aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2020-10-28 18:41:24 +0100
committerThomas Koenig <tkoenig@gcc.gnu.org>2020-10-28 18:41:24 +0100
commitbf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8 (patch)
treee513781ef717465e7db0358e987a5a6cbef5665c /gcc
parent0c261d5b5c931d9e9214d06531bdc7e9e16aeaab (diff)
parent47d13acbda9a5d8eb57ff169ba74857cd54108e4 (diff)
downloadgcc-bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8.zip
gcc-bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8.tar.gz
gcc-bf6dad60c338a42a7fb85f7b2a5870c0fb2e20f8.tar.bz2
Merge branch 'master' into devel/coarray_native.
Merge into devel/coarray_native to prepare for later merging of coarray_native with master.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4712
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in22
-rw-r--r--gcc/ada/ChangeLog2669
-rw-r--r--gcc/ada/Makefile.rtl401
-rw-r--r--gcc/ada/ada_get_targ.adb56
-rw-r--r--gcc/ada/adaint.c117
-rw-r--r--gcc/ada/ali-util.adb2
-rw-r--r--gcc/ada/ali.adb5
-rw-r--r--gcc/ada/alloc.ads14
-rw-r--r--gcc/ada/aspects.adb15
-rw-r--r--gcc/ada/aspects.ads37
-rw-r--r--gcc/ada/atree.adb343
-rw-r--r--gcc/ada/atree.ads67
-rw-r--r--gcc/ada/bindgen.adb31
-rw-r--r--gcc/ada/bindo-writers.adb2
-rw-r--r--gcc/ada/casing.adb14
-rw-r--r--gcc/ada/casing.ads14
-rw-r--r--gcc/ada/checks.adb139
-rw-r--r--gcc/ada/contracts.adb111
-rw-r--r--gcc/ada/contracts.ads14
-rw-r--r--gcc/ada/csets.adb14
-rw-r--r--gcc/ada/csets.ads14
-rw-r--r--gcc/ada/cstand.adb65
-rw-r--r--gcc/ada/debug.adb31
-rw-r--r--gcc/ada/debug.ads14
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_advice.rst10
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst8
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst8
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst31
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst64
-rw-r--r--gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst95
-rw-r--r--gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst2
-rw-r--r--gcc/ada/doc/gnat_rm/the_gnat_library.rst12
-rw-r--r--gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst32
-rw-r--r--gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst13
-rw-r--r--gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst1
-rw-r--r--gcc/ada/einfo.adb94
-rw-r--r--gcc/ada/einfo.ads74
-rw-r--r--gcc/ada/elists.adb72
-rw-r--r--gcc/ada/elists.ads29
-rw-r--r--gcc/ada/env.c54
-rw-r--r--gcc/ada/errout.adb162
-rw-r--r--gcc/ada/errout.ads13
-rw-r--r--gcc/ada/erroutc.adb69
-rw-r--r--gcc/ada/erroutc.ads13
-rw-r--r--gcc/ada/errutil.adb1
-rw-r--r--gcc/ada/exp_aggr.adb426
-rw-r--r--gcc/ada/exp_attr.adb384
-rw-r--r--gcc/ada/exp_ch2.adb94
-rw-r--r--gcc/ada/exp_ch2.ads10
-rw-r--r--gcc/ada/exp_ch3.adb162
-rw-r--r--gcc/ada/exp_ch3.ads5
-rw-r--r--gcc/ada/exp_ch4.adb463
-rw-r--r--gcc/ada/exp_ch5.adb63
-rw-r--r--gcc/ada/exp_ch5.ads1
-rw-r--r--gcc/ada/exp_ch6.adb1236
-rw-r--r--gcc/ada/exp_ch6.ads4
-rw-r--r--gcc/ada/exp_ch7.adb233
-rw-r--r--gcc/ada/exp_ch8.adb4
-rw-r--r--gcc/ada/exp_ch9.adb47
-rw-r--r--gcc/ada/exp_dbug.adb6
-rw-r--r--gcc/ada/exp_dist.adb2
-rw-r--r--gcc/ada/exp_fixd.adb19
-rw-r--r--gcc/ada/exp_imgv.adb87
-rw-r--r--gcc/ada/exp_intr.adb12
-rw-r--r--gcc/ada/exp_pakd.adb24
-rw-r--r--gcc/ada/exp_pakd.ads340
-rw-r--r--gcc/ada/exp_prag.adb1059
-rw-r--r--gcc/ada/exp_prag.ads11
-rw-r--r--gcc/ada/exp_put_image.adb16
-rw-r--r--gcc/ada/exp_spark.adb122
-rw-r--r--gcc/ada/exp_tss.adb8
-rw-r--r--gcc/ada/exp_util.adb575
-rw-r--r--gcc/ada/exp_util.ads42
-rw-r--r--gcc/ada/expander.adb3
-rw-r--r--gcc/ada/fmap.adb4
-rw-r--r--gcc/ada/fname-uf.adb2
-rw-r--r--gcc/ada/fname.adb20
-rw-r--r--gcc/ada/fname.ads14
-rw-r--r--gcc/ada/freeze.adb171
-rw-r--r--gcc/ada/freeze.ads18
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in12
-rw-r--r--gcc/ada/gcc-interface/decl.c74
-rw-r--r--gcc/ada/gcc-interface/system.ads (renamed from gcc/ada/libgnat/system.ads)0
-rw-r--r--gcc/ada/gcc-interface/trans.c19
-rw-r--r--gcc/ada/gcc-interface/utils.c31
-rw-r--r--gcc/ada/get_targ.adb21
-rw-r--r--gcc/ada/get_targ.ads3
-rw-r--r--gcc/ada/ghost.adb135
-rw-r--r--gcc/ada/gnat1drv.adb37
-rw-r--r--gcc/ada/gnat_cuda.adb586
-rw-r--r--gcc/ada/gnat_cuda.ads107
-rw-r--r--gcc/ada/gnat_rm.texi1042
-rw-r--r--gcc/ada/gnat_ugn.texi36
-rw-r--r--gcc/ada/gnatvsn.adb14
-rw-r--r--gcc/ada/gnatvsn.ads14
-rw-r--r--gcc/ada/gsocket.h6
-rw-r--r--gcc/ada/hostparm.ads14
-rw-r--r--gcc/ada/impunit.adb48
-rw-r--r--gcc/ada/indepsw-aix.adb14
-rw-r--r--gcc/ada/indepsw-darwin.adb14
-rw-r--r--gcc/ada/indepsw-gnu.adb14
-rw-r--r--gcc/ada/indepsw.adb14
-rw-r--r--gcc/ada/indepsw.ads14
-rw-r--r--gcc/ada/inline.adb6
-rw-r--r--gcc/ada/krunch.adb41
-rw-r--r--gcc/ada/krunch.ads20
-rw-r--r--gcc/ada/layout.adb50
-rw-r--r--gcc/ada/lib-list.adb14
-rw-r--r--gcc/ada/lib-sort.adb14
-rw-r--r--gcc/ada/lib-writ.adb100
-rw-r--r--gcc/ada/lib-writ.ads6
-rw-r--r--gcc/ada/lib-xref.adb31
-rw-r--r--gcc/ada/lib-xref.ads13
-rw-r--r--gcc/ada/lib.adb14
-rw-r--r--gcc/ada/lib.ads14
-rw-r--r--gcc/ada/libgnarl/s-osinte__aix.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__android.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__darwin.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__gnu.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__hpux-dce.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__lynxos178.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__lynxos178e.ads4
-rw-r--r--gcc/ada/libgnarl/s-osinte__posix.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__qnx.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__rtems.adb5
-rw-r--r--gcc/ada/libgnarl/s-osinte__solaris.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__vxworks.adb4
-rw-r--r--gcc/ada/libgnarl/s-osinte__x32.adb5
-rw-r--r--gcc/ada/libgnarl/s-solita.adb5
-rw-r--r--gcc/ada/libgnarl/s-taasde.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprob.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__dummy.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__hpux-dce.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__linux.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__mingw.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__posix.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__qnx.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__solaris.adb4
-rw-r--r--gcc/ada/libgnarl/s-taprop__vxworks.adb4
-rw-r--r--gcc/ada/libgnarl/s-tarest.adb4
-rw-r--r--gcc/ada/libgnarl/s-tasini.adb5
-rw-r--r--gcc/ada/libgnarl/s-taskin.adb4
-rw-r--r--gcc/ada/libgnarl/s-taspri__dummy.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__hpux-dce.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__lynxos.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__mingw.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__posix-noaltstack.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__posix.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__solaris.ads4
-rw-r--r--gcc/ada/libgnarl/s-taspri__vxworks.ads4
-rw-r--r--gcc/ada/libgnarl/s-tassta.adb4
-rw-r--r--gcc/ada/libgnarl/s-tasuti.adb4
-rw-r--r--gcc/ada/libgnarl/s-tposen.adb4
-rw-r--r--gcc/ada/libgnat/a-cbdlli.adb49
-rw-r--r--gcc/ada/libgnat/a-cbdlli.ads19
-rw-r--r--gcc/ada/libgnat/a-cbhama.adb42
-rw-r--r--gcc/ada/libgnat/a-cbhama.ads13
-rw-r--r--gcc/ada/libgnat/a-cbhase.adb38
-rw-r--r--gcc/ada/libgnat/a-cbhase.ads17
-rw-r--r--gcc/ada/libgnat/a-cbmutr.adb44
-rw-r--r--gcc/ada/libgnat/a-cbmutr.ads10
-rw-r--r--gcc/ada/libgnat/a-cborma.adb42
-rw-r--r--gcc/ada/libgnat/a-cborma.ads13
-rw-r--r--gcc/ada/libgnat/a-cborse.adb37
-rw-r--r--gcc/ada/libgnat/a-cborse.ads13
-rw-r--r--gcc/ada/libgnat/a-cbsyqu.ads2
-rw-r--r--gcc/ada/libgnat/a-cdlili.adb38
-rw-r--r--gcc/ada/libgnat/a-cdlili.ads16
-rw-r--r--gcc/ada/libgnat/a-cfdlli.ads2
-rw-r--r--gcc/ada/libgnat/a-cfinve.adb2
-rw-r--r--gcc/ada/libgnat/a-cgcaso.adb4
-rw-r--r--gcc/ada/libgnat/a-cidlli.adb41
-rw-r--r--gcc/ada/libgnat/a-cidlli.ads16
-rw-r--r--gcc/ada/libgnat/a-cihama.adb42
-rw-r--r--gcc/ada/libgnat/a-cihama.ads12
-rw-r--r--gcc/ada/libgnat/a-cihase.adb37
-rw-r--r--gcc/ada/libgnat/a-cihase.ads12
-rw-r--r--gcc/ada/libgnat/a-cimutr.adb44
-rw-r--r--gcc/ada/libgnat/a-cimutr.ads6
-rw-r--r--gcc/ada/libgnat/a-ciorma.adb31
-rw-r--r--gcc/ada/libgnat/a-ciorma.ads13
-rw-r--r--gcc/ada/libgnat/a-ciormu.adb26
-rw-r--r--gcc/ada/libgnat/a-ciormu.ads6
-rw-r--r--gcc/ada/libgnat/a-ciorse.adb26
-rw-r--r--gcc/ada/libgnat/a-ciorse.ads12
-rw-r--r--gcc/ada/libgnat/a-coboho.adb15
-rw-r--r--gcc/ada/libgnat/a-coboho.ads6
-rw-r--r--gcc/ada/libgnat/a-cobove.adb58
-rw-r--r--gcc/ada/libgnat/a-cobove.ads24
-rw-r--r--gcc/ada/libgnat/a-cofove.adb12
-rw-r--r--gcc/ada/libgnat/a-cogeso.adb4
-rw-r--r--gcc/ada/libgnat/a-cohama.adb42
-rw-r--r--gcc/ada/libgnat/a-cohama.ads12
-rw-r--r--gcc/ada/libgnat/a-cohase.adb37
-rw-r--r--gcc/ada/libgnat/a-cohase.ads12
-rw-r--r--gcc/ada/libgnat/a-cohata.ads2
-rw-r--r--gcc/ada/libgnat/a-coinho.adb17
-rw-r--r--gcc/ada/libgnat/a-coinho.ads7
-rw-r--r--gcc/ada/libgnat/a-coinho__shared.adb17
-rw-r--r--gcc/ada/libgnat/a-coinho__shared.ads7
-rw-r--r--gcc/ada/libgnat/a-coinve.adb61
-rw-r--r--gcc/ada/libgnat/a-coinve.ads20
-rw-r--r--gcc/ada/libgnat/a-comutr.adb44
-rw-r--r--gcc/ada/libgnat/a-comutr.ads6
-rw-r--r--gcc/ada/libgnat/a-convec.adb32
-rw-r--r--gcc/ada/libgnat/a-convec.ads17
-rw-r--r--gcc/ada/libgnat/a-coorma.adb31
-rw-r--r--gcc/ada/libgnat/a-coorma.ads12
-rw-r--r--gcc/ada/libgnat/a-coormu.adb26
-rw-r--r--gcc/ada/libgnat/a-coormu.ads6
-rw-r--r--gcc/ada/libgnat/a-coorse.adb26
-rw-r--r--gcc/ada/libgnat/a-coorse.ads10
-rw-r--r--gcc/ada/libgnat/a-crbltr.ads6
-rw-r--r--gcc/ada/libgnat/a-crdlli.ads2
-rw-r--r--gcc/ada/libgnat/a-direct.adb37
-rw-r--r--gcc/ada/libgnat/a-except.adb19
-rw-r--r--gcc/ada/libgnat/a-except.ads31
-rw-r--r--gcc/ada/libgnat/a-llltio.ads19
-rw-r--r--gcc/ada/libgnat/a-lllwti.ads19
-rw-r--r--gcc/ada/libgnat/a-lllzti.ads19
-rw-r--r--gcc/ada/libgnat/a-nagefl.ads171
-rw-r--r--gcc/ada/libgnat/a-naliop.ads45
-rw-r--r--gcc/ada/libgnat/a-naliop__nolibm.ads43
-rw-r--r--gcc/ada/libgnat/a-nallfl.ads (renamed from gcc/ada/libgnat/a-numaux__darwin.ads)94
-rw-r--r--gcc/ada/libgnat/a-nallfl__wraplf.ads (renamed from gcc/ada/libgnat/a-wtmoau.ads)114
-rw-r--r--gcc/ada/libgnat/a-nalofl.ads (renamed from gcc/ada/libgnat/a-numaux__vxworks.ads)84
-rw-r--r--gcc/ada/libgnat/a-nashfl.ads (renamed from gcc/ada/libgnat/a-ztmoau.ads)115
-rw-r--r--gcc/ada/libgnat/a-nashfl__wraplf.ads87
-rw-r--r--gcc/ada/libgnat/a-nbnbin.adb4
-rw-r--r--gcc/ada/libgnat/a-ngcefu.adb5
-rw-r--r--gcc/ada/libgnat/a-ngcoty.adb34
-rw-r--r--gcc/ada/libgnat/a-ngelfu.adb39
-rw-r--r--gcc/ada/libgnat/a-ngelfu.ads2
-rw-r--r--gcc/ada/libgnat/a-nuauco.ads40
-rw-r--r--gcc/ada/libgnat/a-nuauco__x86.ads39
-rw-r--r--gcc/ada/libgnat/a-nuaufl.ads (renamed from gcc/ada/libgnat/a-numaux__libc-x86.ads)84
-rw-r--r--gcc/ada/libgnat/a-nuaufl__wraplf.ads87
-rw-r--r--gcc/ada/libgnat/a-numaux.ads94
-rw-r--r--gcc/ada/libgnat/a-numaux__darwin.adb211
-rw-r--r--gcc/ada/libgnat/a-numeri.ads5
-rw-r--r--gcc/ada/libgnat/a-stoubu.adb16
-rw-r--r--gcc/ada/libgnat/a-stouut.adb3
-rw-r--r--gcc/ada/libgnat/a-stouut.ads5
-rw-r--r--gcc/ada/libgnat/a-strunb.adb10
-rw-r--r--gcc/ada/libgnat/a-strunb.ads7
-rw-r--r--gcc/ada/libgnat/a-strunb__shared.adb10
-rw-r--r--gcc/ada/libgnat/a-strunb__shared.ads6
-rw-r--r--gcc/ada/libgnat/a-ststun.ads2
-rw-r--r--gcc/ada/libgnat/a-stteou.ads12
-rw-r--r--gcc/ada/libgnat/a-suenco.adb2
-rw-r--r--gcc/ada/libgnat/a-textio.ads5
-rw-r--r--gcc/ada/libgnat/a-tifiio.adb2
-rw-r--r--gcc/ada/libgnat/a-tigeau.adb54
-rw-r--r--gcc/ada/libgnat/a-tigeau.ads6
-rw-r--r--gcc/ada/libgnat/a-tiinau.adb228
-rw-r--r--gcc/ada/libgnat/a-tiinau.ads64
-rw-r--r--gcc/ada/libgnat/a-tiinio.adb60
-rw-r--r--gcc/ada/libgnat/a-tiinio__128.adb182
-rw-r--r--gcc/ada/libgnat/a-timoau.adb305
-rw-r--r--gcc/ada/libgnat/a-timoio.adb79
-rw-r--r--gcc/ada/libgnat/a-timoio__128.adb180
-rw-r--r--gcc/ada/libgnat/a-wtgeau.adb54
-rw-r--r--gcc/ada/libgnat/a-wtgeau.ads8
-rw-r--r--gcc/ada/libgnat/a-wtinau.adb230
-rw-r--r--gcc/ada/libgnat/a-wtinau.ads60
-rw-r--r--gcc/ada/libgnat/a-wtinio.adb52
-rw-r--r--gcc/ada/libgnat/a-wtinio__128.adb199
-rw-r--r--gcc/ada/libgnat/a-wtmoau.adb305
-rw-r--r--gcc/ada/libgnat/a-wtmoio.adb72
-rw-r--r--gcc/ada/libgnat/a-wtmoio__128.adb197
-rw-r--r--gcc/ada/libgnat/a-ztgeau.adb54
-rw-r--r--gcc/ada/libgnat/a-ztgeau.ads8
-rw-r--r--gcc/ada/libgnat/a-ztinau.adb228
-rw-r--r--gcc/ada/libgnat/a-ztinau.ads62
-rw-r--r--gcc/ada/libgnat/a-ztinio.adb52
-rw-r--r--gcc/ada/libgnat/a-ztinio__128.adb199
-rw-r--r--gcc/ada/libgnat/a-ztmoau.adb305
-rw-r--r--gcc/ada/libgnat/a-ztmoio.adb72
-rw-r--r--gcc/ada/libgnat/a-ztmoio__128.adb197
-rw-r--r--gcc/ada/libgnat/g-arrspl.adb26
-rw-r--r--gcc/ada/libgnat/g-arrspl.ads36
-rw-r--r--gcc/ada/libgnat/g-debpoo.ads2
-rw-r--r--gcc/ada/libgnat/g-sechas.ads2
-rw-r--r--gcc/ada/libgnat/g-socket.adb4
-rw-r--r--gcc/ada/libgnat/g-socket.ads12
-rw-r--r--gcc/ada/libgnat/g-socpol.adb430
-rw-r--r--gcc/ada/libgnat/g-socpol.ads216
-rw-r--r--gcc/ada/libgnat/g-socpol__dummy.adb (renamed from gcc/ada/libgnat/a-numaux__dummy.adb)6
-rw-r--r--gcc/ada/libgnat/g-socpol__dummy.ads37
-rw-r--r--gcc/ada/libgnat/g-socthi__mingw.adb21
-rw-r--r--gcc/ada/libgnat/g-sopowa.adb56
-rw-r--r--gcc/ada/libgnat/g-sopowa__mingw.adb92
-rw-r--r--gcc/ada/libgnat/g-sopowa__posix.adb91
-rw-r--r--gcc/ada/libgnat/g-spogwa.adb139
-rw-r--r--gcc/ada/libgnat/g-spogwa.ads50
-rw-r--r--gcc/ada/libgnat/i-cexten__128.ads851
-rw-r--r--gcc/ada/libgnat/interfac.ads2
-rw-r--r--gcc/ada/libgnat/interfac__2020.ads231
-rw-r--r--gcc/ada/libgnat/s-aridou.adb678
-rw-r--r--gcc/ada/libgnat/s-aridou.ads94
-rw-r--r--gcc/ada/libgnat/s-arit128.adb64
-rw-r--r--gcc/ada/libgnat/s-arit128.ads84
-rw-r--r--gcc/ada/libgnat/s-arit64.adb624
-rw-r--r--gcc/ada/libgnat/s-arit64.ads30
-rw-r--r--gcc/ada/libgnat/s-bytswa.ads12
-rw-r--r--gcc/ada/libgnat/s-carsi8.adb7
-rw-r--r--gcc/ada/libgnat/s-carun8.adb7
-rw-r--r--gcc/ada/libgnat/s-casi128.adb116
-rw-r--r--gcc/ada/libgnat/s-casi128.ads52
-rw-r--r--gcc/ada/libgnat/s-caun128.adb115
-rw-r--r--gcc/ada/libgnat/s-caun128.ads52
-rw-r--r--gcc/ada/libgnat/s-dwalin.adb4
-rw-r--r--gcc/ada/libgnat/s-dwalin.ads4
-rw-r--r--gcc/ada/libgnat/s-exnint.adb42
-rw-r--r--gcc/ada/libgnat/s-exnint.ads6
-rw-r--r--gcc/ada/libgnat/s-exnlli.adb46
-rw-r--r--gcc/ada/libgnat/s-exnlli.ads9
-rw-r--r--gcc/ada/libgnat/s-exnllli.ads41
-rw-r--r--gcc/ada/libgnat/s-expint.adb55
-rw-r--r--gcc/ada/libgnat/s-expint.ads9
-rw-r--r--gcc/ada/libgnat/s-explli.adb57
-rw-r--r--gcc/ada/libgnat/s-explli.ads11
-rw-r--r--gcc/ada/libgnat/s-expllli.ads41
-rw-r--r--gcc/ada/libgnat/s-explllu.ads48
-rw-r--r--gcc/ada/libgnat/s-expllu.adb48
-rw-r--r--gcc/ada/libgnat/s-expllu.ads18
-rw-r--r--gcc/ada/libgnat/s-exponn.adb72
-rw-r--r--gcc/ada/libgnat/s-exponn.ads (renamed from gcc/ada/libgnat/a-excpol.adb)26
-rw-r--r--gcc/ada/libgnat/s-expont.adb72
-rw-r--r--gcc/ada/libgnat/s-expont.ads38
-rw-r--r--gcc/ada/libgnat/s-exponu.adb63
-rw-r--r--gcc/ada/libgnat/s-exponu.ads38
-rw-r--r--gcc/ada/libgnat/s-expuns.adb45
-rw-r--r--gcc/ada/libgnat/s-expuns.ads18
-rw-r--r--gcc/ada/libgnat/s-fatgen.adb14
-rw-r--r--gcc/ada/libgnat/s-fileio.adb4
-rw-r--r--gcc/ada/libgnat/s-genbig.adb58
-rw-r--r--gcc/ada/libgnat/s-genbig.ads4
-rw-r--r--gcc/ada/libgnat/s-geveop.adb14
-rw-r--r--gcc/ada/libgnat/s-imageb.adb156
-rw-r--r--gcc/ada/libgnat/s-imageb.ads75
-rw-r--r--gcc/ada/libgnat/s-imagei.adb121
-rw-r--r--gcc/ada/libgnat/s-imagei.ads61
-rw-r--r--gcc/ada/libgnat/s-imageu.adb79
-rw-r--r--gcc/ada/libgnat/s-imageu.ads62
-rw-r--r--gcc/ada/libgnat/s-imagew.adb152
-rw-r--r--gcc/ada/libgnat/s-imagew.ads73
-rw-r--r--gcc/ada/libgnat/s-imenne.adb45
-rw-r--r--gcc/ada/libgnat/s-imgbiu.adb130
-rw-r--r--gcc/ada/libgnat/s-imgbiu.ads34
-rw-r--r--gcc/ada/libgnat/s-imgcha.adb8
-rw-r--r--gcc/ada/libgnat/s-imgdec.adb36
-rw-r--r--gcc/ada/libgnat/s-imgint.adb75
-rw-r--r--gcc/ada/libgnat/s-imgint.ads22
-rw-r--r--gcc/ada/libgnat/s-imgllb.adb133
-rw-r--r--gcc/ada/libgnat/s-imgllb.ads34
-rw-r--r--gcc/ada/libgnat/s-imglli.adb74
-rw-r--r--gcc/ada/libgnat/s-imglli.ads22
-rw-r--r--gcc/ada/libgnat/s-imglllb.ads (renamed from gcc/ada/libgnat/a-timoau.ads)74
-rw-r--r--gcc/ada/libgnat/s-imgllli.ads55
-rw-r--r--gcc/ada/libgnat/s-imglllu.ads58
-rw-r--r--gcc/ada/libgnat/s-imglllw.ads61
-rw-r--r--gcc/ada/libgnat/s-imgllu.adb45
-rw-r--r--gcc/ada/libgnat/s-imgllu.ads29
-rw-r--r--gcc/ada/libgnat/s-imgllw.adb112
-rw-r--r--gcc/ada/libgnat/s-imgllw.ads31
-rw-r--r--gcc/ada/libgnat/s-imgrea.adb40
-rw-r--r--gcc/ada/libgnat/s-imguns.adb45
-rw-r--r--gcc/ada/libgnat/s-imguns.ads28
-rw-r--r--gcc/ada/libgnat/s-imgwiu.adb110
-rw-r--r--gcc/ada/libgnat/s-imgwiu.ads33
-rw-r--r--gcc/ada/libgnat/s-mastop.ads4
-rw-r--r--gcc/ada/libgnat/s-pack100.adb250
-rw-r--r--gcc/ada/libgnat/s-pack100.ads77
-rw-r--r--gcc/ada/libgnat/s-pack101.adb157
-rw-r--r--gcc/ada/libgnat/s-pack101.ads60
-rw-r--r--gcc/ada/libgnat/s-pack102.adb250
-rw-r--r--gcc/ada/libgnat/s-pack102.ads77
-rw-r--r--gcc/ada/libgnat/s-pack103.adb157
-rw-r--r--gcc/ada/libgnat/s-pack103.ads60
-rw-r--r--gcc/ada/libgnat/s-pack104.adb250
-rw-r--r--gcc/ada/libgnat/s-pack104.ads77
-rw-r--r--gcc/ada/libgnat/s-pack105.adb157
-rw-r--r--gcc/ada/libgnat/s-pack105.ads60
-rw-r--r--gcc/ada/libgnat/s-pack106.adb250
-rw-r--r--gcc/ada/libgnat/s-pack106.ads77
-rw-r--r--gcc/ada/libgnat/s-pack107.adb157
-rw-r--r--gcc/ada/libgnat/s-pack107.ads60
-rw-r--r--gcc/ada/libgnat/s-pack108.adb250
-rw-r--r--gcc/ada/libgnat/s-pack108.ads77
-rw-r--r--gcc/ada/libgnat/s-pack109.adb157
-rw-r--r--gcc/ada/libgnat/s-pack109.ads60
-rw-r--r--gcc/ada/libgnat/s-pack110.adb250
-rw-r--r--gcc/ada/libgnat/s-pack110.ads77
-rw-r--r--gcc/ada/libgnat/s-pack111.adb157
-rw-r--r--gcc/ada/libgnat/s-pack111.ads60
-rw-r--r--gcc/ada/libgnat/s-pack112.adb250
-rw-r--r--gcc/ada/libgnat/s-pack112.ads77
-rw-r--r--gcc/ada/libgnat/s-pack113.adb157
-rw-r--r--gcc/ada/libgnat/s-pack113.ads60
-rw-r--r--gcc/ada/libgnat/s-pack114.adb250
-rw-r--r--gcc/ada/libgnat/s-pack114.ads77
-rw-r--r--gcc/ada/libgnat/s-pack115.adb157
-rw-r--r--gcc/ada/libgnat/s-pack115.ads60
-rw-r--r--gcc/ada/libgnat/s-pack116.adb250
-rw-r--r--gcc/ada/libgnat/s-pack116.ads77
-rw-r--r--gcc/ada/libgnat/s-pack117.adb157
-rw-r--r--gcc/ada/libgnat/s-pack117.ads60
-rw-r--r--gcc/ada/libgnat/s-pack118.adb250
-rw-r--r--gcc/ada/libgnat/s-pack118.ads77
-rw-r--r--gcc/ada/libgnat/s-pack119.adb157
-rw-r--r--gcc/ada/libgnat/s-pack119.ads60
-rw-r--r--gcc/ada/libgnat/s-pack120.adb250
-rw-r--r--gcc/ada/libgnat/s-pack120.ads77
-rw-r--r--gcc/ada/libgnat/s-pack121.adb157
-rw-r--r--gcc/ada/libgnat/s-pack121.ads60
-rw-r--r--gcc/ada/libgnat/s-pack122.adb250
-rw-r--r--gcc/ada/libgnat/s-pack122.ads77
-rw-r--r--gcc/ada/libgnat/s-pack123.adb157
-rw-r--r--gcc/ada/libgnat/s-pack123.ads60
-rw-r--r--gcc/ada/libgnat/s-pack124.adb250
-rw-r--r--gcc/ada/libgnat/s-pack124.ads77
-rw-r--r--gcc/ada/libgnat/s-pack125.adb157
-rw-r--r--gcc/ada/libgnat/s-pack125.ads60
-rw-r--r--gcc/ada/libgnat/s-pack126.adb250
-rw-r--r--gcc/ada/libgnat/s-pack126.ads77
-rw-r--r--gcc/ada/libgnat/s-pack127.adb157
-rw-r--r--gcc/ada/libgnat/s-pack127.ads60
-rw-r--r--gcc/ada/libgnat/s-pack65.adb157
-rw-r--r--gcc/ada/libgnat/s-pack65.ads60
-rw-r--r--gcc/ada/libgnat/s-pack66.adb250
-rw-r--r--gcc/ada/libgnat/s-pack66.ads77
-rw-r--r--gcc/ada/libgnat/s-pack67.adb157
-rw-r--r--gcc/ada/libgnat/s-pack67.ads60
-rw-r--r--gcc/ada/libgnat/s-pack68.adb250
-rw-r--r--gcc/ada/libgnat/s-pack68.ads77
-rw-r--r--gcc/ada/libgnat/s-pack69.adb157
-rw-r--r--gcc/ada/libgnat/s-pack69.ads60
-rw-r--r--gcc/ada/libgnat/s-pack70.adb250
-rw-r--r--gcc/ada/libgnat/s-pack70.ads77
-rw-r--r--gcc/ada/libgnat/s-pack71.adb157
-rw-r--r--gcc/ada/libgnat/s-pack71.ads60
-rw-r--r--gcc/ada/libgnat/s-pack72.adb250
-rw-r--r--gcc/ada/libgnat/s-pack72.ads77
-rw-r--r--gcc/ada/libgnat/s-pack73.adb157
-rw-r--r--gcc/ada/libgnat/s-pack73.ads60
-rw-r--r--gcc/ada/libgnat/s-pack74.adb250
-rw-r--r--gcc/ada/libgnat/s-pack74.ads77
-rw-r--r--gcc/ada/libgnat/s-pack75.adb157
-rw-r--r--gcc/ada/libgnat/s-pack75.ads60
-rw-r--r--gcc/ada/libgnat/s-pack76.adb250
-rw-r--r--gcc/ada/libgnat/s-pack76.ads77
-rw-r--r--gcc/ada/libgnat/s-pack77.adb157
-rw-r--r--gcc/ada/libgnat/s-pack77.ads60
-rw-r--r--gcc/ada/libgnat/s-pack78.adb250
-rw-r--r--gcc/ada/libgnat/s-pack78.ads77
-rw-r--r--gcc/ada/libgnat/s-pack79.adb157
-rw-r--r--gcc/ada/libgnat/s-pack79.ads60
-rw-r--r--gcc/ada/libgnat/s-pack80.adb250
-rw-r--r--gcc/ada/libgnat/s-pack80.ads77
-rw-r--r--gcc/ada/libgnat/s-pack81.adb157
-rw-r--r--gcc/ada/libgnat/s-pack81.ads60
-rw-r--r--gcc/ada/libgnat/s-pack82.adb250
-rw-r--r--gcc/ada/libgnat/s-pack82.ads77
-rw-r--r--gcc/ada/libgnat/s-pack83.adb157
-rw-r--r--gcc/ada/libgnat/s-pack83.ads60
-rw-r--r--gcc/ada/libgnat/s-pack84.adb250
-rw-r--r--gcc/ada/libgnat/s-pack84.ads77
-rw-r--r--gcc/ada/libgnat/s-pack85.adb157
-rw-r--r--gcc/ada/libgnat/s-pack85.ads60
-rw-r--r--gcc/ada/libgnat/s-pack86.adb250
-rw-r--r--gcc/ada/libgnat/s-pack86.ads77
-rw-r--r--gcc/ada/libgnat/s-pack87.adb157
-rw-r--r--gcc/ada/libgnat/s-pack87.ads60
-rw-r--r--gcc/ada/libgnat/s-pack88.adb250
-rw-r--r--gcc/ada/libgnat/s-pack88.ads77
-rw-r--r--gcc/ada/libgnat/s-pack89.adb157
-rw-r--r--gcc/ada/libgnat/s-pack89.ads60
-rw-r--r--gcc/ada/libgnat/s-pack90.adb250
-rw-r--r--gcc/ada/libgnat/s-pack90.ads77
-rw-r--r--gcc/ada/libgnat/s-pack91.adb157
-rw-r--r--gcc/ada/libgnat/s-pack91.ads60
-rw-r--r--gcc/ada/libgnat/s-pack92.adb250
-rw-r--r--gcc/ada/libgnat/s-pack92.ads77
-rw-r--r--gcc/ada/libgnat/s-pack93.adb157
-rw-r--r--gcc/ada/libgnat/s-pack93.ads60
-rw-r--r--gcc/ada/libgnat/s-pack94.adb250
-rw-r--r--gcc/ada/libgnat/s-pack94.ads77
-rw-r--r--gcc/ada/libgnat/s-pack95.adb157
-rw-r--r--gcc/ada/libgnat/s-pack95.ads60
-rw-r--r--gcc/ada/libgnat/s-pack96.adb250
-rw-r--r--gcc/ada/libgnat/s-pack96.ads77
-rw-r--r--gcc/ada/libgnat/s-pack97.adb157
-rw-r--r--gcc/ada/libgnat/s-pack97.ads60
-rw-r--r--gcc/ada/libgnat/s-pack98.adb250
-rw-r--r--gcc/ada/libgnat/s-pack98.ads77
-rw-r--r--gcc/ada/libgnat/s-pack99.adb157
-rw-r--r--gcc/ada/libgnat/s-pack99.ads60
-rw-r--r--gcc/ada/libgnat/s-putima.adb26
-rw-r--r--gcc/ada/libgnat/s-putima.ads24
-rw-r--r--gcc/ada/libgnat/s-rannum.adb6
-rw-r--r--gcc/ada/libgnat/s-rannum.ads1
-rw-r--r--gcc/ada/libgnat/s-rident.ads51
-rw-r--r--gcc/ada/libgnat/s-scaval.adb2
-rw-r--r--gcc/ada/libgnat/s-scaval.ads10
-rw-r--r--gcc/ada/libgnat/s-scaval__128.adb342
-rw-r--r--gcc/ada/libgnat/s-scaval__128.ads101
-rw-r--r--gcc/ada/libgnat/s-soflin.adb4
-rw-r--r--gcc/ada/libgnat/s-stalib.adb4
-rw-r--r--gcc/ada/libgnat/s-stalib.ads4
-rw-r--r--gcc/ada/libgnat/s-stchop.adb2
-rw-r--r--gcc/ada/libgnat/s-stchop.ads4
-rw-r--r--gcc/ada/libgnat/s-stchop__limit.ads4
-rw-r--r--gcc/ada/libgnat/s-traceb.ads4
-rw-r--r--gcc/ada/libgnat/s-traent.adb4
-rw-r--r--gcc/ada/libgnat/s-traent.ads4
-rw-r--r--gcc/ada/libgnat/s-trasym.adb4
-rw-r--r--gcc/ada/libgnat/s-trasym.ads4
-rw-r--r--gcc/ada/libgnat/s-trasym__dwarf.adb4
-rw-r--r--gcc/ada/libgnat/s-unstyp.ads35
-rw-r--r--gcc/ada/libgnat/s-valint.adb90
-rw-r--r--gcc/ada/libgnat/s-valint.ads42
-rw-r--r--gcc/ada/libgnat/s-vallli.adb92
-rw-r--r--gcc/ada/libgnat/s-vallli.ads45
-rw-r--r--gcc/ada/libgnat/s-valllli.ads59
-rw-r--r--gcc/ada/libgnat/s-vallllu.ads61
-rw-r--r--gcc/ada/libgnat/s-valllu.adb302
-rw-r--r--gcc/ada/libgnat/s-valllu.ads90
-rw-r--r--gcc/ada/libgnat/s-valuei.adb116
-rw-r--r--gcc/ada/libgnat/s-valuei.ads84
-rw-r--r--gcc/ada/libgnat/s-valueu.adb324
-rw-r--r--gcc/ada/libgnat/s-valueu.ads131
-rw-r--r--gcc/ada/libgnat/s-valuns.adb297
-rw-r--r--gcc/ada/libgnat/s-valuns.ads90
-rw-r--r--gcc/ada/libgnat/s-widint.ads41
-rw-r--r--gcc/ada/libgnat/s-widlli.adb45
-rw-r--r--gcc/ada/libgnat/s-widlli.ads14
-rw-r--r--gcc/ada/libgnat/s-widllli.ads42
-rw-r--r--gcc/ada/libgnat/s-widlllu.ads45
-rw-r--r--gcc/ada/libgnat/s-widllu.adb45
-rw-r--r--gcc/ada/libgnat/s-widllu.ads15
-rw-r--r--gcc/ada/libgnat/s-widthi.adb (renamed from gcc/ada/libgnat/a-excpol__abort.adb)56
-rw-r--r--gcc/ada/libgnat/s-widthi.ads39
-rw-r--r--gcc/ada/libgnat/s-widthu.adb60
-rw-r--r--gcc/ada/libgnat/s-widthu.ads39
-rw-r--r--gcc/ada/libgnat/s-widuns.ads44
-rw-r--r--gcc/ada/libgnat/system-aix.ads6
-rw-r--r--gcc/ada/libgnat/system-darwin-arm.ads6
-rw-r--r--gcc/ada/libgnat/system-darwin-ppc.ads6
-rw-r--r--gcc/ada/libgnat/system-darwin-x86.ads6
-rw-r--r--gcc/ada/libgnat/system-djgpp.ads6
-rw-r--r--gcc/ada/libgnat/system-dragonfly-x86_64.ads6
-rw-r--r--gcc/ada/libgnat/system-freebsd.ads6
-rw-r--r--gcc/ada/libgnat/system-hpux-ia64.ads6
-rw-r--r--gcc/ada/libgnat/system-hpux.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-alpha.ads8
-rw-r--r--gcc/ada/libgnat/system-linux-arm.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-hppa.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-ia64.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-m68k.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-mips.ads8
-rw-r--r--gcc/ada/libgnat/system-linux-ppc.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-riscv.ads8
-rw-r--r--gcc/ada/libgnat/system-linux-s390.ads8
-rw-r--r--gcc/ada/libgnat/system-linux-sh4.ads6
-rw-r--r--gcc/ada/libgnat/system-linux-sparc.ads8
-rw-r--r--gcc/ada/libgnat/system-linux-x86.ads6
-rw-r--r--gcc/ada/libgnat/system-lynxos178-ppc.ads6
-rw-r--r--gcc/ada/libgnat/system-lynxos178-x86.ads6
-rw-r--r--gcc/ada/libgnat/system-mingw.ads6
-rw-r--r--gcc/ada/libgnat/system-qnx-aarch64.ads6
-rw-r--r--gcc/ada/libgnat/system-rtems.ads8
-rw-r--r--gcc/ada/libgnat/system-solaris-sparc.ads6
-rw-r--r--gcc/ada/libgnat/system-solaris-x86.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-arm-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-arm-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-arm.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-e500-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-e500-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-e500-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-e500-vthread.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-ppc-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-ppc-ravenscar.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-ppc-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-ppc-vthread.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-ppc.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-x86-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-x86-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-x86-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-x86-vthread.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks-x86.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-aarch64-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-aarch64.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-arm-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-arm.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-e500-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-e500-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-e500-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-ppc-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-ppc-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-ppc-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-ppc64-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-ppc64-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-x86-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-x86-rtp-smp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-x86-rtp.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-x86_64-kernel.ads6
-rw-r--r--gcc/ada/libgnat/system-vxworks7-x86_64-rtp-smp.ads6
-rw-r--r--gcc/ada/namet-sp.adb14
-rw-r--r--gcc/ada/namet-sp.ads14
-rw-r--r--gcc/ada/namet.adb23
-rw-r--r--gcc/ada/namet.ads18
-rw-r--r--gcc/ada/nlists.adb22
-rw-r--r--gcc/ada/nlists.ads15
-rw-r--r--gcc/ada/opt.adb18
-rw-r--r--gcc/ada/opt.ads34
-rw-r--r--gcc/ada/osint.adb2
-rw-r--r--gcc/ada/output.adb14
-rw-r--r--gcc/ada/output.ads14
-rw-r--r--gcc/ada/par-ch13.adb14
-rw-r--r--gcc/ada/par-ch3.adb2
-rw-r--r--gcc/ada/par-ch4.adb112
-rw-r--r--gcc/ada/par-ch6.adb19
-rw-r--r--gcc/ada/par-prag.adb2
-rw-r--r--gcc/ada/par-tchk.adb14
-rw-r--r--gcc/ada/par.adb9
-rw-r--r--gcc/ada/rident.ads14
-rw-r--r--gcc/ada/rtsfind.adb9
-rw-r--r--gcc/ada/rtsfind.ads861
-rw-r--r--gcc/ada/s-oscons-tmplt.c71
-rw-r--r--gcc/ada/scans.adb14
-rw-r--r--gcc/ada/scans.ads14
-rw-r--r--gcc/ada/scil_ll.adb16
-rw-r--r--gcc/ada/scil_ll.ads14
-rw-r--r--gcc/ada/scng.adb22
-rw-r--r--gcc/ada/sem.adb32
-rw-r--r--gcc/ada/sem.ads7
-rw-r--r--gcc/ada/sem_aggr.adb199
-rw-r--r--gcc/ada/sem_aggr.ads2
-rw-r--r--gcc/ada/sem_attr.adb132
-rw-r--r--gcc/ada/sem_attr.ads10
-rw-r--r--gcc/ada/sem_aux.adb35
-rw-r--r--gcc/ada/sem_aux.ads11
-rw-r--r--gcc/ada/sem_cat.adb1
-rw-r--r--gcc/ada/sem_ch10.adb264
-rw-r--r--gcc/ada/sem_ch10.ads31
-rw-r--r--gcc/ada/sem_ch12.adb263
-rw-r--r--gcc/ada/sem_ch13.adb506
-rw-r--r--gcc/ada/sem_ch13.ads7
-rw-r--r--gcc/ada/sem_ch3.adb268
-rw-r--r--gcc/ada/sem_ch3.ads2
-rw-r--r--gcc/ada/sem_ch4.adb90
-rw-r--r--gcc/ada/sem_ch5.adb4
-rw-r--r--gcc/ada/sem_ch6.adb498
-rw-r--r--gcc/ada/sem_ch7.adb28
-rw-r--r--gcc/ada/sem_ch8.adb343
-rw-r--r--gcc/ada/sem_ch8.ads6
-rw-r--r--gcc/ada/sem_ch9.adb13
-rw-r--r--gcc/ada/sem_disp.adb8
-rw-r--r--gcc/ada/sem_elab.adb7
-rw-r--r--gcc/ada/sem_eval.adb155
-rw-r--r--gcc/ada/sem_intr.adb31
-rw-r--r--gcc/ada/sem_prag.adb848
-rw-r--r--gcc/ada/sem_prag.ads7
-rw-r--r--gcc/ada/sem_res.adb183
-rw-r--r--gcc/ada/sem_scil.adb2
-rw-r--r--gcc/ada/sem_type.adb9
-rw-r--r--gcc/ada/sem_util.adb3099
-rw-r--r--gcc/ada/sem_util.ads286
-rw-r--r--gcc/ada/sem_warn.adb126
-rw-r--r--gcc/ada/set_targ.adb15
-rw-r--r--gcc/ada/set_targ.ads1
-rw-r--r--gcc/ada/sfn_scan.adb14
-rw-r--r--gcc/ada/sinfo.adb23
-rw-r--r--gcc/ada/sinfo.ads23
-rw-r--r--gcc/ada/sinput.adb14
-rw-r--r--gcc/ada/sinput.ads14
-rw-r--r--gcc/ada/snames.adb-tmpl14
-rw-r--r--gcc/ada/snames.ads-tmpl30
-rw-r--r--gcc/ada/sprint.adb15
-rw-r--r--gcc/ada/stand.ads29
-rw-r--r--gcc/ada/stringt.adb14
-rw-r--r--gcc/ada/stringt.ads14
-rw-r--r--gcc/ada/switch-c.adb16
-rw-r--r--gcc/ada/table.adb14
-rw-r--r--gcc/ada/table.ads14
-rw-r--r--gcc/ada/targparm.adb6
-rw-r--r--gcc/ada/targparm.ads3
-rw-r--r--gcc/ada/treepr.adb13
-rw-r--r--gcc/ada/ttypes.ads12
-rw-r--r--gcc/ada/types.adb14
-rw-r--r--gcc/ada/types.ads99
-rw-r--r--gcc/ada/types.h32
-rw-r--r--gcc/ada/uintp.adb24
-rw-r--r--gcc/ada/uintp.ads16
-rw-r--r--gcc/ada/uname.adb14
-rw-r--r--gcc/ada/uname.ads14
-rw-r--r--gcc/ada/urealp.adb14
-rw-r--r--gcc/ada/urealp.ads14
-rw-r--r--gcc/ada/usage.adb5
-rw-r--r--gcc/ada/vast.adb14
-rw-r--r--gcc/ada/vast.ads14
-rw-r--r--gcc/ada/widechar.adb14
-rw-r--r--gcc/ada/widechar.ads14
-rw-r--r--gcc/alias.c8
-rw-r--r--gcc/analyzer/ChangeLog318
-rw-r--r--gcc/analyzer/analysis-plan.cc1
-rw-r--r--gcc/analyzer/analyzer-logging.cc2
-rw-r--r--gcc/analyzer/analyzer.cc5
-rw-r--r--gcc/analyzer/analyzer.h4
-rw-r--r--gcc/analyzer/analyzer.opt16
-rw-r--r--gcc/analyzer/call-string.cc31
-rw-r--r--gcc/analyzer/call-string.h2
-rw-r--r--gcc/analyzer/checker-path.cc1
-rw-r--r--gcc/analyzer/constraint-manager.cc83
-rw-r--r--gcc/analyzer/constraint-manager.h6
-rw-r--r--gcc/analyzer/diagnostic-manager.cc128
-rw-r--r--gcc/analyzer/diagnostic-manager.h4
-rw-r--r--gcc/analyzer/engine.cc412
-rw-r--r--gcc/analyzer/exploded-graph.h28
-rw-r--r--gcc/analyzer/pending-diagnostic.cc1
-rw-r--r--gcc/analyzer/program-point.cc46
-rw-r--r--gcc/analyzer/program-point.h2
-rw-r--r--gcc/analyzer/program-state.cc101
-rw-r--r--gcc/analyzer/program-state.h10
-rw-r--r--gcc/analyzer/region-model-impl-calls.cc15
-rw-r--r--gcc/analyzer/region-model-manager.cc1
-rw-r--r--gcc/analyzer/region-model-reachability.cc20
-rw-r--r--gcc/analyzer/region-model-reachability.h8
-rw-r--r--gcc/analyzer/region-model.cc259
-rw-r--r--gcc/analyzer/region-model.h66
-rw-r--r--gcc/analyzer/region.cc28
-rw-r--r--gcc/analyzer/sm-file.cc1
-rw-r--r--gcc/analyzer/sm-malloc.cc66
-rw-r--r--gcc/analyzer/sm-pattern-test.cc1
-rw-r--r--gcc/analyzer/sm-sensitive.cc1
-rw-r--r--gcc/analyzer/sm-signal.cc7
-rw-r--r--gcc/analyzer/sm-taint.cc1
-rw-r--r--gcc/analyzer/sm.cc36
-rw-r--r--gcc/analyzer/sm.h3
-rw-r--r--gcc/analyzer/state-purge.cc1
-rw-r--r--gcc/analyzer/store.cc119
-rw-r--r--gcc/analyzer/store.h7
-rw-r--r--gcc/analyzer/supergraph.cc112
-rw-r--r--gcc/analyzer/supergraph.h6
-rw-r--r--gcc/analyzer/svalue.cc12
-rw-r--r--gcc/attr-fnspec.h154
-rw-r--r--gcc/attribs.c44
-rw-r--r--gcc/builtin-attrs.def2
-rw-r--r--gcc/builtins.c1005
-rw-r--r--gcc/builtins.def20
-rw-r--r--gcc/builtins.h62
-rw-r--r--gcc/c-family/ChangeLog84
-rw-r--r--gcc/c-family/c-attribs.c63
-rw-r--r--gcc/c-family/c-common.c4
-rw-r--r--gcc/c-family/c-common.def3
-rw-r--r--gcc/c-family/c-common.h1
-rw-r--r--gcc/c-family/c-cppbuiltin.c8
-rw-r--r--gcc/c-family/c-gimplify.c12
-rw-r--r--gcc/c-family/c-pretty-print.c59
-rw-r--r--gcc/c-family/c-warn.c52
-rw-r--r--gcc/c-family/c.opt16
-rw-r--r--gcc/c/ChangeLog14
-rw-r--r--gcc/c/c-decl.c6
-rw-r--r--gcc/c/c-parser.c48
-rw-r--r--gcc/c/c-tree.h1
-rw-r--r--gcc/c/c-typeck.c2
-rw-r--r--gcc/calls.c231
-rw-r--r--gcc/calls.h12
-rw-r--r--gcc/cfg.c114
-rw-r--r--gcc/cfgexpand.c89
-rw-r--r--gcc/cfghooks.c21
-rw-r--r--gcc/cfgloop.c4
-rw-r--r--gcc/cfgloop.h2
-rw-r--r--gcc/cfgloopmanip.c3
-rw-r--r--gcc/cgraph.c207
-rw-r--r--gcc/cgraph.h117
-rw-r--r--gcc/cgraphclones.c172
-rw-r--r--gcc/cgraphunit.c547
-rw-r--r--gcc/collect-utils.c13
-rw-r--r--gcc/collect-utils.h4
-rw-r--r--gcc/collect2.c43
-rw-r--r--gcc/combine.c7
-rw-r--r--gcc/common.opt6
-rw-r--r--gcc/common/config/i386/cpuinfo.h21
-rw-r--r--gcc/common/config/i386/i386-common.c90
-rw-r--r--gcc/common/config/i386/i386-cpuinfo.h5
-rw-r--r--gcc/common/config/i386/i386-isas.h5
-rw-r--r--gcc/common/config/riscv/riscv-common.c91
-rw-r--r--gcc/config.gcc46
-rw-r--r--gcc/config.in26
-rw-r--r--gcc/config/aarch64/aarch64-builtins.c59
-rw-r--r--gcc/config/aarch64/aarch64-cores.def9
-rw-r--r--gcc/config/aarch64/aarch64-option-extensions.def2
-rw-r--r--gcc/config/aarch64/aarch64-protos.h21
-rw-r--r--gcc/config/aarch64/aarch64-simd-builtins.def93
-rw-r--r--gcc/config/aarch64/aarch64-sve.md923
-rw-r--r--gcc/config/aarch64/aarch64-sve2.md73
-rw-r--r--gcc/config/aarch64/aarch64-tune.md2
-rw-r--r--gcc/config/aarch64/aarch64.c243
-rw-r--r--gcc/config/aarch64/aarch64.md102
-rw-r--r--gcc/config/aarch64/arm_neon.h264
-rw-r--r--gcc/config/arm/arm-builtins.c8
-rw-r--r--gcc/config/arm/arm-cpus.in83
-rw-r--r--gcc/config/arm/arm-protos.h3
-rw-r--r--gcc/config/arm/arm-tables.opt15
-rw-r--r--gcc/config/arm/arm-tune.md6
-rw-r--r--gcc/config/arm/arm.c191
-rw-r--r--gcc/config/arm/arm.h41
-rw-r--r--gcc/config/arm/arm.md12
-rw-r--r--gcc/config/arm/arm_mve.h592
-rw-r--r--gcc/config/arm/arm_mve_builtins.def16
-rw-r--r--gcc/config/arm/constraints.md9
-rw-r--r--gcc/config/arm/iterators.md475
-rw-r--r--gcc/config/arm/mve.md967
-rw-r--r--gcc/config/arm/neon.md423
-rw-r--r--gcc/config/arm/parsecpu.awk51
-rw-r--r--gcc/config/arm/unspecs.md800
-rw-r--r--gcc/config/arm/vec-common.md97
-rw-r--r--gcc/config/arm/vfp.md36
-rw-r--r--gcc/config/arm/vxworks.h2
-rw-r--r--gcc/config/bpf/bpf.md20
-rw-r--r--gcc/config/darwin-protos.h2
-rw-r--r--gcc/config/darwin-sections.def15
-rw-r--r--gcc/config/darwin.c142
-rw-r--r--gcc/config/darwin.h3
-rw-r--r--gcc/config/darwin9.h3
-rw-r--r--gcc/config/gcn/gcn.md43
-rw-r--r--gcc/config/gcn/mkoffload.c7
-rw-r--r--gcc/config/i386/adxintrin.h4
-rw-r--r--gcc/config/i386/amxbf16intrin.h52
-rw-r--r--gcc/config/i386/amxint8intrin.h61
-rw-r--r--gcc/config/i386/amxtileintrin.h98
-rw-r--r--gcc/config/i386/avx2intrin.h3
-rw-r--r--gcc/config/i386/avx512bwintrin.h32
-rw-r--r--gcc/config/i386/avx512dqintrin.h186
-rw-r--r--gcc/config/i386/avx512erintrin.h148
-rw-r--r--gcc/config/i386/avx512fintrin.h163
-rw-r--r--gcc/config/i386/avx512vlbwintrin.h65
-rw-r--r--gcc/config/i386/avx512vlintrin.h85
-rw-r--r--gcc/config/i386/avx512vp2intersectintrin.h23
-rw-r--r--gcc/config/i386/avx512vp2intersectvlintrin.h23
-rw-r--r--gcc/config/i386/avxintrin.h7
-rw-r--r--gcc/config/i386/bmi2intrin.h4
-rw-r--r--gcc/config/i386/bmiintrin.h4
-rw-r--r--gcc/config/i386/cetintrin.h4
-rw-r--r--gcc/config/i386/cldemoteintrin.h4
-rw-r--r--gcc/config/i386/clflushoptintrin.h4
-rw-r--r--gcc/config/i386/clwbintrin.h4
-rw-r--r--gcc/config/i386/constraints.md4
-rw-r--r--gcc/config/i386/cpuid.h5
-rw-r--r--gcc/config/i386/emmintrin.h25
-rw-r--r--gcc/config/i386/enqcmdintrin.h10
-rw-r--r--gcc/config/i386/fxsrintrin.h4
-rw-r--r--gcc/config/i386/hresetintrin.h48
-rw-r--r--gcc/config/i386/i386-builtin-types.def5
-rw-r--r--gcc/config/i386/i386-builtin.def18
-rw-r--r--gcc/config/i386/i386-builtins.c5
-rw-r--r--gcc/config/i386/i386-builtins.h1
-rw-r--r--gcc/config/i386/i386-c.c14
-rw-r--r--gcc/config/i386/i386-expand.c36
-rw-r--r--gcc/config/i386/i386-options.c56
-rw-r--r--gcc/config/i386/i386.c107
-rw-r--r--gcc/config/i386/i386.h36
-rw-r--r--gcc/config/i386/i386.md81
-rw-r--r--gcc/config/i386/i386.opt22
-rw-r--r--gcc/config/i386/ia32intrin.h4
-rw-r--r--gcc/config/i386/immintrin.h207
-rw-r--r--gcc/config/i386/intelmic-mkoffload.c12
-rw-r--r--gcc/config/i386/lwpintrin.h4
-rw-r--r--gcc/config/i386/lzcntintrin.h4
-rw-r--r--gcc/config/i386/mingw-w64.h6
-rw-r--r--gcc/config/i386/mmintrin.h6
-rw-r--r--gcc/config/i386/movdirintrin.h4
-rw-r--r--gcc/config/i386/pconfigintrin.h27
-rw-r--r--gcc/config/i386/pkuintrin.h4
-rw-r--r--gcc/config/i386/predicates.md13
-rw-r--r--gcc/config/i386/rdseedintrin.h4
-rw-r--r--gcc/config/i386/rtmintrin.h4
-rw-r--r--gcc/config/i386/serializeintrin.h4
-rw-r--r--gcc/config/i386/sse.md401
-rw-r--r--gcc/config/i386/subst.md4
-rw-r--r--gcc/config/i386/t-i3863
-rw-r--r--gcc/config/i386/t-rtems8
-rw-r--r--gcc/config/i386/tbmintrin.h4
-rw-r--r--gcc/config/i386/tsxldtrkintrin.h27
-rw-r--r--gcc/config/i386/uintrintrin.h87
-rw-r--r--gcc/config/i386/waitpkgintrin.h4
-rw-r--r--gcc/config/i386/wbnoinvdintrin.h27
-rw-r--r--gcc/config/i386/x86gprintrin.h256
-rw-r--r--gcc/config/i386/x86intrin.h12
-rw-r--r--gcc/config/i386/xsavecintrin.h4
-rw-r--r--gcc/config/i386/xsaveintrin.h4
-rw-r--r--gcc/config/i386/xsaveoptintrin.h4
-rw-r--r--gcc/config/i386/xsavesintrin.h4
-rw-r--r--gcc/config/i386/xtestintrin.h4
-rw-r--r--gcc/config/linux-protos.h2
-rw-r--r--gcc/config/linux.c3
-rw-r--r--gcc/config/msp430/msp430.md4
-rw-r--r--gcc/config/nvptx/mkoffload.c7
-rw-r--r--gcc/config/nvptx/nvptx.c128
-rw-r--r--gcc/config/nvptx/nvptx.h5
-rw-r--r--gcc/config/nvptx/nvptx.md28
-rw-r--r--gcc/config/nvptx/nvptx.opt13
-rw-r--r--gcc/config/pa/pa-hpux11.h5
-rw-r--r--gcc/config/pa/pa32-linux.h5
-rw-r--r--gcc/config/pa/pa64-hpux.h12
-rwxr-xr-xgcc/config/riscv/multilib-generator133
-rw-r--r--gcc/config/riscv/riscv-c.c9
-rw-r--r--gcc/config/riscv/riscv-cores.def49
-rw-r--r--gcc/config/riscv/riscv-protos.h14
-rw-r--r--gcc/config/riscv/riscv.c97
-rw-r--r--gcc/config/riscv/riscv.h25
-rw-r--r--gcc/config/riscv/riscv.opt4
-rw-r--r--gcc/config/riscv/t-riscv2
-rw-r--r--gcc/config/rs6000/altivec.h3
-rw-r--r--gcc/config/rs6000/freebsd64.h60
-rw-r--r--gcc/config/rs6000/linux64.h85
-rw-r--r--gcc/config/rs6000/ppc-asm.h9
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def44
-rw-r--r--gcc/config/rs6000/rs6000-c.c3
-rw-r--r--gcc/config/rs6000/rs6000-call.c220
-rw-r--r--gcc/config/rs6000/rs6000-internal.h2
-rw-r--r--gcc/config/rs6000/rs6000-logue.c15
-rw-r--r--gcc/config/rs6000/rs6000.c131
-rw-r--r--gcc/config/rs6000/rs6000.md105
-rw-r--r--gcc/config/rs6000/smmintrin.h30
-rw-r--r--gcc/config/rs6000/vsx.md61
-rw-r--r--gcc/config/rs6000/vxworks.h290
-rw-r--r--gcc/config/s390/s390-protos.h1
-rw-r--r--gcc/config/s390/s390.c70
-rw-r--r--gcc/config/s390/s390.md54
-rw-r--r--gcc/config/s390/vector.md52
-rw-r--r--gcc/config/t-vxworks2
-rw-r--r--gcc/config/vx-common.h2
-rw-r--r--gcc/config/vxworks.c6
-rw-r--r--gcc/config/vxworks.h11
-rw-r--r--gcc/config/vxworks/_vxworks-versions.h20
-rwxr-xr-xgcc/configure425
-rw-r--r--gcc/configure.ac254
-rw-r--r--gcc/convert.c8
-rw-r--r--gcc/coretypes.h8
-rw-r--r--gcc/coverage.c8
-rw-r--r--gcc/cp/ChangeLog564
-rw-r--r--gcc/cp/call.c63
-rw-r--r--gcc/cp/class.c264
-rw-r--r--gcc/cp/constexpr.c45
-rw-r--r--gcc/cp/constraint.cc13
-rw-r--r--gcc/cp/coroutines.cc27
-rw-r--r--gcc/cp/cp-gimplify.c28
-rw-r--r--gcc/cp/cp-tree.h92
-rw-r--r--gcc/cp/cxx-pretty-print.c35
-rw-r--r--gcc/cp/decl.c523
-rw-r--r--gcc/cp/decl2.c27
-rw-r--r--gcc/cp/error.c65
-rw-r--r--gcc/cp/friend.c27
-rw-r--r--gcc/cp/init.c346
-rw-r--r--gcc/cp/lambda.c14
-rw-r--r--gcc/cp/method.c36
-rw-r--r--gcc/cp/name-lookup.c1052
-rw-r--r--gcc/cp/name-lookup.h60
-rw-r--r--gcc/cp/parser.c134
-rw-r--r--gcc/cp/pt.c351
-rw-r--r--gcc/cp/ptree.c6
-rw-r--r--gcc/cp/rtti.c11
-rw-r--r--gcc/cp/semantics.c5
-rw-r--r--gcc/cp/tree.c37
-rw-r--r--gcc/cp/typeck.c12
-rw-r--r--gcc/d/ChangeLog19
-rw-r--r--gcc/d/d-target.cc6
-rw-r--r--gcc/d/decl.cc10
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/declaration.c7
-rw-r--r--gcc/d/dmd/mtype.c8
-rw-r--r--gcc/data-streamer-in.c11
-rw-r--r--gcc/data-streamer-out.c9
-rw-r--r--gcc/data-streamer.h2
-rw-r--r--gcc/dbgcnt.c30
-rw-r--r--gcc/dbgcnt.def1
-rw-r--r--gcc/dfp.c2
-rw-r--r--gcc/doc/analyzer.texi6
-rw-r--r--gcc/doc/extend.texi76
-rw-r--r--gcc/doc/invoke.texi263
-rw-r--r--gcc/doc/sourcebuild.texi12
-rw-r--r--gcc/doc/tm.texi7
-rw-r--r--gcc/dwarf2out.c121
-rw-r--r--gcc/expr.c20
-rw-r--r--gcc/flag-types.h13
-rw-r--r--gcc/fold-const.c2
-rw-r--r--gcc/fortran/ChangeLog176
-rw-r--r--gcc/fortran/class.c2
-rw-r--r--gcc/fortran/decl.c6
-rw-r--r--gcc/fortran/expr.c28
-rw-r--r--gcc/fortran/f95-lang.c4
-rw-r--r--gcc/fortran/gfortran.h16
-rw-r--r--gcc/fortran/intrinsic.c42
-rw-r--r--gcc/fortran/iresolve.c20
-rw-r--r--gcc/fortran/match.c5
-rw-r--r--gcc/fortran/match.h6
-rw-r--r--gcc/fortran/openmp.c29
-rw-r--r--gcc/fortran/resolve.c7
-rw-r--r--gcc/fortran/scanner.c4
-rw-r--r--gcc/fortran/symbol.c25
-rw-r--r--gcc/fortran/trans-array.c15
-rw-r--r--gcc/fortran/trans-decl.c190
-rw-r--r--gcc/fortran/trans-expr.c37
-rw-r--r--gcc/fortran/trans-intrinsic.c299
-rw-r--r--gcc/fortran/trans-io.c74
-rw-r--r--gcc/fortran/trans-openmp.c30
-rw-r--r--gcc/fortran/trans-stmt.c49
-rw-r--r--gcc/fortran/trans-types.c41
-rw-r--r--gcc/fortran/trans.c23
-rw-r--r--gcc/fortran/trans.h4
-rw-r--r--gcc/function.c2
-rw-r--r--gcc/gcc.c102
-rw-r--r--gcc/gcov.c8
-rw-r--r--gcc/gengtype.c3
-rw-r--r--gcc/ggc-common.c28
-rw-r--r--gcc/ggc-page.c17
-rw-r--r--gcc/gimple-array-bounds.cc25
-rw-r--r--gcc/gimple-isel.cc90
-rw-r--r--gcc/gimple-loop-versioning.cc8
-rw-r--r--gcc/gimple-range-cache.cc877
-rw-r--r--gcc/gimple-range-cache.h120
-rw-r--r--gcc/gimple-range-edge.cc197
-rw-r--r--gcc/gimple-range-edge.h55
-rw-r--r--gcc/gimple-range-gori.cc1325
-rw-r--r--gcc/gimple-range-gori.h138
-rw-r--r--gcc/gimple-range.cc1348
-rw-r--r--gcc/gimple-range.h184
-rw-r--r--gcc/gimple-ssa-evrp-analyze.c31
-rw-r--r--gcc/gimple-ssa-evrp-analyze.h21
-rw-r--r--gcc/gimple-ssa-evrp.c256
-rw-r--r--gcc/gimple-ssa-sprintf.c126
-rw-r--r--gcc/gimple-ssa-store-merging.c2
-rw-r--r--gcc/gimple-ssa-warn-alloca.c351
-rw-r--r--gcc/gimple-ssa-warn-restrict.c99
-rw-r--r--gcc/gimple-ssa-warn-restrict.h3
-rw-r--r--gcc/gimple.c69
-rw-r--r--gcc/gimple.h26
-rw-r--r--gcc/gimplify.c20
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc132
-rw-r--r--gcc/go/gofrontend/expressions.h8
-rw-r--r--gcc/go/gofrontend/gogo.cc6
-rw-r--r--gcc/go/gofrontend/import.cc17
-rw-r--r--gcc/go/gofrontend/import.h8
-rw-r--r--gcc/go/gofrontend/statements.cc27
-rw-r--r--gcc/go/gofrontend/statements.h4
-rw-r--r--gcc/go/gofrontend/types.cc16
-rw-r--r--gcc/hash-table.h2
-rw-r--r--gcc/internal-fn.c113
-rw-r--r--gcc/internal-fn.def15
-rw-r--r--gcc/ipa-comdats.c4
-rw-r--r--gcc/ipa-cp.c331
-rw-r--r--gcc/ipa-fnsummary.c994
-rw-r--r--gcc/ipa-fnsummary.h127
-rw-r--r--gcc/ipa-icf-gimple.c1
-rw-r--r--gcc/ipa-icf.c36
-rw-r--r--gcc/ipa-inline-analysis.c92
-rw-r--r--gcc/ipa-inline-transform.c36
-rw-r--r--gcc/ipa-inline.c75
-rw-r--r--gcc/ipa-modref-tree.c80
-rw-r--r--gcc/ipa-modref-tree.h416
-rw-r--r--gcc/ipa-modref.c1647
-rw-r--r--gcc/ipa-modref.h11
-rw-r--r--gcc/ipa-param-manipulation.c7
-rw-r--r--gcc/ipa-polymorphic-call.c14
-rw-r--r--gcc/ipa-predicate.c2
-rw-r--r--gcc/ipa-predicate.h13
-rw-r--r--gcc/ipa-prop.c97
-rw-r--r--gcc/ipa-prop.h114
-rw-r--r--gcc/ipa-pure-const.c18
-rw-r--r--gcc/ipa-sra.c2
-rw-r--r--gcc/ipa-utils.c6
-rw-r--r--gcc/ipa-visibility.c6
-rw-r--r--gcc/ipa.c48
-rw-r--r--gcc/ira-build.c12
-rw-r--r--gcc/ira-color.c4
-rw-r--r--gcc/ira-costs.c12
-rw-r--r--gcc/ira.c2
-rw-r--r--gcc/loop-unroll.c3
-rw-r--r--gcc/lra-constraints.c35
-rw-r--r--gcc/lto-cgraph.c66
-rw-r--r--gcc/lto-streamer-in.c4
-rw-r--r--gcc/lto-wrapper.c47
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto-partition.c2
-rw-r--r--gcc/match.pd32
-rw-r--r--gcc/objc/ChangeLog94
-rw-r--r--gcc/objc/objc-gnu-runtime-abi-01.c32
-rw-r--r--gcc/objc/objc-next-runtime-abi-02.c474
-rw-r--r--gcc/objc/objc-runtime-shared-support.c9
-rw-r--r--gcc/objcp/ChangeLog11
-rw-r--r--gcc/objcp/objcp-decl.c4
-rw-r--r--gcc/omp-expand.c627
-rw-r--r--gcc/omp-low.c68
-rw-r--r--gcc/omp-offload.c53
-rw-r--r--gcc/optabs.c35
-rw-r--r--gcc/optabs.h4
-rw-r--r--gcc/optc-save-gen.awk126
-rw-r--r--gcc/opth-gen.awk20
-rw-r--r--gcc/opts-common.c1
-rw-r--r--gcc/opts-global.c4
-rw-r--r--gcc/opts.c12
-rw-r--r--gcc/params.opt51
-rw-r--r--gcc/passes.c8
-rw-r--r--gcc/passes.def1
-rw-r--r--gcc/predict.c9
-rw-r--r--gcc/print-tree.c2
-rw-r--r--gcc/profile-count.c4
-rw-r--r--gcc/profile.c6
-rw-r--r--gcc/range-op.cc253
-rw-r--r--gcc/recog.c7
-rw-r--r--gcc/regs.h3
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/selftest-run-tests.c1
-rw-r--r--gcc/selftest.h1
-rw-r--r--gcc/simplify-rtx.c41
-rw-r--r--gcc/stor-layout.c17
-rw-r--r--gcc/symtab-thunks.cc639
-rw-r--r--gcc/symtab-thunks.h166
-rw-r--r--gcc/symtab.c2
-rw-r--r--gcc/system.h3
-rw-r--r--gcc/target.def7
-rw-r--r--gcc/targhooks.c9
-rw-r--r--gcc/targhooks.h6
-rw-r--r--gcc/testsuite/ChangeLog2338
-rwxr-xr-xgcc/testsuite/ada/acats/run_all.sh19
-rw-r--r--gcc/testsuite/ada/acats/support/macro.dfs4
-rw-r--r--gcc/testsuite/c-c++-common/Wduplicated-branches-15.c32
-rw-r--r--gcc/testsuite/c-c++-common/Wrestrict.c13
-rw-r--r--gcc/testsuite/c-c++-common/Wsizeof-array-div1.c56
-rw-r--r--gcc/testsuite/c-c++-common/Wsizeof-pointer-div.c2
-rw-r--r--gcc/testsuite/c-c++-common/builtin-has-attribute-3.c2
-rw-r--r--gcc/testsuite/c-c++-common/cpp/endif.c (renamed from gcc/testsuite/gcc.dg/cpp/endif.c)0
-rw-r--r--gcc/testsuite/c-c++-common/cpp/endif.h (renamed from gcc/testsuite/gcc.dg/cpp/endif.h)0
-rw-r--r--gcc/testsuite/c-c++-common/cpp/eof-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/cpp/eof-3.c2
-rw-r--r--gcc/testsuite/c-c++-common/cpp/pr97471.c10
-rw-r--r--gcc/testsuite/c-c++-common/goacc/declare-pr90861.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr97289.c14
-rw-r--r--gcc/testsuite/c-c++-common/ident-0b.c1
-rw-r--r--gcc/testsuite/c-c++-common/ident-1b.c1
-rw-r--r--gcc/testsuite/c-c++-common/ident-2b.c1
-rw-r--r--gcc/testsuite/c-c++-common/pr97164.c15
-rw-r--r--gcc/testsuite/g++.dg/analyzer/analyzer.exp2
-rw-r--r--gcc/testsuite/g++.dg/analyzer/ctor-dtor-1.C26
-rw-r--r--gcc/testsuite/g++.dg/analyzer/dyncast-1.C21
-rw-r--r--gcc/testsuite/g++.dg/analyzer/placement-new.C26
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr97116.C39
-rw-r--r--gcc/testsuite/g++.dg/analyzer/pr97489.C6
-rw-r--r--gcc/testsuite/g++.dg/analyzer/vfunc-1.C14
-rw-r--r--gcc/testsuite/g++.dg/asan/asan_test.C2
-rw-r--r--gcc/testsuite/g++.dg/asan/pr97145.C7
-rw-r--r--gcc/testsuite/g++.dg/asan/pr97414.C19
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter2_y.C6
-rw-r--r--gcc/testsuite/g++.dg/concepts/diagnostic15.C16
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr97438.C30
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-pr96805.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-96241.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-96652.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv14.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic11.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/static_assert16.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-96241.C47
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/new1.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction73.C41
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction74.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-96575.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-class2.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-defarg2.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/consteval18.C26
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-init19.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-init20.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C73
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/fn-template21.C24
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/fn-template22.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/typename18.C21
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/align-1.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/align-2.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/align-3.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/align-4.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/align-5.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/align-6.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-1.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-2.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-3.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C10
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/inline-var-2.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C12
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/noreturn-function.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C4
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C4
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/ref-3.C10
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/ref-4.C6
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C4
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C4
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C31
-rw-r--r--gcc/testsuite/g++.dg/diagnostic/ptrtomem2.C14
-rw-r--r--gcc/testsuite/g++.dg/ext/timevar1.C4
-rw-r--r--gcc/testsuite/g++.dg/ext/timevar2.C4
-rw-r--r--gcc/testsuite/g++.dg/gcov/pr97069.C20
-rw-r--r--gcc/testsuite/g++.dg/inherit/pr97268.C60
-rw-r--r--gcc/testsuite/g++.dg/init/pr42844.C2
-rw-r--r--gcc/testsuite/g++.dg/init/strlen.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/extern-redecl1.C10
-rw-r--r--gcc/testsuite/g++.dg/lookup/extern-redecl2.C18
-rw-r--r--gcc/testsuite/g++.dg/lookup/koenig15.C6
-rw-r--r--gcc/testsuite/g++.dg/lookup/local-extern.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/pr95677.C19
-rw-r--r--gcc/testsuite/g++.dg/no-stack-protector-attr-2.C7
-rw-r--r--gcc/testsuite/g++.dg/no-stack-protector-attr-3.C23
-rw-r--r--gcc/testsuite/g++.dg/no-stack-protector-attr.C16
-rw-r--r--gcc/testsuite/g++.dg/opt/pr97315-1.C27
-rw-r--r--gcc/testsuite/g++.dg/other/i386-2.C3
-rw-r--r--gcc/testsuite/g++.dg/other/i386-3.C3
-rw-r--r--gcc/testsuite/g++.dg/other/nested-extern-1.C16
-rw-r--r--gcc/testsuite/g++.dg/other/nested-extern-1.cc3
-rw-r--r--gcc/testsuite/g++.dg/other/nested-extern-2.C27
-rw-r--r--gcc/testsuite/g++.dg/other/nested-extern-2.cc3
-rw-r--r--gcc/testsuite/g++.dg/other/nested-extern.cc1
-rw-r--r--gcc/testsuite/g++.dg/parse/pr96258.C5
-rw-r--r--gcc/testsuite/g++.dg/pr94314.C2
-rw-r--r--gcc/testsuite/g++.dg/pr97538.C27
-rw-r--r--gcc/testsuite/g++.dg/spellcheck-inttypes.C3
-rw-r--r--gcc/testsuite/g++.dg/spellcheck-typenames.C4
-rw-r--r--gcc/testsuite/g++.dg/template/alignof3.C13
-rw-r--r--gcc/testsuite/g++.dg/template/local-fn3.C17
-rw-r--r--gcc/testsuite/g++.dg/template/local-fn4.C21
-rw-r--r--gcc/testsuite/g++.dg/template/local-var1.C20
-rw-r--r--gcc/testsuite/g++.dg/template/pr97460.C9
-rw-r--r--gcc/testsuite/g++.dg/template/scope5.C8
-rw-r--r--gcc/testsuite/g++.dg/template/shadow3.C4
-rw-r--r--gcc/testsuite/g++.dg/torture/pr92421.C4
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr96979.C48
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pta-delete-1.C24
-rw-r--r--gcc/testsuite/g++.dg/vect/pr97255.cc44
-rw-r--r--gcc/testsuite/g++.dg/vect/pr97347.cc41
-rw-r--r--gcc/testsuite/g++.dg/vect/slp-pr50413.cc3
-rw-r--r--gcc/testsuite/g++.dg/vect/slp-pr50819.cc2
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-10.C64
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-11.C66
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-12.C66
-rw-r--r--gcc/testsuite/g++.dg/warn/Warray-bounds-13.C70
-rw-r--r--gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.C88
-rw-r--r--gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.h4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported2.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported3.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wplacement-new-size-1.C14
-rw-r--r--gcc/testsuite/g++.dg/warn/Wplacement-new-size-2.C18
-rw-r--r--gcc/testsuite/g++.dg/warn/Wplacement-new-size-6.C25
-rw-r--r--gcc/testsuite/g++.dg/warn/Wplacement-new-size-7.C82
-rw-r--r--gcc/testsuite/g++.dg/warn/Wplacement-new-size-8.C147
-rw-r--r--gcc/testsuite/g++.dg/warn/Wrange-loop-construct.C207
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsizeof-array-div1.C37
-rw-r--r--gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/missed-error2.C7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash3.C5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/friend34.C5
-rw-r--r--gcc/testsuite/g++.target/riscv/pr96759.C8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr42717.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr61684.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr97243.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/981019-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr20601-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr52129.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr59221.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr68185.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr97073.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr97325.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr97386-1.c16
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr97386-2.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr97404.c28
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/Walloca-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-58.c14
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-63.c3
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-66.c3
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-68.c118
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter-6.c9
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter-7.c25
-rw-r--r--gcc/testsuite/gcc.dg/Warray-parameter-8.c36
-rw-r--r--gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull-4.c173
-rw-r--r--gcc/testsuite/gcc.dg/Wnonnull-5.c53
-rw-r--r--gcc/testsuite/gcc.dg/Wrestrict-22.c9
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-23.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-34.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-37.c20
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-41.c120
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-43.c9
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-44.c129
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-44.s271
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-45.c255
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-46.c97
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-47.c69
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-49.c146
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-50.c125
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-51.c34
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-52.c62
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-53.c116
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-54.c103
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-55.c97
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overread-5.c76
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-larger-than-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-5.c22
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-6.c34
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-7.c36
-rw-r--r--gcc/testsuite/gcc.dg/Wvla-parameter-8.c86
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/analyzer.exp2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/callbacks-1.c25
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/callbacks-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/callbacks-3.c19
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-21.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/feasibility-2.c20
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c79
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c45
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c391
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr96646.c24
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr96841.c23
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97130.c10
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97233.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97514.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/signal-registration-loc.c23
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/test-setjmp.h15
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/write-to-const-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-1.c58
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr80166.c1
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr97294.c41
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c1
-rw-r--r--gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/atomic/stdatomic-vm.c1
-rw-r--r--gcc/testsuite/gcc.dg/attr-access-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size-11.c4
-rw-r--r--gcc/testsuite/gcc.dg/darwin-sections.c42
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/align-as-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/lang-c89.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-attribute.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-keyword.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c2
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr97439.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/simd-2.c51
-rw-r--r--gcc/testsuite/gcc.dg/gomp/simd-3.c51
-rw-r--r--gcc/testsuite/gcc.dg/independent-cloneids-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-5.c36
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-14.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-sra-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-loophint-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modref-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/ipa/remref-2a.c2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/symver1.c1
-rw-r--r--gcc/testsuite/gcc.dg/lto/modref-1_0.c14
-rw-r--r--gcc/testsuite/gcc.dg/lto/modref-1_1.c13
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-default.c142
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-plain.c42
-rw-r--r--gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp2
-rw-r--r--gcc/testsuite/gcc.dg/pr36093.c (renamed from gcc/testsuite/gcc.c-torture/execute/pr36093.c)3
-rw-r--r--gcc/testsuite/gcc.dg/pr43783.c (renamed from gcc/testsuite/gcc.c-torture/execute/pr43783.c)4
-rw-r--r--gcc/testsuite/gcc.dg/pr51683.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr66552.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr68671.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr81192.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr87314-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr94600-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr94600-3.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr96453.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr96466.c19
-rw-r--r--gcc/testsuite/gcc.dg/pr97192.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr97238.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr97315-2.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97317.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97322.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr97357.c39
-rw-r--r--gcc/testsuite/gcc.dg/pr97359.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97360-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr97371.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr97378.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr97381.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr97396.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr97462.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr97463.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr97467.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr97488.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97501.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr97502.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr97515.c21
-rw-r--r--gcc/testsuite/gcc.dg/pr97520.c11
-rw-r--r--gcc/testsuite/gcc.dg/spellcheck-inttypes.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/thr-cse-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr97135.c21
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr97330-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr97330-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr96394.c64
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-1.c45
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-2.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-3.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-4.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr84512.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr94801.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr97456.c40
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr97503.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c27
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-14.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-17.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-18.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-19.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-20.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-21.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-22.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-23.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-24.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-25.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-26.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-27.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-28.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-29.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-30.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-31.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-34.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-35.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-36.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-38.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-45.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-46.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-48.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-49.c28
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-50.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-51.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-52.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-53.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-8a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-8b.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-9.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-div-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-phis-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pow-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr58135.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c5
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr95839-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr95839.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr95866.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr37027.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr65947-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr67790.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr92324-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr92558.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr95495.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97085.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97139.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97173.c19
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97236.c43
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97241.c19
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97428.c44
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-reduc-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-103.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-91.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-in-order-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-17.c304
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-18.c40
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-19.c40
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-simd-20.c43
-rw-r--r--gcc/testsuite/gcc.misc-tests/outputs.exp24
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h8
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c19
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c3
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c3
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c3
-rw-r--r--gcc/testsuite/gcc.target/aarch64/extend-syntax.c13
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movtf_1.c87
-rw-r--r--gcc/testsuite/gcc.target/aarch64/movti_1.c87
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr96313.c8
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr96757.c23
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr96968.c28
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr97150.c14
-rw-r--r--gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/pr97349.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c44
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c50
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c29
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c54
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c13
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c13
-rw-r--r--gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/stack-protector-3.c45
-rw-r--r--gcc/testsuite/gcc.target/aarch64/stack-protector-4.c6
-rw-r--r--gcc/testsuite/gcc.target/aarch64/stack-protector-5.c23
-rw-r--r--gcc/testsuite/gcc.target/aarch64/stack-protector-6.c8
-rw-r--r--gcc/testsuite/gcc.target/aarch64/stack-protector-7.c25
-rw-r--r--gcc/testsuite/gcc.target/aarch64/subsp.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr96915.c11
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr97079.c22
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c418
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c420
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c426
-rw-r--r--gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-2.c28
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-hard.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-softfp.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-hard.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-softfp.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c15
-rw-r--r--gcc/testsuite/gcc.target/arm/csinc-1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/csinv-1.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/csneg.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/lob1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/lob2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/lob3.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/lob4.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/lob5.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/lob6.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/multilib.exp16
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c5
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fp_vaddq_n.c47
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vaddq_n.c31
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vcvtnq_u32_f32.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u32.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s16.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s32.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s8.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u16.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u32.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u8.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u16.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u32.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u16.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u32.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u8.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c23
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c23
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c23
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u16.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u32.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u8.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u16.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u32.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u8.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16-1.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32-1.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f16-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f32-1.c12
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f16-1.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f32-1.c13
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-compare-1.c84
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-compare-2.c45
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-compare-3.c44
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-compare-4.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-compare-5.c37
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-vcond-gt.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-vcond-ltgt.c3
-rw-r--r--gcc/testsuite/gcc.target/arm/neon-vcond-unordered.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vminmax_1.c61
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vmul_1.c64
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c65
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-protector-3.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-protector-4.c6
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-protector-5.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-protector-6.c8
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-1.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-2.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-3.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-4.c2
-rw-r--r--gcc/testsuite/gcc.target/bpf/diag-sdiv.c12
-rw-r--r--gcc/testsuite/gcc.target/bpf/diag-smod.c12
-rw-r--r--gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c14
-rw-r--r--gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/amx-check.h185
-rw-r--r--gcc/testsuite/gcc.target/i386/amxbf16-asmatt-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c85
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-asmatt-1.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c64
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c63
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c63
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c63
-rw-r--r--gcc/testsuite/gcc.target/i386/amxtile-2.c48
-rw-r--r--gcc/testsuite/gcc.target/i386/amxtile-asmatt-1.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-1.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-1.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-2.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu16-1.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu8-1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-3.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-4.c61
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-3.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-4.c61
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreducess-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512dq-vreducess-2.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-2.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-2.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-2.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-2.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2ss-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd-1.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtss2sd-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si64-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vscalefss-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vscalefss-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-1.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-2.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa32-1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa64-1.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-56.inc10
-rw-r--r--gcc/testsuite/gcc.target/i386/hreset-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/m128-check.h1
-rw-r--r--gcc/testsuite/gcc.target/i386/movdir64b.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/movdiri32.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/movdiri64.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/pr60693.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr68961.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr84101.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-1.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-2.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-3.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-4.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-5.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-6.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95483-7.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96814.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96827.c41
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97249-1.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97282.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97313.c24
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97387-1.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97387-2.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97506.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-12.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-13.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-14.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-22.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-23.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/sse2-mmx-pinsrw.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/uintr-1.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/uintr-2.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/uintr-3.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/uintr-4.c9
-rw-r--r--gcc/testsuite/gcc.target/i386/uintr-5.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/x86-64-v2.c119
-rw-r--r--gcc/testsuite/gcc.target/i386/x86-64-v3-haswell.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/x86-64-v3-skylake.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/x86-64-v3.c119
-rw-r--r--gcc/testsuite/gcc.target/i386/x86-64-v4.c119
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-1.c8
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-2.c31
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-3.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-4.c34
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-4a.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-5.c36
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-5a.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-5b.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-6.c11
-rw-r--r--gcc/testsuite/gcc.target/nvptx/atomic_fetch-3.c24
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-5-p9-runnable.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c34
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-msum-runnable.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-cmp2-runnable.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p7.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p9.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p9.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p9.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-select-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-select-float.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-dimode1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-dimode2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-extract-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-extract-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-extract-3.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-fpcvt-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-fpcvt-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-minmax-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-minmax-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-minmax-3.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-permute.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-splat-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-splat-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-splat-3.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-splat-4.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vbpermd.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vneg.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vparity.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-vpermr.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p9-xxbr-3.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr63335.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr87507.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96139-a.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96139-b.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr97360.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rlwimi-2.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrb.c110
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrd.c73
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrq.c67
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-19.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-22.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-23.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-24.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-28.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-29.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-30.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-31.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-32.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-33.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-34.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-35.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-36.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-37.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-38.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-39.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-40.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-41.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-42.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-43.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-44.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-45.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-cmp.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-cmpne.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v2df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v2di.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v4sf.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v4si-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v4si.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu-df.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-3.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-4.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-5.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-6.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-7.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-8.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-init-9.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-mul.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-set-char.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-set-int.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-set-short.c6
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-setup-double.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-setup-long.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsu/vec-xl-len-13.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsu/vsu.exp3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c170
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c168
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c169
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c168
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c125
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c125
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c126
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c126
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsxcopy.c2
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-1.c18
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-2.c18
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-3.c18
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-4.c18
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-5.c19
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-6.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/mcpu-7.c10
-rw-r--r--gcc/testsuite/gcc.target/riscv/pr96759.c13
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-3.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/predef-6.c6
-rw-r--r--gcc/testsuite/gcc.target/s390/load-and-test-fp-1.c21
-rw-r--r--gcc/testsuite/gcc.target/s390/load-and-test-fp-2.c17
-rw-r--r--gcc/testsuite/gcc.target/s390/load-and-test-fp.h12
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail21001.d12
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d5
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d4
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d3
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/issue21295.d9
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_result_2.f903
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_result_3.f9075
-rw-r--r--gcc/testsuite/gfortran.dg/analyzer/analyzer.exp2
-rw-r--r--gcc/testsuite/gfortran.dg/check_bits_2.f9038
-rw-r--r--gcc/testsuite/gfortran.dg/contiguous_11.f9045
-rw-r--r--gcc/testsuite/gfortran.dg/contiguous_4.f906
-rw-r--r--gcc/testsuite/gfortran.dg/contiguous_7.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/warn_truncated.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/flush-1.f9041
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/flush-2.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/index_4.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_20.f9047
-rw-r--r--gcc/testsuite/gfortran.dg/pr68627.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr95614_1.f906
-rw-r--r--gcc/testsuite/gfortran.dg/pr95614_2.f906
-rw-r--r--gcc/testsuite/gfortran.dg/pr95614_3.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr95614_4.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr96099_1.f908
-rw-r--r--gcc/testsuite/gfortran.dg/pr96099_2.f909
-rw-r--r--gcc/testsuite/gfortran.dg/pr97272.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/pr97500.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/pr97505.f9049
-rw-r--r--gcc/testsuite/gfortran.dg/select_type_50.f9052
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr62283-2.f2
-rw-r--r--gcc/testsuite/gfortran.dg/vect/vect-4.f901
-rw-r--r--gcc/testsuite/gnat.dg/addr16.adb14
-rw-r--r--gcc/testsuite/gnat.dg/addr16_pkg.ads9
-rw-r--r--gcc/testsuite/gnat.dg/assert1.adb15
-rw-r--r--gcc/testsuite/gnat.dg/multfixed.adb4
-rw-r--r--gcc/testsuite/gnat.dg/opt11.adb2
-rw-r--r--gcc/testsuite/gnat.dg/size_clause1.adb2
-rw-r--r--gcc/testsuite/gnat.dg/specs/rep_clause5.ads1
-rw-r--r--gcc/testsuite/gnat.dg/warn11.adb2
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/issue4458.go2
-rw-r--r--gcc/testsuite/lib/target-supports.exp76
-rw-r--r--gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm4
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm1
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm8
-rw-r--r--gcc/testsuite/obj-c++.dg/objc-gc-3.mm2
-rw-r--r--gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm33
-rw-r--r--gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h8
-rw-r--r--gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m13
-rw-r--r--gcc/testsuite/objc.dg/call-super-2.m6
-rw-r--r--gcc/testsuite/objc.dg/gnu-api-2-class-meta.m6
-rw-r--r--gcc/testsuite/objc.dg/gnu-api-2-class.m1
-rw-r--r--gcc/testsuite/objc.dg/gnu-api-2-objc.m8
-rw-r--r--gcc/testsuite/objc.dg/ivar-scope-4.m6
-rw-r--r--gcc/testsuite/objc.dg/objc-gc-4.m2
-rw-r--r--gcc/testsuite/objc.dg/plugin/diagnostic-test-expressions-1.m25
-rw-r--r--gcc/testsuite/objc.dg/torture/forward-1.m46
-rw-r--r--gcc/testsuite/objc/execute/class-tests-1.h2
-rw-r--r--gcc/timevar.c8
-rw-r--r--gcc/toplev.c8
-rw-r--r--gcc/tracer.c61
-rw-r--r--gcc/trans-mem.c8
-rw-r--r--gcc/tree-cfg.c99
-rw-r--r--gcc/tree-complex.c3
-rw-r--r--gcc/tree-core.h3
-rw-r--r--gcc/tree-data-ref.c4
-rw-r--r--gcc/tree-eh.c12
-rw-r--r--gcc/tree-if-conv.c107
-rw-r--r--gcc/tree-inline.c16
-rw-r--r--gcc/tree-into-ssa.c19
-rw-r--r--gcc/tree-nested.c119
-rw-r--r--gcc/tree-nested.h62
-rw-r--r--gcc/tree-nrv.c4
-rw-r--r--gcc/tree-pass.h2
-rw-r--r--gcc/tree-predcom.c3
-rw-r--r--gcc/tree-pretty-print.c3
-rw-r--r--gcc/tree-profile.c9
-rw-r--r--gcc/tree-ssa-alias.c265
-rw-r--r--gcc/tree-ssa-alias.h2
-rw-r--r--gcc/tree-ssa-ccp.c4
-rw-r--r--gcc/tree-ssa-copy.c4
-rw-r--r--gcc/tree-ssa-dce.c35
-rw-r--r--gcc/tree-ssa-dom.c4
-rw-r--r--gcc/tree-ssa-loop-ch.c6
-rw-r--r--gcc/tree-ssa-loop-im.c11
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c9
-rw-r--r--gcc/tree-ssa-loop-ivopts.c3
-rw-r--r--gcc/tree-ssa-loop-manip.c3
-rw-r--r--gcc/tree-ssa-loop-niter.c21
-rw-r--r--gcc/tree-ssa-loop-prefetch.c7
-rw-r--r--gcc/tree-ssa-loop-split.c3
-rw-r--r--gcc/tree-ssa-math-opts.c42
-rw-r--r--gcc/tree-ssa-phiopt.c100
-rw-r--r--gcc/tree-ssa-propagate.c13
-rw-r--r--gcc/tree-ssa-propagate.h5
-rw-r--r--gcc/tree-ssa-reassoc.c2
-rw-r--r--gcc/tree-ssa-sccvn.c2
-rw-r--r--gcc/tree-ssa-sink.c47
-rw-r--r--gcc/tree-ssa-strlen.c205
-rw-r--r--gcc/tree-ssa-strlen.h9
-rw-r--r--gcc/tree-ssa-structalias.c14
-rw-r--r--gcc/tree-ssa-threadedge.c6
-rw-r--r--gcc/tree-switch-conversion.c40
-rw-r--r--gcc/tree-switch-conversion.h7
-rw-r--r--gcc/tree-tailcall.c6
-rw-r--r--gcc/tree-vect-data-refs.c272
-rw-r--r--gcc/tree-vect-loop-manip.c83
-rw-r--r--gcc/tree-vect-loop.c236
-rw-r--r--gcc/tree-vect-patterns.c99
-rw-r--r--gcc/tree-vect-slp.c1362
-rw-r--r--gcc/tree-vect-stmts.c20
-rw-r--r--gcc/tree-vectorizer.c28
-rw-r--r--gcc/tree-vectorizer.h105
-rw-r--r--gcc/tree-vrp.c84
-rw-r--r--gcc/tree.c42
-rw-r--r--gcc/tree.h24
-rw-r--r--gcc/value-prof.c7
-rw-r--r--gcc/value-query.cc177
-rw-r--r--gcc/value-query.h107
-rw-r--r--gcc/value-range.cc139
-rw-r--r--gcc/value-range.h68
-rw-r--r--gcc/vec.h15
-rw-r--r--gcc/vr-values.c669
-rw-r--r--gcc/vr-values.h49
2188 files changed, 97819 insertions, 24773 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 41b34b2..a049252 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,4715 @@
+2020-10-24 H.J. Lu <hjl.tools@gmail.com>
+
+ PR bootstrap/97451
+ * configure.ac (HAVE_AS_WORKING_DWARF_4_FLAG): Renamed to ...
+ (HAVE_AS_WORKING_DWARF_N_FLAG): This. Don't define if there is
+ an extra assembly input file in debug info. Replace success
+ with dwarf4_success in the 32-bit --gdwarf-4 check.
+ * dwarf2out.c (asm_outputs_debug_line_str): Check
+ HAVE_AS_WORKING_DWARF_N_FLAG instead of
+ HAVE_AS_WORKING_DWARF_4_FLAG.
+ * gcc.c (ASM_DEBUG_SPEC): Likewise.
+ (ASM_DEBUG_OPTION_SPEC): Likewise.
+ * config.in: Regenerated.
+ * configure: Likewise.
+
+2020-10-24 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97538
+ * calls.c (get_size_range): Handle undefined ranges.
+
+2020-10-24 Martin Liska <mliska@suse.cz>
+
+ * cgraph.c (cgraph_node::former_thunk_p): Move out of CHECKING_P
+ macro.
+
+2020-10-24 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Limit
+ AND addressing to just lvx/stvx style addresses.
+
+2020-10-24 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.md (cstore<mode>4): Don't call
+ rs6000_emit_int_cmove for power10 when -mno-isel.
+
+2020-10-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * Makefile.in: Add symtab-thunks.o
+ (GTFILES): Add symtab-thunks.h and symtab-thunks.cc; remove cgraphunit.c
+ * cgraph.c: Include symtab-thunks.h.
+ (cgraph_node::create_thunk): Update
+ (symbol_table::create_edge): Update
+ (cgraph_node::dump): Update
+ (cgraph_node::call_for_symbol_thunks_and_aliases): Update
+ (set_nothrow_flag_1): Update
+ (set_malloc_flag_1): Update
+ (set_const_flag_1): Update
+ (collect_callers_of_node_1): Update
+ (clone_of_p): Update
+ (cgraph_node::verify_node): Update
+ (cgraph_node::function_symbol): Update
+ (cgraph_c_finalize): Call thunk_info::release.
+ (cgraph_node::has_thunk_p): Update
+ (cgraph_node::former_thunk_p): Move here from cgraph.h; reimplement.
+ * cgraph.h (struct cgraph_thunk_info): Rename to symtab-thunks.h.
+ (cgraph_node): Remove thunk field; add thunk bitfield.
+ (cgraph_node::expand_thunk): Move to symtab-thunks.h
+ (symtab_thunks_cc_finalize): Declare.
+ (cgraph_node::has_gimple_body_p): Update.
+ (cgraph_node::former_thunk_p): Update.
+ * cgraphclones.c: Include symtab-thunks.h.
+ (duplicate_thunk_for_node): Update.
+ (cgraph_edge::redirect_callee_duplicating_thunks): Update.
+ (cgraph_node::expand_all_artificial_thunks): Update.
+ (cgraph_node::create_edge_including_clones): Update.
+ * cgraphunit.c: Include symtab-thunks.h.
+ (vtable_entry_type): Move to symtab-thunks.c.
+ (cgraph_node::analyze): Update.
+ (analyze_functions): Update.
+ (mark_functions_to_output): Update.
+ (thunk_adjust): Move to symtab-thunks.c
+ (cgraph_node::expand_thunk): Move to symtab-thunks.c
+ (cgraph_node::assemble_thunks_and_aliases): Update.
+ (output_in_order): Update.
+ (cgraphunit_c_finalize): Do not clear vtable_entry_type.
+ (cgraph_node::create_wrapper): Update.
+ * gengtype.c (open_base_files): Add symtab-thunks.h
+ * ipa-comdats.c (propagate_comdat_group): UPdate.
+ (ipa_comdats): Update.
+ * ipa-cp.c (determine_versionability): UPdate.
+ (gather_caller_stats): Update.
+ (count_callers): Update
+ (set_single_call_flag): Update
+ (initialize_node_lattices): Update
+ (call_passes_through_thunk_p): Update
+ (call_passes_through_thunk): Update
+ (propagate_constants_across_call): Update
+ (find_more_scalar_values_for_callers_subset): Update
+ (has_undead_caller_from_outside_scc_p): Update
+ * ipa-fnsummary.c (evaluate_properties_for_edge): Update.
+ (compute_fn_summary): Update.
+ (inline_analyze_function): Update.
+ * ipa-icf.c: Include symtab-thunks.h.
+ (sem_function::equals_wpa): Update.
+ (redirect_all_callers): Update.
+ (sem_function::init): Update.
+ (sem_function::parse): Update.
+ * ipa-inline-transform.c: Include symtab-thunks.h.
+ (inline_call): Update.
+ (save_inline_function_body): Update.
+ (preserve_function_body_p): Update.
+ * ipa-inline.c (inline_small_functions): Update.
+ * ipa-polymorphic-call.c: Include alloc-pool.h, symbol-summary.h,
+ symtab-thunks.h
+ (ipa_polymorphic_call_context::ipa_polymorphic_call_context): Update.
+ * ipa-pure-const.c: Include symtab-thunks.h.
+ (analyze_function): Update.
+ * ipa-sra.c (check_for_caller_issues): Update.
+ * ipa-utils.c (ipa_reverse_postorder): Update.
+ (ipa_merge_profiles): Update.
+ * ipa-visibility.c (non_local_p): Update.
+ (cgraph_node::local_p): Update.
+ (function_and_variable_visibility): Update.
+ * ipa.c (symbol_table::remove_unreachable_nodes): Update.
+ * lto-cgraph.c: Include alloc-pool.h, symbol-summary.h and
+ symtab-thunks.h
+ (lto_output_edge): Update.
+ (lto_output_node): Update.
+ (compute_ltrans_boundary): Update.
+ (output_symtab): Update.
+ (verify_node_partition): Update.
+ (input_overwrite_node): Update.
+ (input_node): Update.
+ * lto-streamer-in.c (fixup_call_stmt_edges): Update.
+ * symtab-thunks.cc: New file.
+ * symtab-thunks.h: New file.
+ * toplev.c (toplev::finalize): Call symtab_thunks_cc_finalize.
+ * trans-mem.c (ipa_tm_mayenterirr_function): Update.
+ (ipa_tm_execute): Update.
+ * tree-inline.c (expand_call_inline): Update.
+ * tree-nested.c (create_nesting_tree): Update.
+ (convert_all_function_calls): Update.
+ (gimplify_all_functions): Update.
+ * tree-profile.c (tree_profiling): Update.
+ * tree-ssa-structalias.c (associate_varinfo_to_alias): Update.
+ * tree.c (free_lang_data_in_decl): Update.
+ * value-prof.c (init_node_map): Update.
+
+2020-10-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91741
+ * doc/invoke.texi: Document -Wsizeof-array-div.
+
+2020-10-23 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97552
+ * attribs.c (init_attr_rdwr_indices): Handle static VLA parameters.
+
+2020-10-23 Douglas Rupp <rupp@adacore.com>
+
+ * config/vxworks.h (VXWORKS_NET_LIBS_RTP): Use -lrtnet if
+ rtnetStackLib.h is available,fallback to -lnet otherwise.
+
+2020-10-23 Douglas Rupp <rupp@adacore.com>
+
+ * gcc.c (if-exists-then-else): New built-in spec function.
+ * doc/invoke.texi: Document it.
+
+2020-10-23 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
+
+ * doc/extend.texi (PowerPC Built-in Functions): Replace
+ extraneous characters with whitespace.
+
+2020-10-23 Martin Liska <mliska@suse.cz>
+
+ * gcov.c (read_count_file): Never call gcov_sync with a negative
+ value.
+
+2020-10-23 Jakub Jelinek <jakub@redhat.com>
+
+ * Makefile.in (PLUGIN_HEADERS): Add gomp-constants.h and $(EXPR_H).
+ (s-header-vars): Accept not just spaces but also tabs between *_H name
+ and =. Handle common/config/ headers similarly to config. Don't
+ throw away everything from first ... to last / on the remaining
+ string, instead skip just ... to corresponding last / without
+ intervening spaces and tabs.
+ (install-plugin): Treat common/config headers like config headers.
+ * config/i386/t-i386 (TM_H): Add
+ $(srcdir)/common/config/i386/i386-cpuinfo.h.
+
+2020-10-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97164
+ * stor-layout.c (layout_type): Also reject arrays where element size
+ is constant, but not a multiple of element alignment.
+
+2020-10-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-loop-ivopts.c (analyze_and_mark_doloop_use): Bail out if
+ the loop is subject to a pragma Unroll with no specific count.
+
+2020-10-23 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/mve.md (mve_vsubq<mode>): New entry for vsub instruction
+ using expression 'minus'.
+ (mve_vsubq_f<mode>): Use minus instead of VSUBQ_F unspec.
+ * config/arm/neon.md (sub<mode>3, sub<mode>3_fp16): Removed.
+ (neon_vsub<mode>): Use gen_sub<mode>3 instead of gen_sub<mode>3_fp16.
+ * config/arm/vec-common.md (sub<mode>3): Use the new mode macros
+ ARM_HAVE_<MODE>_ARITH. Use iterator VDQ instead of VALL.
+
+2020-10-23 Martin Liska <mliska@suse.cz>
+
+ PR lto/97524
+ * lto-wrapper.c (make_exists): New function.
+ (run_gcc): Use it to check that make is present and working
+ for parallel execution.
+
+2020-10-23 Richard Biener <rguenther@suse.de>
+
+ Revert:
+ 2020-10-22 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97521
+ * expr.c (expand_expr_real_1): Be more careful when
+ expanding a VECTOR_BOOLEAN_TYPE_P VECTOR_CSTs.
+
+2020-10-23 Kewen Lin <linkw@linux.ibm.com>
+
+ * tree-vect-loop.c (vect_transform_loop): Remove the redundant
+ LOOP_VINFO_FULLY_MASKED_P check.
+
+2020-10-23 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/mve.md (mve_vsubq<mode>): New entry for vsub instruction
+ using expression 'minus'.
+ (mve_vsubq_f<mode>): Use minus instead of VSUBQ_F unspec.
+ * config/arm/neon.md (sub<mode>3, sub<mode>3_fp16): Removed.
+ (neon_vsub<mode>): Use gen_sub<mode>3 instead of gen_sub<mode>3_fp16.
+ * config/arm/vec-common.md (sub<mode>3): Use the new mode macros
+ ARM_HAVE_<MODE>_ARITH. Use iterator VDQ instead of VALL.
+
+2020-10-22 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_emit_xxspltidp_v2df): Delete
+ debug printf. Remove trailing ".\n" from inform message.
+ Break long line.
+
+2020-10-22 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-range-gori.cc (is_gimple_logical_p): Use types_compatible_p
+ for logical compatibility.
+ (logical_stmt_cache::cacheable_p): Ditto.
+
+2020-10-22 Jan Hubicka <hubicka@ucw.cz>
+
+ * cgraph.c (cgraph_node::get_untransformed_body): Perform lazy
+ clone materialization.
+ * cgraph.h (cgraph_node::materialize_clone): Declare.
+ (symbol_table::materialize_all_clones): Remove.
+ * cgraphclones.c (cgraph_materialize_clone): Turn to ...
+ (cgraph_node::materialize_clone): .. this one; move here
+ dumping from symbol_table::materialize_all_clones.
+ (symbol_table::materialize_all_clones): Remove.
+ * cgraphunit.c (mark_functions_to_output): Clear stmt references.
+ (cgraph_node::expand): Initialize bitmaps early;
+ do not call execute_all_ipa_transforms if there are no transforms.
+ * ipa-inline-transform.c (save_inline_function_body): Fix formating.
+ (inline_transform): Materialize all clones before function is modified.
+ * ipa-param-manipulation.c (ipa_param_adjustments::modify_call):
+ Materialize clone if needed.
+ * ipa.c (class pass_materialize_all_clones): Remove.
+ (make_pass_materialize_all_clones): Remove.
+ * passes.c (execute_all_ipa_transforms): Materialize all clones.
+ * passes.def: Remove pass_materialize_all_clones.
+ * tree-pass.h (make_pass_materialize_all_clones): Remove.
+ * tree-ssa-structalias.c (ipa_pta_execute): Clear refs.
+
+2020-10-22 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * config/rs6000/altivec.h (vec_xl_zext, vec_xl_sext, vec_xst_trunc):
+ New defines.
+ * config/rs6000/rs6000-builtin.def (BU_P10V_OVERLOAD_X): New builtin
+ macro.
+ (BU_P10V_AV_X): New builtin macro.
+ (se_lxvrhbx, se_lxrbhx, se_lxvrwx, se_lxvrdx): Define internal names
+ for load and sign extend vector element.
+ (ze_lxvrbx, ze_lxvrhx, ze_lxvrwx, ze_lxvrdx): Define internal names
+ for load and zero extend vector element.
+ (tr_stxvrbx, tr_stxvrhx, tr_stxvrwx, tr_stxvrdx): Define internal names
+ for truncate and store vector element.
+ (se_lxvrx, ze_lxvrx, tr_stxvrx): Define internal names for overloaded
+ load/store rightmost element.
+ * config/rs6000/rs6000-call.c (altivec_builtin_types): Define the
+ internal monomorphs P10_BUILTIN_SE_LXVRBX, P10_BUILTIN_SE_LXVRHX,
+ P10_BUILTIN_SE_LXVRWX, P10_BUILTIN_SE_LXVRDX,
+ P10_BUILTIN_ZE_LXVRBX, P10_BUILTIN_ZE_LXVRHX, P10_BUILTIN_ZE_LXVRWX,
+ P10_BUILTIN_ZE_LXVRDX,
+ P10_BUILTIN_TR_STXVRBX, P10_BUILTIN_TR_STXVRHX, P10_BUILTIN_TR_STXVRWX,
+ P10_BUILTIN_TR_STXVRDX,
+ (altivec_expand_lxvr_builtin): New expansion for load element builtins.
+ (altivec_expand_stv_builtin): Update to for truncate and store builtins.
+ (altivec_expand_builtin): Add clases for load/store rightmost builtins.
+ (altivec_init_builtins): Add def_builtin entries for
+ __builtin_altivec_se_lxvrbx, __builtin_altivec_se_lxvrhx,
+ __builtin_altivec_se_lxvrwx, __builtin_altivec_se_lxvrdx,
+ __builtin_altivec_ze_lxvrbx, __builtin_altivec_ze_lxvrhx,
+ __builtin_altivec_ze_lxvrwx, __builtin_altivec_ze_lxvrdx,
+ __builtin_altivec_tr_stxvrbx, __builtin_altivec_tr_stxvrhx,
+ __builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrdx,
+ __builtin_vec_se_lxvrx, __builtin_vec_ze_lxvrx, __builtin_vec_tr_stxvrx.
+ * config/rs6000/vsx.md (vsx_lxvr<wd>x, vsx_stxvr<wd>x, vsx_stxvr<wd>x):
+ New define_insn entries.
+ * doc/extend.texi: Add documentation for vsx_xl_sext, vsx_xl_zext,
+ and vec_xst_trunc.
+
+2020-10-22 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * config/rs6000/vsx.md (enum unspec): Add
+ UNSPEC_EXTENDDITI2 and UNSPEC_MTVSRD_DITI_W1 entries.
+ (mtvsrdd_diti_w1, extendditi2_vector): New define_insns.
+ (extendditi2): New define_expand.
+
+2020-10-22 Alexandre Oliva <oliva@adacore.com>
+
+ * config/i386/mingw-w64.h (TARGET_LIBC_HAS_FUNCTION): Enable
+ sincos optimization.
+
+2020-10-22 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/vsx.md (vec_cntmb_<mode>, vec_extract_<mode>),
+ (vec_expand_<mode>): Replace <VSX_MM_SUFFIX> with <wd>.
+
+2020-10-22 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_analyze_slp_instance): Refactor so
+ computing a vector type early is not needed, for store group
+ splitting compute a new vector type based on the desired
+ group size.
+
+2020-10-22 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97521
+ * expr.c (expand_expr_real_1): Be more careful when
+ expanding a VECTOR_BOOLEAN_TYPE_P VECTOR_CSTs.
+
+2020-10-22 David Malcolm <dmalcolm@redhat.com>
+
+ * ipa-modref-tree.c (selftest::test_insert_search_collapse): Fix
+ leak.
+ (selftest::test_merge): Fix leaks.
+
+2020-10-22 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR target/97502
+ * config/s390/vector.md ("vec_cmp<VI_HW:mode><VI_HW:mode>")
+ ("vec_cmpu<VI_HW:mode><VI_HW:mode>"): New expanders.
+
+2020-10-22 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR rtl-optimization/97439
+ * dfp.c (decimal_real_maxval): Set the sign flag in the
+ generated number.
+
+2020-10-22 Martin Liska <mliska@suse.cz>
+
+ PR c/94722
+ * cfgexpand.c (stack_protect_decl_phase):
+ Guard with lookup_attribute("no_stack_protector") at
+ various places.
+ (expand_used_vars): Likewise here.
+ * doc/extend.texi: Document no_stack_protector attribute.
+
+2020-10-22 Martin Liska <mliska@suse.cz>
+
+ * cfgexpand.c: Move the enum to ...
+ * coretypes.h (enum stack_protector): ... here.
+ * function.c (assign_parm_adjust_stack_rtl): Use the stack_protector
+ enum.
+
+2020-10-22 Kito Cheng <kito.cheng@sifive.com>
+
+ * config/riscv/multilib-generator: Add TODO, import itertools
+ and functools.reduce.
+ Handle expantion operator.
+ (LONG_EXT_PREFIXES): New.
+ (arch_canonicalize): Update comment and improve python3
+ debuggability/compatibility.
+ (add_underline_prefix): New.
+ (_expand_combination): Ditto.
+ (unique): Ditto.
+ (expand_combination): Ditto.
+
+2020-10-22 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-ssa-phiopt.c (cond_removal_in_popcount_clz_ctz_pattern):
+ For CLZ and CTZ tests, use type temporary instead of mode.
+
+2020-10-22 Jakub Jelinek <jakub@redhat.com>
+
+ * config.gcc (x86_archs): Add samuel-2, nehemiah, c7 and esther.
+ (x86_64_archs): Add eden-x2, nano, nano-1000, nano-2000, nano-3000,
+ nano-x2, eden-x4, nano-x4, x86-64-v2, x86-64-v3 and x86-64-v4.
+ (i[34567]86-*-* | x86_64-*-*): Only allow x86-64-v* as argument
+ to --with-arch_64=.
+
+2020-10-22 Jan Hubicka <jh@suse.cz>
+
+ * ipa-pure-const.c (funct_state_summary_t::insert): Free stale
+ summaries.
+
+2020-10-22 Jan Hubicka <hubicka@ucw.cz>
+
+ * cgraph.c: Include tree-nested.h
+ (cgraph_node::create): Call maybe_record_nested_function.
+ (cgraph_node::remove): Do not remove function from nested function
+ infos.
+ (cgraph_node::dump): Update.
+ (cgraph_node::unnest): Move to tree-nested.c
+ (cgraph_node::verify_node): Update.
+ (cgraph_c_finalize): Call nested_function_info::release.
+ * cgraph.h (struct symtab_node): Remove nested function info.
+ * cgraphclones.c (cgraph_node::create_clone): Do not clone nested
+ function info.
+ * cgraphunit.c (cgraph_node::analyze): Update.
+ (cgraph_node::expand): Do not worry about nested functions; they are
+ lowered.
+ (symbol_table::finalize_compilation_unit): Call
+ nested_function_info::release.
+ * gimplify.c: Include tree-nested.h
+ (unshare_body): Update.
+ (unvisit_body): Update.
+ * omp-offload.c (omp_discover_implicit_declare_target): Update.
+ * tree-nested.c: Include alloc-pool.h, tree-nested.h, symbol-summary.h
+ (nested_function_sum): New static variable.
+ (nested_function_info::get): New member function.
+ (nested_function_info::get_create): New member function.
+ (unnest_function): New function.
+ (nested_function_info::~nested_function_info): New member function.
+ (nested_function_info::release): New function.
+ (maybe_record_nested_function): New function.
+ (lookup_element_for_decl): Update.
+ (check_for_nested_with_variably_modified): Update.
+ (create_nesting_tree): Update.
+ (unnest_nesting_tree_1): Update.
+ (gimplify_all_functions): Update.
+ (lower_nested_functions): Update.
+ * tree-nested.h (class nested_function_info): New class.
+ (maybe_record_nested_function): Declare.
+ (unnest_function): Declare.
+ (first_nested_function): New inline function.
+ (next_nested_function): New inline function.
+ (nested_function_origin): New inline function.
+
+2020-10-22 liuhongt <hongtao.liu@intel.com>
+
+ PR rtl-optimization/97249
+ * simplify-rtx.c (simplify_binary_operation_1): Simplify
+ vec_select of a subreg of X to a vec_select of X.
+
+2020-10-22 liuhongt <hongtao.liu@intel.com>
+
+ PR target/87767
+ * config/i386/constraints.md ("Br"): New special memory
+ constraint.
+ * config/i386/i386-expand.c (ix86_binary_operator_ok): Both
+ source operand cannot be in memory or bcst_memory_operand.
+ * config/i386/i386.c (ix86_print_operand): Print bcst_mem_operand.
+ * config/i386/i386.h (VALID_BCST_MODE_P): New.
+ * config/i386/predicates.md (bcst_mem_operand): New predicate
+ for AVX512 embedding broadcast memory operand.
+ (bcst_vector_operand): New predicate, vector_operand or
+ bcst_mem_operand.
+ * config/i386/sse.md
+ (*<plusminus_insn><mode>3<mask_name><round_name>): Extend
+ predicate and constraints to handle bcst_mem_operand.
+ (*mul<mode>3<mask_name><round_name>): Ditto.
+ (<sse>_div<mode>3<mask_name><round_name>): Ditto.
+ (<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>):
+ Ditto.
+ (<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>):
+ Ditto.
+ (<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>):
+ Ditto.
+ (<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>):
+ Ditto.
+ (*<plusminus_insn><mode>3): Ditto.
+ (avx512dq_mul<mode>3<mask_name>): Ditto.
+ (*<sse4_1_avx2>_mul<mode>3<mask_name>): Ditto.
+ (*andnot<mode>3): Ditto.
+ (<mask_codefor><code><mode>3<mask_name>): Ditto.
+ (*sub<mode>3<mask_name>_bcst): Removed.
+ (*add<mode>3<mask_name>_bcst): Ditto.
+ (*mul<mode>3<mask_name>_bcst): Ditto.
+ (*<avx512>_div<mode>3<mask_name>_bcst): Ditto.
+ (*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1):
+ Ditto.
+ (*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_2):
+ Ditto.
+ (*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_3):
+ Ditto.
+ (*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1):
+ Ditto.
+ (*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_2):
+ Ditto.
+ (*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_3):
+ Ditto.
+ (*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1):
+ Ditto.
+ (*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_2):
+ Ditto.
+ (*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_3):
+ Ditto.
+ (*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1):
+ Ditto.
+ (*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_2):
+ Ditto.
+ (*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_3):
+ Ditto.
+ (*sub<mode>3_bcst): Ditto.
+ (*add<mode>3_bcst): Ditto.
+ (*avx512dq_mul<mode>3<mask_name>_bcst): Ditto.
+ (*avx512f_mul<mode>3<mask_name>_bcst): Ditto.
+ (*andnot<mode>3_bcst): Ditto.
+ (*<code><mode>3_bcst): Ditto.
+ * config/i386/subst.md (bcst_round_constraint): New subst
+ attribute.
+ (bcst_round_nimm_predicate): Ditto.
+ (bcst_mask_prefix3): Ditto.
+ (bcst_mask_prefix4): Ditto.
+
+2020-10-22 liuhongt <hongtao.liu@intel.com>
+
+ PR target/87767
+ * ira-costs.c (record_operand_costs): Extract memory operand
+ from recog_data.operand[i] for record_address_regs.
+ (record_reg_classes): Extract memory operand from OP for
+ conditional judgement MEM_P.
+ * ira.c (ira_setup_alts): Ditto.
+ * lra-constraints.c (extract_mem_from_operand): New function.
+ (satisfies_memory_constraint_p): Extract memory operand from
+ OP for decompose_mem_address, return false when there's no
+ memory operand inside OP.
+ (process_alt_operands): Remove MEM_P (op) since it would be
+ judged in satisfies_memory_constraint_p.
+ * recog.c (asm_operand_ok): Extract memory operand from OP for
+ judgement of memory_operand (OP, VOIDmode).
+ (constrain_operands): Don't unwrapper unary operator when
+ there's memory operand inside.
+ * rtl.h (extract_mem_from_operand): New decl.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/mve.md (mve_vmaxq_<supf><mode>): Replace with ...
+ (mve_vmaxq_s<mode>, mve_vmaxq_u<mode>): ... these new insns to
+ use smax/umax instead of VMAXQ.
+ (mve_vminq_<supf><mode>): Replace with ...
+ (mve_vminq_s<mode>, mve_vminq_u<mode>): ... these new insns to
+ use smin/umin instead of VMINQ.
+ (mve_vmaxnmq_f<mode>): Use smax instead of VMAXNMQ_F.
+ (mve_vminnmq_f<mode>): Use smin instead of VMINNMQ_F.
+ * config/arm/vec-common.md (smin<mode>3): Use the new mode macros
+ ARM_HAVE_<MODE>_ARITH.
+ (umin<mode>3, smax<mode>3, umax<mode>3): Likewise.
+
+2020-10-22 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97520
+ * gimple-range.cc (range_of_non_trivial_assignment): Handle x = &a
+ by returning a non-zero range.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/mve.md (mve_vmulq<mode>): New entry for vmul instruction
+ using expression 'mult'.
+ (mve_vmulq_f<mode>): Use mult instead of VMULQ_F.
+ * config/arm/neon.md (mul<mode>3): Removed.
+ * config/arm/vec-common.md (mul<mode>3): Use the new mode macros
+ ARM_HAVE_<MODE>_ARITH. Use mode iterator VDQWH instead of VALLW.
+
+2020-10-22 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97515
+ * value-query.cc (range_query::value_of_expr): If the result is
+ UNDEFINED, check to see if the global value is a constant.
+ (range_query::value_on_edge): Ditto.
+
+2020-10-21 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/97445
+ * ipa-inline.c (inline_insns_single): Add hint2 parameter.
+ (inline_insns_auto): Add hint2 parameter.
+ (can_inline_edge_by_limits_p): Update.
+ (want_inline_small_function_p): Update.
+ (wrapper_heuristics_may_apply): Update.
+
+2020-10-21 Richard Biener <rguenther@suse.de>
+ Andrew MacLeod <amacleod@redhat.com>
+ Martin Liska <mliska@suse.cz>
+
+ PR target/97360
+ * config/rs6000/rs6000-call.c (rs6000_init_builtins): Remove call to
+ build_distinct_type_copy().
+
+2020-10-21 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97445
+ * ipa-fnsummary.c (ipa_dump_hints): Add INLINE_HINT_builtin_constant_p.
+ (ipa_fn_summary::~ipa_fn_summary): Free builtin_constant_p_parms.
+ (ipa_fn_summary_t::duplicate): Duplicate builtin_constant_p_parms.
+ (ipa_dump_fn_summary): Dump builtin_constant_p_parms.
+ (add_builtin_constant_p_parm): New function
+ (set_cond_stmt_execution_predicate): Update builtin_constant_p_parms.
+ (ipa_call_context::estimate_size_and_time): Set
+ INLINE_HINT_builtin_constant_p..
+ (ipa_merge_fn_summary_after_inlining): Merge builtin_constant_p_parms.
+ (inline_read_section): Read builtin_constant_p_parms.
+ (ipa_fn_summary_write): Write builtin_constant_p_parms.
+ * ipa-fnsummary.h (enum ipa_hints_vals): Add
+ INLINE_HINT_builtin_constant_p.
+ * ipa-inline.c (want_inline_small_function_p): Use
+ INLINE_HINT_builtin_constant_p.
+ (edge_badness): Use INLINE_HINT_builtin_constant_p.
+
+2020-10-21 Douglas Rupp <rupp@adacore.com>
+
+ * config/vx-common.h (LINK_SPEC, LIB_SPEC): Remove #undef.
+
+2020-10-21 Douglas Rupp <rupp@adacore.com>
+ Olivier Hainque <hainque@adacore.com>
+
+ * config.gcc (powerpc*-wrs-vxworks7r*): New case.
+ * config/rs6000/vxworks.h: Rework to handle VxWorks7.
+ Refactor as common bits + vx6 vs vx7 ones. For the
+ latter, rely essentially on the Linux configuration
+ and adjust CPU to _VX_CPU in CPP_SPEC. Add a case
+ for e6500. Use SUB3TARGET_OVERRIDE_OPTIONS for specifics
+ to preserve the Linux SUBSUBTARGET_OVERRIDE_OPTIONS
+ for vx7.
+
+2020-10-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97500
+ * tree-vect-slp.c (vect_analyze_slp_backedges): Do not
+ fill backedges for inductions.
+
+2020-10-21 liuhongt <hongtao.liu@intel.com>
+
+ PR target/97506
+ * config/i386/i386-expand.c (ix86_expand_sse_movcc): Move
+ op_true to dest directly when op_true equals op_false.
+
+2020-10-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97503
+ * tree-ssa-phiopt.c: Include internal-fn.h.
+ (cond_removal_in_popcount_pattern): Rename to ...
+ (cond_removal_in_popcount_clz_ctz_pattern): ... this. Handle not just
+ popcount, but also clz and ctz if it has C?Z_DEFINED_VALUE_AT_ZERO 2.
+
+2020-10-21 Richard Biener <rguenther@suse.de>
+
+ * cfg.c (htab_bb_copy_original_entry): Remove.
+ (bb_copy_hasher): Likewise.
+ (bb_original, bb_copy, loop_copy): Use
+ hash_map<int_hash<int, -1, -2>, int>.
+ (original_copy_bb_pool): Remove.
+ (initialize_original_copy_tables): Adjust.
+ (reset_original_copy_tables): Likewise.
+ (free_original_copy_tables): Likewise.
+ (original_copy_tables_initialized_p): Likewise.
+ (copy_original_table_clear): Simplify.
+ (copy_original_table_set): Likewise.
+ (get_bb_original): Likewise.
+ (get_bb_copy): Likewise.
+ (get_loop_copy): Likewise.
+
+2020-10-21 Richard Biener <rguenther@suse.de>
+
+ * cfghooks.c (copy_bbs): Split out loop computing new_edges.
+
+2020-10-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-range.cc (gimple_ranger::range_of_ssa_name_with_loop_info):
+ Remove TREE_OVERFLOW special case.
+ * vr-values.c (bounds_of_var_in_loop): Adjust overflow for
+ invariants.
+
+2020-10-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * vr-values.h: Remove simplify_cond_using_ranges_2.
+ (range_fits_type_p): New.
+ * vr-values.c (range_fits_type_p): Remove static qualifier.
+ (vrp_simplify_cond_using_ranges): Move...
+ * tree-vrp.c (vrp_simplify_cond_using_ranges): ...to here.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/mve.md (mve_vmaxq_<supf><mode>): Replace with ...
+ (mve_vmaxq_s<mode>, mve_vmaxq_u<mode>): ... these new insns to
+ use smax/umax instead of VMAXQ.
+ (mve_vminq_<supf><mode>): Replace with ...
+ (mve_vminq_s<mode>, mve_vminq_u<mode>): ... these new insns to
+ use smin/umin instead of VMINQ.
+ (mve_vmaxnmq_f<mode>): Use smax instead of VMAXNMQ_F.
+ (mve_vminnmq_f<mode>): Use smin instead of VMINNMQ_F.
+ * config/arm/vec-common.md (smin<mode>3): Use the new mode macros
+ ARM_HAVE_<MODE>_ARITH.
+ (umin<mode>3, smax<mode>3, umax<mode>3): Likewise.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/mve.md (mve_vmulq<mode>): New entry for vmul instruction
+ using expression 'mult'.
+ (mve_vmulq_f<mode>): Use mult instead of VMULQ_F.
+ * config/arm/neon.md (mul<mode>3): Removed.
+ * config/arm/vec-common.md (mul<mode>3): Use the new mode macros
+ ARM_HAVE_<MODE>_ARITH. Use mode iterator VDQWH instead of VALLW.
+
+2020-10-20 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97505
+ * vr-values.c (vr_values::extract_range_basic): Trap if
+ vr_values version disagrees with range_of_builtin_call.
+
+2020-10-20 David Edelsohn <dje.gcc@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_option_override_internal):
+ Don't implcitly enable Altivec ABI if set on the command line.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * calls.c (get_size_range): Adjust to work with ranger.
+ * calls.h (get_size_range): Add ranger argument to prototype.
+ * gimple-ssa-warn-restrict.c (class wrestrict_dom_walker): Remove.
+ (check_call): Pull out of wrestrict_dom_walker into a
+ static function.
+ (wrestrict_dom_walker::before_dom_children): Rename to...
+ (wrestrict_walk): ...this.
+ (pass_wrestrict::execute): Instantiate ranger.
+ (class builtin_memref): Add stmt and query fields.
+ (builtin_access::builtin_access): Add range_query field.
+ (builtin_memref::builtin_memref): Same.
+ (builtin_memref::extend_offset_range): Same.
+ (builtin_access::builtin_access): Make work with ranger.
+ (wrestrict_dom_walker::check_call): Pull out into...
+ (check_call): ...here.
+ (check_bounds_or_overlap): Add range_query argument.
+ * gimple-ssa-warn-restrict.h (check_bounds_or_overlap):
+ Add range_query and gimple stmt arguments.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-ssa-warn-alloca.c (enum alloca_type): Remove
+ ALLOCA_BOUND_UNKNOWN and ALLOCA_CAST_FROM_SIGNED.
+ (warn_limit_specified_p): New.
+ (alloca_call_type_by_arg): Remove.
+ (cast_from_signed_p): Remove.
+ (is_max): Remove.
+ (alloca_call_type): Remove heuristics and replace with call into
+ ranger.
+ (pass_walloca::execute): Instantiate ranger.
+
+2020-10-20 Tobias Burnus <tobias@codesourcery.com>
+
+ * lto-wrapper.c (run_gcc): Use proper variable for
+ %u.ltrans_args dump suffix.
+
+2020-10-20 Zhiheng Xie <xiezhiheng@huawei.com>
+ Nannan Zheng <zhengnannan@huawei.com>
+
+ * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+ for get/set reg intrinsics.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-range.cc (gimple_ranger::range_of_builtin_ubsan_call):
+ Make externally visble...
+ (range_of_builtin_ubsan_call): ...here. Add range_query argument.
+ (gimple_ranger::range_of_builtin_call): Make externally visible...
+ (range_of_builtin_call): ...here. Add range_query argument.
+ * gimple-range.h (range_of_builtin_call): Move out from class and
+ make externally visible.
+ * vr-values.c (vr_values::extract_range_basic): Abstract out
+ builtin handling to...
+ (vr_values::range_of_expr): Handle non SSAs.
+ (vr_values::extract_range_builtin): ...here.
+ * vr-values.h (class vr_values): Add extract_range_builtin.
+ (range_of_expr): Rename NAME to EXPR.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97501
+ * gimple-range.cc (gimple_ranger::range_of_ssa_name_with_loop_info):
+ Saturate overflows returned from SCEV.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.cc (irange::operator=): Split up call to
+ copy_legacy_range into...
+ (irange::copy_to_legacy): ...this.
+ (irange::copy_legacy_to_multi_range): ...and this.
+ (irange::copy_legacy_range): Remove.
+ * value-range.h: Remove copoy_legacy_range.
+ Add copy_legacy_to_multi_range and copy_to_legacy.
+
+2020-10-20 Tobias Burnus <tobias@codesourcery.com>
+
+ * doc/invoke.texi (NVPTX options): Use @item not @itemx.
+
+2020-10-20 Richard Biener <rguenther@suse.de>
+
+ * tree-cfg.c (reinstall_phi_args): Remove.
+ (gimple_split_edge): Remove PHIs around the edge redirection
+ to avoid touching them at all.
+
+2020-10-20 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-loop.c (vectorizable_reduction): Use the correct
+ loops latch edge for the PHI arg lookup.
+
+2020-10-20 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * config/msp430/msp430.md (andneghi3): Allow general operand for
+ op1 and update output assembler template.
+
+2020-10-20 Tobias Burnus <tobias@codesourcery.com>
+
+ * collect-utils.c (collect_execute, fork_execute): Add at-file suffix
+ argument.
+ * collect-utils.h (collect_execute, fork_execute): Update prototype.
+ * collect2.c (maybe_run_lto_and_relink, do_link, main, do_dsymutil):
+ Update calls by passing NULL.
+ * config/i386/intelmic-mkoffload.c (compile_for_target,
+ generate_host_descr_file, prepare_target_image, main): Likewise.
+ * config/gcn/mkoffload.c (compile_native, main): Pass at-file suffix.
+ * config/nvptx/mkoffload.c (compile_native, main): Likewise.
+ * lto-wrapper.c (compile_offload_image): Likewise.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * range-op.cc (operator_rshift::op1_range): Special case
+ shifting by zero.
+
+2020-10-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97496
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Guard extern
+ promotion with not in pattern.
+
+2020-10-20 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * config/s390/s390.c (s390_expand_vec_strlen): Add alignment
+ for memory access inside loop.
+
+2020-10-19 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97360
+ * gimple-range.h (range_compatible_p): New.
+ * gimple-range-gori.cc (is_gimple_logical_p): Use range_compatible_p.
+ (range_is_either_true_or_false): Ditto.
+ (gori_compute::outgoing_edge_range_p): Cast result to the correct
+ type if necessary.
+ (logical_stmt_cache::cacheable_p): Use range_compatible_p.
+ * gimple-range.cc (gimple_ranger::calc_stmt): Check range_compatible_p
+ before casting the range.
+ (gimple_ranger::range_on_exit): Use range_compatible_p.
+ (gimple_ranger::range_on_edge): Ditto.
+
+2020-10-19 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/97456
+ * tree-complex.c (set_component_ssa_name): Do not replace ignored decl
+ default definitions with new component vars. Reorder if conditions.
+
+2020-10-19 David Edelsohn <dje.gcc@gmail.com>
+
+ * config/rs6000/vsx.md (vextract_fp_from_shorth): Fix vals_be.
+ (vextract_fp_from_shortl) Same.
+
+2020-10-19 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97488
+ * range-op.cc (operator_lshift::op1_range): Handle large right shifts.
+
+2020-10-19 Martin Liska <mliska@suse.cz>
+
+ * ipa-modref.c (compute_parm_map): Clear vector.
+
+2020-10-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97486
+ * tree-vect-slp.c (vect_slp_function): Split after stmts
+ ending a BB.
+
+2020-10-19 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/invoke.texi (OPptimize Options): Add missing closing
+ parenthesis.
+
+2020-10-19 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97467
+ * range-op.cc (operator_lshift::op1_range): Handle shifts by 0.
+
+2020-10-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97466
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Remove
+ spurious assert, re-indent.
+
+2020-10-19 Li Jia He <helijia@gcc.gnu.org>
+
+ PR tree-optimization/66552
+ * match.pd (x << (n % C) -> x << (n & C-1)): New simplification.
+
+2020-10-19 Richard Biener <rguenther@suse.de>
+
+ * tree-cfg.c (verify_gimple_comparison): Drop special-case
+ for pointer comparison.
+
+2020-10-16 Andrew MacLeod <amacleod@redhat.com>
+
+ * vr-values.c (dump_all_value_ranges): Only dump names which are
+ still active.
+
+2020-10-16 Andrew MacLeod <amacleod@redhat.com>
+
+ * range-op.cc (pointer_plus_operator::wi_fold): Make pointer_plus
+ [0, 0] + const return a [const, const] range.
+
+2020-10-16 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-ssa-evrp.c (hybrid_folder::value_on_edge): Call
+ evrp_folder::value_of_expr directly.
+ (hybrid_folder::value_of_stmt): Ditto.
+
+2020-10-16 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97462
+ * range-op.cc (operator_lshift::op1_range): Don't trap on negative
+ shifts.
+
+2020-10-16 Olivier Hainque <hainque@adacore.com>
+
+ * config/vxworks.h (VX_CRTBEGIN_SPEC): Likewise.
+
+2020-10-16 Olivier Hainque <hainque@adacore.com>
+
+ * config/vxworks/_vxworks-versions.h: Only include
+ version.h if _WRS_VXWORKS_MAJOR is not defined.
+ Provide a default _WRS_VXWORKS_MINOR (0).
+
+2020-10-16 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/97327
+ * config/arm/arm.c (fp_bitlist): Add isa_bit_mve_float to FP bits array.
+
+2020-10-16 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): For BB
+ vectorization swap operands only if it helps, demote mismatches to
+ external.
+
+2020-10-16 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/97291
+ * config/arm/arm-builtins.c (arm_strsbwbs_qualifiers): Modify array.
+ (arm_strsbwbu_qualifiers): Likewise.
+ (arm_strsbwbs_p_qualifiers): Likewise.
+ (arm_strsbwbu_p_qualifiers): Likewise.
+ * config/arm/arm_mve.h (__arm_vstrdq_scatter_base_wb_s64): Modify
+ function definition.
+ (__arm_vstrdq_scatter_base_wb_u64): Likewise.
+ (__arm_vstrdq_scatter_base_wb_p_s64): Likewise.
+ (__arm_vstrdq_scatter_base_wb_p_u64): Likewise.
+ (__arm_vstrwq_scatter_base_wb_p_s32): Likewise.
+ (__arm_vstrwq_scatter_base_wb_p_u32): Likewise.
+ (__arm_vstrwq_scatter_base_wb_s32): Likewise.
+ (__arm_vstrwq_scatter_base_wb_u32): Likewise.
+ (__arm_vstrwq_scatter_base_wb_f32): Likewise.
+ (__arm_vstrwq_scatter_base_wb_p_f32): Likewise.
+ * config/arm/arm_mve_builtins.def (vstrwq_scatter_base_wb_add_u): Remove
+ expansion for the builtin.
+ (vstrwq_scatter_base_wb_add_s): Likewise.
+ (vstrwq_scatter_base_wb_add_f): Likewise.
+ (vstrdq_scatter_base_wb_add_u): Likewise.
+ (vstrdq_scatter_base_wb_add_s): Likewise.
+ (vstrwq_scatter_base_wb_p_add_u): Likewise.
+ (vstrwq_scatter_base_wb_p_add_s): Likewise.
+ (vstrwq_scatter_base_wb_p_add_f): Likewise.
+ (vstrdq_scatter_base_wb_p_add_u): Likewise.
+ (vstrdq_scatter_base_wb_p_add_s): Likewise.
+ * config/arm/mve.md (mve_vstrwq_scatter_base_wb_<supf>v4si): Remove
+ expand.
+ (mve_vstrwq_scatter_base_wb_add_<supf>v4si): Likewise.
+ (mve_vstrwq_scatter_base_wb_<supf>v4si_insn): Rename pattern to ...
+ (mve_vstrwq_scatter_base_wb_<supf>v4si): This.
+ (mve_vstrwq_scatter_base_wb_p_<supf>v4si): Remove expand.
+ (mve_vstrwq_scatter_base_wb_p_add_<supf>v4si): Likewise.
+ (mve_vstrwq_scatter_base_wb_p_<supf>v4si_insn): Rename pattern to ...
+ (mve_vstrwq_scatter_base_wb_p_<supf>v4si): This.
+ (mve_vstrwq_scatter_base_wb_fv4sf): Remove expand.
+ (mve_vstrwq_scatter_base_wb_add_fv4sf): Likewise.
+ (mve_vstrwq_scatter_base_wb_fv4sf_insn): Rename pattern to ...
+ (mve_vstrwq_scatter_base_wb_fv4sf): This.
+ (mve_vstrwq_scatter_base_wb_p_fv4sf): Remove expand.
+ (mve_vstrwq_scatter_base_wb_p_add_fv4sf): Likewise.
+ (mve_vstrwq_scatter_base_wb_p_fv4sf_insn): Rename pattern to ...
+ (mve_vstrwq_scatter_base_wb_p_fv4sf): This.
+ (mve_vstrdq_scatter_base_wb_<supf>v2di): Remove expand.
+ (mve_vstrdq_scatter_base_wb_add_<supf>v2di): Likewise.
+ (mve_vstrdq_scatter_base_wb_<supf>v2di_insn): Rename pattern to ...
+ (mve_vstrdq_scatter_base_wb_<supf>v2di): This.
+ (mve_vstrdq_scatter_base_wb_p_<supf>v2di): Remove expand.
+ (mve_vstrdq_scatter_base_wb_p_add_<supf>v2di): Likewise.
+ (mve_vstrdq_scatter_base_wb_p_<supf>v2di_insn): Rename pattern to ...
+ (mve_vstrdq_scatter_base_wb_p_<supf>v2di): This.
+
+2020-10-16 Kito Cheng <kito.cheng@sifive.com>
+
+ * config/riscv/multilib-generator (IMPLIED_EXT): New.
+ (arch_canonicalize): Update comment and handle implied extensions.
+
+2020-10-16 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): First analyze
+ all operands and fill in the def_stmts and ops entries.
+ (vect_def_types_match): New helper.
+
+2020-10-16 Martin Liska <mliska@suse.cz>
+
+ PR ipa/97404
+ * ipa-prop.c (struct ipa_vr_ggc_hash_traits):
+ Compare types of VRP as we can merge ranges of different types.
+
+2020-10-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97428
+ * tree-vect-slp.c (vect_analyze_slp_instance): Split store
+ groups also for loop vectorization.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ PR target/97436
+ * config/nvptx/nvptx.opt (m32): Comment out.
+ * doc/invoke.texi (NVPTX options): Remove -m32.
+
+2020-10-15 Jan Hubicka <hubicka@ucw.cz>
+ Richard Biener <rguenther@suse.de>
+
+ * attr-fnspec.h: Fix toplevel comment.
+
+2020-10-15 Richard Biener <rguenther@suse.de>
+
+ * tree-pretty-print.c (dump_mem_ref): Print constant offset
+ also for TARGET_MEM_REF.
+
+2020-10-15 Jan Hubicka <jh@suse.cz>
+
+ * symtab.c (symtab_node::binds_to_current_def_p): Also accept symbols
+ defined in other partition.
+
+2020-10-15 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-loop.c (vectorizable_live_operation): Adjust
+ dominance query.
+
+2020-10-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97482
+ * tree-data-ref.c (split_constant_offset_1): Handle
+ trivial conversions better.
+ * fold-const.c (convert_to_ptrofftype_loc): Elide conversion
+ if the offset is already ptrofftype_p.
+
+2020-10-15 Martin Liska <mliska@suse.cz>
+
+ PR ipa/97295
+ * profile-count.c (profile_count::to_frequency): Move part of
+ gcc_assert to STATIC_ASSERT.
+ * regs.h (REG_FREQ_FROM_BB): Do not use count.to_frequency for
+ a function that does not have count_max initialized.
+
+2020-10-15 Jakub Jelinek <jakub@redhat.com>
+
+ * params.opt (-param-ipa-jump-function-lookups=): Add full stop at
+ the end of the parameter description.
+
+2020-10-15 Kito Cheng <kito.cheng@sifive.com>
+
+ * common/config/riscv/riscv-common.c (riscv_cpu_tables): New.
+ (riscv_arch_str): Return empty string if current_subset_list
+ is NULL.
+ (riscv_find_cpu): New.
+ (riscv_handle_option): Verify option value of -mcpu.
+ (riscv_expand_arch): Using std::string.
+ (riscv_default_mtune): New.
+ (riscv_expand_arch_from_cpu): Ditto.
+ * config/riscv/riscv-cores.def: New.
+ * config/riscv/riscv-protos.h (riscv_find_cpu): New.
+ (riscv_cpu_info): New.
+ * config/riscv/riscv.c (riscv_tune_info): Rename ...
+ (riscv_tune_param): ... to this.
+ (riscv_cpu_info): Rename ...
+ (riscv_tune_info): ... to this.
+ (tune_info): Rename ...
+ (tune_param): ... to this.
+ (rocket_tune_info): Update data type name.
+ (sifive_7_tune_info): Ditto.
+ (optimize_size_tune_info): Ditto.
+ (riscv_cpu_info_table): Rename ...
+ (riscv_tune_info_table): ... to this.
+ (riscv_parse_cpu): Rename ...
+ (riscv_parse_tune): ... to this, and translate valid -mcpu option to
+ -mtune option.
+ (riscv_rtx_costs): Rename tune_info to tune_param.
+ (riscv_class_max_nregs): Ditto.
+ (riscv_memory_move_cost): Ditto.
+ (riscv_init_machine_status): Use value of -mcpu if -mtune is not
+ given, and rename tune_info to tune_param.
+ * config/riscv/riscv.h (riscv_expand_arch_from_cpu): New.
+ (riscv_default_mtune): Ditto.
+ (EXTRA_SPEC_FUNCTIONS): Add riscv_expand_arch_from_cpu and
+ riscv_default_mtune.
+ (OPTION_DEFAULT_SPECS): Handle default value of -march/-mabi.
+ (DRIVER_SELF_SPECS): Expand -march from -mcpu if -march is not
+ given.
+ * config/riscv/riscv.opt (-mcpu): New option.
+ * config/riscv/t-riscv ($(common_out_file)): Add
+ riscv-cores.def to dependency.
+ * doc/invoke.texi (RISC-V Option): Add -mcpu, and update the
+ description of default value for -mtune and -march.
+
+2020-10-15 Hongyu Wang <hongyu.wang@intel.com>
+
+ * common/config/i386/cpuinfo.h (get_available_features):
+ Detect HRESET.
+ * common/config/i386/i386-common.c (OPTION_MASK_ISA2_HRESET_SET,
+ OPTION_MASK_ISA2_HRESET_UNSET): New macros.
+ (ix86_handle_option): Handle -mhreset.
+ * common/config/i386/i386-cpuinfo.h (enum processor_features):
+ Add FEATURE_HRESET.
+ * common/config/i386/i386-isas.h: Add ISA_NAMES_TABLE_ENTRY
+ for hreset.
+ * config.gcc: Add hresetintrin.h
+ * config/i386/hresetintrin.h: New header file.
+ * config/i386/x86gprintrin.h: Include hresetintrin.h.
+ * config/i386/cpuid.h (bit_HRESET): New.
+ * config/i386/i386-builtin.def: Add new builtin.
+ * config/i386/i386-expand.c (ix86_expand_builtin):
+ Handle new builtin.
+ * config/i386/i386-c.c (ix86_target_macros_internal): Define
+ __HRESET__.
+ * config/i386/i386-options.c (isa2_opts): Add -mhreset.
+ (ix86_valid_target_attribute_inner_p): Handle hreset.
+ * config/i386/i386.h (TARGET_HRESET, TARGET_HRESET_P,
+ PTA_HRESET): New.
+ (PTA_ALDERLAKE): Add PTA_HRESET.
+ * config/i386/i386.opt: Add option -mhreset.
+ * config/i386/i386.md (UNSPECV_HRESET): New unspec.
+ (hreset): New define_insn.
+ * doc/invoke.texi: Document -mhreset.
+ * doc/extend.texi: Document hreset.
+
+2020-10-15 Hongtao Liu <hongtao.liu@intel.com>
+
+ * common/config/i386/cpuinfo.h (get_available_features):
+ Detect UINTR.
+ * common/config/i386/i386-common.c (OPTION_MASK_ISA2_UINTR_SET
+ OPTION_MASK_ISA2_UINTR_UNSET): New.
+ (ix86_handle_option): Handle -muintr.
+ * common/config/i386/i386-cpuinfo.h (enum processor_features):
+ Add FEATURE_UINTR.
+ * common/config/i386/i386-isas.h: Add ISA_NAMES_TABLE_ENTRY
+ for uintr.
+ * config.gcc: Add uintrintrin.h to extra_headers.
+ * config/i386/uintrintrin.h: New.
+ * config/i386/cpuid.h (bit_UINTR): New.
+ * config/i386/i386-builtin-types.def: Add new types.
+ * config/i386/i386-builtin.def: Add new builtins.
+ * config/i386/i386-builtins.c (ix86_init_mmx_sse_builtins): Add
+ __builtin_ia32_testui.
+ * config/i386/i386-builtins.h (ix86_builtins): Add
+ IX86_BUILTIN_TESTUI.
+ * config/i386/i386-c.c (ix86_target_macros_internal): Define
+ __UINTR__.
+ * config/i386/i386-expand.c (ix86_expand_special_args_builtin):
+ Handle UINT8_FTYPE_VOID.
+ (ix86_expand_builtin): Handle IX86_BUILTIN_TESTUI.
+ * config/i386/i386-options.c (isa2_opts): Add -muintr.
+ (ix86_valid_target_attribute_inner_p): Handle UINTR.
+ (ix86_option_override_internal): Add TARGET_64BIT check for UINTR.
+ * config/i386/i386.h (TARGET_UINTR, TARGET_UINTR_P, PTA_UINTR): New.
+ (PTA_SAPPHIRRAPIDS): Add PTA_UINTR.
+ * config/i386/i386.opt: Add -muintr.
+ * config/i386/i386.md
+ (define_int_iterator UINTR_UNSPECV): New.
+ (define_int_attr uintr_unspecv): New.
+ (uintr_<uintr_unspecv>, uintr_senduipi, testui):
+ New define_insn patterns.
+ * config/i386/x86gprintrin.h: Include uintrintrin.h
+ * doc/invoke.texi: Document -muintr.
+ * doc/extend.texi: Document uintr.
+
+2020-10-14 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97391
+ * builtins.c (gimple_parm_array_size): Peel off one less layer
+ of array types.
+
+2020-10-14 Martin Sebor <msebor@redhat.com>
+
+ PR c/97413
+ * attribs.c (init_attr_rdwr_indices): Unwrap extra list layer.
+
+2020-10-14 Sunil K Pandey <skpgkp2@gmail.com>
+
+ PR target/95483
+ * config/i386/avx2intrin.h (_mm_broadcastsi128_si256): New intrinsics.
+ (_mm_broadcastsd_pd): Ditto.
+ * config/i386/avx512bwintrin.h (_mm512_loadu_epi16): New intrinsics.
+ (_mm512_storeu_epi16): Ditto.
+ (_mm512_loadu_epi8): Ditto.
+ (_mm512_storeu_epi8): Ditto.
+ * config/i386/avx512dqintrin.h (_mm_reduce_round_sd): New intrinsics.
+ (_mm_mask_reduce_round_sd): Ditto.
+ (_mm_maskz_reduce_round_sd): Ditto.
+ (_mm_reduce_round_ss): Ditto.
+ (_mm_mask_reduce_round_ss): Ditto.
+ (_mm_maskz_reduce_round_ss): Ditto.
+ (_mm512_reduce_round_pd): Ditto.
+ (_mm512_mask_reduce_round_pd): Ditto.
+ (_mm512_maskz_reduce_round_pd): Ditto.
+ (_mm512_reduce_round_ps): Ditto.
+ (_mm512_mask_reduce_round_ps): Ditto.
+ (_mm512_maskz_reduce_round_ps): Ditto.
+ * config/i386/avx512erintrin.h
+ (_mm_mask_rcp28_round_sd): New intrinsics.
+ (_mm_maskz_rcp28_round_sd): Ditto.
+ (_mm_mask_rcp28_round_ss): Ditto.
+ (_mm_maskz_rcp28_round_ss): Ditto.
+ (_mm_mask_rsqrt28_round_sd): Ditto.
+ (_mm_maskz_rsqrt28_round_sd): Ditto.
+ (_mm_mask_rsqrt28_round_ss): Ditto.
+ (_mm_maskz_rsqrt28_round_ss): Ditto.
+ (_mm_mask_rcp28_sd): Ditto.
+ (_mm_maskz_rcp28_sd): Ditto.
+ (_mm_mask_rcp28_ss): Ditto.
+ (_mm_maskz_rcp28_ss): Ditto.
+ (_mm_mask_rsqrt28_sd): Ditto.
+ (_mm_maskz_rsqrt28_sd): Ditto.
+ (_mm_mask_rsqrt28_ss): Ditto.
+ (_mm_maskz_rsqrt28_ss): Ditto.
+ * config/i386/avx512fintrin.h (_mm_mask_sqrt_sd): New intrinsics.
+ (_mm_maskz_sqrt_sd): Ditto.
+ (_mm_mask_sqrt_ss): Ditto.
+ (_mm_maskz_sqrt_ss): Ditto.
+ (_mm_mask_scalef_sd): Ditto.
+ (_mm_maskz_scalef_sd): Ditto.
+ (_mm_mask_scalef_ss): Ditto.
+ (_mm_maskz_scalef_ss): Ditto.
+ (_mm_mask_cvt_roundsd_ss): Ditto.
+ (_mm_maskz_cvt_roundsd_ss): Ditto.
+ (_mm_mask_cvt_roundss_sd): Ditto.
+ (_mm_maskz_cvt_roundss_sd): Ditto.
+ (_mm_mask_cvtss_sd): Ditto.
+ (_mm_maskz_cvtss_sd): Ditto.
+ (_mm_mask_cvtsd_ss): Ditto.
+ (_mm_maskz_cvtsd_ss): Ditto.
+ (_mm512_cvtsi512_si32): Ditto.
+ (_mm_cvtsd_i32): Ditto.
+ (_mm_cvtss_i32): Ditto.
+ (_mm_cvti32_sd): Ditto.
+ (_mm_cvti32_ss): Ditto.
+ (_mm_cvtsd_i64): Ditto.
+ (_mm_cvtss_i64): Ditto.
+ (_mm_cvti64_sd): Ditto.
+ (_mm_cvti64_ss): Ditto.
+ * config/i386/avx512vlbwintrin.h (_mm256_storeu_epi8): New intrinsics.
+ (_mm_storeu_epi8): Ditto.
+ (_mm256_loadu_epi16): Ditto.
+ (_mm_loadu_epi16): Ditto.
+ (_mm256_loadu_epi8): Ditto.
+ (_mm_loadu_epi8): Ditto.
+ (_mm256_storeu_epi16): Ditto.
+ (_mm_storeu_epi16): Ditto.
+ * config/i386/avx512vlintrin.h (_mm256_load_epi64): New intrinsics.
+ (_mm_load_epi64): Ditto.
+ (_mm256_load_epi32): Ditto.
+ (_mm_load_epi32): Ditto.
+ (_mm256_store_epi32): Ditto.
+ (_mm_store_epi32): Ditto.
+ (_mm256_loadu_epi64): Ditto.
+ (_mm_loadu_epi64): Ditto.
+ (_mm256_loadu_epi32): Ditto.
+ (_mm_loadu_epi32): Ditto.
+ (_mm256_mask_cvt_roundps_ph): Ditto.
+ (_mm256_maskz_cvt_roundps_ph): Ditto.
+ (_mm_mask_cvt_roundps_ph): Ditto.
+ (_mm_maskz_cvt_roundps_ph): Ditto.
+ * config/i386/avxintrin.h (_mm256_cvtsi256_si32): New intrinsics.
+ * config/i386/emmintrin.h (_mm_loadu_si32): New intrinsics.
+ (_mm_loadu_si16): Ditto.
+ (_mm_storeu_si32): Ditto.
+ (_mm_storeu_si16): Ditto.
+ * config/i386/i386-builtin-types.def
+ (V8DF_FTYPE_V8DF_INT_V8DF_UQI_INT): Add new type.
+ (V16SF_FTYPE_V16SF_INT_V16SF_UHI_INT): Ditto.
+ (V4SF_FTYPE_V4SF_V2DF_V4SF_UQI_INT): Ditto.
+ (V2DF_FTYPE_V2DF_V4SF_V2DF_UQI_INT): Ditto.
+ * config/i386/i386-builtin.def
+ (__builtin_ia32_cvtsd2ss_mask_round): New builtin.
+ (__builtin_ia32_cvtss2sd_mask_round): Ditto.
+ (__builtin_ia32_rcp28sd_mask_round): Ditto.
+ (__builtin_ia32_rcp28ss_mask_round): Ditto.
+ (__builtin_ia32_rsqrt28sd_mask_round): Ditto.
+ (__builtin_ia32_rsqrt28ss_mask_round): Ditto.
+ (__builtin_ia32_reducepd512_mask_round): Ditto.
+ (__builtin_ia32_reduceps512_mask_round): Ditto.
+ (__builtin_ia32_reducesd_mask_round): Ditto.
+ (__builtin_ia32_reducess_mask_round): Ditto.
+ * config/i386/i386-expand.c
+ (ix86_expand_round_builtin): Expand round builtin for new type.
+ (V8DF_FTYPE_V8DF_INT_V8DF_UQI_INT)
+ (V16SF_FTYPE_V16SF_INT_V16SF_UHI_INT)
+ (V4SF_FTYPE_V4SF_V2DF_V4SF_UQI_INT)
+ (V2DF_FTYPE_V2DF_V4SF_V2DF_UQI_INT)
+ * config/i386/mmintrin.h ()
+ Define datatype __m32 and __m16.
+ Define datatype __m32_u and __m16_u.
+ * config/i386/sse.md: Adjust pattern.
+ (<mask_codefor>reducep<mode><mask_name><round_saeonly_name>): Adjust.
+ (reduces<mode><mask_scalar_name><round_saeonly_scalar_name>): Ditto.
+ (sse2_cvtsd2ss<mask_name><round_name>): Ditto.
+ (sse2_cvtss2sd<mask_name><round_saeonly_name>): Ditto.
+ (avx512er_vmrcp28<mode><mask_name><round_saeonly_name>): Ditto.
+ (avx512er_vmrsqrt28<mode><mask_name><round_saeonly_name>): Ditto.
+
+2020-10-14 Olivier Hainque <hainque@adacore.com>
+
+ * config/arm/vxworks.h (TARGET_OS_CPP_BUILTINS): Fix
+ the VX_CPU selection for -mcpu=xscale on arm-vxworks.
+
+2020-10-14 Olivier Hainque <hainque@adacore.com>
+
+ * config/rs6000/vxworks.h (TARGET_OS_CPP_BUILTINS): Accommodate
+ expectations from different versions of VxWorks, for 32 or 64bit
+ configurations.
+
+2020-10-14 Olivier Hainque <hainque@adacore.com>
+
+ * config/vxworks.h: #undef CPLUSPLUS_CPP_SPEC.
+
+2020-10-14 Olivier Hainque <hainque@adacore.com>
+
+ * config/t-vxworks: Adjust the VxWorks alternative LIMITS_H guard
+ for glimits.h, make it both closer to the previous one and easier to
+ search for.
+
+2020-10-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/97387
+ * config/i386/i386.md (CC_CCC): New mode iterator.
+ (*setcc_qi_addqi3_cconly_overflow_1_<mode>): New
+ define_insn_and_split.
+ * config/i386/i386.c (ix86_cc_mode): Return CCCmode
+ for *setcc_qi_addqi3_cconly_overflow_1_<mode> pattern operands.
+ (ix86_rtx_costs): Return true and *total = 0;
+ for *setcc_qi_addqi3_cconly_overflow_1_<mode> pattern. Use op0 and
+ op1 temporaries to simplify COMPARE checks.
+
+2020-10-14 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97396
+ * gimple-range.cc (gimple_ranger::range_of_phi): Do not call
+ range_of_ssa_name_with_loop_info with the loop tree root.
+
+2020-10-14 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Split out
+ test for compatible operand types.
+
+2020-10-14 Olivier Hainque <hainque@adacore.com>
+
+ * config/vxworks.c (vxworks_override_options): Guard pic checks with
+ flag_pic > 0 instead of just flag_pic.
+
+2020-10-14 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-fnsummary.c (remap_edge_summaries): Make offset_map HOST_WIDE_INT.
+ (remap_freqcounting_predicate): Likewise.
+ (ipa_merge_fn_summary_after_inlining): Likewise.
+ * ipa-predicate.c (predicate::remap_after_inlining): Likewise
+ * ipa-predicate.h (remap_after_inlining): Update.
+
+2020-10-14 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (compute_parm_map): Handle POINTER_PLUS_EXPR in
+ PASSTHROUGH.
+
+2020-10-14 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Move
+ check for duplicate/interleave of variable size constants
+ to a place done once and early.
+ (vect_build_slp_tree_2): Adjust heuristics when to build
+ a BB SLP node from scalars.
+
+2020-10-14 Tom de Vries <tdevries@suse.de>
+
+ * tracer.c (cached_can_duplicate_bb_p, analyze_bb): Use
+ can_duplicate_block_p.
+ (can_duplicate_insn_p, can_duplicate_bb_no_insn_iter_p)
+ (can_duplicate_bb_p): Move and merge ...
+ * tree-cfg.c (gimple_can_duplicate_bb_p): ... here.
+
+2020-10-14 Jan Hubicka <hubicka@ucw.cz>
+
+ * doc/invoke.texi: (ipa-jump-function-lookups): Document param.
+ * ipa-modref.c (merge_call_side_effects): Use
+ unadjusted_ptr_and_unit_offset.
+ * ipa-prop.c (unadjusted_ptr_and_unit_offset): New function.
+ * ipa-prop.h (unadjusted_ptr_and_unit_offset): Declare.
+ * params.opt: (-param-ipa-jump-function-lookups): New.
+
+2020-10-14 Jan Hubicka <jh@suse.cz>
+
+ PR bootstrap/97350
+ * ipa-modref.c (ignore_edge): Do not ignore inlined edes.
+ (ipa_merge_modref_summary_after_inlining): Improve debug output and
+ fix parameter of ignore_stores_p.
+
+2020-10-14 Kito Cheng <kito.cheng@sifive.com>
+
+ PR target/96759
+ * expr.c (expand_assignment): Handle misaligned stores with PARALLEL
+ value.
+
+2020-10-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/97386
+ * combine.c (simplify_shift_const_1): Don't optimize nested ROTATEs if
+ they have different modes.
+
+2020-10-13 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97379
+ * gimple-range-edge.cc (outgoing_range::calc_switch_ranges): Do
+ not save hash slot across calls to hash_table<>::get_or_insert.
+
+2020-10-13 Tobias Burnus <tobias@codesourcery.com>
+
+ * lto-wrapper.c (find_crtoffloadtable): Fix last commit
+ by adding NULL as last argument to concat.
+
+2020-10-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/aarch64/aarch64.c (neoversen2_tunings): Define.
+ * config/aarch64/aarch64-cores.def (neoverse-n2): Use it.
+
+2020-10-13 Tobias Burnus <tobias@codesourcery.com>
+
+ * lto-wrapper.c (find_crtoffloadtable): With -save-temps,
+ use non-temp file name utilizing the dump prefix.
+ (run_gcc): Update call.
+
+2020-10-13 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97382
+ * tree-vectorizer.h (_stmt_vec_info::same_align_refs): Remove.
+ (STMT_VINFO_SAME_ALIGN_REFS): Likewise.
+ * tree-vectorizer.c (vec_info::new_stmt_vec_info): Do not
+ allocate STMT_VINFO_SAME_ALIGN_REFS.
+ (vec_info::free_stmt_vec_info): Do not release
+ STMT_VINFO_SAME_ALIGN_REFS.
+ * tree-vect-data-refs.c (vect_analyze_data_ref_dependences):
+ Do not compute self and read-read dependences.
+ (vect_dr_aligned_if_related_peeled_dr_is): New helper.
+ (vect_dr_aligned_if_peeled_dr_is): Likewise.
+ (vect_update_misalignment_for_peel): Use it instead of
+ iterating over STMT_VINFO_SAME_ALIGN_REFS.
+ (dr_align_group_sort_cmp): New function.
+ (vect_enhance_data_refs_alignment): Count the number of
+ same aligned refs here and elide uses of STMT_VINFO_SAME_ALIGN_REFS.
+ (vect_find_same_alignment_drs): Remove.
+ (vect_analyze_data_refs_alignment): Do not call it.
+ * vec.h (auto_vec<T, 0>::auto_vec): Adjust CTOR to take
+ a vec<>&&, assert it isn't using auto storage.
+ (auto_vec& operator=): Apply a similar change.
+
+2020-10-13 Tobias Burnus <tobias@codesourcery.com>
+
+ * config/nvptx/mkoffload.c (main): Add missing fclose (in).
+
+2020-10-13 Zhiheng Xie <xiezhiheng@huawei.com>
+ Nannan Zheng <zhengnannan@huawei.com>
+
+ * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+ for mul/mla/mls intrinsics.
+
+2020-10-13 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (add_taskreg_looptemp_clauses): For triangular loops
+ with non-constant number of iterations add another 4 _looptemp_
+ clauses before the (optional) one for lastprivate.
+ (lower_omp_for_lastprivate): Skip those clauses when looking for
+ the lastprivate clause.
+ (lower_omp_for): For triangular loops with non-constant number of
+ iterations add another 4 _looptemp_ clauses.
+ * omp-expand.c (expand_omp_for_init_counts): For triangular loops
+ with non-constant number of iterations set counts[0],
+ fd->first_inner_iterations, fd->factor and fd->adjn1 from the newly
+ added _looptemp_ clauses.
+ (expand_omp_for_init_vars): Initialize the newly added _looptemp_
+ clauses.
+ (find_lastprivate_looptemp): New function.
+ (expand_omp_for_static_nochunk, expand_omp_for_static_chunk,
+ expand_omp_taskloop_for_outer): Use it instead of manually skipping
+ _looptemp_ clauses.
+
+2020-10-13 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/97389
+ * ipa-modref.c (dump_lto_records): Fix formating of dump file.
+ (modref_summary::dump): Do not check loads to be non-null.
+ (modref_summary_lto::dump): Do not check loads to be non-null.
+ (merge_call_side_effects): Improve debug output.
+ (analyze_call): Crash when cur_summary->loads is NULL.
+ (analyze_function): Update.
+ (modref_summaries::insert): Insert only into summaries, not
+ optimization_summaries.
+ (modref_summaries::duplicate): Likewise; crash when load or sotres
+ are NULL.
+ (modref_summaries_lto::duplicate): Crash when loads or stores are NULL.
+ (write_modref_records): param_index is signed.
+ (read_modref_records): param_index is signed.
+ (modref_write): Crash when loads or stores are NULL.
+ (read_section): Compensate previous change.
+ (pass_modref::execute): Do not check optimization_summaries t be
+ non-NULL.
+ (ignore_edge): Fix.
+ (compute_parm_map): Fix formating.
+ (modref_propagate_in_scc): Do not expect loads/stores to be NULL.
+
+2020-10-12 Alexandre Oliva <oliva@adacore.com>
+
+ * builtins.c (mathfn_built_in_type): Use CFN_ enumerators.
+
+2020-10-12 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97381
+ * gimple-range-gori.cc (gori_compute::compute_operand2_range): If a range cannot be
+ calculated through operand 2, return false.
+
+2020-10-12 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97378
+ * range-op.cc (operator_trunc_mod::wi_fold): Return VARYING for mod by zero.
+
+2020-10-12 David Malcolm <dmalcolm@redhat.com>
+
+ * doc/invoke.texi: Document -Wanalyzer-write-to-const and
+ -Wanalyzer-write-to-string-literal.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97342
+ PR middle-end/97023
+ PR middle-end/96384
+ * builtins.c (access_ref::access_ref): Initialize new member. Use
+ new enum.
+ (access_ref::size_remaining): Define new member function.
+ (inform_access): Handle expressions referencing objects.
+ (gimple_call_alloc_size): Call get_size_range instead of get_range.
+ (gimple_call_return_array): New function.
+ (get_range): Rename...
+ (get_offset_range): ...to this. Improve detection of ranges from
+ types of expressions.
+ (gimple_call_return_array): Adjust calls to get_range per above.
+ (compute_objsize): Same. Set maximum size or offset instead of
+ failing for unknown objects and handle more kinds of expressions.
+ (compute_objsize): Call access_ref::size_remaining.
+ (compute_objsize): Have transitional wrapper fail for pointers
+ into unknown objects.
+ (expand_builtin_strncmp): Call access_ref::size_remaining and
+ handle new cases.
+ * builtins.h (access_ref::size_remaining): Declare new member function.
+ (access_ref::set_max_size_range): Define new member function.
+ (access_ref::add_ofset, access_ref::add_max_ofset): Same.
+ (access_ref::add_base0): New data member.
+ * calls.c (get_size_range): Change argument type. Handle new
+ condition.
+ * calls.h (get_size_range): Adjust signature.
+ (enum size_range_flags): Define new type.
+ * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Correct
+ argument to get_size_range.
+ * tree-ssa-strlen.c (get_range): Handle anti-ranges.
+ (maybe_warn_overflow): Check DECL_P before assuming it's one.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR c++/96511
+ PR middle-end/96384
+ * builtins.c (get_range): Return full range of type when neither
+ value nor its range is available. Fail for ranges inverted due
+ to the signedness of offsets.
+ (compute_objsize): Handle more special array members. Handle
+ POINTER_PLUS_EXPR and VIEW_CONVERT_EXPR that come up in front end
+ code.
+ (access_ref::offset_bounded): Define new member function.
+ * builtins.h (access_ref::eval): New data member.
+ (access_ref::offset_bounded): New member function.
+ (access_ref::offset_zero): New member function.
+ (compute_objsize): Declare a new overload.
+ * gimple-array-bounds.cc (array_bounds_checker::check_array_ref): Use
+ enum special_array_member.
+ * tree.c (component_ref_size): Use special_array_member.
+ * tree.h (special_array_member): Define a new type.
+ (component_ref_size): Change signature.
+
+2020-10-12 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref.c (modref_summaries): Remove field IPA.
+ (class modref_summary_lto): New global variable.
+ (class modref_summaries_lto): New.
+ (modref_summary::modref_summary): Remove loads_lto and stores_lto.
+ (modref_summary::~modref_summary): Remove loads_lto and stores_lto.
+ (modref_summary::useful_p): Do not use lto_useful.
+ (modref_records_lto): New typedef.
+ (struct modref_summary_lto): New type.
+ (modref_summary_lto::modref_summary_lto): New member function.
+ (modref_summary_lto::~modref_summary_lto): New member function.
+ (modref_summary_lto::useful_p): New member function.
+ (modref_summary::dump): Do not handle lto.
+ (modref_summary_lto::dump): New member function.
+ (get_modref_function_summary): Use optimization_summary.
+ (merge_call_side_effects): Use optimization_summary.
+ (analyze_call): Use optimization_summary.
+ (struct summary_ptrs): New struture.
+ (analyze_load): Update to handle separate lto and non-lto summaries.
+ (analyze_store): Likewise.
+ (analyze_stmt): Likewise.
+ (remove_summary): Break out from ...
+ (analyze_function): ... here; update to handle seprated summaries.
+ (modref_summaries::insert): Do not handle lto summary.
+ (modref_summaries_lto::insert): New member function.
+ (modref_summaries::duplicate): Do not handle lto summary.
+ (modref_summaries_lto::duplicate): New member function.
+ (read_modref_records): Expect nolto_ret or lto_ret to be NULL>
+ (modref_write): Write lto summary.
+ (read_section): Handle separated summaries.
+ (modref_read): Initialize separated summaries.
+ (modref_transform): Handle separated summaries.
+ (pass_modref::execute): Turn summary to optimization_summary; handle
+ separate summaries.
+ (ignore_edge): Handle separate summaries.
+ (ipa_merge_modref_summary_after_inlining): Likewise.
+ (collapse_loads): Likewise.
+ (modref_propagate_in_scc): Likewise.
+ (pass_ipa_modref::execute): Likewise.
+ (ipa_modref_c_finalize): Likewise.
+ * ipa-modref.h (modref_records_lto): Remove typedef.
+ (struct modref_summary): Remove stores_lto, loads_lto and finished
+ fields; remove lto_useful_p member function.
+
+2020-10-12 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-data-refs.c (vect_slp_analyze_instance_dependence):
+ Use SLP_TREE_REPRESENTATIVE.
+ * tree-vectorizer.h (_slp_tree::vertex): New member used
+ for graphds interfacing.
+ * tree-vect-slp.c (vect_build_slp_tree_2): Allocate space
+ for PHI SLP children.
+ (vect_analyze_slp_backedges): New function filling in SLP
+ node children for PHIs that correspond to backedge values.
+ (vect_analyze_slp): Call vect_analyze_slp_backedges for the
+ graph.
+ (vect_slp_analyze_node_operations): Deal with a cyclic graph.
+ (vect_schedule_slp_instance): Likewise.
+ (vect_schedule_slp): Likewise.
+ (slp_copy_subtree): Remove.
+ (vect_slp_rearrange_stmts): Likewise.
+ (vect_attempt_slp_rearrange_stmts): Likewise.
+ (vect_slp_build_vertices): New functions.
+ (vect_slp_permute): Likewise.
+ (vect_slp_perms_eq): Likewise.
+ (vect_optimize_slp): Remove special code to elide
+ permutations with SLP reductions. Implement generic
+ permute optimization.
+
+2020-10-12 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * config/arm/arm.c (arm_preferred_simd_mode): Use E_FOOmode
+ instead of FOOmode.
+
+2020-10-12 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/97079
+ * internal-fn.c (internal_fn_stored_value_index): Handle also
+ .MASK_STORE_LANES.
+ * tree-vect-patterns.c (vect_recog_over_widening_pattern): Bail
+ out for unsupported TREE_TYPE.
+
+2020-10-12 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_bb_partition_graph_r): Use visited
+ hash-map.
+ (vect_bb_partition_graph): Likewise.
+
+2020-10-12 Duan bo <duanbo3@huawei.com>
+
+ PR target/96757
+ * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Add
+ the identification and handling of the dropped situation in the
+ cond expression processing phase.
+
+2020-10-12 Tobias Burnus <tobias@codesourcery.com>
+
+ * doc/invoke.texi (nvptx's -misa): Update default to sm_35.
+
+2020-10-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/97349
+ * config/aarch64/arm_neon.h (vdupq_n_p8, vdupq_n_p16,
+ vdupq_n_p64, vdupq_n_s8, vdupq_n_s16, vdupq_n_u8, vdupq_n_u16):
+ Fix argument type.
+
+2020-10-12 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * config/s390/s390-protos.h (s390_build_signbit_mask): New
+ function.
+ * config/s390/s390.c (s390_contiguous_bitmask_vector_p):
+ Bitcast the argument to an integral mode.
+ (s390_expand_vec_init): Do not call
+ s390_contiguous_bitmask_vector_p with a scalar argument.
+ (s390_build_signbit_mask): New function.
+ * config/s390/vector.md (copysign<mode>3): Use bitwise
+ operations.
+
+2020-10-12 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97371
+ * range-op.cc (operator_rshift::op1_range): Ignore shifts larger than
+ or equal to type precision.
+
+2020-10-12 Martin Liska <mliska@suse.cz>
+
+ * ipa-modref.c (merge_call_side_effects): Clear modref_parm_map
+ fields in the vector.
+
+2020-10-12 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_analyze_slp_instance): Set matches to true
+ after successful discovery but forced split.
+
+2020-10-12 Tom de Vries <tdevries@suse.de>
+
+ * config/nvptx/nvptx.opt (-msoft-stack-reserve-local): Rename to ...
+ (-msoft-stack-reserve-local=): ... this.
+
+2020-10-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97357
+ * tree-ssa-loop-split.c (ssa_semi_invariant_p): Abnormal
+ SSA names are not semi invariant.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.c (darwin_globalize_label): Make a subset of
+ metadate symbols global.
+ (darwin_label_is_anonymous_local_objc_name): Make a subset of
+ metadata symbols linker-visible.
+ (darwin_override_options): Track more target OS versions, make
+ the next_runtime version track this (unless it's set to 0 for
+ GNU runtime).
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.c (darwin_globalize_label): Add protocol
+ meta-data labels to the set that are global.
+ (darwin_label_is_anonymous_local_objc_name): Arrange for meta-
+ data start labels to be linker-visible.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.c (darwin_objc2_section): Allow for
+ values > 1 to represent the next runtime.
+ (darwin_objc1_section): Likewise.
+ * config/darwin.h (NEXT_OBJC_RUNTIME): Set the default
+ next runtime value to be 10.5.8.
+
+2020-10-10 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (modref_transform): Fix parameter map computation.
+
+2020-10-10 Tom de Vries <tdevries@suse.de>
+
+ PR target/97318
+ * config/nvptx/nvptx.c (nvptx_replace_dot): New function.
+ (write_fn_proto, write_fn_proto_from_insn, nvptx_output_call_insn):
+ Use nvptx_replace_dot.
+
+2020-10-10 Tom de Vries <tdevries@suse.de>
+
+ * config/nvptx/nvptx.c (write_fn_proto_1): New function, factored out
+ of ...
+ (write_fn_proto): ... here. Return void.
+
+2020-10-10 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (remap_arguments): Check range in map access.
+
+2020-10-10 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (modref_transform): Use reserve instead of safe_grow.
+
+2020-10-10 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (modref_transform): Check that summaries are allocated.
+
+2020-10-10 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref-tree.h (struct modref_tree): Revert prevoius change.
+ * ipa-modref.c (analyze_function): Dump original summary.
+ (modref_read): Only set IPA if streaming summary (not optimization
+ summary).
+ (remap_arguments): New function.
+ (modref_transform): New function.
+ (compute_parm_map): Fix offset calculation.
+ (ipa_merge_modref_summary_after_inlining): Do not merge stores when
+ they can be ignored.
+
+2020-10-10 Jan Hubicka <jh@suse.cz>
+
+ * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Improve debug dumps.
+ (call_may_clobber_ref_p_1): Improve debug dumps.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.c (output_objc_section_asm_op): Avoid extra
+ objective-c section switches unless the linker needs them.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin-sections.def (objc2_data_section): New.
+ (objc2_ivar_section): New.
+ * config/darwin.c (darwin_objc2_section): Act on Protocol and
+ ivar refs.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin-sections.def (objc2_class_names_section,
+ objc2_method_names_section, objc2_method_types_section): New
+ * config/darwin.c (output_objc_section_asm_op): Output new
+ sections. (darwin_objc2_section): Select new sections where
+ used.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin.c (darwin_emit_local_bss): Amend section names to
+ match system tools. (darwin_output_aligned_bss): Likewise.
+
+2020-10-10 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97359
+ * gimple-range-gori.cc (logical_stmt_cache::cacheable_p): Only
+ handle ANDs and ORs.
+ (gori_compute_cache::cache_stmt): Adjust comment.
+
+2020-10-09 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/97313
+ * lra-constraints.c (match_reload): Don't keep strict_low_part in
+ reloads for non-registers.
+
+2020-10-09 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97148
+ * config.gcc (extra_headers): Add x86gprintrin.h.
+ * config/i386/adxintrin.h: Check _X86GPRINTRIN_H_INCLUDED for
+ <x86gprintrin.h>.
+ * config/i386/bmi2intrin.h: Likewise.
+ * config/i386/bmiintrin.h: Likewise.
+ * config/i386/cetintrin.h: Likewise.
+ * config/i386/cldemoteintrin.h: Likewise.
+ * config/i386/clflushoptintrin.h: Likewise.
+ * config/i386/clwbintrin.h: Likewise.
+ * config/i386/enqcmdintrin.h: Likewise.
+ * config/i386/fxsrintrin.h: Likewise.
+ * config/i386/ia32intrin.h: Likewise.
+ * config/i386/lwpintrin.h: Likewise.
+ * config/i386/lzcntintrin.h: Likewise.
+ * config/i386/movdirintrin.h: Likewise.
+ * config/i386/pconfigintrin.h: Likewise.
+ * config/i386/pkuintrin.h: Likewise.
+ * config/i386/rdseedintrin.h: Likewise.
+ * config/i386/rtmintrin.h: Likewise.
+ * config/i386/serializeintrin.h: Likewise.
+ * config/i386/tbmintrin.h: Likewise.
+ * config/i386/tsxldtrkintrin.h: Likewise.
+ * config/i386/waitpkgintrin.h: Likewise.
+ * config/i386/wbnoinvdintrin.h: Likewise.
+ * config/i386/xsavecintrin.h: Likewise.
+ * config/i386/xsaveintrin.h: Likewise.
+ * config/i386/xsaveoptintrin.h: Likewise.
+ * config/i386/xsavesintrin.h: Likewise.
+ * config/i386/xtestintrin.h: Likewise.
+ * config/i386/immintrin.h: Include <x86gprintrin.h> instead of
+ <fxsrintrin.h>, <xsaveintrin.h>, <xsaveoptintrin.h>,
+ <xsavesintrin.h>, <xsavecintrin.h>, <lzcntintrin.h>,
+ <bmiintrin.h>, <bmi2intrin.h>, <xtestintrin.h>, <cetintrin.h>,
+ <movdirintrin.h>, <sgxintrin.h, <pconfigintrin.h>,
+ <waitpkgintrin.h>, <cldemoteintrin.h>, <enqcmdintrin.h>,
+ <serializeintrin.h>, <tsxldtrkintrin.h>, <adxintrin.h>,
+ <clwbintrin.h>, <clflushoptintrin.h>, <wbnoinvdintrin.h> and
+ <pkuintrin.h>.
+ (_wbinvd): Moved to config/i386/x86gprintrin.h.
+ (_rdrand16_step): Likewise.
+ (_rdrand32_step): Likewise.
+ (_rdpid_u32): Likewise.
+ (_readfsbase_u32): Likewise.
+ (_readfsbase_u64): Likewise.
+ (_readgsbase_u32): Likewise.
+ (_readgsbase_u64): Likewise.
+ (_writefsbase_u32): Likewise.
+ (_writefsbase_u64): Likewise.
+ (_writegsbase_u32): Likewise.
+ (_writegsbase_u64): Likewise.
+ (_rdrand64_step): Likewise.
+ (_ptwrite64): Likewise.
+ (_ptwrite32): Likewise.
+ * config/i386/x86gprintrin.h: New file.
+ * config/i386/x86intrin.h: Include <x86gprintrin.h>. Don't
+ include <ia32intrin.h>, <lwpintrin.h>, <tbmintrin.h>,
+ <popcntintrin.h>, <mwaitxintrin.h> and <clzerointrin.h>.
+
+2020-10-09 Tom de Vries <tdevries@suse.de>
+
+ PR target/97348
+ * config/nvptx/nvptx.h (ASM_SPEC): Also pass -m to nvptx-as if
+ default is used.
+ * config/nvptx/nvptx.opt (misa): Init with PTX_ISA_SM35.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ * doc/sourcebuild.texi (vect_masked_load): Document.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97334
+ * tree-vect-slp.c (vect_build_slp_tree_1): Do not fatally
+ fail lanes other than zero when BB vectorizing.
+
+2020-10-09 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97292
+ PR ipa/97335
+ * ipa-modref-tree.h (copy_from): Drop summary in a
+ clone.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97347
+ * tree-vect-slp.c (vect_create_constant_vectors): Use
+ edge insertion when inserting on the fallthru edge,
+ appropriately insert at the start of BBs when inserting
+ after PHIs.
+
+2020-10-09 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97317
+ * range-op.cc (operator_cast::op1_range): Handle casts where the precision
+ of the RHS is only 1 greater than the precision of the LHS.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ * cgraphunit.c (expand_all_functions): Free tp_first_run_order.
+ * ipa-modref.c (pass_ipa_modref::execute): Free order.
+ * tree-ssa-loop-niter.c (estimate_numbers_of_iterations): Free
+ loop body.
+ * tree-vect-data-refs.c (vect_find_stmt_data_reference): Free
+ data references upon failure.
+ * tree-vect-loop.c (update_epilogue_loop_vinfo): Free BBs
+ array of the original loop.
+ * tree-vect-slp.c (vect_slp_bbs): Use an auto_vec for
+ dataref_groups to release its memory.
+
+2020-10-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94801
+ PR target/97312
+ * vr-values.c (vr_values::extract_range_basic) <CASE_CFN_CLZ,
+ CASE_CFN_CTZ>: When stmt is not an internal-fn call or
+ C?Z_DEFINED_VALUE_AT_ZERO is not 2, assume argument is not zero
+ and thus use [0, prec-1] range unless it can be further improved.
+ For CTZ, don't update maxi from upper bound if it was previously prec.
+ * gimple-range.cc (gimple_ranger::range_of_builtin_call) <CASE_CFN_CLZ,
+ CASE_CFN_CTZ>: Likewise.
+
+2020-10-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97325
+ * match.pd (FFS(nonzero) -> CTZ(nonzero) + 1): Cast argument to
+ corresponding unsigned type.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_create_constant_vectors): Properly insert
+ after PHIs.
+
+2020-10-08 Alexandre Oliva <oliva@adacore.com>
+
+ * builtins.c (mathfn_built_in_type): New.
+ * builtins.h (mathfn_built_in_type): Declare.
+ * tree-ssa-math-opts.c (execute_cse_sincos_1): Use it to
+ obtain the type expected by the intrinsic.
+
+2020-10-08 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * config/rs6000/rs6000-builtin.def (BU_P10_MISC_2): Rename
+ to BU_P10_POWERPC64_MISC_2.
+ CFUGED, CNTLZDM, CNTTZDM, PDEPD, PEXTD): Call renamed macro.
+
+2020-10-08 Jan Hubicka <jh@suse.cz>
+
+ * tree-nrv.c (dest_safe_for_nrv_p): Disable tbaa in
+ call_may_clobber_ref_p and ref_maybe_used_by_stmt_p.
+ * tree-tailcall.c (find_tail_calls): Likewise.
+ * tree-ssa-alias.c (call_may_clobber_ref_p): Add tbaa_p parameter.
+ * tree-ssa-alias.h (call_may_clobber_ref_p): Update prototype.
+ * tree-ssa-sccvn.c (vn_reference_lookup_3): Pass data->tbaa_p
+ to call_may_clobber_ref_p_1.
+
+2020-10-08 Mark Wielaard <mark@klomp.org>
+
+ * dwarf2out.c (dwarf2out_finish): Emit .file 0 entry when
+ generating DWARF5 .debug_line table through gas.
+
+2020-10-08 John Henning <john.henning@oracle.com>
+
+ PR other/97309
+ * doc/invoke.texi: Improve documentation of
+ -fallow-store-data-races.
+
+2020-10-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96914
+ * config/arm/arm_mve.h (__arm_vcvtnq_u32_f32): New.
+
+2020-10-08 Martin Liska <mliska@suse.cz>
+ Richard Biener <rguenther@suse.de>
+
+ * tree-vectorizer.h (_bb_vec_info::const_iterator): Remove.
+ (_bb_vec_info::const_reverse_iterator): Likewise.
+ (_bb_vec_info::region_stmts): Likewise.
+ (_bb_vec_info::reverse_region_stmts): Likewise.
+ (_bb_vec_info::_bb_vec_info): Adjust.
+ (_bb_vec_info::bb): Remove.
+ (_bb_vec_info::region_begin): Remove.
+ (_bb_vec_info::region_end): Remove.
+ (_bb_vec_info::bbs): New vector of BBs.
+ (vect_slp_function): Declare.
+ * tree-vect-patterns.c (vect_determine_precisions): Use
+ regular stmt iteration.
+ (vect_pattern_recog): Likewise.
+ * tree-vect-slp.c: Include cfganal.h, tree-eh.h and tree-cfg.h.
+ (vect_build_slp_tree_1): Properly refuse to vectorize
+ volatile and throwing stmts.
+ (vect_build_slp_tree_2): Pass group-size down to
+ get_vectype_for_scalar_type.
+ (_bb_vec_info::_bb_vec_info): Use regular stmt iteration,
+ adjust for changed region specification.
+ (_bb_vec_info::~_bb_vec_info): Likewise.
+ (vect_slp_check_for_constructors): Likewise.
+ (vect_slp_region): Likewise.
+ (vect_slp_bbs): New worker operating on a vector of BBs.
+ (vect_slp_bb): Wrap it.
+ (vect_slp_function): New function splitting the function
+ into multi-BB regions.
+ (vect_create_constant_vectors): Handle the case of inserting
+ after a throwing def.
+ (vect_schedule_slp_instance): Adjust.
+ * tree-vectorizer.c (vec_info::remove_stmt): Simplify again.
+ (vec_info::insert_seq_on_entry): Adjust.
+ (pass_slp_vectorize::execute): Also init PHIs. Call
+ vect_slp_function.
+
+2020-10-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97330
+ * tree-ssa-sink.c (statement_sink_location): Avoid skipping
+ PHIs when they dominate the insert location.
+
+2020-10-08 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (get_access): Fix handling of offsets.
+ * tree-ssa-alias.c (modref_may_conflict): Watch for overflows.
+
+2020-10-08 Martin Liska <mliska@suse.cz>
+
+ * dbgcnt.def (DEBUG_COUNTER): Add ipa_mod_ref debug counter.
+ * tree-ssa-alias.c (modref_may_conflict): Handle the counter.
+
+2020-10-08 Richard Biener <rguenther@suse.de>
+
+ * tree-vectorizer.c (try_vectorize_loop_1): Do not dump
+ "basic block vectorized".
+ (pass_slp_vectorize::execute): Likewise.
+ * tree-vect-slp.c (vect_analyze_slp_instance): Avoid
+ re-analyzing split single stmts.
+
+2020-10-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96914
+ * config/arm/arm_mve.h (vqrdmlashq_n_u8, vqrdmlashq_n_u16)
+ (vqrdmlashq_n_u32, vqrdmlahq_n_u8, vqrdmlahq_n_u16)
+ (vqrdmlahq_n_u32, vqdmlahq_n_u8, vqdmlahq_n_u16, vqdmlahq_n_u32)
+ (vmlaldavaxq_p_u16, vmlaldavaxq_p_u32): Remove.
+ * config/arm/arm_mve_builtins.def (vqrdmlashq_n_u, vqrdmlahq_n_u)
+ (vqdmlahq_n_u, vmlaldavaxq_p_u): Remove.
+ * config/arm/unspecs.md (VQDMLAHQ_N_U, VQRDMLAHQ_N_U)
+ (VQRDMLASHQ_N_U)
+ (VMLALDAVAXQ_P_U): Remove unspecs.
+ * config/arm/iterators.md (VQDMLAHQ_N_U, VQRDMLAHQ_N_U)
+ (VQRDMLASHQ_N_U, VMLALDAVAXQ_P_U): Remove attributes.
+ (VQDMLAHQ_N, VQRDMLAHQ_N, VQRDMLASHQ_N, VMLALDAVAXQ_P): Remove
+ unsigned variants from iterators.
+ * config/arm/mve.md (mve_vqdmlahq_n_<supf><mode>)
+ (mve_vqrdmlahq_n_<supf><mode>)
+ (mve_vqrdmlashq_n_<supf><mode>, mve_vmlaldavaxq_p_<supf><mode>):
+ Update comment.
+
+2020-10-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96914
+ * config/arm/arm_mve.h (vqdmlashq, vqdmlashq_m): Define.
+ * config/arm/arm_mve_builtins.def (vqdmlashq_n_s)
+ (vqdmlashq_m_n_s,): New.
+ * config/arm/unspecs.md (VQDMLASHQ_N_S, VQDMLASHQ_M_N_S): New
+ unspecs.
+ * config/arm/iterators.md (VQDMLASHQ_N_S, VQDMLASHQ_M_N_S): New
+ attributes.
+ (VQDMLASHQ_N): New iterator.
+ * config/arm/mve.md (mve_vqdmlashq_n_, mve_vqdmlashq_m_n_s): New
+ patterns.
+
+2020-10-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/97322
+ * config/arm/arm.c (arm_expand_divmod_libfunc): Pass mode instead of
+ GET_MODE (op0) or GET_MODE (op1) to emit_library_call_value.
+
+2020-10-08 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97325
+ * gimple-range.cc (gimple_ranger::range_of_builtin_call): Handle
+ negative numbers in __builtin_ffs and __builtin_popcount.
+
+2020-10-08 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97315
+ * range-op.cc (value_range_with_overflow): Change any
+ non-overflow calculation in which both bounds are
+ overflow/underflow to be undefined.
+
+2020-10-08 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97315
+ * gimple-ssa-evrp.c (hybrid_folder::choose_value): Removes the
+ trap and instead annotates the listing.
+
+2020-10-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/97294
+ * tree-cfg.c (move_block_to_fn): Call notice_special_calls on
+ call stmts being moved into dest_cfun.
+ * omp-low.c (lower_rec_input_clauses): Set cfun->calls_alloca when
+ adding __builtin_alloca_with_align call without gimplification.
+
+2020-10-07 Aldy Hernandez <aldyh@redhat.com>
+
+ * common.opt (-fevrp-mode): Rename and move...
+ * params.opt (--param=evrp-mode): ...here.
+ * gimple-range.h (DEBUG_RANGE_CACHE): Use param_evrp_mode instead
+ of flag_evrp_mode.
+ * gimple-ssa-evrp.c (rvrp_folder): Same.
+ (hybrid_folder): Same.
+ (execute_early_vrp): Same.
+
+2020-10-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97307
+ * tree-ssa-sink.c (statement_sink_location): Change heuristic
+ for not skipping stores to look for virtual definitions
+ rather than uses.
+
+2020-10-07 Andrew MacLeod <amacleod@redhat.com>
+
+ * value-range.h (irange_allocator::allocate): Allocate in two hunks
+ instead of using the variably-sized trailing array approach.
+
+2020-10-07 David Malcolm <dmalcolm@redhat.com>
+
+ * doc/invoke.texi (-fdiagnostics-plain-output): Add
+ -fdiagnostics-path-format=separate-events to list of
+ options injected by -fdiagnostics-plain-output.
+ * opts-common.c (decode_cmdline_options_to_array): Likewise.
+
+2020-10-07 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/96394
+ * ipa-prop.c (update_indirect_edges_after_inlining): Do not add
+ resolved speculation edges to vector of new direct edges even in
+ presence of multiple speculative direct edges for a single call.
+
+2020-10-07 Andrew Stubbs <ams@codesourcery.com>
+
+ * config/gcn/gcn.md (unspec): Add UNSPEC_ADDPTR.
+ (addptrdi3): Add SGPR alternative.
+
+2020-10-07 Mark Wielaard <mark@klomp.org>
+
+ * dwarf2out.c (add_filepath_AT_string): New function.
+ (asm_outputs_debug_line_str): Likewise.
+ (add_filename_attribute): Likewise.
+ (add_comp_dir_attribute): Call add_filepath_AT_string.
+ (gen_compile_unit_die): Call add_filename_attribute for name.
+ (init_sections_and_labels): Init debug_line_str_section when
+ asm_outputs_debug_line_str return true.
+ (dwarf2out_early_finish): Remove DW_AT_name and DW_AT_comp_dir
+ hack and call add_filename_attribute for the remap_debug_filename.
+
+2020-10-07 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac (HAVE_AS_GDWARF_5_DEBUG_FLAG,
+ HAVE_AS_WORKING_DWARF_4_FLAG): New tests.
+ * gcc.c (ASM_DEBUG_DWARF_OPTION): Define.
+ (ASM_DEBUG_SPEC): Use ASM_DEBUG_DWARF_OPTION instead of
+ "--gdwarf2". Use %{cond:opt1;:opt2} style.
+ (ASM_DEBUG_OPTION_DWARF_OPT): Define.
+ (ASM_DEBUG_OPTION_SPEC): Define.
+ (asm_debug_option): New variable.
+ (asm_options): Add "%(asm_debug_option)".
+ (static_specs): Add asm_debug_option entry.
+ (static_spec_functions): Add dwarf-version-gt.
+ (debug_level_greater_than_spec_func): New function.
+ * config/darwin.h (ASM_DEBUG_OPTION_SPEC): Define.
+ * config/darwin9.h (ASM_DEBUG_OPTION_SPEC): Redefine.
+ * config.in: Regenerated.
+ * configure: Regenerated.
+
+2020-10-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/97305
+ * optc-save-gen.awk: Don't declare mask variable if explicit_mask
+ array is not present.
+
+2020-10-07 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-expand.c (expand_omp_simd): Don't emit MIN_EXPR and PLUS_EXPR
+ at the end of entry_bb and innermost init_bb, instead force arguments
+ for MIN_EXPR into temporaries in both cases and jump to a new bb that
+ performs MIN_EXPR and PLUS_EXPR.
+
+2020-10-07 Tom de Vries <tdevries@suse.de>
+
+ * tree-ssa-loop-ch.c (ch_base::copy_headers): Add missing NULL test
+ for dump_file.
+
+2020-10-06 Andrew MacLeod <amacleod@redhat.com>
+
+ * flag-types.h (enum evrp_mode): New enumerated type EVRP_MODE_*.
+ * common.opt (fevrp-mode): New undocumented flag.
+ * gimple-ssa-evrp.c: Include gimple-range.h
+ (class rvrp_folder): EVRP folding using ranger exclusively.
+ (rvrp_folder::rvrp_folder): New.
+ (rvrp_folder::~rvrp_folder): New.
+ (rvrp_folder::value_of_expr): New. Use rangers value_of_expr.
+ (rvrp_folder::value_on_edge): New. Use rangers value_on_edge.
+ (rvrp_folder::value_of_Stmt): New. Use rangers value_of_stmt.
+ (rvrp_folder::fold_stmt): New. Call the simplifier.
+ (class hybrid_folder): EVRP folding using both engines.
+ (hybrid_folder::hybrid_folder): New.
+ (hybrid_folder::~hybrid_folder): New.
+ (hybrid_folder::fold_stmt): New. Simplify with one engne, then the
+ other.
+ (hybrid_folder::value_of_expr): New. Use both value routines.
+ (hybrid_folder::value_on_edge): New. Use both value routines.
+ (hybrid_folder::value_of_stmt): New. Use both value routines.
+ (hybrid_folder::choose_value): New. Choose between range_analzyer and
+ rangers values.
+ (execute_early_vrp): Choose a folder based on flag_evrp_mode.
+ * vr-values.c (simplify_using_ranges::fold_cond): Try range_of_stmt
+ first to see if it returns a value.
+ (simplify_using_ranges::simplify_switch_using_ranges): Return true if
+ any changes were made to the switch.
+
+2020-10-06 Andrew MacLeod <amacleod@redhat.com>
+
+ * Makefile.in (OBJS): Add gimple-range*.o.
+ * gimple-range.h: New file.
+ * gimple-range.cc: New file.
+ * gimple-range-cache.h: New file.
+ * gimple-range-cache.cc: New file.
+ * gimple-range-edge.h: New file.
+ * gimple-range-edge.cc: New file.
+ * gimple-range-gori.h: New file.
+ * gimple-range-gori.cc: New file.
+
+2020-10-06 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/arm.c (arm_preferred_simd_mode): Enable MVE SIMD modes.
+
+2020-10-06 Tom de Vries <tdevries@suse.de>
+
+ PR middle-end/90861
+ * gimplify.c (gimplify_bind_expr): Handle lookup in
+ oacc_declare_returns using key with decl-expr.
+
+2020-10-06 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ * config/arm/iterators.md (MVE_types): Move mode iterator from mve.md to
+ iterators.md.
+ (MVE_VLD_ST): Likewise.
+ (MVE_0): Likewise.
+ (MVE_1): Likewise.
+ (MVE_3): Likewise.
+ (MVE_2): Likewise.
+ (MVE_5): Likewise.
+ (MVE_6): Likewise.
+ (MVE_CNVT): Move mode attribute iterator from mve.md to iterators.md.
+ (MVE_LANES): Likewise.
+ (MVE_constraint): Likewise.
+ (MVE_constraint1): Likewise.
+ (MVE_constraint2): Likewise.
+ (MVE_constraint3): Likewise.
+ (MVE_pred): Likewise.
+ (MVE_pred1): Likewise.
+ (MVE_pred2): Likewise.
+ (MVE_pred3): Likewise.
+ (MVE_B_ELEM): Likewise.
+ (MVE_H_ELEM): Likewise.
+ (V_sz_elem1): Likewise.
+ (V_extr_elem): Likewise.
+ (earlyclobber_32): Likewise.
+ (supf): Move int attribute from mve.md to iterators.md.
+ (mode1): Likewise.
+ (VCVTQ_TO_F): Move int iterator from mve.md to iterators.md.
+ (VMVNQ_N): Likewise.
+ (VREV64Q): Likewise.
+ (VCVTQ_FROM_F): Likewise.
+ (VREV16Q): Likewise.
+ (VCVTAQ): Likewise.
+ (VMVNQ): Likewise.
+ (VDUPQ_N): Likewise.
+ (VCLZQ): Likewise.
+ (VADDVQ): Likewise.
+ (VREV32Q): Likewise.
+ (VMOVLBQ): Likewise.
+ (VMOVLTQ): Likewise.
+ (VCVTPQ): Likewise.
+ (VCVTNQ): Likewise.
+ (VCVTMQ): Likewise.
+ (VADDLVQ): Likewise.
+ (VCTPQ): Likewise.
+ (VCTPQ_M): Likewise.
+ (VCVTQ_N_TO_F): Likewise.
+ (VCREATEQ): Likewise.
+ (VSHRQ_N): Likewise.
+ (VCVTQ_N_FROM_F): Likewise.
+ (VADDLVQ_P): Likewise.
+ (VCMPNEQ): Likewise.
+ (VSHLQ): Likewise.
+ (VABDQ): Likewise.
+ (VADDQ_N): Likewise.
+ (VADDVAQ): Likewise.
+ (VADDVQ_P): Likewise.
+ (VANDQ): Likewise.
+ (VBICQ): Likewise.
+ (VBRSRQ_N): Likewise.
+ (VCADDQ_ROT270): Likewise.
+ (VCADDQ_ROT90): Likewise.
+ (VCMPEQQ): Likewise.
+ (VCMPEQQ_N): Likewise.
+ (VCMPNEQ_N): Likewise.
+ (VEORQ): Likewise.
+ (VHADDQ): Likewise.
+ (VHADDQ_N): Likewise.
+ (VHSUBQ): Likewise.
+ (VHSUBQ_N): Likewise.
+ (VMAXQ): Likewise.
+ (VMAXVQ): Likewise.
+ (VMINQ): Likewise.
+ (VMINVQ): Likewise.
+ (VMLADAVQ): Likewise.
+ (VMULHQ): Likewise.
+ (VMULLBQ_INT): Likewise.
+ (VMULLTQ_INT): Likewise.
+ (VMULQ): Likewise.
+ (VMULQ_N): Likewise.
+ (VORNQ): Likewise.
+ (VORRQ): Likewise.
+ (VQADDQ): Likewise.
+ (VQADDQ_N): Likewise.
+ (VQRSHLQ): Likewise.
+ (VQRSHLQ_N): Likewise.
+ (VQSHLQ): Likewise.
+ (VQSHLQ_N): Likewise.
+ (VQSHLQ_R): Likewise.
+ (VQSUBQ): Likewise.
+ (VQSUBQ_N): Likewise.
+ (VRHADDQ): Likewise.
+ (VRMULHQ): Likewise.
+ (VRSHLQ): Likewise.
+ (VRSHLQ_N): Likewise.
+ (VRSHRQ_N): Likewise.
+ (VSHLQ_N): Likewise.
+ (VSHLQ_R): Likewise.
+ (VSUBQ): Likewise.
+ (VSUBQ_N): Likewise.
+ (VADDLVAQ): Likewise.
+ (VBICQ_N): Likewise.
+ (VMLALDAVQ): Likewise.
+ (VMLALDAVXQ): Likewise.
+ (VMOVNBQ): Likewise.
+ (VMOVNTQ): Likewise.
+ (VORRQ_N): Likewise.
+ (VQMOVNBQ): Likewise.
+ (VQMOVNTQ): Likewise.
+ (VSHLLBQ_N): Likewise.
+ (VSHLLTQ_N): Likewise.
+ (VRMLALDAVHQ): Likewise.
+ (VBICQ_M_N): Likewise.
+ (VCVTAQ_M): Likewise.
+ (VCVTQ_M_TO_F): Likewise.
+ (VQRSHRNBQ_N): Likewise.
+ (VABAVQ): Likewise.
+ (VSHLCQ): Likewise.
+ (VRMLALDAVHAQ): Likewise.
+ (VADDVAQ_P): Likewise.
+ (VCLZQ_M): Likewise.
+ (VCMPEQQ_M_N): Likewise.
+ (VCMPEQQ_M): Likewise.
+ (VCMPNEQ_M_N): Likewise.
+ (VCMPNEQ_M): Likewise.
+ (VDUPQ_M_N): Likewise.
+ (VMAXVQ_P): Likewise.
+ (VMINVQ_P): Likewise.
+ (VMLADAVAQ): Likewise.
+ (VMLADAVQ_P): Likewise.
+ (VMLAQ_N): Likewise.
+ (VMLASQ_N): Likewise.
+ (VMVNQ_M): Likewise.
+ (VPSELQ): Likewise.
+ (VQDMLAHQ_N): Likewise.
+ (VQRDMLAHQ_N): Likewise.
+ (VQRDMLASHQ_N): Likewise.
+ (VQRSHLQ_M_N): Likewise.
+ (VQSHLQ_M_R): Likewise.
+ (VREV64Q_M): Likewise.
+ (VRSHLQ_M_N): Likewise.
+ (VSHLQ_M_R): Likewise.
+ (VSLIQ_N): Likewise.
+ (VSRIQ_N): Likewise.
+ (VMLALDAVQ_P): Likewise.
+ (VQMOVNBQ_M): Likewise.
+ (VMOVLTQ_M): Likewise.
+ (VMOVNBQ_M): Likewise.
+ (VRSHRNTQ_N): Likewise.
+ (VORRQ_M_N): Likewise.
+ (VREV32Q_M): Likewise.
+ (VREV16Q_M): Likewise.
+ (VQRSHRNTQ_N): Likewise.
+ (VMOVNTQ_M): Likewise.
+ (VMOVLBQ_M): Likewise.
+ (VMLALDAVAQ): Likewise.
+ (VQSHRNBQ_N): Likewise.
+ (VSHRNBQ_N): Likewise.
+ (VRSHRNBQ_N): Likewise.
+ (VMLALDAVXQ_P): Likewise.
+ (VQMOVNTQ_M): Likewise.
+ (VMVNQ_M_N): Likewise.
+ (VQSHRNTQ_N): Likewise.
+ (VMLALDAVAXQ): Likewise.
+ (VSHRNTQ_N): Likewise.
+ (VCVTMQ_M): Likewise.
+ (VCVTNQ_M): Likewise.
+ (VCVTPQ_M): Likewise.
+ (VCVTQ_M_N_FROM_F): Likewise.
+ (VCVTQ_M_FROM_F): Likewise.
+ (VRMLALDAVHQ_P): Likewise.
+ (VADDLVAQ_P): Likewise.
+ (VABAVQ_P): Likewise.
+ (VSHLQ_M): Likewise.
+ (VSRIQ_M_N): Likewise.
+ (VSUBQ_M): Likewise.
+ (VCVTQ_M_N_TO_F): Likewise.
+ (VHSUBQ_M): Likewise.
+ (VSLIQ_M_N): Likewise.
+ (VRSHLQ_M): Likewise.
+ (VMINQ_M): Likewise.
+ (VMULLBQ_INT_M): Likewise.
+ (VMULHQ_M): Likewise.
+ (VMULQ_M): Likewise.
+ (VHSUBQ_M_N): Likewise.
+ (VHADDQ_M_N): Likewise.
+ (VORRQ_M): Likewise.
+ (VRMULHQ_M): Likewise.
+ (VQADDQ_M): Likewise.
+ (VRSHRQ_M_N): Likewise.
+ (VQSUBQ_M_N): Likewise.
+ (VADDQ_M): Likewise.
+ (VORNQ_M): Likewise.
+ (VRHADDQ_M): Likewise.
+ (VQSHLQ_M): Likewise.
+ (VANDQ_M): Likewise.
+ (VBICQ_M): Likewise.
+ (VSHLQ_M_N): Likewise.
+ (VCADDQ_ROT270_M): Likewise.
+ (VQRSHLQ_M): Likewise.
+ (VQADDQ_M_N): Likewise.
+ (VADDQ_M_N): Likewise.
+ (VMAXQ_M): Likewise.
+ (VQSUBQ_M): Likewise.
+ (VMLASQ_M_N): Likewise.
+ (VMLADAVAQ_P): Likewise.
+ (VBRSRQ_M_N): Likewise.
+ (VMULQ_M_N): Likewise.
+ (VCADDQ_ROT90_M): Likewise.
+ (VMULLTQ_INT_M): Likewise.
+ (VEORQ_M): Likewise.
+ (VSHRQ_M_N): Likewise.
+ (VSUBQ_M_N): Likewise.
+ (VHADDQ_M): Likewise.
+ (VABDQ_M): Likewise.
+ (VMLAQ_M_N): Likewise.
+ (VQSHLQ_M_N): Likewise.
+ (VMLALDAVAQ_P): Likewise.
+ (VMLALDAVAXQ_P): Likewise.
+ (VQRSHRNBQ_M_N): Likewise.
+ (VQRSHRNTQ_M_N): Likewise.
+ (VQSHRNBQ_M_N): Likewise.
+ (VQSHRNTQ_M_N): Likewise.
+ (VRSHRNBQ_M_N): Likewise.
+ (VRSHRNTQ_M_N): Likewise.
+ (VSHLLBQ_M_N): Likewise.
+ (VSHLLTQ_M_N): Likewise.
+ (VSHRNBQ_M_N): Likewise.
+ (VSHRNTQ_M_N): Likewise.
+ (VSTRWSBQ): Likewise.
+ (VSTRBSOQ): Likewise.
+ (VSTRBQ): Likewise.
+ (VLDRBGOQ): Likewise.
+ (VLDRBQ): Likewise.
+ (VLDRWGBQ): Likewise.
+ (VLD1Q): Likewise.
+ (VLDRHGOQ): Likewise.
+ (VLDRHGSOQ): Likewise.
+ (VLDRHQ): Likewise.
+ (VLDRWQ): Likewise.
+ (VLDRDGBQ): Likewise.
+ (VLDRDGOQ): Likewise.
+ (VLDRDGSOQ): Likewise.
+ (VLDRWGOQ): Likewise.
+ (VLDRWGSOQ): Likewise.
+ (VST1Q): Likewise.
+ (VSTRHSOQ): Likewise.
+ (VSTRHSSOQ): Likewise.
+ (VSTRHQ): Likewise.
+ (VSTRWQ): Likewise.
+ (VSTRDSBQ): Likewise.
+ (VSTRDSOQ): Likewise.
+ (VSTRDSSOQ): Likewise.
+ (VSTRWSOQ): Likewise.
+ (VSTRWSSOQ): Likewise.
+ (VSTRWSBWBQ): Likewise.
+ (VLDRWGBWBQ): Likewise.
+ (VSTRDSBWBQ): Likewise.
+ (VLDRDGBWBQ): Likewise.
+ (VADCIQ): Likewise.
+ (VADCIQ_M): Likewise.
+ (VSBCQ): Likewise.
+ (VSBCQ_M): Likewise.
+ (VSBCIQ): Likewise.
+ (VSBCIQ_M): Likewise.
+ (VADCQ): Likewise.
+ (VADCQ_M): Likewise.
+ (UQRSHLLQ): Likewise.
+ (SQRSHRLQ): Likewise.
+ (VSHLCQ_M): Likewise.
+ * config/arm/mve.md (MVE_types): Move mode iterator to iterators.md from mve.md.
+ (MVE_VLD_ST): Likewise.
+ (MVE_0): Likewise.
+ (MVE_1): Likewise.
+ (MVE_3): Likewise.
+ (MVE_2): Likewise.
+ (MVE_5): Likewise.
+ (MVE_6): Likewise.
+ (MVE_CNVT): Move mode attribute iterator to iterators.md from mve.md.
+ (MVE_LANES): Likewise.
+ (MVE_constraint): Likewise.
+ (MVE_constraint1): Likewise.
+ (MVE_constraint2): Likewise.
+ (MVE_constraint3): Likewise.
+ (MVE_pred): Likewise.
+ (MVE_pred1): Likewise.
+ (MVE_pred2): Likewise.
+ (MVE_pred3): Likewise.
+ (MVE_B_ELEM): Likewise.
+ (MVE_H_ELEM): Likewise.
+ (V_sz_elem1): Likewise.
+ (V_extr_elem): Likewise.
+ (earlyclobber_32): Likewise.
+ (supf): Move int attribute to iterators.md from mve.md.
+ (mode1): Likewise.
+ (VCVTQ_TO_F): Move int iterator to iterators.md from mve.md.
+ (VMVNQ_N): Likewise.
+ (VREV64Q): Likewise.
+ (VCVTQ_FROM_F): Likewise.
+ (VREV16Q): Likewise.
+ (VCVTAQ): Likewise.
+ (VMVNQ): Likewise.
+ (VDUPQ_N): Likewise.
+ (VCLZQ): Likewise.
+ (VADDVQ): Likewise.
+ (VREV32Q): Likewise.
+ (VMOVLBQ): Likewise.
+ (VMOVLTQ): Likewise.
+ (VCVTPQ): Likewise.
+ (VCVTNQ): Likewise.
+ (VCVTMQ): Likewise.
+ (VADDLVQ): Likewise.
+ (VCTPQ): Likewise.
+ (VCTPQ_M): Likewise.
+ (VCVTQ_N_TO_F): Likewise.
+ (VCREATEQ): Likewise.
+ (VSHRQ_N): Likewise.
+ (VCVTQ_N_FROM_F): Likewise.
+ (VADDLVQ_P): Likewise.
+ (VCMPNEQ): Likewise.
+ (VSHLQ): Likewise.
+ (VABDQ): Likewise.
+ (VADDQ_N): Likewise.
+ (VADDVAQ): Likewise.
+ (VADDVQ_P): Likewise.
+ (VANDQ): Likewise.
+ (VBICQ): Likewise.
+ (VBRSRQ_N): Likewise.
+ (VCADDQ_ROT270): Likewise.
+ (VCADDQ_ROT90): Likewise.
+ (VCMPEQQ): Likewise.
+ (VCMPEQQ_N): Likewise.
+ (VCMPNEQ_N): Likewise.
+ (VEORQ): Likewise.
+ (VHADDQ): Likewise.
+ (VHADDQ_N): Likewise.
+ (VHSUBQ): Likewise.
+ (VHSUBQ_N): Likewise.
+ (VMAXQ): Likewise.
+ (VMAXVQ): Likewise.
+ (VMINQ): Likewise.
+ (VMINVQ): Likewise.
+ (VMLADAVQ): Likewise.
+ (VMULHQ): Likewise.
+ (VMULLBQ_INT): Likewise.
+ (VMULLTQ_INT): Likewise.
+ (VMULQ): Likewise.
+ (VMULQ_N): Likewise.
+ (VORNQ): Likewise.
+ (VORRQ): Likewise.
+ (VQADDQ): Likewise.
+ (VQADDQ_N): Likewise.
+ (VQRSHLQ): Likewise.
+ (VQRSHLQ_N): Likewise.
+ (VQSHLQ): Likewise.
+ (VQSHLQ_N): Likewise.
+ (VQSHLQ_R): Likewise.
+ (VQSUBQ): Likewise.
+ (VQSUBQ_N): Likewise.
+ (VRHADDQ): Likewise.
+ (VRMULHQ): Likewise.
+ (VRSHLQ): Likewise.
+ (VRSHLQ_N): Likewise.
+ (VRSHRQ_N): Likewise.
+ (VSHLQ_N): Likewise.
+ (VSHLQ_R): Likewise.
+ (VSUBQ): Likewise.
+ (VSUBQ_N): Likewise.
+ (VADDLVAQ): Likewise.
+ (VBICQ_N): Likewise.
+ (VMLALDAVQ): Likewise.
+ (VMLALDAVXQ): Likewise.
+ (VMOVNBQ): Likewise.
+ (VMOVNTQ): Likewise.
+ (VORRQ_N): Likewise.
+ (VQMOVNBQ): Likewise.
+ (VQMOVNTQ): Likewise.
+ (VSHLLBQ_N): Likewise.
+ (VSHLLTQ_N): Likewise.
+ (VRMLALDAVHQ): Likewise.
+ (VBICQ_M_N): Likewise.
+ (VCVTAQ_M): Likewise.
+ (VCVTQ_M_TO_F): Likewise.
+ (VQRSHRNBQ_N): Likewise.
+ (VABAVQ): Likewise.
+ (VSHLCQ): Likewise.
+ (VRMLALDAVHAQ): Likewise.
+ (VADDVAQ_P): Likewise.
+ (VCLZQ_M): Likewise.
+ (VCMPEQQ_M_N): Likewise.
+ (VCMPEQQ_M): Likewise.
+ (VCMPNEQ_M_N): Likewise.
+ (VCMPNEQ_M): Likewise.
+ (VDUPQ_M_N): Likewise.
+ (VMAXVQ_P): Likewise.
+ (VMINVQ_P): Likewise.
+ (VMLADAVAQ): Likewise.
+ (VMLADAVQ_P): Likewise.
+ (VMLAQ_N): Likewise.
+ (VMLASQ_N): Likewise.
+ (VMVNQ_M): Likewise.
+ (VPSELQ): Likewise.
+ (VQDMLAHQ_N): Likewise.
+ (VQRDMLAHQ_N): Likewise.
+ (VQRDMLASHQ_N): Likewise.
+ (VQRSHLQ_M_N): Likewise.
+ (VQSHLQ_M_R): Likewise.
+ (VREV64Q_M): Likewise.
+ (VRSHLQ_M_N): Likewise.
+ (VSHLQ_M_R): Likewise.
+ (VSLIQ_N): Likewise.
+ (VSRIQ_N): Likewise.
+ (VMLALDAVQ_P): Likewise.
+ (VQMOVNBQ_M): Likewise.
+ (VMOVLTQ_M): Likewise.
+ (VMOVNBQ_M): Likewise.
+ (VRSHRNTQ_N): Likewise.
+ (VORRQ_M_N): Likewise.
+ (VREV32Q_M): Likewise.
+ (VREV16Q_M): Likewise.
+ (VQRSHRNTQ_N): Likewise.
+ (VMOVNTQ_M): Likewise.
+ (VMOVLBQ_M): Likewise.
+ (VMLALDAVAQ): Likewise.
+ (VQSHRNBQ_N): Likewise.
+ (VSHRNBQ_N): Likewise.
+ (VRSHRNBQ_N): Likewise.
+ (VMLALDAVXQ_P): Likewise.
+ (VQMOVNTQ_M): Likewise.
+ (VMVNQ_M_N): Likewise.
+ (VQSHRNTQ_N): Likewise.
+ (VMLALDAVAXQ): Likewise.
+ (VSHRNTQ_N): Likewise.
+ (VCVTMQ_M): Likewise.
+ (VCVTNQ_M): Likewise.
+ (VCVTPQ_M): Likewise.
+ (VCVTQ_M_N_FROM_F): Likewise.
+ (VCVTQ_M_FROM_F): Likewise.
+ (VRMLALDAVHQ_P): Likewise.
+ (VADDLVAQ_P): Likewise.
+ (VABAVQ_P): Likewise.
+ (VSHLQ_M): Likewise.
+ (VSRIQ_M_N): Likewise.
+ (VSUBQ_M): Likewise.
+ (VCVTQ_M_N_TO_F): Likewise.
+ (VHSUBQ_M): Likewise.
+ (VSLIQ_M_N): Likewise.
+ (VRSHLQ_M): Likewise.
+ (VMINQ_M): Likewise.
+ (VMULLBQ_INT_M): Likewise.
+ (VMULHQ_M): Likewise.
+ (VMULQ_M): Likewise.
+ (VHSUBQ_M_N): Likewise.
+ (VHADDQ_M_N): Likewise.
+ (VORRQ_M): Likewise.
+ (VRMULHQ_M): Likewise.
+ (VQADDQ_M): Likewise.
+ (VRSHRQ_M_N): Likewise.
+ (VQSUBQ_M_N): Likewise.
+ (VADDQ_M): Likewise.
+ (VORNQ_M): Likewise.
+ (VRHADDQ_M): Likewise.
+ (VQSHLQ_M): Likewise.
+ (VANDQ_M): Likewise.
+ (VBICQ_M): Likewise.
+ (VSHLQ_M_N): Likewise.
+ (VCADDQ_ROT270_M): Likewise.
+ (VQRSHLQ_M): Likewise.
+ (VQADDQ_M_N): Likewise.
+ (VADDQ_M_N): Likewise.
+ (VMAXQ_M): Likewise.
+ (VQSUBQ_M): Likewise.
+ (VMLASQ_M_N): Likewise.
+ (VMLADAVAQ_P): Likewise.
+ (VBRSRQ_M_N): Likewise.
+ (VMULQ_M_N): Likewise.
+ (VCADDQ_ROT90_M): Likewise.
+ (VMULLTQ_INT_M): Likewise.
+ (VEORQ_M): Likewise.
+ (VSHRQ_M_N): Likewise.
+ (VSUBQ_M_N): Likewise.
+ (VHADDQ_M): Likewise.
+ (VABDQ_M): Likewise.
+ (VMLAQ_M_N): Likewise.
+ (VQSHLQ_M_N): Likewise.
+ (VMLALDAVAQ_P): Likewise.
+ (VMLALDAVAXQ_P): Likewise.
+ (VQRSHRNBQ_M_N): Likewise.
+ (VQRSHRNTQ_M_N): Likewise.
+ (VQSHRNBQ_M_N): Likewise.
+ (VQSHRNTQ_M_N): Likewise.
+ (VRSHRNBQ_M_N): Likewise.
+ (VRSHRNTQ_M_N): Likewise.
+ (VSHLLBQ_M_N): Likewise.
+ (VSHLLTQ_M_N): Likewise.
+ (VSHRNBQ_M_N): Likewise.
+ (VSHRNTQ_M_N): Likewise.
+ (VSTRWSBQ): Likewise.
+ (VSTRBSOQ): Likewise.
+ (VSTRBQ): Likewise.
+ (VLDRBGOQ): Likewise.
+ (VLDRBQ): Likewise.
+ (VLDRWGBQ): Likewise.
+ (VLD1Q): Likewise.
+ (VLDRHGOQ): Likewise.
+ (VLDRHGSOQ): Likewise.
+ (VLDRHQ): Likewise.
+ (VLDRWQ): Likewise.
+ (VLDRDGBQ): Likewise.
+ (VLDRDGOQ): Likewise.
+ (VLDRDGSOQ): Likewise.
+ (VLDRWGOQ): Likewise.
+ (VLDRWGSOQ): Likewise.
+ (VST1Q): Likewise.
+ (VSTRHSOQ): Likewise.
+ (VSTRHSSOQ): Likewise.
+ (VSTRHQ): Likewise.
+ (VSTRWQ): Likewise.
+ (VSTRDSBQ): Likewise.
+ (VSTRDSOQ): Likewise.
+ (VSTRDSSOQ): Likewise.
+ (VSTRWSOQ): Likewise.
+ (VSTRWSSOQ): Likewise.
+ (VSTRWSBWBQ): Likewise.
+ (VLDRWGBWBQ): Likewise.
+ (VSTRDSBWBQ): Likewise.
+ (VLDRDGBWBQ): Likewise.
+ (VADCIQ): Likewise.
+ (VADCIQ_M): Likewise.
+ (VSBCQ): Likewise.
+ (VSBCQ_M): Likewise.
+ (VSBCIQ): Likewise.
+ (VSBCIQ_M): Likewise.
+ (VADCQ): Likewise.
+ (VADCQ_M): Likewise.
+ (UQRSHLLQ): Likewise.
+ (SQRSHRLQ): Likewise.
+ (VSHLCQ_M): Likewise.
+ (define_c_enum "unspec"): Move MVE enumerator to unspecs.md from mve.md.
+ * config/arm/unspecs.md (define_c_enum "unspec"): Move MVE enumerator from
+ mve.md to unspecs.md.
+
+2020-10-06 Martin Liska <mliska@suse.cz>
+
+ * common.opt: Remove -fdbg-cnt-list from deferred options.
+ * dbgcnt.c (dbg_cnt_set_limit_by_index): Make a copy
+ to original_limits.
+ (dbg_cnt_list_all_counters): Print also current counter value
+ and print to stderr.
+ * opts-global.c (handle_common_deferred_options): Do not handle
+ -fdbg-cnt-list.
+ * opts.c (common_handle_option): Likewise.
+ * toplev.c (finalize): Handle it after compilation here.
+
+2020-10-06 Martin Liska <mliska@suse.cz>
+
+ * dbgcnt.c (dbg_cnt): Report also upper limit.
+
+2020-10-06 Tom de Vries <tdevries@suse.de>
+
+ * tracer.c (count_insns): Rename to ...
+ (analyze_bb): ... this.
+ (cache_can_duplicate_bb_p, cached_can_duplicate_bb_p): New function.
+ (ignore_bb_p): Use cached_can_duplicate_bb_p.
+ (tail_duplicate): Call cache_can_duplicate_bb_p.
+
+2020-10-06 Tom de Vries <tdevries@suse.de>
+
+ * tracer.c (can_duplicate_insn_p, can_duplicate_bb_no_insn_iter_p)
+ (can_duplicate_bb_p): New function, factored out of ...
+ (ignore_bb_p): ... here.
+
+2020-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/97282
+ * tree-ssa-math-opts.c (divmod_candidate_p): Don't return false for
+ constant op2 if it is not a power of two and the type has precision
+ larger than HOST_BITS_PER_WIDE_INT or BITS_PER_WORD.
+ * internal-fn.c (contains_call_div_mod): New function.
+ (expand_DIVMOD): If last argument is a constant, try to expand it as
+ TRUNC_DIV_EXPR followed by TRUNC_MOD_EXPR, but if the sequence
+ contains any calls or {,U}{DIV,MOD} rtxes, throw it away and use
+ divmod optab or divmod libfunc.
+
+2020-10-06 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.h (irange_allocator::allocate): Increase
+ newir storage by one.
+
+2020-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/97289
+ * omp-offload.c (omp_discover_declare_target_tgt_fn_r): Only follow
+ node->alias_target if it is a FUNCTION_DECL.
+
+2020-10-06 Joe Ramsay <joe.ramsay@arm.com>
+
+ * config/arm/arm-cpus.in:
+ (ALL_FPU_INTERNAL): Remove vfp_base.
+ (VFPv2): Remove vfp_base.
+ (MVE): Remove vfp_base.
+ (vfp_base): Redefine as implied bit dependent on MVE or FP
+ (cortex-m55): Add flags to disable MVE, MVE FP, FP and DSP extensions.
+ * config/arm/arm.c (arm_configure_build_target): Add implied bits to ISA.
+ * config/arm/parsecpu.awk:
+ (gen_isa): Print implied bits and their dependencies to ISA header.
+ (gen_data): Add parsing for implied feature bits.
+
+2020-10-06 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * doc/invoke.texi: Add z15/arch13 to the list of documented
+ -march/-mtune options.
+
+2020-10-05 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/arm/arm.c (arm_preferred_simd_mode): Enable MVE SIMD modes.
+
+2020-10-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.cc (irange::legacy_intersect): Only handle
+ legacy ranges.
+ (irange::legacy_union): Same.
+ (irange::union_): When unioning legacy with non-legacy,
+ first convert to legacy and do everything in legacy mode.
+ (irange::intersect): Same, but for intersect.
+ * range-op.cc (range_tests): Adjust for above changes.
+
+2020-10-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * range-op.cc (operator_div::wi_fold): Return varying for
+ division by zero.
+ (class operator_rshift): Move class up.
+ (operator_abs::wi_fold): Return [-MIN,-MIN] for ABS([-MIN,-MIN]).
+ (operator_tests): Adjust tests.
+
+2020-10-05 Tom de Vries <tdevries@suse.de>
+
+ * tracer.c (ignore_bb_p): Ignore GOMP_SIMT_XCHG_*.
+
+2020-10-05 Alex Coplan <alex.coplan@arm.com>
+
+ * config/arm/arm-cpus.in (neoverse-v1): Add missing vendor and
+ part numbers.
+
+2020-10-05 Tom de Vries <tdevries@suse.de>
+
+ * tracer.c (ignore_bb_p): Remove incorrect suggestion.
+
+2020-10-05 Jakub Jelinek <jakub@redhat.com>
+
+ * opth-gen.awk: Don't emit explicit_mask array if n_target_explicit
+ is equal to n_target_explicit_mask.
+ * optc-save-gen.awk: Compute has_target_explicit_mask and if false,
+ don't emit code iterating over explicit_mask array elements. Stream
+ also explicit_mask_* target members.
+
+2020-10-05 Jakub Jelinek <jakub@redhat.com>
+
+ * gimple-ssa-store-merging.c
+ (imm_store_chain_info::output_merged_store): Use ~0U instead of ~0 in
+ unsigned int array initializer.
+
+2020-10-05 Tom de Vries <tdevries@suse.de>
+
+ PR fortran/95654
+ * tracer.c (ignore_bb_p): Ignore GOMP_SIMT_ENTER_ALLOC,
+ GOMP_SIMT_VOTE_ANY and GOMP_SIMT_EXIT.
+
+2020-10-03 Jakub Jelinek <jakub@redhat.com>
+
+ * opth-gen.awk: For variables referenced in Mask and InverseMask,
+ don't use the explicit_mask bitmask array, but add separate
+ explicit_mask_* members with the same types as the variables.
+ * optc-save-gen.awk: Save, restore, compare and hash the separate
+ explicit_mask_* members.
+
+2020-10-03 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref-tree.c (test_insert_search_collapse): Update andling
+ of accesses.
+ (test_merge): Likewise.
+ * ipa-modref-tree.h (struct modref_access_node): Add offset, size,
+ max_size, parm_offset and parm_offset_known.
+ (modref_access_node::useful_p): Constify.
+ (modref_access_node::range_info_useful_p): New predicate.
+ (modref_access_node::operator==): New.
+ (struct modref_parm_map): New structure.
+ (modref_tree::merge): Update for racking parameters)
+ * ipa-modref.c (dump_access): Dump new fields.
+ (get_access): Fill in new fields.
+ (merge_call_side_effects): Update handling of parm map.
+ (write_modref_records): Stream new fields.
+ (read_modref_records): Stream new fields.
+ (compute_parm_map): Update for new parm map.
+ (ipa_merge_modref_summary_after_inlining): Update.
+ (modref_propagate_in_scc): Update.
+ * tree-ssa-alias.c (modref_may_conflict): Handle known ranges.
+
+2020-10-03 H.J. Lu <hjl.tools@gmail.com>
+
+ PR other/97280
+ * doc/extend.texi: Replace roudnevenl with roundevenl
+
+2020-10-02 David Edelsohn <dje.gcc@gmail.com>
+ Andrew MacLeod <amacleod@redhat.com>
+
+ * config/rs6000/rs6000.c: Include ssa.h. Reorder some headers.
+ * config/rs6000/rs6000-call.c: Same.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * params.opt (ipa-cp-large-unit-insns): New parameter.
+ * ipa-cp.c (get_max_overall_size): Use the new parameter.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (estimate_local_effects): Add overeall_size to dumped
+ string.
+ (decide_about_value): Add dumping new overall_size.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-fnsummary.h (ipa_freqcounting_predicate): New type.
+ (ipa_fn_summary): Change the type of loop_iterations and loop_strides
+ to vectors of ipa_freqcounting_predicate.
+ (ipa_fn_summary::ipa_fn_summary): Construct the new vectors.
+ (ipa_call_estimates): New fields loops_with_known_iterations and
+ loops_with_known_strides.
+ * ipa-cp.c (hint_time_bonus): Multiply param_ipa_cp_loop_hint_bonus
+ with the expected frequencies of loops with known iteration count or
+ stride.
+ * ipa-fnsummary.c (add_freqcounting_predicate): New function.
+ (ipa_fn_summary::~ipa_fn_summary): Release the new vectors instead of
+ just two predicates.
+ (remap_hint_predicate_after_duplication): Replace with function
+ remap_freqcounting_preds_after_dup.
+ (ipa_fn_summary_t::duplicate): Use it or duplicate new vectors.
+ (ipa_dump_fn_summary): Dump the new vectors.
+ (analyze_function_body): Compute the loop property vectors.
+ (ipa_call_context::estimate_size_and_time): Calculate also
+ loops_with_known_iterations and loops_with_known_strides. Adjusted
+ dumping accordinly.
+ (remap_hint_predicate): Replace with function
+ remap_freqcounting_predicate.
+ (ipa_merge_fn_summary_after_inlining): Use it.
+ (inline_read_section): Stream loopcounting vectors instead of two
+ simple predicates.
+ (ipa_fn_summary_write): Likewise.
+ * params.opt (ipa-max-loop-predicates): New parameter.
+ * doc/invoke.texi (ipa-max-loop-predicates): Document new param.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-inline-analysis.c (do_estimate_edge_time): Adjusted to use
+ ipa_call_estimates.
+ (do_estimate_edge_size): Likewise.
+ (do_estimate_edge_hints): Likewise.
+ * ipa-fnsummary.h (struct ipa_call_estimates): New type.
+ (ipa_call_context::estimate_size_and_time): Adjusted declaration.
+ (estimate_ipcp_clone_size_and_time): Likewise.
+ * ipa-cp.c (hint_time_bonus): Changed the type of the second argument
+ to ipa_call_estimates.
+ (perform_estimation_of_a_value): Adjusted to use ipa_call_estimates.
+ (estimate_local_effects): Likewise.
+ * ipa-fnsummary.c (ipa_call_context::estimate_size_and_time): Adjusted
+ to return estimates in a single ipa_call_estimates parameter.
+ (estimate_ipcp_clone_size_and_time): Likewise.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-fnsummary.h (ipa_cached_call_context): New forward declaration
+ and class.
+ (class ipa_call_context): Make friend ipa_cached_call_context. Moved
+ methods duplicate_from and release to it too.
+ * ipa-fnsummary.c (ipa_call_context::duplicate_from): Moved to class
+ ipa_cached_call_context.
+ (ipa_call_context::release): Likewise, removed the parameter.
+ * ipa-inline-analysis.c (node_context_cache_entry): Change the type of
+ ctx to ipa_cached_call_context.
+ (do_estimate_edge_time): Remove parameter from the call to
+ ipa_cached_call_context::release.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.h (ipa_auto_call_arg_values): New type.
+ (class ipa_call_arg_values): Likewise.
+ (ipa_get_indirect_edge_target): Replaced vector arguments with
+ ipa_call_arg_values in declaration. Added an overload for
+ ipa_auto_call_arg_values.
+ * ipa-fnsummary.h (ipa_call_context): Removed members m_known_vals,
+ m_known_contexts, m_known_aggs, duplicate_from, release and equal_to,
+ new members m_avals, store_to_cache and equivalent_to_p. Adjusted
+ construcotr arguments.
+ (estimate_ipcp_clone_size_and_time): Replaced vector arguments
+ with ipa_auto_call_arg_values in declaration.
+ (evaluate_properties_for_edge): Likewise.
+ * ipa-cp.c (ipa_get_indirect_edge_target): Adjusted to work on
+ ipa_call_arg_values rather than on separate vectors. Added an
+ overload for ipa_auto_call_arg_values.
+ (devirtualization_time_bonus): Adjusted to work on
+ ipa_auto_call_arg_values rather than on separate vectors.
+ (gather_context_independent_values): Adjusted to work on
+ ipa_auto_call_arg_values rather than on separate vectors.
+ (perform_estimation_of_a_value): Likewise.
+ (estimate_local_effects): Likewise.
+ (modify_known_vectors_with_val): Adjusted both variants to work on
+ ipa_auto_call_arg_values and rename them to
+ copy_known_vectors_add_val.
+ (decide_about_value): Adjusted to work on ipa_call_arg_values rather
+ than on separate vectors.
+ (decide_whether_version_node): Likewise.
+ * ipa-fnsummary.c (evaluate_conditions_for_known_args): Likewise.
+ (evaluate_properties_for_edge): Likewise.
+ (ipa_fn_summary_t::duplicate): Likewise.
+ (estimate_edge_devirt_benefit): Adjusted to work on
+ ipa_call_arg_values rather than on separate vectors.
+ (estimate_edge_size_and_time): Likewise.
+ (estimate_calls_size_and_time_1): Likewise.
+ (summarize_calls_size_and_time): Adjusted calls to
+ estimate_edge_size_and_time.
+ (estimate_calls_size_and_time): Adjusted to work on
+ ipa_call_arg_values rather than on separate vectors.
+ (ipa_call_context::ipa_call_context): Construct from a pointer to
+ ipa_auto_call_arg_values instead of inividual vectors.
+ (ipa_call_context::duplicate_from): Adjusted to access vectors within
+ m_avals.
+ (ipa_call_context::release): Likewise.
+ (ipa_call_context::equal_to): Likewise.
+ (ipa_call_context::estimate_size_and_time): Adjusted to work on
+ ipa_call_arg_values rather than on separate vectors.
+ (estimate_ipcp_clone_size_and_time): Adjusted to work with
+ ipa_auto_call_arg_values rather than on separate vectors.
+ (ipa_merge_fn_summary_after_inlining): Likewise. Adjusted call to
+ estimate_edge_size_and_time.
+ (ipa_update_overall_fn_summary): Adjusted call to
+ estimate_edge_size_and_time.
+ * ipa-inline-analysis.c (do_estimate_edge_time): Adjusted to work with
+ ipa_auto_call_arg_values rather than with separate vectors.
+ (do_estimate_edge_size): Likewise.
+ (do_estimate_edge_hints): Likewise.
+ * ipa-prop.c (ipa_auto_call_arg_values::~ipa_auto_call_arg_values):
+ New destructor.
+
+2020-10-02 Joe Ramsay <joe.ramsay@arm.com>
+
+ * config/arm/arm_mve.h (__arm_vmaxnmavq): Remove coercion of scalar
+ argument.
+ (__arm_vmaxnmvq): Likewise.
+ (__arm_vminnmavq): Likewise.
+ (__arm_vminnmvq): Likewise.
+ (__arm_vmaxnmavq_p): Likewise.
+ (__arm_vmaxnmvq_p): Likewise (and delete duplicate definition).
+ (__arm_vminnmavq_p): Likewise.
+ (__arm_vminnmvq_p): Likewise.
+ (__arm_vmaxavq): Likewise.
+ (__arm_vmaxavq_p): Likewise.
+ (__arm_vmaxvq): Likewise.
+ (__arm_vmaxvq_p): Likewise.
+ (__arm_vminavq): Likewise.
+ (__arm_vminavq_p): Likewise.
+ (__arm_vminvq): Likewise.
+ (__arm_vminvq_p): Likewise.
+
+2020-10-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/aarch64/aarch64.c (neoversev1_tunings): Define.
+ * config/aarch64/aarch64-cores.def (zeus): Use it.
+ (neoverse-v1): Likewise.
+
+2020-10-02 Jan Hubicka <hubicka@ucw.cz>
+
+ * attr-fnspec.h: Update documentation.
+ (attr_fnsec::return_desc_size): Set to 2
+ (attr_fnsec::arg_desc_size): Set to 2
+ * builtin-attrs.def (STR1): Update fnspec.
+ * internal-fn.def (UBSAN_NULL): Update fnspec.
+ (UBSAN_VPTR): Update fnspec.
+ (UBSAN_PTR): Update fnspec.
+ (ASAN_CHECK): Update fnspec.
+ (GOACC_DIM_SIZE): Remove fnspec.
+ (GOACC_DIM_POS): Remove fnspec.
+ * tree-ssa-alias.c (attr_fnspec::verify): Update verification.
+
+2020-10-02 Jan Hubicka <jh@suse.cz>
+
+ * attr-fnspec.h: New file.
+ * calls.c (decl_return_flags): Use attr_fnspec.
+ * gimple.c (gimple_call_arg_flags): Use attr_fnspec.
+ (gimple_call_return_flags): Use attr_fnspec.
+ * tree-into-ssa.c (pass_build_ssa::execute): Use attr_fnspec.
+ * tree-ssa-alias.c (attr_fnspec::verify): New member fuction.
+
+2020-10-02 Jan Hubicka <jh@suse.cz>
+
+ * tree-ssa-alias.c (ao_ref_init_from_ptr_and_range): Break out from ...
+ (ao_ref_init_from_ptr_and_size): ... here.
+
+2020-10-02 Jan Hubicka <hubicka@ucw.cz>
+
+ * data-streamer-in.c (streamer_read_poly_int64): New function.
+ * data-streamer-out.c (streamer_write_poly_int64): New function.
+ * data-streamer.h (streamer_write_poly_int64): Declare.
+ (streamer_read_poly_int64): Declare.
+
+2020-10-02 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/aarch64-protos.h (aarch64_sve_pred_dominates_p):
+ Delete.
+ * config/aarch64/aarch64.c (aarch64_sve_pred_dominates_p): Likewise.
+ * config/aarch64/aarch64-sve.md: Add banner comment describing
+ how merging predicated FP operations are represented.
+ (*cond_<SVE_COND_FP_UNARY:optab><mode>_2): Split into...
+ (*cond_<SVE_COND_FP_UNARY:optab><mode>_2_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_UNARY:optab><mode>_2_strict): ...this.
+ (*cond_<SVE_COND_FP_UNARY:optab><mode>_any): Split into...
+ (*cond_<SVE_COND_FP_UNARY:optab><mode>_any_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_UNARY:optab><mode>_any_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY_INT:optab><mode>_2): Split into...
+ (*cond_<SVE_COND_FP_BINARY_INT:optab><mode>_2_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_BINARY_INT:optab><mode>_2_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY_INT:optab><mode>_any): Split into...
+ (*cond_<SVE_COND_FP_BINARY_INT:optab><mode>_any_relaxed): ...this
+ and...
+ (*cond_<SVE_COND_FP_BINARY_INT:optab><mode>_any_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_2): Split into...
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_2_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_2_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY_I1:optab><mode>_2_const): Split into...
+ (*cond_<SVE_COND_FP_BINARY_I1:optab><mode>_2_const_relaxed): ...this
+ and...
+ (*cond_<SVE_COND_FP_BINARY_I1:optab><mode>_2_const_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_3): Split into...
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_3_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_3_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_any): Split into...
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_any_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_BINARY:optab><mode>_any_strict): ...this.
+ (*cond_<SVE_COND_FP_BINARY_I1:optab><mode>_any_const): Split into...
+ (*cond_<SVE_COND_FP_BINARY_I1:optab><mode>_any_const_relaxed): ...this
+ and...
+ (*cond_<SVE_COND_FP_BINARY_I1:optab><mode>_any_const_strict): ...this.
+ (*cond_add<mode>_2_const): Split into...
+ (*cond_add<mode>_2_const_relaxed): ...this and...
+ (*cond_add<mode>_2_const_strict): ...this.
+ (*cond_add<mode>_any_const): Split into...
+ (*cond_add<mode>_any_const_relaxed): ...this and...
+ (*cond_add<mode>_any_const_strict): ...this.
+ (*cond_<SVE_COND_FCADD:optab><mode>_2): Split into...
+ (*cond_<SVE_COND_FCADD:optab><mode>_2_relaxed): ...this and...
+ (*cond_<SVE_COND_FCADD:optab><mode>_2_strict): ...this.
+ (*cond_<SVE_COND_FCADD:optab><mode>_any): Split into...
+ (*cond_<SVE_COND_FCADD:optab><mode>_any_relaxed): ...this and...
+ (*cond_<SVE_COND_FCADD:optab><mode>_any_strict): ...this.
+ (*cond_sub<mode>_3_const): Split into...
+ (*cond_sub<mode>_3_const_relaxed): ...this and...
+ (*cond_sub<mode>_3_const_strict): ...this.
+ (*aarch64_pred_abd<mode>): Split into...
+ (*aarch64_pred_abd<mode>_relaxed): ...this and...
+ (*aarch64_pred_abd<mode>_strict): ...this.
+ (*aarch64_cond_abd<mode>_2): Split into...
+ (*aarch64_cond_abd<mode>_2_relaxed): ...this and...
+ (*aarch64_cond_abd<mode>_2_strict): ...this.
+ (*aarch64_cond_abd<mode>_3): Split into...
+ (*aarch64_cond_abd<mode>_3_relaxed): ...this and...
+ (*aarch64_cond_abd<mode>_3_strict): ...this.
+ (*aarch64_cond_abd<mode>_any): Split into...
+ (*aarch64_cond_abd<mode>_any_relaxed): ...this and...
+ (*aarch64_cond_abd<mode>_any_strict): ...this.
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_2): Split into...
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_2_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_2_strict): ...this.
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_4): Split into...
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_4_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_4_strict): ...this.
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_any): Split into...
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_any_relaxed): ...this and...
+ (*cond_<SVE_COND_FP_TERNARY:optab><mode>_any_strict): ...this.
+ (*cond_<SVE_COND_FCMLA:optab><mode>_4): Split into...
+ (*cond_<SVE_COND_FCMLA:optab><mode>_4_relaxed): ...this and...
+ (*cond_<SVE_COND_FCMLA:optab><mode>_4_strict): ...this.
+ (*cond_<SVE_COND_FCMLA:optab><mode>_any): Split into...
+ (*cond_<SVE_COND_FCMLA:optab><mode>_any_relaxed): ...this and...
+ (*cond_<SVE_COND_FCMLA:optab><mode>_any_strict): ...this.
+ (*aarch64_pred_fac<cmp_op><mode>): Split into...
+ (*aarch64_pred_fac<cmp_op><mode>_relaxed): ...this and...
+ (*aarch64_pred_fac<cmp_op><mode>_strict): ...this.
+ (*cond_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>): Split
+ into...
+ (*cond_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>_relaxed):
+ ...this and...
+ (*cond_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>_strict):
+ ...this.
+ (*cond_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>): Split
+ into...
+ (*cond_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>_relaxed):
+ ...this and...
+ (*cond_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>_strict):
+ ...this.
+ * config/aarch64/aarch64-sve2.md
+ (*cond_<SVE2_COND_FP_UNARY_LONG:optab><mode>): Split into...
+ (*cond_<SVE2_COND_FP_UNARY_LONG:optab><mode>_relaxed): ...this and...
+ (*cond_<SVE2_COND_FP_UNARY_LONG:optab><mode>_strict): ...this.
+ (*cond_<SVE2_COND_FP_UNARY_NARROWB:optab><mode>_any): Split into...
+ (*cond_<SVE2_COND_FP_UNARY_NARROWB:optab><mode>_any_relaxed): ...this
+ and...
+ (*cond_<SVE2_COND_FP_UNARY_NARROWB:optab><mode>_any_strict): ...this.
+ (*cond_<SVE2_COND_INT_UNARY_FP:optab><mode>): Split into...
+ (*cond_<SVE2_COND_INT_UNARY_FP:optab><mode>_relaxed): ...this and...
+ (*cond_<SVE2_COND_INT_UNARY_FP:optab><mode>_strict): ...this.
+
+2020-10-02 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/arm/neon.md (*sub<VDQ:mode>3_neon): Use the new mode macros
+ for the insn condition.
+ (sub<VH:mode>3, *mul<VDQW:mode>3_neon): Likewise.
+ (mul<VDQW:mode>3add<VDQW:mode>_neon): Likewise.
+ (mul<VH:mode>3add<VH:mode>_neon): Likewise.
+ (mul<VDQW:mode>3neg<VDQW:mode>add<VDQW:mode>_neon): Likewise.
+ (fma<VCVTF:mode>4, fma<VH:mode>4, *fmsub<VCVTF:mode>4): Likewise.
+ (quad_halves_<code>v4sf, reduc_plus_scal_<VD:mode>): Likewise.
+ (reduc_plus_scal_<VQ:mode>, reduc_smin_scal_<VD:mode>): Likewise.
+ (reduc_smin_scal_<VQ:mode>, reduc_smax_scal_<VD:mode>): Likewise.
+ (reduc_smax_scal_<VQ:mode>, mul<VH:mode>3): Likewise.
+ (neon_vabd<VF:mode>_2, neon_vabd<VF:mode>_3): Likewise.
+ (fma<VH:mode>4_intrinsic): Delete.
+ (neon_vadd<VCVTF:mode>): Use the new mode macros to decide which
+ form of instruction to generate.
+ (neon_vmla<VDQW:mode>, neon_vmls<VDQW:mode>): Likewise.
+ (neon_vsub<VCVTF:mode>): Likewise.
+ (neon_vfma<VH:mode>): Generate the main fma<mode>4 form instead
+ of using fma<mode>4_intrinsic.
+
+2020-10-02 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/97193
+ * coverage.c (coverage_init): GCDA note files should not be
+ mangled and should end in output directory.
+
+2020-10-02 Jason Merril <jason@redhat.com>
+
+ * gimple.h (gimple_call_operator_delete_p): Rename from
+ gimple_call_replaceable_operator_delete_p.
+ * gimple.c (gimple_call_operator_delete_p): Likewise.
+ * tree.h (DECL_IS_REPLACEABLE_OPERATOR_DELETE_P): Remove.
+ * tree-ssa-dce.c (mark_all_reaching_defs_necessary_1): Adjust.
+ (propagate_necessity): Likewise.
+ (eliminate_unnecessary_stmts): Likewise.
+ * tree-ssa-structalias.c (find_func_aliases_for_call): Likewise.
+
+2020-10-02 Richard Biener <rguenther@suse.de>
+
+ * gimple.h (GF_CALL_FROM_NEW_OR_DELETE): New call flag.
+ (gimple_call_set_from_new_or_delete): New.
+ (gimple_call_from_new_or_delete): Likewise.
+ * gimple.c (gimple_build_call_from_tree): Set
+ GF_CALL_FROM_NEW_OR_DELETE appropriately.
+ * ipa-icf-gimple.c (func_checker::compare_gimple_call):
+ Compare gimple_call_from_new_or_delete.
+ * tree-ssa-dce.c (mark_all_reaching_defs_necessary_1): Make
+ sure to only consider new/delete calls from new or delete
+ expressions.
+ (propagate_necessity): Likewise.
+ (eliminate_unnecessary_stmts): Likewise.
+ * tree-ssa-structalias.c (find_func_aliases_for_call):
+ Likewise.
+
+2020-10-02 Jason Merril <jason@redhat.com>
+
+ * tree.h (CALL_FROM_NEW_OR_DELETE_P): Move from cp-tree.h.
+ * tree-core.h: Document new usage of protected_flag.
+
+2020-10-02 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.h (irange::fits_p): New.
+
+2020-10-01 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_legitimize_address): Use
+ gen_int_mode for high part of address constant.
+
+2020-10-01 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_linux64_override_options):
+ Formatting. Correct setting of TARGET_NO_FP_IN_TOC and
+ TARGET_NO_SUM_IN_TOC.
+
+2020-10-01 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/freebsd64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Use
+ rs6000_linux64_override_options.
+ * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Break
+ out to..
+ * config/rs6000/rs6000.c (rs6000_linux64_override_options): ..this,
+ new function. Tweak non-biarch test and clearing of
+ profile_kernel to work with freebsd64.h.
+
+2020-10-01 Martin Liska <mliska@suse.cz>
+
+ * config/rs6000/rs6000-call.c: Include value-range.h.
+ * config/rs6000/rs6000.c: Likewise.
+
+2020-10-01 Tom de Vries <tdevries@suse.de>
+
+ PR target/80845
+ * config/nvptx/nvptx.md (define_insn "truncsi<QHIM>2"): Emit mov.u32
+ instead of cvt.u32.u32.
+
+2020-10-01 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR target/96528
+ PR target/97288
+ * config/arm/arm-protos.h (arm_expand_vector_compare): Declare.
+ (arm_expand_vcond): Likewise.
+ * config/arm/arm.c (arm_expand_vector_compare): New function.
+ (arm_expand_vcond): Likewise.
+ * config/arm/neon.md (vec_cmp<VDQW:mode><v_cmp_result>): New pattern.
+ (vec_cmpu<VDQW:mode><VDQW:mode>): Likewise.
+ (vcond<VDQW:mode><VDQW:mode>): Require operand 5 to be a register
+ or zero. Use arm_expand_vcond.
+ (vcond<V_cvtto><V32:mode>): New pattern.
+ (vcondu<VDQIW:mode><VDQIW:mode>): Generalize to...
+ (vcondu<VDQW:mode><v_cmp_result): ...this. Require operand 5
+ to be a register or zero. Use arm_expand_vcond.
+ (vcond_mask_<VDQW:mode><v_cmp_result>): New pattern.
+ (neon_vc<cmp_op><mode>, neon_vc<cmp_op><mode>_insn): Add "@" marker.
+ (neon_vbsl<mode>): Likewise.
+ (neon_vc<cmp_op>u<mode>): Reexpress as...
+ (@neon_vc<code><mode>): ...this.
+
+2020-10-01 Michael Davidsaver <mdavidsaver@gmail.com>
+
+ * config/i386/t-rtems: Change from mtune to march when building
+ multilibs. The mtune argument tunes or optimizes for a specific
+ CPU model but does not ensure the generated code is appropriate
+ for the CPU model. Prior to this patch, i386 compatible code
+ was always generated but tuned for later models.
+
+2020-10-01 Aldy Hernandez <aldyh@redhat.com>
+
+ * builtins.c (compute_objsize): Replace vr_values with range_query.
+ (get_range): Same.
+ (gimple_call_alloc_size): Same.
+ * builtins.h (class vr_values): Remove.
+ (gimple_call_alloc_size): Replace vr_values with range_query.
+ * gimple-ssa-sprintf.c (get_int_range): Same.
+ (struct directive): Pass gimple context to fmtfunc callback.
+ (directive::set_width): Replace inline with out-of-line version.
+ (directive::set_precision): Same.
+ (format_none): New gimple argument.
+ (format_percent): New gimple argument.
+ (format_integer): New gimple argument.
+ (format_floating): New gimple argument.
+ (get_string_length): Use range_query API.
+ (format_character): New gimple argument.
+ (format_string): New gimple argument.
+ (format_plain): New gimple argument.
+ (format_directive): New gimple argument.
+ (parse_directive): Replace vr_values with range_query.
+ (compute_format_length): Same.
+ (handle_printf_call): Same. Adjust for range_query API.
+ * tree-ssa-strlen.c (get_range): Same.
+ (compare_nonzero_chars): Same.
+ (get_addr_stridx) Replace vr_values with range_query.
+ (get_stridx): Same.
+ (dump_strlen_info): Same.
+ (get_range_strlen_dynamic): Adjust for range_query API.
+ (set_strlen_range): Same
+ (maybe_warn_overflow): Replace vr_values with range_query.
+ (handle_builtin_strcpy): Same.
+ (maybe_diag_stxncpy_trunc): Add FIXME comment.
+ (handle_builtin_memcpy): Replace vr_values with range_query.
+ (handle_builtin_memset): Same.
+ (get_len_or_size): Same.
+ (strxcmp_eqz_result): Same.
+ (handle_builtin_string_cmp): Same.
+ (count_nonzero_bytes_addr): Same, plus adjust for range_query API.
+ (count_nonzero_bytes): Replace vr_values with range_query.
+ (handle_store): Same.
+ (strlen_check_and_optimize_call): Same.
+ (handle_integral_assign): Same.
+ (check_and_optimize_stmt): Same.
+ * tree-ssa-strlen.h (class vr_values): Remove.
+ (get_range): Replace vr_values with range_query.
+ (get_range_strlen_dynamic): Same.
+ (handle_printf_call): Same.
+
+2020-10-01 Aldy Hernandez <aldyh@redhat.com>
+
+ * gimple-loop-versioning.cc (lv_dom_walker::before_dom_children):
+ Pass m_range_analyzer instead of get_vr_values.
+ (loop_versioning::name_prop::get_value): Rename to...
+ (loop_versioning::name_prop::value_of_expr): ...this.
+ * gimple-ssa-evrp-analyze.c (evrp_range_analyzer::evrp_range_analyzer):
+ Adjust for evrp_range_analyzer
+ inheriting from vr_values.
+ (evrp_range_analyzer::try_find_new_range): Same.
+ (evrp_range_analyzer::record_ranges_from_incoming_edge): Same.
+ (evrp_range_analyzer::record_ranges_from_phis): Same.
+ (evrp_range_analyzer::record_ranges_from_stmt): Same.
+ (evrp_range_analyzer::push_value_range): Same.
+ (evrp_range_analyzer::pop_value_range): Same.
+ * gimple-ssa-evrp-analyze.h (class evrp_range_analyzer): Inherit from
+ vr_values. Adjust accordingly.
+ * gimple-ssa-evrp.c: Adjust for evrp_range_analyzer inheriting from
+ vr_values.
+ (evrp_folder::value_of_evrp): Rename from get_value.
+ * tree-ssa-ccp.c (class ccp_folder): Rename get_value to
+ value_of_expr.
+ (ccp_folder::get_value): Rename to...
+ (ccp_folder::value_of_expr): ...this.
+ * tree-ssa-copy.c (class copy_folder): Rename get_value to
+ value_of_expr.
+ (copy_folder::get_value): Rename to...
+ (copy_folder::value_of_expr): ...this.
+ * tree-ssa-dom.c (dom_opt_dom_walker::after_dom_children): Adjust
+ for evrp_range_analyzer inheriting from vr_values.
+ (dom_opt_dom_walker::optimize_stmt): Same.
+ * tree-ssa-propagate.c (substitute_and_fold_engine::replace_uses_in):
+ Call value_of_* instead of get_value.
+ (substitute_and_fold_engine::replace_phi_args_in): Same.
+ (substitute_and_fold_engine::propagate_into_phi_args): Same.
+ (substitute_and_fold_dom_walker::before_dom_children): Same.
+ * tree-ssa-propagate.h: Include value-query.h.
+ (class substitute_and_fold_engine): Inherit from value_query.
+ * tree-ssa-strlen.c (strlen_dom_walker::before_dom_children):
+ Adjust for evrp_range_analyzer inheriting from vr_values.
+ * tree-ssa-threadedge.c (record_temporary_equivalences_from_phis):
+ Same.
+ * tree-vrp.c (class vrp_folder): Same.
+ (vrp_folder::get_value): Rename to value_of_expr.
+ * vr-values.c (vr_values::get_lattice_entry): Adjust for
+ vr_values inheriting from range_query.
+ (vr_values::range_of_expr): New.
+ (vr_values::value_of_expr): New.
+ (vr_values::value_on_edge): New.
+ (vr_values::value_of_stmt): New.
+ (simplify_using_ranges::op_with_boolean_value_range_p): Call
+ get_value_range through query.
+ (check_for_binary_op_overflow): Rename store to query.
+ (vr_values::vr_values): Remove vrp_value_range_pool.
+ (vr_values::~vr_values): Same.
+ (simplify_using_ranges::get_vr_for_comparison): Call get_value_range
+ through query.
+ (simplify_using_ranges::compare_names): Same.
+ (simplify_using_ranges::vrp_evaluate_conditional): Same.
+ (simplify_using_ranges::vrp_visit_cond_stmt): Same.
+ (simplify_using_ranges::simplify_abs_using_ranges): Same.
+ (simplify_using_ranges::simplify_cond_using_ranges_1): Same.
+ (simplify_cond_using_ranges_2): Same.
+ (simplify_using_ranges::simplify_switch_using_ranges): Same.
+ (simplify_using_ranges::two_valued_val_range_p): Same.
+ (simplify_using_ranges::simplify_using_ranges): Rename store to query.
+ (simplify_using_ranges::simplify): Assert that we have a query.
+ * vr-values.h (class range_query): Remove.
+ (class simplify_using_ranges): Remove inheritance of range_query.
+ (class vr_values): Add virtuals for range_of_expr, value_of_expr,
+ value_on_edge, value_of_stmt, and get_value_range.
+ Call range_query allocator instead of using vrp_value_range_pool.
+ Remove vrp_value_range_pool.
+ (simplify_using_ranges::get_value_range): Remove.
+
+2020-10-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97236
+ * tree-vect-stmts.c (get_group_load_store_type): Keep
+ VMAT_ELEMENTWISE for single-element vectors.
+
+2020-10-01 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (compute_parm_map): Be ready for callee_pi to be NULL.
+
+2020-10-01 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97244
+ * ipa-fnsummary.c (pass_free_fnsummary::execute): Free
+ also indirect inlining datastructure.
+ * ipa-modref.c (pass_ipa_modref::execute): Do not free them here.
+ * ipa-prop.c (ipa_free_all_node_params): Do not crash when info does
+ not exist.
+ (ipa_unregister_cgraph_hooks): Likewise.
+
+2020-10-01 Jan Hubicka <jh@suse.cz>
+
+ * internal-fn.c (DEF_INTERNAL_FN): Fix handling of fnspec
+
+2020-10-01 Aldy Hernandez <aldyh@redhat.com>
+
+ * Makefile.in: Add value-query.o.
+ * value-query.cc: New file.
+ * value-query.h: New file.
+
+2020-10-01 Alex Coplan <alex.coplan@arm.com>
+
+ * config/arm/arm-cpus.in: Fix ordering, move Neoverse N2 down.
+ * config/arm/arm-tables.opt: Regenerate.
+ * config/arm/arm-tune.md: Regenerate.
+
+2020-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ * config/s390/s390.c (s390_atomic_assign_expand_fenv): Use
+ TARGET_EXPR instead of MODIFY_EXPR for the first assignments to
+ fenv_var and old_fpc. Formatting fixes.
+
+2020-10-01 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
+ VIEW_CONVERT_EXPR.
+
+2020-10-01 Florian Weimer <fweimer@redhat.com>
+
+ PR target/97250
+ * config/i386/i386.h (PTA_NO_TUNE, PTA_X86_64_BASELINE)
+ (PTA_X86_64_V2, PTA_X86_64_V3, PTA_X86_64_V4): New.
+ * common/config/i386/i386-common.c (processor_alias_table):
+ Add "x86-64-v2", "x86-64-v3", "x86-64-v4".
+ * config/i386/i386-options.c (ix86_option_override_internal):
+ Handle new PTA_NO_TUNE processor table entries.
+ * doc/invoke.texi (x86 Options): Document new -march values.
+
+2020-10-01 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/ppc-asm.h: Support __PCREL__ code.
+
+2020-10-01 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Don't
+ set -mcmodel=small for -mno-minimal-toc when pcrel.
+
+2020-09-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97189
+ * attribs.c (attr_access::array_as_string): Avoid assuming a VLA
+ access specification string contains a closing bracket.
+
+2020-09-30 Martin Sebor <msebor@redhat.com>
+
+ PR c/97206
+ * attribs.c (attr_access::array_as_string): Avoid modifying a shared
+ type in place and use build_type_attribute_qual_variant instead.
+
+2020-09-30 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
+
+ * config/arm/arm-cpus.in: Add Cortex-A78 and Cortex-A78AE cores.
+ * config/arm/arm-tables.opt: Regenerate.
+ * config/arm/arm-tune.md: Regenerate.
+ * doc/invoke.texi: Update docs.
+
+2020-09-30 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
+
+ * config/aarch64/aarch64-cores.def: Add Cortex-A78 and Cortex-A78AE cores.
+ * config/aarch64/aarch64-tune.md: Regenerate.
+ * doc/invoke.texi: Add -mtune=cortex-a78 and -mtune=cortex-a78ae.
+
+2020-09-30 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/96795
+ * config/arm/arm_mve.h (__ARM_mve_coerce2): Define.
+ (__arm_vaddq): Correct the scalar argument.
+ (__arm_vaddq_m): Likewise.
+ (__arm_vaddq_x): Likewise.
+ (__arm_vcmpeqq_m): Likewise.
+ (__arm_vcmpeqq): Likewise.
+ (__arm_vcmpgeq_m): Likewise.
+ (__arm_vcmpgeq): Likewise.
+ (__arm_vcmpgtq_m): Likewise.
+ (__arm_vcmpgtq): Likewise.
+ (__arm_vcmpleq_m): Likewise.
+ (__arm_vcmpleq): Likewise.
+ (__arm_vcmpltq_m): Likewise.
+ (__arm_vcmpltq): Likewise.
+ (__arm_vcmpneq_m): Likewise.
+ (__arm_vcmpneq): Likewise.
+ (__arm_vfmaq_m): Likewise.
+ (__arm_vfmaq): Likewise.
+ (__arm_vfmasq_m): Likewise.
+ (__arm_vfmasq): Likewise.
+ (__arm_vmaxnmavq): Likewise.
+ (__arm_vmaxnmavq_p): Likewise.
+ (__arm_vmaxnmvq): Likewise.
+ (__arm_vmaxnmvq_p): Likewise.
+ (__arm_vminnmavq): Likewise.
+ (__arm_vminnmavq_p): Likewise.
+ (__arm_vminnmvq): Likewise.
+ (__arm_vminnmvq_p): Likewise.
+ (__arm_vmulq_m): Likewise.
+ (__arm_vmulq): Likewise.
+ (__arm_vmulq_x): Likewise.
+ (__arm_vsetq_lane): Likewise.
+ (__arm_vsubq_m): Likewise.
+ (__arm_vsubq): Likewise.
+ (__arm_vsubq_x): Likewise.
+
+2020-09-30 Joel Hutton <joel.hutton@arm.com>
+
+ PR target/96837
+ * tree-vect-slp.c (vect_analyze_slp): Do not call
+ vect_attempt_slp_rearrange_stmts for vector constructors.
+
+2020-09-30 Tamar Christina <tamar.christina@arm.com>
+
+ * tree-vectorizer.h (SLP_TREE_REF_COUNT): New.
+ * tree-vect-slp.c (_slp_tree::_slp_tree, _slp_tree::~_slp_tree,
+ vect_free_slp_tree, vect_build_slp_tree, vect_print_slp_tree,
+ slp_copy_subtree, vect_attempt_slp_rearrange_stmts): Use it.
+
+2020-09-30 Tobias Burnus <tobias@codesourcery.com>
+
+ * omp-offload.c (omp_discover_implicit_declare_target): Also
+ handled nested functions.
+
+2020-09-30 Tobias Burnus <tobias@codesourcery.com>
+ Tom de Vries <tdevries@suse.de>
+
+ * builtins.c (expand_builtin_cexpi, fold_builtin_sincos): Update
+ targetm.libc_has_function call.
+ * builtins.def (DEF_C94_BUILTIN, DEF_C99_BUILTIN, DEF_C11_BUILTIN):
+ (DEF_C2X_BUILTIN, DEF_C99_COMPL_BUILTIN, DEF_C99_C90RES_BUILTIN):
+ Same.
+ * config/darwin-protos.h (darwin_libc_has_function): Update prototype.
+ * config/darwin.c (darwin_libc_has_function): Add arg.
+ * config/linux-protos.h (linux_libc_has_function): Update prototype.
+ * config/linux.c (linux_libc_has_function): Add arg.
+ * config/i386/i386.c (ix86_libc_has_function): Update
+ targetm.libc_has_function call.
+ * config/nvptx/nvptx.c (nvptx_libc_has_function): New function.
+ (TARGET_LIBC_HAS_FUNCTION): Redefine to nvptx_libc_has_function.
+ * convert.c (convert_to_integer_1): Update targetm.libc_has_function
+ call.
+ * match.pd: Same.
+ * target.def (libc_has_function): Add arg.
+ * doc/tm.texi: Regenerate.
+ * targhooks.c (default_libc_has_function, gnu_libc_has_function)
+ (no_c99_libc_has_function): Add arg.
+ * targhooks.h (default_libc_has_function, no_c99_libc_has_function)
+ (gnu_libc_has_function): Update prototype.
+ * tree-ssa-math-opts.c (pass_cse_sincos::execute): Update
+ targetm.libc_has_function call.
+
+2020-09-30 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97184
+ * config/i386/i386.md (UNSPECV_MOVDIRI): Renamed to ...
+ (UNSPEC_MOVDIRI): This.
+ (UNSPECV_MOVDIR64B): Renamed to ...
+ (UNSPEC_MOVDIR64B): This.
+ (movdiri<mode>): Use SET operation.
+ (@movdir64b_<mode>): Likewise.
+
+2020-09-30 Florian Weimer <fweimer@redhat.com>
+
+ * config/i386/i386-c.c (ix86_target_macros_internal): Define
+ __LAHF_SAHF__ and __MOVBE__ based on ISA flags.
+
+2020-09-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/97150
+ * config/aarch64/arm_neon.h (vqrshlb_u8): Make second argument
+ signed.
+ (vqrshlh_u16): Likewise.
+ (vqrshls_u32): Likewise.
+ (vqrshld_u64): Likewise.
+ (vqshlb_u8): Likewise.
+ (vqshlh_u16): Likewise.
+ (vqshls_u32): Likewise.
+ (vqshld_u64): Likewise.
+ (vshld_u64): Likewise.
+
+2020-09-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/96313
+ * config/aarch64/aarch64-simd-builtins.def (sqmovun): Use UNOPUS
+ qualifiers.
+ * config/aarch64/arm_neon.h (vqmovun_s16): Adjust builtin call.
+ Remove unnecessary result cast.
+ (vqmovun_s32): Likewise.
+ (vqmovun_s64): Likewise.
+ (vqmovunh_s16): Likewise. Fix return type.
+ (vqmovuns_s32): Likewise.
+ (vqmovund_s64): Likewise.
+
+2020-09-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_split_128bit_move_p): Add a
+ function comment. Tighten check for FP moves.
+ * config/aarch64/aarch64.md (*movti_aarch64): Add a w<-Z alternative.
+ (*movtf_aarch64): Handle r<-Y like r<-r. Remove unnecessary
+ earlyclobber. Change splitter predicate from aarch64_reg_or_imm
+ to nonmemory_operand.
+
+2020-09-30 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/97251
+ * config/arm/arm.md (movsf): Relax TARGET_HARD_FLOAT to
+ TARGET_VFP_BASE.
+ (movdf): Likewise.
+ * config/arm/vfp.md (no_literal_pool_df_immediate): Likewise.
+ (no_literal_pool_sf_immediate): Likewise.
+
+2020-09-30 Alan Modra <amodra@gmail.com>
+
+ * configure.ac (--with-long-double-format): Typo fix.
+ * configure: Regenerate.
+
+2020-09-30 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.md (@tablejump<mode>_normal): Don't use
+ non-existent operands[].
+ (@tablejump<mode>_nospec): Likewise.
+
+2020-09-30 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/rs6000.md (tablejump): Simplify.
+ (tablejumpsi): Merge this ...
+ (tablejumpdi): ... and this ...
+ (@tablejump<mode>_normal): ... into this.
+ (tablejumpsi_nospec): Merge this ...
+ (tablejumpdi_nospec): ... and this ...
+ (@tablejump<mode>_nospec): ... into this.
+ (*tablejump<mode>_internal1): Delete, rename to ...
+ (@tablejump<mode>_insn_normal): ... this.
+ (*tablejump<mode>_internal1_nospec): Delete, rename to ...
+ (@tablejump<mode>_insn_nospec): ... this.
+
+2020-09-29 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97188
+ * calls.c (maybe_warn_rdwr_sizes): Simplify warning messages.
+ Correct handling of VLA argumments.
+
+2020-09-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94695
+ * doc/invoke.texi: Document -Wrange-loop-construct.
+
+2020-09-29 Jim Wilson <jimw@sifive.com>
+
+ PR bootstrap/97183
+ * configure.ac (gcc_cv_header_zstd_h): Check ZSTD_VERISON_NUMBER.
+ * configure: Regenerated.
+
+2020-09-29 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
+
+ * config/arm/arm-cpus.in: Add Cortex-X1 core.
+ * config/arm/arm-tables.opt: Regenerate.
+ * config/arm/arm-tune.md: Regenerate.
+ * doc/invoke.texi: Update docs.
+
+2020-09-29 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
+
+ * config/aarch64/aarch64-cores.def: Add Cortex-X1 Arm core.
+ * config/aarch64/aarch64-tune.md: Regenerate.
+ * doc/invoke.texi: Add -mtune=cortex-x1 docs.
+
+2020-09-29 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97247
+ * config/i386/enqcmdintrin.h: Replace <enqcmdntrin.h> with
+ <enqcmdintrin.h>. Replace _ENQCMDNTRIN_H_INCLUDED with
+ _ENQCMDINTRIN_H_INCLUDED.
+
+2020-09-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97241
+ * tree-vect-loop.c (vectorizable_reduction): Move finding
+ the SLP node for the reduction stmt to a better place.
+
+2020-09-29 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_analyze_slp): Move SLP reduction
+ re-arrangement and SLP graph load gathering...
+ (vect_optimize_slp): ... here.
+ * tree-vectorizer.h (vec_info::slp_loads): Remove.
+
+2020-09-29 Hongyu Wang <hongyu.wang@intel.com>
+
+ PR target/97231
+ * config/i386/amxbf16intrin.h: Add FSF copyright notes.
+ * config/i386/amxint8intrin.h: Ditto.
+ * config/i386/amxtileintrin.h: Ditto.
+ * config/i386/avx512vp2intersectintrin.h: Ditto.
+ * config/i386/avx512vp2intersectvlintrin.h: Ditto.
+ * config/i386/pconfigintrin.h: Ditto.
+ * config/i386/tsxldtrkintrin.h: Ditto.
+ * config/i386/wbnoinvdintrin.h: Ditto.
+
+2020-09-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97238
+ * tree-ssa-reassoc.c (ovce_extract_ops): Fix typo.
+
+2020-09-29 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/arm/arm.h (ARM_HAVE_NEON_V8QI_ARITH, ARM_HAVE_NEON_V4HI_ARITH)
+ (ARM_HAVE_NEON_V2SI_ARITH, ARM_HAVE_NEON_V16QI_ARITH): New macros.
+ (ARM_HAVE_NEON_V8HI_ARITH, ARM_HAVE_NEON_V4SI_ARITH): Likewise.
+ (ARM_HAVE_NEON_V2DI_ARITH, ARM_HAVE_NEON_V4HF_ARITH): Likewise.
+ (ARM_HAVE_NEON_V8HF_ARITH, ARM_HAVE_NEON_V2SF_ARITH): Likewise.
+ (ARM_HAVE_NEON_V4SF_ARITH, ARM_HAVE_V8QI_ARITH, ARM_HAVE_V4HI_ARITH)
+ (ARM_HAVE_V2SI_ARITH, ARM_HAVE_V16QI_ARITH, ARM_HAVE_V8HI_ARITH)
+ (ARM_HAVE_V4SI_ARITH, ARM_HAVE_V2DI_ARITH, ARM_HAVE_V4HF_ARITH)
+ (ARM_HAVE_V2SF_ARITH, ARM_HAVE_V8HF_ARITH, ARM_HAVE_V4SF_ARITH):
+ Likewise.
+ * config/arm/iterators.md (VNIM, VNINOTM): Delete.
+ * config/arm/vec-common.md (add<VNIM:mode>3, addv8hf3)
+ (add<VNINOTM:mode>3): Replace with...
+ (add<VDQ:mode>3): ...this new expander.
+ * config/arm/neon.md (*add<VDQ:mode>3_neon): Use the new
+ ARM_HAVE_NEON_<MODE>_ARITH macros as the C condition.
+ (addv8hf3_neon, addv4hf3, add<VFH:mode>3_fp16): Delete in
+ favor of the above.
+ (neon_vadd<VH:mode>): Use gen_add<mode>3 instead of
+ gen_add<mode>3_fp16.
+
+2020-09-29 Kito Cheng <kito.cheng@sifive.com>
+
+ * config/riscv/riscv-c.c (riscv_cpu_cpp_builtins): Define
+ __riscv_cmodel_medany when PIC mode.
+
+2020-09-29 Alex Coplan <alex.coplan@arm.com>
+
+ * config/aarch64/aarch64-cores.def: Move neoverse-n2 after saphira.
+ * config/aarch64/aarch64-tune.md: Regenerate.
+
+2020-09-29 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96979
+ * tree-switch-conversion.c (jump_table_cluster::can_be_handled):
+ Make a fast bail out.
+ (bit_test_cluster::can_be_handled): Likewise here.
+ * tree-switch-conversion.h (get_range): Use wi::to_wide instead
+ of a folding.
+
+2020-09-29 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2020-09-22 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96979
+ * doc/invoke.texi: Document new param max-switch-clustering-attempts.
+ * params.opt: Add new parameter.
+ * tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
+ Limit number of attempts.
+ (bit_test_cluster::find_bit_tests): Likewise.
+
+2020-09-28 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.h (class irange): Add irange_allocator friend.
+ (class irange_allocator): New.
+
+2020-09-28 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/96390
+ * omp-offload.c (omp_discover_declare_target_tgt_fn_r): Handle
+ alias nodes.
+
+2020-09-28 Paul A. Clarke <pc@us.ibm.com>
+
+ * config/rs6000/smmintrin.h (_mm_insert_epi8): New.
+ (_mm_insert_epi32): New.
+ (_mm_insert_epi64): New.
+
+2020-09-28 liuhongt <hongtao.liu@intel.com>
+
+ * common/config/i386/i386-common.c (OPTION_MASK_ISA2_AMX_TILE_SET,
+ OPTION_MASK_ISA2_AMX_INT8_SET, OPTION_MASK_ISA2_AMX_BF16_SET,
+ OPTION_MASK_ISA2_AMX_TILE_UNSET, OPTION_MASK_ISA2_AMX_INT8_UNSET,
+ OPTION_MASK_ISA2_AMX_BF16_UNSET, OPTION_MASK_ISA2_XSAVE_UNSET):
+ New marcos.
+ (ix86_handle_option): Hanlde -mamx-tile, -mamx-int8, -mamx-bf16.
+ * common/config/i386/i386-cpuinfo.h (processor_types): Add
+ FEATURE_AMX_TILE, FEATURE_AMX_INT8, FEATURE_AMX_BF16.
+ * common/config/i386/cpuinfo.h (XSTATE_TILECFG,
+ XSTATE_TILEDATA, XCR_AMX_ENABLED_MASK): New macro.
+ (get_available_features): Enable AMX features only if
+ their states are suoorited by OSXSAVE.
+ * common/config/i386/i386-isas.h: Add ISA_NAME_TABLE_ENTRY
+ for amx-tile, amx-int8, amx-bf16.
+ * config.gcc: Add amxtileintrin.h, amxint8intrin.h,
+ amxbf16intrin.h to extra headers.
+ * config/i386/amxbf16intrin.h: New file.
+ * config/i386/amxint8intrin.h: Ditto.
+ * config/i386/amxtileintrin.h: Ditto.
+ * config/i386/cpuid.h (bit_AMX_BF16, bit_AMX_TILE, bit_AMX_INT8):
+ New macro.
+ * config/i386/i386-c.c (ix86_target_macros_internal): Define
+ __AMX_TILE__, __AMX_INT8__, AMX_BF16__.
+ * config/i386/i386-options.c (ix86_target_string): Add
+ -mamx-tile, -mamx-int8, -mamx-bf16.
+ (ix86_option_override_internal): Handle AMX-TILE,
+ AMX-INT8, AMX-BF16.
+ * config/i386/i386.h (TARGET_AMX_TILE, TARGET_AMX_TILE_P,
+ TARGET_AMX_INT8, TARGET_AMX_INT8_P, TARGET_AMX_BF16_P,
+ PTA_AMX_TILE, PTA_AMX_INT8, PTA_AMX_BF16): New macros.
+ * config/i386/i386.opt: Add -mamx-tile, -mamx-int8, -mamx-bf16.
+ * config/i386/immintrin.h: Include amxtileintrin.h,
+ amxint8intrin.h, amxbf16intrin.h.
+ * doc/invoke.texi: Document -mamx-tile, -mamx-int8, -mamx-bf16.
+ * doc/extend.texi: Document amx-tile, amx-int8, amx-bf16.
+ * doc/sourcebuild.texi ((Effective-Target Keywords, Other
+ hardware attributes): Document amx_int8, amx_tile, amx_bf16.
+
+2020-09-28 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/aarch64/aarch64-builtins.c
+ (aarch64_general_expand_builtin): Do not alter value on a
+ force_reg returned rtx.
+
+2020-09-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-eh.c (lower_try_finally_dup_block): Revert latest change.
+
+2020-09-27 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (modref_summary::useful_p): Fix testing of stores.
+
+2020-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/97073
+ * optabs.c (expand_binop, expand_absneg_bit, expand_unop,
+ expand_copysign_bit): Check reg_overlap_mentioned_p between target
+ and operand(s) and if it returns true, force a pseudo as target.
+
+2020-09-27 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ * gimple-isel.cc (gimple_expand_vec_set_expr): New function.
+ (gimple_expand_vec_cond_exprs): Rename to ...
+ (gimple_expand_vec_exprs): ... this and call
+ gimple_expand_vec_set_expr.
+ * internal-fn.c (vec_set_direct): New define.
+ (expand_vec_set_optab_fn): New function.
+ (direct_vec_set_optab_supported_p): New define.
+ * internal-fn.def (VEC_SET): New DEF_INTERNAL_OPTAB_FN.
+ * optabs.c (can_vec_set_var_idx_p): New function.
+ * optabs.h (can_vec_set_var_idx_p): New declaration.
+
+2020-09-26 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (analyze_stmt): Do not skip clobbers in early pass.
+ * ipa-pure-const.c (analyze_stmt): Update comment.
+
+2020-09-26 David Edelsohn <dje.gcc@gmail.com>
+ Clement Chigot <clement.chigot@atos.com>
+
+ * collect2.c (visibility_flag): New.
+ (main): Detect -fvisibility.
+ (write_c_file_stat): Push and pop default visibility.
+
+2020-09-26 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-inline-transform.c: Include ipa-modref-tree.h and ipa-modref.h.
+ (inline_call): Call ipa_merge_modref_summary_after_inlining.
+ * ipa-inline.c (ipa_inline): Do not free summaries.
+ * ipa-modref.c (dump_records): Fix formating.
+ (merge_call_side_effects): Break out from ...
+ (analyze_call): ... here; record recursive calls.
+ (analyze_stmt): Add new parameter RECURSIVE_CALLS.
+ (analyze_function): Do iterative dataflow on recursive calls.
+ (compute_parm_map): New function.
+ (ipa_merge_modref_summary_after_inlining): New function.
+ (collapse_loads): New function.
+ (modref_propagate_in_scc): Break out from ...
+ (pass_ipa_modref::execute): ... here; Do iterative dataflow.
+ * ipa-modref.h (ipa_merge_modref_summary_after_inlining): Declare.
+
+2020-09-26 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-expand.c (expand_omp_simd): Help vectorizer for the collapse == 1
+ and non-composite collapse > 1 case with non-constant innermost loop
+ step by precomputing number of iterations before loop and using an
+ alternate IV from 0 to number of iterations - 1 with step of 1.
+
+2020-09-26 Jan Hubicka <jh@suse.cz>
+
+ * ipa-fnsummary.c (dump_ipa_call_summary): Dump
+ points_to_local_or_readonly_memory flag.
+ (analyze_function_body): Compute points_to_local_or_readonly_memory
+ flag.
+ (remap_edge_change_prob): Rename to ...
+ (remap_edge_params): ... this one; update
+ points_to_local_or_readonly_memory.
+ (remap_edge_summaries): Update.
+ (read_ipa_call_summary): Stream the new flag.
+ (write_ipa_call_summary): Likewise.
+ * ipa-predicate.h (struct inline_param_summary): Add
+ points_to_local_or_readonly_memory.
+ (inline_param_summary::equal_to): Update.
+ (inline_param_summary::useless_p): Update.
+
+2020-09-26 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref-tree.h (modref_ref_node::insert_access): Track if something
+ changed.
+ (modref_base_node::insert_ref): Likewise (and add a new optional
+ argument)
+ (modref_tree::insert): Likewise.
+ (modref_tree::merge): Rewrite
+
+2020-09-25 Jan Hubicka <hubicka@ucw.cz>
+
+ * doc/invoke.texi: Add -fno-ipa-modref to flags disabled by
+ -flive-patching.
+ * opts.c (control_options_for_live_patching): Disable ipa-modref.
+
+2020-09-25 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref.c (analyze_stmt): Fix return value for gimple_clobber.
+
+2020-09-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/aarch64/aarch64-option-extensions.def (rng): Add
+ cpuinfo string.
+
+2020-09-25 Alex Coplan <alex.coplan@arm.com>
+
+ * config/arm/arm-cpus.in (neoverse-v1): Add FP16.
+
+2020-09-25 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/64636
+ * value-prof.c (stream_out_histogram_value): Allow negative
+ values for HIST_TYPE_IOR.
+
+2020-09-25 Tom de Vries <tdevries@suse.de>
+
+ * config/nvptx/nvptx.c (nvptx_assemble_integer, nvptx_print_operand):
+ Use gcc_fallthrough ().
+
+2020-09-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/96814
+ * expr.c (store_constructor): Handle VECTOR_BOOLEAN_TYPE_P
+ CTORs correctly.
+
+2020-09-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97207
+ * vec.h (auto_vec<T>::operator=(auto_vec<T>&&)): Implement.
+
+2020-09-25 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/arm/arm-protos.h (arm_mve_mode_and_operands_type_check):
+ Delete.
+ * config/arm/arm.c (arm_coproc_mem_operand_wb): Use a scale factor
+ of 2 rather than 4 for 16-bit modes.
+ (arm_mve_mode_and_operands_type_check): Delete.
+ * config/arm/constraints.md (Uj): Allow writeback for Neon,
+ but continue to disallow it for MVE.
+ * config/arm/arm.md (*arm32_mov<HFBF:mode>): Add !TARGET_HAVE_MVE.
+ * config/arm/vfp.md (*mov_load_vfp_hf16, *mov_store_vfp_hf16): Fold
+ back into...
+ (*mov<mode>_vfp_<mode>16): ...here but use Uj for the FPR memory
+ constraints. Use for base MVE too.
+
+2020-09-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97199
+ * tree-if-conv.c (combine_blocks): Remove edges only
+ after looking at virtual PHI args.
+
+2020-09-25 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (scan_omp_1_stmt): Don't call scan_omp_simd for
+ collapse > 1 loops as simt doesn't support collapsed loops yet.
+ * omp-expand.c (expand_omp_for_init_counts, expand_omp_for_init_vars):
+ Small tweaks to function comment.
+ (expand_omp_simd): Rewritten collapse > 1 support to only attempt
+ to vectorize the innermost loop and emit set of outer loops around it.
+ For non-composite simd with collapse > 1 without broken loop don't
+ even try to compute number of iterations first. Add support for
+ non-rectangular simd loops.
+ (expand_omp_for): Don't sorry_at on non-rectangular simd loops.
+
+2020-09-25 Martin Liska <mliska@suse.cz>
+
+ * cgraph.c (cgraph_edge::debug): New.
+ * cgraph.h (cgraph_edge::debug): New.
+
+2020-09-25 Martin Liska <mliska@suse.cz>
+
+ * cgraph.c (cgraph_node::dump): Always print space at the end
+ of a message. Remove one extra space.
+
+2020-09-24 Alex Coplan <alex.coplan@arm.com>
+
+ * config/arm/arm-cpus.in (neoverse-n2): New.
+ * config/arm/arm-tables.opt: Regenerate.
+ * config/arm/arm-tune.md: Regenerate.
+ * doc/invoke.texi: Document support for Neoverse N2.
+
+2020-09-24 Alex Coplan <alex.coplan@arm.com>
+
+ * config/aarch64/aarch64-cores.def: Add Neoverse N2.
+ * config/aarch64/aarch64-tune.md: Regenerate.
+ * doc/invoke.texi: Document AArch64 support for Neoverse N2.
+
+2020-09-24 Richard Biener <rguenther@suse.de>
+
+ * vec.h (auto_vec<T, 0>::auto_vec (auto_vec &&)): New move CTOR.
+ (auto_vec<T, 0>::operator=(auto_vec &&)): Delete.
+ * hash-table.h (hash_table::expand): Use std::move when expanding.
+ * cfgloop.h (get_loop_exit_edges): Return auto_vec<edge>.
+ * cfgloop.c (get_loop_exit_edges): Adjust.
+ * cfgloopmanip.c (fix_loop_placement): Likewise.
+ * ipa-fnsummary.c (analyze_function_body): Likewise.
+ * ira-build.c (create_loop_tree_nodes): Likewise.
+ (create_loop_tree_node_allocnos): Likewise.
+ (loop_with_complex_edge_p): Likewise.
+ * ira-color.c (ira_loop_edge_freq): Likewise.
+ * loop-unroll.c (analyze_insns_in_loop): Likewise.
+ * predict.c (predict_loops): Likewise.
+ * tree-predcom.c (last_always_executed_block): Likewise.
+ * tree-ssa-loop-ch.c (ch_base::copy_headers): Likewise.
+ * tree-ssa-loop-im.c (store_motion_loop): Likewise.
+ * tree-ssa-loop-ivcanon.c (loop_edge_to_cancel): Likewise.
+ (canonicalize_loop_induction_variables): Likewise.
+ * tree-ssa-loop-manip.c (get_loops_exits): Likewise.
+ * tree-ssa-loop-niter.c (find_loop_niter): Likewise.
+ (finite_loop_p): Likewise.
+ (find_loop_niter_by_eval): Likewise.
+ (estimate_numbers_of_iterations): Likewise.
+ * tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Likewise.
+ (may_use_storent_in_loop_p): Likewise.
+
+2020-09-24 Jan Hubicka <jh@suse.cz>
+
+ * doc/invoke.texi: Document -fipa-modref, ipa-modref-max-bases,
+ ipa-modref-max-refs, ipa-modref-max-accesses, ipa-modref-max-tests.
+ * ipa-modref-tree.c (test_insert_search_collapse): Update.
+ (test_merge): Update.
+ (gt_ggc_mx): New function.
+ * ipa-modref-tree.h (struct modref_access_node): New structure.
+ (struct modref_ref_node): Add every_access and accesses array.
+ (modref_ref_node::modref_ref_node): Update ctor.
+ (modref_ref_node::search): New member function.
+ (modref_ref_node::collapse): New member function.
+ (modref_ref_node::insert_access): New member function.
+ (modref_base_node::insert_ref): Do not collapse base if ref is 0.
+ (modref_base_node::collapse): Copllapse also refs.
+ (modref_tree): Add accesses.
+ (modref_tree::modref_tree): Initialize max_accesses.
+ (modref_tree::insert): Add access parameter.
+ (modref_tree::cleanup): New member function.
+ (modref_tree::merge): Add parm_map; merge accesses.
+ (modref_tree::copy_from): New member function.
+ (modref_tree::create_ggc): Add max_accesses.
+ * ipa-modref.c (dump_access): New function.
+ (dump_records): Dump accesses.
+ (dump_lto_records): Dump accesses.
+ (get_access): New function.
+ (record_access): Record access.
+ (record_access_lto): Record access.
+ (analyze_call): Compute parm_map.
+ (analyze_function): Update construction of modref records.
+ (modref_summaries::duplicate): Likewise; use copy_from.
+ (write_modref_records): Stream accesses.
+ (read_modref_records): Sream accesses.
+ (pass_ipa_modref::execute): Update call of merge.
+ * params.opt (-param=modref-max-accesses): New.
+ * tree-ssa-alias.c (alias_stats): Add modref_baseptr_tests.
+ (dump_alias_stats): Update.
+ (base_may_alias_with_dereference_p): New function.
+ (modref_may_conflict): Check accesses.
+ (ref_maybe_used_by_call_p_1): Update call to modref_may_conflict.
+ (call_may_clobber_ref_p_1): Update call to modref_may_conflict.
+
+2020-09-24 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/arm/arm.md (*stack_protect_combined_set_insn): For non-PIC,
+ load the address of the canary rather than the address of the
+ constant pool entry that points to it.
+ (*stack_protect_combined_test_insn): Likewise.
+
+2020-09-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97085
+ * match.pd (mask ? { false,..} : { true, ..} -> ~mask): New.
+
+2020-09-24 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref-tree.h (modref_base::collapse): Release memory.
+ (modref_tree::create_ggc): New member function.
+ (modref_tree::colapse): Release memory.
+ (modref_tree::~modref_tree): New destructor.
+ * ipa-modref.c (modref_summaries::create_ggc): New function.
+ (analyze_function): Use create_ggc.
+ (modref_summaries::duplicate): Likewise.
+ (read_modref_records): Likewise.
+ (modref_read): Likewise.
+
+2020-09-24 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_rtx_costs): Pass mode to
+ reg_or_add_cint_operand and reg_or_sub_cint_operand.
+
+2020-09-24 Alan Modra <amodra@gmail.com>
+
+ PR target/93012
+ * config/rs6000/rs6000.c (num_insns_constant_gpr): Count rldimi
+ constants correctly.
+
+2020-09-24 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
+ Conditionally define __PCREL__.
+
+2020-09-24 Alan Modra <amodra@gmail.com>
+
+ PR target/97107
+ * config/rs6000/rs6000-internal.h (struct rs6000_stack): Improve
+ calls_p comment.
+ * config/rs6000/rs6000-logue.c (rs6000_stack_info): Likewise.
+ (rs6000_expand_split_stack_prologue): Emit the prologue for
+ functions that make a sibling call.
+
+2020-09-24 David Malcolm <dmalcolm@redhat.com>
+
+ * doc/analyzer.texi (Analyzer Paths): Add note about
+ -fno-analyzer-feasibility.
+ * doc/invoke.texi (Static Analyzer Options): Add
+ -fno-analyzer-feasibility.
+
+2020-09-24 Paul A. Clarke <pc@us.ibm.com>
+
+ * doc/extend.texi: Add 'd' for doubleword variant of
+ vector insert instruction.
+
+2020-09-23 Martin Sebor <msebor@redhat.com>
+
+ * gimple-array-bounds.cc (build_zero_elt_array_type): New function.
+ (array_bounds_checker::check_mem_ref): Call it.
+
+2020-09-23 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97175
+ * builtins.c (maybe_warn_for_bound): Handle both DECLs and EXPRESSIONs
+ in pad->dst.ref, same is pad->src.ref.
+
+2020-09-23 Jan Hubicka <jh@suse.cz>
+
+ * ipa-fnsummary.c (refs_local_or_readonly_memory_p): New function.
+ (points_to_local_or_readonly_memory_p): New function.
+ * ipa-fnsummary.h (refs_local_or_readonly_memory_p): Declare.
+ (points_to_local_or_readonly_memory_p): Declare.
+ * ipa-modref.c (record_access_p): Use refs_local_or_readonly_memory_p.
+ * ipa-pure-const.c (check_op): Likewise.
+
+2020-09-23 Tom de Vries <tdevries@suse.de>
+
+ * config/nvptx/nvptx.md: Don't allow operand containing sum of
+ function ref and const.
+
+2020-09-23 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/aarch64-protos.h (aarch64_salt_type): New enum.
+ (aarch64_stack_protect_canary_mem): Declare.
+ * config/aarch64/aarch64.md (UNSPEC_SALT_ADDR): New unspec.
+ (stack_protect_set): Forward to stack_protect_combined_set.
+ (stack_protect_combined_set): New pattern. Use
+ aarch64_stack_protect_canary_mem.
+ (reg_stack_protect_address_<mode>): Add a salt operand.
+ (stack_protect_test): Forward to stack_protect_combined_test.
+ (stack_protect_combined_test): New pattern. Use
+ aarch64_stack_protect_canary_mem.
+ * config/aarch64/aarch64.c (strip_salt): New function.
+ (strip_offset_and_salt): Likewise.
+ (tls_symbolic_operand_type): Use strip_offset_and_salt.
+ (aarch64_stack_protect_canary_mem): New function.
+ (aarch64_cannot_force_const_mem): Use strip_offset_and_salt.
+ (aarch64_classify_address): Likewise.
+ (aarch64_symbolic_address_p): Likewise.
+ (aarch64_print_operand): Likewise.
+ (aarch64_output_addr_const_extra): New function.
+ (aarch64_tls_symbol_p): Use strip_salt.
+ (aarch64_classify_symbol): Likewise.
+ (aarch64_legitimate_pic_operand_p): Use strip_offset_and_salt.
+ (aarch64_legitimate_constant_p): Likewise.
+ (aarch64_mov_operand_p): Use strip_salt.
+ (TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA): Override.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vreinterpretq_f64_p128,
+ vreinterpretq_p128_f64): Define.
+
+2020-09-23 Alex Coplan <alex.coplan@arm.com>
+
+ * config/arm/arm-cpus.in (neoverse-v1): New.
+ * config/arm/arm-tables.opt: Regenerate.
+ * config/arm/arm-tune.md: Regenerate.
+ * doc/invoke.texi: Document support for Neoverse V1.
+
+2020-09-23 Alex Coplan <alex.coplan@arm.com>
+
+ * config/aarch64/aarch64-cores.def: Add Neoverse V1.
+ * config/aarch64/aarch64-tune.md: Regenerate.
+ * doc/invoke.texi: Document support for Neoverse V1.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/96453
+ * gimple-isel.cc (gimple_expand_vec_cond_expr): Remove
+ LT_EXPR -> NE_EXPR verification and also apply it for
+ non-constant masks.
+
+2020-09-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref.c (modref_summary::lto_useful_p): New member function.
+ (modref_summary::useful_p): New member function.
+ (analyze_function): Drop useless summaries.
+ (modref_write): Skip useless summaries.
+ (pass_ipa_modref::execute): Drop useless summaries.
+ * ipa-modref.h (struct GTY): Declare useful_p and lto_useful_p.
+ * tree-ssa-alias.c (dump_alias_stats): Fix.
+ (modref_may_conflict): Fix stats.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/96466
+ * internal-fn.c (expand_vect_cond_mask_optab_fn): Use
+ appropriate mode for force_reg.
+ * tree.c (build_truth_vector_type_for): Pass VOIDmode to
+ make_vector_type.
+
+2020-09-23 Richard Sandiford <richard.sandiford@arm.com>
+
+ * tree-vectorizer.h (determine_peel_for_niter): Delete in favor of...
+ (vect_determine_partial_vectors_and_peeling): ...this new function.
+ * tree-vect-loop-manip.c (vect_update_epilogue_niters): New function.
+ Reject using vector epilogue loops for single iterations. Install
+ the constant number of epilogue loop iterations in the associated
+ loop_vinfo. Rely on vect_determine_partial_vectors_and_peeling
+ to do the main part of the test.
+ (vect_do_peeling): Use vect_update_epilogue_niters to handle
+ epilogue loops with a known number of iterations. Skip recomputing
+ the number of iterations later in that case. Otherwise, use
+ vect_determine_partial_vectors_and_peeling to decide whether the
+ epilogue loop needs to use partial vectors or peeling.
+ * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Set the
+ default can_use_partial_vectors_p to false if partial-vector-usage=0.
+ (determine_peel_for_niter): Remove in favor of...
+ (vect_determine_partial_vectors_and_peeling): ...this new function,
+ split out from...
+ (vect_analyze_loop_2): ...here. Reflect the vect_verify_full_masking
+ and vect_verify_loop_lens results in CAN_USE_PARTIAL_VECTORS_P
+ rather than USING_PARTIAL_VECTORS_P.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/aarch64-simd-builtins.def (frintn): Use BUILTIN_VHSDF_HSDF
+ for modes. Remove explicit hf instantiation.
+ * config/aarch64/arm_neon.h (vrndns_f32): Define.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97173
+ * tree-vect-loop.c (vectorizable_live_operation): Extend
+ assert to also conver element conversions.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vtrn1q_p64, vtrn2q_p64, vuzp1q_p64,
+ vuzp2q_p64, vzip1q_p64, vzip2q_p64): Define.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vldrq_p128): Define.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vstrq_p128): Define.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97151
+ * tree-ssa-structalias.c (find_func_aliases_for_call):
+ DECL_IS_REPLACEABLE_OPERATOR_DELETE_P has no effect on
+ arguments.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97162
+ * alias.c (compare_base_decls): Use DECL_HARD_REGISTER
+ and guard with VAR_P.
+
+2020-09-23 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/97069
+ * profile.c (branch_prob): Line number must be at least 1.
+
+2020-09-23 Tom de Vries <tdevries@suse.de>
+
+ PR target/97158
+ * config/nvptx/nvptx.c (nvptx_output_mov_insn): Handle move from
+ DF subreg to DF reg.
+
+2020-09-23 David Malcolm <dmalcolm@redhat.com>
+
+ * Makefile.in: Add $(ZLIBINC) to CFLAGS-analyzer/engine.o.
+
+2020-09-22 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (analyze_stmt): Ignore gimple clobber.
+
+2020-09-22 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref-tree.c: Add namespace selftest.
+ (modref_tree_c_tests): Rename to ...
+ (ipa_modref_tree_c_tests): ... this.
+ * ipa-modref.c (pass_modref): Remove destructor.
+ (ipa_modref_c_finalize): New function.
+ * ipa-modref.h (ipa_modref_c_finalize): Declare.
+ * selftest-run-tests.c (selftest::run_tests): Call
+ ipa_modref_c_finalize.
+ * selftest.h (ipa_modref_tree_c_tests): Declare.
+ * toplev.c: Include ipa-modref-tree.h and ipa-modref.h
+ (toplev::finalize): Call ipa_modref_c_finalize.
+
+2020-09-22 David Malcolm <dmalcolm@redhat.com>
+
+ * doc/analyzer.texi (Other Debugging Techniques): Mention
+ -fdump-analyzer-json.
+ * doc/invoke.texi (Static Analyzer Options): Add
+ -fdump-analyzer-json.
+
+2020-09-22 David Faust <david.faust@oracle.com>
+
+ * config/bpf/bpf.md: Add defines for signed div and mod operators.
+
+2020-09-22 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96979
+ * doc/invoke.texi: Document new param max-switch-clustering-attempts.
+ * params.opt: Add new parameter.
+ * tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
+ Limit number of attempts.
+ (bit_test_cluster::find_bit_tests): Likewise.
+
+2020-09-22 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * config/s390/s390.md ("*cmp<mode>_ccs_0", "*cmp<mode>_ccz_0",
+ "*cmp<mode>_ccs_0_fastmath"): Basically change "*cmp<mode>_ccs_0" into
+ "*cmp<mode>_ccz_0" and for fast math add "*cmp<mode>_ccs_0_fastmath".
+
+2020-09-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vcls_u8, vcls_u16, vcls_u32,
+ vclsq_u8, vclsq_u16, vclsq_u32): Define.
+
+2020-09-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vceqq_p64, vceqz_p64, vceqzq_p64): Define.
+
+2020-09-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * config/aarch64/arm_neon.h (vadd_p8, vadd_p16, vadd_p64, vaddq_p8,
+ vaddq_p16, vaddq_p64, vaddq_p128): Define.
+
+2020-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ * params.opt (--param=modref-max-tests=): Fix typo in help text:
+ perofmed -> performed.
+ * common.opt: Fix typo: incrmeental -> incremental.
+ * ipa-modref.c: Fix typos: recroding -> recording, becaue -> because,
+ analsis -> analysis.
+ (class modref_summaries): Fix typo: betweehn -> between.
+ (analyze_call): Fix typo: calle -> callee.
+ (read_modref_records): Fix typo: expcted -> expected.
+ (pass_ipa_modref::execute): Fix typo: calle -> callee.
+
+2020-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ * common.opt (-fipa-modref): Add dot at the end of option help.
+ * params.opt (--param=modref-max-tests=): Likewise.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ * doc/invoke.texi: Document -Wctad-maybe-unsupported.
+
+2020-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97139
+ * tree-vect-slp.c (vect_bb_slp_mark_live_stmts): Only mark the
+ pattern root, track visited vectorized stmts.
+
+2020-09-21 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac: Use mallinfo mallinfo2 as first operand of
+ gcc_AC_CHECK_DECLS rather than [mallinfo, mallinfo2].
+ * configure: Regenerated.
+ * config.in: Regenerated.
+
+2020-09-21 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/aarch64/aarch64-builtins.c
+ (aarch64_general_expand_builtin): Use expand machinery not to
+ alter the value of an rtx returned by force_reg.
+
+2020-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97135
+ * tree-ssa-loop-im.c (sm_seq_push_down): Do not ignore
+ self-dependences.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96915
+ * tree-switch-conversion.c (switch_conversion::expand): Accept
+ also integer constants.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ * print-tree.c (print_node): Remove extra space.
+
+2020-09-21 Andrea Corallo <andrea.corallo@arm.com>
+
+ PR target/96968
+ * config/aarch64/aarch64-builtins.c
+ (aarch64_expand_fpsr_fpcr_setter): Fix comment nit.
+ (aarch64_expand_fpsr_fpcr_getter): New function, expand these
+ getters using expand_insn machinery.
+ (aarch64_general_expand_builtin): Make use of.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ * ggc-common.c (ggc_rlimit_bound): Use ONE_? macro.
+ (ggc_min_expand_heuristic): Likewise.
+ (ggc_min_heapsize_heuristic): Likewise.
+ * ggc-page.c (ggc_collect): Likewise.
+ * system.h (ONE_G): Likewise.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ * ggc-common.c (ggc_prune_overhead_list): Use SIZE_AMOUNT.
+ * ggc-page.c (release_pages): Likewise.
+ (ggc_collect): Likewise.
+ (ggc_trim): Likewise.
+ (ggc_grow): Likewise.
+ * timevar.c (timer::print): Likewise.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ * config.in: Regenerate.
+ * configure: Likewise.
+ * configure.ac: Detect for mallinfo2.
+ * ggc-common.c (defined): Use it.
+ * system.h: Handle also HAVE_MALLINFO2.
+
+2020-09-20 John David Anglin < danglin@gcc.gnu.org>
+
+ * config/pa/pa-hpux11.h (LINK_GCC_C_SEQUENCE_SPEC): Delete.
+ * config/pa/pa64-hpux.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
+ (ENDFILE_SPEC): Link with libgcc_stub.a and mill.a.
+ * config/pa/pa32-linux.h (ENDFILE_SPEC): Link with libgcc.a.
+
+2020-09-20 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-modref.c (dump_lto_records): Fix ICE.
+
+2020-09-20 David Cepelik <d@dcepelik.cz>
+ Jan Hubicka <hubicka@ucw.cz>
+
+ * Makefile.in: Add ipa-modref.c and ipa-modref-tree.c.
+ * alias.c: (reference_alias_ptr_type_1): Export.
+ * alias.h (reference_alias_ptr_type_1): Declare.
+ * common.opt (fipa-modref): New.
+ * gengtype.c (open_base_files): Add ipa-modref-tree.h and ipa-modref.h
+ * ipa-modref-tree.c: New file.
+ * ipa-modref-tree.h: New file.
+ * ipa-modref.c: New file.
+ * ipa-modref.h: New file.
+ * lto-section-in.c (lto_section_name): Add ipa_modref.
+ * lto-streamer.h (enum lto_section_type): Add LTO_section_ipa_modref.
+ * opts.c (default_options_table): Enable ipa-modref at -O1+.
+ * params.opt (-param=modref-max-bases, -param=modref-max-refs,
+ -param=modref-max-tests): New params.
+ * passes.def: Schedule pass_modref and pass_ipa_modref.
+ * timevar.def (TV_IPA_MODREF): New timevar.
+ (TV_TREE_MODREF): New timevar.
+ * tree-pass.h (make_pass_modref): Declare.
+ (make_pass_ipa_modref): Declare.
+ * tree-ssa-alias.c (dump_alias_stats): Include ipa-modref-tree.h
+ and ipa-modref.h
+ (alias_stats): Add modref_use_may_alias, modref_use_no_alias,
+ modref_clobber_may_alias, modref_clobber_no_alias, modref_tests.
+ (dump_alias_stats): Dump new stats.
+ (nonoverlapping_array_refs_p): Fix formating.
+ (modref_may_conflict): New function.
+ (ref_maybe_used_by_call_p_1): Use it.
+ (call_may_clobber_ref_p_1): Use it.
+ (call_may_clobber_ref_p): Update.
+ (stmt_may_clobber_ref_p_1): Update.
+ * tree-ssa-alias.h (call_may_clobber_ref_p_1): Update.
+
2020-09-19 Martin Sebor <msebor@redhat.com>
PR middle-end/82608
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2225e46..49d6a92 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20200920
+20201025
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c710bad..0894f48 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1297,6 +1297,7 @@ OBJS = \
cfgloopmanip.o \
cfgrtl.o \
symtab.o \
+ symtab-thunks.o \
cgraph.o \
cgraphbuild.o \
cgraphunit.o \
@@ -1369,6 +1370,10 @@ OBJS = \
gimple-loop-versioning.o \
gimple-low.o \
gimple-pretty-print.o \
+ gimple-range.o \
+ gimple-range-cache.o \
+ gimple-range-edge.o \
+ gimple-range-gori.o \
gimple-ssa-backprop.o \
gimple-ssa-evrp.o \
gimple-ssa-evrp-analyze.o \
@@ -1646,6 +1651,7 @@ OBJS = \
typed-splay-tree.o \
unique-ptr-tests.o \
valtrack.o \
+ value-query.o \
value-range.o \
value-range-equiv.o \
value-prof.o \
@@ -2296,6 +2302,7 @@ s-bversion: BASE-VER
CFLAGS-toplev.o += -DTARGET_NAME=\"$(target_noncanonical)\"
CFLAGS-optinfo-emit-json.o += -DTARGET_NAME=\"$(target_noncanonical)\" $(ZLIBINC)
+CFLAGS-analyzer/engine.o += $(ZLIBINC)
pass-instances.def: $(srcdir)/passes.def $(PASSES_EXTRA) \
$(srcdir)/gen-pass-instances.awk
@@ -2585,6 +2592,7 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/function-abi.h \
$(srcdir)/output.h $(srcdir)/cfgloop.h $(srcdir)/cfg.h $(srcdir)/profile-count.h \
$(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/ipa-ref.h $(srcdir)/cgraph.h \
+ $(srcdir)/symtab-thunks.h $(srcdir)/symtab-thunks.cc \
$(srcdir)/reload.h $(srcdir)/caller-save.c $(srcdir)/symtab.c \
$(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \
$(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-utils.h \
@@ -2623,7 +2631,7 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/omp-offload.c \
$(srcdir)/omp-general.c \
$(srcdir)/omp-low.c \
- $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
+ $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c \
$(srcdir)/cgraphclones.c \
$(srcdir)/tree-phinodes.c \
$(srcdir)/tree-ssa-alias.h \
@@ -3588,7 +3596,8 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
tree-ssa-threadupdate.h inchash.h wide-int.h signop.h hash-map.h \
hash-set.h dominance.h cfg.h cfgrtl.h cfganal.h cfgbuild.h cfgcleanup.h \
lcm.h cfgloopmanip.h file-prefix-map.h builtins.def $(INSN_ATTR_H) \
- pass-instances.def params.list
+ pass-instances.def params.list $(srcdir)/../include/gomp-constants.h \
+ $(EXPR_H)
# generate the 'build fragment' b-header-vars
s-header-vars: Makefile
@@ -3598,7 +3607,7 @@ s-header-vars: Makefile
# more portable than a trailing "-e d" to filter out the uninteresting lines,
# in particular on ia64-hpux where "s/.../p" only prints if -n was requested
# as well.
- $(foreach header_var,$(shell sed < Makefile -n -e 's/^\([A-Z0-9_]*_H\)[ ]*=.*/\1/p'),echo $(header_var)=$(shell echo $($(header_var):$(srcdir)/%=.../%) | sed -e 's~\.\.\./config/~config/~' -e 's~\.\.\..*/~~') >> tmp-header-vars;) \
+ $(foreach header_var,$(shell sed < Makefile -n -e 's/^\([A-Z0-9_]*_H\)[ ]*=.*/\1/p'),echo $(header_var)=$(shell echo $($(header_var):$(srcdir)/%=.../%) | sed -e 's~\.\.\./config/~config/~' -e 's~\.\.\./common/config/~common/config/~' -e 's~\.\.\.[^ ]*/~~g') >> tmp-header-vars;)
$(SHELL) $(srcdir)/../move-if-change tmp-header-vars b-header-vars
$(STAMP) s-header-vars
@@ -3611,8 +3620,8 @@ install-gengtype: installdirs gengtype$(exeext) gtype.state
# Install the headers needed to build a plugin.
install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
-# We keep the directory structure for files in config or c-family and .def
-# files. All other files are flattened to a single directory.
+# We keep the directory structure for files in config, common/config or
+# c-family and .def files. All other files are flattened to a single directory.
$(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
@@ -3624,7 +3633,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
else continue; \
fi; \
case $$path in \
- "$(srcdir)"/config/* | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
+ "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
+ | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
*) base=`basename $$path` ;; \
esac; \
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 280b834..4b4e760 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,2672 @@
+2020-10-23 Iain Sandoe <iain@sandoe.co.uk>
+
+ * adaint.c: On Darwin platforms, define st_atim to
+ st_atimespec. Likwise st_mtim to st_mtimespec.
+
+2020-10-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (EXTRA_GNATRTL_NONTASKING_OBJS) [IA64/Linux]: Fix typo.
+
+2020-10-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (EXTRA_GNATRTL_NONTASKING_OBJS) [IA64/Linux]: Fix typo.
+
+2020-10-23 Alexandre Oliva <oliva@adacore.com>
+
+ PR ada/97504
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS): Select wraplf version
+ of Aux_Long_Long_Float for s390 and remaining sparc and
+ powerpc targets.
+
+2020-10-23 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * Makefile.rtl (GNATRTL_SOCKETS_OBJS): New object
+ g-socpol$(objext) New source files noted: g-socpol.adb,
+ g-socpol.ads, g-socpol__dummy.adb, g-socpol__dummy.ads,
+ g-sopowa.adb, g-sopowa__posix.adb, g-sopowa__mingw.adb,
+ g-spogwa.adb, g-spogwa.ads.
+ * impunit.adb (Non_Imp_File_Names_95): New base filename
+ g-socpol in "GNAT Library Units" section for GNAT.Sockets.Poll
+ unit.
+ * libgnat/g-socket.ads, libgnat/g-socket.adb:
+ (Raise_Socket_Error): Moved from body to private part of
+ specification to use in GNAT.Sockets.Poll.
+ * libgnat/g-socpol.ads, libgnat/g-socpol.adb: Main unit of the
+ implementation.
+ * libgnat/g-socpol__dummy.ads, libgnat/g-socpol__dummy.adb:
+ Empty unit for the systems without sockets support.
+ * libgnat/g-spogwa.ads, libgnat/g-spogwa.adb: Generic unit
+ implementing sockets poll on top of select system call.
+ * libgnat/g-sopowa.adb (Wait): Separate implementation for
+ operation systems with poll system call support.
+ * libgnat/g-sopowa__posix.adb (Wait): Separate implementation
+ for POSIX select system call.
+ * libgnat/g-sopowa__mingw.adb (Wait): Separate implementation
+ for Windows select system call.
+ * gsocket.h (_WIN32_WINNT): Increase to 0x0600 for winsock2.h to
+ allow WSAPoll related definitions.
+ * s-oscons-tmplt.c: Fix comment next to #endif for
+ #if defined (__linux__) || defined (__ANDROID__) line. Include
+ <poll.h> for all except VxWorks and Windows.
+ (SIZEOF_nfds_t): New definition.
+ (SIZEOF_fd_type): New definition.
+ (SIZEOF_pollfd_events): New definition.
+ (POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL): New
+ definitions for VxWorks to be able to emulate poll on top of
+ select in it. Define POLLPRI as zero on Windows as it is not
+ supported there.
+ (Poll_Linkname): New definition, because the poll system call
+ has different name in Windows and POSIX.
+
+2020-10-23 Justin Squirek <squirek@adacore.com>
+
+ * checks.adb (Apply_Accessibility_Check): Skip checks against
+ the extra accessibility of a function result when in Ada 2005
+ mode or earlier.
+ * exp_ch3.adb (Build_Initialization_Call): Modify accessibility
+ level calls to use Accessibility_Level.
+ (Expand_N_Object_Declaration): Modify accessibility level calls
+ to use Accessibility_Level.
+ * exp_ch4.adb (Expand_Allocator_Expression): Add static check
+ for anonymous access discriminants. Remove unneeded propagation
+ of accessibility actual.
+ (Expand_N_In): Modify accessibility level calls to use
+ Accessibility_Level.
+ (Expand_N_Type_Conversion): Modify accessibility level calls to
+ use Accessibility_Level.
+ * exp_ch5.adb (Expand_N_Assignment_Statement): Modify
+ accessibility level calls to use Accessibility_Level.
+ * exp_ch6.adb (Expand_Call_Helper): Rewrite accessibility
+ calculation for the extra accessibility of result actual in
+ function calls, and modify accessibility level calls to use
+ Accessibility_Level.
+ (Check_Against_Result_Level): Removed.
+ * exp_ch9.adb (Expand_N_Requeue_Statement): Add dynamic
+ accessibility check for requeues
+ * sem_attr.adb (Resolve_Attribute): Modify accessibility level
+ calls to use Accessibility_Level.
+ * sem_ch13.adb (Associate_Storage_Pool): Modify accessibility
+ level calls to use Accessibility_Level.
+ * sem_ch4.adb (Analyze_Call): Add static check for explicitly
+ aliased formals in function calls within return statements.
+ * sem_ch6.adb (Check_Return_Construct_Accessibility): Rewrite
+ routine to account for non-aggregate return objects.
+ (Generate_Minimum_Accessibility): Created.
+ (Analyze_Call): Modify accessibility level calls to use
+ Accessibility_Level.
+ (Analyze_Subprogram_Body_Helper): Add generation of minimum
+ accessibility for the extra accessibility of the function
+ result.
+ * sem_ch9.adb (Analyze_Requeue): Modify accessibility level
+ calls to use Accessibility_Level.
+ * sem_res.adb: (Check_Aliased_Parameters): Modify accessibility
+ level calls to use Accessibility_Level.
+ (Valid_Conversion): Modify accessibility level calls to use
+ Accessibility_Level.
+ * sem_util.adb, sem_util.ads (Accessibility_Level_Helper):
+ Renamed to Accessibility_Level, add detection for functions in
+ prefix notation, and add cases where to return zero when
+ specified. Modified to take new, more descriptive, parameters.
+ (Accessibility_Level): Created.
+ (Function_Call_Level): Removed.
+ (Function_Call_Or_Allocator_Level): Created to centralize the
+ calculation accessibility levels for function calls and
+ allocators.
+ (Static_Accessibility_Level): Removed.
+ (Dynamic_Accessibility_Level): Removed.
+ (Get_Dynamic_Accessibility): Renamed from Get_Accessibility.
+ (In_Return_Value): Created to determine if a given expression
+ contributes to the current function's return value.
+ (Is_Master): Created.
+ (Is_Explicitly_Aliased): Created
+
+2020-10-23 Bob Duff <duff@adacore.com>
+
+ * doc/gnat_ugn/gnat_utility_programs.rst: Document
+ --no-comments-fill.
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * contracts.adb (Analyze_Entry_Or_Subprogram_Contract,
+ Analyze_Subprogram_Body_Stub_Contract): Fix missing references
+ to Subprogram_Variant where similar references to Contract_Cases
+ are present.
+ * sem_prag.adb (Analyze_Contract_Case, Analyze_Variant): Check
+ that aggregate parameter has no expressions.
+ (Analyze_Pragma): Replace Contract_Cases with Subprogram_Variant
+ in a copy-pasted comment.
+
+2020-10-23 Philippe Gil <gil@adacore.com>
+
+ * libgnat/g-socket.ads: Fix comment typo.
+
+2020-10-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_pragmas.rst (VFA): Remove uage
+ restrictions in conjunction with Atomic and Aliased.
+ * gnat_rm.texi: Regenerate.
+ * aspects.ads (Aspect_Id): Add Aspect_Full_Access_Only.
+ (Is_Representation_Aspect): Likewise.
+ (Aspect_Names): Likewise.
+ (Aspect_Delay): Likewise.
+ * einfo.ads (Is_Atomic_Or_VFA): Rename into...
+ (Is_Full_Access): ...this.
+ (Is_Volatile_Full_Access): Document new usage for Full_Access_Only.
+ * einfo.adb (Is_Atomic_Or_VFA): Rename into...
+ (Is_Full_Access): ...this.
+ * freeze.ads (Is_Atomic_VFA_Aggregate): Rename into...
+ (Is_Full_Access_Aggregate): ...this.
+ * freeze.adb (Is_Atomic_VFA_Aggregate): Rename into...
+ (Is_Full_Access_Aggregate): ...this. Adjust to above renaming.
+ (Freeze_Array_Type): Likewise.
+ (Freeze_Entity): Likewise.
+ * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Likewise.
+ (Expand_Record_Aggregate): Likewise.
+ * exp_ch4.adb (Expand_N_Op_Eq): Likewise.
+ * exp_ch5.adb (Expand_Assign_Array): Likewise.
+ * exp_ch8.adb (Evaluation_Required): Likewise.
+ * layout.adb (Layout_Type): Likewise.
+ (Set_Composite_Alignment): Likewise.
+ * sem_aux.ads (Has_Rep_Item): Delete.
+ * sem_aux.adb (Has_Rep_Item): Likewise.
+ * sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Implement
+ new legality rules in C.6(12).
+ * sem_ch12.adb (Instantiate_Object): Likewise.
+ * sem_res.adb (Resolve_Actuals): Likewise.
+ * sem_ch13.adb (Inherit_Delayed_Rep_Aspects): Deal with aspect
+ Full_Access_Only.
+ (Check_False_Aspect_For_Derived_Type): Likewise.
+ (Make_Pragma_From_Boolean_Aspect): Test for the presence of Expr.
+ Deal with aspect Full_Access_Only.
+ (Analyze_Aspects_At_Freeze_Point): Likewise.
+ (Analyze_One_Aspect): Do not set Delay_Required to true even for
+ Always_Delay boolean aspects if they have no expression. Force
+ Delay_Required to true for aspect Full_Access_Only in all cases.
+ Reject aspect Full_Access_Only if not in Ada 2020 mode.
+ (Check_Aspect_At_End_Of_Declarations): Deal with empty expression.
+ (Check_Aspect_At_Freeze_Point): Likewise.
+ (Rep_Item_Entity): Delete.
+ (Inherit_Aspects_At_Freeze_Point): Align handling for Bit_Order
+ with that for Scalar_Storage_Order.
+ * sem_prag.adb (Check_Atomic_VFA): Delete.
+ (Check_VFA_Conflicts): Likewise.
+ (Check_Full_Access_Only): New procedure.
+ (Process_Atomic_Independent_Shared_Volatile): Call to implement
+ the new legality checks in C.6(8/2) and mark the entity last.
+ (Analyze_Pragma) <Pragma_Atomic_Components>: Remove obsolete check.
+ * sem_util.ads (Is_Atomic_Or_VFA_Object): Rename into...
+ (Is_Full_Access_Object): ...this.
+ (Is_Subcomponent_Of_Atomic_Object): Rename into...
+ (Is_Subcomponent_Of_Full_Access_Object): ...this.
+ * sem_util.adb (Inherit_Rep_Item_Chain): Use Present_In_Rep_Item.
+ (Is_Atomic_Or_VFA_Object): Rename into...
+ (Is_Full_Access_Object): ...this.
+ (Is_Subcomponent_Of_Atomic_Object): Rename into...
+ (Is_Subcomponent_Of_Full_Access_Object): ...this and adjust.
+ * snames.ads-tmpl (Name_Full_Access_Only): New name of aspect.
+ * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for renaming.
+ (promote_object_alignment): Likewise.
+ (gnat_to_gnu_field): Likewise. Rename local variable and use
+ specific qualifier in error message for Volatile_Full_Access.
+ * gcc-interface/trans.c (lvalue_required_p): Likewise.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * lib-writ.ads, lib-writ.adb (Write_ALI): No longer read
+ existing ALI files in -gnatc mode.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * libgnat/g-socthi__mingw.adb (C_Select): Fix logic in code and
+ make it explicit that we are checking against null values before
+ dereferencing them.
+
+2020-10-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_imgv.adb (Expand_Image_Attribute): For an enumeration type
+ subject to pragma Discard_Names, convert 'Pos to Long_Long_Integer
+ before applying 'Img to the result.
+
+2020-10-23 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Type_Refs): Add guard on freezing of the
+ designated type of an access type appearing in the expression,
+ when expression includes an explicit dereference whose prefix
+ includes a function call.
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Handle
+ subtype_indication; do not apply range checks for ranges; add
+ comment saying that others_choices is not allowed.
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK_N_Aggregate,
+ Expand_SPARK_Delta_Or_Update): Expand
+ Iterated_Component_Association occurring within delta
+ aggregates.
+ (Expand_SPARK): Apply SPARK-specific expansion to ordinary
+ aggregates.
+
+2020-10-23 Johannes Kanig <kanig@adacore.com>
+
+ * exp_util.adb, exp_util.ads
+ (Containing_Package_With_Ext_Axioms,
+ Has_Annotate_Pragma_For_External_Axiomatizations): Removed.
+ * sem_ch8.adb (Analyze_Subprogram_Renaming): Removed code
+ related to external axiomatizations.
+ * einfo.ads
+ (Is_Generic_Actual_Subprogram): Removed comment about external
+ axiomatization.
+
+2020-10-23 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Aggregate): Do not call
+ Resolve_Container_Aggregate if compilation version is earlier
+ than Ada_2020.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_pragmas.rst: Improve
+ documentation of pragma Abort_Defer.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-23 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_prag.adb (Etype_Or_Dim3): New function.
+ (Expand_Pragma_Cuda_Execute): Use Etype_Or_Dim3 for temporary
+ decls.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * libgnat/s-fileio.adb (Open): Fix setting of Tempfile.
+
+2020-10-23 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_prag.adb (Get_Launch_Kernel_Arg_Type): Renamed to
+ Get_Nth_Arg_Type and made more generic.
+ (Build_Dim3_Declaration): Now builds a CUDA.Internal.Dim3
+ instead of a CUDA.Vector_Types.Dim3.
+ (Build_Shared_Memory_Declaration): Now infers needed type from
+ Launch_Kernel instead of using a hard-coded type.
+ (Expand_Pragma_CUDA_Execute): Build additional temporaries to
+ store Grids and Blocks.
+ * rtsfind.ads: Move Launch_Kernel from public to internal
+ package.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch4.adb (Complete_Object_Operation): Only mark entities
+ referenced if we are compiling the extended main unit.
+ * sem_attr.adb (Analyze_Attribute [Attribute_Tag]): Record a
+ reference on the type and its scope.
+
+2020-10-23 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Is_Uninitialized_Aggregate): Recognize an array
+ aggregate with box initialization, scalar components, and no
+ component default values.
+ (Freeze_Entity, Check_Address_Clause): Call it, and simplify
+ freeze code for entity by removing useless assignment.
+
+2020-10-23 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Check_Abstract_Overriding): Subprogram renamings
+ cannot be overridden.
+ (Derive_Subprogram): Enable setting attribute
+ Requires_Overriding on functions with controlling access results
+ of record extensions with a null extension part require
+ overriding (AI95-00391/06).
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): Push scope of
+ the implicit loop before entering name of the index parameter,
+ not after; enter name no matter if the identifier has been
+ decorated before.
+
+2020-10-23 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch4.adb (Analyze_Call): In the case where the call is not
+ overloaded, check for a call to an abstract nondispatching
+ operation and flag an error.
+
+2020-10-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat1drv.adb (Adjust_Global_Switches): Rewrite again code enabling
+ or disabling the support for 128-bit integer types.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * alloc.ads, aspects.adb, aspects.ads, atree.adb, atree.ads,
+ casing.adb, casing.ads, csets.adb, csets.ads, debug.adb, debug.ads,
+ einfo.adb, einfo.ads, elists.adb, elists.ads, fname.adb, fname.ads,
+ gnatvsn.adb, gnatvsn.ads, hostparm.ads, indepsw-aix.adb,
+ indepsw-darwin.adb, indepsw-gnu.adb, indepsw.adb, indepsw.ads,
+ krunch.adb, krunch.ads, lib-list.adb, lib-sort.adb, lib.adb, lib.ads,
+ namet-sp.adb, namet-sp.ads, namet.adb, namet.ads, nlists.adb,
+ nlists.ads, opt.adb, opt.ads, output.adb, output.ads, rident.ads,
+ scans.adb, scans.ads, scil_ll.adb, scil_ll.ads, sem_aux.ads,
+ sem_aux.adb, sfn_scan.adb, sinfo.adb, sinfo.ads, sinput.adb,
+ sinput.ads, snames.adb-tmpl, snames.ads-tmpl, stand.ads,
+ stringt.adb, stringt.ads, table.adb, table.ads, types.adb,
+ types.ads, uintp.adb, uintp.ads, uname.adb, uname.ads,
+ urealp.adb, urealp.ads, vast.adb, vast.ads, widechar.adb,
+ widechar.ads: Update header.
+
+2020-10-23 Arnaud Charlet <charlet@adacore.com>
+
+ * libgnat/a-nbnbin.adb (From_String): Take advantage of
+ Long_Long_Long_Integer.
+ * libgnat/s-genbig.ads, libgnat/s-genbig.adb (To_Bignum): New
+ function taking a Long_Long_Long_Integer.
+
+2020-10-23 Justin Squirek <squirek@adacore.com>
+
+ * sem_util.adb (Accessibility_Call_Helper): In the selected
+ component case, test if a prefix is a function call and whether
+ the subprogram call is not being used in its entirety and use
+ the Innermost_Master_Scope_Depth in that case.
+ (Innermost_Master_Scope_Depth): Test against the node_par
+ instead of its identifier to avoid misattributing unnamed blocks
+ as not being from source.
+ (Function_Call_Level): Add calculation for whether a subprogram
+ call is initializing an object in its entirety.
+ (Subprogram_Call_Level): Renamed to Function_Call_Level.
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_prag.adb (Check_External_Properties): Rewrite to match the
+ SPARK RM description.
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * contracts.adb (Check_Type_Or_Object_External_Properties):
+ Cleanup.
+
+2020-10-23 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_prag.adb (Analyze_External_Property_In_Decl_Part): Set the
+ output parameter Expr_Val to the (implicit) pragma argument even
+ when returning early.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (GNATRTL_128BIT_PAIRS): Add i-cexten.ads.
+ * debug.adb (d.H): Document new usage.
+ * doc/gnat_rm/representation_clauses_and_pragmas.rst (Size Clauses):
+ Document new limit on 64-bit platforms.
+ (Component_Size Clauses): Likewise.
+ (Pragma Pack for Arrays): Likewise.
+ (Pragma Pack for Records): Likewise.
+ (Record Representation Clauses): Likewise.
+ * gnat_rm.texi: Regenerate.
+ * gnat1drv.adb (Adjust_Global_Switches): Rewrite code enabling or
+ disabling the support for 128-bit integer types.
+ * switch-c.adb (Scan_Front_End_Switches): Do not deal with e128.
+ * usage.adb (Write_Switch_Char): Do not print -gnate128 switch.
+ * libgnat/i-cexten__128.ads: New file.
+
+2020-10-22 Javier Miranda <miranda@adacore.com>
+
+ * einfo.ads (Has_Limited_View): New synthesized attribute.
+ * einfo.adb (Has_Limited_View): New synthesized attribute.
+ (Set_Limited_View): Complete assertion.
+ * sem_ch10.ads (Is_Visible_Through_Renamings): Make this routine
+ public to invoke it from Find_Expanded_Name and avoid reporting
+ spurious errors on renamings of limited-with packages.
+ (Load_Needed_Body): Moved to have this spec alphabetically
+ ordered.
+ * sem_ch10.adb (Is_Visible_Through_Renamings): Moved to library
+ level.
+ (Is_Limited_Withed_Unit): New subprogram.
+ * sem_ch3.adb (Access_Type_Declaration): Adding protection to
+ avoid reading attribute Entity() when not available.
+ * sem_ch8.adb (Analyze_Package_Renaming): Report error on
+ renamed package not visible through context clauses.
+ (Find_Expanded_Name): Report error on renamed package not
+ visible through context clauses; handle special case where the
+ prefix is a renaming of a (now visible) shadow package.
+
+2020-10-22 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_prag.adb (Get_Launch_Kernel_Arg_Type): New function.
+ (Build_Shared_Memory_Declaration): Use
+ Get_Launch_Kernel_Arg_Type.
+ (Build_Stream_Declaration): Use Get_Launch_Kernel_Arg_Type.
+ * rtsfind.ads: Remove RO_IC_Unsigned_Long_Long.
+
+2020-10-22 Arnaud Charlet <charlet@adacore.com>
+
+ * libgnat/s-imenne.adb, libgnat/s-imgrea.adb: Add assertions.
+
+2020-10-22 Arnaud Charlet <charlet@adacore.com>
+
+ * libgnat/s-imgrea.adb (Set_Image_Real): Update annotations.
+
+2020-10-22 Steve Baird <baird@adacore.com>
+
+ * aspects.ads: Introduce the subtype Nonoverridable_Aspect_Id,
+ whose Static_Predicate reflects the list of nonoverridable
+ aspects given in Ada RM 13.1.1(18.7).
+ * sem_util.ads, sem_util.adb: Add two new visible subprograms,
+ Check_Inherited_Nonoverridable_Aspects and Is_Confirming. The
+ former is used to check the consistency of inherited
+ nonoverridable aspects from multiple sources. The latter
+ indicates whether two aspect specifications for a nonoverridable
+ aspect are confirming. Because of compatibility concerns in
+ compiling QGen, Is_Confirming always returns True if
+ Relaxed_RM_Semantics (i.e., -gnatd.M) is specified.
+ * sem_ch3.adb (Derived_Type_Declaration): Call new
+ Check_Inherited_Nonoverridable_Aspects procedure if interface
+ list is non-empty.
+ * sem_ch9.adb (Check_Interfaces): Call new
+ Check_Inherited_Nonoverridable_Aspects procedure if interface
+ list is non-empty.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): When an explicit
+ aspect specification overrides an inherited nonoverridable
+ aspect, check that the explicit specification is confirming.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.ads (Check_Compile_Time_Size): Adjust size limit.
+
+2020-10-22 Richard Kenner <kenner@adacore.com>
+
+ * sprint.adb (pg, po, ps): Use {Push,Pop}_Output.
+ * treepr.adb (pl, pn): Likewise.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/implementation_advice.rst: Minor fix.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-22 Steve Baird <baird@adacore.com>
+
+ * sem_util.adb (Is_Container_Aggregate): A new local predicates
+ which indicates whether a given expression is a container
+ aggregate. The implementation of this function is incomplete; in
+ the unusual case of a record aggregate (i.e., not a container
+ aggregate) of a type whose Aggregate aspect is specified, the
+ function will incorrectly return True.
+ (Immediate_Context_Implies_Is_Potentially_Unevaluated): Improve
+ handling of aggregate components.
+ (Is_Repeatedly_Evaluated): Test for container aggregate
+ components along with existing test for array aggregate
+ components.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_fixd.adb (Fpt_Value): Fold if-then-else with identical arms.
+
+2020-10-22 Ed Schonberg <schonberg@adacore.com>
+
+ * par-ch4.adb (P_Iterated_Component_Association): If the
+ construct includes an iterator filter it corresponds to an
+ Iterated_Element_Association, so build the proper node for it.
+ * exp_aggr.adb (Expand_Container_Aggregate, Aggregate_Size): If
+ the component is an Iterated_Element_Association, treat it as
+ having a non-static size.
+
+2020-10-22 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * scng.adb (Scan): Check if any letter of the token is
+ uppercase.
+
+2020-10-22 Justin Squirek <squirek@adacore.com>
+
+ * sem_util.adb (Accessibility_Level_Helper): Conversions to
+ named access types get the level associated with the named
+ access type.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * einfo.ads (Has_Constrained_Partial_View): Add "base type" marker.
+
+2020-10-22 Gary Dismukes <dismukes@adacore.com>
+
+ * einfo.adb (Has_Constrained_Partial_View): Apply Base_Type to Id.
+ * sem_res.adb (Resolve_Actuals.Check_Aliased_Parameter): Remove
+ "not Is_Generic_Type" test and call
+ Object_Type_Has_Constrained_Partial_View instead of
+ Has_Constrained_Partial_View. Improve related error message to
+ say "does not statically match" instead of just "does not
+ match".
+
+2020-10-22 Steve Baird <baird@adacore.com>
+
+ * sem_util.ads, sem_util.adb: Declare and implement a new
+ predicate, Derivation_Too_Early_To_Inherit. This function
+ indicates whether a given derived type fails to inherit a given
+ streaming-related attribute from its parent type because the
+ declaration of the derived type precedes the corresponding
+ attribute_definition_clause of the parent.
+ * exp_tss.adb (Find_Inherited_TSS): Call
+ Derivation_Too_Early_To_Inherit instead of unconditionally
+ assuming that a parent type's streaming attribute is available
+ for inheritance by an immediate descendant type.
+ * sem_attr.adb (Stream_Attribute_Available): Call
+ Derivation_Too_Early_To_Inherit instead of unconditionally
+ assuming that a parent type's streaming attribute is available
+ for inheritance by an immediate descendant type.
+ * exp_attr.adb (Default_Streaming_Unavailable): A new predicate;
+ given a type, indicates whether predefined (as opposed to
+ user-defined) streaming operations for the type should be
+ implemented by raising Program_Error.
+ (Expand_N_Attribute_Reference): For each of the 4
+ streaming-related attributes (i.e., Read, Write, Input, Output),
+ after determining that no user-defined implementation is
+ available (including a Stream_Convert pragma), call
+ Default_Streaming_Unavailable; if that call returns True, then
+ implement the streaming operation as "raise Program_Error;".
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * checks.adb (Apply_Float_Conversion_Check): Saturate the bounds
+ of the check to those of the base type of the expression.
+
+2020-10-22 Justin Squirek <squirek@adacore.com>
+
+ * checks.adb (Apply_Accessibility_Check): Modify condition to
+ avoid flawed optimization and use Get_Accessibility over
+ Extra_Accessibility.
+ * exp_attr.adb: Remove inclusion of Exp_Ch2.adb.
+ * exp_ch2.adb, exp_ch2.ads (Param_Entity): Moved to sem_util.
+ * exp_ch3.ads (Init_Proc_Level_Formal): New function.
+ * exp_ch3.adb (Build_Init_Procedure): Add extra accessibility
+ formal for init procs when the associated type is a limited
+ record.
+ (Build_Initialization_Call): Add condition to handle propagation
+ of the new extra accessibility paramter actual needed for init
+ procs.
+ (Init_Proc_Level_Formal): Created to fetch a the extra
+ accessibility parameter associated with init procs if one
+ exists.
+ * exp_ch4.adb (Build_Attribute_Reference): Modify static check
+ to be dynamic.
+ * exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Move logic
+ used to expand conditional expressions used as actuals for
+ anonymous access formals.
+ (Expand_Call_Helper): Remove extranious accessibility
+ calculation logic.
+ * exp_util.adb: Remove inclusion of Exp_Ch2.adb.
+ * par-ch3.adb (P_Array_Type_Definition): Properly set
+ Aliased_Present on access definitions
+ * sem_attr.adb (Resolve_Attribute): Replace instances for
+ Object_Access_Level with Static_Accessibility_Level.
+ * sem_ch13.adb (Storage_Pool): Replace instances for
+ Object_Access_Level with Static_Accessibility_Level.
+ * sem_ch6.adb (Check_Return_Construct_Accessibility): Replace
+ instances for Object_Access_Level with
+ Static_Accessibility_Level.
+ * sem_ch9.adb (Analyze_Requeue): Replace instances for
+ Object_Access_Level with Static_Accessibility_Level.
+ * sem_res.adb (Check_Aliased_Parameter,
+ Check_Allocator_Discrim_Accessibility, Valid_Conversion):
+ Replace instances for Object_Access_Level with
+ Static_Accessibility_Level.
+ * sem_util.adb, sem_util.ads (Accessibility_Level_Helper):
+ Created to centralize calculation of accessibility levels.
+ (Build_Component_Subtype): Replace instances for
+ Object_Access_Level with Static_Accessibility_Level.
+ (Defining_Entity): Add extra parameter to dictate whether an
+ error is raised or empty is return in the case of an irrelevant
+ N.
+ (Dynamic_Accessibility_Level): Rewritten to use
+ Accessibility_Level_Helper.
+ (Is_View_Conversion): Check membership against Etype to capture
+ nodes like explicit dereferences which have types but are not
+ expanded names or identifers.
+ (Object_Access_LeveL): Removed.
+ (Param_Entity): Moved from sem_util.
+ (Static_Accessibility_Level): Created as a replacement to
+ Object_Access_Level, it also uses Accessibility_Level_Helper for
+ its implementation.
+ * snames.ads-tmpl: Added new name for extra accessibility
+ parameter in init procs.
+
+2020-10-22 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Contract_Cases,
+ Expand_Pragma_Loop_Variant): Reuse Append_New_To.
+ * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Fix typo.
+ (Analyze_Pre_Post_Condition): Refactor repeated calls to
+ Defining_Entity.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_characteristics.rst: Minor
+ fixes.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-22 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_warn.adb (Check_Unused_Withs): Move local variables from
+ to a nested procedure; Lunit is passed as a parameter to
+ Check_System_Aux and its type is refined from Node_Id to
+ Entity_Id; Cnode is now a constant.
+
+2020-10-22 Patrick Bernardi <bernardi@adacore.com>
+
+ * libgnat/s-rident.ads (Profile_Info): Use a common profile
+ definition for Jorvik and GNAT Extended Ravenscar, using the
+ GNAT Extended Ravenscar definition.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (64-bit platforms): Add GNATRTL_128BIT_PAIRS to
+ the LIBGNAT_TARGET_PAIRS list and also GNATRTL_128BIT_OBJS to
+ the EXTRA_GNATRTL_NONTASKING_OBJS list.
+
+2020-10-22 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * sem_prag.adb (Process_Convention,
+ Process_Import_Or_Interface): Fix error message.
+
+2020-10-22 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * sem_ch13.adb (Make_Aitem_Pragma): Turn into function. This
+ removes a side-effect on the Aitem variable.
+ (Analyze_Aspect_Specifications): Handle Suppress and Unsuppress
+ aspects differently from the Linker_Section aspect.
+ (Ceck_Aspect_At_Freeze_Point): Don't expect Suppress/Unsuppress
+ to be delayed anymore.
+
+2020-10-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb: (Resolve_Container_Aggregate): For an indexed
+ container, verify that expressions and component associations
+ are not both present.
+ * exp_aggr.adb: Code reorganization, additional comments.
+ (Expand_Container_Aggregate): Use Aggregate_Size for Iterated_
+ Component_Associations for indexed aggregates. If present, the
+ default value of the formal in the constructor function is used
+ when the size of the aggregate cannot be determined statically.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_attr.adb (Eval_Attribute): Fix oversight for Bit_Position.
+
+2020-10-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.ads, sem_util.adb (Check_Ambiguous_Aggregate): When a
+ subprogram call is found to be ambiguous, check whether
+ ambiguity is caused by an aggregate actual. and indicate that
+ it should carry a type qualification.
+ * sem_ch4.adb (Traverse_Hoonyms, Try_Primitive_Operation): Call
+ it.
+ * sem_res.adb (Report_Ambiguous_Argument): Call it.
+
+2020-10-22 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_warn.adb (Check_One_Unit): Avoid repeated calls by using a
+ local variable Lunit; remove local constant Eitem, which was
+ identical to Lunit.
+
+2020-10-22 Alexandre Oliva <oliva@adacore.com>
+
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS) <x86*-vxworks*>: Select
+ nolibm and wraplf variants like other vxworks ports.
+
+2020-10-22 Martin Liska <mliska@suse.cz>
+
+ PR c/94722
+ * gcc-interface/utils.c (handle_no_stack_protect_attribute):
+ New.
+ (handle_stack_protect_attribute): Add error message for a
+ no_stack_protector function.
+
+2020-10-22 Alexandre Oliva <oliva@adacore.com>
+
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS) <lynxos178>: Rely on
+ Aux_Long_Float for all real types.
+
+2020-10-22 Alexandre Oliva <oliva@adacore.com>
+
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS): Use Long Float-based
+ variant of Aux_Short_Float and Aux_Float on vxworks targets.
+ * libgnat/a-nashfl__wraplf.ads: New.
+ * libgnat/a-nuaufl__wraplf.ads: New.
+
+2020-10-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS) <sparc*-sun-solaris>:
+ Use wraplf version of a-nallfl.
+
+2020-10-22 Alexandre Oliva <oliva@adacore.com>
+
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS): Use
+ a-nallfl__wraplf.ads on aarch64-* and ppc*-linux-gnu targets.
+ * libgnat/a-nallfl__wraplf.ads: New.
+
+2020-10-22 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc-interface/trans.c: Include tree-nested.h
+ (walk_nesting_tree): Update for new nested function info.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add a-llltio, a-lllwti,
+ a-lllzti and remove a-timoau, a-wtmoau and a-ztmoau.
+ (GNATRTL_128BIT_PAIRS): Add a-tiinio.adb, a-timoio.adb, a-wtinio.adb,
+ a-wtmoio.adb, a-ztinio.adb and a-ztmoio.adb.
+ * impunit.adb (Non_Imp_File_Names_95): Add a-llltio, a-lllwti and
+ a-lllzti.
+ * krunch.ads: Document trick for Ada.Long_Long_Long_Integer_*_IO.
+ * krunch.adb (Krunch): Add trick for Ada.Long_Long_Long_Integer_*_IO.
+ * libgnat/a-llltio.ads: Instantiate Ada.Text_IO.Integer_IO.
+ * libgnat/a-lllwti.ads: Instantiate Ada.Wide_Text_IO.Integer_IO.
+ * libgnat/a-lllzti.ads: Instantiate Ada.Wide_Wide_Text_IO.Integer_IO.
+ * libgnat/a-tigeau.ads (Load_Integer): New procedure.
+ * libgnat/a-tigeau.adb (Load_Integer): Likewise.
+ * libgnat/a-tiinau.ads, libgnat/a-tiinau.adb: Change to generic
+ package.
+ * libgnat/a-tiinio.adb: Instantiate it.
+ * libgnat/a-tiinio__128.adb: Likewise.
+ * libgnat/a-timoau.ads, libgnat/a-timoau.adb: Change to generic
+ package.
+ * libgnat/a-timoio.adb: Instantiate it.
+ * libgnat/a-timoio__128.adb: Likewise.
+ * libgnat/a-wtgeau.ads (Load_Integer): New procedure.
+ * libgnat/a-wtgeau.adb (Load_Integer): Likewise.
+ * libgnat/a-wtinau.ads, libgnat/a-wtinau.adb: Change to generic
+ package.
+ * libgnat/a-wtinio.adb: Instantiate it.
+ * libgnat/a-wtinio__128.adb: Likewise.
+ * libgnat/a-wtmoau.ads, libgnat/a-wtmoau.adb: Change to generic
+ package.
+ * libgnat/a-wtmoio.adb: Instantiate it.
+ * libgnat/a-wtmoio__128.adb: Likewise.
+ * libgnat/a-ztgeau.ads (Load_Integer): New procedure.
+ * libgnat/a-ztgeau.adb (Load_Integer): Likewise.
+ * libgnat/a-ztinau.ads, libgnat/a-ztinau.adb: Change to generic
+ package.
+ * libgnat/a-ztinio.adb: Instantiate it.
+ * libgnat/a-ztinio__128.adb: Likewise.
+ * libgnat/a-ztmoau.ads, libgnat/a-ztmoau.adb: Change to generic
+ package.
+ * libgnat/a-ztmoio.adb: Instantiate it.
+ * libgnat/a-ztmoio__128.adb: Likewise.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_ch12.adb (Freeze_Subprogram_Body): Do not move the freeze
+ node of the package body enclosing the instance when its parent
+ is in the same declarative part as the freeze node of the parent.
+
+2020-10-21 Steve Baird <baird@adacore.com>
+
+ * exp_ch6.adb (Insert_Post_Call_Actions): When a function's
+ result type requires finalization and we decide to make copy of
+ a call to the function and subsequently refer only to the copy,
+ then don't forget to finalize the original function result
+ object.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-widint,
+ s-widthi, s-widuns, s-widuns.
+ (GNATRTL_128BIT_OBJS): Add s-imglllb, s-imgllli, s-imglllu, s-imglllw,
+ s-valllli, s-vallllu, s-widllli, s-widlllu.
+ * exp_imgv.adb (Expand_Image_Attribute): Deal with 128-bit types.
+ (Expand_Value_Attribute): Likewise.
+ (Expand_Width_Attribute): Likewise.
+ * exp_put_image.adb (Build_Elementary_Put_Image_Call): Likewise.
+ * krunch.adb (Krunch): Deal with s-img, s-val and s-wid prefixes.
+ * rtsfind.ads (RTU_Id): Add System_Img_LLLI, System_Img_LLLU,
+ System_Val_LLLI, System_Val_LLL, System_Wid_Int, System_Wid_LLLI,
+ System_Wid_LLLU, System_Wid_Uns).
+ (RE_Id): Add RE_Image_Long_Long_Long_Integer,
+ RE_Image_Long_Long_Long_Unsigned,
+ RE_Put_Image_Long_Long_Long_Integer,
+ RE_Put_Image_Long_Long_Long_Unsigned,
+ RE_Long_Long_Long_Unsigned, RE_Value_Long_Long_Long_Integer,
+ RE_Value_Long_Long_Long_Unsigned, RE_Width_Integer,
+ RE_Width_Long_Long_Long_Integer, RE_Width_Long_Long_Long_Unsigned,
+ RE_Width_Unsigned, RE_Image_Long_Long_Long_Integer,
+ RE_Image_Long_Long_Long_Unsigned, RE_Put_Image_Long_Long_Long_Integer,
+ RE_Put_Image_Long_Long_Long_Unsigned, RE_Long_Long_Long_Unsigned,
+ RE_Value_Long_Long_Long_Integer, RE_Value_Long_Long_Long_Unsigned,
+ RE_Width_Integer, RE_Width_Long_Long_Long_Integer,
+ RE_Width_Long_Long_Long_Unsigned, RE_Width_Unsigned.
+ * libgnat/s-imageb.ads, libgnat/s-imageb.adb: New generic
+ package.
+ * libgnat/s-imagei.ads, libgnat/s-imagei.adb: Likewise.
+ * libgnat/s-imageu.ads, libgnat/s-imageu.adb: Likewise.
+ * libgnat/s-imagew.ads, libgnat/s-imagew.adb: Likewise.
+ * libgnat/s-imgbiu.ads: Instantiate System.Image_B.
+ * libgnat/s-imgbiu.adb: Add pragma No_Body.
+ * libgnat/s-imgint.ads: Instantiate System.Image_I.
+ * libgnat/s-imgint.adb: Add pragma No_Body.
+ * libgnat/s-imgllb.ads: Instantiate System.Image_B.
+ * libgnat/s-imgllb.adb: Add pragma No_Body0
+ * libgnat/s-imglli.ads: Instantiate System.Image_I.
+ * libgnat/s-imglli.adb: Add pragma No_Body.
+ * libgnat/s-imglllb.ads: Instantiate System.Image_B.
+ * libgnat/s-imgllli.ads: Instantiate System.Image_I.
+ * libgnat/s-imglllu.ads: Instantiate System.Image_U.
+ * libgnat/s-imglllw.ads: Instantiate System.Image_W.
+ * libgnat/s-imgllu.ads: Instantiate System.Image_U.
+ * libgnat/s-imgllu.adb: Add pragma No_Body.
+ * libgnat/s-imgllw.ads: Instantiate System.Image_W.
+ * libgnat/s-imgllw.adb: Add pragma No_Body.
+ * libgnat/s-imgrea.adb: Remove clauses for System.Unsigned_Types.
+ * libgnat/s-imguns.ads: Instantiate System.Image_U.
+ * libgnat/s-imguns.adb: Add pragma No_Body.
+ * libgnat/s-imgwiu.ads: Instantiate System.Image_W.
+ * libgnat/s-imgwiu.adb: Add pragma No_Body.
+ * libgnat/s-putima.ads (Long_Long_Long_Unsigned): New subtype.
+ (Put_Image_Long_Long_Long_Unsigned): New procedure.
+ * libgnat/s-putima.adb (Small): Rename to Integer_Images.
+ (Large): Rename to LL_Integer_Images.
+ (LLL_Integer_Images): New instantiation.
+ (Put_Image_Long_Long_Long_Integer): New renaming.
+ (Put_Image_Long_Long_Long_Unsigned): Likewise.
+ * libgnat/s-valint.ads: Instantiate System.Value_I.
+ * libgnat/s-valint.adb: Add pragma No_Body.
+ * libgnat/s-vallli.ads: Instantiate System.Value_I.
+ * libgnat/s-vallli.adb: Add pragma No_Body.
+ * libgnat/s-valllli.ads: Instantiate System.Value_I.
+ * libgnat/s-vallllu.ads: Instantiate System.Value_U.
+ * libgnat/s-valllu.ads: Instantiate System.Value_U.
+ * libgnat/s-valllu.adb: Add pragma No_Body.
+ * libgnat/s-valuei.ads, libgnat/s-valuei.adb: New generic
+ package.
+ * libgnat/s-valueu.ads, libgnat/s-valueu.adb: Likewise.
+ * libgnat/s-valuns.ads: Instantiate System.Value_U.
+ * libgnat/s-valuns.adb: Add pragma No_Body.
+ * libgnat/s-widint.ads: Instantiate System.Width_I.
+ * libgnat/s-widlli.ads: Likewise.
+ * libgnat/s-widlli.adb: Add pragma No_Body.
+ * libgnat/s-widllli.ads: Instantiate System.Width_I.
+ * libgnat/s-widlllu.ads: Instantiate System.Width_U.
+ * libgnat/s-widllu.ads: Likewise.
+ * libgnat/s-widllu.adb: Add pragma No_Body.
+ * libgnat/s-widthi.ads, libgnat/s-widthi.adb: New generic
+ package.
+ * libgnat/s-widthu.ads, libgnat/s-widthu.adb: Likewise.
+ * libgnat/s-widuns.ads: Instantiate System.Width_U.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * set_targ.adb (DTN): Fix oversight.
+ (Read_Target_Dependent_Values): Do not error out on missing
+ Long_Long_Long_Size entry and reuse Long_Long_Size for it.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_aggr.adb (Gen_Loop): Analyze copy of the expression in the
+ scope of the implicit loop with name of the index parameter
+ visible.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (GNATRTL_128BIT_PAIRS): New variable.
+ (GNATRTL_128BIT_OBJS): Likewise.
+ (Windows): In 64-bit mode, add the former to LIBGNAT_TARGET_PAIRS and
+ the latter to EXTRA_GNATRTL_NONTASKING_OBJS.
+ (x86_64/linux): Likewise, but unconditionally.
+ (GNATRTL_NONTASKING_OBJS): Add s-aridou, s-exponn, s-expont,
+ s-exponu.
+ * ada_get_targ.adb (Get_Long_Long_Long_Size): New function.
+ * checks.adb (Apply_Arithmetic_Overflow_Strict): Use Integer_Type_For
+ to find an appropriate integer type; if it does not exist and the max
+ integer size is larger than 64, use the 128-bit arithmetic routines.
+ * cstand.adb (Create_Standard): Build Standard_Long_Long_Long_Integer
+ and its base type. Use it for Etype of Any_Integer, Any_Modular and
+ Any_Numeric. Use its size for Build Standard_Long_Long_Long_Unsigned
+ and Universal_Integer.
+ (Print_Standard): Print Long_Long_Long_Integer.
+ * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Mod>: Adjust
+ comment.
+ * exp_ch3.adb (Simple_Init_Initialize_Scalars_Type): Deal with 128-bit
+ types.
+ * exp_ch4.adb (Expand_Array_Comparison): Likewise.
+ (Expand_N_Op_Expon): Likewise.
+ (Narrow_Large_Operation): Likewise.
+ * exp_dbug.adb (Bounds_Match_Size): Handle 128-bit size.
+ * exp_fixd.adb (Build_Double_Divide_Code): Use RE_Double_Divide64.
+ * exp_intr.adb (Expand_Binary_Operator_Call): Handle 128-bit size.
+ * exp_pakd.ads (E_Array): Extend range to 127.
+ (Bits_Id): Fill in up to 127.
+ (Get_Id): Likewise.
+ (GetU_Id): Likewise.
+ (Set_Id): Likewise.
+ (SetU_Id): Likewise.
+ * exp_pakd.adb (Revert_Storage_Order): Handle 128-bit size.
+ * exp_util.adb (Integer_Type_For): Likewise.
+ (Small_Integer_Type_For): Likewise.
+ * fname.adb (Is_Predefined_File_Name): Do not return False for names
+ larger than 12 characters if they start with "s-".
+ * freeze.adb (Adjust_Esize_For_Alignment): Change the maximum value
+ to System_Max_Integer_Size.
+ (Check_Suspicious_Modulus): Adjust comment.
+ (Freeze_Entity): Likewise.
+ * get_targ.ads (Get_Long_Long_Long_Size): New function.
+ * get_targ.adb (Get_Long_Long_Long_Size): Likewise.
+ (Width_From_Size): Deal with 128-bit size.
+ * gnat1drv.adb (Adjust_Global_Switches): Deal with 128-bit types.
+ * impunit.adb (Get_Kind_Of_File): Bump buffer size. Accept files with
+ 13 characters if they start with 's'. Compare slice of Buffer.
+ (Not_Impl_Defined_Unit): Accept files with 13 characters if they start
+ with 's'.
+ * krunch.ads: Document length for 128-bit support units.
+ * krunch.adb (Krunch): Set length to 9 for 128-bit support units.
+ * layout.adb (Layout_Type): Use System_Max_Integer_Size as alignment
+ limit.
+ * rtsfind.ads (RTU_Id): Add System_Arith_128,
+ System_Compare_Array_Signed_128, System_Compare_Array_Unsigned_128,
+ System_Exn_LLLI, System_Exp_LLLU, System_Pack_[65..127].
+ (RE_Id): Add RE_Integer_128, RE_Unsigned_128, RE_Add_With_Ovflo_Check128
+ RE_Multiply_With_Ovflo_Check128, RE_Subtract_With_Ovflo_Check128,
+ RE_Bswap_128, RE_Compare_Array_S128, RE_Compare_Array_U128,
+ RE_Exn_Long_Long_Long_Integer, RE_Exp_Long_Long_Long_Integer,
+ RE_Exp_Long_Long_Long_Unsigned, RE_Bits_[65-127], RE_Get_[65-127],
+ RE_Set_[65-127], RE_IS_Is16, RE_IS_Iu16, RE_Integer_128 and
+ RE_Unsigned_128. Rename RE_Add_With_Ovflo_Check, RE_Double_Divide,
+ RE_Multiply_With_Ovflo_Check, RE_Scaled_Divide and
+ RE_Subtract_With_Ovflo_Check. Remove RE_IS_Iz1, RE_IS_Iz2, RE_IS_Iz4,
+ RE_IS_Iz8, RE_Long_Unsigned, RE_Short_Unsigned, RE_Short_Short_Unsigned
+ (RE_Unit_Table): Likewise.
+ * sem_aux.adb (Corresponding_Unsigned_Type): Deal with a size equal to
+ that of Standard_Long_Long_Long_Integer.
+ (First_Subtype): Deal with Standard_Long_Long_Long_Integer'Base.
+ * sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Attribute_Size>:
+ Check the size against powers of 2 and System_Max_Integer_Size for
+ objects as well.
+ (Set_Enum_Esize): Deal with 128-bit bounds.
+ * sem_ch3.adb (Set_Modular_Size): Handle 128-bit size.
+ (Modular_Type_Declaration): Deal with 128-bit types.
+ (Signed_Integer_Type_Declaration): Support derivation from
+ Standard_Long_Long_Long_Integer.
+ * sem_ch4.adb (Analyze_Mod): Handle 128-bit modulus.
+ * sem_intr.adb: Add with and use clauses for Ttypes.
+ (Check_Shift): Handle 128-bit size and modulus.
+ * sem_prag.adb (Analyze_Pragma) <Pragma_Initialize_Scalars>: Deal
+ with Signed_128 and Unsigned_128.
+ (Analyze_Integer_Value): Handle 128-bit size.
+ * sem_util.ads (Addressable): Adjust description.
+ * sem_util.adb (Addressable): Return true for 128 if the system
+ supports 128 bits.
+ (Set_Invalid_Binder_Values): Deal with Signed_128 and Unsigned_128.
+ * set_targ.ads (Long_Long_Long_Size): New variable.
+ * set_targ.adb (S_Long_Long_Long_Size): New constant.
+ (DTN): Add entry for S_Long_Long_Long_Size.
+ (DTV): Add entry for Long_Long_Long_Size.
+ (Set_Targ): Set Long_Long_Long_Size.
+ * snames.ads-tmpl (Name_Max_Integer_Size): New attribute name.
+ (Name_Signed_128): New scalar name.
+ (Name_Unsigned_128): Likewise.
+ (Scalar_Id): Adjust.
+ (Integer_Scalar_Id): Likewise.
+ (Attribute_Id): Add Attribute_Max_Integer_Size.
+ * stand.ads (Standard_Entity_Type): Add S_Long_Long_Long_Integer.
+ (Standard_Long_Long_Long_Integer): New renaming.
+ (Universal_Integer): Adjust description.
+ (Standard_Long_Long_Long_Unsigned): New variable.
+ * switch-c.adb (Scan_Front_End_Switches): Deal with -gnate128.
+ * ttypes.ads (Standard_Long_Long_Long_Integer_Size): New variable.
+ (Standard_Long_Long_Long_Integer_Width): Likewise.
+ (System_Max_Integer_Size): Turn into variable.
+ (System_Max_Binary_Modulus_Power): Likewise.
+ * uintp.ads (Uint_127): New constant.
+ * uintp.adb (UI_Power_2): Extednd to 128.
+ (UI_Power_10): Likewise.
+ (UI_Expon): Deal with exponent up to 128 specially.
+ * usage.adb (Write_Switch_Char): Print -gnate128 switch.
+ * libgnat/a-tifiio.adb (Put_Scaled): Call Scaled_Divide64.
+ * libgnat/interfac__2020.ads (Integer_128): New integer type.
+ (Unsigned_128): New modular type.
+ (Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left,
+ Rotate_Right): New intrinsic functions operating on it.
+ * libgnat/s-aridou.ads, libgnat/s-aridou.adb: New generic
+ package.
+ * libgnat/s-arit64.ads, libgnat/s-arit64.adb: Instantiate
+ System.Arithmetic_Double.
+ * libgnat/s-arit128.ads, libgnat/s-arit128.adb: Likewise.
+ * libgnat/s-bytswa.ads: Add with clause for Interfaces, use subtypes
+ of unsigned types defined in Interfaces and add Bswap_128.
+ * libgnat/s-casi128.ads, libgnat/s-casi128.adb: New package.
+ * libgnat/s-caun128.ads, libgnat/s-caun128.adb: Likewise.
+ * libgnat/s-exnint.ads: Instantiate System.Exponn.
+ * libgnat/s-exnint.adb: Add pragma No_Body.
+ * libgnat/s-exnlli.ads: Instantiate System.Exponn.
+ * libgnat/s-exnlli.adb: Add pragma No_Body.
+ * libgnat/s-exnllli.ads: Instantiate System.Exponn.
+ * libgnat/s-expint.ads: Likewise.
+ * libgnat/s-expint.adb: Add pragma No_Body.
+ * libgnat/s-explli.ads: Instantiate System.Exponn.
+ * libgnat/s-explli.adb: Add pragma No_Body.
+ * libgnat/s-expllli.ads: Instantiate System.Exponn.
+ * libgnat/s-explllu.ads: Instantiate System.Exponu.
+ * libgnat/s-expllu.ads: Likewise.
+ * libgnat/s-expllu.adb: Add pragma No_Body.
+ * libgnat/s-exponn.ads, libgnat/s-exponn.adb: New generic
+ function.
+ * libgnat/s-expont.ads, libgnat/s-expont.adb: Likewise.
+ * libgnat/s-exponu.ads, libgnat/s-exponu.adb: Likewise.
+ * libgnat/s-expuns.ads, libgnat/s-expuns.adb: Likewise.
+ * libgnat/s-pack65.ads, libgnat/s-pack65.adb: New package.
+ * libgnat/s-pack66.ads, libgnat/s-pack66.adb: New package.
+ * libgnat/s-pack67.ads, libgnat/s-pack67.adb: New package.
+ * libgnat/s-pack68.ads, libgnat/s-pack68.adb: New package.
+ * libgnat/s-pack69.ads, libgnat/s-pack69.adb: New package.
+ * libgnat/s-pack70.ads, libgnat/s-pack70.adb: New package.
+ * libgnat/s-pack71.ads, libgnat/s-pack71.adb: New package.
+ * libgnat/s-pack72.ads, libgnat/s-pack72.adb: New package.
+ * libgnat/s-pack73.ads, libgnat/s-pack73.adb: New package.
+ * libgnat/s-pack74.ads, libgnat/s-pack74.adb: New package.
+ * libgnat/s-pack75.ads, libgnat/s-pack75.adb: New package.
+ * libgnat/s-pack76.ads, libgnat/s-pack76.adb: New package.
+ * libgnat/s-pack77.ads, libgnat/s-pack77.adb: New package.
+ * libgnat/s-pack78.ads, libgnat/s-pack78.adb: New package.
+ * libgnat/s-pack79.ads, libgnat/s-pack79.adb: New package.
+ * libgnat/s-pack80.ads, libgnat/s-pack80.adb: New package.
+ * libgnat/s-pack81.ads, libgnat/s-pack81.adb: New package.
+ * libgnat/s-pack82.ads, libgnat/s-pack82.adb: New package.
+ * libgnat/s-pack83.ads, libgnat/s-pack83.adb: New package.
+ * libgnat/s-pack84.ads, libgnat/s-pack84.adb: New package.
+ * libgnat/s-pack85.ads, libgnat/s-pack85.adb: New package.
+ * libgnat/s-pack86.ads, libgnat/s-pack86.adb: New package.
+ * libgnat/s-pack87.ads, libgnat/s-pack87.adb: New package.
+ * libgnat/s-pack88.ads, libgnat/s-pack88.adb: New package.
+ * libgnat/s-pack89.ads, libgnat/s-pack89.adb: New package.
+ * libgnat/s-pack90.ads, libgnat/s-pack90.adb: New package.
+ * libgnat/s-pack91.ads, libgnat/s-pack91.adb: New package.
+ * libgnat/s-pack92.ads, libgnat/s-pack92.adb: New package.
+ * libgnat/s-pack93.ads, libgnat/s-pack93.adb: New package.
+ * libgnat/s-pack94.ads, libgnat/s-pack94.adb: New package.
+ * libgnat/s-pack95.ads, libgnat/s-pack95.adb: New package.
+ * libgnat/s-pack96.ads, libgnat/s-pack96.adb: New package.
+ * libgnat/s-pack97.ads, libgnat/s-pack97.adb: New package.
+ * libgnat/s-pack98.ads, libgnat/s-pack98.adb: New package.
+ * libgnat/s-pack99.ads, libgnat/s-pack99.adb: New package.
+ * libgnat/s-pack100.ads, libgnat/s-pack100.adb: New package.
+ * libgnat/s-pack101.ads, libgnat/s-pack101.adb: New package.
+ * libgnat/s-pack102.ads, libgnat/s-pack102.adb: New package.
+ * libgnat/s-pack103.ads, libgnat/s-pack103.adb: New package.
+ * libgnat/s-pack104.ads, libgnat/s-pack104.adb: New package.
+ * libgnat/s-pack105.ads, libgnat/s-pack105.adb: New package.
+ * libgnat/s-pack106.ads, libgnat/s-pack106.adb: New package.
+ * libgnat/s-pack107.ads, libgnat/s-pack107.adb: New package.
+ * libgnat/s-pack108.ads, libgnat/s-pack108.adb: New package.
+ * libgnat/s-pack109.ads, libgnat/s-pack109.adb: New package.
+ * libgnat/s-pack110.ads, libgnat/s-pack110.adb: New package.
+ * libgnat/s-pack111.ads, libgnat/s-pack111.adb: New package.
+ * libgnat/s-pack112.ads, libgnat/s-pack112.adb: New package.
+ * libgnat/s-pack113.ads, libgnat/s-pack113.adb: New package.
+ * libgnat/s-pack114.ads, libgnat/s-pack114.adb: New package.
+ * libgnat/s-pack115.ads, libgnat/s-pack115.adb: New package.
+ * libgnat/s-pack116.ads, libgnat/s-pack116.adb: New package.
+ * libgnat/s-pack117.ads, libgnat/s-pack117.adb: New package.
+ * libgnat/s-pack118.ads, libgnat/s-pack118.adb: New package.
+ * libgnat/s-pack119.ads, libgnat/s-pack119.adb: New package.
+ * libgnat/s-pack120.ads, libgnat/s-pack120.adb: New package.
+ * libgnat/s-pack121.ads, libgnat/s-pack121.adb: New package.
+ * libgnat/s-pack122.ads, libgnat/s-pack122.adb: New package.
+ * libgnat/s-pack123.ads, libgnat/s-pack123.adb: New package.
+ * libgnat/s-pack124.ads, libgnat/s-pack124.adb: New package.
+ * libgnat/s-pack125.ads, libgnat/s-pack125.adb: New package.
+ * libgnat/s-pack126.ads, libgnat/s-pack126.adb: New package.
+ * libgnat/s-pack127.ads, libgnat/s-pack127.adb: New package.
+ * libgnat/s-rannum.ads (Random): New function returning 128-bit.
+ * libgnat/s-rannum.adb (Random): Implement it.
+ * libgnat/s-scaval.ads: Add with clause for Interfaces, use subtypes
+ of unsigned types defined in Interfaces.
+ * libgnat/s-scaval.adb: Add use clause for Interfaces.
+ * libgnat/s-scaval__128.ads, libgnat/s-scaval__128.adb: New
+ package.
+ * libgnat/s-unstyp.ads (Long_Long_Long_Unsigned): New modular type.
+ (Shift_Left, Shift_Right, Shift_Right_Arithmetic, Rotate_Left,
+ Rotate_Right): New intrinsic functions operating on it.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_characteristics.rst: Add
+ Long_Long_Long_Integer to the list of predefined integer types.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-21 Yannick Moy <moy@adacore.com>
+
+ * ada_get_targ.adb (Width_From_Size): Add case for 128 bits.
+ Reorder declarations in the same order as get_targ.adb to
+ facilitate diffs.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_aggr.adb (Expand_N_Aggregate): Refactor repeated calls to
+ Etype (N).
+ (Build_Array_Aggr_Code): Fix whitespace.
+
+2020-10-21 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * adaint.c (__gnat_file_time): Use regular arithmetic instead of
+ __builtin_*_overflow routines if GCC version 4 or less and
+ compiler is g++.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_aggr.adb (Resolve_Array_Aggregate): Use Choice_List, which
+ internally calls either Choice or Discrete_Choices, depending on
+ the context.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_aggr.adb (Resolve_Iterated_Component_Association): Use
+ existing defining identifier for index parameter.
+
+2020-10-21 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch9.adb (Build_Task_Activation_Call): Do not generate a
+ call to activate tasks if we are within the scope of a protected
+ type and pragma Detect_Blocking is active.
+
+2020-10-21 Liaiss Merzougue <merzougue@adacore.com>
+
+ * libgnat/s-carsi8.adb (Compare_Array_S8): Add pragma Assert to
+ avoid warning concerning Left_Len and RighLen value regarding
+ Bytes_Compared_As_Words.
+ * libgnat/s-carun8.adb (Compare_Array_U8): Likewise.
+ * libgnat/s-geveop.adb (Binary_Operation, Unary_Operation): Add
+ pragma Assert concerning divide by 0 warning.
+ * libgnat/s-imgcha.adb (Image_Character): Code update to prevent
+ constant operation warning.
+ (Image_Character): Add pragma Assert concerning the unchecked
+ String size.
+ * libgnat/s-imgdec.adb
+ (Round): Upate loop code to prevent warning concerning
+ Digs'First access.
+ (Round): Add pragma assert.
+ (Set): Add pragma Assert for the unchecked string size.
+ (Set_Digits): Add pragma Assert for the input range.
+ (Set_Decimal_Digits): Add pragma Assert.
+ (Set_Blank_And_Sign): Add pragma Assert for the input range.
+ * libgnat/s-arit64.adb (DoubleDivide): Add pragma Assert
+ concerning Du /= 0.
+ (Multiply_With_Ovflo_Check): Add pragma Annotate to avoid
+ warning concerning unsigned -> signed conversion.
+ * libgnat/s-imguns.adb (Set_Image_Unsigned): Add pragma Assert
+ to prevent overflow check warning. Add pragma Assert for
+ controlling S'First = 1.
+ * libgnat/s-imgrea.adb (Image_Floating_Point, Set, Set_Digs,
+ Set_Special_Fill, Convert_Integer): Add pragma Annotate to
+ prevent overflow check warning.
+ (Set_Image_Real): Add pragma Annotate to avoid dead code warning
+ on float check. Add pragma Assert to prevent overflow check
+ warning.
+ * libgnat/s-imgwiu.adb (Set_Digits, Set_Image_Width_Unsigned):
+ Add pragma assert to prevent overflow check warning.
+ * libgnat/s-imgllu.adb (Set_Image_Long_Long_Unsigned): Add
+ pragma assert to prevent overflow check warning.
+ * libgnat/s-imgint.adb (Set_Digits): Add Assert for input
+ constraint and to prevent overflow check warning, create
+ Non_Positive subtype, and change the T parameter as Non_Positive
+ instead Integer.
+ (Set_Image_Integer): Add pragma assert to prevent overflow check
+ warning.
+ * libgnat/s-imglli.adb (Set_Digits): Add Assert for input
+ constraint and to prevent overflow check warning, create
+ Non_Positive subtype, and change the T parameter as Non_Positive
+ instead Integer.
+ (Set_Image_Long_Long_Integer): Add pragma assert to prevent
+ overflow check warning.
+ * libgnat/s-fatgen.adb (Decompose, Pred, Succ): Add pragma
+ Annotate to prevent dead code due to invalid float check.
+ * libgnat/s-imenne.adb (Image_Enumeration_8,
+ Image_Enumeration_16, Image_Enumeration_32): Add pragma Assert
+ to prevent overflow check warning. Add Names_Index subtype for
+ restricting Index_table content.
+
+2020-10-21 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch6.adb (Insert_Post_Call_Actions): Test for
+ N_Explicit_Dereference as part of the existing test for function
+ calls.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.adb (Check_Strict_Alignment): Do not set the flag for
+ a bit-packed array type, even if it is a by-reference type.
+
+2020-10-21 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * adaint.c (__gnat_file_time): New routine.
+ (__gnat_copy_attribs): Copy timestamps in nanoseconds.
+ * libgnat/a-direct.adb (C_Modification_Time): Bind to
+ __gnat_file_time.
+ (Modification_Time): Call to C_Modification_Time.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_aggr.adb (Resolve_Iterated_Component_Association):
+ Expression's copy and now has the same parent as the original
+ expression.
+ (Resolve_Array_Aggregate): Add ??? comment about a still
+ existing minor issue that led to discovery of the above crash.
+
+2020-10-21 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch12.adb (Install_Parents_Of_Generic_Context): Simplify
+ functionality; collect and install parents of generic child
+ package.
+ (Remove_Parents_Of_Generic_Context): Code cleanup.
+ (Instantiate_Package_Body): Hide parents of generic context from
+ visibility before installing the parent instance; restore their
+ visibility when the instance is analyzed
+
+2020-10-21 Doug Rupp <rupp@adacore.com>
+
+ * libgnarl/s-osinte__lynxos178e.ads: Remove -mthreads switch.
+
+2020-10-21 Patrick Bernardi <bernardi@adacore.com>
+
+ * env.c (__gnat_setenv): call setenv for VxWorks 7 kernel mode.
+ (__gnat_environ): envGet takes an int instead of a NULL pointer.
+ (__gnat_unsetenv): call unsetenv for VxWorks 7 kernel mode.
+ (__gnat_clearenv): use __gnat_unsetenv to clear environment
+ variables.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * sem_ch12.adb (Freeze_Subprogram_Body): Call
+ Package_Freeze_Node to retrieve the freeze node for the
+ enclosing body of the generic.
+
+2020-10-21 Justin Squirek <squirek@adacore.com>
+
+ * exp_ch6.adb (Expand_Call_Helper): Modify calls to
+ Add_Extra_Actual to use Extra_Accessibility instead of
+ Get_Accessibility for the EF parameter.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_ch6.adb (Expand_Actuals): Whitespace cleanup.
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Make minimum
+ accessibility a constant object.
+
+2020-10-21 Patrick Bernardi <bernardi@adacore.com>
+
+ * env.c (__gnat_environ): For VxWorks kernel simply return the
+ result of the envGet call. Do this for VxWorks 6 and 7 as they
+ both support the same API.
+
+2020-10-21 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_ch7.adb (Build_Finalizer): Disable warnings on referenced
+ entity.
+
+2020-10-21 Piotr Trojanek <trojanek@adacore.com>
+
+ * einfo.ads, sem_ch3.adb, sem_util.adb: Fix comments.
+
+2020-10-21 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Build_Derived_Type): Propagate convention of
+ class-wide parent.
+
+2020-10-21 Claire Dross <dross@adacore.com>
+
+ * libgnat/a-cofove.adb (Copy): Add explanation in case of
+ Capacity_Error.
+ (Insert_Space): Raise Capacity_Error if the new length is
+ greater than the capacity.
+ (Reserve_Capacity): Raise Capacity_Error instead of
+ Constraint_Error.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Constrain_Decimal, Constrain_Enumeration,
+ Constrain_Float, Constrain_Integer, Constrain_Ordinary_Fixed):
+ Refine parameter type from Node_Id to Entity_Id.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * sprint.adb (po): Set Dump_Freeze_Null to False; align colons.
+ (ps): Likewise.
+
+2020-10-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sinfo.ads, sinfo.adb: The flag Box_Present can appear in
+ Iterated_Element_Association nodes.
+ * sem_aggr.adb (Resolve_Aggregate): Call
+ Resolve_Container_Aggregate when type of context has
+ corresponding aspect.
+ * sem_type.adb (Covers): In Ada_2020 an aggregate is compatible
+ with a type that carries the corresponding aspect.
+ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Do not
+ create declarations and bodies for inherited primitive functions
+ of null extensions that dispatch on result, when current scope
+ includes an immediately visible non-overloadable homonym of the
+ function.
+ * libgnat/a-cborse.adb, libgnat/a-cborse.ads,
+ libgnat/a-cbhase.ads, libgnat/a-cbhase.adb,
+ libgnat/a-cborma.adb, libgnat/a-cborma.ads,
+ libgnat/a-cbhama.adb, libgnat/a-cbhama.ads,
+ libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads,
+ libgnat/a-convec.ads, libgnat/a-ciorse.ads,
+ libgnat/a-cihase.ads, libgnat/a-cihase.adb,
+ libgnat/a-ciorma.ads, libgnat/a-cihama.ads,
+ libgnat/a-cihama.adb, libgnat/a-cidlli.ads,
+ libgnat/a-cidlli.adb, libgnat/a-coinve.adb,
+ libgnat/a-cobove.adb, libgnat/a-cobove.ads,
+ libgnat/a-convec.adb, libgnat/a-coinve.ads,
+ libgnat/a-coorse.ads, libgnat/a-cohase.adb,
+ libgnat/a-cohase.ads, libgnat/a-coorma.ads,
+ libgnat/a-cohama.adb, libgnat/a-cohama.ads,
+ libgnat/a-cdlili.ads: Add primitive function Empty for use in
+ aspect Aggregate, and add corresponding body or expression
+ function.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * aspects.adb (Has_Aspect_Specifications_Flag): Add
+ N_Parameter_Specification.
+ * par-ch13.adb (Aspect_Specifications_Present): Also handle case
+ of an unknown aspect on the last formal parameter (terminated by
+ a Tok_Right_Paren). Minor reformatting.
+ * par-ch6.adb (P_Formal_Part): Scan aspects on formal
+ parameters.
+ * par.adb: Fix typos.
+ * sem_ch6.adb (Process_Formals): Add processing of aspects and
+ in particular Unreferenced aspect for now.
+ * sinfo.ads: Allow ASPECT_SPECIFICATIONS on a
+ PARAMETER_SPECIFICATION.
+ * doc/gnat_rm/implementation_defined_aspects.rst
+ (Aspect Unreferenced): Update documentation.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_util.ads, sem_util.adb (Get_Accessibility): Refine result
+ type from Node_Id to Entity_Id.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * einfo.adb, exp_attr.adb, sem_ch13.adb, sem_util.adb: Use
+ Is_Formal where possible.
+
+2020-10-20 Steve Baird <baird@adacore.com>
+
+ * sem_util.ads: Declare a new package, Old_Attr_Util, which in
+ turn declares two more packages, Conditional_Evaluation and
+ Indirect_Temps. Conditional_Evaluation provides a predicate for
+ deciding whether a given 'Old attribute reference is eligible
+ for conditional evaluation and, in the case where it is
+ eligible, a function that constructs the Boolean-valued
+ condition that is to be evaluated at run time in deciding
+ whether to evaluate the attribute prefix. Indirect_Temps
+ provides support for declaring a temporary which is only
+ initialized conditionally; more specifically, an access type and
+ a variable of that type are declared (unconditionally) and then
+ the variable is (conditionally) initialized with an allocator.
+ The existence of the access type and the pointer variable is
+ hidden from clients, except that a predicate,
+ Is_Access_Type_For_Indirect_Temp, is provided for identifying
+ such access types. This is needed because we want such an access
+ type to be treated like a "normal" access type (specifically
+ with respect to finalization of allocated objects). Other parts
+ of the compiler treat access types differently if
+ Comes_From_Source is False, or if the secondary stack storage
+ pool is used; this predicate is used to disable this special
+ treatment.
+ * sem_attr.adb (Uneval_Old_Msg): Improve message text to reflect
+ Ada202x changes.
+ (Analyze_Attribute): A previously-illegal 'Old attribute
+ reference is accepted in Ada2020 if it is eligible for
+ conditional evaluation.
+ * sem_res.adb (Valid_Conversion): Do not treat a rewritten 'Old
+ attribute like other rewrite substitutions. This makes a
+ difference, for example, in the case where we are generating the
+ expansion of a membership test of the form "Saooaaat'Old in
+ Named_Access_Type"; in this case Valid_Conversion needs to
+ return True (otherwise the expansion will be False - see the
+ call site in exp_ch4.adb).
+ * exp_attr.adb (Expand_N_Attribute_Reference): When expanding a
+ 'Old attribute reference, test for the case where the reference
+ is eligible for conditional evaluation. In that case, use the
+ new "indirect temporary" mechanism provided by Sem_Util.
+ * exp_prag.adb
+ (Expand_Attributes_In_Consequence.Expand_Attributes): If
+ Sem_Util.Indirect_Temp_Needed indicates that there could be
+ correctness problems associated with the old expansion scheme
+ for dealing with 'Old attributes in contract cases consequences,
+ then we use the new "indirect temporary" mechanism provided by
+ Sem_Util instead. We do not want to do this unconditionally.
+ * sem_util.adb: Provide a body for the new Old_Attr_Util
+ package. Further work is needed in several areas for
+ correctness:
+ - The function Is_Repeatedly_Evaluated does not deal with
+ container aggregates yet.
+ - The function Is_Known_On_Entry does not deal with interactions
+ with the Global aspect.
+ Each area where more work is needed is indicated with a "???"
+ comment in the code; a more detailed description can be found
+ there. Some optimization opportunties are similarly indicated
+ with a "???" comment.
+ * exp_ch3.adb (Freeze_Type): In deciding whether to generate
+ expansion for the list controller of an access type, take the
+ predicate Is_Access_Type_For_Indirect_Temp into account. If the
+ predicate yields True, then generate the expansion.
+ * exp_util.adb (Build_Allocate_Deallocate_Proc): We don't
+ normally finalize allocated objects that are allocated on the
+ secondary stack. Add an exception to this rule if the predicate
+ Is_Access_Type_For_Indirect_Temp yields True. As a result of
+ this exception, we have to deal with the fact that gigi expects
+ a different parameter profile if we are using the secondary
+ stack pool; the Pool and Alignment parameters must be omitted in
+ this case.
+
+2020-10-20 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch12.adb (Install_Parents_Of_Generic_Context,
+ Remove_Parents_Of_Generic_Context): New subprograms.
+ (Instantiate_Package_Body): Adding assertions to ensure that
+ installed parents are properly removed.
+
+2020-10-20 Claire Dross <dross@adacore.com>
+
+ * sem_attr.adb (Analyze_Attribute): Emit a warning on 'Update
+ when Warn_On_Obsolescent_Feature is set to True.
+
+2020-10-20 Richard Kenner <kenner@adacore.com>
+
+ * gnat_cuda.adb (Build_Register_Function_Call): Make procedure
+ call instead of function, rename to
+ Build_Register_Procedure_Call.
+ (Build_CUDA_Init_Proc): Make procedure call instead of function.
+
+2020-10-20 Justin Squirek <squirek@adacore.com>
+
+ * exp_ch6.adb (Expand_Branch): Properly anticipate expansion of
+ conditional expressions producing object declarations in
+ addition to assignment statements, and rename formal.
+
+2020-10-20 Yannick Moy <moy@adacore.com>
+
+ * errout.adb (Write_Source_Code_Line): Adopt display closer to
+ GCC format.
+ (Output_Messages): Deal specially with info messages.
+ * erroutc.adb (Prescan_Message): Fix bug leading to check
+ messages being considered as error messages in pretty output
+ mode.
+
+2020-10-20 Justin Squirek <squirek@adacore.com>
+
+ * exp_ch6.adb (Expand_Call_Helper): Properly handle the case
+ where the condition of a conditional expression has been
+ optimized out when calculating the value of an extra
+ accessibility parameter.
+
+2020-10-20 Bob Duff <duff@adacore.com>
+
+ * doc/gnat_ugn/gnat_utility_programs.rst: Change "_" to "-".
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_aggr.adb (Resolve_Aggregate): Warn on not fully
+ initialized box aggregate.
+ * sem_aggr.ads: Fix typo.
+ * sem_res.adb (Resolve_Actuals): Fix typo in error message
+ format marking it incorrectly as a continuation message.
+ * sem_elab.adb (Check_Internal_Call_Continue): Similarly, add
+ missing primary message in case of a call to an actual generic
+ subprogram.
+ * sem_warn.adb (Check_References): Do not warn on read but never
+ assigned variables if the type is partially initialized.
+ * libgnat/a-except.ads, libgnat/a-ststun.ads,
+ libgnat/g-sechas.ads, libgnat/a-cbdlli.ads,
+ libgnat/a-cfdlli.ads, libgnat/a-cobove.ads,
+ libgnat/a-cohata.ads, libgnat/a-crbltr.ads,
+ libgnat/a-cbmutr.ads, libgnat/a-crdlli.ads,
+ libgnat/a-cbsyqu.ads: Address new warning.
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst:
+ Update doc on -gnatwv.
+ * gnat_ugn.texi: Regenerate.
+
+2020-10-20 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch6.adb (Analyze_Expression_Function): Mark static
+ expression functions as inlined.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * contracts.adb (Is_Prologue_Renaming): This function was
+ missing support for E_Constant which can also be generated in
+ protected objects.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * bindgen.adb (Gen_Bind_Env_String): Generate Ada 2012 compatible
+ strings. Code cleanup.
+
+2020-10-20 Yannick Moy <moy@adacore.com>
+
+ * sem_util.adb, sem_util.ads: Comment fix.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch8.adb (Check_Constrained_Object): Suppress discriminant
+ checks when the type has default discriminants and comes from
+ expansion of a "for of" loop.
+
+2020-10-20 Bob Duff <duff@adacore.com>
+
+ * atree.ads: Make Default_Node a constant. Remove the
+ modification of Comes_From_Source, and use a separate flag for
+ that. Change Sloc to 0; it always overwritten, and never left
+ as the No_Location value.
+ (Print_Statistics): Move to spec so we can call it from
+ gnat1drv.
+ (Num_Nodes): Rename to clarify that this is approximate.
+ Correct comment: nodes and entities are never deleted, the count
+ is never decremented, and this is not used by Xref.
+ (Initialize): Correct comment: Error_List is not created here.
+ Other minor naming and comment changes.
+ * atree.adb (Extend_Node, New_Copy, New_Entity, New_Node):
+ Streamline these. Simplify and improve efficiency. Move code
+ from Allocate_Initialize_Node to these, where it can be executed
+ unconditionally. Take advantage of automatic zeroing of the
+ Nodes table.
+ (Allocate_Initialize_Node): Remove this. It was an efficiency
+ bottleneck, and somewhat complicated, because it was called from
+ 4 places, and had all sorts of conditionals to check where it
+ was called from. Better to move most of that code to the call
+ sites, where it can be executed (or not) unconditionally.
+ (Allocate_New_Node): New procedure to partly replace
+ Allocate_Initialize_Node (called from just 2 of those 4 places).
+ (Comes_From_Source_Default): New flag written/read by
+ Set_Comes_From_Source_Default/Get_Comes_From_Source_Default.
+ This allows us to make Default_Node into a constant with
+ all-zeros value.
+ (Set_Paren_Count_Of_Copy): New procedure to avoid duplicated
+ code.
+ (Report): New procedure to encapsulate the call to the reporting
+ procedure.
+ (Atree_Private_Part): We now need a body for this package, to
+ contain package body Nodes.
+ (Approx_Num_Nodes_And_Entities): Was Num_Nodes. For efficiency,
+ compute the answer from Nodes.Last. That way we don't need to
+ increment a counter on every node creation. Other minor naming
+ and comment changes.
+ * gnat1drv.adb: Call Atree.Print_Statistics if -gnatd.A switch
+ was given. Add comment documenting the new order dependency (we
+ must process the command line before calling Atree.Initialize).
+ * debug.adb: Document -gnatd.A.
+ * einfo.adb, sinfo.adb: Remove useless Style_Checks pragmas.
+ * nlists.ads (Allocate_List_Tables): Inline makes node creation
+ a little faster.
+ * nlists.adb (Initialize): Remove local constant E, which didn't
+ seem to add clarity.
+ * treepr.adb (Print_Init): Use renamed
+ Approx_Num_Nodes_And_Entities function.
+ * types.ads: Change the Low and High bounds as described above.
+ * types.h: Change Low and High bounds to match types.ads.
+ * sem_ch8.adb, namet.adb, namet.ads: Move the computation of
+ Last_Name_Id from sem_ch8 to namet, and correct it to not assume
+ Name_Ids are positive.
+ * ali.adb, ali-util.adb, bindo-writers.adb, exp_dist.adb,
+ fmap.adb, fname-uf.adb, osint.adb: Fix various hash functions to
+ avoid assuming the various ranges are positive. Note that "mod"
+ returns a nonnegative result when the second operand is
+ positive. "rem" can return negative values in that case (in
+ particular, if the first operand is negative, which it now is).
+ * switch-c.adb: Allow switch -gnaten to control the value of
+ Nodes_Size_In_Meg.
+ * doc/gnat_ugn/building_executable_programs_with_gnat.rst:
+ Remove traling whitespaces.
+ * opt.ads (Nodes_Size_In_Meg): New Variable.
+
+2020-10-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_util.adb (Remove_Side_Effects): Always generate a renaming
+ that is handled by the front-end in the case of an indexed or a
+ selected component whose prefix has a nonstandard representation.
+
+2020-10-20 Pat Rogers <rogers@adacore.com>
+
+ * doc/gnat_rm/the_gnat_library.rst: Add Ada.Task_Initialization.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-20 Yannick Moy <moy@adacore.com>
+
+ * errout.adb: (Error_Msg-Internal): Pass the location for a line
+ insertion if any in the message.
+ (Output_Messages: Add display of source code lines if -gnatdF is
+ set.
+ (Write_Source_Code_Line): Code clean up.
+ * erroutc.adb (Prescan_Message): Apply prescan for continuation
+ lines when -gnatdF is set, and record presence of line
+ insertion.
+ * erroutc.ads (Has_Insertion_Line): New global for prescan.
+ (Error_Msg_Object): Add field to record line insertion if
+ present.
+ * errutil.adb (Error_Msg): Pass no location for Insertion_Sloc.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch5.adb (Expand_N_Case_Statement): Do not generate
+ validity check when possible.
+
+2020-10-20 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Expand_Iterated_Component): Reorganize code to
+ ensure that Loop_Id is properly initialized on all paths, and
+ remove code duplication.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Analyze_Subtype_Declaration): Propagate predicate
+ function to full view of the created type as well, if it was
+ created.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference): Merge handling of
+ Simple_Storage_Pool and Storage_Pool.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * aspects.ads: Introduce Subprogram_Variant aspect with the
+ following properties: GNAT-specific, with mandatory expression,
+ not a representation aspect, never delayed.
+ * contracts.adb (Expand_Subprogram_Contract): Mention new aspect
+ in the comment.
+ (Add_Contract_Item): Support addition of pragma
+ Subprogram_Variant to N_Contract node.
+ (Analyze_Entry_Or_Subprogram_Contract): Mention new aspect in
+ the comment; add pragma Subprogram_Variant to N_Contract node.
+ (Build_Postconditions_Procedure): Adapt call to
+ Insert_Before_First_Source_Declaration, which is now reused in
+ expansion of new aspect.
+ (Process_Contract_Cases_For): Also process Subprogram_Variant,
+ which is stored in N_Contract node together with Contract_Cases.
+ * contracts.ads (Analyze_Entry_Or_Subprogram_Contract): Mention
+ new aspect in the comment.
+ (Analyze_Entry_Or_Subprogram_Body_Contract): Likewise.
+ * einfo.adb (Get_Pragma): Support retrieval of new pragma.
+ * einfo.ads (Get_Pragma): Likewise.
+ * exp_ch6.adb (Check_Subprogram_Variant): New routine for
+ emitting call to check Subprogram_Variant expressions at run
+ time.
+ (Expand_Call_Helper): Check Subprogram_Variant expressions at
+ recursive calls.
+ * exp_prag.adb (Make_Op): Moved from expansion of pragma
+ Loop_Variant to Exp_Util, so it is now reused for expansion of
+ pragma Subprogram_Variant.
+ (Process_Variant): Adapt call to Make_Op after moving it to
+ Exp_Util.
+ (Expand_Pragma_Subprogram_Variant): New routine.
+ * exp_prag.ads (Expand_Pragma_Subprogram_Variant): Likewise.
+ * exp_util.adb (Make_Variant_Comparison): Moved from Exp_Prag
+ (see above).
+ * exp_util.ads (Make_Variant_Comparison): Likewise.
+ * inline.adb (Remove_Aspects_And_Pragmas): Handle aspect/pragma
+ Subprogram_Variant just like similar contracts.
+ * par-prag.adb (Prag): Likewise.
+ * sem.adb (Insert_Before_First_Source_Declaration): Moved from
+ Contracts (see above).
+ * sem.ads (Insert_Before_First_Source_Declaration): Likewise.
+ * sem_ch12.adb: Mention new aspect in the comment about
+ "Implementation of Generic Contracts", just like similar aspects
+ are mentioned there.
+ * sem_ch13.adb (Insert_Pragma): Mention new aspect in the
+ comment, because this routine is now used for Subprogram_Variant
+ just like for other similar aspects.
+ (Analyze_Aspect_Specifications): Mention new aspect in comments;
+ it is handled just like aspect Contract_Cases.
+ (Check_Aspect_At_Freeze_Point): Do not expect aspect
+ Subprogram_Variant just like we don't expect aspect
+ Contract_Cases.
+ * sem_prag.adb (Ensure_Aggregate_Form): Now also used for pragma
+ Subprogram_Variant, so update comment.
+ (Analyze_Pragma): Add initial checks for pragma
+ Subprogram_Variant.
+ (Analyze_Subprogram_Variant_In_Decl_Part): New routine with
+ secondary checks on the new pragma.
+ (Sig_Flags): Handle references within pragma Subprogram_Variant
+ expression just like references in similar pragma
+ Contract_Cases.
+ (Is_Valid_Assertion_Kind): Handle Subprogram_Variant just like
+ other similar contracts.
+ * sem_prag.ads (Analyze_Subprogram_Variant_In_Decl_Part): New
+ routine.
+ * sem_res.adb (Same_Or_Aliased_Subprograms): Moved to Sem_Util,
+ so it can be reused for detection of recursive calls where
+ Subprogram_Variant needs to be verified.
+ * sem_util.adb (Is_Subprogram_Contract_Annotation): Handle new
+ Subprogram_Variant annotation just like other similar
+ annotations.
+ (Same_Or_Aliased_Subprograms): Moved from Sem_Res (see above).
+ * sem_util.ads (Is_Subprogram_Contract_Annotation): Mention new
+ aspect in the comment.
+ (Same_Or_Aliased_Subprograms): Moved from Sem_Res (see above).
+ * sinfo.ads (N_Contract): Document handling of
+ Subprogram_Variant.
+ * snames.ads-tmpl: Add name for the internally generated
+ procedure with checks for Subprogram_Variant expression, name
+ for the new aspect and new pragma corresponding to aspect
+ Subprogram_Variant.
+
+2020-10-20 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_util.ads: Reorder declaration.
+
+2020-10-19 Ed Schonberg <schonberg@adacore.com>
+
+ * par-ch4.adb: (P_Aggregate_Or_Paren_Expr): Recognize
+ Iterated_Element_Component.
+ (P_Iterated_Component_Association): Rebuild node as an Iterated_
+ Element_Association when Key_Expression is present, and attach
+ either the Loop_Parameter_Specification or the
+ Iterator_Specification to the new node.
+ * sem_aggr.adb: (Resolve_Container_Aggregate):
+ Resolve_Iterated_Association handles bota Iterated_Component_
+ and Iterated_Element_Associations, in which case it analyzes and
+ resoles the orresponding Key_Expression.
+ * exp_aggr.adb (Expand_Iterated_Component): If a Key_Expression
+ is present, use it as the required parameter in the call to the
+ insertion routine for the destination container aggregate. Call
+ this routine for both kinds of Iterated_Associations.
+
+2020-10-19 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch4.adb (Expand_Concatenate): Enable needed range checks.
+
+2020-10-19 Bob Duff <duff@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration):
+ Set the Warnings_Off flag on the pointer object used in the
+ expansion of iterators and similar.
+
+2020-10-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.rtl (PowerPC/Linux): Use s-taspri__posix.ads instead
+ of s-taspri__posix-noaltstack.ads for s-taspri.ads.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch13.adb (Add_Call): Remove excessive condition and
+ unnecessary call to Set_Has_Predicates.
+
+2020-10-19 Yannick Moy <moy@adacore.com>
+
+ * debug.adb: Use debug switch -gnatdF for this alternative
+ display of messages.
+ * errout.adb (Output_Messages): Alternative display when -gnatdF
+ is used.
+ * erroutc.adb (Output_Msg_Text): Likewise.
+
+2020-10-19 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch6.adb (Check_Untagged_Equality): Check for AI12-0352.
+
+2020-10-19 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Add_View_Conversion_Invariants): Do not insert
+ generated invariant checks when the call is a function call.
+ These tests are properly inserted in the code in procedure
+ Insert_Post_Call_Actions, which takes care of finding the proper
+ insertion point for the checks.
+ (Insert_Post_Call_Actions): Add question marks to indicate
+ possible gap in handling function calls that appear as aggregate
+ components.
+
+2020-10-19 Arnaud Charlet <charlet@adacore.com>
+
+ * contracts.adb (Process_Preconditions_For): Do not exclude
+ instances.
+ * sem_ch4.adb (Analyze_Quantified_Expression): Disable spurious
+ warning on internally generated variables.
+
+2020-10-19 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * debug.adb: Document -gnatd_c flag as being used for CUDA.
+ * gnat_cuda.ads: New file.
+ * gnat_cuda.adb: New file.
+ * rtsfind.ads: Add Interfaces_C_Strings package and
+ RE_Fatbin_Wrapper, RE_Register_Fat_Binary,
+ RE_Register_Fat_Binary_End, RE_Register_Function, RE_Chars_Ptr,
+ RE_New_Char_Array entities.
+ * rtsfind.adb: Create new Interfaces_C_Descendant subtype,
+ handle it.
+ * sem_ch7.adb (Analyze_Package_Body_Helper): Call CUDA init
+ procedure.
+ * sem_prag.adb (Analyze_Pragma): Call Add_Cuda_Kernel procedure.
+ * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add gnat_cuda.o.
+
+2020-10-19 Bob Duff <duff@adacore.com>
+
+ * ghost.adb (Whole_Object_Ref): New function to compute the name
+ of the whole object.
+ (Mark_And_Set_Ghost_Assignment): Rewrite to use
+ Whole_Object_Ref. We need to partly analyze the left-hand side
+ in order to distinguish expanded names and record components.
+ * lib-xref.ads, lib-xref.adb (Deferred_References): Move table
+ to body, and add Defer_Reference to update the table, avoiding
+ duplicates.
+ (Generate_Reference): Avoid duplicates.
+ * sem_ch8.ads, sem_ch8.adb (Find_Direct_Name): Remove _OK
+ parameters, which are no longer needed. Ignore errors in
+ Ignore_Errors mode.
+ * sem_util.ads, sem_util.adb (Preanalyze_Without_Errors): Make
+ this public, so we can call it from Ghost.
+ * errout.ads, scng.adb, sem_prag.adb: Minor.
+
+2020-10-19 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference): Check if type
+ depends on discriminant.
+
+2020-10-19 Bob Duff <duff@adacore.com>
+
+ * libgnat/a-coinve.adb, libgnat/a-cidlli.adb (Put_Image): Call
+ Iterate.
+
+2020-10-19 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_aggr.adb (Resolve_Record_Aggregate): Properly apply
+ subtype constraints when using a Default_Value.
+ * freeze.adb: Fix typo.
+
+2020-10-19 Yannick Moy <moy@adacore.com>
+
+ * sem_ch13.adb (Analyze_Aspect_Relaxed_Initialization): Fix bug
+ where a call to Error_Msg_N leads to crash due to
+ Error_Msg_Name_1 being removed by the call, while a subsequent
+ call to Error_Msg_N tries to use it. The variable
+ Error_Msg_Name_1 should be restored prior to the next call. Also
+ add checking for the new rules.
+
+2020-10-19 Arnaud Charlet <charlet@adacore.com>
+
+ * checks.adb (Apply_Type_Conversion_Checks): Minor code clean
+ up.
+ * exp_ch4.adb (Discrete_Range_Check): Optimize range checks.
+ Update comments.
+ (Expand_N_Type_Conversion): Generate range check when rewriting
+ a type conversion if needed. Add assertion.
+ * exp_ch6.adb (Expand_Simple_Function_Return): Minor code clean
+ up.
+ * sem_res.adb (Resolve_Type_Conversion): Apply range check when
+ needed. Update comments.
+
+2020-10-19 Yannick Moy <moy@adacore.com>
+
+ * libgnat/a-textio.ads: Update top-level comment.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part): Fix typo.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_ch6.adb (Expand_Actuals): Simplify condition for by-copy
+ types.
+
+2020-10-19 Yannick Moy <moy@adacore.com>
+
+ * errout.ads: Add comment regarding lack of preservation of
+ Errout state across successive calls to the API.
+
+2020-10-19 Bob Duff <duff@adacore.com>
+
+ * exp_put_image.adb (Build_Elementary_Put_Image_Call): Use the
+ base type to recognize various cases of access types.
+ * libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads, libgnat/a-cbhama.adb,
+ libgnat/a-cbhama.ads, libgnat/a-cbhase.adb, libgnat/a-cbhase.ads,
+ libgnat/a-cbmutr.adb, libgnat/a-cbmutr.ads, libgnat/a-cborma.adb,
+ libgnat/a-cborma.ads, libgnat/a-cborse.adb, libgnat/a-cborse.ads,
+ libgnat/a-cdlili.adb, libgnat/a-cdlili.ads, libgnat/a-cidlli.adb,
+ libgnat/a-cidlli.ads, libgnat/a-cihama.adb, libgnat/a-cihama.ads,
+ libgnat/a-cihase.adb, libgnat/a-cihase.ads, libgnat/a-cimutr.adb,
+ libgnat/a-cimutr.ads, libgnat/a-ciorma.adb, libgnat/a-ciorma.ads,
+ libgnat/a-ciormu.adb, libgnat/a-ciormu.ads, libgnat/a-ciorse.adb,
+ libgnat/a-ciorse.ads, libgnat/a-coboho.adb, libgnat/a-coboho.ads,
+ libgnat/a-cobove.adb, libgnat/a-cobove.ads, libgnat/a-cohama.adb,
+ libgnat/a-cohama.ads, libgnat/a-cohase.adb, libgnat/a-cohase.ads,
+ libgnat/a-coinho.adb, libgnat/a-coinho.ads,
+ libgnat/a-coinho__shared.adb, libgnat/a-coinho__shared.ads,
+ libgnat/a-coinve.adb, libgnat/a-coinve.ads, libgnat/a-comutr.adb,
+ libgnat/a-comutr.ads, libgnat/a-coorma.adb, libgnat/a-coorma.ads,
+ libgnat/a-coormu.adb, libgnat/a-coormu.ads, libgnat/a-coorse.adb,
+ libgnat/a-coorse.ads, libgnat/a-strunb.adb, libgnat/a-strunb.ads,
+ libgnat/a-strunb__shared.adb, libgnat/a-strunb__shared.ads:
+ Implement Put_Image attibute.
+ * libgnat/a-stteou.ads, libgnat/s-putima.ads,
+ libgnat/a-stouut.ads, libgnat/a-stoubu.adb: Make
+ Ada.Strings.Text_Output, Ada.Strings.Text_Output.Utils, and
+ System.Put_Images Pure, so they can be with'ed by Pure units
+ that should have Put_Image defined.
+ * libgnat/a-stouut.adb: Add missing column adjustments, and
+ remove a redundant one.
+ * libgnat/s-putima.adb (Put_Arrow): New routine to print an
+ arrow. Avoids adding a with clause to some containers.
+
+2020-10-19 Bob Duff <duff@adacore.com>
+
+ * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Require matching
+ parens or brackets.
+ * par.adb, par-tchk.adb (T_Right_Bracket): New procedure to give
+ an error on missing ].
+
+2020-10-19 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch8.adb (Find_Direct_Name): Do not trust in the decoration
+ of the Entity attribute in constants associated with
+ discriminals of protected types.
+
+2020-10-19 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_disp.adb (Check_Dispatching_Context): When the enclosing
+ subprogram is abstract, bypass early return if the call is
+ tag-indeterminate, to continue with the later error checking.
+
+2020-10-19 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch7.adb (Uninstall_Declarations): Uninstall the
+ declaration of a subtype declaration defined in the private part
+ of a package.
+
+2020-10-19 Arnaud Charlet <charlet@adacore.com>
+
+ * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Simplify code since
+ we are always under -gnatX if we encounter a Tok_Left_Bracket.
+ * scng.adb (Scan): [] is an aggregate under -gnatX and a wide
+ character otherwise.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_ch6.adb (Expand_Call_Helper): Cleanup.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_ch6.adb (Is_Direct_Deep_Call): Refine type from Node_Id to
+ Entity_Id.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_ch6.adb (May_Fold): Detect all operators, i.e. both binary
+ and unary ones.
+
+2020-10-19 Piotr Trojanek <trojanek@adacore.com>
+
+ * inline.adb (Expand_Inlined_Call): Simplify repeated calls to
+ Nkind.
+
+2020-10-18 Alexandre Oliva <oliva@adacore.com>
+
+ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Compile Ada.Numerics
+ child units Aux_Generic_Float, Aux_Long_Long_Float, Aux_Long_Float,
+ Aux_Float, Aux_Short_Float, Aux_Compat, and Aux_Linker_Options.
+ (X86_TARGET_PAIRS): Drop dummy body for Aux. Use x86 version
+ of Aux_Compat.
+ (X86_64_TARGET_PAIRS): Likewise.
+ (LIBGNAT_TARGET_PAIRS): On VxWorks, select the nolibm
+ variants. Drop the darwin version of Aux. Drop the redundant
+ libc-x86 numaux variants on x86* kfreebsd variants.
+ * libgnat/a-nagefl.ads: New Aux_Generic_Float.
+ * libgnat/a-naliop.ads: New Aux_Linker_Options.
+ * libgnat/a-naliop__nolibm.ads: New.
+ * libgnat/a-nallfl.ads: New Aux_Long_Long_Float.
+ * libgnat/a-nalofl.ads: New Aux_Long_Float.
+ * libgnat/a-nuaufl.ads: New Aux_Float.
+ * libgnat/a-nashfl.ads: New Aux_Short_Float.
+ * libgnat/a-ngcefu.adb (Exp): Factor out the Im (X) passed to
+ Sin and Cos in the Complex variant too.
+ * libgnat/a-ngcoty.adb: Switch to Aux_Generic_Float. Drop
+ redundant conversions.
+ * libgnat/a-ngelfu.adb: Likewise.
+ * libgnat/a-nuauco.ads: New Aux_Compat.
+ * libgnat/a-nuauco__x86.ads: New.
+ * libgnat/a-numaux.ads: Replace with Compat wrapper.
+ * libgnat/a-numaux__darwin.adb: Remove.
+ * libgnat/a-numaux__darwin.ads: Remove.
+ * libgnat/a-numaux__dummy.adb: Remove.
+ * libgnat/a-numaux__libc-x86.ads: Remove.
+ * libgnat/a-numaux__vxworks.ads: Remove.
+
+2020-10-16 Piotr Trojanek <trojanek@adacore.com>
+
+ * checks.adb, exp_aggr.adb, exp_attr.adb, exp_ch6.adb,
+ freeze.adb, sem_aggr.adb, sem_attr.adb, sem_ch13.adb,
+ sem_ch13.ads, sem_ch6.adb, sem_eval.adb, sem_util.adb: Fix style
+ and typos.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_cat.adb (Is_Primary): Handle N_Range properly.
+
+2020-10-16 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * elists.ads (New_Elmt_List): New functions.
+ * elists.adb (New_Elmt_List): New functions.
+ * exp_prag.adb: Add dependency on Elists.
+ (Expand_Pragma_CUDA_Execute): New function.
+ (Expand_N_Pragma): Add call to Expand_Pragma_CUDA_Execute.
+ * rtsfind.ads: Add CUDA.Internal, CUDA.Runtime, System.C
+ packages and RE_Push_Call_Configuration,
+ RE_Pop_Call_Configuration, RE_Launch_Kernel, RO_IC_Unsigned,
+ RO_IC_Unsigned_Long_Long entities.
+ * rtsfind.adb: Extend Interfaces_Descendant to include
+ Interfaces_C.
+
+2020-10-16 Bob Duff <duff@adacore.com>
+
+ * par-ch4.adb (P_Name): Allow Tok_Left_Bracket in two places to
+ call P_Qualified_Expression. We don't need to modify other
+ places that call P_Qualified_Expression, because a
+ qualified_expression is a name in Ada 2012 and higher, so P_Name
+ is the right place. The parser already parses aggregates with
+ brackets; we just need to allow that in qualified expressions.
+
+2020-10-16 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch12.adb (Check_Generic_Child_Unit): When the child unit
+ is a renaming of a generic child unit then traverse the scope
+ containing the renaming declaration to locate the instance of
+ its parent. Otherwise the parent is not installed and the
+ frontend cannot process the instantiation.
+
+2020-10-16 Bob Duff <duff@adacore.com>
+
+ * libgnat/a-numeri.ads: Remove the greek letter.
+
+2020-10-16 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_imgv.adb (Expand_Image_Attribute): Refine previous patch
+ to use root type (and not base type) on enumeration types.
+
+2020-10-16 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_imgv.adb (Expand_Image_Attribute): Use the base type
+ instead of the root type when type of object is private. Remove
+ Ada_2020 guard, because it has been checked during prior
+ analysis. Use Underlying_Type in all cases, as it is a no-op on
+ types that are not private.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * aspects.ads, snames.ads-tmpl: Add support for
+ Exclusive_Functions aspect.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Ditto.
+ * exp_ch9.adb (Build_Protected_Subprogram_Body): Take aspect
+ Exclusive_Functions into account.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies on system.ads,
+ add gnatbind switch -t to avoid timestamp inconsistencies during
+ build.
+ * libgnat/system.ads: Move...
+ * gcc-interface/system.ads: ... here.
+
+2020-10-16 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_eval.adb (Subtypes_Statically_Match): Retrieve
+ discriminant constraints from the two types via new function
+ Original_Discriminant_Constraint rather than
+ Discriminant_Constraint.
+ (Original_Discriminant_Constraint): New function to locate the
+ nearest explicit discriminant constraint associated with a type
+ that may possibly have inherited a constraint from an ancestor
+ type.
+
+2020-10-16 Bob Duff <duff@adacore.com>
+
+ * exp_ch6.adb (Expand_Simple_Function_Return): Remove obsolete
+ comment and code.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ PR ada/95953
+ * libgnat/a-suenco.adb (Convert): Fix handling of third UTF-8
+ byte.
+
+2020-10-16 Steve Baird <baird@adacore.com>
+
+ * exp_util.adb (Is_Related_To_Func_Return): Cope with the case
+ where the FE introduces a type conversion.
+
+2020-10-16 Chris Martin <cmartin@adacore.com>
+
+ * sem_util.ads, sem_util.adb (Is_Access_Variable): New function.
+ (Is_Synchronized_Object): Call new function when determining if
+ a constant can be regarded as synchronized.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration):
+ Call Set_BIP_Initialization_Call systematically.
+ * exp_ch7.adb (Process_Transient_In_Scope): Take
+ BIP_Initialization_Call into account to decide where to insert
+ the Hook.
+
+2020-10-16 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_util.adb (Is_View_Conversion): Detect qualified types.
+ * sem_util.ads (Is_Actual_In_Out_Parameter): Fix style in
+ comment.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * scil_ll.adb, sem_scil.adb: Update assertions.
+
+2020-10-16 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Min_Max): Handle the case where attribute
+ name (qualified by required type) appears as the reducer of a
+ 'Reduce attribute reference.
+ (Resolve_Attribute) <Reduce>: Handle properly the presence of a
+ procedure or an attribute reference Min/Max as a reducer.
+ * exp_attr.adb (Expand_Attribute_Reference) <Reduce>: New
+ subprogram Build_Stat, to construct the combining statement
+ which appears in the generated loop for Reduce, and which is
+ either a function call when the reducer is a function or an
+ attribute, or a procedure call when reducer is an appropriate
+ procedure. BuilD_Stat is used both when the prefix of 'Reduce
+ is a value sequence and when it is an object
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch4.adb (Expand_Concatenate): Allocate result of string
+ concatenation on secondary stack when relevant.
+
+2020-10-16 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Declare_Expression): Retrieve the created
+ block entity that is the scope of the local declarations, from
+ either a local object declaration or an object renaming
+ declaration. The block entity does not have an explicit
+ declaration, but appears as the scope of all locally declared
+ objects.
+
+2020-10-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/system-aix.ads: Likewise.
+ * libgnat/system-darwin-arm.ads: Likewise.
+ * libgnat/system-darwin-ppc.ads: Likewise.
+ * libgnat/system-darwin-x86.ads: Likewise.
+ * libgnat/system-djgpp.ads: Likewise.
+ * libgnat/system-dragonfly-x86_64.ads: Likewise.
+ * libgnat/system-freebsd.ads: Likewise.
+ * libgnat/system-hpux-ia64.ads: Likewise.
+ * libgnat/system-hpux.ads: Likewise.
+ * libgnat/system-linux-alpha.ads: Likewise.
+ * libgnat/system-linux-arm.ads: Likewise.
+ * libgnat/system-linux-hppa.ads: Likewise.
+ * libgnat/system-linux-ia64.ads: Likewise.
+ * libgnat/system-linux-m68k.ads: Likewise.
+ * libgnat/system-linux-mips.ads: Likewise.
+ * libgnat/system-linux-ppc.ads: Likewise.
+ * libgnat/system-linux-riscv.ads: Likewise.
+ * libgnat/system-linux-s390.ads: Likewise.
+ * libgnat/system-linux-sh4.ads: Likewise.
+ * libgnat/system-linux-sparc.ads: Likewise.
+ * libgnat/system-linux-x86.ads: Likewise.
+ * libgnat/system-lynxos178-ppc.ads: Likewise.
+ * libgnat/system-lynxos178-x86.ads: Likewise.
+ * libgnat/system-mingw.ads: Likewise.
+ * libgnat/system-qnx-aarch64.ads: Likewise.
+ * libgnat/system-rtems.ads: Likewise.
+ * libgnat/system-solaris-sparc.ads: Likewise.
+ * libgnat/system-solaris-x86.ads: Likewise.
+ * libgnat/system-vxworks-arm-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks-arm-rtp.ads: Likewise.
+ * libgnat/system-vxworks-arm.ads: Likewise.
+ * libgnat/system-vxworks-e500-kernel.ads: Likewise.
+ * libgnat/system-vxworks-e500-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks-e500-rtp.ads: Likewise.
+ * libgnat/system-vxworks-e500-vthread.ads: Likewise.
+ * libgnat/system-vxworks-ppc-kernel.ads: Likewise.
+ * libgnat/system-vxworks-ppc-ravenscar.ads: Likewise.
+ * libgnat/system-vxworks-ppc-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks-ppc-rtp.ads: Likewise.
+ * libgnat/system-vxworks-ppc-vthread.ads: Likewise.
+ * libgnat/system-vxworks-ppc.ads: Likewise.
+ * libgnat/system-vxworks-x86-kernel.ads: Likewise.
+ * libgnat/system-vxworks-x86-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks-x86-rtp.ads: Likewise.
+ * libgnat/system-vxworks-x86-vthread.ads: Likewise.
+ * libgnat/system-vxworks-x86.ads: Likewise.
+ * libgnat/system-vxworks7-aarch64-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks7-aarch64.ads: Likewise.
+ * libgnat/system-vxworks7-arm-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks7-arm.ads: Likewise.
+ * libgnat/system-vxworks7-e500-kernel.ads: Likewise.
+ * libgnat/system-vxworks7-e500-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks7-e500-rtp.ads: Likewise.
+ * libgnat/system-vxworks7-ppc-kernel.ads: Likewise.
+ * libgnat/system-vxworks7-ppc-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks7-ppc-rtp.ads: Likewise.
+ * libgnat/system-vxworks7-ppc64-kernel.ads: Likewise.
+ * libgnat/system-vxworks7-ppc64-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks7-x86-kernel.ads: Likewise.
+ * libgnat/system-vxworks7-x86-rtp-smp.ads: Likewise.
+ * libgnat/system-vxworks7-x86-rtp.ads: Likewise.
+ * libgnat/system-vxworks7-x86_64-kernel.ads: Likewise.
+ * libgnat/system-vxworks7-x86_64-rtp-smp.ads: Likewise.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * Makefile.rtl, gnat1drv.adb, expander.adb
+ doc/gnat_rm/implementation_defined_pragmas.rst,
+ doc/gnat_ugn/building_executable_programs_with_gnat.rst,
+ doc/gnat_ugn/the_gnat_compilation_model.rst, exp_ch5.ads,
+ exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_util.adb,
+ exp_util.ads, libgnarl/s-osinte__aix.adb,
+ libgnarl/s-osinte__android.adb, libgnarl/s-osinte__darwin.adb,
+ libgnarl/s-osinte__gnu.adb, libgnarl/s-osinte__hpux-dce.adb,
+ libgnarl/s-osinte__lynxos178.adb, libgnarl/s-osinte__posix.adb,
+ libgnarl/s-osinte__qnx.adb, libgnarl/s-osinte__rtems.adb,
+ libgnarl/s-osinte__solaris.adb, libgnarl/s-osinte__vxworks.adb,
+ libgnarl/s-osinte__x32.adb, libgnarl/s-solita.adb,
+ libgnarl/s-taasde.adb, libgnarl/s-taprob.adb,
+ libgnarl/s-taprop__dummy.adb, libgnarl/s-taprop__hpux-dce.adb,
+ libgnarl/s-taprop__linux.adb, libgnarl/s-taprop__mingw.adb,
+ libgnarl/s-taprop__posix.adb, libgnarl/s-taprop__qnx.adb,
+ libgnarl/s-taprop__solaris.adb, libgnarl/s-taprop__vxworks.adb,
+ libgnarl/s-tarest.adb, libgnarl/s-tasini.adb,
+ libgnarl/s-taskin.adb, libgnarl/s-taspri__dummy.ads,
+ libgnarl/s-taspri__hpux-dce.ads, libgnarl/s-taspri__lynxos.ads,
+ libgnarl/s-taspri__mingw.ads,
+ libgnarl/s-taspri__posix-noaltstack.ads,
+ libgnarl/s-taspri__posix.ads, libgnarl/s-taspri__solaris.ads,
+ libgnarl/s-taspri__vxworks.ads, libgnarl/s-tassta.adb,
+ libgnarl/s-tasuti.adb, libgnarl/s-tposen.adb,
+ libgnat/a-except.adb, libgnat/a-except.ads,
+ libgnat/s-dwalin.adb, libgnat/s-dwalin.ads,
+ libgnat/s-mastop.ads, libgnat/s-soflin.adb,
+ libgnat/s-stalib.adb, libgnat/s-stalib.ads,
+ libgnat/s-stchop.adb, libgnat/s-stchop.ads,
+ libgnat/s-stchop__limit.ads, libgnat/s-traceb.ads,
+ libgnat/s-traent.adb, libgnat/s-traent.ads,
+ libgnat/s-trasym.adb, libgnat/s-trasym.ads,
+ libgnat/s-trasym__dwarf.adb, opt.adb, opt.ads, par-prag.adb,
+ sem_prag.adb, snames.ads-tmpl, switch-c.adb, targparm.adb,
+ targparm.ads, usage.adb: Remove support for -gnatP and pragma
+ Polling.
+ * gnat_ugn.texi: Regenerate.
+ * libgnat/a-excpol.adb, libgnat/a-excpol__abort.adb: Removed.
+
+2020-10-16 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Array_Type_Declaration): Create itype with unique
+ name.
+
+2020-10-16 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Analyze_Object_Declaration): Limit scope of a
+ local object by hiding it from local subprograms; simplify
+ nested if-then-if-then condition for an Ada 83 restriction.
+ (Array_Type_Declaration): Confirm with assertion when the else
+ branch is executed.
+ (Find_Type_Of_Object): Simplify membership test with a subtype
+ range.
+
+2020-10-16 Yannick Moy <moy@adacore.com>
+
+ * sem_prag.adb (Analyze_Global_In_Decl_Part): Update check to
+ reject volatile object for reading.
+ * sem_res.adb (Resolve_Actuals, Resolve_Entity_Name): Update
+ check to reject volatile object for reading.
+ * sem_util.adb, sem_util.ads
+ (Check_Nonvolatile_Function_Profile,
+ Has_Effectively_Volatile_Profile): Detect use of volatile object
+ for reading.
+ (Has_Enabled_Property): Accept constants as well.
+ (Is_Effectively_Volatile_For_Reading): New function based on
+ existing Is_Effectively_Volatile.
+ (Is_Effectively_Volatile_Object_For_Reading): Adapted from the
+ existing Is_Effectively_Volatile_Object, using a shared
+ implementation in Is_Effectively_Volatile_Object_Shared.
+
+2020-10-16 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch7.adb (Check_Unnesting_In_Decls_Or_Stmts): In the case
+ of an if-statement, call Unnest_If_Statement to determine
+ whether there are nested subprograms in any of the statement
+ lists of the "if" parts that require a wrapping procedure to
+ handle possible up-level refeferences.
+ (Unnest_Block): Call Check_Unnesting_In_Handlers to do unnesting
+ of subprograms in exception handlers of the block statement.
+ (Unnest_If_Statement): New procedure to traverse the parts of an
+ if-statement and create wrapper procedures as needed to
+ encapsulate nested subprograms that may make up-level
+ references.
+ (Check_Stmts_For_Subp_Unnesting): New support procedure in
+ Unnest_If_Statement to traverse a statement list looking for
+ top-level subprogram bodies that require wrapping inside a
+ procedure (via Unnest_Statement_List) as well as possibly having
+ other statements (block, loop, if) that may themselves require
+ an unnesting transformation (via
+ Check_Unnesting_In_Decls_Or_Stmts).
+ (Unnest_Statement_List): New support procedure to traverse the
+ statements of a statement list that contains subprogram bodies
+ at the top level and replace the statement list with a wrapper
+ procedure body encapsulating the statements and a call to the
+ procedure.
+
+2020-10-16 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_prag.adb (Check_OK_Stream_Convert_Function): Check for
+ abstract subprograms.
+
+2020-10-16 Piotr Trojanek <trojanek@adacore.com>
+
+ * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst
+ (No_Local_Timing_Events): Package Timing_Events is a child of
+ Ada.Real_Time, not of Ada.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_attributes.rst: Document the
+ new Max_Integer_Size attribute.
+ * gnat_rm.texi: Regenerate.
+ * exp_attr.adb (Get_Integer_Type): Call Small_Integer_Type_For.
+ (Expand_N_Attribute_Reference) <Attribute_Pred>: Replace selection
+ code with call to Integer_Type_For.
+ <Attribute_Succ>: Likewise.
+ <Attribute_Val>: Likewise.
+ <Attribute_Valid>: Likewise.
+ <Attribute_Max_Integer_Size>: Raise Program_Error.
+ * exp_ch3.adb (Expand_Freeze_Enumeration_Type): Replace selection
+ code with call to Integer_Type_For.
+ (Simple_Init_Initialize_Scalars_Type): Use Long_Long_Unsigned and
+ System_Max_Integer_Size to size the largest integer type.
+ * exp_pakd.adb (Compute_Linear_Subscript): Minor tweak.
+ (Create_Packed_Array_Impl_Type): Use Small_Integer_Type_For.
+ * exp_util.ads (Integer_Type_For): New function.
+ (Small_Integer_Type_For): Likewise.
+ * exp_util.adb (Adjust_Condition): Use Integer_Type_For.
+ (Component_May_Be_Bit_Aligned): Use System_Max_Integer_Size.
+ (Integer_Type_For): New function.
+ (Small_Integer_Type_For): Likewise.
+ (Matching_Standard_Type): Use Small_Integer_Type_For.
+ (Needs_Constant_Address): Replace 64 with System_Max_Integer_Size.
+ * freeze.adb (Set_Small_Size): Likewise.
+ (Size_Known): Likewise.
+ (Check_Suspicious_Modulus): Likewise.
+ (Check_Large_Modular_Array): Likewise.
+ (Freeze_Entity): Likewise.
+ * layout.adb (Layout_Type): Likewise.
+ * sem_aggr.adb: Add with and use clauses for Ttypes.
+ (Resolve_Aggregate): Replace 64 with System_Max_Integer_Size.
+ * sem_attr.ads (Attribute_Impl_Def): Add Attribute_Max_Integer_Size.
+ * sem_attr.adb (Analyze_Attribute) <Attribute_Max_Integer_Size>: New
+ (Eval_Attribute): Likewise.
+ * sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Change max
+ scalar size to System_Max_Integer_Size.
+ (Check_Array_Type): Replace 64 with System_Max_Integer_Size and
+ remove superfluous test.
+ (OK_Component): Likewise.
+ * sem_ch5.adb: Add with and use clauses for Ttypes.
+ (Analyze_Assignment): Replace 64 with System_Max_Integer_Size.
+ * snames.ads-tmpl (Name_Max_Integer_Size): New attribute name.
+ (Attribute_Id): Add Attribute_Max_Integer_Size.
+ * ttypes.ads (System_Max_Integer_Size): New constant.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch10.adb (Install_With_Clause): Fix implementation of Ada
+ 2005 AI-262 by taking into account generic packages. Minor
+ reformatting.
+ * libgnat/a-cbhase.ads, libgnat/a-cbhase.adb: Remove use clause
+ on runtime unit spec.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * einfo.ads, einfo.adb (Scope_Depth_Value,
+ Set_Scope_Depth_Value): Add assertions on valid nodes and update
+ documentation accordingly.
+ (Write_Field22_Name): Sync with change in Scope_Depth_Value.
+ * sem_ch8.adb (Find_Direct_Name): Fix call to Scope_Depth_Value.
+
+2020-10-15 Javier Miranda <miranda@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma): Adding semantic support of
+ Standard to Default_Storage_Pool.
+ * freeze.adb (Freeze_Entity): If pragma Default_Storage_Pool
+ applies and it is set to Standard then use the global pool as
+ the associated storage pool of the access type.
+
+2020-10-15 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch6.ads (Might_Have_Tasks): Update documentation.
+ * exp_ch6.adb (Might_Have_Tasks): Return also true when the type
+ has tasks.
+ (Make_Build_In_Place_Call_In_Allocator): Code cleanup.
+ * exp_ch3.adb (Ensure_Activation_Chain_And_Master,
+ Expand_N_Full_Type_Declaration, Expand_N_Object_Declaration):
+ Code cleanup.
+
+2020-10-15 Steve Baird <baird@adacore.com>
+
+ * checks.adb (Apply_Predicate_Check): Generate "infinite
+ recursion" warning message even if run-time predicate checking
+ is disabled.
+ * exp_ch6.adb (Expand_Simple_Function_Return): In testing
+ whether the returned expression is a function call, look for the
+ case where the call has been transformed into a dereference of
+ an access value that designates the result of a function call.
+ * sem_ch3.adb (Analyze_Object_Declaration): Legality checking
+ for a static expression is unaffected by assertion policy (and,
+ in particular, enabling/disabling of subtype predicates. To get
+ the right legality checking, we need to call
+ Check_Expression_Against_Static_Predicate for a static
+ expression even if predicate checking is disabled for the given
+ predicate-bearing subtype. On the other hand, we don't want to
+ call Make_Predicate_Check unless predicate checking is enabled.
+ * sem_ch7.adb (Uninstall_Declarations.Preserve_Full_Attributes):
+ Preserve the Predicates_Ignored attribute.
+ * sem_eval.adb (Check_Expression_Against_Static_Predicate):
+ Previously callers ensured that this procedure was only called
+ if predicate checking was enabled; that is no longer the case,
+ so predicates-disabled case must be handled.
+ * sem_prag.adb (Analyze_Pragma): Fix bug in setting
+ Predicates_Ignored attribute in Predicate pragma case.
+
+2020-10-15 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Fixed_Point_Type): Do not scale the bounds
+ of a declared subtype using the 'Small of the type; this is
+ done during resolution of the bound itself, unlike what is done
+ for the bounds of the base type, which are used to determine its
+ required size. Previous code performed this scaling twice,
+ leading to meaningless values for such a subtype.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_util.adb (Bad_Predicated_Subtype_Use): Emit an
+ unconditional error, not a conditional warning.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Combine guards for
+ Null_Exclusion_Present in May_Have_Null_Exclusion; use this
+ combined guard when checking AI-231.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Sync May_Have_Null_Exclusion
+ with assertion in Null_Exclusion_Present; clarify the scope of
+ local variables.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Analyze_Subtype_Declaration): Fix style.
+ (Make_Index): Refactor to avoid repeated detection of subtype
+ indication; add comment.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_prag.adb (Is_Acceptable_Dim3): Use Is_RTE to not pull CUDA
+ package unless necessary; rename local Tmp variable; iterate
+ with procedural Next.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Array_Type_Declaration): Refine type of a local
+ variable.
+ (Make_Index): Simplify to avoid assignment with a type entity
+ and then backtracking by reassigning to Empty; remove excessive
+ whitespace.
+ * sem_ch9.adb (Analyze_Entry_Body): Remove extra parens.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Access_Subprogram_Declaration): Remove extra
+ parens.
+ (Make_Index): Remove excessive calls to Is_Type.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_util.adb (Enter_Name): Remove unnecessary conditions in
+ Enter_Name that come from the beginning of times.
+
+2020-10-15 Bob Duff <duff@adacore.com>
+
+ * exp_ch6.adb (Expand_Simple_Function_Return): Remove DSP part
+ of comment, and reformat.
+
+2020-10-15 Boris Yakobowski <yakobowski@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference): Do not expand
+ 'Initialized in CodePeer mode.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch12.adb (Reset_Entity): Protect against malformed tree.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch13.adb (Add_Predicates): Prevent analyzing twice the
+ same pragma in case an inner package references the type with a
+ predicate (as opposed to defining the type).
+
+2020-10-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/a-cfinve.adb (Int): Use subtype of Long_Long_Integer.
+ * libgnat/a-cofove.adb (Int): Likewise.
+ * libgnat/a-cgcaso.adb (T): Likewise.
+ * libgnat/a-cogeso.adb (T): Likewise.
+ * libgnat/g-debpoo.ads (Byte_Count): Use Long_Long_Integer'Size.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch12.adb: Replace list of N_Defining_... enumerations with
+ N_Entity.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.ads, sem_ch3.adb (Make_Index): Refined type of
+ parameter.
+ (Constrain_Index): Likewise.
+ (Array_Type_Declaration): Refine type of a local counter
+ variable; remove a trivially useless initialization.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_ch3.adb (Analyze_Subtype_Declaration): Recognize both
+ identifiers and expanded names; use high-level Is_Scalar_Type
+ instead of low-level membership test.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_eval.adb (Eval_Intrinsic_Call, Fold_Shift): Add support
+ for Shift_Right_Arithmetic and for signed integers.
+ * exp_ch4.adb (Expand_N_Op_Rotate_Left,
+ Expand_N_Op_Rotate_Right, Expand_N_Op_Shift_Left,
+ Expand_N_Op_Shift_Right_Arithmetic): Minor reformatting and code
+ cleanup to ensure a consistent handling. Update comments and add
+ assertion.
+
+2020-10-15 Bob Duff <duff@adacore.com>
+
+ * sem_ch13.adb (Visible_Component): Enable this code for task
+ and protected types, as well as record and private types.
+ * sem_ch13.ads (Replace_Type_References_Generic): Update
+ comment. Move the efficiency comment into the body, because
+ it's about the implementation.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * par-ch13.adb (Get_Aspect_Specifications): Generate a warning
+ rather than an error on unknown aspects unless -gnatd2 is used.
+ (Aspect_Specifications_Present): Improve detection of unknown
+ aspects.
+ * debug.adb (Debug_Flag_2): Update document.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Do not try to inline intrinsic
+ calls.
+
+2020-10-15 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Expand_N_Aggregate): A record aggregate requires
+ a non-private type.
+ * sem_ch13.adb (Valid_Assign_Indexed): New subprogram local to
+ Resolve_Aspect_Aggregate, to handle the case when the
+ corresponding name appearing in the aspect specification for an
+ indexed aggregate is an overloaded operation.
+ * libgnat/a-convec.ads, libgnat/a-convec.adb,
+ libgnat/a-coinve.ads, libgnat/a-coinve.adb,
+ libgnat/a-cobove.ads, libgnat/a-cobove.adb,
+ libgnat/a-cdlili.ads, libgnat/a-cdlili.adb,
+ libgnat/a-cbdlli.ads, libgnat/a-cbdlli.adb,
+ libgnat/a-cohama.ads, libgnat/a-cihama.ads,
+ libgnat/a-cbhama.ads, libgnat/a-cborma.ads,
+ libgnat/a-ciorma.ads, libgnat/a-coorma.ads,
+ libgnat/a-cihase.ads, libgnat/a-cohase.ads,
+ libgnat/a-cbhase.ads, libgnat/a-cborse.ads,
+ libgnat/a-ciorse.ads, libgnat/a-coorse.ads: Add Ada_2020 aspect
+ Aggregate to types declared in standard containers, as well as
+ new subprograms where required.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * libgnat/g-arrspl.ads, libgnat/g-arrspl.adb (Create,
+ First_Cursor, Advance, Has_Element): New.
+
+2020-10-15 Arnaud Charlet <charlet@adacore.com>
+
+ * Makefile.rtl: Add target pair for interfac.ads.
+ * libgnat/interfac.ads: Add a comment.
+ * libgnat/interfac__2020.ads: New, used for bootstrap purposes.
+ * sem_util.adb (Is_Static_Function): Always return False for pre
+ Ada 2020 to e.g. ignore the Static aspect in Interfaces for
+ Ada < 2020.
+
+2020-10-15 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_util.adb (Remove_Side_Effects): Move special-casing for
+ GNATprove to be applied to all object declarations.
+
+2020-10-12 Alexandre Oliva <oliva@adacore.com>
+
+ * libgnat/a-ngelfu.ads (Sin, Cos): Make the single-argument
+ functions inline.
+
+2020-10-11 Alexandre Oliva <oliva@adacore.com>
+
+ * libgnat/a-numaux.ads: Make all imports Intrinsic.
+ * libgnat/a-numaux__darwin.ads: Likewise.
+ * libgnat/a-numaux__libc-x86.ads: Likewise.
+ * libgnat/a-numaux__vxworks.ads: Likewise.
+
+2020-09-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Set the end locus
+ of body and declaration earlier.
+
+2020-09-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (maybe_saturate_size): Add ALIGN parameter
+ and round down the result to ALIGN.
+ (gnat_to_gnu_entity): Adjust calls to maybe_saturate_size.
+
2020-09-14 Jakub Jelinek <jakub@redhat.com>
* gcc-interface/trans.c (gigi): Adjust build_optimization_node
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index fc978a2..7b5b334 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -206,6 +206,9 @@ GNATRTL_NONTASKING_OBJS= \
a-llitio$(objext) \
a-lliwti$(objext) \
a-llizti$(objext) \
+ a-llltio$(objext) \
+ a-lllwti$(objext) \
+ a-lllzti$(objext) \
a-locale$(objext) \
a-nbnbin$(objext) \
a-nbnbre$(objext) \
@@ -234,6 +237,13 @@ GNATRTL_NONTASKING_OBJS= \
a-nudira$(objext) \
a-nuelfu$(objext) \
a-nuflra$(objext) \
+ a-nagefl$(objext) \
+ a-nallfl$(objext) \
+ a-nalofl$(objext) \
+ a-nuaufl$(objext) \
+ a-nashfl$(objext) \
+ a-nuauco$(objext) \
+ a-naliop$(objext) \
a-numaux$(objext) \
a-numeri$(objext) \
a-nurear$(objext) \
@@ -340,7 +350,6 @@ GNATRTL_NONTASKING_OBJS= \
a-tigeau$(objext) \
a-tiinau$(objext) \
a-tiinio$(objext) \
- a-timoau$(objext) \
a-timoio$(objext) \
a-tiocst$(objext) \
a-tirsfi$(objext) \
@@ -368,7 +377,6 @@ GNATRTL_NONTASKING_OBJS= \
a-wtgeau$(objext) \
a-wtinau$(objext) \
a-wtinio$(objext) \
- a-wtmoau$(objext) \
a-wtmoio$(objext) \
a-wttest$(objext) \
a-wwboio$(objext) \
@@ -392,7 +400,6 @@ GNATRTL_NONTASKING_OBJS= \
a-ztgeau$(objext) \
a-ztinau$(objext) \
a-ztinio$(objext) \
- a-ztmoau$(objext) \
a-ztmoio$(objext) \
a-zttest$(objext) \
a-zzboio$(objext) \
@@ -511,6 +518,7 @@ GNATRTL_NONTASKING_OBJS= \
s-aoinar$(objext) \
s-aomoar$(objext) \
s-aotase$(objext) \
+ s-aridou$(objext) \
s-arit64$(objext) \
s-assert$(objext) \
s-atacco$(objext) \
@@ -575,6 +583,9 @@ GNATRTL_NONTASKING_OBJS= \
s-explli$(objext) \
s-expllu$(objext) \
s-expmod$(objext) \
+ s-exponn$(objext) \
+ s-expont$(objext) \
+ s-exponu$(objext) \
s-expuns$(objext) \
s-fatflt$(objext) \
s-fatgen$(objext) \
@@ -593,6 +604,10 @@ GNATRTL_NONTASKING_OBJS= \
s-geveop$(objext) \
s-gloloc$(objext) \
s-htable$(objext) \
+ s-imageb$(objext) \
+ s-imagei$(objext) \
+ s-imageu$(objext) \
+ s-imagew$(objext) \
s-imenne$(objext) \
s-imgbiu$(objext) \
s-imgboo$(objext) \
@@ -727,6 +742,8 @@ GNATRTL_NONTASKING_OBJS= \
s-vallli$(objext) \
s-valllu$(objext) \
s-valrea$(objext) \
+ s-valuei$(objext) \
+ s-valueu$(objext) \
s-valuns$(objext) \
s-valuti$(objext) \
s-valwch$(objext) \
@@ -741,8 +758,12 @@ GNATRTL_NONTASKING_OBJS= \
s-widboo$(objext) \
s-widcha$(objext) \
s-widenu$(objext) \
+ s-widint$(objext) \
s-widlli$(objext) \
s-widllu$(objext) \
+ s-widthi$(objext) \
+ s-widthu$(objext) \
+ s-widuns$(objext) \
s-widwch$(objext) \
s-wwdcha$(objext) \
s-wwdenu$(objext) \
@@ -799,7 +820,7 @@ GNATLIB_SHARED = gnatlib
# to LIBGNAT_TARGET_PAIRS.
GNATRTL_SOCKETS_OBJS = g-soccon$(objext) g-socket$(objext) g-socthi$(objext) \
- g-soliop$(objext) g-sothco$(objext)
+ g-soliop$(objext) g-sothco$(objext) g-socpol$(objext)
DUMMY_SOCKETS_TARGET_PAIRS = \
g-socket.adb<libgnat/g-socket__dummy.adb \
@@ -807,7 +828,9 @@ DUMMY_SOCKETS_TARGET_PAIRS = \
g-socthi.adb<libgnat/g-socthi__dummy.adb \
g-socthi.ads<libgnat/g-socthi__dummy.ads \
g-sothco.adb<libgnat/g-sothco__dummy.adb \
- g-sothco.ads<libgnat/g-sothco__dummy.ads
+ g-sothco.ads<libgnat/g-sothco__dummy.ads \
+ g-socpol.adb<libgnat/g-socpol__dummy.adb \
+ g-socpol.ads<libgnat/g-socpol__dummy.ads
# On platforms where atomic increment/decrement operations are supported,
# special version of Ada.Strings.Unbounded package can be used.
@@ -834,13 +857,11 @@ ATOMICS_BUILTINS_TARGET_PAIRS = \
# Special version of units for x86 and x86-64 platforms.
X86_TARGET_PAIRS = \
- a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
- a-numaux.adb<libgnat/a-numaux__dummy.adb \
+ a-nuauco.ads<libgnat/a-nuauco__x86.ads \
s-atocou.adb<libgnat/s-atocou__x86.adb
X86_64_TARGET_PAIRS = \
- a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
- a-numaux.adb<libgnat/a-numaux__dummy.adb \
+ a-nuauco.ads<libgnat/a-nuauco__x86.ads \
s-atocou.adb<libgnat/s-atocou__builtin.adb
# Implementation of symbolic traceback based on dwarf
@@ -862,6 +883,97 @@ TRASYM_DWARF_UNIX_OBJS = $(TRASYM_DWARF_COMMON_OBJS) s-mmauni$(objext)
TRASYM_DWARF_MINGW_OBJS = $(TRASYM_DWARF_COMMON_OBJS)
+GNATRTL_128BIT_PAIRS = \
+ a-tiinio.adb<libgnat/a-tiinio__128.adb \
+ a-timoio.adb<libgnat/a-timoio__128.adb \
+ a-wtinio.adb<libgnat/a-wtinio__128.adb \
+ a-wtmoio.adb<libgnat/a-wtmoio__128.adb \
+ a-ztinio.adb<libgnat/a-ztinio__128.adb \
+ a-ztmoio.adb<libgnat/a-ztmoio__128.adb \
+ i-cexten.ads<libgnat/i-cexten__128.ads \
+ s-scaval.ads<libgnat/s-scaval__128.ads \
+ s-scaval.adb<libgnat/s-scaval__128.adb
+
+# Objects needed for 128-bit types
+GNATRTL_128BIT_OBJS = \
+ s-arit128$(objext) \
+ s-casi128$(objext) \
+ s-caun128$(objext) \
+ s-exnllli$(objext) \
+ s-expllli$(objext) \
+ s-explllu$(objext) \
+ s-imglllb$(objext) \
+ s-imgllli$(objext) \
+ s-imglllu$(objext) \
+ s-imglllw$(objext) \
+ s-pack65$(objext) \
+ s-pack66$(objext) \
+ s-pack67$(objext) \
+ s-pack68$(objext) \
+ s-pack69$(objext) \
+ s-pack70$(objext) \
+ s-pack71$(objext) \
+ s-pack72$(objext) \
+ s-pack73$(objext) \
+ s-pack74$(objext) \
+ s-pack75$(objext) \
+ s-pack76$(objext) \
+ s-pack77$(objext) \
+ s-pack78$(objext) \
+ s-pack79$(objext) \
+ s-pack80$(objext) \
+ s-pack81$(objext) \
+ s-pack82$(objext) \
+ s-pack83$(objext) \
+ s-pack84$(objext) \
+ s-pack85$(objext) \
+ s-pack86$(objext) \
+ s-pack87$(objext) \
+ s-pack88$(objext) \
+ s-pack89$(objext) \
+ s-pack90$(objext) \
+ s-pack91$(objext) \
+ s-pack92$(objext) \
+ s-pack93$(objext) \
+ s-pack94$(objext) \
+ s-pack95$(objext) \
+ s-pack96$(objext) \
+ s-pack97$(objext) \
+ s-pack98$(objext) \
+ s-pack99$(objext) \
+ s-pack100$(objext) \
+ s-pack101$(objext) \
+ s-pack102$(objext) \
+ s-pack103$(objext) \
+ s-pack104$(objext) \
+ s-pack105$(objext) \
+ s-pack106$(objext) \
+ s-pack107$(objext) \
+ s-pack108$(objext) \
+ s-pack109$(objext) \
+ s-pack110$(objext) \
+ s-pack111$(objext) \
+ s-pack112$(objext) \
+ s-pack113$(objext) \
+ s-pack114$(objext) \
+ s-pack115$(objext) \
+ s-pack116$(objext) \
+ s-pack117$(objext) \
+ s-pack118$(objext) \
+ s-pack119$(objext) \
+ s-pack120$(objext) \
+ s-pack121$(objext) \
+ s-pack122$(objext) \
+ s-pack123$(objext) \
+ s-pack124$(objext) \
+ s-pack125$(objext) \
+ s-pack126$(objext) \
+ s-pack127$(objext) \
+ s-valllli$(objext) \
+ s-vallllu$(objext) \
+ s-widllli$(objext) \
+ s-widlllu$(objext)
+
# Shared library version
LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(GNAT_SRC)/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
@@ -916,7 +1028,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
- a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+ a-naliop.ads<libgnat/a-naliop__nolibm.ads \
+ a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+ a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
s-intman.ads<libgnarl/s-intman__vxworks.ads \
s-intman.adb<libgnarl/s-intman__vxworks.adb \
@@ -931,6 +1045,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
s-vxwork.ads<libgnarl/s-vxwork__ppc.ads \
g-socthi.ads<libgnat/g-socthi__vxworks.ads \
g-socthi.adb<libgnat/g-socthi__vxworks.adb \
+ g-sopowa.adb<libgnat/g-sopowa__posix.adb \
g-stsifd.adb<libgnat/g-stsifd__sockets.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS)
@@ -949,6 +1064,11 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
EXTRA_GNATRTL_NONTASKING_OBJS+=s-stchop.o
endif
+ ifeq ($(strip $(filter-out powerpc64, $(target_cpu))),)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+
TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
@@ -1039,7 +1159,9 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae vxworksaespe,$(target_cpu) $(t
LIBGNAT_TARGET_PAIRS = \
a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
- a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+ a-naliop.ads<libgnat/a-naliop__nolibm.ads \
+ a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+ a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
g-io.adb<hie/g-io__vxworks-cert.adb \
s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1084,6 +1206,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworksae vxworksaespe,$(target_cpu) $(t
LIBGNAT_TARGET_PAIRS += \
g-socthi.ads<libgnat/g-socthi__vxworks.ads \
g-socthi.adb<libgnat/g-socthi__vxworks.adb \
+ g-sopowa.adb<libgnat/g-sopowa__posix.adb \
g-stsifd.adb<libgnat/g-stsifd__sockets.adb
endif
@@ -1095,7 +1218,9 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae,$(target_cpu) $(target_vendor) $(ta
LIBGNAT_TARGET_PAIRS = \
a-elchha.adb<libgnat/a-elchha__vxworks-ppc-full.adb \
a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
- a-numaux.ads<libgnat/a-numaux__vxworks.ads \
+ a-naliop.ads<libgnat/a-naliop__nolibm.ads \
+ a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+ a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
g-io.adb<hie/g-io__vxworks-cert.adb \
s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
s-interr.adb<libgnarl/s-interr__vxworks.adb \
@@ -1140,6 +1265,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae,$(target_cpu) $(target_vendor) $(ta
LIBGNAT_TARGET_PAIRS += \
g-socthi.ads<libgnat/g-socthi__vxworks.ads \
g-socthi.adb<libgnat/g-socthi__vxworks.adb \
+ g-sopowa.adb<libgnat/g-sopowa__posix.adb \
g-stsifd.adb<libgnat/g-stsifd__sockets.adb
endif
@@ -1148,22 +1274,12 @@ endif
# x86/x86_64 VxWorks
ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7%,$(target_cpu) $(target_vendor) $(target_os))),)
- EH_MECHANISM=-gcc
-
- VX=$(strip $(if $(filter vxworks7%, $(target_os)), vxworks7, vxworks))
- SVX=system-$(VX)
-
- ifeq ($(strip $(filter-out x86_64, $(target_cpu))),)
- X86CPU=x86_64
- LIBGNAT_TARGET_PAIRS=$(X86_64_TARGET_PAIRS)
- else
- X86CPU=x86
- LIBGNAT_TARGET_PAIRS=$(X86_TARGET_PAIRS)
- endif
-
- LIBGNAT_TARGET_PAIRS+= \
+ LIBGNAT_TARGET_PAIRS= \
a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
i-vxwork.ads<libgnat/i-vxwork__x86.ads \
+ a-naliop.ads<libgnat/a-naliop__nolibm.ads \
+ a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+ a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
s-osinte.adb<libgnarl/s-osinte__vxworks.adb \
s-osinte.ads<libgnarl/s-osinte__vxworks.ads \
s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
@@ -1180,11 +1296,27 @@ ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7%,$(target_cpu) $(targ
s-vxwork.ads<libgnarl/s-vxwork__x86.ads \
g-socthi.ads<libgnat/g-socthi__vxworks.ads \
g-socthi.adb<libgnat/g-socthi__vxworks.adb \
+ g-sopowa.adb<libgnat/g-sopowa__posix.adb \
g-stsifd.adb<libgnat/g-stsifd__sockets.adb \
$(ATOMICS_TARGET_PAIRS)
+ VX=$(strip $(if $(filter vxworks7%, $(target_os)), vxworks7, vxworks))
+ SVX=system-$(VX)
+
+ ifeq ($(strip $(filter-out x86_64, $(target_cpu))),)
+ X86CPU=x86_64
+ LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ else
+ X86CPU=x86
+ LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
+ endif
+
TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
+
# The CPU setting for VxSim varies with the
# host (Windows or Linux)
# target (VxWorks6 or VxWorks7)
@@ -1264,7 +1396,7 @@ ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7%,$(target_cpu) $(targ
endif
endif
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
+ EXTRA_GNATRTL_NONTASKING_OBJS += i-vxwork.o i-vxwoio.o
endif
endif
@@ -1288,11 +1420,38 @@ endif
# ARM and Aarch64 VxWorks
ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
+ a-naliop.ads<libgnat/a-naliop__nolibm.ads \
+ a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+ a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
+ s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
+ s-interr.adb<libgnarl/s-interr__vxworks.adb \
+ s-intman.ads<libgnarl/s-intman__vxworks.ads \
+ s-intman.adb<libgnarl/s-intman__vxworks.adb \
+ s-osinte.adb<libgnarl/s-osinte__vxworks.adb \
+ s-osinte.ads<libgnarl/s-osinte__vxworks.ads \
+ s-osprim.adb<libgnat/s-osprim__vxworks.adb \
+ s-parame.ads<libgnat/s-parame__vxworks.ads \
+ s-parame.adb<libgnat/s-parame__vxworks.adb \
+ s-stchop.ads<libgnat/s-stchop__limit.ads \
+ s-stchop.adb<libgnat/s-stchop__vxworks.adb \
+ s-taprop.adb<libgnarl/s-taprop__vxworks.adb \
+ s-tasinf.ads<libgnarl/s-tasinf__vxworks.ads \
+ s-taspri.ads<libgnarl/s-taspri__vxworks.ads \
+ g-socthi.ads<libgnat/g-socthi__vxworks.ads \
+ g-socthi.adb<libgnat/g-socthi__vxworks.adb \
+ g-sopowa.adb<libgnat/g-sopowa__posix.adb \
+ g-stsifd.adb<libgnat/g-stsifd__sockets.adb
+
ifeq ($(strip $(filter-out aarch64, $(target_cpu))),)
ARCH_STR=aarch64
VX=vxworks7
EH_MECHANISM=-gcc
SIGTRAMP_OBJ=sigtramp-vxworks.o
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS) \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
else
ifeq ($(strip $(filter-out arm%, $(target_cpu))),)
ARCH_STR=arm
@@ -1310,29 +1469,9 @@ ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
endif
endif
- SVX=system-$(VX)
+ LIBGNAT_TARGET_PAIRS += s-vxwork.ads<libgnarl/s-vxwork__$(ARCH_STR).ads
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<libgnarl/a-intnam__vxworks.ads \
- a-numaux.ads<libgnat/a-numaux__vxworks.ads \
- s-inmaop.adb<libgnarl/s-inmaop__vxworks.adb \
- s-interr.adb<libgnarl/s-interr__vxworks.adb \
- s-intman.ads<libgnarl/s-intman__vxworks.ads \
- s-intman.adb<libgnarl/s-intman__vxworks.adb \
- s-osinte.adb<libgnarl/s-osinte__vxworks.adb \
- s-osinte.ads<libgnarl/s-osinte__vxworks.ads \
- s-osprim.adb<libgnat/s-osprim__vxworks.adb \
- s-parame.ads<libgnat/s-parame__vxworks.ads \
- s-parame.adb<libgnat/s-parame__vxworks.adb \
- s-stchop.ads<libgnat/s-stchop__limit.ads \
- s-stchop.adb<libgnat/s-stchop__vxworks.adb \
- s-taprop.adb<libgnarl/s-taprop__vxworks.adb \
- s-tasinf.ads<libgnarl/s-tasinf__vxworks.ads \
- s-taspri.ads<libgnarl/s-taspri__vxworks.ads \
- s-vxwork.ads<libgnarl/s-vxwork__$(ARCH_STR).ads \
- g-socthi.ads<libgnat/g-socthi__vxworks.ads \
- g-socthi.adb<libgnat/g-socthi__vxworks.adb \
- g-stsifd.adb<libgnat/g-stsifd__sockets.adb
+ SVX=system-$(VX)
TOOLS_TARGET_PAIRS=indepsw.adb<indepsw-gnu.adb
@@ -1377,9 +1516,8 @@ ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
endif
endif
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o \
- s-stchop.o
- EXTRA_GNATRTL_TASKING_OBJS=i-vxinco.o s-vxwork.o s-vxwext.o
+ EXTRA_GNATRTL_NONTASKING_OBJS += i-vxwork.o i-vxwoio.o s-stchop.o
+ EXTRA_GNATRTL_TASKING_OBJS += i-vxinco.o s-vxwork.o s-vxwext.o
EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
@@ -1429,6 +1567,7 @@ endif
ifeq ($(strip $(filter-out aarch64 %qnx,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__qnx.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__qnx.adb \
s-osinte.adb<libgnarl/s-osinte__qnx.adb \
@@ -1441,10 +1580,12 @@ ifeq ($(strip $(filter-out aarch64 %qnx,$(target_cpu) $(target_os))),)
g-soliop.ads<libgnat/g-soliop__qnx.ads \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-qnx-aarch64.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
EXTRA_GNATRTL_TASKING_OBJS=s-qnx.o
EXTRA_LIBGNAT_OBJS+=sigtramp-qnx.o
EXTRA_LIBGNAT_SRCS+=sigtramp.h
@@ -1457,10 +1598,11 @@ ifeq ($(strip $(filter-out aarch64 %qnx,$(target_cpu) $(target_os))),)
LIBRARY_VERSION := $(LIB_VERSION)
endif
-# Sparc Solaris
+# SPARC Solaris
ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__solaris.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__solaris.adb \
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
@@ -1480,6 +1622,18 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(
EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
+ ifeq ($(strip $(filter-out sparc64 sparcv9,$(target_cpu))),)
+ ifneq ($(strip $(MULTISUBDIR)),/sparcv8plus)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ else
+ ifeq ($(strip $(MULTISUBDIR)),/sparcv9)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ endif
+
EH_MECHANISM=-gcc
THREADSLIB = -lposix4 -lthread
MISCLIB = -lposix4 -lnsl -lsocket
@@ -1489,7 +1643,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(
LIBRARY_VERSION := $(LIB_VERSION)
endif
-# x86 and x86-64 solaris
+# x86 and x86-64 Solaris
ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<libgnarl/a-intnam__solaris.ads \
@@ -1513,6 +1667,8 @@ ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),)
ifeq ($(strip $(MULTISUBDIR)),/amd64)
LIBGNAT_TARGET_PAIRS = \
$(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
else
LIBGNAT_TARGET_PAIRS = \
$(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_TARGET_PAIRS)
@@ -1524,6 +1680,8 @@ ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),)
else
LIBGNAT_TARGET_PAIRS = \
$(LIBGNAT_TARGET_PAIRS_COMMON) $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
endif
endif
@@ -1559,6 +1717,8 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
ifeq ($(strip $(MULTISUBDIR)),/64)
LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
else
LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
endif
@@ -1648,8 +1808,6 @@ endif
ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
- a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
- a-numaux.adb<libgnat/a-numaux__dummy.adb \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__posix.adb \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -1658,8 +1816,13 @@ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
s-taprop.adb<libgnarl/s-taprop__posix.adb \
s-taspri.ads<libgnarl/s-taspri__posix.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(X86_64_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-freebsd.ads
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
+
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EH_MECHANISM=-gcc
@@ -1673,6 +1836,7 @@ endif
ifeq ($(strip $(filter-out %aarch64 freebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__freebsd.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__posix.adb \
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
@@ -1684,8 +1848,11 @@ ifeq ($(strip $(filter-out %aarch64 freebsd%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-freebsd.ads
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
+
GNATLIB_SHARED = gnatlib-shared-dual
EH_MECHANISM=-gcc
@@ -1741,12 +1908,14 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
$(TRASYM_DWARF_UNIX_PAIRS) \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-freebsd.ads
GNATLIB_SHARED = gnatlib-shared-dual
EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
EH_MECHANISM=-gcc
THREADSLIB= -lpthread
@@ -1770,11 +1939,13 @@ ifeq ($(strip $(filter-out %86_64 dragonfly%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-dragonfly-x86_64.ads
GNATLIB_SHARED = gnatlib-shared-dual
- EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
EH_MECHANISM=-gcc
THREADSLIB= -lpthread
@@ -1787,6 +1958,7 @@ endif
ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__posix.adb \
s-linux.ads<libgnarl/s-linux.ads \
@@ -1800,6 +1972,18 @@ ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
system.ads<libgnat/system-linux-s390.ads
+ ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
+ ifneq ($(strip $(MULTISUBDIR)),/32)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ else
+ ifeq ($(strip $(MULTISUBDIR)),/64)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ endif
+
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
@@ -1812,7 +1996,6 @@ endif
# HP/PA HP-UX 10
ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
- a-excpol.adb<libgnat/a-excpol__abort.adb \
a-intnam.ads<libgnarl/a-intnam__hpux.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-interr.adb<libgnarl/s-interr__sigaction.adb \
@@ -1897,6 +2080,9 @@ ifeq ($(strip $(filter-out lynxos178%,$(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__lynxos.ads \
+ a-nuaufl.ads<libgnat/a-nuaufl__wraplf.ads \
+ a-nashfl.ads<libgnat/a-nashfl__wraplf.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
g-soliop.ads<libgnat/g-soliop__lynxos.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__lynxos.adb \
@@ -1988,11 +2174,11 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
else
LIBGNAT_TARGET_PAIRS = \
g-socthi.ads<libgnat/g-socthi__mingw.ads \
- g-socthi.adb<libgnat/g-socthi__mingw.adb
+ g-socthi.adb<libgnat/g-socthi__mingw.adb \
+ g-sopowa.adb<libgnat/g-sopowa__mingw.adb
endif
LIBGNAT_TARGET_PAIRS += \
a-dirval.adb<libgnat/a-dirval__mingw.adb \
- a-excpol.adb<libgnat/a-excpol__abort.adb \
s-gloloc.adb<libgnat/s-gloloc__mingw.adb \
s-inmaop.adb<libgnarl/s-inmaop__dummy.adb \
s-taspri.ads<libgnarl/s-taspri__mingw.ads \
@@ -2022,12 +2208,14 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
SO_OPTS= -m32 -Wl,-soname,
else
- LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS) $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
SO_OPTS = -m64 -Wl,-soname,
endif
else
ifeq ($(strip $(MULTISUBDIR)),/64)
- LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS) $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
SO_OPTS = -m64 -Wl,-soname,
else
LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
@@ -2086,10 +2274,11 @@ endif
# PowerPC and e500v2 Linux
ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
- LIBGNAT_TARGET_PAIRS_COMMON = \
+ LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
a-synbar.adb<libgnarl/a-synbar__posix.adb \
a-synbar.ads<libgnarl/a-synbar__posix.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
@@ -2097,21 +2286,30 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-linux.ads<libgnarl/s-linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+ s-mudido.adb<libgnarl/s-mudido__affinity.adb \
+ s-osinte.ads<libgnarl/s-osinte__linux.ads \
+ s-osprim.adb<libgnat/s-osprim__posix.adb \
+ s-taprop.adb<libgnarl/s-taprop__linux.adb \
+ s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
+ s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
+ s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
s-tsmona.adb<libgnat/s-tsmona__linux.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
- LIBGNAT_TARGET_PAIRS = \
- $(LIBGNAT_TARGET_PAIRS_COMMON) \
- s-mudido.adb<libgnarl/s-mudido__affinity.adb \
- s-osinte.ads<libgnarl/s-osinte__linux.ads \
- s-osprim.adb<libgnat/s-osprim__posix.adb \
- s-taprop.adb<libgnarl/s-taprop__linux.adb \
- s-tasinf.ads<libgnarl/s-tasinf__linux.ads \
- s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
- s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads
+ ifeq ($(strip $(filter-out powerpc64,$(target_cpu))),)
+ ifneq ($(strip $(MULTISUBDIR)),/32)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ else
+ ifeq ($(strip $(MULTISUBDIR)),/64)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ endif
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2161,6 +2359,7 @@ ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
a-synbar.adb<libgnarl/a-synbar__posix.adb \
a-synbar.ads<libgnarl/a-synbar__posix.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
@@ -2177,10 +2376,12 @@ ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-linux-arm.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
EH_MECHANISM=-gcc
THREADSLIB=-lpthread -lrt
@@ -2189,10 +2390,11 @@ ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
LIBRARY_VERSION := $(LIB_VERSION)
endif
-# Sparc Linux
+# SPARC Linux
ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
s-intman.adb<libgnarl/s-intman__posix.adb \
s-linux.ads<libgnarl/s-linux__sparc.ads \
@@ -2206,6 +2408,18 @@ ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
system.ads<libgnat/system-linux-sparc.ads
+ ifeq ($(strip $(filter-out sparc64 sparcv9,$(target_cpu))),)
+ ifneq ($(strip $(MULTISUBDIR)),/32)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ else
+ ifeq ($(strip $(MULTISUBDIR)),/64)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ endif
+
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
@@ -2304,7 +2518,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
a-exetim.adb<libgnarl/a-exetim__posix.adb \
a-exetim.ads<libgnarl/a-exetim__default.ads \
a-intnam.ads<libgnarl/a-intnam__linux.ads \
- a-numaux.ads<libgnat/a-numaux__libc-x86.ads \
+ a-nuauco.ads<libgnat/a-nuauco__x86.ads \
a-synbar.adb<libgnarl/a-synbar__posix.adb \
a-synbar.ads<libgnarl/a-synbar__posix.ads \
s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
@@ -2323,11 +2537,13 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
s-tsmona.adb<libgnat/s-tsmona__linux.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-linux-ia64.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
EH_MECHANISM=-gcc
THREADSLIB=-lpthread -lrt
@@ -2352,9 +2568,11 @@ ifeq ($(strip $(filter-out ia64% hp hpux%,$(target_cpu) $(target_vendor) $(targe
$(TRASYM_DWARF_UNIX_PAIRS) \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-hpux-ia64.ads
EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
MISCLIB=
EH_MECHANISM=-gcc
@@ -2383,10 +2601,12 @@ ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-linux-alpha.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
+ EXTRA_GNATRTL_NONTASKING_OBJS = $(GNATRTL_128BIT_OBJS)
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
EH_MECHANISM=-gcc
MISCLIB=
@@ -2419,12 +2639,14 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
s-tsmona.adb<libgnat/s-tsmona__linux.adb \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
system.ads<libgnat/system-linux-x86.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
EXTRA_GNATRTL_NONTASKING_OBJS += $(TRASYM_DWARF_UNIX_OBJS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o a-exetim.o
EH_MECHANISM=-gcc
@@ -2488,6 +2710,18 @@ ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
system.ads<libgnat/system-linux-riscv.ads
+ ifeq ($(strip $(filter-out riscv64,$(target_cpu))),)
+ ifneq ($(strip $(MULTISUBDIR)),/lib32)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ else
+ ifeq ($(strip $(MULTISUBDIR)),/lib64)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
+ endif
+
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
@@ -2521,11 +2755,13 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),)
ifeq ($(strip $(MULTISUBDIR)),/x86_64)
SO_OPTS += -m64
LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
else
LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
endif
- EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
endif
ifeq ($(strip $(filter-out %x86_64,$(target_cpu))),)
@@ -2542,18 +2778,19 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),)
LIBGNAT_TARGET_PAIRS += $(X86_TARGET_PAIRS)
else
LIBGNAT_TARGET_PAIRS += $(X86_64_TARGET_PAIRS)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
endif
- EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_NONTASKING_OBJS += g-sse.o g-ssvety.o
EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o
endif
ifeq ($(strip $(filter-out powerpc%,$(target_cpu))),)
LIBGNAT_TARGET_PAIRS += \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-intman.adb<libgnarl/s-intman__posix.adb \
s-osprim.adb<libgnat/s-osprim__posix.adb \
- a-numaux.ads<libgnat/a-numaux__darwin.ads \
- a-numaux.adb<libgnat/a-numaux__darwin.adb \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-darwin-ppc.ads
@@ -2576,11 +2813,14 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),)
ifeq ($(strip $(filter-out arm64 aarch64,$(target_cpu))),)
LIBGNAT_TARGET_PAIRS += \
+ a-nallfl.ads<libgnat/a-nallfl__wraplf.ads \
s-intman.adb<libgnarl/s-intman__susv3.adb \
s-osprim.adb<libgnat/s-osprim__darwin.adb \
$(ATOMICS_TARGET_PAIRS) \
- $(ATOMICS_BUILTINS_TARGET_PAIRS)
+ $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
EXTRA_LIBGNAT_OBJS+=sigtramp-ios.o
EXTRA_LIBGNAT_SRCS+=sigtramp.h
LIBGNAT_TARGET_PAIRS += \
@@ -2618,6 +2858,9 @@ ifeq ($(strip $(filter-out linux%,$(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb
endif
+LIBGNAT_TARGET_PAIRS += \
+ interfac.ads<libgnat/interfac__2020.ads
+
# LIBGNAT_SRCS is the list of all C files (including headers) of the runtime
# library. LIBGNAT_OBJS is the list of object files for libgnat.
# thread.c is special as put into GNATRTL_TASKING_OBJS
diff --git a/gcc/ada/ada_get_targ.adb b/gcc/ada/ada_get_targ.adb
index cb2d81f..ddaca1a 100644
--- a/gcc/ada/ada_get_targ.adb
+++ b/gcc/ada/ada_get_targ.adb
@@ -100,6 +100,15 @@ package body Get_Targ is
return 64;
end Get_Long_Long_Size;
+ -----------------------------
+ -- Get_Long_Long_Long_Size --
+ -----------------------------
+
+ function Get_Long_Long_Long_Size return Pos is
+ begin
+ return 64;
+ end Get_Long_Long_Long_Size;
+
----------------------
-- Get_Pointer_Size --
----------------------
@@ -118,15 +127,6 @@ package body Get_Targ is
return 4;
end Get_Maximum_Alignment;
- ------------------------------------
- -- Get_System_Allocator_Alignment --
- ------------------------------------
-
- function Get_System_Allocator_Alignment return Nat is
- begin
- return 1;
- end Get_System_Allocator_Alignment;
-
------------------------
-- Get_Float_Words_BE --
------------------------
@@ -181,6 +181,15 @@ package body Get_Targ is
return 1;
end Get_Strict_Alignment;
+ ------------------------------------
+ -- Get_System_Allocator_Alignment --
+ ------------------------------------
+
+ function Get_System_Allocator_Alignment return Nat is
+ begin
+ return 1;
+ end Get_System_Allocator_Alignment;
+
--------------------------------
-- Get_Double_Float_Alignment --
--------------------------------
@@ -199,15 +208,6 @@ package body Get_Targ is
return 0;
end Get_Double_Scalar_Alignment;
- -----------------------------
- -- Get_Max_Unaligned_Field --
- -----------------------------
-
- function Get_Max_Unaligned_Field return Pos is
- begin
- return 64; -- Can be different on some targets (e.g., AAMP)
- end Get_Max_Unaligned_Field;
-
----------------------
-- Digits_From_Size --
----------------------
@@ -225,6 +225,15 @@ package body Get_Targ is
end Digits_From_Size;
-----------------------------
+ -- Get_Max_Unaligned_Field --
+ -----------------------------
+
+ function Get_Max_Unaligned_Field return Pos is
+ begin
+ return 64; -- Can be different on some targets (e.g., AAMP)
+ end Get_Max_Unaligned_Field;
+
+ -----------------------------
-- Register_Back_End_Types --
-----------------------------
@@ -255,13 +264,14 @@ package body Get_Targ is
-- Width_From_Size --
---------------------
- function Width_From_Size (Size : Pos) return Pos is
+ function Width_From_Size (Size : Pos) return Pos is
begin
case Size is
- when 8 => return 4;
- when 16 => return 6;
- when 32 => return 11;
- when 64 => return 21;
+ when 8 => return 4;
+ when 16 => return 6;
+ when 32 => return 11;
+ when 64 => return 21;
+ when 128 => return 40;
when others => raise Program_Error;
end case;
end Width_From_Size;
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index c44d193..560f352 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -60,6 +60,7 @@
/* We want to use the POSIX variants of include files. */
#define POSIX
#include "vxWorks.h"
+#include <sys/time.h>
#if defined (__mips_vxworks)
#include "cacheLib.h"
@@ -236,6 +237,11 @@ UINT __gnat_current_ccs_encoding;
#include "adaint.h"
+#if defined (__APPLE__) && defined (st_mtime)
+#define st_atim st_atimespec
+#define st_mtim st_mtimespec
+#endif
+
/* Define symbols O_BINARY and O_TEXT as harmless zeroes if they are not
defined in the current system. On DOS-like systems these flags control
whether the file is opened/created in text-translation mode (CR/LF in
@@ -1474,6 +1480,84 @@ __gnat_file_time_fd (int fd)
return __gnat_file_time_fd_attr (fd, &attr);
}
+extern long long __gnat_file_time(char* name)
+{
+ long long result;
+
+ if (name == NULL) {
+ return LLONG_MIN;
+ }
+ /* Number of seconds between <Jan 1st 1970> and <Jan 1st 2150>. */
+ static const long long ada_epoch_offset = (136 * 365 + 44 * 366) * 86400LL;
+#if defined(_WIN32)
+
+ /* Number of 100 nanoseconds between <Jan 1st 1601> and <Jan 1st 2150>. */
+ static const long long w32_epoch_offset =
+ (11644473600LL + ada_epoch_offset) * 1E7;
+
+ WIN32_FILE_ATTRIBUTE_DATA fad;
+ union
+ {
+ FILETIME ft_time;
+ long long ll_time;
+ } t_write;
+
+ if (!GetFileAttributesExA(name, GetFileExInfoStandard, &fad)) {
+ return LLONG_MIN;
+ }
+
+ t_write.ft_time = fad.ftLastWriteTime;
+
+#if defined(__GNUG__) && __GNUG__ <= 4
+ result = (t_write.ll_time - w32_epoch_offset) * 100;
+#else
+ /* Next code similar to (t_write.ll_time - w32_epoch_offset) * 100
+ but on overflow returns LLONG_MIN value. */
+
+ if (__builtin_ssubll_overflow(t_write.ll_time, w32_epoch_offset, &result)) {
+ return LLONG_MIN;
+ }
+
+ if (__builtin_smulll_overflow(result, 100, &result)) {
+ return LLONG_MIN;
+ }
+#endif
+
+#else
+
+ struct stat sb;
+ if (stat(name, &sb) != 0) {
+ return LLONG_MIN;
+ }
+
+#if defined(__GNUG__) && __GNUG__ <= 4
+ result = (sb.st_mtime - ada_epoch_offset) * 1E9;
+#if defined(st_mtime)
+ result += sb.st_mtim.tv_nsec;
+#endif
+#else
+ /* Next code similar to
+ (sb.st_mtime - ada_epoch_offset) * 1E9 + sb.st_mtim.tv_nsec
+ but on overflow returns LLONG_MIN value. */
+
+ if (__builtin_ssubll_overflow(sb.st_mtime, ada_epoch_offset, &result)) {
+ return LLONG_MIN;
+ }
+
+ if (__builtin_smulll_overflow(result, 1E9, &result)) {
+ return LLONG_MIN;
+ }
+
+#if defined(st_mtime)
+ if (__builtin_saddll_overflow(result, sb.st_mtim.tv_nsec, &result)) {
+ return LLONG_MIN;
+ }
+#endif
+#endif
+#endif
+ return result;
+}
+
/* Set the file time stamp. */
void
@@ -3173,22 +3257,45 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
#else
GNAT_STRUCT_STAT fbuf;
- struct utimbuf tbuf;
if (GNAT_STAT (from, &fbuf) == -1) {
return -1;
}
- /* Do we need to copy timestamp ? */
+#if _POSIX_C_SOURCE >= 200809L
+ struct timespec tbuf[2];
+
if (mode != 2) {
- tbuf.actime = fbuf.st_atime;
- tbuf.modtime = fbuf.st_mtime;
+ tbuf[0] = fbuf.st_atim;
+ tbuf[1] = fbuf.st_mtim;
- if (utime (to, &tbuf) == -1) {
+ if (utimensat (AT_FDCWD, to, tbuf, 0) == -1) {
return -1;
}
}
+#else
+ struct timeval tbuf[2];
+ /* Do we need to copy timestamp ? */
+
+ if (mode != 2) {
+ tbuf[0].tv_sec = fbuf.st_atime;
+ tbuf[1].tv_sec = fbuf.st_mtime;
+
+ #if defined(st_mtime)
+ tbuf[0].tv_usec = fbuf.st_atim.tv_nsec / 1000;
+ tbuf[1].tv_usec = fbuf.st_mtim.tv_nsec / 1000;
+ #else
+ tbuf[0].tv_usec = 0;
+ tbuf[1].tv_usec = 0;
+ #endif
+
+ if (utimes (to, tbuf) == -1) {
+ return -1;
+ }
+ }
+#endif
+
/* Do we need to copy file permissions ? */
if (mode != 0 && (chmod (to, fbuf.st_mode) == -1)) {
return -1;
diff --git a/gcc/ada/ali-util.adb b/gcc/ada/ali-util.adb
index ec7ec2f..9dcc656 100644
--- a/gcc/ada/ali-util.adb
+++ b/gcc/ada/ali-util.adb
@@ -179,7 +179,7 @@ package body ALI.Util is
function Hash (F : File_Name_Type) return Header_Num is
begin
- return Header_Num (Int (F) rem Header_Num'Range_Length);
+ return Header_Num (Int (F) mod Header_Num'Range_Length);
end Hash;
---------------------------
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index 6b0d6c7..3bf1257 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -590,7 +590,8 @@ package body ALI is
-- scope__name__line_column__locations
--
-- * The String is converted into a Name_Id
- -- * The Name_Id is used as the hash
+ --
+ -- * The absolute value of the Name_Id is used as the hash
Append (Buffer, IS_Rec.Scope);
Append (Buffer, "__");
@@ -606,7 +607,7 @@ package body ALI is
end if;
IS_Nam := Name_Find (Buffer);
- return Bucket_Range_Type (IS_Nam);
+ return Bucket_Range_Type (abs IS_Nam);
end Hash;
--------------------
diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads
index 4578d56..e7b5bca 100644
--- a/gcc/ada/alloc.ads
+++ b/gcc/ada/alloc.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb
index c222c33..37bbcae 100644
--- a/gcc/ada/aspects.adb
+++ b/gcc/ada/aspects.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -455,6 +449,7 @@ package body Aspects is
N_Package_Instantiation => True,
N_Package_Specification => True,
N_Package_Renaming_Declaration => True,
+ N_Parameter_Specification => True,
N_Private_Extension_Declaration => True,
N_Private_Type_Declaration => True,
N_Procedure_Instantiation => True,
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads
index 0394106..1470efe 100644
--- a/gcc/ada/aspects.ads
+++ b/gcc/ada/aspects.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -153,6 +147,7 @@ package Aspects is
Aspect_Storage_Size,
Aspect_Stream_Size,
Aspect_String_Literal,
+ Aspect_Subprogram_Variant, -- GNAT
Aspect_Suppress,
Aspect_Synchronization,
Aspect_Test_Case, -- GNAT
@@ -190,8 +185,10 @@ package Aspects is
Aspect_Disable_Controlled, -- GNAT
Aspect_Discard_Names,
Aspect_CUDA_Global, -- GNAT
+ Aspect_Exclusive_Functions,
Aspect_Export,
Aspect_Favor_Top_Level, -- GNAT
+ Aspect_Full_Access_Only,
Aspect_Independent,
Aspect_Independent_Components,
Aspect_Import,
@@ -227,6 +224,16 @@ package Aspects is
Aspect_Id range Aspect_Id'Succ (No_Aspect) .. Aspect_Id'Last;
-- Aspect_Id's excluding No_Aspect
+ subtype Nonoverridable_Aspect_Id is Aspect_Id with
+ Static_Predicate => Nonoverridable_Aspect_Id in
+ Aspect_Default_Iterator | Aspect_Iterator_Element |
+ Aspect_Implicit_Dereference | Aspect_Constant_Indexing |
+ Aspect_Variable_Indexing | Aspect_Aggregate |
+ Aspect_Max_Entry_Queue_Length
+ -- | Aspect_No_Controlled_Parts
+ -- ??? No_Controlled_Parts not yet in Aspect_Id enumeration
+ ; -- see RM 13.1.1(18.7)
+
-- The following array indicates aspects that accept 'Class
Class_Aspect_OK : constant array (Aspect_Id) of Boolean :=
@@ -425,6 +432,7 @@ package Aspects is
Aspect_Storage_Size => Expression,
Aspect_Stream_Size => Expression,
Aspect_String_Literal => Name,
+ Aspect_Subprogram_Variant => Expression,
Aspect_Suppress => Name,
Aspect_Synchronization => Name,
Aspect_Test_Case => Expression,
@@ -472,6 +480,7 @@ package Aspects is
Aspect_Dynamic_Predicate => False,
Aspect_Effective_Reads => False,
Aspect_Effective_Writes => False,
+ Aspect_Exclusive_Functions => False,
Aspect_Extensions_Visible => False,
Aspect_External_Name => False,
Aspect_External_Tag => False,
@@ -524,6 +533,7 @@ package Aspects is
Aspect_Storage_Size => True,
Aspect_Stream_Size => True,
Aspect_String_Literal => False,
+ Aspect_Subprogram_Variant => False,
Aspect_Suppress => False,
Aspect_Synchronization => False,
Aspect_Test_Case => False,
@@ -545,6 +555,7 @@ package Aspects is
Aspect_Discard_Names => True,
Aspect_Export => True,
Aspect_Favor_Top_Level => False,
+ Aspect_Full_Access_Only => True,
Aspect_Independent => True,
Aspect_Independent_Components => True,
Aspect_Import => True,
@@ -619,11 +630,13 @@ package Aspects is
Aspect_Effective_Reads => Name_Effective_Reads,
Aspect_Effective_Writes => Name_Effective_Writes,
Aspect_Elaborate_Body => Name_Elaborate_Body,
+ Aspect_Exclusive_Functions => Name_Exclusive_Functions,
Aspect_Export => Name_Export,
Aspect_Extensions_Visible => Name_Extensions_Visible,
Aspect_External_Name => Name_External_Name,
Aspect_External_Tag => Name_External_Tag,
Aspect_Favor_Top_Level => Name_Favor_Top_Level,
+ Aspect_Full_Access_Only => Name_Full_Access_Only,
Aspect_Ghost => Name_Ghost,
Aspect_Global => Name_Global,
Aspect_Implicit_Dereference => Name_Implicit_Dereference,
@@ -697,6 +710,7 @@ package Aspects is
Aspect_Storage_Size => Name_Storage_Size,
Aspect_Stream_Size => Name_Stream_Size,
Aspect_String_Literal => Name_String_Literal,
+ Aspect_Subprogram_Variant => Name_Subprogram_Variant,
Aspect_Suppress => Name_Suppress,
Aspect_Suppress_Debug_Info => Name_Suppress_Debug_Info,
Aspect_Suppress_Initialization => Name_Suppress_Initialization,
@@ -851,6 +865,7 @@ package Aspects is
Aspect_Dispatching_Domain => Always_Delay,
Aspect_Dynamic_Predicate => Always_Delay,
Aspect_Elaborate_Body => Always_Delay,
+ Aspect_Exclusive_Functions => Always_Delay,
Aspect_External_Name => Always_Delay,
Aspect_External_Tag => Always_Delay,
Aspect_Favor_Top_Level => Always_Delay,
@@ -951,6 +966,7 @@ package Aspects is
Aspect_Relaxed_Initialization => Never_Delay,
Aspect_SPARK_Mode => Never_Delay,
Aspect_Static => Never_Delay,
+ Aspect_Subprogram_Variant => Never_Delay,
Aspect_Synchronization => Never_Delay,
Aspect_Test_Case => Never_Delay,
Aspect_Unimplemented => Never_Delay,
@@ -963,6 +979,7 @@ package Aspects is
Aspect_Atomic_Components => Rep_Aspect,
Aspect_Bit_Order => Rep_Aspect,
Aspect_Component_Size => Rep_Aspect,
+ Aspect_Full_Access_Only => Rep_Aspect,
Aspect_Machine_Radix => Rep_Aspect,
Aspect_Object_Size => Rep_Aspect,
Aspect_Pack => Rep_Aspect,
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 7e05a48..d3d40d9 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -57,7 +51,8 @@ package body Atree is
-- assertions this lock has no effect.
Reporting_Proc : Report_Proc := null;
- -- Record argument to last call to Set_Reporting_Proc
+ -- Set_Reporting_Proc sets this. Set_Reporting_Proc must be called only
+ -- once.
Rewriting_Proc : Rewrite_Proc := null;
-- This soft link captures the procedure invoked during a node rewrite
@@ -113,16 +108,11 @@ package body Atree is
procedure Node_Debug_Output (Op : String; N : Node_Id);
-- Called by nnd; writes Op followed by information about N
- procedure Print_Statistics;
- pragma Export (Ada, Print_Statistics);
- -- Print various statistics on the tables maintained by the package
-
-----------------------------
-- Local Objects and Types --
-----------------------------
- Node_Count : Nat;
- -- Count allocated nodes for Num_Nodes function
+ Comes_From_Source_Default : Boolean := False;
use Unchecked_Access;
-- We are allowed to see these from within our own body
@@ -504,7 +494,7 @@ package body Atree is
-- Note: eventually, this should be a field in the Node directly, but
-- for now we do not want to disturb the efficiency of a power of 2
- -- for the node size
+ -- for the node size. ????We are planning to get rid of power-of-2.
package Orig_Nodes is new Table.Table (
Table_Component_Type => Node_Id,
@@ -541,15 +531,19 @@ package body Atree is
Table_Increment => 200,
Table_Name => "Paren_Counts");
+ procedure Set_Paren_Count_Of_Copy (Target, Source : Node_Id);
+ pragma Inline (Set_Paren_Count_Of_Copy);
+ -- Called when copying a node. Makes sure the Paren_Count of the copy is
+ -- correct.
+
-----------------------
-- Local Subprograms --
-----------------------
- function Allocate_Initialize_Node
- (Src : Node_Id;
- With_Extension : Boolean) return Node_Id;
- -- Allocate a new node or node extension. If Src is not empty, the
- -- information for the newly-allocated node is copied from it.
+ function Allocate_New_Node return Node_Id;
+ pragma Inline (Allocate_New_Node);
+ -- Allocate a new node or first part of a node extension. Initialize the
+ -- Nodes.Table entry, Flags, Orig_Nodes, and List tables.
procedure Fix_Parents (Ref_Node, Fix_Node : Node_Id);
-- Fix up parent pointers for the syntactic children of Fix_Node after a
@@ -559,79 +553,28 @@ package body Atree is
-- Mark arbitrary node or entity N as Ghost when it is created within a
-- Ghost region.
- ------------------------------
- -- Allocate_Initialize_Node --
- ------------------------------
+ procedure Report (Target, Source : Node_Id);
+ pragma Inline (Report);
+ -- Invoke the reporting procedure if available
- function Allocate_Initialize_Node
- (Src : Node_Id;
- With_Extension : Boolean) return Node_Id
- is
- New_Id : Node_Id;
+ -----------------------
+ -- Allocate_New_Node --
+ -----------------------
+ function Allocate_New_Node return Node_Id is
+ New_Id : Node_Id;
begin
- if Present (Src)
- and then not Has_Extension (Src)
- and then With_Extension
- and then Src = Nodes.Last
- then
- New_Id := Src;
-
- -- We are allocating a new node, or extending a node other than
- -- Nodes.Last.
-
- else
- if Present (Src) then
- Nodes.Append (Nodes.Table (Src));
- Flags.Append (Flags.Table (Src));
- else
- Nodes.Append (Default_Node);
- Flags.Append (Default_Flags);
- end if;
-
- New_Id := Nodes.Last;
- Orig_Nodes.Append (New_Id);
- Node_Count := Node_Count + 1;
- end if;
-
- -- Clear Check_Actuals to False
-
- Set_Check_Actuals (New_Id, False);
-
- -- Specifically copy Paren_Count to deal with creating new table entry
- -- if the parentheses count is at the maximum possible value already.
-
- if Present (Src) and then Nkind (Src) in N_Subexpr then
- Set_Paren_Count (New_Id, Paren_Count (Src));
- end if;
-
- -- Set extension nodes if required
-
- if With_Extension then
- if Present (Src) and then Has_Extension (Src) then
- for J in 1 .. Num_Extension_Nodes loop
- Nodes.Append (Nodes.Table (Src + J));
- Flags.Append (Flags.Table (Src + J));
- end loop;
- else
- for J in 1 .. Num_Extension_Nodes loop
- Nodes.Append (Default_Node_Extension);
- Flags.Append (Default_Flags);
- end loop;
- end if;
- end if;
-
- Orig_Nodes.Set_Last (Nodes.Last);
+ Nodes.Append (Default_Node);
+ New_Id := Nodes.Last;
+ Flags.Append (Default_Flags);
+ Orig_Nodes.Append (New_Id);
+ Nodes.Table (Nodes.Last).Comes_From_Source :=
+ Comes_From_Source_Default;
Allocate_List_Tables (Nodes.Last);
-
- -- Invoke the reporting procedure (if available)
-
- if Reporting_Proc /= null then
- Reporting_Proc.all (Target => New_Id, Source => Src);
- end if;
+ Report (Target => New_Id, Source => Empty);
return New_Id;
- end Allocate_Initialize_Node;
+ end Allocate_New_Node;
--------------
-- Analyzed --
@@ -762,12 +705,7 @@ package body Atree is
Flags.Table (Destination) := Flags.Table (Source);
- -- Specifically set Paren_Count to make sure auxiliary table entry
- -- gets correctly made if the parentheses count is at the max value.
-
- if Nkind (Destination) in N_Subexpr then
- Set_Paren_Count (Destination, Paren_Count (Source));
- end if;
+ Set_Paren_Count_Of_Copy (Target => Destination, Source => Source);
-- Deal with copying extension nodes if present. No need to copy flags
-- table entries, since they are always zero for extending components.
@@ -1056,12 +994,14 @@ package body Atree is
-- Extend_Node --
-----------------
- function Extend_Node (Node : Node_Id) return Entity_Id is
- Result : Entity_Id;
+ function Extend_Node (Source : Node_Id) return Entity_Id is
+ pragma Assert (Present (Source));
+ pragma Assert (not Has_Extension (Source));
+ New_Id : Entity_Id;
procedure Debug_Extend_Node;
pragma Inline (Debug_Extend_Node);
- -- Debug routine for debug flag N
+ -- Debug routine for -gnatdn
-----------------------
-- Debug_Extend_Node --
@@ -1071,13 +1011,13 @@ package body Atree is
begin
if Debug_Flag_N then
Write_Str ("Extend node ");
- Write_Int (Int (Node));
+ Write_Int (Int (Source));
- if Result = Node then
+ if New_Id = Source then
Write_Str (" in place");
else
Write_Str (" copied to ");
- Write_Int (Int (Result));
+ Write_Int (Int (New_Id));
end if;
-- Write_Eol;
@@ -1087,12 +1027,34 @@ package body Atree is
-- Start of processing for Extend_Node
begin
- pragma Assert (not (Has_Extension (Node)));
+ -- Optimize the case where Source happens to be the last node; in that
+ -- case, we don't need to move it.
+
+ if Source = Nodes.Last then
+ New_Id := Source;
+ else
+ Nodes.Append (Nodes.Table (Source));
+ Flags.Append (Flags.Table (Source));
+ New_Id := Nodes.Last;
+ Orig_Nodes.Append (New_Id);
+ end if;
+
+ Set_Check_Actuals (New_Id, False);
+
+ -- Set extension nodes
+
+ for J in 1 .. Num_Extension_Nodes loop
+ Nodes.Append (Default_Node_Extension);
+ Flags.Append (Default_Flags);
+ end loop;
+
+ Orig_Nodes.Set_Last (Nodes.Last);
+ Allocate_List_Tables (Nodes.Last);
+ Report (Target => New_Id, Source => Source);
- Result := Allocate_Initialize_Node (Node, With_Extension => True);
pragma Debug (Debug_Extend_Node);
- return Result;
+ return New_Id;
end Extend_Node;
-----------------
@@ -1100,6 +1062,8 @@ package body Atree is
-----------------
procedure Fix_Parents (Ref_Node, Fix_Node : Node_Id) is
+ pragma Assert (Nkind (Ref_Node) = Nkind (Fix_Node));
+
procedure Fix_Parent (Field : Union_Id);
-- Fix up one parent pointer. Field is checked to see if it points to
-- a node, list, or element list that has a parent that points to
@@ -1157,7 +1121,7 @@ package body Atree is
function Get_Comes_From_Source_Default return Boolean is
begin
- return Default_Node.Comes_From_Source;
+ return Comes_From_Source_Default;
end Get_Comes_From_Source_Default;
-----------------
@@ -1188,7 +1152,6 @@ package body Atree is
pragma Warnings (Off, Dummy);
begin
- Node_Count := 0;
Atree_Private_Part.Nodes.Init;
Atree_Private_Part.Flags.Init;
Orig_Nodes.Init;
@@ -1252,9 +1215,8 @@ package body Atree is
-- We used to Release the tables, as in the comments below, but that is
-- a waste of time. We're only wasting virtual memory here, and the
-- release calls copy large amounts of data.
+ -- ???Get rid of Release?
- -- Nodes.Release;
- Nodes.Locked := True;
-- Flags.Release;
Flags.Locked := True;
-- Orig_Nodes.Release;
@@ -1314,38 +1276,60 @@ package body Atree is
--------------
function New_Copy (Source : Node_Id) return Node_Id is
- New_Id : Node_Id := Source;
-
+ New_Id : Node_Id;
begin
- if Source > Empty_Or_Error then
- New_Id := Allocate_Initialize_Node (Source, Has_Extension (Source));
+ if Source <= Empty_Or_Error then
+ return Source;
+ end if;
- Nodes.Table (New_Id).In_List := False;
- Nodes.Table (New_Id).Link := Empty_List_Or_Node;
+ Nodes.Append (Nodes.Table (Source));
+ Flags.Append (Flags.Table (Source));
+ New_Id := Nodes.Last;
+ Orig_Nodes.Append (New_Id);
+ Set_Check_Actuals (New_Id, False);
+ Set_Paren_Count_Of_Copy (Target => New_Id, Source => Source);
- -- If the original is marked as a rewrite insertion, then unmark the
- -- copy, since we inserted the original, not the copy.
+ -- Set extension nodes if required
- Nodes.Table (New_Id).Rewrite_Ins := False;
- pragma Debug (New_Node_Debugging_Output (New_Id));
+ if Has_Extension (Source) then
+ for J in 1 .. Num_Extension_Nodes loop
+ Nodes.Append (Nodes.Table (Source + J));
+ Flags.Append (Flags.Table (Source + J));
+ end loop;
+ Orig_Nodes.Set_Last (Nodes.Last);
+ else
+ pragma Assert (Orig_Nodes.Table (Orig_Nodes.Last) = Nodes.Last);
+ end if;
- -- Clear Is_Overloaded since we cannot have semantic interpretations
- -- of this new node.
+ Allocate_List_Tables (Nodes.Last);
+ Report (Target => New_Id, Source => Source);
- if Nkind (Source) in N_Subexpr then
- Set_Is_Overloaded (New_Id, False);
- end if;
+ Nodes.Table (New_Id).In_List := False;
+ Nodes.Table (New_Id).Link := Empty_List_Or_Node;
- -- Always clear Has_Aspects, the caller must take care of copying
- -- aspects if this is required for the particular situation.
+ -- If the original is marked as a rewrite insertion, then unmark the
+ -- copy, since we inserted the original, not the copy.
- Set_Has_Aspects (New_Id, False);
+ Nodes.Table (New_Id).Rewrite_Ins := False;
+ pragma Debug (New_Node_Debugging_Output (New_Id));
- -- Mark the copy as Ghost depending on the current Ghost region
+ -- Clear Is_Overloaded since we cannot have semantic interpretations
+ -- of this new node.
- Mark_New_Ghost_Node (New_Id);
+ if Nkind (Source) in N_Subexpr then
+ Set_Is_Overloaded (New_Id, False);
end if;
+ -- Always clear Has_Aspects, the caller must take care of copying
+ -- aspects if this is required for the particular situation.
+
+ Set_Has_Aspects (New_Id, False);
+
+ -- Mark the copy as Ghost depending on the current Ghost region
+
+ Mark_New_Ghost_Node (New_Id);
+
+ pragma Assert (New_Id /= Source);
return New_Id;
end New_Copy;
@@ -1357,30 +1341,35 @@ package body Atree is
(New_Node_Kind : Node_Kind;
New_Sloc : Source_Ptr) return Entity_Id
is
- Ent : Entity_Id;
-
- begin
pragma Assert (New_Node_Kind in N_Entity);
+ New_Id : constant Entity_Id := Allocate_New_Node;
+ begin
+ -- Set extension nodes
- Ent := Allocate_Initialize_Node (Empty, With_Extension => True);
+ for J in 1 .. Num_Extension_Nodes loop
+ Nodes.Append (Default_Node_Extension);
+ Flags.Append (Default_Flags);
+ end loop;
+
+ Orig_Nodes.Set_Last (Nodes.Last);
-- If this is a node with a real location and we are generating
-- source nodes, then reset Current_Error_Node. This is useful
-- if we bomb during parsing to get a error location for the bomb.
- if Default_Node.Comes_From_Source and then New_Sloc > No_Location then
- Current_Error_Node := Ent;
+ if New_Sloc > No_Location and then Comes_From_Source_Default then
+ Current_Error_Node := New_Id;
end if;
- Nodes.Table (Ent).Nkind := New_Node_Kind;
- Nodes.Table (Ent).Sloc := New_Sloc;
- pragma Debug (New_Node_Debugging_Output (Ent));
+ Nodes.Table (New_Id).Nkind := New_Node_Kind;
+ Nodes.Table (New_Id).Sloc := New_Sloc;
+ pragma Debug (New_Node_Debugging_Output (New_Id));
-- Mark the new entity as Ghost depending on the current Ghost region
- Mark_New_Ghost_Node (Ent);
+ Mark_New_Ghost_Node (New_Id);
- return Ent;
+ return New_Id;
end New_Entity;
--------------
@@ -1391,29 +1380,27 @@ package body Atree is
(New_Node_Kind : Node_Kind;
New_Sloc : Source_Ptr) return Node_Id
is
- Nod : Node_Id;
-
- begin
pragma Assert (New_Node_Kind not in N_Entity);
-
- Nod := Allocate_Initialize_Node (Empty, With_Extension => False);
- Nodes.Table (Nod).Nkind := New_Node_Kind;
- Nodes.Table (Nod).Sloc := New_Sloc;
- pragma Debug (New_Node_Debugging_Output (Nod));
+ New_Id : constant Node_Id := Allocate_New_Node;
+ pragma Assert (Orig_Nodes.Table (Orig_Nodes.Last) = Nodes.Last);
+ begin
+ Nodes.Table (New_Id).Nkind := New_Node_Kind;
+ Nodes.Table (New_Id).Sloc := New_Sloc;
+ pragma Debug (New_Node_Debugging_Output (New_Id));
-- If this is a node with a real location and we are generating source
-- nodes, then reset Current_Error_Node. This is useful if we bomb
-- during parsing to get an error location for the bomb.
- if Default_Node.Comes_From_Source and then New_Sloc > No_Location then
- Current_Error_Node := Nod;
+ if Comes_From_Source_Default and then New_Sloc > No_Location then
+ Current_Error_Node := New_Id;
end if;
-- Mark the new node as Ghost depending on the current Ghost region
- Mark_New_Ghost_Node (Nod);
+ Mark_New_Ghost_Node (New_Id);
- return Nod;
+ return New_Id;
end New_Node;
-------------------------
@@ -1494,14 +1481,18 @@ package body Atree is
return Nodes.Table (First_Node_Id)'Address;
end Nodes_Address;
- ---------------
- -- Num_Nodes --
- ---------------
+ -----------------------------------
+ -- Approx_Num_Nodes_And_Entities --
+ -----------------------------------
- function Num_Nodes return Nat is
+ function Approx_Num_Nodes_And_Entities return Nat is
begin
- return Node_Count;
- end Num_Nodes;
+ -- This is an overestimate, because entities take up more space, but
+ -- that really doesn't matter; it's not worth subtracting out the
+ -- "extra".
+
+ return Nat (Nodes.Last - First_Node_Id);
+ end Approx_Num_Nodes_And_Entities;
-------------------
-- Original_Node --
@@ -1763,6 +1754,17 @@ package body Atree is
end if;
end Replace;
+ ------------
+ -- Report --
+ ------------
+
+ procedure Report (Target, Source : Node_Id) is
+ begin
+ if Reporting_Proc /= null then
+ Reporting_Proc.all (Target, Source);
+ end if;
+ end Report;
+
-------------
-- Rewrite --
-------------
@@ -1895,7 +1897,7 @@ package body Atree is
procedure Set_Comes_From_Source_Default (Default : Boolean) is
begin
- Default_Node.Comes_From_Source := Default;
+ Comes_From_Source_Default := Default;
end Set_Comes_From_Source_Default;
---------------
@@ -1983,6 +1985,8 @@ package body Atree is
Nodes.Table (N).Pflag1 := True;
Nodes.Table (N).Pflag2 := True;
+ -- Search for existing table entry
+
for J in Paren_Counts.First .. Paren_Counts.Last loop
if N = Paren_Counts.Table (J).Nod then
Paren_Counts.Table (J).Count := Val;
@@ -1990,10 +1994,30 @@ package body Atree is
end if;
end loop;
+ -- No existing table entry; make a new one
+
Paren_Counts.Append ((Nod => N, Count => Val));
end if;
end Set_Paren_Count;
+ -----------------------------
+ -- Set_Paren_Count_Of_Copy --
+ -----------------------------
+
+ procedure Set_Paren_Count_Of_Copy (Target, Source : Node_Id) is
+ begin
+ -- We already copied the two Pflags. We need to update the Paren_Counts
+ -- table only if greater than 2.
+
+ if Nkind (Source) in N_Subexpr
+ and then Paren_Count (Source) > 2
+ then
+ Set_Paren_Count (Target, Paren_Count (Source));
+ end if;
+
+ pragma Assert (Paren_Count (Target) = Paren_Count (Source));
+ end Set_Paren_Count_Of_Copy;
+
----------------
-- Set_Parent --
----------------
@@ -8756,7 +8780,6 @@ package body Atree is
procedure Unlock is
begin
- Nodes.Locked := False;
Flags.Locked := False;
Orig_Nodes.Locked := False;
end Unlock;
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index e958a9b..f84ff45 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -70,7 +64,7 @@ package Atree is
-- Currently entities are composed of 7 sequentially allocated 32-byte
-- nodes, considered as a single record. The following definition gives
- -- the number of extension nodes.
+ -- the number of extension nodes. ????We plan to change this.
Num_Extension_Nodes : Node_Id := 6;
-- This value is increased by one if debug flag -gnatd.N is set. This is
@@ -81,6 +75,10 @@ package Atree is
-- 2.01 for the nodes/entities ratio and a 2% increase in compilation time
-- on average for the GCC-based compiler at -O0 on a 32-bit x86 host.
+ procedure Print_Statistics;
+ pragma Export (Ada, Print_Statistics);
+ -- Print various statistics on the tables maintained by the package
+
----------------------------------------
-- Definitions of Fields in Tree Node --
----------------------------------------
@@ -231,12 +229,9 @@ package Atree is
function Flags_Address return System.Address;
-- Return address of Flags table (used in Back_End for Gigi call)
- function Num_Nodes return Nat;
- -- Total number of nodes allocated, where an entity counts as a single
- -- node. This count is incremented every time a node or entity is
- -- allocated, and decremented every time a node or entity is deleted.
- -- This value is used by Xref and by Treepr to allocate hash tables of
- -- suitable size for hashing Node_Id values.
+ function Approx_Num_Nodes_And_Entities return Nat;
+ -- This is an approximation to the number of nodes and entities allocated,
+ -- used to determine sizes of hash tables.
-----------------------
-- Use of Empty Node --
@@ -404,9 +399,8 @@ package Atree is
-- place, and then for subsequent modifications as required.
procedure Initialize;
- -- Called at the start of compilation to initialize the allocation of
- -- the node and list tables and make the standard entries for Empty,
- -- Error and Error_List.
+ -- Called at the start of compilation to initialize the allocation of the
+ -- node and list tables and make the entries for Empty and Error.
procedure Lock;
-- Called before the back end is invoked to lock the nodes table
@@ -551,7 +545,7 @@ package Atree is
-- semantic chains: Homonym and Next_Entity: the corresponding links must
-- be adjusted by the caller, according to context.
- function Extend_Node (Node : Node_Id) return Entity_Id;
+ function Extend_Node (Source : Node_Id) return Entity_Id;
-- This function returns a copy of its input node with an extension added.
-- The fields of the extension are set to Empty. Due to the way extensions
-- are handled (as four consecutive array elements), it may be necessary
@@ -3843,7 +3837,8 @@ package Atree is
-- Field6-11 Holds Field36-Field41
end case;
- end record;
+ end record; -- Node_Record
+ pragma Suppress_Initialization (Node_Record); -- see package Nodes below
pragma Pack (Node_Record);
for Node_Record'Size use 8 * 32;
@@ -3855,7 +3850,7 @@ package Atree is
-- Default value used to initialize default nodes. Note that some of the
-- fields get overwritten, and in particular, Nkind always gets reset.
- Default_Node : Node_Record := (
+ Default_Node : constant Node_Record := (
Is_Extension => False,
Pflag1 => False,
Pflag2 => False,
@@ -3864,7 +3859,6 @@ package Atree is
Rewrite_Ins => False,
Analyzed => False,
Comes_From_Source => False,
- -- modified by Set_Comes_From_Source_Default
Error_Posted => False,
Flag4 => False,
@@ -3886,7 +3880,7 @@ package Atree is
Nkind => N_Unused_At_Start,
- Sloc => No_Location,
+ Sloc => 0,
Link => Empty_List_Or_Node,
Field1 => Empty_List_Or_Node,
Field2 => Empty_List_Or_Node,
@@ -3938,17 +3932,18 @@ package Atree is
Field11 => Empty_List_Or_Node,
Field12 => Empty_List_Or_Node);
- -- The following defines the extendable array used for the nodes table
- -- Nodes with extensions use six consecutive entries in the array
-
- package Nodes is new Table.Table (
- Table_Component_Type => Node_Record,
- Table_Index_Type => Node_Id'Base,
- Table_Low_Bound => First_Node_Id,
- Table_Initial => Alloc.Nodes_Initial,
- Table_Increment => Alloc.Nodes_Increment,
- Release_Threshold => Alloc.Nodes_Release_Threshold,
- Table_Name => "Nodes");
+ -- The following defines the extendable array used for the nodes table.
+ -- Nodes with extensions use multiple consecutive entries in the array
+ -- (see Num_Extension_Nodes).
+
+ package Nodes is new Table.Table
+ (Table_Component_Type => Node_Record,
+ Table_Index_Type => Node_Id'Base,
+ Table_Low_Bound => First_Node_Id,
+ Table_Initial => Alloc.Nodes_Initial,
+ Table_Increment => Alloc.Nodes_Increment,
+ Release_Threshold => Alloc.Nodes_Release_Threshold,
+ Table_Name => "Nodes");
-- The following is a parallel table to Nodes, which provides 8 more
-- bits of space that logically belong to the corresponding node. This
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index 91b4cb3..ed0df1b 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -33,7 +33,6 @@ with Osint; use Osint;
with Osint.B; use Osint.B;
with Output; use Output;
with Rident; use Rident;
-with Stringt; use Stringt;
with Table;
with Targparm; use Targparm;
with Types; use Types;
@@ -1161,19 +1160,18 @@ package body Bindgen is
procedure Write_Name_With_Len (Nam : Name_Id) is
begin
Get_Name_String (Nam);
-
- Start_String;
- Store_String_Char (Character'Val (Name_Len));
- Store_String_Chars (Name_Buffer (1 .. Name_Len));
-
- Write_String_Table_Entry (End_String);
+ Write_Str ("Character'Val (");
+ Write_Int (Int (Name_Len));
+ Write_Str (") & """);
+ Write_Str (Name_Buffer (1 .. Name_Len));
+ Write_Char ('"');
end Write_Name_With_Len;
-- Local variables
- Amp : Character;
- KN : Name_Id := No_Name;
- VN : Name_Id := No_Name;
+ First : Boolean := True;
+ KN : Name_Id := No_Name;
+ VN : Name_Id := No_Name;
-- Start of processing for Gen_Bind_Env_String
@@ -1187,21 +1185,26 @@ package body Bindgen is
Set_Special_Output (Write_Bind_Line'Access);
WBI (" Bind_Env : aliased constant String :=");
- Amp := ' ';
+
while VN /= No_Name loop
- Write_Str (" " & Amp & ' ');
+ if First then
+ Write_Str (" ");
+ else
+ Write_Str (" & ");
+ end if;
+
Write_Name_With_Len (KN);
Write_Str (" & ");
Write_Name_With_Len (VN);
Write_Eol;
Bind_Environment.Get_Next (KN, VN);
- Amp := '&';
+ First := False;
end loop;
+
WBI (" & ASCII.NUL;");
Cancel_Special_Output;
-
Bind_Env_String_Built := True;
end Gen_Bind_Env_String;
diff --git a/gcc/ada/bindo-writers.adb b/gcc/ada/bindo-writers.adb
index 88c8b25..cca6687 100644
--- a/gcc/ada/bindo-writers.adb
+++ b/gcc/ada/bindo-writers.adb
@@ -1561,7 +1561,7 @@ package body Bindo.Writers is
begin
pragma Assert (Present (Nam));
- return Bucket_Range_Type (Nam);
+ return Bucket_Range_Type (abs Nam);
end Hash_File_Name;
---------------------
diff --git a/gcc/ada/casing.adb b/gcc/ada/casing.adb
index b5020d5..db551d7 100644
--- a/gcc/ada/casing.adb
+++ b/gcc/ada/casing.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/casing.ads b/gcc/ada/casing.ads
index b40faaa..fe0e2f2 100644
--- a/gcc/ada/casing.ads
+++ b/gcc/ada/casing.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 9de21d6..b389da5 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -30,7 +30,6 @@ with Einfo; use Einfo;
with Elists; use Elists;
with Eval_Fat; use Eval_Fat;
with Exp_Ch11; use Exp_Ch11;
-with Exp_Ch2; use Exp_Ch2;
with Exp_Ch4; use Exp_Ch4;
with Exp_Pakd; use Exp_Pakd;
with Exp_Util; use Exp_Util;
@@ -590,7 +589,6 @@ package body Checks is
then
Param_Ent := Entity (N);
while Present (Renamed_Object (Param_Ent)) loop
-
-- Renamed_Object must return an Entity_Name here
-- because of preceding "Present (E_E_A (...))" test.
@@ -602,32 +600,45 @@ package body Checks is
return;
-- Only apply the run-time check if the access parameter has an
- -- associated extra access level parameter and when the level of the
- -- type is less deep than the level of the access parameter, and
- -- accessibility checks are not suppressed.
+ -- associated extra access level parameter and when accessibility checks
+ -- are enabled.
elsif Present (Param_Ent)
- and then Present (Extra_Accessibility (Param_Ent))
- and then UI_Gt (Object_Access_Level (N),
- Deepest_Type_Access_Level (Typ))
+ and then Present (Get_Dynamic_Accessibility (Param_Ent))
and then not Accessibility_Checks_Suppressed (Param_Ent)
and then not Accessibility_Checks_Suppressed (Typ)
then
+ -- Obtain the parameter's accessibility level
+
Param_Level :=
- New_Occurrence_Of (Extra_Accessibility (Param_Ent), Loc);
+ New_Occurrence_Of (Get_Dynamic_Accessibility (Param_Ent), Loc);
-- Use the dynamic accessibility parameter for the function's result
-- when one has been created instead of statically referring to the
-- deepest type level so as to appropriatly handle the rules for
-- RM 3.10.2 (10.1/3).
- if Ekind (Scope (Param_Ent))
- in E_Function | E_Operator | E_Subprogram_Type
- and then Present (Extra_Accessibility_Of_Result (Scope (Param_Ent)))
+ if Ekind (Scope (Param_Ent)) = E_Function
+ and then In_Return_Value (N)
+ and then Ekind (Typ) = E_Anonymous_Access_Type
then
- Type_Level :=
- New_Occurrence_Of
- (Extra_Accessibility_Of_Result (Scope (Param_Ent)), Loc);
+ -- Associate the level of the result type to the extra result
+ -- accessibility parameter belonging to the current function.
+
+ if Present (Extra_Accessibility_Of_Result (Scope (Param_Ent))) then
+ Type_Level :=
+ New_Occurrence_Of
+ (Extra_Accessibility_Of_Result (Scope (Param_Ent)), Loc);
+
+ -- In Ada 2005 and earlier modes, a result extra accessibility
+ -- parameter is not generated and no dynamic check is performed.
+
+ else
+ return;
+ end if;
+
+ -- Otherwise get the type's accessibility level normally
+
else
Type_Level :=
Make_Integer_Literal (Loc, Deepest_Type_Access_Level (Typ));
@@ -1013,8 +1024,7 @@ package body Checks is
-- Now see if an overflow check is required
declare
- Siz : constant Int := UI_To_Int (Esize (Rtyp));
- Dsiz : constant Int := Siz * 2;
+ Dsiz : constant Uint := 2 * Esize (Rtyp);
Opnod : Node_Id;
Ctyp : Entity_Id;
Opnd : Node_Id;
@@ -1050,33 +1060,47 @@ package body Checks is
-- an integer type of sufficient length to hold the largest possible
-- result.
- -- If the size of check type exceeds the size of Long_Long_Integer,
+ -- If the size of the check type exceeds the maximum integer size,
-- we use a different approach, expanding to:
- -- typ (xxx_With_Ovflo_Check (Integer_64 (x), Integer (y)))
+ -- typ (xxx_With_Ovflo_Check (Integer_NN (x), Integer_NN (y)))
-- where xxx is Add, Multiply or Subtract as appropriate
-- Find check type if one exists
- if Dsiz <= Standard_Integer_Size then
- Ctyp := Standard_Integer;
-
- elsif Dsiz <= Standard_Long_Long_Integer_Size then
- Ctyp := Standard_Long_Long_Integer;
+ if Dsiz <= System_Max_Integer_Size then
+ Ctyp := Integer_Type_For (Dsiz, Uns => False);
-- No check type exists, use runtime call
else
+ if System_Max_Integer_Size = 64 then
+ Ctyp := RTE (RE_Integer_64);
+ else
+ Ctyp := RTE (RE_Integer_128);
+ end if;
+
if Nkind (N) = N_Op_Add then
- Cent := RE_Add_With_Ovflo_Check;
+ if System_Max_Integer_Size = 64 then
+ Cent := RE_Add_With_Ovflo_Check64;
+ else
+ Cent := RE_Add_With_Ovflo_Check128;
+ end if;
- elsif Nkind (N) = N_Op_Multiply then
- Cent := RE_Multiply_With_Ovflo_Check;
+ elsif Nkind (N) = N_Op_Subtract then
+ if System_Max_Integer_Size = 64 then
+ Cent := RE_Subtract_With_Ovflo_Check64;
+ else
+ Cent := RE_Subtract_With_Ovflo_Check128;
+ end if;
- else
- pragma Assert (Nkind (N) = N_Op_Subtract);
- Cent := RE_Subtract_With_Ovflo_Check;
+ else pragma Assert (Nkind (N) = N_Op_Multiply);
+ if System_Max_Integer_Size = 64 then
+ Cent := RE_Multiply_With_Ovflo_Check64;
+ else
+ Cent := RE_Multiply_With_Ovflo_Check128;
+ end if;
end if;
Rewrite (N,
@@ -1084,8 +1108,8 @@ package body Checks is
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RTE (Cent), Loc),
Parameter_Associations => New_List (
- OK_Convert_To (RTE (RE_Integer_64), Left_Opnd (N)),
- OK_Convert_To (RTE (RE_Integer_64), Right_Opnd (N))))));
+ OK_Convert_To (Ctyp, Left_Opnd (N)),
+ OK_Convert_To (Ctyp, Right_Opnd (N))))));
Analyze_And_Resolve (N, Typ);
return;
@@ -2140,6 +2164,15 @@ package body Checks is
Lo_OK := (Lo >= UR_From_Uint (Ifirst));
end if;
+ -- Saturate the lower bound to that of the expression's type, because
+ -- we do not want to create an out-of-range value but we still need to
+ -- do a comparison to catch NaNs.
+
+ if Lo < Expr_Value_R (Type_Low_Bound (Expr_Type)) then
+ Lo := Expr_Value_R (Type_Low_Bound (Expr_Type));
+ Lo_OK := True;
+ end if;
+
if Lo_OK then
-- Lo_Chk := (X >= Lo)
@@ -2174,6 +2207,15 @@ package body Checks is
Hi_OK := (Hi <= UR_From_Uint (Ilast));
end if;
+ -- Saturate the higher bound to that of the expression's type, because
+ -- we do not want to create an out-of-range value but we still need to
+ -- do a comparison to catch NaNs.
+
+ if Hi > Expr_Value_R (Type_High_Bound (Expr_Type)) then
+ Hi := Expr_Value_R (Type_High_Bound (Expr_Type));
+ Hi_OK := True;
+ end if;
+
if Hi_OK then
-- Hi_Chk := (X <= Hi)
@@ -2744,13 +2786,9 @@ package body Checks is
Par : Node_Id;
S : Entity_Id;
+ Check_Disabled : constant Boolean := (not Predicate_Enabled (Typ))
+ or else not Predicate_Check_In_Scope (N);
begin
- if not Predicate_Enabled (Typ)
- or else not Predicate_Check_In_Scope (N)
- then
- return;
- end if;
-
S := Current_Scope;
while Present (S) and then not Is_Subprogram (S) loop
S := Scope (S);
@@ -2759,7 +2797,9 @@ package body Checks is
-- If the check appears within the predicate function itself, it means
-- that the user specified a check whose formal is the predicated
-- subtype itself, rather than some covering type. This is likely to be
- -- a common error, and thus deserves a warning.
+ -- a common error, and thus deserves a warning. We want to emit this
+ -- warning even if predicate checking is disabled (in which case the
+ -- warning is still useful even if it is not strictly accurate).
if Present (S) and then S = Predicate_Function (Typ) then
Error_Msg_NE
@@ -2774,9 +2814,15 @@ package body Checks is
Parent (N), Typ);
end if;
- Insert_Action (N,
- Make_Raise_Storage_Error (Sloc (N),
- Reason => SE_Infinite_Recursion));
+ if not Check_Disabled then
+ Insert_Action (N,
+ Make_Raise_Storage_Error (Sloc (N),
+ Reason => SE_Infinite_Recursion));
+ return;
+ end if;
+ end if;
+
+ if Check_Disabled then
return;
end if;
@@ -3586,7 +3632,7 @@ package body Checks is
elsif Is_Scalar_Type (Target_Type) then
declare
- Conv_OK : constant Boolean := Conversion_OK (N);
+ Conv_OK : constant Boolean := Conversion_OK (N);
-- If the Conversion_OK flag on the type conversion is set and no
-- floating-point type is involved in the type conversion then
-- fixed-point values must be read as integral values.
@@ -3642,14 +3688,10 @@ package body Checks is
(Entity (High_Bound (Scalar_Range (Enum_T))));
end if;
- if Last_E <= Last_I then
- null;
-
- else
+ if Last_E > Last_I then
Activate_Overflow_Check (N);
end if;
end;
-
else
Activate_Overflow_Check (N);
end if;
@@ -3662,7 +3704,6 @@ package body Checks is
and then not GNATprove_Mode
then
Apply_Float_Conversion_Check (Expr, Target_Type);
-
else
-- Conversions involving fixed-point types are expanded
-- separately, and do not need a Range_Check flag, except
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 9d3e9e9..9e328e2 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -69,8 +69,8 @@ package body Contracts is
procedure Expand_Subprogram_Contract (Body_Id : Entity_Id);
-- Expand the contracts of a subprogram body and its correspoding spec (if
-- any). This routine processes all [refined] pre- and postconditions as
- -- well as Contract_Cases, invariants and predicates. Body_Id denotes the
- -- entity of the subprogram body.
+ -- well as Contract_Cases, Subprogram_Variant, invariants and predicates.
+ -- Body_Id denotes the entity of the subprogram body.
-----------------------
-- Add_Contract_Item --
@@ -200,7 +200,10 @@ package body Contracts is
then
Add_Classification;
- elsif Prag_Nam in Name_Contract_Cases | Name_Test_Case then
+ elsif Prag_Nam in Name_Contract_Cases
+ | Name_Subprogram_Variant
+ | Name_Test_Case
+ then
Add_Contract_Test_Case;
elsif Prag_Nam in Name_Postcondition | Name_Precondition then
@@ -550,8 +553,8 @@ package body Contracts is
end if;
-- Deal with preconditions, [refined] postconditions, Contract_Cases,
- -- invariants and predicates associated with body and its spec. Do not
- -- expand the contract of subprogram body stubs.
+ -- Subprogram_Variant, invariants and predicates associated with body
+ -- and its spec. Do not expand the contract of subprogram body stubs.
if Nkind (Body_Decl) = N_Subprogram_Body then
Expand_Subprogram_Contract (Body_Id);
@@ -665,7 +668,7 @@ package body Contracts is
end;
end if;
- -- Analyze contract-cases and test-cases
+ -- Analyze contract-cases, subprogram-variant and test-cases
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
@@ -686,6 +689,10 @@ package body Contracts is
else
Analyze_Contract_Cases_In_Decl_Part (Prag, Freeze_Id);
end if;
+
+ elsif Prag_Nam = Name_Subprogram_Variant then
+ Analyze_Subprogram_Variant_In_Decl_Part (Prag);
+
else
pragma Assert (Prag_Nam = Name_Test_Case);
Analyze_Test_Case_In_Decl_Part (Prag);
@@ -788,13 +795,13 @@ package body Contracts is
-- Local variables
- AR_Val : Boolean := False;
- AW_Val : Boolean := False;
- ER_Val : Boolean := False;
- EW_Val : Boolean := False;
- Seen : Boolean := False;
- Prag : Node_Id;
- Obj_Typ : Entity_Id;
+ AR_Val : Boolean := False;
+ AW_Val : Boolean := False;
+ ER_Val : Boolean := False;
+ EW_Val : Boolean := False;
+ Seen : Boolean := False;
+ Prag : Node_Id;
+ Obj_Typ : Entity_Id;
-- Start of processing for Check_Type_Or_Object_External_Properties
@@ -931,7 +938,7 @@ package body Contracts is
-- with its type (SPARK RM 7.1.3(2)).
if not Is_Type_Id then
- if Is_Effectively_Volatile (Obj_Typ) then
+ if Is_Effectively_Volatile (Obj_Typ) then
Check_Volatility_Compatibility
(Type_Or_Obj_Id, Obj_Typ,
"volatile object", "its type",
@@ -1425,6 +1432,7 @@ package body Contracts is
-- Global
-- Postcondition
-- Precondition
+ -- Subprogram_Variant
-- Test_Case
else
@@ -1941,49 +1949,6 @@ package body Contracts is
Stmts : List_Id;
Result : Entity_Id)
is
- procedure Insert_Before_First_Source_Declaration (Stmt : Node_Id);
- -- Insert node Stmt before the first source declaration of the
- -- related subprogram's body. If no such declaration exists, Stmt
- -- becomes the last declaration.
-
- --------------------------------------------
- -- Insert_Before_First_Source_Declaration --
- --------------------------------------------
-
- procedure Insert_Before_First_Source_Declaration (Stmt : Node_Id) is
- Decls : constant List_Id := Declarations (Body_Decl);
- Decl : Node_Id;
-
- begin
- -- Inspect the declarations of the related subprogram body looking
- -- for the first source declaration.
-
- if Present (Decls) then
- Decl := First (Decls);
- while Present (Decl) loop
- if Comes_From_Source (Decl) then
- Insert_Before (Decl, Stmt);
- return;
- end if;
-
- Next (Decl);
- end loop;
-
- -- If we get there, then the subprogram body lacks any source
- -- declarations. The body of _Postconditions now acts as the
- -- last declaration.
-
- Append (Stmt, Decls);
-
- -- Ensure that the body has a declaration list
-
- else
- Set_Declarations (Body_Decl, New_List (Stmt));
- end if;
- end Insert_Before_First_Source_Declaration;
-
- -- Local variables
-
Loc : constant Source_Ptr := Sloc (Body_Decl);
Params : List_Id := No_List;
Proc_Bod : Node_Id;
@@ -1991,8 +1956,6 @@ package body Contracts is
Proc_Id : Entity_Id;
Proc_Spec : Node_Id;
- -- Start of processing for Build_Postconditions_Procedure
-
begin
-- Nothing to do if there are no actions to check on exit
@@ -2051,7 +2014,8 @@ package body Contracts is
-- order reference. The body of _Postconditions must be placed after
-- the declaration of Temp to preserve correct visibility.
- Insert_Before_First_Source_Declaration (Proc_Decl);
+ Insert_Before_First_Source_Declaration
+ (Proc_Decl, Declarations (Body_Decl));
Analyze (Proc_Decl);
-- Set an explicit End_Label to override the sloc of the implicit
@@ -2092,14 +2056,20 @@ package body Contracts is
if Present (Items) then
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- if Pragma_Name (Prag) = Name_Contract_Cases
- and then Is_Checked (Prag)
- then
- Expand_Pragma_Contract_Cases
- (CCs => Prag,
- Subp_Id => Subp_Id,
- Decls => Declarations (Body_Decl),
- Stmts => Stmts);
+ if Is_Checked (Prag) then
+ if Pragma_Name (Prag) = Name_Contract_Cases then
+ Expand_Pragma_Contract_Cases
+ (CCs => Prag,
+ Subp_Id => Subp_Id,
+ Decls => Declarations (Body_Decl),
+ Stmts => Stmts);
+
+ elsif Pragma_Name (Prag) = Name_Subprogram_Variant then
+ Expand_Pragma_Subprogram_Variant
+ (Prag => Prag,
+ Subp_Id => Subp_Id,
+ Body_Decls => Declarations (Body_Decl));
+ end if;
end if;
Prag := Next_Pragma (Prag);
@@ -2364,7 +2334,7 @@ package body Contracts is
-- A renamed private component is just a component of
-- _object, with an arbitrary name.
- elsif Ekind (Obj) = E_Variable
+ elsif Ekind (Obj) in E_Variable | E_Constant
and then Nkind (Pref) = N_Identifier
and then Chars (Pref) = Name_uObject
and then Nkind (Sel) = N_Identifier
@@ -2590,8 +2560,7 @@ package body Contracts is
and then Sloc (Body_Id) /= Sloc (Subp_Id)
and then In_Same_Source_Unit (Body_Id, Subp_Id)
and then List_Containing (Body_Decl) /=
- List_Containing (Subp_Decl)
- and then not In_Instance;
+ List_Containing (Subp_Decl);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
diff --git a/gcc/ada/contracts.ads b/gcc/ada/contracts.ads
index 9e7b955..4782ef5 100644
--- a/gcc/ada/contracts.ads
+++ b/gcc/ada/contracts.ads
@@ -69,15 +69,16 @@ package Contracts is
-- subprogram body Body_Id as if they appeared at the end of a declarative
-- region. Pragmas in question are:
--
- -- Contract_Cases (stand alone subprogram body)
- -- Depends (stand alone subprogram body)
- -- Global (stand alone subprogram body)
- -- Postcondition (stand alone subprogram body)
- -- Precondition (stand alone subprogram body)
+ -- Contract_Cases (stand alone subprogram body)
+ -- Depends (stand alone subprogram body)
+ -- Global (stand alone subprogram body)
+ -- Postcondition (stand alone subprogram body)
+ -- Precondition (stand alone subprogram body)
-- Refined_Depends
-- Refined_Global
-- Refined_Post
- -- Test_Case (stand alone subprogram body)
+ -- Subprogram_Variant (stand alone subprogram body)
+ -- Test_Case (stand alone subprogram body)
procedure Analyze_Entry_Or_Subprogram_Contract
(Subp_Id : Entity_Id;
@@ -91,6 +92,7 @@ package Contracts is
-- Global
-- Postcondition
-- Precondition
+ -- Subprogram_Variant
-- Test_Case
--
-- Freeze_Id is the entity of a [generic] package body or a [generic]
diff --git a/gcc/ada/csets.adb b/gcc/ada/csets.adb
index ed3166b..0b77b65 100644
--- a/gcc/ada/csets.adb
+++ b/gcc/ada/csets.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/csets.ads b/gcc/ada/csets.ads
index 1fdff40..ee24926 100644
--- a/gcc/ada/csets.ads
+++ b/gcc/ada/csets.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb
index 71d40e9..fa335c1 100644
--- a/gcc/ada/cstand.adb
+++ b/gcc/ada/cstand.adb
@@ -719,6 +719,11 @@ package body CStand is
(Standard_Long_Long_Integer, Standard_Long_Long_Integer_Size);
Set_Is_Implementation_Defined (Standard_Long_Long_Integer);
+ Build_Signed_Integer_Type
+ (Standard_Long_Long_Long_Integer,
+ Standard_Long_Long_Long_Integer_Size);
+ Set_Is_Implementation_Defined (Standard_Long_Long_Long_Integer);
+
Create_Unconstrained_Base_Type
(Standard_Short_Short_Integer, E_Signed_Integer_Subtype);
@@ -734,6 +739,9 @@ package body CStand is
Create_Unconstrained_Base_Type
(Standard_Long_Long_Integer, E_Signed_Integer_Subtype);
+ Create_Unconstrained_Base_Type
+ (Standard_Long_Long_Long_Integer, E_Signed_Integer_Subtype);
+
Create_Float_Types;
-- Create type definition node for type Character. Note that we do not
@@ -1238,11 +1246,11 @@ package body CStand is
Set_Elem_Alignment (Any_Fixed);
Any_Integer := New_Standard_Entity ("an integer type");
- Set_Ekind (Any_Integer, E_Signed_Integer_Type);
- Set_Scope (Any_Integer, Standard_Standard);
- Set_Etype (Any_Integer, Standard_Long_Long_Integer);
- Init_Size (Any_Integer, Standard_Long_Long_Integer_Size);
- Set_Elem_Alignment (Any_Integer);
+ Set_Ekind (Any_Integer, E_Signed_Integer_Type);
+ Set_Scope (Any_Integer, Standard_Standard);
+ Set_Etype (Any_Integer, Standard_Long_Long_Long_Integer);
+ Init_Size (Any_Integer, Standard_Long_Long_Long_Integer_Size);
+ Set_Elem_Alignment (Any_Integer);
Set_Integer_Bounds
(Any_Integer,
@@ -1251,19 +1259,19 @@ package body CStand is
Hb => Intval (High_Bound (Scalar_Range (Standard_Integer))));
Any_Modular := New_Standard_Entity ("a modular type");
- Set_Ekind (Any_Modular, E_Modular_Integer_Type);
- Set_Scope (Any_Modular, Standard_Standard);
- Set_Etype (Any_Modular, Standard_Long_Long_Integer);
- Init_Size (Any_Modular, Standard_Long_Long_Integer_Size);
- Set_Elem_Alignment (Any_Modular);
- Set_Is_Unsigned_Type (Any_Modular);
+ Set_Ekind (Any_Modular, E_Modular_Integer_Type);
+ Set_Scope (Any_Modular, Standard_Standard);
+ Set_Etype (Any_Modular, Standard_Long_Long_Long_Integer);
+ Init_Size (Any_Modular, Standard_Long_Long_Long_Integer_Size);
+ Set_Elem_Alignment (Any_Modular);
+ Set_Is_Unsigned_Type (Any_Modular);
Any_Numeric := New_Standard_Entity ("a numeric type");
- Set_Ekind (Any_Numeric, E_Signed_Integer_Type);
- Set_Scope (Any_Numeric, Standard_Standard);
- Set_Etype (Any_Numeric, Standard_Long_Long_Integer);
- Init_Size (Any_Numeric, Standard_Long_Long_Integer_Size);
- Set_Elem_Alignment (Any_Numeric);
+ Set_Ekind (Any_Numeric, E_Signed_Integer_Type);
+ Set_Scope (Any_Numeric, Standard_Standard);
+ Set_Etype (Any_Numeric, Standard_Long_Long_Long_Integer);
+ Init_Size (Any_Numeric, Standard_Long_Long_Long_Integer_Size);
+ Set_Elem_Alignment (Any_Numeric);
Any_Real := New_Standard_Entity ("a real type");
Set_Ekind (Any_Real, E_Floating_Point_Type);
@@ -1339,11 +1347,17 @@ package body CStand is
Build_Unsigned_Integer_Type
(Standard_Long_Unsigned, Standard_Long_Integer_Size);
- Standard_Long_Long_Unsigned
- := New_Standard_Entity ("long_long_unsigned");
+ Standard_Long_Long_Unsigned :=
+ New_Standard_Entity ("long_long_unsigned");
Build_Unsigned_Integer_Type
(Standard_Long_Long_Unsigned, Standard_Long_Long_Integer_Size);
+ Standard_Long_Long_Long_Unsigned :=
+ New_Standard_Entity ("long_long_long_unsigned");
+ Build_Unsigned_Integer_Type
+ (Standard_Long_Long_Long_Unsigned,
+ Standard_Long_Long_Long_Integer_Size);
+
-- Standard_Unsigned_64 is not user visible, but is used internally. It
-- is an unsigned type mod 2**64 with 64 bits size.
@@ -1358,16 +1372,16 @@ package body CStand is
-- Note: universal integer and universal real are constructed as fully
-- formed signed numeric types, with parameters corresponding to the
- -- longest runtime types (Long_Long_Integer and Long_Long_Float). This
- -- allows Gigi to properly process references to universal types that
- -- are not folded at compile time.
+ -- longest runtime types (Long_Long_Long_Integer and Long_Long_Float).
+ -- This allows Gigi to properly process references to universal types
+ -- that are not folded at compile time.
Universal_Integer := New_Standard_Entity ("universal_integer");
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Universal_Integer);
Set_Scope (Universal_Integer, Standard_Standard);
Build_Signed_Integer_Type
- (Universal_Integer, Standard_Long_Long_Integer_Size);
+ (Universal_Integer, Standard_Long_Long_Long_Integer_Size);
Universal_Real := New_Standard_Entity ("universal_real");
Decl := New_Node (N_Full_Type_Declaration, Stloc);
@@ -1955,6 +1969,13 @@ package body CStand is
P (";");
Write_Eol;
+ Write_Str (" type Long_Long_Long_Integer");
+ P_Int_Range (Standard_Long_Long_Long_Integer_Size);
+ Write_Str (" for Long_Long_Long_Integer'Size use ");
+ Write_Int (Standard_Long_Long_Long_Integer_Size);
+ P (";");
+ Write_Eol;
+
-- Floating point types
P_Float_Type (Standard_Short_Float);
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 0e4a530..f57b148 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -69,7 +63,7 @@ package body Debug is
-- dC Output debugging information on check suppression
-- dD Delete elaboration checks in inner level routines
-- dE Apply elaboration checks to predefined units
- -- dF
+ -- dF Alternative display for messages over multiple lines
-- dG Generate all warnings including those normally suppressed
-- dH Hold (kill) call to gigi
-- dI Inhibit internal name numbering in gnatG listing
@@ -118,14 +112,14 @@ package body Debug is
-- d.y Disable implicit pragma Elaborate_All on task bodies
-- d.z Restore previous support for frontend handling of Inline_Always
- -- d.A
+ -- d.A Print Atree statistics
-- d.B Generate a bug box on abort_statement
-- d.C Generate concatenation call, do not generate inline code
-- d.D Disable errors on use of overriding keyword in Ada 95 mode
-- d.E Turn selected errors into warnings
-- d.F Debug mode for GNATprove
-- d.G Ignore calls through generic formal parameters for elaboration
- -- d.H
+ -- d.H Disable the support for 128-bit integer types on 64-bit platforms
-- d.I Do not ignore enum representation clauses in CodePeer mode
-- d.J Relaxed rules for pragma No_Return
-- d.K Do not reject components in extensions overlapping with parent
@@ -147,7 +141,7 @@ package body Debug is
-- d_a Stop elaboration checks on accept or select statement
-- d_b
- -- d_c
+ -- d_c CUDA compilation : compile for the host
-- d_d
-- d_e Ignore entry calls and requeue statements for elaboration
-- d_f Issue info messages related to GNATprove usage
@@ -841,6 +835,8 @@ package body Debug is
-- handling of Inline_Always by the front end on such targets. For the
-- targets that do not use the GCC back end, this switch is ignored.
+ -- d.A Print Atree statistics
+
-- d.B Generate a bug box when we see an abort_statement, even though
-- there is no bug. Useful for testing Comperr.Compiler_Abort: write
-- some code containing an abort_statement, and compile it with
@@ -881,6 +877,10 @@ package body Debug is
-- now fixed, but we provide this debug flag to revert to the previous
-- situation of ignoring such calls to aid in transition.
+ -- d.H Disable the support for 128-bit integer types on 64-bit platforms.
+ -- This makes it easier to mimic the behavior of the current compiler
+ -- on 32-bit platforms or of older compilers on 64-bit platforms.
+
-- d.I Do not ignore enum representation clauses in CodePeer mode.
-- The default of ignoring representation clauses for enumeration
-- types in CodePeer is good for the majority of Ada code, but in some
@@ -1032,6 +1032,9 @@ package body Debug is
-- flag also suppresses the additional messages explaining why a
-- non-static expression is non-static (see Sem_Eval.Why_Not_Static).
-- This avoids having to worry about these messages in ACATS testing.
+ -- Finally, this flag is also used for strict legality check, in
+ -- particular it will generate an error instead a warning when
+ -- encountering an unknown pragma.
-- d3 Causes Comperr to dump the contents of the node for which an abort
-- was detected (normally only the Node_Id of the node is output).
diff --git a/gcc/ada/debug.ads b/gcc/ada/debug.ads
index ccc9d11..83ad187 100644
--- a/gcc/ada/debug.ads
+++ b/gcc/ada/debug.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/doc/gnat_rm/implementation_advice.rst b/gcc/ada/doc/gnat_rm/implementation_advice.rst
index 998d0c5..e86ad0a 100644
--- a/gcc/ada/doc/gnat_rm/implementation_advice.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_advice.rst
@@ -199,11 +199,11 @@ former provides improved compatibility with other implementations
supporting this type. The latter corresponds to the highest precision
floating-point type supported by the hardware. On most machines, this
will be the same as ``Long_Float``, but on some machines, it will
-correspond to the IEEE extended form. The notable case is all ia32
-(x86) implementations, where ``Long_Long_Float`` corresponds to
-the 80-bit extended precision format supported in hardware on this
-processor. Note that the 128-bit format on SPARC is not supported,
-since this is a software rather than a hardware format.
+correspond to the IEEE extended form. The notable case is all x86
+implementations, where ``Long_Long_Float`` corresponds to the 80-bit
+extended precision format supported in hardware on this processor.
+Note that the 128-bit format on SPARC is not supported, since this
+is a software rather than a hardware format.
.. index:: Multidimensional arrays
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst
index 736710d..de5efea 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst
@@ -564,9 +564,11 @@ Aspect Unreferenced
===================
.. index:: Unreferenced
-This boolean aspect is equivalent to :ref:`pragma Unreferenced<Pragma-Unreferenced>`. Note that
-in the case of formal parameters, it is not permitted to have aspects for
-a formal parameter, so in this case the pragma form must be used.
+This boolean aspect is equivalent to :ref:`pragma Unreferenced<Pragma-Unreferenced>`.
+
+When using the ``-gnatX`` switch, this aspect is also supported on formal
+parameters, which is in particular the only form possible for expression
+functions.
Aspect Unreferenced_Objects
===========================
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
index 967e9d9..f98a427 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
@@ -657,6 +657,14 @@ target. This is a static value that can be used to specify the alignment
for an object, guaranteeing that it is properly aligned in all
cases.
+Attribute Max_Integer_Size
+==========================
+.. index:: Max_Integer_Size
+
+``Standard'Max_Integer_Size`` (``Standard`` is the only permissible
+prefix) provides the size of the largest supported integer type for
+the target. The result is a static constant.
+
Attribute Mechanism_Code
========================
.. index:: Return values, passing mechanism
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst b/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst
index a5425da..71e1834 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_characteristics.rst
@@ -13,8 +13,7 @@ Manual, and are summarized in Annex M.
A requirement for conforming Ada compilers is that they provide
documentation describing how the implementation deals with each of these
issues. In this chapter you will find each point in Annex M listed,
-followed by a description of how GNAT
-handles the implementation dependence.
+followed by a description of how GNAT handles the implementation dependence.
You can use this chapter as a guide to minimizing implementation
dependent features in your programs if portability to other compilers
@@ -100,17 +99,19 @@ further details.
"The predefined integer types declared in
``Standard``. See 3.5.4(25)."
-====================== =======================================
-Type Representation
-====================== =======================================
-*Short_Short_Integer* 8 bit signed
-*Short_Integer* (Short) 16 bit signed
-*Integer* 32 bit signed
-*Long_Integer* 64 bit signed (on most 64 bit targets,
- depending on the C definition of long).
- 32 bit signed (all other targets)
-*Long_Long_Integer* 64 bit signed
-====================== =======================================
+========================= =======================================
+Type Representation
+========================= =======================================
+*Short_Short_Integer* 8-bit signed
+*Short_Integer* 16-bit signed
+*Integer* 32-bit signed
+*Long_Integer* 64-bit signed (on most 64-bit targets,
+ depending on the C definition of long)
+ 32-bit signed (on all other targets)
+*Long_Long_Integer* 64-bit signed
+*Long_Long_Long_Integer* 128-bit signed (on 64-bit targets)
+ 64-bit signed (on 32-bit targets)
+========================= =======================================
*
"Any nonstandard integer types and the operators defined
@@ -155,7 +156,7 @@ Type Representation
Any combinations are permitted that do not result in a small less than
``Fine_Delta`` and do not result in a mantissa larger than 63 bits.
If the mantissa is larger than 53 bits on machines where Long_Long_Float
-is 64 bits (true of all architectures except ia32), then the output from
+is 64 bits (true of all architectures except x86), then the output from
Text_IO is accurate to only 53 bits, rather than the full mantissa. This
is because floating-point conversions are used to convert fixed point.
@@ -1220,7 +1221,7 @@ is converted to the target type.
The result is only defined to be in the perfect result set if the result
can be computed by a single scaling operation involving a scale factor
-representable in 64-bits.
+representable in 64 bits.
*
"The result of a fixed point arithmetic operation in
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
index 737bc60..e1e6853 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst
@@ -37,7 +37,21 @@ This pragma must appear at the start of the statement sequence of a
handled sequence of statements (right after the ``begin``). It has
the effect of deferring aborts for the sequence of statements (but not
for the declarations or handlers, if any, associated with this statement
-sequence).
+sequence). This can also be useful for adding a polling point in Ada code,
+where asynchronous abort of tasks is checked when leaving the statement
+sequence, and is lighter than, for example, using ``delay 0.0;``, since with
+zero-cost exception handling, propagating exceptions (implicitly used to
+implement task abort) cannot be done reliably in an asynchronous way.
+
+An example of usage would be:
+
+.. code-block:: ada
+
+ -- Add a polling point to check for task aborts
+
+ begin
+ pragma Abort_Defer;
+ end;
.. _Pragma-Abstract_State:
@@ -4525,48 +4539,6 @@ type is potentially persistent.
If this pragma is used on a target where this feature is not supported,
then the pragma will be ignored. See also ``pragma Linker_Section``.
-Pragma Polling
-==============
-
-Syntax:
-
-
-.. code-block:: ada
-
- pragma Polling (ON | OFF);
-
-
-This pragma controls the generation of polling code. This is normally off.
-If ``pragma Polling (ON)`` is used then periodic calls are generated to
-the routine ``Ada.Exceptions.Poll``. This routine is a separate unit in the
-runtime library, and can be found in file :file:`a-excpol.adb`.
-
-Pragma ``Polling`` can appear as a configuration pragma (for example it
-can be placed in the :file:`gnat.adc` file) to enable polling globally, or it
-can be used in the statement or declaration sequence to control polling
-more locally.
-
-A call to the polling routine is generated at the start of every loop and
-at the start of every subprogram call. This guarantees that the ``Poll``
-routine is called frequently, and places an upper bound (determined by
-the complexity of the code) on the period between two ``Poll`` calls.
-
-The primary purpose of the polling interface is to enable asynchronous
-aborts on targets that cannot otherwise support it (for example Windows
-NT), but it may be used for any other purpose requiring periodic polling.
-The standard version is null, and can be replaced by a user program. This
-will require re-compilation of the ``Ada.Exceptions`` package that can
-be found in files :file:`a-except.ads` and :file:`a-except.adb`.
-
-A standard alternative unit (in file :file:`4wexcpol.adb` in the standard GNAT
-distribution) is used to enable the asynchronous abort capability on
-targets that do not normally support the capability. The version of
-``Poll`` in this file makes a call to the appropriate runtime routine
-to test for an abort condition.
-
-Note that polling can also be enabled by use of the *-gnatP* switch.
-See the section on switches for gcc in the :title:`GNAT User's Guide`.
-
Pragma Post
===========
.. index:: Post
@@ -7313,12 +7285,6 @@ there is no guarantee that all the bits will be accessed if the reference
is not to the whole object; the compiler is allowed (and generally will)
access only part of the object in this case.
-It is not permissible to specify ``Atomic`` and ``Volatile_Full_Access`` for
-the same type or object.
-
-It is not permissible to specify ``Volatile_Full_Access`` for a composite
-(record or array) type or object that has an ``Aliased`` subcomponent.
-
.. _Pragma-Volatile_Function:
Pragma Volatile_Function
diff --git a/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst b/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst
index 7bae014..c13a882 100644
--- a/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst
+++ b/gcc/ada/doc/gnat_rm/representation_clauses_and_pragmas.rst
@@ -195,12 +195,12 @@ increasing it. For example, if we have:
type My_Boolean is new Boolean;
for My_Boolean'Size use 32;
-then values of this type will always be 32 bits long. In the case of
-discrete types, the size can be increased up to 64 bits, with the effect
-that the entire specified field is used to hold the value, sign- or
-zero-extended as appropriate. If more than 64 bits is specified, then
-padding space is allocated after the value, and a warning is issued that
-there are unused bits.
+then values of this type will always be 32-bit long. In the case of discrete
+types, the size can be increased up to 64 bits on 32-bit targets and 128 bits
+on 64-bit targets, with the effect that the entire specified field is used to
+hold the value, sign- or zero-extended as appropriate. If more than 64 bits
+or 128 bits resp. is specified, then padding space is allocated after the
+value, and a warning is issued that there are unused bits.
Similarly the size of records and arrays may be increased, and the effect
is to add padding bits after the value. This also causes a warning message
@@ -678,8 +678,9 @@ of this subtype, and must be a multiple of the alignment value.
In addition, component size clauses are allowed which cause the array
to be packed, by specifying a smaller value. A first case is for
-component size values in the range 1 through 63. The value specified
-must not be smaller than the Size of the subtype. GNAT will accurately
+component size values in the range 1 through 63 on 32-bit targets,
+and 1 through 127 on 64-bit targets. The value specified may not
+be smaller than the Size of the subtype. GNAT will accurately
honor all packing requests in this range. For example, if we have:
@@ -1094,7 +1095,8 @@ be one of the following cases:
* Any small simple record type with a static size.
For all these cases, if the component subtype size is in the range
-1 through 64, then the effect of the pragma ``Pack`` is exactly as though a
+1 through 63 on 32-bit targets, and 1 through 127 on 64-bit targets,
+then the effect of the pragma ``Pack`` is exactly as though a
component size were specified giving the component subtype size.
All other types are non-packable, they occupy an integral number of storage
@@ -1124,11 +1126,13 @@ using an explicit ``Component_Size`` setting instead, which never generates
a warning, since the intention of the programmer is clear in this case.
GNAT treats packed arrays in one of two ways. If the size of the array is
-known at compile time and is less than 64 bits, then internally the array
-is represented as a single modular type, of exactly the appropriate number
-of bits. If the length is greater than 63 bits, or is not known at compile
-time, then the packed array is represented as an array of bytes, and the
-length is always a multiple of 8 bits.
+known at compile time and is at most 64 bits on 32-bit targets, and at most
+128 bits on 64-bit targets, then internally the array is represented as a
+single modular type, of exactly the appropriate number of bits. If the
+length is greater than 64 bits on 32-bit targets, and greater than 128
+bits on 64-bit targets, or is not known at compile time, then the packed
+array is represented as an array of bytes, and its length is always a
+multiple of 8 bits.
Note that to represent a packed array as a modular type, the alignment must
be suitable for the modular type involved. For example, on typical machines
@@ -1200,17 +1204,17 @@ taken by components. We distinguish between *packable* components and
Components of the following types are considered packable:
* Components of an elementary type are packable unless they are aliased,
- independent, or of an atomic type.
+ independent or atomic.
* Small packed arrays, where the size is statically known, are represented
internally as modular integers, and so they are also packable.
* Small simple records, where the size is statically known, are also packable.
-For all these cases, if the ``'Size`` value is in the range 1 through 64, the
-components occupy the exact number of bits corresponding to this value
-and are packed with no padding bits, i.e. they can start on an arbitrary
-bit boundary.
+For all these cases, if the ``'Size`` value is in the range 1 through 64 on
+32-bit targets, and 1 through 128 on 64-bit targets, the components occupy
+the exact number of bits corresponding to this value and are packed with no
+padding bits, i.e. they can start on an arbitrary bit boundary.
All other types are non-packable, they occupy an integral number of storage
units and the only effect of pragma ``Pack`` is to remove alignment gaps.
@@ -1237,7 +1241,7 @@ For example, consider the record
end record;
pragma Pack (X2);
-The representation for the record ``X2`` is as follows:
+The representation for the record ``X2`` is as follows on 32-bit targets:
.. code-block:: ada
@@ -1252,17 +1256,16 @@ The representation for the record ``X2`` is as follows:
end record;
Studying this example, we see that the packable fields ``L1``
-and ``L2`` are
-of length equal to their sizes, and placed at specific bit boundaries (and
-not byte boundaries) to
-eliminate padding. But ``L3`` is of a non-packable float type (because
+and ``L2`` are of length equal to their sizes, and placed at
+specific bit boundaries (and not byte boundaries) to eliminate
+padding. But ``L3`` is of a non-packable float type (because
it is aliased), so it is on the next appropriate alignment boundary.
The next two fields are fully packable, so ``L4`` and ``L5`` are
minimally packed with no gaps. However, type ``Rb2`` is a packed
-array that is longer than 64 bits, so it is itself non-packable. Thus
-the ``L6`` field is aligned to the next byte boundary, and takes an
-integral number of bytes, i.e., 72 bits.
+array that is longer than 64 bits, so it is itself non-packable on
+32-bit targets. Thus the ``L6`` field is aligned to the next byte
+boundary, and takes an integral number of bytes, i.e., 72 bits.
.. _Record_Representation_Clauses:
@@ -1283,7 +1286,8 @@ clauses is that the size must be at least the ``'Size`` value of the type
(actually the Value_Size). There are no restrictions due to alignment,
and such components may freely cross storage boundaries.
-Packed arrays with a size up to and including 64 bits are represented
+Packed arrays with a size up to and including 64 bits on 32-bit targets,
+and up to and including 128 bits on 64-bit targets, are represented
internally using a modular type with the appropriate number of bits, and
thus the same lack of restriction applies. For example, if you declare:
@@ -1296,30 +1300,30 @@ thus the same lack of restriction applies. For example, if you declare:
then a component clause for a component of type ``R`` may start on any
specified bit boundary, and may specify a value of 49 bits or greater.
-For packed bit arrays that are longer than 64 bits, there are two
-cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
-including the important case of single bits or boolean values, then
-there are no limitations on placement of such components, and they
-may start and end at arbitrary bit boundaries.
+For packed bit arrays that are longer than 64 bits on 32-bit targets,
+and longer than 128 bits on 64-bit targets, there are two cases. If the
+component size is a power of 2 (1,2,4,8,16,32,64 bits), including the
+important case of single bits or boolean values, then there are no
+limitations on placement of such components, and they may start and
+end at arbitrary bit boundaries.
-If the component size is not a power of 2 (e.g., 3 or 5), then
-an array of this type longer than 64 bits must always be placed on
-on a storage unit (byte) boundary and occupy an integral number
-of storage units (bytes). Any component clause that does not
-meet this requirement will be rejected.
+If the component size is not a power of 2 (e.g., 3 or 5), then an array
+of this type must always be placed on on a storage unit (byte) boundary
+and occupy an integral number of storage units (bytes). Any component
+clause that does not meet this requirement will be rejected.
-Any aliased component, or component of an aliased type, must
-have its normal alignment and size. A component clause that
-does not meet this requirement will be rejected.
+Any aliased component, or component of an aliased type, must have its
+normal alignment and size. A component clause that does not meet this
+requirement will be rejected.
The tag field of a tagged type always occupies an address sized field at
the start of the record. No component clause may attempt to overlay this
tag. When a tagged type appears as a component, the tag field must have
proper alignment
-In the case of a record extension ``T1``, of a type ``T``, no component clause applied
-to the type ``T1`` can specify a storage location that would overlap the first
-``T'Size`` bytes of the record.
+In the case of a record extension ``T1``, of a type ``T``, no component
+clause applied to the type ``T1`` can specify a storage location that
+would overlap the first ``T'Object_Size`` bits of the record.
For all other component types, including non-bit-packed arrays,
the component can be placed at an arbitrary bit boundary,
@@ -1350,8 +1354,7 @@ Handling of Records with Holes
.. index:: Handling of Records with Holes
As a result of alignment considerations, records may contain "holes"
-or gaps
-which do not correspond to the data bits of any of the components.
+or gaps which do not correspond to the data bits of any of the components.
Record representation clauses can also result in holes in records.
GNAT does not attempt to clear these holes, so in record objects,
diff --git a/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst b/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst
index b0f59cf..3e7dc051 100644
--- a/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst
+++ b/gcc/ada/doc/gnat_rm/standard_and_implementation_defined_restrictions.rst
@@ -496,7 +496,7 @@ No_Local_Timing_Events
----------------------
.. index:: No_Local_Timing_Events
-[RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
+[RM D.7] All objects of type Ada.Real_Time.Timing_Events.Timing_Event are
declared at the library level.
No_Long_Long_Integers
diff --git a/gcc/ada/doc/gnat_rm/the_gnat_library.rst b/gcc/ada/doc/gnat_rm/the_gnat_library.rst
index 6b9a410..d70e71c 100644
--- a/gcc/ada/doc/gnat_rm/the_gnat_library.rst
+++ b/gcc/ada/doc/gnat_rm/the_gnat_library.rst
@@ -505,6 +505,18 @@ This package provides subprograms for Text_IO for unbounded
wide wide strings, avoiding the necessity for an intermediate operation
with ordinary wide wide strings.
+.. _`Ada.Task_Initialization_(a-tasini.ads)`:
+
+``Ada.Task_Initialization`` (:file:`a-tasini.ads`)
+==================================================
+
+.. index:: Ada.Task_Initialization (a-tasini.ads)
+
+This package provides a way to set a global initialization handler that
+is automatically invoked whenever a task is activated. Handlers are
+parameterless procedures. Note that such a handler is only invoked for
+those tasks activated after the handler is set.
+
.. _`Ada.Text_IO.C_Streams_(a-tiocst.ads)`:
``Ada.Text_IO.C_Streams`` (:file:`a-tiocst.ads`)
diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
index 1d44d70..1dec487 100644
--- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
+++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
@@ -2058,15 +2058,6 @@ Alphabetical List of All Switches
Cancel effect of previous :switch:`-gnatp` switch.
-.. index:: -gnatP (gcc)
-
-:switch:`-gnatP`
- Enable polling. This is required on some systems (notably Windows NT) to
- obtain asynchronous abort and asynchronous transfer of control capability.
- See ``Pragma_Polling`` in the :title:`GNAT_Reference_Manual` for full
- details.
-
-
.. index:: -gnatq (gcc)
:switch:`-gnatq`
@@ -3874,8 +3865,14 @@ of the pragma in the :title:`GNAT_Reference_manual`).
This switch activates warnings for access to variables which
may not be properly initialized. The default is that
- such warnings are generated.
+ such warnings are generated. This switch will also be emitted when
+ initializing an array or record object via the following aggregate:
+
+ .. code-block:: ada
+ Array_Or_Record : XXX := (others => <>);
+
+ unless the relevant type fully initializes all components.
.. index:: -gnatwV (gcc)
@@ -3884,17 +3881,6 @@ of the pragma in the :title:`GNAT_Reference_manual`).
This switch suppresses warnings for access to variables which
may not be properly initialized.
- For variables of a composite type, the warning can also be suppressed in
- Ada 2005 by using a default initialization with a box. For example, if
- Table is an array of records whose components are only partially uninitialized,
- then the following code:
-
- .. code-block:: ada
-
- Tab : Table := (others => <>);
-
- will suppress warnings on subsequent statements that access components
- of variable Tab.
.. index:: -gnatw.v (gcc)
@@ -6508,8 +6494,8 @@ be presented in subsequent sections.
limitations:
* Starting the program's execution in the debugger will cause it to
- stop at the start of the ``main`` function instead of the main subprogram.
- This can be worked around by manually inserting a breakpoint on that
+ stop at the start of the ``main`` function instead of the main subprogram.
+ This can be worked around by manually inserting a breakpoint on that
subprogram and resuming the program's execution until reaching that breakpoint.
* Programs using GNAT.Compiler_Version will not link.
diff --git a/gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst b/gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst
index 883f012..5c51222 100644
--- a/gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst
+++ b/gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst
@@ -1920,12 +1920,13 @@ building specialized scripts.
:switch:`--comments-fill`
- Fill comment blocks.
+ Fill comment blocks. This is the default.
+ Use :switch:`--no-comments-fill` to turn off filling.
:switch:`--comments-special`
Keep unchanged special form comments.
- This is the default.
+ The default is :switch:`--no-comments-special`.
.. index:: --comments-only (gnatpp)
@@ -2153,18 +2154,18 @@ building specialized scripts.
A_Very_Very_Very_Very_Very_Very_Very_Very_Long_One);
- .. index:: --call_threshold (gnatpp)
+ .. index:: --call-threshold (gnatpp)
- :switch:`--call_threshold={nnn}`
+ :switch:`--call-threshold={nnn}`
If the number of parameter associations is greater than ``nnn`` and if at
least one association uses named notation, start each association from
a new line. If ``nnn`` is 0, no check for the number of associations
is made; this is the default.
- .. index:: --par_threshold (gnatpp)
+ .. index:: --par-threshold (gnatpp)
- :switch:`--par_threshold={nnn}`
+ :switch:`--par-threshold={nnn}`
If the number of parameter specifications is greater than ``nnn``
(or equal to ``nnn`` in case of a function), start each specification from
a new line. If ``nnn`` is 0, and :switch:`--no-separate-is` was not specified, then
diff --git a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
index b8729d0..2f0e10c 100644
--- a/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
+++ b/gcc/ada/doc/gnat_ugn/the_gnat_compilation_model.rst
@@ -1445,7 +1445,6 @@ recognized by GNAT::
Overriding_Renamings
Partition_Elaboration_Policy
Persistent_BSS
- Polling
Prefix_Exception_Messages
Priority_Specific_Dispatching
Profile
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index bf839a5..f39b3bc 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -13,25 +13,16 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-pragma Style_Checks (All_Checks);
--- Turn off subprogram ordering, not used for this unit
-
with Atree; use Atree;
with Elists; use Elists;
with Namet; use Namet;
@@ -1526,7 +1517,7 @@ package body Einfo is
function Has_Constrained_Partial_View (Id : E) return B is
begin
pragma Assert (Is_Type (Id));
- return Flag187 (Id);
+ return Flag187 (Base_Type (Id));
end Has_Constrained_Partial_View;
function Has_Controlled_Component (Id : E) return B is
@@ -2867,7 +2858,7 @@ package body Einfo is
function Minimum_Accessibility (Id : E) return E is
begin
- pragma Assert (Ekind (Id) in Formal_Kind);
+ pragma Assert (Is_Formal (Id));
return Node24 (Id);
end Minimum_Accessibility;
@@ -3311,6 +3302,13 @@ package body Einfo is
function Scope_Depth_Value (Id : E) return U is
begin
+ pragma Assert
+ (Ekind (Id) in
+ Concurrent_Kind | Entry_Kind | Generic_Unit_Kind |
+ E_Package | E_Package_Body | Subprogram_Kind |
+ E_Block | E_Subprogram_Body |
+ E_Private_Type .. E_Limited_Private_Subtype |
+ E_Void | E_Loop | E_Return_Statement);
return Uint22 (Id);
end Scope_Depth_Value;
@@ -6067,7 +6065,8 @@ package body Einfo is
procedure Set_Limited_View (Id : E; V : E) is
begin
- pragma Assert (Ekind (Id) = E_Package);
+ pragma Assert (Ekind (Id) = E_Package
+ and then not Is_Generic_Instance (Id));
Set_Node23 (Id, V);
end Set_Limited_View;
@@ -6126,7 +6125,7 @@ package body Einfo is
procedure Set_Minimum_Accessibility (Id : E; V : E) is
begin
- pragma Assert (Ekind (Id) in Formal_Kind);
+ pragma Assert (Is_Formal (Id));
Set_Node24 (Id, V);
end Set_Minimum_Accessibility;
@@ -6582,7 +6581,13 @@ package body Einfo is
procedure Set_Scope_Depth_Value (Id : E; V : U) is
begin
- pragma Assert (not Is_Record_Type (Id));
+ pragma Assert
+ (Ekind (Id) in
+ Concurrent_Kind | Entry_Kind | Generic_Unit_Kind |
+ E_Package | E_Package_Body | Subprogram_Kind |
+ E_Block | E_Subprogram_Body |
+ E_Private_Type .. E_Limited_Private_Subtype |
+ E_Void | E_Loop | E_Return_Statement);
Set_Uint22 (Id, V);
end Set_Scope_Depth_Value;
@@ -7647,10 +7652,11 @@ package body Einfo is
Id = Pragma_Refined_State or else
Id = Pragma_Volatile_Function;
- -- Contract / test case pragmas
+ -- Contract / subprogram variant / test case pragmas
Is_CTC : constant Boolean :=
Id = Pragma_Contract_Cases or else
+ Id = Pragma_Subprogram_Variant or else
Id = Pragma_Test_Case;
-- Pre / postcondition pragmas
@@ -7836,6 +7842,17 @@ package body Einfo is
end Has_Invariants;
--------------------------
+ -- Has_Limited_View --
+ --------------------------
+
+ function Has_Limited_View (Id : E) return B is
+ begin
+ return Ekind (Id) = E_Package
+ and then not Is_Generic_Instance (Id)
+ and then Present (Limited_View (Id));
+ end Has_Limited_View;
+
+ --------------------------
-- Has_Non_Limited_View --
--------------------------
@@ -8029,15 +8046,6 @@ package body Einfo is
return Empty;
end Invariant_Procedure;
- ----------------------
- -- Is_Atomic_Or_VFA --
- ----------------------
-
- function Is_Atomic_Or_VFA (Id : E) return B is
- begin
- return Is_Atomic (Id) or else Is_Volatile_Full_Access (Id);
- end Is_Atomic_Or_VFA;
-
------------------
-- Is_Base_Type --
------------------
@@ -8196,6 +8204,15 @@ package body Einfo is
return Ekind (Id) = E_Procedure and then Chars (Id) = Name_uFinalizer;
end Is_Finalizer;
+ ----------------------
+ -- Is_Full_Access --
+ ----------------------
+
+ function Is_Full_Access (Id : E) return B is
+ begin
+ return Is_Atomic (Id) or else Is_Volatile_Full_Access (Id);
+ end Is_Full_Access;
+
-------------------
-- Is_Null_State --
-------------------
@@ -10873,21 +10890,18 @@ package body Einfo is
when Formal_Kind =>
Write_Str ("Protected_Formal");
- when E_Block
- | E_Entry
- | E_Entry_Family
- | E_Function
- | E_Generic_Function
- | E_Generic_Package
- | E_Generic_Procedure
- | E_Loop
+ when Concurrent_Kind
+ | Entry_Kind
+ | Generic_Unit_Kind
| E_Package
| E_Package_Body
- | E_Procedure
- | E_Protected_Type
- | E_Return_Statement
+ | Subprogram_Kind
+ | E_Block
| E_Subprogram_Body
- | E_Task_Type
+ | E_Private_Type .. E_Limited_Private_Subtype
+ | E_Void
+ | E_Loop
+ | E_Return_Statement
=>
Write_Str ("Scope_Depth_Value");
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 7932c92..be195ab 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -1576,7 +1570,7 @@ package Einfo is
-- Defined for the given type. Note that this flag can be False even
-- if Component_Size is non-zero (happens in the case of derived types).
--- Has_Constrained_Partial_View (Flag187)
+-- Has_Constrained_Partial_View (Flag187) [base type only]
-- Defined in private type and their completions, when the private
-- type has no discriminants and the full view has discriminants with
-- defaults. In Ada 2005 heap-allocated objects of such types are not
@@ -1785,6 +1779,10 @@ package Einfo is
-- invariant of its own or inherits at least one class-wide invariant
-- from a parent type or an interface.
+-- Has_Limited_View (synth)
+-- Defined in all entities. True for non-generic package entities that
+-- are non-instances and their Limited_View attribute is present.
+
-- Has_Loop_Entry_Attributes (Flag260)
-- Defined in E_Loop entities. Set when the loop is subject to at least
-- one attribute 'Loop_Entry. The flag also implies that the loop has
@@ -1861,8 +1859,8 @@ package Einfo is
-- Has_Own_DIC (Flag3) [base type only]
-- Defined in all type entities. Set for a private type and its full view
--- (and its underlying full view, if the full view is itsef private) when
--- the type is subject to pragma Default_Initial_Condition.
+-- (and its underlying full view, if the full view is itself private)
+-- when the type is subject to pragma Default_Initial_Condition.
-- Has_Own_Invariants (Flag232) [base type only]
-- Defined in all type entities. Set on any type that defines at least
@@ -2376,12 +2374,11 @@ package Einfo is
-- In the case of private and incomplete types, this flag is set in
-- both the partial view and the full view.
--- Is_Atomic_Or_VFA (synth)
+-- Is_Full_Access (synth)
-- Defined in all type entities, and also in constants, components and
--- variables. Set if a pragma Atomic or Shared or Volatile_Full_Access
--- applies to the entity. For many purposes VFA objects should be treated
--- the same as Atomic objects, and this predicate is intended for that
--- usage. In the case of private and incomplete types, the predicate
+-- variables. Set if an aspect/pragma Atomic/Shared, or an aspect/pragma
+-- Volatile_Full_Access or an Ada 2020 aspect Full_Access_Only applies
+-- to the entity. In the case of private and incomplete types, the flag
-- applies to both the partial view and the full view.
-- Is_Base_Type (synthesized)
@@ -2657,10 +2654,6 @@ package Einfo is
-- Used to generate constraint checks on calls to these subprograms, even
-- within an instance of a predefined run-time unit, in which checks
-- are otherwise suppressed.
---
--- The flag is also set on the entity of the expression function created
--- within an instance, for a function that has external axiomatization,
--- for use in GNATprove mode.
-- Is_Generic_Actual_Type (Flag94)
-- Defined in all type and subtype entities. Set in the subtype
@@ -3424,9 +3417,10 @@ package Einfo is
-- Is_Volatile_Full_Access (Flag285)
-- Defined in all type entities, and also in constants, components, and
--- variables. Set if a pragma Volatile_Full_Access applies to the entity.
--- In the case of private and incomplete types, this flag is set in
--- both the partial view and the full view.
+-- variables. Set if an aspect/pragma Volatile_Full_Access or an Ada 2020
+-- aspect Full_Access_Only applies to the entity. In the case of private
+-- and incomplete types, this flag is set in both the partial view and
+-- the full view.
-- Is_Wrapper_Package (synthesized)
-- Defined in package entities. Indicates that the package has been
@@ -4280,14 +4274,16 @@ package Einfo is
-- the Scope will be Standard.
-- Scope_Depth (synthesized)
--- Applies to program units, blocks, concurrent types and entries, and
--- also to record types, i.e. to any entity that can appear on the scope
--- stack. Yields the scope depth value, which for those entities other
--- than records is simply the scope depth value, for record entities, it
--- is the Scope_Depth of the record scope.
+-- Applies to program units, blocks, loops, return statements,
+-- concurrent types, private types and entries, and also to record types,
+-- i.e. to any entity that can appear on the scope stack. Yields the
+-- scope depth value, which for those entities other than records is
+-- simply the scope depth value, for record entities, it is the
+-- Scope_Depth of the record scope.
-- Scope_Depth_Value (Uint22)
--- Defined in program units, blocks, concurrent types, and entries.
+-- Defined in program units, blocks, loops, return statements,
+-- concurrent types, private types and entries.
-- Indicates the number of scopes that statically enclose the declaration
-- of the unit or type. Library units have a depth of zero. Note that
-- record types can act as scopes but do NOT have this field set (see
@@ -5819,7 +5815,7 @@ package Einfo is
-- Implementation_Base_Type (synth)
-- Invariant_Procedure (synth)
-- Is_Access_Protected_Subprogram_Type (synth)
- -- Is_Atomic_Or_VFA (synth)
+ -- Is_Full_Access (synth)
-- Is_Controlled (synth)
-- Object_Size_Clause (synth)
-- Partial_Invariant_Procedure (synth)
@@ -5986,7 +5982,7 @@ package Einfo is
-- Is_Volatile (Flag16)
-- Is_Volatile_Full_Access (Flag285)
-- Treat_As_Volatile (Flag41)
- -- Is_Atomic_Or_VFA (synth)
+ -- Is_Full_Access (synth)
-- Next_Component (synth)
-- Next_Component_Or_Discriminant (synth)
@@ -6040,8 +6036,8 @@ package Einfo is
-- Treat_As_Volatile (Flag41)
-- Address_Clause (synth)
-- Alignment_Clause (synth)
- -- Is_Atomic_Or_VFA (synth)
-- Is_Elaboration_Target (synth)
+ -- Is_Full_Access (synth)
-- Size_Clause (synth)
-- E_Decimal_Fixed_Point_Type
@@ -6482,6 +6478,7 @@ package Einfo is
-- Has_Null_Abstract_State (synth)
-- Is_Elaboration_Target (synth)
-- Is_Wrapper_Package (synth) (non-generic case only)
+ -- Has_Limited_View (synth) (non-generic case only)
-- Scope_Depth (synth)
-- E_Package_Body
@@ -6859,8 +6856,8 @@ package Einfo is
-- Treat_As_Volatile (Flag41)
-- Address_Clause (synth)
-- Alignment_Clause (synth)
- -- Is_Atomic_Or_VFA (synth)
-- Is_Elaboration_Target (synth)
+ -- Is_Full_Access (synth)
-- Size_Clause (synth)
-- E_Void
@@ -7673,13 +7670,13 @@ package Einfo is
function Has_Foreign_Convention (Id : E) return B;
function Has_Interrupt_Handler (Id : E) return B;
function Has_Invariants (Id : E) return B;
+ function Has_Limited_View (Id : E) return B;
function Has_Non_Limited_View (Id : E) return B;
function Has_Non_Null_Abstract_State (Id : E) return B;
function Has_Non_Null_Visible_Refinement (Id : E) return B;
function Has_Null_Abstract_State (Id : E) return B;
function Has_Null_Visible_Refinement (Id : E) return B;
function Implementation_Base_Type (Id : E) return E;
- function Is_Atomic_Or_VFA (Id : E) return B;
function Is_Base_Type (Id : E) return B;
function Is_Boolean_Type (Id : E) return B;
function Is_Constant_Object (Id : E) return B;
@@ -7689,6 +7686,7 @@ package Einfo is
function Is_Elaboration_Target (Id : E) return B;
function Is_External_State (Id : E) return B;
function Is_Finalizer (Id : E) return B;
+ function Is_Full_Access (Id : E) return B;
function Is_Null_State (Id : E) return B;
function Is_Package_Or_Generic_Package (Id : E) return B;
function Is_Packed_Array (Id : E) return B;
@@ -8519,6 +8517,7 @@ package Einfo is
-- Refined_Global
-- Refined_Post
-- Refined_State
+ -- Subprogram_Variant
-- Test_Case
-- Volatile_Function
@@ -8890,7 +8889,6 @@ package Einfo is
pragma Inline (Is_Assignable);
pragma Inline (Is_Asynchronous);
pragma Inline (Is_Atomic);
- pragma Inline (Is_Atomic_Or_VFA);
pragma Inline (Is_Bit_Packed_Array);
pragma Inline (Is_Called);
pragma Inline (Is_Character_Type);
@@ -8941,6 +8939,7 @@ package Einfo is
pragma Inline (Is_Formal_Object);
pragma Inline (Is_Formal_Subprogram);
pragma Inline (Is_Frozen);
+ pragma Inline (Is_Full_Access);
pragma Inline (Is_Generic_Actual_Subprogram);
pragma Inline (Is_Generic_Actual_Type);
pragma Inline (Is_Generic_Instance);
@@ -9204,6 +9203,7 @@ package Einfo is
pragma Inline (Base_Type);
pragma Inline (Float_Rep);
pragma Inline (Has_Foreign_Convention);
+ pragma Inline (Has_Limited_View);
pragma Inline (Has_Non_Limited_View);
pragma Inline (Is_Base_Type);
pragma Inline (Is_Boolean_Type);
diff --git a/gcc/ada/elists.adb b/gcc/ada/elists.adb
index 90bcd2e..16e802d 100644
--- a/gcc/ada/elists.adb
+++ b/gcc/ada/elists.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -373,6 +367,64 @@ package body Elists is
return Elists.Last;
end New_Elmt_List;
+ -------------------
+ -- New_Elmt_List --
+ -------------------
+
+ function New_Elmt_List (Elmt1 : Node_Or_Entity_Id)
+ return Elist_Id
+ is
+ L : constant Elist_Id := New_Elmt_List;
+ begin
+ Append_Elmt (Elmt1, L);
+ return L;
+ end New_Elmt_List;
+
+ -------------------
+ -- New_Elmt_List --
+ -------------------
+
+ function New_Elmt_List
+ (Elmt1 : Node_Or_Entity_Id;
+ Elmt2 : Node_Or_Entity_Id) return Elist_Id
+ is
+ L : constant Elist_Id := New_Elmt_List (Elmt1);
+ begin
+ Append_Elmt (Elmt2, L);
+ return L;
+ end New_Elmt_List;
+
+ -------------------
+ -- New_Elmt_List --
+ -------------------
+
+ function New_Elmt_List
+ (Elmt1 : Node_Or_Entity_Id;
+ Elmt2 : Node_Or_Entity_Id;
+ Elmt3 : Node_Or_Entity_Id) return Elist_Id
+ is
+ L : constant Elist_Id := New_Elmt_List (Elmt1, Elmt2);
+ begin
+ Append_Elmt (Elmt3, L);
+ return L;
+ end New_Elmt_List;
+
+ -------------------
+ -- New_Elmt_List --
+ -------------------
+
+ function New_Elmt_List
+ (Elmt1 : Node_Or_Entity_Id;
+ Elmt2 : Node_Or_Entity_Id;
+ Elmt3 : Node_Or_Entity_Id;
+ Elmt4 : Node_Or_Entity_Id) return Elist_Id
+ is
+ L : constant Elist_Id := New_Elmt_List (Elmt1, Elmt2, Elmt3);
+ begin
+ Append_Elmt (Elmt4, L);
+ return L;
+ end New_Elmt_List;
+
---------------
-- Next_Elmt --
---------------
diff --git a/gcc/ada/elists.ads b/gcc/ada/elists.ads
index 12672a6..92b74fc 100644
--- a/gcc/ada/elists.ads
+++ b/gcc/ada/elists.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -90,6 +84,21 @@ package Elists is
-- a field in some other node which points to an element list where the
-- list is then subsequently filled in using Append calls.
+ function New_Elmt_List (Elmt1 : Node_Or_Entity_Id) return Elist_Id;
+ function New_Elmt_List
+ (Elmt1 : Node_Or_Entity_Id;
+ Elmt2 : Node_Or_Entity_Id) return Elist_Id;
+ function New_Elmt_List
+ (Elmt1 : Node_Or_Entity_Id;
+ Elmt2 : Node_Or_Entity_Id;
+ Elmt3 : Node_Or_Entity_Id) return Elist_Id;
+ function New_Elmt_List
+ (Elmt1 : Node_Or_Entity_Id;
+ Elmt2 : Node_Or_Entity_Id;
+ Elmt3 : Node_Or_Entity_Id;
+ Elmt4 : Node_Or_Entity_Id) return Elist_Id;
+ -- Create a new element list containing the given arguments.
+
function First_Elmt (List : Elist_Id) return Elmt_Id;
pragma Inline (First_Elmt);
-- Obtains the first element of the given element list or, if the list has
diff --git a/gcc/ada/env.c b/gcc/ada/env.c
index 5df0539..0ee09f4 100644
--- a/gcc/ada/env.c
+++ b/gcc/ada/env.c
@@ -68,18 +68,9 @@
envLib.h on VxWorks MILS and VxWorks 653. */
#include <vThreadsData.h>
#include <envLib.h>
- #elif (_WRS_VXWORKS_MAJOR <= 6)
+ #else
+ /* Kernel mode */
#include <envLib.h>
- /* In that mode the following symbol is not defined in any VxWorks
- include files, prior to vxWorks 7, so we declare it as extern. */
- extern char** ppGlobalEnviron;
- #elif (_WRS_VXWORKS_MAJOR >= 7)
- /* This should work for kernel mode on VxWorks 7.x. In 7.2 the tcb
- is made private, so accessor functions must be used, in 7.0 it
- is optional but there is no way to distinguish between 7.2
- and 7.0 since the version.h header file was never updated. */
- #include <envLib.h>
- #include <taskLibCommon.h>
#endif
#endif
@@ -108,7 +99,8 @@ __gnat_getenv (char *name, int *len, char **value)
void
__gnat_setenv (char *name, char *value)
{
-#if (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__)
+#if (defined (__vxworks) && (defined (__RTP__) || _WRS_VXWORKS_MAJOR >= 7)) \
+ || defined (__APPLE__)
setenv (name, value, 1);
#else
@@ -119,9 +111,9 @@ __gnat_setenv (char *name, char *value)
sprintf (expression, "%s=%s", name, value);
putenv (expression);
-#if defined (__MINGW32__) || (defined (__vxworks) && ! defined (__RTP__))
- /* On some systems like MacOS X and Windows, putenv is making a copy of the
- expression string so we can free it after the call to putenv */
+#if defined (__MINGW32__) || defined (__vxworks)
+ /* putenv for Windows and VxWorks 6 kernel modules makes a copy of the
+ expression string, so we need to free it after the call to putenv. */
free (expression);
#endif
#endif
@@ -144,17 +136,16 @@ __gnat_environ (void)
extern char **environ;
return environ;
#else
- #if defined (__RTP__) || defined (VTHREADS) || (_WRS_VXWORKS_MAJOR <= 6)
+ #if defined (__RTP__) || defined (VTHREADS)
return environ;
- #elif (_WRS_VXWORKS_MAJOR >= 7)
- char **task_environ;
-
- task_environ = envGet (taskIdSelf ());
-
- if (task_environ == NULL)
- return ppGlobalEnviron;
- else
- return task_environ;
+ #else
+ /* For VxWorks kernel modules use envGet to get the task's environment
+ (either the task's private environment if it has one or the global
+ environment otherwise). taskId parameter of 0 refers to the current
+ task (the VxWorks documentation says to use NULL but the compiler
+ complains that taskId is an int rather than a pointer. Internally,
+ VxWorks uses 0 as well). */
+ return envGet (0);
#endif
#endif
}
@@ -162,7 +153,8 @@ __gnat_environ (void)
void __gnat_unsetenv (char *name)
{
#if defined (__hpux__) || defined (__sun__) \
- || (defined (__vxworks) && ! defined (__RTP__)) \
+ || (defined (__vxworks) && ! defined (__RTP__) \
+ && _WRS_VXWORKS_MAJOR <= 6) \
|| defined (_AIX) || defined (__Lynx__)
/* On Solaris and HP-UX there is no function to clear an environment
@@ -185,7 +177,7 @@ void __gnat_unsetenv (char *name)
if (strlen (env[index]) > size) {
if (strstr (env[index], name) == env[index] &&
env[index][size] == '=') {
-#if defined (__vxworks) && ! defined (__RTP__)
+#if defined (__vxworks)
/* on Vxworks we are sure that the string has been allocated using
malloc */
free (env[index]);
@@ -218,9 +210,10 @@ void __gnat_unsetenv (char *name)
void __gnat_clearenv (void)
{
#if defined (__sun__) \
- || (defined (__vxworks) && ! defined (__RTP__)) || defined (__Lynx__) \
+ || (defined (__vxworks) && !defined (__RTP__) && _WRS_VXWORKS_MAJOR <= 6) \
+ || defined (__Lynx__) \
|| defined (__PikeOS__)
- /* On Solaris, VxWorks (not RTPs), and Lynx there is no system
+ /* On Solaris, VxWorks kernel pre 7, and Lynx there is no system
call to unset a variable or to clear the environment so set all
the entries in the environ table to NULL (see comment in
__gnat_unsetenv for more explanation). */
@@ -232,7 +225,8 @@ void __gnat_clearenv (void)
index++;
}
#elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \
- || (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \
+ || (defined (__vxworks) && defined (__RTP__) || _WRS_VXWORKS_MAJOR >= 7) \
+ || defined (__CYGWIN__) \
|| defined (__NetBSD__) || defined (__OpenBSD__) || defined (__rtems__) \
|| defined (__DragonFly__) || defined (__DJGPP__)
/* On Windows, FreeBSD and MacOS there is no function to clean all the
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 1063d7d..049db89 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -1119,6 +1119,8 @@ package body Errout is
Prev => No_Error_Msg,
Sptr => Sptr,
Optr => Optr,
+ Insertion_Sloc => (if Has_Insertion_Line then Error_Msg_Sloc
+ else No_Location),
Sfile => Get_Source_File_Index (Sptr),
Line => Get_Physical_Line_Number (Sptr),
Col => Get_Column_Number (Sptr),
@@ -1823,8 +1825,8 @@ package body Errout is
---------------------
procedure Output_Messages is
- E : Error_Msg_Id;
- Err_Flag : Boolean;
+
+ -- Local subprograms
procedure Write_Error_Summary;
-- Write error summary
@@ -1835,6 +1837,14 @@ package body Errout is
procedure Write_Max_Errors;
-- Write message if max errors reached
+ procedure Write_Source_Code_Line (Loc : Source_Ptr);
+ -- Write the source code line corresponding to Loc, as follows:
+ --
+ -- line | actual code line here with Loc somewhere
+ -- | ^ here
+ --
+ -- where the carret on the last line points to location Loc.
+
-------------------------
-- Write_Error_Summary --
-------------------------
@@ -2025,6 +2035,83 @@ package body Errout is
end if;
end Write_Max_Errors;
+ ----------------------------
+ -- Write_Source_Code_Line --
+ ----------------------------
+
+ procedure Write_Source_Code_Line (Loc : Source_Ptr) is
+
+ function Image (X : Positive; Width : Positive) return String;
+ -- Output number X over Width characters, with whitespace padding.
+ -- Only output the low-order Width digits of X, if X is larger than
+ -- Width digits.
+
+ -----------
+ -- Image --
+ -----------
+
+ function Image (X : Positive; Width : Positive) return String is
+ Str : String (1 .. Width);
+ Curr : Natural := X;
+ begin
+ for J in reverse 1 .. Width loop
+ if Curr > 0 then
+ Str (J) := Character'Val (Character'Pos ('0') + Curr mod 10);
+ Curr := Curr / 10;
+ else
+ Str (J) := ' ';
+ end if;
+ end loop;
+
+ return Str;
+ end Image;
+
+ -- Local variables
+
+ Line : constant Pos := Pos (Get_Physical_Line_Number (Loc));
+ Col : constant Natural := Natural (Get_Column_Number (Loc));
+ Width : constant := 5;
+
+ Buf : Source_Buffer_Ptr;
+ Cur_Loc : Source_Ptr := Loc;
+
+ -- Start of processing for Write_Source_Code_Line
+
+ begin
+ if Loc >= First_Source_Ptr then
+ Buf := Source_Text (Get_Source_File_Index (Loc));
+
+ -- First line with the actual source code line
+
+ Write_Str (Image (Positive (Line), Width => Width));
+ Write_Str (" |");
+ Write_Str (String (Buf (Loc - Source_Ptr (Col) + 1 .. Loc - 1)));
+
+ while Cur_Loc <= Buf'Last
+ and then Buf (Cur_Loc) /= ASCII.LF
+ loop
+ Write_Char (Buf (Cur_Loc));
+ Cur_Loc := Cur_Loc + 1;
+ end loop;
+
+ Write_Eol;
+
+ -- Second line with carret sign pointing to location Loc
+
+ Write_Str (String'(1 .. Width => ' '));
+ Write_Str (" |");
+ Write_Str (String'(1 .. Col - 1 => ' '));
+ Write_Str ("^ here");
+ Write_Eol;
+ end if;
+ end Write_Source_Code_Line;
+
+ -- Local variables
+
+ E : Error_Msg_Id;
+ Err_Flag : Boolean;
+ Use_Prefix : Boolean;
+
-- Start of processing for Output_Messages
begin
@@ -2051,27 +2138,72 @@ package body Errout is
E := First_Error_Msg;
while E /= No_Error_Msg loop
+
+ -- If -gnatdF is used, separate main messages from previous
+ -- messages with a newline (unless it is an info message) and
+ -- make continuation messages follow the main message with only
+ -- an indentation of two space characters, without repeating
+ -- file:line:col: prefix.
+
+ Use_Prefix :=
+ not (Debug_Flag_FF and then Errors.Table (E).Msg_Cont);
+
if not Errors.Table (E).Deleted and then not Debug_Flag_KK then
- if Full_Path_Name_For_Brief_Errors then
- Write_Name (Full_Ref_Name (Errors.Table (E).Sfile));
- else
- Write_Name (Reference_Name (Errors.Table (E).Sfile));
+
+ if Debug_Flag_FF then
+ if Errors.Table (E).Msg_Cont then
+ Write_Str (" ");
+ elsif not Errors.Table (E).Info then
+ Write_Eol;
+ end if;
end if;
- Write_Char (':');
- Write_Int (Int (Physical_To_Logical
- (Errors.Table (E).Line,
- Errors.Table (E).Sfile)));
- Write_Char (':');
+ if Use_Prefix then
+ if Full_Path_Name_For_Brief_Errors then
+ Write_Name (Full_Ref_Name (Errors.Table (E).Sfile));
+ else
+ Write_Name (Reference_Name (Errors.Table (E).Sfile));
+ end if;
+
+ Write_Char (':');
+ Write_Int (Int (Physical_To_Logical
+ (Errors.Table (E).Line,
+ Errors.Table (E).Sfile)));
+ Write_Char (':');
+
+ if Errors.Table (E).Col < 10 then
+ Write_Char ('0');
+ end if;
- if Errors.Table (E).Col < 10 then
- Write_Char ('0');
+ Write_Int (Int (Errors.Table (E).Col));
+ Write_Str (": ");
end if;
- Write_Int (Int (Errors.Table (E).Col));
- Write_Str (": ");
Output_Msg_Text (E);
Write_Eol;
+
+ -- If -gnatdF is used, write the source code line corresponding
+ -- to the location of the main message (unless it is an info
+ -- message). Also write the source code line corresponding to
+ -- an insertion location inside continuation messages.
+
+ if Debug_Flag_FF
+ and then not Errors.Table (E).Info
+ then
+ if Errors.Table (E).Msg_Cont then
+ declare
+ Loc : constant Source_Ptr :=
+ Errors.Table (E).Insertion_Sloc;
+ begin
+ if Loc /= No_Location then
+ Write_Source_Code_Line (Loc);
+ end if;
+ end;
+
+ else
+ Write_Source_Code_Line (Errors.Table (E).Sptr);
+ end if;
+ end if;
end if;
E := Errors.Table (E).Next;
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index 83a23cc..e46433f 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -112,8 +112,8 @@ package Errout is
-- already placed an error (not warning) message at that location,
-- then we assume this is cascaded junk and delete the message.
- -- This normal suppression action may be overridden in cases 2-5 (but not
- -- in case 1 or 7 by setting All_Errors mode, or by setting the special
+ -- This normal suppression action may be overridden in cases 2-5 (but
+ -- not in case 1 or 7) by setting All_Errors mode, or by setting the
-- unconditional message insertion character (!) as described below.
---------------------------------------------------------
@@ -453,6 +453,15 @@ package Errout is
-- Note that is mandatory that the caller ensure that global variables
-- are set before the Error_Msg call, otherwise the result is undefined.
+ -- Also note that calls to Error_Msg and its variants destroy the value of
+ -- these global variables, as a way to support the inclusion of multiple
+ -- insertion characters of the same type. For example, support for
+ -- multiple characters % for a name in the message (up to 3) is
+ -- implemented by unconditionally shifting the value for Error_Msg_Nam_2
+ -- to Error_Msg_Nam_1 and from Error_Msg_Nam_3 to Error_Msg_Nam_2 after
+ -- dealing with insertion character %. The caller should ensure that all
+ -- global variables are restored if needed prior to calling Error_Msg.
+
Error_Msg_Col : Column_Number renames Err_Vars.Error_Msg_Col;
-- Column for @ insertion character in message
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
index 0c5d98c..d0cc6ff 100644
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -689,9 +689,16 @@ package body Erroutc is
Txt := Text;
end if;
+ -- If -gnatdF is used, continuation messages follow the main message
+ -- with only an indentation of two space characters, without repeating
+ -- any prefix.
+
+ if Debug_Flag_FF and then E_Msg.Msg_Cont then
+ null;
+
-- For info messages, prefix message with "info: "
- if E_Msg.Info then
+ elsif E_Msg.Info then
Txt := new String'("info: " & Txt.all);
-- Warning treated as error
@@ -807,37 +814,49 @@ package body Erroutc is
J : Natural;
begin
- -- Nothing to do for continuation line
+ -- Nothing to do for continuation line, unless -gnatdF is set
- if Msg (Msg'First) = '\' then
+ if not Debug_Flag_FF and then Msg (Msg'First) = '\' then
return;
- end if;
- -- Set initial values of globals (may be changed during scan)
+ -- Some global variables are not set for continuation messages, as they
+ -- only make sense for the initial mesage.
+
+ elsif Msg (Msg'First) /= '\' then
- Is_Serious_Error := True;
- Is_Unconditional_Msg := False;
- Is_Warning_Msg := False;
- Has_Double_Exclam := False;
+ -- Set initial values of globals (may be changed during scan)
- -- Check style message
+ Is_Serious_Error := True;
+ Is_Unconditional_Msg := False;
+ Is_Warning_Msg := False;
- Is_Style_Msg :=
- Msg'Length > 7 and then Msg (Msg'First .. Msg'First + 6) = "(style)";
+ -- Check style message
- -- Check info message
+ Is_Style_Msg :=
+ Msg'Length > 7
+ and then Msg (Msg'First .. Msg'First + 6) = "(style)";
- Is_Info_Msg :=
- Msg'Length > 6 and then Msg (Msg'First .. Msg'First + 5) = "info: ";
+ -- Check info message
- -- Check check message
+ Is_Info_Msg :=
+ Msg'Length > 6
+ and then Msg (Msg'First .. Msg'First + 5) = "info: ";
- Is_Check_Msg :=
- (Msg'Length > 8 and then Msg (Msg'First .. Msg'First + 7) = "medium: ")
- or else
- (Msg'Length > 6 and then Msg (Msg'First .. Msg'First + 5) = "high: ")
- or else
- (Msg'Length > 5 and then Msg (Msg'First .. Msg'First + 4) = "low: ");
+ -- Check check message
+
+ Is_Check_Msg :=
+ (Msg'Length > 8
+ and then Msg (Msg'First .. Msg'First + 7) = "medium: ")
+ or else
+ (Msg'Length > 6
+ and then Msg (Msg'First .. Msg'First + 5) = "high: ")
+ or else
+ (Msg'Length > 5
+ and then Msg (Msg'First .. Msg'First + 4) = "low: ");
+ end if;
+
+ Has_Double_Exclam := False;
+ Has_Insertion_Line := False;
-- Loop through message looking for relevant insertion sequences
@@ -896,6 +915,12 @@ package body Erroutc is
J := J + 1;
end if;
+ -- Insertion line (# insertion)
+
+ elsif Msg (J) = '#' then
+ Has_Insertion_Line := True;
+ J := J + 1;
+
-- Non-serious error (| insertion)
elsif Msg (J) = '|' then
diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads
index 8472ee5..4c0e68a 100644
--- a/gcc/ada/erroutc.ads
+++ b/gcc/ada/erroutc.ads
@@ -51,6 +51,10 @@ package Erroutc is
-- Set true to indicate that the current message contains the insertion
-- sequence !! (force warnings even in non-main unit source files).
+ Has_Insertion_Line : Boolean := False;
+ -- Set True to indicate that the current message contains the insertion
+ -- character # (insert line number reference).
+
Is_Compile_Time_Msg : Boolean := False;
-- Set true to indicate that the current message originates from a
-- Compile_Time_Warning or Compile_Time_Error pragma.
@@ -209,6 +213,9 @@ package Erroutc is
-- instantiation copy corresponding to the instantiation referenced by
-- Sptr).
+ Insertion_Sloc : Source_Ptr;
+ -- Location in message for insertion character # when used
+
Line : Physical_Line_Number;
-- Line number for error message
@@ -470,11 +477,15 @@ package Erroutc is
-- Has_Double_Exclam is set True if the message contains the sequence !!
-- and is otherwise set False.
--
+ -- Has_Insertion_Line is set True if the message contains the character #
+ -- and is otherwise set False.
+ --
-- We need to know right away these aspects of a message, since we will
-- test these values before doing the full error scan.
--
-- Note that the call has no effect for continuation messages (those whose
- -- first character is '\'), and all variables are left unchanged.
+ -- first character is '\'), and all variables are left unchanged, unless
+ -- -gnatdF is set.
procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr);
-- All error messages whose location is in the range From .. To (not
diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb
index 75d29a9..d4821fc 100644
--- a/gcc/ada/errutil.adb
+++ b/gcc/ada/errutil.adb
@@ -209,6 +209,7 @@ package body Errutil is
Sfile => Get_Source_File_Index (Sptr),
Sptr => Sptr,
Optr => Optr,
+ Insertion_Sloc => No_Location,
Line => Get_Physical_Line_Number (Sptr),
Col => Get_Column_Number (Sptr),
Compile_Time_Pragma => Is_Compile_Time_Msg,
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 168a592..469777f 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -53,6 +53,7 @@ with Sem; use Sem;
with Sem_Aggr; use Sem_Aggr;
with Sem_Aux; use Sem_Aux;
with Sem_Ch3; use Sem_Ch3;
+with Sem_Ch8; use Sem_Ch8;
with Sem_Ch13; use Sem_Ch13;
with Sem_Eval; use Sem_Eval;
with Sem_Mech; use Sem_Mech;
@@ -425,6 +426,8 @@ package body Exp_Aggr is
return Nkind (First (Assoc)) /= N_Iterated_Component_Association;
end Is_OK_Aggregate;
+ -- Start of processing for Aggr_Assignment_OK_For_Backend
+
begin
-- Back end doesn't know about <>
@@ -473,7 +476,7 @@ package body Exp_Aggr is
Csiz := Component_Size (Ctyp);
Ctyp := Component_Type (Ctyp);
- if Is_Atomic_Or_VFA (Ctyp) then
+ if Is_Full_Access (Ctyp) then
return False;
end if;
end loop;
@@ -1954,7 +1957,30 @@ package body Exp_Aggr is
Expander_Mode_Save_And_Set (False);
Tcopy := New_Copy_Tree (Expr);
Set_Parent (Tcopy, N);
- Analyze_And_Resolve (Tcopy, Component_Type (Etype (N)));
+
+ -- For iterated_component_association analyze and resolve
+ -- the expression with name of the index parameter visible.
+ -- To manipulate scopes, we use entity of the implicit loop.
+
+ if Is_Iterated_Component then
+ declare
+ Index_Parameter : constant Entity_Id :=
+ Defining_Identifier (Parent (Expr));
+ begin
+ Push_Scope (Scope (Index_Parameter));
+ Enter_Name (Index_Parameter);
+ Analyze_And_Resolve
+ (Tcopy, Component_Type (Etype (N)));
+ End_Scope;
+ end;
+
+ -- For ordinary component association, just analyze and
+ -- resolve the expression.
+
+ else
+ Analyze_And_Resolve (Tcopy, Component_Type (Etype (N)));
+ end if;
+
Expander_Mode_Restore;
end if;
end if;
@@ -2334,7 +2360,7 @@ package body Exp_Aggr is
Sort_Case_Table (Table);
end if;
- -- STEP 1 (b): take care of the whole set of discrete choices
+ -- STEP 1 (b): take care of the whole set of discrete choices
for J in 1 .. Nb_Choices loop
Low := Table (J).Choice_Lo;
@@ -6376,7 +6402,7 @@ package body Exp_Aggr is
Convert_To_Positional (N);
- -- if the result is no longer an aggregate (e.g. it may be a string
+ -- If the result is no longer an aggregate (e.g. it may be a string
-- literal, or a temporary which has the needed value), then we are
-- done, since there is no longer a nested aggregate.
@@ -6755,13 +6781,16 @@ package body Exp_Aggr is
------------------------
procedure Expand_N_Aggregate (N : Node_Id) is
+ T : constant Entity_Id := Etype (N);
begin
-- Record aggregate case
- if Is_Record_Type (Etype (N)) then
+ if Is_Record_Type (T)
+ and then not Is_Private_Type (T)
+ then
Expand_Record_Aggregate (N);
- elsif Has_Aspect (Etype (N), Aspect_Aggregate) then
+ elsif Has_Aspect (T, Aspect_Aggregate) then
Expand_Container_Aggregate (N);
-- Array aggregate case
@@ -6809,11 +6838,10 @@ package body Exp_Aggr is
and then No (Expressions (N))
then
declare
- T : constant Entity_Id := Etype (N);
- X : constant Node_Id := First_Index (T);
- EC : constant Node_Id := Expression (CA);
- CV : constant Uint := Char_Literal_Value (EC);
- CC : constant Int := UI_To_Int (CV);
+ X : constant Node_Id := First_Index (T);
+ EC : constant Node_Id := Expression (CA);
+ CV : constant Uint := Char_Literal_Value (EC);
+ CC : constant Int := UI_To_Int (CV);
begin
if Nkind (X) = N_Range
@@ -6883,7 +6911,15 @@ package body Exp_Aggr is
Comp : Node_Id;
Decl : Node_Id;
+ Default : Node_Id;
Init_Stat : Node_Id;
+ Siz : Int;
+
+ function Aggregate_Size return Int;
+ -- Compute number of entries in aggregate, including choices
+ -- that cover a range, as well as iterated constructs.
+ -- Return -1 if the size is not known statically, in which case
+ -- we allocate a default size for the aggregate.
procedure Expand_Iterated_Component (Comp : Node_Id);
-- Handle iterated_component_association and iterated_Element
@@ -6891,41 +6927,182 @@ package body Exp_Aggr is
-- given either by a loop parameter specification or an iterator
-- specification.
+ --------------------
+ -- Aggregate_Size --
+ --------------------
+
+ function Aggregate_Size return Int is
+ Comp : Node_Id;
+ Choice : Node_Id;
+ Lo, Hi : Node_Id;
+ Siz : Int := 0;
+
+ procedure Add_Range_Size;
+ -- Compute size of component association given by
+ -- range or subtype name.
+
+ procedure Add_Range_Size is
+ begin
+ if Nkind (Lo) = N_Integer_Literal then
+ Siz := Siz + UI_To_Int (Intval (Hi))
+ - UI_To_Int (Intval (Lo)) + 1;
+ end if;
+ end Add_Range_Size;
+
+ begin
+ if Present (Expressions (N)) then
+ Siz := List_Length (Expressions (N));
+ end if;
+
+ if Present (Component_Associations (N)) then
+ Comp := First (Component_Associations (N));
+
+ -- If the component is an Iterated_Element_Association
+ -- it includes an iterator or a loop parameter, possibly
+ -- with a filter, so we do not attempt to compute its
+ -- size. Room for future optimization ???
+
+ if Nkind (Comp) = N_Iterated_Element_Association then
+ return -1;
+ end if;
+
+ while Present (Comp) loop
+ Choice := First (Choice_List (Comp));
+
+ while Present (Choice) loop
+ Analyze (Choice);
+
+ if Nkind (Choice) = N_Range then
+ Lo := Low_Bound (Choice);
+ Hi := High_Bound (Choice);
+ if Nkind (Lo) /= N_Integer_Literal
+ or else Nkind (Hi) /= N_Integer_Literal
+ then
+ return -1;
+ else
+ Add_Range_Size;
+ end if;
+
+ elsif Is_Entity_Name (Choice)
+ and then Is_Type (Entity (Choice))
+ then
+ Lo := Type_Low_Bound (Entity (Choice));
+ Hi := Type_High_Bound (Entity (Choice));
+ if Nkind (Lo) /= N_Integer_Literal
+ or else Nkind (Hi) /= N_Integer_Literal
+ then
+ return -1;
+ else
+ Add_Range_Size;
+ end if;
+
+ Rewrite (Choice,
+ Make_Range (Loc,
+ New_Copy_Tree (Lo),
+ New_Copy_Tree (Hi)));
+
+ else
+ -- Single choice (syntax excludes a subtype
+ -- indication).
+
+ Siz := Siz + 1;
+ end if;
+
+ Next (Choice);
+ end loop;
+ Next (Comp);
+ end loop;
+ end if;
+
+ return Siz;
+ end Aggregate_Size;
+
-------------------------------
-- Expand_Iterated_Component --
-------------------------------
procedure Expand_Iterated_Component (Comp : Node_Id) is
Expr : constant Node_Id := Expression (Comp);
- Loop_Id : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => Chars (Defining_Identifier (Comp)));
+ Key_Expr : Node_Id := Empty;
+ Loop_Id : Entity_Id;
L_Range : Node_Id;
L_Iteration_Scheme : Node_Id;
Loop_Stat : Node_Id;
+ Params : List_Id;
Stats : List_Id;
begin
- if Present (Iterator_Specification (Comp)) then
- L_Iteration_Scheme :=
- Make_Iteration_Scheme (Loc,
- Iterator_Specification => Iterator_Specification (Comp));
+ if Nkind (Comp) = N_Iterated_Element_Association then
+ Key_Expr := Key_Expression (Comp);
+
+ -- We create a new entity as loop identifier in all cases,
+ -- as is done for generated loops elsewhere, as the loop
+ -- structure has been previously analyzed.
+
+ if Present (Iterator_Specification (Comp)) then
+
+ -- Either an Iterator_Specification of a Loop_Parameter_
+ -- Specification is present.
+
+ L_Iteration_Scheme :=
+ Make_Iteration_Scheme (Loc,
+ Iterator_Specification => Iterator_Specification (Comp));
+ Loop_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => Chars (Defining_Identifier
+ (Iterator_Specification (Comp))));
+ Set_Defining_Identifier
+ (Iterator_Specification (L_Iteration_Scheme), Loop_Id);
+ else
+ L_Iteration_Scheme :=
+ Make_Iteration_Scheme (Loc,
+ Loop_Parameter_Specification =>
+ Loop_Parameter_Specification (Comp));
+ Loop_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => Chars (Defining_Identifier
+ (Loop_Parameter_Specification (Comp))));
+ Set_Defining_Identifier
+ (Loop_Parameter_Specification
+ (L_Iteration_Scheme), Loop_Id);
+ end if;
else
- L_Range := Relocate_Node (First (Discrete_Choices (Comp)));
- L_Iteration_Scheme :=
- Make_Iteration_Scheme (Loc,
- Loop_Parameter_Specification =>
- Make_Loop_Parameter_Specification (Loc,
- Defining_Identifier => Loop_Id,
- Discrete_Subtype_Definition => L_Range));
+
+ -- Iterated_Component_Association.
+
+ Loop_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => Chars (Defining_Identifier (Comp)));
+
+ if Present (Iterator_Specification (Comp)) then
+ L_Iteration_Scheme :=
+ Make_Iteration_Scheme (Loc,
+ Iterator_Specification => Iterator_Specification (Comp));
+
+ else
+ -- Loop_Parameter_Specifcation is parsed with a choice list.
+ -- where the range is the first (and only) choice.
+
+ L_Range := Relocate_Node (First (Discrete_Choices (Comp)));
+
+ L_Iteration_Scheme :=
+ Make_Iteration_Scheme (Loc,
+ Loop_Parameter_Specification =>
+ Make_Loop_Parameter_Specification (Loc,
+ Defining_Identifier => Loop_Id,
+ Discrete_Subtype_Definition => L_Range));
+ end if;
end if;
-- Build insertion statement. For a positional aggregate, only the
-- expression is needed. For a named aggregate, the loop variable,
-- whose type is that of the key, is an additional parameter for
-- the insertion operation.
+ -- If a Key_Expression is present, it serves as the additional
+ -- parameter. Otherwise the key is given by the loop parameter
+ -- itself.
if Present (Add_Unnamed_Subp) then
Stats := New_List
@@ -6935,13 +7112,23 @@ package body Exp_Aggr is
New_List (New_Occurrence_Of (Temp, Loc),
New_Copy_Tree (Expr))));
else
+ -- Named or indexed aggregate, for which a key is present,
+ -- possibly with a specified key_expression.
+
+ if Present (Key_Expr) then
+ Params := New_List (New_Occurrence_Of (Temp, Loc),
+ New_Copy_Tree (Key_Expr),
+ New_Copy_Tree (Expr));
+ else
+ Params := New_List (New_Occurrence_Of (Temp, Loc),
+ New_Occurrence_Of (Loop_Id, Loc),
+ New_Copy_Tree (Expr));
+ end if;
+
Stats := New_List
(Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Entity (Add_Named_Subp), Loc),
- Parameter_Associations =>
- New_List (New_Occurrence_Of (Temp, Loc),
- New_Occurrence_Of (Loop_Id, Loc),
- New_Copy_Tree (Expr))));
+ Parameter_Associations => Params));
end if;
Loop_Stat := Make_Implicit_Loop_Statement
@@ -6953,35 +7140,78 @@ package body Exp_Aggr is
end Expand_Iterated_Component;
+ -- Start of processing for Expand_Container_Aggregate
+
begin
Parse_Aspect_Aggregate (Asp,
Empty_Subp, Add_Named_Subp, Add_Unnamed_Subp,
New_Indexed_Subp, Assign_Indexed_Subp);
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Temp,
- Object_Definition => New_Occurrence_Of (Typ, Loc));
-
- Insert_Action (N, Decl);
- if Ekind (Entity (Empty_Subp)) = E_Function then
- Init_Stat := Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Temp, Loc),
- Expression => Make_Function_Call (Loc,
- Name => New_Occurrence_Of (Entity (Empty_Subp), Loc)));
- else
- Init_Stat := Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Temp, Loc),
- Expression => New_Occurrence_Of (Entity (Empty_Subp), Loc));
+
+ -- The constructor for bounded containers is a function with
+ -- a parameter that sets the size of the container. If the
+ -- size cannot be determined statically we use a default value.
+
+ Siz := Aggregate_Size;
+ if Siz < 0 then
+ Siz := 10;
end if;
- Append (Init_Stat, Aggr_Code);
+ if Ekind (Entity (Empty_Subp)) = E_Function
+ and then Present (First_Formal (Entity (Empty_Subp)))
+ then
+ Default := Default_Value (First_Formal (Entity (Empty_Subp)));
+ -- If aggregate size is not static, use default value of
+ -- formal parameter for allocation. We assume that this
+ -- (implementation-dependent) value is static, even though
+ -- the AI does not require it ???.
+
+ if Siz < 0 then
+ Siz := UI_To_Int (Intval (Default));
+ end if;
+
+ Init_Stat :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp,
+ Object_Definition => New_Occurrence_Of (Typ, Loc),
+ Expression => Make_Function_Call (Loc,
+ Name => New_Occurrence_Of (Entity (Empty_Subp), Loc),
+ Parameter_Associations =>
+ New_List (Make_Integer_Literal (Loc, Siz))));
+
+ Append (Init_Stat, Aggr_Code);
+
+ -- Use default value when aggregate size is not static.
+
+ else
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp,
+ Object_Definition => New_Occurrence_Of (Typ, Loc));
+
+ Insert_Action (N, Decl);
+ if Ekind (Entity (Empty_Subp)) = E_Function then
+ Init_Stat := Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Temp, Loc),
+ Expression => Make_Function_Call (Loc,
+ Name => New_Occurrence_Of (Entity (Empty_Subp), Loc)));
+ else
+ Init_Stat := Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Temp, Loc),
+ Expression => New_Occurrence_Of (Entity (Empty_Subp), Loc));
+ end if;
+
+ Append (Init_Stat, Aggr_Code);
+ end if;
---------------------------
-- Positional aggregate --
---------------------------
+ -- If the aggregate is positional the aspect must include
+ -- an Add_Unnamed subprogram.
+
if Present (Add_Unnamed_Subp)
- and then No (Assign_Indexed_Subp)
+ and then No (Component_Associations (N))
then
if Present (Expressions (N)) then
declare
@@ -7027,7 +7257,9 @@ package body Exp_Aggr is
-- generate an insertion statement for each.
while Present (Comp) loop
- if Nkind (Comp) = N_Iterated_Component_Association then
+ if Nkind (Comp) in N_Iterated_Component_Association
+ | N_Iterated_Element_Association
+ then
Expand_Iterated_Component (Comp);
else
Key := First (Choices (Comp));
@@ -7048,21 +7280,25 @@ package body Exp_Aggr is
Next (Comp);
end loop;
end;
+ end if;
-----------------------
-- Indexed_Aggregate --
-----------------------
- elsif Present (Assign_Indexed_Subp) then
+ -- For an indexed aggregate there must be an Assigned_Indexeed
+ -- subprogram. Note that unlike array aggregates, a container
+ -- aggregate must be fully positional or fully indexed. In the
+ -- first case the expansion has already taken place.
+
+ if Present (Assign_Indexed_Subp)
+ and then Present (Component_Associations (N))
+ then
declare
Insert : constant Entity_Id := Entity (Assign_Indexed_Subp);
Index_Type : constant Entity_Id :=
Etype (Next_Formal (First_Formal (Insert)));
- function Aggregate_Size return Int;
- -- Compute number of entries in aggregate, including choices
- -- that cover a range, as well as iterated constructs.
-
function Expand_Range_Component
(Rng : Node_Id;
Expr : Node_Id) return Node_Id;
@@ -7076,7 +7312,6 @@ package body Exp_Aggr is
Pos : Int := 0;
Stat : Node_Id;
Key : Node_Id;
- Size : Int := 0;
-----------------------------
-- Expand_Raange_Component --
@@ -7116,74 +7351,8 @@ package body Exp_Aggr is
Statements => Stats);
end Expand_Range_Component;
- --------------------
- -- Aggregate_Size --
- --------------------
-
- function Aggregate_Size return Int is
- Comp : Node_Id;
- Choice : Node_Id;
- Lo, Hi : Node_Id;
- Siz : Int := 0;
-
- procedure Add_Range_Size;
- -- Compute size of component association given by
- -- range or subtype name.
-
- procedure Add_Range_Size is
- begin
- if Nkind (Lo) = N_Integer_Literal then
- Siz := Siz + UI_To_Int (Intval (Hi))
- - UI_To_Int (Intval (Lo)) + 1;
- end if;
- end Add_Range_Size;
-
- begin
- if Present (Expressions (N)) then
- Siz := List_Length (Expressions (N));
- end if;
-
- if Present (Component_Associations (N)) then
- Comp := First (Component_Associations (N));
- while Present (Comp) loop
- Choice := First (Choices (Comp));
-
- while Present (Choice) loop
- Analyze (Choice);
-
- if Nkind (Choice) = N_Range then
- Lo := Low_Bound (Choice);
- Hi := High_Bound (Choice);
- Add_Range_Size;
-
- elsif Is_Entity_Name (Choice)
- and then Is_Type (Entity (Choice))
- then
- Lo := Type_Low_Bound (Entity (Choice));
- Hi := Type_High_Bound (Entity (Choice));
- Add_Range_Size;
- Rewrite (Choice,
- Make_Range (Loc,
- New_Copy_Tree (Lo),
- New_Copy_Tree (Hi)));
-
- else
- Resolve (Choice, Index_Type);
- Siz := Siz + 1;
- end if;
-
- Next (Choice);
- end loop;
- Next (Comp);
- end loop;
- end if;
-
- return Siz;
- end Aggregate_Size;
-
begin
- Size := Aggregate_Size;
- if Size > 0 then
+ if Siz > 0 then
-- Modify the call to the constructor to allocate the
-- required size for the aggregwte : call the provided
@@ -7191,7 +7360,7 @@ package body Exp_Aggr is
Index := Make_Op_Add (Loc,
Left_Opnd => New_Copy_Tree (Type_Low_Bound (Index_Type)),
- Right_Opnd => Make_Integer_Literal (Loc, Size - 1));
+ Right_Opnd => Make_Integer_Literal (Loc, Siz - 1));
Set_Expression (Init_Stat,
Make_Function_Call (Loc,
@@ -7270,9 +7439,16 @@ package body Exp_Aggr is
<<Next_Key>>
Next (Key);
end loop;
+
else
- Error_Msg_N ("iterated associations peding", N);
+ -- Iterated component association. Discard
+ -- positional insertion procedure.
+
+ Add_Named_Subp := Assign_Indexed_Subp;
+ Add_Unnamed_Subp := Empty;
+ Expand_Iterated_Component (Comp);
end if;
+
Next (Comp);
end loop;
end if;
@@ -8115,13 +8291,13 @@ package body Exp_Aggr is
-- Start of processing for Expand_Record_Aggregate
begin
- -- If the aggregate is to be assigned to an atomic/VFA variable, we have
+ -- If the aggregate is to be assigned to a full access variable, we have
-- to prevent a piecemeal assignment even if the aggregate is to be
-- expanded. We create a temporary for the aggregate, and assign the
-- temporary instead, so that the back end can generate an atomic move
-- for it.
- if Is_Atomic_VFA_Aggregate (N) then
+ if Is_Full_Access_Aggregate (N) then
return;
-- No special management required for aggregates used to initialize
@@ -8163,7 +8339,7 @@ package body Exp_Aggr is
Convert_To_Assignments (N, Typ);
-- In all other cases, build a proper aggregate to be handled by
- -- the back-end
+ -- the back-end.
else
Build_Back_End_Aggregate;
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 855aa29..d3468d5 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -29,7 +29,6 @@ with Checks; use Checks;
with Einfo; use Einfo;
with Elists; use Elists;
with Exp_Atag; use Exp_Atag;
-with Exp_Ch2; use Exp_Ch2;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch6; use Exp_Ch6;
with Exp_Ch9; use Exp_Ch9;
@@ -137,6 +136,12 @@ package body Exp_Attr is
-- special-case code that shuffles partial and full views in the middle
-- of semantic analysis and expansion.
+ function Default_Streaming_Unavailable (Typ : Entity_Id) return Boolean;
+ --
+ -- In most cases, references to unavailable streaming attributes
+ -- are rejected at compile time. In some obscure cases involving
+ -- generics and formal derived types, the problem is dealt with at runtime.
+
procedure Expand_Access_To_Protected_Op
(N : Node_Id;
Pref : Node_Id;
@@ -928,6 +933,24 @@ package body Exp_Attr is
end Compile_Stream_Body_In_Scope;
-----------------------------------
+ -- Default_Streaming_Unavailable --
+ -----------------------------------
+
+ function Default_Streaming_Unavailable (Typ : Entity_Id) return Boolean is
+ Btyp : constant Entity_Id := Implementation_Base_Type (Typ);
+ begin
+ if Is_Immutably_Limited_Type (Btyp)
+ and then not Is_Tagged_Type (Btyp)
+ and then not (Ekind (Btyp) = E_Record_Type
+ and then Present (Corresponding_Concurrent_Type (Btyp)))
+ then
+ pragma Assert (In_Instance_Body);
+ return True;
+ end if;
+ return False;
+ end Default_Streaming_Unavailable;
+
+ -----------------------------------
-- Expand_Access_To_Protected_Op --
-----------------------------------
@@ -1806,9 +1829,9 @@ package body Exp_Attr is
----------------------------------
procedure Expand_N_Attribute_Reference (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Pref : constant Node_Id := Prefix (N);
- Exprs : constant List_Id := Expressions (N);
+ Loc : constant Source_Ptr := Sloc (N);
+ Pref : constant Node_Id := Prefix (N);
+ Exprs : constant List_Id := Expressions (N);
function Get_Integer_Type (Typ : Entity_Id) return Entity_Id;
-- Return a small integer type appropriate for the enumeration type
@@ -1824,27 +1847,13 @@ package body Exp_Attr is
function Get_Integer_Type (Typ : Entity_Id) return Entity_Id is
Siz : constant Uint := Esize (Base_Type (Typ));
- Int_Typ : Entity_Id;
begin
-- We need to accommodate invalid values of the base type since we
-- accept them for Enum_Rep and Pos, so we reason on the Esize. And
-- we use an unsigned type since the enumeration type is unsigned.
- if Siz <= Esize (Standard_Short_Short_Unsigned) then
- Int_Typ := Standard_Short_Short_Unsigned;
-
- elsif Siz <= Esize (Standard_Short_Unsigned) then
- Int_Typ := Standard_Short_Unsigned;
-
- elsif Siz <= Esize (Standard_Unsigned) then
- Int_Typ := Standard_Unsigned;
-
- else
- Int_Typ := Standard_Long_Long_Unsigned;
- end if;
-
- return Int_Typ;
+ return Small_Integer_Type_For (Siz, Uns => True);
end Get_Integer_Type;
---------------------------------
@@ -1964,10 +1973,10 @@ package body Exp_Attr is
Analyze (N);
end Rewrite_Attribute_Proc_Call;
- Typ : constant Entity_Id := Etype (N);
- Btyp : constant Entity_Id := Base_Type (Typ);
- Ptyp : constant Entity_Id := Etype (Pref);
- Id : constant Attribute_Id := Get_Attribute_Id (Attribute_Name (N));
+ Typ : constant Entity_Id := Etype (N);
+ Btyp : constant Entity_Id := Base_Type (Typ);
+ Ptyp : constant Entity_Id := Etype (Pref);
+ Id : constant Attribute_Id := Get_Attribute_Id (Attribute_Name (N));
-- Start of processing for Expand_N_Attribute_Reference
@@ -2348,7 +2357,7 @@ package body Exp_Attr is
and then Is_Entity_Name (Prefix (Enc_Object))
and then (Ekind (Btyp) = E_General_Access_Type
or else Is_Local_Anonymous_Access (Btyp))
- and then Ekind (Entity (Prefix (Enc_Object))) in Formal_Kind
+ and then Is_Formal (Entity (Prefix (Enc_Object)))
and then Ekind (Etype (Entity (Prefix (Enc_Object))))
= E_Anonymous_Access_Type
and then Present (Extra_Accessibility
@@ -3470,8 +3479,12 @@ package body Exp_Attr is
-- replace this attribute with a direct reference to the attribute of
-- the appropriate index subtype (since otherwise the back end will
-- try to give us the value of 'First for this implementation type).
+ -- Do not do this if Ptyp depends on a discriminant as its bounds
+ -- are only available through N.
- if Is_Constrained_Packed_Array (Ptyp) then
+ if Is_Constrained_Packed_Array (Ptyp)
+ and then not Size_Depends_On_Discriminant (Ptyp)
+ then
Rewrite (N,
Make_Attribute_Reference (Loc,
Attribute_Name => Attribute_Name (N),
@@ -3826,6 +3839,14 @@ package body Exp_Attr is
-- the latter.
when Attribute_Initialized =>
+
+ -- Do not expand 'Initialized in CodePeer mode, it will be handled
+ -- by the back-end directly.
+
+ if CodePeer_Mode then
+ return;
+ end if;
+
Rewrite
(N,
Make_Attribute_Reference
@@ -3957,6 +3978,18 @@ package body Exp_Attr is
Analyze_And_Resolve (N, B_Type);
return;
+ -- Limited types
+
+ elsif Default_Streaming_Unavailable (U_Type) then
+ -- Do the same thing here as is done above in the
+ -- case where a No_Streams restriction is active.
+
+ Rewrite (N,
+ Make_Raise_Program_Error (Sloc (N),
+ Reason => PE_Stream_Operation_Not_Allowed));
+ Set_Etype (N, B_Type);
+ return;
+
-- Elementary types
elsif Is_Elementary_Type (U_Type) then
@@ -4588,7 +4621,7 @@ package body Exp_Attr is
-- b) The integer value is negative. In this case, we know that the
-- result is modulus + value, where the value might be as small as
-- -modulus. The trouble is what type do we use to do the subtract.
- -- No type will do, since modulus can be as big as 2**64, and no
+ -- No type will do, since modulus can be as big as 2**128, and no
-- integer type accommodates this value. Let's do bit of algebra
-- modulus + value
@@ -4667,6 +4700,8 @@ package body Exp_Attr is
Subp : Node_Id;
Temp : Entity_Id;
+ use Old_Attr_Util.Conditional_Evaluation;
+ use Old_Attr_Util.Indirect_Temps;
begin
-- Generating C code we don't need to expand this attribute when
-- we are analyzing the internally built nested postconditions
@@ -4750,10 +4785,60 @@ package body Exp_Attr is
Ins_Nod := First (Declarations (Ins_Nod));
end if;
+ if Eligible_For_Conditional_Evaluation (N) then
+ declare
+ Eval_Stmts : constant List_Id := New_List;
+
+ procedure Append_For_Indirect_Temp
+ (N : Node_Id; Is_Eval_Stmt : Boolean);
+ -- Append either a declaration (which is to be elaborated
+ -- unconditionally) or an evaluation statement (which is
+ -- to be executed conditionally).
+
+ -------------------------------
+ -- Append_For_Indirect_Temp --
+ -------------------------------
+
+ procedure Append_For_Indirect_Temp
+ (N : Node_Id; Is_Eval_Stmt : Boolean)
+ is
+ begin
+ if Is_Eval_Stmt then
+ Append_To (Eval_Stmts, N);
+ else
+ Insert_Before_And_Analyze (Ins_Nod, N);
+ end if;
+ end Append_For_Indirect_Temp;
+
+ procedure Declare_Indirect_Temporary is new
+ Declare_Indirect_Temp
+ (Append_Item => Append_For_Indirect_Temp);
+ begin
+ Declare_Indirect_Temporary
+ (Attr_Prefix => Pref, Indirect_Temp => Temp);
+
+ Insert_Before_And_Analyze (
+ Ins_Nod,
+ Make_If_Statement
+ (Sloc => Loc,
+ Condition => Conditional_Evaluation_Condition (N),
+ Then_Statements => Eval_Stmts));
+
+ Rewrite (N, Indirect_Temp_Value
+ (Temp => Temp,
+ Typ => Etype (Pref),
+ Loc => Loc));
+
+ if Present (Subp) then
+ Pop_Scope;
+ end if;
+ return;
+ end;
+
-- Preserve the tag of the prefix by offering a specific view of the
-- class-wide version of the prefix.
- if Is_Tagged_Type (Typ) then
+ elsif Is_Tagged_Type (Typ) then
-- Generate:
-- CW_Temp : constant Typ'Class := Typ'Class (Pref);
@@ -5025,6 +5110,18 @@ package body Exp_Attr is
Analyze (N);
return;
+ -- Limited types
+
+ elsif Default_Streaming_Unavailable (U_Type) then
+ -- Do the same thing here as is done above in the
+ -- case where a No_Streams restriction is active.
+
+ Rewrite (N,
+ Make_Raise_Program_Error (Sloc (N),
+ Reason => PE_Stream_Operation_Not_Allowed));
+ Set_Etype (N, Standard_Void_Type);
+ return;
+
-- For elementary types, we call the W_xxx routine directly. Note
-- that the effect of Write and Output is identical for the case
-- of an elementary type (there are no discriminants or bounds).
@@ -5266,7 +5363,6 @@ package body Exp_Attr is
when Attribute_Pred => Pred : declare
Etyp : constant Entity_Id := Base_Type (Ptyp);
- Ityp : Entity_Id;
begin
-- For enumeration types with non-standard representations, we
@@ -5286,26 +5382,14 @@ package body Exp_Attr is
Expand_Pred_Succ_Attribute (N);
end if;
- if Is_Unsigned_Type (Etyp) then
- if Esize (Typ) <= Standard_Integer_Size then
- Ityp := RTE (RE_Unsigned);
- else
- Ityp := RTE (RE_Long_Long_Unsigned);
- end if;
-
- else
- if Esize (Etyp) <= Standard_Integer_Size then
- Ityp := Standard_Integer;
- else
- Ityp := Standard_Long_Long_Integer;
- end if;
- end if;
-
Rewrite (N,
Unchecked_Convert_To (Etyp,
Make_Op_Subtract (Loc,
Left_Opnd =>
- Unchecked_Convert_To (Ityp, First (Exprs)),
+ Unchecked_Convert_To (
+ Integer_Type_For
+ (Esize (Etyp), Is_Unsigned_Type (Etyp)),
+ First (Exprs)),
Right_Opnd =>
Make_Integer_Literal (Loc, 1))));
@@ -5638,40 +5722,101 @@ package body Exp_Attr is
E2 : constant Node_Id := Next (E1);
Bnn : constant Entity_Id := Make_Temporary (Loc, 'B', N);
Typ : constant Entity_Id := Etype (N);
+
New_Loop : Node_Id;
+ Stat : Node_Id;
+
+ function Build_Stat (Comp : Node_Id) return Node_Id;
+ -- The reducer can be a function, a procedure whose first
+ -- parameter is in-out, or an attribute that is a function,
+ -- which (for now) can only be Min/Max. This subprogram
+ -- builds the corresponding computation for the generated loop.
+
+ ----------------
+ -- Build_Stat --
+ ----------------
+
+ function Build_Stat (Comp : Node_Id) return Node_Id is
+ begin
+ if Nkind (E1) = N_Attribute_Reference then
+ Stat := Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Bnn, Loc),
+ Expression => Make_Attribute_Reference (Loc,
+ Attribute_Name => Attribute_Name (E1),
+ Prefix => New_Copy (Prefix (E1)),
+ Expressions => New_List (
+ New_Occurrence_Of (Bnn, Loc),
+ Comp)));
+
+ elsif Ekind (Entity (E1)) = E_Procedure then
+ Stat := Make_Procedure_Call_Statement (Loc,
+ Name => New_Occurrence_Of (Entity (E1), Loc),
+ Parameter_Associations => New_List (
+ New_Occurrence_Of (Bnn, Loc),
+ Comp));
+ else
+ Stat := Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Bnn, Loc),
+ Expression => Make_Function_Call (Loc,
+ Name => New_Occurrence_Of (Entity (E1), Loc),
+ Parameter_Associations => New_List (
+ New_Occurrence_Of (Bnn, Loc),
+ Comp)));
+ end if;
+
+ return Stat;
+ end Build_Stat;
-- If the prefix is an aggregate, its unique component is an
-- Iterated_Element, and we create a loop out of its iterator.
+ -- The iterated_component_Association is parsed as a loop
+ -- parameter specification with "in" or as a container
+ -- iterator with "of".
begin
if Nkind (Prefix (N)) = N_Aggregate then
declare
Stream : constant Node_Id :=
First (Component_Associations (Prefix (N)));
- Id : constant Node_Id := Defining_Identifier (Stream);
Expr : constant Node_Id := Expression (Stream);
- Ch : constant Node_Id :=
- First (Discrete_Choices (Stream));
+ Id : constant Node_Id := Defining_Identifier (Stream);
+ It_Spec : constant Node_Id :=
+ Iterator_Specification (Stream);
+ Ch : Node_Id;
+ Iter : Node_Id;
+
begin
- New_Loop := Make_Loop_Statement (Loc,
- Iteration_Scheme =>
+ -- Iteration may be given by an element iterator:
+
+ if Nkind (Stream) = N_Iterated_Component_Association
+ and then Present (It_Spec)
+ and then Of_Present (It_Spec)
+ then
+ Iter :=
+ Make_Iteration_Scheme (Loc,
+ Iterator_Specification =>
+ Relocate_Node (It_Spec),
+ Loop_Parameter_Specification => Empty);
+
+ else
+ Ch := First (Discrete_Choices (Stream));
+ Iter :=
Make_Iteration_Scheme (Loc,
Iterator_Specification => Empty,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => New_Copy (Id),
Discrete_Subtype_Definition =>
- Relocate_Node (Ch))),
+ Relocate_Node (Ch)));
+ end if;
+
+ New_Loop := Make_Loop_Statement (Loc,
+ Iteration_Scheme => Iter,
End_Label => Empty,
- Statements => New_List (
- Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Bnn, Loc),
- Expression => Make_Function_Call (Loc,
- Name => New_Occurrence_Of (Entity (E1), Loc),
- Parameter_Associations => New_List (
- New_Occurrence_Of (Bnn, Loc),
- Relocate_Node (Expr))))));
+ Statements =>
+ New_List (Build_Stat (Relocate_Node (Expr))));
end;
+
else
-- If the prefix is a name, we construct an element iterator
-- over it. Its expansion will verify that it is an array or
@@ -5696,13 +5841,7 @@ package body Exp_Attr is
Loop_Parameter_Specification => Empty),
End_Label => Empty,
Statements => New_List (
- Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Bnn, Loc),
- Expression => Make_Function_Call (Loc,
- Name => New_Occurrence_Of (Entity (E1), Loc),
- Parameter_Associations => New_List (
- New_Occurrence_Of (Bnn, Loc),
- New_Occurrence_Of (Elem, Loc))))));
+ Build_Stat (New_Occurrence_Of (Elem, Loc))));
end;
end if;
@@ -5816,6 +5955,18 @@ package body Exp_Attr is
Analyze (N);
return;
+ -- Limited types
+
+ elsif Default_Streaming_Unavailable (U_Type) then
+ -- Do the same thing here as is done above in the
+ -- case where a No_Streams restriction is active.
+
+ Rewrite (N,
+ Make_Raise_Program_Error (Sloc (N),
+ Reason => PE_Stream_Operation_Not_Allowed));
+ Set_Etype (N, B_Type);
+ return;
+
-- For elementary types, we call the I_xxx routine using the first
-- parameter and then assign the result into the second parameter.
-- We set Assignment_OK to deal with the conversion case.
@@ -5997,11 +6148,11 @@ package body Exp_Attr is
when Attribute_Scaling =>
Expand_Fpt_Attribute_RI (N);
- -------------------------
- -- Simple_Storage_Pool --
- -------------------------
+ ----------------------------------------
+ -- Simple_Storage_Pool & Storage_Pool --
+ ----------------------------------------
- when Attribute_Simple_Storage_Pool =>
+ when Attribute_Simple_Storage_Pool | Attribute_Storage_Pool =>
Rewrite (N,
Make_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Etype (N), Loc),
@@ -6138,17 +6289,6 @@ package body Exp_Attr is
end Size;
------------------
- -- Storage_Pool --
- ------------------
-
- when Attribute_Storage_Pool =>
- Rewrite (N,
- Make_Type_Conversion (Loc,
- Subtype_Mark => New_Occurrence_Of (Etype (N), Loc),
- Expression => New_Occurrence_Of (Entity (N), Loc)));
- Analyze_And_Resolve (N, Typ);
-
- ------------------
-- Storage_Size --
------------------
@@ -6344,7 +6484,6 @@ package body Exp_Attr is
when Attribute_Succ => Succ : declare
Etyp : constant Entity_Id := Base_Type (Ptyp);
- Ityp : Entity_Id;
begin
-- For enumeration types with non-standard representations, we
@@ -6364,26 +6503,14 @@ package body Exp_Attr is
Expand_Pred_Succ_Attribute (N);
end if;
- if Is_Unsigned_Type (Etyp) then
- if Esize (Typ) <= Standard_Integer_Size then
- Ityp := RTE (RE_Unsigned);
- else
- Ityp := RTE (RE_Long_Long_Unsigned);
- end if;
-
- else
- if Esize (Etyp) <= Standard_Integer_Size then
- Ityp := Standard_Integer;
- else
- Ityp := Standard_Long_Long_Integer;
- end if;
- end if;
-
Rewrite (N,
Unchecked_Convert_To (Etyp,
Make_Op_Add (Loc,
Left_Opnd =>
- Unchecked_Convert_To (Ityp, First (Exprs)),
+ Unchecked_Convert_To (
+ Integer_Type_For
+ (Esize (Etyp), Is_Unsigned_Type (Etyp)),
+ First (Exprs)),
Right_Opnd =>
Make_Integer_Literal (Loc, 1))));
@@ -6667,7 +6794,6 @@ package body Exp_Attr is
when Attribute_Val => Val : declare
Etyp : constant Entity_Id := Base_Type (Ptyp);
Expr : constant Node_Id := First (Exprs);
- Ityp : Entity_Id;
Rtyp : Entity_Id;
begin
@@ -6719,21 +6845,6 @@ package body Exp_Attr is
-- Contiguous non-standard enumeration type
if Present (Enum_Pos_To_Rep (Etyp)) then
- if Is_Unsigned_Type (Etyp) then
- if Esize (Typ) <= Standard_Integer_Size then
- Ityp := RTE (RE_Unsigned);
- else
- Ityp := RTE (RE_Long_Long_Unsigned);
- end if;
-
- else
- if Esize (Etyp) <= Standard_Integer_Size then
- Ityp := Standard_Integer;
- else
- Ityp := Standard_Long_Long_Integer;
- end if;
- end if;
-
Rewrite (N,
Unchecked_Convert_To (Etyp,
Make_Op_Add (Loc,
@@ -6741,7 +6852,10 @@ package body Exp_Attr is
Make_Integer_Literal (Loc,
Enumeration_Rep (First_Literal (Etyp))),
Right_Opnd =>
- Convert_To (Ityp, Expr))));
+ Unchecked_Convert_To (
+ Integer_Type_For
+ (Esize (Etyp), Is_Unsigned_Type (Etyp)),
+ Expr))));
-- Standard enumeration type
@@ -7121,27 +7235,16 @@ package body Exp_Attr is
-- correct, even though a value greater than 127 looks signed to a
-- signed comparison.
- elsif Is_Unsigned_Type (Ptyp)
- or else (Is_Private_Type (Ptyp) and then Is_Unsigned_Type (Btyp))
- then
- if Esize (Ptyp) <= 32 then
- PBtyp := RTE (RE_Unsigned_32);
- else
- PBtyp := RTE (RE_Unsigned_64);
- end if;
-
- Rewrite (N, Make_Range_Test);
-
- -- Signed types
-
else
- if Esize (Ptyp) <= Esize (Standard_Integer) then
- PBtyp := Standard_Integer;
- else
- PBtyp := Standard_Long_Long_Integer;
- end if;
-
- Rewrite (N, Make_Range_Test);
+ declare
+ Uns : constant Boolean
+ := Is_Unsigned_Type (Ptyp)
+ or else (Is_Private_Type (Ptyp)
+ and then Is_Unsigned_Type (Btyp));
+ begin
+ PBtyp := Integer_Type_For (Esize (Ptyp), Uns);
+ Rewrite (N, Make_Range_Test);
+ end;
end if;
-- If a predicate is present, then we do the predicate test, even if
@@ -7473,6 +7576,18 @@ package body Exp_Attr is
Analyze (N);
return;
+ -- Limited types
+
+ elsif Default_Streaming_Unavailable (U_Type) then
+ -- Do the same thing here as is done above in the
+ -- case where a No_Streams restriction is active.
+
+ Rewrite (N,
+ Make_Raise_Program_Error (Sloc (N),
+ Reason => PE_Stream_Operation_Not_Allowed));
+ Set_Etype (N, U_Type);
+ return;
+
-- For elementary types, we call the W_xxx routine directly
elsif Is_Elementary_Type (U_Type) then
@@ -7591,6 +7706,7 @@ package body Exp_Attr is
| Attribute_Machine_Radix
| Attribute_Machine_Rounds
| Attribute_Max_Alignment_For_Allocation
+ | Attribute_Max_Integer_Size
| Attribute_Maximum_Alignment
| Attribute_Model_Emin
| Attribute_Model_Epsilon
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index ff1029c..5c3435b 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -717,98 +717,4 @@ package body Exp_Ch2 is
Analyze_And_Resolve (N, T);
end Expand_Renaming;
- ------------------
- -- Param_Entity --
- ------------------
-
- -- This would be trivial, simply a test for an identifier that was a
- -- reference to a formal, if it were not for the fact that a previous call
- -- to Expand_Entry_Parameter will have modified the reference to the
- -- identifier. A formal of a protected entity is rewritten as
-
- -- typ!(recobj).rec.all'Constrained
-
- -- where rec is a selector whose Entry_Formal link points to the formal
-
- -- If the type of the entry parameter has a representation clause, then an
- -- extra temp is involved (see below).
-
- -- For a formal of a task entity, the formal is rewritten as a local
- -- renaming.
-
- -- In addition, a formal that is marked volatile because it is aliased
- -- through an address clause is rewritten as dereference as well.
-
- function Param_Entity (N : Node_Id) return Entity_Id is
- Renamed_Obj : Node_Id;
-
- begin
- -- Simple reference case
-
- if Nkind (N) in N_Identifier | N_Expanded_Name then
- if Is_Formal (Entity (N)) then
- return Entity (N);
-
- -- Handle renamings of formal parameters and formals of tasks that
- -- are rewritten as renamings.
-
- elsif Nkind (Parent (Entity (N))) = N_Object_Renaming_Declaration then
- Renamed_Obj := Get_Referenced_Object (Renamed_Object (Entity (N)));
-
- if Is_Entity_Name (Renamed_Obj)
- and then Is_Formal (Entity (Renamed_Obj))
- then
- return Entity (Renamed_Obj);
-
- elsif
- Nkind (Parent (Parent (Entity (N)))) = N_Accept_Statement
- then
- return Entity (N);
- end if;
- end if;
-
- else
- if Nkind (N) = N_Explicit_Dereference then
- declare
- P : Node_Id := Prefix (N);
- S : Node_Id;
- E : Entity_Id;
- Decl : Node_Id;
-
- begin
- -- If the type of an entry parameter has a representation
- -- clause, then the prefix is not a selected component, but
- -- instead a reference to a temp pointing at the selected
- -- component. In this case, set P to be the initial value of
- -- that temp.
-
- if Nkind (P) = N_Identifier then
- E := Entity (P);
-
- if Ekind (E) = E_Constant then
- Decl := Parent (E);
-
- if Nkind (Decl) = N_Object_Declaration then
- P := Expression (Decl);
- end if;
- end if;
- end if;
-
- if Nkind (P) = N_Selected_Component then
- S := Selector_Name (P);
-
- if Present (Entry_Formal (Entity (S))) then
- return Entry_Formal (Entity (S));
- end if;
-
- elsif Nkind (Original_Node (N)) = N_Identifier then
- return Param_Entity (Original_Node (N));
- end if;
- end;
- end if;
- end if;
-
- return (Empty);
- end Param_Entity;
-
end Exp_Ch2;
diff --git a/gcc/ada/exp_ch2.ads b/gcc/ada/exp_ch2.ads
index 04487d4..8d11dd4 100644
--- a/gcc/ada/exp_ch2.ads
+++ b/gcc/ada/exp_ch2.ads
@@ -32,14 +32,4 @@ package Exp_Ch2 is
procedure Expand_N_Identifier (N : Node_Id);
procedure Expand_N_Real_Literal (N : Node_Id);
- function Param_Entity (N : Node_Id) return Entity_Id;
- -- Given an expression N, determines if the expression is a reference
- -- to a formal (of a subprogram or entry), and if so returns the Id
- -- of the corresponding formal entity, otherwise returns Empty. The
- -- reason that this is in Exp_Ch2 is that it has to deal with the case
- -- where the reference is to an entry formal, and has been expanded
- -- already. Since Exp_Ch2 is in charge of the expansion, it is best
- -- suited to knowing how to detect this case. Also handles the case
- -- of references to renamings of formals.
-
end Exp_Ch2;
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 0b601c5..f8b6ee6 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1335,6 +1335,31 @@ package body Exp_Ch3 is
return Agg;
end Build_Equivalent_Record_Aggregate;
+ ----------------------------
+ -- Init_Proc_Level_Formal --
+ ----------------------------
+
+ function Init_Proc_Level_Formal (Proc : Entity_Id) return Entity_Id is
+ Form : Entity_Id;
+ begin
+ -- Move through the formals of the initialization procedure Proc to find
+ -- the extra accessibility level parameter associated with the object
+ -- being initialized.
+
+ Form := First_Formal (Proc);
+ while Present (Form) loop
+ if Chars (Form) = Name_uInit_Level then
+ return Form;
+ end if;
+
+ Next_Formal (Form);
+ end loop;
+
+ -- No formal was found, return Empty
+
+ return Empty;
+ end Init_Proc_Level_Formal;
+
-------------------------------
-- Build_Initialization_Call --
-------------------------------
@@ -1772,6 +1797,24 @@ package body Exp_Ch3 is
New_Copy_List (Parameter_Associations (Constructor_Ref)));
end if;
+ -- Pass the extra accessibility level parameter associated with the
+ -- level of the object being initialized when required.
+
+ -- When no entity is present for Id_Ref it may not have been fully
+ -- analyzed, so allow the default value of standard standard to be
+ -- passed ???
+
+ if Is_Entity_Name (Id_Ref)
+ and then Present (Init_Proc_Level_Formal (Proc))
+ then
+ Append_To (Args,
+ Make_Parameter_Association (Loc,
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uInit_Level),
+ Explicit_Actual_Parameter =>
+ Accessibility_Level (Id_Ref, Dynamic_Level)));
+ end if;
+
Append_To (Res,
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Proc, Loc),
@@ -2513,6 +2556,21 @@ package body Exp_Ch3 is
New_Occurrence_Of (Standard_True, Loc)));
end if;
+ -- Create an extra accessibility parameter to capture the level of
+ -- the object being initialized when its type is a limited record.
+
+ if Is_Limited_Record (Rec_Type) then
+ Append_To (Parameters,
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Make_Defining_Identifier
+ (Loc, Name_uInit_Level),
+ Parameter_Type =>
+ New_Occurrence_Of (Standard_Natural, Loc),
+ Expression =>
+ Make_Integer_Literal
+ (Loc, Scope_Depth (Standard_Standard))));
+ end if;
+
Set_Parameter_Specifications (Proc_Spec_Node, Parameters);
Set_Specification (Body_Node, Proc_Spec_Node);
Set_Declarations (Body_Node, Decls);
@@ -4758,7 +4816,7 @@ package body Exp_Ch3 is
begin
pragma Assert (Nkind (Obj_Decl) = N_Object_Declaration);
- if Has_Task (Typ) or else Might_Have_Tasks (Typ) then
+ if Might_Have_Tasks (Typ) then
Build_Activation_Chain_Entity (Obj_Decl);
if Has_Task (Typ) then
@@ -5095,32 +5153,15 @@ package body Exp_Ch3 is
-- Is this right??? What about No_Exception_Propagation???
- -- Representations are signed
+ -- The underlying type is signed. Reset the Is_Unsigned_Type explicitly
+ -- because it might have been inherited from the parent type.
if Enumeration_Rep (First_Literal (Typ)) < 0 then
-
- -- The underlying type is signed. Reset the Is_Unsigned_Type
- -- explicitly, because it might have been inherited from
- -- parent type.
-
Set_Is_Unsigned_Type (Typ, False);
-
- if Esize (Typ) <= Standard_Integer_Size then
- Ityp := Standard_Integer;
- else
- Ityp := Standard_Long_Long_Integer;
- end if;
-
- -- Representations are unsigned
-
- else
- if Esize (Typ) <= Standard_Integer_Size then
- Ityp := RTE (RE_Unsigned);
- else
- Ityp := RTE (RE_Long_Long_Unsigned);
- end if;
end if;
+ Ityp := Integer_Type_For (Esize (Typ), Is_Unsigned_Type (Typ));
+
-- The body of the function is a case statement. First collect case
-- alternatives, or optimize the contiguous case.
@@ -5898,10 +5939,8 @@ package body Exp_Ch3 is
Typ := Etype (Comp);
if Ekind (Typ) = E_Anonymous_Access_Type
- and then
- (Has_Task (Available_View (Designated_Type (Typ)))
- or else
- Might_Have_Tasks (Available_View (Designated_Type (Typ))))
+ and then Might_Have_Tasks
+ (Available_View (Designated_Type (Typ)))
and then No (Master_Id (Typ))
then
-- Ensure that the record or array type have a _master
@@ -6785,7 +6824,7 @@ package body Exp_Ch3 is
-- of the stacks in this scenario, the stacks of the first array are
-- not counted.
- if (Has_Task (Typ) or else Might_Have_Tasks (Typ))
+ if Might_Have_Tasks (Typ)
and then not Restriction_Active (No_Secondary_Stack)
and then (Restriction_Active (No_Implicit_Heap_Allocations)
or else Restriction_Active (No_Implicit_Task_Allocations))
@@ -7468,7 +7507,8 @@ package body Exp_Ch3 is
if No (Expr) then
Level_Expr :=
- Make_Integer_Literal (Loc, Scope_Depth (Standard_Standard));
+ Make_Integer_Literal
+ (Loc, Scope_Depth (Standard_Standard));
-- When the expression of the object is a function which returns
-- an anonymous access type the master of the call is the object
@@ -7477,13 +7517,13 @@ package body Exp_Ch3 is
elsif Nkind (Expr) = N_Function_Call
and then Ekind (Etype (Name (Expr))) = E_Anonymous_Access_Type
then
- Level_Expr := Make_Integer_Literal (Loc,
- Object_Access_Level (Def_Id));
+ Level_Expr := Accessibility_Level
+ (Def_Id, Object_Decl_Level);
-- General case
else
- Level_Expr := Dynamic_Accessibility_Level (Expr);
+ Level_Expr := Accessibility_Level (Expr, Dynamic_Level);
end if;
Level_Decl :=
@@ -8162,7 +8202,8 @@ package body Exp_Ch3 is
-- It is known that the accessibility level of the access
-- type is deeper than that of the pool.
- if Type_Access_Level (Def_Id) > Object_Access_Level (Pool)
+ if Type_Access_Level (Def_Id)
+ > Static_Accessibility_Level (Pool, Object_Decl_Level)
and then Is_Class_Wide_Type (Etype (Pool))
and then not Accessibility_Checks_Suppressed (Def_Id)
and then not Accessibility_Checks_Suppressed (Pool)
@@ -8197,8 +8238,9 @@ package body Exp_Ch3 is
-- Taft-amendment types, which potentially have controlled
-- components), expand the list controller object that will store
-- the dynamically allocated objects. Don't do this transformation
- -- for expander-generated access types, but do it for types that
- -- are the full view of types derived from other private types.
+ -- for expander-generated access types, except do it for types
+ -- that are the full view of types derived from other private
+ -- types and for access types used to implement indirect temps.
-- Also suppress the list controller in the case of a designated
-- type with convention Java, since this is used when binding to
-- Java API specs, where there's no equivalent of a finalization
@@ -8207,6 +8249,8 @@ package body Exp_Ch3 is
if not Comes_From_Source (Def_Id)
and then not Has_Private_Declaration (Def_Id)
+ and then not Old_Attr_Util.Indirect_Temps
+ .Is_Access_Type_For_Indirect_Temp (Def_Id)
then
null;
@@ -8581,8 +8625,10 @@ package body Exp_Ch3 is
Scal_Typ := Name_Unsigned_16;
elsif Size_To_Use <= 32 then
Scal_Typ := Name_Unsigned_32;
- else
+ elsif Size_To_Use <= 64 then
Scal_Typ := Name_Unsigned_64;
+ else
+ Scal_Typ := Name_Unsigned_128;
end if;
-- Signed types
@@ -8594,8 +8640,10 @@ package body Exp_Ch3 is
Scal_Typ := Name_Signed_16;
elsif Size_To_Use <= 32 then
Scal_Typ := Name_Signed_32;
- else
+ elsif Size_To_Use <= 64 then
Scal_Typ := Name_Signed_64;
+ else
+ Scal_Typ := Name_Signed_128;
end if;
end if;
@@ -8649,10 +8697,10 @@ package body Exp_Ch3 is
then
Expr := Make_Integer_Literal (Loc, 2 ** Size_To_Use - 1);
- -- Resolve as Unsigned_64, because the largest number we can
- -- generate is out of range of universal integer.
+ -- Resolve as Long_Long_Long_Unsigned, because the largest number
+ -- we can generate is out of range of universal integer.
- Analyze_And_Resolve (Expr, RTE (RE_Unsigned_64));
+ Analyze_And_Resolve (Expr, Standard_Long_Long_Long_Unsigned);
-- Case of signed types
@@ -8739,11 +8787,14 @@ package body Exp_Ch3 is
Size_To_Use := Size;
end if;
- -- The maximum size to use is 64 bits. This will create values of
- -- type Unsigned_64 and the range must fit this type.
+ -- The maximum size to use is System_Max_Integer_Size bits. This
+ -- will create values of type Long_Long_Long_Unsigned and the range
+ -- must fit this type.
- if Size_To_Use /= No_Uint and then Size_To_Use > Uint_64 then
- Size_To_Use := Uint_64;
+ if Size_To_Use /= No_Uint
+ and then Size_To_Use > System_Max_Integer_Size
+ then
+ Size_To_Use := UI_From_Int (System_Max_Integer_Size);
end if;
if Normalize_Scalars and then not IV_Attribute then
@@ -9484,6 +9535,31 @@ package body Exp_Ch3 is
(Is_Null_Extension (Etype (Subp))
and then Etype (Alias (Subp)) /= Etype (Subp))
then
+ -- If there is a non-overloadable homonym in the current
+ -- scope, the implicit declaration remains invisible.
+ -- We check the current entity with the same name, or its
+ -- homonym in case the derivation takes place after the
+ -- hiding object declaration.
+
+ if Present (Current_Entity (Subp)) then
+ declare
+ Curr : constant Entity_Id := Current_Entity (Subp);
+ Prev : constant Entity_Id := Homonym (Curr);
+ begin
+ if (Comes_From_Source (Curr)
+ and then Scope (Curr) = Current_Scope
+ and then not Is_Overloadable (Curr))
+ or else
+ (Present (Prev)
+ and then Comes_From_Source (Prev)
+ and then Scope (Prev) = Current_Scope
+ and then not Is_Overloadable (Prev))
+ then
+ goto Next_Prim;
+ end if;
+ end;
+ end if;
+
Formal_List := No_List;
Formal := First_Formal (Subp);
diff --git a/gcc/ada/exp_ch3.ads b/gcc/ada/exp_ch3.ads
index 954b5a2..a4b7f1f 100644
--- a/gcc/ada/exp_ch3.ads
+++ b/gcc/ada/exp_ch3.ads
@@ -135,6 +135,11 @@ package Exp_Ch3 is
-- type is valid only when Normalize_Scalars or Initialize_Scalars is
-- active, or if N is the node for a 'Invalid_Value attribute node.
+ function Init_Proc_Level_Formal (Proc : Entity_Id) return Entity_Id;
+ -- Fetch the extra formal from an initalization procedure "proc"
+ -- corresponding to the level of the object being initialized. When none
+ -- is present Empty is returned.
+
procedure Init_Secondary_Tags
(Typ : Entity_Id;
Target : Node_Id;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 30824c6..076e0de 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -31,7 +31,6 @@ with Elists; use Elists;
with Errout; use Errout;
with Exp_Aggr; use Exp_Aggr;
with Exp_Atag; use Exp_Atag;
-with Exp_Ch2; use Exp_Ch2;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch6; use Exp_Ch6;
with Exp_Ch7; use Exp_Ch7;
@@ -824,6 +823,37 @@ package body Exp_Ch4 is
Apply_Predicate_Check (Exp, T);
+ -- Check that any anonymous access discriminants are suitable
+ -- for use in an allocator.
+
+ -- Note: This check is performed here instead of during analysis so that
+ -- we can check against the fully resolved etype of Exp.
+
+ if Is_Entity_Name (Exp)
+ and then Has_Anonymous_Access_Discriminant (Etype (Exp))
+ and then Static_Accessibility_Level (Exp, Object_Decl_Level)
+ > Static_Accessibility_Level (N, Object_Decl_Level)
+ then
+ -- A dynamic check and a warning are generated when we are within
+ -- an instance.
+
+ if In_Instance then
+ Insert_Action (N,
+ Make_Raise_Program_Error (Loc,
+ Reason => PE_Accessibility_Check_Failed));
+
+ Error_Msg_N ("anonymous access discriminant is too deep for use"
+ & " in allocator<<", N);
+ Error_Msg_N ("\Program_Error [<<", N);
+
+ -- Otherwise, make the error static
+
+ else
+ Error_Msg_N ("anonymous access discriminant is too deep for use"
+ & " in allocator", N);
+ end if;
+ end if;
+
if Do_Range_Check (Exp) then
Generate_Range_Check (Exp, T, CE_Range_Check_Failed);
end if;
@@ -851,35 +881,6 @@ package body Exp_Ch4 is
return;
end if;
- -- In the case of an Ada 2012 allocator whose initial value comes from a
- -- function call, pass "the accessibility level determined by the point
- -- of call" (AI05-0234) to the function. Conceptually, this belongs in
- -- Expand_Call but it couldn't be done there (because the Etype of the
- -- allocator wasn't set then) so we generate the parameter here. See
- -- the Boolean variable Defer in (a block within) Expand_Call.
-
- if Ada_Version >= Ada_2012 and then Nkind (Exp) = N_Function_Call then
- declare
- Subp : Entity_Id;
-
- begin
- if Nkind (Name (Exp)) = N_Explicit_Dereference then
- Subp := Designated_Type (Etype (Prefix (Name (Exp))));
- else
- Subp := Entity (Name (Exp));
- end if;
-
- Subp := Ultimate_Alias (Subp);
-
- if Present (Extra_Accessibility_Of_Result (Subp)) then
- Add_Extra_Actual_To_Call
- (Subprogram_Call => Exp,
- Extra_Formal => Extra_Accessibility_Of_Result (Subp),
- Extra_Actual => Dynamic_Accessibility_Level (PtrT));
- end if;
- end;
- end if;
-
Aggr_In_Place := Is_Delayed_Aggregate (Exp);
-- Case of tagged type or type requiring finalization
@@ -1385,7 +1386,7 @@ package body Exp_Ch4 is
-- (left'address, right'address, left'length, right'length) <op> 0
-- x = U for unsigned, S for signed
- -- n = 8,16,32,64 for component size
+ -- n = 8,16,32,64,128 for component size
-- Add _Unaligned if length < 4 and component size is 8.
-- <op> is the standard comparison operator
@@ -1422,12 +1423,19 @@ package body Exp_Ch4 is
Comp := RE_Compare_Array_S32;
end if;
- else pragma Assert (Component_Size (Typ1) = 64);
+ elsif Component_Size (Typ1) = 64 then
if Is_Unsigned_Type (Ctyp) then
Comp := RE_Compare_Array_U64;
else
Comp := RE_Compare_Array_S64;
end if;
+
+ else pragma Assert (Component_Size (Typ1) = 128);
+ if Is_Unsigned_Type (Ctyp) then
+ Comp := RE_Compare_Array_U128;
+ else
+ Comp := RE_Compare_Array_S128;
+ end if;
end if;
if RTE_Available (Comp) then
@@ -2963,12 +2971,13 @@ package body Exp_Ch4 is
-- Local Declarations
- Opnd_Typ : Entity_Id;
- Ent : Entity_Id;
- Len : Uint;
- J : Nat;
- Clen : Node_Id;
- Set : Boolean;
+ Opnd_Typ : Entity_Id;
+ Subtyp_Ind : Entity_Id;
+ Ent : Entity_Id;
+ Len : Uint;
+ J : Nat;
+ Clen : Node_Id;
+ Set : Boolean;
-- Start of processing for Expand_Concatenate
@@ -3441,28 +3450,96 @@ package body Exp_Ch4 is
-- Initialize_Scalars is enabled. Also since this is the actual result
-- entity, we make sure we have debug information for the result.
+ Subtyp_Ind :=
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark => New_Occurrence_Of (Atyp, Loc),
+ Constraint =>
+ Make_Index_Or_Discriminant_Constraint (Loc,
+ Constraints => New_List (
+ Make_Range (Loc,
+ Low_Bound => Low_Bound,
+ High_Bound => High_Bound))));
+
Ent := Make_Temporary (Loc, 'S');
Set_Is_Internal (Ent);
Set_Debug_Info_Needed (Ent);
- -- If the bound is statically known to be out of range, we do not want
- -- to abort, we want a warning and a runtime constraint error. Note that
- -- we have arranged that the result will not be treated as a static
- -- constant, so we won't get an illegality during this insertion.
+ -- If we are concatenating strings and the current scope already uses
+ -- the secondary stack, allocate the resulting string also on the
+ -- secondary stack to avoid putting too much pressure on the primary
+ -- stack.
+ -- Don't do this if -gnatd.h is set, as this will break the wrapping of
+ -- Cnode in an Expression_With_Actions, see Expand_N_Op_Concat.
- Insert_Action (Cnode,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Ent,
- Object_Definition =>
- Make_Subtype_Indication (Loc,
- Subtype_Mark => New_Occurrence_Of (Atyp, Loc),
- Constraint =>
- Make_Index_Or_Discriminant_Constraint (Loc,
- Constraints => New_List (
- Make_Range (Loc,
- Low_Bound => Low_Bound,
- High_Bound => High_Bound))))),
- Suppress => All_Checks);
+ if Atyp = Standard_String
+ and then Uses_Sec_Stack (Current_Scope)
+ and then RTE_Available (RE_SS_Pool)
+ and then not Debug_Flag_Dot_H
+ then
+ -- Generate:
+ -- subtype Axx is ...;
+ -- type Ayy is access Axx;
+ -- Rxx : Ayy := new <subtype> [storage_pool = ss_pool];
+ -- Sxx : <subtype> renames Rxx.all;
+
+ declare
+ Alloc : Node_Id;
+ ConstrT : constant Entity_Id := Make_Temporary (Loc, 'A');
+ Acc_Typ : constant Entity_Id := Make_Temporary (Loc, 'A');
+ Temp : Entity_Id;
+
+ begin
+ Insert_Action (Cnode,
+ Make_Subtype_Declaration (Loc,
+ Defining_Identifier => ConstrT,
+ Subtype_Indication => Subtyp_Ind),
+ Suppress => All_Checks);
+ Freeze_Itype (ConstrT, Cnode);
+
+ Insert_Action (Cnode,
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Acc_Typ,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ Subtype_Indication => New_Occurrence_Of (ConstrT, Loc))),
+ Suppress => All_Checks);
+ Alloc :=
+ Make_Allocator (Loc,
+ Expression => New_Occurrence_Of (ConstrT, Loc));
+ Set_Storage_Pool (Alloc, RTE (RE_SS_Pool));
+ Set_Procedure_To_Call (Alloc, RTE (RE_SS_Allocate));
+
+ Temp := Make_Temporary (Loc, 'R', Alloc);
+ Insert_Action (Cnode,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp,
+ Object_Definition => New_Occurrence_Of (Acc_Typ, Loc),
+ Expression => Alloc),
+ Suppress => All_Checks);
+
+ Insert_Action (Cnode,
+ Make_Object_Renaming_Declaration (Loc,
+ Defining_Identifier => Ent,
+ Subtype_Mark => New_Occurrence_Of (ConstrT, Loc),
+ Name =>
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Occurrence_Of (Temp, Loc))),
+ Suppress => All_Checks);
+ end;
+ else
+ -- If the bound is statically known to be out of range, we do not
+ -- want to abort, we want a warning and a runtime constraint error.
+ -- Note that we have arranged that the result will not be treated as
+ -- a static constant, so we won't get an illegality during this
+ -- insertion.
+ -- We also enable checks (in particular range checks) in case the
+ -- bounds of Subtyp_Ind are out of range.
+
+ Insert_Action (Cnode,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Ent,
+ Object_Definition => Subtyp_Ind));
+ end if;
-- If the result of the concatenation appears as the initializing
-- expression of an object declaration, we can just rename the
@@ -6791,37 +6868,28 @@ package body Exp_Ch4 is
-- Apply an accessibility check if the access object has an
-- associated access level and when the level of the type is
-- less deep than the level of the access parameter. This
- -- only occur for access parameters and stand-alone objects
- -- of an anonymous access type.
+ -- can only occur for access parameters and stand-alone
+ -- objects of an anonymous access type.
else
- if Present (Expr_Entity)
- and then
- Present
- (Effective_Extra_Accessibility (Expr_Entity))
- and then UI_Gt (Object_Access_Level (Lop),
- Type_Access_Level (Rtyp))
- then
- Param_Level :=
- New_Occurrence_Of
- (Effective_Extra_Accessibility (Expr_Entity), Loc);
+ Param_Level := Accessibility_Level
+ (Expr_Entity, Dynamic_Level);
- Type_Level :=
- Make_Integer_Literal (Loc, Type_Access_Level (Rtyp));
+ Type_Level :=
+ Make_Integer_Literal (Loc, Type_Access_Level (Rtyp));
- -- Return True only if the accessibility level of the
- -- expression entity is not deeper than the level of
- -- the tested access type.
+ -- Return True only if the accessibility level of the
+ -- expression entity is not deeper than the level of
+ -- the tested access type.
- Rewrite (N,
- Make_And_Then (Loc,
- Left_Opnd => Relocate_Node (N),
- Right_Opnd => Make_Op_Le (Loc,
- Left_Opnd => Param_Level,
- Right_Opnd => Type_Level)));
+ Rewrite (N,
+ Make_And_Then (Loc,
+ Left_Opnd => Relocate_Node (N),
+ Right_Opnd => Make_Op_Le (Loc,
+ Left_Opnd => Param_Level,
+ Right_Opnd => Type_Level)));
- Analyze_And_Resolve (N);
- end if;
+ Analyze_And_Resolve (N);
-- If the designated type is tagged, do tagged membership
-- operation.
@@ -8269,12 +8337,12 @@ package body Exp_Ch4 is
-- Where the component type is elementary we can use a block bit
-- comparison (if supported on the target) exception in the case
-- of floating-point (negative zero issues require element by
- -- element comparison), and atomic/VFA types (where we must be sure
+ -- element comparison), and full access types (where we must be sure
-- to load elements independently) and possibly unaligned arrays.
elsif Is_Elementary_Type (Component_Type (Typl))
and then not Is_Floating_Point_Type (Component_Type (Typl))
- and then not Is_Atomic_Or_VFA (Component_Type (Typl))
+ and then not Is_Full_Access (Component_Type (Typl))
and then not Is_Possibly_Unaligned_Object (Lhs)
and then not Is_Possibly_Unaligned_Slice (Lhs)
and then not Is_Possibly_Unaligned_Object (Rhs)
@@ -8923,15 +8991,18 @@ package body Exp_Ch4 is
Make_Integer_Literal (Loc, Modulus (Rtyp)),
Exp))));
- -- Binary modular case, in this case, we call one of two routines,
+ -- Binary modular case, in this case, we call one of three routines,
-- either the unsigned integer case, or the unsigned long long
- -- integer case, with a final "and" operation to do the required mod.
+ -- integer case, or the unsigned long long long integer case, with a
+ -- final "and" operation to do the required mod.
else
- if UI_To_Int (Esize (Rtyp)) <= Standard_Integer_Size then
+ if Esize (Rtyp) <= Standard_Integer_Size then
Ent := RTE (RE_Exp_Unsigned);
- else
+ elsif Esize (Rtyp) <= Standard_Long_Long_Integer_Size then
Ent := RTE (RE_Exp_Long_Long_Unsigned);
+ else
+ Ent := RTE (RE_Exp_Long_Long_Long_Unsigned);
end if;
Rewrite (N,
@@ -8953,36 +9024,43 @@ package body Exp_Ch4 is
Analyze_And_Resolve (N, Typ);
return;
- -- Signed integer cases, done using either Integer or Long_Long_Integer.
- -- It is not worth having routines for Short_[Short_]Integer, since for
- -- most machines it would not help, and it would generate more code that
- -- might need certification when a certified run time is required.
+ -- Signed integer cases, using either Integer, Long_Long_Integer or
+ -- Long_Long_Long_Integer. It is not worth also having routines for
+ -- Short_[Short_]Integer, since for most machines it would not help,
+ -- and it would generate more code that might need certification when
+ -- a certified run time is required.
-- In the integer cases, we have two routines, one for when overflow
-- checks are required, and one when they are not required, since there
-- is a real gain in omitting checks on many machines.
- elsif Rtyp = Base_Type (Standard_Long_Long_Integer)
- or else (Rtyp = Base_Type (Standard_Long_Integer)
- and then
- Esize (Standard_Long_Integer) > Esize (Standard_Integer))
- or else Rtyp = Universal_Integer
- then
- Etyp := Standard_Long_Long_Integer;
+ elsif Is_Signed_Integer_Type (Rtyp) then
+ if Esize (Rtyp) <= Standard_Integer_Size then
+ Etyp := Standard_Integer;
- if Ovflo then
- Rent := RE_Exp_Long_Long_Integer;
- else
- Rent := RE_Exn_Long_Long_Integer;
- end if;
+ if Ovflo then
+ Rent := RE_Exp_Integer;
+ else
+ Rent := RE_Exn_Integer;
+ end if;
- elsif Is_Signed_Integer_Type (Rtyp) then
- Etyp := Standard_Integer;
+ elsif Esize (Rtyp) <= Standard_Long_Long_Integer_Size then
+ Etyp := Standard_Long_Long_Integer;
+
+ if Ovflo then
+ Rent := RE_Exp_Long_Long_Integer;
+ else
+ Rent := RE_Exn_Long_Long_Integer;
+ end if;
- if Ovflo then
- Rent := RE_Exp_Integer;
else
- Rent := RE_Exn_Integer;
+ Etyp := Standard_Long_Long_Long_Integer;
+
+ if Ovflo then
+ Rent := RE_Exp_Long_Long_Long_Integer;
+ else
+ Rent := RE_Exn_Long_Long_Long_Integer;
+ end if;
end if;
-- Floating-point cases. We do not need separate routines for the
@@ -10265,15 +10343,17 @@ package body Exp_Ch4 is
-- where Bits is the shift count mod Esize (the mod operation here
-- deals with ludicrous large shift counts, which are apparently OK).
- -- What about nonbinary modulus ???
+ if Modify_Tree_For_C then
+ declare
+ Loc : constant Source_Ptr := Sloc (N);
+ Rtp : constant Entity_Id := Etype (Right_Opnd (N));
+ Typ : constant Entity_Id := Etype (N);
- declare
- Loc : constant Source_Ptr := Sloc (N);
- Rtp : constant Entity_Id := Etype (Right_Opnd (N));
- Typ : constant Entity_Id := Etype (N);
+ begin
+ -- Sem_Intr should prevent getting there with a non binary modulus
+
+ pragma Assert (not Non_Binary_Modulus (Typ));
- begin
- if Modify_Tree_For_C then
Rewrite (Right_Opnd (N),
Make_Op_Rem (Loc,
Left_Opnd => Relocate_Node (Right_Opnd (N)),
@@ -10298,8 +10378,8 @@ package body Exp_Ch4 is
Duplicate_Subexpr_No_Checks (Right_Opnd (N))))));
Analyze_And_Resolve (N, Typ);
- end if;
- end;
+ end;
+ end if;
end Expand_N_Op_Rotate_Left;
------------------------------
@@ -10318,22 +10398,24 @@ package body Exp_Ch4 is
-- where Bits is the shift count mod Esize (the mod operation here
-- deals with ludicrous large shift counts, which are apparently OK).
- -- What about nonbinary modulus ???
+ if Modify_Tree_For_C then
+ declare
+ Loc : constant Source_Ptr := Sloc (N);
+ Rtp : constant Entity_Id := Etype (Right_Opnd (N));
+ Typ : constant Entity_Id := Etype (N);
- declare
- Loc : constant Source_Ptr := Sloc (N);
- Rtp : constant Entity_Id := Etype (Right_Opnd (N));
- Typ : constant Entity_Id := Etype (N);
+ begin
+ -- Sem_Intr should prevent getting there with a non binary modulus
- begin
- Rewrite (Right_Opnd (N),
- Make_Op_Rem (Loc,
- Left_Opnd => Relocate_Node (Right_Opnd (N)),
- Right_Opnd => Make_Integer_Literal (Loc, Esize (Typ))));
+ pragma Assert (not Non_Binary_Modulus (Typ));
- Analyze_And_Resolve (Right_Opnd (N), Rtp);
+ Rewrite (Right_Opnd (N),
+ Make_Op_Rem (Loc,
+ Left_Opnd => Relocate_Node (Right_Opnd (N)),
+ Right_Opnd => Make_Integer_Literal (Loc, Esize (Typ))));
+
+ Analyze_And_Resolve (Right_Opnd (N), Rtp);
- if Modify_Tree_For_C then
Rewrite (N,
Make_Op_Or (Loc,
Left_Opnd =>
@@ -10351,8 +10433,8 @@ package body Exp_Ch4 is
Duplicate_Subexpr_No_Checks (Right_Opnd (N))))));
Analyze_And_Resolve (N, Typ);
- end if;
- end;
+ end;
+ end if;
end Expand_N_Op_Rotate_Right;
----------------------------
@@ -10382,6 +10464,10 @@ package body Exp_Ch4 is
Hi : Uint;
begin
+ -- Sem_Intr should prevent getting there with a non binary modulus
+
+ pragma Assert (not Non_Binary_Modulus (Typ));
+
if Compile_Time_Known_Value (Right) then
if Expr_Value (Right) >= Siz then
Rewrite (N, Make_Integer_Literal (Loc, 0));
@@ -10439,7 +10525,14 @@ package body Exp_Ch4 is
Binary_Op_Validity_Checks (N);
-- If we are in Modify_Tree_For_C mode, there is no shift right
- -- arithmetic in C, so we rewrite in terms of logical shifts.
+ -- arithmetic in C, so we rewrite in terms of logical shifts for
+ -- modular integers, and keep the Shift_Right intrinsic for signed
+ -- integers: even though doing a shift on a signed integer is not
+ -- fully guaranteed by the C standard, this is what C compilers
+ -- implement in practice.
+ -- Consider also taking advantage of this for modular integers by first
+ -- performing an unchecked conversion of the modular integer to a signed
+ -- integer of the same sign, and then convert back.
-- Shift_Right (Num, Bits) or
-- (if Num >= Sign
@@ -10448,26 +10541,24 @@ package body Exp_Ch4 is
-- Here Mask is all 1 bits (2**size - 1), and Sign is 2**(size - 1)
- -- Note: in almost all C compilers it would work to just shift a
- -- signed integer right, but it's undefined and we cannot rely on it.
-
-- Note: the above works fine for shift counts greater than or equal
-- to the word size, since in this case (not (Shift_Right (Mask, bits)))
-- generates all 1'bits.
- -- What about nonbinary modulus ???
+ if Modify_Tree_For_C and then Is_Modular_Integer_Type (Etype (N)) then
+ declare
+ Loc : constant Source_Ptr := Sloc (N);
+ Typ : constant Entity_Id := Etype (N);
+ Sign : constant Uint := 2 ** (Esize (Typ) - 1);
+ Mask : constant Uint := (2 ** Esize (Typ)) - 1;
+ Left : constant Node_Id := Left_Opnd (N);
+ Right : constant Node_Id := Right_Opnd (N);
+ Maskx : Node_Id;
- declare
- Loc : constant Source_Ptr := Sloc (N);
- Typ : constant Entity_Id := Etype (N);
- Sign : constant Uint := 2 ** (Esize (Typ) - 1);
- Mask : constant Uint := (2 ** Esize (Typ)) - 1;
- Left : constant Node_Id := Left_Opnd (N);
- Right : constant Node_Id := Right_Opnd (N);
- Maskx : Node_Id;
+ begin
+ -- Sem_Intr should prevent getting there with a non binary modulus
- begin
- if Modify_Tree_For_C then
+ pragma Assert (not Non_Binary_Modulus (Typ));
-- Here if not (Shift_Right (Mask, bits)) can be computed at
-- compile time as a single constant.
@@ -10513,8 +10604,8 @@ package body Exp_Ch4 is
Maskx,
Make_Integer_Literal (Loc, 0)))));
Analyze_And_Resolve (N, Typ);
- end if;
- end;
+ end;
+ end if;
end Expand_N_Op_Shift_Right_Arithmetic;
--------------------------
@@ -11366,7 +11457,12 @@ package body Exp_Ch4 is
-- Start of processing for Discrete_Range_Check
begin
- -- Nothing to do if conversion was rewritten
+ -- Clear the Do_Range_Check flag on N if needed: this can occur when
+ -- e.g. a trivial type conversion is rewritten by its expression.
+
+ Set_Do_Range_Check (N, False);
+
+ -- Nothing more to do if conversion was rewritten
if Nkind (N) /= N_Type_Conversion then
return;
@@ -11374,6 +11470,16 @@ package body Exp_Ch4 is
Expr := Expression (N);
+ -- Nothing to do if no range check flag set
+
+ if not Do_Range_Check (Expr) then
+ return;
+ end if;
+
+ -- Clear the Do_Range_Check flag on Expr
+
+ Set_Do_Range_Check (Expr, False);
+
-- Nothing to do if range checks suppressed
if Range_Checks_Suppressed (Target_Type) then
@@ -11392,23 +11498,20 @@ package body Exp_Ch4 is
-- Before we do a range check, we have to deal with treating
-- a fixed-point operand as an integer. The way we do this
-- is simply to do an unchecked conversion to an appropriate
- -- integer type large enough to hold the result.
+ -- integer type with the smallest size, so that we can suppress
+ -- trivial checks.
if Is_Fixed_Point_Type (Etype (Expr)) then
- if Esize (Base_Type (Etype (Expr))) > Standard_Integer_Size then
- Ityp := Standard_Long_Long_Integer;
- else
- Ityp := Standard_Integer;
- end if;
+ Ityp := Small_Integer_Type_For
+ (Esize (Base_Type (Etype (Expr))), False);
- -- Generate a temporary with the large type to facilitate in the C
- -- backend the code generation for the unchecked conversion.
+ -- Generate a temporary with the integer type to facilitate in the
+ -- C backend the code generation for the unchecked conversion.
if Modify_Tree_For_C then
Generate_Temporary;
end if;
- Set_Do_Range_Check (Expr, False);
Rewrite (Expr, Unchecked_Convert_To (Ityp, Expr));
end if;
@@ -11645,7 +11748,12 @@ package body Exp_Ch4 is
Tnn : Entity_Id;
begin
- -- Nothing to do if conversion was rewritten
+ -- Clear the Do_Range_Check flag on N if needed: this can occur when
+ -- e.g. a trivial type conversion is rewritten by its expression.
+
+ Set_Do_Range_Check (N, False);
+
+ -- Nothing more to do if conversion was rewritten
if Nkind (N) /= N_Type_Conversion then
return;
@@ -11653,7 +11761,7 @@ package body Exp_Ch4 is
Expr := Expression (N);
- -- Clear the flag once for all
+ -- Clear the Do_Range_Check flag on Expr
Set_Do_Range_Check (Expr, False);
@@ -11928,7 +12036,8 @@ package body Exp_Ch4 is
-- Nothing at all to do if conversion is to the identical type so remove
-- the conversion completely, it is useless, except that it may carry
- -- an Assignment_OK attribute, which must be propagated to the operand.
+ -- an Assignment_OK attribute, which must be propagated to the operand
+ -- and the Do_Range_Check flag on Operand should be taken into account.
if Operand_Type = Target_Type then
if Assignment_OK (N) then
@@ -11936,6 +12045,13 @@ package body Exp_Ch4 is
end if;
Rewrite (N, Relocate_Node (Operand));
+
+ if Do_Range_Check (Operand) then
+ pragma Assert (Is_Discrete_Type (Operand_Type));
+
+ Discrete_Range_Check;
+ end if;
+
goto Done;
end if;
@@ -12044,7 +12160,7 @@ package body Exp_Ch4 is
-- in Checks.Apply_Arithmetic_Overflow_Check, but we catch more cases in
-- the processing here. Also we still need the Checks circuit, since we
-- have to be sure not to generate junk overflow checks in the first
- -- place, since it would be trick to remove them here.
+ -- place, since it would be tricky to remove them here.
if Integer_Promotion_Possible (N) then
@@ -12172,8 +12288,8 @@ package body Exp_Ch4 is
and then Ekind (Operand_Type) = E_Anonymous_Access_Type
and then Nkind (Operand) = N_Selected_Component
and then Ekind (Entity (Selector_Name (Operand))) = E_Discriminant
- and then Object_Access_Level (Operand) >
- Type_Access_Level (Target_Type)
+ and then Static_Accessibility_Level (Operand, Zero_On_Dynamic_Level)
+ > Type_Access_Level (Target_Type)
then
Raise_Accessibility_Error;
goto Done;
@@ -12328,7 +12444,9 @@ package body Exp_Ch4 is
-- These conversions require special expansion and processing, found in
-- the Exp_Fixd package. We ignore cases where Conversion_OK is set,
-- since from a semantic point of view, these are simple integer
- -- conversions, which do not need further processing.
+ -- conversions, which do not need further processing except for the
+ -- generation of range checks, which is performed at the end of this
+ -- procedure.
elsif Is_Fixed_Point_Type (Operand_Type)
and then not Conversion_OK (N)
@@ -12536,11 +12654,15 @@ package body Exp_Ch4 is
then
Real_Range_Check;
end if;
+
+ pragma Assert (not Do_Range_Check (Expression (N)));
end if;
-- Here at end of processing
<<Done>>
+ pragma Assert (not Do_Range_Check (N));
+
-- Apply predicate check if required. Note that we can't just call
-- Apply_Predicate_Check here, because the type looks right after
-- the conversion and it would omit the check. The Comes_From_Source
@@ -13988,6 +14110,11 @@ package body Exp_Ch4 is
elsif Is_OK_For_Range (Uint_64) then
return Uint_64;
+ -- If the size of Typ is 128 then check 127
+
+ elsif Tsiz = Uint_128 and then Is_OK_For_Range (Uint_127) then
+ return Uint_127;
+
else
return Uint_128;
end if;
@@ -14107,12 +14234,8 @@ package body Exp_Ch4 is
-- type instead of the first subtype because operations are done in
-- the base type, so this avoids the need for useless conversions.
- if Nsiz <= Standard_Integer_Size then
- Ntyp := Etype (Standard_Integer);
-
- elsif Nsiz <= Standard_Long_Long_Integer_Size then
- Ntyp := Etype (Standard_Long_Long_Integer);
-
+ if Nsiz <= System_Max_Integer_Size then
+ Ntyp := Etype (Integer_Type_For (Nsiz, Uns => False));
else
return;
end if;
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 309297b..93351cf 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -523,11 +523,11 @@ package body Exp_Ch5 is
elsif Has_Controlled_Component (L_Type) then
Loop_Required := True;
- -- If object is atomic/VFA, we cannot tolerate a loop
+ -- If object is full access, we cannot tolerate a loop
- elsif Is_Atomic_Or_VFA_Object (Act_Lhs)
+ elsif Is_Full_Access_Object (Act_Lhs)
or else
- Is_Atomic_Or_VFA_Object (Act_Rhs)
+ Is_Full_Access_Object (Act_Rhs)
then
return;
@@ -536,8 +536,8 @@ package body Exp_Ch5 is
elsif Has_Atomic_Components (L_Type)
or else Has_Atomic_Components (R_Type)
- or else Is_Atomic_Or_VFA (Component_Type (L_Type))
- or else Is_Atomic_Or_VFA (Component_Type (R_Type))
+ or else Is_Full_Access (Component_Type (L_Type))
+ or else Is_Full_Access (Component_Type (R_Type))
then
Loop_Required := True;
@@ -2518,7 +2518,7 @@ package body Exp_Ch5 is
Condition =>
Make_Op_Gt (Loc,
Left_Opnd =>
- Dynamic_Accessibility_Level (Rhs),
+ Accessibility_Level (Rhs, Dynamic_Level),
Right_Opnd =>
Make_Integer_Literal (Loc,
Intval =>
@@ -2534,7 +2534,8 @@ package body Exp_Ch5 is
(Effective_Extra_Accessibility
(Entity (Lhs)), Loc),
Expression =>
- Dynamic_Accessibility_Level (Rhs));
+ Accessibility_Level
+ (Rhs, Dynamic_Level));
begin
if not Accessibility_Checks_Suppressed (Entity (Lhs)) then
@@ -3115,7 +3116,35 @@ package body Exp_Ch5 is
if Validity_Check_Default
and then not Predicates_Ignored (Etype (Expr))
then
- Ensure_Valid (Expr);
+ -- Recognize the simple case where Expr is an object reference
+ -- and the case statement is directly preceded by an
+ -- "if Obj'Valid then": in this case, do not emit another validity
+ -- check.
+
+ declare
+ Check_Validity : Boolean := True;
+ Attr : Node_Id;
+ begin
+ if Nkind (Expr) = N_Identifier
+ and then Nkind (Parent (N)) = N_If_Statement
+ and then Nkind (Original_Node (Condition (Parent (N))))
+ = N_Attribute_Reference
+ and then No (Prev (N))
+ then
+ Attr := Original_Node (Condition (Parent (N)));
+
+ if Attribute_Name (Attr) = Name_Valid
+ and then Nkind (Prefix (Attr)) = N_Identifier
+ and then Entity (Prefix (Attr)) = Entity (Expr)
+ then
+ Check_Validity := False;
+ end if;
+ end if;
+
+ if Check_Validity then
+ Ensure_Valid (Expr);
+ end if;
+ end;
end if;
-- If there is only a single alternative, just replace it with the
@@ -3510,17 +3539,6 @@ package body Exp_Ch5 is
Analyze (N);
end Expand_Formal_Container_Element_Loop;
- -----------------------------
- -- Expand_N_Goto_Statement --
- -----------------------------
-
- -- Add poll before goto if polling active
-
- procedure Expand_N_Goto_Statement (N : Node_Id) is
- begin
- Generate_Poll_Call (N);
- end Expand_N_Goto_Statement;
-
---------------------------
-- Expand_N_If_Statement --
---------------------------
@@ -4608,7 +4626,6 @@ package body Exp_Ch5 is
-- 4. Deal with while loops where Condition_Actions is set
-- 5. Deal with loops over predicated subtypes
-- 6. Deal with loops with iterators over arrays and containers
- -- 7. Insert polling call if required
procedure Expand_N_Loop_Statement (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
@@ -4629,12 +4646,6 @@ package body Exp_Ch5 is
Adjust_Condition (Condition (Scheme));
end if;
- -- Generate polling call
-
- if Is_Non_Empty_List (Statements (N)) then
- Generate_Poll_Call (First (Statements (N)));
- end if;
-
-- Nothing more to do for plain loop with no iteration scheme
if No (Scheme) then
diff --git a/gcc/ada/exp_ch5.ads b/gcc/ada/exp_ch5.ads
index f4cb868..4f5e995 100644
--- a/gcc/ada/exp_ch5.ads
+++ b/gcc/ada/exp_ch5.ads
@@ -32,7 +32,6 @@ package Exp_Ch5 is
procedure Expand_N_Block_Statement (N : Node_Id);
procedure Expand_N_Case_Statement (N : Node_Id);
procedure Expand_N_Exit_Statement (N : Node_Id);
- procedure Expand_N_Goto_Statement (N : Node_Id);
procedure Expand_N_If_Statement (N : Node_Id);
procedure Expand_N_Loop_Statement (N : Node_Id);
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 57d3884..b762026 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -34,7 +34,6 @@ with Elists; use Elists;
with Expander; use Expander;
with Exp_Aggr; use Exp_Aggr;
with Exp_Atag; use Exp_Atag;
-with Exp_Ch2; use Exp_Ch2;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
@@ -1458,12 +1457,12 @@ package body Exp_Ch6 is
Subp : Entity_Id;
Post_Call : out List_Id)
is
- Loc : constant Source_Ptr := Sloc (N);
- Actual : Node_Id;
- Formal : Entity_Id;
- N_Node : Node_Id;
- E_Actual : Entity_Id;
- E_Formal : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (N);
+ Actual : Node_Id;
+ Formal : Entity_Id;
+ N_Node : Node_Id;
+ E_Actual : Entity_Id;
+ E_Formal : Entity_Id;
procedure Add_Call_By_Copy_Code;
-- For cases where the parameter must be passed by copy, this routine
@@ -1807,13 +1806,7 @@ package body Exp_Ch6 is
pragma Assert (Ada_Version >= Ada_2012);
- if Type_Access_Level (E_Formal) >
- Object_Access_Level (Lhs)
- then
- Append_To (Post_Call,
- Make_Raise_Program_Error (Loc,
- Reason => PE_Accessibility_Check_Failed));
- end if;
+ Apply_Accessibility_Check (Lhs, E_Formal, N);
Append_To (Post_Call,
Make_Assignment_Statement (Loc,
@@ -2366,9 +2359,7 @@ package body Exp_Ch6 is
elsif Nkind (Actual) = N_Type_Conversion
and then
- (Is_Numeric_Type (E_Formal)
- or else Is_Access_Type (E_Formal)
- or else Is_Enumeration_Type (E_Formal)
+ (Is_Elementary_Type (E_Formal)
or else Is_Bit_Packed_Array (Etype (Formal))
or else Is_Bit_Packed_Array (Etype (Expression (Actual)))
@@ -2682,22 +2673,22 @@ package body Exp_Ch6 is
| N_Function_Call
| N_Procedure_Call_Statement);
- -- Check that this is not the call in the body of the wrapper.
+ -- Check that this is not the call in the body of the wrapper
if Must_Rewrite_Indirect_Call
and then (not Is_Overloadable (Current_Scope)
or else not Is_Access_Subprogram_Wrapper (Current_Scope))
then
declare
- Loc : constant Source_Ptr := Sloc (N);
- Wrapper : constant Entity_Id :=
+ Loc : constant Source_Ptr := Sloc (N);
+ Wrapper : constant Entity_Id :=
Access_Subprogram_Wrapper (Etype (Name (N)));
Ptr : constant Node_Id := Prefix (Name (N));
Ptr_Type : constant Entity_Id := Etype (Ptr);
Typ : constant Entity_Id := Etype (N);
New_N : Node_Id;
- Parms : List_Id := Parameter_Associations (N);
+ Parms : List_Id := Parameter_Associations (N);
Ptr_Act : Node_Id;
begin
@@ -2735,7 +2726,7 @@ package body Exp_Ch6 is
if Nkind (N) = N_Procedure_Call_Statement then
New_N := Make_Procedure_Call_Statement (Loc,
- Name => New_Occurrence_Of (Wrapper, Loc),
+ Name => New_Occurrence_Of (Wrapper, Loc),
Parameter_Associations => Parms);
else
New_N := Make_Function_Call (Loc,
@@ -2784,6 +2775,15 @@ package body Exp_Ch6 is
-- default parameters and for extra actuals (for Extra_Formals). The
-- argument is an N_Parameter_Association node.
+ procedure Add_Cond_Expression_Extra_Actual (Formal : Entity_Id);
+ -- Adds extra accessibility actuals in the case of a conditional
+ -- expression corresponding to Formal.
+
+ -- Note: Conditional expressions used as actuals for anonymous access
+ -- formals complicate the process of propagating extra accessibility
+ -- actuals and must be handled in a recursive fashion since they can
+ -- be embedded within each other.
+
procedure Add_Extra_Actual (Expr : Node_Id; EF : Entity_Id);
-- Adds an extra actual to the list of extra actuals. Expr is the
-- expression for the value of the actual, EF is the entity for the
@@ -2802,6 +2802,10 @@ package body Exp_Ch6 is
-- though useless predicate checks will be generally removed by
-- back-end optimizations.
+ procedure Check_Subprogram_Variant;
+ -- Emit a call to the internally generated procedure with checks for
+ -- aspect Subprogrgram_Variant, if present and enabled.
+
function Inherited_From_Formal (S : Entity_Id) return Entity_Id;
-- Within an instance, a type derived from an untagged formal derived
-- type inherits from the original parent, not from the actual. The
@@ -2867,6 +2871,219 @@ package body Exp_Ch6 is
Prev := Actual_Expr;
end Add_Actual_Parameter;
+ --------------------------------------
+ -- Add_Cond_Expression_Extra_Actual --
+ --------------------------------------
+
+ procedure Add_Cond_Expression_Extra_Actual
+ (Formal : Entity_Id)
+ is
+ Decl : Node_Id;
+
+ -- Suppress warning for the final removal loop
+ pragma Warnings (Off, Decl);
+
+ Lvl : Entity_Id;
+ Res : Entity_Id;
+ Temp : Node_Id;
+ Typ : Node_Id;
+
+ procedure Insert_Level_Assign (Branch : Node_Id);
+ -- Recursivly add assignment of the level temporary on each branch
+ -- while moving through nested conditional expressions.
+
+ -------------------------
+ -- Insert_Level_Assign --
+ -------------------------
+
+ procedure Insert_Level_Assign (Branch : Node_Id) is
+
+ procedure Expand_Branch (Res_Assn : Node_Id);
+ -- Perform expansion or iterate further within nested
+ -- conditionals given the object declaration or assignment to
+ -- result object created during expansion which represents a
+ -- branch of the conditional expression.
+
+ -------------------
+ -- Expand_Branch --
+ -------------------
+
+ procedure Expand_Branch (Res_Assn : Node_Id) is
+ begin
+ pragma Assert (Nkind (Res_Assn) in
+ N_Assignment_Statement |
+ N_Object_Declaration);
+
+ -- There are more nested conditional expressions so we must go
+ -- deeper.
+
+ if Nkind (Expression (Res_Assn)) =
+ N_Expression_With_Actions
+ and then
+ Nkind
+ (Original_Node (Expression (Res_Assn)))
+ in N_Case_Expression | N_If_Expression
+ then
+ Insert_Level_Assign
+ (Expression (Res_Assn));
+
+ -- Add the level assignment
+
+ else
+ Insert_Before_And_Analyze (Res_Assn,
+ Make_Assignment_Statement (Loc,
+ Name =>
+ New_Occurrence_Of
+ (Lvl, Loc),
+ Expression =>
+ Accessibility_Level
+ (Expression (Res_Assn), Dynamic_Level)));
+ end if;
+ end Expand_Branch;
+
+ Cond : Node_Id;
+ Alt : Node_Id;
+
+ -- Start of processing for Insert_Level_Assign
+
+ begin
+ -- Examine further nested condtionals
+
+ pragma Assert (Nkind (Branch) =
+ N_Expression_With_Actions);
+
+ -- Find the relevant statement in the actions
+
+ Cond := First (Actions (Branch));
+ while Present (Cond) loop
+ exit when Nkind (Cond) in
+ N_Case_Statement | N_If_Statement;
+
+ Next (Cond);
+ end loop;
+
+ -- The conditional expression may have been optimized away, so
+ -- examine the actions in the branch.
+
+ if No (Cond) then
+ Expand_Branch (Last (Actions (Branch)));
+
+ -- Iterate through if expression branches
+
+ elsif Nkind (Cond) = N_If_Statement then
+ Expand_Branch (Last (Then_Statements (Cond)));
+ Expand_Branch (Last (Else_Statements (Cond)));
+
+ -- Iterate through case alternatives
+
+ elsif Nkind (Cond) = N_Case_Statement then
+
+ Alt := First (Alternatives (Cond));
+ while Present (Alt) loop
+ Expand_Branch (Last (Statements (Alt)));
+
+ Next (Alt);
+ end loop;
+ end if;
+ end Insert_Level_Assign;
+
+ -- Start of processing for cond expression case
+
+ begin
+ -- Create declaration of a temporary to store the accessibility
+ -- level of each branch of the conditional expression.
+
+ Lvl := Make_Temporary (Loc, 'L');
+ Decl := Make_Object_Declaration (Loc,
+ Defining_Identifier => Lvl,
+ Object_Definition =>
+ New_Occurrence_Of (Standard_Natural, Loc));
+
+ -- Install the declaration and perform necessary expansion if we
+ -- are dealing with a function call.
+
+ if Nkind (Call_Node) = N_Procedure_Call_Statement then
+ -- Generate:
+ -- Lvl : Natural;
+ -- Call (
+ -- {do
+ -- If_Exp_Res : Typ;
+ -- if Cond then
+ -- Lvl := 0; -- Access level
+ -- If_Exp_Res := Exp;
+ -- ...
+ -- in If_Exp_Res end;},
+ -- Lvl,
+ -- ...
+ -- )
+
+ Insert_Before_And_Analyze (Call_Node, Decl);
+
+ -- A function call must be transformed into an expression with
+ -- actions.
+
+ else
+ -- Generate:
+ -- do
+ -- Lvl : Natural;
+ -- in Call (do{
+ -- If_Exp_Res : Typ
+ -- if Cond then
+ -- Lvl := 0; -- Access level
+ -- If_Exp_Res := Exp;
+ -- in If_Exp_Res end;},
+ -- Lvl,
+ -- ...
+ -- )
+ -- end;
+
+ Res := Make_Temporary (Loc, 'R');
+ Typ := Etype (Call_Node);
+ Temp := Relocate_Node (Call_Node);
+
+ -- Perform the rewrite with the dummy
+
+ Rewrite (Call_Node,
+
+ Make_Expression_With_Actions (Loc,
+ Expression => New_Occurrence_Of (Res, Loc),
+ Actions => New_List (
+ Decl,
+
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Res,
+ Object_Definition =>
+ New_Occurrence_Of (Typ, Loc)))));
+
+ -- Analyze the expression with the dummy
+
+ Analyze_And_Resolve (Call_Node, Typ);
+
+ -- Properly set the expression and move our view of the call node
+
+ Set_Expression (Call_Node, Relocate_Node (Temp));
+ Call_Node := Expression (Call_Node);
+
+ -- Remove the declaration of the dummy and the subsequent actions
+ -- its analysis has created.
+
+ while Present (Remove_Next (Decl)) loop
+ null;
+ end loop;
+ end if;
+
+ -- Decorate the conditional expression with assignments to our level
+ -- temporary.
+
+ Insert_Level_Assign (Prev);
+
+ -- Make our level temporary the passed actual
+
+ Add_Extra_Actual
+ (Expr => New_Occurrence_Of (Lvl, Loc),
+ EF => Extra_Accessibility (Formal));
+ end Add_Cond_Expression_Extra_Actual;
+
----------------------
-- Add_Extra_Actual --
----------------------
@@ -2927,7 +3144,7 @@ package body Exp_Ch6 is
if Has_Invariants (Curr_Typ)
and then Present (Invariant_Procedure (Curr_Typ))
then
- -- Verify the invariate of the current type. Generate:
+ -- Verify the invariant of the current type. Generate:
-- <Curr_Typ>Invariant (Curr_Typ (Arg));
@@ -2945,7 +3162,12 @@ package body Exp_Ch6 is
Par_Typ := Base_Type (Etype (Curr_Typ));
end loop;
- if not Is_Empty_List (Inv_Checks) then
+ -- If the node is a function call the generated tests have been
+ -- already handled in Insert_Post_Call_Actions.
+
+ if not Is_Empty_List (Inv_Checks)
+ and then Nkind (Call_Node) = N_Procedure_Call_Statement
+ then
Insert_Actions_After (Call_Node, Inv_Checks);
end if;
end Add_View_Conversion_Invariants;
@@ -2971,9 +3193,7 @@ package body Exp_Ch6 is
function May_Fold (N : Node_Id) return Traverse_Result is
begin
case Nkind (N) is
- when N_Binary_Op
- | N_Unary_Op
- =>
+ when N_Op =>
return OK;
when N_Expanded_Name
@@ -3057,6 +3277,37 @@ package body Exp_Ch6 is
end if;
end Can_Fold_Predicate_Call;
+ ------------------------------
+ -- Check_Subprogram_Variant --
+ ------------------------------
+
+ procedure Check_Subprogram_Variant is
+ Variant_Prag : constant Node_Id :=
+ Get_Pragma (Current_Scope, Pragma_Subprogram_Variant);
+
+ Variant_Proc : Entity_Id;
+
+ begin
+ if Present (Variant_Prag) and then Is_Checked (Variant_Prag) then
+
+ -- Analysis of the pragma rewrites its argument with a reference
+ -- to the internally generated procedure.
+
+ Variant_Proc :=
+ Entity
+ (Expression
+ (First
+ (Pragma_Argument_Associations (Variant_Prag))));
+
+ Insert_Action (Call_Node,
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (Variant_Proc, Loc),
+ Parameter_Associations =>
+ New_Copy_List (Parameter_Associations (Call_Node))));
+ end if;
+ end Check_Subprogram_Variant;
+
---------------------------
-- Inherited_From_Formal --
---------------------------
@@ -3217,7 +3468,7 @@ package body Exp_Ch6 is
then
declare
Actual : Node_Id;
- Formal : Node_Id;
+ Formal : Entity_Id;
begin
Actual := First (Parameter_Associations (Call_Node));
@@ -3261,10 +3512,9 @@ package body Exp_Ch6 is
Actual : Node_Id;
Formal : Entity_Id;
Orig_Subp : Entity_Id := Empty;
- Param_Count : Natural := 0;
+ Param_Count : Positive;
Parent_Formal : Entity_Id;
Parent_Subp : Entity_Id;
- Prev_Ult : Node_Id;
Scop : Entity_Id;
Subp : Entity_Id;
@@ -3405,8 +3655,7 @@ package body Exp_Ch6 is
end;
end if;
- -- if this is a call to a predicate function, try to constant
- -- fold it.
+ -- If this is a call to a predicate function, try to constant fold it
if Nkind (Call_Node) = N_Function_Call
and then Is_Entity_Name (Name (Call_Node))
@@ -3623,7 +3872,7 @@ package body Exp_Ch6 is
-- Create possible extra actual for accessibility level
- if Present (Get_Accessibility (Formal)) then
+ if Present (Extra_Accessibility (Formal)) then
-- Ada 2005 (AI-252): If the actual was rewritten as an Access
-- attribute, then the original actual may be an aliased object
@@ -3712,413 +3961,25 @@ package body Exp_Ch6 is
Add_Extra_Actual
(Expr =>
- New_Occurrence_Of (Get_Accessibility (Parm_Ent), Loc),
- EF => Get_Accessibility (Formal));
+ New_Occurrence_Of
+ (Get_Dynamic_Accessibility (Parm_Ent), Loc),
+ EF => Extra_Accessibility (Formal));
end;
- elsif Is_Entity_Name (Prev_Orig) then
-
- -- When passing an access parameter, or a renaming of an access
- -- parameter, as the actual to another access parameter we need
- -- to pass along the actual's own access level parameter. This
- -- is done if we are within the scope of the formal access
- -- parameter (if this is an inlined body the extra formal is
- -- irrelevant).
-
- if (Is_Formal (Entity (Prev_Orig))
- or else
- (Present (Renamed_Object (Entity (Prev_Orig)))
- and then
- Is_Entity_Name (Renamed_Object (Entity (Prev_Orig)))
- and then
- Is_Formal
- (Entity (Renamed_Object (Entity (Prev_Orig))))))
- and then Ekind (Etype (Prev_Orig)) = E_Anonymous_Access_Type
- and then In_Open_Scopes (Scope (Entity (Prev_Orig)))
- then
- declare
- Parm_Ent : constant Entity_Id := Param_Entity (Prev_Orig);
-
- begin
- pragma Assert (Present (Parm_Ent));
-
- if Present (Get_Accessibility (Parm_Ent)) then
- Add_Extra_Actual
- (Expr =>
- New_Occurrence_Of
- (Get_Accessibility (Parm_Ent), Loc),
- EF => Get_Accessibility (Formal));
-
- -- If the actual access parameter does not have an
- -- associated extra formal providing its scope level,
- -- then treat the actual as having library-level
- -- accessibility.
+ -- Conditional expressions
- else
- Add_Extra_Actual
- (Expr =>
- Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Standard_Standard)),
- EF => Get_Accessibility (Formal));
- end if;
- end;
-
- -- The actual is a normal access value, so just pass the level
- -- of the actual's access type.
-
- else
- Add_Extra_Actual
- (Expr => Dynamic_Accessibility_Level (Prev_Orig),
- EF => Get_Accessibility (Formal));
- end if;
-
- -- If the actual is an access discriminant, then pass the level
- -- of the enclosing object (RM05-3.10.2(12.4/2)).
-
- elsif Nkind (Prev_Orig) = N_Selected_Component
- and then Ekind (Entity (Selector_Name (Prev_Orig))) =
- E_Discriminant
- and then Ekind (Etype (Entity (Selector_Name (Prev_Orig)))) =
- E_Anonymous_Access_Type
+ elsif Nkind (Prev) = N_Expression_With_Actions
+ and then Nkind (Original_Node (Prev)) in
+ N_If_Expression | N_Case_Expression
then
- Add_Extra_Actual
- (Expr =>
- Make_Integer_Literal (Loc,
- Intval => Object_Access_Level (Prefix (Prev_Orig))),
- EF => Get_Accessibility (Formal));
+ Add_Cond_Expression_Extra_Actual (Formal);
- -- All other cases
+ -- Normal case
else
- case Nkind (Prev_Orig) is
- when N_Attribute_Reference =>
- case Get_Attribute_Id (Attribute_Name (Prev_Orig)) is
- -- Ignore 'Result, 'Loop_Entry, and 'Old as they can
- -- be used to identify access objects and do not have
- -- an effect on accessibility level.
-
- when Attribute_Loop_Entry
- | Attribute_Old
- | Attribute_Result
- =>
- null;
-
- -- For X'Access, pass on the level of the prefix X
-
- when Attribute_Access =>
-
- -- Accessibility level of S'Access is that of A
-
- Prev_Orig := Prefix (Prev_Orig);
-
- -- If the expression is a view conversion, the
- -- accessibility level is that of the expression.
-
- if Nkind (Original_Node (Prev_Orig)) =
- N_Type_Conversion
- and then
- Nkind (Expression (Original_Node (Prev_Orig))) =
- N_Explicit_Dereference
- then
- Prev_Orig :=
- Expression (Original_Node (Prev_Orig));
- end if;
-
- -- Obtain the ultimate prefix so we can check for
- -- the case where we are taking 'Access of a
- -- component of an anonymous access formal - which
- -- would mean we need to pass said formal's
- -- corresponding extra accessibility formal.
-
- Prev_Ult := Ultimate_Prefix (Prev_Orig);
-
- if Is_Entity_Name (Prev_Ult)
- and then not Is_Type (Entity (Prev_Ult))
- and then Present
- (Get_Accessibility
- (Entity (Prev_Ult)))
- then
- Add_Extra_Actual
- (Expr =>
- New_Occurrence_Of
- (Get_Accessibility
- (Entity (Prev_Ult)), Loc),
- EF => Get_Accessibility (Formal));
-
- -- Normal case, call Object_Access_Level. Note:
- -- should be Dynamic_Accessibility_Level ???
-
- else
- Add_Extra_Actual
- (Expr =>
- Make_Integer_Literal (Loc,
- Intval =>
- Object_Access_Level (Prev_Orig)),
- EF => Get_Accessibility (Formal));
- end if;
-
- -- Treat the unchecked attributes as library-level
-
- when Attribute_Unchecked_Access
- | Attribute_Unrestricted_Access
- =>
- Add_Extra_Actual
- (Expr =>
- Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Standard_Standard)),
- EF => Get_Accessibility (Formal));
-
- -- No other cases of attributes returning access
- -- values that can be passed to access parameters.
-
- when others =>
- raise Program_Error;
-
- end case;
-
- -- For allocators we pass the level of the execution of the
- -- called subprogram, which is one greater than the current
- -- scope level. However, according to RM 3.10.2(14/3) this
- -- is wrong since for an anonymous allocator defining the
- -- value of an access parameter, the accessibility level is
- -- that of the innermost master of the call???
-
- when N_Allocator =>
- Add_Extra_Actual
- (Expr =>
- Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Current_Scope) + 1),
- EF => Get_Accessibility (Formal));
-
- -- For most other cases we simply pass the level of the
- -- actual's access type. The type is retrieved from
- -- Prev rather than Prev_Orig, because in some cases
- -- Prev_Orig denotes an original expression that has
- -- not been analyzed.
-
- -- However, when the actual is wrapped in a conditional
- -- expression we must add a local temporary to store the
- -- level at each branch, and, possibly, expand the call
- -- into an expression with actions.
-
- when others =>
- if Nkind (Prev) = N_Expression_With_Actions
- and then Nkind (Original_Node (Prev)) in
- N_If_Expression | N_Case_Expression
- then
- declare
- Decl : Node_Id;
- pragma Warnings (Off, Decl);
- -- Suppress warning for the final removal loop
- Lvl : Entity_Id;
- Res : Entity_Id;
- Temp : Node_Id;
- Typ : Node_Id;
-
- procedure Insert_Level_Assign (Branch : Node_Id);
- -- Recursivly add assignment of the level temporary
- -- on each branch while moving through nested
- -- conditional expressions.
-
- -------------------------
- -- Insert_Level_Assign --
- -------------------------
-
- procedure Insert_Level_Assign (Branch : Node_Id) is
-
- procedure Expand_Branch (Assn : Node_Id);
- -- Perform expansion or iterate further within
- -- nested conditionals.
-
- -------------------
- -- Expand_Branch --
- -------------------
-
- procedure Expand_Branch (Assn : Node_Id) is
- begin
- pragma Assert (Nkind (Assn) =
- N_Assignment_Statement);
-
- -- There are more nested conditional
- -- expressions so we must go deeper.
-
- if Nkind (Expression (Assn)) =
- N_Expression_With_Actions
- and then
- Nkind
- (Original_Node (Expression (Assn))) in
- N_Case_Expression | N_If_Expression
- then
- Insert_Level_Assign (Expression (Assn));
-
- -- Add the level assignment
-
- else
- Insert_Before_And_Analyze (Assn,
- Make_Assignment_Statement (Loc,
- Name =>
- New_Occurrence_Of
- (Lvl, Loc),
- Expression =>
- Dynamic_Accessibility_Level
- (Expression (Assn))));
- end if;
- end Expand_Branch;
-
- Cond : Node_Id;
- Alt : Node_Id;
-
- -- Start of processing for Insert_Level_Assign
-
- begin
- -- Examine further nested condtionals
-
- pragma Assert (Nkind (Branch) =
- N_Expression_With_Actions);
-
- -- Find the relevant statement in the actions
-
- Cond := First (Actions (Branch));
- loop
- exit when Nkind (Cond) in
- N_Case_Statement | N_If_Statement;
-
- Next (Cond);
-
- if No (Cond) then
- raise Program_Error;
- end if;
- end loop;
-
- -- Iterate through if expression branches
-
- if Nkind (Cond) = N_If_Statement then
- Expand_Branch (Last (Then_Statements (Cond)));
- Expand_Branch (Last (Else_Statements (Cond)));
-
- -- Iterate through case alternatives
-
- elsif Nkind (Cond) = N_Case_Statement then
-
- Alt := First (Alternatives (Cond));
- while Present (Alt) loop
- Expand_Branch (Last (Statements (Alt)));
-
- Next (Alt);
- end loop;
- end if;
- end Insert_Level_Assign;
-
- -- Start of processing for cond expression case
-
- begin
- -- Create declaration of a temporary to store the
- -- accessibility level of each branch of the
- -- conditional expression.
-
- Lvl := Make_Temporary (Loc, 'L');
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Lvl,
- Object_Definition =>
- New_Occurrence_Of (Standard_Natural, Loc));
-
- -- Install the declaration and perform necessary
- -- expansion if we are dealing with a function
- -- call.
-
- if Nkind (Call_Node) = N_Procedure_Call_Statement
- then
- -- Generate:
- -- Lvl : Natural;
- -- Call (
- -- {do
- -- If_Exp_Res : Typ;
- -- if Cond then
- -- Lvl := 0; -- Access level
- -- If_Exp_Res := Exp;
- -- ...
- -- in If_Exp_Res end;},
- -- Lvl,
- -- ...
- -- )
-
- Insert_Before_And_Analyze (Call_Node, Decl);
-
- -- A function call must be transformed into an
- -- expression with actions.
-
- else
- -- Generate:
- -- do
- -- Lvl : Natural;
- -- in Call (do{
- -- If_Exp_Res : Typ
- -- if Cond then
- -- Lvl := 0; -- Access level
- -- If_Exp_Res := Exp;
- -- in If_Exp_Res end;},
- -- Lvl,
- -- ...
- -- )
- -- end;
-
- Res := Make_Temporary (Loc, 'R');
- Typ := Etype (Call_Node);
- Temp := Relocate_Node (Call_Node);
-
- -- Perform the rewrite with the dummy
-
- Rewrite (Call_Node,
-
- Make_Expression_With_Actions (Loc,
- Expression => New_Occurrence_Of (Res, Loc),
- Actions => New_List (
- Decl,
-
- Make_Object_Declaration (Loc,
- Defining_Identifier => Res,
- Object_Definition =>
- New_Occurrence_Of (Typ, Loc)))));
-
- -- Analyze the expression with the dummy
-
- Analyze_And_Resolve (Call_Node, Typ);
-
- -- Properly set the expression and move our view
- -- of the call node
-
- Set_Expression (Call_Node, Relocate_Node (Temp));
- Call_Node := Expression (Call_Node);
-
- -- Remove the declaration of the dummy and the
- -- subsequent actions its analysis has created.
-
- while Present (Remove_Next (Decl)) loop
- null;
- end loop;
- end if;
-
- -- Decorate the conditional expression with
- -- assignments to our level temporary.
-
- Insert_Level_Assign (Prev);
-
- -- Make our level temporary the passed actual
-
- Add_Extra_Actual
- (Expr => New_Occurrence_Of (Lvl, Loc),
- EF => Get_Accessibility (Formal));
- end;
-
- -- General case uncomplicated by conditional expressions
-
- else
- Add_Extra_Actual
- (Expr => Dynamic_Accessibility_Level (Prev),
- EF => Get_Accessibility (Formal));
- end if;
- end case;
+ Add_Extra_Actual
+ (Expr => Accessibility_Level (Prev, Dynamic_Level),
+ EF => Extra_Accessibility (Formal));
end if;
end if;
@@ -4342,110 +4203,44 @@ package body Exp_Ch6 is
Present (Extra_Accessibility_Of_Result (Ultimate_Alias (Subp)))
then
declare
- Ancestor : Node_Id := Parent (Call_Node);
- Level : Node_Id := Empty;
- Defer : Boolean := False;
+ Extra_Form : Node_Id := Empty;
+ Level : Node_Id := Empty;
begin
- -- Unimplemented: if Subp returns an anonymous access type, then
-
- -- a) if the call is the operand of an explict conversion, then
- -- the target type of the conversion (a named access type)
- -- determines the accessibility level pass in;
-
- -- b) if the call defines an access discriminant of an object
- -- (e.g., the discriminant of an object being created by an
- -- allocator, or the discriminant of a function result),
- -- then the accessibility level to pass in is that of the
- -- discriminated object being initialized).
-
- -- ???
-
- while Nkind (Ancestor) = N_Qualified_Expression
- loop
- Ancestor := Parent (Ancestor);
- end loop;
-
- case Nkind (Ancestor) is
- when N_Allocator =>
-
- -- At this point, we'd like to assign
-
- -- Level := Dynamic_Accessibility_Level (Ancestor);
-
- -- but Etype of Ancestor may not have been set yet,
- -- so that doesn't work.
-
- -- Handle this later in Expand_Allocator_Expression.
-
- Defer := True;
-
- when N_Object_Declaration
- | N_Object_Renaming_Declaration
- =>
- declare
- Def_Id : constant Entity_Id :=
- Defining_Identifier (Ancestor);
-
- begin
- if Is_Return_Object (Def_Id) then
- if Present (Extra_Accessibility_Of_Result
- (Return_Applies_To (Scope (Def_Id))))
- then
- -- Pass along value that was passed in if the
- -- routine we are returning from also has an
- -- Accessibility_Of_Result formal.
-
- Level :=
- New_Occurrence_Of
- (Extra_Accessibility_Of_Result
- (Return_Applies_To (Scope (Def_Id))), Loc);
- end if;
- else
- Level :=
- Make_Integer_Literal (Loc,
- Intval => Object_Access_Level (Def_Id));
- end if;
- end;
-
- when N_Simple_Return_Statement =>
- if Present (Extra_Accessibility_Of_Result
- (Return_Applies_To
- (Return_Statement_Entity (Ancestor))))
- then
- -- Pass along value that was passed in if the returned
- -- routine also has an Accessibility_Of_Result formal.
-
- Level :=
- New_Occurrence_Of
- (Extra_Accessibility_Of_Result
- (Return_Applies_To
- (Return_Statement_Entity (Ancestor))), Loc);
- end if;
+ -- Detect cases where the function call has been internally
+ -- generated by examining the original node and return library
+ -- level - taking care to avoid ignoring function calls expanded
+ -- in prefix notation.
+
+ if Nkind (Original_Node (Call_Node)) not in N_Function_Call
+ | N_Selected_Component
+ | N_Indexed_Component
+ then
+ Level := Make_Integer_Literal
+ (Loc, Scope_Depth (Standard_Standard));
- when others =>
- null;
- end case;
+ -- Otherwise get the level normally based on the call node
- if not Defer then
- if not Present (Level) then
+ else
+ Level := Accessibility_Level (Call_Node, Dynamic_Level);
- -- The "innermost master that evaluates the function call".
+ end if;
- -- ??? - Should we use Integer'Last here instead in order
- -- to deal with (some of) the problems associated with
- -- calls to subps whose enclosing scope is unknown (e.g.,
- -- Anon_Access_To_Subp_Param.all)?
+ -- It may be possible that we are re-expanding an already
+ -- expanded call when are are dealing with dispatching ???
- Level :=
- Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Current_Scope) + 1);
- end if;
+ if not Present (Parameter_Associations (Call_Node))
+ or else Nkind (Last (Parameter_Associations (Call_Node)))
+ /= N_Parameter_Association
+ or else not Is_Accessibility_Actual
+ (Last (Parameter_Associations (Call_Node)))
+ then
+ Extra_Form := Extra_Accessibility_Of_Result
+ (Ultimate_Alias (Subp));
Add_Extra_Actual
(Expr => Level,
- EF =>
- Extra_Accessibility_Of_Result (Ultimate_Alias (Subp)));
+ EF => Extra_Form);
end if;
end;
end if;
@@ -4516,7 +4311,7 @@ package body Exp_Ch6 is
end if;
-- Ada 2005 (AI-251): If some formal is a class-wide interface, expand
- -- it to point to the correct secondary virtual table
+ -- it to point to the correct secondary virtual table.
if Nkind (Call_Node) in N_Subprogram_Call
and then CW_Interface_Formals_Present
@@ -4650,6 +4445,18 @@ package body Exp_Ch6 is
Expand_Actuals (Call_Node, Subp, Post_Call);
+ -- If it is a recursive call then call the internal procedure that
+ -- verifies Subprogram_Variant contract (if present and enabled).
+ -- Detecting calls to subprogram aliases is necessary for recursive
+ -- calls in instances of generic subprograms, where the renaming of
+ -- the current subprogram is called.
+
+ if Is_Subprogram (Subp)
+ and then Same_Or_Aliased_Subprograms (Subp, Current_Scope)
+ then
+ Check_Subprogram_Variant;
+ end if;
+
-- Verify that the actuals do not share storage. This check must be done
-- on the caller side rather that inside the subprogram to avoid issues
-- of parameter passing.
@@ -4932,7 +4739,7 @@ package body Exp_Ch6 is
-- A call to a null procedure is replaced by a null statement, but we
-- are not allowed to ignore possible side effects of the call, so we
-- make sure that actuals are evaluated.
- -- We also suppress this optimization for GNATCoverage.
+ -- We also suppress this optimization for GNATcoverage.
elsif Is_Null_Procedure (Subp)
and then not Opt.Suppress_Control_Flow_Optimizations
@@ -6389,9 +6196,6 @@ package body Exp_Ch6 is
-- Expand_N_Subprogram_Body --
------------------------------
- -- Add poll call if ATC polling is enabled, unless the body will be inlined
- -- by the back-end.
-
-- Add dummy push/pop label nodes at start and end to clear any local
-- exception indications if local-exception-to-goto optimization is active.
@@ -6601,25 +6405,6 @@ package body Exp_Ch6 is
end;
end if;
- -- Need poll on entry to subprogram if polling enabled. We only do this
- -- for non-empty subprograms, since it does not seem necessary to poll
- -- for a dummy null subprogram.
-
- if Is_Non_Empty_List (L) then
-
- -- Do not add a polling call if the subprogram is to be inlined by
- -- the back-end, to avoid repeated calls with multiple inlinings.
-
- if Is_Inlined (Spec_Id)
- and then Front_End_Inlining
- and then Optimization_Level > 1
- then
- null;
- else
- Generate_Poll_Call (First (L));
- end if;
- end if;
-
-- Initialize any scalar OUT args if Initialize/Normalize_Scalars
if Init_Or_Norm_Scalars and then Is_Subprogram (Spec_Id) then
@@ -7318,6 +7103,13 @@ package body Exp_Ch6 is
Exp : Node_Id := Expression (N);
pragma Assert (Present (Exp));
+ Exp_Is_Function_Call : constant Boolean :=
+ Nkind (Exp) = N_Function_Call
+ or else (Nkind (Exp) = N_Explicit_Dereference
+ and then Is_Entity_Name (Prefix (Exp))
+ and then Ekind (Entity (Prefix (Exp))) = E_Constant
+ and then Is_Related_To_Func_Return (Entity (Prefix (Exp))));
+
Exp_Typ : constant Entity_Id := Etype (Exp);
-- The type of the expression (not necessarily the same as R_Type)
@@ -7329,27 +7121,6 @@ package body Exp_Ch6 is
-- of the return object to the specific type on assignments to the
-- individual components.
- procedure Check_Against_Result_Level (Level : Node_Id);
- -- Check the given accessibility level against the level
- -- determined by the point of call. (AI05-0234).
-
- --------------------------------
- -- Check_Against_Result_Level --
- --------------------------------
-
- procedure Check_Against_Result_Level (Level : Node_Id) is
- begin
- Insert_Action (N,
- Make_Raise_Program_Error (Loc,
- Condition =>
- Make_Op_Gt (Loc,
- Left_Opnd => Level,
- Right_Opnd =>
- New_Occurrence_Of
- (Extra_Accessibility_Of_Result (Scope_Id), Loc)),
- Reason => PE_Accessibility_Check_Failed));
- end Check_Against_Result_Level;
-
-- Start of processing for Expand_Simple_Function_Return
begin
@@ -7477,10 +7248,9 @@ package body Exp_Ch6 is
-- Check the result expression of a scalar function against the subtype
-- of the function by inserting a conversion. This conversion must
-- eventually be performed for other classes of types, but for now it's
- -- only done for scalars.
- -- ???
+ -- only done for scalars ???
- if Is_Scalar_Type (Exp_Typ) then
+ if Is_Scalar_Type (Exp_Typ) and then Exp_Typ /= R_Type then
Rewrite (Exp, Convert_To (R_Type, Exp));
-- The expression is resolved to ensure that the conversion gets
@@ -7533,7 +7303,7 @@ package body Exp_Ch6 is
Decl : Node_Id;
Ent : Entity_Id;
begin
- if Nkind (Exp) /= N_Function_Call
+ if not Exp_Is_Function_Call
and then Has_Discriminants (Ubt)
and then not Is_Constrained (Ubt)
and then not Has_Unchecked_Union (Ubt)
@@ -7556,22 +7326,14 @@ package body Exp_Ch6 is
Set_Enclosing_Sec_Stack_Return (N);
-- Optimize the case where the result is a function call. In this
- -- case either the result is already on the secondary stack, or is
- -- already being returned with the stack pointer depressed and no
- -- further processing is required except to set the By_Ref flag
- -- to ensure that gigi does not attempt an extra unnecessary copy.
- -- (actually not just unnecessary but harmfully wrong in the case
- -- of a controlled type, where gigi does not know how to do a copy).
- -- To make up for a gcc 2.8.1 deficiency (???), we perform the copy
- -- for array types if the constrained status of the target type is
- -- different from that of the expression.
+ -- case the result is already on the secondary stack and no further
+ -- processing is required except to set the By_Ref flag to ensure
+ -- that gigi does not attempt an extra unnecessary copy. (Actually
+ -- not just unnecessary but wrong in the case of a controlled type,
+ -- where gigi does not know how to do a copy.)
if Requires_Transient_Scope (Exp_Typ)
- and then
- (not Is_Array_Type (Exp_Typ)
- or else Is_Constrained (Exp_Typ) = Is_Constrained (R_Type)
- or else CW_Or_Has_Controlled_Part (Utyp))
- and then Nkind (Exp) = N_Function_Call
+ and then Exp_Is_Function_Call
then
Set_By_Ref (N);
@@ -7800,199 +7562,6 @@ package body Exp_Ch6 is
Suppress => All_Checks);
end if;
- -- Determine if the special rules within RM 3.10.2 for explicitly
- -- aliased formals apply to Exp - in which case we require a dynamic
- -- check to be generated.
-
- if Is_Special_Aliased_Formal_Access (Exp, Scope_Id) then
- Check_Against_Result_Level
- (Make_Integer_Literal (Loc,
- Object_Access_Level (Entity (Ultimate_Prefix (Prefix (Exp))))));
- end if;
-
- -- AI05-0234: Check unconstrained access discriminants to ensure
- -- that the result does not outlive an object designated by one
- -- of its discriminants (RM 6.5(21/3)).
-
- if Present (Extra_Accessibility_Of_Result (Scope_Id))
- and then Has_Unconstrained_Access_Discriminants (R_Type)
- then
- declare
- Discrim_Source : Node_Id;
- begin
- Discrim_Source := Exp;
- while Nkind (Discrim_Source) = N_Qualified_Expression loop
- Discrim_Source := Expression (Discrim_Source);
- end loop;
-
- if Nkind (Discrim_Source) = N_Identifier
- and then Is_Return_Object (Entity (Discrim_Source))
- then
- Discrim_Source := Entity (Discrim_Source);
-
- if Is_Constrained (Etype (Discrim_Source)) then
- Discrim_Source := Etype (Discrim_Source);
- else
- Discrim_Source := Expression (Parent (Discrim_Source));
- end if;
-
- elsif Nkind (Discrim_Source) = N_Identifier
- and then Nkind (Original_Node (Discrim_Source)) in
- N_Aggregate | N_Extension_Aggregate
- then
- Discrim_Source := Original_Node (Discrim_Source);
-
- elsif Nkind (Discrim_Source) = N_Explicit_Dereference and then
- Nkind (Original_Node (Discrim_Source)) = N_Function_Call
- then
- Discrim_Source := Original_Node (Discrim_Source);
- end if;
-
- Discrim_Source := Unqual_Conv (Discrim_Source);
-
- case Nkind (Discrim_Source) is
- when N_Defining_Identifier =>
- pragma Assert (Is_Composite_Type (Discrim_Source)
- and then Has_Discriminants (Discrim_Source)
- and then Is_Constrained (Discrim_Source));
-
- declare
- Discrim : Entity_Id :=
- First_Discriminant (Base_Type (R_Type));
- Disc_Elmt : Elmt_Id :=
- First_Elmt (Discriminant_Constraint
- (Discrim_Source));
- begin
- loop
- if Ekind (Etype (Discrim)) =
- E_Anonymous_Access_Type
- then
- Check_Against_Result_Level
- (Dynamic_Accessibility_Level (Node (Disc_Elmt)));
- end if;
-
- Next_Elmt (Disc_Elmt);
- Next_Discriminant (Discrim);
- exit when not Present (Discrim);
- end loop;
- end;
-
- when N_Aggregate
- | N_Extension_Aggregate
- =>
- -- Unimplemented: extension aggregate case where discrims
- -- come from ancestor part, not extension part.
-
- declare
- Discrim : Entity_Id :=
- First_Discriminant (Base_Type (R_Type));
-
- Disc_Exp : Node_Id := Empty;
-
- Positionals_Exhausted
- : Boolean := not Present (Expressions
- (Discrim_Source));
-
- function Associated_Expr
- (Comp_Id : Entity_Id;
- Associations : List_Id) return Node_Id;
-
- -- Given a component and a component associations list,
- -- locate the expression for that component; returns
- -- Empty if no such expression is found.
-
- ---------------------
- -- Associated_Expr --
- ---------------------
-
- function Associated_Expr
- (Comp_Id : Entity_Id;
- Associations : List_Id) return Node_Id
- is
- Assoc : Node_Id;
- Choice : Node_Id;
-
- begin
- -- Simple linear search seems ok here
-
- Assoc := First (Associations);
- while Present (Assoc) loop
- Choice := First (Choices (Assoc));
- while Present (Choice) loop
- if (Nkind (Choice) = N_Identifier
- and then Chars (Choice) = Chars (Comp_Id))
- or else (Nkind (Choice) = N_Others_Choice)
- then
- return Expression (Assoc);
- end if;
-
- Next (Choice);
- end loop;
-
- Next (Assoc);
- end loop;
-
- return Empty;
- end Associated_Expr;
-
- begin
- if not Positionals_Exhausted then
- Disc_Exp := First (Expressions (Discrim_Source));
- end if;
-
- loop
- if Positionals_Exhausted then
- Disc_Exp :=
- Associated_Expr
- (Discrim,
- Component_Associations (Discrim_Source));
- end if;
-
- if Ekind (Etype (Discrim)) =
- E_Anonymous_Access_Type
- then
- Check_Against_Result_Level
- (Dynamic_Accessibility_Level (Disc_Exp));
- end if;
-
- Next_Discriminant (Discrim);
- exit when not Present (Discrim);
-
- if not Positionals_Exhausted then
- Next (Disc_Exp);
- Positionals_Exhausted := not Present (Disc_Exp);
- end if;
- end loop;
- end;
-
- when N_Function_Call =>
-
- -- No check needed (check performed by callee)
-
- null;
-
- when others =>
- declare
- Level : constant Node_Id :=
- Make_Integer_Literal (Loc,
- Object_Access_Level (Discrim_Source));
-
- begin
- -- Unimplemented: check for name prefix that includes
- -- a dereference of an access value with a dynamic
- -- accessibility level (e.g., an access param or a
- -- saooaaat) and use dynamic level in that case. For
- -- example:
- -- return Access_Param.all(Some_Index).Some_Component;
- -- ???
-
- Set_Etype (Level, Standard_Natural);
- Check_Against_Result_Level (Level);
- end;
- end case;
- end;
- end if;
-
-- If we are returning a nonscalar object that is possibly unaligned,
-- then copy the value into a temporary first. This copy may need to
-- expand to a loop of component operations.
@@ -8329,9 +7898,12 @@ package body Exp_Ch6 is
-- The write-back of (in)-out parameters is handled by the back-end,
-- but the constraint checks generated when subtypes of formal and
-- actual don't match must be inserted in the form of assignments.
+ -- Also do this in the case of explicit dereferences, which can occur
+ -- due to rewritings of function calls with controlled results.
if Nkind (N) = N_Function_Call
or else Nkind (Original_Node (N)) = N_Function_Call
+ or else Nkind (N) = N_Explicit_Dereference
then
pragma Assert (Ada_Version >= Ada_2012);
-- Functions with '[in] out' parameters are only allowed in Ada
@@ -8356,13 +7928,28 @@ package body Exp_Ch6 is
-- the write back to be skipped completely.
-- To deal with this, we replace the call by
-
+ --
-- do
-- Tnnn : constant function-result-type := function-call;
-- Post_Call actions
-- in
-- Tnnn;
-- end;
+ --
+ -- However, that doesn't work if function-result-type requires
+ -- finalization (because function-call's result never gets
+ -- finalized). So in that case, we instead replace the call by
+ --
+ -- do
+ -- type Ref is access all function-result-type;
+ -- Ptr : constant Ref := function-call'Reference;
+ -- Tnnn : constant function-result-type := Ptr.all;
+ -- Finalize (Ptr.all);
+ -- Post_Call actions
+ -- in
+ -- Tnnn;
+ -- end;
+ --
declare
Loc : constant Source_Ptr := Sloc (N);
@@ -8371,12 +7958,63 @@ package body Exp_Ch6 is
Name : constant Node_Id := Relocate_Node (N);
begin
- Prepend_To (Post_Call,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Tnnn,
- Object_Definition => New_Occurrence_Of (FRTyp, Loc),
- Constant_Present => True,
- Expression => Name));
+ if Needs_Finalization (FRTyp) then
+ declare
+ Ptr_Typ : constant Entity_Id := Make_Temporary (Loc, 'A');
+
+ Ptr_Typ_Decl : constant Node_Id :=
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Ptr_Typ,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present => True,
+ Subtype_Indication =>
+ New_Occurrence_Of (FRTyp, Loc)));
+
+ Ptr_Obj : constant Entity_Id :=
+ Make_Temporary (Loc, 'P');
+
+ Ptr_Obj_Decl : constant Node_Id :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Ptr_Obj,
+ Object_Definition =>
+ New_Occurrence_Of (Ptr_Typ, Loc),
+ Constant_Present => True,
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => Name,
+ Attribute_Name => Name_Unrestricted_Access));
+
+ function Ptr_Dereference return Node_Id is
+ (Make_Explicit_Dereference (Loc,
+ Prefix => New_Occurrence_Of (Ptr_Obj, Loc)));
+
+ Tnn_Decl : constant Node_Id :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Tnnn,
+ Object_Definition => New_Occurrence_Of (FRTyp, Loc),
+ Constant_Present => True,
+ Expression => Ptr_Dereference);
+
+ Finalize_Call : constant Node_Id :=
+ Make_Final_Call
+ (Obj_Ref => Ptr_Dereference, Typ => FRTyp);
+ begin
+ -- Prepend in reverse order
+
+ Prepend_To (Post_Call, Finalize_Call);
+ Prepend_To (Post_Call, Tnn_Decl);
+ Prepend_To (Post_Call, Ptr_Obj_Decl);
+ Prepend_To (Post_Call, Ptr_Typ_Decl);
+ end;
+ else
+ Prepend_To (Post_Call,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Tnnn,
+ Object_Definition => New_Occurrence_Of (FRTyp, Loc),
+ Constant_Present => True,
+ Expression => Name));
+ end if;
Rewrite (N,
Make_Expression_With_Actions (Loc,
@@ -8417,6 +8055,7 @@ package body Exp_Ch6 is
-- The only exception is when the function call acts as an actual in a
-- procedure call. In this case the function call is in a list, but the
-- post-call actions must be inserted after the procedure call.
+ -- What if the function call is an aggregate component ???
elsif Nkind (Context) = N_Procedure_Call_Statement then
Insert_Actions_After (Context, Post_Call);
@@ -8906,7 +8545,7 @@ package body Exp_Ch6 is
-- rather than some outer chain.
begin
- if Has_Task (Result_Subt) or else Might_Have_Tasks (Result_Subt) then
+ if Might_Have_Tasks (Result_Subt) then
Actions := New_List;
Build_Task_Allocate_Block_With_Init_Stmts
(Actions, Allocator, Init_Stmts => New_List (Assign));
@@ -9561,9 +9200,15 @@ package body Exp_Ch6 is
-- Finally, create an access object initialized to a reference to the
-- function call. We know this access value cannot be null, so mark the
- -- entity accordingly to suppress the access check.
+ -- entity accordingly to suppress the access check. We need to suppress
+ -- warnings, because this can be part of the expansion of "for ... of"
+ -- and similar constructs that generate finalization actions. Such
+ -- finalization actions are safe, because they check a count that
+ -- indicates which objects should be finalized, but the back end
+ -- nonetheless warns about uninitialized objects.
Def_Id := Make_Temporary (Loc, 'R', Func_Call);
+ Set_Warnings_Off (Def_Id);
Set_Etype (Def_Id, Ptr_Typ);
Set_Is_Known_Non_Null (Def_Id);
@@ -9609,7 +9254,7 @@ package body Exp_Ch6 is
-- which prompted the generation of the transient block. To resolve
-- this scenario, store the build-in-place call.
- if Scope_Is_Transient and then Node_To_Be_Wrapped = Obj_Decl then
+ if Scope_Is_Transient then
Set_BIP_Initialization_Call (Obj_Def_Id, Res_Decl);
end if;
@@ -9948,8 +9593,9 @@ package body Exp_Ch6 is
begin
return not Global_No_Tasking
and then not No_Run_Time_Mode
- and then Is_Class_Wide_Type (Typ)
- and then Is_Limited_Record (Typ);
+ and then (Has_Task (Typ)
+ or else (Is_Class_Wide_Type (Typ)
+ and then Is_Limited_Record (Typ)));
end Might_Have_Tasks;
----------------------------
diff --git a/gcc/ada/exp_ch6.ads b/gcc/ada/exp_ch6.ads
index 69b1909..272f893 100644
--- a/gcc/ada/exp_ch6.ads
+++ b/gcc/ada/exp_ch6.ads
@@ -241,8 +241,8 @@ package Exp_Ch6 is
-- object. Function_Call must denote a call to a CPP_Constructor function.
function Might_Have_Tasks (Typ : Entity_Id) return Boolean;
- -- Return True if Typ is a limited class-wide type (or subtype), since it
- -- might have task components.
+ -- Return True when type Typ has tasks or when it is a limited class-wide
+ -- type (or subtype), since it might have task components.
function Needs_BIP_Alloc_Form (Func_Id : Entity_Id) return Boolean;
-- Ada 2005 (AI-318-02): Return True if the function needs an implicit
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 07640bf..b58a3c1 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -398,6 +398,31 @@ package body Exp_Ch7 is
-- actions or secondary-stack management, in which case the nested
-- subprogram is a finalizer.
+ procedure Unnest_If_Statement (If_Stmt : Node_Id);
+ -- The separate statement lists associated with an if-statement (then part,
+ -- elsif parts, else part) may require unnesting if they directly contain
+ -- a subprogram body that references up-level objects. Each statement list
+ -- is traversed to locate such subprogram bodies, and if a part's statement
+ -- list contains a body, then the list is replaced with a new procedure
+ -- containing the part's statements followed by a call to the procedure.
+ -- Furthermore, any nested blocks, loops, or if statements will also be
+ -- traversed to determine the need for further unnesting transformations.
+
+ procedure Unnest_Statement_List (Stmts : in out List_Id);
+ -- A list of statements that directly contains a subprogram at its outer
+ -- level, that may reference objects declared in that same statement list,
+ -- is rewritten as a procedure containing the statement list Stmts (which
+ -- includes any such objects as well as the nested subprogram), followed by
+ -- a call to the new procedure, and Stmts becomes the list containing the
+ -- procedure and the call. This ensures that Unnest_Subprogram will later
+ -- properly handle up-level references from the nested subprogram to
+ -- objects declared earlier in statement list, by creating an activation
+ -- record and passing it to the nested subprogram. This procedure also
+ -- resets the Scope of objects declared in the statement list, as well as
+ -- the Scope of the nested subprogram, to refer to the new procedure.
+ -- Also, the new procedure is marked Has_Nested_Subprogram, so this should
+ -- only be called when known that the statement list contains a subprogram.
+
procedure Unnest_Loop (Loop_Stmt : Node_Id);
-- Top-level Loops that contain nested subprograms with up-level references
-- need to have activation records. We do this by rewriting the loop as a
@@ -3132,6 +3157,14 @@ package body Exp_Ch7 is
Append_To (Finalizer_Stmts, Label);
+ -- Disable warnings on Obj_Id. This works around an issue where GCC
+ -- is not able to detect that Obj_Id is protected by a counter and
+ -- emits spurious warnings.
+
+ if not Comes_From_Source (Obj_Id) then
+ Set_Warnings_Off (Obj_Id);
+ end if;
+
-- Processing for simple protected objects. Such objects require
-- manual finalization of their lock managers.
@@ -4233,6 +4266,17 @@ package body Exp_Ch7 is
then
Unnest_Block (Decl_Or_Stmt);
+ -- If-statements may contain subprogram bodies at the outer level
+ -- of their statement lists, and the subprograms may make up-level
+ -- references (such as to objects declared in the same statement
+ -- list). Unlike block and loop cases, however, we don't have an
+ -- entity on which to test the Contains_Subprogram flag, so
+ -- Unnest_If_Statement must traverse the statement lists to
+ -- determine whether there are nested subprograms present.
+
+ elsif Nkind (Decl_Or_Stmt) = N_If_Statement then
+ Unnest_If_Statement (Decl_Or_Stmt);
+
elsif Nkind (Decl_Or_Stmt) = N_Loop_Statement then
declare
Id : constant Entity_Id :=
@@ -4883,7 +4927,6 @@ package body Exp_Ch7 is
Fin_Id : Entity_Id;
Mark : Entity_Id := Empty;
New_Decls : List_Id;
- Old_Poll : Boolean;
begin
-- If we are generating expanded code for debugging purposes, use the
@@ -4900,12 +4943,6 @@ package body Exp_Ch7 is
Loc := No_Location;
end if;
- -- Set polling off. The finalization and cleanup code is executed
- -- with aborts deferred.
-
- Old_Poll := Polling_Required;
- Polling_Required := False;
-
-- A task activation call has already been built for a task
-- allocation block.
@@ -5014,10 +5051,6 @@ package body Exp_Ch7 is
if Present (Fin_Id) then
Build_Finalizer_Call (N, Fin_Id);
end if;
-
- -- Restore saved polling mode
-
- Polling_Required := Old_Poll;
end;
end Expand_Cleanup_Actions;
@@ -5643,10 +5676,18 @@ package body Exp_Ch7 is
-- <or>
-- Hook := Obj_Id'Unrestricted_Access;
- if Ekind (Obj_Id) in E_Constant | E_Variable
- and then Present (Last_Aggregate_Assignment (Obj_Id))
- then
- Hook_Insert := Last_Aggregate_Assignment (Obj_Id);
+ -- Similarly if we have a build in place call: we must
+ -- initialize Hook only after the call has happened, otherwise
+ -- Obj_Id will not be initialized yet.
+
+ if Ekind (Obj_Id) in E_Constant | E_Variable then
+ if Present (Last_Aggregate_Assignment (Obj_Id)) then
+ Hook_Insert := Last_Aggregate_Assignment (Obj_Id);
+ elsif Present (BIP_Initialization_Call (Obj_Id)) then
+ Hook_Insert := BIP_Initialization_Call (Obj_Id);
+ else
+ Hook_Insert := Obj_Decl;
+ end if;
-- Otherwise the hook seizes the related object immediately
@@ -9261,6 +9302,11 @@ package body Exp_Ch7 is
Handled_Statement_Sequence =>
Handled_Statement_Sequence (Decl));
+ -- Handlers in the block may contain nested subprograms that require
+ -- unnesting.
+
+ Check_Unnesting_In_Handlers (Local_Body);
+
Rewrite (Decl, Local_Body);
Analyze (Decl);
Set_Has_Nested_Subprogram (Local_Proc);
@@ -9288,6 +9334,94 @@ package body Exp_Ch7 is
end loop;
end Unnest_Block;
+ -------------------------
+ -- Unnest_If_Statement --
+ -------------------------
+
+ procedure Unnest_If_Statement (If_Stmt : Node_Id) is
+
+ procedure Check_Stmts_For_Subp_Unnesting (Stmts : in out List_Id);
+ -- A list of statements (that may be a list associated with a then,
+ -- elsif, or else part of an if-statement) is traversed at the top
+ -- level to determine whether it contains a subprogram body, and if so,
+ -- the statements will be replaced with a new procedure body containing
+ -- the statements followed by a call to the procedure. The individual
+ -- statements may also be blocks, loops, or other if statements that
+ -- themselves may require contain nested subprograms needing unnesting.
+
+ procedure Check_Stmts_For_Subp_Unnesting (Stmts : in out List_Id) is
+ Subp_Found : Boolean := False;
+
+ begin
+ if Is_Empty_List (Stmts) then
+ return;
+ end if;
+
+ declare
+ Stmt : Node_Id := First (Stmts);
+ begin
+ while Present (Stmt) loop
+ if Nkind (Stmt) = N_Subprogram_Body then
+ Subp_Found := True;
+ exit;
+ end if;
+
+ Next (Stmt);
+ end loop;
+ end;
+
+ -- The statements themselves may be blocks, loops, etc. that in turn
+ -- contain nested subprograms requiring an unnesting transformation.
+ -- We perform this traversal after looking for subprogram bodies, to
+ -- avoid considering procedures created for one of those statements
+ -- (such as a block rewritten as a procedure) as a nested subprogram
+ -- of the statement list (which could result in an unneeded wrapper
+ -- procedure).
+
+ Check_Unnesting_In_Decls_Or_Stmts (Stmts);
+
+ -- If there was a top-level subprogram body in the statement list,
+ -- then perform an unnesting transformation on the list by replacing
+ -- the statements with a wrapper procedure body containing the
+ -- original statements followed by a call to that procedure.
+
+ if Subp_Found then
+ Unnest_Statement_List (Stmts);
+ end if;
+ end Check_Stmts_For_Subp_Unnesting;
+
+ -- Local variables
+
+ Then_Stmts : List_Id := Then_Statements (If_Stmt);
+ Else_Stmts : List_Id := Else_Statements (If_Stmt);
+
+ -- Start of processing for Unnest_If_Statement
+
+ begin
+ Check_Stmts_For_Subp_Unnesting (Then_Stmts);
+ Set_Then_Statements (If_Stmt, Then_Stmts);
+
+ if not Is_Empty_List (Elsif_Parts (If_Stmt)) then
+ declare
+ Elsif_Part : Node_Id :=
+ First (Elsif_Parts (If_Stmt));
+ Elsif_Stmts : List_Id;
+ begin
+ while Present (Elsif_Part) loop
+ Elsif_Stmts := Then_Statements (Elsif_Part);
+
+ Check_Stmts_For_Subp_Unnesting (Elsif_Stmts);
+ Set_Then_Statements (Elsif_Part, Elsif_Stmts);
+
+ Next (Elsif_Part);
+ end loop;
+ end;
+ end if;
+
+ Check_Stmts_For_Subp_Unnesting (Else_Stmts);
+ Set_Else_Statements (If_Stmt, Else_Stmts);
+ end Unnest_If_Statement;
+
-----------------
-- Unnest_Loop --
-----------------
@@ -9349,6 +9483,75 @@ package body Exp_Ch7 is
-- same loop entity that now belongs to the copied loop statement.
end Unnest_Loop;
+ ---------------------------
+ -- Unnest_Statement_List --
+ ---------------------------
+
+ procedure Unnest_Statement_List (Stmts : in out List_Id) is
+ Loc : constant Source_Ptr := Sloc (First (Stmts));
+ Local_Body : Node_Id;
+ Local_Call : Node_Id;
+ Local_Proc : Entity_Id;
+ New_Stmts : constant List_Id := Empty_List;
+
+ begin
+ Local_Proc :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('P'));
+
+ Local_Body :=
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Procedure_Specification (Loc,
+ Defining_Unit_Name => Local_Proc),
+ Declarations => Empty_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => Stmts));
+
+ Append_To (New_Stmts, Local_Body);
+
+ Analyze (Local_Body);
+
+ Set_Has_Nested_Subprogram (Local_Proc);
+
+ Local_Call :=
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Occurrence_Of (Local_Proc, Loc));
+
+ Append_To (New_Stmts, Local_Call);
+ Analyze (Local_Call);
+
+ -- Traverse the statements, and for any that are declarations or
+ -- subprogram bodies that have entities, set the Scope of those
+ -- entities to the new procedure's Entity_Id.
+
+ declare
+ Stmt : Node_Id := First (Stmts);
+
+ begin
+ while Present (Stmt) loop
+ case Nkind (Stmt) is
+ when N_Declaration
+ | N_Renaming_Declaration
+ =>
+ Set_Scope (Defining_Identifier (Stmt), Local_Proc);
+
+ when N_Subprogram_Body =>
+ Set_Scope
+ (Defining_Unit_Name (Specification (Stmt)), Local_Proc);
+
+ when others =>
+ null;
+ end case;
+
+ Next (Stmt);
+ end loop;
+ end;
+
+ Stmts := New_Stmts;
+ end Unnest_Statement_List;
+
--------------------------------
-- Wrap_Transient_Declaration --
--------------------------------
diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb
index 630d62f..9f4c65c 100644
--- a/gcc/ada/exp_ch8.adb
+++ b/gcc/ada/exp_ch8.adb
@@ -129,7 +129,7 @@ package body Exp_Ch8 is
if Is_Packed (Etype (Prefix (Nam))) then
return True;
- elsif Is_Atomic_Or_VFA_Object (Prefix (Nam)) then
+ elsif Is_Full_Access_Object (Prefix (Nam)) then
return True;
else
@@ -152,7 +152,7 @@ package body Exp_Ch8 is
then
return True;
- elsif Is_Atomic_Or_VFA_Object (Prefix (Nam)) then
+ elsif Is_Full_Access_Object (Prefix (Nam)) then
return True;
else
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 9cf90d1..7207723 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -24,6 +24,7 @@
------------------------------------------------------------------------------
with Atree; use Atree;
+with Aspects; use Aspects;
with Checks; use Checks;
with Einfo; use Einfo;
with Elists; use Elists;
@@ -4089,8 +4090,17 @@ package body Exp_Ch9 is
Parameter_Associations => Uactuals));
end if;
- Lock_Kind := RE_Lock_Read_Only;
-
+ if Has_Aspect (Pid, Aspect_Exclusive_Functions)
+ and then
+ (No (Find_Value_Of_Aspect (Pid, Aspect_Exclusive_Functions))
+ or else
+ Is_True (Static_Boolean (Find_Value_Of_Aspect
+ (Pid, Aspect_Exclusive_Functions))))
+ then
+ Lock_Kind := RE_Lock;
+ else
+ Lock_Kind := RE_Lock_Read_Only;
+ end if;
else
Unprot_Call :=
Make_Procedure_Call_Statement (Loc,
@@ -4950,6 +4960,18 @@ package body Exp_Ch9 is
if No (Chain) or else Is_Ignored_Ghost_Entity (Chain) then
return;
+
+ -- The availability of the activation chain entity does not ensure
+ -- that we have tasks to activate because it may have been declared
+ -- by the frontend to pass a required extra formal to a build-in-place
+ -- subprogram call. If we are within the scope of a protected type and
+ -- pragma Detect_Blocking is active we can assume that no tasks will be
+ -- activated; if tasks are created in a protected object and this pragma
+ -- is active then the frontend emits a warning and Program_Error is
+ -- raised at runtime.
+
+ elsif Detect_Blocking and then Within_Protected_Type (Current_Scope) then
+ return;
end if;
-- The location of the activation call must be as close as possible to
@@ -10051,6 +10073,7 @@ package body Exp_Ch9 is
Conc_Typ : Entity_Id;
Concval : Node_Id;
Ename : Node_Id;
+ Enc_Subp : Entity_Id;
Index : Node_Id;
Old_Typ : Entity_Id;
@@ -10567,6 +10590,26 @@ package body Exp_Ch9 is
Old_Typ := Scope (Old_Typ);
end loop;
+ -- Obtain the innermost enclosing callable construct for use in
+ -- generating a dynamic accessibility check.
+
+ Enc_Subp := Current_Scope;
+
+ if Ekind (Enc_Subp) not in Entry_Kind | Subprogram_Kind then
+ Enc_Subp := Enclosing_Subprogram (Enc_Subp);
+ end if;
+
+ -- Generate a dynamic accessibility check on the target object
+
+ Insert_Before_And_Analyze (N,
+ Make_Raise_Program_Error (Loc,
+ Condition =>
+ Make_Op_Gt (Loc,
+ Left_Opnd => Accessibility_Level (Name (N), Dynamic_Level),
+ Right_Opnd => Make_Integer_Literal (Loc,
+ Scope_Depth (Enc_Subp))),
+ Reason => PE_Accessibility_Check_Failed));
+
-- Ada 2012 (AI05-0030): We have a dispatching requeue of the form
-- Concval.Ename where the type of Concval is class-wide concurrent
-- interface.
diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb
index b973fb6..c2e7741 100644
--- a/gcc/ada/exp_dbug.adb
+++ b/gcc/ada/exp_dbug.adb
@@ -247,7 +247,7 @@ package body Exp_Dbug is
-- Here we check if the static bounds match the natural size, which is
-- the size passed through with the debugging information. This is the
- -- Esize rounded up to 8, 16, 32 or 64 as appropriate.
+ -- Esize rounded up to 8, 16, 32, 64 or 128 as appropriate.
else
declare
@@ -261,8 +261,10 @@ package body Exp_Dbug is
Siz := Uint_16;
elsif Esize (E) <= 32 then
Siz := Uint_32;
- else
+ elsif Esize (E) <= 64 then
Siz := Uint_64;
+ else
+ Siz := Uint_128;
end if;
if Is_Modular_Integer_Type (E) or else Is_Enumeration_Type (E) then
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index 1618fe6..760a412 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -5296,7 +5296,7 @@ package body Exp_Dist is
function Hash (F : Name_Id) return Hash_Index is
begin
- return Hash_Index (Natural (F) mod Positive (Hash_Index'Last + 1));
+ return Hash_Index (Integer (F) mod Positive (Hash_Index'Last + 1));
end Hash;
--------------------------
diff --git a/gcc/ada/exp_fixd.adb b/gcc/ada/exp_fixd.adb
index d956278..42cf626 100644
--- a/gcc/ada/exp_fixd.adb
+++ b/gcc/ada/exp_fixd.adb
@@ -186,7 +186,7 @@ package body Exp_Fixd is
-- Given an operand of fixed-point operation, return an expression that
-- represents the corresponding Universal_Real value. The expression
-- can be of integer type, floating-point type, or fixed-point type.
- -- The expression returned is neither analyzed and resolved. The Etype
+ -- The expression returned is neither analyzed nor resolved. The Etype
-- of the result is properly set (to Universal_Real).
function Integer_Literal
@@ -620,7 +620,7 @@ package body Exp_Fixd is
Object_Definition => New_Occurrence_Of (QR_Typ, Loc)),
Make_Procedure_Call_Statement (Loc,
- Name => New_Occurrence_Of (RTE (RE_Double_Divide), Loc),
+ Name => New_Occurrence_Of (RTE (RE_Double_Divide64), Loc),
Parameter_Associations => New_List (
Build_Conversion (N, QR_Typ, X),
Build_Conversion (N, QR_Typ, Y),
@@ -977,7 +977,7 @@ package body Exp_Fixd is
Object_Definition => New_Occurrence_Of (QR_Typ, Loc)),
Make_Procedure_Call_Statement (Loc,
- Name => New_Occurrence_Of (RTE (RE_Scaled_Divide), Loc),
+ Name => New_Occurrence_Of (RTE (RE_Scaled_Divide64), Loc),
Parameter_Associations => New_List (
Build_Conversion (N, QR_Typ, X),
Build_Conversion (N, QR_Typ, Y),
@@ -2351,19 +2351,8 @@ package body Exp_Fixd is
---------------
function Fpt_Value (N : Node_Id) return Node_Id is
- Typ : constant Entity_Id := Etype (N);
-
begin
- if Is_Integer_Type (Typ)
- or else Is_Floating_Point_Type (Typ)
- then
- return Build_Conversion (N, Universal_Real, N);
-
- -- Fixed-point case, must get integer value first
-
- else
- return Build_Conversion (N, Universal_Real, N);
- end if;
+ return Build_Conversion (N, Universal_Real, N);
end Fpt_Value;
---------------------
diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index 41e4b1b..40cb514 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -479,13 +479,16 @@ package body Exp_Imgv is
Ptyp := Entity (Pref);
- -- Ada 2020 allows 'Image on private types, so we need to fetch the
- -- underlying type.
+ -- Ada 2020 allows 'Image on private types, so fetch the underlying
+ -- type to obtain the structure of the type. We use the base type,
+ -- not the root type, to handle properly derived types, but we use
+ -- the root type for enumeration types, because the literal map is
+ -- attached to the root. Should be inherited ???
- if Ada_Version >= Ada_2020 then
+ if Is_Enumeration_Type (Ptyp) then
Rtyp := Underlying_Type (Root_Type (Ptyp));
else
- Rtyp := Root_Type (Ptyp);
+ Rtyp := Underlying_Type (Base_Type (Ptyp));
end if;
-- Enable speed-optimized expansion of user-defined enumeration types
@@ -567,21 +570,27 @@ package body Exp_Imgv is
Tent := Rtyp;
elsif Is_Signed_Integer_Type (Rtyp) then
- if Esize (Rtyp) <= Esize (Standard_Integer) then
+ if Esize (Rtyp) <= Standard_Integer_Size then
Imid := RE_Image_Integer;
Tent := Standard_Integer;
- else
+ elsif Esize (Rtyp) <= Standard_Long_Long_Integer_Size then
Imid := RE_Image_Long_Long_Integer;
Tent := Standard_Long_Long_Integer;
+ else
+ Imid := RE_Image_Long_Long_Long_Integer;
+ Tent := Standard_Long_Long_Long_Integer;
end if;
elsif Is_Modular_Integer_Type (Rtyp) then
if Modulus (Rtyp) <= Modulus (RTE (RE_Unsigned)) then
Imid := RE_Image_Unsigned;
Tent := RTE (RE_Unsigned);
- else
+ elsif Modulus (Rtyp) <= Modulus (RTE (RE_Long_Long_Unsigned)) then
Imid := RE_Image_Long_Long_Unsigned;
Tent := RTE (RE_Long_Long_Unsigned);
+ else
+ Imid := RE_Image_Long_Long_Long_Unsigned;
+ Tent := RTE (RE_Long_Long_Long_Unsigned);
end if;
elsif Is_Fixed_Point_Type (Rtyp) and then Has_Decimal_Small (Rtyp) then
@@ -610,15 +619,18 @@ package body Exp_Imgv is
or else No (Lit_Strings (Rtyp))
then
-- When pragma Discard_Names applies to the first subtype, build
- -- (Pref'Pos (Expr))'Img.
+ -- (Long_Long_Integer (Pref'Pos (Expr)))'Img. The conversion is
+ -- there to avoid applying 'Img directly in Universal_Integer,
+ -- which can be a very large type. See also the handling of 'Val.
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix =>
- Make_Attribute_Reference (Loc,
- Prefix => Pref,
- Attribute_Name => Name_Pos,
- Expressions => New_List (Expr)),
+ Convert_To (Standard_Long_Long_Integer,
+ Make_Attribute_Reference (Loc,
+ Prefix => Pref,
+ Attribute_Name => Name_Pos,
+ Expressions => New_List (Expr))),
Attribute_Name =>
Name_Img));
Analyze_And_Resolve (N, Standard_String);
@@ -657,9 +669,10 @@ package body Exp_Imgv is
T : Entity_Id;
begin
-- In Ada 2020 we need the underlying type here, because 'Image is
- -- allowed on private types.
+ -- allowed on private types. We have already checked the version
+ -- when resolving the attribute.
- if Ada_Version >= Ada_2020 then
+ if Is_Private_Type (Ptyp) then
T := Rtyp;
else
T := Ptyp;
@@ -683,9 +696,7 @@ package body Exp_Imgv is
declare
Conv : Node_Id;
begin
- if Ada_Version >= Ada_2020
- and then Is_Private_Type (Etype (Expr))
- then
+ if Is_Private_Type (Etype (Expr)) then
if Is_Fixed_Point_Type (Rtyp) then
Conv := Convert_To (Tent, OK_Convert_To (Rtyp, Expr));
else
@@ -893,20 +904,22 @@ package body Exp_Imgv is
Make_Integer_Literal (Loc,
Intval => Int (Wide_Character_Encoding_Method)));
- elsif Rtyp = Base_Type (Standard_Short_Short_Integer)
- or else Rtyp = Base_Type (Standard_Short_Integer)
- or else Rtyp = Base_Type (Standard_Integer)
- then
- Vid := RE_Value_Integer;
-
elsif Is_Signed_Integer_Type (Rtyp) then
- Vid := RE_Value_Long_Long_Integer;
+ if Esize (Rtyp) <= Standard_Integer_Size then
+ Vid := RE_Value_Integer;
+ elsif Esize (Rtyp) <= Standard_Long_Long_Integer_Size then
+ Vid := RE_Value_Long_Long_Integer;
+ else
+ Vid := RE_Value_Long_Long_Long_Integer;
+ end if;
elsif Is_Modular_Integer_Type (Rtyp) then
if Modulus (Rtyp) <= Modulus (RTE (RE_Unsigned)) then
Vid := RE_Value_Unsigned;
- else
+ elsif Modulus (Rtyp) <= Modulus (RTE (RE_Long_Long_Unsigned)) then
Vid := RE_Value_Long_Long_Unsigned;
+ else
+ Vid := RE_Value_Long_Long_Long_Unsigned;
end if;
elsif Is_Decimal_Fixed_Point_Type (Rtyp) then
@@ -1413,14 +1426,30 @@ package body Exp_Imgv is
-- Signed integer types
elsif Is_Signed_Integer_Type (Rtyp) then
- XX := RE_Width_Long_Long_Integer;
- YY := Standard_Long_Long_Integer;
+ if Esize (Rtyp) <= Standard_Integer_Size then
+ XX := RE_Width_Integer;
+ YY := Standard_Integer;
+ elsif Esize (Rtyp) <= Standard_Long_Long_Integer_Size then
+ XX := RE_Width_Long_Long_Integer;
+ YY := Standard_Long_Long_Integer;
+ else
+ XX := RE_Width_Long_Long_Long_Integer;
+ YY := Standard_Long_Long_Long_Integer;
+ end if;
-- Modular integer types
elsif Is_Modular_Integer_Type (Rtyp) then
- XX := RE_Width_Long_Long_Unsigned;
- YY := RTE (RE_Long_Long_Unsigned);
+ if Modulus (Rtyp) <= Modulus (RTE (RE_Unsigned)) then
+ XX := RE_Width_Unsigned;
+ YY := RTE (RE_Unsigned);
+ elsif Modulus (Rtyp) <= Modulus (RTE (RE_Long_Long_Unsigned)) then
+ XX := RE_Width_Long_Long_Unsigned;
+ YY := RTE (RE_Long_Long_Unsigned);
+ else
+ XX := RE_Width_Long_Long_Long_Unsigned;
+ YY := RTE (RE_Long_Long_Long_Unsigned);
+ end if;
-- Real types
diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index 04ad92b..78bde89 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -205,12 +205,16 @@ package body Exp_Intr is
return;
end if;
- -- Use Unsigned_32 for sizes of 32 or below, else Unsigned_64
+ -- Use the appropriate type for the size
- if Siz > 32 then
- T3 := RTE (RE_Unsigned_64);
- else
+ if Siz <= 32 then
T3 := RTE (RE_Unsigned_32);
+
+ elsif Siz <= 64 then
+ T3 := RTE (RE_Unsigned_64);
+
+ else pragma Assert (Siz <= 128);
+ T3 := RTE (RE_Unsigned_128);
end if;
-- Copy operator node, and reset type and entity fields, for
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index b95bd32..07a05a5 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -233,8 +233,11 @@ package body Exp_Pakd is
elsif T_Size <= 32 then
Swap_RE := RE_Bswap_32;
- else pragma Assert (T_Size <= 64);
+ elsif T_Size <= 64 then
Swap_RE := RE_Bswap_64;
+
+ else pragma Assert (T_Size <= 128);
+ Swap_RE := RE_Bswap_128;
end if;
Swap_F := RTE (Swap_RE);
@@ -316,7 +319,7 @@ package body Exp_Pakd is
-- Integer (subscript) - Integer (Styp'First)
- if Esize (Styp) < Esize (Standard_Integer) then
+ if Esize (Styp) < Standard_Integer_Size then
Newsub :=
Make_Op_Subtract (Loc,
Left_Opnd => Convert_To (Standard_Integer, Newsub),
@@ -917,22 +920,7 @@ package body Exp_Pakd is
-- The bounds are statically known, and btyp is one of the
-- unsigned types, depending on the length.
- if Len_Bits <= Standard_Short_Short_Integer_Size then
- Btyp := RTE (RE_Short_Short_Unsigned);
-
- elsif Len_Bits <= Standard_Short_Integer_Size then
- Btyp := RTE (RE_Short_Unsigned);
-
- elsif Len_Bits <= Standard_Integer_Size then
- Btyp := RTE (RE_Unsigned);
-
- elsif Len_Bits <= Standard_Long_Integer_Size then
- Btyp := RTE (RE_Long_Unsigned);
-
- else
- Btyp := RTE (RE_Long_Long_Unsigned);
- end if;
-
+ Btyp := Small_Integer_Type_For (Len_Bits, Uns => True);
Lit := Make_Integer_Literal (Loc, 2 ** Len_Bits - 1);
Set_Print_In_Hex (Lit);
diff --git a/gcc/ada/exp_pakd.ads b/gcc/ada/exp_pakd.ads
index 33726ba..559f54a 100644
--- a/gcc/ada/exp_pakd.ads
+++ b/gcc/ada/exp_pakd.ads
@@ -217,12 +217,12 @@ package Exp_Pakd is
-- Entity Tables for Packed Access Routines --
----------------------------------------------
- -- For the cases of component size = 3,5-7,9-15,17-31,33-63 we call library
- -- routines. These tables provide the entity for the proper routine. They
- -- are exposed in the spec to allow checking for the presence of the needed
- -- routine when an array is subject to pragma Pack.
+ -- For the cases of component size = 3,5-7,9-15,17-31,33-63,65-127 we call
+ -- library routines. These tables provide the entity for the right routine.
+ -- They are exposed in the spec to allow checking for the presence of the
+ -- needed routine when an array is subject to pragma Pack.
- type E_Array is array (Int range 01 .. 63) of RE_Id;
+ type E_Array is array (Int range 1 .. 127) of RE_Id;
-- Array of Bits_nn entities. Note that we do not use library routines
-- for the 8-bit and 16-bit cases, but we still fill in the table, using
@@ -292,7 +292,71 @@ package Exp_Pakd is
60 => RE_Bits_60,
61 => RE_Bits_61,
62 => RE_Bits_62,
- 63 => RE_Bits_63);
+ 63 => RE_Bits_63,
+ 64 => RE_Unsigned_64,
+ 65 => RE_Bits_65,
+ 66 => RE_Bits_66,
+ 67 => RE_Bits_67,
+ 68 => RE_Bits_68,
+ 69 => RE_Bits_69,
+ 70 => RE_Bits_70,
+ 71 => RE_Bits_71,
+ 72 => RE_Bits_72,
+ 73 => RE_Bits_73,
+ 74 => RE_Bits_74,
+ 75 => RE_Bits_75,
+ 76 => RE_Bits_76,
+ 77 => RE_Bits_77,
+ 78 => RE_Bits_78,
+ 79 => RE_Bits_79,
+ 80 => RE_Bits_80,
+ 81 => RE_Bits_81,
+ 82 => RE_Bits_82,
+ 83 => RE_Bits_83,
+ 84 => RE_Bits_84,
+ 85 => RE_Bits_85,
+ 86 => RE_Bits_86,
+ 87 => RE_Bits_87,
+ 88 => RE_Bits_88,
+ 89 => RE_Bits_89,
+ 90 => RE_Bits_90,
+ 91 => RE_Bits_91,
+ 92 => RE_Bits_92,
+ 93 => RE_Bits_93,
+ 94 => RE_Bits_94,
+ 95 => RE_Bits_95,
+ 96 => RE_Bits_96,
+ 97 => RE_Bits_97,
+ 98 => RE_Bits_98,
+ 99 => RE_Bits_99,
+ 100 => RE_Bits_100,
+ 101 => RE_Bits_101,
+ 102 => RE_Bits_102,
+ 103 => RE_Bits_103,
+ 104 => RE_Bits_104,
+ 105 => RE_Bits_105,
+ 106 => RE_Bits_106,
+ 107 => RE_Bits_107,
+ 108 => RE_Bits_108,
+ 109 => RE_Bits_109,
+ 110 => RE_Bits_110,
+ 111 => RE_Bits_111,
+ 112 => RE_Bits_112,
+ 113 => RE_Bits_113,
+ 114 => RE_Bits_114,
+ 115 => RE_Bits_115,
+ 116 => RE_Bits_116,
+ 117 => RE_Bits_117,
+ 118 => RE_Bits_118,
+ 119 => RE_Bits_119,
+ 120 => RE_Bits_120,
+ 121 => RE_Bits_121,
+ 122 => RE_Bits_122,
+ 123 => RE_Bits_123,
+ 124 => RE_Bits_124,
+ 125 => RE_Bits_125,
+ 126 => RE_Bits_126,
+ 127 => RE_Bits_127);
-- Array of Get routine entities. These are used to obtain an element from
-- a packed array. The N'th entry is used to obtain elements from a packed
@@ -362,7 +426,71 @@ package Exp_Pakd is
60 => RE_Get_60,
61 => RE_Get_61,
62 => RE_Get_62,
- 63 => RE_Get_63);
+ 63 => RE_Get_63,
+ 64 => RE_Null,
+ 65 => RE_Get_65,
+ 66 => RE_Get_66,
+ 67 => RE_Get_67,
+ 68 => RE_Get_68,
+ 69 => RE_Get_69,
+ 70 => RE_Get_70,
+ 71 => RE_Get_71,
+ 72 => RE_Get_72,
+ 73 => RE_Get_73,
+ 74 => RE_Get_74,
+ 75 => RE_Get_75,
+ 76 => RE_Get_76,
+ 77 => RE_Get_77,
+ 78 => RE_Get_78,
+ 79 => RE_Get_79,
+ 80 => RE_Get_80,
+ 81 => RE_Get_81,
+ 82 => RE_Get_82,
+ 83 => RE_Get_83,
+ 84 => RE_Get_84,
+ 85 => RE_Get_85,
+ 86 => RE_Get_86,
+ 87 => RE_Get_87,
+ 88 => RE_Get_88,
+ 89 => RE_Get_89,
+ 90 => RE_Get_90,
+ 91 => RE_Get_91,
+ 92 => RE_Get_92,
+ 93 => RE_Get_93,
+ 94 => RE_Get_94,
+ 95 => RE_Get_95,
+ 96 => RE_Get_96,
+ 97 => RE_Get_97,
+ 98 => RE_Get_98,
+ 99 => RE_Get_99,
+ 100 => RE_Get_100,
+ 101 => RE_Get_101,
+ 102 => RE_Get_102,
+ 103 => RE_Get_103,
+ 104 => RE_Get_104,
+ 105 => RE_Get_105,
+ 106 => RE_Get_106,
+ 107 => RE_Get_107,
+ 108 => RE_Get_108,
+ 109 => RE_Get_109,
+ 110 => RE_Get_110,
+ 111 => RE_Get_111,
+ 112 => RE_Get_112,
+ 113 => RE_Get_113,
+ 114 => RE_Get_114,
+ 115 => RE_Get_115,
+ 116 => RE_Get_116,
+ 117 => RE_Get_117,
+ 118 => RE_Get_118,
+ 119 => RE_Get_119,
+ 120 => RE_Get_120,
+ 121 => RE_Get_121,
+ 122 => RE_Get_122,
+ 123 => RE_Get_123,
+ 124 => RE_Get_124,
+ 125 => RE_Get_125,
+ 126 => RE_Get_126,
+ 127 => RE_Get_127);
-- Array of Get routine entities to be used in the case where the packed
-- array is itself a component of a packed structure, and therefore may not
@@ -432,7 +560,71 @@ package Exp_Pakd is
60 => RE_GetU_60,
61 => RE_Get_61,
62 => RE_GetU_62,
- 63 => RE_Get_63);
+ 63 => RE_Get_63,
+ 64 => RE_Null,
+ 65 => RE_Get_65,
+ 66 => RE_GetU_66,
+ 67 => RE_Get_67,
+ 68 => RE_GetU_68,
+ 69 => RE_Get_69,
+ 70 => RE_GetU_70,
+ 71 => RE_Get_71,
+ 72 => RE_GetU_72,
+ 73 => RE_Get_73,
+ 74 => RE_GetU_74,
+ 75 => RE_Get_75,
+ 76 => RE_GetU_76,
+ 77 => RE_Get_77,
+ 78 => RE_GetU_78,
+ 79 => RE_Get_79,
+ 80 => RE_GetU_80,
+ 81 => RE_Get_81,
+ 82 => RE_GetU_82,
+ 83 => RE_Get_83,
+ 84 => RE_GetU_84,
+ 85 => RE_Get_85,
+ 86 => RE_GetU_86,
+ 87 => RE_Get_87,
+ 88 => RE_GetU_88,
+ 89 => RE_Get_89,
+ 90 => RE_GetU_90,
+ 91 => RE_Get_91,
+ 92 => RE_GetU_92,
+ 93 => RE_Get_93,
+ 94 => RE_GetU_94,
+ 95 => RE_Get_95,
+ 96 => RE_GetU_96,
+ 97 => RE_Get_97,
+ 98 => RE_GetU_98,
+ 99 => RE_Get_99,
+ 100 => RE_GetU_100,
+ 101 => RE_Get_101,
+ 102 => RE_GetU_102,
+ 103 => RE_Get_103,
+ 104 => RE_GetU_104,
+ 105 => RE_Get_105,
+ 106 => RE_GetU_106,
+ 107 => RE_Get_107,
+ 108 => RE_GetU_108,
+ 109 => RE_Get_109,
+ 110 => RE_GetU_110,
+ 111 => RE_Get_111,
+ 112 => RE_GetU_112,
+ 113 => RE_Get_113,
+ 114 => RE_GetU_114,
+ 115 => RE_Get_115,
+ 116 => RE_GetU_116,
+ 117 => RE_Get_117,
+ 118 => RE_GetU_118,
+ 119 => RE_Get_119,
+ 120 => RE_GetU_120,
+ 121 => RE_Get_121,
+ 122 => RE_GetU_122,
+ 123 => RE_Get_123,
+ 124 => RE_GetU_124,
+ 125 => RE_Get_125,
+ 126 => RE_GetU_126,
+ 127 => RE_Get_127);
-- Array of Set routine entities. These are used to assign an element of a
-- packed array. The N'th entry is used to assign elements for a packed
@@ -502,7 +694,71 @@ package Exp_Pakd is
60 => RE_Set_60,
61 => RE_Set_61,
62 => RE_Set_62,
- 63 => RE_Set_63);
+ 63 => RE_Set_63,
+ 64 => RE_Null,
+ 65 => RE_Set_65,
+ 66 => RE_Set_66,
+ 67 => RE_Set_67,
+ 68 => RE_Set_68,
+ 69 => RE_Set_69,
+ 70 => RE_Set_70,
+ 71 => RE_Set_71,
+ 72 => RE_Set_72,
+ 73 => RE_Set_73,
+ 74 => RE_Set_74,
+ 75 => RE_Set_75,
+ 76 => RE_Set_76,
+ 77 => RE_Set_77,
+ 78 => RE_Set_78,
+ 79 => RE_Set_79,
+ 80 => RE_Set_80,
+ 81 => RE_Set_81,
+ 82 => RE_Set_82,
+ 83 => RE_Set_83,
+ 84 => RE_Set_84,
+ 85 => RE_Set_85,
+ 86 => RE_Set_86,
+ 87 => RE_Set_87,
+ 88 => RE_Set_88,
+ 89 => RE_Set_89,
+ 90 => RE_Set_90,
+ 91 => RE_Set_91,
+ 92 => RE_Set_92,
+ 93 => RE_Set_93,
+ 94 => RE_Set_94,
+ 95 => RE_Set_95,
+ 96 => RE_Set_96,
+ 97 => RE_Set_97,
+ 98 => RE_Set_98,
+ 99 => RE_Set_99,
+ 100 => RE_Set_100,
+ 101 => RE_Set_101,
+ 102 => RE_Set_102,
+ 103 => RE_Set_103,
+ 104 => RE_Set_104,
+ 105 => RE_Set_105,
+ 106 => RE_Set_106,
+ 107 => RE_Set_107,
+ 108 => RE_Set_108,
+ 109 => RE_Set_109,
+ 110 => RE_Set_110,
+ 111 => RE_Set_111,
+ 112 => RE_Set_112,
+ 113 => RE_Set_113,
+ 114 => RE_Set_114,
+ 115 => RE_Set_115,
+ 116 => RE_Set_116,
+ 117 => RE_Set_117,
+ 118 => RE_Set_118,
+ 119 => RE_Set_119,
+ 120 => RE_Set_120,
+ 121 => RE_Set_121,
+ 122 => RE_Set_122,
+ 123 => RE_Set_123,
+ 124 => RE_Set_124,
+ 125 => RE_Set_125,
+ 126 => RE_Set_126,
+ 127 => RE_Set_127);
-- Array of Set routine entities to be used in the case where the packed
-- array is itself a component of a packed structure, and therefore may not
@@ -572,7 +828,71 @@ package Exp_Pakd is
60 => RE_SetU_60,
61 => RE_Set_61,
62 => RE_SetU_62,
- 63 => RE_Set_63);
+ 63 => RE_Set_63,
+ 64 => RE_Null,
+ 65 => RE_Set_65,
+ 66 => RE_SetU_66,
+ 67 => RE_Set_67,
+ 68 => RE_SetU_68,
+ 69 => RE_Set_69,
+ 70 => RE_SetU_70,
+ 71 => RE_Set_71,
+ 72 => RE_SetU_72,
+ 73 => RE_Set_73,
+ 74 => RE_SetU_74,
+ 75 => RE_Set_75,
+ 76 => RE_SetU_76,
+ 77 => RE_Set_77,
+ 78 => RE_SetU_78,
+ 79 => RE_Set_79,
+ 80 => RE_SetU_80,
+ 81 => RE_Set_81,
+ 82 => RE_SetU_82,
+ 83 => RE_Set_83,
+ 84 => RE_SetU_84,
+ 85 => RE_Set_85,
+ 86 => RE_SetU_86,
+ 87 => RE_Set_87,
+ 88 => RE_SetU_88,
+ 89 => RE_Set_89,
+ 90 => RE_SetU_90,
+ 91 => RE_Set_91,
+ 92 => RE_SetU_92,
+ 93 => RE_Set_93,
+ 94 => RE_SetU_94,
+ 95 => RE_Set_95,
+ 96 => RE_SetU_96,
+ 97 => RE_Set_97,
+ 98 => RE_SetU_98,
+ 99 => RE_Set_99,
+ 100 => RE_SetU_100,
+ 101 => RE_Set_101,
+ 102 => RE_SetU_102,
+ 103 => RE_Set_103,
+ 104 => RE_SetU_104,
+ 105 => RE_Set_105,
+ 106 => RE_SetU_106,
+ 107 => RE_Set_107,
+ 108 => RE_SetU_108,
+ 109 => RE_Set_109,
+ 110 => RE_SetU_110,
+ 111 => RE_Set_111,
+ 112 => RE_SetU_112,
+ 113 => RE_Set_113,
+ 114 => RE_SetU_114,
+ 115 => RE_Set_115,
+ 116 => RE_SetU_116,
+ 117 => RE_Set_117,
+ 118 => RE_SetU_118,
+ 119 => RE_Set_119,
+ 120 => RE_SetU_120,
+ 121 => RE_Set_121,
+ 122 => RE_SetU_122,
+ 123 => RE_Set_123,
+ 124 => RE_SetU_124,
+ 125 => RE_Set_125,
+ 126 => RE_SetU_126,
+ 127 => RE_Set_127);
-----------------
-- Subprograms --
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index e978595..14ccac9 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -28,6 +28,7 @@ with Casing; use Casing;
with Checks; use Checks;
with Debug; use Debug;
with Einfo; use Einfo;
+with Elists; use Elists;
with Errout; use Errout;
with Exp_Ch11; use Exp_Ch11;
with Exp_Util; use Exp_Util;
@@ -67,6 +68,7 @@ package body Exp_Prag is
procedure Expand_Pragma_Abort_Defer (N : Node_Id);
procedure Expand_Pragma_Check (N : Node_Id);
procedure Expand_Pragma_Common_Object (N : Node_Id);
+ procedure Expand_Pragma_CUDA_Execute (N : Node_Id);
procedure Expand_Pragma_Import_Or_Interface (N : Node_Id);
procedure Expand_Pragma_Inspection_Point (N : Node_Id);
procedure Expand_Pragma_Interrupt_Priority (N : Node_Id);
@@ -156,6 +158,9 @@ package body Exp_Prag is
when Pragma_Common_Object =>
Expand_Pragma_Common_Object (N);
+ when Pragma_CUDA_Execute =>
+ Expand_Pragma_CUDA_Execute (N);
+
when Pragma_Import =>
Expand_Pragma_Import_Or_Interface (N);
@@ -614,6 +619,572 @@ package body Exp_Prag is
Expression => New_Copy_Tree (Psect)))));
end Expand_Pragma_Common_Object;
+ --------------------------------
+ -- Expand_Pragma_CUDA_Execute --
+ --------------------------------
+
+ -- Pragma CUDA_Execute is expanded in the following manner:
+
+ -- Original Code
+
+ -- pragma CUDA_Execute (My_Proc (X, Y), Blocks, Grids, Mem, Stream)
+
+ -- Expanded Code
+
+ -- declare
+ -- Blocks_Id : CUDA.Vector_Types.Dim3 := Blocks;
+ -- Grids_Id : CUDA.Vector_Types.Dim3 := Grids;
+ -- Mem_Id : Integer := <Mem or 0>;
+ -- Stream_Id : CUDA.Driver_Types.Stream_T := <Stream or null>;
+ -- X_Id : <Type of X> := X;
+ -- Y_Id : <Type of Y> := Y;
+ -- Arg_Id : Array (1..2) of System.Address :=
+ -- (X'Address,_Id Y'Address);_Id
+ -- begin
+ -- CUDA.Internal.Push_Call_Configuration (
+ -- Grids_Id,
+ -- Blocks_Id,
+ -- Mem_Id,
+ -- Stream_Id);
+ -- CUDA.Internal.Pop_Call_Configuration (
+ -- Grids_Id'address,
+ -- Blocks_Id'address,
+ -- Mem_Id'address,
+ -- Stream_Id'address),
+ -- CUDA.Runtime_Api.Launch_Kernel (
+ -- My_Proc'Address,
+ -- Blocks_Id,
+ -- Grids_Id,
+ -- Arg_Id'Address,
+ -- Mem_Id,
+ -- Stream_Id);
+ -- end;
+
+ procedure Expand_Pragma_CUDA_Execute (N : Node_Id) is
+
+ Loc : constant Source_Ptr := Sloc (N);
+
+ procedure Append_Copies
+ (Params : List_Id;
+ Decls : List_Id;
+ Copies : Elist_Id);
+ -- For each parameter in list Params, create an object declaration of
+ -- the followinng form:
+ --
+ -- Copy_Id : Param_Typ := Param_Val;
+ --
+ -- Param_Typ is the type of the parameter. Param_Val is the initial
+ -- value of the parameter. The declarations are stored in Decls, the
+ -- entities of the new objects are collected in list Copies.
+
+ function Build_Dim3_Declaration
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id) return Node_Id;
+ -- Build an object declaration of the form
+ --
+ -- Decl_Id : CUDA.Internal.Dim3 := Val;
+ --
+ -- Val depends on the nature of Init_Val, as follows:
+ --
+ -- * If Init_Val is of type CUDA.Vector_Types.Dim3, then Val has the
+ -- following form:
+ --
+ -- (Interfaces.C.Unsigned (Val.X),
+ -- Interfaces.C.Unsigned (Val.Y),
+ -- Interfaces.C.Unsigned (Val.Z))
+ --
+ -- * If Init_Val is a single Integer, Val has the following form:
+ --
+ -- (Interfaces.C.Unsigned (Init_Val),
+ -- Interfaces.C.Unsigned (1),
+ -- Interfaces.C.Unsigned (1))
+ --
+ -- * If Init_Val is an aggregate of three values, Val has the
+ -- following form:
+ --
+ -- (Interfaces.C.Unsigned (Val_1),
+ -- Interfaces.C.Unsigned (Val_2),
+ -- Interfaces.C.Unsigned (Val_3))
+
+ function Build_Kernel_Args_Declaration
+ (Kernel_Arg : Entity_Id;
+ Var_Ids : Elist_Id) return Node_Id;
+ -- Given a list of variables, return an object declaration of the
+ -- following form:
+ --
+ -- Kernel_Arg : ... := (Var_1'Address, ..., Var_N'Address);
+
+ function Build_Launch_Kernel_Call
+ (Proc : Entity_Id;
+ Grid_Dims : Entity_Id;
+ Block_Dims : Entity_Id;
+ Kernel_Arg : Entity_Id;
+ Memory : Entity_Id;
+ Stream : Entity_Id) return Node_Id;
+ -- Builds and returns a call to CUDA.Launch_Kernel using the given
+ -- arguments. Proc is the entity of the procedure passed to the
+ -- CUDA_Execute pragma. Grid_Dims and Block_Dims are entities of the
+ -- generated declarations that hold the kernel's dimensions. Args is the
+ -- entity of the temporary array that holds the arguments of the kernel.
+ -- Memory and Stream are the entities of the temporaries that hold the
+ -- fourth and fith arguments of CUDA_Execute or their default values.
+
+ function Build_Shared_Memory_Declaration
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id) return Node_Id;
+ -- Builds a declaration the Defining_Identifier of which is Decl_Id, the
+ -- type of which is inferred from CUDA.Internal.Launch_Kernel and the
+ -- value of which is Init_Val if present or null if not.
+
+ function Build_Simple_Declaration_With_Default
+ (Decl_Id : Entity_Id;
+ Init_Val : Entity_Id;
+ Typ : Entity_Id;
+ Default_Val : Entity_Id) return Node_Id;
+ -- Build a declaration the Defining_Identifier of which is Decl_Id, the
+ -- Object_Definition of which is Typ, the value of which is Init_Val if
+ -- present or Default otherwise.
+
+ function Build_Stream_Declaration
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id) return Node_Id;
+ -- Build a declaration the Defining_Identifier of which is Decl_Id, the
+ -- type of which is Integer, the value of which is Init_Val if present
+ -- and 0 otherwise.
+
+ function Etype_Or_Dim3 (N : Node_Id) return Node_Id;
+ -- If N is an aggregate whose type is unknown, return a new occurrence
+ -- of the public Dim3 type. Otherwise, return a new occurrence of N's
+ -- type.
+
+ function Get_Nth_Arg_Type
+ (Subprogram : Entity_Id;
+ N : Positive) return Entity_Id;
+ -- Returns the type of the Nth argument of Subprogram.
+
+ function To_Addresses (Elmts : Elist_Id) return List_Id;
+ -- Returns a new list containing each element of Elmts wrapped in an
+ -- 'address attribute reference. When passed No_Elist, returns an empty
+ -- list.
+
+ -------------------
+ -- Append_Copies --
+ -------------------
+
+ procedure Append_Copies
+ (Params : List_Id;
+ Decls : List_Id;
+ Copies : Elist_Id)
+ is
+ Copy : Entity_Id;
+ Param : Node_Id;
+ begin
+ Param := First (Params);
+ while Present (Param) loop
+ Copy := Make_Temporary (Loc, 'C');
+
+ Append_To (Decls,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Copy,
+ Object_Definition => New_Occurrence_Of (Etype (Param), Loc),
+ Expression => New_Copy_Tree (Param)));
+
+ Append_Elmt (Copy, Copies);
+ Next (Param);
+ end loop;
+ end Append_Copies;
+
+ ----------------------------
+ -- Build_Dim3_Declaration --
+ ----------------------------
+
+ function Build_Dim3_Declaration
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id) return Node_Id
+ is
+ -- Expressions for each component of the returned Dim3
+ Dim_X : Node_Id;
+ Dim_Y : Node_Id;
+ Dim_Z : Node_Id;
+
+ -- Type of CUDA.Internal.Dim3 - inferred from
+ -- RE_Push_Call_Configuration to avoid needing changes in GNAT when
+ -- the CUDA bindings change (this happens frequently).
+ Internal_Dim3 : constant Entity_Id :=
+ Get_Nth_Arg_Type (RTE (RE_Push_Call_Configuration), 1);
+
+ -- Entities for each component of external and internal Dim3
+ First_Component : Entity_Id := First_Entity (RTE (RE_Dim3));
+ Second_Component : Entity_Id := Next_Entity (First_Component);
+ Third_Component : Entity_Id := Next_Entity (Second_Component);
+ begin
+
+ -- Sem_prag.adb ensured that Init_Val is either a Dim3, an
+ -- aggregate of three Any_Integers or Any_Integer.
+
+ -- If Init_Val is a Dim3, use each of its components.
+
+ if Etype (Init_Val) = RTE (RE_Dim3) then
+ Dim_X := Make_Selected_Component (Loc,
+ Prefix => New_Occurrence_Of (Entity (Init_Val), Loc),
+ Selector_Name => New_Occurrence_Of (First_Component, Loc));
+
+ Dim_Y := Make_Selected_Component (Loc,
+ Prefix => New_Occurrence_Of (Entity (Init_Val), Loc),
+ Selector_Name => New_Occurrence_Of (Second_Component, Loc));
+
+ Dim_Z := Make_Selected_Component (Loc,
+ Prefix => New_Occurrence_Of (Entity (Init_Val), Loc),
+ Selector_Name => New_Occurrence_Of (Third_Component, Loc));
+ else
+ -- If Init_Val is an aggregate, use each of its arguments
+
+ if Nkind (Init_Val) = N_Aggregate then
+ Dim_X := First (Expressions (Init_Val));
+ Dim_Y := Next (Dim_X);
+ Dim_Z := Next (Dim_Y);
+
+ -- Otherwise, we know it is an integer and the rest defaults to 1.
+
+ else
+ Dim_X := Init_Val;
+ Dim_Y := Make_Integer_Literal (Loc, 1);
+ Dim_Z := Make_Integer_Literal (Loc, 1);
+ end if;
+ end if;
+
+ First_Component := First_Entity (Internal_Dim3);
+ Second_Component := Next_Entity (First_Component);
+ Third_Component := Next_Entity (Second_Component);
+
+ -- Finally return the CUDA.Internal.Dim3 declaration with an
+ -- aggregate initialization expression.
+
+ return Make_Object_Declaration (Loc,
+ Defining_Identifier => Decl_Id,
+ Object_Definition => New_Occurrence_Of (Internal_Dim3, Loc),
+ Expression => Make_Aggregate (Loc,
+ Expressions => New_List (
+ Make_Type_Conversion (Loc,
+ Subtype_Mark =>
+ New_Occurrence_Of (Etype (First_Component), Loc),
+ Expression => New_Copy_Tree (Dim_X)),
+ Make_Type_Conversion (Loc,
+ Subtype_Mark =>
+ New_Occurrence_Of (Etype (Second_Component), Loc),
+ Expression => New_Copy_Tree (Dim_Y)),
+ Make_Type_Conversion (Loc,
+ Subtype_Mark =>
+ New_Occurrence_Of (Etype (Third_Component), Loc),
+ Expression => New_Copy_Tree (Dim_Z)))));
+ end Build_Dim3_Declaration;
+
+ -----------------------------------
+ -- Build_Kernel_Args_Declaration --
+ -----------------------------------
+
+ function Build_Kernel_Args_Declaration
+ (Kernel_Arg : Entity_Id;
+ Var_Ids : Elist_Id) return Node_Id
+ is
+ Vals : constant List_Id := To_Addresses (Var_Ids);
+ begin
+ return
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Kernel_Arg,
+ Object_Definition =>
+ Make_Constrained_Array_Definition (Loc,
+ Discrete_Subtype_Definitions => New_List (
+ Make_Range (Loc,
+ Low_Bound => Make_Integer_Literal (Loc, 1),
+ High_Bound =>
+ Make_Integer_Literal (Loc, List_Length (Vals)))),
+ Component_Definition =>
+ Make_Component_Definition (Loc,
+ Subtype_Indication =>
+ New_Occurrence_Of (Etype (RTE (RE_Address)), Loc))),
+ Expression => Make_Aggregate (Loc, Vals));
+ end Build_Kernel_Args_Declaration;
+
+ -------------------------------
+ -- Build_Launch_Kernel_Call --
+ -------------------------------
+
+ function Build_Launch_Kernel_Call
+ (Proc : Entity_Id;
+ Grid_Dims : Entity_Id;
+ Block_Dims : Entity_Id;
+ Kernel_Arg : Entity_Id;
+ Memory : Entity_Id;
+ Stream : Entity_Id) return Node_Id is
+ begin
+ return
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Launch_Kernel), Loc),
+ Parameter_Associations => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Proc, Loc),
+ Attribute_Name => Name_Address),
+ New_Occurrence_Of (Grid_Dims, Loc),
+ New_Occurrence_Of (Block_Dims, Loc),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Kernel_Arg, Loc),
+ Attribute_Name => Name_Address),
+ New_Occurrence_Of (Memory, Loc),
+ New_Occurrence_Of (Stream, Loc)));
+ end Build_Launch_Kernel_Call;
+
+ -------------------------------------
+ -- Build_Shared_Memory_Declaration --
+ -------------------------------------
+
+ function Build_Shared_Memory_Declaration
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id) return Node_Id
+ is
+ begin
+ return Build_Simple_Declaration_With_Default
+ (Decl_Id => Decl_Id,
+ Init_Val => Init_Val,
+ Typ =>
+ New_Occurrence_Of
+ (Get_Nth_Arg_Type (RTE (RE_Launch_Kernel), 5), Loc),
+ Default_Val => Make_Integer_Literal (Loc, 0));
+ end Build_Shared_Memory_Declaration;
+
+ -------------------------------------------
+ -- Build_Simple_Declaration_With_Default --
+ -------------------------------------------
+
+ function Build_Simple_Declaration_With_Default
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id;
+ Typ : Entity_Id;
+ Default_Val : Node_Id) return Node_Id
+ is
+ Value : Node_Id := Init_Val;
+ begin
+ if No (Value) then
+ Value := Default_Val;
+ end if;
+
+ return Make_Object_Declaration (Loc,
+ Defining_Identifier => Decl_Id,
+ Object_Definition => Typ,
+ Expression => Value);
+ end Build_Simple_Declaration_With_Default;
+
+ ------------------------------
+ -- Build_Stream_Declaration --
+ ------------------------------
+
+ function Build_Stream_Declaration
+ (Decl_Id : Entity_Id;
+ Init_Val : Node_Id) return Node_Id
+ is
+ begin
+ return Build_Simple_Declaration_With_Default
+ (Decl_Id => Decl_Id,
+ Init_Val => Init_Val,
+ Typ =>
+ New_Occurrence_Of
+ (Get_Nth_Arg_Type (RTE (RE_Launch_Kernel), 6), Loc),
+ Default_Val => Make_Null (Loc));
+ end Build_Stream_Declaration;
+
+ ------------------------
+ -- Etype_Or_Dim3 --
+ ------------------------
+
+ function Etype_Or_Dim3 (N : Node_Id) return Node_Id is
+ begin
+ if Nkind (N) = N_Aggregate and then Is_Composite_Type (Etype (N))
+ then
+ return New_Occurrence_Of (RTE (RE_Dim3), Sloc (N));
+ end if;
+
+ return New_Occurrence_Of (Etype (N), Loc);
+ end Etype_Or_Dim3;
+
+ ----------------------
+ -- Get_Nth_Arg_Type --
+ ----------------------
+
+ function Get_Nth_Arg_Type
+ (Subprogram : Entity_Id;
+ N : Positive) return Entity_Id
+ is
+ Argument : Entity_Id := First_Entity (Subprogram);
+ begin
+ for J in 2 .. N loop
+ Argument := Next_Entity (Argument);
+ end loop;
+
+ return Etype (Argument);
+ end Get_Nth_Arg_Type;
+
+ ------------------
+ -- To_Addresses --
+ ------------------
+
+ function To_Addresses (Elmts : Elist_Id) return List_Id is
+ Result : constant List_Id := New_List;
+ Elmt : Elmt_Id;
+ begin
+ if Elmts = No_Elist then
+ return Result;
+ end if;
+
+ Elmt := First_Elmt (Elmts);
+ while Present (Elmt) loop
+ Append_To (Result,
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Node (Elmt), Loc),
+ Attribute_Name => Name_Address));
+ Next_Elmt (Elmt);
+ end loop;
+
+ return Result;
+ end To_Addresses;
+
+ -- Local variables
+
+ -- Pragma arguments
+
+ Procedure_Call : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 1));
+ Grid_Dimensions : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 2));
+ Block_Dimensions : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 3));
+ Shared_Memory : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 4));
+ CUDA_Stream : constant Node_Id := Get_Pragma_Arg (Arg_N (N, 5));
+
+ -- Entities of objects that will be overwritten by calls to cuda runtime
+ Grids_Id : constant Entity_Id := Make_Temporary (Loc, 'C');
+ Blocks_Id : constant Entity_Id := Make_Temporary (Loc, 'C');
+ Memory_Id : constant Entity_Id := Make_Temporary (Loc, 'C');
+ Stream_Id : constant Entity_Id := Make_Temporary (Loc, 'C');
+
+ -- Entities of objects that capture the value of pragma arguments
+ Temp_Grid : constant Entity_Id := Make_Temporary (Loc, 'C');
+ Temp_Block : constant Entity_Id := Make_Temporary (Loc, 'C');
+
+ -- Declarations for temporary block and grids. These needs to be stored
+ -- in temporary declarations as the expressions will need to be
+ -- referenced multiple times but could have side effects.
+ Temp_Grid_Decl : constant Node_Id := Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp_Grid,
+ Object_Definition => Etype_Or_Dim3 (Grid_Dimensions),
+ Expression => Grid_Dimensions);
+ Temp_Block_Decl : constant Node_Id := Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp_Block,
+ Object_Definition => Etype_Or_Dim3 (Block_Dimensions),
+ Expression => Block_Dimensions);
+
+ -- List holding the entities of the copies of Procedure_Call's
+ -- arguments.
+
+ Kernel_Arg_Copies : constant Elist_Id := New_Elmt_List;
+
+ -- Entity of the array that contains the address of each of the kernel's
+ -- arguments.
+
+ Kernel_Args_Id : constant Entity_Id := Make_Temporary (Loc, 'C');
+
+ -- Calls to the CUDA runtime API.
+
+ Launch_Kernel_Call : Node_Id;
+ Pop_Call : Node_Id;
+ Push_Call : Node_Id;
+
+ -- Declaration of all temporaries required for CUDA API Calls.
+
+ Blk_Decls : constant List_Id := New_List;
+
+ -- Start of processing for CUDA_Execute
+
+ begin
+ -- Append temporary declarations
+
+ Append_To (Blk_Decls, Temp_Grid_Decl);
+ Analyze (Temp_Grid_Decl);
+
+ Append_To (Blk_Decls, Temp_Block_Decl);
+ Analyze (Temp_Block_Decl);
+
+ -- Build parameter declarations for CUDA API calls
+
+ Append_To
+ (Blk_Decls,
+ Build_Dim3_Declaration
+ (Grids_Id, New_Occurrence_Of (Temp_Grid, Loc)));
+
+ Append_To
+ (Blk_Decls,
+ Build_Dim3_Declaration
+ (Blocks_Id, New_Occurrence_Of (Temp_Block, Loc)));
+
+ Append_To
+ (Blk_Decls,
+ Build_Shared_Memory_Declaration (Memory_Id, Shared_Memory));
+
+ Append_To
+ (Blk_Decls, Build_Stream_Declaration (Stream_Id, CUDA_Stream));
+
+ Append_Copies
+ (Parameter_Associations (Procedure_Call),
+ Blk_Decls,
+ Kernel_Arg_Copies);
+
+ Append_To
+ (Blk_Decls,
+ Build_Kernel_Args_Declaration
+ (Kernel_Args_Id, Kernel_Arg_Copies));
+
+ -- Build calls to the CUDA API
+
+ Push_Call :=
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Push_Call_Configuration), Loc),
+ Parameter_Associations => New_List (
+ New_Occurrence_Of (Grids_Id, Loc),
+ New_Occurrence_Of (Blocks_Id, Loc),
+ New_Occurrence_Of (Memory_Id, Loc),
+ New_Occurrence_Of (Stream_Id, Loc)));
+
+ Pop_Call :=
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Pop_Call_Configuration), Loc),
+ Parameter_Associations => To_Addresses
+ (New_Elmt_List
+ (Grids_Id,
+ Blocks_Id,
+ Memory_Id,
+ Stream_Id)));
+
+ Launch_Kernel_Call := Build_Launch_Kernel_Call
+ (Proc => Entity (Name (Procedure_Call)),
+ Grid_Dims => Grids_Id,
+ Block_Dims => Blocks_Id,
+ Kernel_Arg => Kernel_Args_Id,
+ Memory => Memory_Id,
+ Stream => Stream_Id);
+
+ -- Finally make the block that holds declarations and calls
+
+ Rewrite (N,
+ Make_Block_Statement (Loc,
+ Declarations => Blk_Decls,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (
+ Push_Call,
+ Pop_Call,
+ Launch_Kernel_Call))));
+ Analyze (N);
+ end Expand_Pragma_CUDA_Execute;
+
----------------------------------
-- Expand_Pragma_Contract_Cases --
----------------------------------
@@ -892,9 +1463,43 @@ package body Exp_Prag is
-----------------------
function Expand_Attributes (N : Node_Id) return Traverse_Result is
- Decl : Node_Id;
- Pref : Node_Id;
- Temp : Entity_Id;
+ Decl : Node_Id;
+ Pref : Node_Id;
+ Temp : Entity_Id;
+ Indirect : Boolean := False;
+
+ use Sem_Util.Old_Attr_Util.Indirect_Temps;
+
+ procedure Append_For_Indirect_Temp
+ (N : Node_Id; Is_Eval_Stmt : Boolean);
+
+ -- Append either a declaration (which is to be elaborated
+ -- unconditionally) or an evaluation statement (which is
+ -- to be executed conditionally).
+
+ -------------------------------
+ -- Append_For_Indirect_Temp --
+ -------------------------------
+
+ procedure Append_For_Indirect_Temp
+ (N : Node_Id; Is_Eval_Stmt : Boolean)
+ is
+ begin
+ if Is_Eval_Stmt then
+ Append_To (Eval_Stmts, N);
+ else
+ Prepend_To (Decls, N);
+ -- This use of Prepend (as opposed to Append) is why
+ -- we have the Append_Decls_In_Reverse_Order parameter.
+ end if;
+ end Append_For_Indirect_Temp;
+
+ procedure Declare_Indirect_Temporary is new
+ Declare_Indirect_Temp (
+ Append_Item => Append_For_Indirect_Temp,
+ Append_Decls_In_Reverse_Order => True);
+
+ -- Start of processing for Expand_Attributes
begin
-- Attribute 'Old
@@ -903,37 +1508,49 @@ package body Exp_Prag is
and then Attribute_Name (N) = Name_Old
then
Pref := Prefix (N);
- Temp := Make_Temporary (Loc, 'T', Pref);
- Set_Etype (Temp, Etype (Pref));
- -- Generate a temporary to capture the value of the prefix:
- -- Temp : <Pref type>;
+ Indirect := Indirect_Temp_Needed (Etype (Pref));
+
+ if Indirect then
+ if No (Eval_Stmts) then
+ Eval_Stmts := New_List;
+ end if;
+
+ Declare_Indirect_Temporary
+ (Attr_Prefix => Pref,
+ Indirect_Temp => Temp);
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Temp,
- Object_Definition =>
- New_Occurrence_Of (Etype (Pref), Loc));
+ -- Declare a temporary of the prefix type with no explicit
+ -- initial value. If the appropriate contract case is selected
+ -- at run time, then the temporary will be initialized via an
+ -- assignment statement.
- -- Place that temporary at the beginning of declarations, to
- -- prevent anomalies in the GNATprove flow-analysis pass in
- -- the precondition procedure that follows.
+ else
+ Temp := Make_Temporary (Loc, 'T', Pref);
+ Set_Etype (Temp, Etype (Pref));
- Prepend_To (Decls, Decl);
+ -- Generate a temporary to capture the value of the prefix:
+ -- Temp : <Pref type>;
- -- If the type is unconstrained, the prefix provides its
- -- value and constraint, so add it to declaration.
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp,
+ Object_Definition =>
+ New_Occurrence_Of (Etype (Pref), Loc));
- if not Is_Constrained (Etype (Pref))
- and then Is_Entity_Name (Pref)
- then
- Set_Expression (Decl, Pref);
- Analyze (Decl);
+ -- Place that temporary at the beginning of declarations, to
+ -- prevent anomalies in the GNATprove flow-analysis pass in
+ -- the precondition procedure that follows.
- -- Otherwise add an assignment statement to temporary using
- -- prefix as RHS.
+ Prepend_To (Decls, Decl);
- else
+ -- Initially Temp is uninitialized (which is required for
+ -- correctness if default initialization might have side
+ -- effects). Assign prefix value to temp on Eval_Statement
+ -- list, so assignment will be executed conditionally.
+
+ Set_Ekind (Temp, E_Variable);
+ Set_Suppress_Initialization (Temp);
Analyze (Decl);
if No (Eval_Stmts) then
@@ -944,7 +1561,6 @@ package body Exp_Prag is
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Temp, Loc),
Expression => Pref));
-
end if;
-- Ensure that the prefix is valid
@@ -956,7 +1572,13 @@ package body Exp_Prag is
-- Replace the original attribute 'Old by a reference to the
-- generated temporary.
- Rewrite (N, New_Occurrence_Of (Temp, Loc));
+ if Indirect then
+ Rewrite (N,
+ Indirect_Temp_Value
+ (Temp => Temp, Typ => Etype (Pref), Loc => Loc));
+ else
+ Rewrite (N, New_Occurrence_Of (Temp, Loc));
+ end if;
-- Attribute 'Result
@@ -1307,11 +1929,7 @@ package body Exp_Prag is
-- Raise Assertion_Error when the corresponding consequence of a case
-- guard that evaluated to True fails.
- if No (Stmts) then
- Stmts := New_List;
- end if;
-
- Append_To (Stmts, Conseq_Checks);
+ Append_New_To (Stmts, Conseq_Checks);
In_Assertion_Expr := In_Assertion_Expr - 1;
end Expand_Pragma_Contract_Cases;
@@ -1848,32 +2466,6 @@ package body Exp_Prag is
---------------------
procedure Process_Variant (Variant : Node_Id; Is_Last : Boolean) is
- function Make_Op
- (Loc : Source_Ptr;
- Curr_Val : Node_Id;
- Old_Val : Node_Id) return Node_Id;
- -- Generate a comparison between Curr_Val and Old_Val depending on
- -- the change mode (Increases / Decreases) of the variant.
-
- -------------
- -- Make_Op --
- -------------
-
- function Make_Op
- (Loc : Source_Ptr;
- Curr_Val : Node_Id;
- Old_Val : Node_Id) return Node_Id
- is
- begin
- if Chars (Variant) = Name_Increases then
- return Make_Op_Gt (Loc, Curr_Val, Old_Val);
- else pragma Assert (Chars (Variant) = Name_Decreases);
- return Make_Op_Lt (Loc, Curr_Val, Old_Val);
- end if;
- end Make_Op;
-
- -- Local variables
-
Expr : constant Node_Id := Expression (Variant);
Expr_Typ : constant Entity_Id := Etype (Expr);
Loc : constant Source_Ptr := Sloc (Expr);
@@ -1882,8 +2474,6 @@ package body Exp_Prag is
Old_Id : Entity_Id;
Prag : Node_Id;
- -- Start of processing for Process_Variant
-
begin
-- All temporaries generated in this routine must be inserted before
-- the related loop statement. Ensure that the proper scope is on the
@@ -1955,28 +2545,20 @@ package body Exp_Prag is
-- Step 3: Store value of the expression from the previous iteration
- if No (Old_Assign) then
- Old_Assign := New_List;
- end if;
-
-- Generate:
-- Old := Curr;
- Append_To (Old_Assign,
+ Append_New_To (Old_Assign,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Old_Id, Loc),
Expression => New_Occurrence_Of (Curr_Id, Loc)));
-- Step 4: Store the current value of the expression
- if No (Curr_Assign) then
- Curr_Assign := New_List;
- end if;
-
-- Generate:
-- Curr := <Expr>;
- Append_To (Curr_Assign,
+ Append_New_To (Curr_Assign,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Curr_Id, Loc),
Expression => Relocate_Node (Expr)));
@@ -1994,7 +2576,8 @@ package body Exp_Prag is
Expression => Make_Identifier (Loc, Name_Loop_Variant)),
Make_Pragma_Argument_Association (Loc,
Expression =>
- Make_Op (Loc,
+ Make_Variant_Comparison (Loc,
+ Mode => Chars (Variant),
Curr_Val => New_Occurrence_Of (Curr_Id, Loc),
Old_Val => New_Occurrence_Of (Old_Id, Loc)))));
@@ -2177,6 +2760,338 @@ package body Exp_Prag is
end if;
end Expand_Pragma_Relative_Deadline;
+ --------------------------------------
+ -- Expand_Pragma_Subprogram_Variant --
+ --------------------------------------
+
+ -- Aspect Subprogram_Variant is expanded in the following manner:
+
+ -- Original code
+
+ -- procedure Proc (Param : T) with
+ -- with Variant (Increases => Incr_Expr,
+ -- Decreases => Decr_Expr)
+ -- <declarations>
+ -- is
+ -- <source statements>
+ -- Proc (New_Param_Value);
+ -- end Proc;
+
+ -- Expanded code
+
+ -- procedure Proc (Param : T) is
+ -- Old_Incr : constant <type of Incr_Expr> := <Incr_Expr>;
+ -- Old_Decr : constant <type of Decr_Expr> := <Decr_Expr> ;
+ --
+ -- procedure Variants (Param : T);
+ --
+ -- procedure Variants (Param : T) is
+ -- Curr_Incr : constant <type of Incr_Expr> := <Incr_Expr>;
+ -- Curr_Decr : constant <type of Decr_Expr> := <Decr_Expr>;
+ -- begin
+ -- if Curr_Incr /= Old_Incr then
+ -- pragma Check (Variant, Curr_Incr > Old_Incr);
+ -- else
+ -- pragma Check (Variant, Curr_Decr < Old_Decr);
+ -- end if;
+ -- end Variants;
+ --
+ -- <declarations>
+ -- begin
+ -- <source statements>
+ -- Variants (New_Param_Value);
+ -- Proc (New_Param_Value);
+ -- end Proc;
+
+ procedure Expand_Pragma_Subprogram_Variant
+ (Prag : Node_Id;
+ Subp_Id : Node_Id;
+ Body_Decls : List_Id)
+ is
+ Curr_Decls : List_Id;
+ If_Stmt : Node_Id := Empty;
+
+ function Formal_Param_Map
+ (Old_Subp : Entity_Id;
+ New_Subp : Entity_Id) return Elist_Id;
+ -- Given two subprogram entities Old_Subp and New_Subp with the same
+ -- number of formal parameters return a list of the form:
+ --
+ -- old formal 1
+ -- new formal 1
+ -- old formal 2
+ -- new formal 2
+ -- ...
+ --
+ -- as required by New_Copy_Tree to replace references to formal
+ -- parameters of Old_Subp with references to formal parameters of
+ -- New_Subp.
+
+ procedure Process_Variant
+ (Variant : Node_Id;
+ Formal_Map : Elist_Id;
+ Prev_Decl : in out Node_Id;
+ Is_Last : Boolean);
+ -- Process a single increasing / decreasing termination variant given by
+ -- a component association Variant. Formal_Map is a list of formal
+ -- parameters of the annotated subprogram and of the internal procedure
+ -- that verifies the variant in the format required by New_Copy_Tree.
+ -- The Old_... object created by this routine will be appended after
+ -- Prev_Decl and is stored in this parameter for a next call to this
+ -- routine. Is_Last is True when there are no more variants to process.
+
+ ----------------------
+ -- Formal_Param_Map --
+ ----------------------
+
+ function Formal_Param_Map
+ (Old_Subp : Entity_Id;
+ New_Subp : Entity_Id) return Elist_Id
+ is
+ Old_Formal : Entity_Id := First_Formal (Old_Subp);
+ New_Formal : Entity_Id := First_Formal (New_Subp);
+
+ Param_Map : Elist_Id;
+ begin
+ if Present (Old_Formal) then
+ Param_Map := New_Elmt_List;
+ while Present (Old_Formal) and then Present (New_Formal) loop
+ Append_Elmt (Old_Formal, Param_Map);
+ Append_Elmt (New_Formal, Param_Map);
+
+ Next_Formal (Old_Formal);
+ Next_Formal (New_Formal);
+ end loop;
+
+ return Param_Map;
+ else
+ return No_Elist;
+ end if;
+ end Formal_Param_Map;
+
+ ---------------------
+ -- Process_Variant --
+ ---------------------
+
+ procedure Process_Variant
+ (Variant : Node_Id;
+ Formal_Map : Elist_Id;
+ Prev_Decl : in out Node_Id;
+ Is_Last : Boolean)
+ is
+ Expr : constant Node_Id := Expression (Variant);
+ Expr_Typ : constant Entity_Id := Etype (Expr);
+ Loc : constant Source_Ptr := Sloc (Expr);
+
+ Old_Id : Entity_Id;
+ Old_Decl : Node_Id;
+ Curr_Id : Entity_Id;
+ Curr_Decl : Node_Id;
+ Prag : Node_Id;
+
+ begin
+ -- Create temporaries that store the old values of the associated
+ -- expression.
+
+ -- Generate:
+ -- Old : constant <type of Expr> := <Expr>;
+
+ Old_Id := Make_Temporary (Loc, 'P');
+
+ Old_Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Old_Id,
+ Constant_Present => True,
+ Object_Definition => New_Occurrence_Of (Expr_Typ, Loc),
+ Expression => New_Copy_Tree (Expr));
+
+ Insert_After_And_Analyze (Prev_Decl, Old_Decl);
+
+ Prev_Decl := Old_Decl;
+
+ -- Generate:
+ -- Curr : constant <type of Expr> := <Expr>;
+
+ Curr_Id := Make_Temporary (Loc, 'C');
+
+ Curr_Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Curr_Id,
+ Constant_Present => True,
+ Object_Definition => New_Occurrence_Of (Expr_Typ, Loc),
+ Expression =>
+ New_Copy_Tree (Expr, Map => Formal_Map));
+
+ Append (Curr_Decl, Curr_Decls);
+
+ -- Generate:
+ -- pragma Check (Variant, Curr <|> Old);
+
+ Prag :=
+ Make_Pragma (Loc,
+ Chars => Name_Check,
+ Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression =>
+ Make_Identifier (Loc,
+ Name_Subprogram_Variant)),
+ Make_Pragma_Argument_Association (Loc,
+ Expression =>
+ Make_Variant_Comparison (Loc,
+ Mode => Chars (First (Choices (Variant))),
+ Curr_Val => New_Occurrence_Of (Curr_Id, Loc),
+ Old_Val => New_Occurrence_Of (Old_Id, Loc)))));
+
+ -- Generate:
+ -- if Curr /= Old then
+ -- <Prag>;
+
+ if No (If_Stmt) then
+
+ -- When there is just one termination variant, do not compare
+ -- the old and current value for equality, just check the
+ -- pragma.
+
+ if Is_Last then
+ If_Stmt := Prag;
+ else
+ If_Stmt :=
+ Make_If_Statement (Loc,
+ Condition =>
+ Make_Op_Ne (Loc,
+ Left_Opnd => New_Occurrence_Of (Curr_Id, Loc),
+ Right_Opnd => New_Occurrence_Of (Old_Id, Loc)),
+ Then_Statements => New_List (Prag));
+ end if;
+
+ -- Generate:
+ -- else
+ -- <Prag>;
+ -- end if;
+
+ elsif Is_Last then
+ Set_Else_Statements (If_Stmt, New_List (Prag));
+
+ -- Generate:
+ -- elsif Curr /= Old then
+ -- <Prag>;
+
+ else
+ if Elsif_Parts (If_Stmt) = No_List then
+ Set_Elsif_Parts (If_Stmt, New_List);
+ end if;
+
+ Append_To (Elsif_Parts (If_Stmt),
+ Make_Elsif_Part (Loc,
+ Condition =>
+ Make_Op_Ne (Loc,
+ Left_Opnd => New_Occurrence_Of (Curr_Id, Loc),
+ Right_Opnd => New_Occurrence_Of (Old_Id, Loc)),
+ Then_Statements => New_List (Prag)));
+ end if;
+ end Process_Variant;
+
+ -- Local variables
+
+ Loc : constant Source_Ptr := Sloc (Prag);
+
+ Aggr : Node_Id;
+ Formal_Map : Elist_Id;
+ Last : Node_Id;
+ Last_Variant : Node_Id;
+ Proc_Bod : Node_Id;
+ Proc_Decl : Node_Id;
+ Proc_Id : Entity_Id;
+ Proc_Spec : Node_Id;
+ Variant : Node_Id;
+
+ begin
+ -- Do nothing if pragma is not present or is disabled
+
+ if Is_Ignored (Prag) then
+ return;
+ end if;
+
+ Aggr := Expression (First (Pragma_Argument_Associations (Prag)));
+
+ -- The expansion of Subprogram Variant is quite distributed as it
+ -- produces various statements to capture and compare the arguments.
+ -- To preserve the original context, set the Is_Assertion_Expr flag.
+ -- This aids the Ghost legality checks when verifying the placement
+ -- of a reference to a Ghost entity.
+
+ In_Assertion_Expr := In_Assertion_Expr + 1;
+
+ -- Create declaration of the procedure that compares values of the
+ -- variant expressions captured at the start of subprogram with their
+ -- values at the recursive call of the subprogram.
+
+ Proc_Id := Make_Defining_Identifier (Loc, Name_uVariants);
+
+ Proc_Spec :=
+ Make_Procedure_Specification
+ (Loc,
+ Defining_Unit_Name => Proc_Id,
+ Parameter_Specifications => Copy_Parameter_List (Subp_Id));
+
+ Proc_Decl :=
+ Make_Subprogram_Declaration (Loc, Proc_Spec);
+
+ Insert_Before_First_Source_Declaration (Proc_Decl, Body_Decls);
+ Analyze (Proc_Decl);
+
+ -- Create a mapping between formals of the annotated subprogram (which
+ -- are used to compute values of the variant expression at the start of
+ -- subprogram) and formals of the internal procedure (which are used to
+ -- compute values of of the variant expression at the recursive call).
+
+ Formal_Map :=
+ Formal_Param_Map (Old_Subp => Subp_Id, New_Subp => Proc_Id);
+
+ -- Process invidual increasing / decreasing variants
+
+ Last := Proc_Decl;
+ Curr_Decls := New_List;
+ Last_Variant := Nlists.Last (Component_Associations (Aggr));
+
+ Variant := First (Component_Associations (Aggr));
+ while Present (Variant) loop
+ Process_Variant
+ (Variant => Variant,
+ Formal_Map => Formal_Map,
+ Prev_Decl => Last,
+ Is_Last => Variant = Last_Variant);
+ Next (Variant);
+ end loop;
+
+ -- Create a subprogram body with declarations of objects that capture
+ -- the current values of variant expressions at a recursive call and an
+ -- if-then-else statement that compares current with old values.
+
+ Proc_Bod :=
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Copy_Subprogram_Spec (Proc_Spec),
+ Declarations => Curr_Decls,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (If_Stmt),
+ End_Label => Make_Identifier (Loc, Chars (Proc_Id))));
+
+ Insert_After_And_Analyze (Last, Proc_Bod);
+
+ -- Restore assertion context
+
+ In_Assertion_Expr := In_Assertion_Expr - 1;
+
+ -- Rewrite the aspect expression, which is no longer needed, with
+ -- a reference to the procedure that has just been created. We will
+ -- generate a call to this procedure at each recursive call of the
+ -- subprogram that has been annotated with Subprogram_Variant.
+
+ Rewrite (Aggr, New_Occurrence_Of (Proc_Id, Loc));
+ end Expand_Pragma_Subprogram_Variant;
+
-------------------------------------------
-- Expand_Pragma_Suppress_Initialization --
-------------------------------------------
diff --git a/gcc/ada/exp_prag.ads b/gcc/ada/exp_prag.ads
index 9957b21..59f0d6a 100644
--- a/gcc/ada/exp_prag.ads
+++ b/gcc/ada/exp_prag.ads
@@ -49,4 +49,15 @@ package Exp_Prag is
-- applies to package Pack_Id. N denotes the related package spec or
-- body.
+ procedure Expand_Pragma_Subprogram_Variant
+ (Prag : Node_Id;
+ Subp_Id : Entity_Id;
+ Body_Decls : List_Id);
+ -- Given pragma Subprogram_Variant Prag, create the circuitry needed
+ -- to evaluate variant expressions at the subprogram entry and at the
+ -- recursive call. Subp_Id is the related subprogram for which the pragma
+ -- applies and Body_Decls are its body declarations. On exit, the argument
+ -- of Prag is replaced with a reference to procedure with checks for the
+ -- variant expressions.
+
end Exp_Prag;
diff --git a/gcc/ada/exp_put_image.adb b/gcc/ada/exp_put_image.adb
index 80b49a7..3fae317 100644
--- a/gcc/ada/exp_put_image.adb
+++ b/gcc/ada/exp_put_image.adb
@@ -300,23 +300,27 @@ package body Exp_Put_Image is
if Is_Signed_Integer_Type (U_Type) then
if P_Size <= Standard_Integer_Size then
Lib_RE := RE_Put_Image_Integer;
- else
- pragma Assert (P_Size <= Standard_Long_Long_Integer_Size);
+ elsif P_Size <= Standard_Long_Long_Integer_Size then
Lib_RE := RE_Put_Image_Long_Long_Integer;
+ else
+ pragma Assert (P_Size <= Standard_Long_Long_Long_Integer_Size);
+ Lib_RE := RE_Put_Image_Long_Long_Long_Integer;
end if;
elsif Is_Modular_Integer_Type (U_Type) then
if P_Size <= Standard_Integer_Size then -- Yes, Integer
Lib_RE := RE_Put_Image_Unsigned;
- else
- pragma Assert (P_Size <= Standard_Long_Long_Integer_Size);
+ elsif P_Size <= Standard_Long_Long_Integer_Size then
Lib_RE := RE_Put_Image_Long_Long_Unsigned;
+ else
+ pragma Assert (P_Size <= Standard_Long_Long_Long_Integer_Size);
+ Lib_RE := RE_Put_Image_Long_Long_Long_Unsigned;
end if;
elsif Is_Access_Type (U_Type) then
- if Is_Access_Protected_Subprogram_Type (U_Type) then
+ if Is_Access_Protected_Subprogram_Type (Base_Type (U_Type)) then
Lib_RE := RE_Put_Image_Access_Prot_Subp;
- elsif Is_Access_Subprogram_Type (U_Type) then
+ elsif Is_Access_Subprogram_Type (Base_Type (U_Type)) then
Lib_RE := RE_Put_Image_Access_Subp;
elsif P_Size = System_Address_Size then
Lib_RE := RE_Put_Image_Thin_Pointer;
diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb
index b400268..f6ef865 100644
--- a/gcc/ada/exp_spark.adb
+++ b/gcc/ada/exp_spark.adb
@@ -36,6 +36,7 @@ with Nlists; use Nlists;
with Nmake; use Nmake;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
+with Sem_Ch8; use Sem_Ch8;
with Sem_Prag; use Sem_Prag;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
@@ -51,6 +52,9 @@ package body Exp_SPARK is
-- Local Subprograms --
-----------------------
+ procedure Expand_SPARK_N_Aggregate (N : Node_Id);
+ -- Perform aggregate-specific expansion
+
procedure Expand_SPARK_N_Attribute_Reference (N : Node_Id);
-- Perform attribute-reference-specific expansion
@@ -101,6 +105,9 @@ package body Exp_SPARK is
=>
Qualify_Entity_Names (N);
+ when N_Aggregate =>
+ Expand_SPARK_N_Aggregate (N);
+
-- Replace occurrences of System'To_Address by calls to
-- System.Storage_Elements.To_Address.
@@ -215,25 +222,48 @@ package body Exp_SPARK is
Expr := Expression (Assoc);
Comp_Type := Component_Type (Typ);
+ -- Analyze expression of the iterated_component_association
+ -- with its index parameter in scope.
+
+ if Nkind (Assoc) = N_Iterated_Component_Association then
+ Push_Scope (Scope (Defining_Identifier (Assoc)));
+ Analyze_And_Resolve (Expression (Assoc), Comp_Type);
+ end if;
+
if Is_Scalar_Type (Comp_Type) then
Apply_Scalar_Range_Check (Expr, Comp_Type);
end if;
- Index := First (Choices (Assoc));
- Index_Typ := First_Index (Typ);
-
- while Present (Index) loop
- -- The index denotes a range of elements
+ -- Restore scope of the iterated_component_association
- if Nkind (Index) = N_Range then
- Apply_Scalar_Range_Check
- (Low_Bound (Index), Base_Type (Etype (Index_Typ)));
- Apply_Scalar_Range_Check
- (High_Bound (Index), Base_Type (Etype (Index_Typ)));
+ if Nkind (Assoc) = N_Iterated_Component_Association then
+ End_Scope;
+ end if;
- -- Otherwise the index denotes a single element
+ Index :=
+ First
+ (if Nkind (Assoc) = N_Iterated_Component_Association
+ then Discrete_Choices (Assoc)
+ else Choices (Assoc));
+ Index_Typ := First_Index (Typ);
- else
+ while Present (Index) loop
+ -- If the index denotes a range of elements or a constrained
+ -- subtype indication, then their low and high bounds
+ -- already have range checks applied.
+
+ if Nkind (Index) in N_Range | N_Subtype_Indication then
+ null;
+
+ -- Otherwise the index denotes a single expression where
+ -- range checks need to be applied or a subtype name
+ -- (without range constraints) where applying checks is
+ -- harmless.
+ --
+ -- In delta_aggregate and Update attribute on array the
+ -- others_choice is not allowed.
+
+ else pragma Assert (Nkind (Index) in N_Subexpr);
Apply_Scalar_Range_Check (Index, Etype (Index_Typ));
end if;
@@ -340,6 +370,74 @@ package body Exp_SPARK is
end if;
end Expand_SPARK_N_Freeze_Type;
+ ------------------------------
+ -- Expand_SPARK_N_Aggregate --
+ ------------------------------
+
+ procedure Expand_SPARK_N_Aggregate (N : Node_Id) is
+ Assoc : Node_Id := First (Component_Associations (N));
+ begin
+ -- For compilation, frontend analyses a copy of the
+ -- iterated_component_association's expression for legality checking;
+ -- (then the expression is copied again when expanding association into
+ -- assignments for the individual choices). For SPARK we analyze the
+ -- original expression and apply range checks, if required.
+
+ while Present (Assoc) loop
+ if Nkind (Assoc) = N_Iterated_Component_Association then
+ declare
+ Typ : constant Entity_Id := Etype (N);
+
+ Comp_Type : constant Entity_Id := Component_Type (Typ);
+ Expr : constant Node_Id := Expression (Assoc);
+ Index_Typ : constant Entity_Id := First_Index (Typ);
+
+ Index : Node_Id;
+
+ begin
+ -- Analyze expression with index parameter in scope
+
+ Push_Scope (Scope (Defining_Identifier (Assoc)));
+ Enter_Name (Defining_Identifier (Assoc));
+ Analyze_And_Resolve (Expression (Assoc), Comp_Type);
+
+ if Is_Scalar_Type (Comp_Type) then
+ Apply_Scalar_Range_Check (Expr, Comp_Type);
+ end if;
+
+ End_Scope;
+
+ -- Analyze discrete choices
+
+ Index := First (Discrete_Choices (Assoc));
+
+ while Present (Index) loop
+
+ -- The index denotes a range of elements where range checks
+ -- have been already applied.
+
+ if Nkind (Index) in N_Others_Choice
+ | N_Range
+ | N_Subtype_Indication
+ then
+ null;
+
+ -- Otherwise the index denotes a single element (or a
+ -- subtype name which doesn't require range checks).
+
+ else pragma Assert (Nkind (Index) in N_Subexpr);
+ Apply_Scalar_Range_Check (Index, Etype (Index_Typ));
+ end if;
+
+ Next (Index);
+ end loop;
+ end;
+ end if;
+
+ Next (Assoc);
+ end loop;
+ end Expand_SPARK_N_Aggregate;
+
----------------------------------------
-- Expand_SPARK_N_Attribute_Reference --
----------------------------------------
diff --git a/gcc/ada/exp_tss.adb b/gcc/ada/exp_tss.adb
index b640843..40943fb 100644
--- a/gcc/ada/exp_tss.adb
+++ b/gcc/ada/exp_tss.adb
@@ -164,7 +164,13 @@ package body Exp_Tss is
-- If Typ is a derived type, it may inherit attributes from an ancestor
if No (Proc) and then Is_Derived_Type (Btyp) then
- Proc := Find_Inherited_TSS (Etype (Btyp), Nam);
+ if not Derivation_Too_Early_To_Inherit (Btyp, Nam) then
+ Proc := Find_Inherited_TSS (Etype (Btyp), Nam);
+ elsif Is_Derived_Type (Etype (Btyp)) then
+ -- Skip one link in the derivation chain
+ Proc := Find_Inherited_TSS
+ (Etype (Base_Type (Etype (Btyp))), Nam);
+ end if;
end if;
-- If nothing else, use the TSS of the root type
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 0f8505f..6b474d8 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -32,7 +32,6 @@ with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Aggr; use Exp_Aggr;
-with Exp_Ch2; use Exp_Ch2;
with Exp_Ch6; use Exp_Ch6;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch11; use Exp_Ch11;
@@ -325,7 +324,6 @@ package body Exp_Util is
declare
Loc : constant Source_Ptr := Sloc (N);
T : constant Entity_Id := Etype (N);
- Ti : Entity_Id;
begin
-- Defend against a call where the argument has no type, or has a
@@ -357,15 +355,11 @@ package body Exp_Util is
-- value of type T.
if Nonzero_Is_True (T) or else Has_Non_Standard_Rep (T) then
- if Esize (T) <= Esize (Standard_Integer) then
- Ti := Standard_Integer;
- else
- Ti := Standard_Long_Long_Integer;
- end if;
-
Rewrite (N,
Make_Op_Ne (Loc,
- Left_Opnd => Unchecked_Convert_To (Ti, N),
+ Left_Opnd =>
+ Unchecked_Convert_To
+ (Integer_Type_For (Esize (T), Uns => False), N),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Enum_Rep,
@@ -739,12 +733,13 @@ package body Exp_Util is
-- Local variables
- Desig_Typ : Entity_Id;
- Expr : Node_Id;
- Needs_Fin : Boolean;
- Pool_Id : Entity_Id;
- Proc_To_Call : Node_Id := Empty;
- Ptr_Typ : Entity_Id;
+ Desig_Typ : Entity_Id;
+ Expr : Node_Id;
+ Needs_Fin : Boolean;
+ Pool_Id : Entity_Id;
+ Proc_To_Call : Node_Id := Empty;
+ Ptr_Typ : Entity_Id;
+ Use_Secondary_Stack_Pool : Boolean;
-- Start of processing for Build_Allocate_Deallocate_Proc
@@ -809,17 +804,22 @@ package body Exp_Util is
Desig_Typ := Corresponding_Record_Type (Desig_Typ);
end if;
+ Use_Secondary_Stack_Pool :=
+ Is_RTE (Pool_Id, RE_SS_Pool)
+ or else (Nkind (Expr) = N_Allocator
+ and then Is_RTE (Storage_Pool (Expr), RE_SS_Pool));
+
-- Do not process allocations / deallocations without a pool
if No (Pool_Id) then
return;
-- Do not process allocations on / deallocations from the secondary
- -- stack.
+ -- stack, except for access types used to implement indirect temps.
- elsif Is_RTE (Pool_Id, RE_SS_Pool)
- or else (Nkind (Expr) = N_Allocator
- and then Is_RTE (Storage_Pool (Expr), RE_SS_Pool))
+ elsif Use_Secondary_Stack_Pool
+ and then not Old_Attr_Util.Indirect_Temps
+ .Is_Access_Type_For_Indirect_Temp (Ptr_Typ)
then
return;
@@ -956,7 +956,9 @@ package body Exp_Util is
Append_To (Actuals, New_Occurrence_Of (Addr_Id, Loc));
Append_To (Actuals, New_Occurrence_Of (Size_Id, Loc));
- if Is_Allocate or else not Is_Class_Wide_Type (Desig_Typ) then
+ if (Is_Allocate or else not Is_Class_Wide_Type (Desig_Typ))
+ and then not Use_Secondary_Stack_Pool
+ then
Append_To (Actuals, New_Occurrence_Of (Alig_Id, Loc));
-- For deallocation of class-wide types we obtain the value of
@@ -972,6 +974,9 @@ package body Exp_Util is
-- into the code that reads the value of alignment from the TSD
-- (see Expand_N_Attribute_Reference)
+ -- In the Use_Secondary_Stack_Pool case, Alig_Id is not
+ -- passed in and therefore must not be referenced.
+
Append_To (Actuals,
Unchecked_Convert_To (RTE (RE_Storage_Offset),
Make_Attribute_Reference (Loc,
@@ -1121,55 +1126,67 @@ package body Exp_Util is
-- Create a custom Allocate / Deallocate routine which has identical
-- profile to that of System.Storage_Pools.
- Insert_Action (N,
- Make_Subprogram_Body (Loc,
- Specification =>
-
- -- procedure Pnn
-
- Make_Procedure_Specification (Loc,
- Defining_Unit_Name => Proc_Id,
- Parameter_Specifications => New_List (
-
- -- P : Root_Storage_Pool
-
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Make_Temporary (Loc, 'P'),
- Parameter_Type =>
- New_Occurrence_Of (RTE (RE_Root_Storage_Pool), Loc)),
-
- -- A : [out] Address
-
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Addr_Id,
- Out_Present => Is_Allocate,
- Parameter_Type =>
- New_Occurrence_Of (RTE (RE_Address), Loc)),
-
- -- S : Storage_Count
-
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Size_Id,
- Parameter_Type =>
- New_Occurrence_Of (RTE (RE_Storage_Count), Loc)),
-
- -- L : Storage_Count
-
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Alig_Id,
- Parameter_Type =>
- New_Occurrence_Of (RTE (RE_Storage_Count), Loc)))),
-
- Declarations => No_List,
+ declare
+ -- P : Root_Storage_Pool
+ function Pool_Param return Node_Id is (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Make_Temporary (Loc, 'P'),
+ Parameter_Type =>
+ New_Occurrence_Of (RTE (RE_Root_Storage_Pool), Loc)));
+
+ -- A : [out] Address
+ function Address_Param return Node_Id is (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Addr_Id,
+ Out_Present => Is_Allocate,
+ Parameter_Type =>
+ New_Occurrence_Of (RTE (RE_Address), Loc)));
+
+ -- S : Storage_Count
+ function Size_Param return Node_Id is (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Size_Id,
+ Parameter_Type =>
+ New_Occurrence_Of (RTE (RE_Storage_Count), Loc)));
+
+ -- L : Storage_Count
+ function Alignment_Param return Node_Id is (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Alig_Id,
+ Parameter_Type =>
+ New_Occurrence_Of (RTE (RE_Storage_Count), Loc)));
+
+ Formal_Params : List_Id;
+ begin
+ if Use_Secondary_Stack_Pool then
+ -- Gigi expects a different profile in the Secondary_Stack_Pool
+ -- case. There must be no uses of the two missing formals
+ -- (i.e., Pool_Param and Alignment_Param) in this case.
+ Formal_Params := New_List (Address_Param, Size_Param);
+ else
+ Formal_Params := New_List (
+ Pool_Param, Address_Param, Size_Param, Alignment_Param);
+ end if;
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- Statements => New_List (
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Occurrence_Of (Proc_To_Call, Loc),
- Parameter_Associations => Actuals)))),
- Suppress => All_Checks);
+ Insert_Action (N,
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ -- procedure Pnn
+ Make_Procedure_Specification (Loc,
+ Defining_Unit_Name => Proc_Id,
+ Parameter_Specifications => Formal_Params),
+
+ Declarations => No_List,
+
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (Proc_To_Call, Loc),
+ Parameter_Associations => Actuals)))),
+ Suppress => All_Checks);
+ end;
-- The newly generated Allocate / Deallocate becomes the default
-- procedure to call when the back end processes the allocation /
@@ -4574,11 +4591,11 @@ package body Exp_Util is
if not Is_Record_Type (UT) and then not Is_Array_Type (UT) then
return False;
- -- If we know that we have a small (64 bits or less) record or small
- -- bit-packed array, then everything is fine, since the back end can
- -- handle these cases correctly.
+ -- If we know that we have a small (at most the maximum integer size)
+ -- record or bit-packed array, then everything is fine, since the back
+ -- end can handle these cases correctly.
- elsif Esize (Comp) <= 64
+ elsif Esize (Comp) <= System_Max_Integer_Size
and then (Is_Record_Type (UT) or else Is_Bit_Packed_Array (UT))
then
return False;
@@ -4598,60 +4615,6 @@ package body Exp_Util is
end if;
end Component_May_Be_Bit_Aligned;
- ----------------------------------------
- -- Containing_Package_With_Ext_Axioms --
- ----------------------------------------
-
- function Containing_Package_With_Ext_Axioms
- (E : Entity_Id) return Entity_Id
- is
- begin
- -- E is the package or generic package which is externally axiomatized
-
- if Is_Package_Or_Generic_Package (E)
- and then Has_Annotate_Pragma_For_External_Axiomatization (E)
- then
- return E;
- end if;
-
- -- If E's scope is axiomatized, E is axiomatized
-
- if Present (Scope (E)) then
- declare
- First_Ax_Parent_Scope : constant Entity_Id :=
- Containing_Package_With_Ext_Axioms (Scope (E));
- begin
- if Present (First_Ax_Parent_Scope) then
- return First_Ax_Parent_Scope;
- end if;
- end;
- end if;
-
- -- Otherwise, if E is a package instance, it is axiomatized if the
- -- corresponding generic package is axiomatized.
-
- if Ekind (E) = E_Package then
- declare
- Par : constant Node_Id := Parent (E);
- Decl : Node_Id;
-
- begin
- if Nkind (Par) = N_Defining_Program_Unit_Name then
- Decl := Parent (Par);
- else
- Decl := Par;
- end if;
-
- if Present (Generic_Parent (Decl)) then
- return
- Containing_Package_With_Ext_Axioms (Generic_Parent (Decl));
- end if;
- end;
- end if;
-
- return Empty;
- end Containing_Package_With_Ext_Axioms;
-
-------------------------------
-- Convert_To_Actual_Subtype --
-------------------------------
@@ -6203,26 +6166,6 @@ package body Exp_Util is
return End_String;
end Fully_Qualified_Name_String;
- ------------------------
- -- Generate_Poll_Call --
- ------------------------
-
- procedure Generate_Poll_Call (N : Node_Id) is
- begin
- -- No poll call if polling not active
-
- if not Polling_Required then
- return;
-
- -- Otherwise generate require poll call
-
- else
- Insert_Before_And_Analyze (N,
- Make_Procedure_Call_Statement (Sloc (N),
- Name => New_Occurrence_Of (RTE (RE_Poll), Sloc (N))));
- end if;
- end Generate_Poll_Call;
-
---------------------------------
-- Get_Current_Value_Condition --
---------------------------------
@@ -6656,122 +6599,6 @@ package body Exp_Util is
end if;
end Has_Access_Constraint;
- -----------------------------------------------------
- -- Has_Annotate_Pragma_For_External_Axiomatization --
- -----------------------------------------------------
-
- function Has_Annotate_Pragma_For_External_Axiomatization
- (E : Entity_Id) return Boolean
- is
- function Is_Annotate_Pragma_For_External_Axiomatization
- (N : Node_Id) return Boolean;
- -- Returns whether N is
- -- pragma Annotate (GNATprove, External_Axiomatization);
-
- ----------------------------------------------------
- -- Is_Annotate_Pragma_For_External_Axiomatization --
- ----------------------------------------------------
-
- -- The general form of pragma Annotate is
-
- -- pragma Annotate (IDENTIFIER [, IDENTIFIER {, ARG}]);
- -- ARG ::= NAME | EXPRESSION
-
- -- The first two arguments are by convention intended to refer to an
- -- external tool and a tool-specific function. These arguments are
- -- not analyzed.
-
- -- The following is used to annotate a package specification which
- -- GNATprove should treat specially, because the axiomatization of
- -- this unit is given by the user instead of being automatically
- -- generated.
-
- -- pragma Annotate (GNATprove, External_Axiomatization);
-
- function Is_Annotate_Pragma_For_External_Axiomatization
- (N : Node_Id) return Boolean
- is
- Name_GNATprove : constant String :=
- "gnatprove";
- Name_External_Axiomatization : constant String :=
- "external_axiomatization";
- -- Special names
-
- begin
- if Nkind (N) = N_Pragma
- and then Get_Pragma_Id (N) = Pragma_Annotate
- and then List_Length (Pragma_Argument_Associations (N)) = 2
- then
- declare
- Arg1 : constant Node_Id :=
- First (Pragma_Argument_Associations (N));
- Arg2 : constant Node_Id := Next (Arg1);
- Nam1 : Name_Id;
- Nam2 : Name_Id;
-
- begin
- -- Fill in Name_Buffer with Name_GNATprove first, and then with
- -- Name_External_Axiomatization so that Name_Find returns the
- -- corresponding name. This takes care of all possible casings.
-
- Name_Len := 0;
- Add_Str_To_Name_Buffer (Name_GNATprove);
- Nam1 := Name_Find;
-
- Name_Len := 0;
- Add_Str_To_Name_Buffer (Name_External_Axiomatization);
- Nam2 := Name_Find;
-
- return Chars (Get_Pragma_Arg (Arg1)) = Nam1
- and then
- Chars (Get_Pragma_Arg (Arg2)) = Nam2;
- end;
-
- else
- return False;
- end if;
- end Is_Annotate_Pragma_For_External_Axiomatization;
-
- -- Local variables
-
- Decl : Node_Id;
- Vis_Decls : List_Id;
- N : Node_Id;
-
- -- Start of processing for Has_Annotate_Pragma_For_External_Axiomatization
-
- begin
- if Nkind (Parent (E)) = N_Defining_Program_Unit_Name then
- Decl := Parent (Parent (E));
- else
- Decl := Parent (E);
- end if;
-
- Vis_Decls := Visible_Declarations (Decl);
-
- N := First (Vis_Decls);
- while Present (N) loop
-
- -- Skip declarations generated by the frontend. Skip all pragmas
- -- that are not the desired Annotate pragma. Stop the search on
- -- the first non-pragma source declaration.
-
- if Comes_From_Source (N) then
- if Nkind (N) = N_Pragma then
- if Is_Annotate_Pragma_For_External_Axiomatization (N) then
- return True;
- end if;
- else
- return False;
- end if;
- end if;
-
- Next (N);
- end loop;
-
- return False;
- end Has_Annotate_Pragma_For_External_Axiomatization;
-
--------------------
-- Homonym_Number --
--------------------
@@ -7727,6 +7554,46 @@ package body Exp_Util is
return Proc /= Empty;
end Inside_Init_Proc;
+ ----------------------
+ -- Integer_Type_For --
+ ----------------------
+
+ function Integer_Type_For (S : Uint; Uns : Boolean) return Entity_Id is
+ begin
+ pragma Assert (S <= System_Max_Integer_Size);
+
+ -- This is the canonical 32-bit type
+
+ if S <= Standard_Integer_Size then
+ if Uns then
+ return Standard_Unsigned;
+ else
+ return Standard_Integer;
+ end if;
+
+ -- This is the canonical 64-bit type
+
+ elsif S <= Standard_Long_Long_Integer_Size then
+ if Uns then
+ return Standard_Long_Long_Unsigned;
+ else
+ return Standard_Long_Long_Integer;
+ end if;
+
+ -- This is the canonical 128-bit type
+
+ elsif S <= Standard_Long_Long_Long_Integer_Size then
+ if Uns then
+ return Standard_Long_Long_Long_Unsigned;
+ else
+ return Standard_Long_Long_Long_Integer;
+ end if;
+
+ else
+ raise Program_Error;
+ end if;
+ end Integer_Type_For;
+
----------------------------
-- Is_All_Null_Statements --
----------------------------
@@ -8734,9 +8601,14 @@ package body Exp_Util is
function Is_Related_To_Func_Return (Id : Entity_Id) return Boolean is
Expr : constant Node_Id := Related_Expression (Id);
begin
+ -- In the case of a function with a class-wide result that returns
+ -- a call to a function with a specific result, we introduce a
+ -- type conversion for the return expression. We do not want that
+ -- type conversion to influence the result of this function.
+
return
Present (Expr)
- and then Nkind (Expr) = N_Explicit_Dereference
+ and then Nkind (Unqual_Conv (Expr)) = N_Explicit_Dereference
and then Nkind (Parent (Expr)) = N_Simple_Return_Statement;
end Is_Related_To_Func_Return;
@@ -9919,6 +9791,24 @@ package body Exp_Util is
Constraints => List_Constr));
end Make_Subtype_From_Expr;
+ -----------------------------
+ -- Make_Variant_Comparison --
+ -----------------------------
+
+ function Make_Variant_Comparison
+ (Loc : Source_Ptr;
+ Mode : Name_Id;
+ Curr_Val : Node_Id;
+ Old_Val : Node_Id) return Node_Id
+ is
+ begin
+ if Mode = Name_Increases then
+ return Make_Op_Gt (Loc, Curr_Val, Old_Val);
+ else pragma Assert (Mode = Name_Decreases);
+ return Make_Op_Lt (Loc, Curr_Val, Old_Val);
+ end if;
+ end Make_Variant_Comparison;
+
---------------
-- Map_Types --
---------------
@@ -10554,37 +10444,8 @@ package body Exp_Util is
-- Unsigned integer cases (includes normal enumeration types)
- elsif Is_Unsigned_Type (Typ) then
- if Siz <= Esize (Standard_Short_Short_Unsigned) then
- return Standard_Short_Short_Unsigned;
- elsif Siz <= Esize (Standard_Short_Unsigned) then
- return Standard_Short_Unsigned;
- elsif Siz <= Esize (Standard_Unsigned) then
- return Standard_Unsigned;
- elsif Siz <= Esize (Standard_Long_Unsigned) then
- return Standard_Long_Unsigned;
- elsif Siz <= Esize (Standard_Long_Long_Unsigned) then
- return Standard_Long_Long_Unsigned;
- else
- raise Program_Error;
- end if;
-
- -- Signed integer cases
-
else
- if Siz <= Esize (Standard_Short_Short_Integer) then
- return Standard_Short_Short_Integer;
- elsif Siz <= Esize (Standard_Short_Integer) then
- return Standard_Short_Integer;
- elsif Siz <= Esize (Standard_Integer) then
- return Standard_Integer;
- elsif Siz <= Esize (Standard_Long_Integer) then
- return Standard_Long_Integer;
- elsif Siz <= Esize (Standard_Long_Long_Integer) then
- return Standard_Long_Long_Integer;
- else
- raise Program_Error;
- end if;
+ return Small_Integer_Type_For (Siz, Is_Unsigned_Type (Typ));
end if;
end Matching_Standard_Type;
@@ -10645,9 +10506,9 @@ package body Exp_Util is
-- initialization, or the object is imported.
-- The same holds for all initialized scalar types and all access types.
- -- Packed bit arrays of size up to 64 are represented using a modular
- -- type with an initialization (to zero) and can be processed like other
- -- initialized scalar types.
+ -- Packed bit array types of size up to the maximum integer size are
+ -- represented using a modular type with an initialization (to zero) and
+ -- can be processed like other initialized scalar types.
-- If the type is controlled, code to attach the object to a
-- finalization chain is generated at the point of declaration, and
@@ -10841,12 +10702,12 @@ package body Exp_Util is
Ptyp : constant Entity_Id := Etype (P);
begin
- -- If we know the component size and it is not larger than 64,
- -- then we are definitely OK. The back end does the assignment
- -- of misaligned small objects correctly.
+ -- If we know the component size and it is not larger than the
+ -- maximum integer size, then we are OK. The back end does the
+ -- assignment of small misaligned objects correctly.
if Known_Static_Component_Size (Ptyp)
- and then Component_Size (Ptyp) <= 64
+ and then Component_Size (Ptyp) <= System_Max_Integer_Size
then
return False;
@@ -11324,6 +11185,14 @@ package body Exp_Util is
and then Is_Class_Wide_Type (Etype (Exp))
then
return;
+
+ -- An expression which is in SPARK mode is considered side effect free
+ -- if the resulting value is captured by a variable or a constant.
+
+ elsif GNATprove_Mode
+ and then Nkind (Parent (Exp)) = N_Object_Declaration
+ then
+ return;
end if;
-- The remaining processing is done with all checks suppressed
@@ -11361,7 +11230,7 @@ package body Exp_Util is
elsif (Is_Elementary_Type (Exp_Type)
or else (Is_Record_Type (Exp_Type)
and then Known_Static_RM_Size (Exp_Type)
- and then RM_Size (Exp_Type) <= 64
+ and then RM_Size (Exp_Type) <= System_Max_Integer_Size
and then not Has_Discriminants (Exp_Type)
and then not Is_By_Reference_Type (Exp_Type)))
and then (Variable_Ref
@@ -11522,7 +11391,26 @@ package body Exp_Util is
Insert_Action (Exp, E);
end if;
- -- For expressions that denote names, we can use a renaming scheme.
+ -- If this is a packed array component or a selected component with a
+ -- nonstandard representation, we cannot generate a reference because
+ -- the component may be unaligned, so we must use a renaming and this
+ -- renaming must be handled by the front end, as the back end may balk
+ -- at the nonstandard representation (see Exp_Ch2.Expand_Renaming).
+
+ elsif Nkind (Exp) in N_Indexed_Component | N_Selected_Component
+ and then Has_Non_Standard_Rep (Etype (Prefix (Exp)))
+ then
+ Def_Id := Build_Temporary (Loc, 'R', Exp);
+ Res := New_Occurrence_Of (Def_Id, Loc);
+
+ Insert_Action (Exp,
+ Make_Object_Renaming_Declaration (Loc,
+ Defining_Identifier => Def_Id,
+ Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
+ Name => Relocate_Node (Exp)));
+
+ -- For an expression that denotes a name, we can use a renaming scheme
+ -- that is handled by the back end, instead of the front end as above.
-- This is needed for correctness in the case of a volatile object of
-- a nonvolatile type because the Make_Reference call of the "default"
-- approach would generate an illegal access value (an access value
@@ -11545,21 +11433,7 @@ package body Exp_Util is
Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
Name => Relocate_Node (Exp)));
- -- If this is a packed reference, or a selected component with
- -- a nonstandard representation, a reference to the temporary
- -- will be replaced by a copy of the original expression (see
- -- Exp_Ch2.Expand_Renaming). Otherwise the temporary must be
- -- elaborated by gigi, and is of course not to be replaced in-line
- -- by the expression it renames, which would defeat the purpose of
- -- removing the side effect.
-
- if Nkind (Exp) in N_Selected_Component | N_Indexed_Component
- and then Has_Non_Standard_Rep (Etype (Prefix (Exp)))
- then
- null;
- else
- Set_Is_Renaming_Of_Object (Def_Id, False);
- end if;
+ Set_Is_Renaming_Of_Object (Def_Id, False);
-- Avoid generating a variable-sized temporary, by generating the
-- reference just for the function call. The transformation could be
@@ -11576,15 +11450,6 @@ package body Exp_Util is
-- Otherwise we generate a reference to the expression
else
- -- An expression which is in SPARK mode is considered side effect
- -- free if the resulting value is captured by a variable or a
- -- constant.
-
- if GNATprove_Mode
- and then Nkind (Parent (Exp)) = N_Object_Declaration
- then
- goto Leave;
-
-- When generating C code we cannot consider side effect free object
-- declarations that have discriminants and are initialized by means
-- of a function call since on this target there is no secondary
@@ -11598,7 +11463,7 @@ package body Exp_Util is
-- be identified here to avoid entering into a never-ending loop
-- generating internal object declarations.
- elsif Modify_Tree_For_C
+ if Modify_Tree_For_C
and then Nkind (Parent (Exp)) = N_Object_Declaration
and then
(Nkind (Exp) /= N_Function_Call
@@ -13522,6 +13387,62 @@ package body Exp_Util is
Reason => CE_Range_Check_Failed));
end Silly_Boolean_Array_Xor_Test;
+ ----------------------------
+ -- Small_Integer_Type_For --
+ ----------------------------
+
+ function Small_Integer_Type_For (S : Uint; Uns : Boolean) return Entity_Id
+ is
+ begin
+ pragma Assert (S <= System_Max_Integer_Size);
+
+ if S <= Standard_Short_Short_Integer_Size then
+ if Uns then
+ return Standard_Short_Short_Unsigned;
+ else
+ return Standard_Short_Short_Integer;
+ end if;
+
+ elsif S <= Standard_Short_Integer_Size then
+ if Uns then
+ return Standard_Short_Unsigned;
+ else
+ return Standard_Short_Integer;
+ end if;
+
+ elsif S <= Standard_Integer_Size then
+ if Uns then
+ return Standard_Unsigned;
+ else
+ return Standard_Integer;
+ end if;
+
+ elsif S <= Standard_Long_Integer_Size then
+ if Uns then
+ return Standard_Long_Unsigned;
+ else
+ return Standard_Long_Integer;
+ end if;
+
+ elsif S <= Standard_Long_Long_Integer_Size then
+ if Uns then
+ return Standard_Long_Long_Unsigned;
+ else
+ return Standard_Long_Long_Integer;
+ end if;
+
+ elsif S <= Standard_Long_Long_Long_Integer_Size then
+ if Uns then
+ return Standard_Long_Long_Long_Unsigned;
+ else
+ return Standard_Long_Long_Long_Integer;
+ end if;
+
+ else
+ raise Program_Error;
+ end if;
+ end Small_Integer_Type_For;
+
--------------------------
-- Target_Has_Fixed_Ops --
--------------------------
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 3f882a6..37eb86f 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -427,11 +427,6 @@ package Exp_Util is
-- for trouble using this function and, if so, the assignment is expanded
-- component-wise, which the back end is required to handle correctly.
- function Containing_Package_With_Ext_Axioms
- (E : Entity_Id) return Entity_Id;
- -- Returns the package entity with an external axiomatization containing E,
- -- if any, or Empty if none.
-
procedure Convert_To_Actual_Subtype (Exp : Node_Id);
-- The Etype of an expression is the nominal type of the expression,
-- not the actual subtype. Often these are the same, but not always.
@@ -687,10 +682,6 @@ package Exp_Util is
-- of entity E, in all upper case, with an ASCII.NUL appended at the end
-- of the name if Append_NUL is True.
- procedure Generate_Poll_Call (N : Node_Id);
- -- If polling is active, then a call to the Poll routine is built,
- -- and then inserted before the given node N and analyzed.
-
procedure Get_Current_Value_Condition
(Var : Node_Id;
Op : out Node_Kind;
@@ -734,12 +725,6 @@ package Exp_Util is
function Has_Access_Constraint (E : Entity_Id) return Boolean;
-- Given object or type E, determine if a discriminant is of an access type
- function Has_Annotate_Pragma_For_External_Axiomatization
- (E : Entity_Id) return Boolean;
- -- Returns whether E is a package entity, for which the initial list of
- -- pragmas at the start of the package declaration contains
- -- pragma Annotate (GNATprove, External_Axiomatization);
-
function Homonym_Number (Subp : Entity_Id) return Pos;
-- Here subp is the entity for a subprogram. This routine returns the
-- homonym number used to disambiguate overloaded subprograms in the same
@@ -761,6 +746,10 @@ package Exp_Util is
-- unconditionally executed, i.e. it is not within a loop or a conditional
-- or a case statement etc.
+ function Integer_Type_For (S : Uint; Uns : Boolean) return Entity_Id;
+ -- Return a suitable standard integer type containing at least S bits and
+ -- of the signedness given by Uns.
+
function Is_All_Null_Statements (L : List_Id) return Boolean;
-- Return True if all the items of the list are N_Null_Statement nodes.
-- False otherwise. True for an empty list. It is an error to call this
@@ -910,6 +899,15 @@ package Exp_Util is
-- wide type. Set Related_Id to request an external name for the subtype
-- rather than an internal temporary.
+ function Make_Variant_Comparison
+ (Loc : Source_Ptr;
+ Mode : Name_Id;
+ Curr_Val : Node_Id;
+ Old_Val : Node_Id) return Node_Id;
+ -- Subsidiary to the expansion of pragmas Loop_Variant and
+ -- Subprogram_Variant. Generate a comparison between Curr_Val and Old_Val
+ -- depending on the variant mode (Increases / Decreases).
+
procedure Map_Types (Parent_Type : Entity_Id; Derived_Type : Entity_Id);
-- Establish the following mapping between the attributes of tagged parent
-- type Parent_Type and tagged derived type Derived_Type.
@@ -982,6 +980,11 @@ package Exp_Util is
-- If so, returns the value K, otherwise returns zero. The caller checks
-- that N is of an integer type.
+ function Predicate_Check_In_Scope (N : Node_Id) return Boolean;
+ -- Return True if predicate checks should be generated in the current
+ -- scope on the given node. Will return False for example when the current
+ -- scope is a predefined primitive operation.
+
procedure Process_Statements_For_Controlled_Objects (N : Node_Id);
-- N is a node which contains a non-handled statement list. Inspect the
-- statements looking for declarations of controlled objects. If at least
@@ -1165,6 +1168,10 @@ package Exp_Util is
-- True..True, where a raise of a Constraint_Error exception is required
-- (RM 4.5.6(6)) and ACATS-tested.
+ function Small_Integer_Type_For (S : Uint; Uns : Boolean) return Entity_Id;
+ -- Return the smallest standard integer type containing at least S bits and
+ -- of the signedness given by Uns.
+
function Target_Has_Fixed_Ops
(Left_Typ : Entity_Id;
Right_Typ : Entity_Id;
@@ -1195,11 +1202,6 @@ package Exp_Util is
function Within_Case_Or_If_Expression (N : Node_Id) return Boolean;
-- Determine whether arbitrary node N is within a case or an if expression
- function Predicate_Check_In_Scope (N : Node_Id) return Boolean;
- -- Return True if predicate checks should be generated in the current
- -- scope on the given node. Will return False for example when the current
- -- scope is a predefined primitive operation.
-
private
pragma Inline (Duplicate_Subexpr);
pragma Inline (Force_Evaluation);
diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb
index b8e86b8..d6219f4 100644
--- a/gcc/ada/expander.adb
+++ b/gcc/ada/expander.adb
@@ -273,9 +273,6 @@ package body Expander is
when N_Generic_Instantiation =>
Expand_N_Generic_Instantiation (N);
- when N_Goto_Statement =>
- Expand_N_Goto_Statement (N);
-
when N_Handled_Sequence_Of_Statements =>
Expand_N_Handled_Sequence_Of_Statements (N);
diff --git a/gcc/ada/fmap.adb b/gcc/ada/fmap.adb
index a5ae66e..40aeef1 100644
--- a/gcc/ada/fmap.adb
+++ b/gcc/ada/fmap.adb
@@ -162,12 +162,12 @@ package body Fmap is
function Hash (F : File_Name_Type) return Header_Num is
begin
- return Header_Num (Int (F) rem Header_Num'Range_Length);
+ return Header_Num (Int (F) mod Header_Num'Range_Length);
end Hash;
function Hash (F : Unit_Name_Type) return Header_Num is
begin
- return Header_Num (Int (F) rem Header_Num'Range_Length);
+ return Header_Num (Int (F) mod Header_Num'Range_Length);
end Hash;
----------------
diff --git a/gcc/ada/fname-uf.adb b/gcc/ada/fname-uf.adb
index 97d3b7b..48e2bc2 100644
--- a/gcc/ada/fname-uf.adb
+++ b/gcc/ada/fname-uf.adb
@@ -598,7 +598,7 @@ package body Fname.UF is
function SFN_Hash (F : Unit_Name_Type) return SFN_Header_Num is
begin
- return SFN_Header_Num (Int (F) rem SFN_Header_Num'Range_Length);
+ return SFN_Header_Num (Int (F) mod SFN_Header_Num'Range_Length);
end SFN_Hash;
begin
diff --git a/gcc/ada/fname.adb b/gcc/ada/fname.adb
index ad316eb..67d05e2 100644
--- a/gcc/ada/fname.adb
+++ b/gcc/ada/fname.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -140,11 +134,13 @@ package body Fname is
Renamings_Included : Boolean := True) return Boolean
is
begin
- -- Definitely false if longer than 12 characters (8.3)
- -- except for the Interfaces packages
+ -- Definitely false if longer than 12 characters (8.3), except for the
+ -- Interfaces packages and also the implementation units of the 128-bit
+ -- types under System.
if Fname'Length > 12
and then Fname (Fname'First .. Fname'First + 1) /= "i-"
+ and then Fname (Fname'First .. Fname'First + 1) /= "s-"
then
return False;
end if;
diff --git a/gcc/ada/fname.ads b/gcc/ada/fname.ads
index 06a77f1..7790fbf 100644
--- a/gcc/ada/fname.ads
+++ b/gcc/ada/fname.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 1c177b1..f3abba1 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -80,8 +80,8 @@ package body Freeze is
-- Typ is a type that is being frozen. If no size clause is given,
-- but a default Esize has been computed, then this default Esize is
-- adjusted up if necessary to be consistent with a given alignment,
- -- but never to a value greater than Long_Long_Integer'Size. This
- -- is used for all discrete types and for fixed-point types.
+ -- but never to a value greater than System_Max_Integer_Size. This is
+ -- used for all discrete types and for fixed-point types.
procedure Build_And_Analyze_Renamed_Body
(Decl : Node_Id;
@@ -182,6 +182,12 @@ package body Freeze is
-- the designated type. Otherwise freezing the access type does not freeze
-- the designated type.
+ function Is_Uninitialized_Aggregate (N : Node_Id) return Boolean;
+ -- Determine whether an array aggregate used in an object declaration
+ -- is uninitialized, when the aggregate is declared with a box and
+ -- the component type has no default value. Such an aggregate can be
+ -- optimized away and prevent the copying of uninitialized data.
+
procedure Process_Default_Expressions
(E : Entity_Id;
After : in out Node_Id);
@@ -231,9 +237,7 @@ package body Freeze is
if Known_Esize (Typ) and then Known_Alignment (Typ) then
Align := Alignment_In_Bits (Typ);
- if Align > Esize (Typ)
- and then Align <= Standard_Long_Long_Integer_Size
- then
+ if Align > Esize (Typ) and then Align <= System_Max_Integer_Size then
Set_Esize (Typ, Align);
end if;
end if;
@@ -636,7 +640,7 @@ package body Freeze is
-- If Rep_Clauses are to be ignored, remove address clause from
-- list attached to entity, because it may be illegal for gigi,
- -- for example by breaking order of elaboration..
+ -- for example by breaking order of elaboration.
if Ignore_Rep_Clauses then
declare
@@ -720,7 +724,14 @@ package body Freeze is
-- expansion elsewhere. This exception is necessary to avoid copying
-- limited objects.
- if Present (Init) and then not Is_Limited_View (Typ) then
+ if Present (Init)
+ and then not Is_Limited_View (Typ)
+ then
+ if Is_Uninitialized_Aggregate (Init) then
+ Init := Empty;
+ Set_No_Initialization (Decl);
+ return;
+ end if;
-- Capture initialization value at point of declaration, and make
-- explicit assignment legal, because object may be a constant.
@@ -758,9 +769,8 @@ package body Freeze is
procedure Check_Compile_Time_Size (T : Entity_Id) is
procedure Set_Small_Size (T : Entity_Id; S : Uint);
- -- Sets the compile time known size (64 bits or less) in the RM_Size
- -- field of T, checking for a size clause that was given which attempts
- -- to give a smaller size.
+ -- Sets the compile time known size in the RM_Size field of T, checking
+ -- for a size clause that was given which attempts to give a small size.
function Size_Known (T : Entity_Id) return Boolean;
-- Recursive function that does all the work
@@ -778,7 +788,7 @@ package body Freeze is
procedure Set_Small_Size (T : Entity_Id; S : Uint) is
begin
- if S > 64 then
+ if S > System_Max_Integer_Size then
return;
-- Check for bad size clause given
@@ -848,7 +858,8 @@ package body Freeze is
end if;
-- Check for all indexes static, and also compute possible size
- -- (in case it is not greater than 64 and may be packable).
+ -- (in case it is not greater than System_Max_Integer_Size and
+ -- thus may be packable).
declare
Size : Uint := Component_Size (T);
@@ -1077,8 +1088,7 @@ package body Freeze is
-- We can deal with elementary types, small packed arrays
-- if the representation is a modular type and also small
- -- record types (if the size is not greater than 64, but
- -- the condition is checked by Set_Small_Size).
+ -- record types as checked by Set_Small_Size.
if Is_Elementary_Type (Ctyp)
or else (Is_Array_Type (Ctyp)
@@ -1610,7 +1620,10 @@ package body Freeze is
Comp : Entity_Id;
begin
- if Is_By_Reference_Type (E) then
+ -- Bit-packed array types do not require strict alignment, even if they
+ -- are by-reference types, because they are accessed in a special way.
+
+ if Is_By_Reference_Type (E) and then not Is_Bit_Packed_Array (E) then
Set_Strict_Alignment (E);
elsif Is_Array_Type (E) then
@@ -1724,11 +1737,11 @@ package body Freeze is
end loop;
end Check_Unsigned_Type;
- -----------------------------
- -- Is_Atomic_VFA_Aggregate --
- -----------------------------
+ ------------------------------
+ -- Is_Full_Access_Aggregate --
+ ------------------------------
- function Is_Atomic_VFA_Aggregate (N : Node_Id) return Boolean is
+ function Is_Full_Access_Aggregate (N : Node_Id) return Boolean is
Loc : constant Source_Ptr := Sloc (N);
New_N : Node_Id;
Par : Node_Id;
@@ -1752,9 +1765,9 @@ package body Freeze is
when N_Assignment_Statement =>
Typ := Etype (Name (Par));
- if not Is_Atomic_Or_VFA (Typ)
+ if not Is_Full_Access (Typ)
and then not (Is_Entity_Name (Name (Par))
- and then Is_Atomic_Or_VFA (Entity (Name (Par))))
+ and then Is_Full_Access (Entity (Name (Par))))
then
return False;
end if;
@@ -1762,8 +1775,8 @@ package body Freeze is
when N_Object_Declaration =>
Typ := Etype (Defining_Identifier (Par));
- if not Is_Atomic_Or_VFA (Typ)
- and then not Is_Atomic_Or_VFA (Defining_Identifier (Par))
+ if not Is_Full_Access (Typ)
+ and then not Is_Full_Access (Defining_Identifier (Par))
then
return False;
end if;
@@ -1784,7 +1797,7 @@ package body Freeze is
Set_Expression (Par, New_Occurrence_Of (Temp, Loc));
return True;
- end Is_Atomic_VFA_Aggregate;
+ end Is_Full_Access_Aggregate;
-----------------------------------------------
-- Explode_Initialization_Compound_Statement --
@@ -2202,7 +2215,7 @@ package body Freeze is
-- generated a message on the template.
procedure Check_Suspicious_Modulus (Utype : Entity_Id);
- -- Give warning for modulus of 8, 16, 32, or 64 given as an explicit
+ -- Give warning for modulus of 8, 16, 32, 64 or 128 given as an explicit
-- integer literal without an explicit corresponding size clause. The
-- caller has checked that Utype is a modular integer type.
@@ -2626,12 +2639,12 @@ package body Freeze is
end;
end if;
- -- Check for Aliased or Atomic_Components/Atomic/VFA with
+ -- Check for Aliased or Atomic_Components or Full Access with
-- unsuitable packing or explicit component size clause given.
if (Has_Aliased_Components (Arr)
or else Has_Atomic_Components (Arr)
- or else Is_Atomic_Or_VFA (Ctyp))
+ or else Is_Full_Access (Ctyp))
and then
(Has_Component_Size_Clause (Arr) or else Is_Packed (Arr))
then
@@ -2639,8 +2652,8 @@ package body Freeze is
procedure Complain_CS (T : String);
-- Outputs error messages for incorrect CS clause or pragma
- -- Pack for aliased or atomic/VFA components (T is "aliased"
- -- or "atomic/vfa");
+ -- Pack for aliased or full access components (T is either
+ -- "aliased" or "atomic" or "volatile full access");
-----------------
-- Complain_CS --
@@ -2831,7 +2844,7 @@ package body Freeze is
-- Case of component size that may result in bit packing
- if 1 <= Csiz and then Csiz <= 64 then
+ if 1 <= Csiz and then Csiz <= System_Max_Integer_Size then
declare
Ent : constant Entity_Id :=
First_Subtype (Arr);
@@ -2894,7 +2907,7 @@ package body Freeze is
end if;
end if;
- -- Bit packing is never needed for 8, 16, 32, 64
+ -- Bit packing is never needed for 8, 16, 32, 64 or 128
if Addressable (Csiz) then
@@ -3177,9 +3190,9 @@ package body Freeze is
procedure Check_Large_Modular_Array (Typ : Entity_Id);
-- Check that the size of array type Typ can be computed without
-- overflow, and generates a Storage_Error otherwise. This is only
- -- relevant for array types whose index is a (mod 2**64) type, where
- -- wrap-around arithmetic might yield a meaningless value for the
- -- length of the array, or its corresponding attribute.
+ -- relevant for array types whose index has System_Max_Integer_Size
+ -- bits, where wrap-around arithmetic might yield a meaningless value
+ -- for the length of the array, or its corresponding attribute.
procedure Check_Pragma_Thread_Local_Storage (Var_Id : Entity_Id);
-- Ensure that the initialization state of variable Var_Id subject
@@ -5505,11 +5518,11 @@ package body Freeze is
-- than component-wise (the assignment to the temp may be done
-- component-wise, but that is harmless).
- elsif Is_Atomic_Or_VFA (E)
+ elsif Is_Full_Access (E)
and then Nkind (Parent (E)) = N_Object_Declaration
and then Present (Expression (Parent (E)))
and then Nkind (Expression (Parent (E))) = N_Aggregate
- and then Is_Atomic_VFA_Aggregate (Expression (Parent (E)))
+ and then Is_Full_Access_Aggregate (Expression (Parent (E)))
then
null;
end if;
@@ -5810,7 +5823,7 @@ package body Freeze is
and then not Has_Pragma_Pack (E)
and then not Has_Component_Size_Clause (E)
and then Known_Static_RM_Size (Ctyp)
- and then Rsiz <= 64
+ and then Rsiz <= System_Max_Integer_Size
and then not (Addressable (Rsiz)
and then Known_Static_Esize (Ctyp)
and then Esize (Ctyp) = Rsiz)
@@ -6387,7 +6400,7 @@ package body Freeze is
end if;
-- The pool applies to named and anonymous access types, but not
- -- to subprogram and to internal types generated for 'Access
+ -- to subprogram and to internal types generated for 'Access
-- references.
elsif Is_Access_Type (E)
@@ -6412,6 +6425,11 @@ package body Freeze is
if Nkind (Default_Pool) = N_Null then
Set_No_Pool_Assigned (E);
+ -- Case of pragma Default_Storage_Pool (Standard)
+
+ elsif Entity (Default_Pool) = Standard_Standard then
+ Set_Associated_Storage_Pool (E, RTE (RE_Global_Pool_Object));
+
-- Case of pragma Default_Storage_Pool (storage_pool_NAME)
else
@@ -6826,7 +6844,7 @@ package body Freeze is
end if;
-- If the type has a Defaut_Value/Default_Component_Value aspect,
- -- this is where we analye the expression (after the type is frozen,
+ -- this is where we analyze the expression (after the type is frozen,
-- since in the case of Default_Value, we are analyzing with the
-- type itself, and we treat Default_Component_Value similarly for
-- the sake of uniformity).
@@ -7990,19 +8008,19 @@ package body Freeze is
if Nkind (Node) in N_Has_Etype
and then Present (Etype (Node))
and then Is_Access_Type (Etype (Node))
- and then Nkind (Parent (Node)) = N_Function_Call
- and then Node = Controlling_Argument (Parent (Node))
then
- Check_And_Freeze_Type (Designated_Type (Etype (Node)));
+ if Nkind (Parent (Node)) = N_Function_Call
+ and then Node = Controlling_Argument (Parent (Node))
+ then
+ Check_And_Freeze_Type (Designated_Type (Etype (Node)));
- -- An explicit dereference freezes the designated type as well,
- -- even though that type is not attached to an entity in the
- -- expression.
+ -- An explicit dereference freezes the designated type as well,
+ -- even though that type is not attached to an entity in the
+ -- expression.
- elsif Nkind (Node) in N_Has_Etype
- and then Nkind (Parent (Node)) = N_Explicit_Dereference
- then
- Check_And_Freeze_Type (Designated_Type (Etype (Node)));
+ elsif Nkind (Parent (Node)) = N_Explicit_Dereference then
+ Check_And_Freeze_Type (Designated_Type (Etype (Node)));
+ end if;
-- An iterator specification freezes the iterator type, even though
-- that type is not attached to an entity in the construct.
@@ -8494,21 +8512,21 @@ package body Freeze is
Set_Analyzed (Lo, False);
Analyze (Lo);
- -- Resolve with universal fixed if the base type, and the base type if
- -- it is a subtype. Note we can't resolve the base type with itself,
- -- that would be a reference before definition.
+ -- Resolve with universal fixed if the base type, and with the base
+ -- type if we are freezing a subtype. Note we can't resolve the base
+ -- type with itself, that would be a reference before definition.
+ -- The resolution of the bounds of a subtype, if they are given by real
+ -- literals, includes the setting of the Corresponding_Integer_Value,
+ -- as for other literals of a fixed-point type.
if Typ = Btyp then
Resolve (Lo, Universal_Fixed);
+ Set_Corresponding_Integer_Value
+ (Lo, UR_To_Uint (Realval (Lo) / Small));
else
Resolve (Lo, Btyp);
end if;
- -- Set corresponding integer value for bound
-
- Set_Corresponding_Integer_Value
- (Lo, UR_To_Uint (Realval (Lo) / Small));
-
-- Similar processing for high bound
Set_Etype (Hi, Empty);
@@ -8517,13 +8535,12 @@ package body Freeze is
if Typ = Btyp then
Resolve (Hi, Universal_Fixed);
+ Set_Corresponding_Integer_Value
+ (Hi, UR_To_Uint (Realval (Hi) / Small));
else
Resolve (Hi, Btyp);
end if;
- Set_Corresponding_Integer_Value
- (Hi, UR_To_Uint (Realval (Hi) / Small));
-
-- Set type of range to correspond to bounds
Set_Etype (Rng, Etype (Lo));
@@ -9127,6 +9144,40 @@ package body Freeze is
end if;
end Freeze_Subprogram;
+ --------------------------------
+ -- Is_Uninitialized_Aggregate --
+ --------------------------------
+
+ function Is_Uninitialized_Aggregate (N : Node_Id) return Boolean is
+ Aggr : constant Node_Id := Original_Node (N);
+ Typ : constant Entity_Id := Etype (Aggr);
+
+ Comp : Node_Id;
+ Comp_Type : Entity_Id;
+ begin
+ if Nkind (Aggr) /= N_Aggregate
+ or else No (Typ)
+ or else Ekind (Typ) /= E_Array_Type
+ or else Present (Expressions (Aggr))
+ or else No (Component_Associations (Aggr))
+ then
+ return False;
+ else
+ Comp_Type := Component_Type (Typ);
+ Comp := First (Component_Associations (Aggr));
+
+ if not Box_Present (Comp)
+ or else Present (Next (Comp))
+ then
+ return False;
+ end if;
+
+ return Is_Scalar_Type (Comp_Type)
+ and then No (Default_Aspect_Component_Value (Typ))
+ and then No (Default_Aspect_Value (Comp_Type));
+ end if;
+ end Is_Uninitialized_Aggregate;
+
----------------------
-- Is_Fully_Defined --
----------------------
diff --git a/gcc/ada/freeze.ads b/gcc/ada/freeze.ads
index 56061a07..448d1ed 100644
--- a/gcc/ada/freeze.ads
+++ b/gcc/ada/freeze.ads
@@ -152,15 +152,15 @@ package Freeze is
-- occur.
--
-- Size is known at compile time, but the actual value of the size is not
- -- known to the front end or is definitely greater than 64. In this case,
- -- Size_Known_At_Compile_Time is set, but the RM_Size field is left set
- -- to zero (to be set by Gigi).
+ -- known to the front end or is greater than System_Max_Integer_Size. In
+ -- this case, Size_Known_At_Compile_Time is set, but the RM_Size field is
+ -- left set to zero (to be set by Gigi).
--
-- Size is known at compile time, and the actual value of the size is
- -- known to the front end and is not greater than 64. In this case, the
- -- flag Size_Known_At_Compile_Time is set, and in addition RM_Size is set
- -- to the required size, allowing for possible front end packing of an
- -- array using this type as a component type.
+ -- known to the front end and not greater than System_Max_Integer_Size.
+ -- In this case, Size_Known_At_Compile_Time is set, and in addition the
+ -- RM_Size field is set to the required size, allowing for possible front
+ -- end packing of an array using this type as a component type.
--
-- Note: the flag Size_Known_At_Compile_Time is used to determine if the
-- secondary stack must be used to return a value of the type, and also
@@ -174,8 +174,8 @@ package Freeze is
-- do not allow a size clause if the size would not otherwise be known at
-- compile time in any case.
- function Is_Atomic_VFA_Aggregate (N : Node_Id) return Boolean;
- -- If an atomic/VFA object is initialized with an aggregate or is assigned
+ function Is_Full_Access_Aggregate (N : Node_Id) return Boolean;
+ -- If a full access object is initialized with an aggregate or is assigned
-- an aggregate, we have to prevent a piecemeal access or assignment to the
-- object, even if the aggregate is to be expanded. We create a temporary
-- for the aggregate, and assign the temporary instead, so that the back
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 7d2ea52..78fe602 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -68,7 +68,7 @@ ALL_ADAFLAGS = \
$(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) $(CHECKING_ADAFLAGS) $(WARN_ADAFLAGS)
FORCE_DEBUG_ADAFLAGS = -g
ADA_CFLAGS =
-ADA_INCLUDES = -nostdinc -I- -I. -Iada/generated -Iada -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface -Iada/libgnat -I$(srcdir)/ada/libgnat
+ADA_INCLUDES = -nostdinc -I- -I. -Iada/generated -Iada -Iada/gcc-interface -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface -Iada/libgnat -I$(srcdir)/ada/libgnat
GNATLIBFLAGS= -W -Wall -gnatpg -nostdinc
GNATLIBCFLAGS= -g -O2 $(TCFLAGS)
ADA_INCLUDE_DIR = $(libsubdir)/adainclude
@@ -327,6 +327,7 @@ GNAT_ADA_OBJS = \
ada/libgnat/g-u3spch.o \
ada/get_targ.o \
ada/ghost.o \
+ ada/gnat_cuda.o \
ada/libgnat/gnat.o \
ada/gnatvsn.o \
ada/hostparm.o \
@@ -469,7 +470,7 @@ GNAT_ADA_OBJS = \
ada/stylesw.o \
ada/switch-c.o \
ada/switch.o \
- ada/libgnat/system.o \
+ ada/gcc-interface/system.o \
ada/table.o \
ada/targparm.o \
ada/tbuild.o \
@@ -627,7 +628,7 @@ GNATBIND_OBJS = \
ada/stylesw.o \
ada/switch-b.o \
ada/switch.o \
- ada/libgnat/system.o \
+ ada/gcc-interface/system.o \
ada/table.o \
ada/targext.o \
ada/targparm.o \
@@ -1038,8 +1039,9 @@ ada/sdefault.o : ada/libgnat/ada.ads ada/libgnat/a-except.ads ada/libgnat/a-uncc
ada/libgnat/s-exctab.ads ada/libgnat/s-memory.ads ada/libgnat/s-os_lib.ads ada/libgnat/s-parame.ads \
ada/libgnat/s-stalib.ads ada/libgnat/s-strops.ads ada/libgnat/s-sopco3.ads ada/libgnat/s-sopco4.ads \
ada/libgnat/s-sopco5.ads ada/libgnat/s-string.ads ada/libgnat/s-traent.ads ada/libgnat/s-unstyp.ads \
- ada/libgnat/s-wchcon.ads ada/libgnat/system.ads ada/table.adb ada/table.ads \
- ada/types.ads ada/libgnat/unchdeal.ads ada/libgnat/unchconv.ads
+ ada/libgnat/s-wchcon.ads ada/table.adb ada/table.ads \
+ ada/types.ads ada/libgnat/unchdeal.ads ada/libgnat/unchconv.ads \
+ ada/gcc-interface/system.ads
# Special flags - see gcc-interface/Makefile.in for the template.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index c9c2a95..4e6dc84 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -232,7 +232,7 @@ static tree build_position_list (tree, bool, tree, tree, unsigned int, tree);
static vec<subst_pair> build_subst_list (Entity_Id, Entity_Id, bool);
static vec<variant_desc> build_variant_list (tree, Node_Id, vec<subst_pair>,
vec<variant_desc>);
-static tree maybe_saturate_size (tree);
+static tree maybe_saturate_size (tree, unsigned int align);
static tree validate_size (Uint, tree, Entity_Id, enum tree_code, bool, bool,
const char *, const char *);
static void set_rm_size (Uint, tree, Entity_Id);
@@ -896,13 +896,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
gnu_size = bitsize_unit_node;
/* If this is an object with no specified size and alignment, and
- if either it is atomic or we are not optimizing alignment for
+ if either it is full access or we are not optimizing alignment for
space and it is composite and not an exception, an Out parameter
or a reference to another object, and the size of its type is a
constant, set the alignment to the smallest one which is not
smaller than the size, with an appropriate cap. */
if (!gnu_size && align == 0
- && (Is_Atomic_Or_VFA (gnat_entity)
+ && (Is_Full_Access (gnat_entity)
|| (!Optimize_Alignment_Space (gnat_entity)
&& kind != E_Exception
&& kind != E_Out_Parameter
@@ -1014,7 +1014,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
}
/* Now check if the type of the object allows atomic access. */
- if (Is_Atomic_Or_VFA (gnat_entity))
+ if (Is_Full_Access (gnat_entity))
check_ok_for_atomic_type (gnu_type, gnat_entity, false);
/* If this is a renaming, avoid as much as possible to create a new
@@ -2876,7 +2876,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
{
const int quals
= TYPE_QUAL_VOLATILE
- | (Is_Atomic_Or_VFA (gnat_entity) ? TYPE_QUAL_ATOMIC : 0);
+ | (Is_Full_Access (gnat_entity) ? TYPE_QUAL_ATOMIC : 0);
gnu_type = change_qualified_type (gnu_type, quals);
}
/* Make it artificial only if the base type was artificial too.
@@ -4362,12 +4362,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
gnat_entity);
}
}
- else if (Is_Atomic_Or_VFA (gnat_entity) && !gnu_size
+ else if (Is_Full_Access (gnat_entity) && !gnu_size
&& tree_fits_uhwi_p (TYPE_SIZE (gnu_type))
&& integer_pow2p (TYPE_SIZE (gnu_type)))
align = MIN (BIGGEST_ALIGNMENT,
tree_to_uhwi (TYPE_SIZE (gnu_type)));
- else if (Is_Atomic_Or_VFA (gnat_entity) && gnu_size
+ else if (Is_Full_Access (gnat_entity) && gnu_size
&& tree_fits_uhwi_p (gnu_size)
&& integer_pow2p (gnu_size))
align = MIN (BIGGEST_ALIGNMENT, tree_to_uhwi (gnu_size));
@@ -4425,7 +4425,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
/* If the size is self-referential, annotate the maximum value
after saturating it, if need be, to avoid a No_Uint value. */
if (CONTAINS_PLACEHOLDER_P (gnu_size))
- gnu_size = maybe_saturate_size (max_size (gnu_size, true));
+ {
+ const unsigned int align
+ = UI_To_Int (Alignment (gnat_entity)) * BITS_PER_UNIT;
+ gnu_size
+ = maybe_saturate_size (max_size (gnu_size, true), align);
+ }
/* If we are just annotating types and the type is tagged, the tag
and the parent components are not generated by the front-end so
@@ -4461,7 +4466,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
gnu_size = size_binop (PLUS_EXPR, gnu_size, offset);
}
- gnu_size = maybe_saturate_size (round_up (gnu_size, align));
+ gnu_size
+ = maybe_saturate_size (round_up (gnu_size, align), align);
Set_Esize (gnat_entity, annotate_value (gnu_size));
/* Tagged types are Strict_Alignment so RM_Size = Esize. */
@@ -4597,7 +4603,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
}
/* Now check if the type allows atomic access. */
- if (Is_Atomic_Or_VFA (gnat_entity))
+ if (Is_Full_Access (gnat_entity))
check_ok_for_atomic_type (gnu_type, gnat_entity, false);
/* If this is not an unconstrained array type, set some flags. */
@@ -4715,7 +4721,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
{
const int quals
= TYPE_QUAL_VOLATILE
- | (Is_Atomic_Or_VFA (gnat_entity) ? TYPE_QUAL_ATOMIC : 0);
+ | (Is_Full_Access (gnat_entity) ? TYPE_QUAL_ATOMIC : 0);
gnu_type = change_qualified_type (gnu_type, quals);
}
@@ -5244,7 +5250,7 @@ gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition,
}
/* Now check if the type of the component allows atomic access. */
- if (Has_Atomic_Components (gnat_array) || Is_Atomic_Or_VFA (gnat_type))
+ if (Has_Atomic_Components (gnat_array) || Is_Full_Access (gnat_type))
check_ok_for_atomic_type (gnu_type, gnat_array, true);
/* If the component type is a padded type made for a non-bit-packed array
@@ -7099,9 +7105,9 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
const Entity_Id gnat_field_type = Etype (gnat_field);
tree gnu_field_type = gnat_to_gnu_type (gnat_field_type);
tree gnu_field_id = get_entity_name (gnat_field);
- const bool is_atomic
- = (Is_Atomic_Or_VFA (gnat_field) || Is_Atomic_Or_VFA (gnat_field_type));
const bool is_aliased = Is_Aliased (gnat_field);
+ const bool is_full_access
+ = (Is_Full_Access (gnat_field) || Is_Full_Access (gnat_field_type));
const bool is_independent
= (Is_Independent (gnat_field) || Is_Independent (gnat_field_type));
const bool is_volatile
@@ -7116,7 +7122,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
only constraint is the implementation advice whereby only the bits of
the components should be accessed if they both start and end on byte
boundaries, but that should be guaranteed by the GCC memory model.
- Note that we have some redundancies (is_atomic => is_independent,
+ Note that we have some redundancies (is_full_access => is_independent,
is_aliased => is_independent and is_by_ref => is_strict_alignment)
so the following formula is sufficient. */
const bool needs_strict_alignment = (is_independent || is_strict_alignment);
@@ -7125,10 +7131,16 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
bool is_bitfield;
/* The qualifier to be used in messages. */
- if (is_atomic)
- field_s = "atomic&";
- else if (is_aliased)
+ if (is_aliased)
field_s = "aliased&";
+ else if (is_full_access)
+ {
+ if (Is_Volatile_Full_Access (gnat_field)
+ || Is_Volatile_Full_Access (gnat_field_type))
+ field_s = "volatile full access&";
+ else
+ field_s = "atomic&";
+ }
else if (is_independent)
field_s = "independent&";
else if (is_by_ref)
@@ -7139,7 +7151,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
field_s = "&";
/* The message to be used for incompatible size. */
- if (is_atomic || is_aliased)
+ if (is_aliased || is_full_access)
size_s = "size for %s must be ^";
else if (field_s)
size_s = "size for %s too small{, minimum allowed is ^}";
@@ -7231,7 +7243,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
}
/* Now check if the type of the field allows atomic access. */
- if (Is_Atomic_Or_VFA (gnat_field))
+ if (Is_Full_Access (gnat_field))
{
const unsigned int align
= promote_object_alignment (gnu_field_type, gnat_field);
@@ -7327,7 +7339,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
/* If the size is lower than that of the type, or greater for
atomic and aliased, then error out and reset the size. */
else if ((cmp = tree_int_cst_compare (gnu_size, type_size)) < 0
- || (cmp > 0 && (is_atomic || is_aliased)))
+ || (cmp > 0 && (is_aliased || is_full_access)))
{
char s[128];
snprintf (s, sizeof (s), size_s, field_s);
@@ -8946,15 +8958,21 @@ build_variant_list (tree gnu_qual_union_type, Node_Id gnat_variant_part,
}
/* If SIZE has overflowed, return the maximum valid size, which is the upper
- bound of the signed sizetype in bits; otherwise return SIZE unmodified. */
+ bound of the signed sizetype in bits, rounded down to ALIGN. Otherwise
+ return SIZE unmodified. */
static tree
-maybe_saturate_size (tree size)
+maybe_saturate_size (tree size, unsigned int align)
{
if (TREE_CODE (size) == INTEGER_CST && TREE_OVERFLOW (size))
- size = size_binop (MULT_EXPR,
- fold_convert (bitsizetype, TYPE_MAX_VALUE (ssizetype)),
- build_int_cst (bitsizetype, BITS_PER_UNIT));
+ {
+ size
+ = size_binop (MULT_EXPR,
+ fold_convert (bitsizetype, TYPE_MAX_VALUE (ssizetype)),
+ build_int_cst (bitsizetype, BITS_PER_UNIT));
+ size = round_down (size, align);
+ }
+
return size;
}
@@ -9266,8 +9284,8 @@ promote_object_alignment (tree gnu_type, Entity_Id gnat_entity)
the NRV optimization for it. No point in jumping through all the hoops
needed in order to support BIGGEST_ALIGNMENT if we don't really have to.
So we cap to the smallest alignment that corresponds to a known efficient
- memory access pattern, except for Atomic and Volatile_Full_Access. */
- if (Is_Atomic_Or_VFA (gnat_entity))
+ memory access pattern, except for a full access entity. */
+ if (Is_Full_Access (gnat_entity))
{
size_cap = UINT_MAX;
align_cap = BIGGEST_ALIGNMENT;
diff --git a/gcc/ada/libgnat/system.ads b/gcc/ada/gcc-interface/system.ads
index f54c43f..f54c43f 100644
--- a/gcc/ada/libgnat/system.ads
+++ b/gcc/ada/gcc-interface/system.ads
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 3491451..059e1a4 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -50,6 +50,7 @@
#include "gomp-constants.h"
#include "stringpool.h"
#include "attribs.h"
+#include "tree-nested.h"
#include "ada.h"
#include "adadecode.h"
@@ -900,7 +901,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
the actual assignment might end up being done component-wise. */
return (!constant
||(Is_Composite_Type (Underlying_Type (Etype (gnat_node)))
- && Is_Atomic_Or_VFA (Defining_Entity (gnat_parent)))
+ && Is_Full_Access (Defining_Entity (gnat_parent)))
/* We don't use a constructor if this is a class-wide object
because the effective type of the object is the equivalent
type of the class-wide subtype and it smashes most of the
@@ -915,7 +916,7 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
|| Name (gnat_parent) == gnat_node
|| (Is_Composite_Type (Underlying_Type (Etype (gnat_node)))
&& Is_Entity_Name (Name (gnat_parent))
- && Is_Atomic_Or_VFA (Entity (Name (gnat_parent)))));
+ && Is_Full_Access (Entity (Name (gnat_parent)))));
case N_Unchecked_Type_Conversion:
if (!constant)
@@ -3696,7 +3697,8 @@ finalize_nrv_unc_r (tree *tp, int *walk_subtrees, void *data)
static void
walk_nesting_tree (struct cgraph_node *node, walk_tree_fn func, void *data)
{
- for (node = node->nested; node; node = node->next_nested)
+ for (node = first_nested_function (node);
+ node; node = next_nested_function (node))
{
walk_tree_without_duplicates (&DECL_SAVED_TREE (node->decl), func, data);
walk_nesting_tree (node, func, data);
@@ -4017,6 +4019,11 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnat_poplevel ();
gnu_result = end_stmt_group ();
+ /* Attempt setting the end_locus of our GCC body tree, typically a BIND_EXPR,
+ then the end_locus of our GCC subprogram declaration tree. */
+ set_end_locus_from_node (gnu_result, gnat_node);
+ set_end_locus_from_node (gnu_subprog_decl, gnat_node);
+
/* If we populated the parameter attributes cache, we need to make sure that
the cached expressions are evaluated on all the possible paths leading to
their uses. So we force their evaluation on entry of the function. */
@@ -4111,12 +4118,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
gnu_return_label_stack->pop ();
- /* Attempt setting the end_locus of our GCC body tree, typically a
- BIND_EXPR or STATEMENT_LIST, then the end_locus of our GCC subprogram
- declaration tree. */
- set_end_locus_from_node (gnu_result, gnat_node);
- set_end_locus_from_node (gnu_subprog_decl, gnat_node);
-
/* On SEH targets, install an exception handler around the main entry
point to catch unhandled exceptions. */
if (DECL_NAME (gnu_subprog_decl) == main_identifier_node
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 048a0cf..d50872f 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -92,6 +92,7 @@ static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
static tree handle_stack_protect_attribute (tree *, tree, tree, int, bool *);
+static tree handle_no_stack_protector_attribute (tree *, tree, tree, int, bool *);
static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
static tree handle_noclone_attribute (tree *, tree, tree, int, bool *);
static tree handle_noicf_attribute (tree *, tree, tree, int, bool *);
@@ -116,6 +117,13 @@ static const struct attribute_spec::exclusions attr_cold_hot_exclusions[] =
{ NULL , false, false, false }
};
+static const struct attribute_spec::exclusions attr_stack_protect_exclusions[] =
+{
+ { "stack_protect", true, false, false },
+ { "no_stack_protector", true, false, false },
+ { NULL, false, false, false },
+};
+
/* Fake handler for attributes we don't properly support, typically because
they'd require dragging a lot of the common-c front-end circuitry. */
static tree fake_attribute_handler (tree *, tree, tree, int, bool *);
@@ -141,7 +149,11 @@ const struct attribute_spec gnat_internal_attribute_table[] =
{ "noreturn", 0, 0, true, false, false, false,
handle_noreturn_attribute, NULL },
{ "stack_protect",0, 0, true, false, false, false,
- handle_stack_protect_attribute, NULL },
+ handle_stack_protect_attribute,
+ attr_stack_protect_exclusions },
+ { "no_stack_protector",0, 0, true, false, false, false,
+ handle_no_stack_protector_attribute,
+ attr_stack_protect_exclusions },
{ "noinline", 0, 0, true, false, false, false,
handle_noinline_attribute, NULL },
{ "noclone", 0, 0, true, false, false, false,
@@ -6560,6 +6572,23 @@ handle_stack_protect_attribute (tree *node, tree name, tree, int,
return NULL_TREE;
}
+/* Handle a "no_stack_protector" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_stack_protector_attribute (tree *node, tree name, tree, int,
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
+
/* Handle a "noinline" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/gcc/ada/get_targ.adb b/gcc/ada/get_targ.adb
index ef307f2..8b35b1c 100644
--- a/gcc/ada/get_targ.adb
+++ b/gcc/ada/get_targ.adb
@@ -126,6 +126,18 @@ package body Get_Targ is
return C_Get_Long_Long_Size;
end Get_Long_Long_Size;
+ -----------------------------
+ -- Get_Long_Long_Long_Size --
+ -----------------------------
+
+ function Get_Long_Long_Long_Size return Pos is
+ function C_Get_Long_Long_Long_Size return Pos;
+ pragma Import (C, C_Get_Long_Long_Long_Size,
+ "get_target_long_long_long_size");
+ begin
+ return C_Get_Long_Long_Long_Size;
+ end Get_Long_Long_Long_Size;
+
----------------------
-- Get_Pointer_Size --
----------------------
@@ -309,10 +321,11 @@ package body Get_Targ is
function Width_From_Size (Size : Pos) return Pos is
begin
case Size is
- when 8 => return 4;
- when 16 => return 6;
- when 32 => return 11;
- when 64 => return 21;
+ when 8 => return 4;
+ when 16 => return 6;
+ when 32 => return 11;
+ when 64 => return 21;
+ when 128 => return 40;
when others => raise Program_Error;
end case;
end Width_From_Size;
diff --git a/gcc/ada/get_targ.ads b/gcc/ada/get_targ.ads
index 5a21418..676e117 100644
--- a/gcc/ada/get_targ.ads
+++ b/gcc/ada/get_targ.ads
@@ -68,6 +68,9 @@ package Get_Targ is
function Get_Long_Long_Size return Pos;
-- Size of Standard.Long_Long_Integer
+ function Get_Long_Long_Long_Size return Pos;
+ -- Size of Standard.Long_Long_Long_Integer
+
function Get_Pointer_Size return Pos;
-- Size of System.Address
diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb
index 54d52ba..866f7f7 100644
--- a/gcc/ada/ghost.adb
+++ b/gcc/ada/ghost.adb
@@ -34,7 +34,6 @@ with Nlists; use Nlists;
with Nmake; use Nmake;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
-with Sem_Ch8; use Sem_Ch8;
with Sem_Disp; use Sem_Disp;
with Sem_Eval; use Sem_Eval;
with Sem_Prag; use Sem_Prag;
@@ -65,6 +64,12 @@ package body Ghost is
-- Local subprograms --
-----------------------
+ function Whole_Object_Ref (Ref : Node_Id) return Node_Id;
+ -- For a name that denotes an object, returns a name that denotes the whole
+ -- object, declared by an object declaration, formal parameter declaration,
+ -- etc. For example, for P.X.Comp (J), if P is a package X is a record
+ -- object, this returns P.X.
+
function Ghost_Entity (Ref : Node_Id) return Entity_Id;
pragma Inline (Ghost_Entity);
-- Obtain the entity of a Ghost entity from reference Ref. Return Empty if
@@ -1009,10 +1014,8 @@ package body Ghost is
----------------------------
function Ultimate_Original_Node (Nod : Node_Id) return Node_Id is
- Res : Node_Id;
-
+ Res : Node_Id := Nod;
begin
- Res := Nod;
while Original_Node (Res) /= Res loop
Res := Original_Node (Res);
end loop;
@@ -1176,61 +1179,73 @@ package body Ghost is
-----------------------------------
procedure Mark_And_Set_Ghost_Assignment (N : Node_Id) is
- Orig_Lhs : constant Node_Id := Name (N);
- Orig_Ref : constant Node_Id := Ultimate_Prefix (Orig_Lhs);
-
- Id : Entity_Id;
- Ref : Node_Id;
+ -- A ghost assignment is an assignment whose left-hand side denotes a
+ -- ghost object. Subcomponents are not marked "ghost", so we need to
+ -- find the containing "whole" object. So, for "P.X.Comp (J) := ...",
+ -- where P is a package, X is a record, and Comp is an array, we need
+ -- to check the ghost flags of X.
+ Orig_Lhs : constant Node_Id := Name (N);
begin
- -- A reference to a whole Ghost object (SPARK RM 6.9(1)) appears as an
- -- identifier. If the reference has not been analyzed yet, preanalyze a
- -- copy of the reference to discover the nature of its entity.
-
- if Nkind (Orig_Ref) = N_Identifier and then not Analyzed (Orig_Ref) then
- Ref := New_Copy_Tree (Orig_Ref);
-
- -- Alter the assignment statement by setting its left-hand side to
- -- the copy.
-
- Set_Name (N, Ref);
- Set_Parent (Ref, N);
-
- -- Preanalysis is carried out by looking for a Ghost entity while
- -- suppressing all possible side effects.
-
- Find_Direct_Name
- (N => Ref,
- Errors_OK => False,
- Marker_OK => False,
- Reference_OK => False);
-
- -- Restore the original state of the assignment statement
-
- Set_Name (N, Orig_Lhs);
+ -- Ghost assignments are irrelevant when the expander is inactive, and
+ -- processing them in that mode can lead to spurious errors.
+
+ if Expander_Active then
+ if not Analyzed (Orig_Lhs)
+ and then Nkind (Orig_Lhs) = N_Indexed_Component
+ and then Nkind (Prefix (Orig_Lhs)) = N_Selected_Component
+ and then Nkind (Prefix (Prefix (Orig_Lhs))) =
+ N_Indexed_Component
+ then
+ Analyze (Orig_Lhs);
+ end if;
- -- A potential reference to a Ghost entity is already properly resolved
- -- when the left-hand side is analyzed.
+ -- Make sure Lhs is at least preanalyzed, so we can tell whether
+ -- it denotes a ghost variable. In some cases we need to do a full
+ -- analysis, or else the back end gets confused. Note that in the
+ -- preanalysis case, we are preanalyzing a copy of the left-hand
+ -- side name, temporarily attached to the tree.
- else
- Ref := Orig_Ref;
- end if;
+ declare
+ Lhs : constant Node_Id :=
+ (if Analyzed (Orig_Lhs) then Orig_Lhs
+ else New_Copy_Tree (Orig_Lhs));
+ begin
+ if not Analyzed (Lhs) then
+ Set_Name (N, Lhs);
+ Set_Parent (Lhs, N);
+ Preanalyze_Without_Errors (Lhs);
+ Set_Name (N, Orig_Lhs);
+ end if;
- -- An assignment statement becomes Ghost when its target denotes a Ghost
- -- object. Install the Ghost mode of the target.
+ declare
+ Whole : constant Node_Id := Whole_Object_Ref (Lhs);
+ Id : Entity_Id;
+ begin
+ if Is_Entity_Name (Whole) then
+ Id := Entity (Whole);
- Id := Ghost_Entity (Ref);
+ if Present (Id) then
+ -- Left-hand side denotes a Checked ghost entity, so
+ -- install the region.
- if Present (Id) then
- if Is_Checked_Ghost_Entity (Id) then
- Install_Ghost_Region (Check, N);
+ if Is_Checked_Ghost_Entity (Id) then
+ Install_Ghost_Region (Check, N);
- elsif Is_Ignored_Ghost_Entity (Id) then
- Install_Ghost_Region (Ignore, N);
+ -- Left-hand side denotes an Ignored ghost entity, so
+ -- install the region, and mark the assignment statement
+ -- as an ignored ghost assignment, so it will be removed
+ -- later.
- Set_Is_Ignored_Ghost_Node (N);
- Record_Ignored_Ghost_Node (N);
- end if;
+ elsif Is_Ignored_Ghost_Entity (Id) then
+ Install_Ghost_Region (Ignore, N);
+ Set_Is_Ignored_Ghost_Node (N);
+ Record_Ignored_Ghost_Node (N);
+ end if;
+ end if;
+ end if;
+ end;
+ end;
end if;
end Mark_And_Set_Ghost_Assignment;
@@ -1855,4 +1870,24 @@ package body Ghost is
end if;
end Set_Is_Ghost_Entity;
+ ----------------------
+ -- Whole_Object_Ref --
+ ----------------------
+
+ function Whole_Object_Ref (Ref : Node_Id) return Node_Id is
+ begin
+ if Nkind (Ref) in N_Indexed_Component | N_Slice
+ or else (Nkind (Ref) = N_Selected_Component
+ and then Is_Object_Reference (Prefix (Ref)))
+ then
+ if Is_Access_Type (Etype (Prefix (Ref))) then
+ return Ref;
+ else
+ return Whole_Object_Ref (Prefix (Ref));
+ end if;
+ else
+ return Ref;
+ end if;
+ end Whole_Object_Ref;
+
end Ghost;
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index a9f48ce..180a140 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -342,10 +342,6 @@ procedure Gnat1drv is
Xref_Active := True;
- -- Polling mode forced off, since it generates confusing junk
-
- Polling_Required := False;
-
-- Set operating mode to Generate_Code to benefit from full front-end
-- expansion (e.g. generics).
@@ -531,10 +527,6 @@ procedure Gnat1drv is
Xref_Active := True;
- -- Polling mode forced off, since it generates confusing junk
-
- Polling_Required := False;
-
-- Set operating mode to Check_Semantics, but a light front-end
-- expansion is still performed.
@@ -807,6 +799,24 @@ procedure Gnat1drv is
Set_Standard_Output;
end if;
+ -- Enable or disable the support for 128-bit types. It is automatically
+ -- enabled if the back end supports them, unless -gnatd.H is specified.
+
+ Enable_128bit_Types := Ttypes.Standard_Long_Long_Long_Integer_Size = 128;
+
+ if Enable_128bit_Types and then Debug_Flag_Dot_HH then
+ Enable_128bit_Types := False;
+
+ Ttypes.Standard_Long_Long_Long_Integer_Size :=
+ Ttypes.Standard_Long_Long_Integer_Size;
+ Ttypes.Standard_Long_Long_Long_Integer_Width :=
+ Ttypes.Standard_Long_Long_Integer_Width;
+ Ttypes.System_Max_Integer_Size :=
+ Ttypes.Standard_Long_Long_Integer_Size;
+ Ttypes.System_Max_Binary_Modulus_Power :=
+ Ttypes.Standard_Long_Long_Integer_Size;
+ end if;
+
-- Finally capture adjusted value of Suppress_Options as the initial
-- value for Scope_Suppress, which will be modified as we move from
-- scope to scope (by Suppress/Unsuppress/Overflow_Checks pragmas).
@@ -1075,9 +1085,13 @@ begin
-- Initialize all packages. For the most part, these initialization
-- calls can be made in any order. Exceptions are as follows:
- -- Lib.Initialize need to be called before Scan_Compiler_Arguments,
+ -- Lib.Initialize needs to be called before Scan_Compiler_Arguments,
-- because it initializes a table filled by Scan_Compiler_Arguments.
+ -- Atree.Initialize needs to be called after Scan_Compiler_Arguments,
+ -- because the value specified by the -gnaten switch is used by
+ -- Atree.Initialize.
+
Osint.Initialize;
Fmap.Reset_Tables;
Lib.Initialize;
@@ -1700,7 +1714,10 @@ begin
end;
<<End_Of_Program>>
- null;
+
+ if Debug_Flag_Dot_AA then
+ Atree.Print_Statistics;
+ end if;
-- The outer exception handler handles an unrecoverable error
diff --git a/gcc/ada/gnat_cuda.adb b/gcc/ada/gnat_cuda.adb
new file mode 100644
index 0000000..39a55e6
--- /dev/null
+++ b/gcc/ada/gnat_cuda.adb
@@ -0,0 +1,586 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- C U D A --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2010-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package defines CUDA-specific datastructures and functions.
+
+with Atree; use Atree;
+with Debug; use Debug;
+with Elists; use Elists;
+with Namet; use Namet;
+with Nlists; use Nlists;
+with Nmake; use Nmake;
+with Rtsfind; use Rtsfind;
+with Sinfo; use Sinfo;
+with Stringt; use Stringt;
+with Tbuild; use Tbuild;
+with Uintp; use Uintp;
+with Sem; use Sem;
+with Sem_Util; use Sem_Util;
+with Snames; use Snames;
+
+with GNAT.HTable;
+
+package body GNAT_CUDA is
+
+ --------------------------------------
+ -- Hash Table for CUDA_Global nodes --
+ --------------------------------------
+
+ type Hash_Range is range 0 .. 510;
+ -- Size of hash table headers
+
+ function Hash (F : Entity_Id) return Hash_Range;
+ -- Hash function for hash table
+
+ package CUDA_Kernels_Table is new
+ GNAT.HTable.Simple_HTable
+ (Header_Num => Hash_Range,
+ Element => Elist_Id,
+ No_Element => No_Elist,
+ Key => Entity_Id,
+ Hash => Hash,
+ Equal => "=");
+ -- The keys of this table are package entities whose bodies contain at
+ -- least one procedure marked with aspect CUDA_Global. The values are
+ -- Elists of the marked procedures.
+
+ function Get_CUDA_Kernels (Pack_Id : Entity_Id) return Elist_Id;
+ -- Returns an Elist of all procedures marked with pragma CUDA_Global that
+ -- are declared within package body Pack_Body. Returns No_Elist if
+ -- Pack_Id does not contain such procedures.
+
+ procedure Set_CUDA_Kernels
+ (Pack_Id : Entity_Id;
+ Kernels : Elist_Id);
+ -- Stores Kernels as the list of kernels belonging to the package entity
+ -- Pack_Id. Pack_Id must not have a list of kernels.
+
+ ---------------------
+ -- Add_CUDA_Kernel --
+ ---------------------
+
+ procedure Add_CUDA_Kernel
+ (Pack_Id : Entity_Id;
+ Kernel : Entity_Id)
+ is
+ Kernels : Elist_Id := Get_CUDA_Kernels (Pack_Id);
+ begin
+ if Kernels = No_Elist then
+ Kernels := New_Elmt_List;
+ Set_CUDA_Kernels (Pack_Id, Kernels);
+ end if;
+ Append_Elmt (Kernel, Kernels);
+ end Add_CUDA_Kernel;
+
+ ----------
+ -- Hash --
+ ----------
+
+ function Hash (F : Entity_Id) return Hash_Range is
+ begin
+ return Hash_Range (F mod 511);
+ end Hash;
+
+ ----------------------
+ -- Get_CUDA_Kernels --
+ ----------------------
+
+ function Get_CUDA_Kernels (Pack_Id : Entity_Id) return Elist_Id is
+ begin
+ return CUDA_Kernels_Table.Get (Pack_Id);
+ end Get_CUDA_Kernels;
+
+ ------------------------------------------
+ -- Build_And_Insert_CUDA_Initialization --
+ ------------------------------------------
+
+ procedure Build_And_Insert_CUDA_Initialization (N : Node_Id) is
+
+ -- For the following kernel declaration:
+ --
+ -- package body <Package_Name> is
+ -- procedure <Proc_Name> (X : Integer) with CUDA_Global;
+ -- end package;
+ --
+ -- Insert the following declarations:
+ --
+ -- Fat_Binary : System.Address;
+ -- pragma Import
+ -- (Convention => C,
+ -- Entity => Fat_Binary,
+ -- External_Name => "_binary_<Package_Name>_fatbin_start");
+ --
+ -- Wrapper : Fatbin_Wrapper :=
+ -- (16#466243b1#, 1, Fat_Binary'Address, System.Null_Address);
+ --
+ -- Proc_Symbol_Name : Interfaces.C.Strings.Chars_Ptr :=
+ -- Interfaces.C.Strings.New_Char_Array("<Proc_Name>");
+ --
+ -- Fat_Binary_Handle : System.Address :=
+ -- CUDA.Internal.Register_Fat_Binary (Wrapper'Address);
+ --
+ -- procedure Initialize_CUDA_Kernel is
+ -- begin
+ -- CUDA.Internal.Register_Function
+ -- (Fat_Binary_Handle,
+ -- <Proc_Name>'Address,
+ -- Proc_Symbol_Name,
+ -- Proc_Symbol_Name,
+ -- -1,
+ -- System.Null_Address,
+ -- System.Null_Address,
+ -- System.Null_Address,
+ -- System.Null_Address,
+ -- System.Null_Address);
+ -- CUDA.Internal.Register_Fat_Binary_End (Fat_Binary_Handle);
+ -- end Initialize_CUDA_Kernel;
+ --
+ -- Proc_Symbol_Name is the name of the procedure marked with
+ -- CUDA_Global. The CUDA runtime uses this in order to be able to find
+ -- kernels in the fat binary, so it has to match the name of the
+ -- procedure symbol compiled by GNAT_LLVM. When looking at the code
+ -- generated by NVCC, it seems that the CUDA runtime also needs the name
+ -- of the procedure symbol of the host. Fortuantely, the procedures are
+ -- named the same way whether they are compiled for the host or the
+ -- device, so we use Vector_Add_Name to specify the name of the symbol
+ -- for both the host and the device. The meaning of the rest of the
+ -- arguments is unknown.
+
+ function Build_CUDA_Init_Proc
+ (Init_Id : Entity_Id;
+ CUDA_Kernels : Elist_Id;
+ Handle_Id : Entity_Id;
+ Pack_Decls : List_Id) return Node_Id;
+ -- Create the declaration of Init_Id, the function that binds each
+ -- kernel present in CUDA_Kernels with the fat binary Handle_Id and then
+ -- tells the CUDA runtime that no new function will be bound to the fat
+ -- binary.
+
+ function Build_Fat_Binary_Declaration
+ (Bin_Id : Entity_Id) return Node_Id;
+ -- Create a declaration for Bin_Id, the entity that represents the fat
+ -- binary, i.e.:
+ --
+ -- Bin_Id : System.Address;
+
+ function Build_Fat_Binary_Handle_Declaration
+ (Handle_Id : Entity_Id;
+ Wrapper_Id : Entity_Id) return Node_Id;
+ -- Create the declaration of Handle_Id, a System.Address that will
+ -- receive the results of passing the address of Wrapper_Id to
+ -- CUDA.Register_Fat_Binary, i.e.:
+ --
+ -- Handle_Id : System.Address :=
+ -- CUDA.Register_Fat_Binary (Wrapper_Id'Address)
+
+ function Build_Fat_Binary_Wrapper_Declaration
+ (Wrapper_Id : Entity_Id;
+ Bin_Id : Entity_Id) return Node_Id;
+ -- Create the declaration of the fat binary wrapper Wrapper_Id, which
+ -- holds magic numbers and Bin_Id'Address, i.e.:
+ --
+ -- Wrapper_Id : System.Address :=
+ -- (16#466243b1#, 1, Bin_Id'Address, System.Null_Address);
+
+ function Build_Import_Pragma
+ (Bin_Id : Entity_Id;
+ Pack_Body : Node_Id) return Node_Id;
+ -- Create a pragma that will bind the fat binary Bin_Id to its external
+ -- symbol. N is the package body Bin_Id belongs to, i.e.:
+ --
+ -- pragma Import
+ -- (Convention => C,
+ -- Entity => Bin_Id,
+ -- External_Name => "_binary_<Pack_Body's name>_fatbin_start");
+
+ function Build_Kernel_Name_Declaration
+ (Kernel : Entity_Id) return Node_Id;
+ -- Create the declaration of a C string that contains the name of
+ -- Kernel's symbol, i.e.:
+ --
+ -- Kernel : Interfaces.C.Strings.Chars_Ptr :=
+ -- Interfaces.C.Strings.New_Char_Array("<Kernel's name>");
+
+ function Build_Register_Procedure_Call
+ (Loc : Source_Ptr;
+ Bin : Entity_Id;
+ Kernel : Entity_Id;
+ Kernel_Name : Entity_Id) return Node_Id;
+ -- Return a call to CUDA.Internal.Register_Function that binds Kernel
+ -- (the entity of a procedure) to the symbol described by the C string
+ -- Kernel_Name in the fat binary Bin, using Loc as location.
+
+ --------------------------
+ -- Build_CUDA_Init_Proc --
+ --------------------------
+
+ function Build_CUDA_Init_Proc
+ (Init_Id : Entity_Id;
+ CUDA_Kernels : Elist_Id;
+ Handle_Id : Entity_Id;
+ Pack_Decls : List_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Init_Id);
+
+ Stmts : constant List_Id := New_List;
+ -- List of statements that will be used by the cuda initialization
+ -- function.
+
+ New_Stmt : Node_Id;
+ -- Temporary variable to hold the various newly-created nodes.
+
+ Kernel_Elmt : Elmt_Id;
+ Kernel_Id : Entity_Id;
+
+ begin
+ -- For each CUDA_Global function, declare a C string that holds
+ -- its symbol's name (i.e. packagename __ functionname).
+
+ -- Also create a function call to CUDA.Internal.Register_Function
+ -- that takes the declared C string, a pointer to the function and
+ -- the fat binary handle.
+
+ Kernel_Elmt := First_Elmt (CUDA_Kernels);
+ while Present (Kernel_Elmt) loop
+ Kernel_Id := Node (Kernel_Elmt);
+
+ New_Stmt :=
+ Build_Kernel_Name_Declaration (Kernel_Id);
+ Append (New_Stmt, Pack_Decls);
+ Analyze (New_Stmt);
+
+ Append_To (Stmts,
+ Build_Register_Procedure_Call (Loc,
+ Bin => Handle_Id,
+ Kernel => Kernel_Id,
+ Kernel_Name => Defining_Entity (New_Stmt)));
+
+ Next_Elmt (Kernel_Elmt);
+ end loop;
+
+ -- Finish the CUDA initialization function: add a call to
+ -- register_fat_binary_end, to let the CUDA runtime know that we
+ -- won't be registering any other symbol with the current fat binary.
+
+ Append_To (Stmts,
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Register_Fat_Binary_End), Loc),
+ Parameter_Associations =>
+ New_List (New_Occurrence_Of (Handle_Id, Loc))));
+
+ -- Now that we have all the declarations and calls we need, we can
+ -- build and and return the initialization procedure.
+
+ return
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Procedure_Specification (Loc, Init_Id),
+ Declarations => New_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc, Stmts));
+ end Build_CUDA_Init_Proc;
+
+ ----------------------------------
+ -- Build_Fat_Binary_Declaration --
+ ----------------------------------
+
+ function Build_Fat_Binary_Declaration
+ (Bin_Id : Entity_Id) return Node_Id
+ is
+ begin
+ return
+ Make_Object_Declaration (Sloc (Bin_Id),
+ Defining_Identifier => Bin_Id,
+ Object_Definition =>
+ New_Occurrence_Of (RTE (RE_Address), Sloc (Bin_Id)));
+ end Build_Fat_Binary_Declaration;
+
+ -----------------------------------------
+ -- Build_Fat_Binary_Handle_Declaration --
+ -----------------------------------------
+
+ function Build_Fat_Binary_Handle_Declaration
+ (Handle_Id : Entity_Id;
+ Wrapper_Id : Entity_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Handle_Id);
+ begin
+ -- Generate:
+ -- Handle_Id : System.Address :=
+ -- CUDA.Register_Fat_Binary (Wrapper_Id'Address);
+
+ return
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Handle_Id,
+ Object_Definition => New_Occurrence_Of (RTE (RE_Address), Loc),
+ Expression =>
+ Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Register_Fat_Binary), Loc),
+ Parameter_Associations => New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix =>
+ New_Occurrence_Of (Wrapper_Id, Loc),
+ Attribute_Name => Name_Address))));
+ end Build_Fat_Binary_Handle_Declaration;
+
+ ------------------------------------------
+ -- Build_Fat_Binary_Wrapper_Declaration --
+ ------------------------------------------
+
+ function Build_Fat_Binary_Wrapper_Declaration
+ (Wrapper_Id : Entity_Id;
+ Bin_Id : Entity_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Wrapper_Id);
+ begin
+ return
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Wrapper_Id,
+ Object_Definition =>
+ New_Occurrence_Of (RTE (RE_Fatbin_Wrapper), Loc),
+ Expression =>
+ Make_Aggregate (Loc,
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, UI_From_Int (16#466243b1#)),
+ Make_Integer_Literal (Loc, UI_From_Int (1)),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Bin_Id, Loc),
+ Attribute_Name => Name_Address),
+ New_Occurrence_Of (RTE (RE_Null_Address), Loc))));
+ end Build_Fat_Binary_Wrapper_Declaration;
+
+ -------------------------
+ -- Build_Import_Pragma --
+ -------------------------
+
+ function Build_Import_Pragma
+ (Bin_Id : Entity_Id;
+ Pack_Body : Node_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Bin_Id);
+ External_Symbol : String_Id;
+ begin
+ Start_String;
+ Store_String_Chars
+ ("_binary_"
+ & Get_Name_String (Chars (Defining_Unit_Name (Pack_Body)))
+ & "_fatbin_start");
+ External_Symbol := End_String;
+
+ return
+ Make_Pragma (Loc,
+ Pragma_Identifier =>
+ Make_Identifier (Loc, Name_Import),
+ Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Chars => Name_Convention,
+ Expression => Make_Identifier (Loc, Name_C)),
+ Make_Pragma_Argument_Association (Loc,
+ Chars => Name_Entity,
+ Expression => New_Occurrence_Of (Bin_Id, Loc)),
+ Make_Pragma_Argument_Association (Loc,
+ Chars => Name_External_Name,
+ Expression => Make_String_Literal (Loc, External_Symbol))));
+ end Build_Import_Pragma;
+
+ -------------------------------------
+ -- Build_Kernel_Name_Declaration --
+ -------------------------------------
+
+ function Build_Kernel_Name_Declaration
+ (Kernel : Entity_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Kernel);
+
+ Package_Name : constant String :=
+ Get_Name_String (Chars (Scope (Kernel)));
+
+ Symbol_Name : constant String := Get_Name_String (Chars (Kernel));
+
+ Kernel_Name : String_Id;
+ begin
+ Start_String;
+ Store_String_Chars (Package_Name & "__" & Symbol_Name);
+ Kernel_Name := End_String;
+
+ return
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Make_Temporary (Loc, 'C'),
+ Object_Definition =>
+ New_Occurrence_Of (RTE (RE_Chars_Ptr), Loc),
+ Expression =>
+ Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_New_Char_Array), Loc),
+ Parameter_Associations => New_List (
+ Make_String_Literal (Loc, Kernel_Name))));
+ end Build_Kernel_Name_Declaration;
+
+ -----------------------------------
+ -- Build_Register_Procedure_Call --
+ -----------------------------------
+
+ function Build_Register_Procedure_Call
+ (Loc : Source_Ptr;
+ Bin : Entity_Id;
+ Kernel : Entity_Id;
+ Kernel_Name : Entity_Id) return Node_Id
+ is
+ Args : constant List_Id := New_List;
+ begin
+ -- First argument: the handle of the fat binary.
+
+ Append (New_Occurrence_Of (Bin, Loc), Args);
+
+ -- Second argument: the host address of the function that is
+ -- marked with CUDA_Global.
+
+ Append_To (Args,
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Kernel, Loc),
+ Attribute_Name => Name_Address));
+
+ -- Third argument, the name of the function on the host.
+
+ Append (New_Occurrence_Of (Kernel_Name, Loc), Args);
+
+ -- Fourth argument, the name of the function on the device.
+
+ Append (New_Occurrence_Of (Kernel_Name, Loc), Args);
+
+ -- Fith argument: -1. Meaning unknown - this has been copied from
+ -- LLVM.
+
+ Append (Make_Integer_Literal (Loc, UI_From_Int (-1)), Args);
+
+ -- Args 6, 7, 8, 9, 10: Null pointers. Again, meaning unknown.
+
+ for Arg_Count in 1 .. 5 loop
+ Append_To (Args, New_Occurrence_Of (RTE (RE_Null_Address), Loc));
+ end loop;
+
+ -- Build the call to CUDARegisterFunction, passing the argument
+ -- list we just built.
+
+ return
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Register_Function), Loc),
+ Parameter_Associations => Args);
+ end Build_Register_Procedure_Call;
+
+ -- Local declarations
+
+ Loc : constant Source_Ptr := Sloc (N);
+
+ Spec_Id : constant Node_Id := Corresponding_Spec (N);
+ -- The specification of the package we're adding a cuda init func to.
+
+ Pack_Decls : constant List_Id := Declarations (N);
+
+ CUDA_Node_List : constant Elist_Id := Get_CUDA_Kernels (Spec_Id);
+ -- CUDA nodes that belong to the package.
+
+ CUDA_Init_Func : Entity_Id;
+ -- Entity of the cuda init func.
+
+ Fat_Binary : Entity_Id;
+ -- Entity of the fat binary of N. Bound to said fat binary by a pragma.
+
+ Fat_Binary_Handle : Entity_Id;
+ -- Entity of the result of passing the fat binary wrapper to.
+ -- CUDA.Register_Fat_Binary.
+
+ Fat_Binary_Wrapper : Entity_Id;
+ -- Entity of a record that holds a bunch of magic numbers and a
+ -- reference to Fat_Binary.
+
+ New_Stmt : Node_Id;
+ -- Node to store newly-created declarations
+
+ -- Start of processing for Build_And_Insert_CUDA_Initialization
+
+ begin
+ if CUDA_Node_List = No_Elist or not Debug_Flag_Underscore_C then
+ return;
+ end if;
+
+ Fat_Binary := Make_Temporary (Loc, 'C');
+ New_Stmt := Build_Fat_Binary_Declaration (Fat_Binary);
+ Append_To (Pack_Decls, New_Stmt);
+ Analyze (New_Stmt);
+
+ New_Stmt := Build_Import_Pragma (Fat_Binary, N);
+ Append_To (Pack_Decls, New_Stmt);
+ Analyze (New_Stmt);
+
+ Fat_Binary_Wrapper := Make_Temporary (Loc, 'C');
+ New_Stmt :=
+ Build_Fat_Binary_Wrapper_Declaration
+ (Wrapper_Id => Fat_Binary_Wrapper,
+ Bin_Id => Fat_Binary);
+ Append_To (Pack_Decls, New_Stmt);
+ Analyze (New_Stmt);
+
+ Fat_Binary_Handle := Make_Temporary (Loc, 'C');
+ New_Stmt :=
+ Build_Fat_Binary_Handle_Declaration
+ (Fat_Binary_Handle, Fat_Binary_Wrapper);
+ Append_To (Pack_Decls, New_Stmt);
+ Analyze (New_Stmt);
+
+ CUDA_Init_Func := Make_Temporary (Loc, 'C');
+ New_Stmt :=
+ Build_CUDA_Init_Proc
+ (Init_Id => CUDA_Init_Func,
+ CUDA_Kernels => CUDA_Node_List,
+ Handle_Id => Fat_Binary_Handle,
+ Pack_Decls => Pack_Decls);
+ Append_To (Pack_Decls, New_Stmt);
+ Analyze (New_Stmt);
+
+ New_Stmt :=
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Occurrence_Of (CUDA_Init_Func, Loc));
+ Append_To (Pack_Decls, New_Stmt);
+ Analyze (New_Stmt);
+ end Build_And_Insert_CUDA_Initialization;
+
+ --------------------
+ -- Set_CUDA_Nodes --
+ --------------------
+
+ procedure Set_CUDA_Kernels
+ (Pack_Id : Entity_Id;
+ Kernels : Elist_Id)
+ is
+ begin
+ pragma Assert (Get_CUDA_Kernels (Pack_Id) = No_Elist);
+ CUDA_Kernels_Table.Set (Pack_Id, Kernels);
+ end Set_CUDA_Kernels;
+
+end GNAT_CUDA;
diff --git a/gcc/ada/gnat_cuda.ads b/gcc/ada/gnat_cuda.ads
new file mode 100644
index 0000000..e27be34
--- /dev/null
+++ b/gcc/ada/gnat_cuda.ads
@@ -0,0 +1,107 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- C U D A --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2010-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package defines CUDA-specific datastructures and subprograms.
+--
+-- Compiling for CUDA requires compiling for two targets. One is the CPU (more
+-- frequently named "host"), the other is the GPU (the "device"). Compiling
+-- for the host requires compiling the whole program. Compiling for the device
+-- only requires compiling packages that contain CUDA kernels.
+--
+-- When compiling for the device, GNAT-LLVM is used. It produces assembly
+-- tailored to Nvidia's GPU (NVPTX). This NVPTX code is then assembled into
+-- an object file by ptxas, an assembler provided by Nvidia. This object file
+-- is then combined with its source code into a fat binary by a tool named
+-- `fatbin`, also provided by Nvidia. The resulting fat binary is turned into
+-- a regular object file by the host's linker and linked with the program that
+-- executes on the host.
+--
+-- A CUDA kernel is a procedure marked with the CUDA_Global pragma or aspect.
+-- CUDA_Global does not have any effect when compiling for the device. When
+-- compiling for the host, the frontend stores procedures marked with
+-- CUDA_Global in a hash table the key of which is the Node_Id of the package
+-- body that contains the CUDA_Global procedure. This is done in sem_prag.adb.
+-- Once the declarations of a package body have been analyzed, variable, type
+-- and procedure declarations necessary for the initialization of the CUDA
+-- runtime are appended to the package that contains the CUDA_Global
+-- procedure.
+--
+-- These declarations are used to register the CUDA kernel with the CUDA
+-- runtime when the program is launched. Registering a CUDA kernel with the
+-- CUDA runtime requires multiple function calls:
+-- - The first one registers the fat binary which corresponds to the package
+-- with the CUDA runtime.
+-- - Then, as many function calls as there are kernels in order to bind them
+-- with the fat binary.
+-- fat binary.
+-- - The last call lets the CUDA runtime know that we are done initializing
+-- CUDA.
+-- Expansion of the CUDA_Global aspect is triggered in sem_ch7.adb, during
+-- analysis of the package. All of this expansion is performed in the
+-- Insert_CUDA_Initialization procedure defined in GNAT_CUDA.
+--
+-- Once a CUDA package is initialized, its kernels are ready to be used.
+-- Launching CUDA kernels is done by using the CUDA_Execute pragma. When
+-- compiling for the host, the CUDA_Execute pragma is expanded into a declare
+-- block which performs calls to the CUDA runtime functions.
+-- - The first one pushes a "launch configuration" on the "configuration
+-- stack" of the CUDA runtime.
+-- - The second call pops this call configuration, making it effective.
+-- - The third call actually launches the kernel.
+-- Light validation of the CUDA_Execute pragma is performed in sem_prag.adb
+-- and expansion is performed in exp_prag.adb.
+
+with Types; use Types;
+
+package GNAT_CUDA is
+
+ procedure Add_CUDA_Kernel (Pack_Id : Entity_Id; Kernel : Entity_Id);
+ -- Add Kernel to the list of CUDA_Global nodes that belong to Pack_Id.
+ -- Kernel is a procedure entity marked with CUDA_Global, Pack_Id is the
+ -- entity of its parent package body.
+
+ procedure Build_And_Insert_CUDA_Initialization (N : Node_Id);
+ -- Builds declarations necessary for CUDA initialization and inserts them
+ -- in N, the package body that contains CUDA_Global nodes. These
+ -- declarations are:
+ --
+ -- * A symbol to hold the pointer to the CUDA fat binary
+ --
+ -- * A type definition for a wrapper that contains the pointer to the
+ -- CUDA fat binary
+ --
+ -- * An object of the aforementioned type to hold the aforementioned
+ -- pointer.
+ --
+ -- * For each CUDA_Global procedure in the package, a declaration of a C
+ -- string containing the function's name.
+ --
+ -- * A function that takes care of calling CUDA functions that register
+ -- CUDA_Global procedures with the runtime.
+ --
+ -- * A boolean that holds the result of the call to the aforementioned
+ -- function.
+
+end GNAT_CUDA;
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 882f9e2..e1a5568 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -21,7 +21,7 @@
@copying
@quotation
-GNAT Reference Manual , Jul 01, 2020
+GNAT Reference Manual , Sep 29, 2020
AdaCore
@@ -222,7 +222,6 @@ Implementation Defined Pragmas
* Pragma Part_Of::
* Pragma Passive::
* Pragma Persistent_BSS::
-* Pragma Polling::
* Pragma Post::
* Pragma Postcondition::
* Pragma Post_Class::
@@ -407,6 +406,7 @@ Implementation Defined Attributes
* Attribute Machine_Size::
* Attribute Mantissa::
* Attribute Maximum_Alignment::
+* Attribute Max_Integer_Size::
* Attribute Mechanism_Code::
* Attribute Null_Parameter::
* Attribute Object_Size::
@@ -713,6 +713,7 @@ The GNAT Library
* Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
* Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
* Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
+* Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads.
* Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
* Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
* Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
@@ -1297,7 +1298,6 @@ consideration, the use of these pragmas should be minimized.
* Pragma Part_Of::
* Pragma Passive::
* Pragma Persistent_BSS::
-* Pragma Polling::
* Pragma Post::
* Pragma Postcondition::
* Pragma Post_Class::
@@ -1394,7 +1394,21 @@ This pragma must appear at the start of the statement sequence of a
handled sequence of statements (right after the @code{begin}). It has
the effect of deferring aborts for the sequence of statements (but not
for the declarations or handlers, if any, associated with this statement
-sequence).
+sequence). This can also be useful for adding a polling point in Ada code,
+where asynchronous abort of tasks is checked when leaving the statement
+sequence, and is lighter than, for example, using @code{delay 0.0;}, since with
+zero-cost exception handling, propagating exceptions (implicitly used to
+implement task abort) cannot be done reliably in an asynchronous way.
+
+An example of usage would be:
+
+@example
+-- Add a polling point to check for task aborts
+
+begin
+ pragma Abort_Defer;
+end;
+@end example
@node Pragma Abstract_State,Pragma Ada_83,Pragma Abort_Defer,Implementation Defined Pragmas
@anchor{gnat_rm/implementation_defined_pragmas pragma-abstract-state}@anchor{1c}@anchor{gnat_rm/implementation_defined_pragmas id2}@anchor{1d}
@@ -5959,7 +5973,7 @@ optimized. GNAT does not attempt to optimize any tasks in this manner
For more information on the subject of passive tasks, see the section
'Passive Task Optimization' in the GNAT Users Guide.
-@node Pragma Persistent_BSS,Pragma Polling,Pragma Passive,Implementation Defined Pragmas
+@node Pragma Persistent_BSS,Pragma Post,Pragma Passive,Implementation Defined Pragmas
@anchor{gnat_rm/implementation_defined_pragmas id29}@anchor{b6}@anchor{gnat_rm/implementation_defined_pragmas pragma-persistent-bss}@anchor{b7}
@section Pragma Persistent_BSS
@@ -5990,50 +6004,8 @@ type is potentially persistent.
If this pragma is used on a target where this feature is not supported,
then the pragma will be ignored. See also @code{pragma Linker_Section}.
-@node Pragma Polling,Pragma Post,Pragma Persistent_BSS,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-polling}@anchor{b8}
-@section Pragma Polling
-
-
-Syntax:
-
-@example
-pragma Polling (ON | OFF);
-@end example
-
-This pragma controls the generation of polling code. This is normally off.
-If @code{pragma Polling (ON)} is used then periodic calls are generated to
-the routine @code{Ada.Exceptions.Poll}. This routine is a separate unit in the
-runtime library, and can be found in file @code{a-excpol.adb}.
-
-Pragma @code{Polling} can appear as a configuration pragma (for example it
-can be placed in the @code{gnat.adc} file) to enable polling globally, or it
-can be used in the statement or declaration sequence to control polling
-more locally.
-
-A call to the polling routine is generated at the start of every loop and
-at the start of every subprogram call. This guarantees that the @code{Poll}
-routine is called frequently, and places an upper bound (determined by
-the complexity of the code) on the period between two @code{Poll} calls.
-
-The primary purpose of the polling interface is to enable asynchronous
-aborts on targets that cannot otherwise support it (for example Windows
-NT), but it may be used for any other purpose requiring periodic polling.
-The standard version is null, and can be replaced by a user program. This
-will require re-compilation of the @code{Ada.Exceptions} package that can
-be found in files @code{a-except.ads} and @code{a-except.adb}.
-
-A standard alternative unit (in file @code{4wexcpol.adb} in the standard GNAT
-distribution) is used to enable the asynchronous abort capability on
-targets that do not normally support the capability. The version of
-@code{Poll} in this file makes a call to the appropriate runtime routine
-to test for an abort condition.
-
-Note that polling can also be enabled by use of the @emph{-gnatP} switch.
-See the section on switches for gcc in the @cite{GNAT User's Guide}.
-
-@node Pragma Post,Pragma Postcondition,Pragma Polling,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{b9}
+@node Pragma Post,Pragma Postcondition,Pragma Persistent_BSS,Implementation Defined Pragmas
+@anchor{gnat_rm/implementation_defined_pragmas pragma-post}@anchor{b8}
@section Pragma Post
@@ -6058,7 +6030,7 @@ appear at the start of the declarations in a subprogram body
(preceded only by other pragmas).
@node Pragma Postcondition,Pragma Post_Class,Pragma Post,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{ba}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-postcondition}@anchor{b9}
@section Pragma Postcondition
@@ -6223,7 +6195,7 @@ Ada 2012, and has been retained in its original form for
compatibility purposes.
@node Pragma Post_Class,Pragma Rename_Pragma,Pragma Postcondition,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{bb}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-post-class}@anchor{ba}
@section Pragma Post_Class
@@ -6258,7 +6230,7 @@ policy that controls this pragma is @code{Post'Class}, not
@code{Post_Class}.
@node Pragma Rename_Pragma,Pragma Pre,Pragma Post_Class,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{bc}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-rename-pragma}@anchor{bb}
@section Pragma Rename_Pragma
@@ -6297,7 +6269,7 @@ Pragma Inline_Only will not necessarily mean the same thing as the other Ada
compiler; it's up to you to make sure the semantics are close enough.
@node Pragma Pre,Pragma Precondition,Pragma Rename_Pragma,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{bd}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-pre}@anchor{bc}
@section Pragma Pre
@@ -6322,7 +6294,7 @@ appear at the start of the declarations in a subprogram body
(preceded only by other pragmas).
@node Pragma Precondition,Pragma Predicate,Pragma Pre,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{be}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-precondition}@anchor{bd}
@section Pragma Precondition
@@ -6381,7 +6353,7 @@ Ada 2012, and has been retained in its original form for
compatibility purposes.
@node Pragma Predicate,Pragma Predicate_Failure,Pragma Precondition,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{bf}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{c0}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate}@anchor{be}@anchor{gnat_rm/implementation_defined_pragmas id30}@anchor{bf}
@section Pragma Predicate
@@ -6435,7 +6407,7 @@ defined for subtype B). When following this approach, the
use of predicates should be avoided.
@node Pragma Predicate_Failure,Pragma Preelaborable_Initialization,Pragma Predicate,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c1}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-predicate-failure}@anchor{c0}
@section Pragma Predicate_Failure
@@ -6452,7 +6424,7 @@ the language-defined
@code{Predicate_Failure} aspect, and shares its restrictions and semantics.
@node Pragma Preelaborable_Initialization,Pragma Prefix_Exception_Messages,Pragma Predicate_Failure,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c2}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-preelaborable-initialization}@anchor{c1}
@section Pragma Preelaborable_Initialization
@@ -6467,7 +6439,7 @@ versions of Ada as an implementation-defined pragma.
See Ada 2012 Reference Manual for details.
@node Pragma Prefix_Exception_Messages,Pragma Pre_Class,Pragma Preelaborable_Initialization,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c3}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-prefix-exception-messages}@anchor{c2}
@section Pragma Prefix_Exception_Messages
@@ -6498,7 +6470,7 @@ prefixing in this case, you can always call
@code{GNAT.Source_Info.Enclosing_Entity} and prepend the string manually.
@node Pragma Pre_Class,Pragma Priority_Specific_Dispatching,Pragma Prefix_Exception_Messages,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c4}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-pre-class}@anchor{c3}
@section Pragma Pre_Class
@@ -6533,7 +6505,7 @@ policy that controls this pragma is @code{Pre'Class}, not
@code{Pre_Class}.
@node Pragma Priority_Specific_Dispatching,Pragma Profile,Pragma Pre_Class,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c5}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-priority-specific-dispatching}@anchor{c4}
@section Pragma Priority_Specific_Dispatching
@@ -6557,7 +6529,7 @@ versions of Ada as an implementation-defined pragma.
See Ada 2012 Reference Manual for details.
@node Pragma Profile,Pragma Profile_Warnings,Pragma Priority_Specific_Dispatching,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c6}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-profile}@anchor{c5}
@section Pragma Profile
@@ -6831,7 +6803,7 @@ conforming Ada constructs. The profile enables the following three pragmas:
@end itemize
@node Pragma Profile_Warnings,Pragma Propagate_Exceptions,Pragma Profile,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c7}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-profile-warnings}@anchor{c6}
@section Pragma Profile_Warnings
@@ -6849,7 +6821,7 @@ violations of the profile generate warning messages instead
of error messages.
@node Pragma Propagate_Exceptions,Pragma Provide_Shift_Operators,Pragma Profile_Warnings,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c8}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-propagate-exceptions}@anchor{c7}
@section Pragma Propagate_Exceptions
@@ -6868,7 +6840,7 @@ purposes. It used to be used in connection with optimization of
a now-obsolete mechanism for implementation of exceptions.
@node Pragma Provide_Shift_Operators,Pragma Psect_Object,Pragma Propagate_Exceptions,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{c9}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-provide-shift-operators}@anchor{c8}
@section Pragma Provide_Shift_Operators
@@ -6888,7 +6860,7 @@ including the function declarations for these five operators, together
with the pragma Import (Intrinsic, ...) statements.
@node Pragma Psect_Object,Pragma Pure_Function,Pragma Provide_Shift_Operators,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{ca}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-psect-object}@anchor{c9}
@section Pragma Psect_Object
@@ -6908,7 +6880,7 @@ EXTERNAL_SYMBOL ::=
This pragma is identical in effect to pragma @code{Common_Object}.
@node Pragma Pure_Function,Pragma Rational,Pragma Psect_Object,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{cb}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{cc}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-pure-function}@anchor{ca}@anchor{gnat_rm/implementation_defined_pragmas id31}@anchor{cb}
@section Pragma Pure_Function
@@ -6970,7 +6942,7 @@ unit is not a Pure unit in the categorization sense. So for example, a function
thus marked is free to @code{with} non-pure units.
@node Pragma Rational,Pragma Ravenscar,Pragma Pure_Function,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{cd}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-rational}@anchor{cc}
@section Pragma Rational
@@ -6988,7 +6960,7 @@ pragma Profile (Rational);
@end example
@node Pragma Ravenscar,Pragma Refined_Depends,Pragma Rational,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{ce}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-ravenscar}@anchor{cd}
@section Pragma Ravenscar
@@ -7008,7 +6980,7 @@ pragma Profile (Ravenscar);
which is the preferred method of setting the @code{Ravenscar} profile.
@node Pragma Refined_Depends,Pragma Refined_Global,Pragma Ravenscar,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{cf}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{d0}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-depends}@anchor{ce}@anchor{gnat_rm/implementation_defined_pragmas id32}@anchor{cf}
@section Pragma Refined_Depends
@@ -7041,7 +7013,7 @@ For the semantics of this pragma, see the entry for aspect @code{Refined_Depends
the SPARK 2014 Reference Manual, section 6.1.5.
@node Pragma Refined_Global,Pragma Refined_Post,Pragma Refined_Depends,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d1}@anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d2}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-global}@anchor{d0}@anchor{gnat_rm/implementation_defined_pragmas id33}@anchor{d1}
@section Pragma Refined_Global
@@ -7066,7 +7038,7 @@ For the semantics of this pragma, see the entry for aspect @code{Refined_Global}
the SPARK 2014 Reference Manual, section 6.1.4.
@node Pragma Refined_Post,Pragma Refined_State,Pragma Refined_Global,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d3}@anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d4}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-post}@anchor{d2}@anchor{gnat_rm/implementation_defined_pragmas id34}@anchor{d3}
@section Pragma Refined_Post
@@ -7080,7 +7052,7 @@ For the semantics of this pragma, see the entry for aspect @code{Refined_Post} i
the SPARK 2014 Reference Manual, section 7.2.7.
@node Pragma Refined_State,Pragma Relative_Deadline,Pragma Refined_Post,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d5}@anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d6}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-refined-state}@anchor{d4}@anchor{gnat_rm/implementation_defined_pragmas id35}@anchor{d5}
@section Pragma Refined_State
@@ -7106,7 +7078,7 @@ For the semantics of this pragma, see the entry for aspect @code{Refined_State}
the SPARK 2014 Reference Manual, section 7.2.2.
@node Pragma Relative_Deadline,Pragma Remote_Access_Type,Pragma Refined_State,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d7}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-relative-deadline}@anchor{d6}
@section Pragma Relative_Deadline
@@ -7121,7 +7093,7 @@ versions of Ada as an implementation-defined pragma.
See Ada 2012 Reference Manual for details.
@node Pragma Remote_Access_Type,Pragma Restricted_Run_Time,Pragma Relative_Deadline,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{d8}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{d9}
+@anchor{gnat_rm/implementation_defined_pragmas id36}@anchor{d7}@anchor{gnat_rm/implementation_defined_pragmas pragma-remote-access-type}@anchor{d8}
@section Pragma Remote_Access_Type
@@ -7147,7 +7119,7 @@ pertaining to remote access to class-wide types. At instantiation, the
actual type must be a remote access to class-wide type.
@node Pragma Restricted_Run_Time,Pragma Restriction_Warnings,Pragma Remote_Access_Type,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{da}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-restricted-run-time}@anchor{d9}
@section Pragma Restricted_Run_Time
@@ -7168,7 +7140,7 @@ which is the preferred method of setting the restricted run time
profile.
@node Pragma Restriction_Warnings,Pragma Reviewable,Pragma Restricted_Run_Time,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{db}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-restriction-warnings}@anchor{da}
@section Pragma Restriction_Warnings
@@ -7206,7 +7178,7 @@ generating a warning, but any other use of implementation
defined pragmas will cause a warning to be generated.
@node Pragma Reviewable,Pragma Secondary_Stack_Size,Pragma Restriction_Warnings,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{dc}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-reviewable}@anchor{db}
@section Pragma Reviewable
@@ -7310,7 +7282,7 @@ comprehensive messages identifying possible problems based on this
information.
@node Pragma Secondary_Stack_Size,Pragma Share_Generic,Pragma Reviewable,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{dd}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{de}
+@anchor{gnat_rm/implementation_defined_pragmas id37}@anchor{dc}@anchor{gnat_rm/implementation_defined_pragmas pragma-secondary-stack-size}@anchor{dd}
@section Pragma Secondary_Stack_Size
@@ -7346,7 +7318,7 @@ Note the pragma cannot appear when the restriction @code{No_Secondary_Stack}
is in effect.
@node Pragma Share_Generic,Pragma Shared,Pragma Secondary_Stack_Size,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{df}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-share-generic}@anchor{de}
@section Pragma Share_Generic
@@ -7364,7 +7336,7 @@ than to check that the given names are all names of generic units or
generic instances.
@node Pragma Shared,Pragma Short_Circuit_And_Or,Pragma Share_Generic,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{e0}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e1}
+@anchor{gnat_rm/implementation_defined_pragmas id38}@anchor{df}@anchor{gnat_rm/implementation_defined_pragmas pragma-shared}@anchor{e0}
@section Pragma Shared
@@ -7372,7 +7344,7 @@ This pragma is provided for compatibility with Ada 83. The syntax and
semantics are identical to pragma Atomic.
@node Pragma Short_Circuit_And_Or,Pragma Short_Descriptors,Pragma Shared,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e2}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-short-circuit-and-or}@anchor{e1}
@section Pragma Short_Circuit_And_Or
@@ -7391,7 +7363,7 @@ within the file being compiled, it applies only to the file being compiled.
There is no requirement that all units in a partition use this option.
@node Pragma Short_Descriptors,Pragma Simple_Storage_Pool_Type,Pragma Short_Circuit_And_Or,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e3}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-short-descriptors}@anchor{e2}
@section Pragma Short_Descriptors
@@ -7405,7 +7377,7 @@ This pragma is provided for compatibility with other Ada implementations. It
is recognized but ignored by all current versions of GNAT.
@node Pragma Simple_Storage_Pool_Type,Pragma Source_File_Name,Pragma Short_Descriptors,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e4}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e5}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-simple-storage-pool-type}@anchor{e3}@anchor{gnat_rm/implementation_defined_pragmas id39}@anchor{e4}
@section Pragma Simple_Storage_Pool_Type
@@ -7459,7 +7431,7 @@ storage-management discipline).
An object of a simple storage pool type can be associated with an access
type by specifying the attribute
-@ref{e6,,Simple_Storage_Pool}. For example:
+@ref{e5,,Simple_Storage_Pool}. For example:
@example
My_Pool : My_Simple_Storage_Pool_Type;
@@ -7469,11 +7441,11 @@ type Acc is access My_Data_Type;
for Acc'Simple_Storage_Pool use My_Pool;
@end example
-See attribute @ref{e6,,Simple_Storage_Pool}
+See attribute @ref{e5,,Simple_Storage_Pool}
for further details.
@node Pragma Source_File_Name,Pragma Source_File_Name_Project,Pragma Simple_Storage_Pool_Type,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e7}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{e8}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name}@anchor{e6}@anchor{gnat_rm/implementation_defined_pragmas id40}@anchor{e7}
@section Pragma Source_File_Name
@@ -7565,20 +7537,20 @@ aware of these pragmas, and so other tools that use the projet file would not
be aware of the intended naming conventions. If you are using project files,
file naming is controlled by Source_File_Name_Project pragmas, which are
usually supplied automatically by the project manager. A pragma
-Source_File_Name cannot appear after a @ref{e9,,Pragma Source_File_Name_Project}.
+Source_File_Name cannot appear after a @ref{e8,,Pragma Source_File_Name_Project}.
For more details on the use of the @code{Source_File_Name} pragma, see the
sections on @cite{Using Other File Names} and @cite{Alternative File Naming Schemes}
in the @cite{GNAT User's Guide}.
@node Pragma Source_File_Name_Project,Pragma Source_Reference,Pragma Source_File_Name,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{e9}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{ea}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-source-file-name-project}@anchor{e8}@anchor{gnat_rm/implementation_defined_pragmas id41}@anchor{e9}
@section Pragma Source_File_Name_Project
This pragma has the same syntax and semantics as pragma Source_File_Name.
It is only allowed as a stand-alone configuration pragma.
-It cannot appear after a @ref{e7,,Pragma Source_File_Name}, and
+It cannot appear after a @ref{e6,,Pragma Source_File_Name}, and
most importantly, once pragma Source_File_Name_Project appears,
no further Source_File_Name pragmas are allowed.
@@ -7590,7 +7562,7 @@ Source_File_Name or Source_File_Name_Project pragmas (which would not be
known to the project manager).
@node Pragma Source_Reference,Pragma SPARK_Mode,Pragma Source_File_Name_Project,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{eb}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-source-reference}@anchor{ea}
@section Pragma Source_Reference
@@ -7614,7 +7586,7 @@ string expression other than a string literal. This is because its value
is needed for error messages issued by all phases of the compiler.
@node Pragma SPARK_Mode,Pragma Static_Elaboration_Desired,Pragma Source_Reference,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{ec}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{ed}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-spark-mode}@anchor{eb}@anchor{gnat_rm/implementation_defined_pragmas id42}@anchor{ec}
@section Pragma SPARK_Mode
@@ -7696,7 +7668,7 @@ SPARK_Mode (@code{Off}), then that pragma will need to be repeated in
the package body.
@node Pragma Static_Elaboration_Desired,Pragma Stream_Convert,Pragma SPARK_Mode,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{ee}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-static-elaboration-desired}@anchor{ed}
@section Pragma Static_Elaboration_Desired
@@ -7720,7 +7692,7 @@ construction of larger aggregates with static components that include an others
choice.)
@node Pragma Stream_Convert,Pragma Style_Checks,Pragma Static_Elaboration_Desired,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{ef}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-stream-convert}@anchor{ee}
@section Pragma Stream_Convert
@@ -7797,7 +7769,7 @@ the pragma is silently ignored, and the default implementation of the stream
attributes is used instead.
@node Pragma Style_Checks,Pragma Subtitle,Pragma Stream_Convert,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{f0}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-style-checks}@anchor{ef}
@section Pragma Style_Checks
@@ -7870,7 +7842,7 @@ Rf2 : Integer := ARG; -- OK, no error
@end example
@node Pragma Subtitle,Pragma Suppress,Pragma Style_Checks,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f1}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-subtitle}@anchor{f0}
@section Pragma Subtitle
@@ -7884,7 +7856,7 @@ This pragma is recognized for compatibility with other Ada compilers
but is ignored by GNAT.
@node Pragma Suppress,Pragma Suppress_All,Pragma Subtitle,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f2}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress}@anchor{f1}
@section Pragma Suppress
@@ -7957,7 +7929,7 @@ Of course, run-time checks are omitted whenever the compiler can prove
that they will not fail, whether or not checks are suppressed.
@node Pragma Suppress_All,Pragma Suppress_Debug_Info,Pragma Suppress,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f3}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-all}@anchor{f2}
@section Pragma Suppress_All
@@ -7976,7 +7948,7 @@ The use of the standard Ada pragma @code{Suppress (All_Checks)}
as a normal configuration pragma is the preferred usage in GNAT.
@node Pragma Suppress_Debug_Info,Pragma Suppress_Exception_Locations,Pragma Suppress_All,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f4}@anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f5}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-debug-info}@anchor{f3}@anchor{gnat_rm/implementation_defined_pragmas id43}@anchor{f4}
@section Pragma Suppress_Debug_Info
@@ -7991,7 +7963,7 @@ for the specified entity. It is intended primarily for use in debugging
the debugger, and navigating around debugger problems.
@node Pragma Suppress_Exception_Locations,Pragma Suppress_Initialization,Pragma Suppress_Debug_Info,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f6}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-exception-locations}@anchor{f5}
@section Pragma Suppress_Exception_Locations
@@ -8014,7 +7986,7 @@ a partition, so it is fine to have some units within a partition compiled
with this pragma and others compiled in normal mode without it.
@node Pragma Suppress_Initialization,Pragma Task_Name,Pragma Suppress_Exception_Locations,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{f7}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f8}
+@anchor{gnat_rm/implementation_defined_pragmas id44}@anchor{f6}@anchor{gnat_rm/implementation_defined_pragmas pragma-suppress-initialization}@anchor{f7}
@section Pragma Suppress_Initialization
@@ -8059,7 +8031,7 @@ is suppressed, just as though its subtype had been given in a pragma
Suppress_Initialization, as described above.
@node Pragma Task_Name,Pragma Task_Storage,Pragma Suppress_Initialization,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{f9}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-task-name}@anchor{f8}
@section Pragma Task_Name
@@ -8115,7 +8087,7 @@ end;
@end example
@node Pragma Task_Storage,Pragma Test_Case,Pragma Task_Name,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{fa}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-task-storage}@anchor{f9}
@section Pragma Task_Storage
@@ -8135,7 +8107,7 @@ created, depending on the target. This pragma can appear anywhere a
type.
@node Pragma Test_Case,Pragma Thread_Local_Storage,Pragma Task_Storage,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fb}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{fc}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-test-case}@anchor{fa}@anchor{gnat_rm/implementation_defined_pragmas id45}@anchor{fb}
@section Pragma Test_Case
@@ -8191,7 +8163,7 @@ postcondition. Mode @code{Robustness} indicates that the precondition and
postcondition of the subprogram should be ignored for this test case.
@node Pragma Thread_Local_Storage,Pragma Time_Slice,Pragma Test_Case,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{fd}@anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{fe}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-thread-local-storage}@anchor{fc}@anchor{gnat_rm/implementation_defined_pragmas id46}@anchor{fd}
@section Pragma Thread_Local_Storage
@@ -8229,7 +8201,7 @@ If this pragma is used on a system where @code{TLS} is not supported,
then an error message will be generated and the program will be rejected.
@node Pragma Time_Slice,Pragma Title,Pragma Thread_Local_Storage,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{ff}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-time-slice}@anchor{fe}
@section Pragma Time_Slice
@@ -8245,7 +8217,7 @@ It is ignored if it is used in a system that does not allow this control,
or if it appears in other than the main program unit.
@node Pragma Title,Pragma Type_Invariant,Pragma Time_Slice,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{100}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-title}@anchor{ff}
@section Pragma Title
@@ -8270,7 +8242,7 @@ notation is used, and named and positional notation can be mixed
following the normal rules for procedure calls in Ada.
@node Pragma Type_Invariant,Pragma Type_Invariant_Class,Pragma Title,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{101}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant}@anchor{100}
@section Pragma Type_Invariant
@@ -8291,7 +8263,7 @@ controlled by the assertion identifier @code{Type_Invariant}
rather than @code{Invariant}.
@node Pragma Type_Invariant_Class,Pragma Unchecked_Union,Pragma Type_Invariant,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{102}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{103}
+@anchor{gnat_rm/implementation_defined_pragmas id47}@anchor{101}@anchor{gnat_rm/implementation_defined_pragmas pragma-type-invariant-class}@anchor{102}
@section Pragma Type_Invariant_Class
@@ -8318,7 +8290,7 @@ policy that controls this pragma is @code{Type_Invariant'Class},
not @code{Type_Invariant_Class}.
@node Pragma Unchecked_Union,Pragma Unevaluated_Use_Of_Old,Pragma Type_Invariant_Class,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{104}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unchecked-union}@anchor{103}
@section Pragma Unchecked_Union
@@ -8338,7 +8310,7 @@ version in all language modes (Ada 83, Ada 95, and Ada 2005). For full
details, consult the Ada 2012 Reference Manual, section B.3.3.
@node Pragma Unevaluated_Use_Of_Old,Pragma Unimplemented_Unit,Pragma Unchecked_Union,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{105}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unevaluated-use-of-old}@anchor{104}
@section Pragma Unevaluated_Use_Of_Old
@@ -8393,7 +8365,7 @@ uses up to the end of the corresponding statement sequence or
sequence of package declarations.
@node Pragma Unimplemented_Unit,Pragma Universal_Aliasing,Pragma Unevaluated_Use_Of_Old,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{106}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unimplemented-unit}@anchor{105}
@section Pragma Unimplemented_Unit
@@ -8413,7 +8385,7 @@ The abort only happens if code is being generated. Thus you can use
specs of unimplemented packages in syntax or semantic checking mode.
@node Pragma Universal_Aliasing,Pragma Universal_Data,Pragma Unimplemented_Unit,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{107}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{108}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-aliasing}@anchor{106}@anchor{gnat_rm/implementation_defined_pragmas id48}@anchor{107}
@section Pragma Universal_Aliasing
@@ -8432,7 +8404,7 @@ situations in which it must be suppressed, see the section on
@code{Optimization and Strict Aliasing} in the @cite{GNAT User's Guide}.
@node Pragma Universal_Data,Pragma Unmodified,Pragma Universal_Aliasing,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{109}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{10a}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-universal-data}@anchor{108}@anchor{gnat_rm/implementation_defined_pragmas id49}@anchor{109}
@section Pragma Universal_Data
@@ -8456,7 +8428,7 @@ of this pragma is also available by applying the -univ switch on the
compilations of units where universal addressing of the data is desired.
@node Pragma Unmodified,Pragma Unreferenced,Pragma Universal_Data,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10b}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{10c}
+@anchor{gnat_rm/implementation_defined_pragmas id50}@anchor{10a}@anchor{gnat_rm/implementation_defined_pragmas pragma-unmodified}@anchor{10b}
@section Pragma Unmodified
@@ -8490,7 +8462,7 @@ Thus it is never necessary to use @code{pragma Unmodified} for such
variables, though it is harmless to do so.
@node Pragma Unreferenced,Pragma Unreferenced_Objects,Pragma Unmodified,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{10d}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{10e}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced}@anchor{10c}@anchor{gnat_rm/implementation_defined_pragmas id51}@anchor{10d}
@section Pragma Unreferenced
@@ -8550,7 +8522,7 @@ Thus it is never necessary to use @code{pragma Unreferenced} for such
variables, though it is harmless to do so.
@node Pragma Unreferenced_Objects,Pragma Unreserve_All_Interrupts,Pragma Unreferenced,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{10f}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{110}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unreferenced-objects}@anchor{10e}@anchor{gnat_rm/implementation_defined_pragmas id52}@anchor{10f}
@section Pragma Unreferenced_Objects
@@ -8575,7 +8547,7 @@ compiler will automatically suppress unwanted warnings about these variables
not being referenced.
@node Pragma Unreserve_All_Interrupts,Pragma Unsuppress,Pragma Unreferenced_Objects,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{111}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unreserve-all-interrupts}@anchor{110}
@section Pragma Unreserve_All_Interrupts
@@ -8611,7 +8583,7 @@ handled, see pragma @code{Interrupt_State}, which subsumes the functionality
of the @code{Unreserve_All_Interrupts} pragma.
@node Pragma Unsuppress,Pragma Use_VADS_Size,Pragma Unreserve_All_Interrupts,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{112}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unsuppress}@anchor{111}
@section Pragma Unsuppress
@@ -8647,7 +8619,7 @@ number of implementation-defined check names. See the description of pragma
@code{Suppress} for full details.
@node Pragma Use_VADS_Size,Pragma Unused,Pragma Unsuppress,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{113}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-use-vads-size}@anchor{112}
@section Pragma Use_VADS_Size
@@ -8671,7 +8643,7 @@ as implemented in the VADS compiler. See description of the VADS_Size
attribute for further details.
@node Pragma Unused,Pragma Validity_Checks,Pragma Use_VADS_Size,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{114}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{115}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-unused}@anchor{113}@anchor{gnat_rm/implementation_defined_pragmas id53}@anchor{114}
@section Pragma Unused
@@ -8705,7 +8677,7 @@ Thus it is never necessary to use @code{pragma Unmodified} for such
variables, though it is harmless to do so.
@node Pragma Validity_Checks,Pragma Volatile,Pragma Unused,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{116}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-validity-checks}@anchor{115}
@section Pragma Validity_Checks
@@ -8761,7 +8733,7 @@ A := C; -- C will be validity checked
@end example
@node Pragma Volatile,Pragma Volatile_Full_Access,Pragma Validity_Checks,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{117}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{118}
+@anchor{gnat_rm/implementation_defined_pragmas id54}@anchor{116}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile}@anchor{117}
@section Pragma Volatile
@@ -8779,7 +8751,7 @@ implementation of pragma Volatile is upwards compatible with the
implementation in DEC Ada 83.
@node Pragma Volatile_Full_Access,Pragma Volatile_Function,Pragma Volatile,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{119}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{11a}
+@anchor{gnat_rm/implementation_defined_pragmas id55}@anchor{118}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-full-access}@anchor{119}
@section Pragma Volatile_Full_Access
@@ -8804,14 +8776,8 @@ there is no guarantee that all the bits will be accessed if the reference
is not to the whole object; the compiler is allowed (and generally will)
access only part of the object in this case.
-It is not permissible to specify @code{Atomic} and @code{Volatile_Full_Access} for
-the same type or object.
-
-It is not permissible to specify @code{Volatile_Full_Access} for a composite
-(record or array) type or object that has an @code{Aliased} subcomponent.
-
@node Pragma Volatile_Function,Pragma Warning_As_Error,Pragma Volatile_Full_Access,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11b}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{11c}
+@anchor{gnat_rm/implementation_defined_pragmas id56}@anchor{11a}@anchor{gnat_rm/implementation_defined_pragmas pragma-volatile-function}@anchor{11b}
@section Pragma Volatile_Function
@@ -8825,7 +8791,7 @@ For the semantics of this pragma, see the entry for aspect @code{Volatile_Functi
in the SPARK 2014 Reference Manual, section 7.1.2.
@node Pragma Warning_As_Error,Pragma Warnings,Pragma Volatile_Function,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{11d}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-warning-as-error}@anchor{11c}
@section Pragma Warning_As_Error
@@ -8865,7 +8831,7 @@ you can use multiple pragma Warning_As_Error.
The above use of patterns to match the message applies only to warning
messages generated by the front end. This pragma can also be applied to
-warnings provided by the back end and mentioned in @ref{11e,,Pragma Warnings}.
+warnings provided by the back end and mentioned in @ref{11d,,Pragma Warnings}.
By using a single full @emph{-Wxxx} switch in the pragma, such warnings
can also be treated as errors.
@@ -8915,7 +8881,7 @@ the tag is changed from "warning:" to "error:" and the string
"[warning-as-error]" is appended to the end of the message.
@node Pragma Warnings,Pragma Weak_External,Pragma Warning_As_Error,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas id57}@anchor{11f}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{11e}
+@anchor{gnat_rm/implementation_defined_pragmas id57}@anchor{11e}@anchor{gnat_rm/implementation_defined_pragmas pragma-warnings}@anchor{11d}
@section Pragma Warnings
@@ -9071,7 +9037,7 @@ selectively for each tool, and as a consequence to detect useless pragma
Warnings with switch @code{-gnatw.w}.
@node Pragma Weak_External,Pragma Wide_Character_Encoding,Pragma Warnings,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{120}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-weak-external}@anchor{11f}
@section Pragma Weak_External
@@ -9122,7 +9088,7 @@ end External_Module;
@end example
@node Pragma Wide_Character_Encoding,,Pragma Weak_External,Implementation Defined Pragmas
-@anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{121}
+@anchor{gnat_rm/implementation_defined_pragmas pragma-wide-character-encoding}@anchor{120}
@section Pragma Wide_Character_Encoding
@@ -9153,7 +9119,7 @@ encoding within that file, and does not affect withed units, specs,
or subunits.
@node Implementation Defined Aspects,Implementation Defined Attributes,Implementation Defined Pragmas,Top
-@anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{122}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{123}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{124}
+@anchor{gnat_rm/implementation_defined_aspects implementation-defined-aspects}@anchor{121}@anchor{gnat_rm/implementation_defined_aspects doc}@anchor{122}@anchor{gnat_rm/implementation_defined_aspects id1}@anchor{123}
@chapter Implementation Defined Aspects
@@ -9273,7 +9239,7 @@ or attribute definition clause.
@end menu
@node Aspect Abstract_State,Aspect Annotate,,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{125}
+@anchor{gnat_rm/implementation_defined_aspects aspect-abstract-state}@anchor{124}
@section Aspect Abstract_State
@@ -9282,7 +9248,7 @@ or attribute definition clause.
This aspect is equivalent to @ref{1c,,pragma Abstract_State}.
@node Aspect Annotate,Aspect Async_Readers,Aspect Abstract_State,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{126}
+@anchor{gnat_rm/implementation_defined_aspects aspect-annotate}@anchor{125}
@section Aspect Annotate
@@ -9309,7 +9275,7 @@ Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
@end table
@node Aspect Async_Readers,Aspect Async_Writers,Aspect Annotate,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{127}
+@anchor{gnat_rm/implementation_defined_aspects aspect-async-readers}@anchor{126}
@section Aspect Async_Readers
@@ -9318,7 +9284,7 @@ Equivalent to @code{pragma Annotate (ID, ID @{, ARG@}, Entity => Name);}
This boolean aspect is equivalent to @ref{2d,,pragma Async_Readers}.
@node Aspect Async_Writers,Aspect Constant_After_Elaboration,Aspect Async_Readers,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{128}
+@anchor{gnat_rm/implementation_defined_aspects aspect-async-writers}@anchor{127}
@section Aspect Async_Writers
@@ -9327,7 +9293,7 @@ This boolean aspect is equivalent to @ref{2d,,pragma Async_Readers}.
This boolean aspect is equivalent to @ref{30,,pragma Async_Writers}.
@node Aspect Constant_After_Elaboration,Aspect Contract_Cases,Aspect Async_Writers,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{129}
+@anchor{gnat_rm/implementation_defined_aspects aspect-constant-after-elaboration}@anchor{128}
@section Aspect Constant_After_Elaboration
@@ -9336,7 +9302,7 @@ This boolean aspect is equivalent to @ref{30,,pragma Async_Writers}.
This aspect is equivalent to @ref{42,,pragma Constant_After_Elaboration}.
@node Aspect Contract_Cases,Aspect Depends,Aspect Constant_After_Elaboration,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{12a}
+@anchor{gnat_rm/implementation_defined_aspects aspect-contract-cases}@anchor{129}
@section Aspect Contract_Cases
@@ -9347,7 +9313,7 @@ of clauses being enclosed in parentheses so that syntactically it is an
aggregate.
@node Aspect Depends,Aspect Default_Initial_Condition,Aspect Contract_Cases,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{12b}
+@anchor{gnat_rm/implementation_defined_aspects aspect-depends}@anchor{12a}
@section Aspect Depends
@@ -9356,7 +9322,7 @@ aggregate.
This aspect is equivalent to @ref{53,,pragma Depends}.
@node Aspect Default_Initial_Condition,Aspect Dimension,Aspect Depends,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{12c}
+@anchor{gnat_rm/implementation_defined_aspects aspect-default-initial-condition}@anchor{12b}
@section Aspect Default_Initial_Condition
@@ -9365,7 +9331,7 @@ This aspect is equivalent to @ref{53,,pragma Depends}.
This aspect is equivalent to @ref{4e,,pragma Default_Initial_Condition}.
@node Aspect Dimension,Aspect Dimension_System,Aspect Default_Initial_Condition,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{12d}
+@anchor{gnat_rm/implementation_defined_aspects aspect-dimension}@anchor{12c}
@section Aspect Dimension
@@ -9401,7 +9367,7 @@ Note that when the dimensioned type is an integer type, then any
dimension value must be an integer literal.
@node Aspect Dimension_System,Aspect Disable_Controlled,Aspect Dimension,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{12e}
+@anchor{gnat_rm/implementation_defined_aspects aspect-dimension-system}@anchor{12d}
@section Aspect Dimension_System
@@ -9461,7 +9427,7 @@ See section 'Performing Dimensionality Analysis in GNAT' in the GNAT Users
Guide for detailed examples of use of the dimension system.
@node Aspect Disable_Controlled,Aspect Effective_Reads,Aspect Dimension_System,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{12f}
+@anchor{gnat_rm/implementation_defined_aspects aspect-disable-controlled}@anchor{12e}
@section Aspect Disable_Controlled
@@ -9474,7 +9440,7 @@ where for example you might want a record to be controlled or not depending on
whether some run-time check is enabled or suppressed.
@node Aspect Effective_Reads,Aspect Effective_Writes,Aspect Disable_Controlled,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{130}
+@anchor{gnat_rm/implementation_defined_aspects aspect-effective-reads}@anchor{12f}
@section Aspect Effective_Reads
@@ -9483,7 +9449,7 @@ whether some run-time check is enabled or suppressed.
This aspect is equivalent to @ref{59,,pragma Effective_Reads}.
@node Aspect Effective_Writes,Aspect Extensions_Visible,Aspect Effective_Reads,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{131}
+@anchor{gnat_rm/implementation_defined_aspects aspect-effective-writes}@anchor{130}
@section Aspect Effective_Writes
@@ -9492,7 +9458,7 @@ This aspect is equivalent to @ref{59,,pragma Effective_Reads}.
This aspect is equivalent to @ref{5b,,pragma Effective_Writes}.
@node Aspect Extensions_Visible,Aspect Favor_Top_Level,Aspect Effective_Writes,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{132}
+@anchor{gnat_rm/implementation_defined_aspects aspect-extensions-visible}@anchor{131}
@section Aspect Extensions_Visible
@@ -9501,7 +9467,7 @@ This aspect is equivalent to @ref{5b,,pragma Effective_Writes}.
This aspect is equivalent to @ref{67,,pragma Extensions_Visible}.
@node Aspect Favor_Top_Level,Aspect Ghost,Aspect Extensions_Visible,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{133}
+@anchor{gnat_rm/implementation_defined_aspects aspect-favor-top-level}@anchor{132}
@section Aspect Favor_Top_Level
@@ -9510,7 +9476,7 @@ This aspect is equivalent to @ref{67,,pragma Extensions_Visible}.
This boolean aspect is equivalent to @ref{6c,,pragma Favor_Top_Level}.
@node Aspect Ghost,Aspect Global,Aspect Favor_Top_Level,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{134}
+@anchor{gnat_rm/implementation_defined_aspects aspect-ghost}@anchor{133}
@section Aspect Ghost
@@ -9519,7 +9485,7 @@ This boolean aspect is equivalent to @ref{6c,,pragma Favor_Top_Level}.
This aspect is equivalent to @ref{6f,,pragma Ghost}.
@node Aspect Global,Aspect Initial_Condition,Aspect Ghost,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{135}
+@anchor{gnat_rm/implementation_defined_aspects aspect-global}@anchor{134}
@section Aspect Global
@@ -9528,7 +9494,7 @@ This aspect is equivalent to @ref{6f,,pragma Ghost}.
This aspect is equivalent to @ref{71,,pragma Global}.
@node Aspect Initial_Condition,Aspect Initializes,Aspect Global,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{136}
+@anchor{gnat_rm/implementation_defined_aspects aspect-initial-condition}@anchor{135}
@section Aspect Initial_Condition
@@ -9537,7 +9503,7 @@ This aspect is equivalent to @ref{71,,pragma Global}.
This aspect is equivalent to @ref{7f,,pragma Initial_Condition}.
@node Aspect Initializes,Aspect Inline_Always,Aspect Initial_Condition,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{137}
+@anchor{gnat_rm/implementation_defined_aspects aspect-initializes}@anchor{136}
@section Aspect Initializes
@@ -9546,7 +9512,7 @@ This aspect is equivalent to @ref{7f,,pragma Initial_Condition}.
This aspect is equivalent to @ref{81,,pragma Initializes}.
@node Aspect Inline_Always,Aspect Invariant,Aspect Initializes,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{138}
+@anchor{gnat_rm/implementation_defined_aspects aspect-inline-always}@anchor{137}
@section Aspect Inline_Always
@@ -9555,7 +9521,7 @@ This aspect is equivalent to @ref{81,,pragma Initializes}.
This boolean aspect is equivalent to @ref{84,,pragma Inline_Always}.
@node Aspect Invariant,Aspect Invariant'Class,Aspect Inline_Always,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{139}
+@anchor{gnat_rm/implementation_defined_aspects aspect-invariant}@anchor{138}
@section Aspect Invariant
@@ -9566,18 +9532,18 @@ synonym for the language defined aspect @code{Type_Invariant} except
that it is separately controllable using pragma @code{Assertion_Policy}.
@node Aspect Invariant'Class,Aspect Iterable,Aspect Invariant,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{13a}
+@anchor{gnat_rm/implementation_defined_aspects aspect-invariant-class}@anchor{139}
@section Aspect Invariant'Class
@geindex Invariant'Class
-This aspect is equivalent to @ref{103,,pragma Type_Invariant_Class}. It is a
+This aspect is equivalent to @ref{102,,pragma Type_Invariant_Class}. It is a
synonym for the language defined aspect @code{Type_Invariant'Class} except
that it is separately controllable using pragma @code{Assertion_Policy}.
@node Aspect Iterable,Aspect Linker_Section,Aspect Invariant'Class,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13b}
+@anchor{gnat_rm/implementation_defined_aspects aspect-iterable}@anchor{13a}
@section Aspect Iterable
@@ -9657,7 +9623,7 @@ function Get_Element (Cont : Container; Position : Cursor) return Element_Type;
This aspect is used in the GNAT-defined formal container packages.
@node Aspect Linker_Section,Aspect Lock_Free,Aspect Iterable,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13c}
+@anchor{gnat_rm/implementation_defined_aspects aspect-linker-section}@anchor{13b}
@section Aspect Linker_Section
@@ -9666,7 +9632,7 @@ This aspect is used in the GNAT-defined formal container packages.
This aspect is equivalent to @ref{93,,pragma Linker_Section}.
@node Aspect Lock_Free,Aspect Max_Queue_Length,Aspect Linker_Section,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{13d}
+@anchor{gnat_rm/implementation_defined_aspects aspect-lock-free}@anchor{13c}
@section Aspect Lock_Free
@@ -9675,7 +9641,7 @@ This aspect is equivalent to @ref{93,,pragma Linker_Section}.
This boolean aspect is equivalent to @ref{95,,pragma Lock_Free}.
@node Aspect Max_Queue_Length,Aspect No_Caching,Aspect Lock_Free,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13e}
+@anchor{gnat_rm/implementation_defined_aspects aspect-max-queue-length}@anchor{13d}
@section Aspect Max_Queue_Length
@@ -9684,7 +9650,7 @@ This boolean aspect is equivalent to @ref{95,,pragma Lock_Free}.
This aspect is equivalent to @ref{9d,,pragma Max_Queue_Length}.
@node Aspect No_Caching,Aspect No_Elaboration_Code_All,Aspect Max_Queue_Length,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{13f}
+@anchor{gnat_rm/implementation_defined_aspects aspect-no-caching}@anchor{13e}
@section Aspect No_Caching
@@ -9693,7 +9659,7 @@ This aspect is equivalent to @ref{9d,,pragma Max_Queue_Length}.
This boolean aspect is equivalent to @ref{9f,,pragma No_Caching}.
@node Aspect No_Elaboration_Code_All,Aspect No_Inline,Aspect No_Caching,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{140}
+@anchor{gnat_rm/implementation_defined_aspects aspect-no-elaboration-code-all}@anchor{13f}
@section Aspect No_Elaboration_Code_All
@@ -9703,7 +9669,7 @@ This aspect is equivalent to @ref{a3,,pragma No_Elaboration_Code_All}
for a program unit.
@node Aspect No_Inline,Aspect No_Tagged_Streams,Aspect No_Elaboration_Code_All,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{141}
+@anchor{gnat_rm/implementation_defined_aspects aspect-no-inline}@anchor{140}
@section Aspect No_Inline
@@ -9712,7 +9678,7 @@ for a program unit.
This boolean aspect is equivalent to @ref{a6,,pragma No_Inline}.
@node Aspect No_Tagged_Streams,Aspect Object_Size,Aspect No_Inline,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{142}
+@anchor{gnat_rm/implementation_defined_aspects aspect-no-tagged-streams}@anchor{141}
@section Aspect No_Tagged_Streams
@@ -9723,16 +9689,16 @@ argument specifying a root tagged type (thus this aspect can only be
applied to such a type).
@node Aspect Object_Size,Aspect Obsolescent,Aspect No_Tagged_Streams,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{143}
+@anchor{gnat_rm/implementation_defined_aspects aspect-object-size}@anchor{142}
@section Aspect Object_Size
@geindex Object_Size
-This aspect is equivalent to @ref{144,,attribute Object_Size}.
+This aspect is equivalent to @ref{143,,attribute Object_Size}.
@node Aspect Obsolescent,Aspect Part_Of,Aspect Object_Size,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{145}
+@anchor{gnat_rm/implementation_defined_aspects aspect-obsolescent}@anchor{144}
@section Aspect Obsolescent
@@ -9743,7 +9709,7 @@ evaluation of this aspect happens at the point of occurrence, it is not
delayed until the freeze point.
@node Aspect Part_Of,Aspect Persistent_BSS,Aspect Obsolescent,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{146}
+@anchor{gnat_rm/implementation_defined_aspects aspect-part-of}@anchor{145}
@section Aspect Part_Of
@@ -9752,7 +9718,7 @@ delayed until the freeze point.
This aspect is equivalent to @ref{b4,,pragma Part_Of}.
@node Aspect Persistent_BSS,Aspect Predicate,Aspect Part_Of,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{147}
+@anchor{gnat_rm/implementation_defined_aspects aspect-persistent-bss}@anchor{146}
@section Aspect Persistent_BSS
@@ -9761,13 +9727,13 @@ This aspect is equivalent to @ref{b4,,pragma Part_Of}.
This boolean aspect is equivalent to @ref{b7,,pragma Persistent_BSS}.
@node Aspect Predicate,Aspect Pure_Function,Aspect Persistent_BSS,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{148}
+@anchor{gnat_rm/implementation_defined_aspects aspect-predicate}@anchor{147}
@section Aspect Predicate
@geindex Predicate
-This aspect is equivalent to @ref{bf,,pragma Predicate}. It is thus
+This aspect is equivalent to @ref{be,,pragma Predicate}. It is thus
similar to the language defined aspects @code{Dynamic_Predicate}
and @code{Static_Predicate} except that whether the resulting
predicate is static or dynamic is controlled by the form of the
@@ -9775,52 +9741,52 @@ expression. It is also separately controllable using pragma
@code{Assertion_Policy}.
@node Aspect Pure_Function,Aspect Refined_Depends,Aspect Predicate,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{149}
+@anchor{gnat_rm/implementation_defined_aspects aspect-pure-function}@anchor{148}
@section Aspect Pure_Function
@geindex Pure_Function
-This boolean aspect is equivalent to @ref{cb,,pragma Pure_Function}.
+This boolean aspect is equivalent to @ref{ca,,pragma Pure_Function}.
@node Aspect Refined_Depends,Aspect Refined_Global,Aspect Pure_Function,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{14a}
+@anchor{gnat_rm/implementation_defined_aspects aspect-refined-depends}@anchor{149}
@section Aspect Refined_Depends
@geindex Refined_Depends
-This aspect is equivalent to @ref{cf,,pragma Refined_Depends}.
+This aspect is equivalent to @ref{ce,,pragma Refined_Depends}.
@node Aspect Refined_Global,Aspect Refined_Post,Aspect Refined_Depends,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14b}
+@anchor{gnat_rm/implementation_defined_aspects aspect-refined-global}@anchor{14a}
@section Aspect Refined_Global
@geindex Refined_Global
-This aspect is equivalent to @ref{d1,,pragma Refined_Global}.
+This aspect is equivalent to @ref{d0,,pragma Refined_Global}.
@node Aspect Refined_Post,Aspect Refined_State,Aspect Refined_Global,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14c}
+@anchor{gnat_rm/implementation_defined_aspects aspect-refined-post}@anchor{14b}
@section Aspect Refined_Post
@geindex Refined_Post
-This aspect is equivalent to @ref{d3,,pragma Refined_Post}.
+This aspect is equivalent to @ref{d2,,pragma Refined_Post}.
@node Aspect Refined_State,Aspect Relaxed_Initialization,Aspect Refined_Post,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14d}
+@anchor{gnat_rm/implementation_defined_aspects aspect-refined-state}@anchor{14c}
@section Aspect Refined_State
@geindex Refined_State
-This aspect is equivalent to @ref{d5,,pragma Refined_State}.
+This aspect is equivalent to @ref{d4,,pragma Refined_State}.
@node Aspect Relaxed_Initialization,Aspect Remote_Access_Type,Aspect Refined_State,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{14e}
+@anchor{gnat_rm/implementation_defined_aspects aspect-relaxed-initialization}@anchor{14d}
@section Aspect Relaxed_Initialization
@@ -9830,194 +9796,196 @@ For the syntax and semantics of this aspect, see the SPARK 2014 Reference
Manual, section 6.10.
@node Aspect Remote_Access_Type,Aspect Secondary_Stack_Size,Aspect Relaxed_Initialization,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{14f}
+@anchor{gnat_rm/implementation_defined_aspects aspect-remote-access-type}@anchor{14e}
@section Aspect Remote_Access_Type
@geindex Remote_Access_Type
-This aspect is equivalent to @ref{d9,,pragma Remote_Access_Type}.
+This aspect is equivalent to @ref{d8,,pragma Remote_Access_Type}.
@node Aspect Secondary_Stack_Size,Aspect Scalar_Storage_Order,Aspect Remote_Access_Type,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{150}
+@anchor{gnat_rm/implementation_defined_aspects aspect-secondary-stack-size}@anchor{14f}
@section Aspect Secondary_Stack_Size
@geindex Secondary_Stack_Size
-This aspect is equivalent to @ref{de,,pragma Secondary_Stack_Size}.
+This aspect is equivalent to @ref{dd,,pragma Secondary_Stack_Size}.
@node Aspect Scalar_Storage_Order,Aspect Shared,Aspect Secondary_Stack_Size,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{151}
+@anchor{gnat_rm/implementation_defined_aspects aspect-scalar-storage-order}@anchor{150}
@section Aspect Scalar_Storage_Order
@geindex Scalar_Storage_Order
-This aspect is equivalent to a @ref{152,,attribute Scalar_Storage_Order}.
+This aspect is equivalent to a @ref{151,,attribute Scalar_Storage_Order}.
@node Aspect Shared,Aspect Simple_Storage_Pool,Aspect Scalar_Storage_Order,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{153}
+@anchor{gnat_rm/implementation_defined_aspects aspect-shared}@anchor{152}
@section Aspect Shared
@geindex Shared
-This boolean aspect is equivalent to @ref{e1,,pragma Shared}
+This boolean aspect is equivalent to @ref{e0,,pragma Shared}
and is thus a synonym for aspect @code{Atomic}.
@node Aspect Simple_Storage_Pool,Aspect Simple_Storage_Pool_Type,Aspect Shared,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{154}
+@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool}@anchor{153}
@section Aspect Simple_Storage_Pool
@geindex Simple_Storage_Pool
-This aspect is equivalent to @ref{e6,,attribute Simple_Storage_Pool}.
+This aspect is equivalent to @ref{e5,,attribute Simple_Storage_Pool}.
@node Aspect Simple_Storage_Pool_Type,Aspect SPARK_Mode,Aspect Simple_Storage_Pool,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{155}
+@anchor{gnat_rm/implementation_defined_aspects aspect-simple-storage-pool-type}@anchor{154}
@section Aspect Simple_Storage_Pool_Type
@geindex Simple_Storage_Pool_Type
-This boolean aspect is equivalent to @ref{e4,,pragma Simple_Storage_Pool_Type}.
+This boolean aspect is equivalent to @ref{e3,,pragma Simple_Storage_Pool_Type}.
@node Aspect SPARK_Mode,Aspect Suppress_Debug_Info,Aspect Simple_Storage_Pool_Type,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{156}
+@anchor{gnat_rm/implementation_defined_aspects aspect-spark-mode}@anchor{155}
@section Aspect SPARK_Mode
@geindex SPARK_Mode
-This aspect is equivalent to @ref{ec,,pragma SPARK_Mode} and
+This aspect is equivalent to @ref{eb,,pragma SPARK_Mode} and
may be specified for either or both of the specification and body
of a subprogram or package.
@node Aspect Suppress_Debug_Info,Aspect Suppress_Initialization,Aspect SPARK_Mode,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{157}
+@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-debug-info}@anchor{156}
@section Aspect Suppress_Debug_Info
@geindex Suppress_Debug_Info
-This boolean aspect is equivalent to @ref{f4,,pragma Suppress_Debug_Info}.
+This boolean aspect is equivalent to @ref{f3,,pragma Suppress_Debug_Info}.
@node Aspect Suppress_Initialization,Aspect Test_Case,Aspect Suppress_Debug_Info,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{158}
+@anchor{gnat_rm/implementation_defined_aspects aspect-suppress-initialization}@anchor{157}
@section Aspect Suppress_Initialization
@geindex Suppress_Initialization
-This boolean aspect is equivalent to @ref{f8,,pragma Suppress_Initialization}.
+This boolean aspect is equivalent to @ref{f7,,pragma Suppress_Initialization}.
@node Aspect Test_Case,Aspect Thread_Local_Storage,Aspect Suppress_Initialization,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{159}
+@anchor{gnat_rm/implementation_defined_aspects aspect-test-case}@anchor{158}
@section Aspect Test_Case
@geindex Test_Case
-This aspect is equivalent to @ref{fb,,pragma Test_Case}.
+This aspect is equivalent to @ref{fa,,pragma Test_Case}.
@node Aspect Thread_Local_Storage,Aspect Universal_Aliasing,Aspect Test_Case,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{15a}
+@anchor{gnat_rm/implementation_defined_aspects aspect-thread-local-storage}@anchor{159}
@section Aspect Thread_Local_Storage
@geindex Thread_Local_Storage
-This boolean aspect is equivalent to @ref{fd,,pragma Thread_Local_Storage}.
+This boolean aspect is equivalent to @ref{fc,,pragma Thread_Local_Storage}.
@node Aspect Universal_Aliasing,Aspect Universal_Data,Aspect Thread_Local_Storage,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15b}
+@anchor{gnat_rm/implementation_defined_aspects aspect-universal-aliasing}@anchor{15a}
@section Aspect Universal_Aliasing
@geindex Universal_Aliasing
-This boolean aspect is equivalent to @ref{107,,pragma Universal_Aliasing}.
+This boolean aspect is equivalent to @ref{106,,pragma Universal_Aliasing}.
@node Aspect Universal_Data,Aspect Unmodified,Aspect Universal_Aliasing,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{15c}
+@anchor{gnat_rm/implementation_defined_aspects aspect-universal-data}@anchor{15b}
@section Aspect Universal_Data
@geindex Universal_Data
-This aspect is equivalent to @ref{109,,pragma Universal_Data}.
+This aspect is equivalent to @ref{108,,pragma Universal_Data}.
@node Aspect Unmodified,Aspect Unreferenced,Aspect Universal_Data,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15d}
+@anchor{gnat_rm/implementation_defined_aspects aspect-unmodified}@anchor{15c}
@section Aspect Unmodified
@geindex Unmodified
-This boolean aspect is equivalent to @ref{10c,,pragma Unmodified}.
+This boolean aspect is equivalent to @ref{10b,,pragma Unmodified}.
@node Aspect Unreferenced,Aspect Unreferenced_Objects,Aspect Unmodified,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15e}
+@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced}@anchor{15d}
@section Aspect Unreferenced
@geindex Unreferenced
-This boolean aspect is equivalent to @ref{10d,,pragma Unreferenced}. Note that
-in the case of formal parameters, it is not permitted to have aspects for
-a formal parameter, so in this case the pragma form must be used.
+This boolean aspect is equivalent to @ref{10c,,pragma Unreferenced}.
+
+When using the @code{-gnatX} switch, this aspect is also supported on formal
+parameters, which is in particular the only form possible for expression
+functions.
@node Aspect Unreferenced_Objects,Aspect Value_Size,Aspect Unreferenced,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15f}
+@anchor{gnat_rm/implementation_defined_aspects aspect-unreferenced-objects}@anchor{15e}
@section Aspect Unreferenced_Objects
@geindex Unreferenced_Objects
-This boolean aspect is equivalent to @ref{10f,,pragma Unreferenced_Objects}.
+This boolean aspect is equivalent to @ref{10e,,pragma Unreferenced_Objects}.
@node Aspect Value_Size,Aspect Volatile_Full_Access,Aspect Unreferenced_Objects,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{160}
+@anchor{gnat_rm/implementation_defined_aspects aspect-value-size}@anchor{15f}
@section Aspect Value_Size
@geindex Value_Size
-This aspect is equivalent to @ref{161,,attribute Value_Size}.
+This aspect is equivalent to @ref{160,,attribute Value_Size}.
@node Aspect Volatile_Full_Access,Aspect Volatile_Function,Aspect Value_Size,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{162}
+@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-full-access}@anchor{161}
@section Aspect Volatile_Full_Access
@geindex Volatile_Full_Access
-This boolean aspect is equivalent to @ref{11a,,pragma Volatile_Full_Access}.
+This boolean aspect is equivalent to @ref{119,,pragma Volatile_Full_Access}.
@node Aspect Volatile_Function,Aspect Warnings,Aspect Volatile_Full_Access,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{163}
+@anchor{gnat_rm/implementation_defined_aspects aspect-volatile-function}@anchor{162}
@section Aspect Volatile_Function
@geindex Volatile_Function
-This boolean aspect is equivalent to @ref{11c,,pragma Volatile_Function}.
+This boolean aspect is equivalent to @ref{11b,,pragma Volatile_Function}.
@node Aspect Warnings,,Aspect Volatile_Function,Implementation Defined Aspects
-@anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{164}
+@anchor{gnat_rm/implementation_defined_aspects aspect-warnings}@anchor{163}
@section Aspect Warnings
@geindex Warnings
-This aspect is equivalent to the two argument form of @ref{11e,,pragma Warnings},
+This aspect is equivalent to the two argument form of @ref{11d,,pragma Warnings},
where the first argument is @code{ON} or @code{OFF} and the second argument
is the entity.
@node Implementation Defined Attributes,Standard and Implementation Defined Restrictions,Implementation Defined Aspects,Top
-@anchor{gnat_rm/implementation_defined_attributes doc}@anchor{165}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{166}
+@anchor{gnat_rm/implementation_defined_attributes doc}@anchor{164}@anchor{gnat_rm/implementation_defined_attributes implementation-defined-attributes}@anchor{8}@anchor{gnat_rm/implementation_defined_attributes id1}@anchor{165}
@chapter Implementation Defined Attributes
@@ -10082,6 +10050,7 @@ consideration, you should minimize the use of these attributes.
* Attribute Machine_Size::
* Attribute Mantissa::
* Attribute Maximum_Alignment::
+* Attribute Max_Integer_Size::
* Attribute Mechanism_Code::
* Attribute Null_Parameter::
* Attribute Object_Size::
@@ -10119,7 +10088,7 @@ consideration, you should minimize the use of these attributes.
@end menu
@node Attribute Abort_Signal,Attribute Address_Size,,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{167}
+@anchor{gnat_rm/implementation_defined_attributes attribute-abort-signal}@anchor{166}
@section Attribute Abort_Signal
@@ -10133,7 +10102,7 @@ completely outside the normal semantics of Ada, for a user program to
intercept the abort exception).
@node Attribute Address_Size,Attribute Asm_Input,Attribute Abort_Signal,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{168}
+@anchor{gnat_rm/implementation_defined_attributes attribute-address-size}@anchor{167}
@section Attribute Address_Size
@@ -10149,7 +10118,7 @@ reference to System.Address'Size is nonstatic because Address
is a private type.
@node Attribute Asm_Input,Attribute Asm_Output,Attribute Address_Size,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{169}
+@anchor{gnat_rm/implementation_defined_attributes attribute-asm-input}@anchor{168}
@section Attribute Asm_Input
@@ -10163,10 +10132,10 @@ to be a static expression, and is the constraint for the parameter,
value to be used as the input argument. The possible values for the
constant are the same as those used in the RTL, and are dependent on
the configuration file used to built the GCC back end.
-@ref{16a,,Machine Code Insertions}
+@ref{169,,Machine Code Insertions}
@node Attribute Asm_Output,Attribute Atomic_Always_Lock_Free,Attribute Asm_Input,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16b}
+@anchor{gnat_rm/implementation_defined_attributes attribute-asm-output}@anchor{16a}
@section Attribute Asm_Output
@@ -10182,10 +10151,10 @@ result. The possible values for constraint are the same as those used in
the RTL, and are dependent on the configuration file used to build the
GCC back end. If there are no output operands, then this argument may
either be omitted, or explicitly given as @code{No_Output_Operands}.
-@ref{16a,,Machine Code Insertions}
+@ref{169,,Machine Code Insertions}
@node Attribute Atomic_Always_Lock_Free,Attribute Bit,Attribute Asm_Output,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16c}
+@anchor{gnat_rm/implementation_defined_attributes attribute-atomic-always-lock-free}@anchor{16b}
@section Attribute Atomic_Always_Lock_Free
@@ -10197,7 +10166,7 @@ and False otherwise. The result indicate whether atomic operations are
supported by the target for the given type.
@node Attribute Bit,Attribute Bit_Position,Attribute Atomic_Always_Lock_Free,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16d}
+@anchor{gnat_rm/implementation_defined_attributes attribute-bit}@anchor{16c}
@section Attribute Bit
@@ -10228,7 +10197,7 @@ This attribute is designed to be compatible with the DEC Ada 83 definition
and implementation of the @code{Bit} attribute.
@node Attribute Bit_Position,Attribute Code_Address,Attribute Bit,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16e}
+@anchor{gnat_rm/implementation_defined_attributes attribute-bit-position}@anchor{16d}
@section Attribute Bit_Position
@@ -10243,7 +10212,7 @@ type @emph{universal_integer}. The value depends only on the field
the containing record @code{R}.
@node Attribute Code_Address,Attribute Compiler_Version,Attribute Bit_Position,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16f}
+@anchor{gnat_rm/implementation_defined_attributes attribute-code-address}@anchor{16e}
@section Attribute Code_Address
@@ -10286,7 +10255,7 @@ the same value as is returned by the corresponding @code{'Address}
attribute.
@node Attribute Compiler_Version,Attribute Constrained,Attribute Code_Address,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{170}
+@anchor{gnat_rm/implementation_defined_attributes attribute-compiler-version}@anchor{16f}
@section Attribute Compiler_Version
@@ -10297,7 +10266,7 @@ prefix) yields a static string identifying the version of the compiler
being used to compile the unit containing the attribute reference.
@node Attribute Constrained,Attribute Default_Bit_Order,Attribute Compiler_Version,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{171}
+@anchor{gnat_rm/implementation_defined_attributes attribute-constrained}@anchor{170}
@section Attribute Constrained
@@ -10312,7 +10281,7 @@ record type without discriminants is always @code{True}. This usage is
compatible with older Ada compilers, including notably DEC Ada.
@node Attribute Default_Bit_Order,Attribute Default_Scalar_Storage_Order,Attribute Constrained,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{172}
+@anchor{gnat_rm/implementation_defined_attributes attribute-default-bit-order}@anchor{171}
@section Attribute Default_Bit_Order
@@ -10329,7 +10298,7 @@ as a @code{Pos} value (0 for @code{High_Order_First}, 1 for
@code{Default_Bit_Order} in package @code{System}.
@node Attribute Default_Scalar_Storage_Order,Attribute Deref,Attribute Default_Bit_Order,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{173}
+@anchor{gnat_rm/implementation_defined_attributes attribute-default-scalar-storage-order}@anchor{172}
@section Attribute Default_Scalar_Storage_Order
@@ -10346,7 +10315,7 @@ equal to @code{Default_Bit_Order} if unspecified) as a
@code{System.Bit_Order} value. This is a static attribute.
@node Attribute Deref,Attribute Descriptor_Size,Attribute Default_Scalar_Storage_Order,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{174}
+@anchor{gnat_rm/implementation_defined_attributes attribute-deref}@anchor{173}
@section Attribute Deref
@@ -10359,7 +10328,7 @@ a named access-to-@cite{typ} type, except that it yields a variable, so it can b
used on the left side of an assignment.
@node Attribute Descriptor_Size,Attribute Elaborated,Attribute Deref,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{175}
+@anchor{gnat_rm/implementation_defined_attributes attribute-descriptor-size}@anchor{174}
@section Attribute Descriptor_Size
@@ -10388,7 +10357,7 @@ since @code{Positive} has an alignment of 4, the size of the descriptor is
which yields a size of 32 bits, i.e. including 16 bits of padding.
@node Attribute Elaborated,Attribute Elab_Body,Attribute Descriptor_Size,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{176}
+@anchor{gnat_rm/implementation_defined_attributes attribute-elaborated}@anchor{175}
@section Attribute Elaborated
@@ -10403,7 +10372,7 @@ units has been completed. An exception is for units which need no
elaboration, the value is always False for such units.
@node Attribute Elab_Body,Attribute Elab_Spec,Attribute Elaborated,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{177}
+@anchor{gnat_rm/implementation_defined_attributes attribute-elab-body}@anchor{176}
@section Attribute Elab_Body
@@ -10419,7 +10388,7 @@ e.g., if it is necessary to do selective re-elaboration to fix some
error.
@node Attribute Elab_Spec,Attribute Elab_Subp_Body,Attribute Elab_Body,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{178}
+@anchor{gnat_rm/implementation_defined_attributes attribute-elab-spec}@anchor{177}
@section Attribute Elab_Spec
@@ -10435,7 +10404,7 @@ Ada code, e.g., if it is necessary to do selective re-elaboration to fix
some error.
@node Attribute Elab_Subp_Body,Attribute Emax,Attribute Elab_Spec,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{179}
+@anchor{gnat_rm/implementation_defined_attributes attribute-elab-subp-body}@anchor{178}
@section Attribute Elab_Subp_Body
@@ -10449,7 +10418,7 @@ elaboration procedure by the binder in CodePeer mode only and is unrecognized
otherwise.
@node Attribute Emax,Attribute Enabled,Attribute Elab_Subp_Body,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{17a}
+@anchor{gnat_rm/implementation_defined_attributes attribute-emax}@anchor{179}
@section Attribute Emax
@@ -10462,7 +10431,7 @@ the Ada 83 reference manual for an exact description of the semantics of
this attribute.
@node Attribute Enabled,Attribute Enum_Rep,Attribute Emax,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17b}
+@anchor{gnat_rm/implementation_defined_attributes attribute-enabled}@anchor{17a}
@section Attribute Enabled
@@ -10486,7 +10455,7 @@ a @code{pragma Suppress} or @code{pragma Unsuppress} before instantiating
the package or subprogram, controlling whether the check will be present.
@node Attribute Enum_Rep,Attribute Enum_Val,Attribute Enabled,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17c}
+@anchor{gnat_rm/implementation_defined_attributes attribute-enum-rep}@anchor{17b}
@section Attribute Enum_Rep
@@ -10526,7 +10495,7 @@ integer calculation is done at run time, then the call to @code{Enum_Rep}
may raise @code{Constraint_Error}.
@node Attribute Enum_Val,Attribute Epsilon,Attribute Enum_Rep,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17d}
+@anchor{gnat_rm/implementation_defined_attributes attribute-enum-val}@anchor{17c}
@section Attribute Enum_Val
@@ -10552,7 +10521,7 @@ absence of an enumeration representation clause. This is a static
attribute (i.e., the result is static if the argument is static).
@node Attribute Epsilon,Attribute Fast_Math,Attribute Enum_Val,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17e}
+@anchor{gnat_rm/implementation_defined_attributes attribute-epsilon}@anchor{17d}
@section Attribute Epsilon
@@ -10565,7 +10534,7 @@ the Ada 83 reference manual for an exact description of the semantics of
this attribute.
@node Attribute Fast_Math,Attribute Finalization_Size,Attribute Epsilon,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17f}
+@anchor{gnat_rm/implementation_defined_attributes attribute-fast-math}@anchor{17e}
@section Attribute Fast_Math
@@ -10576,7 +10545,7 @@ prefix) yields a static Boolean value that is True if pragma
@code{Fast_Math} is active, and False otherwise.
@node Attribute Finalization_Size,Attribute Fixed_Value,Attribute Fast_Math,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{180}
+@anchor{gnat_rm/implementation_defined_attributes attribute-finalization-size}@anchor{17f}
@section Attribute Finalization_Size
@@ -10594,7 +10563,7 @@ class-wide type whose tag denotes a type with no controlled parts.
Note that only heap-allocated objects contain finalization data.
@node Attribute Fixed_Value,Attribute From_Any,Attribute Finalization_Size,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{181}
+@anchor{gnat_rm/implementation_defined_attributes attribute-fixed-value}@anchor{180}
@section Attribute Fixed_Value
@@ -10621,7 +10590,7 @@ This attribute is primarily intended for use in implementation of the
input-output functions for fixed-point values.
@node Attribute From_Any,Attribute Has_Access_Values,Attribute Fixed_Value,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{182}
+@anchor{gnat_rm/implementation_defined_attributes attribute-from-any}@anchor{181}
@section Attribute From_Any
@@ -10631,7 +10600,7 @@ This internal attribute is used for the generation of remote subprogram
stubs in the context of the Distributed Systems Annex.
@node Attribute Has_Access_Values,Attribute Has_Discriminants,Attribute From_Any,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{183}
+@anchor{gnat_rm/implementation_defined_attributes attribute-has-access-values}@anchor{182}
@section Attribute Has_Access_Values
@@ -10649,7 +10618,7 @@ definitions. If the attribute is applied to a generic private type, it
indicates whether or not the corresponding actual type has access values.
@node Attribute Has_Discriminants,Attribute Img,Attribute Has_Access_Values,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{184}
+@anchor{gnat_rm/implementation_defined_attributes attribute-has-discriminants}@anchor{183}
@section Attribute Has_Discriminants
@@ -10665,7 +10634,7 @@ definitions. If the attribute is applied to a generic private type, it
indicates whether or not the corresponding actual type has discriminants.
@node Attribute Img,Attribute Initialized,Attribute Has_Discriminants,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{185}
+@anchor{gnat_rm/implementation_defined_attributes attribute-img}@anchor{184}
@section Attribute Img
@@ -10695,7 +10664,7 @@ that returns the appropriate string when called. This means that
in an instantiation as a function parameter.
@node Attribute Initialized,Attribute Integer_Value,Attribute Img,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{186}
+@anchor{gnat_rm/implementation_defined_attributes attribute-initialized}@anchor{185}
@section Attribute Initialized
@@ -10705,7 +10674,7 @@ For the syntax and semantics of this attribute, see the SPARK 2014 Reference
Manual, section 6.10.
@node Attribute Integer_Value,Attribute Invalid_Value,Attribute Initialized,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{187}
+@anchor{gnat_rm/implementation_defined_attributes attribute-integer-value}@anchor{186}
@section Attribute Integer_Value
@@ -10733,7 +10702,7 @@ This attribute is primarily intended for use in implementation of the
standard input-output functions for fixed-point values.
@node Attribute Invalid_Value,Attribute Iterable,Attribute Integer_Value,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{188}
+@anchor{gnat_rm/implementation_defined_attributes attribute-invalid-value}@anchor{187}
@section Attribute Invalid_Value
@@ -10747,7 +10716,7 @@ including the ability to modify the value with the binder -Sxx flag and
relevant environment variables at run time.
@node Attribute Iterable,Attribute Large,Attribute Invalid_Value,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{189}
+@anchor{gnat_rm/implementation_defined_attributes attribute-iterable}@anchor{188}
@section Attribute Iterable
@@ -10756,7 +10725,7 @@ relevant environment variables at run time.
Equivalent to Aspect Iterable.
@node Attribute Large,Attribute Library_Level,Attribute Iterable,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{18a}
+@anchor{gnat_rm/implementation_defined_attributes attribute-large}@anchor{189}
@section Attribute Large
@@ -10769,7 +10738,7 @@ the Ada 83 reference manual for an exact description of the semantics of
this attribute.
@node Attribute Library_Level,Attribute Lock_Free,Attribute Large,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18b}
+@anchor{gnat_rm/implementation_defined_attributes attribute-library-level}@anchor{18a}
@section Attribute Library_Level
@@ -10795,7 +10764,7 @@ end Gen;
@end example
@node Attribute Lock_Free,Attribute Loop_Entry,Attribute Library_Level,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{18c}
+@anchor{gnat_rm/implementation_defined_attributes attribute-lock-free}@anchor{18b}
@section Attribute Lock_Free
@@ -10805,7 +10774,7 @@ end Gen;
pragma @code{Lock_Free} applies to P.
@node Attribute Loop_Entry,Attribute Machine_Size,Attribute Lock_Free,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18d}
+@anchor{gnat_rm/implementation_defined_attributes attribute-loop-entry}@anchor{18c}
@section Attribute Loop_Entry
@@ -10835,7 +10804,7 @@ entry. This copy is not performed if the loop is not entered, or if the
corresponding pragmas are ignored or disabled.
@node Attribute Machine_Size,Attribute Mantissa,Attribute Loop_Entry,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18e}
+@anchor{gnat_rm/implementation_defined_attributes attribute-machine-size}@anchor{18d}
@section Attribute Machine_Size
@@ -10845,7 +10814,7 @@ This attribute is identical to the @code{Object_Size} attribute. It is
provided for compatibility with the DEC Ada 83 attribute of this name.
@node Attribute Mantissa,Attribute Maximum_Alignment,Attribute Machine_Size,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18f}
+@anchor{gnat_rm/implementation_defined_attributes attribute-mantissa}@anchor{18e}
@section Attribute Mantissa
@@ -10857,8 +10826,8 @@ The @code{Mantissa} attribute is provided for compatibility with Ada 83. See
the Ada 83 reference manual for an exact description of the semantics of
this attribute.
-@node Attribute Maximum_Alignment,Attribute Mechanism_Code,Attribute Mantissa,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{190}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{191}
+@node Attribute Maximum_Alignment,Attribute Max_Integer_Size,Attribute Mantissa,Implementation Defined Attributes
+@anchor{gnat_rm/implementation_defined_attributes attribute-maximum-alignment}@anchor{18f}@anchor{gnat_rm/implementation_defined_attributes id2}@anchor{190}
@section Attribute Maximum_Alignment
@@ -10873,7 +10842,18 @@ target. This is a static value that can be used to specify the alignment
for an object, guaranteeing that it is properly aligned in all
cases.
-@node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Maximum_Alignment,Implementation Defined Attributes
+@node Attribute Max_Integer_Size,Attribute Mechanism_Code,Attribute Maximum_Alignment,Implementation Defined Attributes
+@anchor{gnat_rm/implementation_defined_attributes attribute-max-integer-size}@anchor{191}
+@section Attribute Max_Integer_Size
+
+
+@geindex Max_Integer_Size
+
+@code{Standard'Max_Integer_Size} (@code{Standard} is the only permissible
+prefix) provides the size of the largest supported integer type for
+the target. The result is a static constant.
+
+@node Attribute Mechanism_Code,Attribute Null_Parameter,Attribute Max_Integer_Size,Implementation Defined Attributes
@anchor{gnat_rm/implementation_defined_attributes attribute-mechanism-code}@anchor{192}
@section Attribute Mechanism_Code
@@ -10930,7 +10910,7 @@ There is no way of indicating this without the @code{Null_Parameter}
attribute.
@node Attribute Object_Size,Attribute Old,Attribute Null_Parameter,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{144}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{194}
+@anchor{gnat_rm/implementation_defined_attributes attribute-object-size}@anchor{143}@anchor{gnat_rm/implementation_defined_attributes id3}@anchor{194}
@section Attribute Object_Size
@@ -11191,7 +11171,7 @@ the Ada 83 reference manual for an exact description of the semantics of
this attribute.
@node Attribute Scalar_Storage_Order,Attribute Simple_Storage_Pool,Attribute Safe_Small,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19e}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{152}
+@anchor{gnat_rm/implementation_defined_attributes id4}@anchor{19e}@anchor{gnat_rm/implementation_defined_attributes attribute-scalar-storage-order}@anchor{151}
@section Attribute Scalar_Storage_Order
@@ -11314,7 +11294,7 @@ Note that debuggers may be unable to display the correct value of scalar
components of a type for which the opposite storage order is specified.
@node Attribute Simple_Storage_Pool,Attribute Small,Attribute Scalar_Storage_Order,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e6}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{19f}
+@anchor{gnat_rm/implementation_defined_attributes attribute-simple-storage-pool}@anchor{e5}@anchor{gnat_rm/implementation_defined_attributes id5}@anchor{19f}
@section Attribute Simple_Storage_Pool
@@ -11906,7 +11886,7 @@ gives the result that would be obtained by applying the attribute to
the corresponding type.
@node Attribute Value_Size,Attribute Wchar_T_Size,Attribute VADS_Size,Implementation Defined Attributes
-@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b0}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{161}
+@anchor{gnat_rm/implementation_defined_attributes id6}@anchor{1b0}@anchor{gnat_rm/implementation_defined_attributes attribute-value-size}@anchor{160}
@section Attribute Value_Size
@@ -12668,7 +12648,7 @@ only declared at the library level.
@geindex No_Local_Timing_Events
-[RM D.7] All objects of type Ada.Timing_Events.Timing_Event are
+[RM D.7] All objects of type Ada.Real_Time.Timing_Events.Timing_Event are
declared at the library level.
@node No_Long_Long_Integers,No_Multiple_Elaboration,No_Local_Timing_Events,Partition-Wide Restrictions
@@ -13764,11 +13744,11 @@ former provides improved compatibility with other implementations
supporting this type. The latter corresponds to the highest precision
floating-point type supported by the hardware. On most machines, this
will be the same as @code{Long_Float}, but on some machines, it will
-correspond to the IEEE extended form. The notable case is all ia32
-(x86) implementations, where @code{Long_Long_Float} corresponds to
-the 80-bit extended precision format supported in hardware on this
-processor. Note that the 128-bit format on SPARC is not supported,
-since this is a software rather than a hardware format.
+correspond to the IEEE extended form. The notable case is all x86
+implementations, where @code{Long_Long_Float} corresponds to the 80-bit
+extended precision format supported in hardware on this processor.
+Note that the 128-bit format on SPARC is not supported, since this
+is a software rather than a hardware format.
@geindex Multidimensional arrays
@@ -15407,8 +15387,7 @@ Manual, and are summarized in Annex M.
A requirement for conforming Ada compilers is that they provide
documentation describing how the implementation deals with each of these
issues. In this chapter you will find each point in Annex M listed,
-followed by a description of how GNAT
-handles the implementation dependence.
+followed by a description of how GNAT handles the implementation dependence.
You can use this chapter as a guide to minimizing implementation
dependent features in your programs if portability to other compilers
@@ -15543,7 +15522,7 @@ further details.
@end itemize
-@multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
+@multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@headitem
Type
@@ -15558,7 +15537,7 @@ Representation
@tab
-8 bit signed
+8-bit signed
@item
@@ -15566,7 +15545,7 @@ Representation
@tab
-(Short) 16 bit signed
+16-bit signed
@item
@@ -15574,7 +15553,7 @@ Representation
@tab
-32 bit signed
+32-bit signed
@item
@@ -15582,9 +15561,9 @@ Representation
@tab
-64 bit signed (on most 64 bit targets,
-depending on the C definition of long).
-32 bit signed (all other targets)
+64-bit signed (on most 64-bit targets,
+depending on the C definition of long)
+32-bit signed (on all other targets)
@item
@@ -15592,7 +15571,16 @@ depending on the C definition of long).
@tab
-64 bit signed
+64-bit signed
+
+@item
+
+@emph{Long_Long_Long_Integer}
+
+@tab
+
+128-bit signed (on 64-bit targets)
+64-bit signed (on 32-bit targets)
@end multitable
@@ -15700,7 +15688,7 @@ supported for fixed point types. See 3.5.9(10)."
Any combinations are permitted that do not result in a small less than
@code{Fine_Delta} and do not result in a mantissa larger than 63 bits.
If the mantissa is larger than 53 bits on machines where Long_Long_Float
-is 64 bits (true of all architectures except ia32), then the output from
+is 64 bits (true of all architectures except x86), then the output from
Text_IO is accurate to only 53 bits, rather than the full mantissa. This
is because floating-point conversions are used to convert fixed point.
@@ -17524,7 +17512,7 @@ perfect result set. See G.2.3(22)."
The result is only defined to be in the perfect result set if the result
can be computed by a single scaling operation involving a scale factor
-representable in 64-bits.
+representable in 64 bits.
@itemize *
@@ -17950,7 +17938,7 @@ For elementary types, the alignment is the minimum of the actual size of
objects of the type divided by @code{Storage_Unit},
and the maximum alignment supported by the target.
(This maximum alignment is given by the GNAT-specific attribute
-@code{Standard'Maximum_Alignment}; see @ref{190,,Attribute Maximum_Alignment}.)
+@code{Standard'Maximum_Alignment}; see @ref{18f,,Attribute Maximum_Alignment}.)
@geindex Maximum_Alignment attribute
@@ -18117,12 +18105,12 @@ type My_Boolean is new Boolean;
for My_Boolean'Size use 32;
@end example
-then values of this type will always be 32 bits long. In the case of
-discrete types, the size can be increased up to 64 bits, with the effect
-that the entire specified field is used to hold the value, sign- or
-zero-extended as appropriate. If more than 64 bits is specified, then
-padding space is allocated after the value, and a warning is issued that
-there are unused bits.
+then values of this type will always be 32-bit long. In the case of discrete
+types, the size can be increased up to 64 bits on 32-bit targets and 128 bits
+on 64-bit targets, with the effect that the entire specified field is used to
+hold the value, sign- or zero-extended as appropriate. If more than 64 bits
+or 128 bits resp. is specified, then padding space is allocated after the
+value, and a warning is issued that there are unused bits.
Similarly the size of records and arrays may be increased, and the effect
is to add padding bits after the value. This also causes a warning message
@@ -18686,8 +18674,9 @@ of this subtype, and must be a multiple of the alignment value.
In addition, component size clauses are allowed which cause the array
to be packed, by specifying a smaller value. A first case is for
-component size values in the range 1 through 63. The value specified
-must not be smaller than the Size of the subtype. GNAT will accurately
+component size values in the range 1 through 63 on 32-bit targets,
+and 1 through 127 on 64-bit targets. The value specified may not
+be smaller than the Size of the subtype. GNAT will accurately
honor all packing requests in this range. For example, if we have:
@example
@@ -19107,7 +19096,8 @@ Any small simple record type with a static size.
@end itemize
For all these cases, if the component subtype size is in the range
-1 through 64, then the effect of the pragma @code{Pack} is exactly as though a
+1 through 63 on 32-bit targets, and 1 through 127 on 64-bit targets,
+then the effect of the pragma @code{Pack} is exactly as though a
component size were specified giving the component subtype size.
All other types are non-packable, they occupy an integral number of storage
@@ -19137,11 +19127,13 @@ using an explicit @code{Component_Size} setting instead, which never generates
a warning, since the intention of the programmer is clear in this case.
GNAT treats packed arrays in one of two ways. If the size of the array is
-known at compile time and is less than 64 bits, then internally the array
-is represented as a single modular type, of exactly the appropriate number
-of bits. If the length is greater than 63 bits, or is not known at compile
-time, then the packed array is represented as an array of bytes, and the
-length is always a multiple of 8 bits.
+known at compile time and is at most 64 bits on 32-bit targets, and at most
+128 bits on 64-bit targets, then internally the array is represented as a
+single modular type, of exactly the appropriate number of bits. If the
+length is greater than 64 bits on 32-bit targets, and greater than 128
+bits on 64-bit targets, or is not known at compile time, then the packed
+array is represented as an array of bytes, and its length is always a
+multiple of 8 bits.
Note that to represent a packed array as a modular type, the alignment must
be suitable for the modular type involved. For example, on typical machines
@@ -19217,7 +19209,7 @@ Components of the following types are considered packable:
@item
Components of an elementary type are packable unless they are aliased,
-independent, or of an atomic type.
+independent or atomic.
@item
Small packed arrays, where the size is statically known, are represented
@@ -19227,10 +19219,10 @@ internally as modular integers, and so they are also packable.
Small simple records, where the size is statically known, are also packable.
@end itemize
-For all these cases, if the @code{'Size} value is in the range 1 through 64, the
-components occupy the exact number of bits corresponding to this value
-and are packed with no padding bits, i.e. they can start on an arbitrary
-bit boundary.
+For all these cases, if the @code{'Size} value is in the range 1 through 64 on
+32-bit targets, and 1 through 128 on 64-bit targets, the components occupy
+the exact number of bits corresponding to this value and are packed with no
+padding bits, i.e. they can start on an arbitrary bit boundary.
All other types are non-packable, they occupy an integral number of storage
units and the only effect of pragma @code{Pack} is to remove alignment gaps.
@@ -19257,7 +19249,7 @@ end record;
pragma Pack (X2);
@end example
-The representation for the record @code{X2} is as follows:
+The representation for the record @code{X2} is as follows on 32-bit targets:
@example
for X2'Size use 224;
@@ -19272,17 +19264,16 @@ end record;
@end example
Studying this example, we see that the packable fields @code{L1}
-and @code{L2} are
-of length equal to their sizes, and placed at specific bit boundaries (and
-not byte boundaries) to
-eliminate padding. But @code{L3} is of a non-packable float type (because
+and @code{L2} are of length equal to their sizes, and placed at
+specific bit boundaries (and not byte boundaries) to eliminate
+padding. But @code{L3} is of a non-packable float type (because
it is aliased), so it is on the next appropriate alignment boundary.
The next two fields are fully packable, so @code{L4} and @code{L5} are
minimally packed with no gaps. However, type @code{Rb2} is a packed
-array that is longer than 64 bits, so it is itself non-packable. Thus
-the @code{L6} field is aligned to the next byte boundary, and takes an
-integral number of bytes, i.e., 72 bits.
+array that is longer than 64 bits, so it is itself non-packable on
+32-bit targets. Thus the @code{L6} field is aligned to the next byte
+boundary, and takes an integral number of bytes, i.e., 72 bits.
@node Record Representation Clauses,Handling of Records with Holes,Pragma Pack for Records,Representation Clauses and Pragmas
@anchor{gnat_rm/representation_clauses_and_pragmas id13}@anchor{28b}@anchor{gnat_rm/representation_clauses_and_pragmas record-representation-clauses}@anchor{28c}
@@ -19303,7 +19294,8 @@ clauses is that the size must be at least the @code{'Size} value of the type
(actually the Value_Size). There are no restrictions due to alignment,
and such components may freely cross storage boundaries.
-Packed arrays with a size up to and including 64 bits are represented
+Packed arrays with a size up to and including 64 bits on 32-bit targets,
+and up to and including 128 bits on 64-bit targets, are represented
internally using a modular type with the appropriate number of bits, and
thus the same lack of restriction applies. For example, if you declare:
@@ -19316,30 +19308,30 @@ for R'Size use 49;
then a component clause for a component of type @code{R} may start on any
specified bit boundary, and may specify a value of 49 bits or greater.
-For packed bit arrays that are longer than 64 bits, there are two
-cases. If the component size is a power of 2 (1,2,4,8,16,32 bits),
-including the important case of single bits or boolean values, then
-there are no limitations on placement of such components, and they
-may start and end at arbitrary bit boundaries.
+For packed bit arrays that are longer than 64 bits on 32-bit targets,
+and longer than 128 bits on 64-bit targets, there are two cases. If the
+component size is a power of 2 (1,2,4,8,16,32,64 bits), including the
+important case of single bits or boolean values, then there are no
+limitations on placement of such components, and they may start and
+end at arbitrary bit boundaries.
-If the component size is not a power of 2 (e.g., 3 or 5), then
-an array of this type longer than 64 bits must always be placed on
-on a storage unit (byte) boundary and occupy an integral number
-of storage units (bytes). Any component clause that does not
-meet this requirement will be rejected.
+If the component size is not a power of 2 (e.g., 3 or 5), then an array
+of this type must always be placed on on a storage unit (byte) boundary
+and occupy an integral number of storage units (bytes). Any component
+clause that does not meet this requirement will be rejected.
-Any aliased component, or component of an aliased type, must
-have its normal alignment and size. A component clause that
-does not meet this requirement will be rejected.
+Any aliased component, or component of an aliased type, must have its
+normal alignment and size. A component clause that does not meet this
+requirement will be rejected.
The tag field of a tagged type always occupies an address sized field at
the start of the record. No component clause may attempt to overlay this
tag. When a tagged type appears as a component, the tag field must have
proper alignment
-In the case of a record extension @code{T1}, of a type @code{T}, no component clause applied
-to the type @code{T1} can specify a storage location that would overlap the first
-@code{T'Size} bytes of the record.
+In the case of a record extension @code{T1}, of a type @code{T}, no component
+clause applied to the type @code{T1} can specify a storage location that
+would overlap the first @code{T'Object_Size} bits of the record.
For all other component types, including non-bit-packed arrays,
the component can be placed at an arbitrary bit boundary,
@@ -19370,8 +19362,7 @@ end record;
@geindex Handling of Records with Holes
As a result of alignment considerations, records may contain "holes"
-or gaps
-which do not correspond to the data bits of any of the components.
+or gaps which do not correspond to the data bits of any of the components.
Record representation clauses can also result in holes in records.
GNAT does not attempt to clear these holes, so in record objects,
@@ -22592,6 +22583,7 @@ of GNAT, and will generate a warning message.
* Ada.Strings.Unbounded.Text_IO (a-suteio.ads): Ada Strings Unbounded Text_IO a-suteio ads.
* Ada.Strings.Wide_Unbounded.Wide_Text_IO (a-swuwti.ads): Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads.
* Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO (a-szuzti.ads): Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads.
+* Ada.Task_Initialization (a-tasini.ads): Ada Task_Initialization a-tasini ads.
* Ada.Text_IO.C_Streams (a-tiocst.ads): Ada Text_IO C_Streams a-tiocst ads.
* Ada.Text_IO.Reset_Standard_Files (a-tirsfi.ads): Ada Text_IO Reset_Standard_Files a-tirsfi ads.
* Ada.Wide_Characters.Unicode (a-wichun.ads): Ada Wide_Characters Unicode a-wichun ads.
@@ -23189,7 +23181,7 @@ This package provides subprograms for Text_IO for unbounded
wide strings, avoiding the necessity for an intermediate operation
with ordinary wide strings.
-@node Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Text_IO C_Streams a-tiocst ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,The GNAT Library
+@node Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,Ada Task_Initialization a-tasini ads,Ada Strings Wide_Unbounded Wide_Text_IO a-swuwti ads,The GNAT Library
@anchor{gnat_rm/the_gnat_library id29}@anchor{309}@anchor{gnat_rm/the_gnat_library ada-strings-wide-wide-unbounded-wide-wide-text-io-a-szuzti-ads}@anchor{30a}
@section @code{Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO} (@code{a-szuzti.ads})
@@ -23206,8 +23198,20 @@ This package provides subprograms for Text_IO for unbounded
wide wide strings, avoiding the necessity for an intermediate operation
with ordinary wide wide strings.
-@node Ada Text_IO C_Streams a-tiocst ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{30b}@anchor{gnat_rm/the_gnat_library id30}@anchor{30c}
+@node Ada Task_Initialization a-tasini ads,Ada Text_IO C_Streams a-tiocst ads,Ada Strings Wide_Wide_Unbounded Wide_Wide_Text_IO a-szuzti ads,The GNAT Library
+@anchor{gnat_rm/the_gnat_library ada-task-initialization-a-tasini-ads}@anchor{30b}@anchor{gnat_rm/the_gnat_library id30}@anchor{30c}
+@section @code{Ada.Task_Initialization} (@code{a-tasini.ads})
+
+
+@geindex Ada.Task_Initialization (a-tasini.ads)
+
+This package provides a way to set a global initialization handler that
+is automatically invoked whenever a task is activated. Handlers are
+parameterless procedures. Note that such a handler is only invoked for
+those tasks activated after the handler is set.
+
+@node Ada Text_IO C_Streams a-tiocst ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Task_Initialization a-tasini ads,The GNAT Library
+@anchor{gnat_rm/the_gnat_library ada-text-io-c-streams-a-tiocst-ads}@anchor{30d}@anchor{gnat_rm/the_gnat_library id31}@anchor{30e}
@section @code{Ada.Text_IO.C_Streams} (@code{a-tiocst.ads})
@@ -23222,7 +23226,7 @@ extracted from a file opened on the Ada side, and an Ada file
can be constructed from a stream opened on the C side.
@node Ada Text_IO Reset_Standard_Files a-tirsfi ads,Ada Wide_Characters Unicode a-wichun ads,Ada Text_IO C_Streams a-tiocst ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{30d}@anchor{gnat_rm/the_gnat_library id31}@anchor{30e}
+@anchor{gnat_rm/the_gnat_library ada-text-io-reset-standard-files-a-tirsfi-ads}@anchor{30f}@anchor{gnat_rm/the_gnat_library id32}@anchor{310}
@section @code{Ada.Text_IO.Reset_Standard_Files} (@code{a-tirsfi.ads})
@@ -23237,7 +23241,7 @@ execution (for example a standard input file may be redefined to be
interactive).
@node Ada Wide_Characters Unicode a-wichun ads,Ada Wide_Text_IO C_Streams a-wtcstr ads,Ada Text_IO Reset_Standard_Files a-tirsfi ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id32}@anchor{30f}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{310}
+@anchor{gnat_rm/the_gnat_library id33}@anchor{311}@anchor{gnat_rm/the_gnat_library ada-wide-characters-unicode-a-wichun-ads}@anchor{312}
@section @code{Ada.Wide_Characters.Unicode} (@code{a-wichun.ads})
@@ -23250,7 +23254,7 @@ This package provides subprograms that allow categorization of
Wide_Character values according to Unicode categories.
@node Ada Wide_Text_IO C_Streams a-wtcstr ads,Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,Ada Wide_Characters Unicode a-wichun ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{311}@anchor{gnat_rm/the_gnat_library id33}@anchor{312}
+@anchor{gnat_rm/the_gnat_library id34}@anchor{313}@anchor{gnat_rm/the_gnat_library ada-wide-text-io-c-streams-a-wtcstr-ads}@anchor{314}
@section @code{Ada.Wide_Text_IO.C_Streams} (@code{a-wtcstr.ads})
@@ -23265,7 +23269,7 @@ extracted from a file opened on the Ada side, and an Ada file
can be constructed from a stream opened on the C side.
@node Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,Ada Wide_Wide_Characters Unicode a-zchuni ads,Ada Wide_Text_IO C_Streams a-wtcstr ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{313}@anchor{gnat_rm/the_gnat_library id34}@anchor{314}
+@anchor{gnat_rm/the_gnat_library ada-wide-text-io-reset-standard-files-a-wrstfi-ads}@anchor{315}@anchor{gnat_rm/the_gnat_library id35}@anchor{316}
@section @code{Ada.Wide_Text_IO.Reset_Standard_Files} (@code{a-wrstfi.ads})
@@ -23280,7 +23284,7 @@ execution (for example a standard input file may be redefined to be
interactive).
@node Ada Wide_Wide_Characters Unicode a-zchuni ads,Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,Ada Wide_Text_IO Reset_Standard_Files a-wrstfi ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id35}@anchor{315}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{316}
+@anchor{gnat_rm/the_gnat_library id36}@anchor{317}@anchor{gnat_rm/the_gnat_library ada-wide-wide-characters-unicode-a-zchuni-ads}@anchor{318}
@section @code{Ada.Wide_Wide_Characters.Unicode} (@code{a-zchuni.ads})
@@ -23293,7 +23297,7 @@ This package provides subprograms that allow categorization of
Wide_Wide_Character values according to Unicode categories.
@node Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,Ada Wide_Wide_Characters Unicode a-zchuni ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id36}@anchor{317}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{318}
+@anchor{gnat_rm/the_gnat_library id37}@anchor{319}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-c-streams-a-ztcstr-ads}@anchor{31a}
@section @code{Ada.Wide_Wide_Text_IO.C_Streams} (@code{a-ztcstr.ads})
@@ -23308,7 +23312,7 @@ extracted from a file opened on the Ada side, and an Ada file
can be constructed from a stream opened on the C side.
@node Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,GNAT Altivec g-altive ads,Ada Wide_Wide_Text_IO C_Streams a-ztcstr ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id37}@anchor{319}@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{31a}
+@anchor{gnat_rm/the_gnat_library ada-wide-wide-text-io-reset-standard-files-a-zrstfi-ads}@anchor{31b}@anchor{gnat_rm/the_gnat_library id38}@anchor{31c}
@section @code{Ada.Wide_Wide_Text_IO.Reset_Standard_Files} (@code{a-zrstfi.ads})
@@ -23323,7 +23327,7 @@ change during execution (for example a standard input file may be
redefined to be interactive).
@node GNAT Altivec g-altive ads,GNAT Altivec Conversions g-altcon ads,Ada Wide_Wide_Text_IO Reset_Standard_Files a-zrstfi ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{31b}@anchor{gnat_rm/the_gnat_library id38}@anchor{31c}
+@anchor{gnat_rm/the_gnat_library gnat-altivec-g-altive-ads}@anchor{31d}@anchor{gnat_rm/the_gnat_library id39}@anchor{31e}
@section @code{GNAT.Altivec} (@code{g-altive.ads})
@@ -23336,7 +23340,7 @@ definitions of constants and types common to all the versions of the
binding.
@node GNAT Altivec Conversions g-altcon ads,GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec g-altive ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{31d}@anchor{gnat_rm/the_gnat_library id39}@anchor{31e}
+@anchor{gnat_rm/the_gnat_library gnat-altivec-conversions-g-altcon-ads}@anchor{31f}@anchor{gnat_rm/the_gnat_library id40}@anchor{320}
@section @code{GNAT.Altivec.Conversions} (@code{g-altcon.ads})
@@ -23347,7 +23351,7 @@ binding.
This package provides the Vector/View conversion routines.
@node GNAT Altivec Vector_Operations g-alveop ads,GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Conversions g-altcon ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{31f}@anchor{gnat_rm/the_gnat_library id40}@anchor{320}
+@anchor{gnat_rm/the_gnat_library id41}@anchor{321}@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-operations-g-alveop-ads}@anchor{322}
@section @code{GNAT.Altivec.Vector_Operations} (@code{g-alveop.ads})
@@ -23361,7 +23365,7 @@ library. The hard binding is provided as a separate package. This unit
is common to both bindings.
@node GNAT Altivec Vector_Types g-alvety ads,GNAT Altivec Vector_Views g-alvevi ads,GNAT Altivec Vector_Operations g-alveop ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{321}@anchor{gnat_rm/the_gnat_library id41}@anchor{322}
+@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-types-g-alvety-ads}@anchor{323}@anchor{gnat_rm/the_gnat_library id42}@anchor{324}
@section @code{GNAT.Altivec.Vector_Types} (@code{g-alvety.ads})
@@ -23373,7 +23377,7 @@ This package exposes the various vector types part of the Ada binding
to AltiVec facilities.
@node GNAT Altivec Vector_Views g-alvevi ads,GNAT Array_Split g-arrspl ads,GNAT Altivec Vector_Types g-alvety ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{323}@anchor{gnat_rm/the_gnat_library id42}@anchor{324}
+@anchor{gnat_rm/the_gnat_library gnat-altivec-vector-views-g-alvevi-ads}@anchor{325}@anchor{gnat_rm/the_gnat_library id43}@anchor{326}
@section @code{GNAT.Altivec.Vector_Views} (@code{g-alvevi.ads})
@@ -23388,7 +23392,7 @@ vector elements and provides a simple way to initialize vector
objects.
@node GNAT Array_Split g-arrspl ads,GNAT AWK g-awk ads,GNAT Altivec Vector_Views g-alvevi ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{325}@anchor{gnat_rm/the_gnat_library id43}@anchor{326}
+@anchor{gnat_rm/the_gnat_library gnat-array-split-g-arrspl-ads}@anchor{327}@anchor{gnat_rm/the_gnat_library id44}@anchor{328}
@section @code{GNAT.Array_Split} (@code{g-arrspl.ads})
@@ -23401,7 +23405,7 @@ an array wherever the separators appear, and provide direct access
to the resulting slices.
@node GNAT AWK g-awk ads,GNAT Bind_Environment g-binenv ads,GNAT Array_Split g-arrspl ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id44}@anchor{327}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{328}
+@anchor{gnat_rm/the_gnat_library id45}@anchor{329}@anchor{gnat_rm/the_gnat_library gnat-awk-g-awk-ads}@anchor{32a}
@section @code{GNAT.AWK} (@code{g-awk.ads})
@@ -23416,7 +23420,7 @@ or more files containing formatted data. The file is viewed as a database
where each record is a line and a field is a data element in this line.
@node GNAT Bind_Environment g-binenv ads,GNAT Branch_Prediction g-brapre ads,GNAT AWK g-awk ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{329}@anchor{gnat_rm/the_gnat_library id45}@anchor{32a}
+@anchor{gnat_rm/the_gnat_library id46}@anchor{32b}@anchor{gnat_rm/the_gnat_library gnat-bind-environment-g-binenv-ads}@anchor{32c}
@section @code{GNAT.Bind_Environment} (@code{g-binenv.ads})
@@ -23429,7 +23433,7 @@ These associations can be specified using the @code{-V} binder command
line switch.
@node GNAT Branch_Prediction g-brapre ads,GNAT Bounded_Buffers g-boubuf ads,GNAT Bind_Environment g-binenv ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id46}@anchor{32b}@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{32c}
+@anchor{gnat_rm/the_gnat_library id47}@anchor{32d}@anchor{gnat_rm/the_gnat_library gnat-branch-prediction-g-brapre-ads}@anchor{32e}
@section @code{GNAT.Branch_Prediction} (@code{g-brapre.ads})
@@ -23440,7 +23444,7 @@ line switch.
Provides routines giving hints to the branch predictor of the code generator.
@node GNAT Bounded_Buffers g-boubuf ads,GNAT Bounded_Mailboxes g-boumai ads,GNAT Branch_Prediction g-brapre ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id47}@anchor{32d}@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{32e}
+@anchor{gnat_rm/the_gnat_library gnat-bounded-buffers-g-boubuf-ads}@anchor{32f}@anchor{gnat_rm/the_gnat_library id48}@anchor{330}
@section @code{GNAT.Bounded_Buffers} (@code{g-boubuf.ads})
@@ -23455,7 +23459,7 @@ useful directly or as parts of the implementations of other abstractions,
such as mailboxes.
@node GNAT Bounded_Mailboxes g-boumai ads,GNAT Bubble_Sort g-bubsor ads,GNAT Bounded_Buffers g-boubuf ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{32f}@anchor{gnat_rm/the_gnat_library id48}@anchor{330}
+@anchor{gnat_rm/the_gnat_library gnat-bounded-mailboxes-g-boumai-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id49}@anchor{332}
@section @code{GNAT.Bounded_Mailboxes} (@code{g-boumai.ads})
@@ -23468,7 +23472,7 @@ such as mailboxes.
Provides a thread-safe asynchronous intertask mailbox communication facility.
@node GNAT Bubble_Sort g-bubsor ads,GNAT Bubble_Sort_A g-busora ads,GNAT Bounded_Mailboxes g-boumai ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{331}@anchor{gnat_rm/the_gnat_library id49}@anchor{332}
+@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-bubsor-ads}@anchor{333}@anchor{gnat_rm/the_gnat_library id50}@anchor{334}
@section @code{GNAT.Bubble_Sort} (@code{g-bubsor.ads})
@@ -23483,7 +23487,7 @@ data items. Exchange and comparison procedures are provided by passing
access-to-procedure values.
@node GNAT Bubble_Sort_A g-busora ads,GNAT Bubble_Sort_G g-busorg ads,GNAT Bubble_Sort g-bubsor ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id50}@anchor{333}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{334}
+@anchor{gnat_rm/the_gnat_library id51}@anchor{335}@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-a-g-busora-ads}@anchor{336}
@section @code{GNAT.Bubble_Sort_A} (@code{g-busora.ads})
@@ -23499,7 +23503,7 @@ access-to-procedure values. This is an older version, retained for
compatibility. Usually @code{GNAT.Bubble_Sort} will be preferable.
@node GNAT Bubble_Sort_G g-busorg ads,GNAT Byte_Order_Mark g-byorma ads,GNAT Bubble_Sort_A g-busora ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{335}@anchor{gnat_rm/the_gnat_library id51}@anchor{336}
+@anchor{gnat_rm/the_gnat_library gnat-bubble-sort-g-g-busorg-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id52}@anchor{338}
@section @code{GNAT.Bubble_Sort_G} (@code{g-busorg.ads})
@@ -23515,7 +23519,7 @@ if the procedures can be inlined, at the expense of duplicating code for
multiple instantiations.
@node GNAT Byte_Order_Mark g-byorma ads,GNAT Byte_Swapping g-bytswa ads,GNAT Bubble_Sort_G g-busorg ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{337}@anchor{gnat_rm/the_gnat_library id52}@anchor{338}
+@anchor{gnat_rm/the_gnat_library gnat-byte-order-mark-g-byorma-ads}@anchor{339}@anchor{gnat_rm/the_gnat_library id53}@anchor{33a}
@section @code{GNAT.Byte_Order_Mark} (@code{g-byorma.ads})
@@ -23531,7 +23535,7 @@ the encoding of the string. The routine includes detection of special XML
sequences for various UCS input formats.
@node GNAT Byte_Swapping g-bytswa ads,GNAT Calendar g-calend ads,GNAT Byte_Order_Mark g-byorma ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{339}@anchor{gnat_rm/the_gnat_library id53}@anchor{33a}
+@anchor{gnat_rm/the_gnat_library gnat-byte-swapping-g-bytswa-ads}@anchor{33b}@anchor{gnat_rm/the_gnat_library id54}@anchor{33c}
@section @code{GNAT.Byte_Swapping} (@code{g-bytswa.ads})
@@ -23545,7 +23549,7 @@ General routines for swapping the bytes in 2-, 4-, and 8-byte quantities.
Machine-specific implementations are available in some cases.
@node GNAT Calendar g-calend ads,GNAT Calendar Time_IO g-catiio ads,GNAT Byte_Swapping g-bytswa ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id54}@anchor{33b}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{33c}
+@anchor{gnat_rm/the_gnat_library id55}@anchor{33d}@anchor{gnat_rm/the_gnat_library gnat-calendar-g-calend-ads}@anchor{33e}
@section @code{GNAT.Calendar} (@code{g-calend.ads})
@@ -23559,7 +23563,7 @@ Also provides conversion of @code{Ada.Calendar.Time} values to and from the
C @code{timeval} format.
@node GNAT Calendar Time_IO g-catiio ads,GNAT CRC32 g-crc32 ads,GNAT Calendar g-calend ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id55}@anchor{33d}@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{33e}
+@anchor{gnat_rm/the_gnat_library id56}@anchor{33f}@anchor{gnat_rm/the_gnat_library gnat-calendar-time-io-g-catiio-ads}@anchor{340}
@section @code{GNAT.Calendar.Time_IO} (@code{g-catiio.ads})
@@ -23570,7 +23574,7 @@ C @code{timeval} format.
@geindex GNAT.Calendar.Time_IO (g-catiio.ads)
@node GNAT CRC32 g-crc32 ads,GNAT Case_Util g-casuti ads,GNAT Calendar Time_IO g-catiio ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id56}@anchor{33f}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{340}
+@anchor{gnat_rm/the_gnat_library id57}@anchor{341}@anchor{gnat_rm/the_gnat_library gnat-crc32-g-crc32-ads}@anchor{342}
@section @code{GNAT.CRC32} (@code{g-crc32.ads})
@@ -23587,7 +23591,7 @@ of this algorithm see
Aug. 1988. Sarwate, D.V.
@node GNAT Case_Util g-casuti ads,GNAT CGI g-cgi ads,GNAT CRC32 g-crc32 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id57}@anchor{341}@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{342}
+@anchor{gnat_rm/the_gnat_library id58}@anchor{343}@anchor{gnat_rm/the_gnat_library gnat-case-util-g-casuti-ads}@anchor{344}
@section @code{GNAT.Case_Util} (@code{g-casuti.ads})
@@ -23602,7 +23606,7 @@ without the overhead of the full casing tables
in @code{Ada.Characters.Handling}.
@node GNAT CGI g-cgi ads,GNAT CGI Cookie g-cgicoo ads,GNAT Case_Util g-casuti ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id58}@anchor{343}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{344}
+@anchor{gnat_rm/the_gnat_library id59}@anchor{345}@anchor{gnat_rm/the_gnat_library gnat-cgi-g-cgi-ads}@anchor{346}
@section @code{GNAT.CGI} (@code{g-cgi.ads})
@@ -23617,7 +23621,7 @@ builds a table whose index is the key and provides some services to deal
with this table.
@node GNAT CGI Cookie g-cgicoo ads,GNAT CGI Debug g-cgideb ads,GNAT CGI g-cgi ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{345}@anchor{gnat_rm/the_gnat_library id59}@anchor{346}
+@anchor{gnat_rm/the_gnat_library gnat-cgi-cookie-g-cgicoo-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id60}@anchor{348}
@section @code{GNAT.CGI.Cookie} (@code{g-cgicoo.ads})
@@ -23632,7 +23636,7 @@ Common Gateway Interface (CGI). It exports services to deal with Web
cookies (piece of information kept in the Web client software).
@node GNAT CGI Debug g-cgideb ads,GNAT Command_Line g-comlin ads,GNAT CGI Cookie g-cgicoo ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{347}@anchor{gnat_rm/the_gnat_library id60}@anchor{348}
+@anchor{gnat_rm/the_gnat_library gnat-cgi-debug-g-cgideb-ads}@anchor{349}@anchor{gnat_rm/the_gnat_library id61}@anchor{34a}
@section @code{GNAT.CGI.Debug} (@code{g-cgideb.ads})
@@ -23644,7 +23648,7 @@ This is a package to help debugging CGI (Common Gateway Interface)
programs written in Ada.
@node GNAT Command_Line g-comlin ads,GNAT Compiler_Version g-comver ads,GNAT CGI Debug g-cgideb ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id61}@anchor{349}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{34a}
+@anchor{gnat_rm/the_gnat_library id62}@anchor{34b}@anchor{gnat_rm/the_gnat_library gnat-command-line-g-comlin-ads}@anchor{34c}
@section @code{GNAT.Command_Line} (@code{g-comlin.ads})
@@ -23657,7 +23661,7 @@ including the ability to scan for named switches with optional parameters
and expand file names using wildcard notations.
@node GNAT Compiler_Version g-comver ads,GNAT Ctrl_C g-ctrl_c ads,GNAT Command_Line g-comlin ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{34b}@anchor{gnat_rm/the_gnat_library id62}@anchor{34c}
+@anchor{gnat_rm/the_gnat_library gnat-compiler-version-g-comver-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id63}@anchor{34e}
@section @code{GNAT.Compiler_Version} (@code{g-comver.ads})
@@ -23675,7 +23679,7 @@ of the compiler if a consistent tool set is used to compile all units
of a partition).
@node GNAT Ctrl_C g-ctrl_c ads,GNAT Current_Exception g-curexc ads,GNAT Compiler_Version g-comver ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{34d}@anchor{gnat_rm/the_gnat_library id63}@anchor{34e}
+@anchor{gnat_rm/the_gnat_library id64}@anchor{34f}@anchor{gnat_rm/the_gnat_library gnat-ctrl-c-g-ctrl-c-ads}@anchor{350}
@section @code{GNAT.Ctrl_C} (@code{g-ctrl_c.ads})
@@ -23686,7 +23690,7 @@ of a partition).
Provides a simple interface to handle Ctrl-C keyboard events.
@node GNAT Current_Exception g-curexc ads,GNAT Debug_Pools g-debpoo ads,GNAT Ctrl_C g-ctrl_c ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id64}@anchor{34f}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{350}
+@anchor{gnat_rm/the_gnat_library id65}@anchor{351}@anchor{gnat_rm/the_gnat_library gnat-current-exception-g-curexc-ads}@anchor{352}
@section @code{GNAT.Current_Exception} (@code{g-curexc.ads})
@@ -23703,7 +23707,7 @@ This is particularly useful in simulating typical facilities for
obtaining information about exceptions provided by Ada 83 compilers.
@node GNAT Debug_Pools g-debpoo ads,GNAT Debug_Utilities g-debuti ads,GNAT Current_Exception g-curexc ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{351}@anchor{gnat_rm/the_gnat_library id65}@anchor{352}
+@anchor{gnat_rm/the_gnat_library gnat-debug-pools-g-debpoo-ads}@anchor{353}@anchor{gnat_rm/the_gnat_library id66}@anchor{354}
@section @code{GNAT.Debug_Pools} (@code{g-debpoo.ads})
@@ -23720,7 +23724,7 @@ problems.
See @code{The GNAT Debug_Pool Facility} section in the @cite{GNAT User's Guide}.
@node GNAT Debug_Utilities g-debuti ads,GNAT Decode_String g-decstr ads,GNAT Debug_Pools g-debpoo ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{353}@anchor{gnat_rm/the_gnat_library id66}@anchor{354}
+@anchor{gnat_rm/the_gnat_library gnat-debug-utilities-g-debuti-ads}@anchor{355}@anchor{gnat_rm/the_gnat_library id67}@anchor{356}
@section @code{GNAT.Debug_Utilities} (@code{g-debuti.ads})
@@ -23733,7 +23737,7 @@ to and from string images of address values. Supports both C and Ada formats
for hexadecimal literals.
@node GNAT Decode_String g-decstr ads,GNAT Decode_UTF8_String g-deutst ads,GNAT Debug_Utilities g-debuti ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id67}@anchor{355}@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{356}
+@anchor{gnat_rm/the_gnat_library gnat-decode-string-g-decstr-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id68}@anchor{358}
@section @code{GNAT.Decode_String} (@code{g-decstr.ads})
@@ -23757,7 +23761,7 @@ Useful in conjunction with Unicode character coding. Note there is a
preinstantiation for UTF-8. See next entry.
@node GNAT Decode_UTF8_String g-deutst ads,GNAT Directory_Operations g-dirope ads,GNAT Decode_String g-decstr ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{357}@anchor{gnat_rm/the_gnat_library id68}@anchor{358}
+@anchor{gnat_rm/the_gnat_library gnat-decode-utf8-string-g-deutst-ads}@anchor{359}@anchor{gnat_rm/the_gnat_library id69}@anchor{35a}
@section @code{GNAT.Decode_UTF8_String} (@code{g-deutst.ads})
@@ -23778,7 +23782,7 @@ preinstantiation for UTF-8. See next entry.
A preinstantiation of GNAT.Decode_Strings for UTF-8 encoding.
@node GNAT Directory_Operations g-dirope ads,GNAT Directory_Operations Iteration g-diopit ads,GNAT Decode_UTF8_String g-deutst ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id69}@anchor{359}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{35a}
+@anchor{gnat_rm/the_gnat_library id70}@anchor{35b}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-g-dirope-ads}@anchor{35c}
@section @code{GNAT.Directory_Operations} (@code{g-dirope.ads})
@@ -23791,7 +23795,7 @@ the current directory, making new directories, and scanning the files in a
directory.
@node GNAT Directory_Operations Iteration g-diopit ads,GNAT Dynamic_HTables g-dynhta ads,GNAT Directory_Operations g-dirope ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id70}@anchor{35b}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{35c}
+@anchor{gnat_rm/the_gnat_library id71}@anchor{35d}@anchor{gnat_rm/the_gnat_library gnat-directory-operations-iteration-g-diopit-ads}@anchor{35e}
@section @code{GNAT.Directory_Operations.Iteration} (@code{g-diopit.ads})
@@ -23803,7 +23807,7 @@ A child unit of GNAT.Directory_Operations providing additional operations
for iterating through directories.
@node GNAT Dynamic_HTables g-dynhta ads,GNAT Dynamic_Tables g-dyntab ads,GNAT Directory_Operations Iteration g-diopit ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id71}@anchor{35d}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{35e}
+@anchor{gnat_rm/the_gnat_library id72}@anchor{35f}@anchor{gnat_rm/the_gnat_library gnat-dynamic-htables-g-dynhta-ads}@anchor{360}
@section @code{GNAT.Dynamic_HTables} (@code{g-dynhta.ads})
@@ -23821,7 +23825,7 @@ dynamic instances of the hash table, while an instantiation of
@code{GNAT.HTable} creates a single instance of the hash table.
@node GNAT Dynamic_Tables g-dyntab ads,GNAT Encode_String g-encstr ads,GNAT Dynamic_HTables g-dynhta ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{35f}@anchor{gnat_rm/the_gnat_library id72}@anchor{360}
+@anchor{gnat_rm/the_gnat_library gnat-dynamic-tables-g-dyntab-ads}@anchor{361}@anchor{gnat_rm/the_gnat_library id73}@anchor{362}
@section @code{GNAT.Dynamic_Tables} (@code{g-dyntab.ads})
@@ -23841,7 +23845,7 @@ dynamic instances of the table, while an instantiation of
@code{GNAT.Table} creates a single instance of the table type.
@node GNAT Encode_String g-encstr ads,GNAT Encode_UTF8_String g-enutst ads,GNAT Dynamic_Tables g-dyntab ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id73}@anchor{361}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{362}
+@anchor{gnat_rm/the_gnat_library id74}@anchor{363}@anchor{gnat_rm/the_gnat_library gnat-encode-string-g-encstr-ads}@anchor{364}
@section @code{GNAT.Encode_String} (@code{g-encstr.ads})
@@ -23863,7 +23867,7 @@ encoding method. Useful in conjunction with Unicode character coding.
Note there is a preinstantiation for UTF-8. See next entry.
@node GNAT Encode_UTF8_String g-enutst ads,GNAT Exception_Actions g-excact ads,GNAT Encode_String g-encstr ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{363}@anchor{gnat_rm/the_gnat_library id74}@anchor{364}
+@anchor{gnat_rm/the_gnat_library gnat-encode-utf8-string-g-enutst-ads}@anchor{365}@anchor{gnat_rm/the_gnat_library id75}@anchor{366}
@section @code{GNAT.Encode_UTF8_String} (@code{g-enutst.ads})
@@ -23884,7 +23888,7 @@ Note there is a preinstantiation for UTF-8. See next entry.
A preinstantiation of GNAT.Encode_Strings for UTF-8 encoding.
@node GNAT Exception_Actions g-excact ads,GNAT Exception_Traces g-exctra ads,GNAT Encode_UTF8_String g-enutst ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{365}@anchor{gnat_rm/the_gnat_library id75}@anchor{366}
+@anchor{gnat_rm/the_gnat_library gnat-exception-actions-g-excact-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id76}@anchor{368}
@section @code{GNAT.Exception_Actions} (@code{g-excact.ads})
@@ -23897,7 +23901,7 @@ for specific exceptions, or when any exception is raised. This
can be used for instance to force a core dump to ease debugging.
@node GNAT Exception_Traces g-exctra ads,GNAT Exceptions g-except ads,GNAT Exception_Actions g-excact ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{367}@anchor{gnat_rm/the_gnat_library id76}@anchor{368}
+@anchor{gnat_rm/the_gnat_library gnat-exception-traces-g-exctra-ads}@anchor{369}@anchor{gnat_rm/the_gnat_library id77}@anchor{36a}
@section @code{GNAT.Exception_Traces} (@code{g-exctra.ads})
@@ -23911,7 +23915,7 @@ Provides an interface allowing to control automatic output upon exception
occurrences.
@node GNAT Exceptions g-except ads,GNAT Expect g-expect ads,GNAT Exception_Traces g-exctra ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id77}@anchor{369}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{36a}
+@anchor{gnat_rm/the_gnat_library id78}@anchor{36b}@anchor{gnat_rm/the_gnat_library gnat-exceptions-g-except-ads}@anchor{36c}
@section @code{GNAT.Exceptions} (@code{g-except.ads})
@@ -23932,7 +23936,7 @@ predefined exceptions, and for example allow raising
@code{Constraint_Error} with a message from a pure subprogram.
@node GNAT Expect g-expect ads,GNAT Expect TTY g-exptty ads,GNAT Exceptions g-except ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id78}@anchor{36b}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{36c}
+@anchor{gnat_rm/the_gnat_library id79}@anchor{36d}@anchor{gnat_rm/the_gnat_library gnat-expect-g-expect-ads}@anchor{36e}
@section @code{GNAT.Expect} (@code{g-expect.ads})
@@ -23948,7 +23952,7 @@ It is not implemented for cross ports, and in particular is not
implemented for VxWorks or LynxOS.
@node GNAT Expect TTY g-exptty ads,GNAT Float_Control g-flocon ads,GNAT Expect g-expect ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id79}@anchor{36d}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{36e}
+@anchor{gnat_rm/the_gnat_library id80}@anchor{36f}@anchor{gnat_rm/the_gnat_library gnat-expect-tty-g-exptty-ads}@anchor{370}
@section @code{GNAT.Expect.TTY} (@code{g-exptty.ads})
@@ -23960,7 +23964,7 @@ ports. It is not implemented for cross ports, and
in particular is not implemented for VxWorks or LynxOS.
@node GNAT Float_Control g-flocon ads,GNAT Formatted_String g-forstr ads,GNAT Expect TTY g-exptty ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id80}@anchor{36f}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{370}
+@anchor{gnat_rm/the_gnat_library id81}@anchor{371}@anchor{gnat_rm/the_gnat_library gnat-float-control-g-flocon-ads}@anchor{372}
@section @code{GNAT.Float_Control} (@code{g-flocon.ads})
@@ -23974,7 +23978,7 @@ library calls may cause this mode to be modified, and the Reset procedure
in this package can be used to reestablish the required mode.
@node GNAT Formatted_String g-forstr ads,GNAT Heap_Sort g-heasor ads,GNAT Float_Control g-flocon ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id81}@anchor{371}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{372}
+@anchor{gnat_rm/the_gnat_library id82}@anchor{373}@anchor{gnat_rm/the_gnat_library gnat-formatted-string-g-forstr-ads}@anchor{374}
@section @code{GNAT.Formatted_String} (@code{g-forstr.ads})
@@ -23989,7 +23993,7 @@ derived from Integer, Float or enumerations as values for the
formatted string.
@node GNAT Heap_Sort g-heasor ads,GNAT Heap_Sort_A g-hesora ads,GNAT Formatted_String g-forstr ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{373}@anchor{gnat_rm/the_gnat_library id82}@anchor{374}
+@anchor{gnat_rm/the_gnat_library id83}@anchor{375}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-heasor-ads}@anchor{376}
@section @code{GNAT.Heap_Sort} (@code{g-heasor.ads})
@@ -24003,7 +24007,7 @@ access-to-procedure values. The algorithm used is a modified heap sort
that performs approximately N*log(N) comparisons in the worst case.
@node GNAT Heap_Sort_A g-hesora ads,GNAT Heap_Sort_G g-hesorg ads,GNAT Heap_Sort g-heasor ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id83}@anchor{375}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{376}
+@anchor{gnat_rm/the_gnat_library gnat-heap-sort-a-g-hesora-ads}@anchor{377}@anchor{gnat_rm/the_gnat_library id84}@anchor{378}
@section @code{GNAT.Heap_Sort_A} (@code{g-hesora.ads})
@@ -24019,7 +24023,7 @@ This differs from @code{GNAT.Heap_Sort} in having a less convenient
interface, but may be slightly more efficient.
@node GNAT Heap_Sort_G g-hesorg ads,GNAT HTable g-htable ads,GNAT Heap_Sort_A g-hesora ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id84}@anchor{377}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{378}
+@anchor{gnat_rm/the_gnat_library id85}@anchor{379}@anchor{gnat_rm/the_gnat_library gnat-heap-sort-g-g-hesorg-ads}@anchor{37a}
@section @code{GNAT.Heap_Sort_G} (@code{g-hesorg.ads})
@@ -24033,7 +24037,7 @@ if the procedures can be inlined, at the expense of duplicating code for
multiple instantiations.
@node GNAT HTable g-htable ads,GNAT IO g-io ads,GNAT Heap_Sort_G g-hesorg ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id85}@anchor{379}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{37a}
+@anchor{gnat_rm/the_gnat_library id86}@anchor{37b}@anchor{gnat_rm/the_gnat_library gnat-htable-g-htable-ads}@anchor{37c}
@section @code{GNAT.HTable} (@code{g-htable.ads})
@@ -24046,7 +24050,7 @@ data. Provides two approaches, one a simple static approach, and the other
allowing arbitrary dynamic hash tables.
@node GNAT IO g-io ads,GNAT IO_Aux g-io_aux ads,GNAT HTable g-htable ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id86}@anchor{37b}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{37c}
+@anchor{gnat_rm/the_gnat_library id87}@anchor{37d}@anchor{gnat_rm/the_gnat_library gnat-io-g-io-ads}@anchor{37e}
@section @code{GNAT.IO} (@code{g-io.ads})
@@ -24062,7 +24066,7 @@ Standard_Input, and writing characters, strings and integers to either
Standard_Output or Standard_Error.
@node GNAT IO_Aux g-io_aux ads,GNAT Lock_Files g-locfil ads,GNAT IO g-io ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id87}@anchor{37d}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{37e}
+@anchor{gnat_rm/the_gnat_library id88}@anchor{37f}@anchor{gnat_rm/the_gnat_library gnat-io-aux-g-io-aux-ads}@anchor{380}
@section @code{GNAT.IO_Aux} (@code{g-io_aux.ads})
@@ -24076,7 +24080,7 @@ Provides some auxiliary functions for use with Text_IO, including a test
for whether a file exists, and functions for reading a line of text.
@node GNAT Lock_Files g-locfil ads,GNAT MBBS_Discrete_Random g-mbdira ads,GNAT IO_Aux g-io_aux ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id88}@anchor{37f}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{380}
+@anchor{gnat_rm/the_gnat_library id89}@anchor{381}@anchor{gnat_rm/the_gnat_library gnat-lock-files-g-locfil-ads}@anchor{382}
@section @code{GNAT.Lock_Files} (@code{g-locfil.ads})
@@ -24090,7 +24094,7 @@ Provides a general interface for using files as locks. Can be used for
providing program level synchronization.
@node GNAT MBBS_Discrete_Random g-mbdira ads,GNAT MBBS_Float_Random g-mbflra ads,GNAT Lock_Files g-locfil ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id89}@anchor{381}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{382}
+@anchor{gnat_rm/the_gnat_library id90}@anchor{383}@anchor{gnat_rm/the_gnat_library gnat-mbbs-discrete-random-g-mbdira-ads}@anchor{384}
@section @code{GNAT.MBBS_Discrete_Random} (@code{g-mbdira.ads})
@@ -24102,7 +24106,7 @@ The original implementation of @code{Ada.Numerics.Discrete_Random}. Uses
a modified version of the Blum-Blum-Shub generator.
@node GNAT MBBS_Float_Random g-mbflra ads,GNAT MD5 g-md5 ads,GNAT MBBS_Discrete_Random g-mbdira ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id90}@anchor{383}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{384}
+@anchor{gnat_rm/the_gnat_library id91}@anchor{385}@anchor{gnat_rm/the_gnat_library gnat-mbbs-float-random-g-mbflra-ads}@anchor{386}
@section @code{GNAT.MBBS_Float_Random} (@code{g-mbflra.ads})
@@ -24114,7 +24118,7 @@ The original implementation of @code{Ada.Numerics.Float_Random}. Uses
a modified version of the Blum-Blum-Shub generator.
@node GNAT MD5 g-md5 ads,GNAT Memory_Dump g-memdum ads,GNAT MBBS_Float_Random g-mbflra ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id91}@anchor{385}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{386}
+@anchor{gnat_rm/the_gnat_library id92}@anchor{387}@anchor{gnat_rm/the_gnat_library gnat-md5-g-md5-ads}@anchor{388}
@section @code{GNAT.MD5} (@code{g-md5.ads})
@@ -24127,7 +24131,7 @@ the HMAC-MD5 message authentication function as described in RFC 2104 and
FIPS PUB 198.
@node GNAT Memory_Dump g-memdum ads,GNAT Most_Recent_Exception g-moreex ads,GNAT MD5 g-md5 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id92}@anchor{387}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{388}
+@anchor{gnat_rm/the_gnat_library id93}@anchor{389}@anchor{gnat_rm/the_gnat_library gnat-memory-dump-g-memdum-ads}@anchor{38a}
@section @code{GNAT.Memory_Dump} (@code{g-memdum.ads})
@@ -24140,7 +24144,7 @@ standard output or standard error files. Uses GNAT.IO for actual
output.
@node GNAT Most_Recent_Exception g-moreex ads,GNAT OS_Lib g-os_lib ads,GNAT Memory_Dump g-memdum ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{389}@anchor{gnat_rm/the_gnat_library id93}@anchor{38a}
+@anchor{gnat_rm/the_gnat_library gnat-most-recent-exception-g-moreex-ads}@anchor{38b}@anchor{gnat_rm/the_gnat_library id94}@anchor{38c}
@section @code{GNAT.Most_Recent_Exception} (@code{g-moreex.ads})
@@ -24154,7 +24158,7 @@ various logging purposes, including duplicating functionality of some
Ada 83 implementation dependent extensions.
@node GNAT OS_Lib g-os_lib ads,GNAT Perfect_Hash_Generators g-pehage ads,GNAT Most_Recent_Exception g-moreex ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{38b}@anchor{gnat_rm/the_gnat_library id94}@anchor{38c}
+@anchor{gnat_rm/the_gnat_library gnat-os-lib-g-os-lib-ads}@anchor{38d}@anchor{gnat_rm/the_gnat_library id95}@anchor{38e}
@section @code{GNAT.OS_Lib} (@code{g-os_lib.ads})
@@ -24170,7 +24174,7 @@ including a portable spawn procedure, and access to environment variables
and error return codes.
@node GNAT Perfect_Hash_Generators g-pehage ads,GNAT Random_Numbers g-rannum ads,GNAT OS_Lib g-os_lib ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{38d}@anchor{gnat_rm/the_gnat_library id95}@anchor{38e}
+@anchor{gnat_rm/the_gnat_library gnat-perfect-hash-generators-g-pehage-ads}@anchor{38f}@anchor{gnat_rm/the_gnat_library id96}@anchor{390}
@section @code{GNAT.Perfect_Hash_Generators} (@code{g-pehage.ads})
@@ -24188,7 +24192,7 @@ hashcode are in the same order. These hashing functions are very
convenient for use with realtime applications.
@node GNAT Random_Numbers g-rannum ads,GNAT Regexp g-regexp ads,GNAT Perfect_Hash_Generators g-pehage ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{38f}@anchor{gnat_rm/the_gnat_library id96}@anchor{390}
+@anchor{gnat_rm/the_gnat_library gnat-random-numbers-g-rannum-ads}@anchor{391}@anchor{gnat_rm/the_gnat_library id97}@anchor{392}
@section @code{GNAT.Random_Numbers} (@code{g-rannum.ads})
@@ -24200,7 +24204,7 @@ Provides random number capabilities which extend those available in the
standard Ada library and are more convenient to use.
@node GNAT Regexp g-regexp ads,GNAT Registry g-regist ads,GNAT Random_Numbers g-rannum ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{258}@anchor{gnat_rm/the_gnat_library id97}@anchor{391}
+@anchor{gnat_rm/the_gnat_library id98}@anchor{393}@anchor{gnat_rm/the_gnat_library gnat-regexp-g-regexp-ads}@anchor{258}
@section @code{GNAT.Regexp} (@code{g-regexp.ads})
@@ -24216,7 +24220,7 @@ simplest of the three pattern matching packages provided, and is particularly
suitable for 'file globbing' applications.
@node GNAT Registry g-regist ads,GNAT Regpat g-regpat ads,GNAT Regexp g-regexp ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id98}@anchor{392}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{393}
+@anchor{gnat_rm/the_gnat_library id99}@anchor{394}@anchor{gnat_rm/the_gnat_library gnat-registry-g-regist-ads}@anchor{395}
@section @code{GNAT.Registry} (@code{g-regist.ads})
@@ -24230,7 +24234,7 @@ registry API, but at a lower level of abstraction, refer to the Win32.Winreg
package provided with the Win32Ada binding
@node GNAT Regpat g-regpat ads,GNAT Rewrite_Data g-rewdat ads,GNAT Registry g-regist ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id99}@anchor{394}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{395}
+@anchor{gnat_rm/the_gnat_library id100}@anchor{396}@anchor{gnat_rm/the_gnat_library gnat-regpat-g-regpat-ads}@anchor{397}
@section @code{GNAT.Regpat} (@code{g-regpat.ads})
@@ -24245,7 +24249,7 @@ from the original V7 style regular expression library written in C by
Henry Spencer (and binary compatible with this C library).
@node GNAT Rewrite_Data g-rewdat ads,GNAT Secondary_Stack_Info g-sestin ads,GNAT Regpat g-regpat ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id100}@anchor{396}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{397}
+@anchor{gnat_rm/the_gnat_library id101}@anchor{398}@anchor{gnat_rm/the_gnat_library gnat-rewrite-data-g-rewdat-ads}@anchor{399}
@section @code{GNAT.Rewrite_Data} (@code{g-rewdat.ads})
@@ -24259,7 +24263,7 @@ full content to be processed is not loaded into memory all at once. This makes
this interface usable for large files or socket streams.
@node GNAT Secondary_Stack_Info g-sestin ads,GNAT Semaphores g-semaph ads,GNAT Rewrite_Data g-rewdat ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id101}@anchor{398}@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{399}
+@anchor{gnat_rm/the_gnat_library gnat-secondary-stack-info-g-sestin-ads}@anchor{39a}@anchor{gnat_rm/the_gnat_library id102}@anchor{39b}
@section @code{GNAT.Secondary_Stack_Info} (@code{g-sestin.ads})
@@ -24271,7 +24275,7 @@ Provide the capability to query the high water mark of the current task's
secondary stack.
@node GNAT Semaphores g-semaph ads,GNAT Serial_Communications g-sercom ads,GNAT Secondary_Stack_Info g-sestin ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id102}@anchor{39a}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{39b}
+@anchor{gnat_rm/the_gnat_library id103}@anchor{39c}@anchor{gnat_rm/the_gnat_library gnat-semaphores-g-semaph-ads}@anchor{39d}
@section @code{GNAT.Semaphores} (@code{g-semaph.ads})
@@ -24282,7 +24286,7 @@ secondary stack.
Provides classic counting and binary semaphores using protected types.
@node GNAT Serial_Communications g-sercom ads,GNAT SHA1 g-sha1 ads,GNAT Semaphores g-semaph ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{39c}@anchor{gnat_rm/the_gnat_library id103}@anchor{39d}
+@anchor{gnat_rm/the_gnat_library gnat-serial-communications-g-sercom-ads}@anchor{39e}@anchor{gnat_rm/the_gnat_library id104}@anchor{39f}
@section @code{GNAT.Serial_Communications} (@code{g-sercom.ads})
@@ -24294,7 +24298,7 @@ Provides a simple interface to send and receive data over a serial
port. This is only supported on GNU/Linux and Windows.
@node GNAT SHA1 g-sha1 ads,GNAT SHA224 g-sha224 ads,GNAT Serial_Communications g-sercom ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{39e}@anchor{gnat_rm/the_gnat_library id104}@anchor{39f}
+@anchor{gnat_rm/the_gnat_library gnat-sha1-g-sha1-ads}@anchor{3a0}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a1}
@section @code{GNAT.SHA1} (@code{g-sha1.ads})
@@ -24307,7 +24311,7 @@ and RFC 3174, and the HMAC-SHA1 message authentication function as described
in RFC 2104 and FIPS PUB 198.
@node GNAT SHA224 g-sha224 ads,GNAT SHA256 g-sha256 ads,GNAT SHA1 g-sha1 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{3a0}@anchor{gnat_rm/the_gnat_library id105}@anchor{3a1}
+@anchor{gnat_rm/the_gnat_library gnat-sha224-g-sha224-ads}@anchor{3a2}@anchor{gnat_rm/the_gnat_library id106}@anchor{3a3}
@section @code{GNAT.SHA224} (@code{g-sha224.ads})
@@ -24320,7 +24324,7 @@ and the HMAC-SHA224 message authentication function as described
in RFC 2104 and FIPS PUB 198.
@node GNAT SHA256 g-sha256 ads,GNAT SHA384 g-sha384 ads,GNAT SHA224 g-sha224 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{3a2}@anchor{gnat_rm/the_gnat_library id106}@anchor{3a3}
+@anchor{gnat_rm/the_gnat_library gnat-sha256-g-sha256-ads}@anchor{3a4}@anchor{gnat_rm/the_gnat_library id107}@anchor{3a5}
@section @code{GNAT.SHA256} (@code{g-sha256.ads})
@@ -24333,7 +24337,7 @@ and the HMAC-SHA256 message authentication function as described
in RFC 2104 and FIPS PUB 198.
@node GNAT SHA384 g-sha384 ads,GNAT SHA512 g-sha512 ads,GNAT SHA256 g-sha256 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3a4}@anchor{gnat_rm/the_gnat_library id107}@anchor{3a5}
+@anchor{gnat_rm/the_gnat_library id108}@anchor{3a6}@anchor{gnat_rm/the_gnat_library gnat-sha384-g-sha384-ads}@anchor{3a7}
@section @code{GNAT.SHA384} (@code{g-sha384.ads})
@@ -24346,7 +24350,7 @@ and the HMAC-SHA384 message authentication function as described
in RFC 2104 and FIPS PUB 198.
@node GNAT SHA512 g-sha512 ads,GNAT Signals g-signal ads,GNAT SHA384 g-sha384 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id108}@anchor{3a6}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a7}
+@anchor{gnat_rm/the_gnat_library id109}@anchor{3a8}@anchor{gnat_rm/the_gnat_library gnat-sha512-g-sha512-ads}@anchor{3a9}
@section @code{GNAT.SHA512} (@code{g-sha512.ads})
@@ -24359,7 +24363,7 @@ and the HMAC-SHA512 message authentication function as described
in RFC 2104 and FIPS PUB 198.
@node GNAT Signals g-signal ads,GNAT Sockets g-socket ads,GNAT SHA512 g-sha512 ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id109}@anchor{3a8}@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3a9}
+@anchor{gnat_rm/the_gnat_library gnat-signals-g-signal-ads}@anchor{3aa}@anchor{gnat_rm/the_gnat_library id110}@anchor{3ab}
@section @code{GNAT.Signals} (@code{g-signal.ads})
@@ -24371,7 +24375,7 @@ Provides the ability to manipulate the blocked status of signals on supported
targets.
@node GNAT Sockets g-socket ads,GNAT Source_Info g-souinf ads,GNAT Signals g-signal ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3aa}@anchor{gnat_rm/the_gnat_library id110}@anchor{3ab}
+@anchor{gnat_rm/the_gnat_library gnat-sockets-g-socket-ads}@anchor{3ac}@anchor{gnat_rm/the_gnat_library id111}@anchor{3ad}
@section @code{GNAT.Sockets} (@code{g-socket.ads})
@@ -24386,7 +24390,7 @@ on all native GNAT ports and on VxWorks cross prots. It is not implemented for
the LynxOS cross port.
@node GNAT Source_Info g-souinf ads,GNAT Spelling_Checker g-speche ads,GNAT Sockets g-socket ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3ac}@anchor{gnat_rm/the_gnat_library id111}@anchor{3ad}
+@anchor{gnat_rm/the_gnat_library gnat-source-info-g-souinf-ads}@anchor{3ae}@anchor{gnat_rm/the_gnat_library id112}@anchor{3af}
@section @code{GNAT.Source_Info} (@code{g-souinf.ads})
@@ -24400,7 +24404,7 @@ subprograms yielding the date and time of the current compilation (like the
C macros @code{__DATE__} and @code{__TIME__})
@node GNAT Spelling_Checker g-speche ads,GNAT Spelling_Checker_Generic g-spchge ads,GNAT Source_Info g-souinf ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id112}@anchor{3ae}@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3af}
+@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-g-speche-ads}@anchor{3b0}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b1}
@section @code{GNAT.Spelling_Checker} (@code{g-speche.ads})
@@ -24412,7 +24416,7 @@ Provides a function for determining whether one string is a plausible
near misspelling of another string.
@node GNAT Spelling_Checker_Generic g-spchge ads,GNAT Spitbol Patterns g-spipat ads,GNAT Spelling_Checker g-speche ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3b0}@anchor{gnat_rm/the_gnat_library id113}@anchor{3b1}
+@anchor{gnat_rm/the_gnat_library gnat-spelling-checker-generic-g-spchge-ads}@anchor{3b2}@anchor{gnat_rm/the_gnat_library id114}@anchor{3b3}
@section @code{GNAT.Spelling_Checker_Generic} (@code{g-spchge.ads})
@@ -24425,7 +24429,7 @@ determining whether one string is a plausible near misspelling of another
string.
@node GNAT Spitbol Patterns g-spipat ads,GNAT Spitbol g-spitbo ads,GNAT Spelling_Checker_Generic g-spchge ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3b2}@anchor{gnat_rm/the_gnat_library id114}@anchor{3b3}
+@anchor{gnat_rm/the_gnat_library gnat-spitbol-patterns-g-spipat-ads}@anchor{3b4}@anchor{gnat_rm/the_gnat_library id115}@anchor{3b5}
@section @code{GNAT.Spitbol.Patterns} (@code{g-spipat.ads})
@@ -24441,7 +24445,7 @@ the SNOBOL4 dynamic pattern construction and matching capabilities, using the
efficient algorithm developed by Robert Dewar for the SPITBOL system.
@node GNAT Spitbol g-spitbo ads,GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Patterns g-spipat ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3b4}@anchor{gnat_rm/the_gnat_library id115}@anchor{3b5}
+@anchor{gnat_rm/the_gnat_library id116}@anchor{3b6}@anchor{gnat_rm/the_gnat_library gnat-spitbol-g-spitbo-ads}@anchor{3b7}
@section @code{GNAT.Spitbol} (@code{g-spitbo.ads})
@@ -24456,7 +24460,7 @@ useful for constructing arbitrary mappings from strings in the style of
the SNOBOL4 TABLE function.
@node GNAT Spitbol Table_Boolean g-sptabo ads,GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol g-spitbo ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id116}@anchor{3b6}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b7}
+@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-boolean-g-sptabo-ads}@anchor{3b8}@anchor{gnat_rm/the_gnat_library id117}@anchor{3b9}
@section @code{GNAT.Spitbol.Table_Boolean} (@code{g-sptabo.ads})
@@ -24471,7 +24475,7 @@ for type @code{Standard.Boolean}, giving an implementation of sets of
string values.
@node GNAT Spitbol Table_Integer g-sptain ads,GNAT Spitbol Table_VString g-sptavs ads,GNAT Spitbol Table_Boolean g-sptabo ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3b8}@anchor{gnat_rm/the_gnat_library id117}@anchor{3b9}
+@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-integer-g-sptain-ads}@anchor{3ba}@anchor{gnat_rm/the_gnat_library id118}@anchor{3bb}
@section @code{GNAT.Spitbol.Table_Integer} (@code{g-sptain.ads})
@@ -24488,7 +24492,7 @@ for type @code{Standard.Integer}, giving an implementation of maps
from string to integer values.
@node GNAT Spitbol Table_VString g-sptavs ads,GNAT SSE g-sse ads,GNAT Spitbol Table_Integer g-sptain ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id118}@anchor{3ba}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3bb}
+@anchor{gnat_rm/the_gnat_library id119}@anchor{3bc}@anchor{gnat_rm/the_gnat_library gnat-spitbol-table-vstring-g-sptavs-ads}@anchor{3bd}
@section @code{GNAT.Spitbol.Table_VString} (@code{g-sptavs.ads})
@@ -24505,7 +24509,7 @@ a variable length string type, giving an implementation of general
maps from strings to strings.
@node GNAT SSE g-sse ads,GNAT SSE Vector_Types g-ssvety ads,GNAT Spitbol Table_VString g-sptavs ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id119}@anchor{3bc}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3bd}
+@anchor{gnat_rm/the_gnat_library id120}@anchor{3be}@anchor{gnat_rm/the_gnat_library gnat-sse-g-sse-ads}@anchor{3bf}
@section @code{GNAT.SSE} (@code{g-sse.ads})
@@ -24517,7 +24521,7 @@ targets. It exposes vector component types together with a general
introduction to the binding contents and use.
@node GNAT SSE Vector_Types g-ssvety ads,GNAT String_Hash g-strhas ads,GNAT SSE g-sse ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3be}@anchor{gnat_rm/the_gnat_library id120}@anchor{3bf}
+@anchor{gnat_rm/the_gnat_library gnat-sse-vector-types-g-ssvety-ads}@anchor{3c0}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c1}
@section @code{GNAT.SSE.Vector_Types} (@code{g-ssvety.ads})
@@ -24526,7 +24530,7 @@ introduction to the binding contents and use.
SSE vector types for use with SSE related intrinsics.
@node GNAT String_Hash g-strhas ads,GNAT Strings g-string ads,GNAT SSE Vector_Types g-ssvety ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3c0}@anchor{gnat_rm/the_gnat_library id121}@anchor{3c1}
+@anchor{gnat_rm/the_gnat_library gnat-string-hash-g-strhas-ads}@anchor{3c2}@anchor{gnat_rm/the_gnat_library id122}@anchor{3c3}
@section @code{GNAT.String_Hash} (@code{g-strhas.ads})
@@ -24538,7 +24542,7 @@ Provides a generic hash function working on arrays of scalars. Both the scalar
type and the hash result type are parameters.
@node GNAT Strings g-string ads,GNAT String_Split g-strspl ads,GNAT String_Hash g-strhas ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3c2}@anchor{gnat_rm/the_gnat_library id122}@anchor{3c3}
+@anchor{gnat_rm/the_gnat_library id123}@anchor{3c4}@anchor{gnat_rm/the_gnat_library gnat-strings-g-string-ads}@anchor{3c5}
@section @code{GNAT.Strings} (@code{g-string.ads})
@@ -24548,7 +24552,7 @@ Common String access types and related subprograms. Basically it
defines a string access and an array of string access types.
@node GNAT String_Split g-strspl ads,GNAT Table g-table ads,GNAT Strings g-string ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3c4}@anchor{gnat_rm/the_gnat_library id123}@anchor{3c5}
+@anchor{gnat_rm/the_gnat_library gnat-string-split-g-strspl-ads}@anchor{3c6}@anchor{gnat_rm/the_gnat_library id124}@anchor{3c7}
@section @code{GNAT.String_Split} (@code{g-strspl.ads})
@@ -24562,7 +24566,7 @@ to the resulting slices. This package is instantiated from
@code{GNAT.Array_Split}.
@node GNAT Table g-table ads,GNAT Task_Lock g-tasloc ads,GNAT String_Split g-strspl ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id124}@anchor{3c6}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c7}
+@anchor{gnat_rm/the_gnat_library id125}@anchor{3c8}@anchor{gnat_rm/the_gnat_library gnat-table-g-table-ads}@anchor{3c9}
@section @code{GNAT.Table} (@code{g-table.ads})
@@ -24582,7 +24586,7 @@ while an instantiation of @code{GNAT.Dynamic_Tables} creates a type that can be
used to define dynamic instances of the table.
@node GNAT Task_Lock g-tasloc ads,GNAT Time_Stamp g-timsta ads,GNAT Table g-table ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id125}@anchor{3c8}@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3c9}
+@anchor{gnat_rm/the_gnat_library id126}@anchor{3ca}@anchor{gnat_rm/the_gnat_library gnat-task-lock-g-tasloc-ads}@anchor{3cb}
@section @code{GNAT.Task_Lock} (@code{g-tasloc.ads})
@@ -24599,7 +24603,7 @@ single global task lock. Appropriate for use in situations where contention
between tasks is very rarely expected.
@node GNAT Time_Stamp g-timsta ads,GNAT Threads g-thread ads,GNAT Task_Lock g-tasloc ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id126}@anchor{3ca}@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3cb}
+@anchor{gnat_rm/the_gnat_library id127}@anchor{3cc}@anchor{gnat_rm/the_gnat_library gnat-time-stamp-g-timsta-ads}@anchor{3cd}
@section @code{GNAT.Time_Stamp} (@code{g-timsta.ads})
@@ -24614,7 +24618,7 @@ represents the current date and time in ISO 8601 format. This is a very simple
routine with minimal code and there are no dependencies on any other unit.
@node GNAT Threads g-thread ads,GNAT Traceback g-traceb ads,GNAT Time_Stamp g-timsta ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id127}@anchor{3cc}@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3cd}
+@anchor{gnat_rm/the_gnat_library gnat-threads-g-thread-ads}@anchor{3ce}@anchor{gnat_rm/the_gnat_library id128}@anchor{3cf}
@section @code{GNAT.Threads} (@code{g-thread.ads})
@@ -24631,7 +24635,7 @@ further details if your program has threads that are created by a non-Ada
environment which then accesses Ada code.
@node GNAT Traceback g-traceb ads,GNAT Traceback Symbolic g-trasym ads,GNAT Threads g-thread ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id128}@anchor{3ce}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3cf}
+@anchor{gnat_rm/the_gnat_library id129}@anchor{3d0}@anchor{gnat_rm/the_gnat_library gnat-traceback-g-traceb-ads}@anchor{3d1}
@section @code{GNAT.Traceback} (@code{g-traceb.ads})
@@ -24643,7 +24647,7 @@ Provides a facility for obtaining non-symbolic traceback information, useful
in various debugging situations.
@node GNAT Traceback Symbolic g-trasym ads,GNAT UTF_32 g-table ads,GNAT Traceback g-traceb ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3d0}@anchor{gnat_rm/the_gnat_library id129}@anchor{3d1}
+@anchor{gnat_rm/the_gnat_library id130}@anchor{3d2}@anchor{gnat_rm/the_gnat_library gnat-traceback-symbolic-g-trasym-ads}@anchor{3d3}
@section @code{GNAT.Traceback.Symbolic} (@code{g-trasym.ads})
@@ -24652,7 +24656,7 @@ in various debugging situations.
@geindex Trace back facilities
@node GNAT UTF_32 g-table ads,GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Traceback Symbolic g-trasym ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id130}@anchor{3d2}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3d3}
+@anchor{gnat_rm/the_gnat_library id131}@anchor{3d4}@anchor{gnat_rm/the_gnat_library gnat-utf-32-g-table-ads}@anchor{3d5}
@section @code{GNAT.UTF_32} (@code{g-table.ads})
@@ -24671,7 +24675,7 @@ lower case to upper case fold routine corresponding to
the Ada 2005 rules for identifier equivalence.
@node GNAT Wide_Spelling_Checker g-u3spch ads,GNAT Wide_Spelling_Checker g-wispch ads,GNAT UTF_32 g-table ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3d4}@anchor{gnat_rm/the_gnat_library id131}@anchor{3d5}
+@anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-u3spch-ads}@anchor{3d6}@anchor{gnat_rm/the_gnat_library id132}@anchor{3d7}
@section @code{GNAT.Wide_Spelling_Checker} (@code{g-u3spch.ads})
@@ -24684,7 +24688,7 @@ near misspelling of another wide wide string, where the strings are represented
using the UTF_32_String type defined in System.Wch_Cnv.
@node GNAT Wide_Spelling_Checker g-wispch ads,GNAT Wide_String_Split g-wistsp ads,GNAT Wide_Spelling_Checker g-u3spch ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d6}@anchor{gnat_rm/the_gnat_library id132}@anchor{3d7}
+@anchor{gnat_rm/the_gnat_library gnat-wide-spelling-checker-g-wispch-ads}@anchor{3d8}@anchor{gnat_rm/the_gnat_library id133}@anchor{3d9}
@section @code{GNAT.Wide_Spelling_Checker} (@code{g-wispch.ads})
@@ -24696,7 +24700,7 @@ Provides a function for determining whether one wide string is a plausible
near misspelling of another wide string.
@node GNAT Wide_String_Split g-wistsp ads,GNAT Wide_Wide_Spelling_Checker g-zspche ads,GNAT Wide_Spelling_Checker g-wispch ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id133}@anchor{3d8}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3d9}
+@anchor{gnat_rm/the_gnat_library id134}@anchor{3da}@anchor{gnat_rm/the_gnat_library gnat-wide-string-split-g-wistsp-ads}@anchor{3db}
@section @code{GNAT.Wide_String_Split} (@code{g-wistsp.ads})
@@ -24710,7 +24714,7 @@ to the resulting slices. This package is instantiated from
@code{GNAT.Array_Split}.
@node GNAT Wide_Wide_Spelling_Checker g-zspche ads,GNAT Wide_Wide_String_Split g-zistsp ads,GNAT Wide_String_Split g-wistsp ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3da}@anchor{gnat_rm/the_gnat_library id134}@anchor{3db}
+@anchor{gnat_rm/the_gnat_library gnat-wide-wide-spelling-checker-g-zspche-ads}@anchor{3dc}@anchor{gnat_rm/the_gnat_library id135}@anchor{3dd}
@section @code{GNAT.Wide_Wide_Spelling_Checker} (@code{g-zspche.ads})
@@ -24722,7 +24726,7 @@ Provides a function for determining whether one wide wide string is a plausible
near misspelling of another wide wide string.
@node GNAT Wide_Wide_String_Split g-zistsp ads,Interfaces C Extensions i-cexten ads,GNAT Wide_Wide_Spelling_Checker g-zspche ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3dc}@anchor{gnat_rm/the_gnat_library id135}@anchor{3dd}
+@anchor{gnat_rm/the_gnat_library gnat-wide-wide-string-split-g-zistsp-ads}@anchor{3de}@anchor{gnat_rm/the_gnat_library id136}@anchor{3df}
@section @code{GNAT.Wide_Wide_String_Split} (@code{g-zistsp.ads})
@@ -24736,7 +24740,7 @@ to the resulting slices. This package is instantiated from
@code{GNAT.Array_Split}.
@node Interfaces C Extensions i-cexten ads,Interfaces C Streams i-cstrea ads,GNAT Wide_Wide_String_Split g-zistsp ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3de}@anchor{gnat_rm/the_gnat_library id136}@anchor{3df}
+@anchor{gnat_rm/the_gnat_library interfaces-c-extensions-i-cexten-ads}@anchor{3e0}@anchor{gnat_rm/the_gnat_library id137}@anchor{3e1}
@section @code{Interfaces.C.Extensions} (@code{i-cexten.ads})
@@ -24747,7 +24751,7 @@ for use with either manually or automatically generated bindings
to C libraries.
@node Interfaces C Streams i-cstrea ads,Interfaces Packed_Decimal i-pacdec ads,Interfaces C Extensions i-cexten ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3e0}@anchor{gnat_rm/the_gnat_library id137}@anchor{3e1}
+@anchor{gnat_rm/the_gnat_library id138}@anchor{3e2}@anchor{gnat_rm/the_gnat_library interfaces-c-streams-i-cstrea-ads}@anchor{3e3}
@section @code{Interfaces.C.Streams} (@code{i-cstrea.ads})
@@ -24760,7 +24764,7 @@ This package is a binding for the most commonly used operations
on C streams.
@node Interfaces Packed_Decimal i-pacdec ads,Interfaces VxWorks i-vxwork ads,Interfaces C Streams i-cstrea ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id138}@anchor{3e2}@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3e3}
+@anchor{gnat_rm/the_gnat_library interfaces-packed-decimal-i-pacdec-ads}@anchor{3e4}@anchor{gnat_rm/the_gnat_library id139}@anchor{3e5}
@section @code{Interfaces.Packed_Decimal} (@code{i-pacdec.ads})
@@ -24775,7 +24779,7 @@ from a packed decimal format compatible with that used on IBM
mainframes.
@node Interfaces VxWorks i-vxwork ads,Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces Packed_Decimal i-pacdec ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id139}@anchor{3e4}@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3e5}
+@anchor{gnat_rm/the_gnat_library interfaces-vxworks-i-vxwork-ads}@anchor{3e6}@anchor{gnat_rm/the_gnat_library id140}@anchor{3e7}
@section @code{Interfaces.VxWorks} (@code{i-vxwork.ads})
@@ -24791,7 +24795,7 @@ In particular, it interfaces with the
VxWorks hardware interrupt facilities.
@node Interfaces VxWorks Int_Connection i-vxinco ads,Interfaces VxWorks IO i-vxwoio ads,Interfaces VxWorks i-vxwork ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e6}@anchor{gnat_rm/the_gnat_library id140}@anchor{3e7}
+@anchor{gnat_rm/the_gnat_library interfaces-vxworks-int-connection-i-vxinco-ads}@anchor{3e8}@anchor{gnat_rm/the_gnat_library id141}@anchor{3e9}
@section @code{Interfaces.VxWorks.Int_Connection} (@code{i-vxinco.ads})
@@ -24807,7 +24811,7 @@ intConnect() with a custom routine for installing interrupt
handlers.
@node Interfaces VxWorks IO i-vxwoio ads,System Address_Image s-addima ads,Interfaces VxWorks Int_Connection i-vxinco ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3e8}@anchor{gnat_rm/the_gnat_library id141}@anchor{3e9}
+@anchor{gnat_rm/the_gnat_library interfaces-vxworks-io-i-vxwoio-ads}@anchor{3ea}@anchor{gnat_rm/the_gnat_library id142}@anchor{3eb}
@section @code{Interfaces.VxWorks.IO} (@code{i-vxwoio.ads})
@@ -24830,7 +24834,7 @@ function codes. A particular use of this package is
to enable the use of Get_Immediate under VxWorks.
@node System Address_Image s-addima ads,System Assertions s-assert ads,Interfaces VxWorks IO i-vxwoio ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3ea}@anchor{gnat_rm/the_gnat_library id142}@anchor{3eb}
+@anchor{gnat_rm/the_gnat_library system-address-image-s-addima-ads}@anchor{3ec}@anchor{gnat_rm/the_gnat_library id143}@anchor{3ed}
@section @code{System.Address_Image} (@code{s-addima.ads})
@@ -24846,7 +24850,7 @@ function that gives an (implementation dependent)
string which identifies an address.
@node System Assertions s-assert ads,System Atomic_Counters s-atocou ads,System Address_Image s-addima ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3ec}@anchor{gnat_rm/the_gnat_library id143}@anchor{3ed}
+@anchor{gnat_rm/the_gnat_library id144}@anchor{3ee}@anchor{gnat_rm/the_gnat_library system-assertions-s-assert-ads}@anchor{3ef}
@section @code{System.Assertions} (@code{s-assert.ads})
@@ -24862,7 +24866,7 @@ by an run-time assertion failure, as well as the routine that
is used internally to raise this assertion.
@node System Atomic_Counters s-atocou ads,System Memory s-memory ads,System Assertions s-assert ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id144}@anchor{3ee}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3ef}
+@anchor{gnat_rm/the_gnat_library id145}@anchor{3f0}@anchor{gnat_rm/the_gnat_library system-atomic-counters-s-atocou-ads}@anchor{3f1}
@section @code{System.Atomic_Counters} (@code{s-atocou.ads})
@@ -24876,7 +24880,7 @@ on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
x86, and x86_64 platforms.
@node System Memory s-memory ads,System Multiprocessors s-multip ads,System Atomic_Counters s-atocou ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3f0}@anchor{gnat_rm/the_gnat_library id145}@anchor{3f1}
+@anchor{gnat_rm/the_gnat_library system-memory-s-memory-ads}@anchor{3f2}@anchor{gnat_rm/the_gnat_library id146}@anchor{3f3}
@section @code{System.Memory} (@code{s-memory.ads})
@@ -24894,7 +24898,7 @@ calls to this unit may be made for low level allocation uses (for
example see the body of @code{GNAT.Tables}).
@node System Multiprocessors s-multip ads,System Multiprocessors Dispatching_Domains s-mudido ads,System Memory s-memory ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id146}@anchor{3f2}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3f3}
+@anchor{gnat_rm/the_gnat_library id147}@anchor{3f4}@anchor{gnat_rm/the_gnat_library system-multiprocessors-s-multip-ads}@anchor{3f5}
@section @code{System.Multiprocessors} (@code{s-multip.ads})
@@ -24907,7 +24911,7 @@ in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
technically an implementation-defined addition).
@node System Multiprocessors Dispatching_Domains s-mudido ads,System Partition_Interface s-parint ads,System Multiprocessors s-multip ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3f4}@anchor{gnat_rm/the_gnat_library id147}@anchor{3f5}
+@anchor{gnat_rm/the_gnat_library system-multiprocessors-dispatching-domains-s-mudido-ads}@anchor{3f6}@anchor{gnat_rm/the_gnat_library id148}@anchor{3f7}
@section @code{System.Multiprocessors.Dispatching_Domains} (@code{s-mudido.ads})
@@ -24920,7 +24924,7 @@ in GNAT we also make it available in Ada 95 and Ada 2005 (where it is
technically an implementation-defined addition).
@node System Partition_Interface s-parint ads,System Pool_Global s-pooglo ads,System Multiprocessors Dispatching_Domains s-mudido ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id148}@anchor{3f6}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f7}
+@anchor{gnat_rm/the_gnat_library id149}@anchor{3f8}@anchor{gnat_rm/the_gnat_library system-partition-interface-s-parint-ads}@anchor{3f9}
@section @code{System.Partition_Interface} (@code{s-parint.ads})
@@ -24933,7 +24937,7 @@ is used primarily in a distribution context when using Annex E
with @code{GLADE}.
@node System Pool_Global s-pooglo ads,System Pool_Local s-pooloc ads,System Partition_Interface s-parint ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id149}@anchor{3f8}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3f9}
+@anchor{gnat_rm/the_gnat_library id150}@anchor{3fa}@anchor{gnat_rm/the_gnat_library system-pool-global-s-pooglo-ads}@anchor{3fb}
@section @code{System.Pool_Global} (@code{s-pooglo.ads})
@@ -24950,7 +24954,7 @@ declared. It uses malloc/free to allocate/free and does not attempt to
do any automatic reclamation.
@node System Pool_Local s-pooloc ads,System Restrictions s-restri ads,System Pool_Global s-pooglo ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3fa}@anchor{gnat_rm/the_gnat_library id150}@anchor{3fb}
+@anchor{gnat_rm/the_gnat_library system-pool-local-s-pooloc-ads}@anchor{3fc}@anchor{gnat_rm/the_gnat_library id151}@anchor{3fd}
@section @code{System.Pool_Local} (@code{s-pooloc.ads})
@@ -24967,7 +24971,7 @@ a list of allocated blocks, so that all storage allocated for the pool can
be freed automatically when the pool is finalized.
@node System Restrictions s-restri ads,System Rident s-rident ads,System Pool_Local s-pooloc ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3fc}@anchor{gnat_rm/the_gnat_library id151}@anchor{3fd}
+@anchor{gnat_rm/the_gnat_library id152}@anchor{3fe}@anchor{gnat_rm/the_gnat_library system-restrictions-s-restri-ads}@anchor{3ff}
@section @code{System.Restrictions} (@code{s-restri.ads})
@@ -24983,7 +24987,7 @@ compiler determined information on which restrictions
are violated by one or more packages in the partition.
@node System Rident s-rident ads,System Strings Stream_Ops s-ststop ads,System Restrictions s-restri ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{3fe}@anchor{gnat_rm/the_gnat_library id152}@anchor{3ff}
+@anchor{gnat_rm/the_gnat_library system-rident-s-rident-ads}@anchor{400}@anchor{gnat_rm/the_gnat_library id153}@anchor{401}
@section @code{System.Rident} (@code{s-rident.ads})
@@ -24999,7 +25003,7 @@ since the necessary instantiation is included in
package System.Restrictions.
@node System Strings Stream_Ops s-ststop ads,System Unsigned_Types s-unstyp ads,System Rident s-rident ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id153}@anchor{400}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{401}
+@anchor{gnat_rm/the_gnat_library id154}@anchor{402}@anchor{gnat_rm/the_gnat_library system-strings-stream-ops-s-ststop-ads}@anchor{403}
@section @code{System.Strings.Stream_Ops} (@code{s-ststop.ads})
@@ -25015,7 +25019,7 @@ stream attributes are applied to string types, but the subprograms in this
package can be used directly by application programs.
@node System Unsigned_Types s-unstyp ads,System Wch_Cnv s-wchcnv ads,System Strings Stream_Ops s-ststop ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{402}@anchor{gnat_rm/the_gnat_library id154}@anchor{403}
+@anchor{gnat_rm/the_gnat_library system-unsigned-types-s-unstyp-ads}@anchor{404}@anchor{gnat_rm/the_gnat_library id155}@anchor{405}
@section @code{System.Unsigned_Types} (@code{s-unstyp.ads})
@@ -25028,7 +25032,7 @@ also contains some related definitions for other specialized types
used by the compiler in connection with packed array types.
@node System Wch_Cnv s-wchcnv ads,System Wch_Con s-wchcon ads,System Unsigned_Types s-unstyp ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{404}@anchor{gnat_rm/the_gnat_library id155}@anchor{405}
+@anchor{gnat_rm/the_gnat_library system-wch-cnv-s-wchcnv-ads}@anchor{406}@anchor{gnat_rm/the_gnat_library id156}@anchor{407}
@section @code{System.Wch_Cnv} (@code{s-wchcnv.ads})
@@ -25049,7 +25053,7 @@ encoding method. It uses definitions in
package @code{System.Wch_Con}.
@node System Wch_Con s-wchcon ads,,System Wch_Cnv s-wchcnv ads,The GNAT Library
-@anchor{gnat_rm/the_gnat_library id156}@anchor{406}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{407}
+@anchor{gnat_rm/the_gnat_library id157}@anchor{408}@anchor{gnat_rm/the_gnat_library system-wch-con-s-wchcon-ads}@anchor{409}
@section @code{System.Wch_Con} (@code{s-wchcon.ads})
@@ -25061,7 +25065,7 @@ in ordinary strings. These definitions are used by
the package @code{System.Wch_Cnv}.
@node Interfacing to Other Languages,Specialized Needs Annexes,The GNAT Library,Top
-@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{408}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{409}
+@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-other-languages}@anchor{11}@anchor{gnat_rm/interfacing_to_other_languages doc}@anchor{40a}@anchor{gnat_rm/interfacing_to_other_languages id1}@anchor{40b}
@chapter Interfacing to Other Languages
@@ -25079,7 +25083,7 @@ provided.
@end menu
@node Interfacing to C,Interfacing to C++,,Interfacing to Other Languages
-@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{40a}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{40b}
+@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-c}@anchor{40c}@anchor{gnat_rm/interfacing_to_other_languages id2}@anchor{40d}
@section Interfacing to C
@@ -25219,7 +25223,7 @@ of the length corresponding to the @code{type'Size} value in Ada.
@end itemize
@node Interfacing to C++,Interfacing to COBOL,Interfacing to C,Interfacing to Other Languages
-@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{40c}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{47}
+@anchor{gnat_rm/interfacing_to_other_languages id4}@anchor{40e}@anchor{gnat_rm/interfacing_to_other_languages id3}@anchor{47}
@section Interfacing to C++
@@ -25276,7 +25280,7 @@ The @code{External_Name} is the name of the C++ RTTI symbol. You can then
cover a specific C++ exception in an exception handler.
@node Interfacing to COBOL,Interfacing to Fortran,Interfacing to C++,Interfacing to Other Languages
-@anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{40d}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{40e}
+@anchor{gnat_rm/interfacing_to_other_languages id5}@anchor{40f}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-cobol}@anchor{410}
@section Interfacing to COBOL
@@ -25284,7 +25288,7 @@ Interfacing to COBOL is achieved as described in section B.4 of
the Ada Reference Manual.
@node Interfacing to Fortran,Interfacing to non-GNAT Ada code,Interfacing to COBOL,Interfacing to Other Languages
-@anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{40f}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{410}
+@anchor{gnat_rm/interfacing_to_other_languages id6}@anchor{411}@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-fortran}@anchor{412}
@section Interfacing to Fortran
@@ -25294,7 +25298,7 @@ multi-dimensional array causes the array to be stored in column-major
order as required for convenient interface to Fortran.
@node Interfacing to non-GNAT Ada code,,Interfacing to Fortran,Interfacing to Other Languages
-@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{411}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{412}
+@anchor{gnat_rm/interfacing_to_other_languages interfacing-to-non-gnat-ada-code}@anchor{413}@anchor{gnat_rm/interfacing_to_other_languages id7}@anchor{414}
@section Interfacing to non-GNAT Ada code
@@ -25318,7 +25322,7 @@ values or simple record types without variants, or simple array
types with fixed bounds.
@node Specialized Needs Annexes,Implementation of Specific Ada Features,Interfacing to Other Languages,Top
-@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{413}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{414}
+@anchor{gnat_rm/specialized_needs_annexes specialized-needs-annexes}@anchor{12}@anchor{gnat_rm/specialized_needs_annexes doc}@anchor{415}@anchor{gnat_rm/specialized_needs_annexes id1}@anchor{416}
@chapter Specialized Needs Annexes
@@ -25359,7 +25363,7 @@ in Ada 2005) is fully implemented.
@end table
@node Implementation of Specific Ada Features,Implementation of Ada 2012 Features,Specialized Needs Annexes,Top
-@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}@anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{415}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{416}
+@anchor{gnat_rm/implementation_of_specific_ada_features implementation-of-specific-ada-features}@anchor{13}@anchor{gnat_rm/implementation_of_specific_ada_features doc}@anchor{417}@anchor{gnat_rm/implementation_of_specific_ada_features id1}@anchor{418}
@chapter Implementation of Specific Ada Features
@@ -25377,7 +25381,7 @@ facilities.
@end menu
@node Machine Code Insertions,GNAT Implementation of Tasking,,Implementation of Specific Ada Features
-@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{16a}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{417}
+@anchor{gnat_rm/implementation_of_specific_ada_features machine-code-insertions}@anchor{169}@anchor{gnat_rm/implementation_of_specific_ada_features id2}@anchor{419}
@section Machine Code Insertions
@@ -25545,7 +25549,7 @@ according to normal visibility rules. In particular if there is no
qualification is required.
@node GNAT Implementation of Tasking,GNAT Implementation of Shared Passive Packages,Machine Code Insertions,Implementation of Specific Ada Features
-@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{418}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{419}
+@anchor{gnat_rm/implementation_of_specific_ada_features id3}@anchor{41a}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-tasking}@anchor{41b}
@section GNAT Implementation of Tasking
@@ -25561,7 +25565,7 @@ to compliance with the Real-Time Systems Annex.
@end menu
@node Mapping Ada Tasks onto the Underlying Kernel Threads,Ensuring Compliance with the Real-Time Annex,,GNAT Implementation of Tasking
-@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{41a}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{41b}
+@anchor{gnat_rm/implementation_of_specific_ada_features mapping-ada-tasks-onto-the-underlying-kernel-threads}@anchor{41c}@anchor{gnat_rm/implementation_of_specific_ada_features id4}@anchor{41d}
@subsection Mapping Ada Tasks onto the Underlying Kernel Threads
@@ -25630,7 +25634,7 @@ support this functionality when the parent contains more than one task.
@geindex Forking a new process
@node Ensuring Compliance with the Real-Time Annex,Support for Locking Policies,Mapping Ada Tasks onto the Underlying Kernel Threads,GNAT Implementation of Tasking
-@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{41c}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{41d}
+@anchor{gnat_rm/implementation_of_specific_ada_features id5}@anchor{41e}@anchor{gnat_rm/implementation_of_specific_ada_features ensuring-compliance-with-the-real-time-annex}@anchor{41f}
@subsection Ensuring Compliance with the Real-Time Annex
@@ -25681,7 +25685,7 @@ placed at the end.
@c Support_for_Locking_Policies
@node Support for Locking Policies,,Ensuring Compliance with the Real-Time Annex,GNAT Implementation of Tasking
-@anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{41e}
+@anchor{gnat_rm/implementation_of_specific_ada_features support-for-locking-policies}@anchor{420}
@subsection Support for Locking Policies
@@ -25715,7 +25719,7 @@ then ceiling locking is used.
Otherwise, the @code{Ceiling_Locking} policy is ignored.
@node GNAT Implementation of Shared Passive Packages,Code Generation for Array Aggregates,GNAT Implementation of Tasking,Implementation of Specific Ada Features
-@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{41f}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{420}
+@anchor{gnat_rm/implementation_of_specific_ada_features id6}@anchor{421}@anchor{gnat_rm/implementation_of_specific_ada_features gnat-implementation-of-shared-passive-packages}@anchor{422}
@section GNAT Implementation of Shared Passive Packages
@@ -25813,7 +25817,7 @@ This is used to provide the required locking
semantics for proper protected object synchronization.
@node Code Generation for Array Aggregates,The Size of Discriminated Records with Default Discriminants,GNAT Implementation of Shared Passive Packages,Implementation of Specific Ada Features
-@anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{421}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{422}
+@anchor{gnat_rm/implementation_of_specific_ada_features code-generation-for-array-aggregates}@anchor{423}@anchor{gnat_rm/implementation_of_specific_ada_features id7}@anchor{424}
@section Code Generation for Array Aggregates
@@ -25844,7 +25848,7 @@ component values and static subtypes also lead to simpler code.
@end menu
@node Static constant aggregates with static bounds,Constant aggregates with unconstrained nominal types,,Code Generation for Array Aggregates
-@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{423}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{424}
+@anchor{gnat_rm/implementation_of_specific_ada_features static-constant-aggregates-with-static-bounds}@anchor{425}@anchor{gnat_rm/implementation_of_specific_ada_features id8}@anchor{426}
@subsection Static constant aggregates with static bounds
@@ -25891,7 +25895,7 @@ Zero2: constant two_dim := (others => (others => 0));
@end example
@node Constant aggregates with unconstrained nominal types,Aggregates with static bounds,Static constant aggregates with static bounds,Code Generation for Array Aggregates
-@anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{425}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{426}
+@anchor{gnat_rm/implementation_of_specific_ada_features constant-aggregates-with-unconstrained-nominal-types}@anchor{427}@anchor{gnat_rm/implementation_of_specific_ada_features id9}@anchor{428}
@subsection Constant aggregates with unconstrained nominal types
@@ -25906,7 +25910,7 @@ Cr_Unc : constant One_Unc := (12,24,36);
@end example
@node Aggregates with static bounds,Aggregates with nonstatic bounds,Constant aggregates with unconstrained nominal types,Code Generation for Array Aggregates
-@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{427}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{428}
+@anchor{gnat_rm/implementation_of_specific_ada_features id10}@anchor{429}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-static-bounds}@anchor{42a}
@subsection Aggregates with static bounds
@@ -25934,7 +25938,7 @@ end loop;
@end example
@node Aggregates with nonstatic bounds,Aggregates in assignment statements,Aggregates with static bounds,Code Generation for Array Aggregates
-@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{429}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{42a}
+@anchor{gnat_rm/implementation_of_specific_ada_features id11}@anchor{42b}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-with-nonstatic-bounds}@anchor{42c}
@subsection Aggregates with nonstatic bounds
@@ -25945,7 +25949,7 @@ have to be applied to sub-arrays individually, if they do not have statically
compatible subtypes.
@node Aggregates in assignment statements,,Aggregates with nonstatic bounds,Code Generation for Array Aggregates
-@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{42b}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{42c}
+@anchor{gnat_rm/implementation_of_specific_ada_features id12}@anchor{42d}@anchor{gnat_rm/implementation_of_specific_ada_features aggregates-in-assignment-statements}@anchor{42e}
@subsection Aggregates in assignment statements
@@ -25987,7 +25991,7 @@ a temporary (created either by the front-end or the code generator) and then
that temporary will be copied onto the target.
@node The Size of Discriminated Records with Default Discriminants,Strict Conformance to the Ada Reference Manual,Code Generation for Array Aggregates,Implementation of Specific Ada Features
-@anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{42d}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{42e}
+@anchor{gnat_rm/implementation_of_specific_ada_features id13}@anchor{42f}@anchor{gnat_rm/implementation_of_specific_ada_features the-size-of-discriminated-records-with-default-discriminants}@anchor{430}
@section The Size of Discriminated Records with Default Discriminants
@@ -26067,7 +26071,7 @@ say) must be consistent, so it is imperative that the object, once created,
remain invariant.
@node Strict Conformance to the Ada Reference Manual,,The Size of Discriminated Records with Default Discriminants,Implementation of Specific Ada Features
-@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{42f}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{430}
+@anchor{gnat_rm/implementation_of_specific_ada_features strict-conformance-to-the-ada-reference-manual}@anchor{431}@anchor{gnat_rm/implementation_of_specific_ada_features id14}@anchor{432}
@section Strict Conformance to the Ada Reference Manual
@@ -26094,7 +26098,7 @@ behavior (although at the cost of a significant performance penalty), so
infinite and NaN values are properly generated.
@node Implementation of Ada 2012 Features,Obsolescent Features,Implementation of Specific Ada Features,Top
-@anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{431}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{432}
+@anchor{gnat_rm/implementation_of_ada_2012_features doc}@anchor{433}@anchor{gnat_rm/implementation_of_ada_2012_features implementation-of-ada-2012-features}@anchor{14}@anchor{gnat_rm/implementation_of_ada_2012_features id1}@anchor{434}
@chapter Implementation of Ada 2012 Features
@@ -28260,7 +28264,7 @@ RM References: H.04 (8/1)
@end itemize
@node Obsolescent Features,Compatibility and Porting Guide,Implementation of Ada 2012 Features,Top
-@anchor{gnat_rm/obsolescent_features id1}@anchor{433}@anchor{gnat_rm/obsolescent_features doc}@anchor{434}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
+@anchor{gnat_rm/obsolescent_features id1}@anchor{435}@anchor{gnat_rm/obsolescent_features doc}@anchor{436}@anchor{gnat_rm/obsolescent_features obsolescent-features}@anchor{15}
@chapter Obsolescent Features
@@ -28279,7 +28283,7 @@ compatibility purposes.
@end menu
@node pragma No_Run_Time,pragma Ravenscar,,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id2}@anchor{435}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{436}
+@anchor{gnat_rm/obsolescent_features id2}@anchor{437}@anchor{gnat_rm/obsolescent_features pragma-no-run-time}@anchor{438}
@section pragma No_Run_Time
@@ -28292,7 +28296,7 @@ preferred usage is to use an appropriately configured run-time that
includes just those features that are to be made accessible.
@node pragma Ravenscar,pragma Restricted_Run_Time,pragma No_Run_Time,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features id3}@anchor{437}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{438}
+@anchor{gnat_rm/obsolescent_features id3}@anchor{439}@anchor{gnat_rm/obsolescent_features pragma-ravenscar}@anchor{43a}
@section pragma Ravenscar
@@ -28301,7 +28305,7 @@ The pragma @code{Ravenscar} has exactly the same effect as pragma
is part of the new Ada 2005 standard.
@node pragma Restricted_Run_Time,pragma Task_Info,pragma Ravenscar,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{439}@anchor{gnat_rm/obsolescent_features id4}@anchor{43a}
+@anchor{gnat_rm/obsolescent_features pragma-restricted-run-time}@anchor{43b}@anchor{gnat_rm/obsolescent_features id4}@anchor{43c}
@section pragma Restricted_Run_Time
@@ -28311,7 +28315,7 @@ preferred since the Ada 2005 pragma @code{Profile} is intended for
this kind of implementation dependent addition.
@node pragma Task_Info,package System Task_Info s-tasinf ads,pragma Restricted_Run_Time,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{43b}@anchor{gnat_rm/obsolescent_features id5}@anchor{43c}
+@anchor{gnat_rm/obsolescent_features pragma-task-info}@anchor{43d}@anchor{gnat_rm/obsolescent_features id5}@anchor{43e}
@section pragma Task_Info
@@ -28337,7 +28341,7 @@ in the spec of package System.Task_Info in the runtime
library.
@node package System Task_Info s-tasinf ads,,pragma Task_Info,Obsolescent Features
-@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{43d}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{43e}
+@anchor{gnat_rm/obsolescent_features package-system-task-info}@anchor{43f}@anchor{gnat_rm/obsolescent_features package-system-task-info-s-tasinf-ads}@anchor{440}
@section package System.Task_Info (@code{s-tasinf.ads})
@@ -28347,7 +28351,7 @@ to support the @code{Task_Info} pragma. The predefined Ada package
standard replacement for GNAT's @code{Task_Info} functionality.
@node Compatibility and Porting Guide,GNU Free Documentation License,Obsolescent Features,Top
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{43f}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{440}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-and-porting-guide}@anchor{16}@anchor{gnat_rm/compatibility_and_porting_guide doc}@anchor{441}@anchor{gnat_rm/compatibility_and_porting_guide id1}@anchor{442}
@chapter Compatibility and Porting Guide
@@ -28369,7 +28373,7 @@ applications developed in other Ada environments.
@end menu
@node Writing Portable Fixed-Point Declarations,Compatibility with Ada 83,,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{441}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{442}
+@anchor{gnat_rm/compatibility_and_porting_guide id2}@anchor{443}@anchor{gnat_rm/compatibility_and_porting_guide writing-portable-fixed-point-declarations}@anchor{444}
@section Writing Portable Fixed-Point Declarations
@@ -28491,7 +28495,7 @@ If you follow this scheme you will be guaranteed that your fixed-point
types will be portable.
@node Compatibility with Ada 83,Compatibility between Ada 95 and Ada 2005,Writing Portable Fixed-Point Declarations,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{443}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{444}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-ada-83}@anchor{445}@anchor{gnat_rm/compatibility_and_porting_guide id3}@anchor{446}
@section Compatibility with Ada 83
@@ -28519,7 +28523,7 @@ following subsections treat the most likely issues to be encountered.
@end menu
@node Legal Ada 83 programs that are illegal in Ada 95,More deterministic semantics,,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{445}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{446}
+@anchor{gnat_rm/compatibility_and_porting_guide id4}@anchor{447}@anchor{gnat_rm/compatibility_and_porting_guide legal-ada-83-programs-that-are-illegal-in-ada-95}@anchor{448}
@subsection Legal Ada 83 programs that are illegal in Ada 95
@@ -28619,7 +28623,7 @@ the fix is usually simply to add the @code{(<>)} to the generic declaration.
@end itemize
@node More deterministic semantics,Changed semantics,Legal Ada 83 programs that are illegal in Ada 95,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{447}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{448}
+@anchor{gnat_rm/compatibility_and_porting_guide more-deterministic-semantics}@anchor{449}@anchor{gnat_rm/compatibility_and_porting_guide id5}@anchor{44a}
@subsection More deterministic semantics
@@ -28647,7 +28651,7 @@ which open select branches are executed.
@end itemize
@node Changed semantics,Other language compatibility issues,More deterministic semantics,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{449}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{44a}
+@anchor{gnat_rm/compatibility_and_porting_guide id6}@anchor{44b}@anchor{gnat_rm/compatibility_and_porting_guide changed-semantics}@anchor{44c}
@subsection Changed semantics
@@ -28689,7 +28693,7 @@ covers only the restricted range.
@end itemize
@node Other language compatibility issues,,Changed semantics,Compatibility with Ada 83
-@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{44b}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{44c}
+@anchor{gnat_rm/compatibility_and_porting_guide other-language-compatibility-issues}@anchor{44d}@anchor{gnat_rm/compatibility_and_porting_guide id7}@anchor{44e}
@subsection Other language compatibility issues
@@ -28722,7 +28726,7 @@ include @code{pragma Interface} and the floating point type attributes
@end itemize
@node Compatibility between Ada 95 and Ada 2005,Implementation-dependent characteristics,Compatibility with Ada 83,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{44d}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{44e}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-between-ada-95-and-ada-2005}@anchor{44f}@anchor{gnat_rm/compatibility_and_porting_guide id8}@anchor{450}
@section Compatibility between Ada 95 and Ada 2005
@@ -28794,7 +28798,7 @@ can declare a function returning a value from an anonymous access type.
@end itemize
@node Implementation-dependent characteristics,Compatibility with Other Ada Systems,Compatibility between Ada 95 and Ada 2005,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{44f}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{450}
+@anchor{gnat_rm/compatibility_and_porting_guide implementation-dependent-characteristics}@anchor{451}@anchor{gnat_rm/compatibility_and_porting_guide id9}@anchor{452}
@section Implementation-dependent characteristics
@@ -28817,7 +28821,7 @@ transition from certain Ada 83 compilers.
@end menu
@node Implementation-defined pragmas,Implementation-defined attributes,,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{451}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{452}
+@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-pragmas}@anchor{453}@anchor{gnat_rm/compatibility_and_porting_guide id10}@anchor{454}
@subsection Implementation-defined pragmas
@@ -28839,7 +28843,7 @@ avoiding compiler rejection of units that contain such pragmas; they are not
relevant in a GNAT context and hence are not otherwise implemented.
@node Implementation-defined attributes,Libraries,Implementation-defined pragmas,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{453}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{454}
+@anchor{gnat_rm/compatibility_and_porting_guide id11}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide implementation-defined-attributes}@anchor{456}
@subsection Implementation-defined attributes
@@ -28853,7 +28857,7 @@ Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
@code{Type_Class}.
@node Libraries,Elaboration order,Implementation-defined attributes,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{455}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{456}
+@anchor{gnat_rm/compatibility_and_porting_guide libraries}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide id12}@anchor{458}
@subsection Libraries
@@ -28882,7 +28886,7 @@ be preferable to retrofit the application using modular types.
@end itemize
@node Elaboration order,Target-specific aspects,Libraries,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{457}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{458}
+@anchor{gnat_rm/compatibility_and_porting_guide elaboration-order}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide id13}@anchor{45a}
@subsection Elaboration order
@@ -28918,7 +28922,7 @@ pragmas either globally (as an effect of the @emph{-gnatE} switch) or locally
@end itemize
@node Target-specific aspects,,Elaboration order,Implementation-dependent characteristics
-@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{459}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{45a}
+@anchor{gnat_rm/compatibility_and_porting_guide target-specific-aspects}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide id14}@anchor{45c}
@subsection Target-specific aspects
@@ -28931,10 +28935,10 @@ on the robustness of the original design. Moreover, Ada 95 (and thus
Ada 2005 and Ada 2012) are sometimes
incompatible with typical Ada 83 compiler practices regarding implicit
packing, the meaning of the Size attribute, and the size of access values.
-GNAT's approach to these issues is described in @ref{45b,,Representation Clauses}.
+GNAT's approach to these issues is described in @ref{45d,,Representation Clauses}.
@node Compatibility with Other Ada Systems,Representation Clauses,Implementation-dependent characteristics,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{45c}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{45d}
+@anchor{gnat_rm/compatibility_and_porting_guide id15}@anchor{45e}@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-other-ada-systems}@anchor{45f}
@section Compatibility with Other Ada Systems
@@ -28977,7 +28981,7 @@ far beyond this minimal set, as described in the next section.
@end itemize
@node Representation Clauses,Compatibility with HP Ada 83,Compatibility with Other Ada Systems,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{45b}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{45e}
+@anchor{gnat_rm/compatibility_and_porting_guide representation-clauses}@anchor{45d}@anchor{gnat_rm/compatibility_and_porting_guide id16}@anchor{460}
@section Representation Clauses
@@ -29070,7 +29074,7 @@ with thin pointers.
@end itemize
@node Compatibility with HP Ada 83,,Representation Clauses,Compatibility and Porting Guide
-@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{45f}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{460}
+@anchor{gnat_rm/compatibility_and_porting_guide compatibility-with-hp-ada-83}@anchor{461}@anchor{gnat_rm/compatibility_and_porting_guide id17}@anchor{462}
@section Compatibility with HP Ada 83
@@ -29100,7 +29104,7 @@ extension of package System.
@end itemize
@node GNU Free Documentation License,Index,Compatibility and Porting Guide,Top
-@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{461}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{462}
+@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{463}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{464}
@chapter GNU Free Documentation License
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index ab47192..47618f6 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -21,7 +21,7 @@
@copying
@quotation
-GNAT User's Guide for Native Platforms , Jul 01, 2020
+GNAT User's Guide for Native Platforms , Sep 29, 2020
AdaCore
@@ -2850,7 +2850,6 @@ Overflow_Mode
Overriding_Renamings
Partition_Elaboration_Policy
Persistent_BSS
-Polling
Prefix_Exception_Messages
Priority_Specific_Dispatching
Profile
@@ -9721,19 +9720,6 @@ has no effect if cancelled by a subsequent @code{-gnat-p} switch.
Cancel effect of previous @code{-gnatp} switch.
@end table
-@geindex -gnatP (gcc)
-
-
-@table @asis
-
-@item @code{-gnatP}
-
-Enable polling. This is required on some systems (notably Windows NT) to
-obtain asynchronous abort and asynchronous transfer of control capability.
-See @code{Pragma_Polling} in the @cite{GNAT_Reference_Manual} for full
-details.
-@end table
-
@geindex -gnatq (gcc)
@@ -12238,7 +12224,14 @@ that no warnings are given for comparisons or subranges for any type.
This switch activates warnings for access to variables which
may not be properly initialized. The default is that
-such warnings are generated.
+such warnings are generated. This switch will also be emitted when
+initializing an array or record object via the following aggregate:
+
+@example
+Array_Or_Record : XXX := (others => <>);
+@end example
+
+unless the relevant type fully initializes all components.
@end table
@geindex -gnatwV (gcc)
@@ -12252,17 +12245,6 @@ such warnings are generated.
This switch suppresses warnings for access to variables which
may not be properly initialized.
-For variables of a composite type, the warning can also be suppressed in
-Ada 2005 by using a default initialization with a box. For example, if
-Table is an array of records whose components are only partially uninitialized,
-then the following code:
-
-@example
-Tab : Table := (others => <>);
-@end example
-
-will suppress warnings on subsequent statements that access components
-of variable Tab.
@end table
@geindex -gnatw.v (gcc)
diff --git a/gcc/ada/gnatvsn.adb b/gcc/ada/gnatvsn.adb
index 0e7486c..e918540 100644
--- a/gcc/ada/gnatvsn.adb
+++ b/gcc/ada/gnatvsn.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads
index aacbc22..ddd5b9f 100644
--- a/gcc/ada/gnatvsn.ads
+++ b/gcc/ada/gnatvsn.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index e10f954..ba51fb1 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -80,6 +80,12 @@
#define FD_SETSIZE 1024
#ifdef __MINGW32__
+/* winsock2.h allows WSAPoll related definitions only when
+ * _WIN32_WINNT >= 0x0600 */
+#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
+#define _WIN32_WINNT 0x0600
+#endif
+
#include <winsock2.h>
#include <ws2tcpip.h>
#include <versionhelpers.h>
diff --git a/gcc/ada/hostparm.ads b/gcc/ada/hostparm.ads
index 1b87a1d..603f401 100644
--- a/gcc/ada/hostparm.ads
+++ b/gcc/ada/hostparm.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb
index 2cfda7c..2cde430 100644
--- a/gcc/ada/impunit.adb
+++ b/gcc/ada/impunit.adb
@@ -146,6 +146,8 @@ package body Impunit is
("a-llfwti", T), -- Ada.Long_Long_Float_Wide_Text_IO
("a-llitio", T), -- Ada.Long_Long_Integer_Text_IO
("a-lliwti", F), -- Ada.Long_Long_Integer_Wide_Text_IO
+ ("a-llltio", T), -- Ada.Long_Long_Long_Integer_Text_IO
+ ("a-lllwti", F), -- Ada.Long_Long_Long_Integer_Wide_Text_IO
("a-nlcefu", F), -- Ada.Long_Complex_Elementary_Functions
("a-nlcoty", T), -- Ada.Numerics.Long_Complex_Types
("a-nlelfu", T), -- Ada.Numerics.Long_Elementary_Functions
@@ -308,6 +310,7 @@ package body Impunit is
("g-sha512", F), -- GNAT.SHA512
("g-signal", F), -- GNAT.Signals
("g-socket", F), -- GNAT.Sockets
+ ("g-socpol", F), -- GNAT.Sockets.Poll
("g-souinf", F), -- GNAT.Source_Info
("g-speche", F), -- GNAT.Spell_Checker
("g-spchge", F), -- GNAT.Spell_Checker_Generic
@@ -502,6 +505,7 @@ package body Impunit is
("a-llctio", T), -- Ada.Long_Long_Complex_Text_IO
("a-llfzti", T), -- Ada.Long_Long_Float_Wide_Wide_Text_IO
("a-llizti", T), -- Ada.Long_Long_Integer_Wide_Wide_Text_IO
+ ("a-lllzti", T), -- Ada.Long_Long_Long_Integer_Wide_Wide_Text_IO
("a-nlcoar", T), -- Ada.Numerics.Long_Complex_Arrays
("a-nllcar", T), -- Ada.Numerics.Long_Long_Complex_Arrays
("a-nllrar", T), -- Ada.Numerics.Long_Long_Real_Arrays
@@ -687,7 +691,7 @@ package body Impunit is
function Get_Kind_Of_File (File : String) return Kind_Of_Unit is
pragma Assert (File'First = 1);
- Buffer : String (1 .. 8);
+ Buffer : String (1 .. 9);
begin
Error_Msg_Strlen := 0;
@@ -701,13 +705,6 @@ package body Impunit is
return Ada_95_Unit;
end if;
- -- If length of file name is greater than 12, not predefined. The value
- -- 12 here is an 8 char name with extension .ads.
-
- if File'Length > 12 then
- return Not_Predefined_Unit;
- end if;
-
-- Not predefined if file name does not start with a- g- s- i-
if File'Length < 3
@@ -721,6 +718,16 @@ package body Impunit is
return Not_Predefined_Unit;
end if;
+ -- If length of file name is greater than 12, not predefined. The value
+ -- 12 here is an 8 char name with extension .ads. The exception of 13 is
+ -- for the implementation units of the 128-bit types under System.
+
+ if File'Length > 12
+ and then not (File'Length = 13 and then File (1) = 's')
+ then
+ return Not_Predefined_Unit;
+ end if;
+
-- Not predefined if file name does not end in .ads. This can happen
-- when non-standard file names are being used.
@@ -739,7 +746,7 @@ package body Impunit is
-- See if name is in 95 list
for J in Non_Imp_File_Names_95'Range loop
- if Buffer = Non_Imp_File_Names_95 (J).Fname then
+ if Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then
return Ada_95_Unit;
end if;
end loop;
@@ -747,7 +754,7 @@ package body Impunit is
-- See if name is in 2005 list
for J in Non_Imp_File_Names_05'Range loop
- if Buffer = Non_Imp_File_Names_05 (J).Fname then
+ if Buffer (1 .. 8) = Non_Imp_File_Names_05 (J).Fname then
return Ada_2005_Unit;
end if;
end loop;
@@ -755,7 +762,7 @@ package body Impunit is
-- See if name is in 2012 list
for J in Non_Imp_File_Names_12'Range loop
- if Buffer = Non_Imp_File_Names_12 (J).Fname then
+ if Buffer (1 .. 8) = Non_Imp_File_Names_12 (J).Fname then
return Ada_2012_Unit;
end if;
end loop;
@@ -763,7 +770,7 @@ package body Impunit is
-- See if name is in 202X list
for J in Non_Imp_File_Names_2X'Range loop
- if Buffer = Non_Imp_File_Names_2X (J).Fname then
+ if Buffer (1 .. 8) = Non_Imp_File_Names_2X (J).Fname then
return Ada_202X_Unit;
end if;
end loop;
@@ -927,13 +934,6 @@ package body Impunit is
return True;
end if;
- -- If length of file name is greater than 12, then it's a user unit
- -- and not a GNAT implementation defined unit.
-
- if Name_Len > 12 then
- return True;
- end if;
-
-- Implementation defined if unit in the gnat hierarchy
if (Name_Len = 8 and then Name_Buffer (1 .. 8) = "gnat.ads")
@@ -955,6 +955,16 @@ package body Impunit is
return True;
end if;
+ -- If length of file name is greater than 12, not predefined. The value
+ -- 12 here is an 8 char name with extension .ads. The exception of 13 is
+ -- for the implementation units of the 128-bit types under System.
+
+ if Name_Len > 12
+ and then not (Name_Len = 13 and then Name_Buffer (1) = 's')
+ then
+ return True;
+ end if;
+
-- Not impl-defined if file name does not end in .ads. This can happen
-- when non-standard file names are being used.
diff --git a/gcc/ada/indepsw-aix.adb b/gcc/ada/indepsw-aix.adb
index 54c556d..21a4c17 100644
--- a/gcc/ada/indepsw-aix.adb
+++ b/gcc/ada/indepsw-aix.adb
@@ -14,16 +14,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/indepsw-darwin.adb b/gcc/ada/indepsw-darwin.adb
index 3f2c41a..9da4f87 100644
--- a/gcc/ada/indepsw-darwin.adb
+++ b/gcc/ada/indepsw-darwin.adb
@@ -14,16 +14,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/indepsw-gnu.adb b/gcc/ada/indepsw-gnu.adb
index 76138c4..de219b6 100644
--- a/gcc/ada/indepsw-gnu.adb
+++ b/gcc/ada/indepsw-gnu.adb
@@ -14,16 +14,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/indepsw.adb b/gcc/ada/indepsw.adb
index e35b3da..d21bcfe 100644
--- a/gcc/ada/indepsw.adb
+++ b/gcc/ada/indepsw.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/indepsw.ads b/gcc/ada/indepsw.ads
index 4ac3fd8..2fc13cb 100644
--- a/gcc/ada/indepsw.ads
+++ b/gcc/ada/indepsw.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 7293cf2..b4d56b6 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -317,6 +317,7 @@ package body Inline is
-- Refined_Global
-- Refined_Depends
-- Refined_Post
+ -- Subprogram_Variant
-- Test_Case
-- Unmodified
-- Unreferenced
@@ -3728,8 +3729,8 @@ package body Inline is
return;
end if;
- if Nkind (Orig_Bod) = N_Defining_Identifier
- or else Nkind (Orig_Bod) = N_Defining_Operator_Symbol
+ if Nkind (Orig_Bod) in N_Defining_Identifier
+ | N_Defining_Operator_Symbol
then
-- Subprogram is renaming_as_body. Calls occurring after the renaming
-- can be replaced with calls to the renamed entity directly, because
@@ -5119,6 +5120,7 @@ package body Inline is
| Name_Refined_Global
| Name_Refined_Depends
| Name_Refined_Post
+ | Name_Subprogram_Variant
| Name_Test_Case
| Name_Unmodified
| Name_Unreferenced
diff --git a/gcc/ada/krunch.adb b/gcc/ada/krunch.adb
index ac9af73..8ed239e 100644
--- a/gcc/ada/krunch.adb
+++ b/gcc/ada/krunch.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -73,6 +67,15 @@ begin
Curlen := Len - 17;
Krlen := 8;
+ elsif Len >= 27
+ and then Buffer (1 .. 27) = "ada-long_long_long_integer_"
+ then
+ Startloc := 3;
+ Buffer (2 .. Len - 2) := Buffer (4 .. Len);
+ Buffer (18 .. Len - 10) := Buffer (26 .. Len - 2);
+ Curlen := Len - 10;
+ Krlen := 8;
+
elsif Len >= 4 and then Buffer (1 .. 4) = "ada-" then
Startloc := 3;
Buffer (2 .. Len - 2) := Buffer (4 .. Len);
@@ -89,7 +92,23 @@ begin
Startloc := 3;
Buffer (2 .. Len - 5) := Buffer (7 .. Len);
Curlen := Len - 5;
- Krlen := 8;
+ if Buffer (Curlen - 2 .. Curlen) = "128"
+ or else Buffer (3 .. 9) = "exn_lll"
+ or else Buffer (3 .. 9) = "exp_lll"
+ or else Buffer (3 .. 9) = "img_lll"
+ or else Buffer (3 .. 9) = "val_lll"
+ or else Buffer (3 .. 9) = "wid_lll"
+ or else (Buffer (3 .. 6) = "pack" and then Curlen = 10)
+ then
+ if Buffer (3 .. 15) = "compare_array" then
+ Buffer (3 .. 4) := "ca";
+ Buffer (5 .. Curlen - 11) := Buffer (16 .. Curlen);
+ Curlen := Curlen - 11;
+ end if;
+ Krlen := 9;
+ else
+ Krlen := 8;
+ end if;
elsif Len >= 11 and then Buffer (1 .. 11) = "interfaces-" then
Startloc := 3;
diff --git a/gcc/ada/krunch.ads b/gcc/ada/krunch.ads
index 42896b8..82dc612 100644
--- a/gcc/ada/krunch.ads
+++ b/gcc/ada/krunch.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -114,6 +108,12 @@
-- we replace the prefix ada.wide_wide_text_io- by a-zt- and then
-- the normal crunching rules are applied.
+-- An additional trick is used for Ada.Long_Long_Long_Integer_*_IO, where
+-- the Integer word is dropped.
+
+-- The units implementing the support of 128-bit types are crunched to 9 and
+-- System.Compare_Array_* is replaced with System.CA_* before crunching.
+
-- These are the only irregularity required (so far) to keep the file names
-- unique in the standard predefined libraries.
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index 73812f6..ad80849 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -378,12 +378,12 @@ package body Layout is
Init_Esize (E, S);
exit;
- -- If the RM_Size is greater than 64 (happens only when
- -- strange values are specified by the user, then Esize
- -- is simply a copy of RM_Size, it will be further
- -- refined later on)
+ -- If the RM_Size is greater than System_Max_Integer_Size
+ -- (happens only when strange values are specified by the
+ -- user), then Esize is simply a copy of RM_Size, it will
+ -- be further refined later on).
- elsif S = 64 then
+ elsif S = System_Max_Integer_Size then
Set_Esize (E, RM_Size (E));
exit;
@@ -436,11 +436,11 @@ package body Layout is
end if;
-- For array base types, set the component size if object size of the
- -- component type is known and is a small power of 2 (8, 16, 32, 64),
- -- since this is what will always be used, except if a very large
- -- alignment was specified and so Adjust_Esize_For_Alignment gave up
- -- because, in this case, the object size is not a multiple of the
- -- alignment and, therefore, cannot be the component size.
+ -- component type is known and is a small power of 2 (8, 16, 32, 64
+ -- or 128), since this is what will always be used, except if a very
+ -- large alignment was specified and so Adjust_Esize_For_Alignment
+ -- gave up because, in this case, the object size is not a multiple
+ -- of the alignment and, therefore, cannot be the component size.
if Ekind (E) = E_Array_Type and then Unknown_Component_Size (E) then
declare
@@ -455,7 +455,7 @@ package body Layout is
and then Known_Static_Esize (CT)
and then not (Known_Alignment (CT)
and then Alignment_In_Bits (CT) >
- Standard_Long_Long_Integer_Size)
+ System_Max_Integer_Size)
then
declare
S : constant Uint := Esize (CT);
@@ -470,7 +470,7 @@ package body Layout is
-- For non-packed arrays set the alignment of the array to the
-- alignment of the component type if it is unknown. Skip this
- -- in atomic/VFA case since a larger alignment may be needed.
+ -- in full access case since a larger alignment may be needed.
if Is_Array_Type (E)
and then not Is_Packed (E)
@@ -479,7 +479,7 @@ package body Layout is
and then Known_Static_Component_Size (E)
and then Known_Static_Esize (Component_Type (E))
and then Component_Size (E) = Esize (Component_Type (E))
- and then not Is_Atomic_Or_VFA (E)
+ and then not Is_Full_Access (E)
then
Set_Alignment (E, Alignment (Component_Type (E)));
end if;
@@ -505,11 +505,11 @@ package body Layout is
elsif Is_Array_Type (E) then
- -- For arrays that are required to be atomic/VFA, we do the same
- -- processing as described above for short records, since we
- -- really need to have the alignment set for the whole array.
+ -- For arrays that are required to be full access, we do the same
+ -- processing as described above for short records, since we really
+ -- need to have the alignment set for the whole array.
- if Is_Atomic_Or_VFA (E) and then not Debug_Flag_Q then
+ if Is_Full_Access (E) and then not Debug_Flag_Q then
Set_Composite_Alignment (E);
end if;
@@ -615,9 +615,9 @@ package body Layout is
and then Is_Record_Type (E)
and then Is_Packed (E)
then
- -- No effect for record with atomic/VFA components
+ -- No effect for record with full access components
- if Is_Atomic_Or_VFA (E) then
+ if Is_Full_Access (E) then
Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
if Is_Atomic (E) then
@@ -640,7 +640,7 @@ package body Layout is
return;
end if;
- -- No effect if any component is atomic/VFA or is a by-reference type
+ -- No effect if a component is full access or of a by-reference type
declare
Ent : Entity_Id;
@@ -649,8 +649,8 @@ package body Layout is
Ent := First_Component_Or_Discriminant (E);
while Present (Ent) loop
if Is_By_Reference_Type (Etype (Ent))
- or else Is_Atomic_Or_VFA (Etype (Ent))
- or else Is_Atomic_Or_VFA (Ent)
+ or else Is_Full_Access (Etype (Ent))
+ or else Is_Full_Access (Ent)
then
Error_Msg_N ("Optimize_Alignment has no effect for &??", E);
@@ -660,7 +660,7 @@ package body Layout is
& "components present??", E);
else
Error_Msg_N
- ("\pragma is ignored if bolatile full access "
+ ("\pragma is ignored if volatile full access "
& "components present??", E);
end if;
@@ -756,9 +756,9 @@ package body Layout is
-- Further processing for record types only to reduce the alignment
-- set by the above processing in some specific cases. We do not
- -- do this for atomic/VFA records, since we need max alignment there,
+ -- do this for full access records, since we need max alignment there,
- if Is_Record_Type (E) and then not Is_Atomic_Or_VFA (E) then
+ if Is_Record_Type (E) and then not Is_Full_Access (E) then
-- For records, there is generally no point in setting alignment
-- higher than word size since we cannot do better than move by
diff --git a/gcc/ada/lib-list.adb b/gcc/ada/lib-list.adb
index 3eb5637..3733c0b 100644
--- a/gcc/ada/lib-list.adb
+++ b/gcc/ada/lib-list.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/lib-sort.adb b/gcc/ada/lib-sort.adb
index dc51b64..5ed478b 100644
--- a/gcc/ada/lib-sort.adb
+++ b/gcc/ada/lib-sort.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb
index 6fbcdce..6a63b8f 100644
--- a/gcc/ada/lib-writ.adb
+++ b/gcc/ada/lib-writ.adb
@@ -268,17 +268,6 @@ package body Lib.Writ is
-- Collect with lines for entries in the context clause of the given
-- compilation unit, Cunit.
- procedure Update_Tables_From_ALI_File;
- -- Given an up to date ALI file (see Up_To_Date_ALI_file_Exists
- -- function), update tables from the ALI information, including
- -- specifically the Compilation_Switches table.
-
- function Up_To_Date_ALI_File_Exists return Boolean;
- -- If there exists an ALI file that is up to date, then this function
- -- initializes the tables in the ALI spec to contain information on
- -- this file (using Scan_ALI) and returns True. If no file exists,
- -- or the file is not up to date, then False is returned.
-
procedure Write_Unit_Information (Unit_Num : Unit_Number_Type);
-- Write out the library information for one unit for which code is
-- generated (includes unit line and with lines).
@@ -397,76 +386,6 @@ package body Lib.Writ is
end loop;
end Collect_Withs;
- --------------------------------
- -- Up_To_Date_ALI_File_Exists --
- --------------------------------
-
- function Up_To_Date_ALI_File_Exists return Boolean is
- Name : File_Name_Type;
- Text : Text_Buffer_Ptr;
- Id : Sdep_Id;
- Sind : Source_File_Index;
-
- begin
- Opt.Check_Object_Consistency := True;
- Read_Library_Info (Name, Text);
-
- -- Return if we could not find an ALI file
-
- if Text = null then
- return False;
- end if;
-
- -- Return if ALI file has bad format
-
- Initialize_ALI;
-
- if Scan_ALI (Name, Text, False, Err => True) = No_ALI_Id then
- return False;
- end if;
-
- -- If we have an OK ALI file, check if it is up to date
- -- Note that we assume that the ALI read has all the entries
- -- we have in our table, plus some additional ones (that can
- -- come from expansion).
-
- Id := First_Sdep_Entry;
- for J in 1 .. Num_Sdep loop
- Sind := Source_Index (Sdep_Table (J));
-
- while Sdep.Table (Id).Sfile /= File_Name (Sind) loop
- if Id = Sdep.Last then
- return False;
- else
- Id := Id + 1;
- end if;
- end loop;
-
- if Sdep.Table (Id).Stamp /= Time_Stamp (Sind) then
- return False;
- end if;
- end loop;
-
- return True;
- end Up_To_Date_ALI_File_Exists;
-
- ---------------------------------
- -- Update_Tables_From_ALI_File --
- ---------------------------------
-
- procedure Update_Tables_From_ALI_File is
- begin
- -- Build Compilation_Switches table
-
- Compilation_Switches.Init;
-
- for J in First_Arg_Entry .. Args.Last loop
- Compilation_Switches.Increment_Last;
- Compilation_Switches.Table (Compilation_Switches.Last) :=
- Args.Table (J);
- end loop;
- end Update_Tables_From_ALI_File;
-
----------------------------
-- Write_Unit_Information --
----------------------------
@@ -1095,8 +1014,7 @@ package body Lib.Writ is
return;
end if;
- -- Build sorted source dependency table. We do this right away, because
- -- it is referenced by Up_To_Date_ALI_File_Exists.
+ -- Build sorted source dependency table.
for Unum in Units.First .. Last_Unit loop
if Cunit_Entity (Unum) = Empty
@@ -1130,20 +1048,8 @@ package body Lib.Writ is
Lib.Sort (Sdep_Table (1 .. Num_Sdep));
- -- If we are not generating code, and there is an up to date ALI file
- -- file accessible, read it, and acquire the compilation arguments from
- -- this file. In GNATprove mode, always generate the ALI file, which
- -- contains a special section for formal verification.
-
- if Operating_Mode /= Generate_Code and then not GNATprove_Mode then
- if Up_To_Date_ALI_File_Exists then
- Update_Tables_From_ALI_File;
- return;
- end if;
- end if;
-
- -- Otherwise acquire compilation arguments and prepare to write out a
- -- new ali file.
+ -- Acquire compilation arguments and prepare to write out a new ali
+ -- file.
Create_Output_Library_Info;
diff --git a/gcc/ada/lib-writ.ads b/gcc/ada/lib-writ.ads
index e7f2e3f..7ec57b4 100644
--- a/gcc/ada/lib-writ.ads
+++ b/gcc/ada/lib-writ.ads
@@ -1053,12 +1053,6 @@ package Lib.Writ is
-- The Object parameter is true if an object file is created, and false
-- otherwise. Note that the pseudo-object file generated in GNATprove mode
-- does count as an object file from this point of view.
- --
- -- Note: in the case where we are not generating code (-gnatc mode), this
- -- routine only writes an ALI file if it cannot find an existing up to
- -- date ALI file. If it *can* find an existing up to date ALI file, then
- -- it reads this file and sets the Lib.Compilation_Arguments table from
- -- the A lines in this file.
procedure Add_Preprocessing_Dependency (S : Source_File_Index);
-- Indicate that there is a dependency to be added on a preprocessing data
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index ae4b4c7..64b9683 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -53,6 +53,14 @@ package body Lib.Xref is
-- Declarations --
------------------
+ package Deferred_References is new Table.Table (
+ Table_Component_Type => Deferred_Reference_Entry,
+ Table_Index_Type => Int,
+ Table_Low_Bound => 0,
+ Table_Initial => 512,
+ Table_Increment => 200,
+ Table_Name => "Name_Deferred_References");
+
-- The Xref table is used to record references. The Loc field is set
-- to No_Location for a definition entry.
@@ -199,6 +207,21 @@ package body Lib.Xref is
end if;
end Add_Entry;
+ ---------------------
+ -- Defer_Reference --
+ ---------------------
+
+ procedure Defer_Reference (Deferred_Reference : Deferred_Reference_Entry) is
+ begin
+ -- If Get_Ignore_Errors, then we are in Preanalyze_Without_Errors, and
+ -- we should not record cross references, because that will cause
+ -- duplicates when we call Analyze.
+
+ if not Get_Ignore_Errors then
+ Deferred_References.Append (Deferred_Reference);
+ end if;
+ end Defer_Reference;
+
-----------
-- Equal --
-----------
@@ -595,6 +618,14 @@ package body Lib.Xref is
-- Start of processing for Generate_Reference
begin
+ -- If Get_Ignore_Errors, then we are in Preanalyze_Without_Errors, and
+ -- we should not record cross references, because that will cause
+ -- duplicates when we call Analyze.
+
+ if Get_Ignore_Errors then
+ return;
+ end if;
+
-- May happen in case of severe errors
if Nkind (E) not in N_Entity then
diff --git a/gcc/ada/lib-xref.ads b/gcc/ada/lib-xref.ads
index 79dd57b..6a7a9e5 100644
--- a/gcc/ada/lib-xref.ads
+++ b/gcc/ada/lib-xref.ads
@@ -591,8 +591,8 @@ package Lib.Xref is
-- What we do in such cases is to gather nodes, where we would have liked
-- to call Generate_Reference but we couldn't because we didn't know enough
- -- into this table, then we deal with generating references later on when
- -- we have sufficient information to do it right.
+ -- into a table, then we deal with generating references later on when we
+ -- have sufficient information to do it right.
type Deferred_Reference_Entry is record
E : Entity_Id;
@@ -600,13 +600,8 @@ package Lib.Xref is
end record;
-- One entry, E, N are as required for Generate_Reference call
- package Deferred_References is new Table.Table (
- Table_Component_Type => Deferred_Reference_Entry,
- Table_Index_Type => Int,
- Table_Low_Bound => 0,
- Table_Initial => 512,
- Table_Increment => 200,
- Table_Name => "Name_Deferred_References");
+ procedure Defer_Reference (Deferred_Reference : Deferred_Reference_Entry);
+ -- Add one entry to the deferred reference table
procedure Process_Deferred_References;
-- This procedure is called from Frontend to process these table entries.
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb
index 806f939..49a352a 100644
--- a/gcc/ada/lib.adb
+++ b/gcc/ada/lib.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/lib.ads b/gcc/ada/lib.ads
index c4ace09..be517c0 100644
--- a/gcc/ada/lib.ads
+++ b/gcc/ada/lib.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/libgnarl/s-osinte__aix.adb b/gcc/ada/libgnarl/s-osinte__aix.adb
index 2370383..91c4494 100644
--- a/gcc/ada/libgnarl/s-osinte__aix.adb
+++ b/gcc/ada/libgnarl/s-osinte__aix.adb
@@ -31,10 +31,6 @@
-- This is a AIX (Native) version of this package
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
package body System.OS_Interface is
use Interfaces.C;
diff --git a/gcc/ada/libgnarl/s-osinte__android.adb b/gcc/ada/libgnarl/s-osinte__android.adb
index 00f0d48..5895940 100644
--- a/gcc/ada/libgnarl/s-osinte__android.adb
+++ b/gcc/ada/libgnarl/s-osinte__android.adb
@@ -31,10 +31,6 @@
-- This is an Android version of this package.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
diff --git a/gcc/ada/libgnarl/s-osinte__darwin.adb b/gcc/ada/libgnarl/s-osinte__darwin.adb
index 877bcac..b57a31a 100644
--- a/gcc/ada/libgnarl/s-osinte__darwin.adb
+++ b/gcc/ada/libgnarl/s-osinte__darwin.adb
@@ -31,10 +31,6 @@
-- This is a Darwin Threads version of this package
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
with Interfaces.C.Extensions;
package body System.OS_Interface is
diff --git a/gcc/ada/libgnarl/s-osinte__gnu.adb b/gcc/ada/libgnarl/s-osinte__gnu.adb
index 8da6ce3..dc0f4ec 100644
--- a/gcc/ada/libgnarl/s-osinte__gnu.adb
+++ b/gcc/ada/libgnarl/s-osinte__gnu.adb
@@ -31,10 +31,6 @@
-- This is the GNU/Hurd version of this package.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
diff --git a/gcc/ada/libgnarl/s-osinte__hpux-dce.adb b/gcc/ada/libgnarl/s-osinte__hpux-dce.adb
index 06ec5e6..bcfcf61 100644
--- a/gcc/ada/libgnarl/s-osinte__hpux-dce.adb
+++ b/gcc/ada/libgnarl/s-osinte__hpux-dce.adb
@@ -33,10 +33,6 @@
-- This is a DCE version of this package.
-- Currently HP-UX and SNI use this file
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
diff --git a/gcc/ada/libgnarl/s-osinte__lynxos178.adb b/gcc/ada/libgnarl/s-osinte__lynxos178.adb
index 08ed178..79099d7 100644
--- a/gcc/ada/libgnarl/s-osinte__lynxos178.adb
+++ b/gcc/ada/libgnarl/s-osinte__lynxos178.adb
@@ -31,10 +31,6 @@
-- Version of System.OS_Interface for LynxOS-178 (POSIX Threads)
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It may cause infinite loops and other problems.
-
package body System.OS_Interface is
------------------
diff --git a/gcc/ada/libgnarl/s-osinte__lynxos178e.ads b/gcc/ada/libgnarl/s-osinte__lynxos178e.ads
index 646d301..6d84b35 100644
--- a/gcc/ada/libgnarl/s-osinte__lynxos178e.ads
+++ b/gcc/ada/libgnarl/s-osinte__lynxos178e.ads
@@ -47,10 +47,6 @@ with System.Multiprocessors;
package System.OS_Interface is
pragma Preelaborate;
- pragma Linker_Options ("-mthreads");
- -- Selects the POSIX 1.c runtime, rather than the non-threading runtime or
- -- the deprecated legacy threads library.
-
subtype int is Interfaces.C.int;
subtype short is Interfaces.C.short;
subtype long is Interfaces.C.long;
diff --git a/gcc/ada/libgnarl/s-osinte__posix.adb b/gcc/ada/libgnarl/s-osinte__posix.adb
index 5ff7ae7..4818162 100644
--- a/gcc/ada/libgnarl/s-osinte__posix.adb
+++ b/gcc/ada/libgnarl/s-osinte__posix.adb
@@ -32,10 +32,6 @@
-- This version is for POSIX-like operating systems
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
diff --git a/gcc/ada/libgnarl/s-osinte__qnx.adb b/gcc/ada/libgnarl/s-osinte__qnx.adb
index b02bc83..45b7ea7 100644
--- a/gcc/ada/libgnarl/s-osinte__qnx.adb
+++ b/gcc/ada/libgnarl/s-osinte__qnx.adb
@@ -32,10 +32,6 @@
-- This version is for QNX operating systems
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
diff --git a/gcc/ada/libgnarl/s-osinte__rtems.adb b/gcc/ada/libgnarl/s-osinte__rtems.adb
index bfa5cc5..06cf1ab 100644
--- a/gcc/ada/libgnarl/s-osinte__rtems.adb
+++ b/gcc/ada/libgnarl/s-osinte__rtems.adb
@@ -40,11 +40,8 @@
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
with Interfaces.C; use Interfaces.C;
+
package body System.OS_Interface is
-----------------
diff --git a/gcc/ada/libgnarl/s-osinte__solaris.adb b/gcc/ada/libgnarl/s-osinte__solaris.adb
index e3bb41e..adfc386 100644
--- a/gcc/ada/libgnarl/s-osinte__solaris.adb
+++ b/gcc/ada/libgnarl/s-osinte__solaris.adb
@@ -35,10 +35,6 @@
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
with Interfaces.C; use Interfaces.C;
package body System.OS_Interface is
diff --git a/gcc/ada/libgnarl/s-osinte__vxworks.adb b/gcc/ada/libgnarl/s-osinte__vxworks.adb
index d9de575..e88a9af 100644
--- a/gcc/ada/libgnarl/s-osinte__vxworks.adb
+++ b/gcc/ada/libgnarl/s-osinte__vxworks.adb
@@ -34,10 +34,6 @@
-- This package encapsulates all direct interfaces to OS services that are
-- needed by children of System.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
package body System.OS_Interface is
use type Interfaces.C.int;
diff --git a/gcc/ada/libgnarl/s-osinte__x32.adb b/gcc/ada/libgnarl/s-osinte__x32.adb
index 80f7825..8a7cb4c 100644
--- a/gcc/ada/libgnarl/s-osinte__x32.adb
+++ b/gcc/ada/libgnarl/s-osinte__x32.adb
@@ -32,14 +32,11 @@
-- This version is for Linux/x32
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
with Interfaces.C; use Interfaces.C;
+
package body System.OS_Interface is
--------------------
diff --git a/gcc/ada/libgnarl/s-solita.adb b/gcc/ada/libgnarl/s-solita.adb
index bdd5f9c..ac35781 100644
--- a/gcc/ada/libgnarl/s-solita.adb
+++ b/gcc/ada/libgnarl/s-solita.adb
@@ -33,11 +33,6 @@ pragma Style_Checks (All_Checks);
-- Turn off subprogram alpha ordering check, since we group soft link bodies
-- and dummy soft link bodies together separately in this unit.
-pragma Polling (Off);
--- Turn polling off for this package. We don't need polling during any of the
--- routines in this package, and more to the point, if we try to poll it can
--- cause infinite loops.
-
with Ada.Exceptions;
with Ada.Exceptions.Is_Null_Occurrence;
diff --git a/gcc/ada/libgnarl/s-taasde.adb b/gcc/ada/libgnarl/s-taasde.adb
index dc7dac1..9c4340c 100644
--- a/gcc/ada/libgnarl/s-taasde.adb
+++ b/gcc/ada/libgnarl/s-taasde.adb
@@ -29,10 +29,6 @@
-- --
------------------------------------------------------------------------------
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
with Ada.Unchecked_Conversion;
with Ada.Task_Identification;
diff --git a/gcc/ada/libgnarl/s-taprob.adb b/gcc/ada/libgnarl/s-taprob.adb
index 3f8a457..6ce522a 100644
--- a/gcc/ada/libgnarl/s-taprob.adb
+++ b/gcc/ada/libgnarl/s-taprob.adb
@@ -30,10 +30,6 @@
-- --
------------------------------------------------------------------------------
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.Task_Primitives.Operations;
with System.Soft_Links.Tasking;
diff --git a/gcc/ada/libgnarl/s-taprop__dummy.adb b/gcc/ada/libgnarl/s-taprop__dummy.adb
index b6fa63b..7e9093a 100644
--- a/gcc/ada/libgnarl/s-taprop__dummy.adb
+++ b/gcc/ada/libgnarl/s-taprop__dummy.adb
@@ -34,10 +34,6 @@
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
package body System.Task_Primitives.Operations is
use System.Tasking;
diff --git a/gcc/ada/libgnarl/s-taprop__hpux-dce.adb b/gcc/ada/libgnarl/s-taprop__hpux-dce.adb
index 99049f1..0e00511 100644
--- a/gcc/ada/libgnarl/s-taprop__hpux-dce.adb
+++ b/gcc/ada/libgnarl/s-taprop__hpux-dce.adb
@@ -34,10 +34,6 @@
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Ada.Unchecked_Conversion;
with Interfaces.C;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index fb11e02..757a6cd 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -34,10 +34,6 @@
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Interfaces.C; use Interfaces; use type Interfaces.C.int;
with System.Task_Info;
diff --git a/gcc/ada/libgnarl/s-taprop__mingw.adb b/gcc/ada/libgnarl/s-taprop__mingw.adb
index 8fa5435..4405231 100644
--- a/gcc/ada/libgnarl/s-taprop__mingw.adb
+++ b/gcc/ada/libgnarl/s-taprop__mingw.adb
@@ -34,10 +34,6 @@
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Interfaces.C;
with Interfaces.C.Strings;
diff --git a/gcc/ada/libgnarl/s-taprop__posix.adb b/gcc/ada/libgnarl/s-taprop__posix.adb
index c983c77..8ecb293 100644
--- a/gcc/ada/libgnarl/s-taprop__posix.adb
+++ b/gcc/ada/libgnarl/s-taprop__posix.adb
@@ -40,10 +40,6 @@
-- For configurations where SCHED_FIFO and priority ceiling are not a
-- requirement, this file can also be used (e.g AiX threads)
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Ada.Unchecked_Conversion;
with Interfaces.C;
diff --git a/gcc/ada/libgnarl/s-taprop__qnx.adb b/gcc/ada/libgnarl/s-taprop__qnx.adb
index 52d353c..e3ad521 100644
--- a/gcc/ada/libgnarl/s-taprop__qnx.adb
+++ b/gcc/ada/libgnarl/s-taprop__qnx.adb
@@ -40,10 +40,6 @@
-- For configurations where SCHED_FIFO and priority ceiling are not a
-- requirement, this file can also be used (e.g AiX threads)
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Ada.Unchecked_Conversion;
with Interfaces.C;
diff --git a/gcc/ada/libgnarl/s-taprop__solaris.adb b/gcc/ada/libgnarl/s-taprop__solaris.adb
index 8b0183d..3084842 100644
--- a/gcc/ada/libgnarl/s-taprop__solaris.adb
+++ b/gcc/ada/libgnarl/s-taprop__solaris.adb
@@ -34,10 +34,6 @@
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Interfaces.C;
with System.Multiprocessors;
diff --git a/gcc/ada/libgnarl/s-taprop__vxworks.adb b/gcc/ada/libgnarl/s-taprop__vxworks.adb
index 32c301d..c9d019e 100644
--- a/gcc/ada/libgnarl/s-taprop__vxworks.adb
+++ b/gcc/ada/libgnarl/s-taprop__vxworks.adb
@@ -34,10 +34,6 @@
-- This package contains all the GNULL primitives that interface directly with
-- the underlying OS.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Ada.Unchecked_Conversion;
with Interfaces.C;
diff --git a/gcc/ada/libgnarl/s-tarest.adb b/gcc/ada/libgnarl/s-tarest.adb
index ddaa983..4555101 100644
--- a/gcc/ada/libgnarl/s-tarest.adb
+++ b/gcc/ada/libgnarl/s-tarest.adb
@@ -39,10 +39,6 @@ pragma Style_Checks (All_Checks);
-- This package represents the high level tasking interface used by the
-- compiler to expand Ada 95 tasking constructs into simpler run time calls.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during
--- tasking operations. It causes infinite loops and other problems.
-
with Ada.Exceptions;
with System.Task_Primitives.Operations;
diff --git a/gcc/ada/libgnarl/s-tasini.adb b/gcc/ada/libgnarl/s-tasini.adb
index cdcb0ba..2080ac2 100644
--- a/gcc/ada/libgnarl/s-tasini.adb
+++ b/gcc/ada/libgnarl/s-tasini.adb
@@ -33,11 +33,6 @@ pragma Style_Checks (All_Checks);
-- Turn off subprogram alpha ordering check, since we group soft link bodies
-- and dummy soft link bodies together separately in this unit.
-pragma Polling (Off);
--- Turn polling off for this package. We don't need polling during any of the
--- routines in this package, and more to the point, if we try to poll it can
--- cause infinite loops.
-
with System.Task_Primitives;
with System.Task_Primitives.Operations;
with System.Soft_Links;
diff --git a/gcc/ada/libgnarl/s-taskin.adb b/gcc/ada/libgnarl/s-taskin.adb
index 1c6ab4a..16171c1 100644
--- a/gcc/ada/libgnarl/s-taskin.adb
+++ b/gcc/ada/libgnarl/s-taskin.adb
@@ -29,10 +29,6 @@
-- --
------------------------------------------------------------------------------
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.Task_Primitives.Operations;
with System.Storage_Elements;
diff --git a/gcc/ada/libgnarl/s-taspri__dummy.ads b/gcc/ada/libgnarl/s-taspri__dummy.ads
index 6428ec9..7d87e22 100644
--- a/gcc/ada/libgnarl/s-taspri__dummy.ads
+++ b/gcc/ada/libgnarl/s-taspri__dummy.ads
@@ -31,10 +31,6 @@
-- This is a no tasking version of this package
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
package System.Task_Primitives is
pragma Preelaborate;
diff --git a/gcc/ada/libgnarl/s-taspri__hpux-dce.ads b/gcc/ada/libgnarl/s-taspri__hpux-dce.ads
index 65eda3c..e5bb2eb 100644
--- a/gcc/ada/libgnarl/s-taspri__hpux-dce.ads
+++ b/gcc/ada/libgnarl/s-taspri__hpux-dce.ads
@@ -33,10 +33,6 @@
-- This package provides low-level support for most tasking features
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.OS_Interface;
package System.Task_Primitives is
diff --git a/gcc/ada/libgnarl/s-taspri__lynxos.ads b/gcc/ada/libgnarl/s-taspri__lynxos.ads
index 1e54e4c..36bb3a5 100644
--- a/gcc/ada/libgnarl/s-taspri__lynxos.ads
+++ b/gcc/ada/libgnarl/s-taspri__lynxos.ads
@@ -32,10 +32,6 @@
-- This is LynxOS Family version of this package.
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.OS_Interface;
package System.Task_Primitives is
diff --git a/gcc/ada/libgnarl/s-taspri__mingw.ads b/gcc/ada/libgnarl/s-taspri__mingw.ads
index ecf0958..8199a36 100644
--- a/gcc/ada/libgnarl/s-taspri__mingw.ads
+++ b/gcc/ada/libgnarl/s-taspri__mingw.ads
@@ -31,10 +31,6 @@
-- This is a NT (native) version of this package
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.OS_Interface;
with System.Win32;
diff --git a/gcc/ada/libgnarl/s-taspri__posix-noaltstack.ads b/gcc/ada/libgnarl/s-taspri__posix-noaltstack.ads
index 30475c8..6b19345 100644
--- a/gcc/ada/libgnarl/s-taspri__posix-noaltstack.ads
+++ b/gcc/ada/libgnarl/s-taspri__posix-noaltstack.ads
@@ -35,10 +35,6 @@
-- Note: this file can only be used for POSIX compliant systems
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.OS_Interface;
package System.Task_Primitives is
diff --git a/gcc/ada/libgnarl/s-taspri__posix.ads b/gcc/ada/libgnarl/s-taspri__posix.ads
index 89a35ad..5621754 100644
--- a/gcc/ada/libgnarl/s-taspri__posix.ads
+++ b/gcc/ada/libgnarl/s-taspri__posix.ads
@@ -34,10 +34,6 @@
-- Note: this file can only be used for POSIX compliant systems
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.OS_Interface;
package System.Task_Primitives is
diff --git a/gcc/ada/libgnarl/s-taspri__solaris.ads b/gcc/ada/libgnarl/s-taspri__solaris.ads
index bc45168..6e963d5 100644
--- a/gcc/ada/libgnarl/s-taspri__solaris.ads
+++ b/gcc/ada/libgnarl/s-taspri__solaris.ads
@@ -33,10 +33,6 @@
-- This package provides low-level support for most tasking features
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with Ada.Unchecked_Conversion;
with System.OS_Interface;
diff --git a/gcc/ada/libgnarl/s-taspri__vxworks.ads b/gcc/ada/libgnarl/s-taspri__vxworks.ads
index 92cd88c..2c7aadd 100644
--- a/gcc/ada/libgnarl/s-taspri__vxworks.ads
+++ b/gcc/ada/libgnarl/s-taspri__vxworks.ads
@@ -31,10 +31,6 @@
-- This is a VxWorks version of this package
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.OS_Interface;
package System.Task_Primitives is
diff --git a/gcc/ada/libgnarl/s-tassta.adb b/gcc/ada/libgnarl/s-tassta.adb
index c594027..aada734 100644
--- a/gcc/ada/libgnarl/s-tassta.adb
+++ b/gcc/ada/libgnarl/s-tassta.adb
@@ -29,10 +29,6 @@
-- --
------------------------------------------------------------------------------
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
pragma Partition_Elaboration_Policy (Concurrent);
-- This package only implements the concurrent elaboration policy. This pragma
-- will enforce it (and detect conflicts with user specified policy).
diff --git a/gcc/ada/libgnarl/s-tasuti.adb b/gcc/ada/libgnarl/s-tasuti.adb
index 90c5bd9..6dbd1f06 100644
--- a/gcc/ada/libgnarl/s-tasuti.adb
+++ b/gcc/ada/libgnarl/s-tasuti.adb
@@ -33,10 +33,6 @@
-- These declarations are not part of the GNARLI
-pragma Polling (Off);
--- Turn off polling, we do not want ATC polling to take place during tasking
--- operations. It causes infinite loops and other problems.
-
with System.Tasking.Debug;
with System.Task_Primitives.Operations;
with System.Tasking.Initialization;
diff --git a/gcc/ada/libgnarl/s-tposen.adb b/gcc/ada/libgnarl/s-tposen.adb
index 3545435..eb01580 100644
--- a/gcc/ada/libgnarl/s-tposen.adb
+++ b/gcc/ada/libgnarl/s-tposen.adb
@@ -52,10 +52,6 @@ pragma Style_Checks (All_Checks);
-- performed at compile time, and is relatively cheap (see PO_Do_Or_Queue,
-- Service_Entry).
-pragma Polling (Off);
--- Turn off polling, we do not want polling to take place during tasking
--- operations. It can cause infinite loops and other problems.
-
pragma Suppress (All_Checks);
-- Why is this required ???
diff --git a/gcc/ada/libgnat/a-cbdlli.adb b/gcc/ada/libgnat/a-cbdlli.adb
index 0f0c872..a0c356d 100644
--- a/gcc/ada/libgnat/a-cbdlli.adb
+++ b/gcc/ada/libgnat/a-cbdlli.adb
@@ -28,6 +28,7 @@
------------------------------------------------------------------------------
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Doubly_Linked_Lists with
SPARK_Mode => Off
@@ -204,6 +205,18 @@ is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ---------------
+ -- Append_One --
+ ---------------
+
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, No_Element, New_Item, 1);
+ end Append_One;
+
------------
-- Assign --
------------
@@ -505,6 +518,17 @@ is
return Position.Container.Nodes (Position.Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return List is
+ begin
+ return Result : List (Capacity) do
+ null;
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
@@ -1479,6 +1503,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : List)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cbdlli.ads b/gcc/ada/libgnat/a-cbdlli.ads
index 74639cf..183c01e 100644
--- a/gcc/ada/libgnat/a-cbdlli.ads
+++ b/gcc/ada/libgnat/a-cbdlli.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Streams;
private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -54,8 +55,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
-
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Append_One);
pragma Preelaborable_Initialization (List);
type Cursor is private;
@@ -65,6 +67,8 @@ is
No_Element : constant Cursor;
+ function Empty (Capacity : Count_Type := 10) return List;
+
function Has_Element (Position : Cursor) return Boolean;
package List_Iterator_Interfaces is new
@@ -149,6 +153,10 @@ is
New_Item : Element_Type;
Count : Count_Type := 1);
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type);
+
procedure Delete
(Container : in out List;
Position : in out Cursor;
@@ -268,13 +276,16 @@ private
type Node_Array is array (Count_Type range <>) of Node_Type;
type List (Capacity : Count_Type) is tagged record
- Nodes : Node_Array (1 .. Capacity) := (others => <>);
+ Nodes : Node_Array (1 .. Capacity);
Free : Count_Type'Base := -1;
First : Count_Type := 0;
Last : Count_Type := 0;
Length : Count_Type := 0;
TC : aliased Tamper_Counts;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : List);
procedure Read
(Stream : not null access Root_Stream_Type'Class;
diff --git a/gcc/ada/libgnat/a-cbhama.adb b/gcc/ada/libgnat/a-cbhama.adb
index 1881db2..7f0c0e6 100644
--- a/gcc/ada/libgnat/a-cbhama.adb
+++ b/gcc/ada/libgnat/a-cbhama.adb
@@ -38,6 +38,7 @@ with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Hashed_Maps with
SPARK_Mode => Off
@@ -363,6 +364,17 @@ is
return Position.Container.Nodes (Position.Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type) return Map is
+ begin
+ return Result : Map (Capacity, 0) do
+ null;
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Key_Node --
-------------------------
@@ -885,6 +897,36 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Key_Value (Position : Cursor);
+ procedure Put_Key_Value (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Key_Type'Put_Image (S, Key (Position));
+ Put_Arrow (S);
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Key_Value;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Key_Value'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cbhama.ads b/gcc/ada/libgnat/a-cbhama.ads
index 86fed4e..7a1d0f6 100644
--- a/gcc/ada/libgnat/a-cbhama.ads
+++ b/gcc/ada/libgnat/a-cbhama.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Hash_Tables;
private with Ada.Streams;
private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Key_Type is private;
@@ -56,7 +57,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
@@ -67,6 +70,8 @@ is
-- Map objects declared without an initialization expression are
-- initialized to the value Empty_Map.
+ function Empty (Capacity : Count_Type) return Map;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
@@ -340,7 +345,11 @@ private
new Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type);
type Map (Capacity : Count_Type; Modulus : Hash_Type) is
- new HT_Types.Hash_Table_Type (Capacity, Modulus) with null record;
+ new HT_Types.Hash_Table_Type (Capacity, Modulus)
+ with null record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map);
use HT_Types, HT_Types.Implementation;
use Ada.Streams;
diff --git a/gcc/ada/libgnat/a-cbhase.adb b/gcc/ada/libgnat/a-cbhase.adb
index a332bd7..293d722 100644
--- a/gcc/ada/libgnat/a-cbhase.adb
+++ b/gcc/ada/libgnat/a-cbhase.adb
@@ -38,10 +38,12 @@ with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Prime_Numbers; use Ada.Containers.Prime_Numbers;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Hashed_Sets with
SPARK_Mode => Off
is
+ use Ada.Finalization;
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
@@ -454,6 +456,17 @@ is
end;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Set is
+ begin
+ return Result : Set (Capacity, 0) do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Sets --
---------------------
@@ -1107,6 +1120,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cbhase.ads b/gcc/ada/libgnat/a-cbhase.ads
index 01903c7..c82a123 100644
--- a/gcc/ada/libgnat/a-cbhase.ads
+++ b/gcc/ada/libgnat/a-cbhase.ads
@@ -36,7 +36,8 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Hash_Tables;
with Ada.Containers.Helpers;
private with Ada.Streams;
-private with Ada.Finalization; use Ada.Finalization;
+private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -58,7 +59,9 @@ is
type Set (Capacity : Count_Type; Modulus : Hash_Type) is tagged private
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
@@ -69,6 +72,8 @@ is
-- Set objects declared without an initialization expression are
-- initialized to the value Empty_Set.
+ function Empty (Capacity : Count_Type := 10) return Set;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
@@ -498,7 +503,11 @@ private
new Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type);
type Set (Capacity : Count_Type; Modulus : Hash_Type) is
- new HT_Types.Hash_Table_Type (Capacity, Modulus) with null record;
+ new HT_Types.Hash_Table_Type (Capacity, Modulus)
+ with null record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
use HT_Types, HT_Types.Implementation;
use Ada.Streams;
@@ -590,7 +599,7 @@ private
No_Element : constant Cursor := (Container => null, Node => 0);
- type Iterator is new Limited_Controlled and
+ type Iterator is new Ada.Finalization.Limited_Controlled and
Set_Iterator_Interfaces.Forward_Iterator with
record
Container : Set_Access;
diff --git a/gcc/ada/libgnat/a-cbmutr.adb b/gcc/ada/libgnat/a-cbmutr.adb
index 58db8cf..3b25d20 100644
--- a/gcc/ada/libgnat/a-cbmutr.adb
+++ b/gcc/ada/libgnat/a-cbmutr.adb
@@ -29,6 +29,7 @@
with Ada.Finalization;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Multiway_Trees with
SPARK_Mode => Off
@@ -2322,6 +2323,49 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Tree)
+ is
+ use System.Put_Images;
+
+ procedure Rec (Position : Cursor);
+ -- Recursive routine operating on cursors
+
+ procedure Rec (Position : Cursor) is
+ First_Time : Boolean := True;
+ begin
+ Array_Before (S);
+
+ for X in Iterate_Children (V, Position) loop
+ if First_Time then
+ First_Time := False;
+ else
+ Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, Element (X));
+ if Child_Count (X) > 0 then
+ Simple_Array_Between (S);
+ Rec (X);
+ end if;
+ end loop;
+
+ Array_After (S);
+ end Rec;
+
+ begin
+ if First_Child (Root (V)) = No_Element then
+ Array_Before (S);
+ Array_After (S);
+ else
+ Rec (First_Child (Root (V)));
+ end if;
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cbmutr.ads b/gcc/ada/libgnat/a-cbmutr.ads
index 653407b..a9fb55a 100644
--- a/gcc/ada/libgnat/a-cbmutr.ads
+++ b/gcc/ada/libgnat/a-cbmutr.ads
@@ -35,6 +35,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -302,12 +303,15 @@ private
type Element_Array is array (Count_Type range <>) of aliased Element_Type;
type Tree (Capacity : Count_Type) is tagged record
- Nodes : Tree_Node_Array (0 .. Capacity) := (others => <>);
- Elements : Element_Array (1 .. Capacity) := (others => <>);
+ Nodes : Tree_Node_Array (0 .. Capacity);
+ Elements : Element_Array (1 .. Capacity);
Free : Count_Type'Base := No_Node;
TC : aliased Tamper_Counts;
Count : Count_Type := 0;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Tree);
procedure Write
(Stream : not null access Root_Stream_Type'Class;
diff --git a/gcc/ada/libgnat/a-cborma.adb b/gcc/ada/libgnat/a-cborma.adb
index 6f59471..5401847 100644
--- a/gcc/ada/libgnat/a-cborma.adb
+++ b/gcc/ada/libgnat/a-cborma.adb
@@ -38,6 +38,7 @@ pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Ordered_Maps with
SPARK_Mode => Off
@@ -572,6 +573,17 @@ is
return Container.Nodes (Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Map is
+ begin
+ return Result : Map (Capacity) do
+ null;
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Keys --
---------------------
@@ -1289,6 +1301,36 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Key_Value (Position : Cursor);
+ procedure Put_Key_Value (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Key_Type'Put_Image (S, Key (Position));
+ Put_Arrow (S);
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Key_Value;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Key_Value'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cborma.ads b/gcc/ada/libgnat/a-cborma.ads
index c199a09..4da71bc 100644
--- a/gcc/ada/libgnat/a-cborma.ads
+++ b/gcc/ada/libgnat/a-cborma.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Red_Black_Trees;
private with Ada.Streams;
private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Key_Type is private;
@@ -57,7 +58,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
@@ -66,6 +69,8 @@ is
Empty_Map : constant Map;
+ function Empty (Capacity : Count_Type := 10) return Map;
+
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
@@ -248,7 +253,11 @@ private
new Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type);
type Map (Capacity : Count_Type) is
- new Tree_Types.Tree_Type (Capacity) with null record;
+ new Tree_Types.Tree_Type (Capacity)
+ with null record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map);
use Red_Black_Trees;
use Tree_Types, Tree_Types.Implementation;
diff --git a/gcc/ada/libgnat/a-cborse.adb b/gcc/ada/libgnat/a-cborse.adb
index af4f87f..e4a2de8 100644
--- a/gcc/ada/libgnat/a-cborse.adb
+++ b/gcc/ada/libgnat/a-cborse.adb
@@ -41,6 +41,7 @@ pragma Elaborate_All
(Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Ordered_Sets with
SPARK_Mode => Off
@@ -548,6 +549,17 @@ is
return Position.Container.Nodes (Position.Node).Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Set is
+ begin
+ return Result : Set (Capacity) do
+ null;
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Elements --
-------------------------
@@ -1628,6 +1640,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cborse.ads b/gcc/ada/libgnat/a-cborse.ads
index 52b8786..92a6df7 100644
--- a/gcc/ada/libgnat/a-cborse.ads
+++ b/gcc/ada/libgnat/a-cborse.ads
@@ -37,6 +37,7 @@ with Ada.Containers.Helpers;
private with Ada.Containers.Red_Black_Trees;
private with Ada.Streams;
private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -56,7 +57,9 @@ is
type Set (Capacity : Count_Type) is tagged private
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
@@ -65,6 +68,8 @@ is
Empty_Set : constant Set;
+ function Empty (Capacity : Count_Type := 10) return Set;
+
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
@@ -336,7 +341,11 @@ private
new Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type);
type Set (Capacity : Count_Type) is
- new Tree_Types.Tree_Type (Capacity) with null record;
+ new Tree_Types.Tree_Type (Capacity)
+ with null record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
use Tree_Types, Tree_Types.Implementation;
use Ada.Finalization;
diff --git a/gcc/ada/libgnat/a-cbsyqu.ads b/gcc/ada/libgnat/a-cbsyqu.ads
index 61504fa..225db21 100644
--- a/gcc/ada/libgnat/a-cbsyqu.ads
+++ b/gcc/ada/libgnat/a-cbsyqu.ads
@@ -78,7 +78,7 @@ is
First, Last : Count_Type := 0;
Length : Count_Type := 0;
Max_Length : Count_Type := 0;
- Elements : Element_Array (1 .. Capacity) := (others => <>);
+ Elements : Element_Array (1 .. Capacity);
end record;
end Implementation;
diff --git a/gcc/ada/libgnat/a-cdlili.adb b/gcc/ada/libgnat/a-cdlili.adb
index a668db1..f07190e 100644
--- a/gcc/ada/libgnat/a-cdlili.adb
+++ b/gcc/ada/libgnat/a-cdlili.adb
@@ -30,6 +30,7 @@
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Doubly_Linked_Lists with
SPARK_Mode => Off
@@ -163,6 +164,18 @@ is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ---------------
+ -- Append_One --
+ ---------------
+
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, No_Element, New_Item, 1);
+ end Append_One;
+
------------
-- Assign --
------------
@@ -1255,6 +1268,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : List)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cdlili.ads b/gcc/ada/libgnat/a-cdlili.ads
index 89216e0..35c4352 100644
--- a/gcc/ada/libgnat/a-cdlili.ads
+++ b/gcc/ada/libgnat/a-cdlili.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -55,7 +56,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Append_One);
pragma Preelaborable_Initialization (List);
@@ -63,6 +66,7 @@ is
pragma Preelaborable_Initialization (Cursor);
Empty_List : constant List;
+ function Empty return List;
No_Element : constant Cursor;
@@ -152,6 +156,10 @@ is
New_Item : Element_Type;
Count : Count_Type := 1);
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type);
+
procedure Delete
(Container : in out List;
Position : in out Cursor;
@@ -275,7 +283,10 @@ private
Last : Node_Access := null;
Length : Count_Type := 0;
TC : aliased Tamper_Counts;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : List);
overriding procedure Adjust (Container : in out List);
@@ -381,6 +392,7 @@ private
-- Returns a pointer to the element designated by Position.
Empty_List : constant List := (Controlled with others => <>);
+ function Empty return List is (Empty_List);
No_Element : constant Cursor := Cursor'(null, null);
diff --git a/gcc/ada/libgnat/a-cfdlli.ads b/gcc/ada/libgnat/a-cfdlli.ads
index 6131239..f7dbf04 100644
--- a/gcc/ada/libgnat/a-cfdlli.ads
+++ b/gcc/ada/libgnat/a-cfdlli.ads
@@ -1617,7 +1617,7 @@ private
Length : Count_Type := 0;
First : Count_Type := 0;
Last : Count_Type := 0;
- Nodes : Node_Array (1 .. Capacity) := (others => <>);
+ Nodes : Node_Array (1 .. Capacity);
end record;
Empty_List : constant List := (0, others => <>);
diff --git a/gcc/ada/libgnat/a-cfinve.adb b/gcc/ada/libgnat/a-cfinve.adb
index 28e31d1..e424df0 100644
--- a/gcc/ada/libgnat/a-cfinve.adb
+++ b/gcc/ada/libgnat/a-cfinve.adb
@@ -40,7 +40,7 @@ is
-- When growing a container, multiply current capacity by this. Doubling
-- leads to amortized linear-time copying.
- type Int is range System.Min_Int .. System.Max_Int;
+ subtype Int is Long_Long_Integer;
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Array, Elements_Array_Ptr);
diff --git a/gcc/ada/libgnat/a-cgcaso.adb b/gcc/ada/libgnat/a-cgcaso.adb
index 877abab..ff03b80 100644
--- a/gcc/ada/libgnat/a-cgcaso.adb
+++ b/gcc/ada/libgnat/a-cgcaso.adb
@@ -29,12 +29,10 @@
-- This algorithm was adapted from GNAT.Heap_Sort_G (see g-hesorg.ad[sb])
-with System;
-
procedure Ada.Containers.Generic_Constrained_Array_Sort
(Container : in out Array_Type)
is
- type T is range System.Min_Int .. System.Max_Int;
+ subtype T is Long_Long_Integer;
function To_Index (J : T) return Index_Type;
pragma Inline (To_Index);
diff --git a/gcc/ada/libgnat/a-cidlli.adb b/gcc/ada/libgnat/a-cidlli.adb
index 0898db8..a62338f 100644
--- a/gcc/ada/libgnat/a-cidlli.adb
+++ b/gcc/ada/libgnat/a-cidlli.adb
@@ -30,6 +30,7 @@
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Doubly_Linked_Lists with
SPARK_Mode => Off
@@ -184,6 +185,18 @@ is
Insert (Container, No_Element, New_Item, Count);
end Append;
+ ---------------
+ -- Append_One --
+ ---------------
+
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, No_Element, New_Item, 1);
+ end Append_One;
+
------------
-- Assign --
------------
@@ -1297,6 +1310,34 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : List)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Elem (Position : Cursor);
+ procedure Put_Elem (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Elem;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Elem'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cidlli.ads b/gcc/ada/libgnat/a-cidlli.ads
index e9220a6..5e63cf2 100644
--- a/gcc/ada/libgnat/a-cidlli.ads
+++ b/gcc/ada/libgnat/a-cidlli.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -54,7 +55,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Append_One);
pragma Preelaborable_Initialization (List);
@@ -62,6 +65,7 @@ is
pragma Preelaborable_Initialization (Cursor);
Empty_List : constant List;
+ function Empty return List;
No_Element : constant Cursor;
@@ -145,6 +149,10 @@ is
New_Item : Element_Type;
Count : Count_Type := 1);
+ procedure Append_One
+ (Container : in out List;
+ New_Item : Element_Type);
+
procedure Delete
(Container : in out List;
Position : in out Cursor;
@@ -269,7 +277,10 @@ private
Last : Node_Access := null;
Length : Count_Type := 0;
TC : aliased Tamper_Counts;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : List);
overriding procedure Adjust (Container : in out List);
@@ -372,6 +383,7 @@ private
-- Returns a pointer to the element designated by Position.
Empty_List : constant List := List'(Controlled with others => <>);
+ function Empty return List is (Empty_List);
No_Element : constant Cursor := Cursor'(null, null);
diff --git a/gcc/ada/libgnat/a-cihama.adb b/gcc/ada/libgnat/a-cihama.adb
index 9f5aed7..64f662f 100644
--- a/gcc/ada/libgnat/a-cihama.adb
+++ b/gcc/ada/libgnat/a-cihama.adb
@@ -38,6 +38,7 @@ with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Hashed_Maps with
SPARK_Mode => Off
@@ -384,6 +385,17 @@ is
return Position.Node.Element.all;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Map is
+ begin
+ return Result : Map do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Key_Node --
-------------------------
@@ -952,6 +964,36 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Key_Value (Position : Cursor);
+ procedure Put_Key_Value (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Key_Type'Put_Image (S, Key (Position));
+ Put_Arrow (S);
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Key_Value;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Key_Value'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cihama.ads b/gcc/ada/libgnat/a-cihama.ads
index fb6f4e0..ccf5f4e 100644
--- a/gcc/ada/libgnat/a-cihama.ads
+++ b/gcc/ada/libgnat/a-cihama.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Hash_Tables;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Key_Type (<>) is private;
@@ -56,7 +57,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
@@ -67,6 +70,8 @@ is
-- Map objects declared without an initialization expression are
-- initialized to the value Empty_Map.
+ function Empty (Capacity : Count_Type := 1000) return Map;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
@@ -328,7 +333,10 @@ private
type Map is new Ada.Finalization.Controlled with record
HT : HT_Types.Hash_Table_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map);
overriding procedure Adjust (Container : in out Map);
diff --git a/gcc/ada/libgnat/a-cihase.adb b/gcc/ada/libgnat/a-cihase.adb
index b91532d..ebc9152 100644
--- a/gcc/ada/libgnat/a-cihase.adb
+++ b/gcc/ada/libgnat/a-cihase.adb
@@ -40,6 +40,7 @@ with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Prime_Numbers;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Hashed_Sets with
SPARK_Mode => Off
@@ -505,6 +506,17 @@ is
return Position.Node.Element.all;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Set is
+ begin
+ return Result : Set do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Sets --
---------------------
@@ -1264,6 +1276,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cihase.ads b/gcc/ada/libgnat/a-cihase.ads
index 926e07f..cdfd86e 100644
--- a/gcc/ada/libgnat/a-cihase.ads
+++ b/gcc/ada/libgnat/a-cihase.ads
@@ -37,6 +37,7 @@ private with Ada.Containers.Hash_Tables;
with Ada.Containers.Helpers;
private with Ada.Streams;
private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -58,7 +59,9 @@ is
type Set is tagged private
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
@@ -69,6 +72,8 @@ is
-- Set objects declared without an initialization expression are
-- initialized to the value Empty_Set.
+ function Empty (Capacity : Count_Type := 1000) return Set;
+
No_Element : constant Cursor;
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
@@ -492,7 +497,10 @@ private
type Set is new Ada.Finalization.Controlled with record
HT : HT_Types.Hash_Table_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
diff --git a/gcc/ada/libgnat/a-cimutr.adb b/gcc/ada/libgnat/a-cimutr.adb
index 293275a..b358aad 100644
--- a/gcc/ada/libgnat/a-cimutr.adb
+++ b/gcc/ada/libgnat/a-cimutr.adb
@@ -30,6 +30,7 @@
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Multiway_Trees with
SPARK_Mode => Off
@@ -1875,6 +1876,49 @@ is
Process (Position.Node.Element.all);
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Tree)
+ is
+ use System.Put_Images;
+
+ procedure Rec (Position : Cursor);
+ -- Recursive routine operating on cursors
+
+ procedure Rec (Position : Cursor) is
+ First_Time : Boolean := True;
+ begin
+ Array_Before (S);
+
+ for X in Iterate_Children (V, Position) loop
+ if First_Time then
+ First_Time := False;
+ else
+ Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, Element (X));
+ if Child_Count (X) > 0 then
+ Simple_Array_Between (S);
+ Rec (X);
+ end if;
+ end loop;
+
+ Array_After (S);
+ end Rec;
+
+ begin
+ if First_Child (Root (V)) = No_Element then
+ Array_Before (S);
+ Array_After (S);
+ else
+ Rec (First_Child (Root (V)));
+ end if;
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cimutr.ads b/gcc/ada/libgnat/a-cimutr.ads
index 474a1b5..9e03eb9 100644
--- a/gcc/ada/libgnat/a-cimutr.ads
+++ b/gcc/ada/libgnat/a-cimutr.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -348,7 +349,10 @@ private
Root : aliased Tree_Node_Type;
TC : aliased Tamper_Counts;
Count : Count_Type := 0;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Tree);
overriding procedure Adjust (Container : in out Tree);
diff --git a/gcc/ada/libgnat/a-ciorma.adb b/gcc/ada/libgnat/a-ciorma.adb
index 86cd01f..7cfe07d 100644
--- a/gcc/ada/libgnat/a-ciorma.adb
+++ b/gcc/ada/libgnat/a-ciorma.adb
@@ -38,6 +38,7 @@ with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Ordered_Maps with
SPARK_Mode => Off
@@ -1291,6 +1292,36 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Key_Value (Position : Cursor);
+ procedure Put_Key_Value (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Key_Type'Put_Image (S, Key (Position));
+ Put_Arrow (S);
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Key_Value;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Key_Value'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-ciorma.ads b/gcc/ada/libgnat/a-ciorma.ads
index a7799a6..17f5dfd 100644
--- a/gcc/ada/libgnat/a-ciorma.ads
+++ b/gcc/ada/libgnat/a-ciorma.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Key_Type (<>) is private;
@@ -57,7 +58,9 @@ is
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
@@ -66,6 +69,8 @@ is
Empty_Map : constant Map;
+ function Empty return Map;
+
No_Element : constant Cursor;
function Has_Element (Position : Cursor) return Boolean;
@@ -256,7 +261,10 @@ private
type Map is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map);
overriding procedure Adjust (Container : in out Map);
@@ -363,6 +371,7 @@ private
-- Returns a pointer to the element designated by Position.
Empty_Map : constant Map := (Controlled with others => <>);
+ function Empty return Map is (Empty_Map);
No_Element : constant Cursor := Cursor'(null, null);
diff --git a/gcc/ada/libgnat/a-ciormu.adb b/gcc/ada/libgnat/a-ciormu.adb
index 110d734..c3672f4 100644
--- a/gcc/ada/libgnat/a-ciormu.adb
+++ b/gcc/ada/libgnat/a-ciormu.adb
@@ -39,6 +39,7 @@ with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Ordered_Multisets with
SPARK_Mode => Off
@@ -1657,6 +1658,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-ciormu.ads b/gcc/ada/libgnat/a-ciormu.ads
index 474ccc7..5667e2c 100644
--- a/gcc/ada/libgnat/a-ciormu.ads
+++ b/gcc/ada/libgnat/a-ciormu.ads
@@ -35,6 +35,7 @@
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
with Ada.Iterator_Interfaces;
generic
@@ -468,7 +469,10 @@ private
type Set is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
diff --git a/gcc/ada/libgnat/a-ciorse.adb b/gcc/ada/libgnat/a-ciorse.adb
index 772061d..df56e48 100644
--- a/gcc/ada/libgnat/a-ciorse.adb
+++ b/gcc/ada/libgnat/a-ciorse.adb
@@ -41,6 +41,7 @@ pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Ordered_Sets with
SPARK_Mode => Off
@@ -1722,6 +1723,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-ciorse.ads b/gcc/ada/libgnat/a-ciorse.ads
index 1eb8135..1b6e317 100644
--- a/gcc/ada/libgnat/a-ciorse.ads
+++ b/gcc/ada/libgnat/a-ciorse.ads
@@ -37,6 +37,7 @@ with Ada.Containers.Helpers;
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -56,7 +57,9 @@ is
type Set is tagged private with
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
@@ -64,6 +67,7 @@ is
pragma Preelaborable_Initialization (Cursor);
Empty_Set : constant Set;
+ function Empty return Set;
No_Element : constant Cursor;
@@ -357,7 +361,10 @@ private
type Set is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
@@ -442,6 +449,7 @@ private
-- Returns a pointer to the element designated by Position.
Empty_Set : constant Set := (Controlled with others => <>);
+ function Empty return Set is (Empty_Set);
No_Element : constant Cursor := Cursor'(null, null);
diff --git a/gcc/ada/libgnat/a-coboho.adb b/gcc/ada/libgnat/a-coboho.adb
index eefb106..5d44163 100644
--- a/gcc/ada/libgnat/a-coboho.adb
+++ b/gcc/ada/libgnat/a-coboho.adb
@@ -26,6 +26,7 @@
------------------------------------------------------------------------------
with Unchecked_Conversion;
+with System.Put_Images;
package body Ada.Containers.Bounded_Holders is
@@ -64,6 +65,20 @@ package body Ada.Containers.Bounded_Holders is
return Get (Left) = Get (Right);
end "=";
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder)
+ is
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+ Element_Type'Put_Image (S, Get (V));
+ Array_After (S);
+ end Put_Image;
+
---------
-- Get --
---------
diff --git a/gcc/ada/libgnat/a-coboho.ads b/gcc/ada/libgnat/a-coboho.ads
index cb24c89..024e6a6 100644
--- a/gcc/ada/libgnat/a-coboho.ads
+++ b/gcc/ada/libgnat/a-coboho.ads
@@ -30,6 +30,7 @@
------------------------------------------------------------------------------
private with System;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -93,11 +94,14 @@ private
type Holder is record
Data : Storage_Array (1 .. Max_Size_In_Storage_Elements);
end record
- with Alignment => Standard'Maximum_Alignment;
+ with Alignment => Standard'Maximum_Alignment, Put_Image => Put_Image;
-- We would like to say "Alignment => Element_Type'Alignment", but that
-- is illegal because it's not static, so we use the maximum possible
-- (default) alignment instead.
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder);
+
type Element_Access is access all Element_Type;
pragma Assert (Element_Access'Size = Standard'Address_Size,
"cannot instantiate with an array type");
diff --git a/gcc/ada/libgnat/a-cobove.adb b/gcc/ada/libgnat/a-cobove.adb
index fe94ea5..0408741 100644
--- a/gcc/ada/libgnat/a-cobove.adb
+++ b/gcc/ada/libgnat/a-cobove.adb
@@ -30,6 +30,7 @@
with Ada.Containers.Generic_Array_Sort;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Bounded_Vectors is
@@ -350,6 +351,17 @@ package body Ada.Containers.Bounded_Vectors is
Container.Insert (Container.Last + 1, New_Item, Count);
end Append;
+ ----------------
+ -- Append_One --
+ ----------------
+
+ procedure Append_One (Container : in out Vector;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, Last_Index (Container) + 1, New_Item, 1);
+ end Append_One;
+
--------------
-- Capacity --
--------------
@@ -696,6 +708,17 @@ package body Ada.Containers.Bounded_Vectors is
end if;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Vector is
+ begin
+ return Result : Vector (Capacity) do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
@@ -824,6 +847,16 @@ package body Ada.Containers.Bounded_Vectors is
return Index_Type'First;
end First_Index;
+ -----------------
+ -- New_Vector --
+ -----------------
+
+ function New_Vector (First, Last : Index_Type) return Vector
+ is
+ begin
+ return (To_Vector (Count_Type (Last - First + 1)));
+ end New_Vector;
+
---------------------
-- Generic_Sorting --
---------------------
@@ -2097,6 +2130,31 @@ package body Ada.Containers.Bounded_Vectors is
Query_Element (Position.Container.all, Position.Index, Process);
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Vector)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cobove.ads b/gcc/ada/libgnat/a-cobove.ads
index 72da498..ab4ce4e 100644
--- a/gcc/ada/libgnat/a-cobove.ads
+++ b/gcc/ada/libgnat/a-cobove.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Streams;
private with Ada.Finalization;
+private with Ada.Strings.Text_Output;
generic
type Index_Type is range <>;
@@ -58,7 +59,11 @@ package Ada.Containers.Bounded_Vectors is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Append_One,
+ New_Indexed => New_Vector,
+ Assign_Indexed => Replace_Element);
pragma Preelaborable_Initialization (Vector);
@@ -74,8 +79,14 @@ package Ada.Containers.Bounded_Vectors is
package Vector_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
+ function Empty (Capacity : Count_Type := 10) return Vector;
+
overriding function "=" (Left, Right : Vector) return Boolean;
+ function New_Vector (First, Last : Index_Type) return Vector
+ with Pre => First = Index_Type'First;
+ -- Ada_2020 aggregate operation.
+
function To_Vector (Length : Count_Type) return Vector;
function To_Vector
@@ -243,6 +254,10 @@ package Ada.Containers.Bounded_Vectors is
New_Item : Element_Type;
Count : Count_Type := 1);
+ procedure Append_One (Container : in out Vector;
+ New_Item : Element_Type);
+ -- Ada_2020 aggregate operation.
+
procedure Insert_Space
(Container : in out Vector;
Before : Extended_Index;
@@ -377,10 +392,13 @@ private
function "=" (L, R : Elements_Array) return Boolean is abstract;
type Vector (Capacity : Count_Type) is tagged record
- Elements : Elements_Array (1 .. Capacity) := (others => <>);
+ Elements : Elements_Array (1 .. Capacity);
Last : Extended_Index := No_Index;
TC : aliased Tamper_Counts;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Vector);
procedure Write
(Stream : not null access Root_Stream_Type'Class;
diff --git a/gcc/ada/libgnat/a-cofove.adb b/gcc/ada/libgnat/a-cofove.adb
index 41c69a8..d467384 100644
--- a/gcc/ada/libgnat/a-cofove.adb
+++ b/gcc/ada/libgnat/a-cofove.adb
@@ -33,7 +33,7 @@ package body Ada.Containers.Formal_Vectors with
SPARK_Mode => Off
is
- type Int is range System.Min_Int .. System.Max_Int;
+ subtype Int is Long_Long_Integer;
function To_Array_Index (Index : Index_Type'Base) return Count_Type'Base;
@@ -171,7 +171,7 @@ is
elsif Capacity >= LS then
C := Capacity;
else
- raise Capacity_Error;
+ raise Capacity_Error with "Capacity too small";
end if;
return Target : Vector (C) do
@@ -956,6 +956,12 @@ is
if New_Length > Max_Length then
raise Constraint_Error with "Count is out of range";
+
+ -- Raise Capacity_Error if the new length exceeds the container's
+ -- capacity.
+
+ elsif New_Length > Container.Capacity then
+ raise Capacity_Error with "New length is larger than capacity";
end if;
J := To_Array_Index (Before);
@@ -1104,7 +1110,7 @@ is
is
begin
if Capacity > Container.Capacity then
- raise Constraint_Error with "Capacity is out of range";
+ raise Capacity_Error with "Capacity is out of range";
end if;
end Reserve_Capacity;
diff --git a/gcc/ada/libgnat/a-cogeso.adb b/gcc/ada/libgnat/a-cogeso.adb
index 7a71772..2b6b05e 100644
--- a/gcc/ada/libgnat/a-cogeso.adb
+++ b/gcc/ada/libgnat/a-cogeso.adb
@@ -29,10 +29,8 @@
-- This algorithm was adapted from GNAT.Heap_Sort (see g-heasor.ad[sb])
-with System;
-
procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base) is
- type T is range System.Min_Int .. System.Max_Int;
+ subtype T is Long_Long_Integer;
function To_Index (J : T) return Index_Type;
pragma Inline (To_Index);
diff --git a/gcc/ada/libgnat/a-cohama.adb b/gcc/ada/libgnat/a-cohama.adb
index 7f2d8e1..1475330 100644
--- a/gcc/ada/libgnat/a-cohama.adb
+++ b/gcc/ada/libgnat/a-cohama.adb
@@ -38,6 +38,7 @@ pragma Elaborate_All (Ada.Containers.Hash_Tables.Generic_Keys);
with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Hashed_Maps with
SPARK_Mode => Off
@@ -366,6 +367,17 @@ is
return Position.Node.Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Map is
+ begin
+ return Result : Map do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
-------------------------
-- Equivalent_Key_Node --
-------------------------
@@ -870,6 +882,36 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Key_Value (Position : Cursor);
+ procedure Put_Key_Value (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Key_Type'Put_Image (S, Key (Position));
+ Put_Arrow (S);
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Key_Value;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Key_Value'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cohama.ads b/gcc/ada/libgnat/a-cohama.ads
index 9d927bd..21b6935 100644
--- a/gcc/ada/libgnat/a-cohama.ads
+++ b/gcc/ada/libgnat/a-cohama.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Hash_Tables;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
-- The language-defined generic package Containers.Hashed_Maps provides
-- private types Map and Cursor, and a set of operations for each type. A map
@@ -100,7 +101,9 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Named => Insert);
pragma Preelaborable_Initialization (Map);
@@ -115,6 +118,8 @@ is
-- Cursor objects declared without an initialization expression are
-- initialized to the value No_Element.
+ function Empty (Capacity : Count_Type := 1000) return Map;
+
function Has_Element (Position : Cursor) return Boolean;
-- Returns True if Position designates an element, and returns False
-- otherwise.
@@ -423,7 +428,10 @@ private
type Map is new Ada.Finalization.Controlled with record
HT : HT_Types.Hash_Table_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map);
overriding procedure Adjust (Container : in out Map);
diff --git a/gcc/ada/libgnat/a-cohase.adb b/gcc/ada/libgnat/a-cohase.adb
index bc4e53f..63e44e1 100644
--- a/gcc/ada/libgnat/a-cohase.adb
+++ b/gcc/ada/libgnat/a-cohase.adb
@@ -40,6 +40,7 @@ with Ada.Containers.Helpers; use Ada.Containers.Helpers;
with Ada.Containers.Prime_Numbers;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Hashed_Sets with
SPARK_Mode => Off
@@ -467,6 +468,17 @@ is
return Position.Node.Element;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 1000) return Set is
+ begin
+ return Result : Set do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
---------------------
-- Equivalent_Sets --
---------------------
@@ -1149,6 +1161,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-cohase.ads b/gcc/ada/libgnat/a-cohase.ads
index 3645ed0..a0aca52 100644
--- a/gcc/ada/libgnat/a-cohase.ads
+++ b/gcc/ada/libgnat/a-cohase.ads
@@ -37,6 +37,7 @@ private with Ada.Containers.Hash_Tables;
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -59,7 +60,9 @@ is
with
Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
@@ -80,6 +83,8 @@ is
package Set_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
+ function Empty (Capacity : Count_Type := 1000) return Set;
+
function "=" (Left, Right : Set) return Boolean;
-- For each element in Left, set equality attempts to find the equal
-- element in Right; if a search fails, then set equality immediately
@@ -502,7 +507,10 @@ private
type Set is new Ada.Finalization.Controlled with record
HT : HT_Types.Hash_Table_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
diff --git a/gcc/ada/libgnat/a-cohata.ads b/gcc/ada/libgnat/a-cohata.ads
index 9033c52..2b98928 100644
--- a/gcc/ada/libgnat/a-cohata.ads
+++ b/gcc/ada/libgnat/a-cohata.ads
@@ -72,7 +72,7 @@ package Ada.Containers.Hash_Tables is
Length : Count_Type := 0;
TC : aliased Helpers.Tamper_Counts;
Free : Count_Type'Base := -1;
- Nodes : Nodes_Type (1 .. Capacity) := (others => <>);
+ Nodes : Nodes_Type (1 .. Capacity);
Buckets : Buckets_Type (1 .. Modulus) := (others => 0);
end record;
diff --git a/gcc/ada/libgnat/a-coinho.adb b/gcc/ada/libgnat/a-coinho.adb
index c5da943..6c99c8d 100644
--- a/gcc/ada/libgnat/a-coinho.adb
+++ b/gcc/ada/libgnat/a-coinho.adb
@@ -26,6 +26,7 @@
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Holders is
@@ -229,6 +230,22 @@ package body Ada.Containers.Indefinite_Holders is
B := B - 1;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder)
+ is
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+ if not Is_Empty (V) then
+ Element_Type'Put_Image (S, Element (V));
+ end if;
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-coinho.ads b/gcc/ada/libgnat/a-coinho.ads
index bf6165e..372f069 100644
--- a/gcc/ada/libgnat/a-coinho.ads
+++ b/gcc/ada/libgnat/a-coinho.ads
@@ -31,6 +31,7 @@
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -115,7 +116,11 @@ private
type Holder is new Ada.Finalization.Controlled with record
Element : Element_Access;
Busy : Natural := 0;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder);
+
for Holder'Read use Read;
for Holder'Write use Write;
diff --git a/gcc/ada/libgnat/a-coinho__shared.adb b/gcc/ada/libgnat/a-coinho__shared.adb
index 43f5d52..16bb708 100644
--- a/gcc/ada/libgnat/a-coinho__shared.adb
+++ b/gcc/ada/libgnat/a-coinho__shared.adb
@@ -33,6 +33,7 @@
-- internal shared object and element).
with Ada.Unchecked_Deallocation;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Holders is
@@ -319,6 +320,22 @@ package body Ada.Containers.Indefinite_Holders is
B := B - 1;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder)
+ is
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+ if not Is_Empty (V) then
+ Element_Type'Put_Image (S, Element (V));
+ end if;
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-coinho__shared.ads b/gcc/ada/libgnat/a-coinho__shared.ads
index 0345b5e..e7bea85 100644
--- a/gcc/ada/libgnat/a-coinho__shared.ads
+++ b/gcc/ada/libgnat/a-coinho__shared.ads
@@ -36,6 +36,7 @@ private with Ada.Finalization;
private with Ada.Streams;
private with System.Atomic_Counters;
+private with Ada.Strings.Text_Output;
generic
type Element_Type (<>) is private;
@@ -130,7 +131,11 @@ private
type Holder is new Ada.Finalization.Controlled with record
Reference : Shared_Holder_Access;
Busy : Natural := 0;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Holder);
+
for Holder'Read use Read;
for Holder'Write use Write;
diff --git a/gcc/ada/libgnat/a-coinve.adb b/gcc/ada/libgnat/a-coinve.adb
index 79e36ae..10711ff 100644
--- a/gcc/ada/libgnat/a-coinve.adb
+++ b/gcc/ada/libgnat/a-coinve.adb
@@ -31,6 +31,7 @@ with Ada.Containers.Generic_Array_Sort;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Indefinite_Vectors with
SPARK_Mode => Off
@@ -228,6 +229,17 @@ is
end if;
end Append;
+ ----------------
+ -- Append_One --
+ ----------------
+
+ procedure Append_One (Container : in out Vector;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, Last_Index (Container) + 1, New_Item, 1);
+ end Append_One;
+
----------------------
-- Append_Slow_Path --
----------------------
@@ -733,6 +745,17 @@ is
end;
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Vector is
+ begin
+ return Result : Vector do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
@@ -872,6 +895,16 @@ is
end First_Element;
-----------------
+ -- New_Vector --
+ -----------------
+
+ function New_Vector (First, Last : Index_Type) return Vector
+ is
+ begin
+ return (To_Vector (Count_Type (Last - First + 1)));
+ end New_Vector;
+
+ -----------------
-- First_Index --
-----------------
@@ -2628,6 +2661,34 @@ is
end if;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Vector)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Elem (Position : Cursor);
+ procedure Put_Elem (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Elem;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Elem'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-coinve.ads b/gcc/ada/libgnat/a-coinve.ads
index 075a184..593b63e 100644
--- a/gcc/ada/libgnat/a-coinve.ads
+++ b/gcc/ada/libgnat/a-coinve.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Index_Type is range <>;
@@ -61,7 +62,11 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty_Vector,
+ Add_Unnamed => Append_One,
+ New_Indexed => New_Vector,
+ Assign_Indexed => Replace_Element);
pragma Preelaborable_Initialization (Vector);
@@ -72,6 +77,8 @@ is
No_Element : constant Cursor;
+ function Empty (Capacity : Count_Type := 10) return Vector;
+
function Has_Element (Position : Cursor) return Boolean;
package Vector_Iterator_Interfaces is new
@@ -79,6 +86,9 @@ is
overriding function "=" (Left, Right : Vector) return Boolean;
+ function New_Vector (First, Last : Index_Type) return Vector
+ with Pre => First = Index_Type'First;
+
function To_Vector (Length : Count_Type) return Vector;
function To_Vector
@@ -238,6 +248,9 @@ is
New_Item : Element_Type;
Count : Count_Type := 1);
+ procedure Append_One (Container : in out Vector;
+ New_Item : Element_Type);
+
procedure Insert_Space
(Container : in out Vector;
Before : Extended_Index;
@@ -383,7 +396,10 @@ private
Elements : Elements_Access := null;
Last : Extended_Index := No_Index;
TC : aliased Tamper_Counts;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Vector);
overriding procedure Adjust (Container : in out Vector);
overriding procedure Finalize (Container : in out Vector);
diff --git a/gcc/ada/libgnat/a-comutr.adb b/gcc/ada/libgnat/a-comutr.adb
index 76ff751..78f93f0 100644
--- a/gcc/ada/libgnat/a-comutr.adb
+++ b/gcc/ada/libgnat/a-comutr.adb
@@ -31,6 +31,7 @@ with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Multiway_Trees with
SPARK_Mode => Off
@@ -1858,6 +1859,49 @@ is
Process (Position.Node.Element);
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Tree)
+ is
+ use System.Put_Images;
+
+ procedure Rec (Position : Cursor);
+ -- Recursive routine operating on cursors
+
+ procedure Rec (Position : Cursor) is
+ First_Time : Boolean := True;
+ begin
+ Array_Before (S);
+
+ for X in Iterate_Children (V, Position) loop
+ if First_Time then
+ First_Time := False;
+ else
+ Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, Element (X));
+ if Child_Count (X) > 0 then
+ Simple_Array_Between (S);
+ Rec (X);
+ end if;
+ end loop;
+
+ Array_After (S);
+ end Rec;
+
+ begin
+ if First_Child (Root (V)) = No_Element then
+ Array_Before (S);
+ Array_After (S);
+ else
+ Rec (First_Child (Root (V)));
+ end if;
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-comutr.ads b/gcc/ada/libgnat/a-comutr.ads
index 46934a1..a1f51af 100644
--- a/gcc/ada/libgnat/a-comutr.ads
+++ b/gcc/ada/libgnat/a-comutr.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
with Ada.Containers.Helpers;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -400,7 +401,10 @@ private
Root : aliased Root_Node_Type;
TC : aliased Tamper_Counts;
Count : Count_Type := 0;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Tree);
overriding procedure Adjust (Container : in out Tree);
diff --git a/gcc/ada/libgnat/a-convec.adb b/gcc/ada/libgnat/a-convec.adb
index c2a0a83..a43be97 100644
--- a/gcc/ada/libgnat/a-convec.adb
+++ b/gcc/ada/libgnat/a-convec.adb
@@ -210,6 +210,17 @@ is
end if;
end Append;
+ ----------------
+ -- Append_One --
+ ----------------
+
+ procedure Append_One (Container : in out Vector;
+ New_Item : Element_Type)
+ is
+ begin
+ Insert (Container, Last_Index (Container) + 1, New_Item, 1);
+ end Append_One;
+
----------------------
-- Append_Slow_Path --
----------------------
@@ -603,6 +614,17 @@ is
return Position.Container.Elements.EA (Position.Index);
end Element;
+ -----------
+ -- Empty --
+ -----------
+
+ function Empty (Capacity : Count_Type := 10) return Vector is
+ begin
+ return Result : Vector do
+ Reserve_Capacity (Result, Capacity);
+ end return;
+ end Empty;
+
--------------
-- Finalize --
--------------
@@ -742,6 +764,16 @@ is
return Index_Type'First;
end First_Index;
+ -----------------
+ -- New_Vector --
+ -----------------
+
+ function New_Vector (First, Last : Index_Type) return Vector
+ is
+ begin
+ return (To_Vector (Count_Type (Last - First + 1)));
+ end New_Vector;
+
---------------------
-- Generic_Sorting --
---------------------
diff --git a/gcc/ada/libgnat/a-convec.ads b/gcc/ada/libgnat/a-convec.ads
index a12e456..f969e6f 100644
--- a/gcc/ada/libgnat/a-convec.ads
+++ b/gcc/ada/libgnat/a-convec.ads
@@ -93,7 +93,12 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Unnamed => Append_One,
+ New_Indexed => New_Vector,
+ Assign_Indexed => Replace_Element);
+
pragma Preelaborable_Initialization (Vector);
-- Vector type, to be instantiated by users of this package. If an object
-- of type Vector is not otherwise initialized, it is initialized to
@@ -117,6 +122,8 @@ is
Empty_Vector : constant Vector;
-- Empty_Vector represents the empty vector object. It has a length of 0.
+ function Empty (Capacity : Count_Type := 10) return Vector;
+
overriding function "=" (Left, Right : Vector) return Boolean;
-- If Left and Right denote the same vector object, then the function
-- returns True. If Left and Right have different lengths, then the
@@ -323,6 +330,10 @@ is
-- Source is removed from Source and inserted into Target in the original
-- order. The length of Source is 0 after a successful call to Move.
+ function New_Vector (First, Last : Index_Type) return Vector
+ with Pre => First = Index_Type'First;
+ -- Ada_2020 aggregate operation.
+
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
@@ -438,6 +449,10 @@ is
-- Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item,
-- Count).
+ procedure Append_One (Container : in out Vector;
+ New_Item : Element_Type);
+ -- Ada_2020 aggregate operation.
+
procedure Insert_Space
(Container : in out Vector;
Before : Extended_Index;
diff --git a/gcc/ada/libgnat/a-coorma.adb b/gcc/ada/libgnat/a-coorma.adb
index 4106d58..15d08f5 100644
--- a/gcc/ada/libgnat/a-coorma.adb
+++ b/gcc/ada/libgnat/a-coorma.adb
@@ -38,6 +38,7 @@ with Ada.Containers.Red_Black_Trees.Generic_Keys;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Keys);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Ordered_Maps with
SPARK_Mode => Off
@@ -1214,6 +1215,36 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+
+ procedure Put_Key_Value (Position : Cursor);
+ procedure Put_Key_Value (Position : Cursor) is
+ begin
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Key_Type'Put_Image (S, Key (Position));
+ Put_Arrow (S);
+ Element_Type'Put_Image (S, Element (Position));
+ end Put_Key_Value;
+
+ begin
+ Array_Before (S);
+ Iterate (V, Put_Key_Value'Access);
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-coorma.ads b/gcc/ada/libgnat/a-coorma.ads
index e2d5e1e..7f65a7f 100644
--- a/gcc/ada/libgnat/a-coorma.ads
+++ b/gcc/ada/libgnat/a-coorma.ads
@@ -36,6 +36,7 @@ with Ada.Iterator_Interfaces;
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Key_Type is private;
@@ -57,12 +58,15 @@ is
Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
- Iterator_Element => Element_Type;
+ Iterator_Element => Element_Type,
+ Aggregate => (Empty => Empty,
+ Add_Named => Insert);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
+ function Empty return Map;
No_Element : constant Cursor;
@@ -257,7 +261,10 @@ private
type Map is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Map);
overriding procedure Adjust (Container : in out Map);
@@ -367,6 +374,7 @@ private
-- Returns a pointer to the element designated by Position.
Empty_Map : constant Map := (Controlled with others => <>);
+ function Empty return Map is (Empty_Map);
No_Element : constant Cursor := Cursor'(null, null);
diff --git a/gcc/ada/libgnat/a-coormu.adb b/gcc/ada/libgnat/a-coormu.adb
index c02a9f1..c7db472 100644
--- a/gcc/ada/libgnat/a-coormu.adb
+++ b/gcc/ada/libgnat/a-coormu.adb
@@ -39,6 +39,7 @@ with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Ordered_Multisets with
SPARK_Mode => Off
@@ -1565,6 +1566,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-coormu.ads b/gcc/ada/libgnat/a-coormu.ads
index 9c6c3ae..95aec73 100644
--- a/gcc/ada/libgnat/a-coormu.ads
+++ b/gcc/ada/libgnat/a-coormu.ads
@@ -34,6 +34,7 @@
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
with Ada.Iterator_Interfaces;
generic
@@ -472,7 +473,10 @@ private
type Set is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
diff --git a/gcc/ada/libgnat/a-coorse.adb b/gcc/ada/libgnat/a-coorse.adb
index 15b59dd..8a648e8 100644
--- a/gcc/ada/libgnat/a-coorse.adb
+++ b/gcc/ada/libgnat/a-coorse.adb
@@ -41,6 +41,7 @@ with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
pragma Elaborate_All (Ada.Containers.Red_Black_Trees.Generic_Set_Operations);
with System; use type System.Address;
+with System.Put_Images;
package body Ada.Containers.Ordered_Sets with
SPARK_Mode => Off
@@ -1580,6 +1581,31 @@ is
end;
end Query_Element;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set)
+ is
+ First_Time : Boolean := True;
+ use System.Put_Images;
+ begin
+ Array_Before (S);
+
+ for X of V loop
+ if First_Time then
+ First_Time := False;
+ else
+ Simple_Array_Between (S);
+ end if;
+
+ Element_Type'Put_Image (S, X);
+ end loop;
+
+ Array_After (S);
+ end Put_Image;
+
----------
-- Read --
----------
diff --git a/gcc/ada/libgnat/a-coorse.ads b/gcc/ada/libgnat/a-coorse.ads
index 42e5b49..1ccf290 100644
--- a/gcc/ada/libgnat/a-coorse.ads
+++ b/gcc/ada/libgnat/a-coorse.ads
@@ -37,6 +37,7 @@ with Ada.Containers.Helpers;
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
private with Ada.Streams;
+private with Ada.Strings.Text_Output;
generic
type Element_Type is private;
@@ -57,6 +58,8 @@ is
with Constant_Indexing => Constant_Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
+ -- Aggregate => (Empty => Empty,
+ -- Add_Unnamed => Include);
pragma Preelaborable_Initialization (Set);
@@ -66,6 +69,7 @@ is
function Has_Element (Position : Cursor) return Boolean;
Empty_Set : constant Set;
+ function Empty return Set;
No_Element : constant Cursor;
@@ -340,7 +344,10 @@ private
type Set is new Ada.Finalization.Controlled with record
Tree : Tree_Types.Tree_Type;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Set);
overriding procedure Adjust (Container : in out Set);
@@ -428,6 +435,7 @@ private
-- Returns a pointer to the element designated by Position.
Empty_Set : constant Set := (Controlled with others => <>);
+ function Empty return Set is (Empty_Set);
No_Element : constant Cursor := Cursor'(null, null);
diff --git a/gcc/ada/libgnat/a-crbltr.ads b/gcc/ada/libgnat/a-crbltr.ads
index 0ae2abd..4f00bd6 100644
--- a/gcc/ada/libgnat/a-crbltr.ads
+++ b/gcc/ada/libgnat/a-crbltr.ads
@@ -60,9 +60,7 @@ package Ada.Containers.Red_Black_Trees is
-- Note that objects of type Tree_Type are logically initialized (in the
-- sense that representation invariants of type are satisfied by dint of
-- default initialization), even without the Nodes component also having
- -- its own initialization expression. We only initializae the Nodes
- -- component here in order to prevent spurious compiler warnings about
- -- the container object not being fully initialized.
+ -- its own initialization expression.
type Tree_Type (Capacity : Count_Type) is tagged record
First : Count_Type := 0;
@@ -71,7 +69,7 @@ package Ada.Containers.Red_Black_Trees is
Length : Count_Type := 0;
TC : aliased Helpers.Tamper_Counts;
Free : Count_Type'Base := -1;
- Nodes : Nodes_Type (1 .. Capacity) := (others => <>);
+ Nodes : Nodes_Type (1 .. Capacity);
end record;
package Implementation is new Helpers.Generic_Implementation;
diff --git a/gcc/ada/libgnat/a-crdlli.ads b/gcc/ada/libgnat/a-crdlli.ads
index 7f27497..b30d353 100644
--- a/gcc/ada/libgnat/a-crdlli.ads
+++ b/gcc/ada/libgnat/a-crdlli.ads
@@ -314,7 +314,7 @@ private
type Node_Array is array (Count_Type range <>) of Node_Type;
type List (Capacity : Count_Type) is tagged limited record
- Nodes : Node_Array (1 .. Capacity) := (others => <>);
+ Nodes : Node_Array (1 .. Capacity);
Free : Count_Type'Base := -1;
First : Count_Type := 0;
Last : Count_Type := 0;
diff --git a/gcc/ada/libgnat/a-direct.adb b/gcc/ada/libgnat/a-direct.adb
index b70bf0e..162ace9 100644
--- a/gcc/ada/libgnat/a-direct.adb
+++ b/gcc/ada/libgnat/a-direct.adb
@@ -30,7 +30,6 @@
------------------------------------------------------------------------------
with Ada.Calendar; use Ada.Calendar;
-with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Directories.Validity; use Ada.Directories.Validity;
with Ada.Directories.Hierarchical_File_Names;
@@ -70,6 +69,15 @@ package body Ada.Directories is
pragma Import (C, Max_Path, "__gnat_max_path_len");
-- The maximum length of a path
+ function C_Modification_Time (N : System.Address) return Ada.Calendar.Time;
+ pragma Import (C, C_Modification_Time, "__gnat_file_time");
+ -- Get modification time for file with name referenced by N
+
+ Invalid_Time : constant Ada.Calendar.Time :=
+ C_Modification_Time (System.Null_Address);
+ -- Result returned from C_Modification_Time call when routine unable to get
+ -- file modification time.
+
type Search_Data is record
Is_Valid : Boolean := False;
Name : Unbounded_String;
@@ -991,14 +999,9 @@ package body Ada.Directories is
-----------------------
function Modification_Time (Name : String) return Time is
- Date : OS_Time;
- Year : Year_Type;
- Month : Month_Type;
- Day : Day_Type;
- Hour : Hour_Type;
- Minute : Minute_Type;
- Second : Second_Type;
+ Date : Time;
+ C_Name : aliased String (1 .. Name'Length + 1);
begin
-- First, the invalid cases
@@ -1006,19 +1009,15 @@ package body Ada.Directories is
raise Name_Error with '"' & Name & """ not a file or directory";
else
- Date := File_Time_Stamp (Name);
-
- -- Break down the time stamp into its constituents relative to GMT.
- -- This version of Split does not recognize leap seconds or buffer
- -- space for time zone processing.
+ C_Name := Name & ASCII.NUL;
+ Date := C_Modification_Time (C_Name'Address);
- GM_Split (Date, Year, Month, Day, Hour, Minute, Second);
-
- -- The result must be in GMT. Ada.Calendar.
- -- Formatting.Time_Of with default time zone of zero (0) is the
- -- routine of choice.
+ if Date = Invalid_Time then
+ raise Use_Error with
+ "Unable to get modification time of the file """ & Name & '"';
+ end if;
- return Time_Of (Year, Month, Day, Hour, Minute, Second, 0.0);
+ return Date;
end if;
end Modification_Time;
diff --git a/gcc/ada/libgnat/a-except.adb b/gcc/ada/libgnat/a-except.adb
index 17f3db6..52e716f 100644
--- a/gcc/ada/libgnat/a-except.adb
+++ b/gcc/ada/libgnat/a-except.adb
@@ -32,10 +32,6 @@
pragma Style_Checks (All_Checks);
-- No subprogram ordering check, due to logical grouping
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with System.Exception_Tables.
-
with System; use System;
with System.Exceptions; use System.Exceptions;
with System.Exceptions_Debug; use System.Exceptions_Debug;
@@ -668,21 +664,6 @@ package body Ada.Exceptions is
Rmsg_36 : constant String := "stream operation not allowed" & NUL;
Rmsg_37 : constant String := "build-in-place mismatch" & NUL;
- -----------------------
- -- Polling Interface --
- -----------------------
-
- type Unsigned is mod 2 ** 32;
-
- Counter : Unsigned := 0;
- pragma Warnings (Off, Counter);
- -- This counter is provided for convenience. It can be used in Poll to
- -- perform periodic but not systematic operations.
-
- procedure Poll is separate;
- -- The actual polling routine is separate, so that it can easily be
- -- replaced with a target dependent version.
-
--------------------------
-- Code_Address_For_AAA --
--------------------------
diff --git a/gcc/ada/libgnat/a-except.ads b/gcc/ada/libgnat/a-except.ads
index 85bb5bd..4d36a84 100644
--- a/gcc/ada/libgnat/a-except.ads
+++ b/gcc/ada/libgnat/a-except.ads
@@ -36,10 +36,6 @@
-- This is the default version of this package. We also have cert and zfp
-- versions.
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with ourself.
-
with System;
with System.Parameters;
with System.Standard_Library;
@@ -240,31 +236,6 @@ private
-- Determine whether the current exception (if it exists) is an instance of
-- Standard'Abort_Signal.
- -----------------------
- -- Polling Interface --
- -----------------------
-
- -- The GNAT compiler has an option to generate polling calls to the Poll
- -- routine in this package. Specifying the -gnatP option for a compilation
- -- causes a call to Ada.Exceptions.Poll to be generated on every subprogram
- -- entry and on every iteration of a loop, thus avoiding the possibility of
- -- a case of unbounded time between calls.
-
- -- This polling interface may be used for instrumentation or debugging
- -- purposes (e.g. implementing watchpoints in software or in the debugger).
-
- -- In the GNAT technology itself, this interface is used to implement
- -- immediate asynchronous transfer of control and immediate abort on
- -- targets which do not provide for one thread interrupting another.
-
- -- Note: this used to be in a separate unit called System.Poll, but that
- -- caused horrible circular elaboration problems between System.Poll and
- -- Ada.Exceptions.
-
- procedure Poll;
- -- Check for asynchronous abort. Note that we do not inline the body.
- -- This makes the interface more useful for debugging purposes.
-
--------------------------
-- Exception_Occurrence --
--------------------------
@@ -330,6 +301,8 @@ private
pragma Stream_Convert (Exception_Occurrence, String_To_EO, EO_To_String);
-- Functions for implementing Exception_Occurrence stream attributes
+ pragma Warnings (Off, "aggregate not fully initialized");
Null_Occurrence : constant Exception_Occurrence := (others => <>);
+ pragma Warnings (On, "aggregate not fully initialized");
end Ada.Exceptions;
diff --git a/gcc/ada/libgnat/a-llltio.ads b/gcc/ada/libgnat/a-llltio.ads
new file mode 100644
index 0000000..f107d43
--- /dev/null
+++ b/gcc/ada/libgnat/a-llltio.ads
@@ -0,0 +1,19 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . L O N G _ L O N G _ L O N G _ I N T E G E R _ T E X T _ I O --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification, provided that if you redistribute a --
+-- modified version, any changes that you have made are clearly indicated. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Text_IO;
+
+package Ada.Long_Long_Long_Integer_Text_IO is
+ new Ada.Text_IO.Integer_IO (Long_Long_Long_Integer);
diff --git a/gcc/ada/libgnat/a-lllwti.ads b/gcc/ada/libgnat/a-lllwti.ads
new file mode 100644
index 0000000..942fac0
--- /dev/null
+++ b/gcc/ada/libgnat/a-lllwti.ads
@@ -0,0 +1,19 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . L O N G _ L O N G _ I N T E G E R _ W I D E _ T E X T _ I O --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification, provided that if you redistribute a --
+-- modified version, any changes that you have made are clearly indicated. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Text_IO;
+
+package Ada.Long_Long_Long_Integer_Wide_Text_IO is
+ new Ada.Wide_Text_IO.Integer_IO (Long_Long_Long_Integer);
diff --git a/gcc/ada/libgnat/a-lllzti.ads b/gcc/ada/libgnat/a-lllzti.ads
new file mode 100644
index 0000000..40be965
--- /dev/null
+++ b/gcc/ada/libgnat/a-lllzti.ads
@@ -0,0 +1,19 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . L O N G _ L O N G _ I N T E G E R _ W I D E _ T E X T _ I O --
+-- --
+-- S p e c --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. In accordance with the copyright of that document, you can freely --
+-- copy and modify this specification, provided that if you redistribute a --
+-- modified version, any changes that you have made are clearly indicated. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Wide_Text_IO;
+
+package Ada.Long_Long_Long_Integer_Wide_Wide_Text_IO is
+ new Ada.Wide_Wide_Text_IO.Integer_IO (Long_Long_Long_Integer);
diff --git a/gcc/ada/libgnat/a-nagefl.ads b/gcc/ada/libgnat/a-nagefl.ads
new file mode 100644
index 0000000..9260391
--- /dev/null
+++ b/gcc/ada/libgnat/a-nagefl.ads
@@ -0,0 +1,171 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X _ G E N E R I C _ F L O A T --
+-- --
+-- S p e c --
+-- (Generic Wrapper) --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides the basic computational interface for the generic
+-- elementary functions. The C library version interfaces with the routines
+-- in the C mathematical library.
+
+-- This version here is for use with normal Unix math functions.
+
+with Ada.Numerics.Aux_Long_Long_Float;
+with Ada.Numerics.Aux_Long_Float;
+with Ada.Numerics.Aux_Float;
+with Ada.Numerics.Aux_Short_Float;
+
+generic
+ type T is digits <>;
+package Ada.Numerics.Aux_Generic_Float is
+ pragma Pure;
+
+ package LLF renames Aux_Long_Long_Float;
+ package LF renames Aux_Long_Float;
+ package F renames Aux_Float;
+ package SF renames Aux_Short_Float;
+
+ function Sin (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Sin (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Sin (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Sin (F.T (X)))
+ else T'Base (SF.Sin (SF.T (X))));
+
+ function Cos (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Cos (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Cos (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Cos (F.T (X)))
+ else T'Base (SF.Cos (SF.T (X))));
+
+ function Tan (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Tan (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Tan (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Tan (F.T (X)))
+ else T'Base (SF.Tan (SF.T (X))));
+
+ function Exp (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Exp (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Exp (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Exp (F.T (X)))
+ else T'Base (SF.Exp (SF.T (X))));
+
+ function Sqrt (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Sqrt (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Sqrt (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Sqrt (F.T (X)))
+ else T'Base (SF.Sqrt (SF.T (X))));
+
+ function Log (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Log (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Log (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Log (F.T (X)))
+ else T'Base (SF.Log (SF.T (X))));
+
+ function Acos (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Acos (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Acos (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Acos (F.T (X)))
+ else T'Base (SF.Acos (SF.T (X))));
+
+ function Asin (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Asin (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Asin (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Asin (F.T (X)))
+ else T'Base (SF.Asin (SF.T (X))));
+
+ function Atan (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Atan (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Atan (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Atan (F.T (X)))
+ else T'Base (SF.Atan (SF.T (X))));
+
+ function Sinh (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Sinh (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Sinh (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Sinh (F.T (X)))
+ else T'Base (SF.Sinh (SF.T (X))));
+
+ function Cosh (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Cosh (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Cosh (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Cosh (F.T (X)))
+ else T'Base (SF.Cosh (SF.T (X))));
+
+ function Tanh (X : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Tanh (LLF.T (X)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Tanh (LF.T (X)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Tanh (F.T (X)))
+ else T'Base (SF.Tanh (SF.T (X))));
+
+ function Pow (X, Y : T'Base) return T'Base
+ is (if T'Base'Digits > LF.T'Digits
+ then T'Base (LLF.Pow (LLF.T (X), LLF.T (Y)))
+ elsif T'Base'Digits > F.T'Digits
+ then T'Base (LF.Pow (LF.T (X), LF.T (Y)))
+ elsif T'Base'Digits > SF.T'Digits
+ then T'Base (F.Pow (F.T (X), F.T (Y)))
+ else T'Base (SF.Pow (SF.T (X), SF.T (Y))));
+
+end Ada.Numerics.Aux_Generic_Float;
diff --git a/gcc/ada/libgnat/a-naliop.ads b/gcc/ada/libgnat/a-naliop.ads
new file mode 100644
index 0000000..81de811
--- /dev/null
+++ b/gcc/ada/libgnat/a-naliop.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X _ L I N K E R _ O P T I O N S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is used to provide target specific linker_options for
+-- the support of C Library Math functions as required by other
+-- children packages of Ada.Numerics.Aux.
+
+-- This is a version for default use that links with -lm. An
+-- alternate __nolibm version is to be used where no additional
+-- libraries are required.
+
+-- This package should not be directly with'ed by an application program
+
+package Ada.Numerics.Aux_Linker_Options is
+ pragma Pure;
+ pragma Linker_Options ("-lm");
+end Ada.Numerics.Aux_Linker_Options;
diff --git a/gcc/ada/libgnat/a-naliop__nolibm.ads b/gcc/ada/libgnat/a-naliop__nolibm.ads
new file mode 100644
index 0000000..dc1969a
--- /dev/null
+++ b/gcc/ada/libgnat/a-naliop__nolibm.ads
@@ -0,0 +1,43 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X _ L I N K E R _ O P T I O N S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is used to provide target specific linker_options for
+-- the support of C Library Math functions as required by other
+-- children packages of Ada.Numerics.Aux.
+
+-- This is a version to be used where no additional libraries are
+-- required.
+
+-- This package should not be directly with'ed by an application program
+
+package Ada.Numerics.Aux_Linker_Options is
+ pragma Pure;
+end Ada.Numerics.Aux_Linker_Options;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.ads b/gcc/ada/libgnat/a-nallfl.ads
index f2a4428..ca998fa 100644
--- a/gcc/ada/libgnat/a-numaux__darwin.ads
+++ b/gcc/ada/libgnat/a-nallfl.ads
@@ -2,10 +2,10 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . N U M E R I C S . A U X --
+-- A D A . N U M E R I C S . A U X . L O N G _ L O N G _ F L O A T --
-- --
-- S p e c --
--- (Apple OS X Version) --
+-- (C Math Library Version, Long Long Float) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
@@ -30,74 +30,58 @@
-- --
------------------------------------------------------------------------------
--- This version is for use on OS X. It uses the normal Unix math functions,
--- except for sine/cosine which have been implemented directly in Ada to get
--- the required accuracy.
+-- This package provides the basic computational interface for the generic
+-- elementary functions. The C library version interfaces with the routines
+-- in the C mathematical library, and is thus quite portable.
-package Ada.Numerics.Aux is
- pragma Pure;
-
- pragma Linker_Options ("-lm");
-
- type Double is new Long_Float;
- -- Type Double is the type used to call the C routines
+with Ada.Numerics.Aux_Linker_Options;
+pragma Warnings (Off, Ada.Numerics.Aux_Linker_Options);
- -- The following functions have been implemented in Ada, since
- -- the OS X math library didn't meet accuracy requirements for
- -- argument reduction. The implementation here has been tailored
- -- to match Ada strict mode Numerics requirements while maintaining
- -- maximum efficiency.
- function Sin (X : Double) return Double;
- pragma Inline (Sin);
+package Ada.Numerics.Aux_Long_Long_Float is
+ pragma Pure;
- function Cos (X : Double) return Double;
- pragma Inline (Cos);
+ subtype T is Long_Long_Float;
-- We import these functions directly from C. Note that we label them
-- all as pure functions, because indeed all of them are in fact pure.
- function Tan (X : Double) return Double;
- pragma Import (C, Tan, "tan");
- pragma Pure_Function (Tan);
+ function Sin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinl";
+
+ function Cos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cosl";
+
+ function Tan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanl";
- function Exp (X : Double) return Double;
- pragma Import (C, Exp, "exp");
- pragma Pure_Function (Exp);
+ function Exp (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "expl";
- function Sqrt (X : Double) return Double;
- pragma Import (C, Sqrt, "sqrt");
- pragma Pure_Function (Sqrt);
+ function Sqrt (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sqrtl";
- function Log (X : Double) return Double;
- pragma Import (C, Log, "log");
- pragma Pure_Function (Log);
+ function Log (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "logl";
- function Acos (X : Double) return Double;
- pragma Import (C, Acos, "acos");
- pragma Pure_Function (Acos);
+ function Acos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "acosl";
- function Asin (X : Double) return Double;
- pragma Import (C, Asin, "asin");
- pragma Pure_Function (Asin);
+ function Asin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "asinl";
- function Atan (X : Double) return Double;
- pragma Import (C, Atan, "atan");
- pragma Pure_Function (Atan);
+ function Atan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "atanl";
- function Sinh (X : Double) return Double;
- pragma Import (C, Sinh, "sinh");
- pragma Pure_Function (Sinh);
+ function Sinh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinhl";
- function Cosh (X : Double) return Double;
- pragma Import (C, Cosh, "cosh");
- pragma Pure_Function (Cosh);
+ function Cosh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "coshl";
- function Tanh (X : Double) return Double;
- pragma Import (C, Tanh, "tanh");
- pragma Pure_Function (Tanh);
+ function Tanh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanhl";
- function Pow (X, Y : Double) return Double;
- pragma Import (C, Pow, "pow");
- pragma Pure_Function (Pow);
+ function Pow (X, Y : T) return T with
+ Import, Convention => Intrinsic, External_Name => "powl";
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-wtmoau.ads b/gcc/ada/libgnat/a-nallfl__wraplf.ads
index 9fe444e..2d5c71d 100644
--- a/gcc/ada/libgnat/a-wtmoau.ads
+++ b/gcc/ada/libgnat/a-nallfl__wraplf.ads
@@ -2,9 +2,10 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . W I D E _ T E X T _ I O . M O D U L A R _ A U X --
+-- A D A . N U M E R I C S . A U X . L O N G _ L O N G _ F L O A T --
-- --
-- S p e c --
+-- (Long Long Float Wrapper in terms of Long Float) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
@@ -29,59 +30,58 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines for Ada.Wide_Text_IO.Modular_IO that
--- are shared among separate instantiations of this package. The routines
--- in this package are identical semantically to those in Modular_IO itself,
--- except that the generic parameter Num has been replaced by Unsigned or
--- Long_Long_Unsigned, and the default parameters have been removed because
--- they are supplied explicitly by the calls from within the generic template.
-
-with System.Unsigned_Types;
-
-private package Ada.Wide_Text_IO.Modular_Aux is
-
- package U renames System.Unsigned_Types;
-
- procedure Get_Uns
- (File : File_Type;
- Item : out U.Unsigned;
- Width : Field);
-
- procedure Get_LLU
- (File : File_Type;
- Item : out U.Long_Long_Unsigned;
- Width : Field);
-
- procedure Gets_Uns
- (From : String;
- Item : out U.Unsigned;
- Last : out Positive);
-
- procedure Gets_LLU
- (From : String;
- Item : out U.Long_Long_Unsigned;
- Last : out Positive);
-
- procedure Put_Uns
- (File : File_Type;
- Item : U.Unsigned;
- Width : Field;
- Base : Number_Base);
-
- procedure Put_LLU
- (File : File_Type;
- Item : U.Long_Long_Unsigned;
- Width : Field;
- Base : Number_Base);
-
- procedure Puts_Uns
- (To : out String;
- Item : U.Unsigned;
- Base : Number_Base);
-
- procedure Puts_LLU
- (To : out String;
- Item : U.Long_Long_Unsigned;
- Base : Number_Base);
-
-end Ada.Wide_Text_IO.Modular_Aux;
+-- This package provides the basic computational interface for the
+-- generic elementary functions. The functions in this unit are
+-- wrappers for those in the Long Float package.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Long_Long_Float is
+ pragma Pure;
+
+ subtype T is Long_Long_Float;
+ package Aux renames Ada.Numerics.Aux_Long_Float;
+ subtype W is Aux.T;
+
+ -- Use the Aux implementation.
+
+ function Sin (X : T) return T
+ is (T (Aux.Sin (W (X))));
+
+ function Cos (X : T) return T
+ is (T (Aux.Cos (W (X))));
+
+ function Tan (X : T) return T
+ is (T (Aux.Tan (W (X))));
+
+ function Exp (X : T) return T
+ is (T (Aux.Exp (W (X))));
+
+ function Sqrt (X : T) return T
+ is (T (Aux.Sqrt (W (X))));
+
+ function Log (X : T) return T
+ is (T (Aux.Log (W (X))));
+
+ function Acos (X : T) return T
+ is (T (Aux.Acos (W (X))));
+
+ function Asin (X : T) return T
+ is (T (Aux.Asin (W (X))));
+
+ function Atan (X : T) return T
+ is (T (Aux.Atan (W (X))));
+
+ function Sinh (X : T) return T
+ is (T (Aux.Sinh (W (X))));
+
+ function Cosh (X : T) return T
+ is (T (Aux.Cosh (W (X))));
+
+ function Tanh (X : T) return T
+ is (T (Aux.Tanh (W (X))));
+
+ function Pow (X, Y : T) return T
+ is (T (Aux.Pow (W (X), W (Y))));
+
+end Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-numaux__vxworks.ads b/gcc/ada/libgnat/a-nalofl.ads
index c291334..4cdf2f4 100644
--- a/gcc/ada/libgnat/a-numaux__vxworks.ads
+++ b/gcc/ada/libgnat/a-nalofl.ads
@@ -2,10 +2,10 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . N U M E R I C S . A U X --
+-- A D A . N U M E R I C S . A U X _ L O N G _ F L O A T --
-- --
-- S p e c --
--- (C Library Version, VxWorks) --
+-- (C Math Library Version, Long Float) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
@@ -30,68 +30,58 @@
-- --
------------------------------------------------------------------------------
--- Version for use on VxWorks (where we have no libm.a library), so the pragma
--- Linker_Options ("-lm") is omitted in this version.
+-- This package provides the basic computational interface for the generic
+-- elementary functions. The C library version interfaces with the routines
+-- in the C mathematical library, and is thus quite portable.
-package Ada.Numerics.Aux is
+with Ada.Numerics.Aux_Linker_Options;
+pragma Warnings (Off, Ada.Numerics.Aux_Linker_Options);
+
+package Ada.Numerics.Aux_Long_Float is
pragma Pure;
- type Double is new Long_Float;
- -- Type Double is the type used to call the C routines
+ subtype T is Long_Float;
-- We import these functions directly from C. Note that we label them
-- all as pure functions, because indeed all of them are in fact pure.
- function Sin (X : Double) return Double;
- pragma Import (C, Sin, "sin");
- pragma Pure_Function (Sin);
+ function Sin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sin";
- function Cos (X : Double) return Double;
- pragma Import (C, Cos, "cos");
- pragma Pure_Function (Cos);
+ function Cos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cos";
- function Tan (X : Double) return Double;
- pragma Import (C, Tan, "tan");
- pragma Pure_Function (Tan);
+ function Tan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tan";
- function Exp (X : Double) return Double;
- pragma Import (C, Exp, "exp");
- pragma Pure_Function (Exp);
+ function Exp (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "exp";
- function Sqrt (X : Double) return Double;
- pragma Import (C, Sqrt, "sqrt");
- pragma Pure_Function (Sqrt);
+ function Sqrt (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sqrt";
- function Log (X : Double) return Double;
- pragma Import (C, Log, "log");
- pragma Pure_Function (Log);
+ function Log (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "log";
- function Acos (X : Double) return Double;
- pragma Import (C, Acos, "acos");
- pragma Pure_Function (Acos);
+ function Acos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "acos";
- function Asin (X : Double) return Double;
- pragma Import (C, Asin, "asin");
- pragma Pure_Function (Asin);
+ function Asin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "asin";
- function Atan (X : Double) return Double;
- pragma Import (C, Atan, "atan");
- pragma Pure_Function (Atan);
+ function Atan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "atan";
- function Sinh (X : Double) return Double;
- pragma Import (C, Sinh, "sinh");
- pragma Pure_Function (Sinh);
+ function Sinh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinh";
- function Cosh (X : Double) return Double;
- pragma Import (C, Cosh, "cosh");
- pragma Pure_Function (Cosh);
+ function Cosh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cosh";
- function Tanh (X : Double) return Double;
- pragma Import (C, Tanh, "tanh");
- pragma Pure_Function (Tanh);
+ function Tanh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanh";
- function Pow (X, Y : Double) return Double;
- pragma Import (C, Pow, "pow");
- pragma Pure_Function (Pow);
+ function Pow (X, Y : T) return T with
+ Import, Convention => Intrinsic, External_Name => "pow";
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-ztmoau.ads b/gcc/ada/libgnat/a-nashfl.ads
index 9d53154..eaee862 100644
--- a/gcc/ada/libgnat/a-ztmoau.ads
+++ b/gcc/ada/libgnat/a-nashfl.ads
@@ -2,9 +2,10 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . W I D E _ W I D E _ T E X T _ I O . M O D U L A R _ A U X --
+-- A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T --
-- --
-- S p e c --
+-- (Short Float Wrapper in terms of Float) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
@@ -29,60 +30,58 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines for Ada.Wide_Wide_Text_IO.Modular_IO
--- that are shared among separate instantiations of this package. The
--- routines in this package are identical semantically to those in Modular_IO
--- itself, except that the generic parameter Num has been replaced by
--- Unsigned or Long_Long_Unsigned, and the default parameters have been
--- removed because they are supplied explicitly by the calls from within the
--- generic template.
-
-with System.Unsigned_Types;
-
-private package Ada.Wide_Wide_Text_IO.Modular_Aux is
-
- package U renames System.Unsigned_Types;
-
- procedure Get_Uns
- (File : File_Type;
- Item : out U.Unsigned;
- Width : Field);
-
- procedure Get_LLU
- (File : File_Type;
- Item : out U.Long_Long_Unsigned;
- Width : Field);
-
- procedure Gets_Uns
- (From : String;
- Item : out U.Unsigned;
- Last : out Positive);
-
- procedure Gets_LLU
- (From : String;
- Item : out U.Long_Long_Unsigned;
- Last : out Positive);
-
- procedure Put_Uns
- (File : File_Type;
- Item : U.Unsigned;
- Width : Field;
- Base : Number_Base);
-
- procedure Put_LLU
- (File : File_Type;
- Item : U.Long_Long_Unsigned;
- Width : Field;
- Base : Number_Base);
-
- procedure Puts_Uns
- (To : out String;
- Item : U.Unsigned;
- Base : Number_Base);
-
- procedure Puts_LLU
- (To : out String;
- Item : U.Long_Long_Unsigned;
- Base : Number_Base);
-
-end Ada.Wide_Wide_Text_IO.Modular_Aux;
+-- This package provides the basic computational interface for the
+-- generic elementary functions. The functions in this unit are
+-- wrappers for those in the Float package.
+
+with Ada.Numerics.Aux_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+ pragma Pure;
+
+ subtype T is Short_Float;
+ package Aux renames Ada.Numerics.Aux_Float;
+ subtype W is Aux.T;
+
+ -- Use the Aux implementation.
+
+ function Sin (X : T) return T
+ is (T (Aux.Sin (W (X))));
+
+ function Cos (X : T) return T
+ is (T (Aux.Cos (W (X))));
+
+ function Tan (X : T) return T
+ is (T (Aux.Tan (W (X))));
+
+ function Exp (X : T) return T
+ is (T (Aux.Exp (W (X))));
+
+ function Sqrt (X : T) return T
+ is (T (Aux.Sqrt (W (X))));
+
+ function Log (X : T) return T
+ is (T (Aux.Log (W (X))));
+
+ function Acos (X : T) return T
+ is (T (Aux.Acos (W (X))));
+
+ function Asin (X : T) return T
+ is (T (Aux.Asin (W (X))));
+
+ function Atan (X : T) return T
+ is (T (Aux.Atan (W (X))));
+
+ function Sinh (X : T) return T
+ is (T (Aux.Sinh (W (X))));
+
+ function Cosh (X : T) return T
+ is (T (Aux.Cosh (W (X))));
+
+ function Tanh (X : T) return T
+ is (T (Aux.Tanh (W (X))));
+
+ function Pow (X, Y : T) return T
+ is (T (Aux.Pow (W (X), W (Y))));
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-nashfl__wraplf.ads b/gcc/ada/libgnat/a-nashfl__wraplf.ads
new file mode 100644
index 0000000..ca5b48d
--- /dev/null
+++ b/gcc/ada/libgnat/a-nashfl__wraplf.ads
@@ -0,0 +1,87 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X _ S H O R T _ F L O A T --
+-- --
+-- S p e c --
+-- (Short Float Wrapper in terms of Long Float) --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides the basic computational interface for the
+-- generic elementary functions. The functions in this unit are
+-- wrappers for those in the Long Float package.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Short_Float is
+ pragma Pure;
+
+ subtype T is Short_Float;
+ package Aux renames Ada.Numerics.Aux_Long_Float;
+ subtype W is Aux.T;
+
+ -- Use the Aux implementation.
+
+ function Sin (X : T) return T
+ is (T (Aux.Sin (W (X))));
+
+ function Cos (X : T) return T
+ is (T (Aux.Cos (W (X))));
+
+ function Tan (X : T) return T
+ is (T (Aux.Tan (W (X))));
+
+ function Exp (X : T) return T
+ is (T (Aux.Exp (W (X))));
+
+ function Sqrt (X : T) return T
+ is (T (Aux.Sqrt (W (X))));
+
+ function Log (X : T) return T
+ is (T (Aux.Log (W (X))));
+
+ function Acos (X : T) return T
+ is (T (Aux.Acos (W (X))));
+
+ function Asin (X : T) return T
+ is (T (Aux.Asin (W (X))));
+
+ function Atan (X : T) return T
+ is (T (Aux.Atan (W (X))));
+
+ function Sinh (X : T) return T
+ is (T (Aux.Sinh (W (X))));
+
+ function Cosh (X : T) return T
+ is (T (Aux.Cosh (W (X))));
+
+ function Tanh (X : T) return T
+ is (T (Aux.Tanh (W (X))));
+
+ function Pow (X, Y : T) return T
+ is (T (Aux.Pow (W (X), W (Y))));
+
+end Ada.Numerics.Aux_Short_Float;
diff --git a/gcc/ada/libgnat/a-nbnbin.adb b/gcc/ada/libgnat/a-nbnbin.adb
index b919d86..70df2c2 100644
--- a/gcc/ada/libgnat/a-nbnbin.adb
+++ b/gcc/ada/libgnat/a-nbnbin.adb
@@ -238,8 +238,8 @@ package body Ada.Numerics.Big_Numbers.Big_Integers is
function From_String (Arg : String) return Big_Integer is
Result : Big_Integer;
begin
- -- ??? only support Long_Long_Integer, good enough for now
- Set_Bignum (Result, To_Bignum (Long_Long_Integer'Value (Arg)));
+ -- ??? only support Long_Long_Long_Integer, good enough for now
+ Set_Bignum (Result, To_Bignum (Long_Long_Long_Integer'Value (Arg)));
return Result;
end From_String;
diff --git a/gcc/ada/libgnat/a-ngcefu.adb b/gcc/ada/libgnat/a-ngcefu.adb
index 46af6f8..d47a14f 100644
--- a/gcc/ada/libgnat/a-ngcefu.adb
+++ b/gcc/ada/libgnat/a-ngcefu.adb
@@ -481,11 +481,12 @@ package body Ada.Numerics.Generic_Complex_Elementary_Functions is
---------
function Exp (X : Complex) return Complex is
+ ImX : constant Real'Base := Im (X);
EXP_RE_X : constant Real'Base := Exp (Re (X));
begin
- return Compose_From_Cartesian (EXP_RE_X * Cos (Im (X)),
- EXP_RE_X * Sin (Im (X)));
+ return Compose_From_Cartesian (EXP_RE_X * Cos (ImX),
+ EXP_RE_X * Sin (ImX));
end Exp;
function Exp (X : Imaginary) return Complex is
diff --git a/gcc/ada/libgnat/a-ngcoty.adb b/gcc/ada/libgnat/a-ngcoty.adb
index 6785ccf..b369dfc 100644
--- a/gcc/ada/libgnat/a-ngcoty.adb
+++ b/gcc/ada/libgnat/a-ngcoty.adb
@@ -29,10 +29,12 @@
-- --
------------------------------------------------------------------------------
-with Ada.Numerics.Aux; use Ada.Numerics.Aux;
+with Ada.Numerics.Aux_Generic_Float;
package body Ada.Numerics.Generic_Complex_Types is
+ package Aux is new Ada.Numerics.Aux_Generic_Float (Real);
+
subtype R is Real'Base;
Two_Pi : constant R := R (2.0) * Pi;
@@ -440,7 +442,7 @@ package body Ada.Numerics.Generic_Complex_Types is
end if;
else
- arg := R (Atan (Double (abs (b / a))));
+ arg := Aux.Atan (abs (b / a));
if a > 0.0 then
if b > 0.0 then
@@ -507,8 +509,8 @@ package body Ada.Numerics.Generic_Complex_Types is
if Modulus = 0.0 then
return (0.0, 0.0);
else
- return (Modulus * R (Cos (Double (Argument))),
- Modulus * R (Sin (Double (Argument))));
+ return (Modulus * Aux.Cos (Argument),
+ Modulus * Aux.Sin (Argument));
end if;
end Compose_From_Polar;
@@ -536,8 +538,8 @@ package body Ada.Numerics.Generic_Complex_Types is
return (0.0, -Modulus);
else
Arg := Two_Pi * Argument / Cycle;
- return (Modulus * R (Cos (Double (Arg))),
- Modulus * R (Sin (Double (Arg))));
+ return (Modulus * Aux.Cos (Arg),
+ Modulus * Aux.Sin (Arg));
end if;
else
raise Argument_Error;
@@ -597,8 +599,8 @@ package body Ada.Numerics.Generic_Complex_Types is
exception
when Constraint_Error =>
pragma Assert (X.Re /= 0.0);
- return R (Double (abs (X.Re))
- * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+ return R (abs (X.Re))
+ * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
end;
begin
@@ -612,8 +614,8 @@ package body Ada.Numerics.Generic_Complex_Types is
exception
when Constraint_Error =>
pragma Assert (X.Im /= 0.0);
- return R (Double (abs (X.Im))
- * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+ return R (abs (X.Im))
+ * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
end;
-- Now deal with cases of underflow. If only one of the squares
@@ -632,13 +634,11 @@ package body Ada.Numerics.Generic_Complex_Types is
else
if abs (X.Re) > abs (X.Im) then
- return
- R (Double (abs (X.Re))
- * Sqrt (1.0 + (Double (X.Im) / Double (X.Re)) ** 2));
+ return R (abs (X.Re))
+ * Aux.Sqrt (1.0 + (R (X.Im) / R (X.Re)) ** 2);
else
- return
- R (Double (abs (X.Im))
- * Sqrt (1.0 + (Double (X.Re) / Double (X.Im)) ** 2));
+ return R (abs (X.Im))
+ * Aux.Sqrt (1.0 + (R (X.Re) / R (X.Im)) ** 2);
end if;
end if;
@@ -652,7 +652,7 @@ package body Ada.Numerics.Generic_Complex_Types is
-- In all other cases, the naive computation will do
else
- return R (Sqrt (Double (Re2 + Im2)));
+ return Aux.Sqrt (Re2 + Im2);
end if;
end Modulus;
diff --git a/gcc/ada/libgnat/a-ngelfu.adb b/gcc/ada/libgnat/a-ngelfu.adb
index 7e7c662..3f7c3d1 100644
--- a/gcc/ada/libgnat/a-ngelfu.adb
+++ b/gcc/ada/libgnat/a-ngelfu.adb
@@ -36,13 +36,13 @@
-- Uses functions sqrt, exp, log, pow, sin, asin, cos, acos, tan, atan, sinh,
-- cosh, tanh from C library via math.h
-with Ada.Numerics.Aux;
+with Ada.Numerics.Aux_Generic_Float;
package body Ada.Numerics.Generic_Elementary_Functions with
SPARK_Mode => Off
is
- use type Ada.Numerics.Aux.Double;
+ package Aux is new Ada.Numerics.Aux_Generic_Float (Float_Type);
Sqrt_Two : constant := 1.41421_35623_73095_04880_16887_24209_69807_85696;
Log_Two : constant := 0.69314_71805_59945_30941_72321_21458_17656_80755;
@@ -50,7 +50,6 @@ is
Half_Log_Two : constant := Log_Two / 2;
subtype T is Float_Type'Base;
- subtype Double is Aux.Double;
Two_Pi : constant T := 2.0 * Pi;
Half_Pi : constant T := Pi / 2.0;
@@ -150,8 +149,7 @@ is
Rest := Rest - 0.25;
end if;
- Result := Result *
- Float_Type'Base (Aux.Pow (Double (Left), Double (Rest)));
+ Result := Result * Aux.Pow (Left, Rest);
if Right >= 0.0 then
return Result;
@@ -159,8 +157,7 @@ is
return (1.0 / Result);
end if;
else
- return
- Float_Type'Base (Aux.Pow (Double (Left), Double (Right)));
+ return Aux.Pow (Left, Right);
end if;
end if;
@@ -194,7 +191,7 @@ is
return Pi;
end if;
- Temp := Float_Type'Base (Aux.Acos (Double (X)));
+ Temp := Aux.Acos (X);
if Temp < 0.0 then
Temp := Pi + Temp;
@@ -332,7 +329,7 @@ is
return -(Pi / 2.0);
end if;
- return Float_Type'Base (Aux.Asin (Double (X)));
+ return Aux.Asin (X);
end Arcsin;
-- Arbitrary cycle
@@ -515,7 +512,7 @@ is
return 1.0;
end if;
- return Float_Type'Base (Aux.Cos (Double (X)));
+ return Aux.Cos (X);
end Cos;
-- Arbitrary cycle
@@ -568,7 +565,7 @@ is
return 1.0 / X;
end if;
- return 1.0 / Float_Type'Base (Aux.Tan (Double (X)));
+ return 1.0 / Aux.Tan (X);
end Cot;
-- Arbitrary cycle
@@ -617,7 +614,7 @@ is
return 1.0 / X;
end if;
- return 1.0 / Float_Type'Base (Aux.Tanh (Double (X)));
+ return 1.0 / Aux.Tanh (X);
end Coth;
---------
@@ -632,7 +629,7 @@ is
return 1.0;
end if;
- Result := Float_Type'Base (Aux.Exp (Double (X)));
+ Result := Aux.Exp (X);
-- Deal with case of Exp returning IEEE infinity. If Machine_Overflows
-- is False, then we can just leave it as an infinity (and indeed we
@@ -716,7 +713,7 @@ is
Raw_Atan :=
(if Z < Sqrt_Epsilon then Z
elsif Z = 1.0 then Pi / 4.0
- else Float_Type'Base (Aux.Atan (Double (Z))));
+ else Aux.Atan (Z));
if abs Y > abs X then
Raw_Atan := Half_Pi - Raw_Atan;
@@ -747,7 +744,7 @@ is
return 0.0;
end if;
- return Float_Type'Base (Aux.Log (Double (X)));
+ return Aux.Log (X);
end Log;
-- Arbitrary base
@@ -767,7 +764,7 @@ is
return 0.0;
end if;
- return Float_Type'Base (Aux.Log (Double (X)) / Aux.Log (Double (Base)));
+ return Aux.Log (X) / Aux.Log (Base);
end Log;
---------
@@ -782,7 +779,7 @@ is
return X;
end if;
- return Float_Type'Base (Aux.Sin (Double (X)));
+ return Aux.Sin (X);
end Sin;
-- Arbitrary cycle
@@ -816,7 +813,7 @@ is
-- Could test for 12.0 * abs T = Cycle, and return an exact value in
-- those cases. It is not clear this is worth the extra test though.
- return Float_Type'Base (Aux.Sin (Double (T / Cycle * Two_Pi)));
+ return Aux.Sin (T / Cycle * Two_Pi);
end Sin;
----------
@@ -899,7 +896,7 @@ is
return X;
end if;
- return Float_Type'Base (Aux.Sqrt (Double (X)));
+ return Aux.Sqrt (X);
end Sqrt;
---------
@@ -919,7 +916,7 @@ is
-- with, it is impossible for X to be exactly pi/2, and the result is
-- always in range.
- return Float_Type'Base (Aux.Tan (Double (X)));
+ return Aux.Tan (X);
end Tan;
-- Arbitrary cycle
@@ -992,7 +989,7 @@ is
return X + X * R;
else
- return Float_Type'Base (Aux.Tanh (Double (X)));
+ return Aux.Tanh (X);
end if;
end Tanh;
diff --git a/gcc/ada/libgnat/a-ngelfu.ads b/gcc/ada/libgnat/a-ngelfu.ads
index 1a8e176..70f9b7a 100644
--- a/gcc/ada/libgnat/a-ngelfu.ads
+++ b/gcc/ada/libgnat/a-ngelfu.ads
@@ -92,6 +92,7 @@ is
and then (if Left = 0.0 then "**"'Result = 0.0);
function Sin (X : Float_Type'Base) return Float_Type'Base with
+ Inline,
Post => Sin'Result in -1.0 .. 1.0
and then (if X = 0.0 then Sin'Result = 0.0);
@@ -101,6 +102,7 @@ is
and then (if X = 0.0 then Sin'Result = 0.0);
function Cos (X : Float_Type'Base) return Float_Type'Base with
+ Inline,
Post => Cos'Result in -1.0 .. 1.0
and then (if X = 0.0 then Cos'Result = 1.0);
diff --git a/gcc/ada/libgnat/a-nuauco.ads b/gcc/ada/libgnat/a-nuauco.ads
new file mode 100644
index 0000000..7fd49a8
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuauco.ads
@@ -0,0 +1,40 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X _ C O M P A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is used to provide the default type for the
+-- backward-compatibility Ada.Numerics.Aux interface. This is
+-- Long_Float for most platforms, but there is an alternate version
+-- for x86 and x86_64 that uses the Long_Long_Float type.
+
+-- This package should not be directly with'ed by an application program
+
+with Ada.Numerics.Aux_Long_Float;
+package Ada.Numerics.Aux_Compat renames Ada.Numerics.Aux_Long_Float;
diff --git a/gcc/ada/libgnat/a-nuauco__x86.ads b/gcc/ada/libgnat/a-nuauco__x86.ads
new file mode 100644
index 0000000..f1fbb31
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuauco__x86.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X . C O M P A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is used to provide the default type for the
+-- backward-compatibility Ada.Numerics.Aux interface. This is a
+-- version for x86 and x86_64, that uses the Long_Long_Float type.
+
+-- This package should not be directly with'ed by an application program
+
+with Ada.Numerics.Aux_Long_Long_Float;
+package Ada.Numerics.Aux_Compat renames Ada.Numerics.Aux_Long_Long_Float;
diff --git a/gcc/ada/libgnat/a-numaux__libc-x86.ads b/gcc/ada/libgnat/a-nuaufl.ads
index c4647fd..16a34ae 100644
--- a/gcc/ada/libgnat/a-numaux__libc-x86.ads
+++ b/gcc/ada/libgnat/a-nuaufl.ads
@@ -2,10 +2,10 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . N U M E R I C S . A U X --
+-- A D A . N U M E R I C S . A U X _ F L O A T --
-- --
-- S p e c --
--- (C Library Version for x86) --
+-- (C Math Library Version, Float) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
@@ -30,68 +30,58 @@
-- --
------------------------------------------------------------------------------
--- This version is for the x86 using the 80-bit x86 long double format
+-- This package provides the basic computational interface for the generic
+-- elementary functions. The C library version interfaces with the routines
+-- in the C mathematical library, and is thus quite portable.
-package Ada.Numerics.Aux is
- pragma Pure;
+with Ada.Numerics.Aux_Linker_Options;
+pragma Warnings (Off, Ada.Numerics.Aux_Linker_Options);
- pragma Linker_Options ("-lm");
+package Ada.Numerics.Aux_Float is
+ pragma Pure;
- type Double is new Long_Long_Float;
+ subtype T is Float;
-- We import these functions directly from C. Note that we label them
-- all as pure functions, because indeed all of them are in fact pure.
- function Sin (X : Double) return Double;
- pragma Import (C, Sin, "sinl");
- pragma Pure_Function (Sin);
+ function Sin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinf";
- function Cos (X : Double) return Double;
- pragma Import (C, Cos, "cosl");
- pragma Pure_Function (Cos);
+ function Cos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cosf";
- function Tan (X : Double) return Double;
- pragma Import (C, Tan, "tanl");
- pragma Pure_Function (Tan);
+ function Tan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanf";
- function Exp (X : Double) return Double;
- pragma Import (C, Exp, "expl");
- pragma Pure_Function (Exp);
+ function Exp (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "expf";
- function Sqrt (X : Double) return Double;
- pragma Import (C, Sqrt, "sqrtl");
- pragma Pure_Function (Sqrt);
+ function Sqrt (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sqrtf";
- function Log (X : Double) return Double;
- pragma Import (C, Log, "logl");
- pragma Pure_Function (Log);
+ function Log (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "logf";
- function Acos (X : Double) return Double;
- pragma Import (C, Acos, "acosl");
- pragma Pure_Function (Acos);
+ function Acos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "acosf";
- function Asin (X : Double) return Double;
- pragma Import (C, Asin, "asinl");
- pragma Pure_Function (Asin);
+ function Asin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "asinf";
- function Atan (X : Double) return Double;
- pragma Import (C, Atan, "atanl");
- pragma Pure_Function (Atan);
+ function Atan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "atanf";
- function Sinh (X : Double) return Double;
- pragma Import (C, Sinh, "sinhl");
- pragma Pure_Function (Sinh);
+ function Sinh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinhf";
- function Cosh (X : Double) return Double;
- pragma Import (C, Cosh, "coshl");
- pragma Pure_Function (Cosh);
+ function Cosh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "coshf";
- function Tanh (X : Double) return Double;
- pragma Import (C, Tanh, "tanhl");
- pragma Pure_Function (Tanh);
+ function Tanh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanhf";
- function Pow (X, Y : Double) return Double;
- pragma Import (C, Pow, "powl");
- pragma Pure_Function (Pow);
+ function Pow (X, Y : T) return T with
+ Import, Convention => Intrinsic, External_Name => "powf";
-end Ada.Numerics.Aux;
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-nuaufl__wraplf.ads b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
new file mode 100644
index 0000000..b6eb22c
--- /dev/null
+++ b/gcc/ada/libgnat/a-nuaufl__wraplf.ads
@@ -0,0 +1,87 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . N U M E R I C S . A U X _ F L O A T --
+-- --
+-- S p e c --
+-- (Double-based Version, Float) --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides the basic computational interface for the
+-- generic elementary functions. The functions in this unit are
+-- wrappers for those in the Long_Float package.
+
+with Ada.Numerics.Aux_Long_Float;
+
+package Ada.Numerics.Aux_Float is
+ pragma Pure;
+
+ subtype T is Float;
+ package Aux renames Ada.Numerics.Aux_Long_Float;
+ subtype W is Aux.T;
+
+ -- Use the Aux implementation.
+
+ function Sin (X : T) return T
+ is (T (Aux.Sin (W (X))));
+
+ function Cos (X : T) return T
+ is (T (Aux.Cos (W (X))));
+
+ function Tan (X : T) return T
+ is (T (Aux.Tan (W (X))));
+
+ function Exp (X : T) return T
+ is (T (Aux.Exp (W (X))));
+
+ function Sqrt (X : T) return T
+ is (T (Aux.Sqrt (W (X))));
+
+ function Log (X : T) return T
+ is (T (Aux.Log (W (X))));
+
+ function Acos (X : T) return T
+ is (T (Aux.Acos (W (X))));
+
+ function Asin (X : T) return T
+ is (T (Aux.Asin (W (X))));
+
+ function Atan (X : T) return T
+ is (T (Aux.Atan (W (X))));
+
+ function Sinh (X : T) return T
+ is (T (Aux.Sinh (W (X))));
+
+ function Cosh (X : T) return T
+ is (T (Aux.Cosh (W (X))));
+
+ function Tanh (X : T) return T
+ is (T (Aux.Tanh (W (X))));
+
+ function Pow (X, Y : T) return T
+ is (T (Aux.Pow (W (X), W (Y))));
+
+end Ada.Numerics.Aux_Float;
diff --git a/gcc/ada/libgnat/a-numaux.ads b/gcc/ada/libgnat/a-numaux.ads
index 3ad7067..42ed336 100644
--- a/gcc/ada/libgnat/a-numaux.ads
+++ b/gcc/ada/libgnat/a-numaux.ads
@@ -5,7 +5,6 @@
-- A D A . N U M E R I C S . A U X --
-- --
-- S p e c --
--- (C Library Version, non-x86) --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
@@ -30,83 +29,60 @@
-- --
------------------------------------------------------------------------------
--- This package provides the basic computational interface for the generic
--- elementary functions. The C library version interfaces with the routines
--- in the C mathematical library, and is thus quite portable, although it may
--- not necessarily meet the requirements for accuracy in the numerics annex.
--- One advantage of using this package is that it will interface directly to
--- hardware instructions, such as the those provided on the Intel x86.
+-- This is a backward-compatibility unit, for users of this internal
+-- package before the introduction of Aux.Generic_Float.
--- This version here is for use with normal Unix math functions. Alternative
--- versions are provided for special situations:
-
--- a-numaux-darwin For PowerPC/Darwin (special handling of sin/cos)
--- a-numaux-libc-x86 For the x86, using 80-bit long double format
--- a-numaux-x86 For the x86, using 80-bit long double format with
--- inline asm statements
--- a-numaux-vxworks For use on VxWorks (where we have no libm.a library)
+with Ada.Numerics.Aux_Compat;
package Ada.Numerics.Aux is
pragma Pure;
- pragma Linker_Options ("-lm");
+ package Aux renames Aux_Compat;
+
+ type Double is new Aux.T;
- type Double is new Long_Float;
- -- Type Double is the type used to call the C routines
+ subtype T is Double;
+ subtype W is Aux.T;
- -- We import these functions directly from C. Note that we label them
- -- all as pure functions, because indeed all of them are in fact pure.
+ -- Use the Aux implementation.
- function Sin (X : Double) return Double;
- pragma Import (C, Sin, "sin");
- pragma Pure_Function (Sin);
+ function Sin (X : T) return T
+ is (T (Aux.Sin (W (X))));
- function Cos (X : Double) return Double;
- pragma Import (C, Cos, "cos");
- pragma Pure_Function (Cos);
+ function Cos (X : T) return T
+ is (T (Aux.Cos (W (X))));
- function Tan (X : Double) return Double;
- pragma Import (C, Tan, "tan");
- pragma Pure_Function (Tan);
+ function Tan (X : T) return T
+ is (T (Aux.Tan (W (X))));
- function Exp (X : Double) return Double;
- pragma Import (C, Exp, "exp");
- pragma Pure_Function (Exp);
+ function Exp (X : T) return T
+ is (T (Aux.Exp (W (X))));
- function Sqrt (X : Double) return Double;
- pragma Import (C, Sqrt, "sqrt");
- pragma Pure_Function (Sqrt);
+ function Sqrt (X : T) return T
+ is (T (Aux.Sqrt (W (X))));
- function Log (X : Double) return Double;
- pragma Import (C, Log, "log");
- pragma Pure_Function (Log);
+ function Log (X : T) return T
+ is (T (Aux.Log (W (X))));
- function Acos (X : Double) return Double;
- pragma Import (C, Acos, "acos");
- pragma Pure_Function (Acos);
+ function Acos (X : T) return T
+ is (T (Aux.Acos (W (X))));
- function Asin (X : Double) return Double;
- pragma Import (C, Asin, "asin");
- pragma Pure_Function (Asin);
+ function Asin (X : T) return T
+ is (T (Aux.Asin (W (X))));
- function Atan (X : Double) return Double;
- pragma Import (C, Atan, "atan");
- pragma Pure_Function (Atan);
+ function Atan (X : T) return T
+ is (T (Aux.Atan (W (X))));
- function Sinh (X : Double) return Double;
- pragma Import (C, Sinh, "sinh");
- pragma Pure_Function (Sinh);
+ function Sinh (X : T) return T
+ is (T (Aux.Sinh (W (X))));
- function Cosh (X : Double) return Double;
- pragma Import (C, Cosh, "cosh");
- pragma Pure_Function (Cosh);
+ function Cosh (X : T) return T
+ is (T (Aux.Cosh (W (X))));
- function Tanh (X : Double) return Double;
- pragma Import (C, Tanh, "tanh");
- pragma Pure_Function (Tanh);
+ function Tanh (X : T) return T
+ is (T (Aux.Tanh (W (X))));
- function Pow (X, Y : Double) return Double;
- pragma Import (C, Pow, "pow");
- pragma Pure_Function (Pow);
+ function Pow (X, Y : T) return T
+ is (T (Aux.Pow (W (X), W (Y))));
end Ada.Numerics.Aux;
diff --git a/gcc/ada/libgnat/a-numaux__darwin.adb b/gcc/ada/libgnat/a-numaux__darwin.adb
deleted file mode 100644
index 85fdd24..0000000
--- a/gcc/ada/libgnat/a-numaux__darwin.adb
+++ /dev/null
@@ -1,211 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- A D A . N U M E R I C S . A U X --
--- --
--- B o d y --
--- (Apple OS X Version) --
--- --
--- Copyright (C) 1998-2020, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-package body Ada.Numerics.Aux is
-
- -----------------------
- -- Local subprograms --
- -----------------------
-
- function Is_Nan (X : Double) return Boolean;
- -- Return True iff X is a IEEE NaN value
-
- procedure Reduce (X : in out Double; Q : out Natural);
- -- Implement reduction of X by Pi/2. Q is the quadrant of the final
- -- result in the range 0..3. The absolute value of X is at most Pi/4.
- -- It is needed to avoid a loss of accuracy for sin near Pi and cos
- -- near Pi/2 due to the use of an insufficiently precise value of Pi
- -- in the range reduction.
-
- -- The following two functions implement Chebishev approximations
- -- of the trigonometric functions in their reduced domain.
- -- These approximations have been computed using Maple.
-
- function Sine_Approx (X : Double) return Double;
- function Cosine_Approx (X : Double) return Double;
-
- pragma Inline (Reduce);
- pragma Inline (Sine_Approx);
- pragma Inline (Cosine_Approx);
-
- -------------------
- -- Cosine_Approx --
- -------------------
-
- function Cosine_Approx (X : Double) return Double is
- XX : constant Double := X * X;
- begin
- return (((((16#8.DC57FBD05F640#E-08 * XX
- - 16#4.9F7D00BF25D80#E-06) * XX
- + 16#1.A019F7FDEFCC2#E-04) * XX
- - 16#5.B05B058F18B20#E-03) * XX
- + 16#A.AAAAAAAA73FA8#E-02) * XX
- - 16#7.FFFFFFFFFFDE4#E-01) * XX
- - 16#3.655E64869ECCE#E-14 + 1.0;
- end Cosine_Approx;
-
- -----------------
- -- Sine_Approx --
- -----------------
-
- function Sine_Approx (X : Double) return Double is
- XX : constant Double := X * X;
- begin
- return (((((16#A.EA2D4ABE41808#E-09 * XX
- - 16#6.B974C10F9D078#E-07) * XX
- + 16#2.E3BC673425B0E#E-05) * XX
- - 16#D.00D00CCA7AF00#E-04) * XX
- + 16#2.222222221B190#E-02) * XX
- - 16#2.AAAAAAAAAAA44#E-01) * (XX * X) + X;
- end Sine_Approx;
-
- ------------
- -- Is_Nan --
- ------------
-
- function Is_Nan (X : Double) return Boolean is
- begin
- -- The IEEE NaN values are the only ones that do not equal themselves
-
- return X /= X;
- end Is_Nan;
-
- ------------
- -- Reduce --
- ------------
-
- procedure Reduce (X : in out Double; Q : out Natural) is
- Half_Pi : constant := Pi / 2.0;
- Two_Over_Pi : constant := 2.0 / Pi;
-
- HM : constant := Integer'Min (Double'Machine_Mantissa / 2, Natural'Size);
- M : constant Double := 0.5 + 2.0**(1 - HM); -- Splitting constant
- P1 : constant Double := Double'Leading_Part (Half_Pi, HM);
- P2 : constant Double := Double'Leading_Part (Half_Pi - P1, HM);
- P3 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2, HM);
- P4 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3, HM);
- P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3
- - P4, HM);
- P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
- K : Double;
- R : Integer;
-
- begin
- -- For X < 2.0**HM, all products below are computed exactly.
- -- Due to cancellation effects all subtractions are exact as well.
- -- As no double extended floating-point number has more than 75
- -- zeros after the binary point, the result will be the correctly
- -- rounded result of X - K * (Pi / 2.0).
-
- K := X * Two_Over_Pi;
- while abs K >= 2.0**HM loop
- K := K * M - (K * M - K);
- X :=
- (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6;
- K := X * Two_Over_Pi;
- end loop;
-
- -- If K is not a number (because X was not finite) raise exception
-
- if Is_Nan (K) then
- raise Constraint_Error;
- end if;
-
- -- Go through an integer temporary so as to use machine instructions
-
- R := Integer (Double'Rounding (K));
- Q := R mod 4;
- K := Double (R);
- X := (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6;
- end Reduce;
-
- ---------
- -- Cos --
- ---------
-
- function Cos (X : Double) return Double is
- Reduced_X : Double := abs X;
- Quadrant : Natural range 0 .. 3;
-
- begin
- if Reduced_X > Pi / 4.0 then
- Reduce (Reduced_X, Quadrant);
-
- case Quadrant is
- when 0 =>
- return Cosine_Approx (Reduced_X);
-
- when 1 =>
- return Sine_Approx (-Reduced_X);
-
- when 2 =>
- return -Cosine_Approx (Reduced_X);
-
- when 3 =>
- return Sine_Approx (Reduced_X);
- end case;
- end if;
-
- return Cosine_Approx (Reduced_X);
- end Cos;
-
- ---------
- -- Sin --
- ---------
-
- function Sin (X : Double) return Double is
- Reduced_X : Double := X;
- Quadrant : Natural range 0 .. 3;
-
- begin
- if abs X > Pi / 4.0 then
- Reduce (Reduced_X, Quadrant);
-
- case Quadrant is
- when 0 =>
- return Sine_Approx (Reduced_X);
-
- when 1 =>
- return Cosine_Approx (Reduced_X);
-
- when 2 =>
- return Sine_Approx (-Reduced_X);
-
- when 3 =>
- return -Cosine_Approx (Reduced_X);
- end case;
- end if;
-
- return Sine_Approx (Reduced_X);
- end Sin;
-
-end Ada.Numerics.Aux;
diff --git a/gcc/ada/libgnat/a-numeri.ads b/gcc/ada/libgnat/a-numeri.ads
index 805fa56..6304ce1 100644
--- a/gcc/ada/libgnat/a-numeri.ads
+++ b/gcc/ada/libgnat/a-numeri.ads
@@ -21,10 +21,13 @@ package Ada.Numerics is
Pi : constant :=
3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511;
- ["03C0"] : constant := Pi;
+ -- ["03C0"] : constant := Pi;
-- This is the Greek letter Pi (for Ada 2005 AI-388). Note that it is
-- conforming to have this constant present even in Ada 95 mode, as there
-- is no way for a normal mode Ada 95 program to reference this identifier.
+ -- ???This is removed for now, because nobody uses it, and it causes
+ -- trouble for tools other than the compiler. If people want to use the
+ -- Greek letter in their programs, they can easily define it themselves.
e : constant :=
2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996;
diff --git a/gcc/ada/libgnat/a-stoubu.adb b/gcc/ada/libgnat/a-stoubu.adb
index 9fb6c5a..663d4ba 100644
--- a/gcc/ada/libgnat/a-stoubu.adb
+++ b/gcc/ada/libgnat/a-stoubu.adb
@@ -35,6 +35,8 @@ with Ada.Strings.UTF_Encoding.Wide_Strings;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
package body Ada.Strings.Text_Output.Buffers is
+ type Chunk_Access is access all Chunk;
+
function New_Buffer
(Indent_Amount : Natural := Default_Indent_Amount;
Chunk_Length : Positive := Default_Chunk_Length) return Buffer
@@ -46,13 +48,20 @@ package body Ada.Strings.Text_Output.Buffers is
end return;
end New_Buffer;
+ -- We need type conversions of Chunk_Access values in the following two
+ -- procedures, because the one in Text_Output has Storage_Size => 0,
+ -- because Text_Output is Pure. We do not run afoul of 13.11.2(16/3),
+ -- which requires the allocation and deallocation to have the same pool,
+ -- because the allocation in Full_Method and the deallocation in Destroy
+ -- use the same access type, and therefore the same pool.
+
procedure Destroy (S : in out Buffer) is
procedure Free is new Unchecked_Deallocation (Chunk, Chunk_Access);
- Cur : Chunk_Access := S.Initial_Chunk.Next;
+ Cur : Chunk_Access := Chunk_Access (S.Initial_Chunk.Next);
begin
while Cur /= null loop
declare
- Temp : constant Chunk_Access := Cur.Next;
+ Temp : constant Chunk_Access := Chunk_Access (Cur.Next);
begin
Free (Cur);
Cur := Temp;
@@ -66,7 +75,8 @@ package body Ada.Strings.Text_Output.Buffers is
begin
pragma Assert (S.Cur_Chunk.Next = null);
pragma Assert (S.Last = S.Cur_Chunk.Chars'Length);
- S.Cur_Chunk.Next := new Chunk (S.Chunk_Length);
+ S.Cur_Chunk.Next :=
+ Text_Output.Chunk_Access (Chunk_Access'(new Chunk (S.Chunk_Length)));
S.Cur_Chunk := S.Cur_Chunk.Next;
S.Num_Extra_Chunks := @ + 1;
S.Last := 0;
diff --git a/gcc/ada/libgnat/a-stouut.adb b/gcc/ada/libgnat/a-stouut.adb
index b5a8f97..2011408 100644
--- a/gcc/ada/libgnat/a-stouut.adb
+++ b/gcc/ada/libgnat/a-stouut.adb
@@ -142,6 +142,7 @@ package body Ada.Strings.Text_Output.Utils is
S.Cur_Chunk.Chars (S.Last + 1 .. S.Last + Item'Length) := Item;
S.Last := S.Last + Item'Length;
+ S.Column := S.Column + Item'Length;
Full (S);
-- ???Seems like maybe we shouldn't call Full until we have MORE
-- characters. But then we can't pass Chunk_Length => 1 to
@@ -175,6 +176,7 @@ package body Ada.Strings.Text_Output.Utils is
S.Cur_Chunk.Chars (S.Last + 1 .. S.Last + Item'Length) := Item;
S.Last := S.Last + Item'Length;
+ S.Column := S.Column + Item'Length;
else
Put_UTF_8_Outline (S, Item);
end if;
@@ -191,7 +193,6 @@ package body Ada.Strings.Text_Output.Utils is
Put_UTF_8 (S, Item (Line_Start .. Index - 1));
end if;
New_Line (S);
- S.Column := 1;
Line_Start := Index + 1;
end if;
diff --git a/gcc/ada/libgnat/a-stouut.ads b/gcc/ada/libgnat/a-stouut.ads
index 28d7eca..5056080 100644
--- a/gcc/ada/libgnat/a-stouut.ads
+++ b/gcc/ada/libgnat/a-stouut.ads
@@ -29,7 +29,7 @@
-- --
------------------------------------------------------------------------------
-package Ada.Strings.Text_Output.Utils with Preelaborate is
+package Ada.Strings.Text_Output.Utils with Pure is
-- This package provides utility functions on Sink'Class. These are
-- intended for use by Put_Image attributes, both the default versions
@@ -70,7 +70,8 @@ package Ada.Strings.Text_Output.Utils with Preelaborate is
-- Send data that is already UTF-8 encoded (including 7-bit ASCII) to
-- S. These are more efficient than Put_String.
- procedure New_Line (S : in out Sink'Class) with Inline;
+ procedure New_Line (S : in out Sink'Class) with
+ Inline, Post => Column (S) = 1;
-- Puts the new-line character.
function Column (S : Sink'Class) return Positive with Inline;
diff --git a/gcc/ada/libgnat/a-strunb.adb b/gcc/ada/libgnat/a-strunb.adb
index 988de42..7d1e6dd 100644
--- a/gcc/ada/libgnat/a-strunb.adb
+++ b/gcc/ada/libgnat/a-strunb.adb
@@ -778,6 +778,16 @@ package body Ada.Strings.Unbounded is
end if;
end Overwrite;
+ ---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Unbounded_String) is
+ begin
+ String'Put_Image (S, To_String (V));
+ end Put_Image;
+
-----------------------
-- Realloc_For_Chunk --
-----------------------
diff --git a/gcc/ada/libgnat/a-strunb.ads b/gcc/ada/libgnat/a-strunb.ads
index 3471dbb..7de9bbc 100644
--- a/gcc/ada/libgnat/a-strunb.ads
+++ b/gcc/ada/libgnat/a-strunb.ads
@@ -41,6 +41,7 @@ pragma Assertion_Policy (Pre => Ignore);
with Ada.Strings.Maps;
with Ada.Finalization;
+private with Ada.Strings.Text_Output;
-- The language-defined package Strings.Unbounded provides a private type
-- Unbounded_String and a set of operations. An object of type
@@ -744,7 +745,11 @@ private
type Unbounded_String is new AF.Controlled with record
Reference : String_Access := Null_String'Access;
Last : Natural := 0;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Unbounded_String);
+
-- The Unbounded_String is using a buffered implementation to increase
-- speed of the Append/Delete/Insert procedures. The Reference string
-- pointer above contains the current string value and extra room at the
diff --git a/gcc/ada/libgnat/a-strunb__shared.adb b/gcc/ada/libgnat/a-strunb__shared.adb
index 0ff34d8..54a2932 100644
--- a/gcc/ada/libgnat/a-strunb__shared.adb
+++ b/gcc/ada/libgnat/a-strunb__shared.adb
@@ -1297,6 +1297,16 @@ package body Ada.Strings.Unbounded is
end Overwrite;
---------------
+ -- Put_Image --
+ ---------------
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Unbounded_String) is
+ begin
+ String'Put_Image (S, To_String (V));
+ end Put_Image;
+
+ ---------------
-- Reference --
---------------
diff --git a/gcc/ada/libgnat/a-strunb__shared.ads b/gcc/ada/libgnat/a-strunb__shared.ads
index 5a5ad93..2cd8166 100644
--- a/gcc/ada/libgnat/a-strunb__shared.ads
+++ b/gcc/ada/libgnat/a-strunb__shared.ads
@@ -78,6 +78,7 @@ pragma Assertion_Policy (Pre => Ignore);
with Ada.Strings.Maps;
private with Ada.Finalization;
private with System.Atomic_Counters;
+private with Ada.Strings.Text_Output;
package Ada.Strings.Unbounded with
Initial_Condition => Length (Null_Unbounded_String) = 0
@@ -738,7 +739,10 @@ private
type Unbounded_String is new AF.Controlled with record
Reference : not null Shared_String_Access := Empty_Shared_String'Access;
- end record;
+ end record with Put_Image => Put_Image;
+
+ procedure Put_Image
+ (S : in out Ada.Strings.Text_Output.Sink'Class; V : Unbounded_String);
pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String);
-- Provide stream routines without dragging in Ada.Streams
diff --git a/gcc/ada/libgnat/a-ststun.ads b/gcc/ada/libgnat/a-ststun.ads
index 95aca9b..2945bca 100644
--- a/gcc/ada/libgnat/a-ststun.ads
+++ b/gcc/ada/libgnat/a-ststun.ads
@@ -71,7 +71,7 @@ private
EA : Stream_Element_Array (1 .. Last);
end record;
- Empty_Elements : aliased Elements_Type := (Last => 0, EA => (others => <>));
+ Empty_Elements : aliased Elements_Type (0);
type Elements_Access is access all Elements_Type;
diff --git a/gcc/ada/libgnat/a-stteou.ads b/gcc/ada/libgnat/a-stteou.ads
index 924b550..9eaf98a 100644
--- a/gcc/ada/libgnat/a-stteou.ads
+++ b/gcc/ada/libgnat/a-stteou.ads
@@ -32,7 +32,7 @@
with Ada.Strings.UTF_Encoding;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
-package Ada.Strings.Text_Output with Preelaborate is
+package Ada.Strings.Text_Output with Pure is
-- This package provides a "Sink" abstraction, to which characters of type
-- Character, Wide_Character, and Wide_Wide_Character can be sent. This
@@ -48,7 +48,11 @@ package Ada.Strings.Text_Output with Preelaborate is
-- extended. It is designed with particular extensions in mind, and these
-- extensions are declared in child packages of this package, because they
-- depend on implementation details in the private part of this
- -- package. The primary extensions of Sink are:
+ -- package.
+ --
+ -- Users are not expected to extend type Sink.
+ --
+ -- The primary extensions of Sink are:
--
-- Buffer. The characters sent to a Buffer are stored in memory, and can
-- be retrieved via Get functions. This is intended for the
@@ -141,15 +145,13 @@ package Ada.Strings.Text_Output with Preelaborate is
-- slows things down, but increasing it doesn't gain much.
private
- type String_Access is access all String;
-
-- For Buffer, the "internal buffer" mentioned above is implemented as a
-- linked list of chunks. When the current chunk is full, we allocate a new
-- one. For File, there is only one chunk. When it is full, we send the
-- data to the file, and empty it.
type Chunk;
- type Chunk_Access is access all Chunk;
+ type Chunk_Access is access all Chunk with Storage_Size => 0;
type Chunk (Length : Positive) is limited record
Next : Chunk_Access := null;
Chars : UTF_8_Lines (1 .. Length);
diff --git a/gcc/ada/libgnat/a-suenco.adb b/gcc/ada/libgnat/a-suenco.adb
index 6d30f84..0b10a63 100644
--- a/gcc/ada/libgnat/a-suenco.adb
+++ b/gcc/ada/libgnat/a-suenco.adb
@@ -398,7 +398,7 @@ package body Ada.Strings.UTF_Encoding.Conversions is
or Shift_Right (yyyyyyyy, 4));
Result (Len + 3) :=
Character'Val
- (2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 4)
+ (2#10_000000# or Shift_Left (yyyyyyyy and 2#1111#, 2)
or Shift_Right (xxxxxxxx, 6));
Result (Len + 4) :=
Character'Val
diff --git a/gcc/ada/libgnat/a-textio.ads b/gcc/ada/libgnat/a-textio.ads
index 6e5e392..36a4b65 100644
--- a/gcc/ada/libgnat/a-textio.ads
+++ b/gcc/ada/libgnat/a-textio.ads
@@ -36,8 +36,9 @@
-- Preconditions in this unit are meant for analysis only, not for run-time
-- checking, so that the expected exceptions are raised. This is enforced by
-- setting the corresponding assertion policy to Ignore. These preconditions
--- are partial and protect against Status_Error, Mode_Error, and Layout_Error,
--- but not against other types of errors.
+-- are partial. They protect fully against Status_Error and Mode_Error,
+-- partially against Layout_Error (see SPARK User's Guide for details), and
+-- not against other types of errors.
pragma Assertion_Policy (Pre => Ignore);
diff --git a/gcc/ada/libgnat/a-tifiio.adb b/gcc/ada/libgnat/a-tifiio.adb
index 4098f0e..440a77d 100644
--- a/gcc/ada/libgnat/a-tifiio.adb
+++ b/gcc/ada/libgnat/a-tifiio.adb
@@ -580,7 +580,7 @@ package body Ada.Text_IO.Fixed_IO is
YY := 10**(Integer'Min (Max_Digits, AA - (J - 1) * Max_Digits));
end if;
- Scaled_Divide (XX, YY, Z, Q (J), R => XX, Round => False);
+ Scaled_Divide64 (XX, YY, Z, Q (J), R => XX, Round => False);
end loop;
if -E > A then
diff --git a/gcc/ada/libgnat/a-tigeau.adb b/gcc/ada/libgnat/a-tigeau.adb
index c7f719a..f1ba60a 100644
--- a/gcc/ada/libgnat/a-tigeau.adb
+++ b/gcc/ada/libgnat/a-tigeau.adb
@@ -322,6 +322,60 @@ package body Ada.Text_IO.Generic_Aux is
Load_Extended_Digits (File, Buf, Ptr, Junk);
end Load_Extended_Digits;
+ ------------------
+ -- Load_Integer --
+ ------------------
+
+ procedure Load_Integer
+ (File : File_Type;
+ Buf : out String;
+ Ptr : in out Natural)
+ is
+ Hash_Loc : Natural;
+ Loaded : Boolean;
+
+ begin
+ Load_Skip (File);
+
+ -- Note: it is a bit strange to allow a minus sign here, but it seems
+ -- consistent with the general behavior expected by the ACVC tests
+ -- which is to scan past junk and then signal data error, see ACVC
+ -- test CE3704F, case (6), which is for signed integer exponents,
+ -- which seems a similar case.
+
+ Load (File, Buf, Ptr, '+', '-');
+ Load_Digits (File, Buf, Ptr, Loaded);
+
+ if Loaded then
+
+ -- Deal with based literal. We recognize either the standard '#' or
+ -- the allowed alternative replacement ':' (see RM J.2(3)).
+
+ Load (File, Buf, Ptr, '#', ':', Loaded);
+
+ if Loaded then
+ Hash_Loc := Ptr;
+ Load_Extended_Digits (File, Buf, Ptr);
+ Load (File, Buf, Ptr, Buf (Hash_Loc));
+ end if;
+
+ -- Deal with exponent
+
+ Load (File, Buf, Ptr, 'E', 'e', Loaded);
+
+ if Loaded then
+
+ -- Note: it is strange to allow a minus sign, since the syntax
+ -- does not, but that is what ACVC test CE3704F, case (6) wants
+ -- for the signed case, and there seems no good reason to treat
+ -- exponents differently for the signed and unsigned cases.
+
+ Load (File, Buf, Ptr, '+', '-');
+ Load_Digits (File, Buf, Ptr);
+ end if;
+ end if;
+ end Load_Integer;
+
---------------
-- Load_Skip --
---------------
diff --git a/gcc/ada/libgnat/a-tigeau.ads b/gcc/ada/libgnat/a-tigeau.ads
index 32b5fe3..09334b3 100644
--- a/gcc/ada/libgnat/a-tigeau.ads
+++ b/gcc/ada/libgnat/a-tigeau.ads
@@ -150,6 +150,12 @@ private package Ada.Text_IO.Generic_Aux is
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
+ procedure Load_Integer
+ (File : File_Type;
+ Buf : out String;
+ Ptr : in out Natural);
+ -- Loads a possibly signed integer literal value
+
function Nextc (File : File_Type) return Integer;
-- Like Getc, but includes a call to Ungetc, so that the file
-- pointer is not moved by the call.
diff --git a/gcc/ada/libgnat/a-tiinau.adb b/gcc/ada/libgnat/a-tiinau.adb
index d09b456..a0bb5c6 100644
--- a/gcc/ada/libgnat/a-tiinau.adb
+++ b/gcc/ada/libgnat/a-tiinau.adb
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . T E X T _ I O . I N T E G E R _ A U X --
+-- A D A . T E X T _ I O . I N T E G E R _ A U X --
-- --
-- B o d y --
-- --
@@ -31,61 +31,15 @@
with Ada.Text_IO.Generic_Aux; use Ada.Text_IO.Generic_Aux;
-with System.Img_BIU; use System.Img_BIU;
-with System.Img_Int; use System.Img_Int;
-with System.Img_LLB; use System.Img_LLB;
-with System.Img_LLI; use System.Img_LLI;
-with System.Img_LLW; use System.Img_LLW;
-with System.Img_WIU; use System.Img_WIU;
-with System.Val_Int; use System.Val_Int;
-with System.Val_LLI; use System.Val_LLI;
-
package body Ada.Text_IO.Integer_Aux is
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Load_Integer
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural);
- -- This is an auxiliary routine that is used to load a possibly signed
- -- integer literal value from the input file into Buf, starting at Ptr + 1.
- -- On return, Ptr is set to the last character stored.
-
- -------------
- -- Get_Int --
- -------------
-
- procedure Get_Int
- (File : File_Type;
- Item : out Integer;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Ptr : aliased Integer := 1;
- Stop : Integer := 0;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Integer (File, Buf, Stop);
- end if;
-
- Item := Scan_Integer (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_Int;
+ ---------
+ -- Get --
+ ---------
- -------------
- -- Get_LLI --
- -------------
-
- procedure Get_LLI
+ procedure Get
(File : File_Type;
- Item : out Long_Long_Integer;
+ Item : out Num;
Width : Field)
is
Buf : String (1 .. Field'Last);
@@ -100,130 +54,38 @@ package body Ada.Text_IO.Integer_Aux is
Load_Integer (File, Buf, Stop);
end if;
- Item := Scan_Long_Long_Integer (Buf, Ptr'Access, Stop);
+ Item := Scan (Buf, Ptr'Access, Stop);
Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_LLI;
+ end Get;
- --------------
- -- Gets_Int --
- --------------
+ ----------
+ -- Gets --
+ ----------
- procedure Gets_Int
+ procedure Gets
(From : String;
- Item : out Integer;
+ Item : out Num;
Last : out Positive)
is
Pos : aliased Integer;
begin
String_Skip (From, Pos);
- Item := Scan_Integer (From, Pos'Access, From'Last);
+ Item := Scan (From, Pos'Access, From'Last);
Last := Pos - 1;
exception
when Constraint_Error =>
raise Data_Error;
- end Gets_Int;
-
- --------------
- -- Gets_LLI --
- --------------
-
- procedure Gets_LLI
- (From : String;
- Item : out Long_Long_Integer;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Long_Long_Integer (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_LLI;
-
- ------------------
- -- Load_Integer --
- ------------------
-
- procedure Load_Integer
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural)
- is
- Hash_Loc : Natural;
- Loaded : Boolean;
-
- begin
- Load_Skip (File);
- Load (File, Buf, Ptr, '+', '-');
-
- Load_Digits (File, Buf, Ptr, Loaded);
-
- if Loaded then
-
- -- Deal with based literal. We recognize either the standard '#' or
- -- the allowed alternative replacement ':' (see RM J.2(3)).
+ end Gets;
- Load (File, Buf, Ptr, '#', ':', Loaded);
+ ---------
+ -- Put --
+ ---------
- if Loaded then
- Hash_Loc := Ptr;
- Load_Extended_Digits (File, Buf, Ptr);
- Load (File, Buf, Ptr, Buf (Hash_Loc));
- end if;
-
- -- Deal with exponent
-
- Load (File, Buf, Ptr, 'E', 'e', Loaded);
-
- if Loaded then
-
- -- Note: it is strange to allow a minus sign, since the syntax
- -- does not, but that is what ACVC test CE3704F, case (6) wants.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr);
- end if;
- end if;
- end Load_Integer;
-
- -------------
- -- Put_Int --
- -------------
-
- procedure Put_Int
- (File : File_Type;
- Item : Integer;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Integer'Max (Field'Last, Width));
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Integer (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Integer (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Integer (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_Int;
-
- -------------
- -- Put_LLI --
- -------------
-
- procedure Put_LLI
+ procedure Put
(File : File_Type;
- Item : Long_Long_Integer;
+ Item : Num;
Width : Field;
Base : Number_Base)
is
@@ -232,49 +94,23 @@ package body Ada.Text_IO.Integer_Aux is
begin
if Base = 10 and then Width = 0 then
- Set_Image_Long_Long_Integer (Item, Buf, Ptr);
+ Set_Image (Item, Buf, Ptr);
elsif Base = 10 then
- Set_Image_Width_Long_Long_Integer (Item, Width, Buf, Ptr);
+ Set_Image_Width (Item, Width, Buf, Ptr);
else
- Set_Image_Based_Long_Long_Integer (Item, Base, Width, Buf, Ptr);
+ Set_Image_Based (Item, Base, Width, Buf, Ptr);
end if;
Put_Item (File, Buf (1 .. Ptr));
- end Put_LLI;
-
- --------------
- -- Puts_Int --
- --------------
-
- procedure Puts_Int
- (To : out String;
- Item : Integer;
- Base : Number_Base)
- is
- Buf : String (1 .. Integer'Max (Field'Last, To'Length));
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Integer (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Integer (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_Int;
+ end Put;
- --------------
- -- Puts_LLI --
- --------------
+ ----------
+ -- Puts --
+ ----------
- procedure Puts_LLI
+ procedure Puts
(To : out String;
- Item : Long_Long_Integer;
+ Item : Num;
Base : Number_Base)
is
Buf : String (1 .. Integer'Max (Field'Last, To'Length));
@@ -282,9 +118,9 @@ package body Ada.Text_IO.Integer_Aux is
begin
if Base = 10 then
- Set_Image_Width_Long_Long_Integer (Item, To'Length, Buf, Ptr);
+ Set_Image_Width (Item, To'Length, Buf, Ptr);
else
- Set_Image_Based_Long_Long_Integer (Item, Base, To'Length, Buf, Ptr);
+ Set_Image_Based (Item, Base, To'Length, Buf, Ptr);
end if;
if Ptr > To'Length then
@@ -292,6 +128,6 @@ package body Ada.Text_IO.Integer_Aux is
else
To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
end if;
- end Puts_LLI;
+ end Puts;
end Ada.Text_IO.Integer_Aux;
diff --git a/gcc/ada/libgnat/a-tiinau.ads b/gcc/ada/libgnat/a-tiinau.ads
index fda5b68..e149221 100644
--- a/gcc/ada/libgnat/a-tiinau.ads
+++ b/gcc/ada/libgnat/a-tiinau.ads
@@ -29,55 +29,45 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines for Ada.Text_IO.Integer_IO that are
--- shared among separate instantiations of this package. The routines in
--- this package are identical semantically to those in Integer_IO itself,
--- except that the generic parameter Num has been replaced by Integer or
--- Long_Long_Integer, and the default parameters have been removed because
--- they are supplied explicitly by the calls from within the generic template.
+-- This package contains the implementation for Ada.Text_IO.Integer_IO and
+-- Ada.Text_IO.Modular_IO. The routines in this package are identical
+-- semantically to those in Integer_IO and Modular_IO themselves, except that
+-- the default parameters have been removed because they are supplied
+-- explicitly by the calls from within these units.
-private package Ada.Text_IO.Integer_Aux is
+private generic
+ type Num is (<>);
- procedure Get_Int
- (File : File_Type;
- Item : out Integer;
- Width : Field);
+ with function Scan
+ (Str : String; Ptr : not null access Integer; Max : Integer) return Num;
+ with procedure Set_Image
+ (V : Num; S : in out String; P : in out Natural);
+ with procedure Set_Image_Width
+ (V : Num; W : Integer; S : out String; P : in out Natural);
+ with procedure Set_Image_Based
+ (V : Num; B : Natural; W : Integer; S : out String; P : in out Natural);
+
+package Ada.Text_IO.Integer_Aux is
- procedure Get_LLI
+ procedure Get
(File : File_Type;
- Item : out Long_Long_Integer;
+ Item : out Num;
Width : Field);
- procedure Put_Int
- (File : File_Type;
- Item : Integer;
- Width : Field;
- Base : Number_Base);
+ procedure Gets
+ (From : String;
+ Item : out Num;
+ Last : out Positive);
- procedure Put_LLI
+ procedure Put
(File : File_Type;
- Item : Long_Long_Integer;
+ Item : Num;
Width : Field;
Base : Number_Base);
- procedure Gets_Int
- (From : String;
- Item : out Integer;
- Last : out Positive);
-
- procedure Gets_LLI
- (From : String;
- Item : out Long_Long_Integer;
- Last : out Positive);
-
- procedure Puts_Int
- (To : out String;
- Item : Integer;
- Base : Number_Base);
-
- procedure Puts_LLI
+ procedure Puts
(To : out String;
- Item : Long_Long_Integer;
+ Item : Num;
Base : Number_Base);
end Ada.Text_IO.Integer_Aux;
diff --git a/gcc/ada/libgnat/a-tiinio.adb b/gcc/ada/libgnat/a-tiinio.adb
index c71b4bf..4133bec 100644
--- a/gcc/ada/libgnat/a-tiinio.adb
+++ b/gcc/ada/libgnat/a-tiinio.adb
@@ -30,10 +30,32 @@
------------------------------------------------------------------------------
with Ada.Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Int; use System.Img_Int;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLI; use System.Img_LLI;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Int; use System.Val_Int;
+with System.Val_LLI; use System.Val_LLI;
package body Ada.Text_IO.Integer_IO is
- package Aux renames Ada.Text_IO.Integer_Aux;
+ package Aux_Int is new
+ Ada.Text_IO.Integer_Aux
+ (Integer,
+ Scan_Integer,
+ Set_Image_Integer,
+ Set_Image_Width_Integer,
+ Set_Image_Based_Integer);
+
+ package Aux_LLI is new
+ Ada.Text_IO.Integer_Aux
+ (Long_Long_Integer,
+ Scan_Long_Long_Integer,
+ Set_Image_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Integer);
Need_LLI : constant Boolean := Num'Base'Size > Integer'Size;
-- Throughout this generic body, we distinguish between the case where type
@@ -57,9 +79,9 @@ package body Ada.Text_IO.Integer_IO is
begin
if Need_LLI then
- Aux.Get_LLI (File, Long_Long_Integer (Item), Width);
+ Aux_LLI.Get (File, Long_Long_Integer (Item), Width);
else
- Aux.Get_Int (File, Integer (Item), Width);
+ Aux_Int.Get (File, Integer (Item), Width);
end if;
exception
@@ -70,20 +92,8 @@ package body Ada.Text_IO.Integer_IO is
(Item : out Num;
Width : Field := 0)
is
- -- We depend on a range check to get Data_Error
-
- pragma Unsuppress (Range_Check);
- pragma Unsuppress (Overflow_Check);
-
begin
- if Need_LLI then
- Aux.Get_LLI (Current_In, Long_Long_Integer (Item), Width);
- else
- Aux.Get_Int (Current_In, Integer (Item), Width);
- end if;
-
- exception
- when Constraint_Error => raise Data_Error;
+ Get (Current_In, Item, Width);
end Get;
procedure Get
@@ -98,9 +108,9 @@ package body Ada.Text_IO.Integer_IO is
begin
if Need_LLI then
- Aux.Gets_LLI (From, Long_Long_Integer (Item), Last);
+ Aux_LLI.Gets (From, Long_Long_Integer (Item), Last);
else
- Aux.Gets_Int (From, Integer (Item), Last);
+ Aux_Int.Gets (From, Integer (Item), Last);
end if;
exception
@@ -119,9 +129,9 @@ package body Ada.Text_IO.Integer_IO is
is
begin
if Need_LLI then
- Aux.Put_LLI (File, Long_Long_Integer (Item), Width, Base);
+ Aux_LLI.Put (File, Long_Long_Integer (Item), Width, Base);
else
- Aux.Put_Int (File, Integer (Item), Width, Base);
+ Aux_Int.Put (File, Integer (Item), Width, Base);
end if;
end Put;
@@ -131,11 +141,7 @@ package body Ada.Text_IO.Integer_IO is
Base : Number_Base := Default_Base)
is
begin
- if Need_LLI then
- Aux.Put_LLI (Current_Out, Long_Long_Integer (Item), Width, Base);
- else
- Aux.Put_Int (Current_Out, Integer (Item), Width, Base);
- end if;
+ Put (Current_Out, Item, Width, Base);
end Put;
procedure Put
@@ -145,9 +151,9 @@ package body Ada.Text_IO.Integer_IO is
is
begin
if Need_LLI then
- Aux.Puts_LLI (To, Long_Long_Integer (Item), Base);
+ Aux_LLI.Puts (To, Long_Long_Integer (Item), Base);
else
- Aux.Puts_Int (To, Integer (Item), Base);
+ Aux_Int.Puts (To, Integer (Item), Base);
end if;
end Put;
diff --git a/gcc/ada/libgnat/a-tiinio__128.adb b/gcc/ada/libgnat/a-tiinio__128.adb
new file mode 100644
index 0000000..e82b447
--- /dev/null
+++ b/gcc/ada/libgnat/a-tiinio__128.adb
@@ -0,0 +1,182 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . T E X T _ I O . I N T E G E R _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Int; use System.Img_Int;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLI; use System.Img_LLI;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_LLLB; use System.Img_LLLB;
+with System.Img_LLLI; use System.Img_LLLI;
+with System.Img_LLLW; use System.Img_LLLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Int; use System.Val_Int;
+with System.Val_LLI; use System.Val_LLI;
+with System.Val_LLLI; use System.Val_LLLI;
+
+package body Ada.Text_IO.Integer_IO is
+
+ package Aux_Int is new
+ Ada.Text_IO.Integer_Aux
+ (Integer,
+ Scan_Integer,
+ Set_Image_Integer,
+ Set_Image_Width_Integer,
+ Set_Image_Based_Integer);
+
+ package Aux_LLI is new
+ Ada.Text_IO.Integer_Aux
+ (Long_Long_Integer,
+ Scan_Long_Long_Integer,
+ Set_Image_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Integer);
+
+ package Aux_LLLI is new
+ Ada.Text_IO.Integer_Aux
+ (Long_Long_Long_Integer,
+ Scan_Long_Long_Long_Integer,
+ Set_Image_Long_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Long_Integer);
+
+ Need_LLI : constant Boolean := Num'Base'Size > Integer'Size;
+ Need_LLLI : constant Boolean := Num'Base'Size > Long_Long_Integer'Size;
+ -- Throughout this generic body, we distinguish between cases where type
+ -- Integer is acceptable, where type Long_Long_Integer is acceptable and
+ -- where type Long_Long_Long_Integer is needed. These boolean constants
+ -- are used to test for these cases and since they are constant, only code
+ -- for the relevant case will be included in the instance.
+
+ ---------
+ -- Get --
+ ---------
+
+ procedure Get
+ (File : File_Type;
+ Item : out Num;
+ Width : Field := 0)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Get (File, Long_Long_Long_Integer (Item), Width);
+ elsif Need_LLI then
+ Aux_LLI.Get (File, Long_Long_Integer (Item), Width);
+ else
+ Aux_Int.Get (File, Integer (Item), Width);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ procedure Get
+ (Item : out Num;
+ Width : Field := 0)
+ is
+ begin
+ Get (Current_In, Item, Width);
+ end Get;
+
+ procedure Get
+ (From : String;
+ Item : out Num;
+ Last : out Positive)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Gets (From, Long_Long_Long_Integer (Item), Last);
+ elsif Need_LLI then
+ Aux_LLI.Gets (From, Long_Long_Integer (Item), Last);
+ else
+ Aux_Int.Gets (From, Integer (Item), Last);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put
+ (File : File_Type;
+ Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Put (File, Long_Long_Long_Integer (Item), Width, Base);
+ elsif Need_LLI then
+ Aux_LLI.Put (File, Long_Long_Integer (Item), Width, Base);
+ else
+ Aux_Int.Put (File, Integer (Item), Width, Base);
+ end if;
+ end Put;
+
+ procedure Put
+ (Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ Put (Current_Out, Item, Width, Base);
+ end Put;
+
+ procedure Put
+ (To : out String;
+ Item : Num;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Puts (To, Long_Long_Long_Integer (Item), Base);
+ elsif Need_LLI then
+ Aux_LLI.Puts (To, Long_Long_Integer (Item), Base);
+ else
+ Aux_Int.Puts (To, Integer (Item), Base);
+ end if;
+ end Put;
+
+end Ada.Text_IO.Integer_IO;
diff --git a/gcc/ada/libgnat/a-timoau.adb b/gcc/ada/libgnat/a-timoau.adb
deleted file mode 100644
index 050b9c8..0000000
--- a/gcc/ada/libgnat/a-timoau.adb
+++ /dev/null
@@ -1,305 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- A D A . T E X T _ I O . M O D U L A R _ A U X --
--- --
--- B o d y --
--- --
--- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-with Ada.Text_IO.Generic_Aux; use Ada.Text_IO.Generic_Aux;
-
-with System.Img_BIU; use System.Img_BIU;
-with System.Img_Uns; use System.Img_Uns;
-with System.Img_LLB; use System.Img_LLB;
-with System.Img_LLU; use System.Img_LLU;
-with System.Img_LLW; use System.Img_LLW;
-with System.Img_WIU; use System.Img_WIU;
-with System.Val_Uns; use System.Val_Uns;
-with System.Val_LLU; use System.Val_LLU;
-
-package body Ada.Text_IO.Modular_Aux is
-
- use System.Unsigned_Types;
-
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Load_Modular
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural);
- -- This is an auxiliary routine that is used to load an possibly signed
- -- modular literal value from the input file into Buf, starting at Ptr + 1.
- -- Ptr is left set to the last character stored.
-
- -------------
- -- Get_LLU --
- -------------
-
- procedure Get_LLU
- (File : File_Type;
- Item : out Long_Long_Unsigned;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Stop : Integer := 0;
- Ptr : aliased Integer := 1;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Modular (File, Buf, Stop);
- end if;
-
- Item := Scan_Long_Long_Unsigned (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_LLU;
-
- -------------
- -- Get_Uns --
- -------------
-
- procedure Get_Uns
- (File : File_Type;
- Item : out Unsigned;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Stop : Integer := 0;
- Ptr : aliased Integer := 1;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Modular (File, Buf, Stop);
- end if;
-
- Item := Scan_Unsigned (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_Uns;
-
- --------------
- -- Gets_LLU --
- --------------
-
- procedure Gets_LLU
- (From : String;
- Item : out Long_Long_Unsigned;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Long_Long_Unsigned (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_LLU;
-
- --------------
- -- Gets_Uns --
- --------------
-
- procedure Gets_Uns
- (From : String;
- Item : out Unsigned;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Unsigned (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_Uns;
-
- ------------------
- -- Load_Modular --
- ------------------
-
- procedure Load_Modular
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural)
- is
- Hash_Loc : Natural;
- Loaded : Boolean;
-
- begin
- Load_Skip (File);
-
- -- Note: it is a bit strange to allow a minus sign here, but it seems
- -- consistent with the general behavior expected by the ACVC tests
- -- which is to scan past junk and then signal data error, see ACVC
- -- test CE3704F, case (6), which is for signed integer exponents,
- -- which seems a similar case.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr, Loaded);
-
- if Loaded then
-
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- Load (File, Buf, Ptr, '#', ':', Loaded);
-
- if Loaded then
- Hash_Loc := Ptr;
- Load_Extended_Digits (File, Buf, Ptr);
- Load (File, Buf, Ptr, Buf (Hash_Loc));
- end if;
-
- Load (File, Buf, Ptr, 'E', 'e', Loaded);
-
- if Loaded then
-
- -- Note: it is strange to allow a minus sign, since the syntax
- -- does not, but that is what ACVC test CE3704F, case (6) wants
- -- for the signed case, and there seems no good reason to treat
- -- exponents differently for the signed and unsigned cases.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr);
- end if;
- end if;
- end Load_Modular;
-
- -------------
- -- Put_LLU --
- -------------
-
- procedure Put_LLU
- (File : File_Type;
- Item : Long_Long_Unsigned;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Long_Long_Unsigned (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Long_Long_Unsigned (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Unsigned (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_LLU;
-
- -------------
- -- Put_Uns --
- -------------
-
- procedure Put_Uns
- (File : File_Type;
- Item : Unsigned;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Unsigned (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Unsigned (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Unsigned (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_Uns;
-
- --------------
- -- Puts_LLU --
- --------------
-
- procedure Puts_LLU
- (To : out String;
- Item : Long_Long_Unsigned;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Long_Long_Unsigned (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Unsigned (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_LLU;
-
- --------------
- -- Puts_Uns --
- --------------
-
- procedure Puts_Uns
- (To : out String;
- Item : Unsigned;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Unsigned (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Unsigned (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_Uns;
-
-end Ada.Text_IO.Modular_Aux;
diff --git a/gcc/ada/libgnat/a-timoio.adb b/gcc/ada/libgnat/a-timoio.adb
index 0cdeef1..83dbafa 100644
--- a/gcc/ada/libgnat/a-timoio.adb
+++ b/gcc/ada/libgnat/a-timoio.adb
@@ -29,13 +29,39 @@
-- --
------------------------------------------------------------------------------
-with Ada.Text_IO.Modular_Aux;
-
-with System.Unsigned_Types; use System.Unsigned_Types;
+with Ada.Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Uns; use System.Val_Uns;
+with System.Val_LLU; use System.Val_LLU;
package body Ada.Text_IO.Modular_IO is
- package Aux renames Ada.Text_IO.Modular_Aux;
+ package Aux_Uns is new
+ Ada.Text_IO.Integer_Aux
+ (Unsigned,
+ Scan_Unsigned,
+ Set_Image_Unsigned,
+ Set_Image_Width_Unsigned,
+ Set_Image_Based_Unsigned);
+
+ package Aux_LLU is new
+ Ada.Text_IO.Integer_Aux
+ (Long_Long_Unsigned,
+ Scan_Long_Long_Unsigned,
+ Set_Image_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Unsigned);
+
+ Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size;
+ -- Throughout this generic body, we distinguish between the case where type
+ -- Unsigned is acceptable, and where a Long_Long_Unsigned is needed. This
+ -- Boolean is used to test for these cases and since it is a constant, only
+ -- code for the relevant case will be included in the instance.
---------
-- Get --
@@ -46,13 +72,15 @@ package body Ada.Text_IO.Modular_IO is
Item : out Num;
Width : Field := 0)
is
+ -- We depend on a range check to get Data_Error
+
pragma Unsuppress (Range_Check);
begin
- if Num'Size > Unsigned'Size then
- Aux.Get_LLU (File, Long_Long_Unsigned (Item), Width);
+ if Need_LLU then
+ Aux_LLU.Get (File, Long_Long_Unsigned (Item), Width);
else
- Aux.Get_Uns (File, Unsigned (Item), Width);
+ Aux_Uns.Get (File, Unsigned (Item), Width);
end if;
exception
@@ -63,17 +91,8 @@ package body Ada.Text_IO.Modular_IO is
(Item : out Num;
Width : Field := 0)
is
- pragma Unsuppress (Range_Check);
-
begin
- if Num'Size > Unsigned'Size then
- Aux.Get_LLU (Current_In, Long_Long_Unsigned (Item), Width);
- else
- Aux.Get_Uns (Current_In, Unsigned (Item), Width);
- end if;
-
- exception
- when Constraint_Error => raise Data_Error;
+ Get (Current_In, Item, Width);
end Get;
procedure Get
@@ -81,13 +100,15 @@ package body Ada.Text_IO.Modular_IO is
Item : out Num;
Last : out Positive)
is
+ -- We depend on a range check to get Data_Error
+
pragma Unsuppress (Range_Check);
begin
- if Num'Size > Unsigned'Size then
- Aux.Gets_LLU (From, Long_Long_Unsigned (Item), Last);
+ if Need_LLU then
+ Aux_LLU.Gets (From, Long_Long_Unsigned (Item), Last);
else
- Aux.Gets_Uns (From, Unsigned (Item), Last);
+ Aux_Uns.Gets (From, Unsigned (Item), Last);
end if;
exception
@@ -105,10 +126,10 @@ package body Ada.Text_IO.Modular_IO is
Base : Number_Base := Default_Base)
is
begin
- if Num'Size > Unsigned'Size then
- Aux.Put_LLU (File, Long_Long_Unsigned (Item), Width, Base);
+ if Need_LLU then
+ Aux_LLU.Put (File, Long_Long_Unsigned (Item), Width, Base);
else
- Aux.Put_Uns (File, Unsigned (Item), Width, Base);
+ Aux_Uns.Put (File, Unsigned (Item), Width, Base);
end if;
end Put;
@@ -118,11 +139,7 @@ package body Ada.Text_IO.Modular_IO is
Base : Number_Base := Default_Base)
is
begin
- if Num'Size > Unsigned'Size then
- Aux.Put_LLU (Current_Out, Long_Long_Unsigned (Item), Width, Base);
- else
- Aux.Put_Uns (Current_Out, Unsigned (Item), Width, Base);
- end if;
+ Put (Current_Out, Item, Width, Base);
end Put;
procedure Put
@@ -131,10 +148,10 @@ package body Ada.Text_IO.Modular_IO is
Base : Number_Base := Default_Base)
is
begin
- if Num'Size > Unsigned'Size then
- Aux.Puts_LLU (To, Long_Long_Unsigned (Item), Base);
+ if Need_LLU then
+ Aux_LLU.Puts (To, Long_Long_Unsigned (Item), Base);
else
- Aux.Puts_Uns (To, Unsigned (Item), Base);
+ Aux_Uns.Puts (To, Unsigned (Item), Base);
end if;
end Put;
diff --git a/gcc/ada/libgnat/a-timoio__128.adb b/gcc/ada/libgnat/a-timoio__128.adb
new file mode 100644
index 0000000..45856e2
--- /dev/null
+++ b/gcc/ada/libgnat/a-timoio__128.adb
@@ -0,0 +1,180 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . T E X T _ I O . M O D U L A R _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_LLLB; use System.Img_LLLB;
+with System.Img_LLLU; use System.Img_LLLU;
+with System.Img_LLLW; use System.Img_LLLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Uns; use System.Val_Uns;
+with System.Val_LLU; use System.Val_LLU;
+with System.Val_LLLU; use System.Val_LLLU;
+
+package body Ada.Text_IO.Modular_IO is
+
+ package Aux_Uns is new
+ Ada.Text_IO.Integer_Aux
+ (Unsigned,
+ Scan_Unsigned,
+ Set_Image_Unsigned,
+ Set_Image_Width_Unsigned,
+ Set_Image_Based_Unsigned);
+
+ package Aux_LLU is new
+ Ada.Text_IO.Integer_Aux
+ (Long_Long_Unsigned,
+ Scan_Long_Long_Unsigned,
+ Set_Image_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Unsigned);
+
+ package Aux_LLLU is new
+ Ada.Text_IO.Integer_Aux
+ (Long_Long_Long_Unsigned,
+ Scan_Long_Long_Long_Unsigned,
+ Set_Image_Long_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Long_Unsigned);
+
+ Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size;
+ Need_LLLU : constant Boolean := Num'Base'Size > Long_Long_Unsigned'Size;
+ -- Throughout this generic body, we distinguish between cases where type
+ -- Unsigned is acceptable, where type Long_Long_Unsigned is acceptable and
+ -- where type Long_Long_Long_Unsigned is needed. These boolean constants
+ -- are used to test for these cases and since they are constant, only code
+ -- for the relevant case will be included in the instance.
+
+ ---------
+ -- Get --
+ ---------
+
+ procedure Get
+ (File : File_Type;
+ Item : out Num;
+ Width : Field := 0)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Get (File, Long_Long_Long_Unsigned (Item), Width);
+ elsif Need_LLU then
+ Aux_LLU.Get (File, Long_Long_Unsigned (Item), Width);
+ else
+ Aux_Uns.Get (File, Unsigned (Item), Width);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ procedure Get
+ (Item : out Num;
+ Width : Field := 0)
+ is
+ begin
+ Get (Current_In, Item, Width);
+ end Get;
+
+ procedure Get
+ (From : String;
+ Item : out Num;
+ Last : out Positive)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Gets (From, Long_Long_Long_Unsigned (Item), Last);
+ elsif Need_LLU then
+ Aux_LLU.Gets (From, Long_Long_Unsigned (Item), Last);
+ else
+ Aux_Uns.Gets (From, Unsigned (Item), Last);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put
+ (File : File_Type;
+ Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Put (File, Long_Long_Long_Unsigned (Item), Width, Base);
+ elsif Need_LLU then
+ Aux_LLU.Put (File, Long_Long_Unsigned (Item), Width, Base);
+ else
+ Aux_Uns.Put (File, Unsigned (Item), Width, Base);
+ end if;
+ end Put;
+
+ procedure Put
+ (Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ Put (Current_Out, Item, Width, Base);
+ end Put;
+
+ procedure Put
+ (To : out String;
+ Item : Num;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Puts (To, Long_Long_Long_Unsigned (Item), Base);
+ elsif Need_LLU then
+ Aux_LLU.Puts (To, Long_Long_Unsigned (Item), Base);
+ else
+ Aux_Uns.Puts (To, Unsigned (Item), Base);
+ end if;
+ end Put;
+
+end Ada.Text_IO.Modular_IO;
diff --git a/gcc/ada/libgnat/a-wtgeau.adb b/gcc/ada/libgnat/a-wtgeau.adb
index 45eef92..9d24070 100644
--- a/gcc/ada/libgnat/a-wtgeau.adb
+++ b/gcc/ada/libgnat/a-wtgeau.adb
@@ -348,6 +348,60 @@ package body Ada.Wide_Text_IO.Generic_Aux is
Load_Extended_Digits (File, Buf, Ptr, Junk);
end Load_Extended_Digits;
+ ------------------
+ -- Load_Integer --
+ ------------------
+
+ procedure Load_Integer
+ (File : File_Type;
+ Buf : out String;
+ Ptr : in out Natural)
+ is
+ Hash_Loc : Natural;
+ Loaded : Boolean;
+
+ begin
+ Load_Skip (File);
+
+ -- Note: it is a bit strange to allow a minus sign here, but it seems
+ -- consistent with the general behavior expected by the ACVC tests
+ -- which is to scan past junk and then signal data error, see ACVC
+ -- test CE3704F, case (6), which is for signed integer exponents,
+ -- which seems a similar case.
+
+ Load (File, Buf, Ptr, '+', '-');
+ Load_Digits (File, Buf, Ptr, Loaded);
+
+ if Loaded then
+
+ -- Deal with based literal. We recognize either the standard '#' or
+ -- the allowed alternative replacement ':' (see RM J.2(3)).
+
+ Load (File, Buf, Ptr, '#', ':', Loaded);
+
+ if Loaded then
+ Hash_Loc := Ptr;
+ Load_Extended_Digits (File, Buf, Ptr);
+ Load (File, Buf, Ptr, Buf (Hash_Loc));
+ end if;
+
+ -- Deal with exponent
+
+ Load (File, Buf, Ptr, 'E', 'e', Loaded);
+
+ if Loaded then
+
+ -- Note: it is strange to allow a minus sign, since the syntax
+ -- does not, but that is what ACVC test CE3704F, case (6) wants
+ -- for the signed case, and there seems no good reason to treat
+ -- exponents differently for the signed and unsigned cases.
+
+ Load (File, Buf, Ptr, '+', '-');
+ Load_Digits (File, Buf, Ptr);
+ end if;
+ end if;
+ end Load_Integer;
+
---------------
-- Load_Skip --
---------------
diff --git a/gcc/ada/libgnat/a-wtgeau.ads b/gcc/ada/libgnat/a-wtgeau.ads
index ba8509b..9577ac2 100644
--- a/gcc/ada/libgnat/a-wtgeau.ads
+++ b/gcc/ada/libgnat/a-wtgeau.ads
@@ -149,6 +149,12 @@ package Ada.Wide_Text_IO.Generic_Aux is
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
+ procedure Load_Integer
+ (File : File_Type;
+ Buf : out String;
+ Ptr : in out Natural);
+ -- Loads a possibly signed integer literal value
+
procedure Put_Item (File : File_Type; Str : String);
-- This routine is like Wide_Text_IO.Put, except that it checks for
-- overflow of bounded lines, as described in (RM A.10.6(8)). It is used
@@ -169,7 +175,7 @@ package Ada.Wide_Text_IO.Generic_Aux is
procedure String_Skip (Str : String; Ptr : out Integer);
-- Used in the Get from string procedures to skip leading blanks in the
-- string. Ptr is set to the index of the first non-blank. If the string
- -- is all blanks, then the excption End_Error is raised, Note that blank
+ -- is all blanks, then the exception End_Error is raised, Note that blank
-- is defined as a space or horizontal tab (RM A.10.6(5)).
procedure Ungetc (ch : Integer; File : File_Type);
diff --git a/gcc/ada/libgnat/a-wtinau.adb b/gcc/ada/libgnat/a-wtinau.adb
index 53e8163..b614b39 100644
--- a/gcc/ada/libgnat/a-wtinau.adb
+++ b/gcc/ada/libgnat/a-wtinau.adb
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . W I D E _ T E X T _ I O . I N T E G E R _ A U X --
+-- A D A . W I D E _ T E X T _ I O . I N T E G E R _ A U X --
-- --
-- B o d y --
-- --
@@ -31,61 +31,15 @@
with Ada.Wide_Text_IO.Generic_Aux; use Ada.Wide_Text_IO.Generic_Aux;
-with System.Img_BIU; use System.Img_BIU;
-with System.Img_Int; use System.Img_Int;
-with System.Img_LLB; use System.Img_LLB;
-with System.Img_LLI; use System.Img_LLI;
-with System.Img_LLW; use System.Img_LLW;
-with System.Img_WIU; use System.Img_WIU;
-with System.Val_Int; use System.Val_Int;
-with System.Val_LLI; use System.Val_LLI;
-
package body Ada.Wide_Text_IO.Integer_Aux is
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Load_Integer
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural);
- -- This is an auxiliary routine that is used to load an possibly signed
- -- integer literal value from the input file into Buf, starting at Ptr + 1.
- -- On return, Ptr is set to the last character stored.
-
- -------------
- -- Get_Int --
- -------------
-
- procedure Get_Int
- (File : File_Type;
- Item : out Integer;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Ptr : aliased Integer := 1;
- Stop : Integer := 0;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Integer (File, Buf, Stop);
- end if;
-
- Item := Scan_Integer (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_Int;
-
- -------------
- -- Get_LLI --
- -------------
+ ---------
+ -- Get --
+ ---------
- procedure Get_LLI
+ procedure Get
(File : File_Type;
- Item : out Long_Long_Integer;
+ Item : out Num;
Width : Field)
is
Buf : String (1 .. Field'Last);
@@ -100,189 +54,73 @@ package body Ada.Wide_Text_IO.Integer_Aux is
Load_Integer (File, Buf, Stop);
end if;
- Item := Scan_Long_Long_Integer (Buf, Ptr'Access, Stop);
+ Item := Scan (Buf, Ptr'Access, Stop);
Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_LLI;
+ end Get;
- --------------
- -- Gets_Int --
- --------------
+ ----------
+ -- Gets --
+ ----------
- procedure Gets_Int
+ procedure Gets
(From : String;
- Item : out Integer;
+ Item : out Num;
Last : out Positive)
is
Pos : aliased Integer;
begin
String_Skip (From, Pos);
- Item := Scan_Integer (From, Pos'Access, From'Last);
+ Item := Scan (From, Pos'Access, From'Last);
Last := Pos - 1;
exception
when Constraint_Error =>
raise Data_Error;
- end Gets_Int;
-
- --------------
- -- Gets_LLI --
- --------------
-
- procedure Gets_LLI
- (From : String;
- Item : out Long_Long_Integer;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Long_Long_Integer (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_LLI;
-
- ------------------
- -- Load_Integer --
- ------------------
-
- procedure Load_Integer
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural)
- is
- Hash_Loc : Natural;
- Loaded : Boolean;
-
- begin
- Load_Skip (File);
- Load (File, Buf, Ptr, '+', '-');
-
- Load_Digits (File, Buf, Ptr, Loaded);
+ end Gets;
- if Loaded then
+ ---------
+ -- Put --
+ ---------
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- Load (File, Buf, Ptr, '#', ':', Loaded);
-
- if Loaded then
- Hash_Loc := Ptr;
- Load_Extended_Digits (File, Buf, Ptr);
- Load (File, Buf, Ptr, Buf (Hash_Loc));
- end if;
-
- Load (File, Buf, Ptr, 'E', 'e', Loaded);
-
- if Loaded then
-
- -- Note: it is strange to allow a minus sign, since the syntax
- -- does not, but that is what ACVC test CE3704F, case (6) wants.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr);
- end if;
- end if;
- end Load_Integer;
-
- -------------
- -- Put_Int --
- -------------
-
- procedure Put_Int
+ procedure Put
(File : File_Type;
- Item : Integer;
+ Item : Num;
Width : Field;
Base : Number_Base)
is
- Buf : String (1 .. Field'Last);
+ Buf : String (1 .. Integer'Max (Field'Last, Width));
Ptr : Natural := 0;
begin
if Base = 10 and then Width = 0 then
- Set_Image_Integer (Item, Buf, Ptr);
+ Set_Image (Item, Buf, Ptr);
elsif Base = 10 then
- Set_Image_Width_Integer (Item, Width, Buf, Ptr);
+ Set_Image_Width (Item, Width, Buf, Ptr);
else
- Set_Image_Based_Integer (Item, Base, Width, Buf, Ptr);
+ Set_Image_Based (Item, Base, Width, Buf, Ptr);
end if;
Put_Item (File, Buf (1 .. Ptr));
- end Put_Int;
-
- -------------
- -- Put_LLI --
- -------------
-
- procedure Put_LLI
- (File : File_Type;
- Item : Long_Long_Integer;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Long_Long_Integer (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Long_Long_Integer (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Integer (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_LLI;
-
- --------------
- -- Puts_Int --
- --------------
-
- procedure Puts_Int
- (To : out String;
- Item : Integer;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Integer (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Integer (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_Int;
+ end Put;
- --------------
- -- Puts_LLI --
- --------------
+ ----------
+ -- Puts --
+ ----------
- procedure Puts_LLI
+ procedure Puts
(To : out String;
- Item : Long_Long_Integer;
+ Item : Num;
Base : Number_Base)
is
- Buf : String (1 .. Field'Last);
+ Buf : String (1 .. Integer'Max (Field'Last, To'Length));
Ptr : Natural := 0;
begin
if Base = 10 then
- Set_Image_Width_Long_Long_Integer (Item, To'Length, Buf, Ptr);
+ Set_Image_Width (Item, To'Length, Buf, Ptr);
else
- Set_Image_Based_Long_Long_Integer (Item, Base, To'Length, Buf, Ptr);
+ Set_Image_Based (Item, Base, To'Length, Buf, Ptr);
end if;
if Ptr > To'Length then
@@ -290,6 +128,6 @@ package body Ada.Wide_Text_IO.Integer_Aux is
else
To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
end if;
- end Puts_LLI;
+ end Puts;
end Ada.Wide_Text_IO.Integer_Aux;
diff --git a/gcc/ada/libgnat/a-wtinau.ads b/gcc/ada/libgnat/a-wtinau.ads
index 691a877..f139f77 100644
--- a/gcc/ada/libgnat/a-wtinau.ads
+++ b/gcc/ada/libgnat/a-wtinau.ads
@@ -29,55 +29,45 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines for Ada.Wide_Text_IO.Integer_IO that
--- are shared among separate instantiations of this package. The routines
--- in this package are identical semantically to those in Integer_IO itself,
--- except that the generic parameter Num has been replaced by Integer or
--- Long_Long_Integer, and the default parameters have been removed because
--- they are supplied explicitly by the calls from within the generic template.
+-- This package contains the implementation for Ada.Wide_Text_IO.Integer_IO
+-- and Ada.Wide_Text_IO.Modular_IO. The routines in this package are identical
+-- semantically to those in Integer_IO and Modular_IO themselves, except that
+-- the default parameters have been removed because they are supplied
+-- explicitly by the calls from within these units.
-private package Ada.Wide_Text_IO.Integer_Aux is
+private generic
+ type Num is (<>);
- procedure Get_Int
- (File : File_Type;
- Item : out Integer;
- Width : Field);
+ with function Scan
+ (Str : String; Ptr : not null access Integer; Max : Integer) return Num;
+ with procedure Set_Image
+ (V : Num; S : in out String; P : in out Natural);
+ with procedure Set_Image_Width
+ (V : Num; W : Integer; S : out String; P : in out Natural);
+ with procedure Set_Image_Based
+ (V : Num; B : Natural; W : Integer; S : out String; P : in out Natural);
- procedure Get_LLI
+package Ada.Wide_Text_IO.Integer_Aux is
+
+ procedure Get
(File : File_Type;
- Item : out Long_Long_Integer;
+ Item : out Num;
Width : Field);
- procedure Gets_Int
+ procedure Gets
(From : String;
- Item : out Integer;
+ Item : out Num;
Last : out Positive);
- procedure Gets_LLI
- (From : String;
- Item : out Long_Long_Integer;
- Last : out Positive);
-
- procedure Put_Int
+ procedure Put
(File : File_Type;
- Item : Integer;
+ Item : Num;
Width : Field;
Base : Number_Base);
- procedure Put_LLI
- (File : File_Type;
- Item : Long_Long_Integer;
- Width : Field;
- Base : Number_Base);
-
- procedure Puts_Int
- (To : out String;
- Item : Integer;
- Base : Number_Base);
-
- procedure Puts_LLI
+ procedure Puts
(To : out String;
- Item : Long_Long_Integer;
+ Item : Num;
Base : Number_Base);
end Ada.Wide_Text_IO.Integer_Aux;
diff --git a/gcc/ada/libgnat/a-wtinio.adb b/gcc/ada/libgnat/a-wtinio.adb
index bc03227..a3f666e 100644
--- a/gcc/ada/libgnat/a-wtinio.adb
+++ b/gcc/ada/libgnat/a-wtinio.adb
@@ -30,11 +30,35 @@
------------------------------------------------------------------------------
with Ada.Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Int; use System.Img_Int;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLI; use System.Img_LLI;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Int; use System.Val_Int;
+with System.Val_LLI; use System.Val_LLI;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.WCh_WtS;
package body Ada.Wide_Text_IO.Integer_IO is
+ package Aux_Int is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Integer,
+ Scan_Integer,
+ Set_Image_Integer,
+ Set_Image_Width_Integer,
+ Set_Image_Based_Integer);
+
+ package Aux_LLI is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Long_Long_Integer,
+ Scan_Long_Long_Integer,
+ Set_Image_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Integer);
+
Need_LLI : constant Boolean := Num'Base'Size > Integer'Size;
-- Throughout this generic body, we distinguish between the case where type
-- Integer is acceptable, and where a Long_Long_Integer is needed. This
@@ -44,8 +68,6 @@ package body Ada.Wide_Text_IO.Integer_IO is
subtype TFT is Ada.Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
- package Aux renames Ada.Wide_Text_IO.Integer_Aux;
-
---------
-- Get --
---------
@@ -55,11 +77,16 @@ package body Ada.Wide_Text_IO.Integer_IO is
Item : out Num;
Width : Field := 0)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
begin
if Need_LLI then
- Aux.Get_LLI (TFT (File), Long_Long_Integer (Item), Width);
+ Aux_LLI.Get (TFT (File), Long_Long_Integer (Item), Width);
else
- Aux.Get_Int (TFT (File), Integer (Item), Width);
+ Aux_Int.Get (TFT (File), Integer (Item), Width);
end if;
exception
@@ -79,6 +106,11 @@ package body Ada.Wide_Text_IO.Integer_IO is
Item : out Num;
Last : out Positive)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
S : constant String := Wide_String_To_String (From, WCEM_Upper);
-- String on which we do the actual conversion. Note that the method
-- used for wide character encoding is irrelevant, since if there is
@@ -87,9 +119,9 @@ package body Ada.Wide_Text_IO.Integer_IO is
begin
if Need_LLI then
- Aux.Gets_LLI (S, Long_Long_Integer (Item), Last);
+ Aux_LLI.Gets (S, Long_Long_Integer (Item), Last);
else
- Aux.Gets_Int (S, Integer (Item), Last);
+ Aux_Int.Gets (S, Integer (Item), Last);
end if;
exception
@@ -108,9 +140,9 @@ package body Ada.Wide_Text_IO.Integer_IO is
is
begin
if Need_LLI then
- Aux.Put_LLI (TFT (File), Long_Long_Integer (Item), Width, Base);
+ Aux_LLI.Put (TFT (File), Long_Long_Integer (Item), Width, Base);
else
- Aux.Put_Int (TFT (File), Integer (Item), Width, Base);
+ Aux_Int.Put (TFT (File), Integer (Item), Width, Base);
end if;
end Put;
@@ -132,9 +164,9 @@ package body Ada.Wide_Text_IO.Integer_IO is
begin
if Need_LLI then
- Aux.Puts_LLI (S, Long_Long_Integer (Item), Base);
+ Aux_LLI.Puts (S, Long_Long_Integer (Item), Base);
else
- Aux.Puts_Int (S, Integer (Item), Base);
+ Aux_Int.Puts (S, Integer (Item), Base);
end if;
for J in S'Range loop
diff --git a/gcc/ada/libgnat/a-wtinio__128.adb b/gcc/ada/libgnat/a-wtinio__128.adb
new file mode 100644
index 0000000..edc78c3
--- /dev/null
+++ b/gcc/ada/libgnat/a-wtinio__128.adb
@@ -0,0 +1,199 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . W I D E _ T E X T _ I O . I N T E G E R _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Int; use System.Img_Int;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLI; use System.Img_LLI;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_LLLB; use System.Img_LLLB;
+with System.Img_LLLI; use System.Img_LLLI;
+with System.Img_LLLW; use System.Img_LLLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Int; use System.Val_Int;
+with System.Val_LLI; use System.Val_LLI;
+with System.Val_LLLI; use System.Val_LLLI;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_WtS; use System.WCh_WtS;
+
+package body Ada.Wide_Text_IO.Integer_IO is
+
+ package Aux_Int is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Integer,
+ Scan_Integer,
+ Set_Image_Integer,
+ Set_Image_Width_Integer,
+ Set_Image_Based_Integer);
+
+ package Aux_LLI is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Long_Long_Integer,
+ Scan_Long_Long_Integer,
+ Set_Image_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Integer);
+
+ package Aux_LLLI is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Long_Long_Long_Integer,
+ Scan_Long_Long_Long_Integer,
+ Set_Image_Long_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Long_Integer);
+
+ Need_LLI : constant Boolean := Num'Base'Size > Integer'Size;
+ Need_LLLI : constant Boolean := Num'Base'Size > Long_Long_Integer'Size;
+ -- Throughout this generic body, we distinguish between cases where type
+ -- Integer is acceptable, where type Long_Long_Integer is acceptable and
+ -- where type Long_Long_Long_Integer is needed. These boolean constants
+ -- are used to test for these cases and since they are constant, only code
+ -- for the relevant case will be included in the instance.
+
+ subtype TFT is Ada.Wide_Text_IO.File_Type;
+ -- File type required for calls to routines in Aux
+
+ ---------
+ -- Get --
+ ---------
+
+ procedure Get
+ (File : File_Type;
+ Item : out Num;
+ Width : Field := 0)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Get (TFT (File), Long_Long_Long_Integer (Item), Width);
+ elsif Need_LLI then
+ Aux_LLI.Get (TFT (File), Long_Long_Integer (Item), Width);
+ else
+ Aux_Int.Get (TFT (File), Integer (Item), Width);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ procedure Get
+ (Item : out Num;
+ Width : Field := 0)
+ is
+ begin
+ Get (Current_Input, Item, Width);
+ end Get;
+
+ procedure Get
+ (From : Wide_String;
+ Item : out Num;
+ Last : out Positive)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
+ S : constant String := Wide_String_To_String (From, WCEM_Upper);
+ -- String on which we do the actual conversion. Note that the method
+ -- used for wide character encoding is irrelevant, since if there is
+ -- a character outside the Standard.Character range then the call to
+ -- Aux.Gets will raise Data_Error in any case.
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Gets (S, Long_Long_Long_Integer (Item), Last);
+ elsif Need_LLI then
+ Aux_LLI.Gets (S, Long_Long_Integer (Item), Last);
+ else
+ Aux_Int.Gets (S, Integer (Item), Last);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put
+ (File : File_Type;
+ Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Put (TFT (File), Long_Long_Long_Integer (Item), Width, Base);
+ elsif Need_LLI then
+ Aux_LLI.Put (TFT (File), Long_Long_Integer (Item), Width, Base);
+ else
+ Aux_Int.Put (TFT (File), Integer (Item), Width, Base);
+ end if;
+ end Put;
+
+ procedure Put
+ (Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ Put (Current_Output, Item, Width, Base);
+ end Put;
+
+ procedure Put
+ (To : out Wide_String;
+ Item : Num;
+ Base : Number_Base := Default_Base)
+ is
+ S : String (To'First .. To'Last);
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Puts (S, Long_Long_Long_Integer (Item), Base);
+ elsif Need_LLI then
+ Aux_LLI.Puts (S, Long_Long_Integer (Item), Base);
+ else
+ Aux_Int.Puts (S, Integer (Item), Base);
+ end if;
+
+ for J in S'Range loop
+ To (J) := Wide_Character'Val (Character'Pos (S (J)));
+ end loop;
+ end Put;
+
+end Ada.Wide_Text_IO.Integer_IO;
diff --git a/gcc/ada/libgnat/a-wtmoau.adb b/gcc/ada/libgnat/a-wtmoau.adb
deleted file mode 100644
index 9039798..0000000
--- a/gcc/ada/libgnat/a-wtmoau.adb
+++ /dev/null
@@ -1,305 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- A D A . W I D E _ T E X T _ I O . M O D U L A R _ A U X --
--- --
--- B o d y --
--- --
--- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-with Ada.Wide_Text_IO.Generic_Aux; use Ada.Wide_Text_IO.Generic_Aux;
-
-with System.Img_BIU; use System.Img_BIU;
-with System.Img_Uns; use System.Img_Uns;
-with System.Img_LLB; use System.Img_LLB;
-with System.Img_LLU; use System.Img_LLU;
-with System.Img_LLW; use System.Img_LLW;
-with System.Img_WIU; use System.Img_WIU;
-with System.Val_Uns; use System.Val_Uns;
-with System.Val_LLU; use System.Val_LLU;
-
-package body Ada.Wide_Text_IO.Modular_Aux is
-
- use System.Unsigned_Types;
-
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Load_Modular
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural);
- -- This is an auxiliary routine that is used to load an possibly signed
- -- modular literal value from the input file into Buf, starting at Ptr + 1.
- -- Ptr is left set to the last character stored.
-
- -------------
- -- Get_LLU --
- -------------
-
- procedure Get_LLU
- (File : File_Type;
- Item : out Long_Long_Unsigned;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Stop : Integer := 0;
- Ptr : aliased Integer := 1;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Modular (File, Buf, Stop);
- end if;
-
- Item := Scan_Long_Long_Unsigned (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_LLU;
-
- -------------
- -- Get_Uns --
- -------------
-
- procedure Get_Uns
- (File : File_Type;
- Item : out Unsigned;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Stop : Integer := 0;
- Ptr : aliased Integer := 1;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Modular (File, Buf, Stop);
- end if;
-
- Item := Scan_Unsigned (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_Uns;
-
- --------------
- -- Gets_LLU --
- --------------
-
- procedure Gets_LLU
- (From : String;
- Item : out Long_Long_Unsigned;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Long_Long_Unsigned (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_LLU;
-
- --------------
- -- Gets_Uns --
- --------------
-
- procedure Gets_Uns
- (From : String;
- Item : out Unsigned;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Unsigned (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_Uns;
-
- ------------------
- -- Load_Modular --
- ------------------
-
- procedure Load_Modular
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural)
- is
- Hash_Loc : Natural;
- Loaded : Boolean;
-
- begin
- Load_Skip (File);
-
- -- Note: it is a bit strange to allow a minus sign here, but it seems
- -- consistent with the general behavior expected by the ACVC tests
- -- which is to scan past junk and then signal data error, see ACVC
- -- test CE3704F, case (6), which is for signed integer exponents,
- -- which seems a similar case.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr, Loaded);
-
- if Loaded then
-
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- Load (File, Buf, Ptr, '#', ':', Loaded);
-
- if Loaded then
- Hash_Loc := Ptr;
- Load_Extended_Digits (File, Buf, Ptr);
- Load (File, Buf, Ptr, Buf (Hash_Loc));
- end if;
-
- Load (File, Buf, Ptr, 'E', 'e', Loaded);
-
- if Loaded then
-
- -- Note: it is strange to allow a minus sign, since the syntax
- -- does not, but that is what ACVC test CE3704F, case (6) wants
- -- for the signed case, and there seems no good reason to treat
- -- exponents differently for the signed and unsigned cases.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr);
- end if;
- end if;
- end Load_Modular;
-
- -------------
- -- Put_LLU --
- -------------
-
- procedure Put_LLU
- (File : File_Type;
- Item : Long_Long_Unsigned;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Long_Long_Unsigned (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Long_Long_Unsigned (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Unsigned (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_LLU;
-
- -------------
- -- Put_Uns --
- -------------
-
- procedure Put_Uns
- (File : File_Type;
- Item : Unsigned;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Unsigned (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Unsigned (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Unsigned (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_Uns;
-
- --------------
- -- Puts_LLU --
- --------------
-
- procedure Puts_LLU
- (To : out String;
- Item : Long_Long_Unsigned;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Long_Long_Unsigned (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Unsigned (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_LLU;
-
- --------------
- -- Puts_Uns --
- --------------
-
- procedure Puts_Uns
- (To : out String;
- Item : Unsigned;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Unsigned (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Unsigned (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_Uns;
-
-end Ada.Wide_Text_IO.Modular_Aux;
diff --git a/gcc/ada/libgnat/a-wtmoio.adb b/gcc/ada/libgnat/a-wtmoio.adb
index 629f95d..702dcbb 100644
--- a/gcc/ada/libgnat/a-wtmoio.adb
+++ b/gcc/ada/libgnat/a-wtmoio.adb
@@ -29,19 +29,45 @@
-- --
------------------------------------------------------------------------------
-with Ada.Wide_Text_IO.Modular_Aux;
-
-with System.Unsigned_Types; use System.Unsigned_Types;
-with System.WCh_Con; use System.WCh_Con;
-with System.WCh_WtS; use System.WCh_WtS;
+with Ada.Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Uns; use System.Val_Uns;
+with System.Val_LLU; use System.Val_LLU;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_WtS; use System.WCh_WtS;
package body Ada.Wide_Text_IO.Modular_IO is
+ package Aux_Uns is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Unsigned,
+ Scan_Unsigned,
+ Set_Image_Unsigned,
+ Set_Image_Width_Unsigned,
+ Set_Image_Based_Unsigned);
+
+ package Aux_LLU is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Long_Long_Unsigned,
+ Scan_Long_Long_Unsigned,
+ Set_Image_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Unsigned);
+
+ Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size;
+ -- Throughout this generic body, we distinguish between the case where type
+ -- Unsigned is acceptable, and where a Long_Long_Unsigned is needed. This
+ -- Boolean is used to test for these cases and since it is a constant, only
+ -- code for the relevant case will be included in the instance.
+
subtype TFT is Ada.Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
- package Aux renames Ada.Wide_Text_IO.Modular_Aux;
-
---------
-- Get --
---------
@@ -51,11 +77,15 @@ package body Ada.Wide_Text_IO.Modular_IO is
Item : out Num;
Width : Field := 0)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
begin
- if Num'Size > Unsigned'Size then
- Aux.Get_LLU (TFT (File), Long_Long_Unsigned (Item), Width);
+ if Need_LLU then
+ Aux_LLU.Get (TFT (File), Long_Long_Unsigned (Item), Width);
else
- Aux.Get_Uns (TFT (File), Unsigned (Item), Width);
+ Aux_Uns.Get (TFT (File), Unsigned (Item), Width);
end if;
exception
@@ -75,6 +105,10 @@ package body Ada.Wide_Text_IO.Modular_IO is
Item : out Num;
Last : out Positive)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
S : constant String := Wide_String_To_String (From, WCEM_Upper);
-- String on which we do the actual conversion. Note that the method
-- used for wide character encoding is irrelevant, since if there is
@@ -82,10 +116,10 @@ package body Ada.Wide_Text_IO.Modular_IO is
-- Aux.Gets will raise Data_Error in any case.
begin
- if Num'Size > Unsigned'Size then
- Aux.Gets_LLU (S, Long_Long_Unsigned (Item), Last);
+ if Need_LLU then
+ Aux_LLU.Gets (S, Long_Long_Unsigned (Item), Last);
else
- Aux.Gets_Uns (S, Unsigned (Item), Last);
+ Aux_Uns.Gets (S, Unsigned (Item), Last);
end if;
exception
@@ -103,10 +137,10 @@ package body Ada.Wide_Text_IO.Modular_IO is
Base : Number_Base := Default_Base)
is
begin
- if Num'Size > Unsigned'Size then
- Aux.Put_LLU (TFT (File), Long_Long_Unsigned (Item), Width, Base);
+ if Need_LLU then
+ Aux_LLU.Put (TFT (File), Long_Long_Unsigned (Item), Width, Base);
else
- Aux.Put_Uns (TFT (File), Unsigned (Item), Width, Base);
+ Aux_Uns.Put (TFT (File), Unsigned (Item), Width, Base);
end if;
end Put;
@@ -127,10 +161,10 @@ package body Ada.Wide_Text_IO.Modular_IO is
S : String (To'First .. To'Last);
begin
- if Num'Size > Unsigned'Size then
- Aux.Puts_LLU (S, Long_Long_Unsigned (Item), Base);
+ if Need_LLU then
+ Aux_LLU.Puts (S, Long_Long_Unsigned (Item), Base);
else
- Aux.Puts_Uns (S, Unsigned (Item), Base);
+ Aux_Uns.Puts (S, Unsigned (Item), Base);
end if;
for J in S'Range loop
diff --git a/gcc/ada/libgnat/a-wtmoio__128.adb b/gcc/ada/libgnat/a-wtmoio__128.adb
new file mode 100644
index 0000000..661faec
--- /dev/null
+++ b/gcc/ada/libgnat/a-wtmoio__128.adb
@@ -0,0 +1,197 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . W I D E _ T E X T _ I O . M O D U L A R _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_LLLB; use System.Img_LLLB;
+with System.Img_LLLU; use System.Img_LLLU;
+with System.Img_LLLW; use System.Img_LLLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Uns; use System.Val_Uns;
+with System.Val_LLU; use System.Val_LLU;
+with System.Val_LLLU; use System.Val_LLLU;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_WtS; use System.WCh_WtS;
+
+package body Ada.Wide_Text_IO.Modular_IO is
+
+ package Aux_Uns is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Unsigned,
+ Scan_Unsigned,
+ Set_Image_Unsigned,
+ Set_Image_Width_Unsigned,
+ Set_Image_Based_Unsigned);
+
+ package Aux_LLU is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Long_Long_Unsigned,
+ Scan_Long_Long_Unsigned,
+ Set_Image_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Unsigned);
+
+ package Aux_LLLU is new
+ Ada.Wide_Text_IO.Integer_Aux
+ (Long_Long_Long_Unsigned,
+ Scan_Long_Long_Long_Unsigned,
+ Set_Image_Long_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Long_Unsigned);
+
+ Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size;
+ Need_LLLU : constant Boolean := Num'Base'Size > Long_Long_Unsigned'Size;
+ -- Throughout this generic body, we distinguish between cases where type
+ -- Unsigned is acceptable, where type Long_Long_Unsigned is acceptable and
+ -- where type Long_Long_Long_Unsigned is needed. These boolean constants
+ -- are used to test for these cases and since they are constant, only code
+ -- for the relevant case will be included in the instance.
+
+ subtype TFT is Ada.Wide_Text_IO.File_Type;
+ -- File type required for calls to routines in Aux
+
+ ---------
+ -- Get --
+ ---------
+
+ procedure Get
+ (File : File_Type;
+ Item : out Num;
+ Width : Field := 0)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Get (File, Long_Long_Long_Unsigned (Item), Width);
+ elsif Need_LLU then
+ Aux_LLU.Get (TFT (File), Long_Long_Unsigned (Item), Width);
+ else
+ Aux_Uns.Get (TFT (File), Unsigned (Item), Width);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ procedure Get
+ (Item : out Num;
+ Width : Field := 0)
+ is
+ begin
+ Get (Current_Input, Item, Width);
+ end Get;
+
+ procedure Get
+ (From : Wide_String;
+ Item : out Num;
+ Last : out Positive)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
+ S : constant String := Wide_String_To_String (From, WCEM_Upper);
+ -- String on which we do the actual conversion. Note that the method
+ -- used for wide character encoding is irrelevant, since if there is
+ -- a character outside the Standard.Character range then the call to
+ -- Aux.Gets will raise Data_Error in any case.
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Gets (S, Long_Long_Long_Unsigned (Item), Last);
+ elsif Need_LLU then
+ Aux_LLU.Gets (S, Long_Long_Unsigned (Item), Last);
+ else
+ Aux_Uns.Gets (S, Unsigned (Item), Last);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put
+ (File : File_Type;
+ Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Put (File, Long_Long_Long_Unsigned (Item), Width, Base);
+ elsif Need_LLU then
+ Aux_LLU.Put (TFT (File), Long_Long_Unsigned (Item), Width, Base);
+ else
+ Aux_Uns.Put (TFT (File), Unsigned (Item), Width, Base);
+ end if;
+ end Put;
+
+ procedure Put
+ (Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ Put (Current_Output, Item, Width, Base);
+ end Put;
+
+ procedure Put
+ (To : out Wide_String;
+ Item : Num;
+ Base : Number_Base := Default_Base)
+ is
+ S : String (To'First .. To'Last);
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Puts (S, Long_Long_Long_Unsigned (Item), Base);
+ elsif Need_LLU then
+ Aux_LLU.Puts (S, Long_Long_Unsigned (Item), Base);
+ else
+ Aux_Uns.Puts (S, Unsigned (Item), Base);
+ end if;
+
+ for J in S'Range loop
+ To (J) := Wide_Character'Val (Character'Pos (S (J)));
+ end loop;
+ end Put;
+
+end Ada.Wide_Text_IO.Modular_IO;
diff --git a/gcc/ada/libgnat/a-ztgeau.adb b/gcc/ada/libgnat/a-ztgeau.adb
index dbd8926..be7aecc 100644
--- a/gcc/ada/libgnat/a-ztgeau.adb
+++ b/gcc/ada/libgnat/a-ztgeau.adb
@@ -348,6 +348,60 @@ package body Ada.Wide_Wide_Text_IO.Generic_Aux is
Load_Extended_Digits (File, Buf, Ptr, Junk);
end Load_Extended_Digits;
+ ------------------
+ -- Load_Integer --
+ ------------------
+
+ procedure Load_Integer
+ (File : File_Type;
+ Buf : out String;
+ Ptr : in out Natural)
+ is
+ Hash_Loc : Natural;
+ Loaded : Boolean;
+
+ begin
+ Load_Skip (File);
+
+ -- Note: it is a bit strange to allow a minus sign here, but it seems
+ -- consistent with the general behavior expected by the ACVC tests
+ -- which is to scan past junk and then signal data error, see ACVC
+ -- test CE3704F, case (6), which is for signed integer exponents,
+ -- which seems a similar case.
+
+ Load (File, Buf, Ptr, '+', '-');
+ Load_Digits (File, Buf, Ptr, Loaded);
+
+ if Loaded then
+
+ -- Deal with based literal. We recognize either the standard '#' or
+ -- the allowed alternative replacement ':' (see RM J.2(3)).
+
+ Load (File, Buf, Ptr, '#', ':', Loaded);
+
+ if Loaded then
+ Hash_Loc := Ptr;
+ Load_Extended_Digits (File, Buf, Ptr);
+ Load (File, Buf, Ptr, Buf (Hash_Loc));
+ end if;
+
+ -- Deal with exponent
+
+ Load (File, Buf, Ptr, 'E', 'e', Loaded);
+
+ if Loaded then
+
+ -- Note: it is strange to allow a minus sign, since the syntax
+ -- does not, but that is what ACVC test CE3704F, case (6) wants
+ -- for the signed case, and there seems no good reason to treat
+ -- exponents differently for the signed and unsigned cases.
+
+ Load (File, Buf, Ptr, '+', '-');
+ Load_Digits (File, Buf, Ptr);
+ end if;
+ end if;
+ end Load_Integer;
+
---------------
-- Load_Skip --
---------------
diff --git a/gcc/ada/libgnat/a-ztgeau.ads b/gcc/ada/libgnat/a-ztgeau.ads
index 2c5c306..68d4a33 100644
--- a/gcc/ada/libgnat/a-ztgeau.ads
+++ b/gcc/ada/libgnat/a-ztgeau.ads
@@ -149,6 +149,12 @@ package Ada.Wide_Wide_Text_IO.Generic_Aux is
Ptr : in out Integer);
-- Same as above, but no indication if character is loaded
+ procedure Load_Integer
+ (File : File_Type;
+ Buf : out String;
+ Ptr : in out Natural);
+ -- Loads a possibly signed integer literal value
+
procedure Put_Item (File : File_Type; Str : String);
-- This routine is like Wide_Wide_Text_IO.Put, except that it checks for
-- overflow of bounded lines, as described in (RM A.10.6(8)). It is used
@@ -169,7 +175,7 @@ package Ada.Wide_Wide_Text_IO.Generic_Aux is
procedure String_Skip (Str : String; Ptr : out Integer);
-- Used in the Get from string procedures to skip leading blanks in the
-- string. Ptr is set to the index of the first non-blank. If the string
- -- is all blanks, then the excption End_Error is raised, Note that blank
+ -- is all blanks, then the exception End_Error is raised, Note that blank
-- is defined as a space or horizontal tab (RM A.10.6(5)).
procedure Ungetc (ch : Integer; File : File_Type);
diff --git a/gcc/ada/libgnat/a-ztinau.adb b/gcc/ada/libgnat/a-ztinau.adb
index e7e290e..f7b49a1 100644
--- a/gcc/ada/libgnat/a-ztinau.adb
+++ b/gcc/ada/libgnat/a-ztinau.adb
@@ -31,61 +31,15 @@
with Ada.Wide_Wide_Text_IO.Generic_Aux; use Ada.Wide_Wide_Text_IO.Generic_Aux;
-with System.Img_BIU; use System.Img_BIU;
-with System.Img_Int; use System.Img_Int;
-with System.Img_LLB; use System.Img_LLB;
-with System.Img_LLI; use System.Img_LLI;
-with System.Img_LLW; use System.Img_LLW;
-with System.Img_WIU; use System.Img_WIU;
-with System.Val_Int; use System.Val_Int;
-with System.Val_LLI; use System.Val_LLI;
-
package body Ada.Wide_Wide_Text_IO.Integer_Aux is
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Load_Integer
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural);
- -- This is an auxiliary routine that is used to load an possibly signed
- -- integer literal value from the input file into Buf, starting at Ptr + 1.
- -- On return, Ptr is set to the last character stored.
-
- -------------
- -- Get_Int --
- -------------
-
- procedure Get_Int
- (File : File_Type;
- Item : out Integer;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Ptr : aliased Integer := 1;
- Stop : Integer := 0;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Integer (File, Buf, Stop);
- end if;
-
- Item := Scan_Integer (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_Int;
-
- -------------
- -- Get_LLI --
- -------------
+ ---------
+ -- Get --
+ ---------
- procedure Get_LLI
+ procedure Get
(File : File_Type;
- Item : out Long_Long_Integer;
+ Item : out Num;
Width : Field)
is
Buf : String (1 .. Field'Last);
@@ -100,189 +54,73 @@ package body Ada.Wide_Wide_Text_IO.Integer_Aux is
Load_Integer (File, Buf, Stop);
end if;
- Item := Scan_Long_Long_Integer (Buf, Ptr'Access, Stop);
+ Item := Scan (Buf, Ptr'Access, Stop);
Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_LLI;
+ end Get;
- --------------
- -- Gets_Int --
- --------------
+ ----------
+ -- Gets --
+ ----------
- procedure Gets_Int
+ procedure Gets
(From : String;
- Item : out Integer;
+ Item : out Num;
Last : out Positive)
is
Pos : aliased Integer;
begin
String_Skip (From, Pos);
- Item := Scan_Integer (From, Pos'Access, From'Last);
+ Item := Scan (From, Pos'Access, From'Last);
Last := Pos - 1;
exception
when Constraint_Error =>
raise Data_Error;
- end Gets_Int;
-
- --------------
- -- Gets_LLI --
- --------------
-
- procedure Gets_LLI
- (From : String;
- Item : out Long_Long_Integer;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Long_Long_Integer (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_LLI;
-
- ------------------
- -- Load_Integer --
- ------------------
-
- procedure Load_Integer
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural)
- is
- Hash_Loc : Natural;
- Loaded : Boolean;
-
- begin
- Load_Skip (File);
- Load (File, Buf, Ptr, '+', '-');
-
- Load_Digits (File, Buf, Ptr, Loaded);
+ end Gets;
- if Loaded then
+ ---------
+ -- Put --
+ ---------
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- Load (File, Buf, Ptr, '#', ':', Loaded);
-
- if Loaded then
- Hash_Loc := Ptr;
- Load_Extended_Digits (File, Buf, Ptr);
- Load (File, Buf, Ptr, Buf (Hash_Loc));
- end if;
-
- Load (File, Buf, Ptr, 'E', 'e', Loaded);
-
- if Loaded then
-
- -- Note: it is strange to allow a minus sign, since the syntax
- -- does not, but that is what ACVC test CE3704F, case (6) wants.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr);
- end if;
- end if;
- end Load_Integer;
-
- -------------
- -- Put_Int --
- -------------
-
- procedure Put_Int
+ procedure Put
(File : File_Type;
- Item : Integer;
+ Item : Num;
Width : Field;
Base : Number_Base)
is
- Buf : String (1 .. Field'Last);
+ Buf : String (1 .. Integer'Max (Field'Last, Width));
Ptr : Natural := 0;
begin
if Base = 10 and then Width = 0 then
- Set_Image_Integer (Item, Buf, Ptr);
+ Set_Image (Item, Buf, Ptr);
elsif Base = 10 then
- Set_Image_Width_Integer (Item, Width, Buf, Ptr);
+ Set_Image_Width (Item, Width, Buf, Ptr);
else
- Set_Image_Based_Integer (Item, Base, Width, Buf, Ptr);
+ Set_Image_Based (Item, Base, Width, Buf, Ptr);
end if;
Put_Item (File, Buf (1 .. Ptr));
- end Put_Int;
-
- -------------
- -- Put_LLI --
- -------------
-
- procedure Put_LLI
- (File : File_Type;
- Item : Long_Long_Integer;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Long_Long_Integer (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Long_Long_Integer (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Integer (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_LLI;
-
- --------------
- -- Puts_Int --
- --------------
-
- procedure Puts_Int
- (To : out String;
- Item : Integer;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Integer (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Integer (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_Int;
+ end Put;
- --------------
- -- Puts_LLI --
- --------------
+ ----------
+ -- Puts --
+ ----------
- procedure Puts_LLI
+ procedure Puts
(To : out String;
- Item : Long_Long_Integer;
+ Item : Num;
Base : Number_Base)
is
- Buf : String (1 .. Field'Last);
+ Buf : String (1 .. Integer'Max (Field'Last, To'Length));
Ptr : Natural := 0;
begin
if Base = 10 then
- Set_Image_Width_Long_Long_Integer (Item, To'Length, Buf, Ptr);
+ Set_Image_Width (Item, To'Length, Buf, Ptr);
else
- Set_Image_Based_Long_Long_Integer (Item, Base, To'Length, Buf, Ptr);
+ Set_Image_Based (Item, Base, To'Length, Buf, Ptr);
end if;
if Ptr > To'Length then
@@ -290,6 +128,6 @@ package body Ada.Wide_Wide_Text_IO.Integer_Aux is
else
To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
end if;
- end Puts_LLI;
+ end Puts;
end Ada.Wide_Wide_Text_IO.Integer_Aux;
diff --git a/gcc/ada/libgnat/a-ztinau.ads b/gcc/ada/libgnat/a-ztinau.ads
index 49eb3c5..914f120 100644
--- a/gcc/ada/libgnat/a-ztinau.ads
+++ b/gcc/ada/libgnat/a-ztinau.ads
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . W I D E _ W I D E _ T E X T _ I O . I N T E G E R _ A U X --
+-- A D A . W I D E _ W I D E _ T E X T _ I O . I N T E G E R _ A U X --
-- --
-- S p e c --
-- --
@@ -29,55 +29,45 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines for Ada.Wide_Wide_Text_IO.Integer_IO
--- that are shared among separate instantiations of this package. The routines
--- in this package are identical semantically to those in Integer_IO itself,
--- except that the generic parameter Num has been replaced by Integer or
--- Long_Long_Integer, and the default parameters have been removed because
--- they are supplied explicitly by the calls from within the generic template.
+-- This package contains implementation for Ada.Wide_Wide.Text_IO.Integer_IO
+-- and Ada.Wide_Wide_Text_IO.Modular_IO. The routines in this package are
+-- identical semantically to those in Integer_IO and Modular_IO themselves,
+-- except that the default parameters have been removed because they are
+-- supplied explicitly by the calls from within these units.
-private package Ada.Wide_Wide_Text_IO.Integer_Aux is
+private generic
+ type Num is (<>);
- procedure Get_Int
- (File : File_Type;
- Item : out Integer;
- Width : Field);
+ with function Scan
+ (Str : String; Ptr : not null access Integer; Max : Integer) return Num;
+ with procedure Set_Image
+ (V : Num; S : in out String; P : in out Natural);
+ with procedure Set_Image_Width
+ (V : Num; W : Integer; S : out String; P : in out Natural);
+ with procedure Set_Image_Based
+ (V : Num; B : Natural; W : Integer; S : out String; P : in out Natural);
- procedure Get_LLI
+package Ada.Wide_Wide_Text_IO.Integer_Aux is
+
+ procedure Get
(File : File_Type;
- Item : out Long_Long_Integer;
+ Item : out Num;
Width : Field);
- procedure Gets_Int
+ procedure Gets
(From : String;
- Item : out Integer;
+ Item : out Num;
Last : out Positive);
- procedure Gets_LLI
- (From : String;
- Item : out Long_Long_Integer;
- Last : out Positive);
-
- procedure Put_Int
+ procedure Put
(File : File_Type;
- Item : Integer;
+ Item : Num;
Width : Field;
Base : Number_Base);
- procedure Put_LLI
- (File : File_Type;
- Item : Long_Long_Integer;
- Width : Field;
- Base : Number_Base);
-
- procedure Puts_Int
- (To : out String;
- Item : Integer;
- Base : Number_Base);
-
- procedure Puts_LLI
+ procedure Puts
(To : out String;
- Item : Long_Long_Integer;
+ Item : Num;
Base : Number_Base);
end Ada.Wide_Wide_Text_IO.Integer_Aux;
diff --git a/gcc/ada/libgnat/a-ztinio.adb b/gcc/ada/libgnat/a-ztinio.adb
index c0726ce..ab8741e 100644
--- a/gcc/ada/libgnat/a-ztinio.adb
+++ b/gcc/ada/libgnat/a-ztinio.adb
@@ -30,11 +30,35 @@
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Int; use System.Img_Int;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLI; use System.Img_LLI;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Int; use System.Val_Int;
+with System.Val_LLI; use System.Val_LLI;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.WCh_WtS;
package body Ada.Wide_Wide_Text_IO.Integer_IO is
+ package Aux_Int is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Integer,
+ Scan_Integer,
+ Set_Image_Integer,
+ Set_Image_Width_Integer,
+ Set_Image_Based_Integer);
+
+ package Aux_LLI is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Long_Long_Integer,
+ Scan_Long_Long_Integer,
+ Set_Image_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Integer);
+
Need_LLI : constant Boolean := Num'Base'Size > Integer'Size;
-- Throughout this generic body, we distinguish between the case where type
-- Integer is acceptable, and where a Long_Long_Integer is needed. This
@@ -44,8 +68,6 @@ package body Ada.Wide_Wide_Text_IO.Integer_IO is
subtype TFT is Ada.Wide_Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
- package Aux renames Ada.Wide_Wide_Text_IO.Integer_Aux;
-
---------
-- Get --
---------
@@ -55,11 +77,16 @@ package body Ada.Wide_Wide_Text_IO.Integer_IO is
Item : out Num;
Width : Field := 0)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
begin
if Need_LLI then
- Aux.Get_LLI (TFT (File), Long_Long_Integer (Item), Width);
+ Aux_LLI.Get (TFT (File), Long_Long_Integer (Item), Width);
else
- Aux.Get_Int (TFT (File), Integer (Item), Width);
+ Aux_Int.Get (TFT (File), Integer (Item), Width);
end if;
exception
@@ -79,6 +106,11 @@ package body Ada.Wide_Wide_Text_IO.Integer_IO is
Item : out Num;
Last : out Positive)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper);
-- String on which we do the actual conversion. Note that the method
-- used for wide character encoding is irrelevant, since if there is
@@ -87,9 +119,9 @@ package body Ada.Wide_Wide_Text_IO.Integer_IO is
begin
if Need_LLI then
- Aux.Gets_LLI (S, Long_Long_Integer (Item), Last);
+ Aux_LLI.Gets (S, Long_Long_Integer (Item), Last);
else
- Aux.Gets_Int (S, Integer (Item), Last);
+ Aux_Int.Gets (S, Integer (Item), Last);
end if;
exception
@@ -108,9 +140,9 @@ package body Ada.Wide_Wide_Text_IO.Integer_IO is
is
begin
if Need_LLI then
- Aux.Put_LLI (TFT (File), Long_Long_Integer (Item), Width, Base);
+ Aux_LLI.Put (TFT (File), Long_Long_Integer (Item), Width, Base);
else
- Aux.Put_Int (TFT (File), Integer (Item), Width, Base);
+ Aux_Int.Put (TFT (File), Integer (Item), Width, Base);
end if;
end Put;
@@ -132,9 +164,9 @@ package body Ada.Wide_Wide_Text_IO.Integer_IO is
begin
if Need_LLI then
- Aux.Puts_LLI (S, Long_Long_Integer (Item), Base);
+ Aux_LLI.Puts (S, Long_Long_Integer (Item), Base);
else
- Aux.Puts_Int (S, Integer (Item), Base);
+ Aux_Int.Puts (S, Integer (Item), Base);
end if;
for J in S'Range loop
diff --git a/gcc/ada/libgnat/a-ztinio__128.adb b/gcc/ada/libgnat/a-ztinio__128.adb
new file mode 100644
index 0000000..c809eeb
--- /dev/null
+++ b/gcc/ada/libgnat/a-ztinio__128.adb
@@ -0,0 +1,199 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . W I D E _ W I D E _ T E X T _ I O . I N T E G E R _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Int; use System.Img_Int;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLI; use System.Img_LLI;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_LLLB; use System.Img_LLLB;
+with System.Img_LLLI; use System.Img_LLLI;
+with System.Img_LLLW; use System.Img_LLLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Int; use System.Val_Int;
+with System.Val_LLI; use System.Val_LLI;
+with System.Val_LLLI; use System.Val_LLLI;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_WtS; use System.WCh_WtS;
+
+package body Ada.Wide_Wide_Text_IO.Integer_IO is
+
+ package Aux_Int is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Integer,
+ Scan_Integer,
+ Set_Image_Integer,
+ Set_Image_Width_Integer,
+ Set_Image_Based_Integer);
+
+ package Aux_LLI is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Long_Long_Integer,
+ Scan_Long_Long_Integer,
+ Set_Image_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Integer);
+
+ package Aux_LLLI is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Long_Long_Long_Integer,
+ Scan_Long_Long_Long_Integer,
+ Set_Image_Long_Long_Long_Integer,
+ Set_Image_Width_Long_Long_Long_Integer,
+ Set_Image_Based_Long_Long_Long_Integer);
+
+ Need_LLI : constant Boolean := Num'Base'Size > Integer'Size;
+ Need_LLLI : constant Boolean := Num'Base'Size > Long_Long_Integer'Size;
+ -- Throughout this generic body, we distinguish between cases where type
+ -- Integer is acceptable, where type Long_Long_Integer is acceptable and
+ -- where type Long_Long_Long_Integer is needed. These boolean constants
+ -- are used to test for these cases and since they are constant, only code
+ -- for the relevant case will be included in the instance.
+
+ subtype TFT is Ada.Wide_Wide_Text_IO.File_Type;
+ -- File type required for calls to routines in Aux
+
+ ---------
+ -- Get --
+ ---------
+
+ procedure Get
+ (File : File_Type;
+ Item : out Num;
+ Width : Field := 0)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Get (TFT (File), Long_Long_Long_Integer (Item), Width);
+ elsif Need_LLI then
+ Aux_LLI.Get (TFT (File), Long_Long_Integer (Item), Width);
+ else
+ Aux_Int.Get (TFT (File), Integer (Item), Width);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ procedure Get
+ (Item : out Num;
+ Width : Field := 0)
+ is
+ begin
+ Get (Current_Input, Item, Width);
+ end Get;
+
+ procedure Get
+ (From : Wide_Wide_String;
+ Item : out Num;
+ Last : out Positive)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+ pragma Unsuppress (Overflow_Check);
+
+ S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper);
+ -- String on which we do the actual conversion. Note that the method
+ -- used for wide character encoding is irrelevant, since if there is
+ -- a character outside the Standard.Character range then the call to
+ -- Aux.Gets will raise Data_Error in any case.
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Gets (S, Long_Long_Long_Integer (Item), Last);
+ elsif Need_LLI then
+ Aux_LLI.Gets (S, Long_Long_Integer (Item), Last);
+ else
+ Aux_Int.Gets (S, Integer (Item), Last);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put
+ (File : File_Type;
+ Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Put (TFT (File), Long_Long_Long_Integer (Item), Width, Base);
+ elsif Need_LLI then
+ Aux_LLI.Put (TFT (File), Long_Long_Integer (Item), Width, Base);
+ else
+ Aux_Int.Put (TFT (File), Integer (Item), Width, Base);
+ end if;
+ end Put;
+
+ procedure Put
+ (Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ Put (Current_Output, Item, Width, Base);
+ end Put;
+
+ procedure Put
+ (To : out Wide_Wide_String;
+ Item : Num;
+ Base : Number_Base := Default_Base)
+ is
+ S : String (To'First .. To'Last);
+
+ begin
+ if Need_LLLI then
+ Aux_LLLI.Puts (S, Long_Long_Long_Integer (Item), Base);
+ elsif Need_LLI then
+ Aux_LLI.Puts (S, Long_Long_Integer (Item), Base);
+ else
+ Aux_Int.Puts (S, Integer (Item), Base);
+ end if;
+
+ for J in S'Range loop
+ To (J) := Wide_Wide_Character'Val (Character'Pos (S (J)));
+ end loop;
+ end Put;
+
+end Ada.Wide_Wide_Text_IO.Integer_IO;
diff --git a/gcc/ada/libgnat/a-ztmoau.adb b/gcc/ada/libgnat/a-ztmoau.adb
deleted file mode 100644
index 2f179e2..0000000
--- a/gcc/ada/libgnat/a-ztmoau.adb
+++ /dev/null
@@ -1,305 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- A D A . W I D E _ W I D E _ T E X T _ I O . M O D U L A R _ A U X --
--- --
--- B o d y --
--- --
--- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
--- --
--- GNAT is free software; you can redistribute it and/or modify it under --
--- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 3, or (at your option) any later ver- --
--- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
--- --
--- GNAT was originally developed by the GNAT team at New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc. --
--- --
-------------------------------------------------------------------------------
-
-with Ada.Wide_Wide_Text_IO.Generic_Aux; use Ada.Wide_Wide_Text_IO.Generic_Aux;
-
-with System.Img_BIU; use System.Img_BIU;
-with System.Img_Uns; use System.Img_Uns;
-with System.Img_LLB; use System.Img_LLB;
-with System.Img_LLU; use System.Img_LLU;
-with System.Img_LLW; use System.Img_LLW;
-with System.Img_WIU; use System.Img_WIU;
-with System.Val_Uns; use System.Val_Uns;
-with System.Val_LLU; use System.Val_LLU;
-
-package body Ada.Wide_Wide_Text_IO.Modular_Aux is
-
- use System.Unsigned_Types;
-
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- procedure Load_Modular
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural);
- -- This is an auxiliary routine that is used to load an possibly signed
- -- modular literal value from the input file into Buf, starting at Ptr + 1.
- -- Ptr is left set to the last character stored.
-
- -------------
- -- Get_LLU --
- -------------
-
- procedure Get_LLU
- (File : File_Type;
- Item : out Long_Long_Unsigned;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Stop : Integer := 0;
- Ptr : aliased Integer := 1;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Modular (File, Buf, Stop);
- end if;
-
- Item := Scan_Long_Long_Unsigned (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_LLU;
-
- -------------
- -- Get_Uns --
- -------------
-
- procedure Get_Uns
- (File : File_Type;
- Item : out Unsigned;
- Width : Field)
- is
- Buf : String (1 .. Field'Last);
- Stop : Integer := 0;
- Ptr : aliased Integer := 1;
-
- begin
- if Width /= 0 then
- Load_Width (File, Width, Buf, Stop);
- String_Skip (Buf, Ptr);
- else
- Load_Modular (File, Buf, Stop);
- end if;
-
- Item := Scan_Unsigned (Buf, Ptr'Access, Stop);
- Check_End_Of_Field (Buf, Stop, Ptr, Width);
- end Get_Uns;
-
- --------------
- -- Gets_LLU --
- --------------
-
- procedure Gets_LLU
- (From : String;
- Item : out Long_Long_Unsigned;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Long_Long_Unsigned (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_LLU;
-
- --------------
- -- Gets_Uns --
- --------------
-
- procedure Gets_Uns
- (From : String;
- Item : out Unsigned;
- Last : out Positive)
- is
- Pos : aliased Integer;
-
- begin
- String_Skip (From, Pos);
- Item := Scan_Unsigned (From, Pos'Access, From'Last);
- Last := Pos - 1;
-
- exception
- when Constraint_Error =>
- raise Data_Error;
- end Gets_Uns;
-
- ------------------
- -- Load_Modular --
- ------------------
-
- procedure Load_Modular
- (File : File_Type;
- Buf : out String;
- Ptr : in out Natural)
- is
- Hash_Loc : Natural;
- Loaded : Boolean;
-
- begin
- Load_Skip (File);
-
- -- Note: it is a bit strange to allow a minus sign here, but it seems
- -- consistent with the general behavior expected by the ACVC tests
- -- which is to scan past junk and then signal data error, see ACVC
- -- test CE3704F, case (6), which is for signed integer exponents,
- -- which seems a similar case.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr, Loaded);
-
- if Loaded then
-
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- Load (File, Buf, Ptr, '#', ':', Loaded);
-
- if Loaded then
- Hash_Loc := Ptr;
- Load_Extended_Digits (File, Buf, Ptr);
- Load (File, Buf, Ptr, Buf (Hash_Loc));
- end if;
-
- Load (File, Buf, Ptr, 'E', 'e', Loaded);
-
- if Loaded then
-
- -- Note: it is strange to allow a minus sign, since the syntax
- -- does not, but that is what ACVC test CE3704F, case (6) wants
- -- for the signed case, and there seems no good reason to treat
- -- exponents differently for the signed and unsigned cases.
-
- Load (File, Buf, Ptr, '+', '-');
- Load_Digits (File, Buf, Ptr);
- end if;
- end if;
- end Load_Modular;
-
- -------------
- -- Put_LLU --
- -------------
-
- procedure Put_LLU
- (File : File_Type;
- Item : Long_Long_Unsigned;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Long_Long_Unsigned (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Long_Long_Unsigned (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Unsigned (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_LLU;
-
- -------------
- -- Put_Uns --
- -------------
-
- procedure Put_Uns
- (File : File_Type;
- Item : Unsigned;
- Width : Field;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 and then Width = 0 then
- Set_Image_Unsigned (Item, Buf, Ptr);
- elsif Base = 10 then
- Set_Image_Width_Unsigned (Item, Width, Buf, Ptr);
- else
- Set_Image_Based_Unsigned (Item, Base, Width, Buf, Ptr);
- end if;
-
- Put_Item (File, Buf (1 .. Ptr));
- end Put_Uns;
-
- --------------
- -- Puts_LLU --
- --------------
-
- procedure Puts_LLU
- (To : out String;
- Item : Long_Long_Unsigned;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Long_Long_Unsigned (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Long_Long_Unsigned (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_LLU;
-
- --------------
- -- Puts_Uns --
- --------------
-
- procedure Puts_Uns
- (To : out String;
- Item : Unsigned;
- Base : Number_Base)
- is
- Buf : String (1 .. Field'Last);
- Ptr : Natural := 0;
-
- begin
- if Base = 10 then
- Set_Image_Width_Unsigned (Item, To'Length, Buf, Ptr);
- else
- Set_Image_Based_Unsigned (Item, Base, To'Length, Buf, Ptr);
- end if;
-
- if Ptr > To'Length then
- raise Layout_Error;
- else
- To (To'First .. To'First + Ptr - 1) := Buf (1 .. Ptr);
- end if;
- end Puts_Uns;
-
-end Ada.Wide_Wide_Text_IO.Modular_Aux;
diff --git a/gcc/ada/libgnat/a-ztmoio.adb b/gcc/ada/libgnat/a-ztmoio.adb
index bf9d42b..d2f81e2 100644
--- a/gcc/ada/libgnat/a-ztmoio.adb
+++ b/gcc/ada/libgnat/a-ztmoio.adb
@@ -29,19 +29,45 @@
-- --
------------------------------------------------------------------------------
-with Ada.Wide_Wide_Text_IO.Modular_Aux;
-
-with System.Unsigned_Types; use System.Unsigned_Types;
-with System.WCh_Con; use System.WCh_Con;
-with System.WCh_WtS; use System.WCh_WtS;
+with Ada.Wide_Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Uns; use System.Val_Uns;
+with System.Val_LLU; use System.Val_LLU;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_WtS; use System.WCh_WtS;
package body Ada.Wide_Wide_Text_IO.Modular_IO is
+ package Aux_Uns is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Unsigned,
+ Scan_Unsigned,
+ Set_Image_Unsigned,
+ Set_Image_Width_Unsigned,
+ Set_Image_Based_Unsigned);
+
+ package Aux_LLU is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Long_Long_Unsigned,
+ Scan_Long_Long_Unsigned,
+ Set_Image_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Unsigned);
+
+ Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size;
+ -- Throughout this generic body, we distinguish between the case where type
+ -- Unsigned is acceptable, and where a Long_Long_Unsigned is needed. This
+ -- Boolean is used to test for these cases and since it is a constant, only
+ -- code for the relevant case will be included in the instance.
+
subtype TFT is Ada.Wide_Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
- package Aux renames Ada.Wide_Wide_Text_IO.Modular_Aux;
-
---------
-- Get --
---------
@@ -51,11 +77,15 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
Item : out Num;
Width : Field := 0)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
begin
- if Num'Size > Unsigned'Size then
- Aux.Get_LLU (TFT (File), Long_Long_Unsigned (Item), Width);
+ if Need_LLU then
+ Aux_LLU.Get (TFT (File), Long_Long_Unsigned (Item), Width);
else
- Aux.Get_Uns (TFT (File), Unsigned (Item), Width);
+ Aux_Uns.Get (TFT (File), Unsigned (Item), Width);
end if;
exception
@@ -75,6 +105,10 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
Item : out Num;
Last : out Positive)
is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper);
-- String on which we do the actual conversion. Note that the method
-- used for wide character encoding is irrelevant, since if there is
@@ -82,10 +116,10 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
-- Aux.Gets will raise Data_Error in any case.
begin
- if Num'Size > Unsigned'Size then
- Aux.Gets_LLU (S, Long_Long_Unsigned (Item), Last);
+ if Need_LLU then
+ Aux_LLU.Gets (S, Long_Long_Unsigned (Item), Last);
else
- Aux.Gets_Uns (S, Unsigned (Item), Last);
+ Aux_Uns.Gets (S, Unsigned (Item), Last);
end if;
exception
@@ -103,10 +137,10 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
Base : Number_Base := Default_Base)
is
begin
- if Num'Size > Unsigned'Size then
- Aux.Put_LLU (TFT (File), Long_Long_Unsigned (Item), Width, Base);
+ if Need_LLU then
+ Aux_LLU.Put (TFT (File), Long_Long_Unsigned (Item), Width, Base);
else
- Aux.Put_Uns (TFT (File), Unsigned (Item), Width, Base);
+ Aux_Uns.Put (TFT (File), Unsigned (Item), Width, Base);
end if;
end Put;
@@ -127,10 +161,10 @@ package body Ada.Wide_Wide_Text_IO.Modular_IO is
S : String (To'First .. To'Last);
begin
- if Num'Size > Unsigned'Size then
- Aux.Puts_LLU (S, Long_Long_Unsigned (Item), Base);
+ if Need_LLU then
+ Aux_LLU.Puts (S, Long_Long_Unsigned (Item), Base);
else
- Aux.Puts_Uns (S, Unsigned (Item), Base);
+ Aux_Uns.Puts (S, Unsigned (Item), Base);
end if;
for J in S'Range loop
diff --git a/gcc/ada/libgnat/a-ztmoio__128.adb b/gcc/ada/libgnat/a-ztmoio__128.adb
new file mode 100644
index 0000000..e6e11de
--- /dev/null
+++ b/gcc/ada/libgnat/a-ztmoio__128.adb
@@ -0,0 +1,197 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- A D A . W I D E _ W I D E _ T E X T _ I O . M O D U L A R _ I O --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Wide_Wide_Text_IO.Integer_Aux;
+with System.Img_BIU; use System.Img_BIU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Img_LLB; use System.Img_LLB;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_LLW; use System.Img_LLW;
+with System.Img_LLLB; use System.Img_LLLB;
+with System.Img_LLLU; use System.Img_LLLU;
+with System.Img_LLLW; use System.Img_LLLW;
+with System.Img_WIU; use System.Img_WIU;
+with System.Val_Uns; use System.Val_Uns;
+with System.Val_LLU; use System.Val_LLU;
+with System.Val_LLLU; use System.Val_LLLU;
+with System.WCh_Con; use System.WCh_Con;
+with System.WCh_WtS; use System.WCh_WtS;
+
+package body Ada.Wide_Wide_Text_IO.Modular_IO is
+
+ package Aux_Uns is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Unsigned,
+ Scan_Unsigned,
+ Set_Image_Unsigned,
+ Set_Image_Width_Unsigned,
+ Set_Image_Based_Unsigned);
+
+ package Aux_LLU is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Long_Long_Unsigned,
+ Scan_Long_Long_Unsigned,
+ Set_Image_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Unsigned);
+
+ package Aux_LLLU is new
+ Ada.Wide_Wide_Text_IO.Integer_Aux
+ (Long_Long_Long_Unsigned,
+ Scan_Long_Long_Long_Unsigned,
+ Set_Image_Long_Long_Long_Unsigned,
+ Set_Image_Width_Long_Long_Long_Unsigned,
+ Set_Image_Based_Long_Long_Long_Unsigned);
+
+ Need_LLU : constant Boolean := Num'Base'Size > Unsigned'Size;
+ Need_LLLU : constant Boolean := Num'Base'Size > Long_Long_Unsigned'Size;
+ -- Throughout this generic body, we distinguish between cases where type
+ -- Unsigned is acceptable, where type Long_Long_Unsigned is acceptable and
+ -- where type Long_Long_Long_Unsigned is needed. These boolean constants
+ -- are used to test for these cases and since they are constant, only code
+ -- for the relevant case will be included in the instance.
+
+ subtype TFT is Ada.Wide_Wide_Text_IO.File_Type;
+ -- File type required for calls to routines in Aux
+
+ ---------
+ -- Get --
+ ---------
+
+ procedure Get
+ (File : File_Type;
+ Item : out Num;
+ Width : Field := 0)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Get (File, Long_Long_Long_Unsigned (Item), Width);
+ elsif Need_LLU then
+ Aux_LLU.Get (TFT (File), Long_Long_Unsigned (Item), Width);
+ else
+ Aux_Uns.Get (TFT (File), Unsigned (Item), Width);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ procedure Get
+ (Item : out Num;
+ Width : Field := 0)
+ is
+ begin
+ Get (Current_Input, Item, Width);
+ end Get;
+
+ procedure Get
+ (From : Wide_Wide_String;
+ Item : out Num;
+ Last : out Positive)
+ is
+ -- We depend on a range check to get Data_Error
+
+ pragma Unsuppress (Range_Check);
+
+ S : constant String := Wide_Wide_String_To_String (From, WCEM_Upper);
+ -- String on which we do the actual conversion. Note that the method
+ -- used for wide character encoding is irrelevant, since if there is
+ -- a character outside the Standard.Character range then the call to
+ -- Aux.Gets will raise Data_Error in any case.
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Gets (S, Long_Long_Long_Unsigned (Item), Last);
+ elsif Need_LLU then
+ Aux_LLU.Gets (S, Long_Long_Unsigned (Item), Last);
+ else
+ Aux_Uns.Gets (S, Unsigned (Item), Last);
+ end if;
+
+ exception
+ when Constraint_Error => raise Data_Error;
+ end Get;
+
+ ---------
+ -- Put --
+ ---------
+
+ procedure Put
+ (File : File_Type;
+ Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Put (File, Long_Long_Long_Unsigned (Item), Width, Base);
+ elsif Need_LLU then
+ Aux_LLU.Put (TFT (File), Long_Long_Unsigned (Item), Width, Base);
+ else
+ Aux_Uns.Put (TFT (File), Unsigned (Item), Width, Base);
+ end if;
+ end Put;
+
+ procedure Put
+ (Item : Num;
+ Width : Field := Default_Width;
+ Base : Number_Base := Default_Base)
+ is
+ begin
+ Put (Current_Output, Item, Width, Base);
+ end Put;
+
+ procedure Put
+ (To : out Wide_Wide_String;
+ Item : Num;
+ Base : Number_Base := Default_Base)
+ is
+ S : String (To'First .. To'Last);
+
+ begin
+ if Need_LLLU then
+ Aux_LLLU.Puts (S, Long_Long_Long_Unsigned (Item), Base);
+ elsif Need_LLU then
+ Aux_LLU.Puts (S, Long_Long_Unsigned (Item), Base);
+ else
+ Aux_Uns.Puts (S, Unsigned (Item), Base);
+ end if;
+
+ for J in S'Range loop
+ To (J) := Wide_Wide_Character'Val (Character'Pos (S (J)));
+ end loop;
+ end Put;
+
+end Ada.Wide_Wide_Text_IO.Modular_IO;
diff --git a/gcc/ada/libgnat/g-arrspl.adb b/gcc/ada/libgnat/g-arrspl.adb
index e6f0d99..8770030 100644
--- a/gcc/ada/libgnat/g-arrspl.adb
+++ b/gcc/ada/libgnat/g-arrspl.adb
@@ -49,7 +49,7 @@ package body GNAT.Array_Split is
-- Adjust --
------------
- procedure Adjust (S : in out Slice_Set) is
+ overriding procedure Adjust (S : in out Slice_Set) is
begin
S.D.Ref_Counter := S.D.Ref_Counter + 1;
end Adjust;
@@ -68,6 +68,16 @@ package body GNAT.Array_Split is
Create (S, From, To_Set (Separators), Mode);
end Create;
+ function Create
+ (From : Element_Sequence;
+ Separators : Element_Sequence;
+ Mode : Separator_Mode := Single) return Slice_Set is
+ begin
+ return Ret : Slice_Set do
+ Create (Ret, From, Separators, Mode);
+ end return;
+ end Create;
+
------------
-- Create --
------------
@@ -85,6 +95,16 @@ package body GNAT.Array_Split is
S := Result;
end Create;
+ function Create
+ (From : Element_Sequence;
+ Separators : Element_Set;
+ Mode : Separator_Mode := Single) return Slice_Set is
+ begin
+ return Ret : Slice_Set do
+ Create (Ret, From, Separators, Mode);
+ end return;
+ end Create;
+
-----------
-- Count --
-----------
@@ -108,7 +128,7 @@ package body GNAT.Array_Split is
-- Finalize --
--------------
- procedure Finalize (S : in out Slice_Set) is
+ overriding procedure Finalize (S : in out Slice_Set) is
procedure Free is
new Ada.Unchecked_Deallocation (Element_Sequence, Element_Access);
@@ -139,7 +159,7 @@ package body GNAT.Array_Split is
-- Initialize --
----------------
- procedure Initialize (S : in out Slice_Set) is
+ overriding procedure Initialize (S : in out Slice_Set) is
begin
S.D := new Data'(1, null, 0, null, null);
end Initialize;
diff --git a/gcc/ada/libgnat/g-arrspl.ads b/gcc/ada/libgnat/g-arrspl.ads
index 3383f40..099d499 100644
--- a/gcc/ada/libgnat/g-arrspl.ads
+++ b/gcc/ada/libgnat/g-arrspl.ads
@@ -72,7 +72,12 @@ package GNAT.Array_Split is
-- separator and no empty slice is created.
);
- type Slice_Set is private;
+ type Slice_Set is private
+ with Iterable => (First => First_Cursor,
+ Next => Advance,
+ Has_Element => Has_Element,
+ Element => Slice);
+
-- This type uses by-reference semantics. This is a set of slices as
-- returned by Create or Set routines below. The abstraction represents
-- a set of items. Each item is a part of the original array named a
@@ -85,6 +90,10 @@ package GNAT.Array_Split is
From : Element_Sequence;
Separators : Element_Sequence;
Mode : Separator_Mode := Single);
+ function Create
+ (From : Element_Sequence;
+ Separators : Element_Sequence;
+ Mode : Separator_Mode := Single) return Slice_Set;
-- Create a cut array object. From is the source array, and Separators
-- is a sequence of Element along which to split the array. The source
-- array is sliced at separator boundaries. The separators are not
@@ -99,6 +108,10 @@ package GNAT.Array_Split is
From : Element_Sequence;
Separators : Element_Set;
Mode : Separator_Mode := Single);
+ function Create
+ (From : Element_Sequence;
+ Separators : Element_Set;
+ Mode : Separator_Mode := Single) return Slice_Set;
-- Same as above but using a Element_Set
procedure Set
@@ -117,14 +130,21 @@ package GNAT.Array_Split is
type Slice_Number is new Natural;
-- Type used to count number of slices
- function Slice_Count (S : Slice_Set) return Slice_Number;
- pragma Inline (Slice_Count);
+ function Slice_Count (S : Slice_Set) return Slice_Number with Inline;
-- Returns the number of slices (fields) in S
+ function First_Cursor (Unused : Slice_Set) return Slice_Number is (1);
+ function Advance
+ (Unused : Slice_Set; Position : Slice_Number) return Slice_Number
+ is (Position + 1);
+ function Has_Element
+ (Cont : Slice_Set; Position : Slice_Number) return Boolean
+ is (Position <= Slice_Count (Cont));
+ -- Functions used to iterate over a Slice_Set
+
function Slice
(S : Slice_Set;
- Index : Slice_Number) return Element_Sequence;
- pragma Inline (Slice);
+ Index : Slice_Number) return Element_Sequence with Inline;
-- Returns the slice at position Index. First slice is 1. If Index is 0
-- the whole array is returned including the separators (this is the
-- original source array).
@@ -184,8 +204,8 @@ private
D : Data_Access;
end record;
- procedure Initialize (S : in out Slice_Set);
- procedure Adjust (S : in out Slice_Set);
- procedure Finalize (S : in out Slice_Set);
+ overriding procedure Initialize (S : in out Slice_Set);
+ overriding procedure Adjust (S : in out Slice_Set);
+ overriding procedure Finalize (S : in out Slice_Set);
end GNAT.Array_Split;
diff --git a/gcc/ada/libgnat/g-debpoo.ads b/gcc/ada/libgnat/g-debpoo.ads
index ed000fa..88cffe8 100644
--- a/gcc/ada/libgnat/g-debpoo.ads
+++ b/gcc/ada/libgnat/g-debpoo.ads
@@ -299,7 +299,7 @@ package GNAT.Debug_Pools is
-- If Valid is True, Size_In_Storage_Elements is set to the size of this
-- chunk of memory.
- type Byte_Count is mod System.Max_Binary_Modulus;
+ type Byte_Count is mod 2 ** Long_Long_Integer'Size;
-- Type used for maintaining byte counts, needs to be large enough to
-- to accommodate counts allowing for repeated use of the same memory.
diff --git a/gcc/ada/libgnat/g-sechas.ads b/gcc/ada/libgnat/g-sechas.ads
index 2edc2e3..566a696 100644
--- a/gcc/ada/libgnat/g-sechas.ads
+++ b/gcc/ada/libgnat/g-sechas.ads
@@ -218,7 +218,9 @@ package GNAT.Secure_Hashes is
-- HMAC key
end record;
+ pragma Warnings (Off, "aggregate not fully initialized");
Initial_Context : constant Context (KL => 0) := (others => <>);
+ pragma Warnings (On, "aggregate not fully initialized");
-- Initial values are provided by default initialization of Context
type Hash_Stream (C : access Context) is
diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb
index 719d9a9..57a8800 100644
--- a/gcc/ada/libgnat/g-socket.adb
+++ b/gcc/ada/libgnat/g-socket.adb
@@ -186,10 +186,6 @@ package body GNAT.Sockets is
else Value);
-- Removes dot at the end of error message
- procedure Raise_Socket_Error (Error : Integer);
- -- Raise Socket_Error with an exception message describing the error code
- -- from errno.
-
procedure Raise_Host_Error (H_Error : Integer; Name : String);
-- Raise Host_Error exception with message describing error code (note
-- hstrerror seems to be obsolete) from h_errno. Name is the name
diff --git a/gcc/ada/libgnat/g-socket.ads b/gcc/ada/libgnat/g-socket.ads
index 9167241..bf78777 100644
--- a/gcc/ada/libgnat/g-socket.ads
+++ b/gcc/ada/libgnat/g-socket.ads
@@ -449,10 +449,10 @@ package GNAT.Sockets is
type Selector_Status is (Completed, Expired, Aborted);
-- Completion status of a selector operation, indicated as follows:
- -- Complete: one of the expected events occurred
- -- Expired: no event occurred before the expiration of the timeout
- -- Aborted: an external action cancelled the wait operation before
- -- any event occurred.
+ -- Completed: one of the expected events occurred
+ -- Expired: no event occurred before the expiration of the timeout
+ -- Aborted: an external action cancelled the wait operation before
+ -- any event occurred.
Socket_Error : exception;
-- There is only one exception in this package to deal with an error during
@@ -1573,4 +1573,8 @@ private
Wait_For_A_Full_Reception : constant Request_Flag_Type := 4;
Send_End_Of_Record : constant Request_Flag_Type := 8;
+ procedure Raise_Socket_Error (Error : Integer);
+ -- Raise Socket_Error with an exception message describing the error code
+ -- from errno.
+
end GNAT.Sockets;
diff --git a/gcc/ada/libgnat/g-socpol.adb b/gcc/ada/libgnat/g-socpol.adb
new file mode 100644
index 0000000..ab3286c
--- /dev/null
+++ b/gcc/ada/libgnat/g-socpol.adb
@@ -0,0 +1,430 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Calendar;
+
+with GNAT.Sockets.Thin;
+
+package body GNAT.Sockets.Poll is
+
+ To_C : constant array (Wait_Event_Type) of Events_Type :=
+ (Input => SOC.POLLIN or SOC.POLLPRI, Output => SOC.POLLOUT);
+ -- To convert Wait_Event_Type to C I/O events flags
+
+ procedure Set_Mode (Item : out Pollfd; Mode : Wait_Event_Set);
+ -- Set I/O waiting mode on Item
+
+ procedure Set_Event
+ (Item : out Pollfd; Event : Wait_Event_Type; Value : Boolean);
+ -- Set or reset waiting state on I/O event
+
+ procedure Check_Range (Self : Set; Index : Positive) with Inline;
+ -- raise Constraint_Error if Index is more than number of sockets in Self
+
+ function Status (Item : Pollfd) return Event_Set is
+ (Input => (Item.REvents and To_C (Input)) /= 0,
+ Output => (Item.REvents and To_C (Output)) /= 0,
+ Error => (Item.REvents and SOC.POLLERR) /= 0,
+ Hang_Up => (Item.REvents and SOC.POLLHUP) /= 0,
+ Invalid_Request => (Item.REvents and SOC.POLLNVAL) /= 0);
+ -- Get I/O events from C word
+
+ procedure Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer);
+ -- Waits until one or more of the sockets descriptors become ready for some
+ -- class of I/O operation or error state occurs on one or more of them.
+ -- Timeout is in milliseconds. Result mean how many sockets ready for I/O
+ -- or have error state.
+
+ ----------
+ -- Wait --
+ ----------
+
+ procedure Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer)
+ is separate;
+
+ ------------
+ -- Create --
+ ------------
+
+ function Create (Size : Positive) return Set is
+ begin
+ return Result : Set (Size);
+ end Create;
+
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set
+ (Socket : Socket_Type;
+ Events : Wait_Event_Set;
+ Size : Positive := 1) return Set is
+ begin
+ return Result : Set (Size) do
+ Append (Result, Socket, Events);
+ end return;
+ end To_Set;
+
+ ------------
+ -- Append --
+ ------------
+
+ procedure Append
+ (Self : in out Set; Socket : Socket_Type; Events : Wait_Event_Set) is
+ begin
+ Insert (Self, Socket, Events, Self.Length + 1);
+ end Append;
+
+ ------------
+ -- Insert --
+ ------------
+
+ procedure Insert
+ (Self : in out Set;
+ Socket : Socket_Type;
+ Events : Wait_Event_Set;
+ Index : Positive;
+ Keep_Order : Boolean := False) is
+ begin
+ if Self.Size <= Self.Length then
+ raise Constraint_Error with "Socket set is full";
+
+ elsif Index > Self.Length + 1 then
+ raise Constraint_Error with "Insert out of range";
+ end if;
+
+ if Socket < 0 then
+ raise Socket_Error with
+ "Wrong socket descriptor " & Socket_Type'Image (Socket);
+ end if;
+
+ Self.Length := Self.Length + 1;
+
+ if Index /= Self.Length then
+ if Keep_Order then
+ Self.Fds (Index + 1 .. Self.Length) :=
+ Self.Fds (Index .. Self.Length - 1);
+ else
+ Self.Fds (Self.Length) := Self.Fds (Index);
+ end if;
+
+ Self.Fds (Index).Events := 0;
+ end if;
+
+ Self.Fds (Index).Socket := FD_Type (Socket);
+ Set_Mode (Self.Fds (Index), Events);
+
+ if FD_Type (Socket) > Self.Max_FD then
+ Self.Max_FD := FD_Type (Socket);
+ Self.Max_OK := True;
+ end if;
+ end Insert;
+
+ -----------------
+ -- Check_Range --
+ -----------------
+
+ procedure Check_Range (Self : Set; Index : Positive) is
+ begin
+ if Index > Self.Length then
+ raise Constraint_Error;
+ end if;
+ end Check_Range;
+
+ ----------
+ -- Copy --
+ ----------
+
+ procedure Copy (Source : Set; Target : out Set) is
+ begin
+ if Target.Size < Source.Length then
+ raise Constraint_Error with
+ "Can't copy because size of target less than source length";
+ end if;
+
+ Target.Fds (1 .. Source.Length) := Source.Fds (1 .. Source.Length);
+
+ Target.Length := Source.Length;
+ Target.Max_FD := Source.Max_FD;
+ Target.Max_OK := Source.Max_OK;
+ end Copy;
+
+ ----------------
+ -- Get_Events --
+ ----------------
+
+ function Get_Events
+ (Self : Set; Index : Positive) return Wait_Event_Set is
+ begin
+ Check_Range (Self, Index);
+ return
+ (Input => (Self.Fds (Index).Events and To_C (Input)) /= 0,
+ Output => (Self.Fds (Index).Events and To_C (Output)) /= 0);
+ end Get_Events;
+
+ ------------
+ -- Growth --
+ ------------
+
+ function Growth (Self : Set) return Set is
+ begin
+ return Resize
+ (Self,
+ (case Self.Size is
+ when 1 .. 20 => 32,
+ when 21 .. 50 => 64,
+ when 51 .. 99 => Self.Size + Self.Size / 3,
+ when others => Self.Size + Self.Size / 4));
+ end Growth;
+
+ ------------
+ -- Remove --
+ ------------
+
+ procedure Remove
+ (Self : in out Set; Index : Positive; Keep_Order : Boolean := False) is
+ begin
+ Check_Range (Self, Index);
+
+ if Self.Max_FD = Self.Fds (Index).Socket then
+ Self.Max_OK := False;
+ end if;
+
+ if Index < Self.Length then
+ if Keep_Order then
+ Self.Fds (Index .. Self.Length - 1) :=
+ Self.Fds (Index + 1 .. Self.Length);
+ else
+ Self.Fds (Index) := Self.Fds (Self.Length);
+ end if;
+ end if;
+
+ Self.Length := Self.Length - 1;
+ end Remove;
+
+ ------------
+ -- Resize --
+ ------------
+
+ function Resize (Self : Set; Size : Positive) return Set is
+ begin
+ return Result : Set (Size) do
+ Copy (Self, Result);
+ end return;
+ end Resize;
+
+ ---------------
+ -- Set_Event --
+ ---------------
+
+ procedure Set_Event
+ (Self : in out Set;
+ Index : Positive;
+ Event : Wait_Event_Type;
+ Value : Boolean) is
+ begin
+ Check_Range (Self, Index);
+ Set_Event (Self.Fds (Index), Event, Value);
+ end Set_Event;
+
+ procedure Set_Event
+ (Item : out Pollfd; Event : Wait_Event_Type; Value : Boolean) is
+ begin
+ if Value then
+ Item.Events := Item.Events or To_C (Event);
+ else
+ Item.Events := Item.Events and not To_C (Event);
+ end if;
+ end Set_Event;
+
+ ----------------
+ -- Set_Events --
+ ----------------
+
+ procedure Set_Events
+ (Self : in out Set;
+ Index : Positive;
+ Events : Wait_Event_Set) is
+ begin
+ Check_Range (Self, Index);
+ Set_Mode (Self.Fds (Index), Events);
+ end Set_Events;
+
+ --------------
+ -- Set_Mode --
+ --------------
+
+ procedure Set_Mode (Item : out Pollfd; Mode : Wait_Event_Set) is
+ begin
+ for J in Mode'Range loop
+ Set_Event (Item, J, Mode (J));
+ end loop;
+ end Set_Mode;
+
+ ------------
+ -- Socket --
+ ------------
+
+ function Socket (Self : Set; Index : Positive) return Socket_Type is
+ begin
+ Check_Range (Self, Index);
+ return Socket_Type (Self.Fds (Index).Socket);
+ end Socket;
+
+ -----------
+ -- State --
+ -----------
+
+ procedure State
+ (Self : Set;
+ Index : Positive;
+ Socket : out Socket_Type;
+ Status : out Event_Set) is
+ begin
+ Check_Range (Self, Index);
+ Socket := Socket_Type (Self.Fds (Index).Socket);
+ Status := Poll.Status (Self.Fds (Index));
+ end State;
+
+ ----------
+ -- Wait --
+ ----------
+
+ procedure Wait (Self : in out Set; Timeout : Duration; Count : out Natural)
+ is
+ use Ada.Calendar;
+ -- Used to calculate partially consumed timeout on EINTR.
+ -- Better to use Ada.Real_Time, but we can't in current GNAT because
+ -- Ada.Real_Time is in tasking part of runtime.
+
+ Result : Integer;
+ Poll_Timeout : Duration := Timeout;
+ C_Timeout : Interfaces.C.int;
+ Errno : Integer;
+ Stamp : constant Time := Clock;
+ begin
+ if Self.Length = 0 then
+ Count := 0;
+ return;
+ end if;
+
+ loop
+ if Poll_Timeout >= Duration (Interfaces.C.int'Last - 8) / 1_000 then
+ -- Minus 8 is to workaround Linux kernel 2.6.24 bug with close to
+ -- Integer'Last poll timeout values.
+ -- syscall (SYS_poll, &ufds, 1, 2147483644); // is waiting
+ -- syscall (SYS_poll, &ufds, 1, 2147483645); // is not waiting
+ -- Timeout values close to maximum could be not safe because of
+ -- possible time conversion boundary errors in the kernel.
+ -- Use unlimited timeout instead of maximum 24 days timeout for
+ -- safety reasons.
+
+ C_Timeout := -1;
+ else
+ C_Timeout := Interfaces.C.int (Poll_Timeout * 1_000);
+ end if;
+
+ Wait (Self, C_Timeout, Result);
+
+ exit when Result >= 0;
+
+ Errno := Thin.Socket_Errno;
+
+ -- In case of EINTR error we have to continue waiting for network
+ -- events.
+
+ if Errno = SOC.EINTR then
+ if C_Timeout >= 0 then
+ Poll_Timeout := Timeout - (Clock - Stamp);
+
+ if Poll_Timeout < 0.0 then
+ Count := 0;
+ return;
+
+ elsif Poll_Timeout > Timeout then
+ -- Clock moved back in time. This should not be happen when
+ -- we use monotonic time.
+
+ Poll_Timeout := Timeout;
+ end if;
+ end if;
+
+ else
+ Raise_Socket_Error (Errno);
+ end if;
+ end loop;
+
+ Count := Result;
+ end Wait;
+
+ ----------
+ -- Next --
+ ----------
+
+ procedure Next (Self : Set; Index : in out Natural) is
+ begin
+ loop
+ Index := Index + 1;
+
+ if Index > Self.Length then
+ Index := 0;
+ return;
+
+ elsif Self.Fds (Index).REvents /= 0 then
+ return;
+ end if;
+ end loop;
+ end Next;
+
+ ------------
+ -- Status --
+ ------------
+
+ function Status (Self : Set; Index : Positive) return Event_Set is
+ begin
+ Check_Range (Self, Index);
+ return Status (Self.Fds (Index));
+ end Status;
+
+ --------------
+ -- C_Status --
+ --------------
+
+ function C_Status
+ (Self : Set; Index : Positive) return Interfaces.C.unsigned is
+ begin
+ Check_Range (Self, Index);
+ return Interfaces.C.unsigned (Self.Fds (Index).REvents);
+ end C_Status;
+
+end GNAT.Sockets.Poll;
diff --git a/gcc/ada/libgnat/g-socpol.ads b/gcc/ada/libgnat/g-socpol.ads
new file mode 100644
index 0000000..c03c578
--- /dev/null
+++ b/gcc/ada/libgnat/g-socpol.ads
@@ -0,0 +1,216 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides an interface to wait for one of a set of sockets to
+-- become ready to perform I/O.
+
+with System.OS_Constants;
+
+package GNAT.Sockets.Poll is
+
+ type Event_Type is (Input, Output, Error, Hang_Up, Invalid_Request);
+ -- I/O events we can expect on socket.
+ -- Input - socket ready to read;
+ -- Output - socket available for write;
+ -- Error - socket is in error state;
+ -- Hang_Up - peer closed;
+ -- Invalid_Request - invalid socket;
+
+ type Event_Set is array (Event_Type) of Boolean;
+ -- The type to get results on events waiting
+
+ subtype Wait_Event_Type is Event_Type range Input .. Output;
+ type Wait_Event_Set is array (Wait_Event_Type) of Boolean;
+ -- The type to set events to wait. Note that Error event would be waited
+ -- anyway.
+
+ -------------------------------
+ -- Predefined set of events --
+ -------------------------------
+
+ Input_Event : constant Wait_Event_Set;
+ -- Wait for input availability only
+
+ Output_Event : constant Wait_Event_Set;
+ -- Wait for output availability only
+
+ Both_Events : constant Wait_Event_Set;
+ -- Wait for Input and Output availability
+
+ Error_Event : constant Wait_Event_Set;
+ -- Wait only for error state on socket
+
+ type Set (Size : Positive) is private;
+ -- Set of sockets with I/O event set to wait on
+
+ function Create (Size : Positive) return Set;
+ -- Create empty socket set with defined size
+
+ function To_Set
+ (Socket : Socket_Type;
+ Events : Wait_Event_Set;
+ Size : Positive := 1) return Set;
+ -- Create socket set and put the Socket there at the first place.
+ -- Events parameter is defining what state of the socket we are going to
+ -- wait.
+
+ procedure Append
+ (Self : in out Set;
+ Socket : Socket_Type;
+ Events : Wait_Event_Set);
+ -- Add Socket and its I/O waiting state at the end of Self
+
+ procedure Insert
+ (Self : in out Set;
+ Socket : Socket_Type;
+ Events : Wait_Event_Set;
+ Index : Positive;
+ Keep_Order : Boolean := False);
+ -- Insert Socket and its I/O waiting state at the Index position.
+ -- If Keep_Order is True then all next elements moved to the next index up.
+ -- Otherwise the old element from Index moved to the end of the Self set.
+
+ procedure Remove
+ (Self : in out Set; Index : Positive; Keep_Order : Boolean := False);
+ -- Remove socket from Index. If Keep_Order is True then move all next
+ -- elements after removed one to previous index. If Keep_Order is False
+ -- then move the last element on place of the removed one.
+
+ procedure Set_Event
+ (Self : in out Set;
+ Index : Positive;
+ Event : Wait_Event_Type;
+ Value : Boolean);
+ -- Set I/O waiting event to Value for the socket at Index position
+
+ procedure Set_Events
+ (Self : in out Set;
+ Index : Positive;
+ Events : Wait_Event_Set);
+ -- Set I/O waiting events for the socket at Index position
+
+ function Get_Events
+ (Self : Set; Index : Positive) return Wait_Event_Set;
+ -- Get I/O waiting events for the socket at Index position
+
+ function Length (Self : Set) return Natural;
+ -- Get the number of sockets currently in the Self set
+
+ function Full (Self : Set) return Boolean;
+ -- Return True if there is no more space in the Self set for new sockets
+
+ procedure Wait (Self : in out Set; Timeout : Duration; Count : out Natural);
+ -- Wait no longer than Timeout on the socket set for the I/O events.
+ -- Count output parameter is the number of elements in the Self set are
+ -- detected for I/O events. Zero Count mean timeout on wait.
+ -- The iteration over activated elements in set could be done with routine
+ -- Next. The kind of I/O events on element could be cheched with State or
+ -- Status routines.
+
+ procedure Next (Self : Set; Index : in out Natural);
+ -- Iterate over set looking for the next index with active I/O event state.
+ -- Put 0 initially into Index. Each iteration increments Index and then
+ -- checks for state. End of iterations can be detected by 0 in the Index.
+
+ procedure Copy (Source : Set; Target : out Set);
+ -- Copy sockets and its I/O waiting events from Source set into Target
+
+ function Resize (Self : Set; Size : Positive) return Set;
+ -- Returns the copy of Source with modified Size
+
+ function Growth (Self : Set) return Set;
+ -- Returns the copy of Source with increased Size
+
+ function Socket (Self : Set; Index : Positive) return Socket_Type;
+ -- Returns the Socket from Index position
+
+ function Status (Self : Set; Index : Positive) return Event_Set;
+ -- Returns I/O events detected in previous Wait call at Index position
+
+ procedure State
+ (Self : Set;
+ Index : Positive;
+ Socket : out Socket_Type;
+ Status : out Event_Set);
+ -- Returns Socket and its I/O events detected in previous Wait call at
+ -- Index position.
+
+ function C_Status
+ (Self : Set; Index : Positive) return Interfaces.C.unsigned;
+ -- Return word with I/O events detected flags in previous Wait call at
+ -- Index position. Possible flags are defined in System.OS_Constants names
+ -- starting with POLL prefix.
+
+private
+
+ Input_Event : constant Wait_Event_Set := (Input => True, Output => False);
+ Output_Event : constant Wait_Event_Set := (Input => False, Output => True);
+ Both_Events : constant Wait_Event_Set := (others => True);
+ Error_Event : constant Wait_Event_Set := (others => False);
+
+ package SOC renames System.OS_Constants;
+
+ type nfds_t is mod 2 ** SOC.SIZEOF_nfds_t;
+ for nfds_t'Size use SOC.SIZEOF_nfds_t;
+
+ FD_Type_Bound : constant := 2 ** (SOC.SIZEOF_fd_type - 1);
+
+ type FD_Type is range -FD_Type_Bound .. FD_Type_Bound - 1;
+ for FD_Type'Size use SOC.SIZEOF_fd_type;
+
+ type Events_Type is mod 2 ** SOC.SIZEOF_pollfd_events;
+ for Events_Type'Size use SOC.SIZEOF_pollfd_events;
+
+ type Pollfd is record
+ Socket : FD_Type;
+ Events : Events_Type := 0;
+ REvents : Events_Type := 0;
+ end record with Convention => C;
+
+ type Poll_Set is array (Positive range <>) of Pollfd with Convention => C;
+
+ type Set (Size : Positive) is record
+ Length : Natural := 0;
+ Max_FD : FD_Type := 0;
+ Max_OK : Boolean;
+ -- Is the Max_FD actual. It can became inactual after remove socket with
+ -- Max_FD from set and became actual again after add socket with FD more
+ -- than Max_FD.
+ Fds : Poll_Set (1 .. Size);
+ end record;
+
+ function Length (Self : Set) return Natural
+ is (Self.Length);
+
+ function Full (Self : Set) return Boolean
+ is (Self.Size = Self.Length);
+
+end GNAT.Sockets.Poll;
diff --git a/gcc/ada/libgnat/a-numaux__dummy.adb b/gcc/ada/libgnat/g-socpol__dummy.adb
index f5d72ec..01c7cc5 100644
--- a/gcc/ada/libgnat/a-numaux__dummy.adb
+++ b/gcc/ada/libgnat/g-socpol__dummy.adb
@@ -1,12 +1,12 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME COMPONENTS --
+-- GNAT COMPILER COMPONENTS --
-- --
--- A D A . N U M E R I C S . A U X --
+-- G N A T . S O C K E T S . P O L L --
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- Copyright (C) 2020, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/libgnat/g-socpol__dummy.ads b/gcc/ada/libgnat/g-socpol__dummy.ads
new file mode 100644
index 0000000..507471e
--- /dev/null
+++ b/gcc/ada/libgnat/g-socpol__dummy.ads
@@ -0,0 +1,37 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is a placeholder for the sockets binding for platforms where
+-- it is not implemented.
+
+package GNAT.Sockets.Thin_Common is
+ pragma Unimplemented_Unit;
+end GNAT.Sockets.Thin_Common;
diff --git a/gcc/ada/libgnat/g-socthi__mingw.adb b/gcc/ada/libgnat/g-socthi__mingw.adb
index f63a6cb..dd8a68c 100644
--- a/gcc/ada/libgnat/g-socthi__mingw.adb
+++ b/gcc/ada/libgnat/g-socthi__mingw.adb
@@ -375,13 +375,10 @@ package body GNAT.Sockets.Thin is
Exceptfds : access Fd_Set;
Timeout : Timeval_Access) return C.int
is
- pragma Warnings (Off, Exceptfds);
-
- Original_WFS : aliased constant Fd_Set := Writefds.all;
-
- Res : C.int;
- S : aliased C.int;
- Last : aliased C.int;
+ Original_WFS : aliased Fd_Set;
+ Res : C.int;
+ S : aliased C.int;
+ Last : aliased C.int;
begin
-- Asynchronous connection failures are notified in the exception fd
@@ -392,7 +389,8 @@ package body GNAT.Sockets.Thin is
-- present in the initial write fd set, then move the socket from the
-- exception fd set to the write fd set.
- if Writefds /= No_Fd_Set_Access then
+ if Writefds /= null then
+ Original_WFS := Writefds.all;
-- Add any socket present in write fd set into exception fd set
@@ -411,7 +409,7 @@ package body GNAT.Sockets.Thin is
Res := Standard_Select (Nfds, Readfds, Writefds, Exceptfds, Timeout);
- if Exceptfds /= No_Fd_Set_Access then
+ if Exceptfds /= null then
declare
EFSC : aliased Fd_Set := Exceptfds.all;
Flag : constant C.int := SOSC.MSG_PEEK + SOSC.MSG_OOB;
@@ -448,8 +446,8 @@ package body GNAT.Sockets.Thin is
-- exception fd set back to write fd set. Otherwise, ignore
-- this event since the user is not watching for it.
- if Writefds /= No_Fd_Set_Access
- and then (Is_Socket_In_Set (Original_WFS'Access, S) /= 0)
+ if Writefds /= null
+ and then Is_Socket_In_Set (Original_WFS'Access, S) /= 0
then
Insert_Socket_In_Set (Writefds, S);
end if;
@@ -457,6 +455,7 @@ package body GNAT.Sockets.Thin is
end loop;
end;
end if;
+
return Res;
end C_Select;
diff --git a/gcc/ada/libgnat/g-sopowa.adb b/gcc/ada/libgnat/g-sopowa.adb
new file mode 100644
index 0000000..fc6e6d9
--- /dev/null
+++ b/gcc/ada/libgnat/g-sopowa.adb
@@ -0,0 +1,56 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L . W A I T --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Wait implementation on top of native poll call
+--
+-- This submodule can be used on systems where poll system call is natively
+-- supported. Microsoft Windows supports WSAPoll system call from Vista
+-- version and this submodule can be used on such Windows versions too, the
+-- System.OS_Constants.Poll_Linkname constant defines appropriate link name
+-- for Windows. But we do not use WSAPoll in GNAT.Sockets.Poll implementation
+-- for now because it is much slower than select system call, at least in
+-- Windows version 10.0.18363.1016.
+
+separate (GNAT.Sockets.Poll)
+
+procedure Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer)
+is
+
+ function Poll
+ (Fds : Poll_Set;
+ Nfds : nfds_t;
+ Timeout : Interfaces.C.int) return Integer
+ with Import, Convention => Stdcall, External_Name => SOC.Poll_Linkname;
+
+begin
+ Result := Poll (Fds.Fds, nfds_t (Fds.Length), Timeout);
+end Wait;
diff --git a/gcc/ada/libgnat/g-sopowa__mingw.adb b/gcc/ada/libgnat/g-sopowa__mingw.adb
new file mode 100644
index 0000000..3d66437
--- /dev/null
+++ b/gcc/ada/libgnat/g-sopowa__mingw.adb
@@ -0,0 +1,92 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L . W A I T --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Wait implementation on top of Windows select call
+--
+-- Microsoft Windows from Vista version has WSAPoll function in API which is
+-- similar to POSIX poll call, but experiments show that the WSAPoll is much
+-- slower than select at least in Windows version 10.0.18363.1016.
+
+with GNAT.Sockets.Poll.G_Wait;
+
+separate (GNAT.Sockets.Poll)
+
+procedure Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer)
+is
+ use Interfaces;
+
+ type FD_Array is array (1 .. Fds.Length) of FD_Type
+ with Convention => C;
+
+ type FD_Set_Type is record
+ Count : C.int;
+ Set : FD_Array;
+ end record with Convention => C;
+
+ procedure Reset_Socket_Set (Set : in out FD_Set_Type) with Inline;
+
+ procedure Insert_Socket_In_Set (Set : in out FD_Set_Type; FD : FD_Type)
+ with Inline;
+
+ function Is_Socket_In_Set (Set : FD_Set_Type; FD : FD_Type) return C.int
+ with Import, Convention => C,
+ External_Name => "__gnat_is_socket_in_set";
+
+ --------------------------
+ -- Insert_Socket_In_Set --
+ --------------------------
+
+ procedure Insert_Socket_In_Set (Set : in out FD_Set_Type; FD : FD_Type) is
+ begin
+ Set.Count := Set.Count + 1;
+ Set.Set (Integer (Set.Count)) := FD;
+ end Insert_Socket_In_Set;
+
+ ----------------------
+ -- Reset_Socket_Set --
+ ----------------------
+
+ procedure Reset_Socket_Set (Set : in out FD_Set_Type) is
+ begin
+ Set.Count := 0;
+ end Reset_Socket_Set;
+
+ ----------
+ -- Poll --
+ ----------
+
+ procedure Poll is new G_Wait
+ (FD_Set_Type, Reset_Socket_Set, Insert_Socket_In_Set, Is_Socket_In_Set);
+
+begin
+ Poll (Fds, Timeout, Result);
+end Wait;
diff --git a/gcc/ada/libgnat/g-sopowa__posix.adb b/gcc/ada/libgnat/g-sopowa__posix.adb
new file mode 100644
index 0000000..02ccb77
--- /dev/null
+++ b/gcc/ada/libgnat/g-sopowa__posix.adb
@@ -0,0 +1,91 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L . W A I T --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Wait implementation on top of posix select call
+
+with GNAT.Sockets.Poll.G_Wait;
+
+separate (GNAT.Sockets.Poll)
+
+procedure Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer)
+is
+ use Interfaces;
+
+ function Get_Max_FD return FD_Type;
+ -- Check is Max_FD is actual and correct it if necessary
+
+ type FD_Set_Type is array (0 .. Get_Max_FD / C.long'Size) of C.long
+ with Convention => C;
+
+ procedure Reset_Socket_Set (Set : in out FD_Set_Type);
+ -- Use own FD_ZERO routine because FD_Set_Type size depend on Fds.Max_FD
+
+ procedure Insert_Socket_In_Set (Set : in out FD_Set_Type; FD : FD_Type)
+ with Import, Convention => C,
+ External_Name => "__gnat_insert_socket_in_set";
+
+ function Is_Socket_In_Set (Set : FD_Set_Type; FD : FD_Type) return C.int
+ with Import, Convention => C,
+ External_Name => "__gnat_is_socket_in_set";
+
+ procedure Reset_Socket_Set (Set : in out FD_Set_Type) is
+ begin
+ Set := (others => 0);
+ end Reset_Socket_Set;
+
+ procedure Poll is new G_Wait
+ (FD_Set_Type, Reset_Socket_Set, Insert_Socket_In_Set, Is_Socket_In_Set);
+
+ ----------------
+ -- Get_Max_FD --
+ ----------------
+
+ function Get_Max_FD return FD_Type is
+ begin
+ if not Fds.Max_OK then
+ Fds.Max_FD := Fds.Fds (Fds.Fds'First).Socket;
+
+ for J in Fds.Fds'First + 1 .. Fds.Length loop
+ if Fds.Max_FD < Fds.Fds (J).Socket then
+ Fds.Max_FD := Fds.Fds (J).Socket;
+ end if;
+ end loop;
+
+ Fds.Max_OK := True;
+ end if;
+
+ return Fds.Max_FD;
+ end Get_Max_FD;
+
+begin
+ Poll (Fds, Timeout, Result);
+end Wait;
diff --git a/gcc/ada/libgnat/g-spogwa.adb b/gcc/ada/libgnat/g-spogwa.adb
new file mode 100644
index 0000000..a9135ea
--- /dev/null
+++ b/gcc/ada/libgnat/g-spogwa.adb
@@ -0,0 +1,139 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L . G _ W A I T --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with GNAT.Sockets.Thin_Common;
+
+procedure GNAT.Sockets.Poll.G_Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer)
+is
+ use Interfaces;
+
+ use type C.int;
+
+ function C_Select
+ (Nfds : C.int;
+ readfds : access FD_Set_Type;
+ writefds : access FD_Set_Type;
+ exceptfds : access FD_Set_Type;
+ timeout : access Thin_Common.Timeval) return Integer
+ with Import => True, Convention => Stdcall, External_Name => "select";
+
+ Timeout_V : aliased Thin_Common.Timeval;
+ Timeout_A : access Thin_Common.Timeval;
+
+ Rfds : aliased FD_Set_Type;
+ Rcount : Natural := 0;
+ Wfds : aliased FD_Set_Type;
+ Wcount : Natural := 0;
+ Efds : aliased FD_Set_Type;
+
+ Rfdsa : access FD_Set_Type;
+ Wfdsa : access FD_Set_Type;
+
+ FD_Events : Events_Type;
+
+begin
+ -- Setup (convert data from poll to select layout)
+
+ if Timeout >= 0 then
+ Timeout_A := Timeout_V'Access;
+ Timeout_V.tv_sec := Thin_Common.time_t (Timeout / 1000);
+ Timeout_V.tv_usec := Thin_Common.suseconds_t (Timeout rem 1000 * 1000);
+ end if;
+
+ Reset_Socket_Set (Rfds);
+ Reset_Socket_Set (Wfds);
+ Reset_Socket_Set (Efds);
+
+ for J in Fds.Fds'First .. Fds.Length loop
+ Fds.Fds (J).REvents := 0;
+
+ FD_Events := Fds.Fds (J).Events;
+
+ if (FD_Events and (SOC.POLLIN or SOC.POLLPRI)) /= 0 then
+ Insert_Socket_In_Set (Rfds, Fds.Fds (J).Socket);
+ Rcount := Rcount + 1;
+ end if;
+
+ if (FD_Events and SOC.POLLOUT) /= 0 then
+ Insert_Socket_In_Set (Wfds, Fds.Fds (J).Socket);
+ Wcount := Wcount + 1;
+ end if;
+
+ Insert_Socket_In_Set (Efds, Fds.Fds (J).Socket);
+
+ if Fds.Fds (J).Socket > Fds.Max_FD then
+ raise Program_Error with "Wrong Max_FD";
+ end if;
+ end loop;
+
+ -- Any non-null descriptor set must contain at least one handle
+ -- to a socket on Windows (MSDN).
+
+ if Rcount /= 0 then
+ Rfdsa := Rfds'Access;
+ end if;
+
+ if Wcount /= 0 then
+ Wfdsa := Wfds'Access;
+ end if;
+
+ -- Call OS select
+
+ Result :=
+ C_Select (C.int (Fds.Max_FD + 1), Rfdsa, Wfdsa, Efds'Access, Timeout_A);
+
+ -- Build result (convert back from select to poll layout)
+
+ if Result > 0 then
+ Result := 0;
+
+ for J in Fds.Fds'First .. Fds.Length loop
+ if Is_Socket_In_Set (Rfds, Fds.Fds (J).Socket) /= 0 then
+ -- Do not need "or" with Poll_Ptr (J).REvents because it's zero
+
+ Fds.Fds (J).REvents := SOC.POLLIN;
+ end if;
+
+ if Is_Socket_In_Set (Wfds, Fds.Fds (J).Socket) /= 0 then
+ Fds.Fds (J).REvents := Fds.Fds (J).REvents or SOC.POLLOUT;
+ end if;
+
+ if Is_Socket_In_Set (Efds, Fds.Fds (J).Socket) /= 0 then
+ Fds.Fds (J).REvents := Fds.Fds (J).REvents or SOC.POLLERR;
+ end if;
+
+ if Fds.Fds (J).REvents /= 0 then
+ Result := Result + 1;
+ end if;
+ end loop;
+ end if;
+end GNAT.Sockets.Poll.G_Wait;
diff --git a/gcc/ada/libgnat/g-spogwa.ads b/gcc/ada/libgnat/g-spogwa.ads
new file mode 100644
index 0000000..bde6a69
--- /dev/null
+++ b/gcc/ada/libgnat/g-spogwa.ads
@@ -0,0 +1,50 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . P O L L . G _ W A I T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2020, AdaCore --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Interfaces.C;
+
+private generic
+ type FD_Set_Type is private;
+ with procedure Reset_Socket_Set (Set : in out FD_Set_Type);
+ with procedure Insert_Socket_In_Set
+ (Set : in out FD_Set_Type; FD : FD_Type);
+ with function Is_Socket_In_Set
+ (Set : FD_Set_Type; FD : FD_Type) return Interfaces.C.int;
+procedure GNAT.Sockets.Poll.G_Wait
+ (Fds : in out Set; Timeout : Interfaces.C.int; Result : out Integer);
+-- Common code to implement GNAT.Sockets.Poll.Wait routine on top of posix or
+-- win32 select API.
+-- Posix and Win32 select has the same API but different socket set structure.
+-- C API for select has socket set size defined at compilation stage. This Ada
+-- implementation allow to define size of socket set at the execution time.
+-- Unlike C select API we do not need allocate socket set for maximum number
+-- of sockets when we need to check only few of them. And we are not limited
+-- with FD_SETSIZE when we need more sockets to check.
diff --git a/gcc/ada/libgnat/i-cexten__128.ads b/gcc/ada/libgnat/i-cexten__128.ads
new file mode 100644
index 0000000..0c049f3
--- /dev/null
+++ b/gcc/ada/libgnat/i-cexten__128.ads
@@ -0,0 +1,851 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- I N T E R F A C E S . C . E X T E N S I O N S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains additional C-related definitions, intended for use
+-- with either manually or automatically generated bindings to C libraries.
+
+with System;
+
+package Interfaces.C.Extensions is
+ pragma Pure;
+
+ -- Definitions for C "void" and "void *" types
+
+ subtype void is System.Address;
+ subtype void_ptr is System.Address;
+
+ -- Definitions for C incomplete/unknown structs
+
+ subtype opaque_structure_def is System.Address;
+ type opaque_structure_def_ptr is access opaque_structure_def;
+ for opaque_structure_def_ptr'Storage_Size use 0;
+
+ -- Definitions for C++ incomplete/unknown classes
+
+ subtype incomplete_class_def is System.Address;
+ type incomplete_class_def_ptr is access incomplete_class_def;
+ for incomplete_class_def_ptr'Storage_Size use 0;
+
+ -- C bool
+
+ type bool is new Boolean;
+ pragma Convention (C, bool);
+
+ -- 64-bit integer types
+
+ subtype long_long is Interfaces.C.long_long;
+ subtype unsigned_long_long is Interfaces.C.unsigned_long_long;
+
+ -- 128-bit floating-point type available on x86:
+ -- typedef float float_128 __attribute__ ((mode (TF)));
+
+ type Float_128 is record
+ low, high : unsigned_long_long;
+ end record;
+ pragma Convention (C_Pass_By_Copy, Float_128);
+ for Float_128'Alignment use unsigned_long_long'Alignment * 2;
+
+ -- 128-bit complex floating-point type available on x86:
+ -- typedef _Complex float cfloat_128 __attribute__ ((mode (TC)));
+
+ type CFloat_128 is record
+ re, im : Float_128;
+ end record;
+ pragma Convention (C_Pass_By_Copy, CFloat_128);
+
+ -- Types for bitfields
+
+ type Unsigned_1 is mod 2 ** 1;
+ for Unsigned_1'Size use 1;
+
+ type Unsigned_2 is mod 2 ** 2;
+ for Unsigned_2'Size use 2;
+
+ type Unsigned_3 is mod 2 ** 3;
+ for Unsigned_3'Size use 3;
+
+ type Unsigned_4 is mod 2 ** 4;
+ for Unsigned_4'Size use 4;
+
+ type Unsigned_5 is mod 2 ** 5;
+ for Unsigned_5'Size use 5;
+
+ type Unsigned_6 is mod 2 ** 6;
+ for Unsigned_6'Size use 6;
+
+ type Unsigned_7 is mod 2 ** 7;
+ for Unsigned_7'Size use 7;
+
+ type Unsigned_8 is mod 2 ** 8;
+ for Unsigned_8'Size use 8;
+
+ type Unsigned_9 is mod 2 ** 9;
+ for Unsigned_9'Size use 9;
+
+ type Unsigned_10 is mod 2 ** 10;
+ for Unsigned_10'Size use 10;
+
+ type Unsigned_11 is mod 2 ** 11;
+ for Unsigned_11'Size use 11;
+
+ type Unsigned_12 is mod 2 ** 12;
+ for Unsigned_12'Size use 12;
+
+ type Unsigned_13 is mod 2 ** 13;
+ for Unsigned_13'Size use 13;
+
+ type Unsigned_14 is mod 2 ** 14;
+ for Unsigned_14'Size use 14;
+
+ type Unsigned_15 is mod 2 ** 15;
+ for Unsigned_15'Size use 15;
+
+ type Unsigned_16 is mod 2 ** 16;
+ for Unsigned_16'Size use 16;
+
+ type Unsigned_17 is mod 2 ** 17;
+ for Unsigned_17'Size use 17;
+
+ type Unsigned_18 is mod 2 ** 18;
+ for Unsigned_18'Size use 18;
+
+ type Unsigned_19 is mod 2 ** 19;
+ for Unsigned_19'Size use 19;
+
+ type Unsigned_20 is mod 2 ** 20;
+ for Unsigned_20'Size use 20;
+
+ type Unsigned_21 is mod 2 ** 21;
+ for Unsigned_21'Size use 21;
+
+ type Unsigned_22 is mod 2 ** 22;
+ for Unsigned_22'Size use 22;
+
+ type Unsigned_23 is mod 2 ** 23;
+ for Unsigned_23'Size use 23;
+
+ type Unsigned_24 is mod 2 ** 24;
+ for Unsigned_24'Size use 24;
+
+ type Unsigned_25 is mod 2 ** 25;
+ for Unsigned_25'Size use 25;
+
+ type Unsigned_26 is mod 2 ** 26;
+ for Unsigned_26'Size use 26;
+
+ type Unsigned_27 is mod 2 ** 27;
+ for Unsigned_27'Size use 27;
+
+ type Unsigned_28 is mod 2 ** 28;
+ for Unsigned_28'Size use 28;
+
+ type Unsigned_29 is mod 2 ** 29;
+ for Unsigned_29'Size use 29;
+
+ type Unsigned_30 is mod 2 ** 30;
+ for Unsigned_30'Size use 30;
+
+ type Unsigned_31 is mod 2 ** 31;
+ for Unsigned_31'Size use 31;
+
+ type Unsigned_32 is mod 2 ** 32;
+ for Unsigned_32'Size use 32;
+
+ type Unsigned_33 is mod 2 ** 33;
+ for Unsigned_33'Size use 33;
+
+ type Unsigned_34 is mod 2 ** 34;
+ for Unsigned_34'Size use 34;
+
+ type Unsigned_35 is mod 2 ** 35;
+ for Unsigned_35'Size use 35;
+
+ type Unsigned_36 is mod 2 ** 36;
+ for Unsigned_36'Size use 36;
+
+ type Unsigned_37 is mod 2 ** 37;
+ for Unsigned_37'Size use 37;
+
+ type Unsigned_38 is mod 2 ** 38;
+ for Unsigned_38'Size use 38;
+
+ type Unsigned_39 is mod 2 ** 39;
+ for Unsigned_39'Size use 39;
+
+ type Unsigned_40 is mod 2 ** 40;
+ for Unsigned_40'Size use 40;
+
+ type Unsigned_41 is mod 2 ** 41;
+ for Unsigned_41'Size use 41;
+
+ type Unsigned_42 is mod 2 ** 42;
+ for Unsigned_42'Size use 42;
+
+ type Unsigned_43 is mod 2 ** 43;
+ for Unsigned_43'Size use 43;
+
+ type Unsigned_44 is mod 2 ** 44;
+ for Unsigned_44'Size use 44;
+
+ type Unsigned_45 is mod 2 ** 45;
+ for Unsigned_45'Size use 45;
+
+ type Unsigned_46 is mod 2 ** 46;
+ for Unsigned_46'Size use 46;
+
+ type Unsigned_47 is mod 2 ** 47;
+ for Unsigned_47'Size use 47;
+
+ type Unsigned_48 is mod 2 ** 48;
+ for Unsigned_48'Size use 48;
+
+ type Unsigned_49 is mod 2 ** 49;
+ for Unsigned_49'Size use 49;
+
+ type Unsigned_50 is mod 2 ** 50;
+ for Unsigned_50'Size use 50;
+
+ type Unsigned_51 is mod 2 ** 51;
+ for Unsigned_51'Size use 51;
+
+ type Unsigned_52 is mod 2 ** 52;
+ for Unsigned_52'Size use 52;
+
+ type Unsigned_53 is mod 2 ** 53;
+ for Unsigned_53'Size use 53;
+
+ type Unsigned_54 is mod 2 ** 54;
+ for Unsigned_54'Size use 54;
+
+ type Unsigned_55 is mod 2 ** 55;
+ for Unsigned_55'Size use 55;
+
+ type Unsigned_56 is mod 2 ** 56;
+ for Unsigned_56'Size use 56;
+
+ type Unsigned_57 is mod 2 ** 57;
+ for Unsigned_57'Size use 57;
+
+ type Unsigned_58 is mod 2 ** 58;
+ for Unsigned_58'Size use 58;
+
+ type Unsigned_59 is mod 2 ** 59;
+ for Unsigned_59'Size use 59;
+
+ type Unsigned_60 is mod 2 ** 60;
+ for Unsigned_60'Size use 60;
+
+ type Unsigned_61 is mod 2 ** 61;
+ for Unsigned_61'Size use 61;
+
+ type Unsigned_62 is mod 2 ** 62;
+ for Unsigned_62'Size use 62;
+
+ type Unsigned_63 is mod 2 ** 63;
+ for Unsigned_63'Size use 63;
+
+ type Unsigned_64 is mod 2 ** 64;
+ for Unsigned_64'Size use 64;
+
+ type Unsigned_65 is mod 2 ** 65;
+ for Unsigned_65'Size use 65;
+
+ type Unsigned_66 is mod 2 ** 66;
+ for Unsigned_66'Size use 66;
+
+ type Unsigned_67 is mod 2 ** 67;
+ for Unsigned_67'Size use 67;
+
+ type Unsigned_68 is mod 2 ** 68;
+ for Unsigned_68'Size use 68;
+
+ type Unsigned_69 is mod 2 ** 69;
+ for Unsigned_69'Size use 69;
+
+ type Unsigned_70 is mod 2 ** 70;
+ for Unsigned_70'Size use 70;
+
+ type Unsigned_71 is mod 2 ** 71;
+ for Unsigned_71'Size use 71;
+
+ type Unsigned_72 is mod 2 ** 72;
+ for Unsigned_72'Size use 72;
+
+ type Unsigned_73 is mod 2 ** 73;
+ for Unsigned_73'Size use 73;
+
+ type Unsigned_74 is mod 2 ** 74;
+ for Unsigned_74'Size use 74;
+
+ type Unsigned_75 is mod 2 ** 75;
+ for Unsigned_75'Size use 75;
+
+ type Unsigned_76 is mod 2 ** 76;
+ for Unsigned_76'Size use 76;
+
+ type Unsigned_77 is mod 2 ** 77;
+ for Unsigned_77'Size use 77;
+
+ type Unsigned_78 is mod 2 ** 78;
+ for Unsigned_78'Size use 78;
+
+ type Unsigned_79 is mod 2 ** 79;
+ for Unsigned_79'Size use 79;
+
+ type Unsigned_80 is mod 2 ** 80;
+ for Unsigned_80'Size use 80;
+
+ type Unsigned_81 is mod 2 ** 81;
+ for Unsigned_81'Size use 81;
+
+ type Unsigned_82 is mod 2 ** 82;
+ for Unsigned_82'Size use 82;
+
+ type Unsigned_83 is mod 2 ** 83;
+ for Unsigned_83'Size use 83;
+
+ type Unsigned_84 is mod 2 ** 84;
+ for Unsigned_84'Size use 84;
+
+ type Unsigned_85 is mod 2 ** 85;
+ for Unsigned_85'Size use 85;
+
+ type Unsigned_86 is mod 2 ** 86;
+ for Unsigned_86'Size use 86;
+
+ type Unsigned_87 is mod 2 ** 87;
+ for Unsigned_87'Size use 87;
+
+ type Unsigned_88 is mod 2 ** 88;
+ for Unsigned_88'Size use 88;
+
+ type Unsigned_89 is mod 2 ** 89;
+ for Unsigned_89'Size use 89;
+
+ type Unsigned_90 is mod 2 ** 90;
+ for Unsigned_90'Size use 90;
+
+ type Unsigned_91 is mod 2 ** 91;
+ for Unsigned_91'Size use 91;
+
+ type Unsigned_92 is mod 2 ** 92;
+ for Unsigned_92'Size use 92;
+
+ type Unsigned_93 is mod 2 ** 93;
+ for Unsigned_93'Size use 93;
+
+ type Unsigned_94 is mod 2 ** 94;
+ for Unsigned_94'Size use 94;
+
+ type Unsigned_95 is mod 2 ** 95;
+ for Unsigned_95'Size use 95;
+
+ type Unsigned_96 is mod 2 ** 96;
+ for Unsigned_96'Size use 96;
+
+ type Unsigned_97 is mod 2 ** 97;
+ for Unsigned_97'Size use 97;
+
+ type Unsigned_98 is mod 2 ** 98;
+ for Unsigned_98'Size use 98;
+
+ type Unsigned_99 is mod 2 ** 99;
+ for Unsigned_99'Size use 99;
+
+ type Unsigned_100 is mod 2 ** 100;
+ for Unsigned_100'Size use 100;
+
+ type Unsigned_101 is mod 2 ** 101;
+ for Unsigned_101'Size use 101;
+
+ type Unsigned_102 is mod 2 ** 102;
+ for Unsigned_102'Size use 102;
+
+ type Unsigned_103 is mod 2 ** 103;
+ for Unsigned_103'Size use 103;
+
+ type Unsigned_104 is mod 2 ** 104;
+ for Unsigned_104'Size use 104;
+
+ type Unsigned_105 is mod 2 ** 105;
+ for Unsigned_105'Size use 105;
+
+ type Unsigned_106 is mod 2 ** 106;
+ for Unsigned_106'Size use 106;
+
+ type Unsigned_107 is mod 2 ** 107;
+ for Unsigned_107'Size use 107;
+
+ type Unsigned_108 is mod 2 ** 108;
+ for Unsigned_108'Size use 108;
+
+ type Unsigned_109 is mod 2 ** 109;
+ for Unsigned_109'Size use 109;
+
+ type Unsigned_110 is mod 2 ** 110;
+ for Unsigned_110'Size use 110;
+
+ type Unsigned_111 is mod 2 ** 111;
+ for Unsigned_111'Size use 111;
+
+ type Unsigned_112 is mod 2 ** 112;
+ for Unsigned_112'Size use 112;
+
+ type Unsigned_113 is mod 2 ** 113;
+ for Unsigned_113'Size use 113;
+
+ type Unsigned_114 is mod 2 ** 114;
+ for Unsigned_114'Size use 114;
+
+ type Unsigned_115 is mod 2 ** 115;
+ for Unsigned_115'Size use 115;
+
+ type Unsigned_116 is mod 2 ** 116;
+ for Unsigned_116'Size use 116;
+
+ type Unsigned_117 is mod 2 ** 117;
+ for Unsigned_117'Size use 117;
+
+ type Unsigned_118 is mod 2 ** 118;
+ for Unsigned_118'Size use 118;
+
+ type Unsigned_119 is mod 2 ** 119;
+ for Unsigned_119'Size use 119;
+
+ type Unsigned_120 is mod 2 ** 120;
+ for Unsigned_120'Size use 120;
+
+ type Unsigned_121 is mod 2 ** 121;
+ for Unsigned_121'Size use 121;
+
+ type Unsigned_122 is mod 2 ** 122;
+ for Unsigned_122'Size use 122;
+
+ type Unsigned_123 is mod 2 ** 123;
+ for Unsigned_123'Size use 123;
+
+ type Unsigned_124 is mod 2 ** 124;
+ for Unsigned_124'Size use 124;
+
+ type Unsigned_125 is mod 2 ** 125;
+ for Unsigned_125'Size use 125;
+
+ type Unsigned_126 is mod 2 ** 126;
+ for Unsigned_126'Size use 126;
+
+ type Unsigned_127 is mod 2 ** 127;
+ for Unsigned_127'Size use 127;
+
+ type Unsigned_128 is mod 2 ** 128;
+ for Unsigned_128'Size use 128;
+
+ type Signed_2 is range -2 ** 1 .. 2 ** 1 - 1;
+ for Signed_2'Size use 2;
+
+ type Signed_3 is range -2 ** 2 .. 2 ** 2 - 1;
+ for Signed_3'Size use 3;
+
+ type Signed_4 is range -2 ** 3 .. 2 ** 3 - 1;
+ for Signed_4'Size use 4;
+
+ type Signed_5 is range -2 ** 4 .. 2 ** 4 - 1;
+ for Signed_5'Size use 5;
+
+ type Signed_6 is range -2 ** 5 .. 2 ** 5 - 1;
+ for Signed_6'Size use 6;
+
+ type Signed_7 is range -2 ** 6 .. 2 ** 6 - 1;
+ for Signed_7'Size use 7;
+
+ type Signed_8 is range -2 ** 7 .. 2 ** 7 - 1;
+ for Signed_8'Size use 8;
+
+ type Signed_9 is range -2 ** 8 .. 2 ** 8 - 1;
+ for Signed_9'Size use 9;
+
+ type Signed_10 is range -2 ** 9 .. 2 ** 9 - 1;
+ for Signed_10'Size use 10;
+
+ type Signed_11 is range -2 ** 10 .. 2 ** 10 - 1;
+ for Signed_11'Size use 11;
+
+ type Signed_12 is range -2 ** 11 .. 2 ** 11 - 1;
+ for Signed_12'Size use 12;
+
+ type Signed_13 is range -2 ** 12 .. 2 ** 12 - 1;
+ for Signed_13'Size use 13;
+
+ type Signed_14 is range -2 ** 13 .. 2 ** 13 - 1;
+ for Signed_14'Size use 14;
+
+ type Signed_15 is range -2 ** 14 .. 2 ** 14 - 1;
+ for Signed_15'Size use 15;
+
+ type Signed_16 is range -2 ** 15 .. 2 ** 15 - 1;
+ for Signed_16'Size use 16;
+
+ type Signed_17 is range -2 ** 16 .. 2 ** 16 - 1;
+ for Signed_17'Size use 17;
+
+ type Signed_18 is range -2 ** 17 .. 2 ** 17 - 1;
+ for Signed_18'Size use 18;
+
+ type Signed_19 is range -2 ** 18 .. 2 ** 18 - 1;
+ for Signed_19'Size use 19;
+
+ type Signed_20 is range -2 ** 19 .. 2 ** 19 - 1;
+ for Signed_20'Size use 20;
+
+ type Signed_21 is range -2 ** 20 .. 2 ** 20 - 1;
+ for Signed_21'Size use 21;
+
+ type Signed_22 is range -2 ** 21 .. 2 ** 21 - 1;
+ for Signed_22'Size use 22;
+
+ type Signed_23 is range -2 ** 22 .. 2 ** 22 - 1;
+ for Signed_23'Size use 23;
+
+ type Signed_24 is range -2 ** 23 .. 2 ** 23 - 1;
+ for Signed_24'Size use 24;
+
+ type Signed_25 is range -2 ** 24 .. 2 ** 24 - 1;
+ for Signed_25'Size use 25;
+
+ type Signed_26 is range -2 ** 25 .. 2 ** 25 - 1;
+ for Signed_26'Size use 26;
+
+ type Signed_27 is range -2 ** 26 .. 2 ** 26 - 1;
+ for Signed_27'Size use 27;
+
+ type Signed_28 is range -2 ** 27 .. 2 ** 27 - 1;
+ for Signed_28'Size use 28;
+
+ type Signed_29 is range -2 ** 28 .. 2 ** 28 - 1;
+ for Signed_29'Size use 29;
+
+ type Signed_30 is range -2 ** 29 .. 2 ** 29 - 1;
+ for Signed_30'Size use 30;
+
+ type Signed_31 is range -2 ** 30 .. 2 ** 30 - 1;
+ for Signed_31'Size use 31;
+
+ type Signed_32 is range -2 ** 31 .. 2 ** 31 - 1;
+ for Signed_32'Size use 32;
+
+ type Signed_33 is range -2 ** 32 .. 2 ** 32 - 1;
+ for Signed_33'Size use 33;
+
+ type Signed_34 is range -2 ** 33 .. 2 ** 33 - 1;
+ for Signed_34'Size use 34;
+
+ type Signed_35 is range -2 ** 34 .. 2 ** 34 - 1;
+ for Signed_35'Size use 35;
+
+ type Signed_36 is range -2 ** 35 .. 2 ** 35 - 1;
+ for Signed_36'Size use 36;
+
+ type Signed_37 is range -2 ** 36 .. 2 ** 36 - 1;
+ for Signed_37'Size use 37;
+
+ type Signed_38 is range -2 ** 37 .. 2 ** 37 - 1;
+ for Signed_38'Size use 38;
+
+ type Signed_39 is range -2 ** 38 .. 2 ** 38 - 1;
+ for Signed_39'Size use 39;
+
+ type Signed_40 is range -2 ** 39 .. 2 ** 39 - 1;
+ for Signed_40'Size use 40;
+
+ type Signed_41 is range -2 ** 40 .. 2 ** 40 - 1;
+ for Signed_41'Size use 41;
+
+ type Signed_42 is range -2 ** 41 .. 2 ** 41 - 1;
+ for Signed_42'Size use 42;
+
+ type Signed_43 is range -2 ** 42 .. 2 ** 42 - 1;
+ for Signed_43'Size use 43;
+
+ type Signed_44 is range -2 ** 43 .. 2 ** 43 - 1;
+ for Signed_44'Size use 44;
+
+ type Signed_45 is range -2 ** 44 .. 2 ** 44 - 1;
+ for Signed_45'Size use 45;
+
+ type Signed_46 is range -2 ** 45 .. 2 ** 45 - 1;
+ for Signed_46'Size use 46;
+
+ type Signed_47 is range -2 ** 46 .. 2 ** 46 - 1;
+ for Signed_47'Size use 47;
+
+ type Signed_48 is range -2 ** 47 .. 2 ** 47 - 1;
+ for Signed_48'Size use 48;
+
+ type Signed_49 is range -2 ** 48 .. 2 ** 48 - 1;
+ for Signed_49'Size use 49;
+
+ type Signed_50 is range -2 ** 49 .. 2 ** 49 - 1;
+ for Signed_50'Size use 50;
+
+ type Signed_51 is range -2 ** 50 .. 2 ** 50 - 1;
+ for Signed_51'Size use 51;
+
+ type Signed_52 is range -2 ** 51 .. 2 ** 51 - 1;
+ for Signed_52'Size use 52;
+
+ type Signed_53 is range -2 ** 52 .. 2 ** 52 - 1;
+ for Signed_53'Size use 53;
+
+ type Signed_54 is range -2 ** 53 .. 2 ** 53 - 1;
+ for Signed_54'Size use 54;
+
+ type Signed_55 is range -2 ** 54 .. 2 ** 54 - 1;
+ for Signed_55'Size use 55;
+
+ type Signed_56 is range -2 ** 55 .. 2 ** 55 - 1;
+ for Signed_56'Size use 56;
+
+ type Signed_57 is range -2 ** 56 .. 2 ** 56 - 1;
+ for Signed_57'Size use 57;
+
+ type Signed_58 is range -2 ** 57 .. 2 ** 57 - 1;
+ for Signed_58'Size use 58;
+
+ type Signed_59 is range -2 ** 58 .. 2 ** 58 - 1;
+ for Signed_59'Size use 59;
+
+ type Signed_60 is range -2 ** 59 .. 2 ** 59 - 1;
+ for Signed_60'Size use 60;
+
+ type Signed_61 is range -2 ** 60 .. 2 ** 60 - 1;
+ for Signed_61'Size use 61;
+
+ type Signed_62 is range -2 ** 61 .. 2 ** 61 - 1;
+ for Signed_62'Size use 62;
+
+ type Signed_63 is range -2 ** 62 .. 2 ** 62 - 1;
+ for Signed_63'Size use 63;
+
+ type Signed_64 is range -2 ** 63 .. 2 ** 63 - 1;
+ for Signed_64'Size use 64;
+
+ type Signed_65 is range -2 ** 64 .. 2 ** 64 - 1;
+ for Signed_65'Size use 65;
+
+ type Signed_66 is range -2 ** 65 .. 2 ** 65 - 1;
+ for Signed_66'Size use 66;
+
+ type Signed_67 is range -2 ** 66 .. 2 ** 66 - 1;
+ for Signed_67'Size use 67;
+
+ type Signed_68 is range -2 ** 67 .. 2 ** 67 - 1;
+ for Signed_68'Size use 68;
+
+ type Signed_69 is range -2 ** 68 .. 2 ** 68 - 1;
+ for Signed_69'Size use 69;
+
+ type Signed_70 is range -2 ** 69 .. 2 ** 69 - 1;
+ for Signed_70'Size use 70;
+
+ type Signed_71 is range -2 ** 70 .. 2 ** 70 - 1;
+ for Signed_71'Size use 71;
+
+ type Signed_72 is range -2 ** 71 .. 2 ** 71 - 1;
+ for Signed_72'Size use 72;
+
+ type Signed_73 is range -2 ** 72 .. 2 ** 72 - 1;
+ for Signed_73'Size use 73;
+
+ type Signed_74 is range -2 ** 73 .. 2 ** 73 - 1;
+ for Signed_74'Size use 74;
+
+ type Signed_75 is range -2 ** 74 .. 2 ** 74 - 1;
+ for Signed_75'Size use 75;
+
+ type Signed_76 is range -2 ** 75 .. 2 ** 75 - 1;
+ for Signed_76'Size use 76;
+
+ type Signed_77 is range -2 ** 76 .. 2 ** 76 - 1;
+ for Signed_77'Size use 77;
+
+ type Signed_78 is range -2 ** 77 .. 2 ** 77 - 1;
+ for Signed_78'Size use 78;
+
+ type Signed_79 is range -2 ** 78 .. 2 ** 78 - 1;
+ for Signed_79'Size use 79;
+
+ type Signed_80 is range -2 ** 79 .. 2 ** 79 - 1;
+ for Signed_80'Size use 80;
+
+ type Signed_81 is range -2 ** 80 .. 2 ** 80 - 1;
+ for Signed_81'Size use 81;
+
+ type Signed_82 is range -2 ** 81 .. 2 ** 81 - 1;
+ for Signed_82'Size use 82;
+
+ type Signed_83 is range -2 ** 82 .. 2 ** 82 - 1;
+ for Signed_83'Size use 83;
+
+ type Signed_84 is range -2 ** 83 .. 2 ** 83 - 1;
+ for Signed_84'Size use 84;
+
+ type Signed_85 is range -2 ** 84 .. 2 ** 84 - 1;
+ for Signed_85'Size use 85;
+
+ type Signed_86 is range -2 ** 85 .. 2 ** 85 - 1;
+ for Signed_86'Size use 86;
+
+ type Signed_87 is range -2 ** 86 .. 2 ** 86 - 1;
+ for Signed_87'Size use 87;
+
+ type Signed_88 is range -2 ** 87 .. 2 ** 87 - 1;
+ for Signed_88'Size use 88;
+
+ type Signed_89 is range -2 ** 88 .. 2 ** 88 - 1;
+ for Signed_89'Size use 89;
+
+ type Signed_90 is range -2 ** 89 .. 2 ** 89 - 1;
+ for Signed_90'Size use 90;
+
+ type Signed_91 is range -2 ** 90 .. 2 ** 90 - 1;
+ for Signed_91'Size use 91;
+
+ type Signed_92 is range -2 ** 91 .. 2 ** 91 - 1;
+ for Signed_92'Size use 92;
+
+ type Signed_93 is range -2 ** 92 .. 2 ** 92 - 1;
+ for Signed_93'Size use 93;
+
+ type Signed_94 is range -2 ** 93 .. 2 ** 93 - 1;
+ for Signed_94'Size use 94;
+
+ type Signed_95 is range -2 ** 94 .. 2 ** 94 - 1;
+ for Signed_95'Size use 95;
+
+ type Signed_96 is range -2 ** 95 .. 2 ** 95 - 1;
+ for Signed_96'Size use 96;
+
+ type Signed_97 is range -2 ** 96 .. 2 ** 96 - 1;
+ for Signed_97'Size use 97;
+
+ type Signed_98 is range -2 ** 97 .. 2 ** 97 - 1;
+ for Signed_98'Size use 98;
+
+ type Signed_99 is range -2 ** 98 .. 2 ** 98 - 1;
+ for Signed_99'Size use 99;
+
+ type Signed_100 is range -2 ** 99 .. 2 ** 99 - 1;
+ for Signed_100'Size use 100;
+
+ type Signed_101 is range -2 ** 100 .. 2 ** 100 - 1;
+ for Signed_101'Size use 101;
+
+ type Signed_102 is range -2 ** 101 .. 2 ** 101 - 1;
+ for Signed_102'Size use 102;
+
+ type Signed_103 is range -2 ** 102 .. 2 ** 102 - 1;
+ for Signed_103'Size use 103;
+
+ type Signed_104 is range -2 ** 103 .. 2 ** 103 - 1;
+ for Signed_104'Size use 104;
+
+ type Signed_105 is range -2 ** 104 .. 2 ** 104 - 1;
+ for Signed_105'Size use 105;
+
+ type Signed_106 is range -2 ** 105 .. 2 ** 105 - 1;
+ for Signed_106'Size use 106;
+
+ type Signed_107 is range -2 ** 106 .. 2 ** 106 - 1;
+ for Signed_107'Size use 107;
+
+ type Signed_108 is range -2 ** 107 .. 2 ** 107 - 1;
+ for Signed_108'Size use 108;
+
+ type Signed_109 is range -2 ** 108 .. 2 ** 108 - 1;
+ for Signed_109'Size use 109;
+
+ type Signed_110 is range -2 ** 109 .. 2 ** 109 - 1;
+ for Signed_110'Size use 110;
+
+ type Signed_111 is range -2 ** 110 .. 2 ** 110 - 1;
+ for Signed_111'Size use 111;
+
+ type Signed_112 is range -2 ** 111 .. 2 ** 111 - 1;
+ for Signed_112'Size use 112;
+
+ type Signed_113 is range -2 ** 112 .. 2 ** 112 - 1;
+ for Signed_113'Size use 113;
+
+ type Signed_114 is range -2 ** 113 .. 2 ** 113 - 1;
+ for Signed_114'Size use 114;
+
+ type Signed_115 is range -2 ** 114 .. 2 ** 114 - 1;
+ for Signed_115'Size use 115;
+
+ type Signed_116 is range -2 ** 115 .. 2 ** 115 - 1;
+ for Signed_116'Size use 116;
+
+ type Signed_117 is range -2 ** 116 .. 2 ** 116 - 1;
+ for Signed_117'Size use 117;
+
+ type Signed_118 is range -2 ** 117 .. 2 ** 117 - 1;
+ for Signed_118'Size use 118;
+
+ type Signed_119 is range -2 ** 118 .. 2 ** 118 - 1;
+ for Signed_119'Size use 119;
+
+ type Signed_120 is range -2 ** 119 .. 2 ** 119 - 1;
+ for Signed_120'Size use 120;
+
+ type Signed_121 is range -2 ** 120 .. 2 ** 120 - 1;
+ for Signed_121'Size use 121;
+
+ type Signed_122 is range -2 ** 121 .. 2 ** 121 - 1;
+ for Signed_122'Size use 122;
+
+ type Signed_123 is range -2 ** 122 .. 2 ** 122 - 1;
+ for Signed_123'Size use 123;
+
+ type Signed_124 is range -2 ** 123 .. 2 ** 123 - 1;
+ for Signed_124'Size use 124;
+
+ type Signed_125 is range -2 ** 124 .. 2 ** 124 - 1;
+ for Signed_125'Size use 125;
+
+ type Signed_126 is range -2 ** 125 .. 2 ** 125 - 1;
+ for Signed_126'Size use 126;
+
+ type Signed_127 is range -2 ** 126 .. 2 ** 126 - 1;
+ for Signed_127'Size use 127;
+
+ type Signed_128 is range -2 ** 127 .. 2 ** 127 - 1;
+ for Signed_128'Size use 128;
+
+end Interfaces.C.Extensions;
diff --git a/gcc/ada/libgnat/interfac.ads b/gcc/ada/libgnat/interfac.ads
index 9fe7aac..9e7dfba 100644
--- a/gcc/ada/libgnat/interfac.ads
+++ b/gcc/ada/libgnat/interfac.ads
@@ -33,6 +33,8 @@
-- --
------------------------------------------------------------------------------
+-- This is the compiler version of this unit
+
pragma Compiler_Unit_Warning;
package Interfaces is
diff --git a/gcc/ada/libgnat/interfac__2020.ads b/gcc/ada/libgnat/interfac__2020.ads
new file mode 100644
index 0000000..2865fc2
--- /dev/null
+++ b/gcc/ada/libgnat/interfac__2020.ads
@@ -0,0 +1,231 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- I N T E R F A C E S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2002-2020, Free Software Foundation, Inc. --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
+-- apply solely to the implementation dependent sections of this file. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the runtime version of this unit (not used during GNAT build)
+
+package Interfaces is
+ pragma No_Elaboration_Code_All;
+ pragma Pure;
+
+ -- All identifiers in this unit are implementation defined
+
+ pragma Implementation_Defined;
+
+ type Integer_8 is range -2 ** 7 .. 2 ** 7 - 1;
+ for Integer_8'Size use 8;
+
+ type Integer_16 is range -2 ** 15 .. 2 ** 15 - 1;
+ for Integer_16'Size use 16;
+
+ type Integer_32 is range -2 ** 31 .. 2 ** 31 - 1;
+ for Integer_32'Size use 32;
+
+ type Integer_64 is new Long_Long_Integer;
+ for Integer_64'Size use 64;
+ -- Note: we use Long_Long_Integer'First instead of -2 ** 63 to allow this
+ -- unit to compile when using custom target configuration files where the
+ -- maximum integer is 32 bits. This is useful for static analysis tools
+ -- such as SPARK or CodePeer. In the normal case Long_Long_Integer is
+ -- always 64-bits so we get the desired 64-bit type.
+
+ type Integer_128 is new Long_Long_Long_Integer;
+ -- Note: we use Long_Long_Long_Integer instead of literal bounds to allow
+ -- this unit to be compiled with compilers not supporting 128-bit integers.
+ -- We do not put a confirming size clause of 128 bits for the same reason.
+
+ type Unsigned_8 is mod 2 ** 8;
+ for Unsigned_8'Size use 8;
+
+ type Unsigned_16 is mod 2 ** 16;
+ for Unsigned_16'Size use 16;
+
+ type Unsigned_24 is mod 2 ** 24;
+ for Unsigned_24'Size use 24;
+ -- Declare this type for compatibility with legacy Ada compilers.
+ -- This is particularly useful in the context of CodePeer analysis.
+
+ type Unsigned_32 is mod 2 ** 32;
+ for Unsigned_32'Size use 32;
+
+ type Unsigned_64 is mod 2 ** Long_Long_Integer'Size;
+ for Unsigned_64'Size use 64;
+ -- See comment on Integer_64 above
+
+ type Unsigned_128 is mod 2 ** Long_Long_Long_Integer'Size;
+ -- See comment on Integer_128 above
+
+ function Shift_Left
+ (Value : Unsigned_8;
+ Amount : Natural) return Unsigned_8
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right
+ (Value : Unsigned_8;
+ Amount : Natural) return Unsigned_8
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right_Arithmetic
+ (Value : Unsigned_8;
+ Amount : Natural) return Unsigned_8
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Left
+ (Value : Unsigned_8;
+ Amount : Natural) return Unsigned_8
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Right
+ (Value : Unsigned_8;
+ Amount : Natural) return Unsigned_8
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Left
+ (Value : Unsigned_16;
+ Amount : Natural) return Unsigned_16
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right
+ (Value : Unsigned_16;
+ Amount : Natural) return Unsigned_16
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right_Arithmetic
+ (Value : Unsigned_16;
+ Amount : Natural) return Unsigned_16
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Left
+ (Value : Unsigned_16;
+ Amount : Natural) return Unsigned_16
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Right
+ (Value : Unsigned_16;
+ Amount : Natural) return Unsigned_16
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Left
+ (Value : Unsigned_32;
+ Amount : Natural) return Unsigned_32
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right
+ (Value : Unsigned_32;
+ Amount : Natural) return Unsigned_32
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right_Arithmetic
+ (Value : Unsigned_32;
+ Amount : Natural) return Unsigned_32
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Left
+ (Value : Unsigned_32;
+ Amount : Natural) return Unsigned_32
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Right
+ (Value : Unsigned_32;
+ Amount : Natural) return Unsigned_32
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Left
+ (Value : Unsigned_64;
+ Amount : Natural) return Unsigned_64
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right
+ (Value : Unsigned_64;
+ Amount : Natural) return Unsigned_64
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right_Arithmetic
+ (Value : Unsigned_64;
+ Amount : Natural) return Unsigned_64
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Left
+ (Value : Unsigned_64;
+ Amount : Natural) return Unsigned_64
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Right
+ (Value : Unsigned_64;
+ Amount : Natural) return Unsigned_64
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Left
+ (Value : Unsigned_128;
+ Amount : Natural) return Unsigned_128
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right
+ (Value : Unsigned_128;
+ Amount : Natural) return Unsigned_128
+ with Import, Convention => Intrinsic, Static;
+
+ function Shift_Right_Arithmetic
+ (Value : Unsigned_128;
+ Amount : Natural) return Unsigned_128
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Left
+ (Value : Unsigned_128;
+ Amount : Natural) return Unsigned_128
+ with Import, Convention => Intrinsic, Static;
+
+ function Rotate_Right
+ (Value : Unsigned_128;
+ Amount : Natural) return Unsigned_128
+ with Import, Convention => Intrinsic, Static;
+
+ -- IEEE Floating point types
+
+ type IEEE_Float_32 is digits 6;
+ for IEEE_Float_32'Size use 32;
+
+ type IEEE_Float_64 is digits 15;
+ for IEEE_Float_64'Size use 64;
+
+ -- If there is an IEEE extended float available on the machine, we assume
+ -- that it is available as Long_Long_Float.
+
+ -- Note: it is harmless, and explicitly permitted, to include additional
+ -- types in interfaces, so it is not wrong to have IEEE_Extended_Float
+ -- defined even if the extended format is not available.
+
+ type IEEE_Extended_Float is new Long_Long_Float;
+
+end Interfaces;
diff --git a/gcc/ada/libgnat/s-aridou.adb b/gcc/ada/libgnat/s-aridou.adb
new file mode 100644
index 0000000..05a8c9f
--- /dev/null
+++ b/gcc/ada/libgnat/s-aridou.adb
@@ -0,0 +1,678 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . A R I T H _ D O U B L E --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Unchecked_Conversion;
+
+package body System.Arith_Double is
+
+ pragma Suppress (Overflow_Check);
+ pragma Suppress (Range_Check);
+
+ function To_Uns is new Ada.Unchecked_Conversion (Double_Int, Double_Uns);
+ function To_Int is new Ada.Unchecked_Conversion (Double_Uns, Double_Int);
+
+ Double_Size : constant Natural := Double_Int'Size;
+ Single_Size : constant Natural := Double_Int'Size / 2;
+
+ -----------------------
+ -- Local Subprograms --
+ -----------------------
+
+ function "+" (A, B : Single_Uns) return Double_Uns is
+ (Double_Uns (A) + Double_Uns (B));
+ function "+" (A : Double_Uns; B : Single_Uns) return Double_Uns is
+ (A + Double_Uns (B));
+ -- Length doubling additions
+
+ function "*" (A, B : Single_Uns) return Double_Uns is
+ (Double_Uns (A) * Double_Uns (B));
+ -- Length doubling multiplication
+
+ function "/" (A : Double_Uns; B : Single_Uns) return Double_Uns is
+ (A / Double_Uns (B));
+ -- Length doubling division
+
+ function "&" (Hi, Lo : Single_Uns) return Double_Uns is
+ (Shift_Left (Double_Uns (Hi), Single_Size) or Double_Uns (Lo));
+ -- Concatenate hi, lo values to form double result
+
+ function "abs" (X : Double_Int) return Double_Uns is
+ (if X = Double_Int'First
+ then 2 ** (Double_Size - 1)
+ else Double_Uns (Double_Int'(abs X)));
+ -- Convert absolute value of X to unsigned. Note that we can't just use
+ -- the expression of the Else since it overflows for X = Double_Int'First.
+
+ function "rem" (A : Double_Uns; B : Single_Uns) return Double_Uns is
+ (A rem Double_Uns (B));
+ -- Length doubling remainder
+
+ function Le3 (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) return Boolean;
+ -- Determines if (3 * Single_Size)-bit value X1&X2&X3 <= Y1&Y2&Y3
+
+ function Lo (A : Double_Uns) return Single_Uns is
+ (Single_Uns (A and (2 ** Single_Size - 1)));
+ -- Low order half of double value
+
+ function Hi (A : Double_Uns) return Single_Uns is
+ (Single_Uns (Shift_Right (A, Single_Size)));
+ -- High order half of double value
+
+ procedure Sub3 (X1, X2, X3 : in out Single_Uns; Y1, Y2, Y3 : Single_Uns);
+ -- Computes X1&X2&X3 := X1&X2&X3 - Y1&Y1&Y3 mod 2 ** (3 * Single_Size)
+
+ function To_Neg_Int (A : Double_Uns) return Double_Int;
+ -- Convert to negative integer equivalent. If the input is in the range
+ -- 0 .. 2 ** (Double_Size - 1), then the corresponding nonpositive signed
+ -- integer (obtained by negating the given value) is returned, otherwise
+ -- constraint error is raised.
+
+ function To_Pos_Int (A : Double_Uns) return Double_Int;
+ -- Convert to positive integer equivalent. If the input is in the range
+ -- 0 .. 2 ** (Double_Size - 1) - 1, then the corresponding non-negative
+ -- signed integer is returned, otherwise constraint error is raised.
+
+ procedure Raise_Error;
+ pragma No_Return (Raise_Error);
+ -- Raise constraint error with appropriate message
+
+ --------------------------
+ -- Add_With_Ovflo_Check --
+ --------------------------
+
+ function Add_With_Ovflo_Check (X, Y : Double_Int) return Double_Int is
+ R : constant Double_Int := To_Int (To_Uns (X) + To_Uns (Y));
+
+ begin
+ if X >= 0 then
+ if Y < 0 or else R >= 0 then
+ return R;
+ end if;
+
+ else -- X < 0
+ if Y > 0 or else R < 0 then
+ return R;
+ end if;
+ end if;
+
+ Raise_Error;
+ end Add_With_Ovflo_Check;
+
+ -------------------
+ -- Double_Divide --
+ -------------------
+
+ procedure Double_Divide
+ (X, Y, Z : Double_Int;
+ Q, R : out Double_Int;
+ Round : Boolean)
+ is
+ Xu : constant Double_Uns := abs X;
+ Yu : constant Double_Uns := abs Y;
+
+ Yhi : constant Single_Uns := Hi (Yu);
+ Ylo : constant Single_Uns := Lo (Yu);
+
+ Zu : constant Double_Uns := abs Z;
+ Zhi : constant Single_Uns := Hi (Zu);
+ Zlo : constant Single_Uns := Lo (Zu);
+
+ T1, T2 : Double_Uns;
+ Du, Qu, Ru : Double_Uns;
+ Den_Pos : Boolean;
+
+ begin
+ if Yu = 0 or else Zu = 0 then
+ Raise_Error;
+ end if;
+
+ -- Set final signs (RM 4.5.5(27-30))
+
+ Den_Pos := (Y < 0) = (Z < 0);
+
+ -- Compute Y * Z. Note that if the result overflows Double_Uns, then
+ -- the rounded result is zero, except for the very special case where
+ -- X = -2 ** (Double_Size - 1) and abs(Y*Z) = 2 ** Double_Size, when
+ -- Round is True.
+
+ if Yhi /= 0 then
+ if Zhi /= 0 then
+
+ -- Handle the special case when Round is True
+
+ if Yhi = 1
+ and then Zhi = 1
+ and then Ylo = 0
+ and then Zlo = 0
+ and then X = Double_Int'First
+ and then Round
+ then
+ Q := (if Den_Pos then -1 else 1);
+ else
+ Q := 0;
+ end if;
+
+ R := X;
+ return;
+ else
+ T2 := Yhi * Zlo;
+ end if;
+
+ else
+ T2 := Ylo * Zhi;
+ end if;
+
+ T1 := Ylo * Zlo;
+ T2 := T2 + Hi (T1);
+
+ if Hi (T2) /= 0 then
+
+ -- Handle the special case when Round is True
+
+ if Hi (T2) = 1
+ and then Lo (T2) = 0
+ and then Lo (T1) = 0
+ and then X = Double_Int'First
+ and then Round
+ then
+ Q := (if Den_Pos then -1 else 1);
+ else
+ Q := 0;
+ end if;
+
+ R := X;
+ return;
+ end if;
+
+ Du := Lo (T2) & Lo (T1);
+
+ -- Check overflow case of largest negative number divided by -1
+
+ if X = Double_Int'First and then Du = 1 and then not Den_Pos then
+ Raise_Error;
+ end if;
+
+ -- Perform the actual division
+
+ pragma Assert (Du /= 0);
+ -- Multiplication of 2-limb arguments Yu and Zu leads to 4-limb result
+ -- (where each limb is a single value). Cases where 4 limbs are needed
+ -- require Yhi/=0 and Zhi/=0 and lead to early exit. Remaining cases
+ -- where 3 limbs are needed correspond to Hi(T2)/=0 and lead to early
+ -- exit. Thus, at this point, the result fits in 2 limbs which are
+ -- exactly Lo(T2) and Lo(T1), which corresponds to the value of Du.
+ -- As the case where one of Yu or Zu is null also led to early exit,
+ -- we have Du/=0 here.
+ Qu := Xu / Du;
+ Ru := Xu rem Du;
+
+ -- Deal with rounding case
+
+ if Round and then Ru > (Du - Double_Uns'(1)) / Double_Uns'(2) then
+ Qu := Qu + Double_Uns'(1);
+ end if;
+
+ -- Case of dividend (X) sign positive
+
+ if X >= 0 then
+ R := To_Int (Ru);
+ Q := (if Den_Pos then To_Int (Qu) else -To_Int (Qu));
+
+ -- Case of dividend (X) sign negative
+
+ -- We perform the unary minus operation on the unsigned value
+ -- before conversion to signed, to avoid a possible overflow
+ -- for value -2 ** (Double_Size - 1), both for computing R and Q.
+
+ else
+ R := To_Int (-Ru);
+ Q := (if Den_Pos then To_Int (-Qu) else To_Int (Qu));
+ end if;
+ end Double_Divide;
+
+ ---------
+ -- Le3 --
+ ---------
+
+ function Le3 (X1, X2, X3, Y1, Y2, Y3 : Single_Uns) return Boolean is
+ begin
+ if X1 < Y1 then
+ return True;
+ elsif X1 > Y1 then
+ return False;
+ elsif X2 < Y2 then
+ return True;
+ elsif X2 > Y2 then
+ return False;
+ else
+ return X3 <= Y3;
+ end if;
+ end Le3;
+
+ -------------------------------
+ -- Multiply_With_Ovflo_Check --
+ -------------------------------
+
+ function Multiply_With_Ovflo_Check (X, Y : Double_Int) return Double_Int is
+ Xu : constant Double_Uns := abs X;
+ Xhi : constant Single_Uns := Hi (Xu);
+ Xlo : constant Single_Uns := Lo (Xu);
+
+ Yu : constant Double_Uns := abs Y;
+ Yhi : constant Single_Uns := Hi (Yu);
+ Ylo : constant Single_Uns := Lo (Yu);
+
+ T1, T2 : Double_Uns;
+
+ begin
+ if Xhi /= 0 then
+ if Yhi /= 0 then
+ Raise_Error;
+ else
+ T2 := Xhi * Ylo;
+ end if;
+
+ elsif Yhi /= 0 then
+ T2 := Xlo * Yhi;
+
+ else -- Yhi = Xhi = 0
+ T2 := 0;
+ end if;
+
+ -- Here we have T2 set to the contribution to the upper half of the
+ -- result from the upper halves of the input values.
+
+ T1 := Xlo * Ylo;
+ T2 := T2 + Hi (T1);
+
+ if Hi (T2) /= 0 then
+ Raise_Error;
+ end if;
+
+ T2 := Lo (T2) & Lo (T1);
+
+ if X >= 0 then
+ if Y >= 0 then
+ return To_Pos_Int (T2);
+ pragma Annotate (CodePeer, Intentional, "precondition",
+ "Intentional Unsigned->Signed conversion");
+ else
+ return To_Neg_Int (T2);
+ end if;
+ else -- X < 0
+ if Y < 0 then
+ return To_Pos_Int (T2);
+ pragma Annotate (CodePeer, Intentional, "precondition",
+ "Intentional Unsigned->Signed conversion");
+ else
+ return To_Neg_Int (T2);
+ end if;
+ end if;
+
+ end Multiply_With_Ovflo_Check;
+
+ -----------------
+ -- Raise_Error --
+ -----------------
+
+ procedure Raise_Error is
+ begin
+ raise Constraint_Error with "Double arithmetic overflow";
+ end Raise_Error;
+
+ -------------------
+ -- Scaled_Divide --
+ -------------------
+
+ procedure Scaled_Divide
+ (X, Y, Z : Double_Int;
+ Q, R : out Double_Int;
+ Round : Boolean)
+ is
+ Xu : constant Double_Uns := abs X;
+ Xhi : constant Single_Uns := Hi (Xu);
+ Xlo : constant Single_Uns := Lo (Xu);
+
+ Yu : constant Double_Uns := abs Y;
+ Yhi : constant Single_Uns := Hi (Yu);
+ Ylo : constant Single_Uns := Lo (Yu);
+
+ Zu : Double_Uns := abs Z;
+ Zhi : Single_Uns := Hi (Zu);
+ Zlo : Single_Uns := Lo (Zu);
+
+ D : array (1 .. 4) of Single_Uns;
+ -- The dividend, four digits (D(1) is high order)
+
+ Qd : array (1 .. 2) of Single_Uns;
+ -- The quotient digits, two digits (Qd(1) is high order)
+
+ S1, S2, S3 : Single_Uns;
+ -- Value to subtract, three digits (S1 is high order)
+
+ Qu : Double_Uns;
+ Ru : Double_Uns;
+ -- Unsigned quotient and remainder
+
+ Mask : Single_Uns;
+ -- Mask of bits used to compute the scaling factor below
+
+ Scale : Natural;
+ -- Scaling factor used for multiple-precision divide. Dividend and
+ -- Divisor are multiplied by 2 ** Scale, and the final remainder is
+ -- divided by the scaling factor. The reason for this scaling is to
+ -- allow more accurate estimation of quotient digits.
+
+ Shift : Natural;
+ -- Shift factor used to compute the scaling factor above
+
+ T1, T2, T3 : Double_Uns;
+ -- Temporary values
+
+ begin
+ -- First do the multiplication, giving the four digit dividend
+
+ T1 := Xlo * Ylo;
+ D (4) := Lo (T1);
+ D (3) := Hi (T1);
+
+ if Yhi /= 0 then
+ T1 := Xlo * Yhi;
+ T2 := D (3) + Lo (T1);
+ D (3) := Lo (T2);
+ D (2) := Hi (T1) + Hi (T2);
+
+ if Xhi /= 0 then
+ T1 := Xhi * Ylo;
+ T2 := D (3) + Lo (T1);
+ D (3) := Lo (T2);
+ T3 := D (2) + Hi (T1);
+ T3 := T3 + Hi (T2);
+ D (2) := Lo (T3);
+ D (1) := Hi (T3);
+
+ T1 := (D (1) & D (2)) + Double_Uns'(Xhi * Yhi);
+ D (1) := Hi (T1);
+ D (2) := Lo (T1);
+
+ else
+ D (1) := 0;
+ end if;
+
+ else
+ if Xhi /= 0 then
+ T1 := Xhi * Ylo;
+ T2 := D (3) + Lo (T1);
+ D (3) := Lo (T2);
+ D (2) := Hi (T1) + Hi (T2);
+
+ else
+ D (2) := 0;
+ end if;
+
+ D (1) := 0;
+ end if;
+
+ -- Now it is time for the dreaded multiple precision division. First an
+ -- easy case, check for the simple case of a one digit divisor.
+
+ if Zhi = 0 then
+ if D (1) /= 0 or else D (2) >= Zlo then
+ Raise_Error;
+
+ -- Here we are dividing at most three digits by one digit
+
+ else
+ T1 := D (2) & D (3);
+ T2 := Lo (T1 rem Zlo) & D (4);
+
+ Qu := Lo (T1 / Zlo) & Lo (T2 / Zlo);
+ Ru := T2 rem Zlo;
+ end if;
+
+ -- If divisor is double digit and dividend is too large, raise error
+
+ elsif (D (1) & D (2)) >= Zu then
+ Raise_Error;
+
+ -- This is the complex case where we definitely have a double digit
+ -- divisor and a dividend of at least three digits. We use the classical
+ -- multiple-precision division algorithm (see section (4.3.1) of Knuth's
+ -- "The Art of Computer Programming", Vol. 2 for a description
+ -- (algorithm D).
+
+ else
+ -- First normalize the divisor so that it has the leading bit on.
+ -- We do this by finding the appropriate left shift amount.
+
+ Shift := Single_Size / 2;
+ Mask := Shift_Left (2 ** (Single_Size / 2) - 1, Shift);
+ Scale := 0;
+
+ while Shift /= 0 loop
+ if (Hi (Zu) and Mask) = 0 then
+ Scale := Scale + Shift;
+ Zu := Shift_Left (Zu, Shift);
+ end if;
+
+ Shift := Shift / 2;
+ Mask := Shift_Left (Mask, Shift);
+ end loop;
+
+ Zhi := Hi (Zu);
+ Zlo := Lo (Zu);
+
+ pragma Assert (Zhi /= 0);
+ -- We have Hi(Zu)/=0 before normalization. The sequence of Shift_Left
+ -- operations results in the leading bit of Zu being 1 by moving the
+ -- leftmost 1-bit in Zu to leading position, thus Zhi=Hi(Zu)/=0 here.
+
+ -- Note that when we scale up the dividend, it still fits in four
+ -- digits, since we already tested for overflow, and scaling does
+ -- not change the invariant that (D (1) & D (2)) < Zu.
+
+ T1 := Shift_Left (D (1) & D (2), Scale);
+ D (1) := Hi (T1);
+ T2 := Shift_Left (0 & D (3), Scale);
+ D (2) := Lo (T1) or Hi (T2);
+ T3 := Shift_Left (0 & D (4), Scale);
+ D (3) := Lo (T2) or Hi (T3);
+ D (4) := Lo (T3);
+
+ -- Loop to compute quotient digits, runs twice for Qd(1) and Qd(2)
+
+ for J in 0 .. 1 loop
+
+ -- Compute next quotient digit. We have to divide three digits by
+ -- two digits. We estimate the quotient by dividing the leading
+ -- two digits by the leading digit. Given the scaling we did above
+ -- which ensured the first bit of the divisor is set, this gives
+ -- an estimate of the quotient that is at most two too high.
+
+ Qd (J + 1) := (if D (J + 1) = Zhi
+ then 2 ** Single_Size - 1
+ else Lo ((D (J + 1) & D (J + 2)) / Zhi));
+
+ -- Compute amount to subtract
+
+ T1 := Qd (J + 1) * Zlo;
+ T2 := Qd (J + 1) * Zhi;
+ S3 := Lo (T1);
+ T1 := Hi (T1) + Lo (T2);
+ S2 := Lo (T1);
+ S1 := Hi (T1) + Hi (T2);
+
+ -- Adjust quotient digit if it was too high
+
+ -- We use the version of the algorithm in the 2nd Edition of
+ -- "The Art of Computer Programming". This had a bug not
+ -- discovered till 1995, see Vol 2 errata:
+ -- http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz.
+ -- Under rare circumstances the expression in the test could
+ -- overflow. This version was further corrected in 2005, see
+ -- Vol 2 errata:
+ -- http://www-cs-faculty.stanford.edu/~uno/all2-pre.ps.gz.
+ -- This implementation is not impacted by these bugs, due to the
+ -- use of a word-size comparison done in function Le3 instead of
+ -- a comparison on two-word integer quantities in the original
+ -- algorithm.
+
+ loop
+ exit when Le3 (S1, S2, S3, D (J + 1), D (J + 2), D (J + 3));
+ Qd (J + 1) := Qd (J + 1) - 1;
+ Sub3 (S1, S2, S3, 0, Zhi, Zlo);
+ end loop;
+
+ -- Now subtract S1&S2&S3 from D1&D2&D3 ready for next step
+
+ Sub3 (D (J + 1), D (J + 2), D (J + 3), S1, S2, S3);
+ end loop;
+
+ -- The two quotient digits are now set, and the remainder of the
+ -- scaled division is in D3&D4. To get the remainder for the
+ -- original unscaled division, we rescale this dividend.
+
+ -- We rescale the divisor as well, to make the proper comparison
+ -- for rounding below.
+
+ Qu := Qd (1) & Qd (2);
+ Ru := Shift_Right (D (3) & D (4), Scale);
+ Zu := Shift_Right (Zu, Scale);
+ end if;
+
+ -- Deal with rounding case
+
+ if Round and then Ru > (Zu - Double_Uns'(1)) / Double_Uns'(2) then
+
+ -- Protect against wrapping around when rounding, by signaling
+ -- an overflow when the quotient is too large.
+
+ if Qu = Double_Uns'Last then
+ Raise_Error;
+ end if;
+
+ Qu := Qu + Double_Uns'(1);
+ end if;
+
+ -- Set final signs (RM 4.5.5(27-30))
+
+ -- Case of dividend (X * Y) sign positive
+
+ if (X >= 0 and then Y >= 0) or else (X < 0 and then Y < 0) then
+ R := To_Pos_Int (Ru);
+ Q := (if Z > 0 then To_Pos_Int (Qu) else To_Neg_Int (Qu));
+
+ -- Case of dividend (X * Y) sign negative
+
+ else
+ R := To_Neg_Int (Ru);
+ Q := (if Z > 0 then To_Neg_Int (Qu) else To_Pos_Int (Qu));
+ end if;
+ end Scaled_Divide;
+
+ ----------
+ -- Sub3 --
+ ----------
+
+ procedure Sub3 (X1, X2, X3 : in out Single_Uns; Y1, Y2, Y3 : Single_Uns) is
+ begin
+ if Y3 > X3 then
+ if X2 = 0 then
+ X1 := X1 - 1;
+ end if;
+
+ X2 := X2 - 1;
+ end if;
+
+ X3 := X3 - Y3;
+
+ if Y2 > X2 then
+ X1 := X1 - 1;
+ end if;
+
+ X2 := X2 - Y2;
+ X1 := X1 - Y1;
+ end Sub3;
+
+ -------------------------------
+ -- Subtract_With_Ovflo_Check --
+ -------------------------------
+
+ function Subtract_With_Ovflo_Check (X, Y : Double_Int) return Double_Int is
+ R : constant Double_Int := To_Int (To_Uns (X) - To_Uns (Y));
+
+ begin
+ if X >= 0 then
+ if Y > 0 or else R >= 0 then
+ return R;
+ end if;
+
+ else -- X < 0
+ if Y <= 0 or else R < 0 then
+ return R;
+ end if;
+ end if;
+
+ Raise_Error;
+ end Subtract_With_Ovflo_Check;
+
+ ----------------
+ -- To_Neg_Int --
+ ----------------
+
+ function To_Neg_Int (A : Double_Uns) return Double_Int is
+ R : constant Double_Int :=
+ (if A = 2 ** (Double_Size - 1) then Double_Int'First else -To_Int (A));
+ -- Note that we can't just use the expression of the Else, because it
+ -- overflows for A = 2 ** (Double_Size - 1).
+ begin
+ if R <= 0 then
+ return R;
+ else
+ Raise_Error;
+ end if;
+ end To_Neg_Int;
+
+ ----------------
+ -- To_Pos_Int --
+ ----------------
+
+ function To_Pos_Int (A : Double_Uns) return Double_Int is
+ R : constant Double_Int := To_Int (A);
+ begin
+ if R >= 0 then
+ return R;
+ else
+ Raise_Error;
+ end if;
+ end To_Pos_Int;
+
+end System.Arith_Double;
diff --git a/gcc/ada/libgnat/s-aridou.ads b/gcc/ada/libgnat/s-aridou.ads
new file mode 100644
index 0000000..f9c03e5
--- /dev/null
+++ b/gcc/ada/libgnat/s-aridou.ads
@@ -0,0 +1,94 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . A R I T H _ D O U B L E --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides software routines for doing arithmetic on "double"
+-- signed integer values in cases where either overflow checking is required,
+-- or intermediate results are longer than the result type.
+
+generic
+
+ type Double_Int is range <>;
+
+ type Double_Uns is mod <>;
+
+ type Single_Uns is mod <>;
+
+ with function Shift_Left (A : Double_Uns; B : Natural) return Double_Uns
+ is <>;
+
+ with function Shift_Right (A : Double_Uns; B : Natural) return Double_Uns
+ is <>;
+
+ with function Shift_Left (A : Single_Uns; B : Natural) return Single_Uns
+ is <>;
+
+package System.Arith_Double is
+ pragma Pure;
+
+ function Add_With_Ovflo_Check (X, Y : Double_Int) return Double_Int;
+ -- Raises Constraint_Error if sum of operands overflows Double_Int,
+ -- otherwise returns the signed integer sum.
+
+ function Subtract_With_Ovflo_Check (X, Y : Double_Int) return Double_Int;
+ -- Raises Constraint_Error if difference of operands overflows Double_Int,
+ -- otherwise returns the signed integer difference.
+
+ function Multiply_With_Ovflo_Check (X, Y : Double_Int) return Double_Int;
+ pragma Convention (C, Multiply_With_Ovflo_Check);
+ -- Raises Constraint_Error if product of operands overflows Double_Int,
+ -- otherwise returns the signed integer product. Gigi may also call this
+ -- routine directly.
+
+ procedure Scaled_Divide
+ (X, Y, Z : Double_Int;
+ Q, R : out Double_Int;
+ Round : Boolean);
+ -- Performs the division of (X * Y) / Z, storing the quotient in Q
+ -- and the remainder in R. Constraint_Error is raised if Z is zero,
+ -- or if the quotient does not fit in Double_Int. Round indicates if
+ -- the result should be rounded. If Round is False, then Q, R are
+ -- the normal quotient and remainder from a truncating division.
+ -- If Round is True, then Q is the rounded quotient. The remainder
+ -- R is not affected by the setting of the Round flag.
+
+ procedure Double_Divide
+ (X, Y, Z : Double_Int;
+ Q, R : out Double_Int;
+ Round : Boolean);
+ -- Performs the division X / (Y * Z), storing the quotient in Q and
+ -- the remainder in R. Constraint_Error is raised if Y or Z is zero,
+ -- or if the quotient does not fit in Double_Int. Round indicates if the
+ -- result should be rounded. If Round is False, then Q, R are the normal
+ -- quotient and remainder from a truncating division. If Round is True,
+ -- then Q is the rounded quotient. The remainder R is not affected by the
+ -- setting of the Round flag.
+
+end System.Arith_Double;
diff --git a/gcc/ada/libgnat/s-arit128.adb b/gcc/ada/libgnat/s-arit128.adb
new file mode 100644
index 0000000..82c8fc3
--- /dev/null
+++ b/gcc/ada/libgnat/s-arit128.adb
@@ -0,0 +1,64 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . A R I T H _ 1 2 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Arith_Double;
+
+package body System.Arith_128 is
+
+ subtype Uns128 is Interfaces.Unsigned_128;
+ subtype Uns64 is Interfaces.Unsigned_64;
+
+ use Interfaces;
+
+ package Impl is new Arith_Double (Int128, Uns128, Uns64);
+
+ function Add_With_Ovflo_Check128 (X, Y : Int128) return Int128
+ renames Impl.Add_With_Ovflo_Check;
+
+ function Subtract_With_Ovflo_Check128 (X, Y : Int128) return Int128
+ renames Impl.Subtract_With_Ovflo_Check;
+
+ function Multiply_With_Ovflo_Check128 (X, Y : Int128) return Int128
+ renames Impl.Multiply_With_Ovflo_Check;
+
+ procedure Scaled_Divide128
+ (X, Y, Z : Int128;
+ Q, R : out Int128;
+ Round : Boolean)
+ renames Impl.Scaled_Divide;
+
+ procedure Double_Divide128
+ (X, Y, Z : Int128;
+ Q, R : out Int128;
+ Round : Boolean)
+ renames Impl.Double_Divide;
+
+end System.Arith_128;
diff --git a/gcc/ada/libgnat/s-arit128.ads b/gcc/ada/libgnat/s-arit128.ads
new file mode 100644
index 0000000..55154da
--- /dev/null
+++ b/gcc/ada/libgnat/s-arit128.ads
@@ -0,0 +1,84 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . A R I T H _ 1 2 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This unit provides software routines for doing arithmetic on 128-bit
+-- signed integer values in cases where either overflow checking is
+-- required, or intermediate results are longer than 128 bits.
+
+pragma Restrictions (No_Elaboration_Code);
+-- Allow direct call from gigi generated code
+
+with Interfaces;
+
+package System.Arith_128 is
+ pragma Pure;
+
+ subtype Int128 is Interfaces.Integer_128;
+
+ function Add_With_Ovflo_Check128 (X, Y : Int128) return Int128;
+ -- Raises Constraint_Error if sum of operands overflows 128 bits,
+ -- otherwise returns the 128-bit signed integer sum.
+
+ function Subtract_With_Ovflo_Check128 (X, Y : Int128) return Int128;
+ -- Raises Constraint_Error if difference of operands overflows 128
+ -- bits, otherwise returns the 128-bit signed integer difference.
+
+ function Multiply_With_Ovflo_Check128 (X, Y : Int128) return Int128;
+ pragma Export (C, Multiply_With_Ovflo_Check128, "__gnat_mulv128");
+ -- Raises Constraint_Error if product of operands overflows 128
+ -- bits, otherwise returns the 128-bit signed integer product.
+ -- Gigi may also call this routine directly.
+
+ procedure Scaled_Divide128
+ (X, Y, Z : Int128;
+ Q, R : out Int128;
+ Round : Boolean);
+ -- Performs the division of (X * Y) / Z, storing the quotient in Q
+ -- and the remainder in R. Constraint_Error is raised if Z is zero,
+ -- or if the quotient does not fit in 128 bits. Round indicates if
+ -- the result should be rounded. If Round is False, then Q, R are
+ -- the normal quotient and remainder from a truncating division.
+ -- If Round is True, then Q is the rounded quotient. The remainder
+ -- R is not affected by the setting of the Round flag.
+
+ procedure Double_Divide128
+ (X, Y, Z : Int128;
+ Q, R : out Int128;
+ Round : Boolean);
+ -- Performs the division X / (Y * Z), storing the quotient in Q and
+ -- the remainder in R. Constraint_Error is raised if Y or Z is zero,
+ -- or if the quotient does not fit in 128 bits. Round indicates if the
+ -- result should be rounded. If Round is False, then Q, R are the normal
+ -- quotient and remainder from a truncating division. If Round is True,
+ -- then Q is the rounded quotient. The remainder R is not affected by the
+ -- setting of the Round flag.
+
+end System.Arith_128;
diff --git a/gcc/ada/libgnat/s-arit64.adb b/gcc/ada/libgnat/s-arit64.adb
index 060f352..a4d60f2 100644
--- a/gcc/ada/libgnat/s-arit64.adb
+++ b/gcc/ada/libgnat/s-arit64.adb
@@ -29,630 +29,36 @@
-- --
------------------------------------------------------------------------------
-with Interfaces; use Interfaces;
-
-with Ada.Unchecked_Conversion;
+with System.Arith_Double;
package body System.Arith_64 is
- pragma Suppress (Overflow_Check);
- pragma Suppress (Range_Check);
-
- subtype Uns64 is Unsigned_64;
- function To_Uns is new Ada.Unchecked_Conversion (Int64, Uns64);
- function To_Int is new Ada.Unchecked_Conversion (Uns64, Int64);
-
- subtype Uns32 is Unsigned_32;
-
- -----------------------
- -- Local Subprograms --
- -----------------------
-
- function "+" (A, B : Uns32) return Uns64 is (Uns64 (A) + Uns64 (B));
- function "+" (A : Uns64; B : Uns32) return Uns64 is (A + Uns64 (B));
- -- Length doubling additions
-
- function "*" (A, B : Uns32) return Uns64 is (Uns64 (A) * Uns64 (B));
- -- Length doubling multiplication
-
- function "/" (A : Uns64; B : Uns32) return Uns64 is (A / Uns64 (B));
- -- Length doubling division
-
- function "&" (Hi, Lo : Uns32) return Uns64 is
- (Shift_Left (Uns64 (Hi), 32) or Uns64 (Lo));
- -- Concatenate hi, lo values to form 64-bit result
-
- function "abs" (X : Int64) return Uns64 is
- (if X = Int64'First then 2**63 else Uns64 (Int64'(abs X)));
- -- Convert absolute value of X to unsigned. Note that we can't just use
- -- the expression of the Else, because it overflows for X = Int64'First.
-
- function "rem" (A : Uns64; B : Uns32) return Uns64 is (A rem Uns64 (B));
- -- Length doubling remainder
-
- function Le3 (X1, X2, X3 : Uns32; Y1, Y2, Y3 : Uns32) return Boolean;
- -- Determines if 96 bit value X1&X2&X3 <= Y1&Y2&Y3
-
- function Lo (A : Uns64) return Uns32 is (Uns32 (A and 16#FFFF_FFFF#));
- -- Low order half of 64-bit value
-
- function Hi (A : Uns64) return Uns32 is (Uns32 (Shift_Right (A, 32)));
- -- High order half of 64-bit value
-
- procedure Sub3 (X1, X2, X3 : in out Uns32; Y1, Y2, Y3 : Uns32);
- -- Computes X1&X2&X3 := X1&X2&X3 - Y1&Y1&Y3 with mod 2**96 wrap
-
- function To_Neg_Int (A : Uns64) return Int64 with Inline;
- -- Convert to negative integer equivalent. If the input is in the range
- -- 0 .. 2 ** 63, then the corresponding negative signed integer (obtained
- -- by negating the given value) is returned, otherwise constraint error
- -- is raised.
-
- function To_Pos_Int (A : Uns64) return Int64 with Inline;
- -- Convert to positive integer equivalent. If the input is in the range
- -- 0 .. 2 ** 63-1, then the corresponding non-negative signed integer is
- -- returned, otherwise constraint error is raised.
-
- procedure Raise_Error with Inline;
- pragma No_Return (Raise_Error);
- -- Raise constraint error with appropriate message
-
- --------------------------
- -- Add_With_Ovflo_Check --
- --------------------------
+ subtype Uns64 is Interfaces.Unsigned_64;
+ subtype Uns32 is Interfaces.Unsigned_32;
- function Add_With_Ovflo_Check (X, Y : Int64) return Int64 is
- R : constant Int64 := To_Int (To_Uns (X) + To_Uns (Y));
+ use Interfaces;
- begin
- if X >= 0 then
- if Y < 0 or else R >= 0 then
- return R;
- end if;
+ package Impl is new Arith_Double (Int64, Uns64, Uns32);
- else -- X < 0
- if Y > 0 or else R < 0 then
- return R;
- end if;
- end if;
+ function Add_With_Ovflo_Check64 (X, Y : Int64) return Int64
+ renames Impl.Add_With_Ovflo_Check;
- Raise_Error;
- end Add_With_Ovflo_Check;
+ function Subtract_With_Ovflo_Check64 (X, Y : Int64) return Int64
+ renames Impl.Subtract_With_Ovflo_Check;
- -------------------
- -- Double_Divide --
- -------------------
+ function Multiply_With_Ovflo_Check64 (X, Y : Int64) return Int64
+ renames Impl.Multiply_With_Ovflo_Check;
- procedure Double_Divide
+ procedure Scaled_Divide64
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean)
- is
- Xu : constant Uns64 := abs X;
- Yu : constant Uns64 := abs Y;
-
- Yhi : constant Uns32 := Hi (Yu);
- Ylo : constant Uns32 := Lo (Yu);
-
- Zu : constant Uns64 := abs Z;
- Zhi : constant Uns32 := Hi (Zu);
- Zlo : constant Uns32 := Lo (Zu);
-
- T1, T2 : Uns64;
- Du, Qu, Ru : Uns64;
- Den_Pos : Boolean;
-
- begin
- if Yu = 0 or else Zu = 0 then
- Raise_Error;
- end if;
-
- -- Set final signs (RM 4.5.5(27-30))
-
- Den_Pos := (Y < 0) = (Z < 0);
-
- -- Compute Y * Z. Note that if the result overflows 64 bits unsigned,
- -- then the rounded result is zero, except for the very special case
- -- where X = -2**63 and abs(Y*Z) = 2**64, when Round is True.
-
- if Yhi /= 0 then
- if Zhi /= 0 then
-
- -- Handle the special case when Round is True
-
- if Yhi = 1
- and then Zhi = 1
- and then Ylo = 0
- and then Zlo = 0
- and then X = Int64'First
- and then Round
- then
- Q := (if Den_Pos then -1 else 1);
- else
- Q := 0;
- end if;
-
- R := X;
- return;
- else
- T2 := Yhi * Zlo;
- end if;
-
- else
- T2 := Ylo * Zhi;
- end if;
-
- T1 := Ylo * Zlo;
- T2 := T2 + Hi (T1);
-
- if Hi (T2) /= 0 then
-
- -- Handle the special case when Round is True
-
- if Hi (T2) = 1
- and then Lo (T2) = 0
- and then Lo (T1) = 0
- and then X = Int64'First
- and then Round
- then
- Q := (if Den_Pos then -1 else 1);
- else
- Q := 0;
- end if;
-
- R := X;
- return;
- end if;
+ renames Impl.Scaled_Divide;
- Du := Lo (T2) & Lo (T1);
-
- -- Check overflow case of largest negative number divided by -1
-
- if X = Int64'First and then Du = 1 and then not Den_Pos then
- Raise_Error;
- end if;
-
- -- Perform the actual division
-
- Qu := Xu / Du;
- Ru := Xu rem Du;
-
- -- Deal with rounding case
-
- if Round and then Ru > (Du - Uns64'(1)) / Uns64'(2) then
- Qu := Qu + Uns64'(1);
- end if;
-
- -- Case of dividend (X) sign positive
-
- if X >= 0 then
- R := To_Int (Ru);
- Q := (if Den_Pos then To_Int (Qu) else -To_Int (Qu));
-
- -- Case of dividend (X) sign negative
-
- -- We perform the unary minus operation on the unsigned value
- -- before conversion to signed, to avoid a possible overflow for
- -- value -2**63, both for computing R and Q.
-
- else
- R := To_Int (-Ru);
- Q := (if Den_Pos then To_Int (-Qu) else To_Int (Qu));
- end if;
- end Double_Divide;
-
- ---------
- -- Le3 --
- ---------
-
- function Le3 (X1, X2, X3 : Uns32; Y1, Y2, Y3 : Uns32) return Boolean is
- begin
- if X1 < Y1 then
- return True;
- elsif X1 > Y1 then
- return False;
- elsif X2 < Y2 then
- return True;
- elsif X2 > Y2 then
- return False;
- else
- return X3 <= Y3;
- end if;
- end Le3;
-
- -------------------------------
- -- Multiply_With_Ovflo_Check --
- -------------------------------
-
- function Multiply_With_Ovflo_Check (X, Y : Int64) return Int64 is
- Xu : constant Uns64 := abs X;
- Xhi : constant Uns32 := Hi (Xu);
- Xlo : constant Uns32 := Lo (Xu);
-
- Yu : constant Uns64 := abs Y;
- Yhi : constant Uns32 := Hi (Yu);
- Ylo : constant Uns32 := Lo (Yu);
-
- T1, T2 : Uns64;
-
- begin
- if Xhi /= 0 then
- if Yhi /= 0 then
- Raise_Error;
- else
- T2 := Xhi * Ylo;
- end if;
-
- elsif Yhi /= 0 then
- T2 := Xlo * Yhi;
-
- else -- Yhi = Xhi = 0
- T2 := 0;
- end if;
-
- -- Here we have T2 set to the contribution to the upper half of the
- -- result from the upper halves of the input values.
-
- T1 := Xlo * Ylo;
- T2 := T2 + Hi (T1);
-
- if Hi (T2) /= 0 then
- Raise_Error;
- end if;
-
- T2 := Lo (T2) & Lo (T1);
-
- if X >= 0 then
- if Y >= 0 then
- return To_Pos_Int (T2);
- else
- return To_Neg_Int (T2);
- end if;
- else -- X < 0
- if Y < 0 then
- return To_Pos_Int (T2);
- else
- return To_Neg_Int (T2);
- end if;
- end if;
-
- end Multiply_With_Ovflo_Check;
-
- -----------------
- -- Raise_Error --
- -----------------
-
- procedure Raise_Error is
- begin
- raise Constraint_Error with "64-bit arithmetic overflow";
- end Raise_Error;
-
- -------------------
- -- Scaled_Divide --
- -------------------
-
- procedure Scaled_Divide
+ procedure Double_Divide64
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean)
- is
- Xu : constant Uns64 := abs X;
- Xhi : constant Uns32 := Hi (Xu);
- Xlo : constant Uns32 := Lo (Xu);
-
- Yu : constant Uns64 := abs Y;
- Yhi : constant Uns32 := Hi (Yu);
- Ylo : constant Uns32 := Lo (Yu);
-
- Zu : Uns64 := abs Z;
- Zhi : Uns32 := Hi (Zu);
- Zlo : Uns32 := Lo (Zu);
-
- D : array (1 .. 4) of Uns32;
- -- The dividend, four digits (D(1) is high order)
-
- Qd : array (1 .. 2) of Uns32;
- -- The quotient digits, two digits (Qd(1) is high order)
-
- S1, S2, S3 : Uns32;
- -- Value to subtract, three digits (S1 is high order)
-
- Qu : Uns64;
- Ru : Uns64;
- -- Unsigned quotient and remainder
-
- Scale : Natural;
- -- Scaling factor used for multiple-precision divide. Dividend and
- -- Divisor are multiplied by 2 ** Scale, and the final remainder is
- -- divided by the scaling factor. The reason for this scaling is to
- -- allow more accurate estimation of quotient digits.
-
- T1, T2, T3 : Uns64;
- -- Temporary values
-
- begin
- -- First do the multiplication, giving the four digit dividend
-
- T1 := Xlo * Ylo;
- D (4) := Lo (T1);
- D (3) := Hi (T1);
-
- if Yhi /= 0 then
- T1 := Xlo * Yhi;
- T2 := D (3) + Lo (T1);
- D (3) := Lo (T2);
- D (2) := Hi (T1) + Hi (T2);
-
- if Xhi /= 0 then
- T1 := Xhi * Ylo;
- T2 := D (3) + Lo (T1);
- D (3) := Lo (T2);
- T3 := D (2) + Hi (T1);
- T3 := T3 + Hi (T2);
- D (2) := Lo (T3);
- D (1) := Hi (T3);
-
- T1 := (D (1) & D (2)) + Uns64'(Xhi * Yhi);
- D (1) := Hi (T1);
- D (2) := Lo (T1);
-
- else
- D (1) := 0;
- end if;
-
- else
- if Xhi /= 0 then
- T1 := Xhi * Ylo;
- T2 := D (3) + Lo (T1);
- D (3) := Lo (T2);
- D (2) := Hi (T1) + Hi (T2);
-
- else
- D (2) := 0;
- end if;
-
- D (1) := 0;
- end if;
-
- -- Now it is time for the dreaded multiple precision division. First an
- -- easy case, check for the simple case of a one digit divisor.
-
- if Zhi = 0 then
- if D (1) /= 0 or else D (2) >= Zlo then
- Raise_Error;
-
- -- Here we are dividing at most three digits by one digit
-
- else
- T1 := D (2) & D (3);
- T2 := Lo (T1 rem Zlo) & D (4);
-
- Qu := Lo (T1 / Zlo) & Lo (T2 / Zlo);
- Ru := T2 rem Zlo;
- end if;
-
- -- If divisor is double digit and dividend is too large, raise error
-
- elsif (D (1) & D (2)) >= Zu then
- Raise_Error;
-
- -- This is the complex case where we definitely have a double digit
- -- divisor and a dividend of at least three digits. We use the classical
- -- multiple-precision division algorithm (see section (4.3.1) of Knuth's
- -- "The Art of Computer Programming", Vol. 2 for a description
- -- (algorithm D).
-
- else
- -- First normalize the divisor so that it has the leading bit on.
- -- We do this by finding the appropriate left shift amount.
-
- Scale := 0;
-
- if (Zhi and 16#FFFF0000#) = 0 then
- Scale := 16;
- Zu := Shift_Left (Zu, 16);
- end if;
-
- if (Hi (Zu) and 16#FF00_0000#) = 0 then
- Scale := Scale + 8;
- Zu := Shift_Left (Zu, 8);
- end if;
-
- if (Hi (Zu) and 16#F000_0000#) = 0 then
- Scale := Scale + 4;
- Zu := Shift_Left (Zu, 4);
- end if;
-
- if (Hi (Zu) and 16#C000_0000#) = 0 then
- Scale := Scale + 2;
- Zu := Shift_Left (Zu, 2);
- end if;
-
- if (Hi (Zu) and 16#8000_0000#) = 0 then
- Scale := Scale + 1;
- Zu := Shift_Left (Zu, 1);
- end if;
-
- Zhi := Hi (Zu);
- Zlo := Lo (Zu);
-
- -- Note that when we scale up the dividend, it still fits in four
- -- digits, since we already tested for overflow, and scaling does
- -- not change the invariant that (D (1) & D (2)) < Zu.
-
- T1 := Shift_Left (D (1) & D (2), Scale);
- D (1) := Hi (T1);
- T2 := Shift_Left (0 & D (3), Scale);
- D (2) := Lo (T1) or Hi (T2);
- T3 := Shift_Left (0 & D (4), Scale);
- D (3) := Lo (T2) or Hi (T3);
- D (4) := Lo (T3);
-
- -- Loop to compute quotient digits, runs twice for Qd(1) and Qd(2)
-
- for J in 0 .. 1 loop
-
- -- Compute next quotient digit. We have to divide three digits by
- -- two digits. We estimate the quotient by dividing the leading
- -- two digits by the leading digit. Given the scaling we did above
- -- which ensured the first bit of the divisor is set, this gives
- -- an estimate of the quotient that is at most two too high.
-
- Qd (J + 1) := (if D (J + 1) = Zhi
- then 2 ** 32 - 1
- else Lo ((D (J + 1) & D (J + 2)) / Zhi));
-
- -- Compute amount to subtract
-
- T1 := Qd (J + 1) * Zlo;
- T2 := Qd (J + 1) * Zhi;
- S3 := Lo (T1);
- T1 := Hi (T1) + Lo (T2);
- S2 := Lo (T1);
- S1 := Hi (T1) + Hi (T2);
-
- -- Adjust quotient digit if it was too high
-
- -- We use the version of the algorithm in the 2nd Edition of
- -- "The Art of Computer Programming". This had a bug not
- -- discovered till 1995, see Vol 2 errata:
- -- http://www-cs-faculty.stanford.edu/~uno/err2-2e.ps.gz.
- -- Under rare circumstances the expression in the test could
- -- overflow. This version was further corrected in 2005, see
- -- Vol 2 errata:
- -- http://www-cs-faculty.stanford.edu/~uno/all2-pre.ps.gz.
- -- This implementation is not impacted by these bugs, due to the
- -- use of a word-size comparison done in function Le3 instead of
- -- a comparison on two-word integer quantities in the original
- -- algorithm.
-
- loop
- exit when Le3 (S1, S2, S3, D (J + 1), D (J + 2), D (J + 3));
- Qd (J + 1) := Qd (J + 1) - 1;
- Sub3 (S1, S2, S3, 0, Zhi, Zlo);
- end loop;
-
- -- Now subtract S1&S2&S3 from D1&D2&D3 ready for next step
-
- Sub3 (D (J + 1), D (J + 2), D (J + 3), S1, S2, S3);
- end loop;
-
- -- The two quotient digits are now set, and the remainder of the
- -- scaled division is in D3&D4. To get the remainder for the
- -- original unscaled division, we rescale this dividend.
-
- -- We rescale the divisor as well, to make the proper comparison
- -- for rounding below.
-
- Qu := Qd (1) & Qd (2);
- Ru := Shift_Right (D (3) & D (4), Scale);
- Zu := Shift_Right (Zu, Scale);
- end if;
-
- -- Deal with rounding case
-
- if Round and then Ru > (Zu - Uns64'(1)) / Uns64'(2) then
-
- -- Protect against wrapping around when rounding, by signaling
- -- an overflow when the quotient is too large.
-
- if Qu = Uns64'Last then
- Raise_Error;
- end if;
-
- Qu := Qu + Uns64 (1);
- end if;
-
- -- Set final signs (RM 4.5.5(27-30))
-
- -- Case of dividend (X * Y) sign positive
-
- if (X >= 0 and then Y >= 0) or else (X < 0 and then Y < 0) then
- R := To_Pos_Int (Ru);
- Q := (if Z > 0 then To_Pos_Int (Qu) else To_Neg_Int (Qu));
-
- -- Case of dividend (X * Y) sign negative
-
- else
- R := To_Neg_Int (Ru);
- Q := (if Z > 0 then To_Neg_Int (Qu) else To_Pos_Int (Qu));
- end if;
- end Scaled_Divide;
-
- ----------
- -- Sub3 --
- ----------
-
- procedure Sub3 (X1, X2, X3 : in out Uns32; Y1, Y2, Y3 : Uns32) is
- begin
- if Y3 > X3 then
- if X2 = 0 then
- X1 := X1 - 1;
- end if;
-
- X2 := X2 - 1;
- end if;
-
- X3 := X3 - Y3;
-
- if Y2 > X2 then
- X1 := X1 - 1;
- end if;
-
- X2 := X2 - Y2;
- X1 := X1 - Y1;
- end Sub3;
-
- -------------------------------
- -- Subtract_With_Ovflo_Check --
- -------------------------------
-
- function Subtract_With_Ovflo_Check (X, Y : Int64) return Int64 is
- R : constant Int64 := To_Int (To_Uns (X) - To_Uns (Y));
-
- begin
- if X >= 0 then
- if Y > 0 or else R >= 0 then
- return R;
- end if;
-
- else -- X < 0
- if Y <= 0 or else R < 0 then
- return R;
- end if;
- end if;
-
- Raise_Error;
- end Subtract_With_Ovflo_Check;
-
- ----------------
- -- To_Neg_Int --
- ----------------
-
- function To_Neg_Int (A : Uns64) return Int64 is
- R : constant Int64 := (if A = 2**63 then Int64'First else -To_Int (A));
- -- Note that we can't just use the expression of the Else, because it
- -- overflows for A = 2**63.
- begin
- if R <= 0 then
- return R;
- else
- Raise_Error;
- end if;
- end To_Neg_Int;
-
- ----------------
- -- To_Pos_Int --
- ----------------
-
- function To_Pos_Int (A : Uns64) return Int64 is
- R : constant Int64 := To_Int (A);
- begin
- if R >= 0 then
- return R;
- else
- Raise_Error;
- end if;
- end To_Pos_Int;
+ renames Impl.Double_Divide;
end System.Arith_64;
diff --git a/gcc/ada/libgnat/s-arit64.ads b/gcc/ada/libgnat/s-arit64.ads
index 479515f..90d5c25 100644
--- a/gcc/ada/libgnat/s-arit64.ads
+++ b/gcc/ada/libgnat/s-arit64.ads
@@ -43,42 +43,54 @@ package System.Arith_64 is
subtype Int64 is Interfaces.Integer_64;
- function Add_With_Ovflo_Check (X, Y : Int64) return Int64;
+ function Add_With_Ovflo_Check64 (X, Y : Int64) return Int64;
-- Raises Constraint_Error if sum of operands overflows 64 bits,
-- otherwise returns the 64-bit signed integer sum.
- function Subtract_With_Ovflo_Check (X, Y : Int64) return Int64;
+ function Subtract_With_Ovflo_Check64 (X, Y : Int64) return Int64;
-- Raises Constraint_Error if difference of operands overflows 64
-- bits, otherwise returns the 64-bit signed integer difference.
- function Multiply_With_Ovflo_Check (X, Y : Int64) return Int64;
- pragma Export (C, Multiply_With_Ovflo_Check, "__gnat_mulv64");
+ function Multiply_With_Ovflo_Check64 (X, Y : Int64) return Int64;
+ pragma Export (C, Multiply_With_Ovflo_Check64, "__gnat_mulv64");
-- Raises Constraint_Error if product of operands overflows 64
-- bits, otherwise returns the 64-bit signed integer product.
- -- GIGI may also call this routine directly.
+ -- Gigi may also call this routine directly.
- procedure Scaled_Divide
+ procedure Scaled_Divide64
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean);
-- Performs the division of (X * Y) / Z, storing the quotient in Q
-- and the remainder in R. Constraint_Error is raised if Z is zero,
- -- or if the quotient does not fit in 64-bits. Round indicates if
+ -- or if the quotient does not fit in 64 bits. Round indicates if
-- the result should be rounded. If Round is False, then Q, R are
-- the normal quotient and remainder from a truncating division.
-- If Round is True, then Q is the rounded quotient. The remainder
-- R is not affected by the setting of the Round flag.
- procedure Double_Divide
+ procedure Scaled_Divide
+ (X, Y, Z : Int64;
+ Q, R : out Int64;
+ Round : Boolean) renames Scaled_Divide64;
+ -- Renamed procedure to preserve compatibility with earlier versions
+
+ procedure Double_Divide64
(X, Y, Z : Int64;
Q, R : out Int64;
Round : Boolean);
-- Performs the division X / (Y * Z), storing the quotient in Q and
-- the remainder in R. Constraint_Error is raised if Y or Z is zero,
- -- or if the quotient does not fit in 64-bits. Round indicates if the
+ -- or if the quotient does not fit in 64 bits. Round indicates if the
-- result should be rounded. If Round is False, then Q, R are the normal
-- quotient and remainder from a truncating division. If Round is True,
-- then Q is the rounded quotient. The remainder R is not affected by the
-- setting of the Round flag.
+ procedure Double_Divide
+ (X, Y, Z : Int64;
+ Q, R : out Int64;
+ Round : Boolean) renames Double_Divide64;
+ -- Renamed procedure to preserve compatibility with earlier versions
+
end System.Arith_64;
diff --git a/gcc/ada/libgnat/s-bytswa.ads b/gcc/ada/libgnat/s-bytswa.ads
index 76d8ded..1eac50d 100644
--- a/gcc/ada/libgnat/s-bytswa.ads
+++ b/gcc/ada/libgnat/s-bytswa.ads
@@ -33,13 +33,16 @@
-- (supporting alternative byte ordering), and by the GNAT.Byte_Swapping run
-- time package which provides user level routines for byte swapping.
+with Interfaces;
+
package System.Byte_Swapping is
pragma Pure;
- type U16 is mod 2**16;
- type U32 is mod 2**32;
- type U64 is mod 2**64;
+ subtype U16 is Interfaces.Unsigned_16;
+ subtype U32 is Interfaces.Unsigned_32;
+ subtype U64 is Interfaces.Unsigned_64;
+ subtype U128 is Interfaces.Unsigned_128;
function Bswap_16 (X : U16) return U16;
pragma Import (Intrinsic, Bswap_16, "__builtin_bswap16");
@@ -50,4 +53,7 @@ package System.Byte_Swapping is
function Bswap_64 (X : U64) return U64;
pragma Import (Intrinsic, Bswap_64, "__builtin_bswap64");
+ function Bswap_128 (X : U128) return U128;
+ pragma Import (Intrinsic, Bswap_128, "__builtin_bswap128");
+
end System.Byte_Swapping;
diff --git a/gcc/ada/libgnat/s-carsi8.adb b/gcc/ada/libgnat/s-carsi8.adb
index 11ec460..2da7f5a 100644
--- a/gcc/ada/libgnat/s-carsi8.adb
+++ b/gcc/ada/libgnat/s-carsi8.adb
@@ -97,6 +97,13 @@ package body System.Compare_Array_Signed_8 is
end if;
end loop;
+ pragma Assert (Left_Len >= Bytes_Compared_As_Words);
+ pragma Assert (Right_Len >= Bytes_Compared_As_Words);
+ -- Left_Len and Right_Len are always greater or equal to
+ -- Bytes_Compared_As_Words because:
+ -- * Compare_Len is min (Left_Len, Right_Len)
+ -- * Words_To_Compare = Compare_Len / 4
+ -- * Bytes_Compared_As_Words = Words_To_Compare * 4
return Compare_Array_S8_Unaligned
(AddA (Left, Address (Bytes_Compared_As_Words)),
AddA (Right, Address (Bytes_Compared_As_Words)),
diff --git a/gcc/ada/libgnat/s-carun8.adb b/gcc/ada/libgnat/s-carun8.adb
index 412410e..0ed3d26 100644
--- a/gcc/ada/libgnat/s-carun8.adb
+++ b/gcc/ada/libgnat/s-carun8.adb
@@ -98,6 +98,13 @@ package body System.Compare_Array_Unsigned_8 is
end if;
end loop;
+ pragma Assert (Left_Len >= Bytes_Compared_As_Words);
+ pragma Assert (Right_Len >= Bytes_Compared_As_Words);
+ -- Left_Len and Right_Len are always greater or equal to
+ -- Bytes_Compared_As_Words because:
+ -- * Compare_Len is min (Left_Len, Right_Len)
+ -- * Words_To_Compare = Compare_Len / 4
+ -- * Bytes_Compared_As_Words = Words_To_Compare * 4
return Compare_Array_U8_Unaligned
(AddA (Left, Address (Bytes_Compared_As_Words)),
AddA (Right, Address (Bytes_Compared_As_Words)),
diff --git a/gcc/ada/libgnat/s-casi128.adb b/gcc/ada/libgnat/s-casi128.adb
new file mode 100644
index 0000000..96a8f3d
--- /dev/null
+++ b/gcc/ada/libgnat/s-casi128.adb
@@ -0,0 +1,116 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY COMPONENTS --
+-- --
+-- S Y S T E M . C O M P A R E _ A R R A Y _ S I G N E D _ 1 2 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2002-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Address_Operations; use System.Address_Operations;
+
+with Ada.Unchecked_Conversion;
+
+package body System.Compare_Array_Signed_128 is
+
+ type Word is range -2**127 .. 2**127 - 1;
+ for Word'Size use 128;
+ -- Used to process operands by 128-bit words
+
+ type Uword is new Word;
+ for Uword'Alignment use 1;
+ -- Used to process operands when unaligned
+
+ type WP is access Word;
+ type UP is access Uword;
+
+ function W is new Ada.Unchecked_Conversion (Address, WP);
+ function U is new Ada.Unchecked_Conversion (Address, UP);
+
+ ------------------------
+ -- Compare_Array_S128 --
+ ------------------------
+
+ function Compare_Array_S128
+ (Left : System.Address;
+ Right : System.Address;
+ Left_Len : Natural;
+ Right_Len : Natural) return Integer
+ is
+ Clen : Natural := Natural'Min (Left_Len, Right_Len);
+ -- Number of elements left to compare
+
+ L : Address := Left;
+ R : Address := Right;
+ -- Pointers to next elements to compare
+
+ begin
+ -- Case of going by aligned quadruple words
+
+ if ModA (OrA (Left, Right), 16) = 0 then
+ while Clen /= 0 loop
+ if W (L).all /= W (R).all then
+ if W (L).all > W (R).all then
+ return +1;
+ else
+ return -1;
+ end if;
+ end if;
+
+ Clen := Clen - 1;
+ L := AddA (L, 16);
+ R := AddA (R, 16);
+ end loop;
+
+ -- Case of going by unaligned quadruple words
+
+ else
+ while Clen /= 0 loop
+ if U (L).all /= U (R).all then
+ if U (L).all > U (R).all then
+ return +1;
+ else
+ return -1;
+ end if;
+ end if;
+
+ Clen := Clen - 1;
+ L := AddA (L, 16);
+ R := AddA (R, 16);
+ end loop;
+ end if;
+
+ -- Here if common section equal, result decided by lengths
+
+ if Left_Len = Right_Len then
+ return 0;
+ elsif Left_Len > Right_Len then
+ return +1;
+ else
+ return -1;
+ end if;
+ end Compare_Array_S128;
+
+end System.Compare_Array_Signed_128;
diff --git a/gcc/ada/libgnat/s-casi128.ads b/gcc/ada/libgnat/s-casi128.ads
new file mode 100644
index 0000000..0893bad
--- /dev/null
+++ b/gcc/ada/libgnat/s-casi128.ads
@@ -0,0 +1,52 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY COMPONENTS --
+-- --
+-- S Y S T E M . C O M P A R E _ A R R A Y _ S I G N E D _ 1 2 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2002-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains functions for runtime comparisons on arrays whose
+-- elements are 128-bit discrete type values to be treated as signed.
+
+package System.Compare_Array_Signed_128 is
+
+ -- Note: although the functions in this package are in a sense Pure, the
+ -- package cannot be declared as Pure, since the arguments are addresses,
+ -- not the data, and the result is not pure wrt the address values.
+
+ function Compare_Array_S128
+ (Left : System.Address;
+ Right : System.Address;
+ Left_Len : Natural;
+ Right_Len : Natural) return Integer;
+ -- Compare the array starting at address Left of length Left_Len
+ -- with the array starting at address Right of length Right_Len.
+ -- The comparison is in the normal Ada semantic sense of array
+ -- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
+ -- Left>Right respectively.
+
+end System.Compare_Array_Signed_128;
diff --git a/gcc/ada/libgnat/s-caun128.adb b/gcc/ada/libgnat/s-caun128.adb
new file mode 100644
index 0000000..bb69793
--- /dev/null
+++ b/gcc/ada/libgnat/s-caun128.adb
@@ -0,0 +1,115 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY COMPONENTS --
+-- --
+-- S Y S T E M . C O M P A R E _ A R R A Y _ U N S I G N E D _ 1 2 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2002-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Address_Operations; use System.Address_Operations;
+
+with Ada.Unchecked_Conversion;
+
+package body System.Compare_Array_Unsigned_128 is
+
+ type Word is mod 2 ** 128;
+ -- Used to process operands by 128-bit words
+
+ type Uword is new Word;
+ for Uword'Alignment use 1;
+ -- Used to process operands when unaligned
+
+ type WP is access Word;
+ type UP is access Uword;
+
+ function W is new Ada.Unchecked_Conversion (Address, WP);
+ function U is new Ada.Unchecked_Conversion (Address, UP);
+
+ ------------------------
+ -- Compare_Array_U128 --
+ ------------------------
+
+ function Compare_Array_U128
+ (Left : System.Address;
+ Right : System.Address;
+ Left_Len : Natural;
+ Right_Len : Natural) return Integer
+ is
+ Clen : Natural := Natural'Min (Left_Len, Right_Len);
+ -- Number of elements left to compare
+
+ L : Address := Left;
+ R : Address := Right;
+ -- Pointers to next elements to compare
+
+ begin
+ -- Case of going by aligned quadruple words
+
+ if ModA (OrA (Left, Right), 16) = 0 then
+ while Clen /= 0 loop
+ if W (L).all /= W (R).all then
+ if W (L).all > W (R).all then
+ return +1;
+ else
+ return -1;
+ end if;
+ end if;
+
+ Clen := Clen - 1;
+ L := AddA (L, 16);
+ R := AddA (R, 16);
+ end loop;
+
+ -- Case of going by unaligned quadruple words
+
+ else
+ while Clen /= 0 loop
+ if U (L).all /= U (R).all then
+ if U (L).all > U (R).all then
+ return +1;
+ else
+ return -1;
+ end if;
+ end if;
+
+ Clen := Clen - 1;
+ L := AddA (L, 16);
+ R := AddA (R, 16);
+ end loop;
+ end if;
+
+ -- Here if common section equal, result decided by lengths
+
+ if Left_Len = Right_Len then
+ return 0;
+ elsif Left_Len > Right_Len then
+ return +1;
+ else
+ return -1;
+ end if;
+ end Compare_Array_U128;
+
+end System.Compare_Array_Unsigned_128;
diff --git a/gcc/ada/libgnat/s-caun128.ads b/gcc/ada/libgnat/s-caun128.ads
new file mode 100644
index 0000000..c96983d
--- /dev/null
+++ b/gcc/ada/libgnat/s-caun128.ads
@@ -0,0 +1,52 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY COMPONENTS --
+-- --
+-- S Y S T E M . C O M P A R E _ A R R A Y _ U N S I G N E D _ 1 2 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2002-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains functions for runtime comparisons on arrays whose
+-- elements are 128-bit discrete type values to be treated as unsigned.
+
+package System.Compare_Array_Unsigned_128 is
+
+ -- Note: although the functions in this package are in a sense Pure, the
+ -- package cannot be declared as Pure, since the arguments are addresses,
+ -- not the data, and the result is not pure wrt the address values.
+
+ function Compare_Array_U128
+ (Left : System.Address;
+ Right : System.Address;
+ Left_Len : Natural;
+ Right_Len : Natural) return Integer;
+ -- Compare the array starting at address Left of length Left_Len
+ -- with the array starting at address Right of length Right_Len.
+ -- The comparison is in the normal Ada semantic sense of array
+ -- comparison. The result is -1,0,+1 for Left<Right, Left=Right,
+ -- Left>Right respectively.
+
+end System.Compare_Array_Unsigned_128;
diff --git a/gcc/ada/libgnat/s-dwalin.adb b/gcc/ada/libgnat/s-dwalin.adb
index dbd4c53..abb499c 100644
--- a/gcc/ada/libgnat/s-dwalin.adb
+++ b/gcc/ada/libgnat/s-dwalin.adb
@@ -29,10 +29,6 @@
-- --
------------------------------------------------------------------------------
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we can get
--- elaboration circularities when polling is turned on
-
with Ada.Characters.Handling;
with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback;
with Ada.Unchecked_Deallocation;
diff --git a/gcc/ada/libgnat/s-dwalin.ads b/gcc/ada/libgnat/s-dwalin.ads
index 2753be3..072f089 100644
--- a/gcc/ada/libgnat/s-dwalin.ads
+++ b/gcc/ada/libgnat/s-dwalin.ads
@@ -38,10 +38,6 @@
-- size is a consideration it's possible to strip all other .debug sections,
-- which will decrease the size of the object significantly.
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we can get
--- elaboration circularities when polling is turned on
-
with Ada.Exceptions.Traceback;
with System.Object_Reader;
diff --git a/gcc/ada/libgnat/s-exnint.adb b/gcc/ada/libgnat/s-exnint.adb
index fccd675..3914192 100644
--- a/gcc/ada/libgnat/s-exnint.adb
+++ b/gcc/ada/libgnat/s-exnint.adb
@@ -29,42 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Exn_Int is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- -----------------
- -- Exn_Integer --
- -----------------
-
- function Exn_Integer (Left : Integer; Right : Natural) return Integer is
- pragma Suppress (Division_Check);
- pragma Suppress (Overflow_Check);
-
- Result : Integer := 1;
- Factor : Integer := Left;
- Exp : Natural := Right;
-
- begin
- -- We use the standard logarithmic approach, Exp gets shifted right
- -- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2.
-
- -- Note: it is not worth special casing base values -1, 0, +1 since
- -- the expander does this when the base is a literal, and other cases
- -- will be extremely rare.
-
- if Exp /= 0 then
- loop
- if Exp rem 2 /= 0 then
- Result := Result * Factor;
- end if;
-
- Exp := Exp / 2;
- exit when Exp = 0;
- Factor := Factor * Factor;
- end loop;
- end if;
-
- return Result;
- end Exn_Integer;
-
-end System.Exn_Int;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-exnint.ads b/gcc/ada/libgnat/s-exnint.ads
index 29303a3..ac64e58 100644
--- a/gcc/ada/libgnat/s-exnint.ads
+++ b/gcc/ada/libgnat/s-exnint.ads
@@ -31,9 +31,11 @@
-- Integer exponentiation (checks off)
+with System.Exponn;
+
package System.Exn_Int is
- pragma Pure;
- function Exn_Integer (Left : Integer; Right : Natural) return Integer;
+ function Exn_Integer is new Exponn (Integer);
+ pragma Pure_Function (Exn_Integer);
end System.Exn_Int;
diff --git a/gcc/ada/libgnat/s-exnlli.adb b/gcc/ada/libgnat/s-exnlli.adb
index dc486d6..b1c33ea 100644
--- a/gcc/ada/libgnat/s-exnlli.adb
+++ b/gcc/ada/libgnat/s-exnlli.adb
@@ -29,46 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Exn_LLI is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- ---------------------------
- -- Exn_Long_Long_Integer --
- ---------------------------
-
- function Exn_Long_Long_Integer
- (Left : Long_Long_Integer;
- Right : Natural)
- return Long_Long_Integer
- is
- pragma Suppress (Division_Check);
- pragma Suppress (Overflow_Check);
-
- Result : Long_Long_Integer := 1;
- Factor : Long_Long_Integer := Left;
- Exp : Natural := Right;
-
- begin
- -- We use the standard logarithmic approach, Exp gets shifted right
- -- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2.
-
- -- Note: it is not worth special casing base values -1, 0, +1 since
- -- the expander does this when the base is a literal, and other cases
- -- will be extremely rare.
-
- if Exp /= 0 then
- loop
- if Exp rem 2 /= 0 then
- Result := Result * Factor;
- end if;
-
- Exp := Exp / 2;
- exit when Exp = 0;
- Factor := Factor * Factor;
- end loop;
- end if;
-
- return Result;
- end Exn_Long_Long_Integer;
-
-end System.Exn_LLI;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-exnlli.ads b/gcc/ada/libgnat/s-exnlli.ads
index f6d94de..3c2786b 100644
--- a/gcc/ada/libgnat/s-exnlli.ads
+++ b/gcc/ada/libgnat/s-exnlli.ads
@@ -31,12 +31,11 @@
-- Long_Long_Integer exponentiation (checks off)
+with System.Exponn;
+
package System.Exn_LLI is
- pragma Pure;
- function Exn_Long_Long_Integer
- (Left : Long_Long_Integer;
- Right : Natural)
- return Long_Long_Integer;
+ function Exn_Long_Long_Integer is new Exponn (Long_Long_Integer);
+ pragma Pure_Function (Exn_Long_Long_Integer);
end System.Exn_LLI;
diff --git a/gcc/ada/libgnat/s-exnllli.ads b/gcc/ada/libgnat/s-exnllli.ads
new file mode 100644
index 0000000..9573d7d
--- /dev/null
+++ b/gcc/ada/libgnat/s-exnllli.ads
@@ -0,0 +1,41 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X N _ L L L I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Long_Long_Long_Integer exponentiation (checks off)
+
+with System.Exponn;
+
+package System.Exn_LLLI is
+
+ function Exn_Long_Long_Long_Integer is new Exponn (Long_Long_Long_Integer);
+ pragma Pure_Function (Exn_Long_Long_Long_Integer);
+
+end System.Exn_LLLI;
diff --git a/gcc/ada/libgnat/s-expint.adb b/gcc/ada/libgnat/s-expint.adb
index aa3445c..489d768 100644
--- a/gcc/ada/libgnat/s-expint.adb
+++ b/gcc/ada/libgnat/s-expint.adb
@@ -29,55 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Exp_Int is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- -----------------
- -- Exp_Integer --
- -----------------
-
- -- Note that negative exponents get a constraint error because the
- -- subtype of the Right argument (the exponent) is Natural.
-
- function Exp_Integer
- (Left : Integer;
- Right : Natural)
- return Integer
- is
- Result : Integer := 1;
- Factor : Integer := Left;
- Exp : Natural := Right;
-
- begin
- -- We use the standard logarithmic approach, Exp gets shifted right
- -- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2.
-
- -- Note: it is not worth special casing base values -1, 0, +1 since
- -- the expander does this when the base is a literal, and other cases
- -- will be extremely rare.
-
- if Exp /= 0 then
- loop
- if Exp rem 2 /= 0 then
- declare
- pragma Unsuppress (All_Checks);
- begin
- Result := Result * Factor;
- end;
- end if;
-
- Exp := Exp / 2;
- exit when Exp = 0;
-
- declare
- pragma Unsuppress (All_Checks);
- begin
- Factor := Factor * Factor;
- end;
- end loop;
- end if;
-
- return Result;
- end Exp_Integer;
-
-end System.Exp_Int;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-expint.ads b/gcc/ada/libgnat/s-expint.ads
index 584564a..70d16e0 100644
--- a/gcc/ada/libgnat/s-expint.ads
+++ b/gcc/ada/libgnat/s-expint.ads
@@ -31,12 +31,11 @@
-- Integer exponentiation (checks on)
+with System.Expont;
+
package System.Exp_Int is
- pragma Pure;
- function Exp_Integer
- (Left : Integer;
- Right : Natural)
- return Integer;
+ function Exp_Integer is new Expont (Integer);
+ pragma Pure_Function (Exp_Integer);
end System.Exp_Int;
diff --git a/gcc/ada/libgnat/s-explli.adb b/gcc/ada/libgnat/s-explli.adb
index 4f244cd..98946dc 100644
--- a/gcc/ada/libgnat/s-explli.adb
+++ b/gcc/ada/libgnat/s-explli.adb
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- S Y S T E M . E X P L L I --
+-- S Y S T E M . E X P _ L L I --
-- --
-- B o d y --
-- --
@@ -29,55 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Exp_LLI is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- ---------------------------
- -- Exp_Long_Long_Integer --
- ---------------------------
-
- -- Note that negative exponents get a constraint error because the
- -- subtype of the Right argument (the exponent) is Natural.
-
- function Exp_Long_Long_Integer
- (Left : Long_Long_Integer;
- Right : Natural)
- return Long_Long_Integer
- is
- Result : Long_Long_Integer := 1;
- Factor : Long_Long_Integer := Left;
- Exp : Natural := Right;
-
- begin
- -- We use the standard logarithmic approach, Exp gets shifted right
- -- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2.
-
- -- Note: it is not worth special casing base values -1, 0, +1 since
- -- the expander does this when the base is a literal, and other cases
- -- will be extremely rare.
-
- if Exp /= 0 then
- loop
- if Exp rem 2 /= 0 then
- declare
- pragma Unsuppress (All_Checks);
- begin
- Result := Result * Factor;
- end;
- end if;
-
- Exp := Exp / 2;
- exit when Exp = 0;
-
- declare
- pragma Unsuppress (All_Checks);
- begin
- Factor := Factor * Factor;
- end;
- end loop;
- end if;
-
- return Result;
- end Exp_Long_Long_Integer;
-
-end System.Exp_LLI;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-explli.ads b/gcc/ada/libgnat/s-explli.ads
index f1283cd..bf58a9a 100644
--- a/gcc/ada/libgnat/s-explli.ads
+++ b/gcc/ada/libgnat/s-explli.ads
@@ -29,14 +29,13 @@
-- --
------------------------------------------------------------------------------
--- Long_Long_Integer exponentiation
+-- Long_Long_Integer exponentiation (checks on)
+
+with System.Expont;
package System.Exp_LLI is
- pragma Pure;
- function Exp_Long_Long_Integer
- (Left : Long_Long_Integer;
- Right : Natural)
- return Long_Long_Integer;
+ function Exp_Long_Long_Integer is new Expont (Long_Long_Integer);
+ pragma Pure_Function (Exp_Long_Long_Integer);
end System.Exp_LLI;
diff --git a/gcc/ada/libgnat/s-expllli.ads b/gcc/ada/libgnat/s-expllli.ads
new file mode 100644
index 0000000..0e4375d
--- /dev/null
+++ b/gcc/ada/libgnat/s-expllli.ads
@@ -0,0 +1,41 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P _ L L L I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Long_Long_Long_Integer exponentiation (checks on)
+
+with System.Expont;
+
+package System.Exp_LLLI is
+
+ function Exp_Long_Long_Long_Integer is new Expont (Long_Long_Long_Integer);
+ pragma Pure_Function (Exp_Long_Long_Long_Integer);
+
+end System.Exp_LLLI;
diff --git a/gcc/ada/libgnat/s-explllu.ads b/gcc/ada/libgnat/s-explllu.ads
new file mode 100644
index 0000000..2f7c6a9
--- /dev/null
+++ b/gcc/ada/libgnat/s-explllu.ads
@@ -0,0 +1,48 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P _ L L L U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This function performs exponentiation of unsigned types with binary modulus
+-- values exceeding that of System.Unsigned_Types.Long_Long_Unsigned.
+-- The result is always full width, the caller must do a masking operation if
+-- the modulus is less than 2 ** Long_Long_Long_Unsigned'Size.
+
+with System.Exponu;
+with System.Unsigned_Types;
+
+package System.Exp_LLLU is
+
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
+
+ function Exp_Long_Long_Long_Unsigned is
+ new Exponu (Long_Long_Long_Unsigned);
+ pragma Pure_Function (Exp_Long_Long_Long_Unsigned);
+
+end System.Exp_LLLU;
diff --git a/gcc/ada/libgnat/s-expllu.adb b/gcc/ada/libgnat/s-expllu.adb
index 5615e4a..3a383f7 100644
--- a/gcc/ada/libgnat/s-expllu.adb
+++ b/gcc/ada/libgnat/s-expllu.adb
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- S Y S T E M . X P _ B M L --
+-- S Y S T E M . E X P _ L L U --
-- --
-- B o d y --
-- --
@@ -29,46 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Exp_LLU is
-
- ----------------------------
- -- Exp_Long_Long_Unsigned --
- ----------------------------
-
- function Exp_Long_Long_Unsigned
- (Left : Long_Long_Unsigned;
- Right : Natural)
- return Long_Long_Unsigned
- is
- Result : Long_Long_Unsigned := 1;
- Factor : Long_Long_Unsigned := Left;
- Exp : Natural := Right;
-
- begin
- -- We use the standard logarithmic approach, Exp gets shifted right
- -- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2.
-
- -- Note: it is not worth special casing the cases of base values -1,0,+1
- -- since the expander does this when the base is a literal, and other
- -- cases will be extremely rare.
-
- if Exp /= 0 then
- loop
- if Exp rem 2 /= 0 then
- Result := Result * Factor;
- end if;
-
- Exp := Exp / 2;
- exit when Exp = 0;
- Factor := Factor * Factor;
- end loop;
- end if;
-
- return Result;
-
- end Exp_Long_Long_Unsigned;
-
-end System.Exp_LLU;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-expllu.ads b/gcc/ada/libgnat/s-expllu.ads
index 2127aaad..9e30090 100644
--- a/gcc/ada/libgnat/s-expllu.ads
+++ b/gcc/ada/libgnat/s-expllu.ads
@@ -29,19 +29,19 @@
-- --
------------------------------------------------------------------------------
--- This function performs exponentiation of unsigned types (with binary
--- modulus values exceeding that of Unsigned_Types.Unsigned). The result
--- is always full width, the caller must do a masking operation if the
--- modulus is less than 2 ** (Long_Long_Unsigned'Size).
+-- This function performs exponentiation of unsigned types with binary modulus
+-- values exceeding that of System.Unsigned_Types.Unsigned.
+-- The result is always full width, the caller must do a masking operation if
+-- the modulus is less than 2 ** Long_Long_Unsigned'Size.
+with System.Exponu;
with System.Unsigned_Types;
package System.Exp_LLU is
- pragma Pure;
- function Exp_Long_Long_Unsigned
- (Left : System.Unsigned_Types.Long_Long_Unsigned;
- Right : Natural)
- return System.Unsigned_Types.Long_Long_Unsigned;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ function Exp_Long_Long_Unsigned is new Exponu (Long_Long_Unsigned);
+ pragma Pure_Function (Exp_Long_Long_Unsigned);
end System.Exp_LLU;
diff --git a/gcc/ada/libgnat/s-exponn.adb b/gcc/ada/libgnat/s-exponn.adb
new file mode 100644
index 0000000..f1522d0
--- /dev/null
+++ b/gcc/ada/libgnat/s-exponn.adb
@@ -0,0 +1,72 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P O N N --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+function System.Exponn (Left : Int; Right : Natural) return Int is
+
+ -- Note that negative exponents get a constraint error because the
+ -- subtype of the Right argument (the exponent) is Natural.
+
+ Result : Int := 1;
+ Factor : Int := Left;
+ Exp : Natural := Right;
+
+begin
+ -- We use the standard logarithmic approach, Exp gets shifted right
+ -- testing successive low order bits and Factor is the value of the
+ -- base raised to the next power of 2.
+
+ -- Note: it is not worth special casing base values -1, 0, +1 since
+ -- the expander does this when the base is a literal, and other cases
+ -- will be extremely rare.
+
+ if Exp /= 0 then
+ loop
+ if Exp rem 2 /= 0 then
+ declare
+ pragma Suppress (Overflow_Check);
+ begin
+ Result := Result * Factor;
+ end;
+ end if;
+
+ Exp := Exp / 2;
+ exit when Exp = 0;
+
+ declare
+ pragma Suppress (Overflow_Check);
+ begin
+ Factor := Factor * Factor;
+ end;
+ end loop;
+ end if;
+
+ return Result;
+end System.Exponn;
diff --git a/gcc/ada/libgnat/a-excpol.adb b/gcc/ada/libgnat/s-exponn.ads
index 27893c3..f4cd18f 100644
--- a/gcc/ada/libgnat/a-excpol.adb
+++ b/gcc/ada/libgnat/s-exponn.ads
@@ -1,15 +1,14 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . E X C E P T I O N S . P O L L --
+-- S Y S T E M . E X P O N N --
-- --
--- B o d y --
--- (dummy version where polling is not used) --
+-- S p e c --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
--- GNARL is free software; you can redistribute it and/or modify it under --
+-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
@@ -25,18 +24,15 @@
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
--- GNARL was developed by the GNARL team at Florida State University. --
--- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-separate (Ada.Exceptions)
+-- Signed integer exponentiation (checks off)
-----------
--- Poll --
-----------
+generic
-procedure Poll is
-begin
- null;
-end Poll;
+ type Int is range <>;
+
+function System.Exponn (Left : Int; Right : Natural) return Int;
diff --git a/gcc/ada/libgnat/s-expont.adb b/gcc/ada/libgnat/s-expont.adb
new file mode 100644
index 0000000..bcdcae4
--- /dev/null
+++ b/gcc/ada/libgnat/s-expont.adb
@@ -0,0 +1,72 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P O N T --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+function System.Expont (Left : Int; Right : Natural) return Int is
+
+ -- Note that negative exponents get a constraint error because the
+ -- subtype of the Right argument (the exponent) is Natural.
+
+ Result : Int := 1;
+ Factor : Int := Left;
+ Exp : Natural := Right;
+
+begin
+ -- We use the standard logarithmic approach, Exp gets shifted right
+ -- testing successive low order bits and Factor is the value of the
+ -- base raised to the next power of 2.
+
+ -- Note: it is not worth special casing base values -1, 0, +1 since
+ -- the expander does this when the base is a literal, and other cases
+ -- will be extremely rare.
+
+ if Exp /= 0 then
+ loop
+ if Exp rem 2 /= 0 then
+ declare
+ pragma Unsuppress (Overflow_Check);
+ begin
+ Result := Result * Factor;
+ end;
+ end if;
+
+ Exp := Exp / 2;
+ exit when Exp = 0;
+
+ declare
+ pragma Unsuppress (Overflow_Check);
+ begin
+ Factor := Factor * Factor;
+ end;
+ end loop;
+ end if;
+
+ return Result;
+end System.Expont;
diff --git a/gcc/ada/libgnat/s-expont.ads b/gcc/ada/libgnat/s-expont.ads
new file mode 100644
index 0000000..7a519fd
--- /dev/null
+++ b/gcc/ada/libgnat/s-expont.ads
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P O N T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Signed integer exponentiation (checks on)
+
+generic
+
+ type Int is range <>;
+
+function System.Expont (Left : Int; Right : Natural) return Int;
diff --git a/gcc/ada/libgnat/s-exponu.adb b/gcc/ada/libgnat/s-exponu.adb
new file mode 100644
index 0000000..d2b9305
--- /dev/null
+++ b/gcc/ada/libgnat/s-exponu.adb
@@ -0,0 +1,63 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P O N U --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+function System.Exponu (Left : Int; Right : Natural) return Int is
+
+ -- Note that negative exponents get a constraint error because the
+ -- subtype of the Right argument (the exponent) is Natural.
+
+ Result : Int := 1;
+ Factor : Int := Left;
+ Exp : Natural := Right;
+
+begin
+ -- We use the standard logarithmic approach, Exp gets shifted right
+ -- testing successive low order bits and Factor is the value of the
+ -- base raised to the next power of 2.
+
+ -- Note: it is not worth special casing base values -1, 0, +1 since
+ -- the expander does this when the base is a literal, and other cases
+ -- will be extremely rare.
+
+ if Exp /= 0 then
+ loop
+ if Exp rem 2 /= 0 then
+ Result := Result * Factor;
+ end if;
+
+ Exp := Exp / 2;
+ exit when Exp = 0;
+ Factor := Factor * Factor;
+ end loop;
+ end if;
+
+ return Result;
+end System.Exponu;
diff --git a/gcc/ada/libgnat/s-exponu.ads b/gcc/ada/libgnat/s-exponu.ads
new file mode 100644
index 0000000..2a913d6
--- /dev/null
+++ b/gcc/ada/libgnat/s-exponu.ads
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . E X P O N U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Modular integer exponentiation
+
+generic
+
+ type Int is mod <>;
+
+function System.Exponu (Left : Int; Right : Natural) return Int;
diff --git a/gcc/ada/libgnat/s-expuns.adb b/gcc/ada/libgnat/s-expuns.adb
index da43763..f513da2 100644
--- a/gcc/ada/libgnat/s-expuns.adb
+++ b/gcc/ada/libgnat/s-expuns.adb
@@ -29,45 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Exp_Uns is
-
- ------------------
- -- Exp_Unsigned --
- ------------------
-
- function Exp_Unsigned
- (Left : Unsigned;
- Right : Natural)
- return Unsigned
- is
- Result : Unsigned := 1;
- Factor : Unsigned := Left;
- Exp : Natural := Right;
-
- begin
- -- We use the standard logarithmic approach, Exp gets shifted right
- -- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2.
-
- -- Note: it is not worth special casing the cases of base values -1,0,+1
- -- since the expander does this when the base is a literal, and other
- -- cases will be extremely rare.
-
- if Exp /= 0 then
- loop
- if Exp rem 2 /= 0 then
- Result := Result * Factor;
- end if;
-
- Exp := Exp / 2;
- exit when Exp = 0;
- Factor := Factor * Factor;
- end loop;
- end if;
-
- return Result;
- end Exp_Unsigned;
-
-end System.Exp_Uns;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-expuns.ads b/gcc/ada/libgnat/s-expuns.ads
index a0d8085..3826f4f 100644
--- a/gcc/ada/libgnat/s-expuns.ads
+++ b/gcc/ada/libgnat/s-expuns.ads
@@ -29,19 +29,19 @@
-- --
------------------------------------------------------------------------------
--- This function performs exponentiation of unsigned types (with binary
--- modulus values up to and including that of Unsigned_Types.Unsigned).
--- The result is always full width, the caller must do a masking operation
--- the modulus is less than 2 ** (Unsigned'Size).
+-- This function performs exponentiation of unsigned types with binary modulus
+-- values up to and including that of System.Unsigned_Types.Unsigned.
+-- The result is always full width, the caller must do a masking operation if
+-- the modulus is less than 2 ** Unsigned'Size.
+with System.Exponu;
with System.Unsigned_Types;
package System.Exp_Uns is
- pragma Pure;
- function Exp_Unsigned
- (Left : System.Unsigned_Types.Unsigned;
- Right : Natural)
- return System.Unsigned_Types.Unsigned;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ function Exp_Unsigned is new Exponu (Unsigned);
+ pragma Pure_Function (Exp_Unsigned);
end System.Exp_Uns;
diff --git a/gcc/ada/libgnat/s-fatgen.adb b/gcc/ada/libgnat/s-fatgen.adb
index b544587..a598a12 100644
--- a/gcc/ada/libgnat/s-fatgen.adb
+++ b/gcc/ada/libgnat/s-fatgen.adb
@@ -172,10 +172,14 @@ package body System.Fat_Gen is
elsif X > T'Safe_Last then
Frac := Invrad;
+ pragma Annotate (CodePeer, Intentional, "dead code",
+ "Check float range.");
Expo := T'Machine_Emax + 1;
elsif X < T'Safe_First then
Frac := -Invrad;
+ pragma Annotate (CodePeer, Intentional, "dead code",
+ "Check float range.");
Expo := T'Machine_Emax + 2; -- how many extra negative values?
else
@@ -217,6 +221,8 @@ package body System.Fat_Gen is
while Ax < R_Neg_Power (Expbits'Last) loop
Ax := Ax * R_Power (Expbits'Last);
+ pragma Annotate (CodePeer, Intentional, "dead code",
+ "Check float range.");
Ex := Ex - Log_Power (Expbits'Last);
end loop;
pragma Annotate
@@ -424,7 +430,11 @@ package body System.Fat_Gen is
-- For infinities, return unchanged
elsif X < T'First or else X > T'Last then
+ pragma Annotate (CodePeer, Intentional, "condition predetermined",
+ "Check for invalid float");
return X;
+ pragma Annotate (CodePeer, Intentional, "dead code",
+ "Check float range.");
-- Subtract from the given number a number equivalent to the value
-- of its least significant bit. Given that the most significant bit
@@ -673,7 +683,11 @@ package body System.Fat_Gen is
-- For infinities, return unchanged
elsif X < T'First or else X > T'Last then
+ pragma Annotate (CodePeer, Intentional, "condition predetermined",
+ "Check for invalid float");
return X;
+ pragma Annotate (CodePeer, Intentional, "dead code",
+ "Check float range.");
-- Add to the given number a number equivalent to the value
-- of its least significant bit. Given that the most significant bit
diff --git a/gcc/ada/libgnat/s-fileio.adb b/gcc/ada/libgnat/s-fileio.adb
index b6377e3..c574487 100644
--- a/gcc/ada/libgnat/s-fileio.adb
+++ b/gcc/ada/libgnat/s-fileio.adb
@@ -800,9 +800,9 @@ package body System.File_IO is
Text_Encoding : Content_Encoding;
- Tempfile : constant Boolean := Name = "";
+ Tempfile : constant Boolean := Name = "" and Stream = NULL_Stream;
-- Indicates temporary file case, which is indicated by an empty file
- -- name.
+ -- name and no specified Stream.
Namelen : constant Integer := max_path_len;
-- Length required for file name, not including final ASCII.NUL.
diff --git a/gcc/ada/libgnat/s-genbig.adb b/gcc/ada/libgnat/s-genbig.adb
index 71aff9b..12167ac 100644
--- a/gcc/ada/libgnat/s-genbig.adb
+++ b/gcc/ada/libgnat/s-genbig.adb
@@ -1120,7 +1120,33 @@ package body System.Generic_Bignums is
-- To_Bignum --
---------------
- function To_Bignum (X : Long_Long_Integer) return Big_Integer is
+ function To_Bignum (X : Long_Long_Long_Integer) return Big_Integer is
+
+ function Convert_128
+ (X : Long_Long_Long_Integer; Neg : Boolean) return Big_Integer;
+ -- Convert a 128 bits natural integer to a Big_Integer
+
+ -----------------
+ -- Convert_128 --
+ -----------------
+
+ function Convert_128
+ (X : Long_Long_Long_Integer; Neg : Boolean) return Big_Integer
+ is
+ Vector : Digit_Vector (1 .. 4);
+ High : constant Unsigned_64 :=
+ Unsigned_64 (Shift_Right (Unsigned_128 (X), 64));
+ Low : constant Unsigned_64 :=
+ Unsigned_64 (Unsigned_128 (X) and 16#FFFF_FFFF_FFFF_FFFF#);
+
+ begin
+ Vector (1) := SD (High / Base);
+ Vector (2) := SD (High mod Base);
+ Vector (3) := SD (Low / Base);
+ Vector (4) := SD (Low mod Base);
+ return Normalize (Vector, Neg);
+ end Convert_128;
+
begin
if X = 0 then
return Allocate_Big_Integer ((1 .. 0 => <>), False);
@@ -1130,23 +1156,43 @@ package body System.Generic_Bignums is
elsif X in -(2 ** 32 - 1) .. +(2 ** 32 - 1) then
return Allocate_Big_Integer ((1 => SD (abs X)), X < 0);
- -- Largest negative number annoyance
+ -- Large negative number annoyance
- elsif X = Long_Long_Integer'First then
+ elsif X = -2 ** 63 then
return Allocate_Big_Integer ((2 ** 31, 0), True);
+ elsif Long_Long_Long_Integer'Size = 128
+ and then X = Long_Long_Long_Integer'First
+ then
+ return Allocate_Big_Integer ((2 ** 31, 0, 0, 0), True);
+
-- Other negative numbers
elsif X < 0 then
- return Allocate_Big_Integer
- ((SD ((-X) / Base), SD ((-X) mod Base)), True);
+ if Long_Long_Long_Integer'Size = 64 then
+ return Allocate_Big_Integer
+ ((SD ((-X) / Base), SD ((-X) mod Base)), True);
+ else
+ return Convert_128 (-X, True);
+ end if;
-- Positive numbers
+
else
- return Allocate_Big_Integer ((SD (X / Base), SD (X mod Base)), False);
+ if Long_Long_Long_Integer'Size = 64 then
+ return Allocate_Big_Integer
+ ((SD (X / Base), SD (X mod Base)), False);
+ else
+ return Convert_128 (X, False);
+ end if;
end if;
end To_Bignum;
+ function To_Bignum (X : Long_Long_Integer) return Big_Integer is
+ begin
+ return To_Bignum (Long_Long_Long_Integer (X));
+ end To_Bignum;
+
function To_Bignum (X : Unsigned_64) return Big_Integer is
begin
if X = 0 then
diff --git a/gcc/ada/libgnat/s-genbig.ads b/gcc/ada/libgnat/s-genbig.ads
index 003a8fd..81e3843 100644
--- a/gcc/ada/libgnat/s-genbig.ads
+++ b/gcc/ada/libgnat/s-genbig.ads
@@ -101,6 +101,10 @@ package System.Generic_Bignums is
-- Convert Long_Long_Integer to a big integer. No exception can be raised
-- for any input argument.
+ function To_Bignum (X : Long_Long_Long_Integer) return Big_Integer;
+ -- Convert Long_Long_Long_Integer to a big integer. No exception can be
+ -- raised.
+
function To_Bignum (X : Interfaces.Unsigned_64) return Big_Integer;
-- Convert Unsigned_64 to a big integer. No exception can be raised for any
-- input argument.
diff --git a/gcc/ada/libgnat/s-geveop.adb b/gcc/ada/libgnat/s-geveop.adb
index 8e59b30..ff62a34 100644
--- a/gcc/ada/libgnat/s-geveop.adb
+++ b/gcc/ada/libgnat/s-geveop.adb
@@ -66,6 +66,13 @@ package body System.Generic_Vector_Operations is
function VP is new Ada.Unchecked_Conversion (Address, Vector_Ptr);
function EP is new Ada.Unchecked_Conversion (Address, Element_Ptr);
+ pragma Assert (VI > 0);
+ -- VI = VU
+ -- VU = Vectors.Vector'Size / Storage_Unit
+ -- Vector'Size = System.Word_Size
+ -- System.Word_Size is a multiple of Storage_Unit
+ -- Vector'Size > Storage_Unit
+ -- VI > 0
SA : constant Address :=
AddA (XA, To_Address
((Integer_Address (Length) / VI * VI) and Unaligned));
@@ -111,6 +118,13 @@ package body System.Generic_Vector_Operations is
function VP is new Ada.Unchecked_Conversion (Address, Vector_Ptr);
function EP is new Ada.Unchecked_Conversion (Address, Element_Ptr);
+ pragma Assert (VI > 0);
+ -- VI = VU
+ -- VU = Vectors.Vector'Size / Storage_Unit
+ -- Vector'Size = System.Word_Size
+ -- System.Word_Size is a multiple of Storage_Unit
+ -- Vector'Size > Storage_Unit
+ -- VI > 0
SA : constant Address :=
AddA (XA, To_Address
((Integer_Address (Length) / VI * VI) and Unaligned));
diff --git a/gcc/ada/libgnat/s-imageb.adb b/gcc/ada/libgnat/s-imageb.adb
new file mode 100644
index 0000000..72e8fb3
--- /dev/null
+++ b/gcc/ada/libgnat/s-imageb.adb
@@ -0,0 +1,156 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ B --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body System.Image_B is
+
+ -----------------------------
+ -- Set_Image_Based_Integer --
+ -----------------------------
+
+ procedure Set_Image_Based_Integer
+ (V : Int;
+ B : Natural;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ is
+ Start : Natural;
+
+ begin
+ -- Positive case can just use the unsigned circuit directly
+
+ if V >= 0 then
+ Set_Image_Based_Unsigned (Uns (V), B, W, S, P);
+
+ -- Negative case has to set a minus sign. Note also that we have to be
+ -- careful not to generate overflow with the largest negative number.
+
+ else
+ P := P + 1;
+ S (P) := ' ';
+ Start := P;
+
+ declare
+ pragma Suppress (Overflow_Check);
+ pragma Suppress (Range_Check);
+ begin
+ Set_Image_Based_Unsigned (Uns (-V), B, W - 1, S, P);
+ end;
+
+ -- Set minus sign in last leading blank location. Because of the
+ -- code above, there must be at least one such location.
+
+ while S (Start + 1) = ' ' loop
+ Start := Start + 1;
+ end loop;
+
+ S (Start) := '-';
+ end if;
+
+ end Set_Image_Based_Integer;
+
+ ------------------------------
+ -- Set_Image_Based_Unsigned --
+ ------------------------------
+
+ procedure Set_Image_Based_Unsigned
+ (V : Uns;
+ B : Natural;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ is
+ Start : constant Natural := P;
+ F, T : Natural;
+ BU : constant Uns := Uns (B);
+ Hex : constant array
+ (Uns range 0 .. 15) of Character := "0123456789ABCDEF";
+
+ procedure Set_Digits (T : Uns);
+ -- Set digits of absolute value of T
+
+ ----------------
+ -- Set_Digits --
+ ----------------
+
+ procedure Set_Digits (T : Uns) is
+ begin
+ if T >= BU then
+ Set_Digits (T / BU);
+ P := P + 1;
+ S (P) := Hex (T mod BU);
+ else
+ P := P + 1;
+ S (P) := Hex (T);
+ end if;
+ end Set_Digits;
+
+ -- Start of processing for Set_Image_Based_Unsigned
+
+ begin
+
+ if B >= 10 then
+ P := P + 1;
+ S (P) := '1';
+ end if;
+
+ P := P + 1;
+ S (P) := Character'Val (Character'Pos ('0') + B mod 10);
+
+ P := P + 1;
+ S (P) := '#';
+
+ Set_Digits (V);
+
+ P := P + 1;
+ S (P) := '#';
+
+ -- Add leading spaces if required by width parameter
+
+ if P - Start < W then
+ F := P;
+ P := Start + W;
+ T := P;
+
+ while F > Start loop
+ S (T) := S (F);
+ T := T - 1;
+ F := F - 1;
+ end loop;
+
+ for J in Start + 1 .. T loop
+ S (J) := ' ';
+ end loop;
+ end if;
+
+ end Set_Image_Based_Unsigned;
+
+end System.Image_B;
diff --git a/gcc/ada/libgnat/s-imageb.ads b/gcc/ada/libgnat/s-imageb.ads
new file mode 100644
index 0000000..109f5c7
--- /dev/null
+++ b/gcc/ada/libgnat/s-imageb.ads
@@ -0,0 +1,75 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ B --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Contains the routine for computing the image in based format of signed and
+-- unsigned integers for use by Text_IO.Integer_IO and Text_IO.Modular_IO.
+
+generic
+
+ type Int is range <>;
+
+ type Uns is mod <>;
+
+package System.Image_B is
+ pragma Pure;
+
+ procedure Set_Image_Based_Integer
+ (V : Int;
+ B : Natural;
+ W : Integer;
+ S : out String;
+ P : in out Natural);
+ -- Sets the signed image of V in based format, using base value B (2..16)
+ -- starting at S (P + 1), updating P to point to the last character stored.
+ -- The image includes a leading minus sign if necessary, but no leading
+ -- spaces unless W is positive, in which case leading spaces are output if
+ -- necessary to ensure that the output string is no less than W characters
+ -- long. The caller promises that the buffer is large enough and no check
+ -- is made for this. Constraint_Error will not necessarily be raised if
+ -- this is violated, since it is perfectly valid to compile this unit with
+ -- checks off.
+
+ procedure Set_Image_Based_Unsigned
+ (V : Uns;
+ B : Natural;
+ W : Integer;
+ S : out String;
+ P : in out Natural);
+ -- Sets the unsigned image of V in based format, using base value B (2..16)
+ -- starting at S (P + 1), updating P to point to the last character stored.
+ -- The image includes no leading spaces unless W is positive, in which case
+ -- leading spaces are output if necessary to ensure that the output string
+ -- is no less than W characters long. The caller promises that the buffer
+ -- is large enough and no check is made for this. Constraint_Error will not
+ -- necessarily be raised if this is violated, since it is perfectly valid
+ -- to compile this unit with checks off).
+
+end System.Image_B;
diff --git a/gcc/ada/libgnat/s-imagei.adb b/gcc/ada/libgnat/s-imagei.adb
new file mode 100644
index 0000000..c739dfb
--- /dev/null
+++ b/gcc/ada/libgnat/s-imagei.adb
@@ -0,0 +1,121 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ I --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body System.Image_I is
+
+ subtype Non_Positive is Int range Int'First .. 0;
+
+ procedure Set_Digits
+ (T : Non_Positive;
+ S : in out String;
+ P : in out Natural);
+ -- Set digits of absolute value of T, which is zero or negative. We work
+ -- with the negative of the value so that the largest negative number is
+ -- not a special case.
+
+ -------------------
+ -- Image_Integer --
+ -------------------
+
+ procedure Image_Integer
+ (V : Int;
+ S : in out String;
+ P : out Natural)
+ is
+ pragma Assert (S'First = 1);
+
+ begin
+ if V >= 0 then
+ S (1) := ' ';
+ P := 1;
+ else
+ P := 0;
+ end if;
+
+ Set_Image_Integer (V, S, P);
+ end Image_Integer;
+
+ ----------------
+ -- Set_Digits --
+ ----------------
+
+ procedure Set_Digits
+ (T : Non_Positive;
+ S : in out String;
+ P : in out Natural)
+ is
+ begin
+ if T <= -10 then
+ Set_Digits (T / 10, S, P);
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the Set_Image_Integer
+ -- specification, the caller guarantees that S is long enough to
+ -- hold the result.
+ P := P + 1;
+ S (P) := Character'Val (48 - (T rem 10));
+
+ else
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the Set_Image_Integer
+ -- specification, the caller guarantees that S is long enough to
+ -- hold the result.
+ P := P + 1;
+ S (P) := Character'Val (48 - T);
+ end if;
+ end Set_Digits;
+
+ -----------------------
+ -- Set_Image_Integer --
+ -----------------------
+
+ procedure Set_Image_Integer
+ (V : Int;
+ S : in out String;
+ P : in out Natural)
+ is
+ begin
+ if V >= 0 then
+ Set_Digits (-V, S, P);
+
+ else
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ P := P + 1;
+ S (P) := '-';
+ Set_Digits (V, S, P);
+ end if;
+ end Set_Image_Integer;
+
+end System.Image_I;
diff --git a/gcc/ada/libgnat/s-imagei.ads b/gcc/ada/libgnat/s-imagei.ads
new file mode 100644
index 0000000..2163af8
--- /dev/null
+++ b/gcc/ada/libgnat/s-imagei.ads
@@ -0,0 +1,61 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains the routines for supporting the Image attribute for
+-- signed integer types, and also for conversion operations required in
+-- Text_IO.Integer_IO for such types.
+
+generic
+
+ type Int is range <>;
+
+package System.Image_I is
+ pragma Pure;
+
+ procedure Image_Integer
+ (V : Int;
+ S : in out String;
+ P : out Natural);
+ -- Computes Int'Image (V) and stores the result in S (1 .. P)
+ -- setting the resulting value of P. The caller guarantees that S
+ -- is long enough to hold the result, and that S'First is 1.
+
+ procedure Set_Image_Integer
+ (V : Int;
+ S : in out String;
+ P : in out Natural);
+ -- Stores the image of V in S starting at S (P + 1), P is updated to point
+ -- to the last character stored. The value stored is identical to the value
+ -- of Int'Image (V) except that no leading space is stored when V is
+ -- non-negative. The caller guarantees that S is long enough to hold the
+ -- result. S need not have a lower bound of 1.
+
+end System.Image_I;
diff --git a/gcc/ada/libgnat/s-imageu.adb b/gcc/ada/libgnat/s-imageu.adb
new file mode 100644
index 0000000..c995d55
--- /dev/null
+++ b/gcc/ada/libgnat/s-imageu.adb
@@ -0,0 +1,79 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ U --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body System.Image_U is
+
+ --------------------
+ -- Image_Unsigned --
+ --------------------
+
+ procedure Image_Unsigned
+ (V : Uns;
+ S : in out String;
+ P : out Natural)
+ is
+ pragma Assert (S'First = 1);
+ begin
+ S (1) := ' ';
+ P := 1;
+ Set_Image_Unsigned (V, S, P);
+ end Image_Unsigned;
+
+ ------------------------
+ -- Set_Image_Unsigned --
+ ------------------------
+
+ procedure Set_Image_Unsigned
+ (V : Uns;
+ S : in out String;
+ P : in out Natural)
+ is
+ begin
+ if V >= 10 then
+ Set_Image_Unsigned (V / 10, S, P);
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ P := P + 1;
+ S (P) := Character'Val (48 + (V rem 10));
+
+ else
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ P := P + 1;
+ S (P) := Character'Val (48 + V);
+ end if;
+ end Set_Image_Unsigned;
+
+end System.Image_U;
diff --git a/gcc/ada/libgnat/s-imageu.ads b/gcc/ada/libgnat/s-imageu.ads
new file mode 100644
index 0000000..39e738a
--- /dev/null
+++ b/gcc/ada/libgnat/s-imageu.ads
@@ -0,0 +1,62 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains the routines for supporting the Image attribute for
+-- modular integer types, and also for conversion operations required in
+-- Text_IO.Modular_IO for such types.
+
+generic
+
+ type Uns is mod <>;
+
+package System.Image_U is
+ pragma Pure;
+
+ procedure Image_Unsigned
+ (V : Uns;
+ S : in out String;
+ P : out Natural);
+ pragma Inline (Image_Unsigned);
+ -- Computes Uns'Image (V) and stores the result in S (1 .. P) setting
+ -- the resulting value of P. The caller guarantees that S is long enough to
+ -- hold the result, and that S'First is 1.
+
+ procedure Set_Image_Unsigned
+ (V : Uns;
+ S : in out String;
+ P : in out Natural);
+ -- Stores the image of V in S starting at S (P + 1), P is updated to point
+ -- to the last character stored. The value stored is identical to the value
+ -- of Uns'Image (V) except that no leading space is stored. The caller
+ -- guarantees that S is long enough to hold the result. S need not have a
+ -- lower bound of 1.
+
+end System.Image_U;
diff --git a/gcc/ada/libgnat/s-imagew.adb b/gcc/ada/libgnat/s-imagew.adb
new file mode 100644
index 0000000..dd3b96e
--- /dev/null
+++ b/gcc/ada/libgnat/s-imagew.adb
@@ -0,0 +1,152 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ W --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body System.Image_W is
+
+ -----------------------------
+ -- Set_Image_Width_Integer --
+ -----------------------------
+
+ procedure Set_Image_Width_Integer
+ (V : Int;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ is
+ Start : Natural;
+
+ begin
+ -- Positive case can just use the unsigned circuit directly
+
+ if V >= 0 then
+ Set_Image_Width_Unsigned (Uns (V), W, S, P);
+
+ -- Negative case has to set a minus sign. Note also that we have to be
+ -- careful not to generate overflow with the largest negative number.
+
+ else
+ P := P + 1;
+ S (P) := ' ';
+ Start := P;
+
+ declare
+ pragma Suppress (Overflow_Check);
+ pragma Suppress (Range_Check);
+ begin
+ Set_Image_Width_Unsigned (Uns (-V), W - 1, S, P);
+ end;
+
+ -- Set minus sign in last leading blank location. Because of the
+ -- code above, there must be at least one such location.
+
+ while S (Start + 1) = ' ' loop
+ Start := Start + 1;
+ end loop;
+
+ S (Start) := '-';
+ end if;
+
+ end Set_Image_Width_Integer;
+
+ ------------------------------
+ -- Set_Image_Width_Unsigned --
+ ------------------------------
+
+ procedure Set_Image_Width_Unsigned
+ (V : Uns;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ is
+ Start : constant Natural := P;
+ F, T : Natural;
+
+ procedure Set_Digits (T : Uns);
+ -- Set digits of absolute value of T
+
+ ----------------
+ -- Set_Digits --
+ ----------------
+
+ procedure Set_Digits (T : Uns) is
+ begin
+ if T >= 10 then
+ Set_Digits (T / 10);
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ P := P + 1;
+ S (P) := Character'Val (T mod 10 + Character'Pos ('0'));
+
+ else
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ P := P + 1;
+ S (P) := Character'Val (T + Character'Pos ('0'));
+ end if;
+ end Set_Digits;
+
+ -- Start of processing for Set_Image_Width_Unsigned
+
+ begin
+ Set_Digits (V);
+
+ -- Add leading spaces if required by width parameter
+
+ if P - Start < W then
+ F := P;
+ P := P + (W - (P - Start));
+ T := P;
+
+ while F > Start loop
+ pragma Assert (T >= S'First and T <= S'Last and
+ F >= S'First and F <= S'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ S (T) := S (F);
+ T := T - 1;
+ F := F - 1;
+ end loop;
+
+ for J in Start + 1 .. T loop
+ pragma Assert (J >= S'First and J <= S'Last);
+ -- No check is done since, as documented in the specification,
+ -- the caller guarantees that S is long enough to hold the result.
+ S (J) := ' ';
+ end loop;
+ end if;
+
+ end Set_Image_Width_Unsigned;
+
+end System.Image_W;
diff --git a/gcc/ada/libgnat/s-imagew.ads b/gcc/ada/libgnat/s-imagew.ads
new file mode 100644
index 0000000..14c0c60
--- /dev/null
+++ b/gcc/ada/libgnat/s-imagew.ads
@@ -0,0 +1,73 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M A G E _ W --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Contains the routine for computing the image of signed and unsigned
+-- integers up to Integer for use by Text_IO.Integer_IO and
+-- Text_IO.Modular_IO.
+
+generic
+
+ type Int is range <>;
+
+ type Uns is mod <>;
+
+package System.Image_W is
+ pragma Pure;
+
+ procedure Set_Image_Width_Integer
+ (V : Int;
+ W : Integer;
+ S : out String;
+ P : in out Natural);
+ -- Sets the signed image of V in decimal format, starting at S (P + 1),
+ -- updating P to point to the last character stored. The image includes
+ -- a leading minus sign if necessary, but no leading spaces unless W is
+ -- positive, in which case leading spaces are output if necessary to ensure
+ -- that the output string is no less than W characters long. The caller
+ -- promises that the buffer is large enough and no check is made for this.
+ -- Constraint_Error will not necessarily be raised if this is violated,
+ -- since it is perfectly valid to compile this unit with checks off.
+
+ procedure Set_Image_Width_Unsigned
+ (V : Uns;
+ W : Integer;
+ S : out String;
+ P : in out Natural);
+ -- Sets the unsigned image of V in decimal format, starting at S (P + 1),
+ -- updating P to point to the last character stored. The image includes no
+ -- leading spaces unless W is positive, in which case leading spaces are
+ -- output if necessary to ensure that the output string is no less than
+ -- W characters long. The caller promises that the buffer is large enough
+ -- and no check is made for this. Constraint_Error will not necessarily be
+ -- raised if this is violated, since it is perfectly valid to compile this
+ -- unit with checks off.
+
+end System.Image_W;
diff --git a/gcc/ada/libgnat/s-imenne.adb b/gcc/ada/libgnat/s-imenne.adb
index 605b85b..3052ea2 100644
--- a/gcc/ada/libgnat/s-imenne.adb
+++ b/gcc/ada/libgnat/s-imenne.adb
@@ -49,8 +49,11 @@ package body System.Img_Enum_New is
pragma Assert (S'First = 1);
type Natural_8 is range 0 .. 2 ** 7 - 1;
+ subtype Names_Index is
+ Natural_8 range Natural_8 (Names'First)
+ .. Natural_8 (Names'Last) + 1;
subtype Index is Natural range Natural'First .. Names'Length;
- type Index_Table is array (Index) of Natural_8;
+ type Index_Table is array (Index) of Names_Index;
type Index_Table_Ptr is access Index_Table;
function To_Index_Table_Ptr is
@@ -58,9 +61,19 @@ package body System.Img_Enum_New is
IndexesT : constant Index_Table_Ptr := To_Index_Table_Ptr (Indexes);
+ pragma Assert (Pos in IndexesT'Range);
+ pragma Assert (Pos + 1 in IndexesT'Range);
+
Start : constant Natural := Natural (IndexesT (Pos));
Next : constant Natural := Natural (IndexesT (Pos + 1));
+ pragma Assert (Next - 1 >= Start);
+ pragma Assert (Start >= Names'First);
+ pragma Assert (Next - 1 <= Names'Last);
+
+ pragma Assert (Next - Start <= S'Last);
+ -- The caller should guarantee that S is large enough to contain the
+ -- enumeration image.
begin
S (1 .. Next - Start) := Names (Start .. Next - 1);
P := Next - Start;
@@ -80,8 +93,11 @@ package body System.Img_Enum_New is
pragma Assert (S'First = 1);
type Natural_16 is range 0 .. 2 ** 15 - 1;
+ subtype Names_Index is
+ Natural_16 range Natural_16 (Names'First)
+ .. Natural_16 (Names'Last) + 1;
subtype Index is Natural range Natural'First .. Names'Length;
- type Index_Table is array (Index) of Natural_16;
+ type Index_Table is array (Index) of Names_Index;
type Index_Table_Ptr is access Index_Table;
function To_Index_Table_Ptr is
@@ -89,9 +105,19 @@ package body System.Img_Enum_New is
IndexesT : constant Index_Table_Ptr := To_Index_Table_Ptr (Indexes);
+ pragma Assert (Pos in IndexesT'Range);
+ pragma Assert (Pos + 1 in IndexesT'Range);
+
Start : constant Natural := Natural (IndexesT (Pos));
Next : constant Natural := Natural (IndexesT (Pos + 1));
+ pragma Assert (Next - 1 >= Start);
+ pragma Assert (Start >= Names'First);
+ pragma Assert (Next - 1 <= Names'Last);
+
+ pragma Assert (Next - Start <= S'Last);
+ -- The caller should guarantee that S is large enough to contain the
+ -- enumeration image.
begin
S (1 .. Next - Start) := Names (Start .. Next - 1);
P := Next - Start;
@@ -111,8 +137,11 @@ package body System.Img_Enum_New is
pragma Assert (S'First = 1);
type Natural_32 is range 0 .. 2 ** 31 - 1;
+ subtype Names_Index is
+ Natural_32 range Natural_32 (Names'First)
+ .. Natural_32 (Names'Last) + 1;
subtype Index is Natural range Natural'First .. Names'Length;
- type Index_Table is array (Index) of Natural_32;
+ type Index_Table is array (Index) of Names_Index;
type Index_Table_Ptr is access Index_Table;
function To_Index_Table_Ptr is
@@ -120,9 +149,19 @@ package body System.Img_Enum_New is
IndexesT : constant Index_Table_Ptr := To_Index_Table_Ptr (Indexes);
+ pragma Assert (Pos in IndexesT'Range);
+ pragma Assert (Pos + 1 in IndexesT'Range);
+
Start : constant Natural := Natural (IndexesT (Pos));
Next : constant Natural := Natural (IndexesT (Pos + 1));
+ pragma Assert (Next - 1 >= Start);
+ pragma Assert (Start >= Names'First);
+ pragma Assert (Next - 1 <= Names'Last);
+
+ pragma Assert (Next - Start <= S'Last);
+ -- The caller should guarantee that S is large enough to contain the
+ -- enumeration image.
begin
S (1 .. Next - Start) := Names (Start .. Next - 1);
P := Next - Start;
diff --git a/gcc/ada/libgnat/s-imgbiu.adb b/gcc/ada/libgnat/s-imgbiu.adb
index 7b765c0..fbbbcec 100644
--- a/gcc/ada/libgnat/s-imgbiu.adb
+++ b/gcc/ada/libgnat/s-imgbiu.adb
@@ -29,130 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Img_BIU is
-
- -----------------------------
- -- Set_Image_Based_Integer --
- -----------------------------
-
- procedure Set_Image_Based_Integer
- (V : Integer;
- B : Natural;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : Natural;
-
- begin
- -- Positive case can just use the unsigned circuit directly
-
- if V >= 0 then
- Set_Image_Based_Unsigned (Unsigned (V), B, W, S, P);
-
- -- Negative case has to set a minus sign. Note also that we have to be
- -- careful not to generate overflow with the largest negative number.
-
- else
- P := P + 1;
- S (P) := ' ';
- Start := P;
-
- declare
- pragma Suppress (Overflow_Check);
- pragma Suppress (Range_Check);
- begin
- Set_Image_Based_Unsigned (Unsigned (-V), B, W - 1, S, P);
- end;
-
- -- Set minus sign in last leading blank location. Because of the
- -- code above, there must be at least one such location.
-
- while S (Start + 1) = ' ' loop
- Start := Start + 1;
- end loop;
-
- S (Start) := '-';
- end if;
-
- end Set_Image_Based_Integer;
-
- ------------------------------
- -- Set_Image_Based_Unsigned --
- ------------------------------
-
- procedure Set_Image_Based_Unsigned
- (V : Unsigned;
- B : Natural;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : constant Natural := P;
- F, T : Natural;
- BU : constant Unsigned := Unsigned (B);
- Hex : constant array
- (Unsigned range 0 .. 15) of Character := "0123456789ABCDEF";
-
- procedure Set_Digits (T : Unsigned);
- -- Set digits of absolute value of T
-
- ----------------
- -- Set_Digits --
- ----------------
-
- procedure Set_Digits (T : Unsigned) is
- begin
- if T >= BU then
- Set_Digits (T / BU);
- P := P + 1;
- S (P) := Hex (T mod BU);
- else
- P := P + 1;
- S (P) := Hex (T);
- end if;
- end Set_Digits;
-
- -- Start of processing for Set_Image_Based_Unsigned
-
- begin
-
- if B >= 10 then
- P := P + 1;
- S (P) := '1';
- end if;
-
- P := P + 1;
- S (P) := Character'Val (Character'Pos ('0') + B mod 10);
-
- P := P + 1;
- S (P) := '#';
-
- Set_Digits (V);
-
- P := P + 1;
- S (P) := '#';
-
- -- Add leading spaces if required by width parameter
-
- if P - Start < W then
- F := P;
- P := Start + W;
- T := P;
-
- while F > Start loop
- S (T) := S (F);
- T := T - 1;
- F := F - 1;
- end loop;
-
- for J in Start + 1 .. T loop
- S (J) := ' ';
- end loop;
- end if;
-
- end Set_Image_Based_Unsigned;
-
-end System.Img_BIU;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imgbiu.ads b/gcc/ada/libgnat/s-imgbiu.ads
index 524e582..9cf24ae 100644
--- a/gcc/ada/libgnat/s-imgbiu.ads
+++ b/gcc/ada/libgnat/s-imgbiu.ads
@@ -30,43 +30,33 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image in based format of signed and
--- unsigned integers whose size <= Integer'Size for use by Text_IO.Integer_IO
--- and Text_IO.Modular_IO.
+-- unsigned integers up to Integer for use by Text_IO.Integer_IO and
+-- Text_IO.Modular_IO.
+with System.Image_B;
with System.Unsigned_Types;
package System.Img_BIU is
pragma Pure;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ package Impl is new Image_B (Integer, Unsigned);
+
procedure Set_Image_Based_Integer
(V : Integer;
B : Natural;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the signed image of V in based format, using base value B (2..16)
- -- starting at S (P + 1), updating P to point to the last character stored.
- -- The image includes a leading minus sign if necessary, but no leading
- -- spaces unless W is positive, in which case leading spaces are output if
- -- necessary to ensure that the output string is no less than W characters
- -- long. The caller promises that the buffer is large enough and no check
- -- is made for this. Constraint_Error will not necessarily be raised if
- -- this is violated, since it is perfectly valid to compile this unit with
- -- checks off.
+ P : in out Natural)
+ renames Impl.Set_Image_Based_Integer;
procedure Set_Image_Based_Unsigned
- (V : System.Unsigned_Types.Unsigned;
+ (V : Unsigned;
B : Natural;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the unsigned image of V in based format, using base value B (2..16)
- -- starting at S (P + 1), updating P to point to the last character stored.
- -- The image includes no leading spaces unless W is positive, in which case
- -- leading spaces are output if necessary to ensure that the output string
- -- is no less than W characters long. The caller promises that the buffer
- -- is large enough and no check is made for this. Constraint_Error will not
- -- necessarily be raised if this is violated, since it is perfectly valid
- -- to compile this unit with checks off).
+ P : in out Natural)
+ renames Impl.Set_Image_Based_Unsigned;
end System.Img_BIU;
diff --git a/gcc/ada/libgnat/s-imgcha.adb b/gcc/ada/libgnat/s-imgcha.adb
index a2d7c46..06048eb 100644
--- a/gcc/ada/libgnat/s-imgcha.adb
+++ b/gcc/ada/libgnat/s-imgcha.adb
@@ -140,8 +140,12 @@ package body System.Img_Char is
declare
VP : constant Natural := Character'Pos (V);
begin
- S (1 .. 9) := "RESERVED_";
- S (10) := Character'Val (48 + VP / 100);
+ pragma Assert (S'First = 1 and S'Last >= 12);
+ -- As described in the header description, this procedure
+ -- doesn't check the size of the string provided by the caller
+ -- and suppose S'First is 1.
+ S (1 .. 10) := "RESERVED_1";
+ -- Since C1_Range is 127..159, the first character is always 1
S (11) := Character'Val (48 + (VP / 10) mod 10);
S (12) := Character'Val (48 + VP mod 10);
P := 12;
diff --git a/gcc/ada/libgnat/s-imgdec.adb b/gcc/ada/libgnat/s-imgdec.adb
index 6000d44..840dadb 100644
--- a/gcc/ada/libgnat/s-imgdec.adb
+++ b/gcc/ada/libgnat/s-imgdec.adb
@@ -72,6 +72,10 @@ package body System.Img_Dec is
Aft : Natural;
Exp : Natural)
is
+ pragma Assert (NDigs >= 1);
+ pragma Assert (Digs'First = 1);
+ pragma Assert (Digs'First < Digs'Last);
+
Minus : constant Boolean := (Digs (Digs'First) = '-');
-- Set True if input is negative
@@ -135,6 +139,10 @@ package body System.Img_Dec is
procedure Round (N : Integer) is
D : Character;
+ pragma Assert (NDigs >= 1);
+ pragma Assert (Digs'First = 1);
+ pragma Assert (Digs'First < Digs'Last);
+
begin
-- Nothing to do if rounding past the last digit we have
@@ -164,10 +172,17 @@ package body System.Img_Dec is
else
LD := N;
+ pragma Assert (LD >= 1);
+ -- In this case, we have N < LD and N >= FD. FD is a Natural,
+ -- So we can conclude, LD >= 1
ND := LD - 1;
+ pragma Assert (N + 1 <= Digs'Last);
if Digs (N + 1) >= '5' then
- for J in reverse 2 .. N loop
+ for J in reverse Digs'First + 1 .. Digs'First + N - 1 loop
+ pragma Assert (Digs (J) in '0' .. '9' | ' ' | '-');
+ -- Because it is a decimal image, we can assume that
+ -- it can only contain these characters.
D := Character'Succ (Digs (J));
if D <= '9' then
@@ -196,6 +211,17 @@ package body System.Img_Dec is
procedure Set (C : Character) is
begin
+ pragma Assert (P >= (S'First - 1) and P < S'Last and
+ P < Natural'Last);
+ -- No check is done as documented in the header : updating P to
+ -- point to the last character stored, the caller promises that the
+ -- buffer is large enough and no check is made for this.
+ -- Constraint_Error will not necessarily be raised if this
+ -- requirement is violated, since it is perfectly valid to compile
+ -- this unit with checks off.
+ --
+ -- Due to codepeer limitation, codepeer should be used with switch:
+ -- -no-propagation system.img_dec.set_decimal_digits.set
P := P + 1;
S (P) := C;
end Set;
@@ -230,6 +256,9 @@ package body System.Img_Dec is
procedure Set_Digits (S, E : Natural) is
begin
+ pragma Assert (S >= Digs'First and E <= Digs'Last);
+ -- S and E should be in the Digs array range
+ -- TBC: Analysis should be completed
for J in S .. E loop
Set (Digs (J));
end loop;
@@ -254,8 +283,10 @@ package body System.Img_Dec is
if Exp > 0 then
Set_Blanks_And_Sign (Fore - 1);
Round (Digits_After_Point + 2);
+
Set (Digs (FD));
FD := FD + 1;
+ pragma Assert (ND >= 1);
ND := ND - 1;
Set ('.');
@@ -388,6 +419,9 @@ package body System.Img_Dec is
else
Set_Blanks_And_Sign (Fore - Digits_Before_Point);
+ pragma Assert (FD + Digits_Before_Point - 1 >= 0);
+ -- In this branch, we have Digits_Before_Point > 0. It is the
+ -- else of test (Digits_Before_Point <= 0)
Set_Digits (FD, FD + Digits_Before_Point - 1);
Set ('.');
Set_Digits (FD + Digits_Before_Point, LD);
diff --git a/gcc/ada/libgnat/s-imgint.adb b/gcc/ada/libgnat/s-imgint.adb
index 2b94472..acadd1c 100644
--- a/gcc/ada/libgnat/s-imgint.adb
+++ b/gcc/ada/libgnat/s-imgint.adb
@@ -29,75 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Img_Int is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- procedure Set_Digits
- (T : Integer;
- S : in out String;
- P : in out Natural);
- -- Set digits of absolute value of T, which is zero or negative. We work
- -- with the negative of the value so that the largest negative number is
- -- not a special case.
-
- -------------------
- -- Image_Integer --
- -------------------
-
- procedure Image_Integer
- (V : Integer;
- S : in out String;
- P : out Natural)
- is
- pragma Assert (S'First = 1);
-
- begin
- if V >= 0 then
- S (1) := ' ';
- P := 1;
- else
- P := 0;
- end if;
-
- Set_Image_Integer (V, S, P);
- end Image_Integer;
-
- ----------------
- -- Set_Digits --
- ----------------
-
- procedure Set_Digits
- (T : Integer;
- S : in out String;
- P : in out Natural)
- is
- begin
- if T <= -10 then
- Set_Digits (T / 10, S, P);
- P := P + 1;
- S (P) := Character'Val (48 - (T rem 10));
- else
- P := P + 1;
- S (P) := Character'Val (48 - T);
- end if;
- end Set_Digits;
-
- -----------------------
- -- Set_Image_Integer --
- -----------------------
-
- procedure Set_Image_Integer
- (V : Integer;
- S : in out String;
- P : in out Natural)
- is
- begin
- if V >= 0 then
- Set_Digits (-V, S, P);
- else
- P := P + 1;
- S (P) := '-';
- Set_Digits (V, S, P);
- end if;
- end Set_Image_Integer;
-
-end System.Img_Int;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imgint.ads b/gcc/ada/libgnat/s-imgint.ads
index 6c2c675..08ce31d 100644
--- a/gcc/ada/libgnat/s-imgint.ads
+++ b/gcc/ada/libgnat/s-imgint.ads
@@ -30,28 +30,26 @@
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
--- signed integer types up to Size Integer'Size, and also for conversion
--- operations required in Text_IO.Integer_IO for such types.
+-- signed integer types up to Integer, and also for conversion operations
+-- required in Text_IO.Integer_IO for such types.
+
+with System.Image_I;
package System.Img_Int is
pragma Pure;
+ package Impl is new Image_I (Integer);
+
procedure Image_Integer
(V : Integer;
S : in out String;
- P : out Natural);
- -- Computes Integer'Image (V) and stores the result in S (1 .. P)
- -- setting the resulting value of P. The caller guarantees that S
- -- is long enough to hold the result, and that S'First is 1.
+ P : out Natural)
+ renames Impl.Image_Integer;
procedure Set_Image_Integer
(V : Integer;
S : in out String;
- P : in out Natural);
- -- Stores the image of V in S starting at S (P + 1), P is updated to point
- -- to the last character stored. The value stored is identical to the value
- -- of Integer'Image (V) except that no leading space is stored when V is
- -- non-negative. The caller guarantees that S is long enough to hold the
- -- result. S need not have a lower bound of 1.
+ P : in out Natural)
+ renames Impl.Set_Image_Integer;
end System.Img_Int;
diff --git a/gcc/ada/libgnat/s-imgllb.adb b/gcc/ada/libgnat/s-imgllb.adb
index 30d6a3c..90ba5ce 100644
--- a/gcc/ada/libgnat/s-imgllb.adb
+++ b/gcc/ada/libgnat/s-imgllb.adb
@@ -29,133 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Img_LLB is
-
- ---------------------------------------
- -- Set_Image_Based_Long_Long_Integer --
- ---------------------------------------
-
- procedure Set_Image_Based_Long_Long_Integer
- (V : Long_Long_Integer;
- B : Natural;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : Natural;
-
- begin
- -- Positive case can just use the unsigned circuit directly
-
- if V >= 0 then
- Set_Image_Based_Long_Long_Unsigned
- (Long_Long_Unsigned (V), B, W, S, P);
-
- -- Negative case has to set a minus sign. Note also that we have to be
- -- careful not to generate overflow with the largest negative number.
-
- else
- P := P + 1;
- S (P) := ' ';
- Start := P;
-
- declare
- pragma Suppress (Overflow_Check);
- pragma Suppress (Range_Check);
- begin
- Set_Image_Based_Long_Long_Unsigned
- (Long_Long_Unsigned (-V), B, W - 1, S, P);
- end;
-
- -- Set minus sign in last leading blank location. Because of the
- -- code above, there must be at least one such location.
-
- while S (Start + 1) = ' ' loop
- Start := Start + 1;
- end loop;
-
- S (Start) := '-';
- end if;
-
- end Set_Image_Based_Long_Long_Integer;
-
- ----------------------------------------
- -- Set_Image_Based_Long_Long_Unsigned --
- ----------------------------------------
-
- procedure Set_Image_Based_Long_Long_Unsigned
- (V : Long_Long_Unsigned;
- B : Natural;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : constant Natural := P;
- F, T : Natural;
- BU : constant Long_Long_Unsigned := Long_Long_Unsigned (B);
- Hex : constant array
- (Long_Long_Unsigned range 0 .. 15) of Character :=
- "0123456789ABCDEF";
-
- procedure Set_Digits (T : Long_Long_Unsigned);
- -- Set digits of absolute value of T
-
- ----------------
- -- Set_Digits --
- ----------------
-
- procedure Set_Digits (T : Long_Long_Unsigned) is
- begin
- if T >= BU then
- Set_Digits (T / BU);
- P := P + 1;
- S (P) := Hex (T mod BU);
- else
- P := P + 1;
- S (P) := Hex (T);
- end if;
- end Set_Digits;
-
- -- Start of processing for Set_Image_Based_Long_Long_Unsigned
-
- begin
-
- if B >= 10 then
- P := P + 1;
- S (P) := '1';
- end if;
-
- P := P + 1;
- S (P) := Character'Val (Character'Pos ('0') + B mod 10);
-
- P := P + 1;
- S (P) := '#';
-
- Set_Digits (V);
-
- P := P + 1;
- S (P) := '#';
-
- -- Add leading spaces if required by width parameter
-
- if P - Start < W then
- F := P;
- P := Start + W;
- T := P;
-
- while F > Start loop
- S (T) := S (F);
- T := T - 1;
- F := F - 1;
- end loop;
-
- for J in Start + 1 .. T loop
- S (J) := ' ';
- end loop;
- end if;
-
- end Set_Image_Based_Long_Long_Unsigned;
-
-end System.Img_LLB;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imgllb.ads b/gcc/ada/libgnat/s-imgllb.ads
index 0232315..bfaf2ee 100644
--- a/gcc/ada/libgnat/s-imgllb.ads
+++ b/gcc/ada/libgnat/s-imgllb.ads
@@ -30,43 +30,33 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image in based format of signed and
--- unsigned integers whose size > Integer'Size for use by Text_IO.Integer_IO
--- and Text_IO.Modular_IO.
+-- unsigned integers larger than Integer for use by Text_IO.Integer_IO and
+-- Text_IO.Modular_IO.
+with System.Image_B;
with System.Unsigned_Types;
package System.Img_LLB is
pragma Preelaborate;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ package Impl is new Image_B (Long_Long_Integer, Long_Long_Unsigned);
+
procedure Set_Image_Based_Long_Long_Integer
(V : Long_Long_Integer;
B : Natural;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the signed image of V in based format, using base value B (2..16)
- -- starting at S (P + 1), updating P to point to the last character stored.
- -- The image includes a leading minus sign if necessary, but no leading
- -- spaces unless W is positive, in which case leading spaces are output if
- -- necessary to ensure that the output string is no less than W characters
- -- long. The caller promises that the buffer is large enough and no check
- -- is made for this. Constraint_Error will not necessarily be raised if
- -- this is violated, since it is perfectly valid to compile this unit with
- -- checks off.
+ P : in out Natural)
+ renames Impl.Set_Image_Based_Integer;
procedure Set_Image_Based_Long_Long_Unsigned
- (V : System.Unsigned_Types.Long_Long_Unsigned;
+ (V : Long_Long_Unsigned;
B : Natural;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the unsigned image of V in based format, using base value B (2..16)
- -- starting at S (P + 1), updating P to point to the last character stored.
- -- The image includes no leading spaces unless W is positive, in which case
- -- leading spaces are output if necessary to ensure that the output string
- -- is no less than W characters long. The caller promises that the buffer
- -- is large enough and no check is made for this. Constraint_Error will not
- -- necessarily be raised if this is violated, since it is perfectly valid
- -- to compile this unit with checks off).
+ P : in out Natural)
+ renames Impl.Set_Image_Based_Unsigned;
end System.Img_LLB;
diff --git a/gcc/ada/libgnat/s-imglli.adb b/gcc/ada/libgnat/s-imglli.adb
index 4d024ee..cdaeb7e 100644
--- a/gcc/ada/libgnat/s-imglli.adb
+++ b/gcc/ada/libgnat/s-imglli.adb
@@ -29,74 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Img_LLI is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- procedure Set_Digits
- (T : Long_Long_Integer;
- S : in out String;
- P : in out Natural);
- -- Set digits of absolute value of T, which is zero or negative. We work
- -- with the negative of the value so that the largest negative number is
- -- not a special case.
-
- -----------------------------
- -- Image_Long_Long_Integer --
- -----------------------------
-
- procedure Image_Long_Long_Integer
- (V : Long_Long_Integer;
- S : in out String;
- P : out Natural)
- is
- pragma Assert (S'First = 1);
-
- begin
- if V >= 0 then
- S (1) := ' ';
- P := 1;
- else
- P := 0;
- end if;
-
- Set_Image_Long_Long_Integer (V, S, P);
- end Image_Long_Long_Integer;
-
- ----------------
- -- Set_Digits --
- ----------------
-
- procedure Set_Digits
- (T : Long_Long_Integer;
- S : in out String;
- P : in out Natural)
- is
- begin
- if T <= -10 then
- Set_Digits (T / 10, S, P);
- P := P + 1;
- S (P) := Character'Val (48 - (T rem 10));
- else
- P := P + 1;
- S (P) := Character'Val (48 - T);
- end if;
- end Set_Digits;
-
- ---------------------------------
- -- Set_Image_Long_Long_Integer --
- --------------------------------
-
- procedure Set_Image_Long_Long_Integer
- (V : Long_Long_Integer;
- S : in out String;
- P : in out Natural) is
- begin
- if V >= 0 then
- Set_Digits (-V, S, P);
- else
- P := P + 1;
- S (P) := '-';
- Set_Digits (V, S, P);
- end if;
- end Set_Image_Long_Long_Integer;
-
-end System.Img_LLI;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imglli.ads b/gcc/ada/libgnat/s-imglli.ads
index b0d3cae..49defc5 100644
--- a/gcc/ada/libgnat/s-imglli.ads
+++ b/gcc/ada/libgnat/s-imglli.ads
@@ -30,28 +30,26 @@
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
--- signed integer types larger than Size Integer'Size, and also for conversion
--- operations required in Text_IO.Integer_IO for such types.
+-- signed integer types larger Integer, and also for conversion operations
+-- required in Text_IO.Integer_IO for such types.
+
+with System.Image_I;
package System.Img_LLI is
pragma Pure;
+ package Impl is new Image_I (Long_Long_Integer);
+
procedure Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
- P : out Natural);
- -- Computes Long_Long_Integer'Image (V) and stores the result in
- -- S (1 .. P) setting the resulting value of P. The caller guarantees
- -- that S is long enough to hold the result, and that S'First is 1.
+ P : out Natural)
+ renames Impl.Image_Integer;
procedure Set_Image_Long_Long_Integer
(V : Long_Long_Integer;
S : in out String;
- P : in out Natural);
- -- Stores the image of V in S starting at S (P + 1), P is updated to point
- -- to the last character stored. The value stored is identical to the value
- -- of Long_Long_Integer'Image (V) except that no leading space is stored
- -- when V is non-negative. The caller guarantees that S is long enough to
- -- hold the result. S need not have a lower bound of 1.
+ P : in out Natural)
+ renames Impl.Set_Image_Integer;
end System.Img_LLI;
diff --git a/gcc/ada/libgnat/a-timoau.ads b/gcc/ada/libgnat/s-imglllb.ads
index 247eb14..b246037 100644
--- a/gcc/ada/libgnat/a-timoau.ads
+++ b/gcc/ada/libgnat/s-imglllb.ads
@@ -2,7 +2,7 @@
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . T E X T _ I O . M O D U L A R _ A U X --
+-- S Y S T E M . I M G _ L L L B --
-- --
-- S p e c --
-- --
@@ -29,59 +29,35 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines for Ada.Text_IO.Modular_IO that are
--- shared among separate instantiations of this package. The routines in
--- this package are identical semantically to those in Modular_IO itself,
--- except that the generic parameter Num has been replaced by Unsigned or
--- Long_Long_Unsigned, and the default parameters have been removed because
--- they are supplied explicitly by the calls from within the generic template.
+-- Contains the routine for computing the image in based format of signed and
+-- unsigned integers larger than Long_Long_Integer for use by
+-- Text_IO.Integer_IO and Text_IO.Modular_IO.
+with System.Image_B;
with System.Unsigned_Types;
-private package Ada.Text_IO.Modular_Aux is
+package System.Img_LLLB is
+ pragma Preelaborate;
- package U renames System.Unsigned_Types;
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
- procedure Get_Uns
- (File : File_Type;
- Item : out U.Unsigned;
- Width : Field);
+ package Impl is
+ new Image_B (Long_Long_Long_Integer, Long_Long_Long_Unsigned);
- procedure Get_LLU
- (File : File_Type;
- Item : out U.Long_Long_Unsigned;
- Width : Field);
+ procedure Set_Image_Based_Long_Long_Long_Integer
+ (V : Long_Long_Long_Integer;
+ B : Natural;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ renames Impl.Set_Image_Based_Integer;
- procedure Put_Uns
- (File : File_Type;
- Item : U.Unsigned;
- Width : Field;
- Base : Number_Base);
+ procedure Set_Image_Based_Long_Long_Long_Unsigned
+ (V : Long_Long_Long_Unsigned;
+ B : Natural;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ renames Impl.Set_Image_Based_Unsigned;
- procedure Put_LLU
- (File : File_Type;
- Item : U.Long_Long_Unsigned;
- Width : Field;
- Base : Number_Base);
-
- procedure Gets_Uns
- (From : String;
- Item : out U.Unsigned;
- Last : out Positive);
-
- procedure Gets_LLU
- (From : String;
- Item : out U.Long_Long_Unsigned;
- Last : out Positive);
-
- procedure Puts_Uns
- (To : out String;
- Item : U.Unsigned;
- Base : Number_Base);
-
- procedure Puts_LLU
- (To : out String;
- Item : U.Long_Long_Unsigned;
- Base : Number_Base);
-
-end Ada.Text_IO.Modular_Aux;
+end System.Img_LLLB;
diff --git a/gcc/ada/libgnat/s-imgllli.ads b/gcc/ada/libgnat/s-imgllli.ads
new file mode 100644
index 0000000..c6d41f9
--- /dev/null
+++ b/gcc/ada/libgnat/s-imgllli.ads
@@ -0,0 +1,55 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M G _ L L L I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains the routines for supporting the Image attribute for
+-- signed integer types larger than Long_Long_Integer, and also for conversion
+-- operations required in Text_IO.Integer_IO for such types.
+
+with System.Image_I;
+
+package System.Img_LLLI is
+ pragma Pure;
+
+ package Impl is new Image_I (Long_Long_Long_Integer);
+
+ procedure Image_Long_Long_Long_Integer
+ (V : Long_Long_Long_Integer;
+ S : in out String;
+ P : out Natural)
+ renames Impl.Image_Integer;
+
+ procedure Set_Image_Long_Long_Long_Integer
+ (V : Long_Long_Long_Integer;
+ S : in out String;
+ P : in out Natural)
+ renames Impl.Set_Image_Integer;
+
+end System.Img_LLLI;
diff --git a/gcc/ada/libgnat/s-imglllu.ads b/gcc/ada/libgnat/s-imglllu.ads
new file mode 100644
index 0000000..8b6f16a
--- /dev/null
+++ b/gcc/ada/libgnat/s-imglllu.ads
@@ -0,0 +1,58 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M G _ L L L U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains the routines for supporting the Image attribute for
+-- modular integer types larger than Long_Long_Unsigned, and also for
+-- conversion operations required in Text_IO.Modular_IO for such types.
+
+with System.Image_U;
+with System.Unsigned_Types;
+
+package System.Img_LLLU is
+ pragma Pure;
+
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
+
+ package Impl is new Image_U (Long_Long_Long_Unsigned);
+
+ procedure Image_Long_Long_Long_Unsigned
+ (V : Long_Long_Long_Unsigned;
+ S : in out String;
+ P : out Natural)
+ renames Impl.Image_Unsigned;
+
+ procedure Set_Image_Long_Long_Long_Unsigned
+ (V : Long_Long_Long_Unsigned;
+ S : in out String;
+ P : in out Natural)
+ renames Impl.Set_Image_Unsigned;
+
+end System.Img_LLLU;
diff --git a/gcc/ada/libgnat/s-imglllw.ads b/gcc/ada/libgnat/s-imglllw.ads
new file mode 100644
index 0000000..de33f18
--- /dev/null
+++ b/gcc/ada/libgnat/s-imglllw.ads
@@ -0,0 +1,61 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . I M G _ L L W --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Contains the routine for computing the image of signed and unsigned
+-- integers larger than Integer for use by Text_IO.Integer_IO and
+-- Text_IO.Modular_IO.
+
+with System.Image_W;
+with System.Unsigned_Types;
+
+package System.Img_LLLW is
+ pragma Pure;
+
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
+
+ package Impl is
+ new Image_W (Long_Long_Long_Integer, Long_Long_Long_Unsigned);
+
+ procedure Set_Image_Width_Long_Long_Long_Integer
+ (V : Long_Long_Long_Integer;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ renames Impl.Set_Image_Width_Integer;
+
+ procedure Set_Image_Width_Long_Long_Long_Unsigned
+ (V : Long_Long_Long_Unsigned;
+ W : Integer;
+ S : out String;
+ P : in out Natural)
+ renames Impl.Set_Image_Width_Unsigned;
+
+end System.Img_LLLW;
diff --git a/gcc/ada/libgnat/s-imgllu.adb b/gcc/ada/libgnat/s-imgllu.adb
index f62a25d..680b11b 100644
--- a/gcc/ada/libgnat/s-imgllu.adb
+++ b/gcc/ada/libgnat/s-imgllu.adb
@@ -29,45 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Img_LLU is
-
- ------------------------------
- -- Image_Long_Long_Unsigned --
- ------------------------------
-
- procedure Image_Long_Long_Unsigned
- (V : System.Unsigned_Types.Long_Long_Unsigned;
- S : in out String;
- P : out Natural)
- is
- pragma Assert (S'First = 1);
- begin
- S (1) := ' ';
- P := 1;
- Set_Image_Long_Long_Unsigned (V, S, P);
- end Image_Long_Long_Unsigned;
-
- ----------------------------------
- -- Set_Image_Long_Long_Unsigned --
- ----------------------------------
-
- procedure Set_Image_Long_Long_Unsigned
- (V : Long_Long_Unsigned;
- S : in out String;
- P : in out Natural)
- is
- begin
- if V >= 10 then
- Set_Image_Long_Long_Unsigned (V / 10, S, P);
- P := P + 1;
- S (P) := Character'Val (48 + (V rem 10));
-
- else
- P := P + 1;
- S (P) := Character'Val (48 + V);
- end if;
- end Set_Image_Long_Long_Unsigned;
-
-end System.Img_LLU;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imgllu.ads b/gcc/ada/libgnat/s-imgllu.ads
index d54bb33..dabc68d 100644
--- a/gcc/ada/libgnat/s-imgllu.ads
+++ b/gcc/ada/libgnat/s-imgllu.ads
@@ -30,32 +30,29 @@
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
--- unsigned (modular) integer types larger than Size Unsigned'Size, and also
--- for conversion operations required in Text_IO.Modular_IO for such types.
+-- modular integer types larger than Unsigned, and also for conversion
+-- operations required in Text_IO.Modular_IO for such types.
+with System.Image_U;
with System.Unsigned_Types;
package System.Img_LLU is
pragma Pure;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ package Impl is new Image_U (Long_Long_Unsigned);
+
procedure Image_Long_Long_Unsigned
- (V : System.Unsigned_Types.Long_Long_Unsigned;
+ (V : Long_Long_Unsigned;
S : in out String;
- P : out Natural);
- pragma Inline (Image_Long_Long_Unsigned);
-
- -- Computes Long_Long_Unsigned'Image (V) and stores the result in
- -- S (1 .. P) setting the resulting value of P. The caller guarantees
- -- that S is long enough to hold the result, and that S'First is 1.
+ P : out Natural)
+ renames Impl.Image_Unsigned;
procedure Set_Image_Long_Long_Unsigned
- (V : System.Unsigned_Types.Long_Long_Unsigned;
+ (V : Long_Long_Unsigned;
S : in out String;
- P : in out Natural);
- -- Stores the image of V in S starting at S (P + 1), P is updated to point
- -- to the last character stored. The value stored is identical to the value
- -- of Long_Long_Unsigned'Image (V) except that no leading space is stored.
- -- The caller guarantees that S is long enough to hold the result. S need
- -- not have a lower bound of 1.
+ P : in out Natural)
+ renames Impl.Set_Image_Unsigned;
end System.Img_LLU;
diff --git a/gcc/ada/libgnat/s-imgllw.adb b/gcc/ada/libgnat/s-imgllw.adb
index cfd4fc2..5702a93 100644
--- a/gcc/ada/libgnat/s-imgllw.adb
+++ b/gcc/ada/libgnat/s-imgllw.adb
@@ -29,112 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Img_LLW is
-
- ---------------------------------------
- -- Set_Image_Width_Long_Long_Integer --
- ---------------------------------------
-
- procedure Set_Image_Width_Long_Long_Integer
- (V : Long_Long_Integer;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : Natural;
-
- begin
- -- Positive case can just use the unsigned circuit directly
-
- if V >= 0 then
- Set_Image_Width_Long_Long_Unsigned
- (Long_Long_Unsigned (V), W, S, P);
-
- -- Negative case has to set a minus sign. Note also that we have to be
- -- careful not to generate overflow with the largest negative number.
-
- else
- P := P + 1;
- S (P) := ' ';
- Start := P;
-
- declare
- pragma Suppress (Overflow_Check);
- pragma Suppress (Range_Check);
- begin
- Set_Image_Width_Long_Long_Unsigned
- (Long_Long_Unsigned (-V), W - 1, S, P);
- end;
-
- -- Set minus sign in last leading blank location. Because of the
- -- code above, there must be at least one such location.
-
- while S (Start + 1) = ' ' loop
- Start := Start + 1;
- end loop;
-
- S (Start) := '-';
- end if;
-
- end Set_Image_Width_Long_Long_Integer;
-
- ----------------------------------------
- -- Set_Image_Width_Long_Long_Unsigned --
- ----------------------------------------
-
- procedure Set_Image_Width_Long_Long_Unsigned
- (V : Long_Long_Unsigned;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : constant Natural := P;
- F, T : Natural;
-
- procedure Set_Digits (T : Long_Long_Unsigned);
- -- Set digits of absolute value of T
-
- ----------------
- -- Set_Digits --
- ----------------
-
- procedure Set_Digits (T : Long_Long_Unsigned) is
- begin
- if T >= 10 then
- Set_Digits (T / 10);
- P := P + 1;
- S (P) := Character'Val (T mod 10 + Character'Pos ('0'));
- else
- P := P + 1;
- S (P) := Character'Val (T + Character'Pos ('0'));
- end if;
- end Set_Digits;
-
- -- Start of processing for Set_Image_Width_Long_Long_Unsigned
-
- begin
- Set_Digits (V);
-
- -- Add leading spaces if required by width parameter
-
- if P - Start < W then
- F := P;
- P := P + (W - (P - Start));
- T := P;
-
- while F > Start loop
- S (T) := S (F);
- T := T - 1;
- F := F - 1;
- end loop;
-
- for J in Start + 1 .. T loop
- S (J) := ' ';
- end loop;
- end if;
-
- end Set_Image_Width_Long_Long_Unsigned;
-
-end System.Img_LLW;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imgllw.ads b/gcc/ada/libgnat/s-imgllw.ads
index e6e5fb0..12986e5 100644
--- a/gcc/ada/libgnat/s-imgllw.ads
+++ b/gcc/ada/libgnat/s-imgllw.ads
@@ -30,40 +30,31 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image of signed and unsigned
--- integers whose size > Integer'Size for use by Text_IO.Integer_IO,
+-- integers larger than Integer for use by Text_IO.Integer_IO and
-- Text_IO.Modular_IO.
+with System.Image_W;
with System.Unsigned_Types;
package System.Img_LLW is
pragma Pure;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ package Impl is new Image_W (Long_Long_Integer, Long_Long_Unsigned);
+
procedure Set_Image_Width_Long_Long_Integer
(V : Long_Long_Integer;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the signed image of V in decimal format, starting at S (P + 1),
- -- updating P to point to the last character stored. The image includes
- -- a leading minus sign if necessary, but no leading spaces unless W is
- -- positive, in which case leading spaces are output if necessary to ensure
- -- that the output string is no less than W characters long. The caller
- -- promises that the buffer is large enough and no check is made for this.
- -- Constraint_Error will not necessarily be raised if this is violated,
- -- since it is perfectly valid to compile this unit with checks off.
+ P : in out Natural)
+ renames Impl.Set_Image_Width_Integer;
procedure Set_Image_Width_Long_Long_Unsigned
- (V : System.Unsigned_Types.Long_Long_Unsigned;
+ (V : Long_Long_Unsigned;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the unsigned image of V in decimal format, starting at S (P + 1),
- -- updating P to point to the last character stored. The image includes no
- -- leading spaces unless W is positive, in which case leading spaces are
- -- output if necessary to ensure that the output string is no less than
- -- W characters long. The caller promises that the buffer is large enough
- -- and no check is made for this. Constraint_Error will not necessarily be
- -- raised if this is violated, since it is perfectly valid to compile this
- -- unit with checks off.
+ P : in out Natural)
+ renames Impl.Set_Image_Width_Unsigned;
end System.Img_LLW;
diff --git a/gcc/ada/libgnat/s-imgrea.adb b/gcc/ada/libgnat/s-imgrea.adb
index 68b1fdc..45d0ae5 100644
--- a/gcc/ada/libgnat/s-imgrea.adb
+++ b/gcc/ada/libgnat/s-imgrea.adb
@@ -29,10 +29,9 @@
-- --
------------------------------------------------------------------------------
-with System.Img_LLU; use System.Img_LLU;
-with System.Img_Uns; use System.Img_Uns;
-with System.Powten_Table; use System.Powten_Table;
-with System.Unsigned_Types; use System.Unsigned_Types;
+with System.Img_LLU; use System.Img_LLU;
+with System.Img_Uns; use System.Img_Uns;
+with System.Powten_Table; use System.Powten_Table;
with System.Float_Control;
package body System.Img_Real is
@@ -99,6 +98,11 @@ package body System.Img_Real is
if (not Is_Negative (V) and then V <= Long_Long_Float'Last)
or else (not Long_Long_Float'Signed_Zeros and then V = -0.0)
then
+ pragma Annotate (CodePeer, False_Positive, "condition predetermined",
+ "CodePeer analysis ignores NaN and Inf values");
+ pragma Assert (S'Last > 1);
+ -- The caller is responsible for S to be large enough for all
+ -- Image_Floating_Point operation.
S (1) := ' ';
P := 1;
else
@@ -372,6 +376,7 @@ package body System.Img_Real is
-- be significantly more efficient than the Long_Long_Unsigned one.
if X < Powten (Unsdigs) then
+ pragma Assert (X in 0.0 .. Long_Long_Float (Unsigned'Last));
Ndigs := 0;
Set_Image_Unsigned
(Unsigned (Long_Long_Float'Truncation (X)),
@@ -381,6 +386,10 @@ package body System.Img_Real is
-- the Long_Long_Unsigned routine after all.
else
+ pragma Assert (X < Powten (Maxdigs));
+ pragma Assert
+ (X in 0.0 .. Long_Long_Float (Long_Long_Unsigned'Last));
+
Ndigs := 0;
Set_Image_Long_Long_Unsigned
(Long_Long_Unsigned (Long_Long_Float'Truncation (X)),
@@ -394,6 +403,12 @@ package body System.Img_Real is
procedure Set (C : Character) is
begin
+ pragma Assert (P in S'First - 1 .. S'Last - 1);
+ -- No check is done as documented in the header: updating P to point
+ -- to the last character stored, the caller promises that the buffer
+ -- is large enough and no check is made for this. Constraint_Error
+ -- will not necessarily be raised if this requirement is violated,
+ -- since it is perfectly valid to compile this unit with checks off.
P := P + 1;
S (P) := C;
end Set;
@@ -424,6 +439,8 @@ package body System.Img_Real is
procedure Set_Digs (S, E : Natural) is
begin
+ pragma Assert (S >= Digs'First and E <= Digs'Last);
+ -- S and E should be in the Digs array range
for J in S .. E loop
Set (Digs (J));
end loop;
@@ -437,9 +454,13 @@ package body System.Img_Real is
F : Natural;
begin
+ pragma Assert ((Fore + Aft - N + 1) in Natural);
+ -- Fore + Aft - N + 1 should be in the Natural range
F := Fore + 1 + Aft - N;
if Exp /= 0 then
+ pragma Assert (F + Exp + 1 <= Natural'Last);
+ -- F + Exp + 1 should be in the Natural range
F := F + Exp + 1;
end if;
@@ -487,15 +508,15 @@ package body System.Img_Real is
-- an infinite value, so we print Inf.
if V > Long_Long_Float'Last then
- pragma Annotate
- (CodePeer, Intentional, "test always true", "test for infinity");
-
+ pragma Annotate (CodePeer, False_Positive, "dead code",
+ "CodePeer analysis ignores NaN and Inf values");
+ pragma Annotate (CodePeer, False_Positive, "test always true",
+ "CodePeer analysis ignores NaN and Inf values");
Set ('+');
Set ('I');
Set ('n');
Set ('f');
Set_Special_Fill (4);
-
-- In all other cases we print NaN
elsif V < Long_Long_Float'First then
@@ -504,7 +525,6 @@ package body System.Img_Real is
Set ('n');
Set ('f');
Set_Special_Fill (4);
-
else
Set ('N');
Set ('a');
@@ -597,6 +617,7 @@ package body System.Img_Real is
for J in 1 .. Scale + NF loop
Ndigs := Ndigs + 1;
+ pragma Assert (Ndigs <= Digs'Last);
Digs (Ndigs) := '0';
end loop;
@@ -663,6 +684,7 @@ package body System.Img_Real is
for J in 1 .. NFrac - Maxdigs + 1 loop
Ndigs := Ndigs + 1;
+ pragma Assert (Ndigs <= Digs'Last);
Digs (Ndigs) := '0';
Scale := Scale - 1;
end loop;
diff --git a/gcc/ada/libgnat/s-imguns.adb b/gcc/ada/libgnat/s-imguns.adb
index 914121d..8db42b4 100644
--- a/gcc/ada/libgnat/s-imguns.adb
+++ b/gcc/ada/libgnat/s-imguns.adb
@@ -29,45 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Img_Uns is
-
- --------------------
- -- Image_Unsigned --
- --------------------
-
- procedure Image_Unsigned
- (V : System.Unsigned_Types.Unsigned;
- S : in out String;
- P : out Natural)
- is
- pragma Assert (S'First = 1);
- begin
- S (1) := ' ';
- P := 1;
- Set_Image_Unsigned (V, S, P);
- end Image_Unsigned;
-
- ------------------------
- -- Set_Image_Unsigned --
- ------------------------
-
- procedure Set_Image_Unsigned
- (V : Unsigned;
- S : in out String;
- P : in out Natural)
- is
- begin
- if V >= 10 then
- Set_Image_Unsigned (V / 10, S, P);
- P := P + 1;
- S (P) := Character'Val (48 + (V rem 10));
-
- else
- P := P + 1;
- S (P) := Character'Val (48 + V);
- end if;
- end Set_Image_Unsigned;
-
-end System.Img_Uns;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imguns.ads b/gcc/ada/libgnat/s-imguns.ads
index 86e6d99..746fff1 100644
--- a/gcc/ada/libgnat/s-imguns.ads
+++ b/gcc/ada/libgnat/s-imguns.ads
@@ -30,31 +30,29 @@
------------------------------------------------------------------------------
-- This package contains the routines for supporting the Image attribute for
--- modular integer types up to size Unsigned'Size, and also for conversion
--- operations required in Text_IO.Modular_IO for such types.
+-- modular integer types up to Unsigned, and also for conversion operations
+-- required in Text_IO.Modular_IO for such types.
+with System.Image_U;
with System.Unsigned_Types;
package System.Img_Uns is
pragma Pure;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ package Impl is new Image_U (Unsigned);
+
procedure Image_Unsigned
- (V : System.Unsigned_Types.Unsigned;
+ (V : Unsigned;
S : in out String;
- P : out Natural);
- pragma Inline (Image_Unsigned);
- -- Computes Unsigned'Image (V) and stores the result in S (1 .. P) setting
- -- the resulting value of P. The caller guarantees that S is long enough to
- -- hold the result, and that S'First is 1.
+ P : out Natural)
+ renames Impl.Image_Unsigned;
procedure Set_Image_Unsigned
- (V : System.Unsigned_Types.Unsigned;
+ (V : Unsigned;
S : in out String;
- P : in out Natural);
- -- Stores the image of V in S starting at S (P + 1), P is updated to point
- -- to the last character stored. The value stored is identical to the value
- -- of Unsigned'Image (V) except that no leading space is stored. The caller
- -- guarantees that S is long enough to hold the result. S need not have a
- -- lower bound of 1.
+ P : in out Natural)
+ renames Impl.Set_Image_Unsigned;
end System.Img_Uns;
diff --git a/gcc/ada/libgnat/s-imgwiu.adb b/gcc/ada/libgnat/s-imgwiu.adb
index 90a8f41..9f04cce 100644
--- a/gcc/ada/libgnat/s-imgwiu.adb
+++ b/gcc/ada/libgnat/s-imgwiu.adb
@@ -29,110 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Img_WIU is
-
- -----------------------------
- -- Set_Image_Width_Integer --
- -----------------------------
-
- procedure Set_Image_Width_Integer
- (V : Integer;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : Natural;
-
- begin
- -- Positive case can just use the unsigned circuit directly
-
- if V >= 0 then
- Set_Image_Width_Unsigned (Unsigned (V), W, S, P);
-
- -- Negative case has to set a minus sign. Note also that we have to be
- -- careful not to generate overflow with the largest negative number.
-
- else
- P := P + 1;
- S (P) := ' ';
- Start := P;
-
- declare
- pragma Suppress (Overflow_Check);
- pragma Suppress (Range_Check);
- begin
- Set_Image_Width_Unsigned (Unsigned (-V), W - 1, S, P);
- end;
-
- -- Set minus sign in last leading blank location. Because of the
- -- code above, there must be at least one such location.
-
- while S (Start + 1) = ' ' loop
- Start := Start + 1;
- end loop;
-
- S (Start) := '-';
- end if;
-
- end Set_Image_Width_Integer;
-
- ------------------------------
- -- Set_Image_Width_Unsigned --
- ------------------------------
-
- procedure Set_Image_Width_Unsigned
- (V : Unsigned;
- W : Integer;
- S : out String;
- P : in out Natural)
- is
- Start : constant Natural := P;
- F, T : Natural;
-
- procedure Set_Digits (T : Unsigned);
- -- Set digits of absolute value of T
-
- ----------------
- -- Set_Digits --
- ----------------
-
- procedure Set_Digits (T : Unsigned) is
- begin
- if T >= 10 then
- Set_Digits (T / 10);
- P := P + 1;
- S (P) := Character'Val (T mod 10 + Character'Pos ('0'));
- else
- P := P + 1;
- S (P) := Character'Val (T + Character'Pos ('0'));
- end if;
- end Set_Digits;
-
- -- Start of processing for Set_Image_Width_Unsigned
-
- begin
- Set_Digits (V);
-
- -- Add leading spaces if required by width parameter
-
- if P - Start < W then
- F := P;
- P := P + (W - (P - Start));
- T := P;
-
- while F > Start loop
- S (T) := S (F);
- T := T - 1;
- F := F - 1;
- end loop;
-
- for J in Start + 1 .. T loop
- S (J) := ' ';
- end loop;
- end if;
-
- end Set_Image_Width_Unsigned;
-
-end System.Img_WIU;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-imgwiu.ads b/gcc/ada/libgnat/s-imgwiu.ads
index 6d33599..89515e8 100644
--- a/gcc/ada/libgnat/s-imgwiu.ads
+++ b/gcc/ada/libgnat/s-imgwiu.ads
@@ -30,40 +30,31 @@
------------------------------------------------------------------------------
-- Contains the routine for computing the image of signed and unsigned
--- integers whose size <= Integer'Size for use by Text_IO.Integer_IO
--- and Text_IO.Modular_IO.
+-- integers up to Integer for use by Text_IO.Integer_IO and
+-- Text_IO.Modular_IO.
+with System.Image_W;
with System.Unsigned_Types;
package System.Img_WIU is
pragma Pure;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ package Impl is new Image_W (Integer, Unsigned);
+
procedure Set_Image_Width_Integer
(V : Integer;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the signed image of V in decimal format, starting at S (P + 1),
- -- updating P to point to the last character stored. The image includes
- -- a leading minus sign if necessary, but no leading spaces unless W is
- -- positive, in which case leading spaces are output if necessary to ensure
- -- that the output string is no less than W characters long. The caller
- -- promises that the buffer is large enough and no check is made for this.
- -- Constraint_Error will not necessarily be raised if this is violated,
- -- since it is perfectly valid to compile this unit with checks off.
+ P : in out Natural)
+ renames Impl.Set_Image_Width_Integer;
procedure Set_Image_Width_Unsigned
- (V : System.Unsigned_Types.Unsigned;
+ (V : Unsigned;
W : Integer;
S : out String;
- P : in out Natural);
- -- Sets the unsigned image of V in decimal format, starting at S (P + 1),
- -- updating P to point to the last character stored. The image includes no
- -- leading spaces unless W is positive, in which case leading spaces are
- -- output if necessary to ensure that the output string is no less than
- -- W characters long. The caller promises that the buffer is large enough
- -- and no check is made for this. Constraint_Error will not necessarily be
- -- raised if this is violated, since it is perfectly valid to compile this
- -- unit with checks off.
+ P : in out Natural)
+ renames Impl.Set_Image_Width_Unsigned;
end System.Img_WIU;
diff --git a/gcc/ada/libgnat/s-mastop.ads b/gcc/ada/libgnat/s-mastop.ads
index c2c23d3..ffe04be 100644
--- a/gcc/ada/libgnat/s-mastop.ads
+++ b/gcc/ada/libgnat/s-mastop.ads
@@ -31,10 +31,6 @@
pragma Compiler_Unit_Warning;
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with System.Exception_Tables.
-
with System.Storage_Elements;
package System.Machine_State_Operations is
diff --git a/gcc/ada/libgnat/s-pack100.adb b/gcc/ada/libgnat/s-pack100.adb
new file mode 100644
index 0000000..bae251c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack100.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 0 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_100 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_100;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_100 or SetU_100 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_100 --
+ ------------
+
+ function Get_100
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_100
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_100;
+
+ -------------
+ -- GetU_100 --
+ -------------
+
+ function GetU_100
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_100
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_100;
+
+ ------------
+ -- Set_100 --
+ ------------
+
+ procedure Set_100
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_100;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_100;
+
+ -------------
+ -- SetU_100 --
+ -------------
+
+ procedure SetU_100
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_100;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_100;
+
+end System.Pack_100;
diff --git a/gcc/ada/libgnat/s-pack100.ads b/gcc/ada/libgnat/s-pack100.ads
new file mode 100644
index 0000000..dfb3e62
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack100.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 0 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 100
+
+package System.Pack_100 is
+ pragma Preelaborate;
+
+ Bits : constant := 100;
+
+ type Bits_100 is mod 2 ** Bits;
+ for Bits_100'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_100
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_100 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_100
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_100;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_100
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_100 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_100
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_100;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_100;
diff --git a/gcc/ada/libgnat/s-pack101.adb b/gcc/ada/libgnat/s-pack101.adb
new file mode 100644
index 0000000..dfa1cf3
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack101.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 1 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_101 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_101;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_101 --
+ ------------
+
+ function Get_101
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_101
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_101;
+
+ ------------
+ -- Set_101 --
+ ------------
+
+ procedure Set_101
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_101;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_101;
+
+end System.Pack_101;
diff --git a/gcc/ada/libgnat/s-pack101.ads b/gcc/ada/libgnat/s-pack101.ads
new file mode 100644
index 0000000..2e77051
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack101.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 1 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 101
+
+package System.Pack_101 is
+ pragma Preelaborate;
+
+ Bits : constant := 101;
+
+ type Bits_101 is mod 2 ** Bits;
+ for Bits_101'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_101
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_101 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_101
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_101;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_101;
diff --git a/gcc/ada/libgnat/s-pack102.adb b/gcc/ada/libgnat/s-pack102.adb
new file mode 100644
index 0000000..ebf1094
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack102.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 2 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_102 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_102;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_102 or SetU_102 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_102 --
+ ------------
+
+ function Get_102
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_102
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_102;
+
+ -------------
+ -- GetU_102 --
+ -------------
+
+ function GetU_102
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_102
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_102;
+
+ ------------
+ -- Set_102 --
+ ------------
+
+ procedure Set_102
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_102;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_102;
+
+ -------------
+ -- SetU_102 --
+ -------------
+
+ procedure SetU_102
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_102;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_102;
+
+end System.Pack_102;
diff --git a/gcc/ada/libgnat/s-pack102.ads b/gcc/ada/libgnat/s-pack102.ads
new file mode 100644
index 0000000..065f338
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack102.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 2 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 102
+
+package System.Pack_102 is
+ pragma Preelaborate;
+
+ Bits : constant := 102;
+
+ type Bits_102 is mod 2 ** Bits;
+ for Bits_102'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_102
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_102 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_102
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_102;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_102
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_102 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_102
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_102;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_102;
diff --git a/gcc/ada/libgnat/s-pack103.adb b/gcc/ada/libgnat/s-pack103.adb
new file mode 100644
index 0000000..b5df31e
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack103.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 3 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_103 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_103;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_103 --
+ ------------
+
+ function Get_103
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_103
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_103;
+
+ ------------
+ -- Set_103 --
+ ------------
+
+ procedure Set_103
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_103;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_103;
+
+end System.Pack_103;
diff --git a/gcc/ada/libgnat/s-pack103.ads b/gcc/ada/libgnat/s-pack103.ads
new file mode 100644
index 0000000..ad12b0e
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack103.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 3 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 103
+
+package System.Pack_103 is
+ pragma Preelaborate;
+
+ Bits : constant := 103;
+
+ type Bits_103 is mod 2 ** Bits;
+ for Bits_103'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_103
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_103 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_103
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_103;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_103;
diff --git a/gcc/ada/libgnat/s-pack104.adb b/gcc/ada/libgnat/s-pack104.adb
new file mode 100644
index 0000000..573fe4a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack104.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 4 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_104 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_104;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_104 or SetU_104 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_104 --
+ ------------
+
+ function Get_104
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_104
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_104;
+
+ -------------
+ -- GetU_104 --
+ -------------
+
+ function GetU_104
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_104
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_104;
+
+ ------------
+ -- Set_104 --
+ ------------
+
+ procedure Set_104
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_104;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_104;
+
+ -------------
+ -- SetU_104 --
+ -------------
+
+ procedure SetU_104
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_104;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_104;
+
+end System.Pack_104;
diff --git a/gcc/ada/libgnat/s-pack104.ads b/gcc/ada/libgnat/s-pack104.ads
new file mode 100644
index 0000000..3dee1a7
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack104.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 4 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 104
+
+package System.Pack_104 is
+ pragma Preelaborate;
+
+ Bits : constant := 104;
+
+ type Bits_104 is mod 2 ** Bits;
+ for Bits_104'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_104
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_104 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_104
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_104;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_104
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_104 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_104
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_104;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_104;
diff --git a/gcc/ada/libgnat/s-pack105.adb b/gcc/ada/libgnat/s-pack105.adb
new file mode 100644
index 0000000..b5e2aab
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack105.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_105 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_105;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_105 --
+ ------------
+
+ function Get_105
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_105
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_105;
+
+ ------------
+ -- Set_105 --
+ ------------
+
+ procedure Set_105
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_105;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_105;
+
+end System.Pack_105;
diff --git a/gcc/ada/libgnat/s-pack105.ads b/gcc/ada/libgnat/s-pack105.ads
new file mode 100644
index 0000000..2faf652
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack105.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 105
+
+package System.Pack_105 is
+ pragma Preelaborate;
+
+ Bits : constant := 105;
+
+ type Bits_105 is mod 2 ** Bits;
+ for Bits_105'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_105
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_105 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_105
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_105;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_105;
diff --git a/gcc/ada/libgnat/s-pack106.adb b/gcc/ada/libgnat/s-pack106.adb
new file mode 100644
index 0000000..645b5a2
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack106.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_106 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_106;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_106 or SetU_106 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_106 --
+ ------------
+
+ function Get_106
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_106
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_106;
+
+ -------------
+ -- GetU_106 --
+ -------------
+
+ function GetU_106
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_106
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_106;
+
+ ------------
+ -- Set_106 --
+ ------------
+
+ procedure Set_106
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_106;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_106;
+
+ -------------
+ -- SetU_106 --
+ -------------
+
+ procedure SetU_106
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_106;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_106;
+
+end System.Pack_106;
diff --git a/gcc/ada/libgnat/s-pack106.ads b/gcc/ada/libgnat/s-pack106.ads
new file mode 100644
index 0000000..27c7efa
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack106.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 106
+
+package System.Pack_106 is
+ pragma Preelaborate;
+
+ Bits : constant := 106;
+
+ type Bits_106 is mod 2 ** Bits;
+ for Bits_106'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_106
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_106 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_106
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_106;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_106
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_106 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_106
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_106;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_106;
diff --git a/gcc/ada/libgnat/s-pack107.adb b/gcc/ada/libgnat/s-pack107.adb
new file mode 100644
index 0000000..7e1a86a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack107.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_107 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_107;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_107 --
+ ------------
+
+ function Get_107
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_107
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_107;
+
+ ------------
+ -- Set_107 --
+ ------------
+
+ procedure Set_107
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_107;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_107;
+
+end System.Pack_107;
diff --git a/gcc/ada/libgnat/s-pack107.ads b/gcc/ada/libgnat/s-pack107.ads
new file mode 100644
index 0000000..3eba81d
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack107.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 107
+
+package System.Pack_107 is
+ pragma Preelaborate;
+
+ Bits : constant := 107;
+
+ type Bits_107 is mod 2 ** Bits;
+ for Bits_107'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_107
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_107 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_107
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_107;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_107;
diff --git a/gcc/ada/libgnat/s-pack108.adb b/gcc/ada/libgnat/s-pack108.adb
new file mode 100644
index 0000000..afe28a5
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack108.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_108 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_108;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_108 or SetU_108 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_108 --
+ ------------
+
+ function Get_108
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_108
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_108;
+
+ -------------
+ -- GetU_108 --
+ -------------
+
+ function GetU_108
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_108
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_108;
+
+ ------------
+ -- Set_108 --
+ ------------
+
+ procedure Set_108
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_108;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_108;
+
+ -------------
+ -- SetU_108 --
+ -------------
+
+ procedure SetU_108
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_108;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_108;
+
+end System.Pack_108;
diff --git a/gcc/ada/libgnat/s-pack108.ads b/gcc/ada/libgnat/s-pack108.ads
new file mode 100644
index 0000000..e751654
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack108.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 108
+
+package System.Pack_108 is
+ pragma Preelaborate;
+
+ Bits : constant := 108;
+
+ type Bits_108 is mod 2 ** Bits;
+ for Bits_108'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_108
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_108 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_108
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_108;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_108
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_108 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_108
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_108;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_108;
diff --git a/gcc/ada/libgnat/s-pack109.adb b/gcc/ada/libgnat/s-pack109.adb
new file mode 100644
index 0000000..e976ed4
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack109.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 9 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_109 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_109;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_109 --
+ ------------
+
+ function Get_109
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_109
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_109;
+
+ ------------
+ -- Set_109 --
+ ------------
+
+ procedure Set_109
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_109;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_109;
+
+end System.Pack_109;
diff --git a/gcc/ada/libgnat/s-pack109.ads b/gcc/ada/libgnat/s-pack109.ads
new file mode 100644
index 0000000..2ea8b42
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack109.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 0 9 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 109
+
+package System.Pack_109 is
+ pragma Preelaborate;
+
+ Bits : constant := 109;
+
+ type Bits_109 is mod 2 ** Bits;
+ for Bits_109'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_109
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_109 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_109
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_109;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_109;
diff --git a/gcc/ada/libgnat/s-pack110.adb b/gcc/ada/libgnat/s-pack110.adb
new file mode 100644
index 0000000..a85eb3d
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack110.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 0 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_110 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_110;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_110 or SetU_110 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_110 --
+ ------------
+
+ function Get_110
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_110
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_110;
+
+ -------------
+ -- GetU_110 --
+ -------------
+
+ function GetU_110
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_110
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_110;
+
+ ------------
+ -- Set_110 --
+ ------------
+
+ procedure Set_110
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_110;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_110;
+
+ -------------
+ -- SetU_110 --
+ -------------
+
+ procedure SetU_110
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_110;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_110;
+
+end System.Pack_110;
diff --git a/gcc/ada/libgnat/s-pack110.ads b/gcc/ada/libgnat/s-pack110.ads
new file mode 100644
index 0000000..570a994
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack110.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 0 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 110
+
+package System.Pack_110 is
+ pragma Preelaborate;
+
+ Bits : constant := 110;
+
+ type Bits_110 is mod 2 ** Bits;
+ for Bits_110'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_110
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_110 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_110
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_110;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_110
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_110 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_110
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_110;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_110;
diff --git a/gcc/ada/libgnat/s-pack111.adb b/gcc/ada/libgnat/s-pack111.adb
new file mode 100644
index 0000000..168877b
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack111.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 1 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_111 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_111;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_111 --
+ ------------
+
+ function Get_111
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_111
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_111;
+
+ ------------
+ -- Set_111 --
+ ------------
+
+ procedure Set_111
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_111;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_111;
+
+end System.Pack_111;
diff --git a/gcc/ada/libgnat/s-pack111.ads b/gcc/ada/libgnat/s-pack111.ads
new file mode 100644
index 0000000..784b861
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack111.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 1 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 111
+
+package System.Pack_111 is
+ pragma Preelaborate;
+
+ Bits : constant := 111;
+
+ type Bits_111 is mod 2 ** Bits;
+ for Bits_111'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_111
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_111 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_111
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_111;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_111;
diff --git a/gcc/ada/libgnat/s-pack112.adb b/gcc/ada/libgnat/s-pack112.adb
new file mode 100644
index 0000000..b8acf56
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack112.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 2 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_112 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_112;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_112 or SetU_112 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_112 --
+ ------------
+
+ function Get_112
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_112
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_112;
+
+ -------------
+ -- GetU_112 --
+ -------------
+
+ function GetU_112
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_112
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_112;
+
+ ------------
+ -- Set_112 --
+ ------------
+
+ procedure Set_112
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_112;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_112;
+
+ -------------
+ -- SetU_112 --
+ -------------
+
+ procedure SetU_112
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_112;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_112;
+
+end System.Pack_112;
diff --git a/gcc/ada/libgnat/s-pack112.ads b/gcc/ada/libgnat/s-pack112.ads
new file mode 100644
index 0000000..6b36a8b
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack112.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 2 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 112
+
+package System.Pack_112 is
+ pragma Preelaborate;
+
+ Bits : constant := 112;
+
+ type Bits_112 is mod 2 ** Bits;
+ for Bits_112'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_112
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_112 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_112
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_112;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_112
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_112 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_112
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_112;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_112;
diff --git a/gcc/ada/libgnat/s-pack113.adb b/gcc/ada/libgnat/s-pack113.adb
new file mode 100644
index 0000000..58f84d4
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack113.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 3 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_113 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_113;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_113 --
+ ------------
+
+ function Get_113
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_113
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_113;
+
+ ------------
+ -- Set_113 --
+ ------------
+
+ procedure Set_113
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_113;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_113;
+
+end System.Pack_113;
diff --git a/gcc/ada/libgnat/s-pack113.ads b/gcc/ada/libgnat/s-pack113.ads
new file mode 100644
index 0000000..2f0bfc2
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack113.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 3 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 113
+
+package System.Pack_113 is
+ pragma Preelaborate;
+
+ Bits : constant := 113;
+
+ type Bits_113 is mod 2 ** Bits;
+ for Bits_113'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_113
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_113 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_113
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_113;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_113;
diff --git a/gcc/ada/libgnat/s-pack114.adb b/gcc/ada/libgnat/s-pack114.adb
new file mode 100644
index 0000000..079abeb
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack114.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 4 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_114 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_114;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_114 or SetU_114 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_114 --
+ ------------
+
+ function Get_114
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_114
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_114;
+
+ -------------
+ -- GetU_114 --
+ -------------
+
+ function GetU_114
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_114
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_114;
+
+ ------------
+ -- Set_114 --
+ ------------
+
+ procedure Set_114
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_114;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_114;
+
+ -------------
+ -- SetU_114 --
+ -------------
+
+ procedure SetU_114
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_114;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_114;
+
+end System.Pack_114;
diff --git a/gcc/ada/libgnat/s-pack114.ads b/gcc/ada/libgnat/s-pack114.ads
new file mode 100644
index 0000000..046026e
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack114.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 4 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 114
+
+package System.Pack_114 is
+ pragma Preelaborate;
+
+ Bits : constant := 114;
+
+ type Bits_114 is mod 2 ** Bits;
+ for Bits_114'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_114
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_114 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_114
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_114;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_114
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_114 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_114
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_114;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_114;
diff --git a/gcc/ada/libgnat/s-pack115.adb b/gcc/ada/libgnat/s-pack115.adb
new file mode 100644
index 0000000..0459777
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack115.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_115 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_115;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_115 --
+ ------------
+
+ function Get_115
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_115
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_115;
+
+ ------------
+ -- Set_115 --
+ ------------
+
+ procedure Set_115
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_115;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_115;
+
+end System.Pack_115;
diff --git a/gcc/ada/libgnat/s-pack115.ads b/gcc/ada/libgnat/s-pack115.ads
new file mode 100644
index 0000000..a2063a6
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack115.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 115
+
+package System.Pack_115 is
+ pragma Preelaborate;
+
+ Bits : constant := 115;
+
+ type Bits_115 is mod 2 ** Bits;
+ for Bits_115'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_115
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_115 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_115
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_115;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_115;
diff --git a/gcc/ada/libgnat/s-pack116.adb b/gcc/ada/libgnat/s-pack116.adb
new file mode 100644
index 0000000..d03c857
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack116.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_116 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_116;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_116 or SetU_116 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_116 --
+ ------------
+
+ function Get_116
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_116
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_116;
+
+ -------------
+ -- GetU_116 --
+ -------------
+
+ function GetU_116
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_116
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_116;
+
+ ------------
+ -- Set_116 --
+ ------------
+
+ procedure Set_116
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_116;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_116;
+
+ -------------
+ -- SetU_116 --
+ -------------
+
+ procedure SetU_116
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_116;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_116;
+
+end System.Pack_116;
diff --git a/gcc/ada/libgnat/s-pack116.ads b/gcc/ada/libgnat/s-pack116.ads
new file mode 100644
index 0000000..3cd556d
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack116.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 116
+
+package System.Pack_116 is
+ pragma Preelaborate;
+
+ Bits : constant := 116;
+
+ type Bits_116 is mod 2 ** Bits;
+ for Bits_116'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_116
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_116 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_116
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_116;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_116
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_116 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_116
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_116;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_116;
diff --git a/gcc/ada/libgnat/s-pack117.adb b/gcc/ada/libgnat/s-pack117.adb
new file mode 100644
index 0000000..92da470
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack117.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_117 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_117;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_117 --
+ ------------
+
+ function Get_117
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_117
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_117;
+
+ ------------
+ -- Set_117 --
+ ------------
+
+ procedure Set_117
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_117;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_117;
+
+end System.Pack_117;
diff --git a/gcc/ada/libgnat/s-pack117.ads b/gcc/ada/libgnat/s-pack117.ads
new file mode 100644
index 0000000..478663a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack117.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 117
+
+package System.Pack_117 is
+ pragma Preelaborate;
+
+ Bits : constant := 117;
+
+ type Bits_117 is mod 2 ** Bits;
+ for Bits_117'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_117
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_117 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_117
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_117;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_117;
diff --git a/gcc/ada/libgnat/s-pack118.adb b/gcc/ada/libgnat/s-pack118.adb
new file mode 100644
index 0000000..aa1d763
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack118.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_118 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_118;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_118 or SetU_118 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_118 --
+ ------------
+
+ function Get_118
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_118
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_118;
+
+ -------------
+ -- GetU_118 --
+ -------------
+
+ function GetU_118
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_118
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_118;
+
+ ------------
+ -- Set_118 --
+ ------------
+
+ procedure Set_118
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_118;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_118;
+
+ -------------
+ -- SetU_118 --
+ -------------
+
+ procedure SetU_118
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_118;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_118;
+
+end System.Pack_118;
diff --git a/gcc/ada/libgnat/s-pack118.ads b/gcc/ada/libgnat/s-pack118.ads
new file mode 100644
index 0000000..0902c5c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack118.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 118
+
+package System.Pack_118 is
+ pragma Preelaborate;
+
+ Bits : constant := 118;
+
+ type Bits_118 is mod 2 ** Bits;
+ for Bits_118'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_118
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_118 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_118
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_118;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_118
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_118 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_118
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_118;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_118;
diff --git a/gcc/ada/libgnat/s-pack119.adb b/gcc/ada/libgnat/s-pack119.adb
new file mode 100644
index 0000000..9003175
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack119.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 9 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_119 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_119;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_119 --
+ ------------
+
+ function Get_119
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_119
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_119;
+
+ ------------
+ -- Set_119 --
+ ------------
+
+ procedure Set_119
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_119;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_119;
+
+end System.Pack_119;
diff --git a/gcc/ada/libgnat/s-pack119.ads b/gcc/ada/libgnat/s-pack119.ads
new file mode 100644
index 0000000..75d1c4a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack119.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 1 9 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 119
+
+package System.Pack_119 is
+ pragma Preelaborate;
+
+ Bits : constant := 119;
+
+ type Bits_119 is mod 2 ** Bits;
+ for Bits_119'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_119
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_119 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_119
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_119;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_119;
diff --git a/gcc/ada/libgnat/s-pack120.adb b/gcc/ada/libgnat/s-pack120.adb
new file mode 100644
index 0000000..774085c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack120.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 0 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_120 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_120;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_120 or SetU_120 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_120 --
+ ------------
+
+ function Get_120
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_120
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_120;
+
+ -------------
+ -- GetU_120 --
+ -------------
+
+ function GetU_120
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_120
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_120;
+
+ ------------
+ -- Set_120 --
+ ------------
+
+ procedure Set_120
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_120;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_120;
+
+ -------------
+ -- SetU_120 --
+ -------------
+
+ procedure SetU_120
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_120;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_120;
+
+end System.Pack_120;
diff --git a/gcc/ada/libgnat/s-pack120.ads b/gcc/ada/libgnat/s-pack120.ads
new file mode 100644
index 0000000..ae5580a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack120.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 0 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 120
+
+package System.Pack_120 is
+ pragma Preelaborate;
+
+ Bits : constant := 120;
+
+ type Bits_120 is mod 2 ** Bits;
+ for Bits_120'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_120
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_120 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_120
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_120;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_120
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_120 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_120
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_120;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_120;
diff --git a/gcc/ada/libgnat/s-pack121.adb b/gcc/ada/libgnat/s-pack121.adb
new file mode 100644
index 0000000..a44f144
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack121.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 1 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_121 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_121;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_121 --
+ ------------
+
+ function Get_121
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_121
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_121;
+
+ ------------
+ -- Set_121 --
+ ------------
+
+ procedure Set_121
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_121;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_121;
+
+end System.Pack_121;
diff --git a/gcc/ada/libgnat/s-pack121.ads b/gcc/ada/libgnat/s-pack121.ads
new file mode 100644
index 0000000..5f4f5ed
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack121.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 1 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 121
+
+package System.Pack_121 is
+ pragma Preelaborate;
+
+ Bits : constant := 121;
+
+ type Bits_121 is mod 2 ** Bits;
+ for Bits_121'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_121
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_121 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_121
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_121;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_121;
diff --git a/gcc/ada/libgnat/s-pack122.adb b/gcc/ada/libgnat/s-pack122.adb
new file mode 100644
index 0000000..13c59ac
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack122.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 2 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_122 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_122;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_122 or SetU_122 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_122 --
+ ------------
+
+ function Get_122
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_122
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_122;
+
+ -------------
+ -- GetU_122 --
+ -------------
+
+ function GetU_122
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_122
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_122;
+
+ ------------
+ -- Set_122 --
+ ------------
+
+ procedure Set_122
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_122;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_122;
+
+ -------------
+ -- SetU_122 --
+ -------------
+
+ procedure SetU_122
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_122;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_122;
+
+end System.Pack_122;
diff --git a/gcc/ada/libgnat/s-pack122.ads b/gcc/ada/libgnat/s-pack122.ads
new file mode 100644
index 0000000..0094896
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack122.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 2 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 122
+
+package System.Pack_122 is
+ pragma Preelaborate;
+
+ Bits : constant := 122;
+
+ type Bits_122 is mod 2 ** Bits;
+ for Bits_122'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_122
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_122 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_122
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_122;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_122
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_122 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_122
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_122;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_122;
diff --git a/gcc/ada/libgnat/s-pack123.adb b/gcc/ada/libgnat/s-pack123.adb
new file mode 100644
index 0000000..27d7417
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack123.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 3 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_123 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_123;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_123 --
+ ------------
+
+ function Get_123
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_123
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_123;
+
+ ------------
+ -- Set_123 --
+ ------------
+
+ procedure Set_123
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_123;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_123;
+
+end System.Pack_123;
diff --git a/gcc/ada/libgnat/s-pack123.ads b/gcc/ada/libgnat/s-pack123.ads
new file mode 100644
index 0000000..f40fe87
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack123.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 3 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 123
+
+package System.Pack_123 is
+ pragma Preelaborate;
+
+ Bits : constant := 123;
+
+ type Bits_123 is mod 2 ** Bits;
+ for Bits_123'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_123
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_123 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_123
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_123;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_123;
diff --git a/gcc/ada/libgnat/s-pack124.adb b/gcc/ada/libgnat/s-pack124.adb
new file mode 100644
index 0000000..2e6d9c0
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack124.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 4 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_124 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_124;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_124 or SetU_124 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_124 --
+ ------------
+
+ function Get_124
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_124
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_124;
+
+ -------------
+ -- GetU_124 --
+ -------------
+
+ function GetU_124
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_124
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_124;
+
+ ------------
+ -- Set_124 --
+ ------------
+
+ procedure Set_124
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_124;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_124;
+
+ -------------
+ -- SetU_124 --
+ -------------
+
+ procedure SetU_124
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_124;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_124;
+
+end System.Pack_124;
diff --git a/gcc/ada/libgnat/s-pack124.ads b/gcc/ada/libgnat/s-pack124.ads
new file mode 100644
index 0000000..3a4f159
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack124.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 4 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 124
+
+package System.Pack_124 is
+ pragma Preelaborate;
+
+ Bits : constant := 124;
+
+ type Bits_124 is mod 2 ** Bits;
+ for Bits_124'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_124
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_124 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_124
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_124;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_124
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_124 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_124
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_124;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_124;
diff --git a/gcc/ada/libgnat/s-pack125.adb b/gcc/ada/libgnat/s-pack125.adb
new file mode 100644
index 0000000..ffc2c1c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack125.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_125 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_125;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_125 --
+ ------------
+
+ function Get_125
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_125
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_125;
+
+ ------------
+ -- Set_125 --
+ ------------
+
+ procedure Set_125
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_125;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_125;
+
+end System.Pack_125;
diff --git a/gcc/ada/libgnat/s-pack125.ads b/gcc/ada/libgnat/s-pack125.ads
new file mode 100644
index 0000000..dc4fdc9
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack125.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 125
+
+package System.Pack_125 is
+ pragma Preelaborate;
+
+ Bits : constant := 125;
+
+ type Bits_125 is mod 2 ** Bits;
+ for Bits_125'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_125
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_125 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_125
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_125;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_125;
diff --git a/gcc/ada/libgnat/s-pack126.adb b/gcc/ada/libgnat/s-pack126.adb
new file mode 100644
index 0000000..c566fc9
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack126.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_126 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_126;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_126 or SetU_126 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_126 --
+ ------------
+
+ function Get_126
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_126
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_126;
+
+ -------------
+ -- GetU_126 --
+ -------------
+
+ function GetU_126
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_126
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_126;
+
+ ------------
+ -- Set_126 --
+ ------------
+
+ procedure Set_126
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_126;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_126;
+
+ -------------
+ -- SetU_126 --
+ -------------
+
+ procedure SetU_126
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_126;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_126;
+
+end System.Pack_126;
diff --git a/gcc/ada/libgnat/s-pack126.ads b/gcc/ada/libgnat/s-pack126.ads
new file mode 100644
index 0000000..fd83f78
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack126.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 126
+
+package System.Pack_126 is
+ pragma Preelaborate;
+
+ Bits : constant := 126;
+
+ type Bits_126 is mod 2 ** Bits;
+ for Bits_126'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_126
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_126 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_126
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_126;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_126
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_126 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_126
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_126;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_126;
diff --git a/gcc/ada/libgnat/s-pack127.adb b/gcc/ada/libgnat/s-pack127.adb
new file mode 100644
index 0000000..3895c1f
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack127.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_127 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_127;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_127 --
+ ------------
+
+ function Get_127
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_127
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_127;
+
+ ------------
+ -- Set_127 --
+ ------------
+
+ procedure Set_127
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_127;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_127;
+
+end System.Pack_127;
diff --git a/gcc/ada/libgnat/s-pack127.ads b/gcc/ada/libgnat/s-pack127.ads
new file mode 100644
index 0000000..c37ae59
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack127.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 1 2 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 127
+
+package System.Pack_127 is
+ pragma Preelaborate;
+
+ Bits : constant := 127;
+
+ type Bits_127 is mod 2 ** Bits;
+ for Bits_127'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_127
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_127 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_127
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_127;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_127;
diff --git a/gcc/ada/libgnat/s-pack65.adb b/gcc/ada/libgnat/s-pack65.adb
new file mode 100644
index 0000000..c5b7310
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack65.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_65 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_65;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_65 --
+ ------------
+
+ function Get_65
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_65
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_65;
+
+ ------------
+ -- Set_65 --
+ ------------
+
+ procedure Set_65
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_65;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_65;
+
+end System.Pack_65;
diff --git a/gcc/ada/libgnat/s-pack65.ads b/gcc/ada/libgnat/s-pack65.ads
new file mode 100644
index 0000000..8752c9c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack65.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 65
+
+package System.Pack_65 is
+ pragma Preelaborate;
+
+ Bits : constant := 65;
+
+ type Bits_65 is mod 2 ** Bits;
+ for Bits_65'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_65
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_65 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_65
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_65;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_65;
diff --git a/gcc/ada/libgnat/s-pack66.adb b/gcc/ada/libgnat/s-pack66.adb
new file mode 100644
index 0000000..5e90ceb
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack66.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_66 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_66;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_66 or SetU_66 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_66 --
+ ------------
+
+ function Get_66
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_66
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_66;
+
+ -------------
+ -- GetU_66 --
+ -------------
+
+ function GetU_66
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_66
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_66;
+
+ ------------
+ -- Set_66 --
+ ------------
+
+ procedure Set_66
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_66;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_66;
+
+ -------------
+ -- SetU_66 --
+ -------------
+
+ procedure SetU_66
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_66;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_66;
+
+end System.Pack_66;
diff --git a/gcc/ada/libgnat/s-pack66.ads b/gcc/ada/libgnat/s-pack66.ads
new file mode 100644
index 0000000..b45d317
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack66.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 66
+
+package System.Pack_66 is
+ pragma Preelaborate;
+
+ Bits : constant := 66;
+
+ type Bits_66 is mod 2 ** Bits;
+ for Bits_66'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_66
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_66 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_66
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_66;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_66
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_66 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_66
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_66;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_66;
diff --git a/gcc/ada/libgnat/s-pack67.adb b/gcc/ada/libgnat/s-pack67.adb
new file mode 100644
index 0000000..d7c77e8
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack67.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_67 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_67;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_67 --
+ ------------
+
+ function Get_67
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_67
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_67;
+
+ ------------
+ -- Set_67 --
+ ------------
+
+ procedure Set_67
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_67;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_67;
+
+end System.Pack_67;
diff --git a/gcc/ada/libgnat/s-pack67.ads b/gcc/ada/libgnat/s-pack67.ads
new file mode 100644
index 0000000..f77b651
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack67.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 67
+
+package System.Pack_67 is
+ pragma Preelaborate;
+
+ Bits : constant := 67;
+
+ type Bits_67 is mod 2 ** Bits;
+ for Bits_67'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_67
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_67 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_67
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_67;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_67;
diff --git a/gcc/ada/libgnat/s-pack68.adb b/gcc/ada/libgnat/s-pack68.adb
new file mode 100644
index 0000000..03a0361
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack68.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_68 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_68;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_68 or SetU_68 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_68 --
+ ------------
+
+ function Get_68
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_68
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_68;
+
+ -------------
+ -- GetU_68 --
+ -------------
+
+ function GetU_68
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_68
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_68;
+
+ ------------
+ -- Set_68 --
+ ------------
+
+ procedure Set_68
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_68;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_68;
+
+ -------------
+ -- SetU_68 --
+ -------------
+
+ procedure SetU_68
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_68;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_68;
+
+end System.Pack_68;
diff --git a/gcc/ada/libgnat/s-pack68.ads b/gcc/ada/libgnat/s-pack68.ads
new file mode 100644
index 0000000..5565b32
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack68.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 68
+
+package System.Pack_68 is
+ pragma Preelaborate;
+
+ Bits : constant := 68;
+
+ type Bits_68 is mod 2 ** Bits;
+ for Bits_68'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_68
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_68 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_68
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_68;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_68
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_68 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_68
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_68;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_68;
diff --git a/gcc/ada/libgnat/s-pack69.adb b/gcc/ada/libgnat/s-pack69.adb
new file mode 100644
index 0000000..f383029
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack69.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 9 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_69 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_69;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_69 --
+ ------------
+
+ function Get_69
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_69
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_69;
+
+ ------------
+ -- Set_69 --
+ ------------
+
+ procedure Set_69
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_69;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_69;
+
+end System.Pack_69;
diff --git a/gcc/ada/libgnat/s-pack69.ads b/gcc/ada/libgnat/s-pack69.ads
new file mode 100644
index 0000000..76a221d
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack69.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 6 9 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 69
+
+package System.Pack_69 is
+ pragma Preelaborate;
+
+ Bits : constant := 69;
+
+ type Bits_69 is mod 2 ** Bits;
+ for Bits_69'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_69
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_69 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_69
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_69;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_69;
diff --git a/gcc/ada/libgnat/s-pack70.adb b/gcc/ada/libgnat/s-pack70.adb
new file mode 100644
index 0000000..7dab227
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack70.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 0 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_70 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_70;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_70 or SetU_70 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_70 --
+ ------------
+
+ function Get_70
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_70
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_70;
+
+ -------------
+ -- GetU_70 --
+ -------------
+
+ function GetU_70
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_70
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_70;
+
+ ------------
+ -- Set_70 --
+ ------------
+
+ procedure Set_70
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_70;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_70;
+
+ -------------
+ -- SetU_70 --
+ -------------
+
+ procedure SetU_70
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_70;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_70;
+
+end System.Pack_70;
diff --git a/gcc/ada/libgnat/s-pack70.ads b/gcc/ada/libgnat/s-pack70.ads
new file mode 100644
index 0000000..b978d1c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack70.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 0 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 70
+
+package System.Pack_70 is
+ pragma Preelaborate;
+
+ Bits : constant := 70;
+
+ type Bits_70 is mod 2 ** Bits;
+ for Bits_70'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_70
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_70 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_70
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_70;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_70
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_70 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_70
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_70;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_70;
diff --git a/gcc/ada/libgnat/s-pack71.adb b/gcc/ada/libgnat/s-pack71.adb
new file mode 100644
index 0000000..f3560de
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack71.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 1 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_71 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_71;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_71 --
+ ------------
+
+ function Get_71
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_71
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_71;
+
+ ------------
+ -- Set_71 --
+ ------------
+
+ procedure Set_71
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_71;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_71;
+
+end System.Pack_71;
diff --git a/gcc/ada/libgnat/s-pack71.ads b/gcc/ada/libgnat/s-pack71.ads
new file mode 100644
index 0000000..842a232
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack71.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 1 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 71
+
+package System.Pack_71 is
+ pragma Preelaborate;
+
+ Bits : constant := 71;
+
+ type Bits_71 is mod 2 ** Bits;
+ for Bits_71'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_71
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_71 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_71
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_71;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_71;
diff --git a/gcc/ada/libgnat/s-pack72.adb b/gcc/ada/libgnat/s-pack72.adb
new file mode 100644
index 0000000..14fbb15
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack72.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 2 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_72 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_72;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_72 or SetU_72 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_72 --
+ ------------
+
+ function Get_72
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_72
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_72;
+
+ -------------
+ -- GetU_72 --
+ -------------
+
+ function GetU_72
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_72
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_72;
+
+ ------------
+ -- Set_72 --
+ ------------
+
+ procedure Set_72
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_72;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_72;
+
+ -------------
+ -- SetU_72 --
+ -------------
+
+ procedure SetU_72
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_72;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_72;
+
+end System.Pack_72;
diff --git a/gcc/ada/libgnat/s-pack72.ads b/gcc/ada/libgnat/s-pack72.ads
new file mode 100644
index 0000000..b1add35
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack72.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 2 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 72
+
+package System.Pack_72 is
+ pragma Preelaborate;
+
+ Bits : constant := 72;
+
+ type Bits_72 is mod 2 ** Bits;
+ for Bits_72'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_72
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_72 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_72
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_72;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_72
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_72 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_72
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_72;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_72;
diff --git a/gcc/ada/libgnat/s-pack73.adb b/gcc/ada/libgnat/s-pack73.adb
new file mode 100644
index 0000000..f4853cb
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack73.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 3 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_73 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_73;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_73 --
+ ------------
+
+ function Get_73
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_73
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_73;
+
+ ------------
+ -- Set_73 --
+ ------------
+
+ procedure Set_73
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_73;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_73;
+
+end System.Pack_73;
diff --git a/gcc/ada/libgnat/s-pack73.ads b/gcc/ada/libgnat/s-pack73.ads
new file mode 100644
index 0000000..5f103de
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack73.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 3 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 73
+
+package System.Pack_73 is
+ pragma Preelaborate;
+
+ Bits : constant := 73;
+
+ type Bits_73 is mod 2 ** Bits;
+ for Bits_73'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_73
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_73 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_73
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_73;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_73;
diff --git a/gcc/ada/libgnat/s-pack74.adb b/gcc/ada/libgnat/s-pack74.adb
new file mode 100644
index 0000000..984b4c0
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack74.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 4 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_74 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_74;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_74 or SetU_74 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_74 --
+ ------------
+
+ function Get_74
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_74
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_74;
+
+ -------------
+ -- GetU_74 --
+ -------------
+
+ function GetU_74
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_74
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_74;
+
+ ------------
+ -- Set_74 --
+ ------------
+
+ procedure Set_74
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_74;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_74;
+
+ -------------
+ -- SetU_74 --
+ -------------
+
+ procedure SetU_74
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_74;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_74;
+
+end System.Pack_74;
diff --git a/gcc/ada/libgnat/s-pack74.ads b/gcc/ada/libgnat/s-pack74.ads
new file mode 100644
index 0000000..5dde51b
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack74.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 4 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 74
+
+package System.Pack_74 is
+ pragma Preelaborate;
+
+ Bits : constant := 74;
+
+ type Bits_74 is mod 2 ** Bits;
+ for Bits_74'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_74
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_74 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_74
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_74;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_74
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_74 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_74
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_74;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_74;
diff --git a/gcc/ada/libgnat/s-pack75.adb b/gcc/ada/libgnat/s-pack75.adb
new file mode 100644
index 0000000..6c7c14f
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack75.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_75 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_75;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_75 --
+ ------------
+
+ function Get_75
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_75
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_75;
+
+ ------------
+ -- Set_75 --
+ ------------
+
+ procedure Set_75
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_75;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_75;
+
+end System.Pack_75;
diff --git a/gcc/ada/libgnat/s-pack75.ads b/gcc/ada/libgnat/s-pack75.ads
new file mode 100644
index 0000000..551833a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack75.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 75
+
+package System.Pack_75 is
+ pragma Preelaborate;
+
+ Bits : constant := 75;
+
+ type Bits_75 is mod 2 ** Bits;
+ for Bits_75'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_75
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_75 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_75
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_75;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_75;
diff --git a/gcc/ada/libgnat/s-pack76.adb b/gcc/ada/libgnat/s-pack76.adb
new file mode 100644
index 0000000..6a7c5fa
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack76.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_76 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_76;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_76 or SetU_76 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_76 --
+ ------------
+
+ function Get_76
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_76
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_76;
+
+ -------------
+ -- GetU_76 --
+ -------------
+
+ function GetU_76
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_76
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_76;
+
+ ------------
+ -- Set_76 --
+ ------------
+
+ procedure Set_76
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_76;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_76;
+
+ -------------
+ -- SetU_76 --
+ -------------
+
+ procedure SetU_76
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_76;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_76;
+
+end System.Pack_76;
diff --git a/gcc/ada/libgnat/s-pack76.ads b/gcc/ada/libgnat/s-pack76.ads
new file mode 100644
index 0000000..6a600c9
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack76.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 76
+
+package System.Pack_76 is
+ pragma Preelaborate;
+
+ Bits : constant := 76;
+
+ type Bits_76 is mod 2 ** Bits;
+ for Bits_76'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_76
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_76 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_76
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_76;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_76
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_76 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_76
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_76;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_76;
diff --git a/gcc/ada/libgnat/s-pack77.adb b/gcc/ada/libgnat/s-pack77.adb
new file mode 100644
index 0000000..f29cdf1
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack77.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_77 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_77;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_77 --
+ ------------
+
+ function Get_77
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_77
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_77;
+
+ ------------
+ -- Set_77 --
+ ------------
+
+ procedure Set_77
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_77;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_77;
+
+end System.Pack_77;
diff --git a/gcc/ada/libgnat/s-pack77.ads b/gcc/ada/libgnat/s-pack77.ads
new file mode 100644
index 0000000..9308a78
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack77.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 77
+
+package System.Pack_77 is
+ pragma Preelaborate;
+
+ Bits : constant := 77;
+
+ type Bits_77 is mod 2 ** Bits;
+ for Bits_77'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_77
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_77 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_77
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_77;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_77;
diff --git a/gcc/ada/libgnat/s-pack78.adb b/gcc/ada/libgnat/s-pack78.adb
new file mode 100644
index 0000000..e321c1e
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack78.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_78 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_78;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_78 or SetU_78 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_78 --
+ ------------
+
+ function Get_78
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_78
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_78;
+
+ -------------
+ -- GetU_78 --
+ -------------
+
+ function GetU_78
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_78
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_78;
+
+ ------------
+ -- Set_78 --
+ ------------
+
+ procedure Set_78
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_78;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_78;
+
+ -------------
+ -- SetU_78 --
+ -------------
+
+ procedure SetU_78
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_78;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_78;
+
+end System.Pack_78;
diff --git a/gcc/ada/libgnat/s-pack78.ads b/gcc/ada/libgnat/s-pack78.ads
new file mode 100644
index 0000000..54fdd95
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack78.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 78
+
+package System.Pack_78 is
+ pragma Preelaborate;
+
+ Bits : constant := 78;
+
+ type Bits_78 is mod 2 ** Bits;
+ for Bits_78'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_78
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_78 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_78
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_78;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_78
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_78 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_78
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_78;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_78;
diff --git a/gcc/ada/libgnat/s-pack79.adb b/gcc/ada/libgnat/s-pack79.adb
new file mode 100644
index 0000000..75fb14c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack79.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 9 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_79 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_79;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_79 --
+ ------------
+
+ function Get_79
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_79
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_79;
+
+ ------------
+ -- Set_79 --
+ ------------
+
+ procedure Set_79
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_79;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_79;
+
+end System.Pack_79;
diff --git a/gcc/ada/libgnat/s-pack79.ads b/gcc/ada/libgnat/s-pack79.ads
new file mode 100644
index 0000000..337be86
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack79.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 7 9 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 79
+
+package System.Pack_79 is
+ pragma Preelaborate;
+
+ Bits : constant := 79;
+
+ type Bits_79 is mod 2 ** Bits;
+ for Bits_79'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_79
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_79 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_79
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_79;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_79;
diff --git a/gcc/ada/libgnat/s-pack80.adb b/gcc/ada/libgnat/s-pack80.adb
new file mode 100644
index 0000000..d66588b
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack80.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 0 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_80 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_80;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_80 or SetU_80 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_80 --
+ ------------
+
+ function Get_80
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_80
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_80;
+
+ -------------
+ -- GetU_80 --
+ -------------
+
+ function GetU_80
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_80
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_80;
+
+ ------------
+ -- Set_80 --
+ ------------
+
+ procedure Set_80
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_80;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_80;
+
+ -------------
+ -- SetU_80 --
+ -------------
+
+ procedure SetU_80
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_80;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_80;
+
+end System.Pack_80;
diff --git a/gcc/ada/libgnat/s-pack80.ads b/gcc/ada/libgnat/s-pack80.ads
new file mode 100644
index 0000000..c1f0de4
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack80.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 0 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 80
+
+package System.Pack_80 is
+ pragma Preelaborate;
+
+ Bits : constant := 80;
+
+ type Bits_80 is mod 2 ** Bits;
+ for Bits_80'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_80
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_80 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_80
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_80;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_80
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_80 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_80
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_80;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_80;
diff --git a/gcc/ada/libgnat/s-pack81.adb b/gcc/ada/libgnat/s-pack81.adb
new file mode 100644
index 0000000..5157882
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack81.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 1 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_81 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_81;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_81 --
+ ------------
+
+ function Get_81
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_81
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_81;
+
+ ------------
+ -- Set_81 --
+ ------------
+
+ procedure Set_81
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_81;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_81;
+
+end System.Pack_81;
diff --git a/gcc/ada/libgnat/s-pack81.ads b/gcc/ada/libgnat/s-pack81.ads
new file mode 100644
index 0000000..9f17734
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack81.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 1 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 81
+
+package System.Pack_81 is
+ pragma Preelaborate;
+
+ Bits : constant := 81;
+
+ type Bits_81 is mod 2 ** Bits;
+ for Bits_81'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_81
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_81 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_81
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_81;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_81;
diff --git a/gcc/ada/libgnat/s-pack82.adb b/gcc/ada/libgnat/s-pack82.adb
new file mode 100644
index 0000000..7e409dd
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack82.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 2 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_82 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_82;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_82 or SetU_82 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_82 --
+ ------------
+
+ function Get_82
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_82
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_82;
+
+ -------------
+ -- GetU_82 --
+ -------------
+
+ function GetU_82
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_82
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_82;
+
+ ------------
+ -- Set_82 --
+ ------------
+
+ procedure Set_82
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_82;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_82;
+
+ -------------
+ -- SetU_82 --
+ -------------
+
+ procedure SetU_82
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_82;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_82;
+
+end System.Pack_82;
diff --git a/gcc/ada/libgnat/s-pack82.ads b/gcc/ada/libgnat/s-pack82.ads
new file mode 100644
index 0000000..96a75bf
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack82.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 2 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 82
+
+package System.Pack_82 is
+ pragma Preelaborate;
+
+ Bits : constant := 82;
+
+ type Bits_82 is mod 2 ** Bits;
+ for Bits_82'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_82
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_82 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_82
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_82;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_82
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_82 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_82
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_82;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_82;
diff --git a/gcc/ada/libgnat/s-pack83.adb b/gcc/ada/libgnat/s-pack83.adb
new file mode 100644
index 0000000..5fe2441
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack83.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 3 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_83 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_83;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_83 --
+ ------------
+
+ function Get_83
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_83
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_83;
+
+ ------------
+ -- Set_83 --
+ ------------
+
+ procedure Set_83
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_83;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_83;
+
+end System.Pack_83;
diff --git a/gcc/ada/libgnat/s-pack83.ads b/gcc/ada/libgnat/s-pack83.ads
new file mode 100644
index 0000000..75ccd5b
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack83.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 3 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 83
+
+package System.Pack_83 is
+ pragma Preelaborate;
+
+ Bits : constant := 83;
+
+ type Bits_83 is mod 2 ** Bits;
+ for Bits_83'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_83
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_83 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_83
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_83;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_83;
diff --git a/gcc/ada/libgnat/s-pack84.adb b/gcc/ada/libgnat/s-pack84.adb
new file mode 100644
index 0000000..29b6454
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack84.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 4 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_84 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_84;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_84 or SetU_84 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_84 --
+ ------------
+
+ function Get_84
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_84
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_84;
+
+ -------------
+ -- GetU_84 --
+ -------------
+
+ function GetU_84
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_84
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_84;
+
+ ------------
+ -- Set_84 --
+ ------------
+
+ procedure Set_84
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_84;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_84;
+
+ -------------
+ -- SetU_84 --
+ -------------
+
+ procedure SetU_84
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_84;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_84;
+
+end System.Pack_84;
diff --git a/gcc/ada/libgnat/s-pack84.ads b/gcc/ada/libgnat/s-pack84.ads
new file mode 100644
index 0000000..c3055f9
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack84.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 4 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 84
+
+package System.Pack_84 is
+ pragma Preelaborate;
+
+ Bits : constant := 84;
+
+ type Bits_84 is mod 2 ** Bits;
+ for Bits_84'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_84
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_84 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_84
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_84;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_84
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_84 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_84
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_84;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_84;
diff --git a/gcc/ada/libgnat/s-pack85.adb b/gcc/ada/libgnat/s-pack85.adb
new file mode 100644
index 0000000..6edf9d1
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack85.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_85 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_85;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_85 --
+ ------------
+
+ function Get_85
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_85
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_85;
+
+ ------------
+ -- Set_85 --
+ ------------
+
+ procedure Set_85
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_85;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_85;
+
+end System.Pack_85;
diff --git a/gcc/ada/libgnat/s-pack85.ads b/gcc/ada/libgnat/s-pack85.ads
new file mode 100644
index 0000000..71bb986
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack85.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 85
+
+package System.Pack_85 is
+ pragma Preelaborate;
+
+ Bits : constant := 85;
+
+ type Bits_85 is mod 2 ** Bits;
+ for Bits_85'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_85
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_85 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_85
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_85;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_85;
diff --git a/gcc/ada/libgnat/s-pack86.adb b/gcc/ada/libgnat/s-pack86.adb
new file mode 100644
index 0000000..39e8bca
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack86.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_86 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_86;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_86 or SetU_86 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_86 --
+ ------------
+
+ function Get_86
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_86
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_86;
+
+ -------------
+ -- GetU_86 --
+ -------------
+
+ function GetU_86
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_86
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_86;
+
+ ------------
+ -- Set_86 --
+ ------------
+
+ procedure Set_86
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_86;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_86;
+
+ -------------
+ -- SetU_86 --
+ -------------
+
+ procedure SetU_86
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_86;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_86;
+
+end System.Pack_86;
diff --git a/gcc/ada/libgnat/s-pack86.ads b/gcc/ada/libgnat/s-pack86.ads
new file mode 100644
index 0000000..0dee449
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack86.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 86
+
+package System.Pack_86 is
+ pragma Preelaborate;
+
+ Bits : constant := 86;
+
+ type Bits_86 is mod 2 ** Bits;
+ for Bits_86'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_86
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_86 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_86
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_86;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_86
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_86 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_86
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_86;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_86;
diff --git a/gcc/ada/libgnat/s-pack87.adb b/gcc/ada/libgnat/s-pack87.adb
new file mode 100644
index 0000000..8bfc7b4
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack87.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_87 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_87;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_87 --
+ ------------
+
+ function Get_87
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_87
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_87;
+
+ ------------
+ -- Set_87 --
+ ------------
+
+ procedure Set_87
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_87;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_87;
+
+end System.Pack_87;
diff --git a/gcc/ada/libgnat/s-pack87.ads b/gcc/ada/libgnat/s-pack87.ads
new file mode 100644
index 0000000..ad80713
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack87.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 87
+
+package System.Pack_87 is
+ pragma Preelaborate;
+
+ Bits : constant := 87;
+
+ type Bits_87 is mod 2 ** Bits;
+ for Bits_87'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_87
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_87 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_87
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_87;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_87;
diff --git a/gcc/ada/libgnat/s-pack88.adb b/gcc/ada/libgnat/s-pack88.adb
new file mode 100644
index 0000000..638581a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack88.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_88 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_88;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_88 or SetU_88 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_88 --
+ ------------
+
+ function Get_88
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_88
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_88;
+
+ -------------
+ -- GetU_88 --
+ -------------
+
+ function GetU_88
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_88
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_88;
+
+ ------------
+ -- Set_88 --
+ ------------
+
+ procedure Set_88
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_88;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_88;
+
+ -------------
+ -- SetU_88 --
+ -------------
+
+ procedure SetU_88
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_88;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_88;
+
+end System.Pack_88;
diff --git a/gcc/ada/libgnat/s-pack88.ads b/gcc/ada/libgnat/s-pack88.ads
new file mode 100644
index 0000000..bd38bd7
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack88.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 88
+
+package System.Pack_88 is
+ pragma Preelaborate;
+
+ Bits : constant := 88;
+
+ type Bits_88 is mod 2 ** Bits;
+ for Bits_88'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_88
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_88 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_88
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_88;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_88
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_88 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_88
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_88;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_88;
diff --git a/gcc/ada/libgnat/s-pack89.adb b/gcc/ada/libgnat/s-pack89.adb
new file mode 100644
index 0000000..eff29c0
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack89.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 9 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_89 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_89;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_89 --
+ ------------
+
+ function Get_89
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_89
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_89;
+
+ ------------
+ -- Set_89 --
+ ------------
+
+ procedure Set_89
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_89;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_89;
+
+end System.Pack_89;
diff --git a/gcc/ada/libgnat/s-pack89.ads b/gcc/ada/libgnat/s-pack89.ads
new file mode 100644
index 0000000..5ab8102
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack89.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 8 9 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 89
+
+package System.Pack_89 is
+ pragma Preelaborate;
+
+ Bits : constant := 89;
+
+ type Bits_89 is mod 2 ** Bits;
+ for Bits_89'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_89
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_89 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_89
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_89;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_89;
diff --git a/gcc/ada/libgnat/s-pack90.adb b/gcc/ada/libgnat/s-pack90.adb
new file mode 100644
index 0000000..bed4845
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack90.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 0 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_90 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_90;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_90 or SetU_90 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_90 --
+ ------------
+
+ function Get_90
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_90
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_90;
+
+ -------------
+ -- GetU_90 --
+ -------------
+
+ function GetU_90
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_90
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_90;
+
+ ------------
+ -- Set_90 --
+ ------------
+
+ procedure Set_90
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_90;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_90;
+
+ -------------
+ -- SetU_90 --
+ -------------
+
+ procedure SetU_90
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_90;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_90;
+
+end System.Pack_90;
diff --git a/gcc/ada/libgnat/s-pack90.ads b/gcc/ada/libgnat/s-pack90.ads
new file mode 100644
index 0000000..2960293
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack90.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 0 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 90
+
+package System.Pack_90 is
+ pragma Preelaborate;
+
+ Bits : constant := 90;
+
+ type Bits_90 is mod 2 ** Bits;
+ for Bits_90'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_90
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_90 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_90
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_90;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_90
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_90 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_90
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_90;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_90;
diff --git a/gcc/ada/libgnat/s-pack91.adb b/gcc/ada/libgnat/s-pack91.adb
new file mode 100644
index 0000000..25c9f14
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack91.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 1 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_91 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_91;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_91 --
+ ------------
+
+ function Get_91
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_91
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_91;
+
+ ------------
+ -- Set_91 --
+ ------------
+
+ procedure Set_91
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_91;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_91;
+
+end System.Pack_91;
diff --git a/gcc/ada/libgnat/s-pack91.ads b/gcc/ada/libgnat/s-pack91.ads
new file mode 100644
index 0000000..065c1b5
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack91.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 1 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 91
+
+package System.Pack_91 is
+ pragma Preelaborate;
+
+ Bits : constant := 91;
+
+ type Bits_91 is mod 2 ** Bits;
+ for Bits_91'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_91
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_91 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_91
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_91;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_91;
diff --git a/gcc/ada/libgnat/s-pack92.adb b/gcc/ada/libgnat/s-pack92.adb
new file mode 100644
index 0000000..b9ea0a6
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack92.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 2 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_92 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_92;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_92 or SetU_92 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_92 --
+ ------------
+
+ function Get_92
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_92
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_92;
+
+ -------------
+ -- GetU_92 --
+ -------------
+
+ function GetU_92
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_92
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_92;
+
+ ------------
+ -- Set_92 --
+ ------------
+
+ procedure Set_92
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_92;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_92;
+
+ -------------
+ -- SetU_92 --
+ -------------
+
+ procedure SetU_92
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_92;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_92;
+
+end System.Pack_92;
diff --git a/gcc/ada/libgnat/s-pack92.ads b/gcc/ada/libgnat/s-pack92.ads
new file mode 100644
index 0000000..5184bc6
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack92.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 2 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 92
+
+package System.Pack_92 is
+ pragma Preelaborate;
+
+ Bits : constant := 92;
+
+ type Bits_92 is mod 2 ** Bits;
+ for Bits_92'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_92
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_92 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_92
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_92;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_92
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_92 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_92
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_92;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_92;
diff --git a/gcc/ada/libgnat/s-pack93.adb b/gcc/ada/libgnat/s-pack93.adb
new file mode 100644
index 0000000..1fe486c
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack93.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 3 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_93 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_93;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_93 --
+ ------------
+
+ function Get_93
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_93
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_93;
+
+ ------------
+ -- Set_93 --
+ ------------
+
+ procedure Set_93
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_93;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_93;
+
+end System.Pack_93;
diff --git a/gcc/ada/libgnat/s-pack93.ads b/gcc/ada/libgnat/s-pack93.ads
new file mode 100644
index 0000000..618ab64
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack93.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 3 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 93
+
+package System.Pack_93 is
+ pragma Preelaborate;
+
+ Bits : constant := 93;
+
+ type Bits_93 is mod 2 ** Bits;
+ for Bits_93'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_93
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_93 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_93
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_93;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_93;
diff --git a/gcc/ada/libgnat/s-pack94.adb b/gcc/ada/libgnat/s-pack94.adb
new file mode 100644
index 0000000..5a65908
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack94.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 4 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_94 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_94;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_94 or SetU_94 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_94 --
+ ------------
+
+ function Get_94
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_94
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_94;
+
+ -------------
+ -- GetU_94 --
+ -------------
+
+ function GetU_94
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_94
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_94;
+
+ ------------
+ -- Set_94 --
+ ------------
+
+ procedure Set_94
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_94;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_94;
+
+ -------------
+ -- SetU_94 --
+ -------------
+
+ procedure SetU_94
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_94;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_94;
+
+end System.Pack_94;
diff --git a/gcc/ada/libgnat/s-pack94.ads b/gcc/ada/libgnat/s-pack94.ads
new file mode 100644
index 0000000..692a4dc
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack94.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 4 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 94
+
+package System.Pack_94 is
+ pragma Preelaborate;
+
+ Bits : constant := 94;
+
+ type Bits_94 is mod 2 ** Bits;
+ for Bits_94'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_94
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_94 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_94
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_94;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_94
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_94 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_94
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_94;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_94;
diff --git a/gcc/ada/libgnat/s-pack95.adb b/gcc/ada/libgnat/s-pack95.adb
new file mode 100644
index 0000000..f8d6be6
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack95.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 5 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_95 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_95;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_95 --
+ ------------
+
+ function Get_95
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_95
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_95;
+
+ ------------
+ -- Set_95 --
+ ------------
+
+ procedure Set_95
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_95;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_95;
+
+end System.Pack_95;
diff --git a/gcc/ada/libgnat/s-pack95.ads b/gcc/ada/libgnat/s-pack95.ads
new file mode 100644
index 0000000..288a787
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack95.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 5 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 95
+
+package System.Pack_95 is
+ pragma Preelaborate;
+
+ Bits : constant := 95;
+
+ type Bits_95 is mod 2 ** Bits;
+ for Bits_95'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_95
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_95 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_95
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_95;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_95;
diff --git a/gcc/ada/libgnat/s-pack96.adb b/gcc/ada/libgnat/s-pack96.adb
new file mode 100644
index 0000000..1371ee1
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack96.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 6 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_96 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_96;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_96 or SetU_96 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_96 --
+ ------------
+
+ function Get_96
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_96
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_96;
+
+ -------------
+ -- GetU_96 --
+ -------------
+
+ function GetU_96
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_96
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_96;
+
+ ------------
+ -- Set_96 --
+ ------------
+
+ procedure Set_96
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_96;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_96;
+
+ -------------
+ -- SetU_96 --
+ -------------
+
+ procedure SetU_96
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_96;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_96;
+
+end System.Pack_96;
diff --git a/gcc/ada/libgnat/s-pack96.ads b/gcc/ada/libgnat/s-pack96.ads
new file mode 100644
index 0000000..355f00a
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack96.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 6 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 96
+
+package System.Pack_96 is
+ pragma Preelaborate;
+
+ Bits : constant := 96;
+
+ type Bits_96 is mod 2 ** Bits;
+ for Bits_96'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_96
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_96 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_96
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_96;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_96
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_96 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_96
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_96;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_96;
diff --git a/gcc/ada/libgnat/s-pack97.adb b/gcc/ada/libgnat/s-pack97.adb
new file mode 100644
index 0000000..000f8ed
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack97.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 7 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_97 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_97;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_97 --
+ ------------
+
+ function Get_97
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_97
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_97;
+
+ ------------
+ -- Set_97 --
+ ------------
+
+ procedure Set_97
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_97;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_97;
+
+end System.Pack_97;
diff --git a/gcc/ada/libgnat/s-pack97.ads b/gcc/ada/libgnat/s-pack97.ads
new file mode 100644
index 0000000..4c8a936
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack97.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 7 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 97
+
+package System.Pack_97 is
+ pragma Preelaborate;
+
+ Bits : constant := 97;
+
+ type Bits_97 is mod 2 ** Bits;
+ for Bits_97'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_97
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_97 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_97
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_97;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_97;
diff --git a/gcc/ada/libgnat/s-pack98.adb b/gcc/ada/libgnat/s-pack98.adb
new file mode 100644
index 0000000..1ac4c66
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack98.adb
@@ -0,0 +1,250 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 8 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_98 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_98;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ -- The following declarations are for the case where the address
+ -- passed to GetU_98 or SetU_98 is not guaranteed to be aligned.
+ -- These routines are used when the packed array is itself a
+ -- component of a packed record, and therefore may not be aligned.
+
+ type ClusterU is new Cluster;
+ for ClusterU'Alignment use 1;
+
+ type ClusterU_Ref is access ClusterU;
+
+ type Rev_ClusterU is new ClusterU
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_ClusterU_Ref is access Rev_ClusterU;
+
+ ------------
+ -- Get_98 --
+ ------------
+
+ function Get_98
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_98
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_98;
+
+ -------------
+ -- GetU_98 --
+ -------------
+
+ function GetU_98
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_98
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end GetU_98;
+
+ ------------
+ -- Set_98 --
+ ------------
+
+ procedure Set_98
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_98;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_98;
+
+ -------------
+ -- SetU_98 --
+ -------------
+
+ procedure SetU_98
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_98;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : ClusterU_Ref with Address => A'Address, Import;
+ RC : Rev_ClusterU_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end SetU_98;
+
+end System.Pack_98;
diff --git a/gcc/ada/libgnat/s-pack98.ads b/gcc/ada/libgnat/s-pack98.ads
new file mode 100644
index 0000000..239eca1
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack98.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 8 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 98
+
+package System.Pack_98 is
+ pragma Preelaborate;
+
+ Bits : constant := 98;
+
+ type Bits_98 is mod 2 ** Bits;
+ for Bits_98'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_98
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_98 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_98
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_98;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+ function GetU_98
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_98 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned. This version
+ -- is used when Arr may represent an unaligned address.
+
+ procedure SetU_98
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_98;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value. This version
+ -- is used when Arr may represent an unaligned address
+
+end System.Pack_98;
diff --git a/gcc/ada/libgnat/s-pack99.adb b/gcc/ada/libgnat/s-pack99.adb
new file mode 100644
index 0000000..a8bde88
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack99.adb
@@ -0,0 +1,157 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 9 --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Storage_Elements;
+with System.Unsigned_Types;
+
+package body System.Pack_99 is
+
+ subtype Bit_Order is System.Bit_Order;
+ Reverse_Bit_Order : constant Bit_Order :=
+ Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
+ subtype Ofs is System.Storage_Elements.Storage_Offset;
+ subtype Uns is System.Unsigned_Types.Unsigned;
+ subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
+
+ use type System.Storage_Elements.Storage_Offset;
+ use type System.Unsigned_Types.Unsigned;
+
+ type Cluster is record
+ E0, E1, E2, E3, E4, E5, E6, E7 : Bits_99;
+ end record;
+
+ for Cluster use record
+ E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1;
+ E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1;
+ E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1;
+ E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1;
+ E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1;
+ E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1;
+ E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1;
+ E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1;
+ end record;
+
+ for Cluster'Size use Bits * 8;
+
+ for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment,
+ 1 +
+ 1 * Boolean'Pos (Bits mod 2 = 0) +
+ 2 * Boolean'Pos (Bits mod 4 = 0));
+ -- Use maximum possible alignment, given the bit field size, since this
+ -- will result in the most efficient code possible for the field.
+
+ type Cluster_Ref is access Cluster;
+
+ type Rev_Cluster is new Cluster
+ with Bit_Order => Reverse_Bit_Order,
+ Scalar_Storage_Order => Reverse_Bit_Order;
+ type Rev_Cluster_Ref is access Rev_Cluster;
+
+ ------------
+ -- Get_99 --
+ ------------
+
+ function Get_99
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_99
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => return RC.E0;
+ when 1 => return RC.E1;
+ when 2 => return RC.E2;
+ when 3 => return RC.E3;
+ when 4 => return RC.E4;
+ when 5 => return RC.E5;
+ when 6 => return RC.E6;
+ when 7 => return RC.E7;
+ end case;
+
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => return C.E0;
+ when 1 => return C.E1;
+ when 2 => return C.E2;
+ when 3 => return C.E3;
+ when 4 => return C.E4;
+ when 5 => return C.E5;
+ when 6 => return C.E6;
+ when 7 => return C.E7;
+ end case;
+ end if;
+ end Get_99;
+
+ ------------
+ -- Set_99 --
+ ------------
+
+ procedure Set_99
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_99;
+ Rev_SSO : Boolean)
+ is
+ A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+ C : Cluster_Ref with Address => A'Address, Import;
+ RC : Rev_Cluster_Ref with Address => A'Address, Import;
+ begin
+ if Rev_SSO then
+ case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0 := E;
+ when 1 => RC.E1 := E;
+ when 2 => RC.E2 := E;
+ when 3 => RC.E3 := E;
+ when 4 => RC.E4 := E;
+ when 5 => RC.E5 := E;
+ when 6 => RC.E6 := E;
+ when 7 => RC.E7 := E;
+ end case;
+ else
+ case N07 (Uns (N) mod 8) is
+ when 0 => C.E0 := E;
+ when 1 => C.E1 := E;
+ when 2 => C.E2 := E;
+ when 3 => C.E3 := E;
+ when 4 => C.E4 := E;
+ when 5 => C.E5 := E;
+ when 6 => C.E6 := E;
+ when 7 => C.E7 := E;
+ end case;
+ end if;
+ end Set_99;
+
+end System.Pack_99;
diff --git a/gcc/ada/libgnat/s-pack99.ads b/gcc/ada/libgnat/s-pack99.ads
new file mode 100644
index 0000000..fa805c4
--- /dev/null
+++ b/gcc/ada/libgnat/s-pack99.ads
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . P A C K _ 9 9 --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Handling of packed arrays with Component_Size = 99
+
+package System.Pack_99 is
+ pragma Preelaborate;
+
+ Bits : constant := 99;
+
+ type Bits_99 is mod 2 ** Bits;
+ for Bits_99'Size use Bits;
+
+ -- In all subprograms below, Rev_SSO is set True if the array has the
+ -- non-default scalar storage order.
+
+ function Get_99
+ (Arr : System.Address;
+ N : Natural;
+ Rev_SSO : Boolean) return Bits_99 with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is extracted and returned.
+
+ procedure Set_99
+ (Arr : System.Address;
+ N : Natural;
+ E : Bits_99;
+ Rev_SSO : Boolean) with Inline;
+ -- Arr is the address of the packed array, N is the zero-based
+ -- subscript. This element is set to the given value.
+
+end System.Pack_99;
diff --git a/gcc/ada/libgnat/s-putima.adb b/gcc/ada/libgnat/s-putima.adb
index 4ae612d..925c3b9 100644
--- a/gcc/ada/libgnat/s-putima.adb
+++ b/gcc/ada/libgnat/s-putima.adb
@@ -93,21 +93,30 @@ package body System.Put_Images is
end Generic_Integer_Images;
- package Small is new Generic_Integer_Images (Integer, Unsigned, Base => 10);
- package Large is new Generic_Integer_Images
+ package Integer_Images is new Generic_Integer_Images
+ (Integer, Unsigned, Base => 10);
+ package LL_Integer_Images is new Generic_Integer_Images
(Long_Long_Integer, Long_Long_Unsigned, Base => 10);
+ package LLL_Integer_Images is new Generic_Integer_Images
+ (Long_Long_Long_Integer, Long_Long_Long_Unsigned, Base => 10);
procedure Put_Image_Integer (S : in out Sink'Class; X : Integer)
- renames Small.Put_Image;
+ renames Integer_Images.Put_Image;
procedure Put_Image_Long_Long_Integer
(S : in out Sink'Class; X : Long_Long_Integer)
- renames Large.Put_Image;
+ renames LL_Integer_Images.Put_Image;
+ procedure Put_Image_Long_Long_Long_Integer
+ (S : in out Sink'Class; X : Long_Long_Long_Integer)
+ renames LLL_Integer_Images.Put_Image;
procedure Put_Image_Unsigned (S : in out Sink'Class; X : Unsigned)
- renames Small.Put_Image;
+ renames Integer_Images.Put_Image;
procedure Put_Image_Long_Long_Unsigned
(S : in out Sink'Class; X : Long_Long_Unsigned)
- renames Large.Put_Image;
+ renames LL_Integer_Images.Put_Image;
+ procedure Put_Image_Long_Long_Long_Unsigned
+ (S : in out Sink'Class; X : Long_Long_Long_Unsigned)
+ renames LLL_Integer_Images.Put_Image;
type Signed_Address is range
-2**(Standard'Address_Size - 1) .. 2**(Standard'Address_Size - 1) - 1;
@@ -250,6 +259,11 @@ package body System.Put_Images is
Put_7bit (S, ')');
end Record_After;
+ procedure Put_Arrow (S : in out Sink'Class) is
+ begin
+ Put_UTF_8 (S, " => ");
+ end Put_Arrow;
+
procedure Put_Image_Unknown (S : in out Sink'Class; Type_Name : String) is
begin
Put_UTF_8 (S, "{");
diff --git a/gcc/ada/libgnat/s-putima.ads b/gcc/ada/libgnat/s-putima.ads
index 17e184a..1d2a11d 100644
--- a/gcc/ada/libgnat/s-putima.ads
+++ b/gcc/ada/libgnat/s-putima.ads
@@ -32,15 +32,16 @@
with Ada.Strings.Text_Output;
with System.Unsigned_Types;
-package System.Put_Images is
+package System.Put_Images with Pure is
-- This package contains subprograms that are called by the generated code
-- for the 'Put_Image attribute.
--
- -- For an integer type that fits in Integer, the actual parameter is
+ -- For a signed integer type that fits in Integer, the actual parameter is
-- converted to Integer, and Put_Image_Integer is called. For larger types,
- -- Put_Image_Long_Long_Integer is used. Other numeric types are treated
- -- similarly. Access values are unchecked-converted to either Thin_Pointer
+ -- Put_Image_Long_Long_Integer or Put_Image_Long_Long_Long_Integer is used.
+ -- For a modular integer type, this is similar with Integer replaced with
+ -- Unsigned. Access values are unchecked-converted to either Thin_Pointer
-- or Fat_Pointer, and Put_Image_Thin_Pointer or Put_Image_Fat_Pointer is
-- called. The Before/Between/After procedures are called before printing
-- the components of a composite type, between pairs of components, and
@@ -54,18 +55,23 @@ package System.Put_Images is
procedure Put_Image_Integer (S : in out Sink'Class; X : Integer);
procedure Put_Image_Long_Long_Integer
(S : in out Sink'Class; X : Long_Long_Integer);
+ procedure Put_Image_Long_Long_Long_Integer
+ (S : in out Sink'Class; X : Long_Long_Long_Integer);
- subtype Unsigned is System.Unsigned_Types.Unsigned;
- subtype Long_Long_Unsigned is System.Unsigned_Types.Long_Long_Unsigned;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
procedure Put_Image_Unsigned (S : in out Sink'Class; X : Unsigned);
procedure Put_Image_Long_Long_Unsigned
(S : in out Sink'Class; X : Long_Long_Unsigned);
+ procedure Put_Image_Long_Long_Long_Unsigned
+ (S : in out Sink'Class; X : Long_Long_Long_Unsigned);
type Byte is new Character with Alignment => 1;
type Byte_String is array (Positive range <>) of Byte with Alignment => 1;
- type Thin_Pointer is access all Byte;
- type Fat_Pointer is access all Byte_String;
+ type Thin_Pointer is access all Byte with Storage_Size => 0;
+ type Fat_Pointer is access all Byte_String with Storage_Size => 0;
procedure Put_Image_Thin_Pointer (S : in out Sink'Class; X : Thin_Pointer);
procedure Put_Image_Fat_Pointer (S : in out Sink'Class; X : Fat_Pointer);
-- Print "null", or the address of the designated object as an unsigned
@@ -95,6 +101,8 @@ package System.Put_Images is
procedure Record_Between (S : in out Sink'Class);
procedure Record_After (S : in out Sink'Class);
+ procedure Put_Arrow (S : in out Sink'Class);
+
procedure Put_Image_Unknown (S : in out Sink'Class; Type_Name : String);
-- For Put_Image of types that don't have the attribute, such as type
-- Sink.
diff --git a/gcc/ada/libgnat/s-rannum.adb b/gcc/ada/libgnat/s-rannum.adb
index 01a6e91..e65e6a7 100644
--- a/gcc/ada/libgnat/s-rannum.adb
+++ b/gcc/ada/libgnat/s-rannum.adb
@@ -387,6 +387,12 @@ is
or Unsigned_64 (Unsigned_32'(Random (Gen)));
end Random;
+ function Random (Gen : Generator) return Unsigned_128 is
+ begin
+ return Shift_Left (Unsigned_128 (Unsigned_64'(Random (Gen))), 64)
+ or Unsigned_128 (Unsigned_64'(Random (Gen)));
+ end Random;
+
---------------------
-- Random_Discrete --
---------------------
diff --git a/gcc/ada/libgnat/s-rannum.ads b/gcc/ada/libgnat/s-rannum.ads
index 1851b69..6cbba3e 100644
--- a/gcc/ada/libgnat/s-rannum.ads
+++ b/gcc/ada/libgnat/s-rannum.ads
@@ -76,6 +76,7 @@ is
function Random (Gen : Generator) return Interfaces.Unsigned_32;
function Random (Gen : Generator) return Interfaces.Unsigned_64;
+ function Random (Gen : Generator) return Interfaces.Unsigned_128;
-- Return pseudo-random numbers uniformly distributed on T'First .. T'Last
-- for builtin integer types.
diff --git a/gcc/ada/libgnat/s-rident.ads b/gcc/ada/libgnat/s-rident.ads
index afec9a4..662721a 100644
--- a/gcc/ada/libgnat/s-rident.ads
+++ b/gcc/ada/libgnat/s-rident.ads
@@ -551,9 +551,10 @@ package System.Rident is
Max_Task_Entries => 0,
others => 0)),
- Jorvik =>
+ Jorvik | GNAT_Extended_Ravenscar =>
- -- Restrictions for Jorvik profile ..
+ -- Restrictions for Jorvik profile, previously known
+ -- known as the GNAT_Extended_Ravenscar profile.
-- Note: the table entries here only represent the
-- required restriction profile for Jorvik. The
@@ -567,7 +568,12 @@ package System.Rident is
-- as follows:
-- 1) Ravenscar includes restriction Simple_Barriers;
-- Jorvik includes Pure_Barriers instead.
- -- 2) The following 6 restrictions are included in
+ -- 2) The No_Implicit_Heap_Allocations restriction is
+ -- lifted and replaced with the following
+ -- restrictions:
+ -- No_Implicit_Task_Allocations
+ -- No_Implicit_Protected_Object_Allocations
+ -- 3) The following 6 restrictions are included in
-- Ravenscar but not in Jorvik:
-- No_Implicit_Heap_Allocations
-- No_Relative_Delay
@@ -598,45 +604,6 @@ package System.Rident is
-- plus these additional restrictions:
- No_Local_Timing_Events => True,
- No_Select_Statements => True,
- No_Specific_Termination_Handlers => True,
- No_Task_Termination => True,
- Pure_Barriers => True,
- others => False),
-
- -- Value settings for Ravenscar (same as Restricted)
-
- Value =>
- (Max_Asynchronous_Select_Nesting => 0,
- Max_Select_Alternatives => 0,
- Max_Task_Entries => 0,
- others => 0)),
-
- GNAT_Extended_Ravenscar =>
-
- -- Restrictions for GNAT_Extended_Ravenscar =
- -- Restricted profile ..
-
- (Set =>
- (No_Abort_Statements => True,
- No_Asynchronous_Control => True,
- No_Dynamic_Attachment => True,
- No_Dynamic_CPU_Assignment => True,
- No_Dynamic_Priorities => True,
- No_Local_Protected_Objects => True,
- No_Protected_Type_Allocators => True,
- No_Requeue_Statements => True,
- No_Task_Allocators => True,
- No_Task_Attributes_Package => True,
- No_Task_Hierarchy => True,
- No_Terminate_Alternatives => True,
- Max_Asynchronous_Select_Nesting => True,
- Max_Select_Alternatives => True,
- Max_Task_Entries => True,
-
- -- plus these additional restrictions:
-
No_Implicit_Task_Allocations => True,
No_Implicit_Protected_Object_Allocations
=> True,
diff --git a/gcc/ada/libgnat/s-scaval.adb b/gcc/ada/libgnat/s-scaval.adb
index 9815fbd..5a88111 100644
--- a/gcc/ada/libgnat/s-scaval.adb
+++ b/gcc/ada/libgnat/s-scaval.adb
@@ -33,6 +33,8 @@ with Ada.Unchecked_Conversion;
package body System.Scalar_Values is
+ use Interfaces;
+
----------------
-- Initialize --
----------------
diff --git a/gcc/ada/libgnat/s-scaval.ads b/gcc/ada/libgnat/s-scaval.ads
index bd9c9c5..6d13262 100644
--- a/gcc/ada/libgnat/s-scaval.ads
+++ b/gcc/ada/libgnat/s-scaval.ads
@@ -35,6 +35,8 @@
-- are used by the generated code, which are linked to the actual values
-- by the use of pragma Import.
+with Interfaces;
+
package System.Scalar_Values is
-- Note: logically this package should be Pure since it can be accessed
@@ -43,10 +45,10 @@ package System.Scalar_Values is
-- access this from generated code, and the compiler knows that it is
-- OK to access this unit from generated code.
- type Byte1 is mod 2 ** 8;
- type Byte2 is mod 2 ** 16;
- type Byte4 is mod 2 ** 32;
- type Byte8 is mod 2 ** 64;
+ subtype Byte1 is Interfaces.Unsigned_8;
+ subtype Byte2 is Interfaces.Unsigned_16;
+ subtype Byte4 is Interfaces.Unsigned_32;
+ subtype Byte8 is Interfaces.Unsigned_64;
-- The explicit initializations here are not really required, since these
-- variables are always set by System.Scalar_Values.Initialize.
diff --git a/gcc/ada/libgnat/s-scaval__128.adb b/gcc/ada/libgnat/s-scaval__128.adb
new file mode 100644
index 0000000..53110c2
--- /dev/null
+++ b/gcc/ada/libgnat/s-scaval__128.adb
@@ -0,0 +1,342 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . S C A L A R _ V A L U E S --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2003-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with Ada.Unchecked_Conversion;
+
+package body System.Scalar_Values is
+
+ use Interfaces;
+
+ ----------------
+ -- Initialize --
+ ----------------
+
+ procedure Initialize (Mode1 : Character; Mode2 : Character) is
+ C1 : Character := Mode1;
+ C2 : Character := Mode2;
+
+ procedure Get_Env_Value_Ptr (Name, Length, Ptr : Address);
+ pragma Import (C, Get_Env_Value_Ptr, "__gnat_getenv");
+
+ subtype String2 is String (1 .. 2);
+ type String2_Ptr is access all String2;
+
+ Env_Value_Ptr : aliased String2_Ptr;
+ Env_Value_Length : aliased Integer;
+
+ EV_Val : aliased constant String :=
+ "GNAT_INIT_SCALARS" & ASCII.NUL;
+
+ B : Byte1;
+
+ EFloat : constant Boolean := Long_Long_Float'Size > Long_Float'Size;
+ -- Set True if we are on an x86 with 96-bit floats for extended
+
+ AFloat : constant Boolean :=
+ Long_Float'Size = 48 and then Long_Long_Float'Size = 48;
+ -- Set True if we are on an AAMP with 48-bit extended floating point
+
+ type ByteLF is array (0 .. 7 - 2 * Boolean'Pos (AFloat)) of Byte1;
+
+ for ByteLF'Component_Size use 8;
+
+ -- Type used to hold Long_Float values on all targets and to initialize
+ -- 48-bit Long_Float values used on AAMP. On AAMP, this type is 6 bytes.
+ -- On other targets the type is 8 bytes, and type Byte8 is used for
+ -- values that are then converted to ByteLF.
+
+ pragma Warnings (Off); -- why ???
+ function To_ByteLF is new Ada.Unchecked_Conversion (Byte8, ByteLF);
+ pragma Warnings (On);
+
+ type ByteLLF is
+ array (0 .. 7 + 4 * Boolean'Pos (EFloat) - 2 * Boolean'Pos (AFloat))
+ of Byte1;
+
+ for ByteLLF'Component_Size use 8;
+
+ -- Type used to initialize Long_Long_Float values used on x86 and
+ -- any other target with the same 80-bit floating-point values that
+ -- GCC always stores in 96-bits. Note that we are assuming Intel
+ -- format little-endian addressing for this type. On non-Intel
+ -- architectures, this is the same length as Byte8 and holds
+ -- a Long_Float value.
+
+ -- The following variables are used to initialize the float values
+ -- by overlay. We can't assign directly to the float values, since
+ -- we may be assigning signalling Nan's that will cause a trap if
+ -- loaded into a floating-point register.
+
+ IV_Isf : aliased Byte4; -- Initialize short float
+ IV_Ifl : aliased Byte4; -- Initialize float
+ IV_Ilf : aliased ByteLF; -- Initialize long float
+ IV_Ill : aliased ByteLLF; -- Initialize long long float
+
+ for IV_Isf'Address use IS_Isf'Address;
+ for IV_Ifl'Address use IS_Ifl'Address;
+ for IV_Ilf'Address use IS_Ilf'Address;
+ for IV_Ill'Address use IS_Ill'Address;
+
+ -- The following pragmas are used to suppress initialization
+
+ pragma Import (Ada, IV_Isf);
+ pragma Import (Ada, IV_Ifl);
+ pragma Import (Ada, IV_Ilf);
+ pragma Import (Ada, IV_Ill);
+
+ begin
+ -- Acquire environment variable value if necessary
+
+ if C1 = 'E' and then C2 = 'V' then
+ Get_Env_Value_Ptr
+ (EV_Val'Address, Env_Value_Length'Address, Env_Value_Ptr'Address);
+
+ -- Ignore if length is not 2
+
+ if Env_Value_Length /= 2 then
+ C1 := 'I';
+ C2 := 'N';
+
+ -- Length is 2, see if it is a valid value
+
+ else
+ -- Acquire two characters and fold to upper case
+
+ C1 := Env_Value_Ptr (1);
+ C2 := Env_Value_Ptr (2);
+
+ if C1 in 'a' .. 'z' then
+ C1 := Character'Val (Character'Pos (C1) - 32);
+ end if;
+
+ if C2 in 'a' .. 'z' then
+ C2 := Character'Val (Character'Pos (C2) - 32);
+ end if;
+
+ -- IN/LO/HI are ok values
+
+ if (C1 = 'I' and then C2 = 'N')
+ or else
+ (C1 = 'L' and then C2 = 'O')
+ or else
+ (C1 = 'H' and then C2 = 'I')
+ then
+ null;
+
+ -- Try for valid hex digits
+
+ elsif (C1 in '0' .. '9' or else C1 in 'A' .. 'Z')
+ or else
+ (C2 in '0' .. '9' or else C2 in 'A' .. 'Z')
+ then
+ null;
+
+ -- Otherwise environment value is bad, ignore and use IN (invalid)
+
+ else
+ C1 := 'I';
+ C2 := 'N';
+ end if;
+ end if;
+ end if;
+
+ -- IN (invalid value)
+
+ if C1 = 'I' and then C2 = 'N' then
+ IS_Is1 := 16#80#;
+ IS_Is2 := 16#8000#;
+ IS_Is4 := 16#8000_0000#;
+ IS_Is8 := 16#8000_0000_0000_0000#;
+ IS_Is16 := 16#8000_0000_0000_0000_0000_0000_0000_0000#;
+
+ IS_Iu1 := 16#FF#;
+ IS_Iu2 := 16#FFFF#;
+ IS_Iu4 := 16#FFFF_FFFF#;
+ IS_Iu8 := 16#FFFF_FFFF_FFFF_FFFF#;
+ IS_Iu16 := 16#FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF#;
+
+ IS_Iz1 := 16#00#;
+ IS_Iz2 := 16#0000#;
+ IS_Iz4 := 16#0000_0000#;
+ IS_Iz8 := 16#0000_0000_0000_0000#;
+ IS_Iz16 := 16#0000_0000_0000_0000_0000_0000_0000_0000#;
+
+ if AFloat then
+ IV_Isf := 16#FFFF_FF00#;
+ IV_Ifl := 16#FFFF_FF00#;
+ IV_Ilf := (0, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#);
+
+ else
+ IV_Isf := IS_Iu4;
+ IV_Ifl := IS_Iu4;
+ IV_Ilf := To_ByteLF (IS_Iu8);
+ end if;
+
+ if EFloat then
+ IV_Ill := (0, 0, 0, 0, 0, 0, 0, 16#C0#, 16#FF#, 16#FF#, 0, 0);
+ end if;
+
+ -- LO (Low values)
+
+ elsif C1 = 'L' and then C2 = 'O' then
+ IS_Is1 := 16#80#;
+ IS_Is2 := 16#8000#;
+ IS_Is4 := 16#8000_0000#;
+ IS_Is8 := 16#8000_0000_0000_0000#;
+ IS_Is16 := 16#8000_0000_0000_0000_0000_0000_0000_0000#;
+
+ IS_Iu1 := 16#00#;
+ IS_Iu2 := 16#0000#;
+ IS_Iu4 := 16#0000_0000#;
+ IS_Iu8 := 16#0000_0000_0000_0000#;
+ IS_Iu16 := 16#0000_0000_0000_0000_0000_0000_0000_0000#;
+
+ IS_Iz1 := 16#00#;
+ IS_Iz2 := 16#0000#;
+ IS_Iz4 := 16#0000_0000#;
+ IS_Iz8 := 16#0000_0000_0000_0000#;
+ IS_Iz16 := 16#0000_0000_0000_0000_0000_0000_0000_0000#;
+
+ if AFloat then
+ IV_Isf := 16#0000_0001#;
+ IV_Ifl := 16#0000_0001#;
+ IV_Ilf := (1, 0, 0, 0, 0, 0);
+
+ else
+ IV_Isf := 16#FF80_0000#;
+ IV_Ifl := 16#FF80_0000#;
+ IV_Ilf := To_ByteLF (16#FFF0_0000_0000_0000#);
+ end if;
+
+ if EFloat then
+ IV_Ill := (0, 0, 0, 0, 0, 0, 0, 16#80#, 16#FF#, 16#FF#, 0, 0);
+ end if;
+
+ -- HI (High values)
+
+ elsif C1 = 'H' and then C2 = 'I' then
+ IS_Is1 := 16#7F#;
+ IS_Is2 := 16#7FFF#;
+ IS_Is4 := 16#7FFF_FFFF#;
+ IS_Is8 := 16#7FFF_FFFF_FFFF_FFFF#;
+ IS_Is16 := 16#7FFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF#;
+
+ IS_Iu1 := 16#FF#;
+ IS_Iu2 := 16#FFFF#;
+ IS_Iu4 := 16#FFFF_FFFF#;
+ IS_Iu8 := 16#FFFF_FFFF_FFFF_FFFF#;
+ IS_Iu16 := 16#FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF#;
+
+ IS_Iz1 := 16#FF#;
+ IS_Iz2 := 16#FFFF#;
+ IS_Iz4 := 16#FFFF_FFFF#;
+ IS_Iz8 := 16#FFFF_FFFF_FFFF_FFFF#;
+ IS_Iz16 := 16#FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF#;
+
+ if AFloat then
+ IV_Isf := 16#7FFF_FFFF#;
+ IV_Ifl := 16#7FFF_FFFF#;
+ IV_Ilf := (16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#FF#, 16#7F#);
+
+ else
+ IV_Isf := 16#7F80_0000#;
+ IV_Ifl := 16#7F80_0000#;
+ IV_Ilf := To_ByteLF (16#7FF0_0000_0000_0000#);
+ end if;
+
+ if EFloat then
+ IV_Ill := (0, 0, 0, 0, 0, 0, 0, 16#80#, 16#FF#, 16#7F#, 0, 0);
+ end if;
+
+ -- -Shh (hex byte)
+
+ else
+ -- Convert the two hex digits (we know they are valid here)
+
+ B := 16 * (Character'Pos (C1)
+ - (if C1 in '0' .. '9'
+ then Character'Pos ('0')
+ else Character'Pos ('A') - 10))
+ + (Character'Pos (C2)
+ - (if C2 in '0' .. '9'
+ then Character'Pos ('0')
+ else Character'Pos ('A') - 10));
+
+ -- Initialize data values from the hex value
+
+ IS_Is1 := B;
+ IS_Is2 := 2**8 * Byte2 (IS_Is1) + Byte2 (IS_Is1);
+ IS_Is4 := 2**16 * Byte4 (IS_Is2) + Byte4 (IS_Is2);
+ IS_Is8 := 2**32 * Byte8 (IS_Is4) + Byte8 (IS_Is4);
+ IS_Is16 := 2**64 * Byte16 (IS_Is8) + Byte16 (IS_Is8);
+
+ IS_Iu1 := IS_Is1;
+ IS_Iu2 := IS_Is2;
+ IS_Iu4 := IS_Is4;
+ IS_Iu8 := IS_Is8;
+ IS_Iu16 := IS_Is16;
+
+ IS_Iz1 := IS_Is1;
+ IS_Iz2 := IS_Is2;
+ IS_Iz4 := IS_Is4;
+ IS_Iz8 := IS_Is8;
+ IS_Iz16 := IS_Is16;
+
+ IV_Isf := IS_Is4;
+ IV_Ifl := IS_Is4;
+
+ if AFloat then
+ IV_Ill := (B, B, B, B, B, B);
+ else
+ IV_Ilf := To_ByteLF (IS_Is8);
+ end if;
+
+ if EFloat then
+ IV_Ill := (B, B, B, B, B, B, B, B, B, B, B, B);
+ end if;
+ end if;
+
+ -- If no separate Long_Long_Float, then use Long_Float value as
+ -- Long_Long_Float initial value.
+
+ if not EFloat then
+ declare
+ pragma Warnings (Off); -- why???
+ function To_ByteLLF is
+ new Ada.Unchecked_Conversion (ByteLF, ByteLLF);
+ pragma Warnings (On);
+ begin
+ IV_Ill := To_ByteLLF (IV_Ilf);
+ end;
+ end if;
+ end Initialize;
+
+end System.Scalar_Values;
diff --git a/gcc/ada/libgnat/s-scaval__128.ads b/gcc/ada/libgnat/s-scaval__128.ads
new file mode 100644
index 0000000..8eb1b65
--- /dev/null
+++ b/gcc/ada/libgnat/s-scaval__128.ads
@@ -0,0 +1,101 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . S C A L A R _ V A L U E S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2001-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package defines the constants used for initializing scalar values
+-- when pragma Initialize_Scalars is used. The actual values are defined
+-- in the binder generated file. This package contains the Ada names that
+-- are used by the generated code, which are linked to the actual values
+-- by the use of pragma Import.
+
+-- This is the 128-bit version of the package
+
+with Interfaces;
+
+package System.Scalar_Values is
+
+ -- Note: logically this package should be Pure since it can be accessed
+ -- from pure units, but the IS_xxx variables below get set at run time,
+ -- so they have to be library level variables. In fact we only ever
+ -- access this from generated code, and the compiler knows that it is
+ -- OK to access this unit from generated code.
+
+ subtype Byte1 is Interfaces.Unsigned_8;
+ subtype Byte2 is Interfaces.Unsigned_16;
+ subtype Byte4 is Interfaces.Unsigned_32;
+ subtype Byte8 is Interfaces.Unsigned_64;
+ subtype Byte16 is Interfaces.Unsigned_128;
+
+ -- The explicit initializations here are not really required, since these
+ -- variables are always set by System.Scalar_Values.Initialize.
+
+ IS_Is1 : Byte1 := 0; -- Initialize 1 byte signed
+ IS_Is2 : Byte2 := 0; -- Initialize 2 byte signed
+ IS_Is4 : Byte4 := 0; -- Initialize 4 byte signed
+ IS_Is8 : Byte8 := 0; -- Initialize 8 byte signed
+ IS_Is16 : Byte16 := 0; -- Initialize 8 byte signed
+ -- For the above cases, the undefined value (set by the binder -Sin switch)
+ -- is the largest negative number (1 followed by all zero bits).
+
+ IS_Iu1 : Byte1 := 0; -- Initialize 1 byte unsigned
+ IS_Iu2 : Byte2 := 0; -- Initialize 2 byte unsigned
+ IS_Iu4 : Byte4 := 0; -- Initialize 4 byte unsigned
+ IS_Iu8 : Byte8 := 0; -- Initialize 8 byte unsigned
+ IS_Iu16 : Byte16 := 0; -- Initialize 8 byte unsigned
+ -- For the above cases, the undefined value (set by the binder -Sin switch)
+ -- is the largest unsigned number (all 1 bits).
+
+ IS_Iz1 : Byte1 := 0; -- Initialize 1 byte zeroes
+ IS_Iz2 : Byte2 := 0; -- Initialize 2 byte zeroes
+ IS_Iz4 : Byte4 := 0; -- Initialize 4 byte zeroes
+ IS_Iz8 : Byte8 := 0; -- Initialize 8 byte zeroes
+ IS_Iz16 : Byte16 := 0; -- Initialize 8 byte zeroes
+ -- For the above cases, the undefined value (set by the binder -Sin switch)
+ -- is the zero (all 0 bits). This is used when zero is known to be an
+ -- invalid value.
+
+ -- The float definitions are aliased, because we use overlays to set them
+
+ IS_Isf : aliased Short_Float := 0.0; -- Initialize short float
+ IS_Ifl : aliased Float := 0.0; -- Initialize float
+ IS_Ilf : aliased Long_Float := 0.0; -- Initialize long float
+ IS_Ill : aliased Long_Long_Float := 0.0; -- Initialize long long float
+
+ procedure Initialize (Mode1 : Character; Mode2 : Character);
+ -- This procedure is called from the binder when Initialize_Scalars mode
+ -- is active. The arguments are the two characters from the -S switch,
+ -- with letters forced upper case. So for example if -S5a is given, then
+ -- Mode1 will be '5' and Mode2 will be 'A'. If the parameters are EV,
+ -- then this routine reads the environment variable GNAT_INIT_SCALARS.
+ -- The possible settings are the same as those for the -S switch (except
+ -- for EV), i.e. IN/LO/HO/xx, xx = 2 hex digits. If no -S switch is given
+ -- then the default of IN (invalid values) is passed on the call.
+
+end System.Scalar_Values;
diff --git a/gcc/ada/libgnat/s-soflin.adb b/gcc/ada/libgnat/s-soflin.adb
index 7e1a557..48d1338 100644
--- a/gcc/ada/libgnat/s-soflin.adb
+++ b/gcc/ada/libgnat/s-soflin.adb
@@ -31,10 +31,6 @@
pragma Compiler_Unit_Warning;
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get an
--- infinite loop from the code within the Poll routine itself.
-
pragma Warnings (Off);
-- Disable warnings as System.Soft_Links.Initialize is not Preelaborate. It is
-- safe to with this unit as its elaboration routine will only be initializing
diff --git a/gcc/ada/libgnat/s-stalib.adb b/gcc/ada/libgnat/s-stalib.adb
index 61636d1..7c60013 100644
--- a/gcc/ada/libgnat/s-stalib.adb
+++ b/gcc/ada/libgnat/s-stalib.adb
@@ -36,10 +36,6 @@ pragma Compiler_Unit_Warning;
-- of System.Standard_Library, since this would cause order of elaboration
-- problems (Elaborate_Body would have the same problem).
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with Ada.Exceptions if polling is on.
-
pragma Warnings (Off);
-- Kill warnings from unused withs. These unused with's are here to make
-- sure the relevant units are loaded and properly elaborated.
diff --git a/gcc/ada/libgnat/s-stalib.ads b/gcc/ada/libgnat/s-stalib.ads
index 5fbedae..b6258ed 100644
--- a/gcc/ada/libgnat/s-stalib.ads
+++ b/gcc/ada/libgnat/s-stalib.ads
@@ -46,10 +46,6 @@
pragma Compiler_Unit_Warning;
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with Ada.Exceptions if polling is on.
-
with Ada.Unchecked_Conversion;
package System.Standard_Library is
diff --git a/gcc/ada/libgnat/s-stchop.adb b/gcc/ada/libgnat/s-stchop.adb
index c5c3d35..340d27b 100644
--- a/gcc/ada/libgnat/s-stchop.adb
+++ b/gcc/ada/libgnat/s-stchop.adb
@@ -61,8 +61,6 @@ package body System.Stack_Checking.Operations is
-- cache is pending, that write should be followed by a Poll to prevent
-- losing signals.
--
- -- Note: This function must be compiled with Polling turned off
- --
-- Note: on systems with real thread-local storage, Set_Stack_Info should
-- return an access value for such local storage. In those cases the cache
-- will always be up-to-date.
diff --git a/gcc/ada/libgnat/s-stchop.ads b/gcc/ada/libgnat/s-stchop.ads
index d057ddb..185301c 100644
--- a/gcc/ada/libgnat/s-stchop.ads
+++ b/gcc/ada/libgnat/s-stchop.ads
@@ -36,10 +36,6 @@ pragma Restrictions (No_Elaboration_Code);
-- We want to guarantee the absence of elaboration code because the binder
-- does not handle references to this package.
-pragma Polling (Off);
--- Turn off polling, we do not want polling to take place during stack
--- checking operations. It causes infinite loops and other problems.
-
with System.Storage_Elements;
package System.Stack_Checking.Operations is
diff --git a/gcc/ada/libgnat/s-stchop__limit.ads b/gcc/ada/libgnat/s-stchop__limit.ads
index c904606..7330676 100644
--- a/gcc/ada/libgnat/s-stchop__limit.ads
+++ b/gcc/ada/libgnat/s-stchop__limit.ads
@@ -37,10 +37,6 @@ pragma Restrictions (No_Elaboration_Code);
-- We want to guarantee the absence of elaboration code because the binder
-- does not handle references to this package.
-pragma Polling (Off);
--- Turn off polling, we do not want polling to take place during stack
--- checking operations. It causes infinite loops and other problems.
-
package System.Stack_Checking.Operations is
pragma Preelaborate;
diff --git a/gcc/ada/libgnat/s-traceb.ads b/gcc/ada/libgnat/s-traceb.ads
index 1c3151c..094218c 100644
--- a/gcc/ada/libgnat/s-traceb.ads
+++ b/gcc/ada/libgnat/s-traceb.ads
@@ -35,10 +35,6 @@
pragma Compiler_Unit_Warning;
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with System.Exception_Tables.
-
with System.Traceback_Entries;
package System.Traceback is
diff --git a/gcc/ada/libgnat/s-traent.adb b/gcc/ada/libgnat/s-traent.adb
index 950b0e5..23d174f 100644
--- a/gcc/ada/libgnat/s-traent.adb
+++ b/gcc/ada/libgnat/s-traent.adb
@@ -29,10 +29,6 @@
-- --
------------------------------------------------------------------------------
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with Ada.Exceptions.
-
pragma Compiler_Unit_Warning;
package body System.Traceback_Entries is
diff --git a/gcc/ada/libgnat/s-traent.ads b/gcc/ada/libgnat/s-traent.ads
index fa2db4e..83ef569 100644
--- a/gcc/ada/libgnat/s-traent.ads
+++ b/gcc/ada/libgnat/s-traent.ads
@@ -38,10 +38,6 @@
-- version of the package, an entry is a mere code location representing the
-- address of a call instruction part of the call-chain.
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we get
--- elaboration circularities with Ada.Exceptions.
-
pragma Compiler_Unit_Warning;
package System.Traceback_Entries is
diff --git a/gcc/ada/libgnat/s-trasym.adb b/gcc/ada/libgnat/s-trasym.adb
index 0d6639f..bfc3a98 100644
--- a/gcc/ada/libgnat/s-trasym.adb
+++ b/gcc/ada/libgnat/s-trasym.adb
@@ -33,10 +33,6 @@
-- is not supported. It returns tracebacks as lists of hexadecimal addresses
-- of the form "0x...".
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we can get
--- elaboration circularities when polling is turned on.
-
with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback;
with System.Address_Image;
diff --git a/gcc/ada/libgnat/s-trasym.ads b/gcc/ada/libgnat/s-trasym.ads
index f0240cd..e974ee9 100644
--- a/gcc/ada/libgnat/s-trasym.ads
+++ b/gcc/ada/libgnat/s-trasym.ads
@@ -71,10 +71,6 @@
-- executable. You should consider using gdb to obtain symbolic traceback in
-- such cases.
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we can get
--- elaboration circularities when polling is turned on.
-
with Ada.Exceptions;
package System.Traceback.Symbolic is
diff --git a/gcc/ada/libgnat/s-trasym__dwarf.adb b/gcc/ada/libgnat/s-trasym__dwarf.adb
index d8e3956..78cbcc2 100644
--- a/gcc/ada/libgnat/s-trasym__dwarf.adb
+++ b/gcc/ada/libgnat/s-trasym__dwarf.adb
@@ -31,10 +31,6 @@
-- Run-time symbolic traceback support for targets using DWARF debug data
-pragma Polling (Off);
--- We must turn polling off for this unit, because otherwise we can get
--- elaboration circularities when polling is turned on.
-
with Ada.Unchecked_Deallocation;
with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback;
diff --git a/gcc/ada/libgnat/s-unstyp.ads b/gcc/ada/libgnat/s-unstyp.ads
index 0f6c73c..86c5d7f 100644
--- a/gcc/ada/libgnat/s-unstyp.ads
+++ b/gcc/ada/libgnat/s-unstyp.ads
@@ -41,13 +41,14 @@ package System.Unsigned_Types is
pragma Pure;
pragma No_Elaboration_Code_All;
- type Short_Short_Unsigned is mod 2 ** Short_Short_Integer'Size;
- type Short_Unsigned is mod 2 ** Short_Integer'Size;
- type Unsigned is mod 2 ** Integer'Size;
- type Long_Unsigned is mod 2 ** Long_Integer'Size;
- type Long_Long_Unsigned is mod 2 ** Long_Long_Integer'Size;
-
- type Float_Unsigned is mod 2 ** Float'Size;
+ type Short_Short_Unsigned is mod 2 ** Short_Short_Integer'Size;
+ type Short_Unsigned is mod 2 ** Short_Integer'Size;
+ type Unsigned is mod 2 ** Integer'Size;
+ type Long_Unsigned is mod 2 ** Long_Integer'Size;
+ type Long_Long_Unsigned is mod 2 ** Long_Long_Integer'Size;
+ type Long_Long_Long_Unsigned is mod Max_Binary_Modulus;
+
+ type Float_Unsigned is mod 2 ** Float'Size;
-- Used in the implementation of Is_Negative intrinsic (see Exp_Intr)
type Packed_Byte is mod 2 ** 8;
@@ -215,6 +216,26 @@ package System.Unsigned_Types is
(Value : Long_Long_Unsigned;
Amount : Natural) return Long_Long_Unsigned;
+ function Shift_Left
+ (Value : Long_Long_Long_Unsigned;
+ Amount : Natural) return Long_Long_Long_Unsigned;
+
+ function Shift_Right
+ (Value : Long_Long_Long_Unsigned;
+ Amount : Natural) return Long_Long_Long_Unsigned;
+
+ function Shift_Right_Arithmetic
+ (Value : Long_Long_Long_Unsigned;
+ Amount : Natural) return Long_Long_Long_Unsigned;
+
+ function Rotate_Left
+ (Value : Long_Long_Long_Unsigned;
+ Amount : Natural) return Long_Long_Long_Unsigned;
+
+ function Rotate_Right
+ (Value : Long_Long_Long_Unsigned;
+ Amount : Natural) return Long_Long_Long_Unsigned;
+
pragma Import (Intrinsic, Shift_Left);
pragma Import (Intrinsic, Shift_Right);
pragma Import (Intrinsic, Shift_Right_Arithmetic);
diff --git a/gcc/ada/libgnat/s-valint.adb b/gcc/ada/libgnat/s-valint.adb
index c40d558..983d2d1 100644
--- a/gcc/ada/libgnat/s-valint.adb
+++ b/gcc/ada/libgnat/s-valint.adb
@@ -29,90 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
-with System.Val_Uns; use System.Val_Uns;
-with System.Val_Util; use System.Val_Util;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Val_Int is
-
- ------------------
- -- Scan_Integer --
- ------------------
-
- function Scan_Integer
- (Str : String;
- Ptr : not null access Integer;
- Max : Integer) return Integer
- is
- Uval : Unsigned;
- -- Unsigned result
-
- Minus : Boolean := False;
- -- Set to True if minus sign is present, otherwise to False
-
- Start : Positive;
- -- Saves location of first non-blank (not used in this case)
-
- begin
- Scan_Sign (Str, Ptr, Max, Minus, Start);
-
- if Str (Ptr.all) not in '0' .. '9' then
- Ptr.all := Start;
- Bad_Value (Str);
- end if;
-
- Uval := Scan_Raw_Unsigned (Str, Ptr, Max);
-
- -- Deal with overflow cases, and also with maximum negative number
-
- if Uval > Unsigned (Integer'Last) then
- if Minus and then Uval = Unsigned (-(Integer'First)) then
- return Integer'First;
- else
- Bad_Value (Str);
- end if;
-
- -- Negative values
-
- elsif Minus then
- return -(Integer (Uval));
-
- -- Positive values
-
- else
- return Integer (Uval);
- end if;
- end Scan_Integer;
-
- -------------------
- -- Value_Integer --
- -------------------
-
- function Value_Integer (Str : String) return Integer is
- begin
- -- We have to special case Str'Last = Positive'Last because the normal
- -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
- -- deal with this by converting to a subtype which fixes the bounds.
-
- if Str'Last = Positive'Last then
- declare
- subtype NT is String (1 .. Str'Length);
- begin
- return Value_Integer (NT (Str));
- end;
-
- -- Normal case where Str'Last < Positive'Last
-
- else
- declare
- V : Integer;
- P : aliased Integer := Str'First;
- begin
- V := Scan_Integer (Str, P'Access, Str'Last);
- Scan_Trailing_Blanks (Str, P);
- return V;
- end;
- end if;
- end Value_Integer;
-
-end System.Val_Int;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-valint.ads b/gcc/ada/libgnat/s-valint.ads
index 79571da..8a3c55e 100644
--- a/gcc/ada/libgnat/s-valint.ads
+++ b/gcc/ada/libgnat/s-valint.ads
@@ -32,42 +32,24 @@
-- This package contains routines for scanning signed Integer values for use
-- in Text_IO.Integer_IO, and the Value attribute.
+with System.Unsigned_Types;
+with System.Val_Uns;
+with System.Value_I;
+
package System.Val_Int is
pragma Preelaborate;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ package Impl is new Value_I (Integer, Unsigned, Val_Uns.Scan_Raw_Unsigned);
+
function Scan_Integer
(Str : String;
Ptr : not null access Integer;
- Max : Integer) return Integer;
- -- This function scans the string starting at Str (Ptr.all) for a valid
- -- integer according to the syntax described in (RM 3.5(43)). The substring
- -- scanned extends no further than Str (Max). There are three cases for the
- -- return:
- --
- -- If a valid integer is found after scanning past any initial spaces, then
- -- Ptr.all is updated past the last character of the integer (but trailing
- -- spaces are not scanned out).
- --
- -- If no valid integer is found, then Ptr.all points either to an initial
- -- non-digit character, or to Max + 1 if the field is all spaces and the
- -- exception Constraint_Error is raised.
- --
- -- If a syntactically valid integer is scanned, but the value is out of
- -- range, or, in the based case, the base value is out of range or there
- -- is an out of range digit, then Ptr.all points past the integer, and
- -- Constraint_Error is raised.
- --
- -- Note: these rules correspond to the requirements for leaving the pointer
- -- positioned in Text_Io.Get
- --
- -- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
- -- special case of an all-blank string, and Ptr is unchanged, and hence
- -- is greater than Max as required in this case.
+ Max : Integer) return Integer
+ renames Impl.Scan_Integer;
- function Value_Integer (Str : String) return Integer;
- -- Used in computing X'Value (Str) where X is a signed integer type whose
- -- base range does not exceed the base range of Integer. Str is the string
- -- argument of the attribute. Constraint_Error is raised if the string is
- -- malformed, or if the value is out of range.
+ function Value_Integer (Str : String) return Integer
+ renames Impl.Value_Integer;
end System.Val_Int;
diff --git a/gcc/ada/libgnat/s-vallli.adb b/gcc/ada/libgnat/s-vallli.adb
index 43bb0a7..eadab12 100644
--- a/gcc/ada/libgnat/s-vallli.adb
+++ b/gcc/ada/libgnat/s-vallli.adb
@@ -29,92 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
-with System.Val_LLU; use System.Val_LLU;
-with System.Val_Util; use System.Val_Util;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Val_LLI is
-
- ----------------------------
- -- Scan_Long_Long_Integer --
- ----------------------------
-
- function Scan_Long_Long_Integer
- (Str : String;
- Ptr : not null access Integer;
- Max : Integer) return Long_Long_Integer
- is
- Uval : Long_Long_Unsigned;
- -- Unsigned result
-
- Minus : Boolean := False;
- -- Set to True if minus sign is present, otherwise to False
-
- Start : Positive;
- -- Saves location of first non-blank
-
- begin
- Scan_Sign (Str, Ptr, Max, Minus, Start);
-
- if Str (Ptr.all) not in '0' .. '9' then
- Ptr.all := Start;
- Bad_Value (Str);
- end if;
-
- Uval := Scan_Raw_Long_Long_Unsigned (Str, Ptr, Max);
-
- -- Deal with overflow cases, and also with maximum negative number
-
- if Uval > Long_Long_Unsigned (Long_Long_Integer'Last) then
- if Minus
- and then Uval = Long_Long_Unsigned (-(Long_Long_Integer'First))
- then
- return Long_Long_Integer'First;
- else
- Bad_Value (Str);
- end if;
-
- -- Negative values
-
- elsif Minus then
- return -(Long_Long_Integer (Uval));
-
- -- Positive values
-
- else
- return Long_Long_Integer (Uval);
- end if;
- end Scan_Long_Long_Integer;
-
- -----------------------------
- -- Value_Long_Long_Integer --
- -----------------------------
-
- function Value_Long_Long_Integer (Str : String) return Long_Long_Integer is
- begin
- -- We have to special case Str'Last = Positive'Last because the normal
- -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
- -- deal with this by converting to a subtype which fixes the bounds.
-
- if Str'Last = Positive'Last then
- declare
- subtype NT is String (1 .. Str'Length);
- begin
- return Value_Long_Long_Integer (NT (Str));
- end;
-
- -- Normal case where Str'Last < Positive'Last
-
- else
- declare
- V : Long_Long_Integer;
- P : aliased Integer := Str'First;
- begin
- V := Scan_Long_Long_Integer (Str, P'Access, Str'Last);
- Scan_Trailing_Blanks (Str, P);
- return V;
- end;
- end if;
- end Value_Long_Long_Integer;
-
-end System.Val_LLI;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-vallli.ads b/gcc/ada/libgnat/s-vallli.ads
index 0a51bbe..e53873e 100644
--- a/gcc/ada/libgnat/s-vallli.ads
+++ b/gcc/ada/libgnat/s-vallli.ads
@@ -32,42 +32,27 @@
-- This package contains routines for scanning signed Long_Long_Integer
-- values for use in Text_IO.Integer_IO, and the Value attribute.
+with System.Unsigned_Types;
+with System.Val_LLU;
+with System.Value_I;
+
package System.Val_LLI is
pragma Preelaborate;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ package Impl is new
+ Value_I (Long_Long_Integer,
+ Long_Long_Unsigned,
+ Val_LLU.Scan_Raw_Long_Long_Unsigned);
+
function Scan_Long_Long_Integer
(Str : String;
Ptr : not null access Integer;
- Max : Integer) return Long_Long_Integer;
- -- This function scans the string starting at Str (Ptr.all) for a valid
- -- integer according to the syntax described in (RM 3.5(43)). The substring
- -- scanned extends no further than Str (Max). There are three cases for the
- -- return:
- --
- -- If a valid integer is found after scanning past any initial spaces, then
- -- Ptr.all is updated past the last character of the integer (but trailing
- -- spaces are not scanned out).
- --
- -- If no valid integer is found, then Ptr.all points either to an initial
- -- non-digit character, or to Max + 1 if the field is all spaces and the
- -- exception Constraint_Error is raised.
- --
- -- If a syntactically valid integer is scanned, but the value is out of
- -- range, or, in the based case, the base value is out of range or there
- -- is an out of range digit, then Ptr.all points past the integer, and
- -- Constraint_Error is raised.
- --
- -- Note: these rules correspond to the requirements for leaving the pointer
- -- positioned in Text_Io.Get
- --
- -- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
- -- special case of an all-blank string, and Ptr is unchanged, and hence
- -- is greater than Max as required in this case.
+ Max : Integer) return Long_Long_Integer
+ renames Impl.Scan_Integer;
- function Value_Long_Long_Integer (Str : String) return Long_Long_Integer;
- -- Used in computing X'Value (Str) where X is a signed integer type whose
- -- base range exceeds the base range of Integer. Str is the string argument
- -- of the attribute. Constraint_Error is raised if the string is malformed,
- -- or if the value is out of range.
+ function Value_Long_Long_Integer (Str : String) return Long_Long_Integer
+ renames Impl.Value_Integer;
end System.Val_LLI;
diff --git a/gcc/ada/libgnat/s-valllli.ads b/gcc/ada/libgnat/s-valllli.ads
new file mode 100644
index 0000000..9ab7161
--- /dev/null
+++ b/gcc/ada/libgnat/s-valllli.ads
@@ -0,0 +1,59 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . V A L _ L L L I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains routines for scanning signed Long_Long_Long_Integer
+-- values for use in Text_IO.Integer_IO, and the Value attribute.
+
+with System.Unsigned_Types;
+with System.Val_LLLU;
+with System.Value_I;
+
+package System.Val_LLLI is
+ pragma Preelaborate;
+
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
+
+ package Impl is new
+ Value_I (Long_Long_Long_Integer,
+ Long_Long_Long_Unsigned,
+ Val_LLLU.Scan_Raw_Long_Long_Long_Unsigned);
+
+ function Scan_Long_Long_Long_Integer
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Long_Long_Long_Integer
+ renames Impl.Scan_Integer;
+
+ function Value_Long_Long_Long_Integer
+ (Str : String) return Long_Long_Long_Integer
+ renames Impl.Value_Integer;
+
+end System.Val_LLLI;
diff --git a/gcc/ada/libgnat/s-vallllu.ads b/gcc/ada/libgnat/s-vallllu.ads
new file mode 100644
index 0000000..34ce282
--- /dev/null
+++ b/gcc/ada/libgnat/s-vallllu.ads
@@ -0,0 +1,61 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . V A L _ L L L U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains routines for scanning modular Long_Long_Unsigned
+-- values for use in Text_IO.Modular_IO, and the Value attribute.
+
+with System.Unsigned_Types;
+with System.Value_U;
+
+package System.Val_LLLU is
+ pragma Preelaborate;
+
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
+
+ package Impl is new Value_U (Long_Long_Long_Unsigned);
+
+ function Scan_Raw_Long_Long_Long_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Long_Long_Long_Unsigned
+ renames Impl.Scan_Raw_Unsigned;
+
+ function Scan_Long_Long_Long_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Long_Long_Long_Unsigned
+ renames Impl.Scan_Unsigned;
+
+ function Value_Long_Long_Long_Unsigned
+ (Str : String) return Long_Long_Long_Unsigned
+ renames Impl.Value_Unsigned;
+
+end System.Val_LLLU;
diff --git a/gcc/ada/libgnat/s-valllu.adb b/gcc/ada/libgnat/s-valllu.adb
index dca0aac..1afb632 100644
--- a/gcc/ada/libgnat/s-valllu.adb
+++ b/gcc/ada/libgnat/s-valllu.adb
@@ -29,302 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
-with System.Val_Util; use System.Val_Util;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Val_LLU is
-
- ---------------------------------
- -- Scan_Raw_Long_Long_Unsigned --
- ---------------------------------
-
- function Scan_Raw_Long_Long_Unsigned
- (Str : String;
- Ptr : not null access Integer;
- Max : Integer) return Long_Long_Unsigned
- is
- P : Integer;
- -- Local copy of the pointer
-
- Uval : Long_Long_Unsigned;
- -- Accumulated unsigned integer result
-
- Expon : Integer;
- -- Exponent value
-
- Overflow : Boolean := False;
- -- Set True if overflow is detected at any point
-
- Base_Char : Character;
- -- Base character (# or :) in based case
-
- Base : Long_Long_Unsigned := 10;
- -- Base value (reset in based case)
-
- Digit : Long_Long_Unsigned;
- -- Digit value
-
- begin
- -- We do not tolerate strings with Str'Last = Positive'Last
-
- if Str'Last = Positive'Last then
- raise Program_Error with
- "string upper bound is Positive'Last, not supported";
- end if;
-
- P := Ptr.all;
- Uval := Character'Pos (Str (P)) - Character'Pos ('0');
- P := P + 1;
-
- -- Scan out digits of what is either the number or the base.
- -- In either case, we are definitely scanning out in base 10.
-
- declare
- Umax : constant := (Long_Long_Unsigned'Last - 9) / 10;
- -- Max value which cannot overflow on accumulating next digit
-
- Umax10 : constant := Long_Long_Unsigned'Last / 10;
- -- Numbers bigger than Umax10 overflow if multiplied by 10
-
- begin
- -- Loop through decimal digits
- loop
- exit when P > Max;
-
- Digit := Character'Pos (Str (P)) - Character'Pos ('0');
-
- -- Non-digit encountered
-
- if Digit > 9 then
- if Str (P) = '_' then
- Scan_Underscore (Str, P, Ptr, Max, False);
- else
- exit;
- end if;
-
- -- Accumulate result, checking for overflow
-
- else
- if Uval <= Umax then
- Uval := 10 * Uval + Digit;
-
- elsif Uval > Umax10 then
- Overflow := True;
-
- else
- Uval := 10 * Uval + Digit;
-
- if Uval < Umax10 then
- Overflow := True;
- end if;
- end if;
-
- P := P + 1;
- end if;
- end loop;
- end;
-
- Ptr.all := P;
-
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- if P < Max and then (Str (P) = '#' or else Str (P) = ':') then
- Base_Char := Str (P);
- P := P + 1;
- Base := Uval;
- Uval := 0;
-
- -- Check base value. Overflow is set True if we find a bad base, or
- -- a digit that is out of range of the base. That way, we scan out
- -- the numeral that is still syntactically correct, though illegal.
- -- We use a safe base of 16 for this scan, to avoid zero divide.
-
- if Base not in 2 .. 16 then
- Overflow := True;
- Base := 16;
- end if;
-
- -- Scan out based integer
-
- declare
- Umax : constant Long_Long_Unsigned :=
- (Long_Long_Unsigned'Last - Base + 1) / Base;
- -- Max value which cannot overflow on accumulating next digit
-
- UmaxB : constant Long_Long_Unsigned :=
- Long_Long_Unsigned'Last / Base;
- -- Numbers bigger than UmaxB overflow if multiplied by base
-
- begin
- -- Loop to scan out based integer value
-
- loop
- -- We require a digit at this stage
-
- if Str (P) in '0' .. '9' then
- Digit := Character'Pos (Str (P)) - Character'Pos ('0');
-
- elsif Str (P) in 'A' .. 'F' then
- Digit :=
- Character'Pos (Str (P)) - (Character'Pos ('A') - 10);
-
- elsif Str (P) in 'a' .. 'f' then
- Digit :=
- Character'Pos (Str (P)) - (Character'Pos ('a') - 10);
-
- -- If we don't have a digit, then this is not a based number
- -- after all, so we use the value we scanned out as the base
- -- (now in Base), and the pointer to the base character was
- -- already stored in Ptr.all.
-
- else
- Uval := Base;
- exit;
- end if;
-
- -- If digit is too large, just signal overflow and continue.
- -- The idea here is to keep scanning as long as the input is
- -- syntactically valid, even if we have detected overflow
-
- if Digit >= Base then
- Overflow := True;
-
- -- Here we accumulate the value, checking overflow
-
- elsif Uval <= Umax then
- Uval := Base * Uval + Digit;
-
- elsif Uval > UmaxB then
- Overflow := True;
-
- else
- Uval := Base * Uval + Digit;
-
- if Uval < UmaxB then
- Overflow := True;
- end if;
- end if;
-
- -- If at end of string with no base char, not a based number
- -- but we signal Constraint_Error and set the pointer past
- -- the end of the field, since this is what the ACVC tests
- -- seem to require, see CE3704N, line 204.
-
- P := P + 1;
-
- if P > Max then
- Ptr.all := P;
- Bad_Value (Str);
- end if;
-
- -- If terminating base character, we are done with loop
-
- if Str (P) = Base_Char then
- Ptr.all := P + 1;
- exit;
-
- -- Deal with underscore
-
- elsif Str (P) = '_' then
- Scan_Underscore (Str, P, Ptr, Max, True);
- end if;
-
- end loop;
- end;
- end if;
-
- -- Come here with scanned unsigned value in Uval. The only remaining
- -- required step is to deal with exponent if one is present.
-
- Expon := Scan_Exponent (Str, Ptr, Max);
-
- if Expon /= 0 and then Uval /= 0 then
-
- -- For non-zero value, scale by exponent value. No need to do this
- -- efficiently, since use of exponent in integer literals is rare,
- -- and in any case the exponent cannot be very large.
-
- declare
- UmaxB : constant Long_Long_Unsigned :=
- Long_Long_Unsigned'Last / Base;
- -- Numbers bigger than UmaxB overflow if multiplied by base
-
- begin
- for J in 1 .. Expon loop
- if Uval > UmaxB then
- Overflow := True;
- exit;
- end if;
-
- Uval := Uval * Base;
- end loop;
- end;
- end if;
-
- -- Return result, dealing with sign and overflow
-
- if Overflow then
- Bad_Value (Str);
- else
- return Uval;
- end if;
- end Scan_Raw_Long_Long_Unsigned;
-
- -----------------------------
- -- Scan_Long_Long_Unsigned --
- -----------------------------
-
- function Scan_Long_Long_Unsigned
- (Str : String;
- Ptr : not null access Integer;
- Max : Integer) return Long_Long_Unsigned
- is
- Start : Positive;
- -- Save location of first non-blank character
-
- begin
- Scan_Plus_Sign (Str, Ptr, Max, Start);
-
- if Str (Ptr.all) not in '0' .. '9' then
- Ptr.all := Start;
- raise Constraint_Error;
- end if;
-
- return Scan_Raw_Long_Long_Unsigned (Str, Ptr, Max);
- end Scan_Long_Long_Unsigned;
-
- ------------------------------
- -- Value_Long_Long_Unsigned --
- ------------------------------
-
- function Value_Long_Long_Unsigned
- (Str : String) return Long_Long_Unsigned
- is
- begin
- -- We have to special case Str'Last = Positive'Last because the normal
- -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
- -- deal with this by converting to a subtype which fixes the bounds.
-
- if Str'Last = Positive'Last then
- declare
- subtype NT is String (1 .. Str'Length);
- begin
- return Value_Long_Long_Unsigned (NT (Str));
- end;
-
- -- Normal case where Str'Last < Positive'Last
-
- else
- declare
- V : Long_Long_Unsigned;
- P : aliased Integer := Str'First;
- begin
- V := Scan_Long_Long_Unsigned (Str, P'Access, Str'Last);
- Scan_Trailing_Blanks (Str, P);
- return V;
- end;
- end if;
- end Value_Long_Long_Unsigned;
-
-end System.Val_LLU;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-valllu.ads b/gcc/ada/libgnat/s-valllu.ads
index 51a31dd..5c0300c 100644
--- a/gcc/ada/libgnat/s-valllu.ads
+++ b/gcc/ada/libgnat/s-valllu.ads
@@ -33,97 +33,29 @@
-- values for use in Text_IO.Modular_IO, and the Value attribute.
with System.Unsigned_Types;
+with System.Value_U;
package System.Val_LLU is
pragma Preelaborate;
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ package Impl is new Value_U (Long_Long_Unsigned);
+
function Scan_Raw_Long_Long_Unsigned
(Str : String;
Ptr : not null access Integer;
- Max : Integer) return System.Unsigned_Types.Long_Long_Unsigned;
- -- This function scans the string starting at Str (Ptr.all) for a valid
- -- integer according to the syntax described in (RM 3.5(43)). The substring
- -- scanned extends no further than Str (Max). Note: this does not scan
- -- leading or trailing blanks, nor leading sign.
- --
- -- There are three cases for the return:
- --
- -- If a valid integer is found, then Ptr.all is updated past the last
- -- character of the integer.
- --
- -- If no valid integer is found, then Ptr.all points either to an initial
- -- non-digit character, or to Max + 1 if the field is all spaces and the
- -- exception Constraint_Error is raised.
- --
- -- If a syntactically valid integer is scanned, but the value is out of
- -- range, or, in the based case, the base value is out of range or there
- -- is an out of range digit, then Ptr.all points past the integer, and
- -- Constraint_Error is raised.
- --
- -- Note: these rules correspond to the requirements for leaving the pointer
- -- positioned in Text_IO.Get. Note that the rules as stated in the RM would
- -- seem to imply that for a case like:
- --
- -- 8#12345670009#
- --
- -- the pointer should be left at the first # having scanned out the longest
- -- valid integer literal (8), but in fact in this case the pointer points
- -- past the final # and Constraint_Error is raised. This is the behavior
- -- expected for Text_IO and enforced by the ACATS tests.
- --
- -- If a based literal is malformed in that a character other than a valid
- -- hexadecimal digit is encountered during scanning out the digits after
- -- the # (this includes the case of using the wrong terminator, : instead
- -- of # or vice versa) there are two cases. If all the digits before the
- -- non-digit are in range of the base, as in
- --
- -- 8#100x00#
- -- 8#100:
- --
- -- then in this case, the "base" value before the initial # is returned as
- -- the result, and the pointer points to the initial # character on return.
- --
- -- If an out of range digit has been detected before the invalid character,
- -- as in:
- --
- -- 8#900x00#
- -- 8#900:
- --
- -- then the pointer is also left at the initial # character, but constraint
- -- error is raised reflecting the encounter of an out of range digit.
- --
- -- Finally if we have an unterminated fixed-point constant where the final
- -- # or : character is missing, Constraint_Error is raised and the pointer
- -- is left pointing past the last digit, as in:
- --
- -- 8#22
- --
- -- This string results in a Constraint_Error with the pointer pointing
- -- past the second 2.
- --
- -- Note: if Str is empty, i.e. if Max is less than Ptr, then this is a
- -- special case of an all-blank string, and Ptr is unchanged, and hence
- -- is greater than Max as required in this case.
- --
- -- Note: this routine should not be called with Str'Last = Positive'Last.
- -- If this occurs Program_Error is raised with a message noting that this
- -- case is not supported. Most such cases are eliminated by the caller.
+ Max : Integer) return Long_Long_Unsigned
+ renames Impl.Scan_Raw_Unsigned;
function Scan_Long_Long_Unsigned
(Str : String;
Ptr : not null access Integer;
- Max : Integer) return System.Unsigned_Types.Long_Long_Unsigned;
- -- Same as Scan_Raw_Long_Long_Unsigned, except scans optional leading
- -- blanks, and an optional leading plus sign.
- --
- -- Note: if a minus sign is present, Constraint_Error will be raised.
- -- Note: trailing blanks are not scanned.
+ Max : Integer) return Long_Long_Unsigned
+ renames Impl.Scan_Unsigned;
function Value_Long_Long_Unsigned
- (Str : String) return System.Unsigned_Types.Long_Long_Unsigned;
- -- Used in computing X'Value (Str) where X is a modular integer type whose
- -- modulus exceeds the range of System.Unsigned_Types.Unsigned. Str is the
- -- string argument of the attribute. Constraint_Error is raised if the
- -- string is malformed, or if the value is out of range.
+ (Str : String) return Long_Long_Unsigned
+ renames Impl.Value_Unsigned;
end System.Val_LLU;
diff --git a/gcc/ada/libgnat/s-valuei.adb b/gcc/ada/libgnat/s-valuei.adb
new file mode 100644
index 0000000..1bc8b32
--- /dev/null
+++ b/gcc/ada/libgnat/s-valuei.adb
@@ -0,0 +1,116 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . V A L U E _ I --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Val_Util; use System.Val_Util;
+
+package body System.Value_I is
+
+ ------------------
+ -- Scan_Integer --
+ ------------------
+
+ function Scan_Integer
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Int
+ is
+ Uval : Uns;
+ -- Unsigned result
+
+ Minus : Boolean := False;
+ -- Set to True if minus sign is present, otherwise to False
+
+ Start : Positive;
+ -- Saves location of first non-blank (not used in this case)
+
+ begin
+ Scan_Sign (Str, Ptr, Max, Minus, Start);
+
+ if Str (Ptr.all) not in '0' .. '9' then
+ Ptr.all := Start;
+ Bad_Value (Str);
+ end if;
+
+ Uval := Scan_Raw_Unsigned (Str, Ptr, Max);
+
+ -- Deal with overflow cases, and also with maximum negative number
+
+ if Uval > Uns (Int'Last) then
+ if Minus and then Uval = Uns (-(Int'First)) then
+ return Int'First;
+ else
+ Bad_Value (Str);
+ end if;
+
+ -- Negative values
+
+ elsif Minus then
+ return -(Int (Uval));
+
+ -- Positive values
+
+ else
+ return Int (Uval);
+ end if;
+ end Scan_Integer;
+
+ -------------------
+ -- Value_Integer --
+ -------------------
+
+ function Value_Integer (Str : String) return Int is
+ begin
+ -- We have to special case Str'Last = Positive'Last because the normal
+ -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
+ -- deal with this by converting to a subtype which fixes the bounds.
+
+ if Str'Last = Positive'Last then
+ declare
+ subtype NT is String (1 .. Str'Length);
+ begin
+ return Value_Integer (NT (Str));
+ end;
+
+ -- Normal case where Str'Last < Positive'Last
+
+ else
+ declare
+ V : Int;
+ P : aliased Integer := Str'First;
+ begin
+ V := Scan_Integer (Str, P'Access, Str'Last);
+ Scan_Trailing_Blanks (Str, P);
+ return V;
+ end;
+ end if;
+ end Value_Integer;
+
+end System.Value_I;
diff --git a/gcc/ada/libgnat/s-valuei.ads b/gcc/ada/libgnat/s-valuei.ads
new file mode 100644
index 0000000..13f4f8c
--- /dev/null
+++ b/gcc/ada/libgnat/s-valuei.ads
@@ -0,0 +1,84 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . V A L U E _ I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains routines for scanning signed integer values for use
+-- in Text_IO.Integer_IO, and the Value attribute.
+
+generic
+
+ type Int is range <>;
+
+ type Uns is mod <>;
+
+ with function Scan_Raw_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Uns;
+
+package System.Value_I is
+ pragma Preelaborate;
+
+ function Scan_Integer
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Int;
+ -- This function scans the string starting at Str (Ptr.all) for a valid
+ -- integer according to the syntax described in (RM 3.5(43)). The substring
+ -- scanned extends no further than Str (Max). There are three cases for the
+ -- return:
+ --
+ -- If a valid integer is found after scanning past any initial spaces, then
+ -- Ptr.all is updated past the last character of the integer (but trailing
+ -- spaces are not scanned out).
+ --
+ -- If no valid integer is found, then Ptr.all points either to an initial
+ -- non-digit character, or to Max + 1 if the field is all spaces and the
+ -- exception Constraint_Error is raised.
+ --
+ -- If a syntactically valid integer is scanned, but the value is out of
+ -- range, or, in the based case, the base value is out of range or there
+ -- is an out of range digit, then Ptr.all points past the integer, and
+ -- Constraint_Error is raised.
+ --
+ -- Note: these rules correspond to the requirements for leaving the pointer
+ -- positioned in Text_Io.Get
+ --
+ -- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
+ -- special case of an all-blank string, and Ptr is unchanged, and hence
+ -- is greater than Max as required in this case.
+
+ function Value_Integer (Str : String) return Int;
+ -- Used in computing X'Value (Str) where X is a signed integer type whose
+ -- base range does not exceed the base range of Integer. Str is the string
+ -- argument of the attribute. Constraint_Error is raised if the string is
+ -- malformed, or if the value is out of range.
+
+end System.Value_I;
diff --git a/gcc/ada/libgnat/s-valueu.adb b/gcc/ada/libgnat/s-valueu.adb
new file mode 100644
index 0000000..75bef07
--- /dev/null
+++ b/gcc/ada/libgnat/s-valueu.adb
@@ -0,0 +1,324 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . V A L U E _ U --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Val_Util; use System.Val_Util;
+
+package body System.Value_U is
+
+ -----------------------
+ -- Scan_Raw_Unsigned --
+ -----------------------
+
+ function Scan_Raw_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Uns
+ is
+ P : Integer;
+ -- Local copy of the pointer
+
+ Uval : Uns;
+ -- Accumulated unsigned integer result
+
+ Expon : Integer;
+ -- Exponent value
+
+ Overflow : Boolean := False;
+ -- Set True if overflow is detected at any point
+
+ Base_Char : Character;
+ -- Base character (# or :) in based case
+
+ Base : Uns := 10;
+ -- Base value (reset in based case)
+
+ Digit : Uns;
+ -- Digit value
+
+ begin
+ -- We do not tolerate strings with Str'Last = Positive'Last
+
+ if Str'Last = Positive'Last then
+ raise Program_Error with
+ "string upper bound is Positive'Last, not supported";
+ end if;
+
+ P := Ptr.all;
+ Uval := Character'Pos (Str (P)) - Character'Pos ('0');
+ P := P + 1;
+
+ -- Scan out digits of what is either the number or the base.
+ -- In either case, we are definitely scanning out in base 10.
+
+ declare
+ Umax : constant Uns := (Uns'Last - 9) / 10;
+ -- Max value which cannot overflow on accumulating next digit
+
+ Umax10 : constant Uns := Uns'Last / 10;
+ -- Numbers bigger than Umax10 overflow if multiplied by 10
+
+ begin
+ -- Loop through decimal digits
+ loop
+ exit when P > Max;
+
+ Digit := Character'Pos (Str (P)) - Character'Pos ('0');
+
+ -- Non-digit encountered
+
+ if Digit > 9 then
+ if Str (P) = '_' then
+ Scan_Underscore (Str, P, Ptr, Max, False);
+ else
+ exit;
+ end if;
+
+ -- Accumulate result, checking for overflow
+
+ else
+ if Uval <= Umax then
+ Uval := 10 * Uval + Digit;
+
+ elsif Uval > Umax10 then
+ Overflow := True;
+
+ else
+ Uval := 10 * Uval + Digit;
+
+ if Uval < Umax10 then
+ Overflow := True;
+ end if;
+ end if;
+
+ P := P + 1;
+ end if;
+ end loop;
+ end;
+
+ Ptr.all := P;
+
+ -- Deal with based case. We recognize either the standard '#' or the
+ -- allowed alternative replacement ':' (see RM J.2(3)).
+
+ if P < Max and then (Str (P) = '#' or else Str (P) = ':') then
+ Base_Char := Str (P);
+ P := P + 1;
+ Base := Uval;
+ Uval := 0;
+
+ -- Check base value. Overflow is set True if we find a bad base, or
+ -- a digit that is out of range of the base. That way, we scan out
+ -- the numeral that is still syntactically correct, though illegal.
+ -- We use a safe base of 16 for this scan, to avoid zero divide.
+
+ if Base not in 2 .. 16 then
+ Overflow := True;
+ Base := 16;
+ end if;
+
+ -- Scan out based integer
+
+ declare
+ Umax : constant Uns := (Uns'Last - Base + 1) / Base;
+ -- Max value which cannot overflow on accumulating next digit
+
+ UmaxB : constant Uns := Uns'Last / Base;
+ -- Numbers bigger than UmaxB overflow if multiplied by base
+
+ begin
+ -- Loop to scan out based integer value
+
+ loop
+ -- We require a digit at this stage
+
+ if Str (P) in '0' .. '9' then
+ Digit := Character'Pos (Str (P)) - Character'Pos ('0');
+
+ elsif Str (P) in 'A' .. 'F' then
+ Digit :=
+ Character'Pos (Str (P)) - (Character'Pos ('A') - 10);
+
+ elsif Str (P) in 'a' .. 'f' then
+ Digit :=
+ Character'Pos (Str (P)) - (Character'Pos ('a') - 10);
+
+ -- If we don't have a digit, then this is not a based number
+ -- after all, so we use the value we scanned out as the base
+ -- (now in Base), and the pointer to the base character was
+ -- already stored in Ptr.all.
+
+ else
+ Uval := Base;
+ exit;
+ end if;
+
+ -- If digit is too large, just signal overflow and continue.
+ -- The idea here is to keep scanning as long as the input is
+ -- syntactically valid, even if we have detected overflow
+
+ if Digit >= Base then
+ Overflow := True;
+
+ -- Here we accumulate the value, checking overflow
+
+ elsif Uval <= Umax then
+ Uval := Base * Uval + Digit;
+
+ elsif Uval > UmaxB then
+ Overflow := True;
+
+ else
+ Uval := Base * Uval + Digit;
+
+ if Uval < UmaxB then
+ Overflow := True;
+ end if;
+ end if;
+
+ -- If at end of string with no base char, not a based number
+ -- but we signal Constraint_Error and set the pointer past
+ -- the end of the field, since this is what the ACVC tests
+ -- seem to require, see CE3704N, line 204.
+
+ P := P + 1;
+
+ if P > Max then
+ Ptr.all := P;
+ Bad_Value (Str);
+ end if;
+
+ -- If terminating base character, we are done with loop
+
+ if Str (P) = Base_Char then
+ Ptr.all := P + 1;
+ exit;
+
+ -- Deal with underscore
+
+ elsif Str (P) = '_' then
+ Scan_Underscore (Str, P, Ptr, Max, True);
+ end if;
+
+ end loop;
+ end;
+ end if;
+
+ -- Come here with scanned unsigned value in Uval. The only remaining
+ -- required step is to deal with exponent if one is present.
+
+ Expon := Scan_Exponent (Str, Ptr, Max);
+
+ if Expon /= 0 and then Uval /= 0 then
+
+ -- For non-zero value, scale by exponent value. No need to do this
+ -- efficiently, since use of exponent in integer literals is rare,
+ -- and in any case the exponent cannot be very large.
+
+ declare
+ UmaxB : constant Uns := Uns'Last / Base;
+ -- Numbers bigger than UmaxB overflow if multiplied by base
+
+ begin
+ for J in 1 .. Expon loop
+ if Uval > UmaxB then
+ Overflow := True;
+ exit;
+ end if;
+
+ Uval := Uval * Base;
+ end loop;
+ end;
+ end if;
+
+ -- Return result, dealing with sign and overflow
+
+ if Overflow then
+ Bad_Value (Str);
+ else
+ return Uval;
+ end if;
+ end Scan_Raw_Unsigned;
+
+ -------------------
+ -- Scan_Unsigned --
+ -------------------
+
+ function Scan_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Uns
+ is
+ Start : Positive;
+ -- Save location of first non-blank character
+
+ begin
+ Scan_Plus_Sign (Str, Ptr, Max, Start);
+
+ if Str (Ptr.all) not in '0' .. '9' then
+ Ptr.all := Start;
+ Bad_Value (Str);
+ end if;
+
+ return Scan_Raw_Unsigned (Str, Ptr, Max);
+ end Scan_Unsigned;
+
+ --------------------
+ -- Value_Unsigned --
+ --------------------
+
+ function Value_Unsigned (Str : String) return Uns is
+ begin
+ -- We have to special case Str'Last = Positive'Last because the normal
+ -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
+ -- deal with this by converting to a subtype which fixes the bounds.
+
+ if Str'Last = Positive'Last then
+ declare
+ subtype NT is String (1 .. Str'Length);
+ begin
+ return Value_Unsigned (NT (Str));
+ end;
+
+ -- Normal case where Str'Last < Positive'Last
+
+ else
+ declare
+ V : Uns;
+ P : aliased Integer := Str'First;
+ begin
+ V := Scan_Unsigned (Str, P'Access, Str'Last);
+ Scan_Trailing_Blanks (Str, P);
+ return V;
+ end;
+ end if;
+ end Value_Unsigned;
+
+end System.Value_U;
diff --git a/gcc/ada/libgnat/s-valueu.ads b/gcc/ada/libgnat/s-valueu.ads
new file mode 100644
index 0000000..ad8256c
--- /dev/null
+++ b/gcc/ada/libgnat/s-valueu.ads
@@ -0,0 +1,131 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . V A L U E _ U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains routines for scanning modular Unsigned
+-- values for use in Text_IO.Modular_IO, and the Value attribute.
+
+generic
+
+ type Uns is mod <>;
+
+package System.Value_U is
+ pragma Preelaborate;
+
+ function Scan_Raw_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Uns;
+ -- This function scans the string starting at Str (Ptr.all) for a valid
+ -- integer according to the syntax described in (RM 3.5(43)). The substring
+ -- scanned extends no further than Str (Max). Note: this does not scan
+ -- leading or trailing blanks, nor leading sign.
+ --
+ -- There are three cases for the return:
+ --
+ -- If a valid integer is found, then Ptr.all is updated past the last
+ -- character of the integer.
+ --
+ -- If no valid integer is found, then Ptr.all points either to an initial
+ -- non-digit character, or to Max + 1 if the field is all spaces and the
+ -- exception Constraint_Error is raised.
+ --
+ -- If a syntactically valid integer is scanned, but the value is out of
+ -- range, or, in the based case, the base value is out of range or there
+ -- is an out of range digit, then Ptr.all points past the integer, and
+ -- Constraint_Error is raised.
+ --
+ -- Note: these rules correspond to the requirements for leaving the pointer
+ -- positioned in Text_IO.Get. Note that the rules as stated in the RM would
+ -- seem to imply that for a case like:
+ --
+ -- 8#12345670009#
+ --
+ -- the pointer should be left at the first # having scanned out the longest
+ -- valid integer literal (8), but in fact in this case the pointer points
+ -- past the final # and Constraint_Error is raised. This is the behavior
+ -- expected for Text_IO and enforced by the ACATS tests.
+ --
+ -- If a based literal is malformed in that a character other than a valid
+ -- hexadecimal digit is encountered during scanning out the digits after
+ -- the # (this includes the case of using the wrong terminator, : instead
+ -- of # or vice versa) there are two cases. If all the digits before the
+ -- non-digit are in range of the base, as in
+ --
+ -- 8#100x00#
+ -- 8#100:
+ --
+ -- then in this case, the "base" value before the initial # is returned as
+ -- the result, and the pointer points to the initial # character on return.
+ --
+ -- If an out of range digit has been detected before the invalid character,
+ -- as in:
+ --
+ -- 8#900x00#
+ -- 8#900:
+ --
+ -- then the pointer is also left at the initial # character, but constraint
+ -- error is raised reflecting the encounter of an out of range digit.
+ --
+ -- Finally if we have an unterminated fixed-point constant where the final
+ -- # or : character is missing, Constraint_Error is raised and the pointer
+ -- is left pointing past the last digit, as in:
+ --
+ -- 8#22
+ --
+ -- This string results in a Constraint_Error with the pointer pointing
+ -- past the second 2.
+ --
+ -- Note: if Str is empty, i.e. if Max is less than Ptr, then this is a
+ -- special case of an all-blank string, and Ptr is unchanged, and hence
+ -- is greater than Max as required in this case.
+ --
+ -- Note: this routine should not be called with Str'Last = Positive'Last.
+ -- If this occurs Program_Error is raised with a message noting that this
+ -- case is not supported. Most such cases are eliminated by the caller.
+
+ function Scan_Unsigned
+ (Str : String;
+ Ptr : not null access Integer;
+ Max : Integer) return Uns;
+ -- Same as Scan_Raw_Unsigned, except scans optional leading
+ -- blanks, and an optional leading plus sign.
+ --
+ -- Note: if a minus sign is present, Constraint_Error will be raised.
+ -- Note: trailing blanks are not scanned.
+
+ function Value_Unsigned
+ (Str : String) return Uns;
+ -- Used in computing X'Value (Str) where X is a modular integer type whose
+ -- modulus does not exceed the range of System.Unsigned_Types.Unsigned. Str
+ -- is the string argument of the attribute. Constraint_Error is raised if
+ -- the string is malformed, or if the value is out of range.
+
+end System.Value_U;
diff --git a/gcc/ada/libgnat/s-valuns.adb b/gcc/ada/libgnat/s-valuns.adb
index 9f9e81e..b710a9b 100644
--- a/gcc/ada/libgnat/s-valuns.adb
+++ b/gcc/ada/libgnat/s-valuns.adb
@@ -29,297 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
-with System.Val_Util; use System.Val_Util;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Val_Uns is
-
- -----------------------
- -- Scan_Raw_Unsigned --
- -----------------------
-
- function Scan_Raw_Unsigned
- (Str : String;
- Ptr : not null access Integer;
- Max : Integer) return Unsigned
- is
- P : Integer;
- -- Local copy of the pointer
-
- Uval : Unsigned;
- -- Accumulated unsigned integer result
-
- Expon : Integer;
- -- Exponent value
-
- Overflow : Boolean := False;
- -- Set True if overflow is detected at any point
-
- Base_Char : Character;
- -- Base character (# or :) in based case
-
- Base : Unsigned := 10;
- -- Base value (reset in based case)
-
- Digit : Unsigned;
- -- Digit value
-
- begin
- -- We do not tolerate strings with Str'Last = Positive'Last
-
- if Str'Last = Positive'Last then
- raise Program_Error with
- "string upper bound is Positive'Last, not supported";
- end if;
-
- P := Ptr.all;
- Uval := Character'Pos (Str (P)) - Character'Pos ('0');
- P := P + 1;
-
- -- Scan out digits of what is either the number or the base.
- -- In either case, we are definitely scanning out in base 10.
-
- declare
- Umax : constant := (Unsigned'Last - 9) / 10;
- -- Max value which cannot overflow on accumulating next digit
-
- Umax10 : constant := Unsigned'Last / 10;
- -- Numbers bigger than Umax10 overflow if multiplied by 10
-
- begin
- -- Loop through decimal digits
- loop
- exit when P > Max;
-
- Digit := Character'Pos (Str (P)) - Character'Pos ('0');
-
- -- Non-digit encountered
-
- if Digit > 9 then
- if Str (P) = '_' then
- Scan_Underscore (Str, P, Ptr, Max, False);
- else
- exit;
- end if;
-
- -- Accumulate result, checking for overflow
-
- else
- if Uval <= Umax then
- Uval := 10 * Uval + Digit;
-
- elsif Uval > Umax10 then
- Overflow := True;
-
- else
- Uval := 10 * Uval + Digit;
-
- if Uval < Umax10 then
- Overflow := True;
- end if;
- end if;
-
- P := P + 1;
- end if;
- end loop;
- end;
-
- Ptr.all := P;
-
- -- Deal with based case. We recognize either the standard '#' or the
- -- allowed alternative replacement ':' (see RM J.2(3)).
-
- if P < Max and then (Str (P) = '#' or else Str (P) = ':') then
- Base_Char := Str (P);
- P := P + 1;
- Base := Uval;
- Uval := 0;
-
- -- Check base value. Overflow is set True if we find a bad base, or
- -- a digit that is out of range of the base. That way, we scan out
- -- the numeral that is still syntactically correct, though illegal.
- -- We use a safe base of 16 for this scan, to avoid zero divide.
-
- if Base not in 2 .. 16 then
- Overflow := True;
- Base := 16;
- end if;
-
- -- Scan out based integer
-
- declare
- Umax : constant Unsigned := (Unsigned'Last - Base + 1) / Base;
- -- Max value which cannot overflow on accumulating next digit
-
- UmaxB : constant Unsigned := Unsigned'Last / Base;
- -- Numbers bigger than UmaxB overflow if multiplied by base
-
- begin
- -- Loop to scan out based integer value
-
- loop
- -- We require a digit at this stage
-
- if Str (P) in '0' .. '9' then
- Digit := Character'Pos (Str (P)) - Character'Pos ('0');
-
- elsif Str (P) in 'A' .. 'F' then
- Digit :=
- Character'Pos (Str (P)) - (Character'Pos ('A') - 10);
-
- elsif Str (P) in 'a' .. 'f' then
- Digit :=
- Character'Pos (Str (P)) - (Character'Pos ('a') - 10);
-
- -- If we don't have a digit, then this is not a based number
- -- after all, so we use the value we scanned out as the base
- -- (now in Base), and the pointer to the base character was
- -- already stored in Ptr.all.
-
- else
- Uval := Base;
- exit;
- end if;
-
- -- If digit is too large, just signal overflow and continue.
- -- The idea here is to keep scanning as long as the input is
- -- syntactically valid, even if we have detected overflow
-
- if Digit >= Base then
- Overflow := True;
-
- -- Here we accumulate the value, checking overflow
-
- elsif Uval <= Umax then
- Uval := Base * Uval + Digit;
-
- elsif Uval > UmaxB then
- Overflow := True;
-
- else
- Uval := Base * Uval + Digit;
-
- if Uval < UmaxB then
- Overflow := True;
- end if;
- end if;
-
- -- If at end of string with no base char, not a based number
- -- but we signal Constraint_Error and set the pointer past
- -- the end of the field, since this is what the ACVC tests
- -- seem to require, see CE3704N, line 204.
-
- P := P + 1;
-
- if P > Max then
- Ptr.all := P;
- Bad_Value (Str);
- end if;
-
- -- If terminating base character, we are done with loop
-
- if Str (P) = Base_Char then
- Ptr.all := P + 1;
- exit;
-
- -- Deal with underscore
-
- elsif Str (P) = '_' then
- Scan_Underscore (Str, P, Ptr, Max, True);
- end if;
-
- end loop;
- end;
- end if;
-
- -- Come here with scanned unsigned value in Uval. The only remaining
- -- required step is to deal with exponent if one is present.
-
- Expon := Scan_Exponent (Str, Ptr, Max);
-
- if Expon /= 0 and then Uval /= 0 then
-
- -- For non-zero value, scale by exponent value. No need to do this
- -- efficiently, since use of exponent in integer literals is rare,
- -- and in any case the exponent cannot be very large.
-
- declare
- UmaxB : constant Unsigned := Unsigned'Last / Base;
- -- Numbers bigger than UmaxB overflow if multiplied by base
-
- begin
- for J in 1 .. Expon loop
- if Uval > UmaxB then
- Overflow := True;
- exit;
- end if;
-
- Uval := Uval * Base;
- end loop;
- end;
- end if;
-
- -- Return result, dealing with sign and overflow
-
- if Overflow then
- Bad_Value (Str);
- else
- return Uval;
- end if;
- end Scan_Raw_Unsigned;
-
- -------------------
- -- Scan_Unsigned --
- -------------------
-
- function Scan_Unsigned
- (Str : String;
- Ptr : not null access Integer;
- Max : Integer) return Unsigned
- is
- Start : Positive;
- -- Save location of first non-blank character
-
- begin
- Scan_Plus_Sign (Str, Ptr, Max, Start);
-
- if Str (Ptr.all) not in '0' .. '9' then
- Ptr.all := Start;
- Bad_Value (Str);
- end if;
-
- return Scan_Raw_Unsigned (Str, Ptr, Max);
- end Scan_Unsigned;
-
- --------------------
- -- Value_Unsigned --
- --------------------
-
- function Value_Unsigned (Str : String) return Unsigned is
- begin
- -- We have to special case Str'Last = Positive'Last because the normal
- -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
- -- deal with this by converting to a subtype which fixes the bounds.
-
- if Str'Last = Positive'Last then
- declare
- subtype NT is String (1 .. Str'Length);
- begin
- return Value_Unsigned (NT (Str));
- end;
-
- -- Normal case where Str'Last < Positive'Last
-
- else
- declare
- V : Unsigned;
- P : aliased Integer := Str'First;
- begin
- V := Scan_Unsigned (Str, P'Access, Str'Last);
- Scan_Trailing_Blanks (Str, P);
- return V;
- end;
- end if;
- end Value_Unsigned;
-
-end System.Val_Uns;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-valuns.ads b/gcc/ada/libgnat/s-valuns.ads
index b965ba5..84b7a7d 100644
--- a/gcc/ada/libgnat/s-valuns.ads
+++ b/gcc/ada/libgnat/s-valuns.ads
@@ -33,97 +33,29 @@
-- values for use in Text_IO.Modular_IO, and the Value attribute.
with System.Unsigned_Types;
+with System.Value_U;
package System.Val_Uns is
pragma Preelaborate;
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ package Impl is new Value_U (Unsigned);
+
function Scan_Raw_Unsigned
(Str : String;
Ptr : not null access Integer;
- Max : Integer) return System.Unsigned_Types.Unsigned;
- -- This function scans the string starting at Str (Ptr.all) for a valid
- -- integer according to the syntax described in (RM 3.5(43)). The substring
- -- scanned extends no further than Str (Max). Note: this does not scan
- -- leading or trailing blanks, nor leading sign.
- --
- -- There are three cases for the return:
- --
- -- If a valid integer is found, then Ptr.all is updated past the last
- -- character of the integer.
- --
- -- If no valid integer is found, then Ptr.all points either to an initial
- -- non-digit character, or to Max + 1 if the field is all spaces and the
- -- exception Constraint_Error is raised.
- --
- -- If a syntactically valid integer is scanned, but the value is out of
- -- range, or, in the based case, the base value is out of range or there
- -- is an out of range digit, then Ptr.all points past the integer, and
- -- Constraint_Error is raised.
- --
- -- Note: these rules correspond to the requirements for leaving the pointer
- -- positioned in Text_IO.Get. Note that the rules as stated in the RM would
- -- seem to imply that for a case like:
- --
- -- 8#12345670009#
- --
- -- the pointer should be left at the first # having scanned out the longest
- -- valid integer literal (8), but in fact in this case the pointer points
- -- past the final # and Constraint_Error is raised. This is the behavior
- -- expected for Text_IO and enforced by the ACATS tests.
- --
- -- If a based literal is malformed in that a character other than a valid
- -- hexadecimal digit is encountered during scanning out the digits after
- -- the # (this includes the case of using the wrong terminator, : instead
- -- of # or vice versa) there are two cases. If all the digits before the
- -- non-digit are in range of the base, as in
- --
- -- 8#100x00#
- -- 8#100:
- --
- -- then in this case, the "base" value before the initial # is returned as
- -- the result, and the pointer points to the initial # character on return.
- --
- -- If an out of range digit has been detected before the invalid character,
- -- as in:
- --
- -- 8#900x00#
- -- 8#900:
- --
- -- then the pointer is also left at the initial # character, but constraint
- -- error is raised reflecting the encounter of an out of range digit.
- --
- -- Finally if we have an unterminated fixed-point constant where the final
- -- # or : character is missing, Constraint_Error is raised and the pointer
- -- is left pointing past the last digit, as in:
- --
- -- 8#22
- --
- -- This string results in a Constraint_Error with the pointer pointing
- -- past the second 2.
- --
- -- Note: if Str is empty, i.e. if Max is less than Ptr, then this is a
- -- special case of an all-blank string, and Ptr is unchanged, and hence
- -- is greater than Max as required in this case.
- --
- -- Note: this routine should not be called with Str'Last = Positive'Last.
- -- If this occurs Program_Error is raised with a message noting that this
- -- case is not supported. Most such cases are eliminated by the caller.
+ Max : Integer) return Unsigned
+ renames Impl.Scan_Raw_Unsigned;
function Scan_Unsigned
(Str : String;
Ptr : not null access Integer;
- Max : Integer) return System.Unsigned_Types.Unsigned;
- -- Same as Scan_Raw_Unsigned, except scans optional leading
- -- blanks, and an optional leading plus sign.
- --
- -- Note: if a minus sign is present, Constraint_Error will be raised.
- -- Note: trailing blanks are not scanned.
+ Max : Integer) return Unsigned
+ renames Impl.Scan_Unsigned;
function Value_Unsigned
- (Str : String) return System.Unsigned_Types.Unsigned;
- -- Used in computing X'Value (Str) where X is a modular integer type whose
- -- modulus does not exceed the range of System.Unsigned_Types.Unsigned. Str
- -- is the string argument of the attribute. Constraint_Error is raised if
- -- the string is malformed, or if the value is out of range.
+ (Str : String) return Unsigned
+ renames Impl.Value_Unsigned;
end System.Val_Uns;
diff --git a/gcc/ada/libgnat/s-widint.ads b/gcc/ada/libgnat/s-widint.ads
new file mode 100644
index 0000000..6306277
--- /dev/null
+++ b/gcc/ada/libgnat/s-widint.ads
@@ -0,0 +1,41 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D _ I N T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Width attribute for signed integers up to Integer
+
+with System.Width_I;
+
+package System.Wid_Int is
+
+ function Width_Integer is new Width_I (Integer);
+ pragma Pure_Function (Width_Integer);
+
+end System.Wid_Int;
diff --git a/gcc/ada/libgnat/s-widlli.adb b/gcc/ada/libgnat/s-widlli.adb
index ff62186e..65b1ab4 100644
--- a/gcc/ada/libgnat/s-widlli.adb
+++ b/gcc/ada/libgnat/s-widlli.adb
@@ -29,45 +29,8 @@
-- --
------------------------------------------------------------------------------
-package body System.Wid_LLI is
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
- -----------------------------
- -- Width_Long_Long_Integer --
- -----------------------------
-
- function Width_Long_Long_Integer
- (Lo, Hi : Long_Long_Integer)
- return Natural
- is
- W : Natural;
- T : Long_Long_Integer;
-
- begin
- if Lo > Hi then
- return 0;
-
- else
- -- Minimum value is 2, one for sign, one for digit
-
- W := 2;
-
- -- Get max of absolute values, but avoid bomb if we have the maximum
- -- negative number (note that First + 1 has same digits as First)
-
- T := Long_Long_Integer'Max (
- abs (Long_Long_Integer'Max (Lo, Long_Long_Integer'First + 1)),
- abs (Long_Long_Integer'Max (Hi, Long_Long_Integer'First + 1)));
-
- -- Increase value if more digits required
-
- while T >= 10 loop
- T := T / 10;
- W := W + 1;
- end loop;
-
- return W;
- end if;
-
- end Width_Long_Long_Integer;
-
-end System.Wid_LLI;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-widlli.ads b/gcc/ada/libgnat/s-widlli.ads
index 73e95bc..a67050e 100644
--- a/gcc/ada/libgnat/s-widlli.ads
+++ b/gcc/ada/libgnat/s-widlli.ads
@@ -29,17 +29,13 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routine used for Width attribute for all
--- non-static signed integer subtypes. Note we only have one routine,
--- since this seems a fairly marginal function.
+-- Width attribute for signed integers larger than Integer
+
+with System.Width_I;
package System.Wid_LLI is
- pragma Pure;
- function Width_Long_Long_Integer
- (Lo, Hi : Long_Long_Integer)
- return Natural;
- -- Compute Width attribute for non-static type derived from a signed
- -- Integer type. The arguments Lo, Hi are the bounds of the type.
+ function Width_Long_Long_Integer is new Width_I (Long_Long_Integer);
+ pragma Pure_Function (Width_Long_Long_Integer);
end System.Wid_LLI;
diff --git a/gcc/ada/libgnat/s-widllli.ads b/gcc/ada/libgnat/s-widllli.ads
new file mode 100644
index 0000000..80ab9d1
--- /dev/null
+++ b/gcc/ada/libgnat/s-widllli.ads
@@ -0,0 +1,42 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D _ L L L I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Width attribute for signed integers larger than Long_Long_Integer
+
+with System.Width_I;
+
+package System.Wid_LLLI is
+
+ function Width_Long_Long_Long_Integer is
+ new Width_I (Long_Long_Long_Integer);
+ pragma Pure_Function (Width_Long_Long_Long_Integer);
+
+end System.Wid_LLLI;
diff --git a/gcc/ada/libgnat/s-widlllu.ads b/gcc/ada/libgnat/s-widlllu.ads
new file mode 100644
index 0000000..6f84837
--- /dev/null
+++ b/gcc/ada/libgnat/s-widlllu.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D _ L L L U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Width attribute for modular integers larger than Long_Long_Integer
+
+with System.Width_U;
+with System.Unsigned_Types;
+
+package System.Wid_LLLU is
+
+ subtype Long_Long_Long_Unsigned is Unsigned_Types.Long_Long_Long_Unsigned;
+
+ function Width_Long_Long_Long_Unsigned is
+ new Width_U (Long_Long_Long_Unsigned);
+ pragma Pure_Function (Width_Long_Long_Long_Unsigned);
+
+end System.Wid_LLLU;
diff --git a/gcc/ada/libgnat/s-widllu.adb b/gcc/ada/libgnat/s-widllu.adb
index 49ac43f..840f0a0 100644
--- a/gcc/ada/libgnat/s-widllu.adb
+++ b/gcc/ada/libgnat/s-widllu.adb
@@ -29,45 +29,8 @@
-- --
------------------------------------------------------------------------------
-with System.Unsigned_Types; use System.Unsigned_Types;
+-- This package does not require a body, since it is an instantiation. We
+-- provide a dummy file containing a No_Body pragma so that previous versions
+-- of the body (which did exist) will not interfere.
-package body System.Wid_LLU is
-
- ------------------------------
- -- Width_Long_Long_Unsigned --
- ------------------------------
-
- function Width_Long_Long_Unsigned
- (Lo, Hi : Long_Long_Unsigned)
- return Natural
- is
- W : Natural;
- T : Long_Long_Unsigned;
-
- begin
- if Lo > Hi then
- return 0;
-
- else
- -- Minimum value is 2, one for sign, one for digit
-
- W := 2;
-
- -- Get max of absolute values, but avoid bomb if we have the maximum
- -- negative number (note that First + 1 has same digits as First)
-
- T := Long_Long_Unsigned'Max (Lo, Hi);
-
- -- Increase value if more digits required
-
- while T >= 10 loop
- T := T / 10;
- W := W + 1;
- end loop;
-
- return W;
- end if;
-
- end Width_Long_Long_Unsigned;
-
-end System.Wid_LLU;
+pragma No_Body;
diff --git a/gcc/ada/libgnat/s-widllu.ads b/gcc/ada/libgnat/s-widllu.ads
index fad814c..e77eb55 100644
--- a/gcc/ada/libgnat/s-widllu.ads
+++ b/gcc/ada/libgnat/s-widllu.ads
@@ -29,19 +29,16 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routine used for Width attribute for all
--- non-static unsigned integer (modular integer) subtypes. Note we only
--- have one routine, since this seems a fairly marginal function.
+-- Width attribute for modular integers larger than Integer
+with System.Width_U;
with System.Unsigned_Types;
package System.Wid_LLU is
- pragma Pure;
- function Width_Long_Long_Unsigned
- (Lo, Hi : System.Unsigned_Types.Long_Long_Unsigned)
- return Natural;
- -- Compute Width attribute for non-static type derived from a modular
- -- integer type. The arguments Lo, Hi are the bounds of the type.
+ subtype Long_Long_Unsigned is Unsigned_Types.Long_Long_Unsigned;
+
+ function Width_Long_Long_Unsigned is new Width_U (Long_Long_Unsigned);
+ pragma Pure_Function (Width_Long_Long_Unsigned);
end System.Wid_LLU;
diff --git a/gcc/ada/libgnat/a-excpol__abort.adb b/gcc/ada/libgnat/s-widthi.adb
index 511f58c..dee6068 100644
--- a/gcc/ada/libgnat/a-excpol__abort.adb
+++ b/gcc/ada/libgnat/s-widthi.adb
@@ -1,15 +1,14 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- GNAT RUN-TIME COMPONENTS --
-- --
--- A D A . E X C E P T I O N S . P O L L --
--- (version supporting asynchronous abort test) --
+-- S Y S T E M . W I D T H _ I --
-- --
--- B o d y --
+-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
--- GNARL is free software; you can redistribute it and/or modify it under --
+-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
@@ -25,38 +24,39 @@
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
--- GNARL was developed by the GNARL team at Florida State University. --
--- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
--- This version is for targets that do not support per-thread asynchronous
--- signals. On such targets, we require compilation with the -gnatP switch
--- that activates periodic polling. Then in the body of the polling routine
--- we test for asynchronous abort.
+function System.Width_I (Lo, Hi : Int) return Natural is
+ W : Natural;
+ T : Int;
--- Windows and HPUX 10 currently use this file
+begin
+ if Lo > Hi then
+ return 0;
-pragma Warnings (Off);
--- Allow withing of non-Preelaborated units in Ada 2005 mode where this
--- package will be categorized as Preelaborate. See AI-362 for details.
--- It is safe in the context of the run-time to violate the rules.
+ else
+ -- Minimum value is 2, one for sign, one for digit
-with System.Soft_Links;
+ W := 2;
-pragma Warnings (On);
+ -- Get max of absolute values, but avoid bomb if we have the maximum
+ -- negative number (note that First + 1 has same digits as First)
-separate (Ada.Exceptions)
+ T := Int'Max (
+ abs (Int'Max (Lo, Int'First + 1)),
+ abs (Int'Max (Hi, Int'First + 1)));
-----------
--- Poll --
-----------
+ -- Increase value if more digits required
-procedure Poll is
-begin
- -- Test for asynchronous abort on each poll
+ while T >= 10 loop
+ T := T / 10;
+ W := W + 1;
+ end loop;
- if System.Soft_Links.Check_Abort_Status.all /= 0 then
- raise Standard'Abort_Signal;
+ return W;
end if;
-end Poll;
+
+end System.Width_I;
diff --git a/gcc/ada/libgnat/s-widthi.ads b/gcc/ada/libgnat/s-widthi.ads
new file mode 100644
index 0000000..570ac20
--- /dev/null
+++ b/gcc/ada/libgnat/s-widthi.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D T H _ I --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Compute Width attribute for non-static type derived from a signed integer
+-- type. The arguments Lo, Hi are the bounds of the type.
+
+generic
+
+ type Int is range <>;
+
+function System.Width_I (Lo, Hi : Int) return Natural;
diff --git a/gcc/ada/libgnat/s-widthu.adb b/gcc/ada/libgnat/s-widthu.adb
new file mode 100644
index 0000000..2469e30
--- /dev/null
+++ b/gcc/ada/libgnat/s-widthu.adb
@@ -0,0 +1,60 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D T H _ U --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+function System.Width_U (Lo, Hi : Uns) return Natural is
+ W : Natural;
+ T : Uns;
+
+begin
+ if Lo > Hi then
+ return 0;
+
+ else
+ -- Minimum value is 2, one for sign, one for digit
+
+ W := 2;
+
+ -- Get max of absolute values, but avoid bomb if we have the maximum
+ -- negative number (note that First + 1 has same digits as First)
+
+ T := Uns'Max (Lo, Hi);
+
+ -- Increase value if more digits required
+
+ while T >= 10 loop
+ T := T / 10;
+ W := W + 1;
+ end loop;
+
+ return W;
+ end if;
+
+end System.Width_U;
diff --git a/gcc/ada/libgnat/s-widthu.ads b/gcc/ada/libgnat/s-widthu.ads
new file mode 100644
index 0000000..2861738
--- /dev/null
+++ b/gcc/ada/libgnat/s-widthu.ads
@@ -0,0 +1,39 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D T H _ U --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Compute Width attribute for non-static type derived from a modular integer
+-- type. The arguments Lo, Hi are the bounds of the type.
+
+generic
+
+ type Uns is mod <>;
+
+function System.Width_U (Lo, Hi : Uns) return Natural;
diff --git a/gcc/ada/libgnat/s-widuns.ads b/gcc/ada/libgnat/s-widuns.ads
new file mode 100644
index 0000000..d93d3e2
--- /dev/null
+++ b/gcc/ada/libgnat/s-widuns.ads
@@ -0,0 +1,44 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M . W I D _ U N S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception 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/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- Width attribute for modular integers up to Integer
+
+with System.Width_U;
+with System.Unsigned_Types;
+
+package System.Wid_Uns is
+
+ subtype Unsigned is Unsigned_Types.Unsigned;
+
+ function Width_Unsigned is new Width_U (Unsigned);
+ pragma Pure_Function (Width_Unsigned);
+
+end System.Wid_Uns;
diff --git a/gcc/ada/libgnat/system-aix.ads b/gcc/ada/libgnat/system-aix.ads
index 6ffa0f5..5bf603d 100644
--- a/gcc/ada/libgnat/system-aix.ads
+++ b/gcc/ada/libgnat/system-aix.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-darwin-arm.ads b/gcc/ada/libgnat/system-darwin-arm.ads
index 4206b04..70e02a1 100644
--- a/gcc/ada/libgnat/system-darwin-arm.ads
+++ b/gcc/ada/libgnat/system-darwin-arm.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-darwin-ppc.ads b/gcc/ada/libgnat/system-darwin-ppc.ads
index b543f63..4947c6c 100644
--- a/gcc/ada/libgnat/system-darwin-ppc.ads
+++ b/gcc/ada/libgnat/system-darwin-ppc.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-darwin-x86.ads b/gcc/ada/libgnat/system-darwin-x86.ads
index 3ceacff..828b310 100644
--- a/gcc/ada/libgnat/system-darwin-x86.ads
+++ b/gcc/ada/libgnat/system-darwin-x86.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-djgpp.ads b/gcc/ada/libgnat/system-djgpp.ads
index 82b496e..68fdb49 100644
--- a/gcc/ada/libgnat/system-djgpp.ads
+++ b/gcc/ada/libgnat/system-djgpp.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-dragonfly-x86_64.ads b/gcc/ada/libgnat/system-dragonfly-x86_64.ads
index a77ebd6..6bfb5c4 100644
--- a/gcc/ada/libgnat/system-dragonfly-x86_64.ads
+++ b/gcc/ada/libgnat/system-dragonfly-x86_64.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-freebsd.ads b/gcc/ada/libgnat/system-freebsd.ads
index c2afb79..d4fe60e 100644
--- a/gcc/ada/libgnat/system-freebsd.ads
+++ b/gcc/ada/libgnat/system-freebsd.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-hpux-ia64.ads b/gcc/ada/libgnat/system-hpux-ia64.ads
index c0d5515..f11edc6 100644
--- a/gcc/ada/libgnat/system-hpux-ia64.ads
+++ b/gcc/ada/libgnat/system-hpux-ia64.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-hpux.ads b/gcc/ada/libgnat/system-hpux.ads
index 7acd350..ddf6a82 100644
--- a/gcc/ada/libgnat/system-hpux.ads
+++ b/gcc/ada/libgnat/system-hpux.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-alpha.ads b/gcc/ada/libgnat/system-linux-alpha.ads
index 1d1411e..eebe93a 100644
--- a/gcc/ada/libgnat/system-linux-alpha.ads
+++ b/gcc/ada/libgnat/system-linux-alpha.ads
@@ -48,11 +48,11 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-arm.ads b/gcc/ada/libgnat/system-linux-arm.ads
index e3ee506..4d09d9e 100644
--- a/gcc/ada/libgnat/system-linux-arm.ads
+++ b/gcc/ada/libgnat/system-linux-arm.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-hppa.ads b/gcc/ada/libgnat/system-linux-hppa.ads
index 59aab83..6bc9541 100644
--- a/gcc/ada/libgnat/system-linux-hppa.ads
+++ b/gcc/ada/libgnat/system-linux-hppa.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-ia64.ads b/gcc/ada/libgnat/system-linux-ia64.ads
index bf36c77..ae9b49a 100644
--- a/gcc/ada/libgnat/system-linux-ia64.ads
+++ b/gcc/ada/libgnat/system-linux-ia64.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-m68k.ads b/gcc/ada/libgnat/system-linux-m68k.ads
index 571c629..3fbd781 100644
--- a/gcc/ada/libgnat/system-linux-m68k.ads
+++ b/gcc/ada/libgnat/system-linux-m68k.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-mips.ads b/gcc/ada/libgnat/system-linux-mips.ads
index c381496..d760db8 100644
--- a/gcc/ada/libgnat/system-linux-mips.ads
+++ b/gcc/ada/libgnat/system-linux-mips.ads
@@ -48,11 +48,11 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-ppc.ads b/gcc/ada/libgnat/system-linux-ppc.ads
index f3d3712..0f39370 100644
--- a/gcc/ada/libgnat/system-linux-ppc.ads
+++ b/gcc/ada/libgnat/system-linux-ppc.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-riscv.ads b/gcc/ada/libgnat/system-linux-riscv.ads
index 676394a..91eddf2 100644
--- a/gcc/ada/libgnat/system-linux-riscv.ads
+++ b/gcc/ada/libgnat/system-linux-riscv.ads
@@ -48,11 +48,11 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-s390.ads b/gcc/ada/libgnat/system-linux-s390.ads
index 916f68d..374b938 100644
--- a/gcc/ada/libgnat/system-linux-s390.ads
+++ b/gcc/ada/libgnat/system-linux-s390.ads
@@ -48,11 +48,11 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-sh4.ads b/gcc/ada/libgnat/system-linux-sh4.ads
index 8940ab0..cd811de 100644
--- a/gcc/ada/libgnat/system-linux-sh4.ads
+++ b/gcc/ada/libgnat/system-linux-sh4.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-sparc.ads b/gcc/ada/libgnat/system-linux-sparc.ads
index 5d93b76..e74214b 100644
--- a/gcc/ada/libgnat/system-linux-sparc.ads
+++ b/gcc/ada/libgnat/system-linux-sparc.ads
@@ -48,11 +48,11 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-linux-x86.ads b/gcc/ada/libgnat/system-linux-x86.ads
index 7e30fee..eb8b5dd 100644
--- a/gcc/ada/libgnat/system-linux-x86.ads
+++ b/gcc/ada/libgnat/system-linux-x86.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-lynxos178-ppc.ads b/gcc/ada/libgnat/system-lynxos178-ppc.ads
index 8882034..cf516e1 100644
--- a/gcc/ada/libgnat/system-lynxos178-ppc.ads
+++ b/gcc/ada/libgnat/system-lynxos178-ppc.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-lynxos178-x86.ads b/gcc/ada/libgnat/system-lynxos178-x86.ads
index 3a5f297..c151472 100644
--- a/gcc/ada/libgnat/system-lynxos178-x86.ads
+++ b/gcc/ada/libgnat/system-lynxos178-x86.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-mingw.ads b/gcc/ada/libgnat/system-mingw.ads
index 990c5f5..cf960da 100644
--- a/gcc/ada/libgnat/system-mingw.ads
+++ b/gcc/ada/libgnat/system-mingw.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-qnx-aarch64.ads b/gcc/ada/libgnat/system-qnx-aarch64.ads
index a04f7b2..37b8fd1 100644
--- a/gcc/ada/libgnat/system-qnx-aarch64.ads
+++ b/gcc/ada/libgnat/system-qnx-aarch64.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-rtems.ads b/gcc/ada/libgnat/system-rtems.ads
index 50a96a3..099c234 100644
--- a/gcc/ada/libgnat/system-rtems.ads
+++ b/gcc/ada/libgnat/system-rtems.ads
@@ -52,11 +52,11 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
- Max_Nonbinary_Modulus : constant := Integer'Last;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
+ Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
Max_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-solaris-sparc.ads b/gcc/ada/libgnat/system-solaris-sparc.ads
index 244042c..0e1ce01 100644
--- a/gcc/ada/libgnat/system-solaris-sparc.ads
+++ b/gcc/ada/libgnat/system-solaris-sparc.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-solaris-x86.ads b/gcc/ada/libgnat/system-solaris-x86.ads
index c77c916..010ce5b 100644
--- a/gcc/ada/libgnat/system-solaris-x86.ads
+++ b/gcc/ada/libgnat/system-solaris-x86.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-arm-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks-arm-rtp-smp.ads
index 1186d8b..91806e5 100644
--- a/gcc/ada/libgnat/system-vxworks-arm-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks-arm-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-arm-rtp.ads b/gcc/ada/libgnat/system-vxworks-arm-rtp.ads
index ce52c07..de13974 100644
--- a/gcc/ada/libgnat/system-vxworks-arm-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks-arm-rtp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-arm.ads b/gcc/ada/libgnat/system-vxworks-arm.ads
index 4dc6be8..fac4e72 100644
--- a/gcc/ada/libgnat/system-vxworks-arm.ads
+++ b/gcc/ada/libgnat/system-vxworks-arm.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-e500-kernel.ads b/gcc/ada/libgnat/system-vxworks-e500-kernel.ads
index 44b713a..cf89c2d 100644
--- a/gcc/ada/libgnat/system-vxworks-e500-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks-e500-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-e500-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks-e500-rtp-smp.ads
index a3e8f41..862f3f6 100644
--- a/gcc/ada/libgnat/system-vxworks-e500-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks-e500-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-e500-rtp.ads b/gcc/ada/libgnat/system-vxworks-e500-rtp.ads
index 5a26eed..a3baecb 100644
--- a/gcc/ada/libgnat/system-vxworks-e500-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks-e500-rtp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-e500-vthread.ads b/gcc/ada/libgnat/system-vxworks-e500-vthread.ads
index df96432..fc92958 100644
--- a/gcc/ada/libgnat/system-vxworks-e500-vthread.ads
+++ b/gcc/ada/libgnat/system-vxworks-e500-vthread.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-ppc-kernel.ads b/gcc/ada/libgnat/system-vxworks-ppc-kernel.ads
index 76ec6eb..383c820 100644
--- a/gcc/ada/libgnat/system-vxworks-ppc-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks-ppc-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-ppc-ravenscar.ads b/gcc/ada/libgnat/system-vxworks-ppc-ravenscar.ads
index 8485e74..53a1f9e 100644
--- a/gcc/ada/libgnat/system-vxworks-ppc-ravenscar.ads
+++ b/gcc/ada/libgnat/system-vxworks-ppc-ravenscar.ads
@@ -73,10 +73,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads
index 17b7f2c..aa99413 100644
--- a/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-ppc-rtp.ads b/gcc/ada/libgnat/system-vxworks-ppc-rtp.ads
index a57563d..acb20c4 100644
--- a/gcc/ada/libgnat/system-vxworks-ppc-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks-ppc-rtp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-ppc-vthread.ads b/gcc/ada/libgnat/system-vxworks-ppc-vthread.ads
index 9d2c379..aca420e 100644
--- a/gcc/ada/libgnat/system-vxworks-ppc-vthread.ads
+++ b/gcc/ada/libgnat/system-vxworks-ppc-vthread.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-ppc.ads b/gcc/ada/libgnat/system-vxworks-ppc.ads
index 20b8674..99644ee 100644
--- a/gcc/ada/libgnat/system-vxworks-ppc.ads
+++ b/gcc/ada/libgnat/system-vxworks-ppc.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-x86-kernel.ads b/gcc/ada/libgnat/system-vxworks-x86-kernel.ads
index 42d8769..3781020 100644
--- a/gcc/ada/libgnat/system-vxworks-x86-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks-x86-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-x86-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks-x86-rtp-smp.ads
index 8bed920..374041c 100644
--- a/gcc/ada/libgnat/system-vxworks-x86-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks-x86-rtp-smp.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-x86-rtp.ads b/gcc/ada/libgnat/system-vxworks-x86-rtp.ads
index fd20986..cff7291 100644
--- a/gcc/ada/libgnat/system-vxworks-x86-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks-x86-rtp.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-x86-vthread.ads b/gcc/ada/libgnat/system-vxworks-x86-vthread.ads
index 418e52b..1867196 100644
--- a/gcc/ada/libgnat/system-vxworks-x86-vthread.ads
+++ b/gcc/ada/libgnat/system-vxworks-x86-vthread.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks-x86.ads b/gcc/ada/libgnat/system-vxworks-x86.ads
index 6059202..c82a61f 100644
--- a/gcc/ada/libgnat/system-vxworks-x86.ads
+++ b/gcc/ada/libgnat/system-vxworks-x86.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-aarch64-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-aarch64-rtp-smp.ads
index 524f967..37bf607 100644
--- a/gcc/ada/libgnat/system-vxworks7-aarch64-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-aarch64-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-aarch64.ads b/gcc/ada/libgnat/system-vxworks7-aarch64.ads
index f1e11ba..c386500 100644
--- a/gcc/ada/libgnat/system-vxworks7-aarch64.ads
+++ b/gcc/ada/libgnat/system-vxworks7-aarch64.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-arm-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-arm-rtp-smp.ads
index 032620d..7e2db7a 100644
--- a/gcc/ada/libgnat/system-vxworks7-arm-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-arm-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-arm.ads b/gcc/ada/libgnat/system-vxworks7-arm.ads
index 4dc6be8..fac4e72 100644
--- a/gcc/ada/libgnat/system-vxworks7-arm.ads
+++ b/gcc/ada/libgnat/system-vxworks7-arm.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-e500-kernel.ads b/gcc/ada/libgnat/system-vxworks7-e500-kernel.ads
index 495cfed..e03264e 100644
--- a/gcc/ada/libgnat/system-vxworks7-e500-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks7-e500-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-e500-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-e500-rtp-smp.ads
index 2633156..a9b3317 100644
--- a/gcc/ada/libgnat/system-vxworks7-e500-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-e500-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-e500-rtp.ads b/gcc/ada/libgnat/system-vxworks7-e500-rtp.ads
index a521d25..3e963d0 100644
--- a/gcc/ada/libgnat/system-vxworks7-e500-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-e500-rtp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-ppc-kernel.ads b/gcc/ada/libgnat/system-vxworks7-ppc-kernel.ads
index a054aa2..93b3271 100644
--- a/gcc/ada/libgnat/system-vxworks7-ppc-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks7-ppc-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-ppc-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-ppc-rtp-smp.ads
index 7e3e16db..e5d984b 100644
--- a/gcc/ada/libgnat/system-vxworks7-ppc-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-ppc-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-ppc-rtp.ads b/gcc/ada/libgnat/system-vxworks7-ppc-rtp.ads
index 87ac8f0..e96d303 100644
--- a/gcc/ada/libgnat/system-vxworks7-ppc-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-ppc-rtp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-ppc64-kernel.ads b/gcc/ada/libgnat/system-vxworks7-ppc64-kernel.ads
index c631a85..90499f6 100644
--- a/gcc/ada/libgnat/system-vxworks7-ppc64-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks7-ppc64-kernel.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-ppc64-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-ppc64-rtp-smp.ads
index 9f27913..49b22b6 100644
--- a/gcc/ada/libgnat/system-vxworks7-ppc64-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-ppc64-rtp-smp.ads
@@ -50,10 +50,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-x86-kernel.ads b/gcc/ada/libgnat/system-vxworks7-x86-kernel.ads
index 5bfe0b3..d7b35dd 100644
--- a/gcc/ada/libgnat/system-vxworks7-x86-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks7-x86-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-x86-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-x86-rtp-smp.ads
index 5e66142..293ede8 100644
--- a/gcc/ada/libgnat/system-vxworks7-x86-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-x86-rtp-smp.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-x86-rtp.ads b/gcc/ada/libgnat/system-vxworks7-x86-rtp.ads
index 47ca3e8..caf458f 100644
--- a/gcc/ada/libgnat/system-vxworks7-x86-rtp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-x86-rtp.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-x86_64-kernel.ads b/gcc/ada/libgnat/system-vxworks7-x86_64-kernel.ads
index ac90238..a5f00ff 100644
--- a/gcc/ada/libgnat/system-vxworks7-x86_64-kernel.ads
+++ b/gcc/ada/libgnat/system-vxworks7-x86_64-kernel.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/libgnat/system-vxworks7-x86_64-rtp-smp.ads b/gcc/ada/libgnat/system-vxworks7-x86_64-rtp-smp.ads
index c3e4a9c..05e69e5 100644
--- a/gcc/ada/libgnat/system-vxworks7-x86_64-rtp-smp.ads
+++ b/gcc/ada/libgnat/system-vxworks7-x86_64-rtp-smp.ads
@@ -48,10 +48,10 @@ package System is
-- System-Dependent Named Numbers
- Min_Int : constant := Long_Long_Integer'First;
- Max_Int : constant := Long_Long_Integer'Last;
+ Min_Int : constant := -2 ** (Standard'Max_Integer_Size - 1);
+ Max_Int : constant := 2 ** (Standard'Max_Integer_Size - 1) - 1;
- Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Binary_Modulus : constant := 2 ** Standard'Max_Integer_Size;
Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1;
Max_Base_Digits : constant := Long_Long_Float'Digits;
diff --git a/gcc/ada/namet-sp.adb b/gcc/ada/namet-sp.adb
index d3106bc..b64a1f1 100644
--- a/gcc/ada/namet-sp.adb
+++ b/gcc/ada/namet-sp.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/namet-sp.ads b/gcc/ada/namet-sp.ads
index f4a6fed..3d75460 100644
--- a/gcc/ada/namet-sp.ads
+++ b/gcc/ada/namet-sp.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb
index e39e0b9..557232d 100644
--- a/gcc/ada/namet.adb
+++ b/gcc/ada/namet.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -1094,6 +1088,15 @@ package body Namet is
return Id in Name_Entries.First .. Name_Entries.Last;
end Is_Valid_Name;
+ ------------------
+ -- Last_Name_Id --
+ ------------------
+
+ function Last_Name_Id return Name_Id is
+ begin
+ return Name_Id (Int (First_Name_Id) + Name_Entries_Count - 1);
+ end Last_Name_Id;
+
--------------------
-- Length_Of_Name --
--------------------
diff --git a/gcc/ada/namet.ads b/gcc/ada/namet.ads
index ce7cac1..f3c7c5b4 100644
--- a/gcc/ada/namet.ads
+++ b/gcc/ada/namet.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -437,6 +431,10 @@ package Namet is
function Name_Entries_Count return Nat;
-- Return current number of entries in the names table
+ function Last_Name_Id return Name_Id;
+ -- Return the last Name_Id in the table. This information is valid until
+ -- new names have been added.
+
--------------------------
-- Obsolete Subprograms --
--------------------------
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb
index 29eec04..02859c7 100644
--- a/gcc/ada/nlists.adb
+++ b/gcc/ada/nlists.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -338,8 +332,6 @@ package body Nlists is
----------------
procedure Initialize is
- E : constant List_Id := Error_List;
-
begin
Lists.Init;
Next_Node.Init;
@@ -348,9 +340,9 @@ package body Nlists is
-- Allocate Error_List list header
Lists.Increment_Last;
- Set_Parent (E, Empty);
- Set_First (E, Empty);
- Set_Last (E, Empty);
+ Set_Parent (Error_List, Empty);
+ Set_First (Error_List, Empty);
+ Set_Last (Error_List, Empty);
end Initialize;
------------------
diff --git a/gcc/ada/nlists.ads b/gcc/ada/nlists.ads
index 67fc661..169c8e5 100644
--- a/gcc/ada/nlists.ads
+++ b/gcc/ada/nlists.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -377,6 +371,7 @@ package Nlists is
-- "if Present (Statements)" as opposed to "if Statements /= No_List".
procedure Allocate_List_Tables (N : Node_Or_Entity_Id);
+ pragma Inline (Allocate_List_Tables);
-- Called when nodes table is expanded to include node N. This call
-- makes sure that list structures internal to Nlists are adjusted
-- appropriately to reflect this increase in the size of the nodes table.
diff --git a/gcc/ada/opt.adb b/gcc/ada/opt.adb
index 2d21b56..8ad6d3a 100644
--- a/gcc/ada/opt.adb
+++ b/gcc/ada/opt.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -98,7 +92,6 @@ package body Opt is
No_Component_Reordering_Config := No_Component_Reordering;
Optimize_Alignment_Config := Optimize_Alignment;
Persistent_BSS_Mode_Config := Persistent_BSS_Mode;
- Polling_Required_Config := Polling_Required;
Prefix_Exception_Messages_Config := Prefix_Exception_Messages;
SPARK_Mode_Config := SPARK_Mode;
SPARK_Mode_Pragma_Config := SPARK_Mode_Pragma;
@@ -139,7 +132,6 @@ package body Opt is
Optimize_Alignment := Save.Optimize_Alignment;
Optimize_Alignment_Local := Save.Optimize_Alignment_Local;
Persistent_BSS_Mode := Save.Persistent_BSS_Mode;
- Polling_Required := Save.Polling_Required;
Prefix_Exception_Messages := Save.Prefix_Exception_Messages;
SPARK_Mode := Save.SPARK_Mode;
SPARK_Mode_Pragma := Save.SPARK_Mode_Pragma;
@@ -183,7 +175,6 @@ package body Opt is
Optimize_Alignment => Optimize_Alignment,
Optimize_Alignment_Local => Optimize_Alignment_Local,
Persistent_BSS_Mode => Persistent_BSS_Mode,
- Polling_Required => Polling_Required,
Prefix_Exception_Messages => Prefix_Exception_Messages,
SPARK_Mode => SPARK_Mode,
SPARK_Mode_Pragma => SPARK_Mode_Pragma,
@@ -302,7 +293,6 @@ package body Opt is
Default_Pool := Default_Pool_Config;
Exception_Locations_Suppressed := Exception_Locations_Suppressed_Config;
Fast_Math := Fast_Math_Config;
- Polling_Required := Polling_Required_Config;
end Set_Config_Switches;
end Opt;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 885a6fb..7ec44dc 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -1199,6 +1193,12 @@ package Opt is
-- If a pragma No_Tagged_Streams is active for the current scope, this
-- points to the corresponding pragma.
+ Nodes_Size_In_Meg : Nat := 0;
+ -- GNAT
+ -- Amount of memory to allocate for all nodes, in units of 2**20 bytes.
+ -- Set by the -gnaten switch; 0 means -gnaten was not given, and a default
+ -- value should be used.
+
Normalize_Scalars : Boolean := False;
-- GNAT, GNATBIND
-- Set True if a pragma Normalize_Scalars applies to the current unit.
@@ -1306,11 +1306,6 @@ package Opt is
-- GNATBIND
-- True if pessimistic elaboration order is to be chosen (-p switch set)
- Polling_Required : Boolean := False;
- -- GNAT
- -- Set to True if polling for asynchronous abort is enabled by using
- -- the -gnatP option for GNAT.
-
Prefix_Exception_Messages : Boolean := False;
-- GNAT
-- Set True to prefix exception messages with entity-name:
@@ -2103,14 +2098,6 @@ package Opt is
-- at the start of each compilation unit, except that it is always
-- set False for predefined units.
- Polling_Required_Config : Boolean;
- -- GNAT
- -- This is the value of the configuration switch that controls polling
- -- mode. It can be set True by the command line switch -gnatP, and then
- -- further modified by the use of pragma Polling in the gnat.adc file. This
- -- flag is used to set the initial value for Polling_Required at the start
- -- of analyzing each unit.
-
Prefix_Exception_Messages_Config : Boolean;
-- The setting of Prefix_Exception_Messages from configuration pragmas
@@ -2338,7 +2325,6 @@ private
Optimize_Alignment : Character;
Optimize_Alignment_Local : Boolean;
Persistent_BSS_Mode : Boolean;
- Polling_Required : Boolean;
Prefix_Exception_Messages : Boolean;
SPARK_Mode : SPARK_Mode_Type;
SPARK_Mode_Pragma : Node_Id;
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 3ae76cf..e935c2b 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -1072,7 +1072,7 @@ package body Osint is
function File_Hash (F : File_Name_Type) return File_Hash_Num is
begin
- return File_Hash_Num (Int (F) rem File_Hash_Num'Range_Length);
+ return File_Hash_Num (Int (F) mod File_Hash_Num'Range_Length);
end File_Hash;
-----------------
diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb
index 971819b..432247f 100644
--- a/gcc/ada/output.adb
+++ b/gcc/ada/output.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/output.ads b/gcc/ada/output.ads
index 55d308a..d501602 100644
--- a/gcc/ada/output.ads
+++ b/gcc/ada/output.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/par-ch13.adb b/gcc/ada/par-ch13.adb
index 0b0319d..95223a1 100644
--- a/gcc/ada/par-ch13.adb
+++ b/gcc/ada/par-ch13.adb
@@ -153,9 +153,8 @@ package body Ch13 is
Result := True;
else
Scan; -- past identifier
- Result := Token = Tok_Arrow or else
- Token = Tok_Comma or else
- Token = Tok_Semicolon;
+ Result := Token in
+ Tok_Arrow | Tok_Comma | Tok_Is | Tok_Semicolon | Tok_Right_Paren;
end if;
-- If earlier than Ada 2012, check for valid aspect identifier (possibly
@@ -178,7 +177,7 @@ package body Ch13 is
-- defaulted True value. Further checks when analyzing aspect
-- specification, which may include further aspects.
- elsif Token = Tok_Comma or else Token = Tok_Semicolon then
+ elsif Token in Tok_Comma | Tok_Semicolon then
Result := True;
elsif Token = Tok_Apostrophe then
@@ -265,7 +264,8 @@ package body Ch13 is
-- The aspect mark is not recognized
if A_Id = No_Aspect then
- Error_Msg_N ("& is not a valid aspect identifier", Token_Node);
+ Error_Msg_Warn := not Debug_Flag_2;
+ Error_Msg_N ("<<& is not a valid aspect identifier", Token_Node);
OK := False;
-- Check bad spelling
@@ -274,7 +274,7 @@ package body Ch13 is
if Is_Bad_Spelling_Of (Token_Name, Aspect_Names (J)) then
Error_Msg_Name_1 := Aspect_Names (J);
Error_Msg_N -- CODEFIX
- ("\possible misspelling of%", Token_Node);
+ ("\<<possible misspelling of%", Token_Node);
exit;
end if;
end loop;
@@ -957,7 +957,7 @@ package body Ch13 is
-- If Decl is Error, we ignore the aspects, and issue a message
elsif Decl = Error
- or else not Permits_Aspect_Specifications (Decl)
+ or else not Permits_Aspect_Specifications (Decl)
then
Error_Msg ("aspect specifications not allowed here", Ptr);
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index adaa3e2..017a0a1 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -2810,7 +2810,7 @@ package body Ch3 is
-- end if;
Set_Subtype_Indication (CompDef_Node, Empty);
- Set_Aliased_Present (CompDef_Node, False);
+ Set_Aliased_Present (CompDef_Node, Aliased_Present);
Set_Access_Definition (CompDef_Node,
P_Access_Definition (Not_Null_Present));
else
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 9815ca1..925da76 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -281,9 +281,10 @@ package body Ch4 is
goto Scan_Name_Extension;
end if;
- -- We have scanned out a qualified simple name, check for name extension
- -- Note that we know there is no dot here at this stage, so the only
- -- possible cases of name extension are apostrophe and left paren.
+ -- We have scanned out a qualified simple name, check for name
+ -- extension. Note that we know there is no dot here at this stage,
+ -- so the only possible cases of name extension are apostrophe followed
+ -- by '(' or '['.
if Token = Tok_Apostrophe then
Save_Scan_State (Scan_State); -- at apostrophe
@@ -291,7 +292,9 @@ package body Ch4 is
-- Qualified expression in Ada 2012 mode (treated as a name)
- if Ada_Version >= Ada_2012 and then Token = Tok_Left_Paren then
+ if Ada_Version >= Ada_2012
+ and then Token in Tok_Left_Paren | Tok_Left_Bracket
+ then
goto Scan_Name_Extension_Apostrophe;
-- If left paren not in Ada 2012, then it is not part of the name,
@@ -445,7 +448,9 @@ package body Ch4 is
begin
-- Check for qualified expression case in Ada 2012 mode
- if Ada_Version >= Ada_2012 and then Token = Tok_Left_Paren then
+ if Ada_Version >= Ada_2012
+ and then Token in Tok_Left_Paren | Tok_Left_Bracket
+ then
Name_Node := P_Qualified_Expression (Name_Node);
goto Scan_Name_Extension;
@@ -1386,11 +1391,14 @@ package body Ch4 is
return Maybe;
end Is_Quantified_Expression;
+ Start_Token : constant Token_Type := Token;
+ -- Used to prevent mismatches (...] and [...)
+
-- Start of processing for P_Aggregate_Or_Paren_Expr
begin
Lparen_Sloc := Token_Ptr;
- if Token = Tok_Left_Bracket and then Ada_Version >= Ada_2020 then
+ if Token = Tok_Left_Bracket then
Scan;
-- Special case for null aggregate in Ada 2020
@@ -1599,8 +1607,11 @@ package body Ch4 is
-- identifier or OTHERS follows (the latter cases are missing
-- comma cases). Also assume positional if a semicolon follows,
-- which can happen if there are missing parens.
+ -- In Ada_2012 and Ada_2020 an iterated association can appear.
- elsif Nkind (Expr_Node) = N_Iterated_Component_Association then
+ elsif Nkind (Expr_Node) in
+ N_Iterated_Component_Association | N_Iterated_Element_Association
+ then
if No (Assoc_List) then
Assoc_List := New_List (Expr_Node);
else
@@ -1692,23 +1703,26 @@ package body Ch4 is
end if;
end loop;
- -- All component associations (positional and named) have been scanned
+ -- All component associations (positional and named) have been scanned.
+ -- Scan ] or ) based on Start_Token.
- if Token = Tok_Right_Bracket and then Ada_Version >= Ada_2020 then
- Set_Component_Associations (Aggregate_Node, Assoc_List);
- Set_Is_Homogeneous_Aggregate (Aggregate_Node);
- Scan; -- past right bracket
+ case Start_Token is
+ when Tok_Left_Bracket =>
+ Set_Component_Associations (Aggregate_Node, Assoc_List);
+ Set_Is_Homogeneous_Aggregate (Aggregate_Node);
+ T_Right_Bracket;
- if Token = Tok_Apostrophe then
- Scan;
+ if Token = Tok_Apostrophe then
+ Scan;
- if Token = Tok_Identifier then
- return P_Reduction_Attribute_Reference (Aggregate_Node);
+ if Token = Tok_Identifier then
+ return P_Reduction_Attribute_Reference (Aggregate_Node);
+ end if;
end if;
- end if;
- else
- T_Right_Paren;
- end if;
+ when Tok_Left_Paren =>
+ T_Right_Paren;
+ when others => raise Program_Error;
+ end case;
if Nkind (Aggregate_Node) /= N_Delta_Aggregate then
Set_Expressions (Aggregate_Node, Expr_List);
@@ -3406,11 +3420,38 @@ package body Ch4 is
function P_Iterated_Component_Association return Node_Id is
Assoc_Node : Node_Id;
+ Choice : Node_Id;
+ Filter : Node_Id := Empty;
Id : Node_Id;
Iter_Spec : Node_Id;
Loop_Spec : Node_Id;
State : Saved_Scan_State;
+ procedure Build_Iterated_Element_Association;
+ -- If the iterator includes a key expression or a filter, it is
+ -- an Ada_2020 Iterator_Element_Association within a container
+ -- aggregate.
+
+ ----------------------------------------
+ -- Build_Iterated_Element_Association --
+ ----------------------------------------
+
+ procedure Build_Iterated_Element_Association is
+ begin
+ Choice := First (Discrete_Choices (Assoc_Node));
+ Assoc_Node :=
+ New_Node (N_Iterated_Element_Association, Prev_Token_Ptr);
+ Set_Loop_Parameter_Specification (Assoc_Node, Loop_Spec);
+
+ if Present (Next (Choice)) then
+ Error_Msg_N ("expect loop parameter specification", Choice);
+ end if;
+
+ Remove (Choice);
+ Set_Discrete_Subtype_Definition (Loop_Spec, Choice);
+ Set_Iterator_Filter (Loop_Spec, Filter);
+ end Build_Iterated_Element_Association;
+
-- Start of processing for P_Iterated_Component_Association
begin
@@ -3428,6 +3469,8 @@ package body Ch4 is
-- In addition, if "use" is present after the specification,
-- this is an Iterated_Element_Association that carries a
-- key_expression, and we generate the appropriate node.
+ -- Finally, the Iterated_Element form is reserved for contwiner
+ -- aggregates, and is illegal in array aggregates.
Id := P_Defining_Identifier;
Assoc_Node :=
@@ -3438,19 +3481,34 @@ package body Ch4 is
T_In;
Set_Discrete_Choices (Assoc_Node, P_Discrete_Choice_List);
+ -- The iterator may include a filter.
+
+ if Token = Tok_When then
+ Scan; -- past WHEN
+ Filter := P_Condition;
+ end if;
+
+ -- Build loop_parameter specification.
+
+ Loop_Spec :=
+ New_Node (N_Loop_Parameter_Specification, Prev_Token_Ptr);
+ Set_Defining_Identifier (Loop_Spec, Id);
+
if Token = Tok_Use then
- -- Key-expression is present, rewrite node as an
+ -- Ada_2020 Key-expression is present, rewrite node as an
-- iterated_Element_Awwoiation.
Scan; -- past USE
- Loop_Spec :=
- New_Node (N_Loop_Parameter_Specification, Prev_Token_Ptr);
- Set_Defining_Identifier (Loop_Spec, Id);
- Set_Discrete_Subtype_Definition (Loop_Spec,
- First (Discrete_Choices (Assoc_Node)));
- Set_Loop_Parameter_Specification (Assoc_Node, Loop_Spec);
+ Build_Iterated_Element_Association;
Set_Key_Expression (Assoc_Node, P_Expression);
+
+ elsif Present (Filter) then
+ -- A loop_Parameter_Specification also indicates an Ada_2020
+ -- conwtruct, in contrast with a subtype indication used in
+ -- array aggregates.
+
+ Build_Iterated_Element_Association;
end if;
TF_Arrow;
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 1ff7950..622a508 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -1627,6 +1627,25 @@ package body Ch6 is
Scan; -- past right paren
exit Specification_Loop;
+ -- Support for aspects on formal parameters is a GNAT extension for
+ -- the time being.
+
+ elsif Token = Tok_With then
+ if not Extensions_Allowed then
+ Error_Msg_SP ("aspect on formal parameter requires -gnatX");
+ end if;
+
+ P_Aspect_Specifications (Specification_Node, False);
+
+ if Token = Tok_Right_Paren then
+ Scan; -- past right paren
+ exit Specification_Loop;
+
+ elsif Token = Tok_Semicolon then
+ Save_Scan_State (Scan_State);
+ Scan; -- past semicolon
+ end if;
+
-- Special check for common error of using comma instead of semicolon
elsif Token = Tok_Comma then
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 265f187..5783c33 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -1449,7 +1449,6 @@ begin
| Pragma_Partition_Elaboration_Policy
| Pragma_Passive
| Pragma_Persistent_BSS
- | Pragma_Polling
| Pragma_Post
| Pragma_Post_Class
| Pragma_Postcondition
@@ -1497,6 +1496,7 @@ begin
| Pragma_Storage_Unit
| Pragma_Stream_Convert
| Pragma_Subtitle
+ | Pragma_Subprogram_Variant
| Pragma_Suppress
| Pragma_Suppress_Debug_Info
| Pragma_Suppress_Exception_Locations
diff --git a/gcc/ada/par-tchk.adb b/gcc/ada/par-tchk.adb
index 8eb705e..65ff45a 100644
--- a/gcc/ada/par-tchk.adb
+++ b/gcc/ada/par-tchk.adb
@@ -402,6 +402,20 @@ package body Tchk is
Check_Token (Tok_Record, AP);
end T_Record;
+ ---------------------
+ -- T_Right_Bracket --
+ ---------------------
+
+ procedure T_Right_Bracket is
+ begin
+ if Token = Tok_Right_Bracket then
+ Scan;
+ else
+ Error_Msg_AP -- CODEFIX
+ ("|missing ""']'""");
+ end if;
+ end T_Right_Bracket;
+
-------------------
-- T_Right_Paren --
-------------------
diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index 1dee1e7..4c3a154 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -995,10 +995,10 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
procedure P_Aspect_Specifications
(Decl : Node_Id;
Semicolon : Boolean := True);
- -- This procedure scans out a series of aspect spefications. If argument
- -- Semicolon is True, a terminating semicolon is also scanned. If this
- -- argument is False, the scan pointer is left pointing past the aspects
- -- and the caller must check for a proper terminator.
+ -- This procedure scans out a series of aspect specifications. If
+ -- argument Semicolon is True, a terminating semicolon is also scanned.
+ -- If this argument is False, the scan pointer is left pointing past the
+ -- aspects and the caller must check for a proper terminator.
--
-- P_Aspect_Specifications is called with the current token pointing
-- to either a WITH keyword starting an aspect specification, or an
@@ -1212,6 +1212,7 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
procedure T_Private;
procedure T_Range;
procedure T_Record;
+ procedure T_Right_Bracket;
procedure T_Right_Paren;
procedure T_Semicolon;
procedure T_Then;
diff --git a/gcc/ada/rident.ads b/gcc/ada/rident.ads
index 36ffb68..e9f538c 100644
--- a/gcc/ada/rident.ads
+++ b/gcc/ada/rident.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 7689375..872ce01 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -589,7 +589,10 @@ package body Rtsfind is
range CUDA_Driver_Types .. CUDA_Vector_Types;
subtype Interfaces_Descendant is RTU_Id
- range Interfaces_Packed_Decimal .. Interfaces_Packed_Decimal;
+ range Interfaces_C .. Interfaces_C_Strings;
+
+ subtype Interfaces_C_Descendant is Interfaces_Descendant
+ range Interfaces_C_Strings .. Interfaces_C_Strings;
subtype System_Descendant is RTU_Id
range System_Address_Image .. System_Tasking_Stages;
@@ -674,6 +677,10 @@ package body Rtsfind is
elsif U_Id in Interfaces_Descendant then
Name_Buffer (11) := '.';
+ if U_Id in Interfaces_C_Descendant then
+ Name_Buffer (13) := '.';
+ end if;
+
elsif U_Id in System_Descendant then
Name_Buffer (7) := '.';
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index ff9eb0a..42578db 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -159,13 +159,15 @@ package Rtsfind is
Ada_Wide_Wide_Text_IO_Integer_IO,
Ada_Wide_Wide_Text_IO_Modular_IO,
- -- CUDA
+ -- Package CUDA
CUDA,
-- Children of CUDA
CUDA_Driver_Types,
+ CUDA_Internal,
+ CUDA_Runtime_Api,
CUDA_Vector_Types,
-- Interfaces
@@ -174,8 +176,13 @@ package Rtsfind is
-- Children of Interfaces
+ Interfaces_C,
Interfaces_Packed_Decimal,
+ -- Children of Interfaces.C
+
+ Interfaces_C_Strings,
+
-- Package System
System,
@@ -185,6 +192,7 @@ package Rtsfind is
System_Address_Image,
System_Address_To_Access_Conversions,
System_Arith_64,
+ System_Arith_128,
System_AST_Handling,
System_Assertions,
System_Atomic_Primitives,
@@ -195,14 +203,16 @@ package Rtsfind is
System_Boolean_Array_Operations,
System_Byte_Swapping,
System_Checked_Pools,
+ System_Compare_Array_Signed_8,
System_Compare_Array_Signed_16,
System_Compare_Array_Signed_32,
System_Compare_Array_Signed_64,
- System_Compare_Array_Signed_8,
+ System_Compare_Array_Signed_128,
+ System_Compare_Array_Unsigned_8,
System_Compare_Array_Unsigned_16,
System_Compare_Array_Unsigned_32,
System_Compare_Array_Unsigned_64,
- System_Compare_Array_Unsigned_8,
+ System_Compare_Array_Unsigned_128,
System_Concat_2,
System_Concat_3,
System_Concat_4,
@@ -220,10 +230,12 @@ package Rtsfind is
System_Exn_Int,
System_Exn_LLF,
System_Exn_LLI,
+ System_Exn_LLLI,
System_Exp_Int,
- System_Exp_LInt,
System_Exp_LLI,
+ System_Exp_LLLI,
System_Exp_LLU,
+ System_Exp_LLLU,
System_Exp_Mod,
System_Exp_Uns,
System_Fat_Flt,
@@ -246,7 +258,9 @@ package Rtsfind is
System_Img_Int,
System_Img_LLD,
System_Img_LLI,
+ System_Img_LLLI,
System_Img_LLU,
+ System_Img_LLLU,
System_Img_Name,
System_Img_Real,
System_Img_Uns,
@@ -315,6 +329,69 @@ package Rtsfind is
System_Pack_61,
System_Pack_62,
System_Pack_63,
+ System_Pack_65,
+ System_Pack_66,
+ System_Pack_67,
+ System_Pack_68,
+ System_Pack_69,
+ System_Pack_70,
+ System_Pack_71,
+ System_Pack_72,
+ System_Pack_73,
+ System_Pack_74,
+ System_Pack_75,
+ System_Pack_76,
+ System_Pack_77,
+ System_Pack_78,
+ System_Pack_79,
+ System_Pack_80,
+ System_Pack_81,
+ System_Pack_82,
+ System_Pack_83,
+ System_Pack_84,
+ System_Pack_85,
+ System_Pack_86,
+ System_Pack_87,
+ System_Pack_88,
+ System_Pack_89,
+ System_Pack_90,
+ System_Pack_91,
+ System_Pack_92,
+ System_Pack_93,
+ System_Pack_94,
+ System_Pack_95,
+ System_Pack_96,
+ System_Pack_97,
+ System_Pack_98,
+ System_Pack_99,
+ System_Pack_100,
+ System_Pack_101,
+ System_Pack_102,
+ System_Pack_103,
+ System_Pack_104,
+ System_Pack_105,
+ System_Pack_106,
+ System_Pack_107,
+ System_Pack_108,
+ System_Pack_109,
+ System_Pack_110,
+ System_Pack_111,
+ System_Pack_112,
+ System_Pack_113,
+ System_Pack_114,
+ System_Pack_115,
+ System_Pack_116,
+ System_Pack_117,
+ System_Pack_118,
+ System_Pack_119,
+ System_Pack_120,
+ System_Pack_121,
+ System_Pack_122,
+ System_Pack_123,
+ System_Pack_124,
+ System_Pack_125,
+ System_Pack_126,
+ System_Pack_127,
System_Parameters,
System_Partition_Interface,
System_Pool_32_Global,
@@ -345,7 +422,9 @@ package Rtsfind is
System_Val_Int,
System_Val_LLD,
System_Val_LLI,
+ System_Val_LLLI,
System_Val_LLU,
+ System_Val_LLLU,
System_Val_Name,
System_Val_Real,
System_Val_Uns,
@@ -356,9 +435,13 @@ package Rtsfind is
System_Wid_Bool,
System_Wid_Char,
System_Wid_Enum,
+ System_Wid_Int,
System_Wid_LLI,
+ System_Wid_LLLI,
System_Wid_LLU,
+ System_Wid_LLLU,
System_Wid_Name,
+ System_Wid_Uns,
System_Wid_WChar,
System_WWd_Char,
System_WWd_Enum,
@@ -625,16 +708,31 @@ package Rtsfind is
RE_Stream_T, -- CUDA.Driver_Types
+ RE_Fatbin_Wrapper, -- CUDA.Internal
+ RE_Launch_Kernel, -- CUDA.Internal
+ RE_Pop_Call_Configuration, -- CUDA.Internal
+ RE_Push_Call_Configuration, -- CUDA.Internal
+ RE_Register_Fat_Binary, -- CUDA.Internal
+ RE_Register_Fat_Binary_End, -- CUDA.Internal
+ RE_Register_Function, -- CUDA.Internal
+
RE_Dim3, -- CUDA.Vector_Types
RE_Integer_8, -- Interfaces
RE_Integer_16, -- Interfaces
RE_Integer_32, -- Interfaces
RE_Integer_64, -- Interfaces
+ RE_Integer_128, -- Interfaces
RE_Unsigned_8, -- Interfaces
RE_Unsigned_16, -- Interfaces
RE_Unsigned_32, -- Interfaces
RE_Unsigned_64, -- Interfaces
+ RE_Unsigned_128, -- Interfaces
+
+ RO_IC_Unsigned, -- Interfaces.C
+
+ RE_Chars_Ptr, -- Interfaces.C.Strings
+ RE_New_Char_Array, -- Interfaces.C.Strings
RE_Address, -- System
RE_Any_Priority, -- System
@@ -651,11 +749,15 @@ package Rtsfind is
RE_Address_Image, -- System.Address_Image
- RE_Add_With_Ovflo_Check, -- System.Arith_64
- RE_Double_Divide, -- System.Arith_64
- RE_Multiply_With_Ovflo_Check, -- System.Arith_64
- RE_Scaled_Divide, -- System.Arith_64
- RE_Subtract_With_Ovflo_Check, -- System.Arith_64
+ RE_Add_With_Ovflo_Check64, -- System.Arith_64
+ RE_Double_Divide64, -- System.Arith_64
+ RE_Multiply_With_Ovflo_Check64, -- System.Arith_64
+ RE_Scaled_Divide64, -- System.Arith_64
+ RE_Subtract_With_Ovflo_Check64, -- System.Arith_64
+
+ RE_Add_With_Ovflo_Check128, -- System.Arith_128
+ RE_Multiply_With_Ovflo_Check128, -- System.Arith_128
+ RE_Subtract_With_Ovflo_Check128, -- System.Arith_128
RE_Create_AST_Handler, -- System.AST_Handling
@@ -731,6 +833,7 @@ package Rtsfind is
RE_Bswap_16, -- System.Byte_Swapping
RE_Bswap_32, -- System.Byte_Swapping
RE_Bswap_64, -- System.Byte_Swapping
+ RE_Bswap_128, -- System.Byte_Swapping
RE_Checked_Pool, -- System.Checked_Pools
@@ -738,15 +841,17 @@ package Rtsfind is
RE_Compare_Array_S8_Unaligned, -- System.Compare_Array_Signed_8
RE_Compare_Array_S16, -- System.Compare_Array_Signed_16
- RE_Compare_Array_S32, -- System.Compare_Array_Signed_16
- RE_Compare_Array_S64, -- System.Compare_Array_Signed_16
+ RE_Compare_Array_S32, -- System.Compare_Array_Signed_32
+ RE_Compare_Array_S64, -- System.Compare_Array_Signed_64
+ RE_Compare_Array_S128, -- System.Compare_Array_Signed_128
RE_Compare_Array_U8, -- System.Compare_Array_Unsigned_8
RE_Compare_Array_U8_Unaligned, -- System.Compare_Array_Unsigned_8
RE_Compare_Array_U16, -- System.Compare_Array_Unsigned_16
- RE_Compare_Array_U32, -- System.Compare_Array_Unsigned_16
- RE_Compare_Array_U64, -- System.Compare_Array_Unsigned_16
+ RE_Compare_Array_U32, -- System.Compare_Array_Unsigned_32
+ RE_Compare_Array_U64, -- System.Compare_Array_Unsigned_64
+ RE_Compare_Array_U128, -- System.Compare_Array_Unsigned_128
RE_Str_Concat_2, -- System.Concat_2
RE_Str_Concat_3, -- System.Concat_3
@@ -786,12 +891,18 @@ package Rtsfind is
RE_Exn_Long_Long_Integer, -- System.Exn_LLI
+ RE_Exn_Long_Long_Long_Integer, -- System.Exn_LLLI
+
RE_Exp_Integer, -- System.Exp_Int
RE_Exp_Long_Long_Integer, -- System.Exp_LLI
+ RE_Exp_Long_Long_Long_Integer, -- System.Exp_LLLI
+
RE_Exp_Long_Long_Unsigned, -- System.Exp_LLU
+ RE_Exp_Long_Long_Long_Unsigned, -- System.Exp_LLLU
+
RE_Exp_Modular, -- System.Exp_Mod
RE_Exp_Unsigned, -- System.Exp_Uns
@@ -851,8 +962,12 @@ package Rtsfind is
RE_Image_Long_Long_Integer, -- System.Img_LLI
+ RE_Image_Long_Long_Long_Integer, -- System.Img_LLLI
+
RE_Image_Long_Long_Unsigned, -- System.Img_LLU
+ RE_Image_Long_Long_Long_Unsigned, -- System.Img_LLLU
+
RE_Image_Ordinary_Fixed_Point, -- System.Img_Real
RE_Image_Floating_Point, -- System.Img_Real
@@ -1162,6 +1277,320 @@ package Rtsfind is
RE_Get_63, -- System.Pack_63
RE_Set_63, -- System.Pack_63
+ RE_Bits_65, -- System.Pack_65
+ RE_Get_65, -- System.Pack_65
+ RE_Set_65, -- System.Pack_65
+
+ RE_Bits_66, -- System.Pack_66
+ RE_Get_66, -- System.Pack_66
+ RE_GetU_66, -- System.Pack_66
+ RE_Set_66, -- System.Pack_66
+ RE_SetU_66, -- System.Pack_66
+
+ RE_Bits_67, -- System.Pack_67
+ RE_Get_67, -- System.Pack_67
+ RE_Set_67, -- System.Pack_67
+
+ RE_Bits_68, -- System.Pack_68
+ RE_Get_68, -- System.Pack_68
+ RE_GetU_68, -- System.Pack_68
+ RE_Set_68, -- System.Pack_68
+ RE_SetU_68, -- System.Pack_68
+
+ RE_Bits_69, -- System.Pack_69
+ RE_Get_69, -- System.Pack_69
+ RE_Set_69, -- System.Pack_69
+
+ RE_Bits_70, -- System.Pack_70
+ RE_Get_70, -- System.Pack_70
+ RE_GetU_70, -- System.Pack_70
+ RE_Set_70, -- System.Pack_70
+ RE_SetU_70, -- System.Pack_70
+
+ RE_Bits_71, -- System.Pack_71
+ RE_Get_71, -- System.Pack_71
+ RE_Set_71, -- System.Pack_71
+
+ RE_Bits_72, -- System.Pack_72
+ RE_Get_72, -- System.Pack_72
+ RE_GetU_72, -- System.Pack_72
+ RE_Set_72, -- System.Pack_72
+ RE_SetU_72, -- System.Pack_72
+
+ RE_Bits_73, -- System.Pack_73
+ RE_Get_73, -- System.Pack_73
+ RE_Set_73, -- System.Pack_73
+
+ RE_Bits_74, -- System.Pack_74
+ RE_Get_74, -- System.Pack_74
+ RE_GetU_74, -- System.Pack_74
+ RE_Set_74, -- System.Pack_74
+ RE_SetU_74, -- System.Pack_74
+
+ RE_Bits_75, -- System.Pack_75
+ RE_Get_75, -- System.Pack_75
+ RE_Set_75, -- System.Pack_75
+
+ RE_Bits_76, -- System.Pack_76
+ RE_Get_76, -- System.Pack_76
+ RE_GetU_76, -- System.Pack_76
+ RE_Set_76, -- System.Pack_76
+ RE_SetU_76, -- System.Pack_76
+
+ RE_Bits_77, -- System.Pack_77
+ RE_Get_77, -- System.Pack_77
+ RE_Set_77, -- System.Pack_77
+
+ RE_Bits_78, -- System.Pack_78
+ RE_Get_78, -- System.Pack_78
+ RE_GetU_78, -- System.Pack_78
+ RE_Set_78, -- System.Pack_78
+ RE_SetU_78, -- System.Pack_78
+
+ RE_Bits_79, -- System.Pack_79
+ RE_Get_79, -- System.Pack_79
+ RE_Set_79, -- System.Pack_79
+
+ RE_Bits_80, -- System.Pack_80
+ RE_Get_80, -- System.Pack_80
+ RE_GetU_80, -- System.Pack_80
+ RE_Set_80, -- System.Pack_80
+ RE_SetU_80, -- System.Pack_80
+
+ RE_Bits_81, -- System.Pack_81
+ RE_Get_81, -- System.Pack_81
+ RE_Set_81, -- System.Pack_81
+
+ RE_Bits_82, -- System.Pack_82
+ RE_Get_82, -- System.Pack_82
+ RE_GetU_82, -- System.Pack_82
+ RE_Set_82, -- System.Pack_82
+ RE_SetU_82, -- System.Pack_82
+
+ RE_Bits_83, -- System.Pack_83
+ RE_Get_83, -- System.Pack_83
+ RE_Set_83, -- System.Pack_83
+
+ RE_Bits_84, -- System.Pack_84
+ RE_Get_84, -- System.Pack_84
+ RE_GetU_84, -- System.Pack_84
+ RE_Set_84, -- System.Pack_84
+ RE_SetU_84, -- System.Pack_84
+
+ RE_Bits_85, -- System.Pack_85
+ RE_Get_85, -- System.Pack_85
+ RE_Set_85, -- System.Pack_85
+
+ RE_Bits_86, -- System.Pack_86
+ RE_Get_86, -- System.Pack_86
+ RE_GetU_86, -- System.Pack_86
+ RE_Set_86, -- System.Pack_86
+ RE_SetU_86, -- System.Pack_86
+
+ RE_Bits_87, -- System.Pack_87
+ RE_Get_87, -- System.Pack_87
+ RE_Set_87, -- System.Pack_87
+
+ RE_Bits_88, -- System.Pack_88
+ RE_Get_88, -- System.Pack_88
+ RE_GetU_88, -- System.Pack_88
+ RE_Set_88, -- System.Pack_88
+ RE_SetU_88, -- System.Pack_88
+
+ RE_Bits_89, -- System.Pack_89
+ RE_Get_89, -- System.Pack_89
+ RE_Set_89, -- System.Pack_89
+
+ RE_Bits_90, -- System.Pack_90
+ RE_Get_90, -- System.Pack_90
+ RE_GetU_90, -- System.Pack_90
+ RE_Set_90, -- System.Pack_90
+ RE_SetU_90, -- System.Pack_90
+
+ RE_Bits_91, -- System.Pack_91
+ RE_Get_91, -- System.Pack_91
+ RE_Set_91, -- System.Pack_91
+
+ RE_Bits_92, -- System.Pack_92
+ RE_Get_92, -- System.Pack_92
+ RE_GetU_92, -- System.Pack_92
+ RE_Set_92, -- System.Pack_92
+ RE_SetU_92, -- System.Pack_92
+
+ RE_Bits_93, -- System.Pack_93
+ RE_Get_93, -- System.Pack_93
+ RE_Set_93, -- System.Pack_93
+
+ RE_Bits_94, -- System.Pack_94
+ RE_Get_94, -- System.Pack_94
+ RE_GetU_94, -- System.Pack_94
+ RE_Set_94, -- System.Pack_94
+ RE_SetU_94, -- System.Pack_94
+
+ RE_Bits_95, -- System.Pack_95
+ RE_Get_95, -- System.Pack_95
+ RE_Set_95, -- System.Pack_95
+
+ RE_Bits_96, -- System.Pack_96
+ RE_Get_96, -- System.Pack_96
+ RE_GetU_96, -- System.Pack_96
+ RE_Set_96, -- System.Pack_96
+ RE_SetU_96, -- System.Pack_96
+
+ RE_Bits_97, -- System.Pack_97
+ RE_Get_97, -- System.Pack_97
+ RE_Set_97, -- System.Pack_97
+
+ RE_Bits_98, -- System.Pack_98
+ RE_Get_98, -- System.Pack_98
+ RE_GetU_98, -- System.Pack_98
+ RE_Set_98, -- System.Pack_98
+ RE_SetU_98, -- System.Pack_98
+
+ RE_Bits_99, -- System.Pack_99
+ RE_Get_99, -- System.Pack_99
+ RE_Set_99, -- System.Pack_99
+
+ RE_Bits_100, -- System.Pack_100
+ RE_Get_100, -- System.Pack_100
+ RE_GetU_100, -- System.Pack_100
+ RE_Set_100, -- System.Pack_100
+ RE_SetU_100, -- System.Pack_100
+
+ RE_Bits_101, -- System.Pack_101
+ RE_Get_101, -- System.Pack_101
+ RE_Set_101, -- System.Pack_101
+
+ RE_Bits_102, -- System.Pack_102
+ RE_Get_102, -- System.Pack_102
+ RE_GetU_102, -- System.Pack_102
+ RE_Set_102, -- System.Pack_102
+ RE_SetU_102, -- System.Pack_102
+
+ RE_Bits_103, -- System.Pack_103
+ RE_Get_103, -- System.Pack_103
+ RE_Set_103, -- System.Pack_103
+
+ RE_Bits_104, -- System.Pack_104
+ RE_Get_104, -- System.Pack_104
+ RE_GetU_104, -- System.Pack_104
+ RE_Set_104, -- System.Pack_104
+ RE_SetU_104, -- System.Pack_104
+
+ RE_Bits_105, -- System.Pack_105
+ RE_Get_105, -- System.Pack_105
+ RE_Set_105, -- System.Pack_105
+
+ RE_Bits_106, -- System.Pack_106
+ RE_Get_106, -- System.Pack_106
+ RE_GetU_106, -- System.Pack_106
+ RE_Set_106, -- System.Pack_106
+ RE_SetU_106, -- System.Pack_106
+
+ RE_Bits_107, -- System.Pack_107
+ RE_Get_107, -- System.Pack_107
+ RE_Set_107, -- System.Pack_107
+
+ RE_Bits_108, -- System.Pack_108
+ RE_Get_108, -- System.Pack_108
+ RE_GetU_108, -- System.Pack_108
+ RE_Set_108, -- System.Pack_108
+ RE_SetU_108, -- System.Pack_108
+
+ RE_Bits_109, -- System.Pack_109
+ RE_Get_109, -- System.Pack_109
+ RE_Set_109, -- System.Pack_109
+
+ RE_Bits_110, -- System.Pack_110
+ RE_Get_110, -- System.Pack_110
+ RE_GetU_110, -- System.Pack_110
+ RE_Set_110, -- System.Pack_110
+ RE_SetU_110, -- System.Pack_110
+
+ RE_Bits_111, -- System.Pack_111
+ RE_Get_111, -- System.Pack_111
+ RE_Set_111, -- System.Pack_111
+
+ RE_Bits_112, -- System.Pack_112
+ RE_Get_112, -- System.Pack_112
+ RE_GetU_112, -- System.Pack_112
+ RE_Set_112, -- System.Pack_112
+ RE_SetU_112, -- System.Pack_112
+
+ RE_Bits_113, -- System.Pack_113
+ RE_Get_113, -- System.Pack_113
+ RE_Set_113, -- System.Pack_113
+
+ RE_Bits_114, -- System.Pack_114
+ RE_Get_114, -- System.Pack_114
+ RE_GetU_114, -- System.Pack_114
+ RE_Set_114, -- System.Pack_114
+ RE_SetU_114, -- System.Pack_114
+
+ RE_Bits_115, -- System.Pack_115
+ RE_Get_115, -- System.Pack_115
+ RE_Set_115, -- System.Pack_115
+
+ RE_Bits_116, -- System.Pack_116
+ RE_Get_116, -- System.Pack_116
+ RE_GetU_116, -- System.Pack_116
+ RE_Set_116, -- System.Pack_116
+ RE_SetU_116, -- System.Pack_116
+
+ RE_Bits_117, -- System.Pack_117
+ RE_Get_117, -- System.Pack_117
+ RE_Set_117, -- System.Pack_117
+
+ RE_Bits_118, -- System.Pack_118
+ RE_Get_118, -- System.Pack_118
+ RE_GetU_118, -- System.Pack_118
+ RE_Set_118, -- System.Pack_118
+ RE_SetU_118, -- System.Pack_118
+
+ RE_Bits_119, -- System.Pack_119
+ RE_Get_119, -- System.Pack_119
+ RE_Set_119, -- System.Pack_119
+
+ RE_Bits_120, -- System.Pack_120
+ RE_Get_120, -- System.Pack_120
+ RE_GetU_120, -- System.Pack_120
+ RE_Set_120, -- System.Pack_120
+ RE_SetU_120, -- System.Pack_120
+
+ RE_Bits_121, -- System.Pack_121
+ RE_Get_121, -- System.Pack_121
+ RE_Set_121, -- System.Pack_121
+
+ RE_Bits_122, -- System.Pack_122
+ RE_Get_122, -- System.Pack_122
+ RE_GetU_122, -- System.Pack_122
+ RE_Set_122, -- System.Pack_122
+ RE_SetU_122, -- System.Pack_122
+
+ RE_Bits_123, -- System.Pack_123
+ RE_Get_123, -- System.Pack_123
+ RE_Set_123, -- System.Pack_123
+
+ RE_Bits_124, -- System.Pack_124
+ RE_Get_124, -- System.Pack_124
+ RE_GetU_124, -- System.Pack_124
+ RE_Set_124, -- System.Pack_124
+ RE_SetU_124, -- System.Pack_124
+
+ RE_Bits_125, -- System.Pack_125
+ RE_Get_125, -- System.Pack_125
+ RE_Set_125, -- System.Pack_125
+
+ RE_Bits_126, -- System.Pack_126
+ RE_Get_126, -- System.Pack_126
+ RE_GetU_126, -- System.Pack_126
+ RE_Set_126, -- System.Pack_126
+ RE_SetU_126, -- System.Pack_126
+
+ RE_Bits_127, -- System.Pack_127
+ RE_Get_127, -- System.Pack_127
+ RE_Set_127, -- System.Pack_127
+
RE_Adjust_Storage_Size, -- System.Parameters
RE_Default_Secondary_Stack_Size, -- System.Parameters
RE_Default_Stack_Size, -- System.Parameters
@@ -1197,8 +1626,10 @@ package Rtsfind is
RE_Put_Image_Integer, -- System.Put_Images
RE_Put_Image_Long_Long_Integer, -- System.Put_Images
+ RE_Put_Image_Long_Long_Long_Integer, -- System.Put_Images
RE_Put_Image_Unsigned, -- System.Put_Images
RE_Put_Image_Long_Long_Unsigned, -- System.Put_Images
+ RE_Put_Image_Long_Long_Long_Unsigned, -- System.Put_Images
RE_Put_Image_Thin_Pointer, -- System.Put_Images
RE_Put_Image_Fat_Pointer, -- System.Put_Images
RE_Put_Image_Access_Subp, -- System.Put_Images
@@ -1349,14 +1780,12 @@ package Rtsfind is
RE_IS_Is2, -- System.Scalar_Values
RE_IS_Is4, -- System.Scalar_Values
RE_IS_Is8, -- System.Scalar_Values
+ RE_IS_Is16, -- System.Scalar_Values
RE_IS_Iu1, -- System.Scalar_Values
RE_IS_Iu2, -- System.Scalar_Values
RE_IS_Iu4, -- System.Scalar_Values
RE_IS_Iu8, -- System.Scalar_Values
- RE_IS_Iz1, -- System.Scalar_Values
- RE_IS_Iz2, -- System.Scalar_Values
- RE_IS_Iz4, -- System.Scalar_Values
- RE_IS_Iz8, -- System.Scalar_Values
+ RE_IS_Iu16, -- System.Scalar_Values
RE_IS_Isf, -- System.Scalar_Values
RE_IS_Ifl, -- System.Scalar_Values
RE_IS_Ilf, -- System.Scalar_Values
@@ -1547,8 +1976,8 @@ package Rtsfind is
RE_Bits_2, -- System.Unsigned_Types
RE_Bits_4, -- System.Unsigned_Types
RE_Float_Unsigned, -- System.Unsigned_Types
- RE_Long_Unsigned, -- System.Unsigned_Types
RE_Long_Long_Unsigned, -- System.Unsigned_Types
+ RE_Long_Long_Long_Unsigned, -- System.Unsigned_Types
RE_Packed_Byte, -- System.Unsigned_Types
RE_Packed_Bytes1, -- System.Unsigned_Types
RE_Packed_Bytes2, -- System.Unsigned_Types
@@ -1556,8 +1985,6 @@ package Rtsfind is
RE_Rev_Packed_Bytes1, -- System.Unsigned_Types
RE_Rev_Packed_Bytes2, -- System.Unsigned_Types
RE_Rev_Packed_Bytes4, -- System.Unsigned_Types
- RE_Short_Unsigned, -- System.Unsigned_Types
- RE_Short_Short_Unsigned, -- System.Unsigned_Types
RE_Unsigned, -- System.Unsigned_Types
RE_Value_Boolean, -- System.Val_Bool
@@ -1576,8 +2003,12 @@ package Rtsfind is
RE_Value_Long_Long_Integer, -- System.Val_LLI
+ RE_Value_Long_Long_Long_Integer, -- System.Val_LLLI
+
RE_Value_Long_Long_Unsigned, -- System.Val_LLU
+ RE_Value_Long_Long_Long_Unsigned, -- System.Val_LLLU
+
RE_Value_Real, -- System.Val_Real
RE_Value_Unsigned, -- System.Val_Uns
@@ -1618,10 +2049,18 @@ package Rtsfind is
RE_Width_Enumeration_16, -- System.Wid_Enum
RE_Width_Enumeration_32, -- System.Wid_Enum
+ RE_Width_Integer, -- System.Wid_Int
+
RE_Width_Long_Long_Integer, -- System.Wid_LLI
+ RE_Width_Long_Long_Long_Integer, -- System.Wid_LLLI
+
RE_Width_Long_Long_Unsigned, -- System.Wid_LLU
+ RE_Width_Long_Long_Long_Unsigned, -- System.Wid_LLLU
+
+ RE_Width_Unsigned, -- System.Wid_Uns
+
RE_Width_Wide_Character, -- System.Wid_WChar
RE_Width_Wide_Wide_Character, -- System.Wid_WChar
@@ -1916,16 +2355,31 @@ package Rtsfind is
RE_Stream_T => CUDA_Driver_Types,
+ RE_Fatbin_Wrapper => CUDA_Internal,
+ RE_Launch_Kernel => CUDA_Internal,
+ RE_Pop_Call_Configuration => CUDA_Internal,
+ RE_Push_Call_Configuration => CUDA_Internal,
+ RE_Register_Fat_Binary => CUDA_Internal,
+ RE_Register_Fat_Binary_End => CUDA_Internal,
+ RE_Register_Function => CUDA_Internal,
+
RE_Dim3 => CUDA_Vector_Types,
RE_Integer_8 => Interfaces,
RE_Integer_16 => Interfaces,
RE_Integer_32 => Interfaces,
RE_Integer_64 => Interfaces,
+ RE_Integer_128 => Interfaces,
RE_Unsigned_8 => Interfaces,
RE_Unsigned_16 => Interfaces,
RE_Unsigned_32 => Interfaces,
RE_Unsigned_64 => Interfaces,
+ RE_Unsigned_128 => Interfaces,
+
+ RO_IC_Unsigned => Interfaces_C,
+
+ RE_Chars_Ptr => Interfaces_C_Strings,
+ RE_New_Char_Array => Interfaces_C_Strings,
RE_Address => System,
RE_Any_Priority => System,
@@ -1942,11 +2396,15 @@ package Rtsfind is
RE_Address_Image => System_Address_Image,
- RE_Add_With_Ovflo_Check => System_Arith_64,
- RE_Double_Divide => System_Arith_64,
- RE_Multiply_With_Ovflo_Check => System_Arith_64,
- RE_Scaled_Divide => System_Arith_64,
- RE_Subtract_With_Ovflo_Check => System_Arith_64,
+ RE_Add_With_Ovflo_Check64 => System_Arith_64,
+ RE_Double_Divide64 => System_Arith_64,
+ RE_Multiply_With_Ovflo_Check64 => System_Arith_64,
+ RE_Scaled_Divide64 => System_Arith_64,
+ RE_Subtract_With_Ovflo_Check64 => System_Arith_64,
+
+ RE_Add_With_Ovflo_Check128 => System_Arith_128,
+ RE_Multiply_With_Ovflo_Check128 => System_Arith_128,
+ RE_Subtract_With_Ovflo_Check128 => System_Arith_128,
RE_Create_AST_Handler => System_AST_Handling,
@@ -2024,6 +2482,7 @@ package Rtsfind is
RE_Bswap_16 => System_Byte_Swapping,
RE_Bswap_32 => System_Byte_Swapping,
RE_Bswap_64 => System_Byte_Swapping,
+ RE_Bswap_128 => System_Byte_Swapping,
RE_Compare_Array_S8 => System_Compare_Array_Signed_8,
RE_Compare_Array_S8_Unaligned => System_Compare_Array_Signed_8,
@@ -2034,6 +2493,8 @@ package Rtsfind is
RE_Compare_Array_S64 => System_Compare_Array_Signed_64,
+ RE_Compare_Array_S128 => System_Compare_Array_Signed_128,
+
RE_Compare_Array_U8 => System_Compare_Array_Unsigned_8,
RE_Compare_Array_U8_Unaligned => System_Compare_Array_Unsigned_8,
@@ -2043,6 +2504,8 @@ package Rtsfind is
RE_Compare_Array_U64 => System_Compare_Array_Unsigned_64,
+ RE_Compare_Array_U128 => System_Compare_Array_Unsigned_128,
+
RE_Str_Concat_2 => System_Concat_2,
RE_Str_Concat_3 => System_Concat_3,
RE_Str_Concat_4 => System_Concat_4,
@@ -2081,12 +2544,18 @@ package Rtsfind is
RE_Exn_Long_Long_Integer => System_Exn_LLI,
+ RE_Exn_Long_Long_Long_Integer => System_Exn_LLLI,
+
RE_Exp_Integer => System_Exp_Int,
RE_Exp_Long_Long_Integer => System_Exp_LLI,
+ RE_Exp_Long_Long_Long_Integer => System_Exp_LLLI,
+
RE_Exp_Long_Long_Unsigned => System_Exp_LLU,
+ RE_Exp_Long_Long_Long_Unsigned => System_Exp_LLLU,
+
RE_Exp_Modular => System_Exp_Mod,
RE_Exp_Unsigned => System_Exp_Uns,
@@ -2146,8 +2615,12 @@ package Rtsfind is
RE_Image_Long_Long_Integer => System_Img_LLI,
+ RE_Image_Long_Long_Long_Integer => System_Img_LLLI,
+
RE_Image_Long_Long_Unsigned => System_Img_LLU,
+ RE_Image_Long_Long_Long_Unsigned => System_Img_LLLU,
+
RE_Image_Ordinary_Fixed_Point => System_Img_Real,
RE_Image_Floating_Point => System_Img_Real,
@@ -2457,6 +2930,320 @@ package Rtsfind is
RE_Get_63 => System_Pack_63,
RE_Set_63 => System_Pack_63,
+ RE_Bits_65 => System_Pack_65,
+ RE_Get_65 => System_Pack_65,
+ RE_Set_65 => System_Pack_65,
+
+ RE_Bits_66 => System_Pack_66,
+ RE_Get_66 => System_Pack_66,
+ RE_GetU_66 => System_Pack_66,
+ RE_Set_66 => System_Pack_66,
+ RE_SetU_66 => System_Pack_66,
+
+ RE_Bits_67 => System_Pack_67,
+ RE_Get_67 => System_Pack_67,
+ RE_Set_67 => System_Pack_67,
+
+ RE_Bits_68 => System_Pack_68,
+ RE_Get_68 => System_Pack_68,
+ RE_GetU_68 => System_Pack_68,
+ RE_Set_68 => System_Pack_68,
+ RE_SetU_68 => System_Pack_68,
+
+ RE_Bits_69 => System_Pack_69,
+ RE_Get_69 => System_Pack_69,
+ RE_Set_69 => System_Pack_69,
+
+ RE_Bits_70 => System_Pack_70,
+ RE_Get_70 => System_Pack_70,
+ RE_GetU_70 => System_Pack_70,
+ RE_Set_70 => System_Pack_70,
+ RE_SetU_70 => System_Pack_70,
+
+ RE_Bits_71 => System_Pack_71,
+ RE_Get_71 => System_Pack_71,
+ RE_Set_71 => System_Pack_71,
+
+ RE_Bits_72 => System_Pack_72,
+ RE_Get_72 => System_Pack_72,
+ RE_GetU_72 => System_Pack_72,
+ RE_Set_72 => System_Pack_72,
+ RE_SetU_72 => System_Pack_72,
+
+ RE_Bits_73 => System_Pack_73,
+ RE_Get_73 => System_Pack_73,
+ RE_Set_73 => System_Pack_73,
+
+ RE_Bits_74 => System_Pack_74,
+ RE_Get_74 => System_Pack_74,
+ RE_GetU_74 => System_Pack_74,
+ RE_Set_74 => System_Pack_74,
+ RE_SetU_74 => System_Pack_74,
+
+ RE_Bits_75 => System_Pack_75,
+ RE_Get_75 => System_Pack_75,
+ RE_Set_75 => System_Pack_75,
+
+ RE_Bits_76 => System_Pack_76,
+ RE_Get_76 => System_Pack_76,
+ RE_GetU_76 => System_Pack_76,
+ RE_Set_76 => System_Pack_76,
+ RE_SetU_76 => System_Pack_76,
+
+ RE_Bits_77 => System_Pack_77,
+ RE_Get_77 => System_Pack_77,
+ RE_Set_77 => System_Pack_77,
+
+ RE_Bits_78 => System_Pack_78,
+ RE_Get_78 => System_Pack_78,
+ RE_GetU_78 => System_Pack_78,
+ RE_Set_78 => System_Pack_78,
+ RE_SetU_78 => System_Pack_78,
+
+ RE_Bits_79 => System_Pack_79,
+ RE_Get_79 => System_Pack_79,
+ RE_Set_79 => System_Pack_79,
+
+ RE_Bits_80 => System_Pack_80,
+ RE_Get_80 => System_Pack_80,
+ RE_GetU_80 => System_Pack_80,
+ RE_Set_80 => System_Pack_80,
+ RE_SetU_80 => System_Pack_80,
+
+ RE_Bits_81 => System_Pack_81,
+ RE_Get_81 => System_Pack_81,
+ RE_Set_81 => System_Pack_81,
+
+ RE_Bits_82 => System_Pack_82,
+ RE_Get_82 => System_Pack_82,
+ RE_GetU_82 => System_Pack_82,
+ RE_Set_82 => System_Pack_82,
+ RE_SetU_82 => System_Pack_82,
+
+ RE_Bits_83 => System_Pack_83,
+ RE_Get_83 => System_Pack_83,
+ RE_Set_83 => System_Pack_83,
+
+ RE_Bits_84 => System_Pack_84,
+ RE_Get_84 => System_Pack_84,
+ RE_GetU_84 => System_Pack_84,
+ RE_Set_84 => System_Pack_84,
+ RE_SetU_84 => System_Pack_84,
+
+ RE_Bits_85 => System_Pack_85,
+ RE_Get_85 => System_Pack_85,
+ RE_Set_85 => System_Pack_85,
+
+ RE_Bits_86 => System_Pack_86,
+ RE_Get_86 => System_Pack_86,
+ RE_GetU_86 => System_Pack_86,
+ RE_Set_86 => System_Pack_86,
+ RE_SetU_86 => System_Pack_86,
+
+ RE_Bits_87 => System_Pack_87,
+ RE_Get_87 => System_Pack_87,
+ RE_Set_87 => System_Pack_87,
+
+ RE_Bits_88 => System_Pack_88,
+ RE_Get_88 => System_Pack_88,
+ RE_GetU_88 => System_Pack_88,
+ RE_Set_88 => System_Pack_88,
+ RE_SetU_88 => System_Pack_88,
+
+ RE_Bits_89 => System_Pack_89,
+ RE_Get_89 => System_Pack_89,
+ RE_Set_89 => System_Pack_89,
+
+ RE_Bits_90 => System_Pack_90,
+ RE_Get_90 => System_Pack_90,
+ RE_GetU_90 => System_Pack_90,
+ RE_Set_90 => System_Pack_90,
+ RE_SetU_90 => System_Pack_90,
+
+ RE_Bits_91 => System_Pack_91,
+ RE_Get_91 => System_Pack_91,
+ RE_Set_91 => System_Pack_91,
+
+ RE_Bits_92 => System_Pack_92,
+ RE_Get_92 => System_Pack_92,
+ RE_GetU_92 => System_Pack_92,
+ RE_Set_92 => System_Pack_92,
+ RE_SetU_92 => System_Pack_92,
+
+ RE_Bits_93 => System_Pack_93,
+ RE_Get_93 => System_Pack_93,
+ RE_Set_93 => System_Pack_93,
+
+ RE_Bits_94 => System_Pack_94,
+ RE_Get_94 => System_Pack_94,
+ RE_GetU_94 => System_Pack_94,
+ RE_Set_94 => System_Pack_94,
+ RE_SetU_94 => System_Pack_94,
+
+ RE_Bits_95 => System_Pack_95,
+ RE_Get_95 => System_Pack_95,
+ RE_Set_95 => System_Pack_95,
+
+ RE_Bits_96 => System_Pack_96,
+ RE_Get_96 => System_Pack_96,
+ RE_GetU_96 => System_Pack_96,
+ RE_Set_96 => System_Pack_96,
+ RE_SetU_96 => System_Pack_96,
+
+ RE_Bits_97 => System_Pack_97,
+ RE_Get_97 => System_Pack_97,
+ RE_Set_97 => System_Pack_97,
+
+ RE_Bits_98 => System_Pack_98,
+ RE_Get_98 => System_Pack_98,
+ RE_GetU_98 => System_Pack_98,
+ RE_Set_98 => System_Pack_98,
+ RE_SetU_98 => System_Pack_98,
+
+ RE_Bits_99 => System_Pack_99,
+ RE_Get_99 => System_Pack_99,
+ RE_Set_99 => System_Pack_99,
+
+ RE_Bits_100 => System_Pack_100,
+ RE_Get_100 => System_Pack_100,
+ RE_GetU_100 => System_Pack_100,
+ RE_Set_100 => System_Pack_100,
+ RE_SetU_100 => System_Pack_100,
+
+ RE_Bits_101 => System_Pack_101,
+ RE_Get_101 => System_Pack_101,
+ RE_Set_101 => System_Pack_101,
+
+ RE_Bits_102 => System_Pack_102,
+ RE_Get_102 => System_Pack_102,
+ RE_GetU_102 => System_Pack_102,
+ RE_Set_102 => System_Pack_102,
+ RE_SetU_102 => System_Pack_102,
+
+ RE_Bits_103 => System_Pack_103,
+ RE_Get_103 => System_Pack_103,
+ RE_Set_103 => System_Pack_103,
+
+ RE_Bits_104 => System_Pack_104,
+ RE_Get_104 => System_Pack_104,
+ RE_GetU_104 => System_Pack_104,
+ RE_Set_104 => System_Pack_104,
+ RE_SetU_104 => System_Pack_104,
+
+ RE_Bits_105 => System_Pack_105,
+ RE_Get_105 => System_Pack_105,
+ RE_Set_105 => System_Pack_105,
+
+ RE_Bits_106 => System_Pack_106,
+ RE_Get_106 => System_Pack_106,
+ RE_GetU_106 => System_Pack_106,
+ RE_Set_106 => System_Pack_106,
+ RE_SetU_106 => System_Pack_106,
+
+ RE_Bits_107 => System_Pack_107,
+ RE_Get_107 => System_Pack_107,
+ RE_Set_107 => System_Pack_107,
+
+ RE_Bits_108 => System_Pack_108,
+ RE_Get_108 => System_Pack_108,
+ RE_GetU_108 => System_Pack_108,
+ RE_Set_108 => System_Pack_108,
+ RE_SetU_108 => System_Pack_108,
+
+ RE_Bits_109 => System_Pack_109,
+ RE_Get_109 => System_Pack_109,
+ RE_Set_109 => System_Pack_109,
+
+ RE_Bits_110 => System_Pack_110,
+ RE_Get_110 => System_Pack_110,
+ RE_GetU_110 => System_Pack_110,
+ RE_Set_110 => System_Pack_110,
+ RE_SetU_110 => System_Pack_110,
+
+ RE_Bits_111 => System_Pack_111,
+ RE_Get_111 => System_Pack_111,
+ RE_Set_111 => System_Pack_111,
+
+ RE_Bits_112 => System_Pack_112,
+ RE_Get_112 => System_Pack_112,
+ RE_GetU_112 => System_Pack_112,
+ RE_Set_112 => System_Pack_112,
+ RE_SetU_112 => System_Pack_112,
+
+ RE_Bits_113 => System_Pack_113,
+ RE_Get_113 => System_Pack_113,
+ RE_Set_113 => System_Pack_113,
+
+ RE_Bits_114 => System_Pack_114,
+ RE_Get_114 => System_Pack_114,
+ RE_GetU_114 => System_Pack_114,
+ RE_Set_114 => System_Pack_114,
+ RE_SetU_114 => System_Pack_114,
+
+ RE_Bits_115 => System_Pack_115,
+ RE_Get_115 => System_Pack_115,
+ RE_Set_115 => System_Pack_115,
+
+ RE_Bits_116 => System_Pack_116,
+ RE_Get_116 => System_Pack_116,
+ RE_GetU_116 => System_Pack_116,
+ RE_Set_116 => System_Pack_116,
+ RE_SetU_116 => System_Pack_116,
+
+ RE_Bits_117 => System_Pack_117,
+ RE_Get_117 => System_Pack_117,
+ RE_Set_117 => System_Pack_117,
+
+ RE_Bits_118 => System_Pack_118,
+ RE_Get_118 => System_Pack_118,
+ RE_GetU_118 => System_Pack_118,
+ RE_Set_118 => System_Pack_118,
+ RE_SetU_118 => System_Pack_118,
+
+ RE_Bits_119 => System_Pack_119,
+ RE_Get_119 => System_Pack_119,
+ RE_Set_119 => System_Pack_119,
+
+ RE_Bits_120 => System_Pack_120,
+ RE_Get_120 => System_Pack_120,
+ RE_GetU_120 => System_Pack_120,
+ RE_Set_120 => System_Pack_120,
+ RE_SetU_120 => System_Pack_120,
+
+ RE_Bits_121 => System_Pack_121,
+ RE_Get_121 => System_Pack_121,
+ RE_Set_121 => System_Pack_121,
+
+ RE_Bits_122 => System_Pack_122,
+ RE_Get_122 => System_Pack_122,
+ RE_GetU_122 => System_Pack_122,
+ RE_Set_122 => System_Pack_122,
+ RE_SetU_122 => System_Pack_122,
+
+ RE_Bits_123 => System_Pack_123,
+ RE_Get_123 => System_Pack_123,
+ RE_Set_123 => System_Pack_123,
+
+ RE_Bits_124 => System_Pack_124,
+ RE_Get_124 => System_Pack_124,
+ RE_GetU_124 => System_Pack_124,
+ RE_Set_124 => System_Pack_124,
+ RE_SetU_124 => System_Pack_124,
+
+ RE_Bits_125 => System_Pack_125,
+ RE_Get_125 => System_Pack_125,
+ RE_Set_125 => System_Pack_125,
+
+ RE_Bits_126 => System_Pack_126,
+ RE_Get_126 => System_Pack_126,
+ RE_GetU_126 => System_Pack_126,
+ RE_Set_126 => System_Pack_126,
+ RE_SetU_126 => System_Pack_126,
+
+ RE_Bits_127 => System_Pack_127,
+ RE_Get_127 => System_Pack_127,
+ RE_Set_127 => System_Pack_127,
+
RE_Adjust_Storage_Size => System_Parameters,
RE_Default_Secondary_Stack_Size => System_Parameters,
RE_Default_Stack_Size => System_Parameters,
@@ -2612,8 +3399,10 @@ package Rtsfind is
RE_Put_Image_Integer => System_Put_Images,
RE_Put_Image_Long_Long_Integer => System_Put_Images,
+ RE_Put_Image_Long_Long_Long_Integer => System_Put_Images,
RE_Put_Image_Unsigned => System_Put_Images,
RE_Put_Image_Long_Long_Unsigned => System_Put_Images,
+ RE_Put_Image_Long_Long_Long_Unsigned => System_Put_Images,
RE_Put_Image_Thin_Pointer => System_Put_Images,
RE_Put_Image_Fat_Pointer => System_Put_Images,
RE_Put_Image_Access_Subp => System_Put_Images,
@@ -2644,14 +3433,12 @@ package Rtsfind is
RE_IS_Is2 => System_Scalar_Values,
RE_IS_Is4 => System_Scalar_Values,
RE_IS_Is8 => System_Scalar_Values,
+ RE_IS_Is16 => System_Scalar_Values,
RE_IS_Iu1 => System_Scalar_Values,
RE_IS_Iu2 => System_Scalar_Values,
RE_IS_Iu4 => System_Scalar_Values,
RE_IS_Iu8 => System_Scalar_Values,
- RE_IS_Iz1 => System_Scalar_Values,
- RE_IS_Iz2 => System_Scalar_Values,
- RE_IS_Iz4 => System_Scalar_Values,
- RE_IS_Iz8 => System_Scalar_Values,
+ RE_IS_Iu16 => System_Scalar_Values,
RE_IS_Isf => System_Scalar_Values,
RE_IS_Ifl => System_Scalar_Values,
RE_IS_Ilf => System_Scalar_Values,
@@ -2842,8 +3629,8 @@ package Rtsfind is
RE_Bits_2 => System_Unsigned_Types,
RE_Bits_4 => System_Unsigned_Types,
RE_Float_Unsigned => System_Unsigned_Types,
- RE_Long_Unsigned => System_Unsigned_Types,
RE_Long_Long_Unsigned => System_Unsigned_Types,
+ RE_Long_Long_Long_Unsigned => System_Unsigned_Types,
RE_Packed_Byte => System_Unsigned_Types,
RE_Packed_Bytes1 => System_Unsigned_Types,
RE_Packed_Bytes2 => System_Unsigned_Types,
@@ -2851,8 +3638,6 @@ package Rtsfind is
RE_Rev_Packed_Bytes1 => System_Unsigned_Types,
RE_Rev_Packed_Bytes2 => System_Unsigned_Types,
RE_Rev_Packed_Bytes4 => System_Unsigned_Types,
- RE_Short_Unsigned => System_Unsigned_Types,
- RE_Short_Short_Unsigned => System_Unsigned_Types,
RE_Unsigned => System_Unsigned_Types,
RE_Value_Boolean => System_Val_Bool,
@@ -2871,8 +3656,12 @@ package Rtsfind is
RE_Value_Long_Long_Integer => System_Val_LLI,
+ RE_Value_Long_Long_Long_Integer => System_Val_LLLI,
+
RE_Value_Long_Long_Unsigned => System_Val_LLU,
+ RE_Value_Long_Long_Long_Unsigned => System_Val_LLLU,
+
RE_Value_Real => System_Val_Real,
RE_Value_Unsigned => System_Val_Uns,
@@ -2914,10 +3703,18 @@ package Rtsfind is
RE_Width_Enumeration_16 => System_Wid_Enum,
RE_Width_Enumeration_32 => System_Wid_Enum,
+ RE_Width_Integer => System_Wid_Int,
+
RE_Width_Long_Long_Integer => System_Wid_LLI,
+ RE_Width_Long_Long_Long_Integer => System_Wid_LLLI,
+
RE_Width_Long_Long_Unsigned => System_Wid_LLU,
+ RE_Width_Long_Long_Long_Unsigned => System_Wid_LLLU,
+
+ RE_Width_Unsigned => System_Wid_Uns,
+
RE_Width_Wide_Character => System_Wid_WChar,
RE_Width_Wide_Wide_Character => System_Wid_WChar,
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index 14a58aa..e3e5bc2 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -96,7 +96,7 @@ pragma Style_Checks ("M32766");
/* Define _BSD_SOURCE to get CRTSCTS */
# define _BSD_SOURCE
-#endif /* defined (__linux__) */
+#endif /* defined (__linux__) || defined (__ANDROID__) */
/* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
@@ -121,6 +121,8 @@ pragma Style_Checks ("M32766");
**/
# include <vxWorks.h>
+#elif !defined(__MINGW32__)
+#include <poll.h>
#endif
#include "adaint.h"
@@ -1735,12 +1737,28 @@ CND(SIZEOF_sigset, "sigset")
#endif
#if defined(_WIN32) || defined(__vxworks)
+#define SIZEOF_nfds_t sizeof (int) * 8
#define SIZEOF_socklen_t sizeof (size_t)
#else
+#define SIZEOF_nfds_t sizeof (nfds_t) * 8
#define SIZEOF_socklen_t sizeof (socklen_t)
#endif
+CND(SIZEOF_nfds_t, "Size of nfds_t");
CND(SIZEOF_socklen_t, "Size of socklen_t");
+{
+#if defined(__vxworks)
+#define SIZEOF_fd_type sizeof (int) * 8
+#define SIZEOF_pollfd_events sizeof (short) * 8
+#else
+const struct pollfd v_pollfd;
+#define SIZEOF_fd_type sizeof (v_pollfd.fd) * 8
+#define SIZEOF_pollfd_events sizeof (v_pollfd.events) * 8
+#endif
+CND(SIZEOF_fd_type, "Size of socket fd");
+CND(SIZEOF_pollfd_events, "Size of pollfd.events");
+}
+
#ifndef IF_NAMESIZE
#ifdef IF_MAX_STRING_SIZE
#define IF_NAMESIZE IF_MAX_STRING_SIZE
@@ -1752,6 +1770,50 @@ CND(IF_NAMESIZE, "Max size of interface name with 0 terminator");
/*
+ -- Poll values
+
+*/
+
+#if defined(__vxworks)
+#ifndef POLLIN
+#define POLLIN 1
+#endif
+
+#ifndef POLLPRI
+#define POLLPRI 2
+#endif
+
+#ifndef POLLOUT
+#define POLLOUT 4
+#endif
+
+#ifndef POLLERR
+#define POLLERR 8
+#endif
+
+#ifndef POLLHUP
+#define POLLHUP 16
+#endif
+
+#ifndef POLLNVAL
+#define POLLNVAL 32
+#endif
+
+#elif defined(_WIN32)
+#define POLLPRI 0
+/* If the POLLPRI flag is set on a socket for the Microsoft Winsock provider,
+ * the WSAPoll function will fail. */
+#endif
+
+CND(POLLIN, "There is data to read");
+CND(POLLPRI, "Urgent data to read");
+CND(POLLOUT, "Writing will not block");
+CND(POLLERR, "Error (output only)");
+CND(POLLHUP, "Hang up (output only)");
+CND(POLLNVAL, "Invalid request");
+
+/*
+
-- Fields of struct msghdr
*/
@@ -1799,6 +1861,13 @@ CST(Inet_Pton_Linkname, "")
#endif
CST(Inet_Ntop_Linkname, "")
+#if defined(_WIN32)
+# define Poll_Linkname "WSAPoll"
+#else
+# define Poll_Linkname "poll"
+#endif
+CST(Poll_Linkname, "")
+
#endif /* HAVE_SOCKETS */
/*
diff --git a/gcc/ada/scans.adb b/gcc/ada/scans.adb
index 12cf27a..9ea407e 100644
--- a/gcc/ada/scans.adb
+++ b/gcc/ada/scans.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads
index 746d337..6db276b 100644
--- a/gcc/ada/scans.ads
+++ b/gcc/ada/scans.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/scil_ll.adb b/gcc/ada/scil_ll.adb
index 98ca30d..53c9013 100644
--- a/gcc/ada/scil_ll.adb
+++ b/gcc/ada/scil_ll.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -122,7 +116,7 @@ package body SCIL_LL is
when N_SCIL_Membership_Test =>
pragma Assert
(Nkind (N) in N_Identifier | N_And_Then | N_Or_Else |
- N_Expression_With_Actions);
+ N_Expression_With_Actions | N_Function_Call);
null;
when others =>
diff --git a/gcc/ada/scil_ll.ads b/gcc/ada/scil_ll.ads
index 8942cc8..5770b37 100644
--- a/gcc/ada/scil_ll.ads
+++ b/gcc/ada/scil_ll.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 2bac3a8..0d5cff8 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -1180,6 +1180,8 @@ package body Scng is
end if;
end Start_Of_Wide_Character;
+ Token_Contains_Uppercase : Boolean;
+
-- Start of processing for Scan
begin
@@ -1241,6 +1243,8 @@ package body Scng is
Token_Ptr := Scan_Ptr;
+ Token_Contains_Uppercase := False;
+
-- Here begins the main case statement which transfers control on the
-- basis of the non-blank character we have encountered.
@@ -1378,14 +1382,19 @@ package body Scng is
-- Left bracket
when '[' =>
- if Source (Scan_Ptr + 1) = '"' then
- goto Scan_Wide_Character;
- elsif Ada_Version >= Ada_2020 then
+ -- [] under -gnatX is an aggregate notation and the special
+ -- wide character notation becomes unsupported since the two
+ -- are ambiguous.
+
+ if Extensions_Allowed then
Scan_Ptr := Scan_Ptr + 1;
Token := Tok_Left_Bracket;
return;
+ elsif Source (Scan_Ptr + 1) = '"' then
+ goto Scan_Wide_Character;
+
else
Error_Msg_S ("illegal character, replaced by ""(""");
Scan_Ptr := Scan_Ptr + 1;
@@ -1994,6 +2003,7 @@ package body Scng is
-- Upper case letters
when 'A' .. 'Z' =>
+ Token_Contains_Uppercase := True;
Name_Len := 1;
Underline_Found := False;
Name_Buffer (1) :=
@@ -2342,6 +2352,8 @@ package body Scng is
Accumulate_Checksum (Source (Scan_Ptr));
elsif Source (Scan_Ptr) in 'A' .. 'Z' then
+ Token_Contains_Uppercase := True;
+
Name_Buffer (Name_Len + 1) :=
Character'Val (Character'Pos (Source (Scan_Ptr)) + 32);
Accumulate_Checksum (Name_Buffer (Name_Len + 1));
@@ -2569,7 +2581,7 @@ package body Scng is
Token := Tok_Identifier;
- -- Here is where we check if it was a keyword
+ -- Check if it is a keyword
if Is_Keyword_Name (Token_Name) then
Accumulate_Token_Checksum;
@@ -2596,7 +2608,7 @@ package body Scng is
-- Ada 2005 (AI-340): Do not apply the style check in case of
-- MOD attribute.
- if Source (Token_Ptr) <= 'Z'
+ if Token_Contains_Uppercase
and then (Prev_Token /= Tok_Apostrophe
or else
(Token /= Tok_Access and then
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 4429b6b..7a67a43 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -1193,6 +1193,38 @@ package body Sem is
end if;
end Insert_Before_And_Analyze;
+ --------------------------------------------
+ -- Insert_Before_First_Source_Declaration --
+ --------------------------------------------
+
+ procedure Insert_Before_First_Source_Declaration
+ (Stmt : Node_Id;
+ Decls : List_Id)
+ is
+ Decl : Node_Id;
+ begin
+ -- Inspect the declarations of the related subprogram body looking for
+ -- the first source declaration.
+
+ pragma Assert (Present (Decls));
+
+ Decl := First (Decls);
+ while Present (Decl) loop
+ if Comes_From_Source (Decl) then
+ Insert_Before (Decl, Stmt);
+ return;
+ end if;
+
+ Next (Decl);
+ end loop;
+
+ -- If we get there, then the subprogram body lacks any source
+ -- declarations. The body of _Postconditions now acts as the
+ -- last declaration.
+
+ Append (Stmt, Decls);
+ end Insert_Before_First_Source_Declaration;
+
-----------------------------------
-- Insert_List_After_And_Analyze --
-----------------------------------
diff --git a/gcc/ada/sem.ads b/gcc/ada/sem.ads
index f320b32..6003997 100644
--- a/gcc/ada/sem.ads
+++ b/gcc/ada/sem.ads
@@ -671,6 +671,13 @@ package Sem is
-- Suppress argument is present, then the analysis is done with the
-- specified check suppressed (can be All_Checks to suppress all checks).
+ procedure Insert_Before_First_Source_Declaration
+ (Stmt : Node_Id;
+ Decls : List_Id);
+ -- Insert node Stmt before the first source declaration of the related
+ -- subprogram's body. If no such declaration exists, Stmt becomes the last
+ -- declaration.
+
function External_Ref_In_Generic (E : Entity_Id) return Boolean;
-- Return True if we are in the context of a generic and E is
-- external (more global) to it.
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index f77230c..fdc27b3 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -48,6 +48,7 @@ with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Cat; use Sem_Cat;
with Sem_Ch3; use Sem_Ch3;
+with Sem_Ch5; use Sem_Ch5;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch13; use Sem_Ch13;
with Sem_Dim; use Sem_Dim;
@@ -63,6 +64,7 @@ with Stand; use Stand;
with Style; use Style;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
+with Ttypes; use Ttypes;
with Uintp; use Uintp;
package body Sem_Aggr is
@@ -789,6 +791,31 @@ package body Sem_Aggr is
-- The actual aggregate subtype. This is not necessarily the same as Typ
-- which is the subtype of the context in which the aggregate was found.
+ Others_Box : Boolean := False;
+ -- Set to True if N represents a simple aggregate with only
+ -- (others => <>), not nested as part of another aggregate.
+
+ function Within_Aggregate (N : Node_Id) return Boolean;
+ -- Return True if N is part of an N_Aggregate
+
+ ----------------------
+ -- Within_Aggregate --
+ ----------------------
+
+ function Within_Aggregate (N : Node_Id) return Boolean is
+ P : Node_Id := Parent (N);
+ begin
+ while Present (P) loop
+ if Nkind (P) = N_Aggregate then
+ return True;
+ end if;
+
+ P := Parent (P);
+ end loop;
+
+ return False;
+ end Within_Aggregate;
+
begin
-- Ignore junk empty aggregate resulting from parser error
@@ -809,16 +836,26 @@ package body Sem_Aggr is
and then Present (Component_Associations (N))
then
declare
- Comp : Node_Id;
+ Comp : Node_Id;
+ First_Comp : Boolean := True;
begin
Comp := First (Component_Associations (N));
while Present (Comp) loop
if Box_Present (Comp) then
+ if First_Comp
+ and then No (Expressions (N))
+ and then Nkind (First (Choices (Comp))) = N_Others_Choice
+ and then not Within_Aggregate (N)
+ then
+ Others_Box := True;
+ end if;
+
Insert_Actions (N, Freeze_Entity (Typ, N));
exit;
end if;
+ First_Comp := False;
Next (Comp);
end loop;
end;
@@ -831,7 +868,8 @@ package body Sem_Aggr is
if not Support_Aggregates_On_Target
and then Comes_From_Source (N)
- and then (not Known_Static_Esize (Typ) or else Esize (Typ) > 64)
+ and then (not Known_Static_Esize (Typ)
+ or else Esize (Typ) > System_Max_Integer_Size)
then
Error_Msg_CRT ("aggregate", N);
end if;
@@ -861,6 +899,12 @@ package body Sem_Aggr is
elsif Is_Array_Type (Typ) and then Null_Record_Present (N) then
Error_Msg_N ("null record forbidden in array aggregate", N);
+ elsif Present (Find_Aspect (Typ, Aspect_Aggregate))
+ and then Ekind (Typ) /= E_Record_Type
+ and then Ada_Version >= Ada_2020
+ then
+ Resolve_Container_Aggregate (N, Typ);
+
elsif Is_Record_Type (Typ) then
Resolve_Record_Aggregate (N, Typ);
@@ -1042,6 +1086,13 @@ package body Sem_Aggr is
Set_Analyzed (N);
end if;
+ if Warn_On_No_Value_Assigned
+ and then Others_Box
+ and then not Is_Fully_Initialized_Type (Etype (N))
+ then
+ Error_Msg_N ("?v?aggregate not fully initialized", N);
+ end if;
+
Check_Function_Writable_Actuals (N);
end Resolve_Aggregate;
@@ -1590,21 +1641,16 @@ package body Sem_Aggr is
Set_Etype (Ent, Standard_Void_Type);
Set_Parent (Ent, Parent (N));
Push_Scope (Ent);
- Id :=
- Make_Defining_Identifier (Loc,
- Chars => Chars (Defining_Identifier (N)));
-- Insert and decorate the index variable in the current scope.
-- The expression has to be analyzed once the index variable is
- -- directly visible. Mark the variable as referenced to prevent
- -- spurious warnings, given that subsequent uses of its name in the
- -- expression will reference the internal (synonym) loop variable.
+ -- directly visible.
+ Id := Defining_Identifier (N);
Enter_Name (Id);
Set_Etype (Id, Index_Typ);
Set_Ekind (Id, E_Variable);
Set_Scope (Id, Ent);
- Set_Referenced (Id);
-- Analyze a copy of the expression, to verify legality. We use
-- a copy because the expression will be analyzed anew when the
@@ -1612,6 +1658,7 @@ package body Sem_Aggr is
-- as a loop with a new index variable.
Expr := New_Copy_Tree (Expression (N));
+ Set_Parent (Expr, N);
Dummy := Resolve_Aggr_Expr (Expr, False);
-- An iterated_component_association may appear in a nested
@@ -1791,7 +1838,7 @@ package body Sem_Aggr is
if Others_Present and then not Others_Allowed then
Error_Msg_N
("OTHERS choice not allowed here",
- First (Choices (First (Component_Associations (N)))));
+ First (Choice_List (First (Component_Associations (N)))));
return Failure;
end if;
@@ -2007,8 +2054,13 @@ package body Sem_Aggr is
return Failure;
end if;
+ -- ??? Checks for dynamically tagged expressions below will
+ -- be only applied to iterated_component_association after
+ -- expansion; in particular, errors might not be reported when
+ -- -gnatc switch is used.
+
elsif Nkind (Assoc) = N_Iterated_Component_Association then
- null; -- handled above, in a loop context.
+ null; -- handled above, in a loop context
elsif not Resolve_Aggr_Expr
(Expression (Assoc), Single_Elmt => Single_Choice)
@@ -2644,11 +2696,12 @@ package body Sem_Aggr is
---------------------------------
procedure Resolve_Container_Aggregate (N : Node_Id; Typ : Entity_Id) is
- procedure Resolve_Iterated_Component_Association
+ procedure Resolve_Iterated_Association
(Comp : Node_Id;
Key_Type : Entity_Id;
Elmt_Type : Entity_Id);
- -- Resolve choices and expression in an iterated component association.
+ -- Resolve choices and expression in an iterated component association
+ -- or an iterated element association, which has a key_expression.
-- This is similar but not identical to the handling of this construct
-- in an array aggregate.
-- For a named container, the type of each choice must be compatible
@@ -2664,25 +2717,54 @@ package body Sem_Aggr is
New_Indexed_Subp : Node_Id := Empty;
Assign_Indexed_Subp : Node_Id := Empty;
- --------------------------------------------
- -- Resolve_Iterated_Component_Association --
- --------------------------------------------
+ ----------------------------------
+ -- Resolve_Iterated_Association --
+ ----------------------------------
- procedure Resolve_Iterated_Component_Association
+ procedure Resolve_Iterated_Association
(Comp : Node_Id;
Key_Type : Entity_Id;
Elmt_Type : Entity_Id)
is
- Choice : Node_Id;
- Ent : Entity_Id;
- Expr : Node_Id;
- Id : Entity_Id;
- Iter : Node_Id;
- Typ : Entity_Id := Empty;
+ Choice : Node_Id;
+ Ent : Entity_Id;
+ Expr : Node_Id;
+ Key_Expr : Node_Id;
+ Id : Entity_Id;
+ Id_Name : Name_Id;
+ Iter : Node_Id;
+ Typ : Entity_Id := Empty;
begin
- if Present (Iterator_Specification (Comp)) then
- Iter := Copy_Separate_Tree (Iterator_Specification (Comp));
+ -- If this is an Iterated_Element_Association then either a
+ -- an Iterator_Specification or a Loop_Parameter specification
+ -- is present. In both cases a Key_Expression is present.
+
+ if Nkind (Comp) = N_Iterated_Element_Association then
+ if Present (Loop_Parameter_Specification (Comp)) then
+ Analyze_Loop_Parameter_Specification
+ (Loop_Parameter_Specification (Comp));
+ Id_Name := Chars (Defining_Identifier
+ (Loop_Parameter_Specification (Comp)));
+ else
+ Iter := Copy_Separate_Tree (Iterator_Specification (Comp));
+ Analyze (Iter);
+ Typ := Etype (Defining_Identifier (Iter));
+ Id_Name := Chars (Defining_Identifier
+ (Iterator_Specification (Comp)));
+ end if;
+
+ -- Key expression must have the type of the key. We analyze
+ -- a copy of the original expression, because it will be
+ -- reanalyzed and copied as needed during expansion of the
+ -- corresponding loop.
+
+ Key_Expr := Key_Expression (Comp);
+ Analyze_And_Resolve (New_Copy_Tree (Key_Expr), Key_Type);
+
+ elsif Present (Iterator_Specification (Comp)) then
+ Iter := Copy_Separate_Tree (Iterator_Specification (Comp));
+ Id_Name := Chars (Defining_Identifier (Comp));
Analyze (Iter);
Typ := Etype (Defining_Identifier (Iter));
@@ -2709,19 +2791,19 @@ package body Sem_Aggr is
Next (Choice);
end loop;
+
+ Id_Name := Chars (Defining_Identifier (Comp));
end if;
-- Create a scope in which to introduce an index, which is usually
-- visible in the expression for the component, and needed for its
-- analysis.
+ Id := Make_Defining_Identifier (Sloc (Comp), Id_Name);
Ent := New_Internal_Entity (E_Loop, Current_Scope, Sloc (Comp), 'L');
Set_Etype (Ent, Standard_Void_Type);
Set_Parent (Ent, Parent (Comp));
Push_Scope (Ent);
- Id :=
- Make_Defining_Identifier (Sloc (Comp),
- Chars => Chars (Defining_Identifier (Comp)));
-- Insert and decorate the loop variable in the current scope.
-- The expression has to be analyzed once the loop variable is
@@ -2750,7 +2832,8 @@ package body Sem_Aggr is
Expr := New_Copy_Tree (Expression (Comp));
Preanalyze_And_Resolve (Expr, Elmt_Type);
End_Scope;
- end Resolve_Iterated_Component_Association;
+
+ end Resolve_Iterated_Association;
begin
pragma Assert (Nkind (Asp) = N_Aggregate);
@@ -2795,7 +2878,7 @@ package body Sem_Aggr is
& "for unnamed container aggregate", Comp);
return;
else
- Resolve_Iterated_Component_Association
+ Resolve_Iterated_Association
(Comp, Empty, Elmt_Type);
end if;
@@ -2835,8 +2918,11 @@ package body Sem_Aggr is
Analyze_And_Resolve (Expression (Comp), Elmt_Type);
- elsif Nkind (Comp) = N_Iterated_Component_Association then
- Resolve_Iterated_Component_Association
+ elsif Nkind (Comp) in
+ N_Iterated_Component_Association |
+ N_Iterated_Element_Association
+ then
+ Resolve_Iterated_Association
(Comp, Key_Type, Elmt_Type);
end if;
@@ -2845,9 +2931,9 @@ package body Sem_Aggr is
end;
else
- -- Indexed Aggregate. Both positional and indexed component
- -- can be present. Choices must be static values or ranges
- -- with static bounds.
+ -- Indexed Aggregate. Positional or indexed component
+ -- can be present, but not both. Choices must be static
+ -- values or ranges with static bounds.
declare
Container : constant Entity_Id :=
@@ -2868,6 +2954,12 @@ package body Sem_Aggr is
end if;
if Present (Component_Associations (N)) then
+ if Present (Expressions (N)) then
+ Error_Msg_N ("Container aggregate cannot be "
+ & "both positional and named", N);
+ return;
+ end if;
+
Comp := First (Expressions (N));
while Present (Comp) loop
@@ -2881,8 +2973,11 @@ package body Sem_Aggr is
Analyze_And_Resolve (Expression (Comp), Comp_Type);
- elsif Nkind (Comp) = N_Iterated_Component_Association then
- Resolve_Iterated_Component_Association
+ elsif Nkind (Comp) in
+ N_Iterated_Component_Association |
+ N_Iterated_Element_Association
+ then
+ Resolve_Iterated_Association
(Comp, Index_Type, Comp_Type);
end if;
@@ -2958,15 +3053,15 @@ package body Sem_Aggr is
begin
Set_Etype (Ent, Standard_Void_Type);
Set_Parent (Ent, Assoc);
+ Push_Scope (Ent);
if No (Scope (Id)) then
- Enter_Name (Id);
Set_Etype (Id, Index_Type);
Set_Ekind (Id, E_Variable);
Set_Scope (Id, Ent);
end if;
+ Enter_Name (Id);
- Push_Scope (Ent);
Analyze_And_Resolve
(New_Copy_Tree (Expression (Assoc)), Component_Type (Typ));
End_Scope;
@@ -3965,7 +4060,7 @@ package body Sem_Aggr is
-- Copy the expression so that it is resolved
-- independently for each component, This is needed
- -- for accessibility checks on compoents of anonymous
+ -- for accessibility checks on components of anonymous
-- access types, even in compile_only mode.
if not Inside_A_Generic then
@@ -5031,16 +5126,28 @@ package body Sem_Aggr is
end if;
-- Ada 2012: If component is scalar with default value, use it
+ -- by converting it to Ctyp, so that subtype constraints are
+ -- checked.
elsif Is_Scalar_Type (Ctyp)
and then Has_Default_Aspect (Ctyp)
then
- Add_Association
- (Component => Component,
- Expr =>
- Default_Aspect_Value
- (First_Subtype (Underlying_Type (Ctyp))),
- Assoc_List => New_Assoc_List);
+ declare
+ Conv : constant Node_Id :=
+ Convert_To
+ (Typ => Ctyp,
+ Expr =>
+ New_Copy_Tree
+ (Default_Aspect_Value
+ (First_Subtype (Underlying_Type (Ctyp)))));
+
+ begin
+ Analyze_And_Resolve (Conv, Ctyp);
+ Add_Association
+ (Component => Component,
+ Expr => Conv,
+ Assoc_List => New_Assoc_List);
+ end;
elsif Has_Non_Null_Base_Init_Proc (Ctyp)
or else not Expander_Active
diff --git a/gcc/ada/sem_aggr.ads b/gcc/ada/sem_aggr.ads
index b0b4e14..cbbc71d 100644
--- a/gcc/ada/sem_aggr.ads
+++ b/gcc/ada/sem_aggr.ads
@@ -39,7 +39,7 @@ package Sem_Aggr is
-- Returns True is aggregate Aggr consists of a single OTHERS choice
function Is_Single_Aggregate (Aggr : Node_Id) return Boolean;
- -- Returns True is aggregate Aggr consists of a single choice
+ -- Returns True if aggregate Aggr consists of a single choice
-- WARNING: There is a matching C declaration of this subprogram in fe.h
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index e3c027d..e361601 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -2748,6 +2748,16 @@ package body Sem_Attr is
procedure Min_Max is
begin
+ -- Attribute can appear as function name in a reduction.
+ -- Semantic checks are performed later.
+
+ if Nkind (Parent (N)) = N_Attribute_Reference
+ and then Attribute_Name (Parent (N)) = Name_Reduce
+ then
+ Set_Etype (N, P_Base_Type);
+ return;
+ end if;
+
Check_E2;
Check_Scalar_Type;
Resolve (E1, P_Base_Type);
@@ -2818,9 +2828,21 @@ package body Sem_Attr is
case Uneval_Old_Setting is
when 'E' =>
+ -- ??? In the case where Ada_Version is < Ada_2020 and
+ -- an illegal 'Old prefix would be legal in Ada_2020,
+ -- we'd like to call Error_Msg_Ada_2020_Feature.
+ -- Identifying that case involves some work.
+
Error_Attr_P
("prefix of attribute % that is potentially "
- & "unevaluated must statically name an entity");
+ & "unevaluated must statically name an entity"
+
+ -- further text needed for accuracy if Ada_2020
+ & (if Ada_Version >= Ada_2020
+ and then Attr_Id = Attribute_Old
+ then " or be eligible for conditional evaluation"
+ & " (RM 6.1.1 (27))"
+ else ""));
when 'W' =>
Error_Msg_Name_1 := Aname;
@@ -4755,6 +4777,13 @@ package body Sem_Attr is
when Attribute_Max_Size_In_Storage_Elements =>
Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
+ ----------------------
+ -- Max_Integer_Size --
+ ----------------------
+
+ when Attribute_Max_Integer_Size =>
+ Standard_Attribute (System_Max_Integer_Size);
+
----------------------------------
-- Max_Size_In_Storage_Elements --
----------------------------------
@@ -5119,10 +5148,15 @@ package body Sem_Attr is
else
-- Ensure that the prefix of attribute 'Old is an entity when it
- -- is potentially unevaluated (6.1.1 (27/3)).
+ -- is potentially unevaluated (6.1.1 (27/3)). This rule is
+ -- relaxed in Ada2020 - this relaxation is reflected in the
+ -- call (below) to Eligible_For_Conditional_Evaluation.
if Is_Potentially_Unevaluated (N)
and then not Statically_Names_Object (P)
+ and then not
+ Old_Attr_Util.Conditional_Evaluation
+ .Eligible_For_Conditional_Evaluation (N)
then
Uneval_Old_Msg;
@@ -6254,6 +6288,15 @@ package body Sem_Attr is
if Comes_From_Source (N) then
Check_Not_Incomplete_Type;
+
+ -- 'Tag requires visibility on the corresponding package holding
+ -- the tag, so record a reference here, to avoid spurious unused
+ -- with_clause reported when compiling the main unit.
+
+ if In_Extended_Main_Source_Unit (Current_Scope) then
+ Set_Referenced (P_Type, True);
+ Set_Referenced (Scope (P_Type), True);
+ end if;
end if;
-- Set appropriate type
@@ -6854,7 +6897,7 @@ package body Sem_Attr is
end if;
-- Verify the consistency of types when the current component is
- -- part of a miltiple component update.
+ -- part of a multiple component update.
-- Comp_1 | ... | Comp_N => <value>
@@ -6882,6 +6925,11 @@ package body Sem_Attr is
-- Start of processing for Update
begin
+ if Warn_On_Obsolescent_Feature then
+ Error_Msg_N ("?j?attribute Update is an obsolescent feature", N);
+ Error_Msg_N ("\?j?use a delta aggregate instead", N);
+ end if;
+
Check_E1;
if not Is_Object_Reference (P) then
@@ -7298,7 +7346,7 @@ package body Sem_Attr is
--------------------
procedure Eval_Attribute (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
+ Loc : constant Source_Ptr := Sloc (N);
C_Type : constant Entity_Id := Etype (N);
-- The type imposed by the context
@@ -7875,7 +7923,7 @@ package body Sem_Attr is
if Known_Static_Component_Bit_Offset (CE) then
Compile_Time_Known_Attribute
- (N, Component_Bit_Offset (Entity (P)));
+ (N, Component_Bit_Offset (CE));
else
Check_Expressions;
end if;
@@ -10431,6 +10479,7 @@ package body Sem_Attr is
| Attribute_Initialized
| Attribute_Last_Bit
| Attribute_Library_Level
+ | Attribute_Max_Integer_Size
| Attribute_Maximum_Alignment
| Attribute_Old
| Attribute_Output
@@ -11237,10 +11286,10 @@ package body Sem_Attr is
-- Otherwise a check will be generated later when the return
-- statement gets expanded.
- and then not Is_Special_Aliased_Formal_Access
- (N, Current_Scope)
+ and then not Is_Special_Aliased_Formal_Access (N)
and then
- Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp)
+ Static_Accessibility_Level (N, Zero_On_Dynamic_Level) >
+ Deepest_Type_Access_Level (Btyp)
then
-- In an instance, this is a runtime check, but one we know
-- will fail, so generate an appropriate warning. As usual,
@@ -11383,8 +11432,20 @@ package body Sem_Attr is
if Attr_Id /= Attribute_Unchecked_Access
and then Ekind (Btyp) = E_General_Access_Type
+
+ -- Call Accessibility_Level directly to avoid returning zero
+ -- on cases where the prefix is an explicitly aliased
+ -- parameter in a return statement, instead of using the
+ -- normal Static_Accessibility_Level function.
+
+ -- Shouldn't this be handled somehow in
+ -- Static_Accessibility_Level ???
+
+ and then Nkind (Accessibility_Level (P, Dynamic_Level))
+ = N_Integer_Literal
and then
- Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp)
+ Intval (Accessibility_Level (P, Dynamic_Level))
+ > Deepest_Type_Access_Level (Btyp)
then
Accessibility_Message;
return;
@@ -11405,7 +11466,8 @@ package body Sem_Attr is
-- anonymous_access_to_protected, there are no accessibility
-- checks either. Omit check entirely for Unrestricted_Access.
- elsif Object_Access_Level (P) > Deepest_Type_Access_Level (Btyp)
+ elsif Static_Accessibility_Level (P, Zero_On_Dynamic_Level)
+ > Deepest_Type_Access_Level (Btyp)
and then Comes_From_Source (N)
and then Ekind (Btyp) = E_Access_Protected_Subprogram_Type
and then Attr_Id /= Attribute_Unrestricted_Access
@@ -11453,7 +11515,7 @@ package body Sem_Attr is
Set_Etype (N, Btyp);
- -- Check for incorrect atomic/volatile reference (RM C.6(12))
+ -- Check for incorrect atomic/volatile/VFA reference (RM C.6(12))
if Attr_Id /= Attribute_Unrestricted_Access then
if Is_Atomic_Object (P)
@@ -11469,6 +11531,27 @@ package body Sem_Attr is
Error_Msg_F
("access to volatile object cannot yield access-to-" &
"non-volatile type", P);
+
+ elsif Is_Volatile_Full_Access_Object (P)
+ and then not Is_Volatile_Full_Access (Designated_Type (Typ))
+ then
+ Error_Msg_F
+ ("access to full access object cannot yield access-to-" &
+ "non-full-access type", P);
+ end if;
+
+ -- Check for nonatomic subcomponent of a full access object
+ -- in Ada 2020 (RM C.6 (12)).
+
+ if Ada_Version >= Ada_2020
+ and then Is_Subcomponent_Of_Full_Access_Object (P)
+ and then not Is_Atomic_Object (P)
+ then
+ Error_Msg_NE
+ ("cannot have access attribute with prefix &", N, P);
+ Error_Msg_N
+ ("\nonatomic subcomponent of full access object "
+ & "(RM C.6(12))", N);
end if;
end if;
@@ -12011,6 +12094,11 @@ package body Sem_Attr is
or else Present (Next_Formal (F2))
then
return False;
+
+ elsif Ekind (Op) = E_Procedure then
+ return Ekind (F1) = E_In_Out_Parameter
+ and then Covers (Typ, Etype (F1));
+
else
return
(Ekind (Op) = E_Operator
@@ -12034,13 +12122,19 @@ package body Sem_Attr is
Get_Next_Interp (Index, It);
end loop;
+ elsif Nkind (E1) = N_Attribute_Reference
+ and then (Attribute_Name (E1) = Name_Max
+ or else Attribute_Name (E1) = Name_Min)
+ then
+ Op := E1;
+
elsif Proper_Op (Entity (E1)) then
Op := Entity (E1);
Set_Etype (N, Typ);
end if;
if No (Op) then
- Error_Msg_N ("No visible function for reduction", E1);
+ Error_Msg_N ("No visible subprogram for reduction", E1);
end if;
end;
@@ -12355,11 +12449,17 @@ package body Sem_Attr is
-- applies to an ancestor type.
while Etype (Etyp) /= Etyp loop
- Etyp := Etype (Etyp);
+ declare
+ Derived_Type : constant Entity_Id := Etyp;
+ begin
+ Etyp := Etype (Etyp);
- if Has_Stream_Attribute_Definition (Etyp, Nam) then
- return True;
- end if;
+ if Has_Stream_Attribute_Definition (Etyp, Nam) then
+ if not Derivation_Too_Early_To_Inherit (Derived_Type, Nam) then
+ return True;
+ end if;
+ end if;
+ end;
end loop;
if Ada_Version < Ada_2005 then
diff --git a/gcc/ada/sem_attr.ads b/gcc/ada/sem_attr.ads
index b118a97..5ccb1c1 100644
--- a/gcc/ada/sem_attr.ads
+++ b/gcc/ada/sem_attr.ads
@@ -311,6 +311,16 @@ package Sem_Attr is
-- This attribute is identical to the Object_Size attribute. It is
-- provided for compatibility with the DEC attribute of this name.
+ ----------------------
+ -- Max_Integer_Size --
+ ----------------------
+
+ Attribute_Max_Integer_Size => True,
+ -- Standard'Max_Integer_Size (Standard is the only permissible prefix)
+ -- provides values System.Min_Int and System.Max_Int, and is intended
+ -- primarily for constructing these definitions in package System. This
+ -- is a static attribute.
+
-----------------------
-- Maximum_Alignment --
-----------------------
diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb
index 4a16c12..36fd6ad 100644
--- a/gcc/ada/sem_aux.adb
+++ b/gcc/ada/sem_aux.adb
@@ -18,13 +18,6 @@
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
@@ -163,6 +156,8 @@ package body Sem_Aux is
return Standard_Long_Unsigned;
elsif Siz = Esize (Standard_Long_Long_Integer) then
return Standard_Long_Long_Unsigned;
+ elsif Siz = Esize (Standard_Long_Long_Long_Integer) then
+ return Standard_Long_Long_Long_Unsigned;
else
raise Program_Error;
end if;
@@ -364,6 +359,9 @@ package body Sem_Aux is
elsif B = Base_Type (Standard_Long_Long_Integer) then
return Standard_Long_Long_Integer;
+ elsif B = Base_Type (Standard_Long_Long_Long_Integer) then
+ return Standard_Long_Long_Long_Integer;
+
elsif Is_Generic_Type (Typ) then
if Present (Parent (B)) then
return Defining_Identifier (Parent (B));
@@ -706,29 +704,6 @@ package body Sem_Aux is
return Present (Get_Rep_Item (E, Nam1, Nam2, Check_Parents));
end Has_Rep_Item;
- function Has_Rep_Item (E : Entity_Id; N : Node_Id) return Boolean is
- Item : Node_Id;
-
- begin
- pragma Assert
- (Nkind (N) in N_Aspect_Specification
- | N_Attribute_Definition_Clause
- | N_Enumeration_Representation_Clause
- | N_Pragma
- | N_Record_Representation_Clause);
-
- Item := First_Rep_Item (E);
- while Present (Item) loop
- if Item = N then
- return True;
- end if;
-
- Next_Rep_Item (Item);
- end loop;
-
- return False;
- end Has_Rep_Item;
-
--------------------
-- Has_Rep_Pragma --
--------------------
diff --git a/gcc/ada/sem_aux.ads b/gcc/ada/sem_aux.ads
index c15c271..1d82045 100644
--- a/gcc/ada/sem_aux.ads
+++ b/gcc/ada/sem_aux.ads
@@ -18,13 +18,6 @@
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
--- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
@@ -247,10 +240,6 @@ package Sem_Aux is
-- not inherited from its parents, if any). If found then True is returned,
-- otherwise False indicates that no matching entry was found.
- function Has_Rep_Item (E : Entity_Id; N : Node_Id) return Boolean;
- -- Determine whether the Rep_Item chain of arbitrary entity E contains item
- -- N. N must denote a valid rep item.
-
function Has_Rep_Pragma
(E : Entity_Id;
Nam : Name_Id;
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index be1e67e..7872c68 100644
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -2121,6 +2121,7 @@ package body Sem_Cat is
| N_Index_Or_Discriminant_Constraint
| N_Membership_Test
| N_Op
+ | N_Range
=>
return True;
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 76b68a1..0bad136 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -4480,10 +4480,6 @@ package body Sem_Ch10 is
-- Determine whether any package in the ancestor chain starting with
-- C_Unit has a limited with clause for package Pack.
- function Is_Visible_Through_Renamings (P : Entity_Id) return Boolean;
- -- Check if some package installed though normal with-clauses has a
- -- renaming declaration of package P. AARM 10.1.2(21/2).
-
-------------------------
-- Check_Body_Required --
-------------------------
@@ -4813,108 +4809,6 @@ package body Sem_Ch10 is
return False;
end Has_Limited_With_Clause;
- ----------------------------------
- -- Is_Visible_Through_Renamings --
- ----------------------------------
-
- function Is_Visible_Through_Renamings (P : Entity_Id) return Boolean is
- Kind : constant Node_Kind :=
- Nkind (Unit (Cunit (Current_Sem_Unit)));
- Aux_Unit : Node_Id;
- Item : Node_Id;
- Decl : Entity_Id;
-
- begin
- -- Example of the error detected by this subprogram:
-
- -- package P is
- -- type T is ...
- -- end P;
-
- -- with P;
- -- package Q is
- -- package Ren_P renames P;
- -- end Q;
-
- -- with Q;
- -- package R is ...
-
- -- limited with P; -- ERROR
- -- package R.C is ...
-
- Aux_Unit := Cunit (Current_Sem_Unit);
-
- loop
- Item := First (Context_Items (Aux_Unit));
- while Present (Item) loop
- if Nkind (Item) = N_With_Clause
- and then not Limited_Present (Item)
- and then Nkind (Unit (Library_Unit (Item))) =
- N_Package_Declaration
- then
- Decl :=
- First (Visible_Declarations
- (Specification (Unit (Library_Unit (Item)))));
- while Present (Decl) loop
- if Nkind (Decl) = N_Package_Renaming_Declaration
- and then Entity (Name (Decl)) = P
- then
- -- Generate the error message only if the current unit
- -- is a package declaration; in case of subprogram
- -- bodies and package bodies we just return True to
- -- indicate that the limited view must not be
- -- installed.
-
- if Kind = N_Package_Declaration then
- Error_Msg_N
- ("simultaneous visibility of the limited and " &
- "unlimited views not allowed", N);
- Error_Msg_Sloc := Sloc (Item);
- Error_Msg_NE
- ("\\ unlimited view of & visible through the " &
- "context clause #", N, P);
- Error_Msg_Sloc := Sloc (Decl);
- Error_Msg_NE ("\\ and the renaming #", N, P);
- end if;
-
- return True;
- end if;
-
- Next (Decl);
- end loop;
- end if;
-
- Next (Item);
- end loop;
-
- -- If it is a body not acting as spec, follow pointer to the
- -- corresponding spec, otherwise follow pointer to parent spec.
-
- if Present (Library_Unit (Aux_Unit))
- and then Nkind (Unit (Aux_Unit)) in
- N_Package_Body | N_Subprogram_Body
- then
- if Aux_Unit = Library_Unit (Aux_Unit) then
-
- -- Aux_Unit is a body that acts as a spec. Clause has
- -- already been flagged as illegal.
-
- return False;
-
- else
- Aux_Unit := Library_Unit (Aux_Unit);
- end if;
-
- else
- Aux_Unit := Parent_Spec (Unit (Aux_Unit));
- end if;
-
- exit when No (Aux_Unit);
- end loop;
-
- return False;
- end Is_Visible_Through_Renamings;
-
-- Start of processing for Install_Limited_With_Clause
begin
@@ -4952,7 +4846,7 @@ package body Sem_Ch10 is
-- Do not install the limited-view if the full-view is already visible
-- through renaming declarations.
- if Is_Visible_Through_Renamings (P) then
+ if Is_Visible_Through_Renamings (P, N) then
return;
end if;
@@ -5303,8 +5197,9 @@ package body Sem_Ch10 is
-- analyzing the private part of the package).
if Private_Present (With_Clause)
- and then Nkind (Unit (Parent (With_Clause))) = N_Package_Declaration
- and then not (Private_With_OK)
+ and then Nkind (Unit (Parent (With_Clause)))
+ in N_Package_Declaration | N_Generic_Package_Declaration
+ and then not Private_With_OK
then
return;
end if;
@@ -5371,7 +5266,7 @@ package body Sem_Ch10 is
Set_Is_Visible_Lib_Unit (Uname);
-- If the unit is a wrapper package for a compilation unit that is
- -- a subprogrm instance, indicate that the instance itself is a
+ -- a subprogram instance, indicate that the instance itself is a
-- visible unit. This is necessary if the instance is inlined.
if Is_Wrapper_Package (Uname) then
@@ -5551,6 +5446,148 @@ package body Sem_Ch10 is
end if;
end Is_Ancestor_Unit;
+ ----------------------------------
+ -- Is_Visible_Through_Renamings --
+ ----------------------------------
+
+ function Is_Visible_Through_Renamings
+ (P : Entity_Id;
+ Error_Node : Node_Id := Empty) return Boolean
+ is
+ function Is_Limited_Withed_Unit
+ (Lib_Unit : Node_Id;
+ Pkg_Ent : Entity_Id) return Boolean;
+ -- Return True if Pkg_Ent is a limited-withed package of the given
+ -- library unit.
+
+ ----------------------------
+ -- Is_Limited_Withed_Unit --
+ ----------------------------
+
+ function Is_Limited_Withed_Unit
+ (Lib_Unit : Node_Id;
+ Pkg_Ent : Entity_Id) return Boolean
+ is
+ Item : Node_Id := First (Context_Items (Lib_Unit));
+
+ begin
+ while Present (Item) loop
+ if Nkind (Item) = N_With_Clause
+ and then Limited_Present (Item)
+ and then Entity (Name (Item)) = Pkg_Ent
+ then
+ return True;
+ end if;
+
+ Next (Item);
+ end loop;
+
+ return False;
+ end Is_Limited_Withed_Unit;
+
+ -- Local variables
+
+ Kind : constant Node_Kind := Nkind (Unit (Cunit (Current_Sem_Unit)));
+ Aux_Unit : Node_Id;
+ Item : Node_Id;
+ Decl : Entity_Id;
+
+ begin
+ -- Example of the error detected by this subprogram:
+
+ -- package P is
+ -- type T is ...
+ -- end P;
+
+ -- with P;
+ -- package Q is
+ -- package Ren_P renames P;
+ -- end Q;
+
+ -- with Q;
+ -- package R is ...
+
+ -- limited with P; -- ERROR
+ -- package R.C is ...
+
+ Aux_Unit := Cunit (Current_Sem_Unit);
+
+ loop
+ Item := First (Context_Items (Aux_Unit));
+ while Present (Item) loop
+ if Nkind (Item) = N_With_Clause
+ and then not Limited_Present (Item)
+ and then Nkind (Unit (Library_Unit (Item))) =
+ N_Package_Declaration
+ then
+ Decl :=
+ First (Visible_Declarations
+ (Specification (Unit (Library_Unit (Item)))));
+ while Present (Decl) loop
+ if Nkind (Decl) = N_Package_Renaming_Declaration
+ and then Entity (Name (Decl)) = P
+ and then not Is_Limited_Withed_Unit
+ (Lib_Unit => Library_Unit (Item),
+ Pkg_Ent => Entity (Name (Decl)))
+ then
+ -- Generate the error message only if the current unit
+ -- is a package declaration; in case of subprogram
+ -- bodies and package bodies we just return True to
+ -- indicate that the limited view must not be
+ -- installed.
+
+ if Kind = N_Package_Declaration
+ and then Present (Error_Node)
+ then
+ Error_Msg_N
+ ("simultaneous visibility of the limited and " &
+ "unlimited views not allowed", Error_Node);
+ Error_Msg_Sloc := Sloc (Item);
+ Error_Msg_NE
+ ("\\ unlimited view of & visible through the " &
+ "context clause #", Error_Node, P);
+ Error_Msg_Sloc := Sloc (Decl);
+ Error_Msg_NE ("\\ and the renaming #", Error_Node, P);
+ end if;
+
+ return True;
+ end if;
+
+ Next (Decl);
+ end loop;
+ end if;
+
+ Next (Item);
+ end loop;
+
+ -- If it is a body not acting as spec, follow pointer to the
+ -- corresponding spec, otherwise follow pointer to parent spec.
+
+ if Present (Library_Unit (Aux_Unit))
+ and then Nkind (Unit (Aux_Unit)) in
+ N_Package_Body | N_Subprogram_Body
+ then
+ if Aux_Unit = Library_Unit (Aux_Unit) then
+
+ -- Aux_Unit is a body that acts as a spec. Clause has
+ -- already been flagged as illegal.
+
+ return False;
+
+ else
+ Aux_Unit := Library_Unit (Aux_Unit);
+ end if;
+
+ else
+ Aux_Unit := Parent_Spec (Unit (Aux_Unit));
+ end if;
+
+ exit when No (Aux_Unit);
+ end loop;
+
+ return False;
+ end Is_Visible_Through_Renamings;
+
-----------------------
-- Load_Needed_Body --
-----------------------
@@ -6464,7 +6501,7 @@ package body Sem_Ch10 is
null;
elsif Nkind (Item) = N_With_Clause
- and then Context_Installed (Item)
+ and then Context_Installed (Item)
then
-- Remove items from one with'ed unit
@@ -6818,12 +6855,12 @@ package body Sem_Ch10 is
-- In_Regular_With_Clause --
----------------------------
- function In_Regular_With_Clause (E : Entity_Id) return Boolean
- is
+ function In_Regular_With_Clause (E : Entity_Id) return Boolean is
Item : Node_Id;
begin
Item := First (Context_Items (Comp_Unit));
+
while Present (Item) loop
if Nkind (Item) = N_With_Clause
@@ -6836,6 +6873,7 @@ package body Sem_Ch10 is
then
return True;
end if;
+
Next (Item);
end loop;
diff --git a/gcc/ada/sem_ch10.ads b/gcc/ada/sem_ch10.ads
index 11f1586..b0946a4 100644
--- a/gcc/ada/sem_ch10.ads
+++ b/gcc/ada/sem_ch10.ads
@@ -51,6 +51,25 @@ package Sem_Ch10 is
-- view, determine whether the package where T resides is imported through
-- a regular with clause in the current package body.
+ function Is_Visible_Through_Renamings
+ (P : Entity_Id;
+ Error_Node : Node_Id := Empty) return Boolean;
+ -- Check if some package installed though normal with-clauses has a
+ -- renaming declaration of package P. AARM 10.1.2(21/2). Errors are
+ -- reported on Error_Node (if present); otherwise no error is reported.
+
+ procedure Load_Needed_Body
+ (N : Node_Id;
+ OK : out Boolean;
+ Do_Analyze : Boolean := True);
+ -- Load and analyze the body of a context unit that is generic, or that
+ -- contains generic units or inlined units. The body becomes part of the
+ -- semantic dependency set of the unit that needs it. The returned result
+ -- in OK is True if the load is successful, and False if the requested file
+ -- cannot be found. If the flag Do_Analyze is false, the unit is loaded and
+ -- parsed only. This allows a selective analysis in some inlining cases
+ -- where a full analysis would lead so circularities in the back-end.
+
procedure Remove_Context (N : Node_Id);
-- Removes the entities from the context clause of the given compilation
-- unit from the visibility chains. This is done on exit from a unit as
@@ -66,16 +85,4 @@ package Sem_Ch10 is
-- rule imposes extra steps in order to install/remove the private_with
-- clauses of an enclosing unit.
- procedure Load_Needed_Body
- (N : Node_Id;
- OK : out Boolean;
- Do_Analyze : Boolean := True);
- -- Load and analyze the body of a context unit that is generic, or that
- -- contains generic units or inlined units. The body becomes part of the
- -- semantic dependency set of the unit that needs it. The returned result
- -- in OK is True if the load is successful, and False if the requested file
- -- cannot be found. If the flag Do_Analyze is false, the unit is loaded and
- -- parsed only. This allows a selective analysis in some inlining cases
- -- where a full analysis would lead so circularities in the back-end.
-
end Sem_Ch10;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index cbf27e2..06b3bec 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -270,6 +270,7 @@ package body Sem_Ch12 is
-- Refined_Depends
-- Refined_Global
-- Refined_Post
+ -- Subprogram_Variant
-- Test_Case
-- Most package contract annotations utilize forward references to classify
@@ -7512,11 +7513,60 @@ package body Sem_Ch12 is
null;
elsif Present (Entity (Gen_Id))
+ and then No (Renamed_Entity (Entity (Gen_Id)))
and then Is_Child_Unit (Entity (Gen_Id))
and then not In_Open_Scopes (Inst_Par)
then
Install_Parent (Inst_Par);
Parent_Installed := True;
+
+ -- Handle renaming of generic child unit
+
+ elsif Present (Entity (Gen_Id))
+ and then Present (Renamed_Entity (Entity (Gen_Id)))
+ and then Is_Child_Unit (Renamed_Entity (Entity (Gen_Id)))
+ then
+ declare
+ E : Entity_Id;
+ Ren_Decl : Node_Id;
+
+ begin
+ -- The entity of the renamed generic child unit does not
+ -- have any reference to the instantiated parent. In order to
+ -- locate it we traverse the scope containing the renaming
+ -- declaration; the instance of the parent is available in
+ -- the prefix of the renaming declaration. For example:
+
+ -- package A is
+ -- package Inst_Par is new ...
+ -- generic package Ren_Child renames Ins_Par.Child;
+ -- end;
+
+ -- with A;
+ -- package B is
+ -- package Inst_Child is new A.Ren_Child;
+ -- end;
+
+ E := First_Entity (Entity (Prefix (Gen_Id)));
+ while Present (E) loop
+ if Present (Renamed_Entity (E))
+ and then
+ Renamed_Entity (E) = Renamed_Entity (Entity (Gen_Id))
+ then
+ Ren_Decl := Parent (E);
+ Inst_Par := Entity (Prefix (Name (Ren_Decl)));
+
+ if not In_Open_Scopes (Inst_Par) then
+ Install_Parent (Inst_Par);
+ Parent_Installed := True;
+ end if;
+
+ exit;
+ end if;
+
+ E := Next_Entity (E);
+ end loop;
+ end;
end if;
elsif In_Enclosing_Instance then
@@ -8005,9 +8055,7 @@ package body Sem_Ch12 is
end if;
elsif No (Ent)
- or else Nkind (Ent) not in N_Defining_Identifier
- | N_Defining_Character_Literal
- | N_Defining_Operator_Symbol
+ or else Nkind (Ent) not in N_Entity
or else No (Scope (Ent))
or else
(Scope (Ent) = Current_Instantiated_Parent.Gen_Id
@@ -8174,9 +8222,7 @@ package body Sem_Ch12 is
then
Set_Entity (New_N, Entity (Name (Assoc)));
- elsif Nkind (Assoc) in N_Defining_Identifier
- | N_Defining_Character_Literal
- | N_Defining_Operator_Symbol
+ elsif Nkind (Assoc) in N_Entity
and then Expander_Active
then
-- Inlining case: we are copying a tree that contains
@@ -8934,8 +8980,8 @@ package body Sem_Ch12 is
is
Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node);
Par : constant Entity_Id := Scope (Gen_Unit);
- E_G_Id : Entity_Id;
Enc_G : Entity_Id;
+ Enc_G_F : Node_Id;
Enc_I : Node_Id;
F_Node : Node_Id;
@@ -9060,12 +9106,7 @@ package body Sem_Ch12 is
and then Present (Freeze_Node (Par))
and then Present (Enc_I)
then
- if In_Same_Declarative_Part (Parent (Freeze_Node (Par)), Enc_I)
- or else
- (Nkind (Enc_I) = N_Package_Body
- and then In_Same_Declarative_Part
- (Parent (Freeze_Node (Par)), Parent (Enc_I)))
- then
+ if In_Same_Declarative_Part (Parent (Freeze_Node (Par)), Enc_I) then
-- The enclosing package may contain several instances. Rather
-- than computing the earliest point at which to insert its freeze
-- node, we place it at the end of the declarative part of the
@@ -9082,14 +9123,6 @@ package body Sem_Ch12 is
and then Enc_G /= Enc_I
and then Earlier (Inst_Node, Gen_Body)
then
- if Nkind (Enc_G) = N_Package_Body then
- E_G_Id :=
- Corresponding_Spec (Enc_G);
- else pragma Assert (Nkind (Enc_G) = N_Package_Body_Stub);
- E_G_Id :=
- Corresponding_Spec (Proper_Body (Unit (Library_Unit (Enc_G))));
- end if;
-
-- Freeze package that encloses instance, and place node after the
-- package that encloses generic. If enclosing package is already
-- frozen we have to assume it is at the proper place. This may be a
@@ -9117,10 +9150,10 @@ package body Sem_Ch12 is
-- Freeze enclosing subunit before instance
- Ensure_Freeze_Node (E_G_Id);
+ Enc_G_F := Package_Freeze_Node (Enc_G);
- if not Is_List_Member (Freeze_Node (E_G_Id)) then
- Insert_After (Enc_G, Freeze_Node (E_G_Id));
+ if not Is_List_Member (Enc_G_F) then
+ Insert_After (Enc_G, Enc_G_F);
end if;
Insert_Freeze_Node_For_Instance (Inst_Node, F_Node);
@@ -11346,8 +11379,8 @@ package body Sem_Ch12 is
Note_Possible_Modification (Actual, Sure => True);
- -- Check for instantiation with atomic/volatile object actual for
- -- nonatomic/nonvolatile formal (RM C.6 (12)).
+ -- Check for instantiation with atomic/volatile/VFA object actual for
+ -- nonatomic/nonvolatile/nonVFA formal (RM C.6 (12)).
if Is_Atomic_Object (Actual) and then not Is_Atomic (Orig_Ftyp) then
Error_Msg_NE
@@ -11361,20 +11394,29 @@ package body Sem_Ch12 is
("cannot instantiate nonvolatile formal & of mode in out",
Actual, Gen_Obj);
Error_Msg_N ("\with volatile object actual (RM C.6(12))", Actual);
+
+ elsif Is_Volatile_Full_Access_Object (Actual)
+ and then not Is_Volatile_Full_Access (Orig_Ftyp)
+ then
+ Error_Msg_NE
+ ("cannot instantiate nonfull access formal & of mode in out",
+ Actual, Gen_Obj);
+ Error_Msg_N
+ ("\with full access object actual (RM C.6(12))", Actual);
end if;
- -- Check for instantiation on nonatomic subcomponent of an atomic
- -- object in Ada 2020 (RM C.6 (13)).
+ -- Check for instantiation on nonatomic subcomponent of a full access
+ -- object in Ada 2020 (RM C.6 (12)).
if Ada_Version >= Ada_2020
- and then Is_Subcomponent_Of_Atomic_Object (Actual)
+ and then Is_Subcomponent_Of_Full_Access_Object (Actual)
and then not Is_Atomic_Object (Actual)
then
Error_Msg_NE
("cannot instantiate formal & of mode in out with actual",
Actual, Gen_Obj);
Error_Msg_N
- ("\nonatomic subcomponent of atomic object (RM C.6(13))",
+ ("\nonatomic subcomponent of full access object (RM C.6(12))",
Actual);
end if;
@@ -11637,6 +11679,8 @@ package body Sem_Ch12 is
Act_Decl : constant Node_Id := Body_Info.Act_Decl;
Act_Decl_Id : constant Entity_Id := Defining_Entity (Act_Decl);
Act_Spec : constant Node_Id := Specification (Act_Decl);
+ Ctx_Parents : Elist_Id := No_Elist;
+ Ctx_Top : Int := 0;
Inst_Node : constant Node_Id := Body_Info.Inst_Node;
Gen_Id : constant Node_Id := Name (Inst_Node);
Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node);
@@ -11648,6 +11692,17 @@ package body Sem_Ch12 is
-- appear uninitialized. This is suspicious, unless the actual is a
-- fully initialized type.
+ procedure Install_Parents_Of_Generic_Context
+ (Inst_Scope : Entity_Id;
+ Ctx_Parents : out Elist_Id);
+ -- Inst_Scope is the scope where the instance appears within; when it
+ -- appears within a generic child package G, this routine collects and
+ -- installs the enclosing packages of G in the scopes stack; installed
+ -- packages are returned in Ctx_Parents.
+
+ procedure Remove_Parents_Of_Generic_Context (Ctx_Parents : Elist_Id);
+ -- Reverse effect after instantiation is complete
+
-----------------------------
-- Check_Initialized_Types --
-----------------------------
@@ -11711,6 +11766,60 @@ package body Sem_Ch12 is
end loop;
end Check_Initialized_Types;
+ ----------------------------------------
+ -- Install_Parents_Of_Generic_Context --
+ ----------------------------------------
+
+ procedure Install_Parents_Of_Generic_Context
+ (Inst_Scope : Entity_Id;
+ Ctx_Parents : out Elist_Id)
+ is
+ Elmt : Elmt_Id;
+ S : Entity_Id;
+
+ begin
+ Ctx_Parents := New_Elmt_List;
+
+ -- Collect context parents (ie. parents where the instantiation
+ -- appears within).
+
+ S := Inst_Scope;
+ while S /= Standard_Standard loop
+ Prepend_Elmt (S, Ctx_Parents);
+ S := Scope (S);
+ end loop;
+
+ -- Install enclosing parents
+
+ Elmt := First_Elmt (Ctx_Parents);
+ while Present (Elmt) loop
+ Push_Scope (Node (Elmt));
+ Set_Is_Immediately_Visible (Node (Elmt));
+ Next_Elmt (Elmt);
+ end loop;
+ end Install_Parents_Of_Generic_Context;
+
+ ---------------------------------------
+ -- Remove_Parents_Of_Generic_Context --
+ ---------------------------------------
+
+ procedure Remove_Parents_Of_Generic_Context (Ctx_Parents : Elist_Id) is
+ Elmt : Elmt_Id;
+
+ begin
+ -- Traverse Ctx_Parents in LIFO order to check the removed scopes
+
+ Elmt := Last_Elmt (Ctx_Parents);
+ while Present (Elmt) loop
+ pragma Assert (Current_Scope = Node (Elmt));
+ Set_Is_Immediately_Visible (Current_Scope, False);
+ Pop_Scope;
+
+ Remove_Last_Elmt (Ctx_Parents);
+ Elmt := Last_Elmt (Ctx_Parents);
+ end loop;
+ end Remove_Parents_Of_Generic_Context;
+
-- Local variables
-- The following constants capture the context prior to instantiating
@@ -11738,6 +11847,11 @@ package body Sem_Ch12 is
Par_Installed : Boolean := False;
Par_Vis : Boolean := False;
+ Scope_Check_Id : Entity_Id;
+ Scope_Check_Last : Nat;
+ -- Value of Current_Scope before calls to Install_Parents; used to check
+ -- that scopes are correctly removed after instantiation.
+
Vis_Prims_List : Elist_Id := No_Elist;
-- List of primitives made temporarily visible in the instantiation
-- to match the visibility of the formal type.
@@ -11951,6 +12065,34 @@ package body Sem_Ch12 is
end loop;
end;
+ Scope_Check_Id := Current_Scope;
+ Scope_Check_Last := Scope_Stack.Last;
+
+ -- If the instantiation appears within a generic child some actual
+ -- parameter may be the current instance of the enclosing generic
+ -- parent.
+
+ declare
+ Inst_Scope : constant Entity_Id := Scope (Act_Decl_Id);
+
+ begin
+ if Is_Child_Unit (Inst_Scope)
+ and then Ekind (Inst_Scope) = E_Generic_Package
+ and then Present (Generic_Associations (Inst_Node))
+ then
+ Install_Parents_Of_Generic_Context (Inst_Scope, Ctx_Parents);
+
+ -- Hide them from visibility; required to avoid conflicts
+ -- installing the parent instance.
+
+ if Present (Ctx_Parents) then
+ Push_Scope (Standard_Standard);
+ Ctx_Top := Scope_Stack.Last;
+ Scope_Stack.Table (Ctx_Top).Is_Active_Stack_Base := True;
+ end if;
+ end if;
+ end;
+
-- If it is a child unit, make the parent instance (which is an
-- instance of the parent of the generic) visible. The parent
-- instance is the prefix of the name of the generic unit.
@@ -11986,7 +12128,18 @@ package body Sem_Ch12 is
Build_Instance_Compilation_Unit_Nodes
(Inst_Node, Act_Body, Act_Decl);
- Analyze (Inst_Node);
+
+ -- If the instantiation appears within a generic child package
+ -- enable visibility of current instance of enclosing generic
+ -- parents.
+
+ if Present (Ctx_Parents) then
+ Scope_Stack.Table (Ctx_Top).Is_Active_Stack_Base := False;
+ Analyze (Inst_Node);
+ Scope_Stack.Table (Ctx_Top).Is_Active_Stack_Base := True;
+ else
+ Analyze (Inst_Node);
+ end if;
if Parent (Inst_Node) = Cunit (Main_Unit) then
@@ -12010,14 +12163,22 @@ package body Sem_Ch12 is
-- indicate that the body instance is to be delayed.
Install_Body (Act_Body, Inst_Node, Gen_Body, Gen_Decl);
- Analyze (Act_Body);
+
+ -- If the instantiation appears within a generic child package
+ -- enable visibility of current instance of enclosing generic
+ -- parents.
+
+ if Present (Ctx_Parents) then
+ Scope_Stack.Table (Ctx_Top).Is_Active_Stack_Base := False;
+ Analyze (Act_Body);
+ Scope_Stack.Table (Ctx_Top).Is_Active_Stack_Base := True;
+ else
+ Analyze (Act_Body);
+ end if;
end if;
Inherit_Context (Gen_Body, Inst_Node);
- -- Remove the parent instances if they have been placed on the scope
- -- stack to compile the body.
-
if Par_Installed then
Remove_Parent (In_Body => True);
@@ -12026,6 +12187,20 @@ package body Sem_Ch12 is
Set_Is_Immediately_Visible (Par_Ent, Par_Vis);
end if;
+ -- Remove the parent instances if they have been placed on the scope
+ -- stack to compile the body.
+
+ if Present (Ctx_Parents) then
+ pragma Assert (Scope_Stack.Last = Ctx_Top
+ and then Current_Scope = Standard_Standard);
+ Pop_Scope;
+
+ Remove_Parents_Of_Generic_Context (Ctx_Parents);
+ end if;
+
+ pragma Assert (Current_Scope = Scope_Check_Id);
+ pragma Assert (Scope_Stack.Last = Scope_Check_Last);
+
Restore_Hidden_Primitives (Vis_Prims_List);
-- Restore the private views that were made visible when the body of
@@ -12533,15 +12708,15 @@ package body Sem_Ch12 is
if Is_Volatile (A_Gen_T) and then not Is_Volatile (Act_T) then
Error_Msg_NE
- ("actual for& has different Volatile aspect",
- Actual, A_Gen_T);
+ ("actual for& must have Volatile aspect",
+ Actual, A_Gen_T);
elsif Is_Derived_Type (A_Gen_T)
and then Is_Volatile (A_Gen_T) /= Is_Volatile (Act_T)
then
Error_Msg_NE
("actual for& has different Volatile aspect",
- Actual, A_Gen_T);
+ Actual, A_Gen_T);
end if;
-- We assume that an array type whose atomic component type
@@ -15656,10 +15831,7 @@ package body Sem_Ch12 is
-- preserve in this case, since the expansion will be redone in
-- the instance.
- if Nkind (E) not in N_Defining_Character_Literal
- | N_Defining_Identifier
- | N_Defining_Operator_Symbol
- then
+ if Nkind (E) not in N_Entity then
Set_Associated_Node (N, Empty);
Set_Etype (N, Empty);
return;
@@ -15708,7 +15880,12 @@ package body Sem_Ch12 is
elsif Nkind (Parent (N)) = N_Selected_Component
and then Nkind (Parent (N2)) = N_Expanded_Name
then
- if Is_Global (Entity (Parent (N2))) then
+ -- In case of previous errors, the tree might be malformed
+
+ if No (Entity (Parent (N2))) then
+ null;
+
+ elsif Is_Global (Entity (Parent (N2))) then
Change_Selected_Component_To_Expanded_Name (Parent (N));
Set_Associated_Node (Parent (N), Parent (N2));
Set_Global_Type (Parent (N), Parent (N2));
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 30cade8..7013094 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -390,8 +390,7 @@ package body Sem_Ch13 is
procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is
Max_Machine_Scalar_Size : constant Uint :=
- UI_From_Int
- (Standard_Long_Long_Integer_Size);
+ UI_From_Int (System_Max_Integer_Size);
-- We use this as the maximum machine scalar size
SSU : constant Uint := UI_From_Int (System_Storage_Unit);
@@ -1211,9 +1210,11 @@ package body Sem_Ch13 is
Set_Is_Volatile (E);
end if;
- -- Volatile_Full_Access
+ -- Volatile_Full_Access (also Full_Access_Only)
- when Aspect_Volatile_Full_Access =>
+ when Aspect_Volatile_Full_Access
+ | Aspect_Full_Access_Only
+ =>
if Is_Volatile_Full_Access (P) then
Set_Is_Volatile_Full_Access (E);
end if;
@@ -1309,7 +1310,9 @@ package body Sem_Ch13 is
return;
end if;
- when Aspect_Volatile_Full_Access =>
+ when Aspect_Volatile_Full_Access
+ | Aspect_Full_Access_Only
+ =>
if not Is_Volatile_Full_Access (Par) then
return;
end if;
@@ -1327,23 +1330,28 @@ package body Sem_Ch13 is
-- Local variables
- Prag : Node_Id;
+ Prag : Node_Id;
+ P_Name : Name_Id;
-- Start of processing for Make_Pragma_From_Boolean_Aspect
begin
- -- Note that we know Expr is present, because for a missing Expr
- -- argument, we knew it was True and did not need to delay the
- -- evaluation to the freeze point.
-
- if Is_False (Static_Boolean (Expr)) then
+ if Present (Expr) and then Is_False (Static_Boolean (Expr)) then
Check_False_Aspect_For_Derived_Type;
else
+ -- There is no Full_Access_Only pragma so use VFA instead
+
+ if A_Name = Name_Full_Access_Only then
+ P_Name := Name_Volatile_Full_Access;
+ else
+ P_Name := A_Name;
+ end if;
+
Prag :=
Make_Pragma (Loc,
Pragma_Identifier =>
- Make_Identifier (Sloc (Ident), Chars (Ident)),
+ Make_Identifier (Sloc (Ident), P_Name),
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ident),
Expression => New_Occurrence_Of (Ent, Sloc (Ident)))));
@@ -1428,12 +1436,13 @@ package body Sem_Ch13 is
-- Analyze_Aspect_Export_Import, but is not analyzed as
-- the complete analysis must happen now.
- if A_Id = Aspect_Export or else A_Id = Aspect_Import then
- null;
-
- -- Otherwise create a corresponding pragma
+ -- Aspect Full_Access_Only must be analyzed last so that
+ -- aspects Volatile and Atomic, if any, are analyzed.
- else
+ if A_Id /= Aspect_Export
+ and then A_Id /= Aspect_Import
+ and then A_Id /= Aspect_Full_Access_Only
+ then
Make_Pragma_From_Boolean_Aspect (ASN);
end if;
@@ -1500,6 +1509,25 @@ package body Sem_Ch13 is
Next_Rep_Item (ASN);
end loop;
+ -- Make a second pass for a Full_Access_Only entry
+
+ ASN := First_Rep_Item (E);
+ while Present (ASN) loop
+ if Nkind (ASN) = N_Aspect_Specification then
+ exit when Entity (ASN) /= E;
+
+ if Get_Aspect_Id (ASN) = Aspect_Full_Access_Only then
+ Make_Pragma_From_Boolean_Aspect (ASN);
+ Ritem := Aspect_Rep_Item (ASN);
+ if Present (Ritem) then
+ Analyze (Ritem);
+ end if;
+ end if;
+ end if;
+
+ Next_Rep_Item (ASN);
+ end loop;
+
-- This is where we inherit delayed rep aspects from our parent. Note
-- that if we fell out of the above loop with ASN non-empty, it means
-- we hit an aspect for an entity other than E, and it must be the
@@ -1545,6 +1573,7 @@ package body Sem_Ch13 is
-- Refined_Global
-- Refined_State
-- SPARK_Mode
+ -- Subprogram_Variant
-- Warnings
-- Insert pragma Prag such that it mimics the placement of a source
-- pragma of the same kind. Flag Is_Generic should be set when the
@@ -1765,10 +1794,10 @@ package body Sem_Ch13 is
-- analyzed right now.
-- Note that there is a special handling for Pre, Post, Test_Case,
- -- Contract_Cases aspects. In these cases, we do not have to worry
- -- about delay issues, since the pragmas themselves deal with delay
- -- of visibility for the expression analysis. Thus, we just insert
- -- the pragma after the node N.
+ -- Contract_Cases and Subprogram_Variant aspects. In these cases, we do
+ -- not have to worry about delay issues, since the pragmas themselves
+ -- deal with delay of visibility for the expression analysis. Thus, we
+ -- just insert the pragma after the node N.
-- Loop through aspects
@@ -1813,9 +1842,9 @@ package body Sem_Ch13 is
procedure Analyze_Aspect_Static;
-- Ada 202x (AI12-0075): Perform analysis of aspect Static
- procedure Make_Aitem_Pragma
+ function Make_Aitem_Pragma
(Pragma_Argument_Associations : List_Id;
- Pragma_Name : Name_Id);
+ Pragma_Name : Name_Id) return Node_Id;
-- This is a wrapper for Make_Pragma used for converting aspects
-- to pragmas. It takes care of Sloc (set from Loc) and building
-- the pragma identifier from the given name. In addition the
@@ -1874,7 +1903,7 @@ package body Sem_Ch13 is
-- Generate:
-- pragma Convention (<Conv>, <E>);
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Name => Name_Convention,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
@@ -2166,6 +2195,9 @@ package body Sem_Ch13 is
Seen : in out Elist_Id)
is
begin
+ -- Set name of the aspect for error messages
+ Error_Msg_Name_1 := Nam;
+
-- The relaxed parameter is a formal parameter
if Nkind (Param) in N_Identifier | N_Expanded_Name then
@@ -2180,6 +2212,14 @@ package body Sem_Ch13 is
pragma Assert (Is_Formal (Item));
+ -- It must not have scalar or access type
+
+ if Is_Elementary_Type (Etype (Item)) then
+ Error_Msg_N ("illegal aspect % item", Param);
+ Error_Msg_N
+ ("\item must not have elementary type", Param);
+ end if;
+
-- Detect duplicated items
if Contains (Seen, Item) then
@@ -2206,6 +2246,16 @@ package body Sem_Ch13 is
and then
Entity (Pref) = Subp_Id
then
+ -- Function result must not have scalar or access
+ -- type.
+
+ if Is_Elementary_Type (Etype (Pref)) then
+ Error_Msg_N ("illegal aspect % item", Param);
+ Error_Msg_N
+ ("\function result must not have elementary"
+ & " type", Param);
+ end if;
+
-- Detect duplicated items
if Contains (Seen, Subp_Id) then
@@ -2346,12 +2396,14 @@ package body Sem_Ch13 is
if not Is_OK_Static_Expression
(Expression (Assoc))
then
+ Error_Msg_Name_1 := Nam;
Error_Msg_N
("expression of aspect %" &
"must be static", Aspect);
end if;
else
+ Error_Msg_Name_1 := Nam;
Error_Msg_N
("illegal aspect % expression", Expr);
end if;
@@ -2654,11 +2706,12 @@ package body Sem_Ch13 is
-- Make_Aitem_Pragma --
-----------------------
- procedure Make_Aitem_Pragma
+ function Make_Aitem_Pragma
(Pragma_Argument_Associations : List_Id;
- Pragma_Name : Name_Id)
+ Pragma_Name : Name_Id) return Node_Id
is
- Args : List_Id := Pragma_Argument_Associations;
+ Args : List_Id := Pragma_Argument_Associations;
+ Aitem : Node_Id;
begin
-- We should never get here if aspect was disabled
@@ -2692,6 +2745,8 @@ package body Sem_Ch13 is
Set_Corresponding_Aspect (Aitem, Aspect);
Set_From_Aspect_Specification (Aitem);
+
+ return Aitem;
end Make_Aitem_Pragma;
-- Start of processing for Analyze_One_Aspect
@@ -2845,23 +2900,33 @@ package body Sem_Ch13 is
case Aspect_Delay (A_Id) is
when Always_Delay =>
- Delay_Required := True;
+ -- For Boolean aspects, do not delay if no expression
+
+ if A_Id in Boolean_Aspects | Library_Unit_Aspects then
+ Delay_Required := Present (Expr);
+ else
+ Delay_Required := True;
+ end if;
when Never_Delay =>
Delay_Required := False;
when Rep_Aspect =>
- -- If expression has the form of an integer literal, then
- -- do not delay, since we know the value cannot change.
- -- This optimization catches most rep clause cases.
-
- -- For Boolean aspects, don't delay if no expression
+ -- For Boolean aspects, do not delay if no expression except
+ -- for Full_Access_Only because we need to process it after
+ -- Volatile and Atomic, which can be independently delayed.
- if A_Id in Boolean_Aspects and then No (Expr) then
+ if A_Id in Boolean_Aspects
+ and then A_Id /= Aspect_Full_Access_Only
+ and then No (Expr)
+ then
Delay_Required := False;
- -- For non-Boolean aspects, don't delay if integer literal
+ -- For non-Boolean aspects, if the expression has the form
+ -- of an integer literal, then do not delay, since we know
+ -- the value cannot change. This optimization catches most
+ -- rep clause cases.
elsif A_Id not in Boolean_Aspects
and then Present (Expr)
@@ -2869,7 +2934,7 @@ package body Sem_Ch13 is
then
Delay_Required := False;
- -- For Alignment and various Size aspects, don't delay for
+ -- For Alignment and various Size aspects, do not delay for
-- an attribute reference whose prefix is Standard, for
-- example Standard'Maximum_Alignment or Standard'Word_Size.
@@ -3025,13 +3090,10 @@ package body Sem_Ch13 is
-- referring to the entity, and the second argument is the
-- aspect definition expression.
- -- Linker_Section/Suppress/Unsuppress
+ -- Linker_Section
- when Aspect_Linker_Section
- | Aspect_Suppress
- | Aspect_Unsuppress
- =>
- Make_Aitem_Pragma
+ when Aspect_Linker_Section =>
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc)),
@@ -3046,8 +3108,7 @@ package body Sem_Ch13 is
-- code. (This is already done for types with implicit
-- initialization, such as protected types.)
- if A_Id = Aspect_Linker_Section
- and then Nkind (N) = N_Object_Declaration
+ if Nkind (N) = N_Object_Declaration
and then Has_Init_Expression (N)
then
Delay_Required := False;
@@ -3058,7 +3119,7 @@ package body Sem_Ch13 is
-- Corresponds to pragma Implemented, construct the pragma
when Aspect_Synchronization =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => New_Occurrence_Of (E, Loc)),
@@ -3069,7 +3130,7 @@ package body Sem_Ch13 is
-- Attach_Handler
when Aspect_Attach_Handler =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
@@ -3111,7 +3172,7 @@ package body Sem_Ch13 is
-- flags recording whether it is static/dynamic). We also
-- set flags recording this in the type itself.
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
@@ -3196,7 +3257,7 @@ package body Sem_Ch13 is
-- Construct the pragma
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
@@ -3352,10 +3413,25 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr));
end if;
+ -- Suppress/Unsuppress
+
+ when Aspect_Suppress
+ | Aspect_Unsuppress
+ =>
+ Aitem := Make_Aitem_Pragma
+ (Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Relocate_Node (Expr)),
+ Make_Pragma_Argument_Association (Sloc (Expr),
+ Expression => New_Occurrence_Of (E, Loc))),
+ Pragma_Name => Chars (Id));
+
+ Delay_Required := False;
+
-- Warnings
when Aspect_Warnings =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Expr),
Expression => Relocate_Node (Expr)),
@@ -3383,7 +3459,7 @@ package body Sem_Ch13 is
-- an invariant must apply to a private type, or appear in
-- the private part of a spec and apply to a completion.
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent),
@@ -3435,7 +3511,7 @@ package body Sem_Ch13 is
if Nkind (Context) in N_Generic_Package_Declaration
| N_Package_Declaration
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3461,7 +3537,7 @@ package body Sem_Ch13 is
-- related object declaration.
when Aspect_Async_Readers =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3476,7 +3552,7 @@ package body Sem_Ch13 is
-- related object declaration.
when Aspect_Async_Writers =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3491,7 +3567,7 @@ package body Sem_Ch13 is
-- related object declaration.
when Aspect_Constant_After_Elaboration =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3511,7 +3587,7 @@ package body Sem_Ch13 is
-- private type's full view.
when Aspect_Default_Initial_Condition =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3525,7 +3601,7 @@ package body Sem_Ch13 is
-- Default_Storage_Pool
when Aspect_Default_Storage_Pool =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3546,7 +3622,7 @@ package body Sem_Ch13 is
-- Analyze_Depends_In_Decl_Part for details.
when Aspect_Depends =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3561,7 +3637,7 @@ package body Sem_Ch13 is
-- related object declaration.
when Aspect_Effective_Reads =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3576,7 +3652,7 @@ package body Sem_Ch13 is
-- related object declaration.
when Aspect_Effective_Writes =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3591,7 +3667,7 @@ package body Sem_Ch13 is
-- related subprogram.
when Aspect_Extensions_Visible =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3607,7 +3683,7 @@ package body Sem_Ch13 is
-- a type declaration.
when Aspect_Ghost =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3627,7 +3703,7 @@ package body Sem_Ch13 is
-- Analyze_Global_In_Decl_Part for details.
when Aspect_Global =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3662,7 +3738,7 @@ package body Sem_Ch13 is
if Nkind (Context) in N_Generic_Package_Declaration
| N_Package_Declaration
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3710,7 +3786,7 @@ package body Sem_Ch13 is
if Nkind (Context) in N_Generic_Package_Declaration
| N_Package_Declaration
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3736,7 +3812,7 @@ package body Sem_Ch13 is
-- Max_Entry_Queue_Depth
when Aspect_Max_Entry_Queue_Depth =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3749,7 +3825,7 @@ package body Sem_Ch13 is
-- Max_Entry_Queue_Length
when Aspect_Max_Entry_Queue_Length =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3762,7 +3838,7 @@ package body Sem_Ch13 is
-- Max_Queue_Length
when Aspect_Max_Queue_Length =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3777,7 +3853,7 @@ package body Sem_Ch13 is
-- declaration.
when Aspect_No_Caching =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3801,7 +3877,7 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr)));
end if;
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Chars (Id));
end;
@@ -3813,7 +3889,7 @@ package body Sem_Ch13 is
| N_Package_Instantiation
or else Is_Single_Concurrent_Type_Declaration (N)
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3834,7 +3910,7 @@ package body Sem_Ch13 is
-- SPARK_Mode
when Aspect_SPARK_Mode =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3855,7 +3931,7 @@ package body Sem_Ch13 is
-- routine Analyze_Refined_Depends_In_Decl_Part.
when Aspect_Refined_Depends =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3876,7 +3952,7 @@ package body Sem_Ch13 is
-- routine Analyze_Refined_Global_In_Decl_Part.
when Aspect_Refined_Global =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3889,7 +3965,7 @@ package body Sem_Ch13 is
-- Refined_Post
when Aspect_Refined_Post =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3909,7 +3985,7 @@ package body Sem_Ch13 is
-- the pragma.
if Nkind (N) = N_Package_Body then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3930,7 +4006,7 @@ package body Sem_Ch13 is
-- Relative_Deadline
when Aspect_Relative_Deadline =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3979,7 +4055,7 @@ package body Sem_Ch13 is
-- attribute does not have visibility on the discriminant.
when Aspect_Secondary_Stack_Size =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -3997,7 +4073,7 @@ package body Sem_Ch13 is
-- related subprogram.
when Aspect_Volatile_Function =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -4077,7 +4153,7 @@ package body Sem_Ch13 is
Chars => Name_Entity,
Expression => Ent));
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => Pargs,
Pragma_Name => Name_Annotate);
end;
@@ -4123,7 +4199,7 @@ package body Sem_Ch13 is
when Aspect_Aggregate =>
Validate_Aspect_Aggregate (Expr);
Record_Rep_Item (E, Aspect);
- return;
+ goto Continue;
when Aspect_Integer_Literal
| Aspect_Real_Literal
@@ -4170,8 +4246,8 @@ package body Sem_Ch13 is
-- Case 4: Aspects requiring special handling
- -- Pre/Post/Test_Case/Contract_Cases whose corresponding
- -- pragmas take care of the delay.
+ -- Pre/Post/Test_Case/Contract_Cases/Subprogram_Variant whose
+ -- corresponding pragmas take care of the delay.
-- Pre/Post
@@ -4271,7 +4347,7 @@ package body Sem_Ch13 is
New_Expr := Relocate_Node (Expr);
end if;
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Check,
@@ -4362,7 +4438,7 @@ package body Sem_Ch13 is
-- Build the test-case pragma
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Nam);
end Test_Case;
@@ -4370,7 +4446,20 @@ package body Sem_Ch13 is
-- Contract_Cases
when Aspect_Contract_Cases =>
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
+ (Pragma_Argument_Associations => New_List (
+ Make_Pragma_Argument_Association (Loc,
+ Expression => Relocate_Node (Expr))),
+ Pragma_Name => Nam);
+
+ Decorate (Aspect, Aitem);
+ Insert_Pragma (Aitem);
+ goto Continue;
+
+ -- Subprogram_Variant
+
+ when Aspect_Subprogram_Variant =>
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -4398,14 +4487,16 @@ package body Sem_Ch13 is
if Ekind (E) /= E_Protected_Type then
Error_Msg_Name_1 := Nam;
Error_Msg_N
- ("aspect % only applies to a protected object",
+ ("aspect % only applies to a protected type " &
+ "or object",
Aspect);
else
-- Set the Uses_Lock_Free flag to True if there is no
-- expression or if the expression is True. The
-- evaluation of this aspect should be delayed to the
- -- freeze point (why???)
+ -- freeze point if we wanted to handle the corner case
+ -- of "true" or "false" being redefined.
if No (Expr)
or else Is_True (Static_Boolean (Expr))
@@ -4427,6 +4518,28 @@ package body Sem_Ch13 is
Analyze_Aspect_Disable_Controlled;
goto Continue;
+ -- Ada 202x (AI12-0129): Exclusive_Functions
+
+ elsif A_Id = Aspect_Exclusive_Functions then
+ if Ekind (E) /= E_Protected_Type then
+ Error_Msg_Name_1 := Nam;
+ Error_Msg_N
+ ("aspect % only applies to a protected type " &
+ "or object",
+ Aspect);
+ end if;
+
+ goto Continue;
+
+ -- Ada 202x (AI12-0363): Full_Access_Only
+
+ elsif A_Id = Aspect_Full_Access_Only then
+ if Ada_Version < Ada_2020 then
+ Error_Msg_N
+ ("aspect % is an Ada 202x feature", Aspect);
+ Error_Msg_N ("\compile with -gnat2020", Aspect);
+ end if;
+
-- Ada 202x (AI12-0075): static expression functions
elsif A_Id = Aspect_Static then
@@ -4461,10 +4574,9 @@ package body Sem_Ch13 is
goto Continue;
end if;
- -- Cases where we do not delay, includes all cases where the
- -- expression is missing other than the above cases.
+ -- Cases where we do not delay
- if not Delay_Required or else No (Expr) then
+ if not Delay_Required then
-- Exclude aspects Export and Import because their pragma
-- syntax does not map directly to a Boolean aspect.
@@ -4472,15 +4584,13 @@ package body Sem_Ch13 is
if A_Id /= Aspect_Export
and then A_Id /= Aspect_Import
then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
Pragma_Name => Chars (Id));
end if;
- Delay_Required := False;
-
-- In general cases, the corresponding pragma/attribute
-- definition clause will be inserted later at the freezing
-- point, and we do not need to build it now.
@@ -4523,7 +4633,7 @@ package body Sem_Ch13 is
-- Create a pragma and put it at the start of the task
-- definition for the task type declaration.
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
@@ -4584,7 +4694,7 @@ package body Sem_Ch13 is
if Is_Boolean_Aspect (Aspect) and then No (Aitem) then
if Is_True (Static_Boolean (Expr)) then
- Make_Aitem_Pragma
+ Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
@@ -4687,9 +4797,39 @@ package body Sem_Ch13 is
Insert_After (Ins_Node, Aitem);
Ins_Node := Aitem;
end if;
+
+ <<Continue>>
+
+ -- If a nonoverridable aspect is explicitly specified for a
+ -- derived type, then check consistency with the parent type.
+
+ if A_Id in Nonoverridable_Aspect_Id
+ and then Nkind (N) = N_Full_Type_Declaration
+ and then Nkind (Type_Definition (N)) = N_Derived_Type_Definition
+ and then not In_Instance_Body
+ then
+ declare
+ Parent_Type : constant Entity_Id := Etype (E);
+ Inherited_Aspect : constant Node_Id :=
+ Find_Aspect (Parent_Type, A_Id);
+ begin
+ if Present (Inherited_Aspect)
+ and then not Is_Confirming
+ (A_Id, Inherited_Aspect, Aspect)
+ then
+ Error_Msg_Name_1 := Aspect_Names (A_Id);
+ Error_Msg_Sloc := Sloc (Inherited_Aspect);
+
+ Error_Msg
+ ("overriding aspect specification for "
+ & "nonoverridable aspect % does not confirm "
+ & "aspect specification inherited from #",
+ Sloc (Aspect));
+ end if;
+ end;
+ end if;
end Analyze_One_Aspect;
- <<Continue>>
Next (Aspect);
end loop Aspect_Loop;
@@ -6977,12 +7117,13 @@ package body Sem_Ch13 is
else
if Is_Elementary_Type (Etyp)
and then Size /= System_Storage_Unit
- and then Size /= System_Storage_Unit * 2
- and then Size /= System_Storage_Unit * 4
- and then Size /= System_Storage_Unit * 8
+ and then Size /= 16
+ and then Size /= 32
+ and then Size /= 64
+ and then Size /= System_Max_Integer_Size
then
Error_Msg_Uint_1 := UI_From_Int (System_Storage_Unit);
- Error_Msg_Uint_2 := Error_Msg_Uint_1 * 8;
+ Error_Msg_Uint_2 := UI_From_Int (System_Max_Integer_Size);
Error_Msg_N
("size for primitive object must be a power of 2 in "
& "the range ^-^", N);
@@ -7143,7 +7284,10 @@ package body Sem_Ch13 is
-- check (B)
- if Type_Access_Level (Ent) > Object_Access_Level (Pool) then
+ if Type_Access_Level (Ent)
+ > Static_Accessibility_Level
+ (Pool, Object_Decl_Level)
+ then
Error_Msg_N
("subpool access type has deeper accessibility "
& "level than pool", Ent);
@@ -7154,7 +7298,7 @@ package body Sem_Ch13 is
-- check (C)
- if Present (Obj) and then Ekind (Obj) in Formal_Kind then
+ if Present (Obj) and then Is_Formal (Obj) then
Error_Msg_N
("subpool cannot be part of a parameter", Ent);
return;
@@ -9546,8 +9690,8 @@ package body Sem_Ch13 is
-- Predicate_Function of the parent type, using Add_Call above.
procedure Add_Call (T : Entity_Id);
- -- Includes a call to the predicate function for type T in Expr if T
- -- has predicates and Predicate_Function (T) is non-empty.
+ -- Includes a call to the predicate function for type T in Expr if
+ -- Predicate_Function (T) is non-empty.
function Process_RE (N : Node_Id) return Traverse_Result;
-- Used in Process REs, tests if node N is a raise expression, and if
@@ -9571,8 +9715,8 @@ package body Sem_Ch13 is
Exp : Node_Id;
begin
- if Present (T) and then Present (Predicate_Function (T)) then
- Set_Has_Predicates (Typ);
+ if Present (Predicate_Function (T)) then
+ pragma Assert (Has_Predicates (Typ));
-- Build the call to the predicate function of T. The type may be
-- derived, so use an unchecked conversion for the actual.
@@ -9746,7 +9890,7 @@ package body Sem_Ch13 is
elsif Nkind (Ritem) = N_Aspect_Specification
and then Present (Aspect_Rep_Item (Ritem))
- and then Scope (Typ) /= Current_Scope
+ and then Scope_Depth (Scope (Typ)) > Scope_Depth (Current_Scope)
then
declare
Prag : constant Node_Id := Aspect_Rep_Item (Ritem);
@@ -10016,7 +10160,7 @@ package body Sem_Ch13 is
end if;
end;
- -- within a generic unit, prevent a double analysis of the body
+ -- Within a generic unit, prevent a double analysis of the body
-- which will not be marked analyzed yet. This will happen when
-- the freeze node is created during the preanalysis of an
-- expression function.
@@ -10350,7 +10494,10 @@ package body Sem_Ch13 is
Freeze_Expr : constant Node_Id := Expression (ASN);
-- Expression from call to Check_Aspect_At_Freeze_Point.
- T : constant Entity_Id := Etype (Original_Node (Freeze_Expr));
+ T : constant Entity_Id :=
+ (if Present (Freeze_Expr)
+ then Etype (Original_Node (Freeze_Expr))
+ else Empty);
-- Type required for preanalyze call. We use the original expression to
-- get the proper type, to prevent cascaded errors when the expression
-- is constant-folded.
@@ -10494,12 +10641,12 @@ package body Sem_Ch13 is
Set_Parent (End_Decl_Expr, ASN);
- -- In a generic context the original aspect expressions have not
+ -- In a generic context the original aspect expressions have not
-- been preanalyzed, so do it now. There are no conformance checks
-- to perform in this case. As before, we have to make components
-- visible for aspects that may reference them.
- if No (T) then
+ if Present (Freeze_Expr) and then No (T) then
if A_Id = Aspect_Dynamic_Predicate
or else A_Id = Aspect_Predicate
or else A_Id = Aspect_Priority
@@ -10539,7 +10686,7 @@ package body Sem_Ch13 is
elsif A_Id = Aspect_Predicate_Failure then
Preanalyze_Spec_Expression (End_Decl_Expr, Standard_String);
- else
+ elsif Present (End_Decl_Expr) then
Preanalyze_Spec_Expression (End_Decl_Expr, T);
end if;
@@ -10701,8 +10848,6 @@ package body Sem_Ch13 is
| Aspect_Output
| Aspect_Put_Image
| Aspect_Read
- | Aspect_Suppress
- | Aspect_Unsuppress
| Aspect_Warnings
| Aspect_Write
=>
@@ -10818,8 +10963,11 @@ package body Sem_Ch13 is
| Aspect_Refined_State
| Aspect_Relaxed_Initialization
| Aspect_SPARK_Mode
+ | Aspect_Subprogram_Variant
+ | Aspect_Suppress
| Aspect_Test_Case
| Aspect_Unimplemented
+ | Aspect_Unsuppress
| Aspect_Volatile_Function
=>
raise Program_Error;
@@ -10828,7 +10976,9 @@ package body Sem_Ch13 is
-- Do the preanalyze call
- Preanalyze_Spec_Expression (Expression (ASN), T);
+ if Present (Expression (ASN)) then
+ Preanalyze_Spec_Expression (Expression (ASN), T);
+ end if;
end Check_Aspect_At_Freeze_Point;
-----------------------------------
@@ -13031,9 +13181,6 @@ package body Sem_Ch13 is
-- specification node whose correponding pragma (if any) is present in
-- the Rep Item chain of the entity it has been specified to.
- function Rep_Item_Entity (Rep_Item : Node_Id) return Entity_Id;
- -- Return the entity for which Rep_Item is specified
-
--------------------------------------------------
-- Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item --
--------------------------------------------------
@@ -13044,26 +13191,10 @@ package body Sem_Ch13 is
begin
return
Nkind (Rep_Item) = N_Pragma
- or else Present_In_Rep_Item
- (Entity (Rep_Item), Aspect_Rep_Item (Rep_Item));
+ or else
+ Present_In_Rep_Item (Entity (Rep_Item), Aspect_Rep_Item (Rep_Item));
end Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item;
- ---------------------
- -- Rep_Item_Entity --
- ---------------------
-
- function Rep_Item_Entity (Rep_Item : Node_Id) return Entity_Id is
- begin
- if Nkind (Rep_Item) = N_Aspect_Specification then
- return Entity (Rep_Item);
-
- else
- pragma Assert
- (Nkind (Rep_Item) in N_Attribute_Definition_Clause | N_Pragma);
- return Entity (Name (Rep_Item));
- end if;
- end Rep_Item_Entity;
-
-- Start of processing for Inherit_Aspects_At_Freeze_Point
begin
@@ -13189,10 +13320,12 @@ package body Sem_Ch13 is
Set_Treat_As_Volatile (Typ);
end if;
- -- Volatile_Full_Access
+ -- Volatile_Full_Access and Full_Access_Only
if not Has_Rep_Item (Typ, Name_Volatile_Full_Access, False)
- and then Has_Rep_Pragma (Typ, Name_Volatile_Full_Access)
+ and then not Has_Rep_Item (Typ, Name_Full_Access_Only, False)
+ and then (Has_Rep_Item (Typ, Name_Volatile_Full_Access)
+ or else Has_Rep_Item (Typ, Name_Full_Access_Only))
and then Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Get_Rep_Item (Typ, Name_Volatile_Full_Access))
then
@@ -13249,23 +13382,20 @@ package body Sem_Ch13 is
-- Bit_Order
- if Is_Record_Type (Typ) then
+ if Is_Record_Type (Typ) and then Typ = Bas_Typ then
if not Has_Rep_Item (Typ, Name_Bit_Order, False)
and then Has_Rep_Item (Typ, Name_Bit_Order)
then
Set_Reverse_Bit_Order (Bas_Typ,
- Reverse_Bit_Order (Rep_Item_Entity
- (Get_Rep_Item (Typ, Name_Bit_Order))));
+ Reverse_Bit_Order
+ (Implementation_Base_Type (Etype (Bas_Typ))));
end if;
end if;
-- Scalar_Storage_Order
- -- Note: the aspect is specified on a first subtype, but recorded
- -- in a flag of the base type!
-
if (Is_Record_Type (Typ) or else Is_Array_Type (Typ))
- and then Typ = Bas_Typ
+ and then Typ = Bas_Typ
then
-- For a type extension, always inherit from parent; otherwise
-- inherit if no default applies. Note: we do not check for
@@ -14498,11 +14628,9 @@ package body Sem_Ch13 is
function Visible_Component (Comp : Name_Id) return Entity_Id;
-- Given an identifier in the expression, check whether there is a
- -- discriminant or component of the type that is directy visible, and
- -- rewrite it as the corresponding selected component of the formal of
- -- the subprogram. The entity is located by a sequential search, which
- -- seems acceptable given the typical size of component lists and check
- -- expressions. Possible optimization ???
+ -- discriminant, component, protected procedure, or entry of the type
+ -- that is directy visible, and rewrite it as the corresponding selected
+ -- component of the formal of the subprogram.
----------------------
-- Replace_Type_Ref --
@@ -14677,14 +14805,20 @@ package body Sem_Ch13 is
function Visible_Component (Comp : Name_Id) return Entity_Id is
E : Entity_Id;
-
begin
- -- Types with nameable components are records and discriminated
- -- private types.
+ -- Types with nameable components are record, task, and protected
+ -- types, and discriminated private types.
- if Ekind (T) = E_Record_Type
+ if Ekind (T) in E_Record_Type
+ | E_Task_Type
+ | E_Protected_Type
or else (Is_Private_Type (T) and then Has_Discriminants (T))
then
+ -- This is a sequential search, which seems acceptable
+ -- efficiency-wise, given the typical size of component
+ -- lists, protected operation lists, task item lists, and
+ -- check expressions.
+
E := First_Entity (T);
while Present (E) loop
if Comes_From_Source (E) and then Chars (E) = Comp then
@@ -14695,7 +14829,7 @@ package body Sem_Ch13 is
end loop;
end if;
- -- Nothing by that name, or the type has no components
+ -- Nothing by that name
return Empty;
end Visible_Component;
@@ -15142,19 +15276,33 @@ package body Sem_Ch13 is
-- Predicates that establish the legality of each possible operation in
-- an Aggregate aspect.
- function Valid_Empty (E : Entity_Id) return Boolean;
- function Valid_Add_Named (E : Entity_Id) return Boolean;
- function Valid_Add_Unnamed (E : Entity_Id) return Boolean;
- function Valid_New_Indexed (E : Entity_Id) return Boolean;
-
- -- Note: The legality rules for Assign_Indexed are the same as for
- -- Add_Named.
+ function Valid_Empty (E : Entity_Id) return Boolean;
+ function Valid_Add_Named (E : Entity_Id) return Boolean;
+ function Valid_Add_Unnamed (E : Entity_Id) return Boolean;
+ function Valid_New_Indexed (E : Entity_Id) return Boolean;
+ function Valid_Assign_Indexed (E : Entity_Id) return Boolean;
generic
with function Pred (Id : Node_Id) return Boolean;
procedure Resolve_Operation (Subp_Id : Node_Id);
-- Common processing to resolve each aggregate operation.
+ ------------------------
+ -- Valid_Assign_Index --
+ ------------------------
+
+ function Valid_Assign_Indexed (E : Entity_Id) return Boolean is
+ begin
+ -- The profile must be the same as for Add_Named, with the added
+ -- requirement that the key_type be a discrete type.
+
+ if Valid_Add_Named (E) then
+ return Is_Discrete_Type (Etype (Next_Formal (First_Formal (E))));
+ else
+ return False;
+ end if;
+ end Valid_Assign_Indexed;
+
-----------------
-- Valid_Emoty --
-----------------
@@ -15278,7 +15426,8 @@ package body Sem_Ch13 is
procedure Resolve_Named is new Resolve_Operation (Valid_Add_Named);
procedure Resolve_Indexed is new Resolve_Operation (Valid_New_Indexed);
procedure Resolve_Assign_Indexed
- is new Resolve_Operation (Valid_Add_Named);
+ is new Resolve_Operation
+ (Valid_Assign_Indexed);
begin
Assoc := First (Component_Associations (Expr));
@@ -15347,7 +15496,7 @@ package body Sem_Ch13 is
begin
Init_Alignment (T);
- -- Find the minimum standard size (8,16,32,64) that fits
+ -- Find the minimum standard size (8,16,32,64,128) that fits
Lo := Enumeration_Rep (Entity (Type_Low_Bound (T)));
Hi := Enumeration_Rep (Entity (Type_High_Bound (T)));
@@ -15362,8 +15511,11 @@ package body Sem_Ch13 is
elsif Lo >= -Uint_2**31 and then Hi < Uint_2**31 then
Sz := 32;
- else pragma Assert (Lo >= -Uint_2**63 and then Hi < Uint_2**63);
+ elsif Lo >= -Uint_2**63 and then Hi < Uint_2**63 then
Sz := 64;
+
+ else pragma Assert (Lo >= -Uint_2**127 and then Hi < Uint_2**127);
+ Sz := 128;
end if;
else
@@ -15376,8 +15528,11 @@ package body Sem_Ch13 is
elsif Hi < Uint_2**32 then
Sz := 32;
- else pragma Assert (Hi < Uint_2**63);
+ elsif Hi < Uint_2**64 then
Sz := 64;
+
+ else pragma Assert (Hi < Uint_2**128);
+ Sz := 128;
end if;
end if;
@@ -15674,12 +15829,12 @@ package body Sem_Ch13 is
return;
end if;
- -- Case of component size is greater than or equal to 64 and the
- -- alignment of the array is at least as large as the alignment
- -- of the component. We are definitely OK in this situation.
+ -- Case where component size is greater than or equal to the maximum
+ -- integer size and the alignment of the array is at least as large
+ -- as the alignment of the component. We are OK in this situation.
if Known_Component_Size (Atyp)
- and then Component_Size (Atyp) >= 64
+ and then Component_Size (Atyp) >= System_Max_Integer_Size
and then Known_Alignment (Atyp)
and then Known_Alignment (Ctyp)
and then Alignment (Atyp) >= Alignment (Ctyp)
@@ -15690,8 +15845,7 @@ package body Sem_Ch13 is
-- Check actual component size
if not Known_Component_Size (Atyp)
- or else not (Addressable (Component_Size (Atyp))
- and then Component_Size (Atyp) < 64)
+ or else not Addressable (Component_Size (Atyp))
or else Component_Size (Atyp) mod Esize (Ctyp) /= 0
then
No_Independence;
@@ -15777,10 +15931,12 @@ package body Sem_Ch13 is
return False;
end if;
- -- Size of component must be addressable or greater than 64 bits
- -- and a multiple of bytes.
+ -- Size of component must be addressable or greater than the maximum
+ -- integer size and a multiple of bytes.
- if not Addressable (Esize (C)) and then Esize (C) < Uint_64 then
+ if not Addressable (Esize (C))
+ and then Esize (C) < System_Max_Integer_Size
+ then
return False;
end if;
diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads
index 3d24c04..7d9f38d 100644
--- a/gcc/ada/sem_ch13.ads
+++ b/gcc/ada/sem_ch13.ads
@@ -164,6 +164,11 @@ package Sem_Ch13 is
-- parameter does the actual replacement of node N, which is either a
-- simple direct reference to T, or a selected component that represents
-- an appropriately qualified occurrence of T.
+ --
+ -- This also replaces each reference to a component, entry, or protected
+ -- procedure with a selected component whose prefix is the parameter.
+ -- For example, Component_Name becomes Parameter.Component_Name, where
+ -- Parameter is the parameter, which is of type T.
function Rep_Item_Too_Late
(T : Entity_Id;
@@ -176,7 +181,7 @@ package Sem_Ch13 is
-- is the pragma or representation clause itself, used for placing error
-- messages if the item is too late.
--
- -- Fonly is a flag that causes only the freezing rule (para 9) to be
+ -- FOnly is a flag that causes only the freezing rule (para 9) to be
-- applied, and the tests of para 10 are skipped. This is appropriate for
-- both subtype related attributes (Alignment and Size) and for stream
-- attributes, which, although certainly not subtype related attributes,
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index a5690d6..269818a 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -410,7 +410,7 @@ package body Sem_Ch3 is
-- When constraining a protected type or task type with discriminants,
-- constrain the corresponding record with the same discriminant values.
- procedure Constrain_Decimal (Def_Id : Node_Id; S : Node_Id);
+ procedure Constrain_Decimal (Def_Id : Entity_Id; S : Node_Id);
-- Constrain a decimal fixed point type with a digits constraint and/or a
-- range constraint, and build E_Decimal_Fixed_Point_Subtype entity.
@@ -426,11 +426,11 @@ package body Sem_Ch3 is
-- Constrain_Concurrent. See Build_Discriminated_Subtype for an explanation
-- of For_Access.
- procedure Constrain_Enumeration (Def_Id : Node_Id; S : Node_Id);
+ procedure Constrain_Enumeration (Def_Id : Entity_Id; S : Node_Id);
-- Constrain an enumeration type with a range constraint. This is identical
-- to Constrain_Integer, but for the Ekind of the resulting subtype.
- procedure Constrain_Float (Def_Id : Node_Id; S : Node_Id);
+ procedure Constrain_Float (Def_Id : Entity_Id; S : Node_Id);
-- Constrain a floating point type with either a digits constraint
-- and/or a range constraint, building a E_Floating_Point_Subtype.
@@ -440,17 +440,17 @@ package body Sem_Ch3 is
Related_Nod : Node_Id;
Related_Id : Entity_Id;
Suffix : Character;
- Suffix_Index : Nat);
+ Suffix_Index : Pos);
-- Process an index constraint S in a constrained array declaration. The
-- constraint can be a subtype name, or a range with or without an explicit
-- subtype mark. The index is the corresponding index of the unconstrained
-- array. The Related_Id and Suffix parameters are used to build the
-- associated Implicit type name.
- procedure Constrain_Integer (Def_Id : Node_Id; S : Node_Id);
+ procedure Constrain_Integer (Def_Id : Entity_Id; S : Node_Id);
-- Build subtype of a signed or modular integer type
- procedure Constrain_Ordinary_Fixed (Def_Id : Node_Id; S : Node_Id);
+ procedure Constrain_Ordinary_Fixed (Def_Id : Entity_Id; S : Node_Id);
-- Constrain an ordinary fixed point type with a range constraint, and
-- build an E_Ordinary_Fixed_Point_Subtype entity.
@@ -1185,7 +1185,7 @@ package body Sem_Ch3 is
end;
end if;
- if not (Is_Type (Etype (Desig_Type))) then
+ if not Is_Type (Etype (Desig_Type)) then
Error_Msg_N
("expect type in function specification",
Result_Definition (T_Def));
@@ -1329,7 +1329,8 @@ package body Sem_Ch3 is
if Nkind (S) /= N_Subtype_Indication then
Analyze (S);
- if Present (Entity (S))
+ if Nkind (S) in N_Has_Entity
+ and then Present (Entity (S))
and then Ekind (Root_Type (Entity (S))) = E_Incomplete_Type
then
Set_Directly_Designated_Type (T, Entity (S));
@@ -3644,8 +3645,6 @@ package body Sem_Ch3 is
-- E is set to Expression (N) throughout this routine. When Expression
-- (N) is modified, E is changed accordingly.
- Prev_Entity : Entity_Id := Empty;
-
procedure Check_Dynamic_Object (Typ : Entity_Id);
-- A library-level object with nonstatic discriminant constraints may
-- require dynamic allocation. The declaration is illegal if the
@@ -3921,7 +3920,8 @@ package body Sem_Ch3 is
Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
-- Save the Ghost-related attributes to restore on exit
- Related_Id : Entity_Id;
+ Prev_Entity : Entity_Id := Empty;
+ Related_Id : Entity_Id;
Full_View_Present : Boolean := False;
-- Start of processing for Analyze_Object_Declaration
@@ -4423,7 +4423,7 @@ package body Sem_Ch3 is
-- the predicate still applies.
if not Suppress_Assignment_Checks (N)
- and then Predicate_Enabled (T)
+ and then (Predicate_Enabled (T) or else Has_Static_Predicate (T))
and then
(not No_Initialization (N)
or else (Present (E) and then Nkind (E) = N_Aggregate))
@@ -4434,15 +4434,23 @@ package body Sem_Ch3 is
then
-- If the type has a static predicate and the expression is known at
-- compile time, see if the expression satisfies the predicate.
+ -- In the case of a static expression, this must be done even if
+ -- the predicate is not enabled (as per static expression rules).
if Present (E) then
Check_Expression_Against_Static_Predicate (E, T);
end if;
+ -- Do not perform further predicate-related checks unless
+ -- predicates are enabled for the subtype.
+
+ if not Predicate_Enabled (T) then
+ null;
+
-- If the type is a null record and there is no explicit initial
-- expression, no predicate check applies.
- if No (E) and then Is_Null_Record_Type (T) then
+ elsif No (E) and then Is_Null_Record_Type (T) then
null;
-- Do not generate a predicate check if the initialization expression
@@ -4512,7 +4520,7 @@ package body Sem_Ch3 is
end if;
-- Case of initialization present but in error. Set initial
- -- expression as absent (but do not make above complaints)
+ -- expression as absent (but do not make above complaints).
elsif E = Error then
Set_Expression (N, Empty);
@@ -4521,19 +4529,15 @@ package body Sem_Ch3 is
-- Case of initialization present
else
- -- Check restrictions in Ada 83
-
- if not Constant_Present (N) then
-
- -- Unconstrained variables not allowed in Ada 83 mode
+ -- Unconstrained variables not allowed in Ada 83
- if Ada_Version = Ada_83
- and then Comes_From_Source (Object_Definition (N))
- then
- Error_Msg_N
- ("(Ada 83) unconstrained variable not allowed",
- Object_Definition (N));
- end if;
+ if Ada_Version = Ada_83
+ and then not Constant_Present (N)
+ and then Comes_From_Source (Object_Definition (N))
+ then
+ Error_Msg_N
+ ("(Ada 83) unconstrained variable not allowed",
+ Object_Definition (N));
end if;
-- Now we constrain the variable from the initializing expression
@@ -4612,7 +4616,7 @@ package body Sem_Ch3 is
Act_T := Find_Type_Of_Object (Object_Definition (N), N);
end if;
- -- Propagate attributes to full view when needed.
+ -- Propagate attributes to full view when needed
Set_Is_Constr_Subt_For_U_Nominal (Act_T);
@@ -5279,8 +5283,8 @@ package body Sem_Ch3 is
(N : Node_Id;
Skip : Boolean := False)
is
- Id : constant Entity_Id := Defining_Identifier (N);
- T : Entity_Id;
+ Id : constant Entity_Id := Defining_Identifier (N);
+ T : Entity_Id;
begin
Generate_Definition (Id);
@@ -5710,6 +5714,16 @@ package body Sem_Ch3 is
then
Set_Subprograms_For_Type (Id, Subprograms_For_Type (T));
+ -- If the current declaration created both a private and a full view,
+ -- then propagate Predicate_Function to the latter as well.
+
+ if Present (Full_View (Id))
+ and then No (Predicate_Function (Full_View (Id)))
+ then
+ Set_Subprograms_For_Type
+ (Full_View (Id), Subprograms_For_Type (Id));
+ end if;
+
if Has_Static_Predicate (T) then
Set_Has_Static_Predicate (Id);
Set_Static_Discrete_Predicate (Id, Static_Discrete_Predicate (T));
@@ -5829,8 +5843,8 @@ package body Sem_Ch3 is
Target_Index := First_Index (Indic_Typ);
while Present (Subt_Index) loop
- if ((Nkind (Subt_Index) = N_Identifier
- and then Ekind (Entity (Subt_Index)) in Scalar_Kind)
+ if ((Nkind (Subt_Index) in N_Expanded_Name | N_Identifier
+ and then Is_Scalar_Type (Entity (Subt_Index)))
or else Nkind (Subt_Index) = N_Subtype_Indication)
and then
Nkind (Scalar_Range (Etype (Subt_Index))) = N_Range
@@ -5987,9 +6001,9 @@ package body Sem_Ch3 is
Element_Type : Entity_Id;
Implicit_Base : Entity_Id;
Index : Node_Id;
- Nb_Index : Nat;
+ Nb_Index : Pos;
Priv : Entity_Id;
- Related_Id : Entity_Id := Empty;
+ Related_Id : Entity_Id;
begin
if Nkind (Def) = N_Constrained_Array_Definition then
@@ -6042,7 +6056,7 @@ package body Sem_Ch3 is
then
declare
Loc : constant Source_Ptr := Sloc (Def);
- Decl : Entity_Id;
+ Decl : Node_Id;
New_E : Entity_Id;
begin
@@ -6138,7 +6152,12 @@ package body Sem_Ch3 is
-- Constrained array case
if No (T) then
- T := Create_Itype (E_Void, P, Related_Id, 'T');
+ -- We might be creating more than one itype with the same Related_Id,
+ -- e.g. for an array object definition and its initial value. Give
+ -- them unique suffixes, because GNATprove require distinct types to
+ -- have different names.
+
+ T := Create_Itype (E_Void, P, Related_Id, 'T', Suffix_Index => -1);
end if;
if Nkind (Def) = N_Constrained_Array_Definition then
@@ -6182,7 +6201,8 @@ package body Sem_Ch3 is
-- Unconstrained array case
- else
+ else pragma Assert (Nkind (Def) = N_Unconstrained_Array_Definition);
+
Set_Ekind (T, E_Array_Type);
Init_Size_Align (T);
Set_Etype (T, T);
@@ -7222,7 +7242,7 @@ package body Sem_Ch3 is
-- Introduce an implicit base type for the derived type even if there
-- is no constraint attached to it, since this seems closer to the
-- Ada semantics. Build a full type declaration tree for the derived
- -- type using the implicit base type as the defining identifier. The
+ -- type using the implicit base type as the defining identifier. Then
-- build a subtype declaration tree which applies the constraint (if
-- any) have it replace the derived type declaration.
@@ -9732,6 +9752,13 @@ package body Sem_Ch3 is
Set_Convention (Derived_Type, Convention (Parent_Base));
+ if Is_Tagged_Type (Derived_Type)
+ and then Present (Class_Wide_Type (Derived_Type))
+ then
+ Set_Convention (Class_Wide_Type (Derived_Type),
+ Convention (Class_Wide_Type (Parent_Base)));
+ end if;
+
-- Set SSO default for record or array type
if (Is_Array_Type (Derived_Type) or else Is_Record_Type (Derived_Type))
@@ -10849,6 +10876,13 @@ package body Sem_Ch3 is
then
null;
+ -- Subprogram renamings cannot be overridden
+
+ elsif Comes_From_Source (Subp)
+ and then Present (Alias (Subp))
+ then
+ null;
+
else
Error_Msg_NE
("type must be declared abstract or & overridden",
@@ -13781,7 +13815,7 @@ package body Sem_Ch3 is
-- Constrain_Decimal --
-----------------------
- procedure Constrain_Decimal (Def_Id : Node_Id; S : Node_Id) is
+ procedure Constrain_Decimal (Def_Id : Entity_Id; S : Node_Id) is
T : constant Entity_Id := Entity (Subtype_Mark (S));
C : constant Node_Id := Constraint (S);
Loc : constant Source_Ptr := Sloc (C);
@@ -13998,7 +14032,7 @@ package body Sem_Ch3 is
-- Constrain_Enumeration --
---------------------------
- procedure Constrain_Enumeration (Def_Id : Node_Id; S : Node_Id) is
+ procedure Constrain_Enumeration (Def_Id : Entity_Id; S : Node_Id) is
T : constant Entity_Id := Entity (Subtype_Mark (S));
C : constant Node_Id := Constraint (S);
@@ -14021,7 +14055,7 @@ package body Sem_Ch3 is
-- Constrain_Float --
----------------------
- procedure Constrain_Float (Def_Id : Node_Id; S : Node_Id) is
+ procedure Constrain_Float (Def_Id : Entity_Id; S : Node_Id) is
T : constant Entity_Id := Entity (Subtype_Mark (S));
C : Node_Id;
D : Node_Id;
@@ -14100,7 +14134,7 @@ package body Sem_Ch3 is
Related_Nod : Node_Id;
Related_Id : Entity_Id;
Suffix : Character;
- Suffix_Index : Nat)
+ Suffix_Index : Pos)
is
Def_Id : Entity_Id;
R : Node_Id := Empty;
@@ -14230,7 +14264,7 @@ package body Sem_Ch3 is
-- Constrain_Integer --
-----------------------
- procedure Constrain_Integer (Def_Id : Node_Id; S : Node_Id) is
+ procedure Constrain_Integer (Def_Id : Entity_Id; S : Node_Id) is
T : constant Entity_Id := Entity (Subtype_Mark (S));
C : constant Node_Id := Constraint (S);
@@ -14253,7 +14287,7 @@ package body Sem_Ch3 is
-- Constrain_Ordinary_Fixed --
------------------------------
- procedure Constrain_Ordinary_Fixed (Def_Id : Node_Id; S : Node_Id) is
+ procedure Constrain_Ordinary_Fixed (Def_Id : Entity_Id; S : Node_Id) is
T : constant Entity_Id := Entity (Subtype_Mark (S));
C : Node_Id;
D : Node_Id;
@@ -15699,7 +15733,9 @@ package body Sem_Ch3 is
null;
-- Ada 2005 (AI-228): Calculate the "require overriding" and "abstract"
- -- properties of the subprogram, as defined in RM-3.9.3(4/2-6/2).
+ -- properties of the subprogram, as defined in RM-3.9.3(4/2-6/2). Note
+ -- that functions with controlling access results of record extensions
+ -- with a null extension part require overriding (AI95-00391/06).
-- Ada 202x (AI12-0042): Similarly, set those properties for
-- implementing the rule of RM 7.3.2(6.1/4).
@@ -15717,8 +15753,7 @@ package body Sem_Ch3 is
and then Ekind (Etype (New_Subp)) =
E_Anonymous_Access_Type
and then Designated_Type (Etype (New_Subp)) =
- Derived_Type
- and then not Is_Null_Extension (Derived_Type))
+ Derived_Type)
or else (Comes_From_Source (Alias (New_Subp))
and then Is_EVF_Procedure (Alias (New_Subp)))
@@ -16728,6 +16763,14 @@ package body Sem_Ch3 is
Next (Intf);
end loop;
end;
+
+ -- Check consistency of any nonoverridable aspects that are
+ -- inherited from multiple sources.
+
+ Check_Inherited_Nonoverridable_Aspects
+ (Inheritor => T,
+ Interface_List => Interface_List (Def),
+ Parent_Type => Parent_Type);
end if;
if Parent_Type = Any_Type
@@ -17727,9 +17770,7 @@ package body Sem_Ch3 is
-- Case of an anonymous array subtype
- if Def_Kind in
- N_Constrained_Array_Definition | N_Unconstrained_Array_Definition
- then
+ if Def_Kind in N_Array_Type_Definition then
T := Empty;
Array_Type_Declaration (T, Obj_Def);
@@ -19120,7 +19161,7 @@ package body Sem_Ch3 is
(N : Node_Id;
Related_Nod : Node_Id;
Related_Id : Entity_Id := Empty;
- Suffix_Index : Nat := 1)
+ Suffix_Index : Pos := 1)
is
R : Node_Id;
T : Entity_Id;
@@ -19211,24 +19252,20 @@ package body Sem_Ch3 is
return;
end if;
+ -- If the range bounds are "T'Low .. T'High" where T is a name of
+ -- a discrete type, then use T as the type of the index.
+
if Nkind (Low_Bound (N)) = N_Attribute_Reference
and then Attribute_Name (Low_Bound (N)) = Name_First
and then Is_Entity_Name (Prefix (Low_Bound (N)))
- and then Is_Type (Entity (Prefix (Low_Bound (N))))
and then Is_Discrete_Type (Entity (Prefix (Low_Bound (N))))
- then
- -- The type of the index will be the type of the prefix, as long
- -- as the upper bound is 'Last of the same type.
+ and then Nkind (High_Bound (N)) = N_Attribute_Reference
+ and then Attribute_Name (High_Bound (N)) = Name_Last
+ and then Is_Entity_Name (Prefix (High_Bound (N)))
+ and then Entity (Prefix (High_Bound (N))) = Def_Id
+ then
Def_Id := Entity (Prefix (Low_Bound (N)));
-
- if Nkind (High_Bound (N)) /= N_Attribute_Reference
- or else Attribute_Name (High_Bound (N)) /= Name_Last
- or else not Is_Entity_Name (Prefix (High_Bound (N)))
- or else Entity (Prefix (High_Bound (N))) /= Def_Id
- then
- Def_Id := Empty;
- end if;
end if;
R := N;
@@ -19266,7 +19303,6 @@ package body Sem_Ch3 is
if Is_Entity_Name (Prefix (N))
and then Comes_From_Source (N)
- and then Is_Type (Entity (Prefix (N)))
and then Is_Discrete_Type (Entity (Prefix (N)))
then
Def_Id := Entity (Prefix (N));
@@ -19372,25 +19408,30 @@ package body Sem_Ch3 is
Set_First_Literal (Def_Id, First_Literal (T));
end if;
- Set_Size_Info (Def_Id, (T));
- Set_RM_Size (Def_Id, RM_Size (T));
- Set_First_Rep_Item (Def_Id, First_Rep_Item (T));
+ Set_Size_Info (Def_Id, (T));
+ Set_RM_Size (Def_Id, RM_Size (T));
+ Set_First_Rep_Item (Def_Id, First_Rep_Item (T));
Set_Scalar_Range (Def_Id, R);
Conditional_Delay (Def_Id, T);
+ -- In the subtype indication case inherit properties of the parent
+
if Nkind (N) = N_Subtype_Indication then
+
+ -- It is enough to inherit predicate flags and not the predicate
+ -- functions, because predicates on an index type are illegal
+ -- anyway and the flags are enough to detect them.
+
Inherit_Predicate_Flags (Def_Id, Entity (Subtype_Mark (N)));
- end if;
- -- In the subtype indication case, if the immediate parent of the
- -- new subtype is nonstatic, then the subtype we create is nonstatic,
- -- even if its bounds are static.
+ -- If the immediate parent of the new subtype is nonstatic, then
+ -- the subtype we create is nonstatic as well, even if its bounds
+ -- are static.
- if Nkind (N) = N_Subtype_Indication
- and then not Is_OK_Static_Subtype (Entity (Subtype_Mark (N)))
- then
- Set_Is_Non_Static_Subtype (Def_Id);
+ if not Is_OK_Static_Subtype (Entity (Subtype_Mark (N))) then
+ Set_Is_Non_Static_Subtype (Def_Id);
+ end if;
end if;
end if;
@@ -19415,17 +19456,20 @@ package body Sem_Ch3 is
----------------------
procedure Set_Modular_Size (Bits : Int) is
+ Siz : Int;
+
begin
Set_RM_Size (T, UI_From_Int (Bits));
- if Bits <= 8 then
- Init_Esize (T, 8);
+ if Bits < System_Max_Binary_Modulus_Power then
+ Siz := 8;
- elsif Bits <= 16 then
- Init_Esize (T, 16);
+ while Siz < 128 loop
+ exit when Bits <= Siz;
+ Siz := Siz * 2;
+ end loop;
- elsif Bits <= 32 then
- Init_Esize (T, 32);
+ Init_Esize (T, Siz);
else
Init_Esize (T, System_Max_Binary_Modulus_Power);
@@ -19440,14 +19484,14 @@ package body Sem_Ch3 is
begin
-- If the mod expression is (exactly) 2 * literal, where literal is
- -- 64 or less,then almost certainly the * was meant to be **. Warn.
+ -- 128 or less,then almost certainly the * was meant to be **. Warn.
if Warn_On_Suspicious_Modulus_Value
and then Nkind (Mod_Expr) = N_Op_Multiply
and then Nkind (Left_Opnd (Mod_Expr)) = N_Integer_Literal
and then Intval (Left_Opnd (Mod_Expr)) = Uint_2
and then Nkind (Right_Opnd (Mod_Expr)) = N_Integer_Literal
- and then Intval (Right_Opnd (Mod_Expr)) <= Uint_64
+ and then Intval (Right_Opnd (Mod_Expr)) <= Uint_128
then
Error_Msg_N
("suspicious MOD value, was '*'* intended'??M?", Mod_Expr);
@@ -21487,14 +21531,6 @@ package body Sem_Ch3 is
Related_Id : Entity_Id := Empty;
Suffix : Character := ' ') return Entity_Id
is
- P : Node_Id;
- Def_Id : Entity_Id;
- Error_Node : Node_Id;
- Full_View_Id : Entity_Id;
- Subtype_Mark_Id : Entity_Id;
-
- May_Have_Null_Exclusion : Boolean;
-
procedure Check_Incomplete (T : Node_Id);
-- Called to verify that an incomplete type is not used prematurely
@@ -21519,6 +21555,16 @@ package body Sem_Ch3 is
end if;
end Check_Incomplete;
+ -- Local variables
+
+ P : Node_Id;
+ Def_Id : Entity_Id;
+ Error_Node : Node_Id;
+ Full_View_Id : Entity_Id;
+ Subtype_Mark_Id : Entity_Id;
+
+ May_Have_Null_Exclusion : Boolean;
+
-- Start of processing for Process_Subtype
begin
@@ -21539,20 +21585,12 @@ package body Sem_Ch3 is
Check_Incomplete (S);
P := Parent (S);
- -- Ada 2005 (AI-231): Static check
-
- if Ada_Version >= Ada_2005
- and then Present (P)
- and then Null_Exclusion_Present (P)
- and then Nkind (P) /= N_Access_To_Object_Definition
- and then not Is_Access_Type (Entity (S))
- then
- Error_Msg_N ("`NOT NULL` only allowed for an access type", S);
- end if;
-
- -- The following is ugly, can't we have a range or even a flag???
+ -- The following mirroring of assertion in Null_Exclusion_Present is
+ -- ugly, can't we have a range, a static predicate or even a flag???
May_Have_Null_Exclusion :=
+ Present (P)
+ and then
Nkind (P) in N_Access_Definition
| N_Access_Function_Definition
| N_Access_Procedure_Definition
@@ -21562,11 +21600,23 @@ package body Sem_Ch3 is
| N_Derived_Type_Definition
| N_Discriminant_Specification
| N_Formal_Object_Declaration
+ | N_Function_Specification
| N_Object_Declaration
| N_Object_Renaming_Declaration
| N_Parameter_Specification
| N_Subtype_Declaration;
+ -- Ada 2005 (AI-231): Static check
+
+ if Ada_Version >= Ada_2005
+ and then May_Have_Null_Exclusion
+ and then Null_Exclusion_Present (P)
+ and then Nkind (P) /= N_Access_To_Object_Definition
+ and then not Is_Access_Type (Entity (S))
+ then
+ Error_Msg_N ("`NOT NULL` only allowed for an access type", S);
+ end if;
+
-- Create an Itype that is a duplicate of Entity (S) but with the
-- null-exclusion attribute.
@@ -22440,8 +22490,8 @@ package body Sem_Ch3 is
Check_Bound (Hi);
if Errs then
- Hi := Type_High_Bound (Standard_Long_Long_Integer);
- Lo := Type_Low_Bound (Standard_Long_Long_Integer);
+ Hi := Type_High_Bound (Standard_Long_Long_Long_Integer);
+ Lo := Type_Low_Bound (Standard_Long_Long_Long_Integer);
end if;
-- Find type to derive from
@@ -22465,11 +22515,15 @@ package body Sem_Ch3 is
Check_Restriction (No_Long_Long_Integers, Def);
Base_Typ := Base_Type (Standard_Long_Long_Integer);
+ elsif Can_Derive_From (Standard_Long_Long_Long_Integer) then
+ Check_Restriction (No_Long_Long_Integers, Def);
+ Base_Typ := Base_Type (Standard_Long_Long_Long_Integer);
+
else
- Base_Typ := Base_Type (Standard_Long_Long_Integer);
+ Base_Typ := Base_Type (Standard_Long_Long_Long_Integer);
Error_Msg_N ("integer type definition bounds out of range", Def);
- Hi := Type_High_Bound (Standard_Long_Long_Integer);
- Lo := Type_Low_Bound (Standard_Long_Long_Integer);
+ Hi := Type_High_Bound (Standard_Long_Long_Long_Integer);
+ Lo := Type_Low_Bound (Standard_Long_Long_Long_Integer);
end if;
end if;
diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads
index bb29904..e94ce15 100644
--- a/gcc/ada/sem_ch3.ads
+++ b/gcc/ada/sem_ch3.ads
@@ -195,7 +195,7 @@ package Sem_Ch3 is
(N : Node_Id;
Related_Nod : Node_Id;
Related_Id : Entity_Id := Empty;
- Suffix_Index : Nat := 1);
+ Suffix_Index : Pos := 1);
-- Process an index that is given in an array declaration, an entry
-- family declaration or a loop iteration. The index is given by an index
-- declaration (a 'box'), or by a discrete range. The later can be the name
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index c92fb06..d06a4a8 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -976,7 +976,7 @@ package body Sem_Ch4 is
Nam : Node_Id;
X : Interp_Index;
It : Interp;
- Nam_Ent : Entity_Id;
+ Nam_Ent : Entity_Id := Empty;
Success : Boolean := False;
Deref : Boolean := False;
@@ -1254,6 +1254,25 @@ package body Sem_Ch4 is
Analyze_One_Call (N, Nam_Ent, True, Success);
+ -- If the nonoverloaded interpretation is a call to an abstract
+ -- nondispatching operation, then flag an error and return.
+
+ -- Should this be incorporated in Remove_Abstract_Operations (which
+ -- currently only deals with cases where the name is overloaded)? ???
+
+ if Is_Overloadable (Nam_Ent)
+ and then Is_Abstract_Subprogram (Nam_Ent)
+ and then not Is_Dispatching_Operation (Nam_Ent)
+ then
+ Set_Etype (N, Any_Type);
+
+ Error_Msg_Sloc := Sloc (Nam_Ent);
+ Error_Msg_NE
+ ("cannot call abstract operation& declared#", N, Nam_Ent);
+
+ return;
+ end if;
+
-- If this is an indirect call, the return type of the access_to
-- subprogram may be an incomplete type. At the point of the call,
-- use the full type if available, and at the same time update the
@@ -1452,6 +1471,46 @@ package body Sem_Ch4 is
End_Interp_List;
end if;
+ -- Check the accessibility level for actuals for explicitly aliased
+ -- formals.
+
+ if Nkind (N) = N_Function_Call
+ and then Comes_From_Source (N)
+ and then Present (Nam_Ent)
+ and then In_Return_Value (N)
+ then
+ declare
+ Form : Node_Id;
+ Act : Node_Id;
+ begin
+ Act := First_Actual (N);
+ Form := First_Formal (Nam_Ent);
+
+ while Present (Form) and then Present (Act) loop
+ -- Check whether the formal is aliased and if the accessibility
+ -- level of the actual is deeper than the accessibility level
+ -- of the enclosing subprogam to which the current return
+ -- statement applies.
+
+ -- Should we be checking Is_Entity_Name on Act? Won't this miss
+ -- other cases ???
+
+ if Is_Explicitly_Aliased (Form)
+ and then Is_Entity_Name (Act)
+ and then Static_Accessibility_Level
+ (Act, Zero_On_Dynamic_Level)
+ > Subprogram_Access_Level (Current_Subprogram)
+ then
+ Error_Msg_N ("actual for explicitly aliased formal is too"
+ & " short lived", Act);
+ end if;
+
+ Next_Formal (Form);
+ Next_Actual (Act);
+ end loop;
+ end;
+ end if;
+
if Ada_Version >= Ada_2012 then
-- Check if the call contains a function with writable actuals
@@ -3136,7 +3195,7 @@ package body Sem_Ch4 is
begin
-- A special warning check, if we have an expression of the form:
-- expr mod 2 * literal
- -- where literal is 64 or less, then probably what was meant was
+ -- where literal is 128 or less, then probably what was meant was
-- expr mod 2 ** literal
-- so issue an appropriate warning.
@@ -3145,7 +3204,7 @@ package body Sem_Ch4 is
and then Intval (Right_Opnd (N)) = Uint_2
and then Nkind (Parent (N)) = N_Op_Multiply
and then Nkind (Right_Opnd (Parent (N))) = N_Integer_Literal
- and then Intval (Right_Opnd (Parent (N))) <= Uint_64
+ and then Intval (Right_Opnd (Parent (N))) <= Uint_128
then
Error_Msg_N
("suspicious MOD value, was '*'* intended'??M?", Parent (N));
@@ -4220,6 +4279,7 @@ package body Sem_Ch4 is
if Warn_On_Suspicious_Contract
and then not Referenced (Loop_Id, Cond)
+ and then not Is_Internal_Name (Chars (Loop_Id))
then
-- Generating C, this check causes spurious warnings on inlined
-- postconditions; we can safely disable it because this check
@@ -8990,16 +9050,20 @@ package body Sem_Ch4 is
Rewrite (First_Actual, Obj);
end if;
- -- The operation is obtained from the dispatch table and not by
- -- visibility, and may be declared in a unit that is not explicitly
- -- referenced in the source, but is nevertheless required in the
- -- context of the current unit. Indicate that operation and its scope
- -- are referenced, to prevent spurious and misleading warnings. If
- -- the operation is overloaded, all primitives are in the same scope
- -- and we can use any of them.
+ if In_Extended_Main_Source_Unit (Current_Scope) then
+ -- The operation is obtained from the dispatch table and not by
+ -- visibility, and may be declared in a unit that is not
+ -- explicitly referenced in the source, but is nevertheless
+ -- required in the context of the current unit. Indicate that
+ -- operation and its scope are referenced, to prevent spurious and
+ -- misleading warnings. If the operation is overloaded, all
+ -- primitives are in the same scope and we can use any of them.
+ -- Don't do that outside the main unit since otherwise this will
+ -- e.g. prevent the detection of some unused with clauses.
- Set_Referenced (Entity (Subprog), True);
- Set_Referenced (Scope (Entity (Subprog)), True);
+ Set_Referenced (Entity (Subprog), True);
+ Set_Referenced (Scope (Entity (Subprog)), True);
+ end if;
Rewrite (Node_To_Replace, Call_Node);
@@ -9338,6 +9402,7 @@ package body Sem_Ch4 is
Error_Msg_NE ("ambiguous call to&", N, Hom);
Report_Ambiguity (Matching_Op);
Report_Ambiguity (Hom);
+ Check_Ambiguous_Aggregate (New_Call_Node);
Error := True;
return;
end if;
@@ -9960,6 +10025,7 @@ package body Sem_Ch4 is
Error_Msg_NE ("ambiguous call to&", N, Prim_Op);
Report_Ambiguity (Matching_Op);
Report_Ambiguity (Prim_Op);
+ Check_Ambiguous_Aggregate (Call_Node);
return True;
end if;
end if;
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 336507a..2afe18b 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -59,6 +59,7 @@ with Stand; use Stand;
with Sinfo; use Sinfo;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
+with Ttypes; use Ttypes;
with Uintp; use Uintp;
package body Sem_Ch5 is
@@ -1049,7 +1050,8 @@ package body Sem_Ch5 is
if not Support_Composite_Assign_On_Target
and then (Is_Array_Type (T1) or else Is_Record_Type (T1))
- and then (not Has_Size_Clause (T1) or else Esize (T1) > 64)
+ and then (not Has_Size_Clause (T1)
+ or else Esize (T1) > Ttypes.System_Max_Integer_Size)
then
Error_Msg_CRT ("composite assignment", N);
end if;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index ed1c326..88bbdf7 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -306,8 +306,6 @@ package body Sem_Ch6 is
-- If the expression is a completion, Prev is the entity whose
-- declaration is completed. Def_Id is needed to analyze the spec.
- -- Start of processing for Analyze_Expression_Function
-
begin
-- This is one of the occasions on which we transform the tree during
-- semantic analysis. If this is a completion, transform the expression
@@ -611,6 +609,12 @@ package body Sem_Ch6 is
Set_Expression
(Original_Node (Subprogram_Spec (Def_Id)),
New_Copy_Tree (Expr));
+
+ -- Mark static expression functions as inlined, to ensure
+ -- that even calls with nonstatic actuals will be inlined.
+
+ Set_Has_Pragma_Inline (Def_Id);
+ Set_Is_Inlined (Def_Id);
end if;
end if;
end;
@@ -668,9 +672,9 @@ package body Sem_Ch6 is
end if;
end Analyze_Expression_Function;
- ----------------------------------------
- -- Analyze_Extended_Return_Statement --
- ----------------------------------------
+ ---------------------------------------
+ -- Analyze_Extended_Return_Statement --
+ ---------------------------------------
procedure Analyze_Extended_Return_Statement (N : Node_Id) is
begin
@@ -780,20 +784,19 @@ package body Sem_Ch6 is
------------------------------------------
procedure Check_Return_Construct_Accessibility (Return_Stmt : Node_Id) is
- Assoc : Node_Id;
- Agg : Node_Id := Empty;
- Discr : Entity_Id;
- Expr : Node_Id;
- Obj : Node_Id;
- Process_Exprs : Boolean := False;
- Return_Con : Node_Id;
+ Return_Con : Node_Id;
+ Assoc : Node_Id := Empty;
+ Assoc_Expr : Node_Id;
+ Disc : Entity_Id;
+ Obj_Decl : Node_Id;
+ Unqual : Node_Id;
begin
-- Only perform checks on record types with access discriminants and
-- non-internally generated functions.
if not Is_Record_Type (R_Type)
- or else not Has_Discriminants (R_Type)
+ or else not Has_Anonymous_Access_Discriminant (R_Type)
or else not Comes_From_Source (Return_Stmt)
then
return;
@@ -833,166 +836,219 @@ package body Sem_Ch6 is
Return_Con := Original_Node (Return_Con);
else
- Return_Con := Return_Stmt;
+ Return_Con := Expression (Return_Stmt);
end if;
- -- We may need to check an aggregate or a subtype indication
- -- depending on how the discriminants were specified and whether
- -- we are looking at an extended return statement.
+ -- Obtain the accessibility levels of the expressions associated
+ -- with all anonymous access discriminants, then generate a
+ -- dynamic check or static error when relevant.
- if Nkind (Return_Con) = N_Object_Declaration
- and then Nkind (Object_Definition (Return_Con))
- = N_Subtype_Indication
+ Unqual := Unqualify (Original_Node (Return_Con));
+
+ -- Obtain the corresponding declaration based on the return object's
+ -- identifier.
+
+ if Nkind (Unqual) = N_Identifier
+ and then Nkind (Parent (Entity (Unqual)))
+ in N_Object_Declaration
+ | N_Object_Renaming_Declaration
then
- Assoc := Original_Node
- (First
- (Constraints
- (Constraint (Object_Definition (Return_Con)))));
+ Obj_Decl := Original_Node (Parent (Entity (Unqual)));
+
+ -- We were passed the object declaration directly, so use it
+
+ elsif Nkind (Unqual) in N_Object_Declaration
+ | N_Object_Renaming_Declaration
+ then
+ Obj_Decl := Unqual;
+
+ -- Otherwise, we are looking at something else
+
else
- -- Qualified expressions may be nested
+ Obj_Decl := Empty;
- Agg := Original_Node (Expression (Return_Con));
- while Nkind (Agg) = N_Qualified_Expression loop
- Agg := Original_Node (Expression (Agg));
- end loop;
+ end if;
+
+ -- Hop up object renamings when present
+
+ if Present (Obj_Decl)
+ and then Nkind (Obj_Decl) = N_Object_Renaming_Declaration
+ then
+ while Nkind (Obj_Decl) = N_Object_Renaming_Declaration loop
- -- If we are looking at an aggregate instead of a function call we
- -- can continue checking accessibility for the supplied
- -- discriminant associations.
+ if Nkind (Name (Obj_Decl)) not in N_Entity then
+ -- We may be looking at the expansion of iterators or
+ -- some other internally generated construct, so it is safe
+ -- to ignore checks ???
+
+ if not Comes_From_Source (Obj_Decl) then
+ return;
+ end if;
+
+ Obj_Decl := Original_Node
+ (Declaration_Node
+ (Ultimate_Prefix (Name (Obj_Decl))));
+
+ -- Move up to the next declaration based on the object's name
- if Nkind (Agg) = N_Aggregate then
- if Present (Expressions (Agg)) then
- Assoc := First (Expressions (Agg));
- Process_Exprs := True;
else
- Assoc := First (Component_Associations (Agg));
+ Obj_Decl := Original_Node
+ (Declaration_Node (Name (Obj_Decl)));
end if;
+ end loop;
+ end if;
- -- Otherwise the expression is not of interest ???
+ -- Obtain the discriminant values from the return aggregate
+ -- Do we cover extension aggregates correctly ???
+
+ if Nkind (Unqual) = N_Aggregate then
+ if Present (Expressions (Unqual)) then
+ Assoc := First (Expressions (Unqual));
else
- return;
+ Assoc := First (Component_Associations (Unqual));
end if;
- end if;
- -- Move through the discriminants checking the accessibility level
- -- of each co-extension's associated expression.
+ -- There is an object declaration for the return object
- Discr := First_Discriminant (R_Type);
- while Present (Discr) loop
- if Ekind (Etype (Discr)) = E_Anonymous_Access_Type then
+ elsif Present (Obj_Decl) then
+ -- When a subtype indication is present in an object declaration
+ -- it must contain the object's discriminants.
+
+ if Nkind (Object_Definition (Obj_Decl)) = N_Subtype_Indication then
+ Assoc := First
+ (Constraints
+ (Constraint
+ (Object_Definition (Obj_Decl))));
+
+ -- The object declaration contains an aggregate
+
+ elsif Present (Expression (Obj_Decl)) then
+
+ if Nkind (Unqualify (Expression (Obj_Decl))) = N_Aggregate then
+ -- Grab the first associated discriminant expresion
+
+ if Present
+ (Expressions (Unqualify (Expression (Obj_Decl))))
+ then
+ Assoc := First
+ (Expressions
+ (Unqualify (Expression (Obj_Decl))));
+ else
+ Assoc := First
+ (Component_Associations
+ (Unqualify (Expression (Obj_Decl))));
+ end if;
+
+ -- Otherwise, this is something else
- if Nkind (Assoc) = N_Attribute_Reference then
- Expr := Assoc;
- elsif Nkind (Assoc) in
- N_Component_Association | N_Discriminant_Association
- then
- Expr := Expression (Assoc);
else
- Expr := Empty;
+ return;
end if;
- -- This anonymous access discriminant has an associated
- -- expression which needs checking.
+ -- There are no supplied discriminants in the object declaration,
+ -- so get them from the type definition since they must be default
+ -- initialized.
- if Present (Expr)
- and then Nkind (Expr) = N_Attribute_Reference
- and then Attribute_Name (Expr) /= Name_Unrestricted_Access
- then
- -- Obtain the object to perform static checks on by moving
- -- up the prefixes in the expression taking into account
- -- named access types and renamed objects within the
- -- expression.
+ -- Do we handle constrained subtypes correctly ???
- -- Note, this loop duplicates some of the logic in
- -- Object_Access_Level since we have to check special rules
- -- based on the context we are in (a return aggregate)
- -- relating to formals of the current function.
+ elsif Nkind (Unqual) = N_Object_Declaration then
+ Assoc := First_Discriminant
+ (Etype (Object_Definition (Obj_Decl)));
- Obj := Original_Node (Prefix (Expr));
- loop
- while Nkind (Obj) in N_Explicit_Dereference
- | N_Indexed_Component
- | N_Selected_Component
- loop
- -- When we encounter a named access type then we can
- -- ignore accessibility checks on the dereference.
-
- if Ekind (Etype (Original_Node (Prefix (Obj))))
- in E_Access_Type ..
- E_Access_Protected_Subprogram_Type
- then
- if Nkind (Obj) = N_Selected_Component then
- Obj := Selector_Name (Obj);
- else
- Obj := Original_Node (Prefix (Obj));
- end if;
- exit;
- end if;
+ else
+ Assoc := First_Discriminant (Etype (Unqual));
+ end if;
- Obj := Original_Node (Prefix (Obj));
- end loop;
+ -- When we are not looking at an aggregate or an identifier, return
+ -- since any other construct (like a function call) is not
+ -- applicable since checks will be performed on the side of the
+ -- callee.
- if Nkind (Obj) = N_Selected_Component then
- Obj := Selector_Name (Obj);
- end if;
+ else
+ return;
+ end if;
- -- Check for renamings
+ -- Obtain the discriminants so we know the actual type in case the
+ -- value of their associated expression gets implicitly converted.
- pragma Assert (Is_Entity_Name (Obj));
+ if No (Obj_Decl) then
+ pragma Assert (Nkind (Unqual) = N_Aggregate);
- if Present (Renamed_Object (Entity (Obj))) then
- Obj := Renamed_Object (Entity (Obj));
- else
- exit;
- end if;
- end loop;
+ Disc := First_Discriminant (Etype (Unqual));
- -- Do not check aliased formals statically
+ else
+ Disc := First_Discriminant
+ (Etype (Defining_Identifier (Obj_Decl)));
+ end if;
- if Is_Formal (Entity (Obj))
- and then (Is_Aliased (Entity (Obj))
- or else Ekind (Etype (Entity (Obj))) =
- E_Anonymous_Access_Type)
- then
- null;
+ -- Loop through each of the discriminants and check each expression
+ -- associated with an anonymous access discriminant.
- -- Otherwise, handle the expression normally, avoiding the
- -- special logic above, and call Object_Access_Level with
- -- the original expression.
+ while Present (Assoc) and then Present (Disc) loop
+ -- Unwrap the associated expression
- elsif Object_Access_Level (Expr) >
- Scope_Depth (Scope (Scope_Id))
- then
- Error_Msg_N
- ("access discriminant in return aggregate would "
- & "be a dangling reference", Obj);
- end if;
- end if;
- end if;
+ if Nkind (Assoc)
+ in N_Component_Association | N_Discriminant_Association
+ then
+ Assoc_Expr := Expression (Assoc);
- Next_Discriminant (Discr);
+ elsif Nkind (Assoc) in N_Entity
+ and then Ekind (Assoc) = E_Discriminant
+ then
+ Assoc_Expr := Discriminant_Default_Value (Assoc);
- if not Is_List_Member (Assoc) then
- Assoc := Empty;
else
- Nlists.Next (Assoc);
+ Assoc_Expr := Assoc;
end if;
- -- After aggregate expressions, examine component associations if
- -- present.
+ -- Check the accessibility level of the expression when the
+ -- discriminant is of an anonymous access type.
+
+ if Present (Assoc_Expr)
+ and then Ekind (Etype (Disc)) = E_Anonymous_Access_Type
+ then
+ -- Perform a static check first, if possible
- if No (Assoc) then
- if Present (Agg)
- and then Process_Exprs
- and then Present (Component_Associations (Agg))
+ if Static_Accessibility_Level
+ (Expr => Assoc_Expr,
+ Level => Zero_On_Dynamic_Level,
+ In_Return_Context => True)
+ > Scope_Depth (Scope (Scope_Id))
then
- Assoc := First (Component_Associations (Agg));
- Process_Exprs := False;
- else
+ Error_Msg_N
+ ("access discriminant in return object would be a dangling"
+ & " reference", Return_Stmt);
exit;
+
+ end if;
+
+ -- Otherwise, generate a dynamic check based on the extra
+ -- accessibility of the result.
+
+ if Present (Extra_Accessibility_Of_Result (Scope_Id)) then
+ Insert_Before_And_Analyze (Return_Stmt,
+ Make_Raise_Program_Error (Loc,
+ Condition =>
+ Make_Op_Gt (Loc,
+ Left_Opnd => Accessibility_Level
+ (Expr => Assoc_Expr,
+ Level => Dynamic_Level,
+ In_Return_Context => True),
+ Right_Opnd => Extra_Accessibility_Of_Result
+ (Scope_Id)),
+ Reason => PE_Accessibility_Check_Failed));
end if;
end if;
+
+ -- Iterate over the discriminants
+
+ Disc := Next_Discriminant (Disc);
+ if not Is_List_Member (Assoc) then
+ exit;
+ else
+ Nlists.Next (Assoc);
+ end if;
end loop;
end Check_Return_Construct_Accessibility;
@@ -1432,8 +1488,8 @@ package body Sem_Ch6 is
if (Ada_Version < Ada_2005 or else Debug_Flag_Dot_L)
and then Is_Limited_View (Etype (Scope_Id))
- and then Object_Access_Level (Expr) >
- Subprogram_Access_Level (Scope_Id)
+ and then Static_Accessibility_Level (Expr, Zero_On_Dynamic_Level)
+ > Subprogram_Access_Level (Scope_Id)
then
-- Suppress the message in a generic, where the rewriting
-- is irrelevant.
@@ -2574,6 +2630,9 @@ package body Sem_Ch6 is
Loc : constant Source_Ptr := Sloc (N);
Prev_Id : constant Entity_Id := Current_Entity_In_Scope (Body_Id);
+ Body_Nod : Node_Id := Empty;
+ Minimum_Acc_Objs : List_Id := No_List;
+
Conformant : Boolean;
Desig_View : Entity_Id := Empty;
Exch_Views : Elist_Id := No_Elist;
@@ -2658,6 +2717,13 @@ package body Sem_Ch6 is
-- limited views with the non-limited ones. Return the list of changes
-- to be used to undo the transformation.
+ procedure Generate_Minimum_Accessibility
+ (Extra_Access : Entity_Id;
+ Related_Form : Entity_Id := Empty);
+ -- Generate a minimum accessibility object for a given extra
+ -- accessibility formal (Extra_Access) and its related formal if it
+ -- exists.
+
function Is_Private_Concurrent_Primitive
(Subp_Id : Entity_Id) return Boolean;
-- Determine whether subprogram Subp_Id is a primitive of a concurrent
@@ -3435,6 +3501,66 @@ package body Sem_Ch6 is
return Result;
end Exchange_Limited_Views;
+ ------------------------------------
+ -- Generate_Minimum_Accessibility --
+ ------------------------------------
+
+ procedure Generate_Minimum_Accessibility
+ (Extra_Access : Entity_Id;
+ Related_Form : Entity_Id := Empty)
+ is
+ Loc : constant Source_Ptr := Sloc (Body_Nod);
+ Form : Entity_Id;
+ Obj_Node : Node_Id;
+ begin
+ -- When no related formal exists then we are dealing with an
+ -- extra accessibility formal for a function result.
+
+ if No (Related_Form) then
+ Form := Extra_Access;
+ else
+ Form := Related_Form;
+ end if;
+
+ -- Create the minimum accessibility object
+
+ Obj_Node :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier =>
+ Make_Temporary
+ (Loc, 'A', Extra_Access),
+ Object_Definition => New_Occurrence_Of
+ (Standard_Natural, Loc),
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of
+ (Standard_Natural, Loc),
+ Attribute_Name => Name_Min,
+ Expressions => New_List (
+ Make_Integer_Literal (Loc,
+ Scope_Depth (Body_Id)),
+ New_Occurrence_Of
+ (Extra_Access, Loc))));
+
+ -- Add the new local object to the Minimum_Acc_Obj to
+ -- be later prepended to the subprogram's list of
+ -- declarations after we are sure all expansion is
+ -- done.
+
+ if Present (Minimum_Acc_Objs) then
+ Prepend (Obj_Node, Minimum_Acc_Objs);
+ else
+ Minimum_Acc_Objs := New_List (Obj_Node);
+ end if;
+
+ -- Register the object and analyze it
+
+ Set_Minimum_Accessibility
+ (Form, Defining_Identifier (Obj_Node));
+
+ Analyze (Obj_Node);
+ end Generate_Minimum_Accessibility;
+
-------------------------------------
-- Is_Private_Concurrent_Primitive --
-------------------------------------
@@ -3766,9 +3892,6 @@ package body Sem_Ch6 is
-- Local variables
- Body_Nod : Node_Id := Empty;
- Minimum_Acc_Objs : List_Id := No_List;
-
Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
Saved_EA : constant Boolean := Expander_Active;
@@ -4646,7 +4769,7 @@ package body Sem_Ch6 is
-- This method is used to supplement our "small integer model" for
-- accessibility-check generation (for more information see
- -- Dynamic_Accessibility_Level).
+ -- Accessibility_Level).
-- Because we allow accessibility values greater than our expected value
-- passing along the same extra accessibility formal as an actual
@@ -4695,50 +4818,33 @@ package body Sem_Ch6 is
then
-- Generate the minimum accessibility level object
- -- A60b : natural := natural'min(1, paramL);
+ -- A60b : constant natural := natural'min(1, paramL);
- declare
- Loc : constant Source_Ptr := Sloc (Body_Nod);
- Obj_Node : constant Node_Id :=
- Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Temporary
- (Loc, 'A', Extra_Accessibility (Form)),
- Object_Definition => New_Occurrence_Of
- (Standard_Natural, Loc),
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of
- (Standard_Natural, Loc),
- Attribute_Name => Name_Min,
- Expressions => New_List (
- Make_Integer_Literal (Loc,
- Object_Access_Level (Form)),
- New_Occurrence_Of
- (Extra_Accessibility (Form), Loc))));
- begin
- -- Add the new local object to the Minimum_Acc_Obj to
- -- be later prepended to the subprogram's list of
- -- declarations after we are sure all expansion is
- -- done.
+ Generate_Minimum_Accessibility
+ (Extra_Accessibility (Form), Form);
+ end if;
- if Present (Minimum_Acc_Objs) then
- Prepend (Obj_Node, Minimum_Acc_Objs);
- else
- Minimum_Acc_Objs := New_List (Obj_Node);
- end if;
+ Next_Formal (Form);
+ end loop;
- -- Register the object and analyze it
+ -- Generate the minimum accessibility level object for the
+ -- function's Extra_Accessibility_Of_Result.
- Set_Minimum_Accessibility
- (Form, Defining_Identifier (Obj_Node));
+ -- A31b : constant natural := natural'min (2, funcL);
- Analyze (Obj_Node);
- end;
- end if;
+ if Ekind (Body_Id) = E_Function
+ and then Present (Extra_Accessibility_Of_Result (Body_Id))
+ then
+ Generate_Minimum_Accessibility
+ (Extra_Accessibility_Of_Result (Body_Id));
- Next_Formal (Form);
- end loop;
+ -- Replace the Extra_Accessibility_Of_Result with the new
+ -- minimum accessibility object.
+
+ Set_Extra_Accessibility_Of_Result
+ (Body_Id, Minimum_Accessibility
+ (Extra_Accessibility_Of_Result (Body_Id)));
+ end if;
end if;
end;
end if;
@@ -9120,10 +9226,27 @@ package body Sem_Ch6 is
("equality operator appears too late (Ada 2012)?y?", Eq_Op);
end if;
- -- No error detected
+ -- Finally check for AI12-0352: declaration of a user-defined primitive
+ -- equality operation for a record type T is illegal if it occurs after
+ -- a type has been derived from T.
else
- return;
+ Obj_Decl := Next (Parent (Typ));
+
+ while Present (Obj_Decl) and then Obj_Decl /= Decl loop
+ if Nkind (Obj_Decl) = N_Full_Type_Declaration
+ and then Etype (Defining_Identifier (Obj_Decl)) = Typ
+ then
+ Error_Msg_N
+ ("equality operator cannot appear after derivation", Eq_Op);
+ Error_Msg_NE
+ ("an equality operator for& cannot be declared after "
+ & "this point??",
+ Obj_Decl, Typ);
+ end if;
+
+ Next (Obj_Decl);
+ end loop;
end if;
end Check_Untagged_Equality;
@@ -12261,6 +12384,27 @@ package body Sem_Ch6 is
end if;
end if;
+ -- Deal with aspects on formal parameters. Only Unreferenced is
+ -- supported for the time being.
+
+ if Has_Aspects (Param_Spec) then
+ declare
+ Aspect : Node_Id := First (Aspect_Specifications (Param_Spec));
+ begin
+ while Present (Aspect) loop
+ if Chars (Identifier (Aspect)) = Name_Unreferenced then
+ Set_Has_Pragma_Unreferenced (Formal);
+ else
+ Error_Msg_NE
+ ("unsupported aspect& on parameter",
+ Aspect, Identifier (Aspect));
+ end if;
+
+ Next (Aspect);
+ end loop;
+ end;
+ end if;
+
<<Continue>>
Next (Param_Spec);
end loop;
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 3ff2001..762f0c1 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -40,6 +40,7 @@ with Exp_Dist; use Exp_Dist;
with Exp_Dbug; use Exp_Dbug;
with Freeze; use Freeze;
with Ghost; use Ghost;
+with GNAT_CUDA; use GNAT_CUDA;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
@@ -999,6 +1000,13 @@ package body Sem_Ch7 is
Analyze_List (Declarations (N));
end if;
+ -- If procedures marked with CUDA_Global have been defined within N, we
+ -- need to register them with the CUDA runtime at program startup. This
+ -- requires multiple declarations and function calls which need to be
+ -- appended to N's declarations.
+
+ Build_And_Insert_CUDA_Initialization (N);
+
HSS := Handled_Statement_Sequence (N);
if Present (HSS) then
@@ -2725,6 +2733,7 @@ package body Sem_Ch7 is
Set_Has_Pragma_Unreferenced_Objects
(Priv, Has_Pragma_Unreferenced_Objects
(Full));
+ Set_Predicates_Ignored (Priv, Predicates_Ignored (Full));
if Is_Unchecked_Union (Full) then
Set_Is_Unchecked_Union (Base_Type (Priv));
end if;
@@ -3184,6 +3193,25 @@ package body Sem_Ch7 is
end loop;
end;
+ -- For subtypes of private types the frontend generates two entities:
+ -- one associated with the partial view and the other associated with
+ -- the full view. When the subtype declaration is public the frontend
+ -- places the former entity in the list of public entities of the
+ -- package and the latter entity in the private part of the package.
+ -- When the subtype declaration is private it generates these two
+ -- entities but both are placed in the private part of the package
+ -- (and the full view has the same source location as the partial
+ -- view and no parent; see Prepare_Private_Subtype_Completion).
+
+ elsif Ekind (Id) in E_Private_Subtype
+ | E_Limited_Private_Subtype
+ and then Present (Full_View (Id))
+ and then Sloc (Id) = Sloc (Full_View (Id))
+ and then No (Parent (Full_View (Id)))
+ then
+ Set_Is_Hidden (Id);
+ Set_Is_Potentially_Use_Visible (Id, False);
+
elsif not Is_Child_Unit (Id)
and then (not Is_Private_Type (Id) or else No (Full_View (Id)))
then
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 3c10a96..35c6f60 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -52,6 +52,7 @@ with Sem_Cat; use Sem_Cat;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch4; use Sem_Ch4;
with Sem_Ch6; use Sem_Ch6;
+with Sem_Ch10; use Sem_Ch10;
with Sem_Ch12; use Sem_Ch12;
with Sem_Ch13; use Sem_Ch13;
with Sem_Dim; use Sem_Dim;
@@ -776,8 +777,9 @@ package body Sem_Ch8 is
------------------------------
procedure Check_Constrained_Object is
- Typ : constant Entity_Id := Etype (Nam);
- Subt : Entity_Id;
+ Typ : constant Entity_Id := Etype (Nam);
+ Subt : Entity_Id;
+ Loop_Scheme : Node_Id;
begin
if Nkind (Nam) in N_Function_Call | N_Explicit_Dereference
@@ -821,6 +823,29 @@ package body Sem_Ch8 is
Rewrite (Subtype_Mark (N), New_Occurrence_Of (Subt, Loc));
Set_Etype (Nam, Subt);
+ -- Suppress discriminant checks on this subtype if the original
+ -- type has defaulted discriminants and Id is a "for of" loop
+ -- iterator.
+
+ if Has_Defaulted_Discriminants (Typ)
+ and then Nkind (Original_Node (Parent (N))) = N_Loop_Statement
+ then
+ Loop_Scheme := Iteration_Scheme (Original_Node (Parent (N)));
+
+ if Present (Loop_Scheme)
+ and then Present (Iterator_Specification (Loop_Scheme))
+ and then
+ Defining_Identifier
+ (Iterator_Specification (Loop_Scheme)) = Id
+ then
+ Set_Checks_May_Be_Suppressed (Subt);
+ Push_Local_Suppress_Stack_Entry
+ (Entity => Subt,
+ Check => Discriminant_Check,
+ Suppress => True);
+ end if;
+ end if;
+
-- Freeze subtype at once, to prevent order of elaboration
-- issues in the backend. The renamed object exists, so its
-- type is already frozen in any case.
@@ -1520,6 +1545,21 @@ package body Sem_Ch8 is
Set_Ekind (New_P, E_Package);
Set_Etype (New_P, Standard_Void_Type);
+ elsif Present (Renamed_Entity (Old_P))
+ and then (From_Limited_With (Renamed_Entity (Old_P))
+ or else Has_Limited_View (Renamed_Entity (Old_P)))
+ and then not
+ Unit_Is_Visible (Cunit (Get_Source_Unit (Renamed_Entity (Old_P))))
+ then
+ Error_Msg_NE
+ ("renaming of limited view of package & not usable in this context"
+ & " (RM 8.5.3(3.1/2))", Name (N), Renamed_Entity (Old_P));
+
+ -- Set basic attributes to minimize cascaded errors
+
+ Set_Ekind (New_P, E_Package);
+ Set_Etype (New_P, Standard_Void_Type);
+
-- Here for OK package renaming
else
@@ -2965,16 +3005,7 @@ package body Sem_Ch8 is
-- Check whether the renaming is for a defaulted actual subprogram
-- with a class-wide actual.
- -- The class-wide wrapper is not needed in GNATprove_Mode and there
- -- is an external axiomatization on the package.
-
- if CW_Actual
- and then Box_Present (Inst_Node)
- and then not
- (GNATprove_Mode
- and then
- Present (Containing_Package_With_Ext_Axioms (Formal_Spec)))
- then
+ if CW_Actual and then Box_Present (Inst_Node) then
Build_Class_Wide_Wrapper (New_S, Old_S);
elsif Is_Entity_Name (Nam)
@@ -3834,29 +3865,6 @@ package body Sem_Ch8 is
Ada_Version_Pragma := Save_AVP;
Ada_Version_Explicit := Save_AV_Exp;
- -- In GNATprove mode, the renamings of actual subprograms are replaced
- -- with wrapper functions that make it easier to propagate axioms to the
- -- points of call within an instance. Wrappers are generated if formal
- -- subprogram is subject to axiomatization.
-
- -- The types in the wrapper profiles are obtained from (instances of)
- -- the types of the formal subprogram.
-
- if Is_Actual
- and then GNATprove_Mode
- and then Present (Containing_Package_With_Ext_Axioms (Formal_Spec))
- and then not Inside_A_Generic
- then
- if Ekind (Old_S) = E_Function then
- Rewrite (N, Build_Function_Wrapper (Formal_Spec, Old_S));
- Analyze (N);
-
- elsif Ekind (Old_S) = E_Operator then
- Rewrite (N, Build_Operator_Wrapper (Formal_Spec, Old_S));
- Analyze (N);
- end if;
- end if;
-
-- Check if we are looking at an Ada 2012 defaulted formal subprogram
-- and mark any use_package_clauses that affect the visibility of the
-- implicit generic actual.
@@ -5013,12 +5021,7 @@ package body Sem_Ch8 is
-- Find_Direct_Name --
----------------------
- procedure Find_Direct_Name
- (N : Node_Id;
- Errors_OK : Boolean := True;
- Marker_OK : Boolean := True;
- Reference_OK : Boolean := True)
- is
+ procedure Find_Direct_Name (N : Node_Id) is
E : Entity_Id;
E2 : Entity_Id;
Msg : Boolean;
@@ -5285,10 +5288,6 @@ package body Sem_Ch8 is
Item : Node_Id;
begin
- if not Errors_OK then
- return;
- end if;
-
-- Ada 2005 (AI-262): Generate a precise error concerning the
-- Beaujolais effect that was previously detected
@@ -5456,8 +5455,7 @@ package body Sem_Ch8 is
-- Named aggregate should also be handled similarly ???
- if Errors_OK
- and then Nkind (N) = N_Identifier
+ if Nkind (N) = N_Identifier
and then Nkind (Parent (N)) = N_Case_Statement_Alternative
then
declare
@@ -5493,122 +5491,114 @@ package body Sem_Ch8 is
Set_Entity (N, Any_Id);
Set_Etype (N, Any_Type);
- if Errors_OK then
-
- -- We use the table Urefs to keep track of entities for which we
- -- have issued errors for undefined references. Multiple errors
- -- for a single name are normally suppressed, however we modify
- -- the error message to alert the programmer to this effect.
+ -- We use the table Urefs to keep track of entities for which we
+ -- have issued errors for undefined references. Multiple errors
+ -- for a single name are normally suppressed, however we modify
+ -- the error message to alert the programmer to this effect.
- for J in Urefs.First .. Urefs.Last loop
- if Chars (N) = Chars (Urefs.Table (J).Node) then
- if Urefs.Table (J).Err /= No_Error_Msg
- and then Sloc (N) /= Urefs.Table (J).Loc
- then
- Error_Msg_Node_1 := Urefs.Table (J).Node;
-
- if Urefs.Table (J).Nvis then
- Change_Error_Text (Urefs.Table (J).Err,
- "& is not visible (more references follow)");
- else
- Change_Error_Text (Urefs.Table (J).Err,
- "& is undefined (more references follow)");
- end if;
+ for J in Urefs.First .. Urefs.Last loop
+ if Chars (N) = Chars (Urefs.Table (J).Node) then
+ if Urefs.Table (J).Err /= No_Error_Msg
+ and then Sloc (N) /= Urefs.Table (J).Loc
+ then
+ Error_Msg_Node_1 := Urefs.Table (J).Node;
- Urefs.Table (J).Err := No_Error_Msg;
+ if Urefs.Table (J).Nvis then
+ Change_Error_Text (Urefs.Table (J).Err,
+ "& is not visible (more references follow)");
+ else
+ Change_Error_Text (Urefs.Table (J).Err,
+ "& is undefined (more references follow)");
end if;
- -- Although we will set Msg False, and thus suppress the
- -- message, we also set Error_Posted True, to avoid any
- -- cascaded messages resulting from the undefined reference.
-
- Msg := False;
- Set_Error_Posted (N);
- return;
+ Urefs.Table (J).Err := No_Error_Msg;
end if;
- end loop;
- -- If entry not found, this is first undefined occurrence
+ -- Although we will set Msg False, and thus suppress the
+ -- message, we also set Error_Posted True, to avoid any
+ -- cascaded messages resulting from the undefined reference.
- if Nvis then
- Error_Msg_N ("& is not visible!", N);
- Emsg := Get_Msg_Id;
+ Msg := False;
+ Set_Error_Posted (N);
+ return;
+ end if;
+ end loop;
- else
- Error_Msg_N ("& is undefined!", N);
- Emsg := Get_Msg_Id;
+ -- If entry not found, this is first undefined occurrence
- -- A very bizarre special check, if the undefined identifier
- -- is Put or Put_Line, then add a special error message (since
- -- this is a very common error for beginners to make).
+ if Nvis then
+ Error_Msg_N ("& is not visible!", N);
+ Emsg := Get_Msg_Id;
- if Chars (N) in Name_Put | Name_Put_Line then
- Error_Msg_N -- CODEFIX
- ("\\possible missing `WITH Ada.Text_'I'O; " &
- "USE Ada.Text_'I'O`!", N);
+ else
+ Error_Msg_N ("& is undefined!", N);
+ Emsg := Get_Msg_Id;
- -- Another special check if N is the prefix of a selected
- -- component which is a known unit: add message complaining
- -- about missing with for this unit.
+ -- A very bizarre special check, if the undefined identifier
+ -- is Put or Put_Line, then add a special error message (since
+ -- this is a very common error for beginners to make).
- elsif Nkind (Parent (N)) = N_Selected_Component
- and then N = Prefix (Parent (N))
- and then Is_Known_Unit (Parent (N))
- then
- Error_Msg_Node_2 := Selector_Name (Parent (N));
- Error_Msg_N -- CODEFIX
- ("\\missing `WITH &.&;`", Prefix (Parent (N)));
- end if;
+ if Chars (N) in Name_Put | Name_Put_Line then
+ Error_Msg_N -- CODEFIX
+ ("\\possible missing `WITH Ada.Text_'I'O; " &
+ "USE Ada.Text_'I'O`!", N);
- -- Now check for possible misspellings
+ -- Another special check if N is the prefix of a selected
+ -- component which is a known unit: add message complaining
+ -- about missing with for this unit.
- declare
- E : Entity_Id;
- Ematch : Entity_Id := Empty;
+ elsif Nkind (Parent (N)) = N_Selected_Component
+ and then N = Prefix (Parent (N))
+ and then Is_Known_Unit (Parent (N))
+ then
+ Error_Msg_Node_2 := Selector_Name (Parent (N));
+ Error_Msg_N -- CODEFIX
+ ("\\missing `WITH &.&;`", Prefix (Parent (N)));
+ end if;
- Last_Name_Id : constant Name_Id :=
- Name_Id (Nat (First_Name_Id) +
- Name_Entries_Count - 1);
+ -- Now check for possible misspellings
- begin
- for Nam in First_Name_Id .. Last_Name_Id loop
- E := Get_Name_Entity_Id (Nam);
+ declare
+ E : Entity_Id;
+ Ematch : Entity_Id := Empty;
+ begin
+ for Nam in First_Name_Id .. Last_Name_Id loop
+ E := Get_Name_Entity_Id (Nam);
- if Present (E)
- and then (Is_Immediately_Visible (E)
- or else
- Is_Potentially_Use_Visible (E))
- then
- if Is_Bad_Spelling_Of (Chars (N), Nam) then
- Ematch := E;
- exit;
- end if;
+ if Present (E)
+ and then (Is_Immediately_Visible (E)
+ or else
+ Is_Potentially_Use_Visible (E))
+ then
+ if Is_Bad_Spelling_Of (Chars (N), Nam) then
+ Ematch := E;
+ exit;
end if;
- end loop;
-
- if Present (Ematch) then
- Error_Msg_NE -- CODEFIX
- ("\possible misspelling of&", N, Ematch);
end if;
- end;
- end if;
+ end loop;
- -- Make entry in undefined references table unless the full errors
- -- switch is set, in which case by refraining from generating the
- -- table entry we guarantee that we get an error message for every
- -- undefined reference. The entry is not added if we are ignoring
- -- errors.
+ if Present (Ematch) then
+ Error_Msg_NE -- CODEFIX
+ ("\possible misspelling of&", N, Ematch);
+ end if;
+ end;
+ end if;
- if not All_Errors_Mode and then Ignore_Errors_Enable = 0 then
- Urefs.Append (
- (Node => N,
- Err => Emsg,
- Nvis => Nvis,
- Loc => Sloc (N)));
- end if;
+ -- Make entry in undefined references table unless the full errors
+ -- switch is set, in which case by refraining from generating the
+ -- table entry we guarantee that we get an error message for every
+ -- undefined reference. The entry is not added if we are ignoring
+ -- errors.
- Msg := True;
+ if not All_Errors_Mode and then Ignore_Errors_Enable = 0 then
+ Urefs.Append (
+ (Node => N,
+ Err => Emsg,
+ Nvis => Nvis,
+ Loc => Sloc (N)));
end if;
+
+ Msg := True;
end Undefined;
-- Local variables
@@ -5627,6 +5617,21 @@ package body Sem_Ch8 is
if Is_Type (Entity (N)) then
Set_Etype (N, Entity (N));
+ -- The exception to this general rule are constants associated with
+ -- discriminals of protected types because for each protected op
+ -- a new set of discriminals is internally created by the frontend
+ -- (see Exp_Ch9.Set_Discriminals), and the current decoration of the
+ -- entity pointer may have been set as part of a preanalysis, where
+ -- discriminals still reference the first subprogram or entry to be
+ -- expanded (see Expand_Protected_Body_Declarations).
+
+ elsif Full_Analysis
+ and then Ekind (Entity (N)) = E_Constant
+ and then Present (Discriminal_Link (Entity (N)))
+ and then Is_Protected_Type (Scope (Discriminal_Link (Entity (N))))
+ then
+ goto Find_Name;
+
else
declare
Entyp : constant Entity_Id := Etype (Entity (N));
@@ -5667,6 +5672,8 @@ package body Sem_Ch8 is
return;
end if;
+ <<Find_Name>>
+
-- Preserve relevant elaboration-related attributes of the context which
-- are no longer available or very expensive to recompute once analysis,
-- resolution, and expansion are over.
@@ -5714,6 +5721,12 @@ package body Sem_Ch8 is
E := Homonym (E);
end loop;
+ -- If we are ignoring errors, skip the error processing
+
+ if Get_Ignore_Errors then
+ return;
+ end if;
+
-- If no entries on homonym chain that were potentially visible,
-- and no entities reasonably considered as non-visible, then
-- we have a plain undefined reference, with no additional
@@ -5752,7 +5765,7 @@ package body Sem_Ch8 is
-- outside the instance.
if From_Actual_Package (E)
- and then Scope_Depth (E2) < Scope_Depth (Inst)
+ and then Scope_Depth (Scope (E2)) < Scope_Depth (Inst)
then
goto Found;
else
@@ -6033,7 +6046,7 @@ package body Sem_Ch8 is
-- If no homonyms were visible, the entity is unambiguous
if not Is_Overloaded (N) then
- if Reference_OK and then not Is_Actual_Parameter then
+ if not Is_Actual_Parameter then
Generate_Reference (E, N);
end if;
end if;
@@ -6052,8 +6065,7 @@ package body Sem_Ch8 is
-- in SPARK mode where renamings are traversed for generating
-- local effects of subprograms.
- if Reference_OK
- and then Is_Object (E)
+ if Is_Object (E)
and then Present (Renamed_Object (E))
and then not GNATprove_Mode
then
@@ -6083,7 +6095,7 @@ package body Sem_Ch8 is
-- Generate reference unless this is an actual parameter
-- (see comment below).
- if Reference_OK and then not Is_Actual_Parameter then
+ if not Is_Actual_Parameter then
Generate_Reference (E, N);
Set_Referenced (E, R);
end if;
@@ -6092,7 +6104,7 @@ package body Sem_Ch8 is
-- Normal case, not a label: generate reference
else
- if Reference_OK and then not Is_Actual_Parameter then
+ if not Is_Actual_Parameter then
-- Package or generic package is always a simple reference
@@ -6112,7 +6124,7 @@ package body Sem_Ch8 is
-- If we don't know now, generate reference later
when Unknown =>
- Deferred_References.Append ((E, N));
+ Defer_Reference ((E, N));
end case;
end if;
end if;
@@ -6161,11 +6173,7 @@ package body Sem_Ch8 is
-- reference is a write when it appears on the left hand side of an
-- assignment.
- if Marker_OK
- and then Needs_Variable_Reference_Marker
- (N => N,
- Calls_OK => False)
- then
+ if Needs_Variable_Reference_Marker (N => N, Calls_OK => False) then
declare
Is_Assignment_LHS : constant Boolean := Is_LHS (N) = Yes;
@@ -6266,6 +6274,22 @@ package body Sem_Ch8 is
then
P_Name := Renamed_Object (P_Name);
+ if From_Limited_With (P_Name)
+ and then not Unit_Is_Visible (Cunit (Get_Source_Unit (P_Name)))
+ then
+ Error_Msg_NE
+ ("renaming of limited view of package & not usable in this"
+ & " context (RM 8.5.3(3.1/2))", Prefix (N), P_Name);
+
+ elsif Has_Limited_View (P_Name)
+ and then not Unit_Is_Visible (Cunit (Get_Source_Unit (P_Name)))
+ and then not Is_Visible_Through_Renamings (P_Name)
+ then
+ Error_Msg_NE
+ ("renaming of limited view of package & not usable in this"
+ & " context (RM 8.5.3(3.1/2))", Prefix (N), P_Name);
+ end if;
+
-- Rewrite node with entity field pointing to renamed object
Rewrite (Prefix (N), New_Copy (Prefix (N)));
@@ -6331,6 +6355,19 @@ package body Sem_Ch8 is
Candidate := Get_Full_View (Non_Limited_View (Id));
Is_New_Candidate := True;
+ -- Handle special case where the prefix is a renaming of a shadow
+ -- package which is visible. Required to avoid reporting spurious
+ -- errors.
+
+ elsif Ekind (P_Name) = E_Package
+ and then From_Limited_With (P_Name)
+ and then not From_Limited_With (Id)
+ and then Sloc (Scope (Id)) = Sloc (P_Name)
+ and then Unit_Is_Visible (Cunit (Get_Source_Unit (P_Name)))
+ then
+ Candidate := Get_Full_View (Id);
+ Is_New_Candidate := True;
+
-- An unusual case arises with a fully qualified name for an
-- entity local to a generic child unit package, within an
-- instantiation of that package. The name of the unit now
@@ -6729,7 +6766,7 @@ package body Sem_Ch8 is
Generate_Reference (Id, N, 'r');
when Unknown =>
- Deferred_References.Append ((Id, N));
+ Defer_Reference ((Id, N));
end case;
end if;
diff --git a/gcc/ada/sem_ch8.ads b/gcc/ada/sem_ch8.ads
index b1a2b9e..fe5d5ee 100644
--- a/gcc/ada/sem_ch8.ads
+++ b/gcc/ada/sem_ch8.ads
@@ -82,11 +82,7 @@ package Sem_Ch8 is
-- Subsidiaries of End_Use_Clauses. Also called directly for use clauses
-- appearing in context clauses.
- procedure Find_Direct_Name
- (N : Node_Id;
- Errors_OK : Boolean := True;
- Marker_OK : Boolean := True;
- Reference_OK : Boolean := True);
+ procedure Find_Direct_Name (N : Node_Id);
-- Given a direct name (Identifier or Operator_Symbol), this routine scans
-- the homonym chain for the name, searching for corresponding visible
-- entities to find the referenced entity (or in the case of overloading,
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index effc858..a9d720b 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -1252,7 +1252,7 @@ package body Sem_Ch9 is
E := First_Entity (P_Type);
while Present (E) loop
if Chars (E) = Chars (Id)
- and then (Ekind (E) = Ekind (Id))
+ and then Ekind (E) = Ekind (Id)
and then Type_Conformant (Id, E)
then
Entry_Name := E;
@@ -2360,7 +2360,8 @@ package body Sem_Ch9 is
-- entry body) unless it is a parameter of the innermost enclosing
-- accept statement (or entry body).
- if Object_Access_Level (Target_Obj) >= Scope_Depth (Outer_Ent)
+ if Static_Accessibility_Level (Target_Obj, Zero_On_Dynamic_Level)
+ >= Scope_Depth (Outer_Ent)
and then
(not Is_Entity_Name (Target_Obj)
or else not Is_Formal (Entity (Target_Obj))
@@ -3532,6 +3533,14 @@ package body Sem_Ch9 is
Next (Iface);
end loop;
+
+ -- Check consistency of any nonoverridable aspects that are
+ -- inherited from multiple sources.
+
+ Check_Inherited_Nonoverridable_Aspects
+ (Inheritor => N,
+ Interface_List => Interface_List (N),
+ Parent_Type => Empty);
end if;
if not Has_Private_Declaration (T) then
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 67a8cdf..cf54337 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -575,12 +575,16 @@ package body Sem_Disp is
-- Similarly, if this is a pre/postcondition for an abstract
-- subprogram, it may call another abstract function which is
-- a primitive of an abstract type. The call is non-dispatching
- -- but will be legal in overridings of the operation.
+ -- but will be legal in overridings of the operation. However,
+ -- if the call is tag-indeterminate we want to continue with
+ -- with the error checking below, as this case is illegal even
+ -- for abstract subprograms (see AI12-0170).
elsif (Is_Subprogram (Scop)
or else Chars (Scop) = Name_Postcondition)
and then
- (Is_Abstract_Subprogram (Scop)
+ ((Is_Abstract_Subprogram (Scop)
+ and then not Is_Tag_Indeterminate (N))
or else
(Nkind (Parent (Scop)) = N_Procedure_Specification
and then Null_Present (Parent (Scop))))
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 78108e9..d7a8bb0 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -18633,16 +18633,17 @@ package body Sem_Elab is
elsif Nkind (N) = N_Attribute_Reference then
Error_Msg_NE
("Access attribute of & before body seen<<", N, Orig_Ent);
- Error_Msg_N ("\possible Program_Error on later references<", N);
+ Error_Msg_N
+ ("\possible Program_Error on later references<<", N);
Insert_Check := False;
elsif Nkind (Unit_Declaration_Node (Orig_Ent)) /=
N_Subprogram_Renaming_Declaration
+ or else Is_Generic_Actual_Subprogram (Orig_Ent)
then
Error_Msg_NE
("cannot call& before body seen<<", N, Orig_Ent);
-
- elsif not Is_Generic_Actual_Subprogram (Orig_Ent) then
+ else
Insert_Check := False;
end if;
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index 8c13abc..12f2822 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -445,9 +445,11 @@ package body Sem_Eval is
-- is folded, and since this is definitely a failure, extra checks
-- are OK.
- Insert_Action (Expr,
- Make_Predicate_Check
- (Typ, Duplicate_Subexpr (Expr)), Suppress => All_Checks);
+ if Predicate_Enabled (Typ) then
+ Insert_Action (Expr,
+ Make_Predicate_Check
+ (Typ, Duplicate_Subexpr (Expr)), Suppress => All_Checks);
+ end if;
end if;
end Check_Expression_Against_Static_Predicate;
@@ -2941,9 +2943,14 @@ package body Sem_Eval is
end if;
case Nam is
- when Name_Shift_Left => Eval_Shift (N, E, N_Op_Shift_Left);
- when Name_Shift_Right => Eval_Shift (N, E, N_Op_Shift_Right);
- when others => null;
+ when Name_Shift_Left =>
+ Eval_Shift (N, E, N_Op_Shift_Left);
+ when Name_Shift_Right =>
+ Eval_Shift (N, E, N_Op_Shift_Right);
+ when Name_Shift_Right_Arithmetic =>
+ Eval_Shift (N, E, N_Op_Shift_Right_Arithmetic);
+ when others =>
+ null;
end case;
end Eval_Intrinsic_Call;
@@ -3224,7 +3231,7 @@ package body Sem_Eval is
-- Eval_Op_Not --
-----------------
- -- The not operation is a static functions, so the result is potentially
+ -- The not operation is a static function, so the result is potentially
-- static if the operand is potentially static (RM 4.9(7), 4.9(20)).
procedure Eval_Op_Not (N : Node_Id) is
@@ -4800,13 +4807,11 @@ package body Sem_Eval is
end Check_Elab_Call;
begin
- -- Evaluate logical shift operators on binary modular types
-
- if Is_Modular_Integer_Type (Typ)
- and then not Non_Binary_Modulus (Typ)
- and then Compile_Time_Known_Value (Left)
+ if Compile_Time_Known_Value (Left)
and then Compile_Time_Known_Value (Right)
then
+ pragma Assert (not Non_Binary_Modulus (Typ));
+
if Op = N_Op_Shift_Left then
Check_Elab_Call;
@@ -4821,12 +4826,73 @@ package body Sem_Eval is
elsif Op = N_Op_Shift_Right then
Check_Elab_Call;
- -- Fold Shift_Right (X, Y) by computing X / 2**Y
+ -- Fold Shift_Right (X, Y) by computing abs X / 2**Y
Fold_Uint
(N,
- Expr_Value (Left) / (Uint_2 ** Expr_Value (Right)),
+ abs Expr_Value (Left) / (Uint_2 ** Expr_Value (Right)),
Static => Static);
+
+ elsif Op = N_Op_Shift_Right_Arithmetic then
+ Check_Elab_Call;
+
+ declare
+ Two_Y : constant Uint := Uint_2 ** Expr_Value (Right);
+ Modulus : Uint;
+ begin
+ if Is_Modular_Integer_Type (Typ) then
+ Modulus := Einfo.Modulus (Typ);
+ else
+ Modulus := Uint_2 ** RM_Size (Typ);
+ end if;
+
+ -- X / 2**Y if X if positive or a small enough modular integer
+
+ if (Is_Modular_Integer_Type (Typ)
+ and then Expr_Value (Left) < Modulus / Uint_2)
+ or else
+ (not Is_Modular_Integer_Type (Typ)
+ and then Expr_Value (Left) >= 0)
+ then
+ Fold_Uint (N, Expr_Value (Left) / Two_Y, Static => Static);
+
+ -- -1 (aka all 1's) if Y is larger than the number of bits
+ -- available or if X = -1.
+
+ elsif Two_Y > Modulus
+ or else Expr_Value (Left) = Uint_Minus_1
+ then
+ if Is_Modular_Integer_Type (Typ) then
+ Fold_Uint (N, Modulus - Uint_1, Static => Static);
+ else
+ Fold_Uint (N, Uint_Minus_1, Static => Static);
+ end if;
+
+ -- Large modular integer, compute via multiply/divide the
+ -- following: X >> Y + (1 << Y - 1) << (RM_Size - Y)
+
+ elsif Is_Modular_Integer_Type (Typ) then
+ Fold_Uint
+ (N,
+ (Expr_Value (Left)) / Two_Y
+ + (Two_Y - Uint_1)
+ * Uint_2 ** (RM_Size (Typ) - Expr_Value (Right)),
+ Static => Static);
+
+ -- Negative signed integer, compute via multiple/divide the
+ -- following:
+ -- (Modulus + X) >> Y + (1 << Y - 1) << (RM_Size - Y) - Modulus
+
+ else
+ Fold_Uint
+ (N,
+ (Modulus + Expr_Value (Left)) / Two_Y
+ + (Two_Y - Uint_1)
+ * Uint_2 ** (RM_Size (Typ) - Expr_Value (Right))
+ - Modulus,
+ Static => Static);
+ end if;
+ end;
end if;
end if;
end Fold_Shift;
@@ -6488,8 +6554,65 @@ package body Sem_Eval is
end if;
declare
- DL1 : constant Elist_Id := Discriminant_Constraint (T1);
- DL2 : constant Elist_Id := Discriminant_Constraint (T2);
+
+ function Original_Discriminant_Constraint
+ (Typ : Entity_Id) return Elist_Id;
+ -- Returns Typ's discriminant constraint, or if the constraint
+ -- is inherited from an ancestor type, then climbs the parent
+ -- types to locate and return the constraint farthest up the
+ -- parent chain that Typ's constraint is ultimately inherited
+ -- from (stopping before a parent that doesn't impose a constraint
+ -- or a parent that has new discriminants). This ensures a proper
+ -- result from the equality comparison of Elist_Ids below (as
+ -- otherwise, derived types that inherit constraints may appear
+ -- to be unequal, because each level of derivation can have its
+ -- own copy of the constraint).
+
+ function Original_Discriminant_Constraint
+ (Typ : Entity_Id) return Elist_Id
+ is
+ begin
+ if not Has_Discriminants (Typ) then
+ return No_Elist;
+
+ -- If Typ is not a derived type, then directly return the
+ -- its constraint.
+
+ elsif not Is_Derived_Type (Typ) then
+ return Discriminant_Constraint (Typ);
+
+ -- If the parent type doesn't have discriminants, doesn't
+ -- have a constraint, or has new discriminants, then stop
+ -- and return Typ's constraint.
+
+ elsif not Has_Discriminants (Etype (Typ))
+
+ -- No constraint on the parent type
+
+ or else not Present (Discriminant_Constraint (Etype (Typ)))
+ or else Is_Empty_Elmt_List
+ (Discriminant_Constraint (Etype (Typ)))
+
+ -- The parent type defines new discriminants
+
+ or else
+ (Is_Base_Type (Etype (Typ))
+ and then Present (Discriminant_Specifications
+ (Parent (Etype (Typ)))))
+ then
+ return Discriminant_Constraint (Typ);
+
+ -- Otherwise, make a recursive call on the parent type
+
+ else
+ return Original_Discriminant_Constraint (Etype (Typ));
+ end if;
+ end Original_Discriminant_Constraint;
+
+ -- Local variables
+
+ DL1 : constant Elist_Id := Original_Discriminant_Constraint (T1);
+ DL2 : constant Elist_Id := Original_Discriminant_Constraint (T2);
DA1 : Elmt_Id;
DA2 : Elmt_Id;
diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb
index 15bb146..f3d9f44 100644
--- a/gcc/ada/sem_intr.adb
+++ b/gcc/ada/sem_intr.adb
@@ -38,6 +38,7 @@ with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
+with Ttypes; use Ttypes;
with Uintp; use Uintp;
package body Sem_Intr is
@@ -430,11 +431,18 @@ package body Sem_Intr is
if Size /= 8 and then
Size /= 16 and then
Size /= 32 and then
- Size /= 64
+ Size /= 64 and then
+ Size /= System_Max_Integer_Size
then
- Errint
- ("first argument for shift must have size 8, 16, 32 or 64",
- Ptyp1, N, Relaxed => True);
+ if System_Max_Integer_Size > 64 then
+ Errint
+ ("first argument for shift must have size 8, 16, 32, 64 or 128",
+ Ptyp1, N, Relaxed => True);
+ else
+ Errint
+ ("first argument for shift must have size 8, 16, 32 or 64",
+ Ptyp1, N, Relaxed => True);
+ end if;
return;
elsif Non_Binary_Modulus (Typ1) then
@@ -449,10 +457,19 @@ package body Sem_Intr is
and then Modulus (Typ1) /= Uint_2 ** 16
and then Modulus (Typ1) /= Uint_2 ** 32
and then Modulus (Typ1) /= Uint_2 ** 64
+ and then Modulus (Typ1) /= Uint_2 ** System_Max_Binary_Modulus_Power
then
- Errint
- ("modular type for shift must have modulus of 2'*'*8, "
- & "2'*'*16, 2'*'*32, or 2'*'*64", Ptyp1, N, Relaxed => True);
+ if System_Max_Binary_Modulus_Power > 64 then
+ Errint
+ ("modular type for shift must have modulus of 2'*'*8, "
+ & "2'*'*16, 2'*'*32, 2'*'*64 or 2'*'*128", Ptyp1, N,
+ Relaxed => True);
+ else
+ Errint
+ ("modular type for shift must have modulus of 2'*'*8, "
+ & "2'*'*16, 2'*'*32, or 2'*'*64", Ptyp1, N,
+ Relaxed => True);
+ end if;
elsif Etype (Arg1) /= Etype (E) then
Errint
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index b7148d80..1e1a279 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -44,6 +44,7 @@ with Exp_Util; use Exp_Util;
with Expander; use Expander;
with Freeze; use Freeze;
with Ghost; use Ghost;
+with GNAT_CUDA; use GNAT_CUDA;
with Gnatvsn; use Gnatvsn;
with Lib; use Lib;
with Lib.Writ; use Lib.Writ;
@@ -543,12 +544,16 @@ package body Sem_Prag is
Set_Ghost_Mode (N);
-- Single and multiple contract cases must appear in aggregate form. If
- -- this is not the case, then either the parser of the analysis of the
+ -- this is not the case, then either the parser or the analysis of the
-- pragma failed to produce an aggregate.
pragma Assert (Nkind (CCases) = N_Aggregate);
- if Present (Component_Associations (CCases)) then
+ -- Only CASE_GUARD => CONSEQUENCE clauses are allowed
+
+ if Present (Component_Associations (CCases))
+ and then No (Expressions (CCases))
+ then
-- Ensure that the formal parameters are visible when analyzing all
-- clauses. This falls out of the general rule of aspects pertaining
@@ -583,7 +588,7 @@ package body Sem_Prag is
-- Otherwise the pragma is illegal
else
- Error_Msg_N ("wrong syntax for constract cases", N);
+ Error_Msg_N ("wrong syntax for contract cases", N);
end if;
Set_Is_Analyzed_Pragma (N);
@@ -2100,12 +2105,11 @@ package body Sem_Prag is
Expr : Node_Id;
begin
- Expr_Val := False;
-
- -- Do not analyze the pragma multiple times
+ -- Do not analyze the pragma multiple times, but set the output
+ -- parameter to the argument specified by the pragma.
if Is_Analyzed_Pragma (N) then
- return;
+ goto Leave;
end if;
Error_Msg_Name_1 := Pragma_Name (N);
@@ -2146,6 +2150,10 @@ package body Sem_Prag is
end if;
end if;
+ Set_Is_Analyzed_Pragma (N);
+
+ <<Leave>>
+
-- Ensure that the Boolean expression (if present) is static. A missing
-- argument defaults the value to True (SPARK RM 7.1.2(5)).
@@ -2159,7 +2167,6 @@ package body Sem_Prag is
end if;
end if;
- Set_Is_Analyzed_Pragma (N);
end Analyze_External_Property_In_Decl_Part;
---------------------------------
@@ -2467,10 +2474,11 @@ package body Sem_Prag is
elsif SPARK_Mode = On
and then Ekind (Item_Id) = E_Variable
- and then Is_Effectively_Volatile (Item_Id)
+ and then Is_Effectively_Volatile_For_Reading (Item_Id)
then
- -- An effectively volatile object cannot appear as a global
- -- item of a nonvolatile function (SPARK RM 7.1.3(8)).
+ -- An effectively volatile object for reading cannot appear
+ -- as a global item of a nonvolatile function (SPARK RM
+ -- 7.1.3(8)).
if Ekind (Spec_Id) in E_Function | E_Generic_Function
and then not Is_Volatile_Function (Spec_Id)
@@ -3940,10 +3948,6 @@ package body Sem_Prag is
procedure Check_At_Most_N_Arguments (N : Nat);
-- Check there are no more than N arguments present
- procedure Check_Atomic_VFA (E : Entity_Id; VFA : Boolean);
- -- Apply legality checks to type or object E subject to an Atomic aspect
- -- in Ada 2020 (RM C.6(13)) or to a Volatile_Full_Access aspect.
-
procedure Check_Component
(Comp : Node_Id;
UU_Typ : Entity_Id;
@@ -4068,10 +4072,10 @@ package body Sem_Prag is
procedure Ensure_Aggregate_Form (Arg : Node_Id);
-- Subsidiary routine to the processing of pragmas Abstract_State,
-- Contract_Cases, Depends, Global, Initializes, Refined_Depends,
- -- Refined_Global and Refined_State. Transform argument Arg into
- -- an aggregate if not one already. N_Null is never transformed.
- -- Arg may denote an aspect specification or a pragma argument
- -- association.
+ -- Refined_Global, Refined_State and Subprogram_Variant. Transform
+ -- argument Arg into an aggregate if not one already. N_Null is never
+ -- transformed. Arg may denote an aspect specification or a pragma
+ -- argument association.
procedure Error_Pragma (Msg : String);
pragma No_Return (Error_Pragma);
@@ -4796,7 +4800,7 @@ package body Sem_Prag is
-- Chain the pragma on the contract for further processing by
-- Analyze_Pre_Post_Condition_In_Decl_Part.
- Add_Contract_Item (N, Defining_Entity (Subp_Decl));
+ Add_Contract_Item (N, Subp_Id);
-- Fully analyze the pragma when it appears inside an entry or
-- subprogram body because it cannot benefit from forward references.
@@ -5623,165 +5627,6 @@ package body Sem_Prag is
end if;
end Check_At_Most_N_Arguments;
- ------------------------
- -- Check_Atomic_VFA --
- ------------------------
-
- procedure Check_Atomic_VFA (E : Entity_Id; VFA : Boolean) is
-
- Aliased_Subcomponent : exception;
- -- Exception raised if an aliased subcomponent is found in E
-
- Independent_Subcomponent : exception;
- -- Exception raised if an independent subcomponent is found in E
-
- procedure Check_Subcomponents (Typ : Entity_Id);
- -- Apply checks to subcomponents for Atomic and Volatile_Full_Access
-
- -------------------------
- -- Check_Subcomponents --
- -------------------------
-
- procedure Check_Subcomponents (Typ : Entity_Id) is
- Comp : Entity_Id;
-
- begin
- if Is_Array_Type (Typ) then
- Comp := Component_Type (Typ);
-
- -- For Atomic we accept any atomic subcomponents
-
- if not VFA
- and then (Has_Atomic_Components (Typ)
- or else Is_Atomic (Comp))
- then
- null;
-
- -- Give an error if the components are aliased
-
- elsif Has_Aliased_Components (Typ)
- or else Is_Aliased (Comp)
- then
- raise Aliased_Subcomponent;
-
- -- For VFA we accept non-aliased VFA subcomponents
-
- elsif VFA
- and then Is_Volatile_Full_Access (Comp)
- then
- null;
-
- -- Give an error if the components are independent
-
- elsif Has_Independent_Components (Typ)
- or else Is_Independent (Comp)
- then
- raise Independent_Subcomponent;
- end if;
-
- -- Recurse on the component type
-
- Check_Subcomponents (Comp);
-
- -- Note: Has_Aliased_Components, like Has_Atomic_Components,
- -- and Has_Independent_Components, applies only to arrays.
- -- However, this flag does not have a corresponding pragma, so
- -- perhaps it should be possible to apply it to record types as
- -- well. Should this be done ???
-
- elsif Is_Record_Type (Typ) then
- -- It is possible to have an aliased discriminant, so they
- -- must be checked along with normal components.
-
- Comp := First_Component_Or_Discriminant (Typ);
- while Present (Comp) loop
-
- -- For Atomic we accept any atomic subcomponents
-
- if not VFA
- and then (Is_Atomic (Comp)
- or else Is_Atomic (Etype (Comp)))
- then
- null;
-
- -- Give an error if the component is aliased
-
- elsif Is_Aliased (Comp)
- or else Is_Aliased (Etype (Comp))
- then
- raise Aliased_Subcomponent;
-
- -- For VFA we accept non-aliased VFA subcomponents
-
- elsif VFA
- and then (Is_Volatile_Full_Access (Comp)
- or else Is_Volatile_Full_Access (Etype (Comp)))
- then
- null;
-
- -- Give an error if the component is independent
-
- elsif Is_Independent (Comp)
- or else Is_Independent (Etype (Comp))
- then
- raise Independent_Subcomponent;
- end if;
-
- -- Recurse on the component type
-
- Check_Subcomponents (Etype (Comp));
-
- Next_Component_Or_Discriminant (Comp);
- end loop;
- end if;
- end Check_Subcomponents;
-
- Typ : Entity_Id;
-
- begin
- -- Fetch the type in case we are dealing with an object or component
-
- if Is_Type (E) then
- Typ := E;
- else
- pragma Assert (Is_Object (E)
- or else
- Nkind (Declaration_Node (E)) = N_Component_Declaration);
-
- Typ := Etype (E);
- end if;
-
- -- Check all the subcomponents of the type recursively, if any
-
- Check_Subcomponents (Typ);
-
- exception
- when Aliased_Subcomponent =>
- if VFA then
- Error_Pragma
- ("cannot apply Volatile_Full_Access with aliased "
- & "subcomponent ");
- else
- Error_Pragma
- ("cannot apply Atomic with aliased subcomponent "
- & "(RM C.6(13))");
- end if;
-
- when Independent_Subcomponent =>
- if VFA then
- Error_Pragma
- ("cannot apply Volatile_Full_Access with independent "
- & "subcomponent ");
- else
- Error_Pragma
- ("cannot apply Atomic with independent subcomponent "
- & "(RM C.6(13))");
- end if;
-
- when others =>
- raise Program_Error;
- end Check_Atomic_VFA;
-
---------------------
-- Check_Component --
---------------------
@@ -7367,8 +7212,9 @@ package body Sem_Prag is
------------------------------------------------
procedure Process_Atomic_Independent_Shared_Volatile is
- procedure Check_VFA_Conflicts (Ent : Entity_Id);
- -- Check that Volatile_Full_Access and VFA do not conflict
+ procedure Check_Full_Access_Only (Ent : Entity_Id);
+ -- Apply legality checks to type or object Ent subject to the
+ -- Full_Access_Only aspect in Ada 2020 (RM C.6(8.2)).
procedure Mark_Component_Or_Object (Ent : Entity_Id);
-- Appropriately set flags on the given entity, either an array or
@@ -7385,15 +7231,68 @@ package body Sem_Prag is
-- full access arrays. Note: this is necessary for derived types.
-------------------------
- -- Check_VFA_Conflicts --
+ -- Check_Full_Access_Only --
-------------------------
- procedure Check_VFA_Conflicts (Ent : Entity_Id) is
- Comp : Entity_Id;
+ procedure Check_Full_Access_Only (Ent : Entity_Id) is
Typ : Entity_Id;
- VFA_And_Atomic : Boolean := False;
- -- Set True if both VFA and Atomic present
+ Full_Access_Subcomponent : exception;
+ -- Exception raised if a full access subcomponent is found
+
+ Generic_Type_Subcomponent : exception;
+ -- Exception raised if a subcomponent with generic type is found
+
+ procedure Check_Subcomponents (Typ : Entity_Id);
+ -- Apply checks to subcomponents recursively
+
+ -------------------------
+ -- Check_Subcomponents --
+ -------------------------
+
+ procedure Check_Subcomponents (Typ : Entity_Id) is
+ Comp : Entity_Id;
+
+ begin
+ if Is_Array_Type (Typ) then
+ Comp := Component_Type (Typ);
+
+ if Has_Atomic_Components (Typ)
+ or else Is_Full_Access (Comp)
+ then
+ raise Full_Access_Subcomponent;
+
+ elsif Is_Generic_Type (Comp) then
+ raise Generic_Type_Subcomponent;
+ end if;
+
+ -- Recurse on the component type
+
+ Check_Subcomponents (Comp);
+
+ elsif Is_Record_Type (Typ) then
+ Comp := First_Component_Or_Discriminant (Typ);
+ while Present (Comp) loop
+
+ if Is_Full_Access (Comp)
+ or else Is_Full_Access (Etype (Comp))
+ then
+ raise Full_Access_Subcomponent;
+
+ elsif Is_Generic_Type (Etype (Comp)) then
+ raise Generic_Type_Subcomponent;
+ end if;
+
+ -- Recurse on the component type
+
+ Check_Subcomponents (Etype (Comp));
+
+ Next_Component_Or_Discriminant (Comp);
+ end loop;
+ end if;
+ end Check_Subcomponents;
+
+ -- Start of processing for Check_Full_Access_Only
begin
-- Fetch the type in case we are dealing with an object or
@@ -7409,49 +7308,29 @@ package body Sem_Prag is
Typ := Etype (Ent);
end if;
- -- Check Atomic and VFA used together
-
- if Prag_Id = Pragma_Volatile_Full_Access
- or else Is_Volatile_Full_Access (Ent)
- then
- if Prag_Id = Pragma_Atomic
- or else Prag_Id = Pragma_Shared
- or else Is_Atomic (Ent)
- then
- VFA_And_Atomic := True;
-
- elsif Is_Array_Type (Typ) then
- VFA_And_Atomic := Has_Atomic_Components (Typ);
+ if not Is_Volatile (Ent) and then not Is_Volatile (Typ) then
+ Error_Pragma
+ ("cannot have Full_Access_Only without Volatile/Atomic "
+ & "(RM C.6(8.2))");
+ return;
+ end if;
- -- Note: Has_Atomic_Components is not used below, as this flag
- -- represents the pragma of the same name, Atomic_Components,
- -- which only applies to arrays.
+ -- Check all the subcomponents of the type recursively, if any
- elsif Is_Record_Type (Typ) then
- -- Attributes cannot be applied to discriminants, only
- -- regular record components.
-
- Comp := First_Component (Typ);
- while Present (Comp) loop
- if Is_Atomic (Comp)
- or else Is_Atomic (Typ)
- then
- VFA_And_Atomic := True;
+ Check_Subcomponents (Typ);
- exit;
- end if;
+ exception
+ when Full_Access_Subcomponent =>
+ Error_Pragma
+ ("cannot have Full_Access_Only with full access subcomponent "
+ & "(RM C.6(8.2))");
- Next_Component (Comp);
- end loop;
- end if;
+ when Generic_Type_Subcomponent =>
+ Error_Pragma
+ ("cannot have Full_Access_Only with subcomponent of generic "
+ & "type (RM C.6(8.2))");
- if VFA_And_Atomic then
- Error_Pragma
- ("cannot have Volatile_Full_Access and Atomic for same "
- & "entity");
- end if;
- end if;
- end Check_VFA_Conflicts;
+ end Check_Full_Access_Only;
------------------------------
-- Mark_Component_Or_Object --
@@ -7607,6 +7486,7 @@ package body Sem_Prag is
end if;
E := Entity (E_Arg);
+ Decl := Declaration_Node (E);
-- A pragma that applies to a Ghost entity becomes Ghost for the
-- purposes of legality checks and removal of ignored Ghost code.
@@ -7617,9 +7497,43 @@ package body Sem_Prag is
Check_Duplicate_Pragma (E);
- -- Check appropriateness of the entity
+ -- Check the constraints of Full_Access_Only in Ada 2020. Note that
+ -- they do not apply to GNAT's Volatile_Full_Access because 1) this
+ -- aspect subsumes the Volatile aspect and 2) nesting is supported
+ -- for this aspect and the outermost enclosing VFA object prevails.
- Decl := Declaration_Node (E);
+ -- Note also that we used to forbid specifying both Atomic and VFA on
+ -- the same type or object, but the restriction has been lifted in
+ -- light of the semantics of Full_Access_Only and Atomic in Ada 2020.
+
+ if Prag_Id = Pragma_Volatile_Full_Access
+ and then From_Aspect_Specification (N)
+ and then
+ Get_Aspect_Id (Corresponding_Aspect (N)) = Aspect_Full_Access_Only
+ then
+ Check_Full_Access_Only (E);
+ end if;
+
+ -- The following check is only relevant when SPARK_Mode is on as
+ -- this is not a standard Ada legality rule. Pragma Volatile can
+ -- only apply to a full type declaration or an object declaration
+ -- (SPARK RM 7.1.3(2)). Original_Node is necessary to account for
+ -- untagged derived types that are rewritten as subtypes of their
+ -- respective root types.
+
+ if SPARK_Mode = On
+ and then Prag_Id = Pragma_Volatile
+ and then Nkind (Original_Node (Decl)) not in
+ N_Full_Type_Declaration |
+ N_Formal_Type_Declaration |
+ N_Object_Declaration |
+ N_Single_Protected_Declaration |
+ N_Single_Task_Declaration
+ then
+ Error_Pragma_Arg
+ ("argument of pragma % must denote a full type or object "
+ & "declaration", Arg1);
+ end if;
-- Deal with the case where the pragma/attribute is applied to a type
@@ -7652,41 +7566,6 @@ package body Sem_Prag is
else
Error_Pragma_Arg ("inappropriate entity for pragma%", Arg1);
end if;
-
- -- Check that Volatile_Full_Access and Atomic do not conflict
-
- Check_VFA_Conflicts (E);
-
- -- Check for the application of Atomic or Volatile_Full_Access to
- -- an entity that has [nonatomic] aliased, or else specified to be
- -- independently addressable, subcomponents.
-
- if (Prag_Id = Pragma_Atomic and then Ada_Version >= Ada_2020)
- or else Prag_Id = Pragma_Volatile_Full_Access
- then
- Check_Atomic_VFA (E, VFA => Prag_Id = Pragma_Volatile_Full_Access);
- end if;
-
- -- The following check is only relevant when SPARK_Mode is on as
- -- this is not a standard Ada legality rule. Pragma Volatile can
- -- only apply to a full type declaration or an object declaration
- -- (SPARK RM 7.1.3(2)). Original_Node is necessary to account for
- -- untagged derived types that are rewritten as subtypes of their
- -- respective root types.
-
- if SPARK_Mode = On
- and then Prag_Id = Pragma_Volatile
- and then Nkind (Original_Node (Decl)) not in
- N_Full_Type_Declaration |
- N_Formal_Type_Declaration |
- N_Object_Declaration |
- N_Single_Protected_Declaration |
- N_Single_Task_Declaration
- then
- Error_Pragma_Arg
- ("argument of pragma % must denote a full type or object "
- & "declaration", Arg1);
- end if;
end Process_Atomic_Independent_Shared_Volatile;
-------------------------------------------
@@ -8268,8 +8147,13 @@ package body Sem_Prag is
-- Accept Intrinsic Export on types if Relaxed_RM_Semantics
if not (Is_Type (E) and then Relaxed_RM_Semantics) then
- Error_Pragma_Arg
- ("second argument of pragma% must be a subprogram", Arg2);
+ if From_Aspect_Specification (N) then
+ Error_Pragma_Arg
+ ("entity for aspect% must be a subprogram", Arg2);
+ else
+ Error_Pragma_Arg
+ ("second argument of pragma% must be a subprogram", Arg2);
+ end if;
end if;
-- Special checks for C_Variadic_n
@@ -9541,10 +9425,17 @@ package body Sem_Prag is
Process_Import_Predefined_Type;
else
- Error_Pragma_Arg
- ("second argument of pragma% must be object, subprogram "
- & "or incomplete type",
- Arg2);
+ if From_Aspect_Specification (N) then
+ Error_Pragma_Arg
+ ("entity for aspect% must be object, subprogram "
+ & "or incomplete type",
+ Arg2);
+ else
+ Error_Pragma_Arg
+ ("second argument of pragma% must be object, subprogram "
+ & "or incomplete type",
+ Arg2);
+ end if;
end if;
-- If this pragma applies to a compilation unit, then the unit, which
@@ -13575,11 +13466,6 @@ package body Sem_Prag is
-- Atomic implies both Independent and Volatile
if Prag_Id = Pragma_Atomic_Components then
- if Ada_Version >= Ada_2020 then
- Check_Atomic_VFA
- (Component_Type (Etype (E)), VFA => False);
- end if;
-
Set_Has_Atomic_Components (E);
Set_Has_Independent_Components (E);
end if;
@@ -14774,16 +14660,17 @@ package body Sem_Prag is
function Is_Acceptable_Dim3 (N : Node_Id) return Boolean;
-- Returns True if N is an acceptable argument for CUDA_Execute,
- -- false otherwise.
+ -- False otherwise.
------------------------
-- Is_Acceptable_Dim3 --
------------------------
function Is_Acceptable_Dim3 (N : Node_Id) return Boolean is
- Tmp : Node_Id;
+ Expr : Node_Id;
begin
- if Etype (N) = RTE (RE_Dim3) or else Is_Integer_Type (Etype (N))
+ if Is_RTE (Etype (N), RE_Dim3)
+ or else Is_Integer_Type (Etype (N))
then
return True;
end if;
@@ -14791,10 +14678,10 @@ package body Sem_Prag is
if Nkind (N) = N_Aggregate
and then List_Length (Expressions (N)) = 3
then
- Tmp := First (Expressions (N));
- while Present (Tmp) loop
- Analyze_And_Resolve (Tmp, Any_Integer);
- Tmp := Next (Tmp);
+ Expr := First (Expressions (N));
+ while Present (Expr) loop
+ Analyze_And_Resolve (Expr, Any_Integer);
+ Next (Expr);
end loop;
return True;
end if;
@@ -14813,7 +14700,6 @@ package body Sem_Prag is
-- Start of processing for CUDA_Execute
begin
-
GNAT_Pragma;
Check_At_Least_N_Arguments (3);
Check_At_Most_N_Arguments (5);
@@ -14891,6 +14777,7 @@ package body Sem_Prag is
else
Set_Is_CUDA_Kernel (Kernel_Proc);
+ Add_CUDA_Kernel (Pack_Id, Kernel_Proc);
end if;
end CUDA_Global;
@@ -15314,7 +15201,7 @@ package body Sem_Prag is
-- Default_Storage_Pool --
--------------------------
- -- pragma Default_Storage_Pool (storage_pool_NAME | null);
+ -- pragma Default_Storage_Pool (storage_pool_NAME | null | Standard);
when Pragma_Default_Storage_Pool => Default_Storage_Pool : declare
Pool : Node_Id;
@@ -15355,6 +15242,18 @@ package body Sem_Prag is
Set_Etype (Pool, Empty);
+ -- Case of Default_Storage_Pool (Standard);
+
+ elsif Nkind (Pool) = N_Identifier
+ and then Chars (Pool) = Name_Standard
+ then
+ Analyze (Pool);
+
+ if Entity (Pool) /= Standard_Standard then
+ Error_Pragma_Arg
+ ("package Standard is not directly visible", Arg1);
+ end if;
+
-- Case of Default_Storage_Pool (storage_pool_NAME);
else
@@ -15362,7 +15261,7 @@ package body Sem_Prag is
-- argument is "null".
if Is_Configuration_Pragma then
- Error_Pragma_Arg ("NULL expected", Arg1);
+ Error_Pragma_Arg ("NULL or Standard expected", Arg1);
end if;
-- The expected type for a non-"null" argument is
@@ -17008,7 +16907,7 @@ package body Sem_Prag is
return;
end if;
- -- Otherwie the expression is not static
+ -- Otherwise the expression is not static
else
Error_Pragma_Arg
@@ -17792,15 +17691,17 @@ package body Sem_Prag is
-- Short_Float
-- | Float
-- | Long_Float
- -- | Long_Long_Flat
+ -- | Long_Long_Float
-- | Signed_8
-- | Signed_16
-- | Signed_32
-- | Signed_64
+ -- | Signed_128
-- | Unsigned_8
-- | Unsigned_16
-- | Unsigned_32
-- | Unsigned_64
+ -- | Unsigned_128
when Pragma_Initialize_Scalars => Do_Initialize_Scalars : declare
Seen : array (Scalar_Id) of Node_Id := (others => Empty);
@@ -17853,7 +17754,14 @@ package body Sem_Prag is
begin
Analyze_And_Resolve (Val_Expr, Any_Integer);
- if Is_OK_Static_Expression (Val_Expr) then
+ if (Scal_Typ = Name_Signed_128
+ or else Scal_Typ = Name_Unsigned_128)
+ and then Ttypes.System_Max_Integer_Size < 128
+ then
+ Error_Msg_Name_1 := Scal_Typ;
+ Error_Msg_N ("value cannot be set for type %", Val_Expr);
+
+ elsif Is_OK_Static_Expression (Val_Expr) then
Set_Invalid_Scalar_Value (Scal_Typ, Expr_Value (Val_Expr));
else
@@ -21041,19 +20949,6 @@ package body Sem_Prag is
Map_Pragma_Name (From => Chars (New_Name), To => Chars (Old_Name));
end Rename_Pragma;
- -------------
- -- Polling --
- -------------
-
- -- pragma Polling (ON | OFF);
-
- when Pragma_Polling =>
- GNAT_Pragma;
- Check_Arg_Count (1);
- Check_No_Identifiers;
- Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off);
- Polling_Required := (Chars (Get_Pragma_Arg (Arg1)) = Name_On);
-
-----------------------------------
-- Post/Post_Class/Postcondition --
-----------------------------------
@@ -21201,9 +21096,7 @@ package body Sem_Prag is
Set_Has_Delayed_Freeze (Typ);
Set_Predicates_Ignored (Typ,
- Present (Check_Policy_List)
- and then
- Policy_In_Effect (Name_Dynamic_Predicate) = Name_Ignore);
+ Policy_In_Effect (Name_Dynamic_Predicate) = Name_Ignore);
Discard := Rep_Item_Too_Late (Typ, N, FOnly => True);
end Predicate;
@@ -23709,6 +23602,9 @@ package body Sem_Prag is
Error_Pragma_Arg
("argument for pragma% must be function of one argument",
Arg);
+ elsif Is_Abstract_Subprogram (Ent) then
+ Error_Pragma_Arg
+ ("argument for pragma% cannot be abstract", Arg);
end if;
end Check_OK_Stream_Convert_Function;
@@ -23895,6 +23791,139 @@ package body Sem_Prag is
end if;
end Style_Checks;
+ ------------------------
+ -- Subprogram_Variant --
+ ------------------------
+
+ -- pragma Subprogram_Variant ( SUBPROGRAM_VARIANT_ITEM
+ -- {, SUBPROGRAM_VARIANT_ITEM } );
+
+ -- SUBPROGRAM_VARIANT_ITEM ::=
+ -- CHANGE_DIRECTION => discrete_EXPRESSION
+
+ -- CHANGE_DIRECTION ::= Increases | Decreases
+
+ -- Characteristics:
+
+ -- * Analysis - The annotation undergoes initial checks to verify
+ -- the legal placement and context. Secondary checks preanalyze the
+ -- expressions in:
+
+ -- Analyze_Subprogram_Variant_In_Decl_Part
+
+ -- * Expansion - The annotation is expanded during the expansion of
+ -- the related subprogram [body] contract as performed in:
+
+ -- Expand_Subprogram_Contract
+
+ -- * Template - The annotation utilizes the generic template of the
+ -- related subprogram [body] when it is:
+
+ -- aspect on subprogram declaration
+ -- aspect on stand-alone subprogram body
+ -- pragma on stand-alone subprogram body
+
+ -- The annotation must prepare its own template when it is:
+
+ -- pragma on subprogram declaration
+
+ -- * Globals - Capture of global references must occur after full
+ -- analysis.
+
+ -- * Instance - The annotation is instantiated automatically when
+ -- the related generic subprogram [body] is instantiated except for
+ -- the "pragma on subprogram declaration" case. In that scenario
+ -- the annotation must instantiate itself.
+
+ when Pragma_Subprogram_Variant => Subprogram_Variant : declare
+ Spec_Id : Entity_Id;
+ Subp_Decl : Node_Id;
+ Subp_Spec : Node_Id;
+
+ begin
+ GNAT_Pragma;
+ Check_No_Identifiers;
+ Check_Arg_Count (1);
+
+ -- Ensure the proper placement of the pragma. Subprogram_Variant
+ -- must be associated with a subprogram declaration or a body that
+ -- acts as a spec.
+
+ Subp_Decl :=
+ Find_Related_Declaration_Or_Body (N, Do_Checks => True);
+
+ -- Generic subprogram
+
+ if Nkind (Subp_Decl) = N_Generic_Subprogram_Declaration then
+ null;
+
+ -- Body acts as spec
+
+ elsif Nkind (Subp_Decl) = N_Subprogram_Body
+ and then No (Corresponding_Spec (Subp_Decl))
+ then
+ null;
+
+ -- Body stub acts as spec
+
+ elsif Nkind (Subp_Decl) = N_Subprogram_Body_Stub
+ and then No (Corresponding_Spec_Of_Stub (Subp_Decl))
+ then
+ null;
+
+ -- Subprogram
+
+ elsif Nkind (Subp_Decl) = N_Subprogram_Declaration then
+ Subp_Spec := Specification (Subp_Decl);
+
+ -- Pragma Subprogram_Variant is forbidden on null procedures,
+ -- as this may lead to potential ambiguities in behavior when
+ -- interface null procedures are involved. Also, it just
+ -- wouldn't make sense, because null procedure is not
+ -- recursive.
+
+ if Nkind (Subp_Spec) = N_Procedure_Specification
+ and then Null_Present (Subp_Spec)
+ then
+ Error_Msg_N (Fix_Error
+ ("pragma % cannot apply to null procedure"), N);
+ return;
+ end if;
+
+ else
+ Pragma_Misplaced;
+ return;
+ end if;
+
+ Spec_Id := Unique_Defining_Entity (Subp_Decl);
+
+ -- A pragma that applies to a Ghost entity becomes Ghost for the
+ -- purposes of legality checks and removal of ignored Ghost code.
+
+ Mark_Ghost_Pragma (N, Spec_Id);
+ Ensure_Aggregate_Form (Get_Argument (N, Spec_Id));
+
+ -- Chain the pragma on the contract for further processing by
+ -- Analyze_Subprogram_Variant_In_Decl_Part.
+
+ Add_Contract_Item (N, Defining_Entity (Subp_Decl));
+
+ -- Fully analyze the pragma when it appears inside a subprogram
+ -- body because it cannot benefit from forward references.
+
+ if Nkind (Subp_Decl) in N_Subprogram_Body
+ | N_Subprogram_Body_Stub
+ then
+ -- The legality checks of pragma Subprogram_Variant are
+ -- affected by the SPARK mode in effect and the volatility
+ -- of the context. Analyze all pragmas in a specific order.
+
+ Analyze_If_Present (Pragma_SPARK_Mode);
+ Analyze_If_Present (Pragma_Volatile_Function);
+ Analyze_Subprogram_Variant_In_Decl_Part (N);
+ end if;
+ end Subprogram_Variant;
+
--------------
-- Subtitle --
--------------
@@ -28915,6 +28944,156 @@ package body Sem_Prag is
Set_Is_Analyzed_Pragma (N);
end Analyze_Refined_State_In_Decl_Part;
+ ---------------------------------------------
+ -- Analyze_Subprogram_Variant_In_Decl_Part --
+ ---------------------------------------------
+
+ -- WARNING: This routine manages Ghost regions. Return statements must be
+ -- replaced by gotos which jump to the end of the routine and restore the
+ -- Ghost mode.
+
+ procedure Analyze_Subprogram_Variant_In_Decl_Part
+ (N : Node_Id;
+ Freeze_Id : Entity_Id := Empty)
+ is
+ Subp_Decl : constant Node_Id := Find_Related_Declaration_Or_Body (N);
+ Spec_Id : constant Entity_Id := Unique_Defining_Entity (Subp_Decl);
+
+ procedure Analyze_Variant (Variant : Node_Id);
+ -- Verify the legality of a single contract case
+
+ ---------------------
+ -- Analyze_Variant --
+ ---------------------
+
+ procedure Analyze_Variant (Variant : Node_Id) is
+ Direction : Node_Id;
+ Expr : Node_Id;
+ Errors : Nat;
+ Extra_Direction : Node_Id;
+
+ begin
+ if Nkind (Variant) /= N_Component_Association then
+ Error_Msg_N ("wrong syntax in subprogram variant", Variant);
+ return;
+ end if;
+
+ Direction := First (Choices (Variant));
+ Expr := Expression (Variant);
+
+ -- Each variant must have exactly one direction
+
+ Extra_Direction := Next (Direction);
+
+ if Present (Extra_Direction) then
+ Error_Msg_N
+ ("subprogram variant case must have exactly one direction",
+ Extra_Direction);
+ end if;
+
+ -- Check placement of OTHERS if available (SPARK RM 6.1.3(1))
+
+ if Nkind (Direction) = N_Identifier then
+ if Chars (Direction) /= Name_Decreases
+ and then
+ Chars (Direction) /= Name_Increases
+ then
+ Error_Msg_N ("wrong direction", Direction);
+ end if;
+ else
+ Error_Msg_N ("wrong syntax", Direction);
+ end if;
+
+ Errors := Serious_Errors_Detected;
+ Preanalyze_Assert_Expression (Expr, Any_Discrete);
+
+ -- Emit a clarification message when the variant expression
+ -- contains at least one undefined reference, possibly due
+ -- to contract freezing.
+
+ if Errors /= Serious_Errors_Detected
+ and then Present (Freeze_Id)
+ and then Has_Undefined_Reference (Expr)
+ then
+ Contract_Freeze_Error (Spec_Id, Freeze_Id);
+ end if;
+ end Analyze_Variant;
+
+ -- Local variables
+
+ Variants : constant Node_Id := Expression (Get_Argument (N, Spec_Id));
+
+ Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
+ Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ -- Save the Ghost-related attributes to restore on exit
+
+ Variant : Node_Id;
+ Restore_Scope : Boolean := False;
+
+ -- Start of processing for Analyze_Subprogram_Variant_In_Decl_Part
+
+ begin
+ -- Do not analyze the pragma multiple times
+
+ if Is_Analyzed_Pragma (N) then
+ return;
+ end if;
+
+ -- Set the Ghost mode in effect from the pragma. Due to the delayed
+ -- analysis of the pragma, the Ghost mode at point of declaration and
+ -- point of analysis may not necessarily be the same. Use the mode in
+ -- effect at the point of declaration.
+
+ Set_Ghost_Mode (N);
+
+ -- Single and multiple contract cases must appear in aggregate form. If
+ -- this is not the case, then either the parser of the analysis of the
+ -- pragma failed to produce an aggregate.
+
+ pragma Assert (Nkind (Variants) = N_Aggregate);
+
+ -- Only "change_direction => discrete_expression" clauses are allowed
+
+ if Present (Component_Associations (Variants))
+ and then No (Expressions (Variants))
+ then
+
+ -- Ensure that the formal parameters are visible when analyzing all
+ -- clauses. This falls out of the general rule of aspects pertaining
+ -- to subprogram declarations.
+
+ if not In_Open_Scopes (Spec_Id) then
+ Restore_Scope := True;
+ Push_Scope (Spec_Id);
+
+ if Is_Generic_Subprogram (Spec_Id) then
+ Install_Generic_Formals (Spec_Id);
+ else
+ Install_Formals (Spec_Id);
+ end if;
+ end if;
+
+ Variant := First (Component_Associations (Variants));
+ while Present (Variant) loop
+ Analyze_Variant (Variant);
+ Next (Variant);
+ end loop;
+
+ if Restore_Scope then
+ End_Scope;
+ end if;
+
+ -- Otherwise the pragma is illegal
+
+ else
+ Error_Msg_N ("wrong syntax for subprogram variant", N);
+ end if;
+
+ Set_Is_Analyzed_Pragma (N);
+
+ Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ end Analyze_Subprogram_Variant_In_Decl_Part;
+
------------------------------------
-- Analyze_Test_Case_In_Decl_Part --
------------------------------------
@@ -29295,44 +29474,38 @@ package body Sem_Prag is
ER : Boolean;
EW : Boolean)
is
- begin
- -- All properties enabled
-
- if AR and AW and ER and EW then
- null;
-
- -- Async_Readers + Effective_Writes
- -- Async_Readers + Async_Writers + Effective_Writes
-
- elsif AR and EW and not ER then
- null;
-
- -- Async_Writers + Effective_Reads
- -- Async_Readers + Async_Writers + Effective_Reads
-
- elsif AW and ER and not EW then
- null;
+ type Properties is array (Positive range 1 .. 4) of Boolean;
+ type Combinations is array (Positive range <>) of Properties;
+ -- Arrays of Async_Readers, Async_Writers, Effective_Writes and
+ -- Effective_Reads properties and their combinations, respectively.
+
+ Specified : constant Properties := (AR, AW, EW, ER);
+ -- External properties, as given by the Item pragma
+
+ Allowed : constant Combinations :=
+ (1 => (True, False, True, False),
+ 2 => (False, True, False, True),
+ 3 => (True, False, False, False),
+ 4 => (False, True, False, False),
+ 5 => (True, True, True, False),
+ 6 => (True, True, False, True),
+ 7 => (True, True, False, False),
+ 8 => (True, True, True, True));
+ -- Allowed combinations, as listed in the SPARK RM 7.1.2(6) table
- -- Async_Readers + Async_Writers
-
- elsif AR and AW and not ER and not EW then
- null;
-
- -- Async_Readers
-
- elsif AR and not AW and not ER and not EW then
- null;
-
- -- Async_Writers
+ begin
+ -- Check if the specified properties match any of the allowed
+ -- combination; if not, then emit an error.
- elsif AW and not AR and not ER and not EW then
- null;
+ for J in Allowed'Range loop
+ if Specified = Allowed (J) then
+ return;
+ end if;
+ end loop;
- else
- SPARK_Msg_N
- ("illegal combination of external properties (SPARK RM 7.1.2(6))",
- Item);
- end if;
+ SPARK_Msg_N
+ ("illegal combination of external properties (SPARK RM 7.1.2(6))",
+ Item);
end Check_External_Properties;
----------------
@@ -30928,7 +31101,6 @@ package body Sem_Prag is
Pragma_Partition_Elaboration_Policy => 0,
Pragma_Passive => 0,
Pragma_Persistent_BSS => 0,
- Pragma_Polling => 0,
Pragma_Post => -1,
Pragma_Postcondition => -1,
Pragma_Post_Class => -1,
@@ -30981,6 +31153,7 @@ package body Sem_Prag is
Pragma_Storage_Unit => 0,
Pragma_Stream_Convert => 0,
Pragma_Style_Checks => 0,
+ Pragma_Subprogram_Variant => -1,
Pragma_Subtitle => 0,
Pragma_Suppress => 0,
Pragma_Suppress_All => 0,
@@ -31272,6 +31445,7 @@ package body Sem_Prag is
| Name_Predicate
| Name_Refined_Post
| Name_Statement_Assertions
+ | Name_Subprogram_Variant
=>
return True;
diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads
index 460fc9c..fd7a0cd 100644
--- a/gcc/ada/sem_prag.ads
+++ b/gcc/ada/sem_prag.ads
@@ -265,6 +265,13 @@ package Sem_Prag is
-- the entity of [generic] package body or [generic] subprogram body which
-- caused "freezing" of the related contract where the pragma resides.
+ procedure Analyze_Subprogram_Variant_In_Decl_Part
+ (N : Node_Id;
+ Freeze_Id : Entity_Id := Empty);
+ -- Perform full analysis of delayed pragma Subprogram_Variant. Freeze_Id is
+ -- the entity of [generic] package body or [generic] subprogram body which
+ -- caused "freezing" of the related contract where the pragma resides.
+
procedure Analyze_Test_Case_In_Decl_Part (N : Node_Id);
-- Perform preanalysis of pragma Test_Case
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 50a4287..a24c9c2 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -2097,7 +2097,8 @@ package body Sem_Res is
then
Error_Msg_NE ("ambiguous call to&", Arg, Name (Arg));
- -- Could use comments on what is going on here???
+ -- Examine possible interpretations, and adapt the message
+ -- for inherited subprograms declared by a type derivation.
Get_First_Interp (Name (Arg), I, It);
while Present (It.Nam) loop
@@ -2112,6 +2113,11 @@ package body Sem_Res is
Get_Next_Interp (I, It);
end loop;
end if;
+
+ -- Additional message and hint if the ambiguity involves an Ada2020
+ -- container aggregate.
+
+ Check_Ambiguous_Aggregate (N);
end Report_Ambiguous_Argument;
-----------------------
@@ -3428,7 +3434,7 @@ package body Sem_Res is
procedure Flag_Effectively_Volatile_Objects (Expr : Node_Id);
-- Emit an error concerning the illegal usage of an effectively volatile
- -- object in interfering context (SPARK RM 7.1.3(10)).
+ -- object for reading in interfering context (SPARK RM 7.1.3(10)).
procedure Insert_Default;
-- If the actual is missing in a call, insert in the actuals list
@@ -3473,13 +3479,13 @@ package body Sem_Res is
elsif Has_Discriminants (F_Typ)
and then not Is_Constrained (F_Typ)
- and then not Has_Constrained_Partial_View (F_Typ)
- and then not Is_Generic_Type (F_Typ)
+ and then not Object_Type_Has_Constrained_Partial_View
+ (Typ => F_Typ, Scop => Current_Scope)
then
null;
else
- Error_Msg_NE ("untagged actual does not match "
+ Error_Msg_NE ("untagged actual does not statically match "
& "aliased formal&", A, F);
end if;
@@ -3493,16 +3499,16 @@ package body Sem_Res is
elsif Ekind (Etype (Nam)) = E_Anonymous_Access_Type then
if Nkind (Parent (N)) = N_Type_Conversion
- and then Type_Access_Level (Etype (Parent (N))) <
- Object_Access_Level (A)
+ and then Type_Access_Level (Etype (Parent (N)))
+ < Static_Accessibility_Level (A, Object_Decl_Level)
then
Error_Msg_N ("aliased actual has wrong accessibility", A);
end if;
elsif Nkind (Parent (N)) = N_Qualified_Expression
and then Nkind (Parent (Parent (N))) = N_Allocator
- and then Type_Access_Level (Etype (Parent (Parent (N)))) <
- Object_Access_Level (A)
+ and then Type_Access_Level (Etype (Parent (Parent (N))))
+ < Static_Accessibility_Level (A, Object_Decl_Level)
then
Error_Msg_N
("aliased actual in allocator has wrong accessibility", A);
@@ -3687,7 +3693,7 @@ package body Sem_Res is
procedure Flag_Effectively_Volatile_Objects (Expr : Node_Id) is
function Flag_Object (N : Node_Id) return Traverse_Result;
-- Determine whether arbitrary node N denotes an effectively volatile
- -- object and if it does, emit an error.
+ -- object for reading and if it does, emit an error.
-----------------
-- Flag_Object --
@@ -3707,9 +3713,7 @@ package body Sem_Res is
Id := Entity (N);
if Is_Object (Id)
- and then Is_Effectively_Volatile (Id)
- and then (Async_Writers_Enabled (Id)
- or else Effective_Reads_Enabled (Id))
+ and then Is_Effectively_Volatile_For_Reading (Id)
then
Error_Msg_N
("volatile object cannot appear in this context (SPARK "
@@ -4145,11 +4149,11 @@ package body Sem_Res is
-- types.
if Is_By_Reference_Type (Etype (F))
- or else Is_By_Reference_Type (Expr_Typ)
+ or else Is_By_Reference_Type (Expr_Typ)
then
Error_Msg_N
("view conversion between unrelated by reference "
- & "array types not allowed (\'A'I-00246)", A);
+ & "array types not allowed ('A'I-00246)", A);
-- In Ada 2005 mode, check view conversion component
-- type cannot be private, tagged, or volatile. Note
@@ -4722,7 +4726,7 @@ package body Sem_Res is
end if;
end if;
- -- Check illegal cases of atomic/volatile actual (RM C.6(12,13))
+ -- Check illegal cases of atomic/volatile/VFA actual (RM C.6(12))
if (Is_By_Reference_Type (Etype (F)) or else Is_Aliased (F))
and then Comes_From_Source (N)
@@ -4744,17 +4748,29 @@ package body Sem_Res is
A, F);
Error_Msg_N
("\which is passed by reference (RM C.6(12))", A);
+
+ elsif Is_Volatile_Full_Access_Object (A)
+ and then not Is_Volatile_Full_Access (Etype (F))
+ then
+ Error_Msg_NE
+ ("cannot pass full access object to nonfull access "
+ & "formal&", A, F);
+ Error_Msg_N
+ ("\which is passed by reference (RM C.6(12))", A);
end if;
+ -- Check for nonatomic subcomponent of a full access object
+ -- in Ada 2020 (RM C.6 (12)).
+
if Ada_Version >= Ada_2020
- and then Is_Subcomponent_Of_Atomic_Object (A)
+ and then Is_Subcomponent_Of_Full_Access_Object (A)
and then not Is_Atomic_Object (A)
then
Error_Msg_N
- ("cannot pass nonatomic subcomponent of atomic object",
- A);
+ ("cannot pass nonatomic subcomponent of full access "
+ & "object", A);
Error_Msg_NE
- ("\to formal & which is passed by reference (RM C.6(13))",
+ ("\to formal & which is passed by reference (RM C.6(12))",
A, F);
end if;
end if;
@@ -4876,17 +4892,17 @@ package body Sem_Res is
if SPARK_Mode = On and then Comes_From_Source (A) then
- -- An effectively volatile object may act as an actual when the
- -- corresponding formal is of a non-scalar effectively volatile
- -- type (SPARK RM 7.1.3(10)).
+ -- An effectively volatile object for reading may act as an
+ -- actual when the corresponding formal is of a non-scalar
+ -- effectively volatile type for reading (SPARK RM 7.1.3(10)).
if not Is_Scalar_Type (Etype (F))
- and then Is_Effectively_Volatile (Etype (F))
+ and then Is_Effectively_Volatile_For_Reading (Etype (F))
then
null;
- -- An effectively volatile object may act as an actual in a
- -- call to an instance of Unchecked_Conversion.
+ -- An effectively volatile object for reading may act as an
+ -- actual in a call to an instance of Unchecked_Conversion.
-- (SPARK RM 7.1.3(10)).
elsif Is_Unchecked_Conversion_Instance (Nam) then
@@ -4894,18 +4910,18 @@ package body Sem_Res is
-- The actual denotes an object
- elsif Is_Effectively_Volatile_Object (A) then
+ elsif Is_Effectively_Volatile_Object_For_Reading (A) then
Error_Msg_N
("volatile object cannot act as actual in a call (SPARK "
& "RM 7.1.3(10))", A);
-- Otherwise the actual denotes an expression. Inspect the
- -- expression and flag each effectively volatile object with
- -- enabled property Async_Writers or Effective_Reads as illegal
- -- because it apprears within an interfering context. Note that
- -- this is usually done in Resolve_Entity_Name, but when the
- -- effectively volatile object appears as an actual in a call,
- -- the call must be resolved first.
+ -- expression and flag each effectively volatile object
+ -- for reading as illegal because it apprears within an
+ -- interfering context. Note that this is usually done in
+ -- Resolve_Entity_Name, but when the effectively volatile
+ -- object for reading appears as an actual in a call, the
+ -- call must be resolved first.
else
Flag_Effectively_Volatile_Objects (A);
@@ -4923,7 +4939,7 @@ package body Sem_Res is
A_Id := Entity (A);
if Ekind (A_Id) = E_Variable
- and then Is_Effectively_Volatile (Etype (A_Id))
+ and then Is_Effectively_Volatile_For_Reading (Etype (A_Id))
and then Effective_Reads_Enabled (A_Id)
then
Error_Msg_NE
@@ -5045,8 +5061,9 @@ package body Sem_Res is
elsif Nkind (Disc_Exp) = N_Attribute_Reference
and then Get_Attribute_Id (Attribute_Name (Disc_Exp)) =
Attribute_Access
- and then Object_Access_Level (Prefix (Disc_Exp)) >
- Deepest_Type_Access_Level (Alloc_Typ)
+ and then Static_Accessibility_Level
+ (Disc_Exp, Zero_On_Dynamic_Level)
+ > Deepest_Type_Access_Level (Alloc_Typ)
then
Error_Msg_N
("prefix of attribute has deeper level than allocator type",
@@ -5057,8 +5074,9 @@ package body Sem_Res is
elsif Ekind (Etype (Disc_Exp)) = E_Anonymous_Access_Type
and then Nkind (Disc_Exp) = N_Selected_Component
- and then Object_Access_Level (Prefix (Disc_Exp)) >
- Deepest_Type_Access_Level (Alloc_Typ)
+ and then Static_Accessibility_Level
+ (Disc_Exp, Zero_On_Dynamic_Level)
+ > Deepest_Type_Access_Level (Alloc_Typ)
then
Error_Msg_N
("access discriminant has deeper level than allocator type",
@@ -6126,27 +6144,6 @@ package body Sem_Res is
------------------
procedure Resolve_Call (N : Node_Id; Typ : Entity_Id) is
- function Same_Or_Aliased_Subprograms
- (S : Entity_Id;
- E : Entity_Id) return Boolean;
- -- Returns True if the subprogram entity S is the same as E or else
- -- S is an alias of E.
-
- ---------------------------------
- -- Same_Or_Aliased_Subprograms --
- ---------------------------------
-
- function Same_Or_Aliased_Subprograms
- (S : Entity_Id;
- E : Entity_Id) return Boolean
- is
- Subp_Alias : constant Entity_Id := Alias (S);
- begin
- return S = E or else (Present (Subp_Alias) and then Subp_Alias = E);
- end Same_Or_Aliased_Subprograms;
-
- -- Local variables
-
Loc : constant Source_Ptr := Sloc (N);
Subp : constant Node_Id := Name (N);
Body_Id : Entity_Id;
@@ -6159,8 +6156,6 @@ package body Sem_Res is
Rtype : Entity_Id;
Scop : Entity_Id;
- -- Start of processing for Resolve_Call
-
begin
-- Preserve relevant elaboration-related attributes of the context which
-- are no longer available or very expensive to recompute once analysis,
@@ -7042,6 +7037,7 @@ package body Sem_Res is
if not Checking_Potentially_Static_Expression
and then Is_Static_Function_Call (N)
+ and then not Is_Intrinsic_Subprogram (Ultimate_Alias (Nam))
and then not Error_Posted (Ultimate_Alias (Nam))
then
Inline_Static_Function_Call (N, Ultimate_Alias (Nam));
@@ -7442,11 +7438,14 @@ package body Sem_Res is
-- Install the scope created for local declarations, if
-- any. The syntax allows a Declare_Expression with no
-- declarations, in analogy with block statements.
+ -- Note that that scope has no explicit declaration, but
+ -- appears as the scope of all entities declared therein.
Decl := First (Actions (N));
while Present (Decl) loop
- exit when Nkind (Decl) = N_Object_Declaration;
+ exit when Nkind (Decl)
+ in N_Object_Declaration | N_Object_Renaming_Declaration;
Next (Decl);
end loop;
@@ -7769,14 +7768,11 @@ package body Sem_Res is
if SPARK_Mode = On then
- -- An effectively volatile object subject to enabled properties
- -- Async_Writers or Effective_Reads must appear in non-interfering
- -- context (SPARK RM 7.1.3(10)).
+ -- An effectively volatile object for reading must appear in
+ -- non-interfering context (SPARK RM 7.1.3(10)).
if Is_Object (E)
- and then Is_Effectively_Volatile (E)
- and then (Async_Writers_Enabled (E)
- or else Effective_Reads_Enabled (E))
+ and then Is_Effectively_Volatile_For_Reading (E)
and then not Is_OK_Volatile_Context (Par, N)
then
SPARK_Msg_N
@@ -11642,12 +11638,12 @@ package body Sem_Res is
-- to apply checks required for a subtype conversion.
-- Skip these type conversion checks if universal fixed operands
- -- operands involved, since range checks are handled separately for
+ -- are involved, since range checks are handled separately for
-- these cases (in the appropriate Expand routines in unit Exp_Fixd).
if Nkind (N) = N_Type_Conversion
and then not Is_Generic_Type (Root_Type (Target_Typ))
- and then Target_Typ /= Universal_Fixed
+ and then Target_Typ /= Universal_Fixed
and then Operand_Typ /= Universal_Fixed
then
Apply_Type_Conversion_Checks (N);
@@ -11887,19 +11883,13 @@ package body Sem_Res is
(N, Target_Typ, Static_Failure_Is_Error => True);
end if;
- -- If at this stage we have a real to integer conversion, make sure that
- -- the Do_Range_Check flag is set, because such conversions in general
- -- need a range check. We only need this if expansion is off.
- -- In GNATprove mode, we only do that when converting from fixed-point
- -- (as floating-point to integer conversions are now handled in
- -- GNATprove mode).
+ -- If at this stage we have a fixed point to integer conversion, make
+ -- sure that the Do_Range_Check flag is set which is not always done
+ -- by exp_fixd.adb.
if Nkind (N) = N_Type_Conversion
- and then not Expander_Active
and then Is_Integer_Type (Target_Typ)
- and then (Is_Fixed_Point_Type (Operand_Typ)
- or else (not GNATprove_Mode
- and then Is_Floating_Point_Type (Operand_Typ)))
+ and then Is_Fixed_Point_Type (Operand_Typ)
and then not Range_Checks_Suppressed (Target_Typ)
and then not Range_Checks_Suppressed (Operand_Typ)
then
@@ -13363,12 +13353,13 @@ package body Sem_Res is
then
-- When the operand is a selected access discriminant the check
-- needs to be made against the level of the object denoted by
- -- the prefix of the selected name (Object_Access_Level handles
+ -- the prefix of the selected name (Accessibility_Level handles
-- checking the prefix of the operand for this case).
if Nkind (Operand) = N_Selected_Component
- and then Object_Access_Level (Operand) >
- Deepest_Type_Access_Level (Target_Type)
+ and then Static_Accessibility_Level
+ (Operand, Zero_On_Dynamic_Level)
+ > Deepest_Type_Access_Level (Target_Type)
then
-- In an instance, this is a run-time check, but one we know
-- will fail, so generate an appropriate warning. The raise
@@ -13452,11 +13443,21 @@ package body Sem_Res is
-- rewritten. The Comes_From_Source test isn't sufficient because
-- nodes in inlined calls to predefined library routines can have
-- Comes_From_Source set to False. (Is there a better way to test
- -- for implicit conversions???)
+ -- for implicit conversions???).
+ --
+ -- Do not treat a rewritten 'Old attribute reference like other
+ -- rewrite substitutions. This makes a difference, for example,
+ -- in the case where we are generating the expansion of a
+ -- membership test of the form
+ -- Saooaaat'Old in Named_Access_Type
+ -- because in this case Valid_Conversion needs to return True
+ -- (otherwise the expansion will be False - see the call site
+ -- in exp_ch4.adb).
if Ada_Version >= Ada_2012
and then not Comes_From_Source (N)
and then Is_Rewrite_Substitution (N)
+ and then not Is_Attribute_Old (Original_Node (N))
and then Ekind (Base_Type (Target_Type)) = E_General_Access_Type
and then Ekind (Opnd_Type) = E_Anonymous_Access_Type
then
@@ -13526,6 +13527,13 @@ package body Sem_Res is
N_Function_Specification
or else Ekind (Target_Type) in
Anonymous_Access_Kind)
+
+ -- Check we are not in a return value ???
+
+ and then (not In_Return_Value (N)
+ or else
+ Nkind (Associated_Node_For_Itype (Target_Type))
+ = N_Component_Declaration)
then
-- In an instance, this is a run-time check, but one we know
-- will fail, so generate an appropriate warning. The raise
@@ -13560,12 +13568,13 @@ package body Sem_Res is
then
-- When the operand is a selected access discriminant the check
-- needs to be made against the level of the object denoted by
- -- the prefix of the selected name (Object_Access_Level handles
+ -- the prefix of the selected name (Accessibility_Level handles
-- checking the prefix of the operand for this case).
if Nkind (Operand) = N_Selected_Component
- and then Object_Access_Level (Operand) >
- Deepest_Type_Access_Level (Target_Type)
+ and then Static_Accessibility_Level
+ (Operand, Zero_On_Dynamic_Level)
+ > Deepest_Type_Access_Level (Target_Type)
then
-- In an instance, this is a run-time check, but one we know
-- will fail, so generate an appropriate warning. The raise
diff --git a/gcc/ada/sem_scil.adb b/gcc/ada/sem_scil.adb
index f8ad56b..56902b0 100644
--- a/gcc/ada/sem_scil.adb
+++ b/gcc/ada/sem_scil.adb
@@ -135,7 +135,7 @@ package body Sem_SCIL is
pragma Assert
(Nkind (N) in
N_Identifier | N_And_Then | N_Or_Else |
- N_Expression_With_Actions
+ N_Expression_With_Actions | N_Function_Call
and then Etype (N) = Standard_Boolean);
-- Check the entity identifier of the associated tagged type (that
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
index a5e62a7..3b1f48e 100644
--- a/gcc/ada/sem_type.adb
+++ b/gcc/ada/sem_type.adb
@@ -1009,6 +1009,15 @@ package body Sem_Type is
elsif T2 = Any_Composite and then Is_Aggregate_Type (T1) then
return True;
+ -- In Ada_2020, an aggregate is compatible with the type that
+ -- as the ccorrespoding aspect.
+
+ elsif Ada_Version >= Ada_2020
+ and then T2 = Any_Composite
+ and then Present (Find_Aspect (T1, Aspect_Aggregate))
+ then
+ return True;
+
-- If the expected type is an anonymous access, the designated type must
-- cover that of the expression. Use the base type for this check: even
-- though access subtypes are rare in sources, they are generated for
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index a80cc5c..0eb4905 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25,13 +25,13 @@
with Treepr; -- ???For debugging code below
-with Aspects; use Aspects;
with Casing; use Casing;
with Checks; use Checks;
with Debug; use Debug;
with Elists; use Elists;
with Errout; use Errout;
with Erroutc; use Erroutc;
+with Exp_Ch3; use Exp_Ch3;
with Exp_Ch11; use Exp_Ch11;
with Exp_Util; use Exp_Util;
with Fname; use Fname;
@@ -49,8 +49,10 @@ with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Attr; use Sem_Attr;
+with Sem_Cat; use Sem_Cat;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
+with Sem_Ch13; use Sem_Ch13;
with Sem_Disp; use Sem_Disp;
with Sem_Elab; use Sem_Elab;
with Sem_Eval; use Sem_Eval;
@@ -116,7 +118,7 @@ package body Sem_Util is
(Item_Id : Entity_Id;
Property : Name_Id) return Boolean;
-- Subsidiary to routines Async_xxx_Enabled and Effective_xxx_Enabled.
- -- Determine whether the state abstraction, variable, or type denoted by
+ -- Determine whether the state abstraction, object, or type denoted by
-- entity Item_Id has enabled property Property.
function Has_Null_Extension (T : Entity_Id) return Boolean;
@@ -127,6 +129,18 @@ package body Sem_Util is
-- Determine whether arbitrary entity Id denotes an atomic object as per
-- RM C.6(7).
+ function Is_Container_Aggregate (Exp : Node_Id) return Boolean;
+ -- Is the given expression a container aggregate?
+
+ generic
+ with function Is_Effectively_Volatile_Entity
+ (Id : Entity_Id) return Boolean;
+ -- Function to use on object and type entities
+ function Is_Effectively_Volatile_Object_Shared
+ (N : Node_Id) return Boolean;
+ -- Shared function used to detect effectively volatile objects and
+ -- effectively volatile objects for reading.
+
function Is_Fully_Initialized_Variant (Typ : Entity_Id) return Boolean;
-- Subsidiary to Is_Fully_Initialized_Type. For an unconstrained type
-- with discriminants whose default values are static, examine only the
@@ -256,6 +270,614 @@ package body Sem_Util is
return Interface_List (Nod);
end Abstract_Interface_List;
+ -------------------------
+ -- Accessibility_Level --
+ -------------------------
+
+ function Accessibility_Level
+ (Expr : Node_Id;
+ Level : Accessibility_Level_Kind;
+ In_Return_Context : Boolean := False) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Expr);
+
+ function Accessibility_Level (Expr : Node_Id) return Node_Id
+ is (Accessibility_Level (Expr, Level, In_Return_Context));
+ -- Renaming of the enclosing function to facilitate recursive calls
+
+ function Make_Level_Literal (Level : Uint) return Node_Id;
+ -- Construct an integer literal representing an accessibility level
+ -- with its type set to Natural.
+
+ function Innermost_Master_Scope_Depth
+ (N : Node_Id) return Uint;
+ -- Returns the scope depth of the given node's innermost
+ -- enclosing dynamic scope (effectively the accessibility
+ -- level of the innermost enclosing master).
+
+ function Function_Call_Or_Allocator_Level
+ (N : Node_Id) return Node_Id;
+ -- Centralized processing of subprogram calls which may appear in
+ -- prefix notation.
+
+ ----------------------------------
+ -- Innermost_Master_Scope_Depth --
+ ----------------------------------
+
+ function Innermost_Master_Scope_Depth
+ (N : Node_Id) return Uint
+ is
+ Encl_Scop : Entity_Id;
+ Node_Par : Node_Id := Parent (N);
+ Master_Lvl_Modifier : Int := 0;
+
+ begin
+ -- Locate the nearest enclosing node (by traversing Parents)
+ -- that Defining_Entity can be applied to, and return the
+ -- depth of that entity's nearest enclosing dynamic scope.
+
+ -- The rules that define what a master are defined in
+ -- RM 7.6.1 (3), and include statements and conditions for loops
+ -- among other things. These cases are detected properly ???
+
+ while Present (Node_Par) loop
+
+ if Present (Defining_Entity
+ (Node_Par, Empty_On_Errors => True))
+ then
+ Encl_Scop := Nearest_Dynamic_Scope
+ (Defining_Entity (Node_Par));
+
+ -- Ignore transient scopes made during expansion
+
+ if Comes_From_Source (Node_Par) then
+ return Scope_Depth (Encl_Scop) + Master_Lvl_Modifier;
+ end if;
+
+ -- For a return statement within a function, return
+ -- the depth of the function itself. This is not just
+ -- a small optimization, but matters when analyzing
+ -- the expression in an expression function before
+ -- the body is created.
+
+ elsif Nkind (Node_Par) in N_Extended_Return_Statement
+ | N_Simple_Return_Statement
+ and then Ekind (Current_Scope) = E_Function
+ then
+ return Scope_Depth (Current_Scope);
+
+ -- Statements are counted as masters
+
+ elsif Is_Master (Node_Par) then
+ Master_Lvl_Modifier := Master_Lvl_Modifier + 1;
+
+ end if;
+
+ Node_Par := Parent (Node_Par);
+ end loop;
+
+ -- Should never reach the following return
+
+ pragma Assert (False);
+
+ return Scope_Depth (Current_Scope) + 1;
+ end Innermost_Master_Scope_Depth;
+
+ ------------------------
+ -- Make_Level_Literal --
+ ------------------------
+
+ function Make_Level_Literal (Level : Uint) return Node_Id is
+ Result : constant Node_Id := Make_Integer_Literal (Loc, Level);
+
+ begin
+ Set_Etype (Result, Standard_Natural);
+ return Result;
+ end Make_Level_Literal;
+
+ --------------------------------------
+ -- Function_Call_Or_Allocator_Level --
+ --------------------------------------
+
+ function Function_Call_Or_Allocator_Level (N : Node_Id) return Node_Id is
+ Par : Node_Id;
+ Prev_Par : Node_Id;
+ begin
+ -- Results of functions are objects, so we either get the
+ -- accessibility of the function or, in case of a call which is
+ -- indirect, the level of the access-to-subprogram type.
+
+ -- This code looks wrong ???
+
+ if Nkind (N) = N_Function_Call
+ and then Ada_Version < Ada_2005
+ then
+ if Is_Entity_Name (Name (N)) then
+ return Make_Level_Literal
+ (Subprogram_Access_Level (Entity (Name (N))));
+ else
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (Prefix (Name (N)))));
+ end if;
+
+ -- We ignore coextensions as they cannot be implemented under the
+ -- "small-integer" model.
+
+ elsif Nkind (N) = N_Allocator
+ and then (Is_Static_Coextension (N)
+ or else Is_Dynamic_Coextension (N))
+ then
+ return Make_Level_Literal
+ (Scope_Depth (Standard_Standard));
+ end if;
+
+ -- Named access types have a designated level
+
+ if Is_Named_Access_Type (Etype (N)) then
+ return Make_Level_Literal (Type_Access_Level (Etype (N)));
+
+ -- Otherwise, the level is dictated by RM 3.10.2 (10.7/3)
+
+ else
+ if Nkind (N) = N_Function_Call then
+ -- Dynamic checks are generated when we are within a return
+ -- value or we are in a function call within an anonymous
+ -- access discriminant constraint of a return object (signified
+ -- by In_Return_Context) on the side of the callee.
+
+ -- So, in this case, return library accessibility level to null
+ -- out the check on the side of the caller.
+
+ if In_Return_Value (N)
+ or else In_Return_Context
+ then
+ return Make_Level_Literal
+ (Subprogram_Access_Level (Current_Subprogram));
+ end if;
+ end if;
+
+ -- Find any relevant enclosing parent nodes that designate an
+ -- object being initialized.
+
+ -- Note: The above is only relevant if the result is used "in its
+ -- entirety" as RM 3.10.2 (10.2/3) states. However, this is
+ -- accounted for in the case statement in the main body of
+ -- Accessibility_Level for N_Selected_Component.
+
+ Par := Parent (Expr);
+ Prev_Par := Empty;
+ while Present (Par) loop
+ -- Detect an expanded implicit conversion, typically this
+ -- occurs on implicitly converted actuals in calls.
+
+ -- Does this catch all implicit conversions ???
+
+ if Nkind (Par) = N_Type_Conversion
+ and then Is_Named_Access_Type (Etype (Par))
+ then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (Par)));
+ end if;
+
+ -- Jump out when we hit an object declaration or the right-hand
+ -- side of an assignment, or a construct such as an aggregate
+ -- subtype indication which would be the result is not used
+ -- "in its entirety."
+
+ exit when Nkind (Par) in N_Object_Declaration
+ or else (Nkind (Par) = N_Assignment_Statement
+ and then Name (Par) /= Prev_Par);
+
+ Prev_Par := Par;
+ Par := Parent (Par);
+ end loop;
+
+ -- Assignment statements are handled in a similar way in
+ -- accordance to the left-hand part. However, strictly speaking,
+ -- this is illegal according to the RM, but this change is needed
+ -- to pass an ACATS C-test and is useful in general ???
+
+ case Nkind (Par) is
+ when N_Object_Declaration =>
+ return Make_Level_Literal
+ (Scope_Depth
+ (Scope (Defining_Identifier (Par))));
+
+ when N_Assignment_Statement =>
+ -- Return the accessiblity level of the left-hand part
+
+ return Accessibility_Level
+ (Expr => Name (Par),
+ Level => Object_Decl_Level,
+ In_Return_Context => In_Return_Context);
+
+ when others =>
+ return Make_Level_Literal
+ (Innermost_Master_Scope_Depth (Expr));
+ end case;
+ end if;
+ end Function_Call_Or_Allocator_Level;
+
+ -- Local variables
+
+ E : Entity_Id := Original_Node (Expr);
+ Pre : Node_Id;
+
+ -- Start of processing for Accessibility_Level
+
+ begin
+ -- We could be looking at a reference to a formal due to the expansion
+ -- of entries and other cases, so obtain the renaming if necessary.
+
+ if Present (Param_Entity (Expr)) then
+ E := Param_Entity (Expr);
+ end if;
+
+ -- Extract the entity
+
+ if Nkind (E) in N_Has_Entity and then Present (Entity (E)) then
+ E := Entity (E);
+
+ -- Deal with a possible renaming of a private protected component
+
+ if Ekind (E) in E_Constant | E_Variable and then Is_Prival (E) then
+ E := Prival_Link (E);
+ end if;
+ end if;
+
+ -- Perform the processing on the expression
+
+ case Nkind (E) is
+ -- The level of an aggregate is that of the innermost master that
+ -- evaluates it as defined in RM 3.10.2 (10/4).
+
+ when N_Aggregate =>
+ return Make_Level_Literal (Innermost_Master_Scope_Depth (Expr));
+
+ -- The accessibility level is that of the access type, except for an
+ -- anonymous allocators which have special rules defined in RM 3.10.2
+ -- (14/3).
+
+ when N_Allocator =>
+ return Function_Call_Or_Allocator_Level (E);
+
+ -- We could reach this point for two reasons. Either the expression
+ -- applies to a special attribute ('Loop_Entry, 'Result, or 'Old), or
+ -- we are looking at the access attributes directly ('Access,
+ -- 'Address, or 'Unchecked_Access).
+
+ when N_Attribute_Reference =>
+ Pre := Original_Node (Prefix (E));
+
+ -- Regular 'Access attribute presence means we have to look at the
+ -- prefix.
+
+ if Attribute_Name (E) = Name_Access then
+ return Accessibility_Level (Prefix (E));
+
+ -- Unchecked or unrestricted attributes have unlimited depth
+
+ elsif Attribute_Name (E) in Name_Address
+ | Name_Unchecked_Access
+ | Name_Unrestricted_Access
+ then
+ return Make_Level_Literal (Scope_Depth (Standard_Standard));
+
+ -- 'Access can be taken further against other special attributes,
+ -- so handle these cases explicitly.
+
+ elsif Attribute_Name (E)
+ in Name_Old | Name_Loop_Entry | Name_Result
+ then
+ -- Named access types
+
+ if Is_Named_Access_Type (Etype (Pre)) then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (Pre)));
+
+ -- Anonymous access types
+
+ elsif Nkind (Pre) in N_Has_Entity
+ and then Present (Get_Dynamic_Accessibility (Entity (Pre)))
+ and then Level = Dynamic_Level
+ then
+ return New_Occurrence_Of
+ (Get_Dynamic_Accessibility (Entity (Pre)), Loc);
+
+ -- Otherwise the level is treated in a similar way as
+ -- aggregates according to RM 6.1.1 (35.1/4) which concerns
+ -- an implicit constant declaration - in turn defining the
+ -- accessibility level to be that of the implicit constant
+ -- declaration.
+
+ else
+ return Make_Level_Literal
+ (Innermost_Master_Scope_Depth (Expr));
+ end if;
+
+ else
+ raise Program_Error;
+ end if;
+
+ -- This is the "base case" for accessibility level calculations which
+ -- means we are near the end of our recursive traversal.
+
+ when N_Defining_Identifier =>
+ -- A dynamic check is performed on the side of the callee when we
+ -- are within a return statement, so return a library-level
+ -- accessibility level to null out checks on the side of the
+ -- caller.
+
+ if Is_Explicitly_Aliased (E)
+ and then Level /= Dynamic_Level
+ and then (In_Return_Value (Expr)
+ or else In_Return_Context)
+ then
+ return Make_Level_Literal (Scope_Depth (Standard_Standard));
+
+ -- Something went wrong and an extra accessibility formal has not
+ -- been generated when one should have ???
+
+ elsif Is_Formal (E)
+ and then not Present (Get_Dynamic_Accessibility (E))
+ and then Ekind (Etype (E)) = E_Anonymous_Access_Type
+ then
+ return Make_Level_Literal (Scope_Depth (Standard_Standard));
+
+ -- Stand-alone object of an anonymous access type "SAOAAT"
+
+ elsif (Is_Formal (E)
+ or else Ekind (E) in E_Variable
+ | E_Constant)
+ and then Present (Get_Dynamic_Accessibility (E))
+ and then (Level = Dynamic_Level
+ or else Level = Zero_On_Dynamic_Level)
+ then
+ if Level = Zero_On_Dynamic_Level then
+ return Make_Level_Literal
+ (Scope_Depth (Standard_Standard));
+ end if;
+
+ return
+ New_Occurrence_Of (Get_Dynamic_Accessibility (E), Loc);
+
+ -- Initialization procedures have a special extra accessitility
+ -- parameter associated with the level at which the object
+ -- begin initialized exists
+
+ elsif Ekind (E) = E_Record_Type
+ and then Is_Limited_Record (E)
+ and then Current_Scope = Init_Proc (E)
+ and then Present (Init_Proc_Level_Formal (Current_Scope))
+ then
+ return New_Occurrence_Of
+ (Init_Proc_Level_Formal (Current_Scope), Loc);
+
+ -- Current instance of the type is deeper than that of the type
+ -- according to RM 3.10.2 (21).
+
+ elsif Is_Type (E) then
+ return Make_Level_Literal
+ (Type_Access_Level (E) + 1);
+
+ -- Move up the renamed entity if it came from source since
+ -- expansion may have created a dummy renaming under certain
+ -- circumstances.
+
+ elsif Present (Renamed_Object (E))
+ and then Comes_From_Source (Renamed_Object (E))
+ then
+ return Accessibility_Level (Renamed_Object (E));
+
+ -- Named access types get their level from their associated type
+
+ elsif Is_Named_Access_Type (Etype (E)) then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (E)));
+
+ -- When E is a component of the current instance of a
+ -- protected type, we assume the level to be deeper than that of
+ -- the type itself.
+
+ elsif not Is_Overloadable (E)
+ and then Ekind (Scope (E)) = E_Protected_Type
+ and then Comes_From_Source (Scope (E))
+ then
+ return Make_Level_Literal
+ (Scope_Depth (Enclosing_Dynamic_Scope (E)) + 1);
+
+ -- Normal object - get the level of the enclosing scope
+
+ else
+ return Make_Level_Literal
+ (Scope_Depth (Enclosing_Dynamic_Scope (E)));
+ end if;
+
+ -- Handle indexed and selected components including the special cases
+ -- whereby there is an implicit dereference, a component of a
+ -- composite type, or a function call in prefix notation.
+
+ -- We don't handle function calls in prefix notation correctly ???
+
+ when N_Indexed_Component | N_Selected_Component =>
+ Pre := Original_Node (Prefix (E));
+
+ -- When E is an indexed component or selected component and
+ -- the current Expr is a function call, we know that we are
+ -- looking at an expanded call in prefix notation.
+
+ if Nkind (Expr) = N_Function_Call then
+ return Function_Call_Or_Allocator_Level (Expr);
+
+ -- If the prefix is a named access type, then we are dealing
+ -- with an implicit deferences. In that case the level is that
+ -- of the named access type in the prefix.
+
+ elsif Is_Named_Access_Type (Etype (Pre)) then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (Pre)));
+
+ -- The current expression is a named access type, so there is no
+ -- reason to look at the prefix. Instead obtain the level of E's
+ -- named access type.
+
+ elsif Is_Named_Access_Type (Etype (E)) then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (E)));
+
+ -- A non-discriminant selected component where the component
+ -- is an anonymous access type means that its associated
+ -- level is that of the containing type - see RM 3.10.2 (16).
+
+ elsif Nkind (E) = N_Selected_Component
+ and then Ekind (Etype (E)) = E_Anonymous_Access_Type
+ and then Ekind (Etype (Pre)) /= E_Anonymous_Access_Type
+ and then not (Nkind (Selector_Name (E)) in N_Has_Entity
+ and then Ekind (Entity (Selector_Name (E)))
+ = E_Discriminant)
+ then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (Prefix (E))));
+
+ -- Similar to the previous case - arrays featuring components of
+ -- anonymous access components get their corresponding level from
+ -- their containing type's declaration.
+
+ elsif Nkind (E) = N_Indexed_Component
+ and then Ekind (Etype (E)) = E_Anonymous_Access_Type
+ and then Ekind (Etype (Pre)) in Array_Kind
+ and then Ekind (Component_Type (Base_Type (Etype (Pre))))
+ = E_Anonymous_Access_Type
+ then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (Prefix (E))));
+
+ -- The accessibility calculation routine that handles function
+ -- calls (Function_Call_Level) assumes, in the case the
+ -- result is of an anonymous access type, that the result will be
+ -- used "in its entirety" when the call is present within an
+ -- assignment or object declaration.
+
+ -- To properly handle cases where the result is not used in its
+ -- entirety, we test if the prefix of the component in question is
+ -- a function call, which tells us that one of its components has
+ -- been identified and is being accessed. Therefore we can
+ -- conclude that the result is not used "in its entirety"
+ -- according to RM 3.10.2 (10.2/3).
+
+ elsif Nkind (Pre) = N_Function_Call
+ and then not Is_Named_Access_Type (Etype (Pre))
+ then
+ -- Dynamic checks are generated when we are within a return
+ -- value or we are in a function call within an anonymous
+ -- access discriminant constraint of a return object (signified
+ -- by In_Return_Context) on the side of the callee.
+
+ -- So, in this case, return a library accessibility level to
+ -- null out the check on the side of the caller.
+
+ if (In_Return_Value (E)
+ or else In_Return_Context)
+ and then Level /= Dynamic_Level
+ then
+ return Make_Level_Literal
+ (Scope_Depth (Standard_Standard));
+ end if;
+
+ return Make_Level_Literal
+ (Innermost_Master_Scope_Depth (Expr));
+
+ -- Otherwise, continue recursing over the expression prefixes
+
+ else
+ return Accessibility_Level (Prefix (E));
+ end if;
+
+ -- Qualified expressions
+
+ when N_Qualified_Expression =>
+ if Is_Named_Access_Type (Etype (E)) then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (E)));
+ else
+ return Accessibility_Level (Expression (E));
+ end if;
+
+ -- Handle function calls
+
+ when N_Function_Call =>
+ return Function_Call_Or_Allocator_Level (E);
+
+ -- Explicit dereference accessibility level calculation
+
+ when N_Explicit_Dereference =>
+ Pre := Original_Node (Prefix (E));
+
+ -- The prefix is a named access type so the level is taken from
+ -- its type.
+
+ if Is_Named_Access_Type (Etype (Pre)) then
+ return Make_Level_Literal (Type_Access_Level (Etype (Pre)));
+
+ -- Otherwise, recurse deeper
+
+ else
+ return Accessibility_Level (Prefix (E));
+ end if;
+
+ -- Type conversions
+
+ when N_Type_Conversion | N_Unchecked_Type_Conversion =>
+ -- View conversions are special in that they require use to
+ -- inspect the expression of the type conversion.
+
+ -- Allocators of anonymous access types are internally generated,
+ -- so recurse deeper in that case as well.
+
+ if Is_View_Conversion (E)
+ or else Ekind (Etype (E)) = E_Anonymous_Access_Type
+ then
+ return Accessibility_Level (Expression (E));
+
+ -- We don't care about the master if we are looking at a named
+ -- access type.
+
+ elsif Is_Named_Access_Type (Etype (E)) then
+ return Make_Level_Literal
+ (Type_Access_Level (Etype (E)));
+
+ -- In section RM 3.10.2 (10/4) the accessibility rules for
+ -- aggregates and value conversions are outlined. Are these
+ -- followed in the case of initialization of an object ???
+
+ -- Should use Innermost_Master_Scope_Depth ???
+
+ else
+ return Accessibility_Level (Current_Scope);
+ end if;
+
+ -- Default to the type accessibility level for the type of the
+ -- expression's entity.
+
+ when others =>
+ return Make_Level_Literal (Type_Access_Level (Etype (E)));
+ end case;
+ end Accessibility_Level;
+
+ --------------------------------
+ -- Static_Accessibility_Level --
+ --------------------------------
+
+ function Static_Accessibility_Level
+ (Expr : Node_Id;
+ Level : Static_Accessibility_Level_Kind;
+ In_Return_Context : Boolean := False) return Uint
+ is
+ begin
+ return Intval
+ (Accessibility_Level (Expr, Level, In_Return_Context));
+ end Static_Accessibility_Level;
+
----------------------------------
-- Acquire_Warning_Match_String --
----------------------------------
@@ -314,7 +936,6 @@ package body Sem_Util is
procedure Add_Block_Identifier (N : Node_Id; Id : out Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
-
begin
pragma Assert (Nkind (N) = N_Block_Statement);
@@ -419,14 +1040,13 @@ package body Sem_Util is
-- Addressable --
-----------------
- -- For now, just 8/16/32/64
-
function Addressable (V : Uint) return Boolean is
begin
return V = Uint_8 or else
V = Uint_16 or else
V = Uint_32 or else
- V = Uint_64;
+ V = Uint_64 or else
+ (V = Uint_128 and then System_Max_Integer_Size = 128);
end Addressable;
function Addressable (V : Int) return Boolean is
@@ -434,7 +1054,8 @@ package body Sem_Util is
return V = 8 or else
V = 16 or else
V = 32 or else
- V = 64;
+ V = 64 or else
+ V = System_Max_Integer_Size;
end Addressable;
---------------------------------
@@ -982,7 +1603,7 @@ package body Sem_Util is
Reason => PE_Bad_Predicated_Generic_Type));
else
- Error_Msg_FE (Msg & "<<", N, Typ);
+ Error_Msg_FE (Msg, N, Typ);
end if;
else
@@ -2416,6 +3037,27 @@ package body Sem_Util is
end if;
end Cannot_Raise_Constraint_Error;
+ -------------------------------
+ -- Check_Ambiguous_Aggregate --
+ -------------------------------
+
+ procedure Check_Ambiguous_Aggregate (Call : Node_Id) is
+ Actual : Node_Id;
+
+ begin
+ if Extensions_Allowed then
+ Actual := First_Actual (Call);
+ while Present (Actual) loop
+ if Nkind (Actual) = N_Aggregate then
+ Error_Msg_N
+ ("\add type qualification to aggregate actual", Actual);
+ exit;
+ end if;
+ Next_Actual (Actual);
+ end loop;
+ end if;
+ end Check_Ambiguous_Aggregate;
+
-----------------------------------------
-- Check_Dynamically_Tagged_Expression --
-----------------------------------------
@@ -2535,10 +3177,6 @@ package body Sem_Util is
-- second occurrence, the error is reported, and the tree traversal
-- is abandoned.
- procedure Preanalyze_Without_Errors (N : Node_Id);
- -- Preanalyze N without reporting errors. Very dubious, you can't just
- -- go analyzing things more than once???
-
-------------------------
-- Collect_Identifiers --
-------------------------
@@ -2765,18 +3403,6 @@ package body Sem_Util is
Do_Traversal (N);
end Collect_Identifiers;
- -------------------------------
- -- Preanalyze_Without_Errors --
- -------------------------------
-
- procedure Preanalyze_Without_Errors (N : Node_Id) is
- Status : constant Boolean := Get_Ignore_Errors;
- begin
- Set_Ignore_Errors (True);
- Preanalyze (N);
- Set_Ignore_Errors (Status);
- end Preanalyze_Without_Errors;
-
-- Start of processing for Check_Function_Writable_Actuals
begin
@@ -3614,6 +4240,132 @@ package body Sem_Util is
end if;
end Check_No_Hidden_State;
+ ---------------------------------------------
+ -- Check_Nonoverridable_Aspect_Consistency --
+ ---------------------------------------------
+
+ procedure Check_Inherited_Nonoverridable_Aspects
+ (Inheritor : Entity_Id;
+ Interface_List : List_Id;
+ Parent_Type : Entity_Id) is
+
+ -- array needed for iterating over subtype values
+ Nonoverridable_Aspects : constant array (Positive range <>) of
+ Nonoverridable_Aspect_Id :=
+ (Aspect_Default_Iterator,
+ Aspect_Iterator_Element,
+ Aspect_Implicit_Dereference,
+ Aspect_Constant_Indexing,
+ Aspect_Variable_Indexing,
+ Aspect_Aggregate,
+ Aspect_Max_Entry_Queue_Length
+ -- , Aspect_No_Controlled_Parts
+ );
+
+ -- Note that none of these 8 aspects can be specified (for a type)
+ -- via a pragma. For 7 of them, the corresponding pragma does not
+ -- exist. The Pragma_Id enumeration type does include
+ -- Pragma_Max_Entry_Queue_Length, but that pragma is only use to
+ -- specify the aspect for a protected entry or entry family, not for
+ -- a type, and therefore cannot introduce the sorts of inheritance
+ -- issues that we are concerned with in this procedure.
+
+ type Entity_Array is array (Nat range <>) of Entity_Id;
+
+ function Ancestor_Entities return Entity_Array;
+ -- Returns all progenitors (including parent type, if present)
+
+ procedure Check_Consistency_For_One_Aspect_Of_Two_Ancestors
+ (Aspect : Nonoverridable_Aspect_Id;
+ Ancestor_1 : Entity_Id;
+ Aspect_Spec_1 : Node_Id;
+ Ancestor_2 : Entity_Id;
+ Aspect_Spec_2 : Node_Id);
+ -- A given aspect has been specified for each of two ancestors;
+ -- check that the two aspect specifications are compatible (see
+ -- RM 13.1.1(18.5) and AI12-0211).
+
+ -----------------------
+ -- Ancestor_Entities --
+ -----------------------
+
+ function Ancestor_Entities return Entity_Array is
+ Ifc_Count : constant Nat := List_Length (Interface_List);
+ Ifc_Ancestors : Entity_Array (1 .. Ifc_Count);
+ Ifc : Node_Id := First (Interface_List);
+ begin
+ for Idx in Ifc_Ancestors'Range loop
+ Ifc_Ancestors (Idx) := Entity (Ifc);
+ pragma Assert (Present (Ifc_Ancestors (Idx)));
+ Ifc := Next (Ifc);
+ end loop;
+ pragma Assert (not Present (Ifc));
+ if Present (Parent_Type) then
+ return Parent_Type & Ifc_Ancestors;
+ else
+ return Ifc_Ancestors;
+ end if;
+ end Ancestor_Entities;
+
+ -------------------------------------------------------
+ -- Check_Consistency_For_One_Aspect_Of_Two_Ancestors --
+ -------------------------------------------------------
+
+ procedure Check_Consistency_For_One_Aspect_Of_Two_Ancestors
+ (Aspect : Nonoverridable_Aspect_Id;
+ Ancestor_1 : Entity_Id;
+ Aspect_Spec_1 : Node_Id;
+ Ancestor_2 : Entity_Id;
+ Aspect_Spec_2 : Node_Id) is
+ begin
+ if not Is_Confirming (Aspect, Aspect_Spec_1, Aspect_Spec_2) then
+ Error_Msg_Name_1 := Aspect_Names (Aspect);
+ Error_Msg_Name_2 := Chars (Ancestor_1);
+ Error_Msg_Name_3 := Chars (Ancestor_2);
+
+ Error_Msg (
+ "incompatible % aspects inherited from ancestors % and %",
+ Sloc (Inheritor));
+ end if;
+ end Check_Consistency_For_One_Aspect_Of_Two_Ancestors;
+
+ Ancestors : constant Entity_Array := Ancestor_Entities;
+
+ -- start of processing for Check_Inherited_Nonoverridable_Aspects
+ begin
+ -- No Ada_Version check here; AI12-0211 is a binding interpretation.
+
+ if Ancestors'Length < 2 then
+ return; -- Inconsistency impossible; it takes 2 to disagree.
+ elsif In_Instance_Body then
+ return; -- No legality checking in an instance body.
+ end if;
+
+ for Aspect of Nonoverridable_Aspects loop
+ declare
+ First_Ancestor_With_Aspect : Entity_Id := Empty;
+ First_Aspect_Spec, Current_Aspect_Spec : Node_Id := Empty;
+ begin
+ for Ancestor of Ancestors loop
+ Current_Aspect_Spec := Find_Aspect (Ancestor, Aspect);
+ if Present (Current_Aspect_Spec) then
+ if Present (First_Ancestor_With_Aspect) then
+ Check_Consistency_For_One_Aspect_Of_Two_Ancestors
+ (Aspect => Aspect,
+ Ancestor_1 => First_Ancestor_With_Aspect,
+ Aspect_Spec_1 => First_Aspect_Spec,
+ Ancestor_2 => Ancestor,
+ Aspect_Spec_2 => Current_Aspect_Spec);
+ else
+ First_Ancestor_With_Aspect := Ancestor;
+ First_Aspect_Spec := Current_Aspect_Spec;
+ end if;
+ end if;
+ end loop;
+ end;
+ end loop;
+ end Check_Inherited_Nonoverridable_Aspects;
+
----------------------------------------
-- Check_Nonvolatile_Function_Profile --
----------------------------------------
@@ -3626,7 +4378,7 @@ package body Sem_Util is
Formal := First_Formal (Func_Id);
while Present (Formal) loop
- if Is_Effectively_Volatile (Etype (Formal)) then
+ if Is_Effectively_Volatile_For_Reading (Etype (Formal)) then
Error_Msg_NE
("nonvolatile function & cannot have a volatile parameter",
Formal, Func_Id);
@@ -3637,7 +4389,7 @@ package body Sem_Util is
-- Inspect the return type
- if Is_Effectively_Volatile (Etype (Func_Id)) then
+ if Is_Effectively_Volatile_For_Reading (Etype (Func_Id)) then
Error_Msg_NE
("nonvolatile function & cannot have a volatile return type",
Result_Definition (Parent (Func_Id)), Func_Id);
@@ -4754,8 +5506,9 @@ package body Sem_Util is
if Present (Pref_Encl_Typ)
and then No (Cont_Encl_Typ)
and then Is_Public_Operation
- and then Scope_Depth (Pref_Encl_Typ) >=
- Object_Access_Level (Context)
+ and then Scope_Depth (Pref_Encl_Typ)
+ >= Static_Accessibility_Level
+ (Context, Object_Decl_Level)
then
Error_Msg_N
("??possible unprotected access to protected data", Expr);
@@ -6229,9 +6982,9 @@ package body Sem_Util is
end if;
end Current_Subprogram;
- ----------------------------------
+ -------------------------------
-- Deepest_Type_Access_Level --
- ----------------------------------
+ -------------------------------
function Deepest_Type_Access_Level (Typ : Entity_Id) return Uint is
begin
@@ -6262,7 +7015,10 @@ package body Sem_Util is
-- Defining_Entity --
---------------------
- function Defining_Entity (N : Node_Id) return Entity_Id is
+ function Defining_Entity
+ (N : Node_Id;
+ Empty_On_Errors : Boolean := False) return Entity_Id
+ is
begin
case Nkind (N) is
when N_Abstract_Subprogram_Declaration
@@ -6361,6 +7117,10 @@ package body Sem_Util is
return Entity (Identifier (N));
when others =>
+ if Empty_On_Errors then
+ return Empty;
+ end if;
+
raise Program_Error;
end case;
end Defining_Entity;
@@ -6764,6 +7524,71 @@ package body Sem_Util is
return Denotes_Discriminant (L) or else Denotes_Discriminant (H);
end Depends_On_Discriminant;
+ -------------------------------------
+ -- Derivation_Too_Early_To_Inherit --
+ -------------------------------------
+
+ function Derivation_Too_Early_To_Inherit
+ (Typ : Entity_Id; Streaming_Op : TSS_Name_Type) return Boolean is
+ Btyp : constant Entity_Id := Implementation_Base_Type (Typ);
+ Parent_Type : Entity_Id;
+ begin
+ if Is_Derived_Type (Btyp) then
+ Parent_Type := Implementation_Base_Type (Etype (Btyp));
+ pragma Assert (Parent_Type /= Btyp);
+ if Has_Stream_Attribute_Definition
+ (Parent_Type, Streaming_Op)
+ and then In_Same_Extended_Unit (Btyp, Parent_Type)
+ and then Instantiation (Get_Source_File_Index (Sloc (Btyp))) =
+ Instantiation (Get_Source_File_Index (Sloc (Parent_Type)))
+ then
+ declare
+ -- ??? Avoid code duplication here with
+ -- Sem_Cat.Has_Stream_Attribute_Definition by introducing a
+ -- new function to be called from both places?
+
+ Rep_Item : Node_Id := First_Rep_Item (Parent_Type);
+ Real_Rep : Node_Id;
+ Found : Boolean := False;
+ begin
+ while Present (Rep_Item) loop
+ Real_Rep := Rep_Item;
+
+ if Nkind (Rep_Item) = N_Aspect_Specification then
+ Real_Rep := Aspect_Rep_Item (Rep_Item);
+ end if;
+
+ if Nkind (Real_Rep) = N_Attribute_Definition_Clause then
+ case Chars (Real_Rep) is
+ when Name_Read =>
+ Found := Streaming_Op = TSS_Stream_Read;
+
+ when Name_Write =>
+ Found := Streaming_Op = TSS_Stream_Write;
+
+ when Name_Input =>
+ Found := Streaming_Op = TSS_Stream_Input;
+
+ when Name_Output =>
+ Found := Streaming_Op = TSS_Stream_Output;
+
+ when others =>
+ null;
+ end case;
+ end if;
+
+ if Found then
+ return Earlier_In_Extended_Unit (Btyp, Real_Rep);
+ end if;
+
+ Next_Rep_Item (Rep_Item);
+ end loop;
+ end;
+ end if;
+ end if;
+ return False;
+ end Derivation_Too_Early_To_Inherit;
+
-------------------------
-- Designate_Same_Unit --
-------------------------
@@ -6878,203 +7703,6 @@ package body Sem_Util is
Analyze (N);
end Diagnose_Iterated_Component_Association;
- ---------------------------------
- -- Dynamic_Accessibility_Level --
- ---------------------------------
-
- function Dynamic_Accessibility_Level (N : Node_Id) return Node_Id is
- Loc : constant Source_Ptr := Sloc (N);
-
- function Make_Level_Literal (Level : Uint) return Node_Id;
- -- Construct an integer literal representing an accessibility level
- -- with its type set to Natural.
-
- ------------------------
- -- Make_Level_Literal --
- ------------------------
-
- function Make_Level_Literal (Level : Uint) return Node_Id is
- Result : constant Node_Id := Make_Integer_Literal (Loc, Level);
-
- begin
- Set_Etype (Result, Standard_Natural);
- return Result;
- end Make_Level_Literal;
-
- -- Local variables
-
- Expr : Node_Id := Original_Node (N);
- -- Expr references the original node because at this stage N may be the
- -- reference to a variable internally created by the frontend to remove
- -- side effects of an expression.
-
- E : Entity_Id;
-
- -- Start of processing for Dynamic_Accessibility_Level
-
- begin
- if Is_Entity_Name (Expr) then
- E := Entity (Expr);
-
- if Present (Renamed_Object (E)) then
- return Dynamic_Accessibility_Level (Renamed_Object (E));
- end if;
-
- if (Is_Formal (E)
- or else Ekind (E) in E_Variable | E_Constant)
- and then Present (Get_Accessibility (E))
- then
- return New_Occurrence_Of (Get_Accessibility (E), Loc);
- end if;
- end if;
-
- -- Handle a constant-folded conditional expression by avoiding use of
- -- the original node.
-
- if Nkind (Expr) in N_Case_Expression | N_If_Expression then
- Expr := N;
- end if;
-
- -- Unimplemented: Ptr.all'Access, where Ptr has Extra_Accessibility ???
-
- case Nkind (Expr) is
- -- It may be possible that we have an access object denoted by an
- -- attribute reference for 'Loop_Entry which may, in turn, have an
- -- indexed component representing a loop identifier.
-
- -- In this case we must climb up the indexed component and set expr
- -- to the attribute reference so the rest of the machinery can
- -- operate as expected.
-
- when N_Indexed_Component =>
- if Nkind (Prefix (Expr)) = N_Attribute_Reference
- and then Get_Attribute_Id (Attribute_Name (Prefix (Expr)))
- = Attribute_Loop_Entry
- then
- Expr := Prefix (Expr);
- end if;
-
- -- For access discriminant, the level of the enclosing object
-
- when N_Selected_Component =>
- if Ekind (Entity (Selector_Name (Expr))) = E_Discriminant
- and then Ekind (Etype (Entity (Selector_Name (Expr)))) =
- E_Anonymous_Access_Type
- then
- return Make_Level_Literal (Object_Access_Level (Expr));
- end if;
-
- when N_Attribute_Reference =>
- case Get_Attribute_Id (Attribute_Name (Expr)) is
-
- -- Ignore 'Loop_Entry, 'Result, and 'Old as they can be used to
- -- identify access objects and do not have an effect on
- -- accessibility level.
-
- when Attribute_Loop_Entry | Attribute_Old | Attribute_Result =>
- null;
-
- -- For X'Access, the level of the prefix X
-
- when Attribute_Access =>
- return Make_Level_Literal
- (Object_Access_Level (Prefix (Expr)));
-
- -- Treat the unchecked attributes as library-level
-
- when Attribute_Unchecked_Access
- | Attribute_Unrestricted_Access
- =>
- return Make_Level_Literal (Scope_Depth (Standard_Standard));
-
- -- No other access-valued attributes
-
- when others =>
- raise Program_Error;
- end case;
-
- when N_Allocator =>
-
- -- This is not fully implemented since it depends on context (see
- -- 3.10.2(14/3-14.2/3). More work is needed in the following cases
- --
- -- 1) For an anonymous allocator defining the value of an access
- -- parameter, the accessibility level is that of the innermost
- -- master of the call; however currently we pass the level of
- -- execution of the called subprogram, which is one greater
- -- than the current scope level (see Expand_Call_Helper).
- --
- -- For example, a statement is a master and a declaration is
- -- not a master; so we should not pass in the same level for
- -- the following cases:
- --
- -- function F (X : access Integer) return T is ... ;
- -- Decl : T := F (new Integer); -- level is off by one
- -- begin
- -- Decl := F (new Integer); -- we get this case right
- --
- -- 2) For an anonymous allocator that defines the result of a
- -- function with an access result, the accessibility level is
- -- determined as though the allocator were in place of the call
- -- of the function. In the special case of a call that is the
- -- operand of a type conversion the level is that of the target
- -- access type of the conversion.
- --
- -- 3) For an anonymous allocator defining an access discriminant
- -- the accessibility level is determined as follows:
- -- * for an allocator used to define the discriminant of an
- -- object, the level of the object
- -- * for an allocator used to define the constraint in a
- -- subtype_indication in any other context, the level of
- -- the master that elaborates the subtype_indication.
-
- case Nkind (Parent (N)) is
- when N_Object_Declaration =>
-
- -- For an anonymous allocator whose type is that of a
- -- stand-alone object of an anonymous access-to-object type,
- -- the accessibility level is that of the declaration of the
- -- stand-alone object.
-
- return
- Make_Level_Literal
- (Object_Access_Level
- (Defining_Identifier (Parent (N))));
-
- when N_Assignment_Statement =>
- return
- Make_Level_Literal
- (Object_Access_Level (Name (Parent (N))));
-
- when others =>
- declare
- S : constant String :=
- Node_Kind'Image (Nkind (Parent (N)));
- begin
- Error_Msg_Strlen := S'Length;
- Error_Msg_String (1 .. Error_Msg_Strlen) := S;
- Error_Msg_N
- ("unsupported context for anonymous allocator (~)",
- Parent (N));
- end;
- end case;
-
- when N_Type_Conversion =>
- if not Is_Local_Anonymous_Access (Etype (Expr)) then
-
- -- Handle type conversions introduced for a rename of an
- -- Ada 2012 stand-alone object of an anonymous access type.
-
- return Dynamic_Accessibility_Level (Expression (Expr));
- end if;
-
- when others =>
- null;
- end case;
-
- return Make_Level_Literal (Type_Access_Level (Etype (Expr)));
- end Dynamic_Accessibility_Level;
-
------------------------
-- Discriminated_Size --
------------------------
@@ -7825,18 +8453,9 @@ package body Sem_Util is
Set_Etype (Def_Id, Any_Type);
end if;
- -- Inherited discriminants and components in derived record types are
- -- immediately visible. Itypes are not.
-
- -- Unless the Itype is for a record type with a corresponding remote
- -- type (what is that about, it was not commented ???)
+ -- All entities except Itypes are immediately visible
- if Ekind (Def_Id) in E_Discriminant | E_Component
- or else
- ((not Is_Record_Type (Def_Id)
- or else No (Corresponding_Remote_Type (Def_Id)))
- and then not Is_Itype (Def_Id))
- then
+ if not Is_Itype (Def_Id) then
Set_Is_Immediately_Visible (Def_Id);
Set_Current_Entity (Def_Id);
end if;
@@ -8451,7 +9070,7 @@ package body Sem_Util is
if Has_Own_DIC (Typ) then
DIC_Typ := Typ;
- -- Otherwise the DIC pragma is inherited from a parent type
+ -- Otherwise the DIC pragma is inherited from a parent type
else
pragma Assert (Has_Inherited_DIC (Typ));
@@ -9580,11 +10199,11 @@ package body Sem_Util is
end if;
end Gather_Components;
- -----------------------
- -- Get_Accessibility --
- -----------------------
+ -------------------------------
+ -- Get_Dynamic_Accessibility --
+ -------------------------------
- function Get_Accessibility (E : Entity_Id) return Node_Id is
+ function Get_Dynamic_Accessibility (E : Entity_Id) return Entity_Id is
begin
-- When minimum accessibility is set for E then we utilize it - except
-- in a few edge cases like the expansion of select statements where
@@ -9594,7 +10213,7 @@ package body Sem_Util is
-- To avoid these situations where expansion may get complex we verify
-- that the minimum accessibility object is within scope.
- if Ekind (E) in Formal_Kind
+ if Is_Formal (E)
and then Present (Minimum_Accessibility (E))
and then In_Open_Scopes (Scope (Minimum_Accessibility (E)))
then
@@ -9602,7 +10221,7 @@ package body Sem_Util is
end if;
return Extra_Accessibility (E);
- end Get_Accessibility;
+ end Get_Dynamic_Accessibility;
------------------------
-- Get_Actual_Subtype --
@@ -10800,6 +11419,31 @@ package body Sem_Util is
end if;
end Has_Access_Values;
+ ---------------------------------------
+ -- Has_Anonymous_Access_Discriminant --
+ ---------------------------------------
+
+ function Has_Anonymous_Access_Discriminant (Typ : Entity_Id) return Boolean
+ is
+ Disc : Node_Id;
+
+ begin
+ if not Has_Discriminants (Typ) then
+ return False;
+ end if;
+
+ Disc := First_Discriminant (Typ);
+ while Present (Disc) loop
+ if Ekind (Etype (Disc)) = E_Anonymous_Access_Type then
+ return True;
+ end if;
+
+ Next_Discriminant (Disc);
+ end loop;
+
+ return False;
+ end Has_Anonymous_Access_Discriminant;
+
------------------------------
-- Has_Compatible_Alignment --
------------------------------
@@ -11231,11 +11875,11 @@ package body Sem_Util is
begin
-- Inspect the formal parameters looking for an effectively volatile
- -- type.
+ -- type for reading.
Formal := First_Formal (Subp_Id);
while Present (Formal) loop
- if Is_Effectively_Volatile (Etype (Formal)) then
+ if Is_Effectively_Volatile_For_Reading (Etype (Formal)) then
return True;
end if;
@@ -11245,7 +11889,7 @@ package body Sem_Util is
-- Inspect the return type of functions
if Ekind (Subp_Id) in E_Function | E_Generic_Function
- and then Is_Effectively_Volatile (Etype (Subp_Id))
+ and then Is_Effectively_Volatile_For_Reading (Etype (Subp_Id))
then
return True;
end if;
@@ -11619,7 +12263,7 @@ package body Sem_Util is
if Ekind (Item_Id) = E_Abstract_State then
return State_Has_Enabled_Property;
- elsif Ekind (Item_Id) = E_Variable then
+ elsif Ekind (Item_Id) in E_Variable | E_Constant then
return Type_Or_Variable_Has_Enabled_Property (Item_Id);
-- Other objects can only inherit properties through their type. We
@@ -11960,6 +12604,39 @@ package body Sem_Util is
(Directly_Designated_Type (Etype (Formal))) = E;
end Is_Access_Subprogram_Wrapper;
+ ---------------------------
+ -- Is_Explicitly_Aliased --
+ ---------------------------
+
+ function Is_Explicitly_Aliased (N : Node_Id) return Boolean is
+ begin
+ return Is_Formal (N)
+ and then Present (Parent (N))
+ and then Nkind (Parent (N)) = N_Parameter_Specification
+ and then Aliased_Present (Parent (N));
+ end Is_Explicitly_Aliased;
+
+ ----------------------------
+ -- Is_Container_Aggregate --
+ ----------------------------
+
+ function Is_Container_Aggregate (Exp : Node_Id) return Boolean is
+
+ function Is_Record_Aggregate return Boolean is (False);
+ -- ??? Unimplemented. Given an aggregate whose type is a
+ -- record type with specified Aggregate aspect, how do we
+ -- determine whether it is a record aggregate or a container
+ -- aggregate? If the code where the aggregate occurs can see only
+ -- a partial view of the aggregate's type then the aggregate
+ -- cannot be a record type; an aggregate of a private type has to
+ -- be a container aggregate.
+
+ begin
+ return Nkind (Exp) = N_Aggregate
+ and then Present (Find_Aspect (Etype (Exp), Aspect_Aggregate))
+ and then not Is_Record_Aggregate;
+ end Is_Container_Aggregate;
+
---------------------------------
-- Side_Effect_Free_Statements --
---------------------------------
@@ -13541,6 +14218,96 @@ package body Sem_Util is
end In_Subtree;
---------------------
+ -- In_Return_Value --
+ ---------------------
+
+ function In_Return_Value (Expr : Node_Id) return Boolean is
+ Par : Node_Id;
+ Prev_Par : Node_Id;
+ Pre : Node_Id;
+ In_Function_Call : Boolean := False;
+
+ begin
+ -- Move through parent nodes to determine if Expr contributes to the
+ -- return value of the current subprogram.
+
+ Par := Expr;
+ Prev_Par := Empty;
+ while Present (Par) loop
+
+ case Nkind (Par) is
+ -- Ignore ranges and they don't contribute to the result
+
+ when N_Range =>
+ return False;
+
+ -- An object declaration whose parent is an extended return
+ -- statement is a return object.
+
+ when N_Object_Declaration =>
+ if Present (Parent (Par))
+ and then Nkind (Parent (Par)) = N_Extended_Return_Statement
+ then
+ return True;
+ end if;
+
+ -- We hit a simple return statement, so we know we are in one
+
+ when N_Simple_Return_Statement =>
+ return True;
+
+ -- Only include one nexting level of function calls
+
+ when N_Function_Call =>
+ if not In_Function_Call then
+ In_Function_Call := True;
+ else
+ return False;
+ end if;
+
+ -- Check if we are on the right-hand side of an assignment
+ -- statement to a return object.
+
+ -- This is not specified in the RM ???
+
+ when N_Assignment_Statement =>
+ if Prev_Par = Name (Par) then
+ return False;
+ end if;
+
+ Pre := Name (Par);
+ while Present (Pre) loop
+ if Is_Entity_Name (Pre)
+ and then Is_Return_Object (Entity (Pre))
+ then
+ return True;
+ end if;
+
+ exit when Nkind (Pre) not in N_Selected_Component
+ | N_Indexed_Component
+ | N_Slice;
+
+ Pre := Prefix (Pre);
+ end loop;
+
+ -- Otherwise, we hit a master which was not relevant
+
+ when others =>
+ if Is_Master (Par) then
+ return False;
+ end if;
+ end case;
+
+ -- Iterate up to the next parent, keeping track of the previous one
+
+ Prev_Par := Par;
+ Par := Parent (Par);
+ end loop;
+
+ return False;
+ end In_Return_Value;
+
+ ---------------------
-- In_Visible_Part --
---------------------
@@ -13951,7 +14718,7 @@ package body Sem_Util is
-- ^
-- Item
- if Has_Rep_Item (From_Typ, Next_Item) then
+ if Present_In_Rep_Item (From_Typ, Next_Item) then
exit;
end if;
@@ -14297,10 +15064,20 @@ package body Sem_Util is
Name_Signed_16 => RTE (RE_IS_Is2),
Name_Signed_32 => RTE (RE_IS_Is4),
Name_Signed_64 => RTE (RE_IS_Is8),
+ Name_Signed_128 => Empty,
Name_Unsigned_8 => RTE (RE_IS_Iu1),
Name_Unsigned_16 => RTE (RE_IS_Iu2),
Name_Unsigned_32 => RTE (RE_IS_Iu4),
- Name_Unsigned_64 => RTE (RE_IS_Iu8));
+ Name_Unsigned_64 => RTE (RE_IS_Iu8),
+ Name_Unsigned_128 => Empty);
+
+ if System_Max_Integer_Size < 128 then
+ Invalid_Binder_Values (Name_Signed_128) := RTE (RE_IS_Is8);
+ Invalid_Binder_Values (Name_Unsigned_128) := RTE (RE_IS_Iu8);
+ else
+ Invalid_Binder_Values (Name_Signed_128) := RTE (RE_IS_Is16);
+ Invalid_Binder_Values (Name_Unsigned_128) := RTE (RE_IS_Iu16);
+ end if;
end if;
end Set_Invalid_Binder_Values;
@@ -14337,6 +15114,16 @@ package body Sem_Util is
return Nkind (Par) in N_Subprogram_Call;
end Is_Anonymous_Access_Actual;
+ ------------------------
+ -- Is_Access_Variable --
+ ------------------------
+
+ function Is_Access_Variable (E : Entity_Id) return Boolean is
+ begin
+ return Is_Access_Object_Type (E)
+ and then not Is_Access_Constant (E);
+ end Is_Access_Variable;
+
-----------------------------
-- Is_Actual_Out_Parameter --
-----------------------------
@@ -14553,15 +15340,6 @@ package body Sem_Util is
end Is_Atomic_Object_Entity;
-----------------------------
- -- Is_Atomic_Or_VFA_Object --
- -----------------------------
-
- function Is_Atomic_Or_VFA_Object (N : Node_Id) return Boolean is
- begin
- return Is_Atomic_Object (N) or else Is_Volatile_Full_Access_Object (N);
- end Is_Atomic_Or_VFA_Object;
-
- -----------------------------
-- Is_Attribute_Loop_Entry --
-----------------------------
@@ -14821,6 +15599,120 @@ package body Sem_Util is
return False;
end Is_Child_Or_Sibling;
+ -------------------
+ -- Is_Confirming --
+ -------------------
+
+ function Is_Confirming (Aspect : Nonoverridable_Aspect_Id;
+ Aspect_Spec_1, Aspect_Spec_2 : Node_Id)
+ return Boolean is
+ function Names_Match (Nm1, Nm2 : Node_Id) return Boolean;
+ function Names_Match (Nm1, Nm2 : Node_Id) return Boolean is
+ begin
+ if Nkind (Nm1) /= Nkind (Nm2) then
+ return False;
+ end if;
+ case Nkind (Nm1) is
+ when N_Identifier =>
+ return Name_Equals (Chars (Nm1), Chars (Nm2));
+ when N_Expanded_Name =>
+ return Names_Match (Prefix (Nm1), Prefix (Nm2))
+ and then Names_Match (Selector_Name (Nm1),
+ Selector_Name (Nm2));
+ when N_Empty =>
+ return True; -- needed for Aggregate aspect checking
+
+ when others =>
+ -- e.g., 'Class attribute references
+ if Is_Entity_Name (Nm1) and Is_Entity_Name (Nm2) then
+ return Entity (Nm1) = Entity (Nm2);
+ end if;
+
+ raise Program_Error;
+ end case;
+ end Names_Match;
+ begin
+ -- allow users to disable "shall be confirming" check, at least for now
+ if Relaxed_RM_Semantics then
+ return True;
+ end if;
+
+ -- ??? Type conversion here (along with "when others =>" below) is a
+ -- workaround for a bootstrapping problem related to casing on a
+ -- static-predicate-bearing subtype.
+
+ case Aspect_Id (Aspect) is
+ -- name-valued aspects; compare text of names, not resolution.
+ when Aspect_Default_Iterator
+ | Aspect_Iterator_Element
+ | Aspect_Constant_Indexing
+ | Aspect_Variable_Indexing
+ | Aspect_Implicit_Dereference =>
+ declare
+ Item_1 : constant Node_Id := Aspect_Rep_Item (Aspect_Spec_1);
+ Item_2 : constant Node_Id := Aspect_Rep_Item (Aspect_Spec_2);
+ begin
+ if (Nkind (Item_1) /= N_Attribute_Definition_Clause)
+ or (Nkind (Item_2) /= N_Attribute_Definition_Clause)
+ then
+ pragma Assert (Serious_Errors_Detected > 0);
+ return True;
+ end if;
+
+ return Names_Match (Expression (Item_1),
+ Expression (Item_2));
+ end;
+
+ -- one of a kind
+ when Aspect_Aggregate =>
+ declare
+ Empty_1,
+ Add_Named_1,
+ Add_Unnamed_1,
+ New_Indexed_1,
+ Assign_Indexed_1,
+ Empty_2,
+ Add_Named_2,
+ Add_Unnamed_2,
+ New_Indexed_2,
+ Assign_Indexed_2 : Node_Id := Empty;
+ begin
+ Parse_Aspect_Aggregate
+ (N => Expression (Aspect_Spec_1),
+ Empty_Subp => Empty_1,
+ Add_Named_Subp => Add_Named_1,
+ Add_Unnamed_Subp => Add_Unnamed_1,
+ New_Indexed_Subp => New_Indexed_1,
+ Assign_Indexed_Subp => Assign_Indexed_1);
+ Parse_Aspect_Aggregate
+ (N => Expression (Aspect_Spec_2),
+ Empty_Subp => Empty_2,
+ Add_Named_Subp => Add_Named_2,
+ Add_Unnamed_Subp => Add_Unnamed_2,
+ New_Indexed_Subp => New_Indexed_2,
+ Assign_Indexed_Subp => Assign_Indexed_2);
+ return
+ Names_Match (Empty_1, Empty_2) and then
+ Names_Match (Add_Named_1, Add_Named_2) and then
+ Names_Match (Add_Unnamed_1, Add_Unnamed_2) and then
+ Names_Match (New_Indexed_1, New_Indexed_2) and then
+ Names_Match (Assign_Indexed_1, Assign_Indexed_2);
+ end;
+
+ -- scalar-valued aspects; compare (static) values.
+ when Aspect_Max_Entry_Queue_Length -- | Aspect_No_Controlled_Parts
+ =>
+ -- This should be unreachable. No_Controlled_Parts is
+ -- not yet supported at all in GNAT and Max_Entry_Queue_Length
+ -- is supported only for protected entries, not for types.
+ pragma Assert (Serious_Errors_Detected /= 0);
+ return True;
+
+ when others =>
+ raise Program_Error;
+ end case;
+ end Is_Confirming;
+
-----------------------------
-- Is_Concurrent_Interface --
-----------------------------
@@ -15756,35 +16648,115 @@ package body Sem_Util is
end if;
end Is_Effectively_Volatile;
+ -----------------------------------------
+ -- Is_Effectively_Volatile_For_Reading --
+ -----------------------------------------
+
+ function Is_Effectively_Volatile_For_Reading
+ (Id : Entity_Id) return Boolean
+ is
+ begin
+ -- A concurrent type is effectively volatile for reading
+
+ if Is_Concurrent_Type (Id) then
+ return True;
+
+ elsif Is_Effectively_Volatile (Id) then
+
+ -- Other volatile types and objects are effectively volatile for
+ -- reading when they have property Async_Writers or Effective_Reads
+ -- set to True. This includes the case of an array type whose
+ -- Volatile_Components aspect is True (hence it is effectively
+ -- volatile) which does not have the properties Async_Writers
+ -- and Effective_Reads set to False.
+
+ if Async_Writers_Enabled (Id)
+ or else Effective_Reads_Enabled (Id)
+ then
+ return True;
+
+ -- In addition, an array type is effectively volatile for reading
+ -- when its component type is effectively volatile for reading.
+
+ elsif Is_Array_Type (Id) then
+ declare
+ Anc : Entity_Id := Base_Type (Id);
+ begin
+ if Is_Private_Type (Anc) then
+ Anc := Full_View (Anc);
+ end if;
+
+ -- Test for presence of ancestor, as the full view of a
+ -- private type may be missing in case of error.
+
+ return
+ Present (Anc)
+ and then Is_Effectively_Volatile_For_Reading
+ (Component_Type (Anc));
+ end;
+ end if;
+ end if;
+
+ return False;
+
+ end Is_Effectively_Volatile_For_Reading;
+
------------------------------------
-- Is_Effectively_Volatile_Object --
------------------------------------
function Is_Effectively_Volatile_Object (N : Node_Id) return Boolean is
+ function Is_Effectively_Volatile_Object_Inst
+ is new Is_Effectively_Volatile_Object_Shared (Is_Effectively_Volatile);
+ begin
+ return Is_Effectively_Volatile_Object_Inst (N);
+ end Is_Effectively_Volatile_Object;
+
+ ------------------------------------------------
+ -- Is_Effectively_Volatile_Object_For_Reading --
+ ------------------------------------------------
+
+ function Is_Effectively_Volatile_Object_For_Reading
+ (N : Node_Id) return Boolean
+ is
+ function Is_Effectively_Volatile_Object_For_Reading_Inst
+ is new Is_Effectively_Volatile_Object_Shared
+ (Is_Effectively_Volatile_For_Reading);
+ begin
+ return Is_Effectively_Volatile_Object_For_Reading_Inst (N);
+ end Is_Effectively_Volatile_Object_For_Reading;
+
+ -------------------------------------------
+ -- Is_Effectively_Volatile_Object_Shared --
+ -------------------------------------------
+
+ function Is_Effectively_Volatile_Object_Shared
+ (N : Node_Id) return Boolean
+ is
begin
if Is_Entity_Name (N) then
return Is_Object (Entity (N))
- and then Is_Effectively_Volatile (Entity (N));
+ and then Is_Effectively_Volatile_Entity (Entity (N));
elsif Nkind (N) in N_Indexed_Component | N_Slice then
- return Is_Effectively_Volatile_Object (Prefix (N));
+ return Is_Effectively_Volatile_Object_Shared (Prefix (N));
elsif Nkind (N) = N_Selected_Component then
return
- Is_Effectively_Volatile_Object (Prefix (N))
+ Is_Effectively_Volatile_Object_Shared (Prefix (N))
or else
- Is_Effectively_Volatile_Object (Selector_Name (N));
+ Is_Effectively_Volatile_Object_Shared (Selector_Name (N));
elsif Nkind (N) in N_Qualified_Expression
| N_Unchecked_Type_Conversion
| N_Type_Conversion
then
- return Is_Effectively_Volatile_Object (Expression (N));
+ return Is_Effectively_Volatile_Object_Shared (Expression (N));
else
return False;
end if;
- end Is_Effectively_Volatile_Object;
+ end Is_Effectively_Volatile_Object_Shared;
-------------------
-- Is_Entry_Body --
@@ -15968,6 +16940,15 @@ package body Sem_Util is
return R;
end Is_Fixed_Model_Number;
+ -----------------------------
+ -- Is_Full_Access_Object --
+ -----------------------------
+
+ function Is_Full_Access_Object (N : Node_Id) return Boolean is
+ begin
+ return Is_Atomic_Object (N) or else Is_Volatile_Full_Access_Object (N);
+ end Is_Full_Access_Object;
+
-------------------------------
-- Is_Fully_Initialized_Type --
-------------------------------
@@ -16609,6 +17590,62 @@ package body Sem_Util is
end if;
end Is_Local_Variable_Reference;
+ ---------------
+ -- Is_Master --
+ ---------------
+
+ function Is_Master (N : Node_Id) return Boolean is
+ Disable_Subexpression_Masters : constant Boolean := True;
+
+ begin
+ if Nkind (N) in N_Subprogram_Body | N_Task_Body | N_Entry_Body
+ or else Is_Statement (N)
+ then
+ return True;
+ end if;
+
+ -- We avoid returning True when the master is a subexpression described
+ -- in RM 7.6.1(3/2) for the proposes of accessibility level calculation
+ -- in Accessibility_Level_Helper.Innermost_Master_Scope_Depth ???
+
+ if not Disable_Subexpression_Masters
+ and then Nkind (N) in N_Subexpr
+ then
+ declare
+ Par : Node_Id := N;
+
+ subtype N_Simple_Statement_Other_Than_Simple_Return
+ is Node_Kind with Static_Predicate =>
+ N_Simple_Statement_Other_Than_Simple_Return
+ in N_Abort_Statement
+ | N_Assignment_Statement
+ | N_Code_Statement
+ | N_Delay_Statement
+ | N_Entry_Call_Statement
+ | N_Free_Statement
+ | N_Goto_Statement
+ | N_Null_Statement
+ | N_Raise_Statement
+ | N_Requeue_Statement
+ | N_Exit_Statement
+ | N_Procedure_Call_Statement;
+ begin
+ while Present (Par) loop
+ Par := Parent (Par);
+ if Nkind (Par) in N_Subexpr |
+ N_Simple_Statement_Other_Than_Simple_Return
+ then
+ return False;
+ end if;
+ end loop;
+
+ return True;
+ end;
+ end if;
+
+ return False;
+ end Is_Master;
+
-----------------------
-- Is_Name_Reference --
-----------------------
@@ -17906,6 +18943,7 @@ package body Sem_Util is
is
Par : constant Node_Id := Parent (Expr);
+ function Aggregate_Type return Node_Id is (Etype (Parent (Par)));
begin
if Nkind (Par) = N_If_Expression then
return Is_Elsif (Par) or else Expr /= First (Expressions (Par));
@@ -17933,55 +18971,69 @@ package body Sem_Util is
elsif Nkind (Par) = N_Quantified_Expression then
return Expr = Condition (Par);
- elsif Nkind (Par) = N_Aggregate
- and then Present (Etype (Par))
- and then Etype (Par) /= Any_Composite
- and then Is_Array_Type (Etype (Par))
- and then Nkind (Expr) = N_Component_Association
+ elsif Nkind (Par) = N_Component_Association
+ and then Expr = Expression (Par)
+ and then Nkind (Parent (Par))
+ in N_Aggregate | N_Delta_Aggregate | N_Extension_Aggregate
+ and then Present (Aggregate_Type)
+ and then Aggregate_Type /= Any_Composite
then
- declare
- Choice : Node_Id;
- In_Others_Choice : Boolean := False;
-
- begin
- -- The expression of an array_component_association is
- -- potentially unevaluated if the associated choice is a
- -- subtype_indication or range that defines a nonstatic or
- -- null range.
+ if Is_Array_Type (Aggregate_Type) then
+ if Ada_Version >= Ada_2020 then
+ -- For Ada_2020, this predicate returns True for
+ -- any "repeatedly evaluated" expression.
+ return True;
+ end if;
- Choice := First (Choices (Expr));
- while Present (Choice) loop
- if Nkind (Choice) = N_Range
- and then Non_Static_Or_Null_Range (Choice)
- then
- return True;
+ declare
+ Choice : Node_Id;
+ In_Others_Choice : Boolean := False;
+ Array_Agg : constant Node_Id := Parent (Par);
+ begin
+ -- The expression of an array_component_association is
+ -- potentially unevaluated if the associated choice is a
+ -- subtype_indication or range that defines a nonstatic or
+ -- null range.
+
+ Choice := First (Choices (Par));
+ while Present (Choice) loop
+ if Nkind (Choice) = N_Range
+ and then Non_Static_Or_Null_Range (Choice)
+ then
+ return True;
- elsif Nkind (Choice) = N_Identifier
- and then Present (Scalar_Range (Etype (Choice)))
- and then
- Non_Static_Or_Null_Range (Scalar_Range (Etype (Choice)))
- then
- return True;
+ elsif Nkind (Choice) = N_Identifier
+ and then Present (Scalar_Range (Etype (Choice)))
+ and then
+ Non_Static_Or_Null_Range
+ (Scalar_Range (Etype (Choice)))
+ then
+ return True;
- elsif Nkind (Choice) = N_Others_Choice then
- In_Others_Choice := True;
- end if;
+ elsif Nkind (Choice) = N_Others_Choice then
+ In_Others_Choice := True;
+ end if;
- Next (Choice);
- end loop;
+ Next (Choice);
+ end loop;
- -- It is also potentially unevaluated if the associated choice
- -- is an others choice and the applicable index constraint is
- -- nonstatic or null.
+ -- It is also potentially unevaluated if the associated
+ -- choice is an others choice and the applicable index
+ -- constraint is nonstatic or null.
- if In_Others_Choice then
- if not Compile_Time_Known_Bounds (Etype (Par)) then
- return True;
- else
- return Has_Null_Others_Choice (Par);
+ if In_Others_Choice then
+ if not Compile_Time_Known_Bounds (Aggregate_Type) then
+ return True;
+ else
+ return Has_Null_Others_Choice (Array_Agg);
+ end if;
end if;
- end if;
- end;
+ end;
+
+ elsif Is_Container_Aggregate (Parent (Par)) then
+ -- a component of a container aggregate
+ return True;
+ end if;
return False;
@@ -18765,8 +19817,10 @@ package body Sem_Util is
--------------------------------------
function Is_Special_Aliased_Formal_Access
- (Exp : Node_Id;
- Scop : Entity_Id) return Boolean is
+ (Exp : Node_Id;
+ In_Return_Context : Boolean := False) return Boolean
+ is
+ Scop : constant Entity_Id := Current_Subprogram;
begin
-- Verify the expression is an access reference to 'Access within a
-- return statement as this is the only time an explicitly aliased
@@ -18774,7 +19828,9 @@ package body Sem_Util is
if Nkind (Exp) /= N_Attribute_Reference
or else Get_Attribute_Id (Attribute_Name (Exp)) /= Attribute_Access
- or else Nkind (Parent (Exp)) /= N_Simple_Return_Statement
+ or else not (In_Return_Value (Exp)
+ or else In_Return_Context)
+ or else not Needs_Result_Accessibility_Level (Scop)
then
return False;
end if;
@@ -18784,17 +19840,8 @@ package body Sem_Util is
-- that Scop returns an anonymous access type, otherwise the special
-- rules dictating a need for a dynamic check are not in effect.
- declare
- P_Ult : constant Node_Id := Ultimate_Prefix (Prefix (Exp));
- begin
- return Is_Entity_Name (P_Ult)
- and then Is_Aliased (Entity (P_Ult))
- and then Is_Formal (Entity (P_Ult))
- and then Scope (Entity (P_Ult)) = Scop
- and then Ekind (Scop) in
- E_Function | E_Operator | E_Subprogram_Type
- and then Needs_Result_Accessibility_Level (Scop);
- end;
+ return Is_Entity_Name (Prefix (Exp))
+ and then Is_Explicitly_Aliased (Entity (Prefix (Exp)));
end Is_Special_Aliased_Formal_Access;
-----------------------------
@@ -18835,16 +19882,21 @@ package body Sem_Util is
function Is_Static_Function (Subp : Entity_Id) return Boolean is
begin
- return Has_Aspect (Subp, Aspect_Static)
+ -- Always return False for pre Ada 2020 to e.g. ignore the Static
+ -- aspect in package Interfaces for Ada_Version < 2020 and also
+ -- for efficiency.
+
+ return Ada_Version >= Ada_2020
+ and then Has_Aspect (Subp, Aspect_Static)
and then
(No (Find_Value_Of_Aspect (Subp, Aspect_Static))
or else Is_True (Static_Boolean
(Find_Value_Of_Aspect (Subp, Aspect_Static))));
end Is_Static_Function;
- ------------------------------
- -- Is_Static_Function_Call --
- ------------------------------
+ -----------------------------
+ -- Is_Static_Function_Call --
+ -----------------------------
function Is_Static_Function_Call (Call : Node_Id) return Boolean is
function Has_All_Static_Actuals (Call : Node_Id) return Boolean;
@@ -18897,11 +19949,12 @@ package body Sem_Util is
and then Has_All_Static_Actuals (Call);
end Is_Static_Function_Call;
- ----------------------------------------
- -- Is_Subcomponent_Of_Atomic_Object --
- ----------------------------------------
+ -------------------------------------------
+ -- Is_Subcomponent_Of_Full_Access_Object --
+ -------------------------------------------
- function Is_Subcomponent_Of_Atomic_Object (N : Node_Id) return Boolean is
+ function Is_Subcomponent_Of_Full_Access_Object (N : Node_Id) return Boolean
+ is
R : Node_Id;
begin
@@ -18914,19 +19967,19 @@ package body Sem_Util is
-- If the prefix is an access value, only the designated type matters
if Is_Access_Type (Etype (R)) then
- if Is_Atomic (Designated_Type (Etype (R))) then
+ if Is_Full_Access (Designated_Type (Etype (R))) then
return True;
end if;
else
- if Is_Atomic_Object (R) then
+ if Is_Full_Access_Object (R) then
return True;
end if;
end if;
end loop;
return False;
- end Is_Subcomponent_Of_Atomic_Object;
+ end Is_Subcomponent_Of_Full_Access_Object;
---------------------------------------
-- Is_Subprogram_Contract_Annotation --
@@ -18958,6 +20011,7 @@ package body Sem_Util is
or else Nam = Name_Refined_Depends
or else Nam = Name_Refined_Global
or else Nam = Name_Refined_Post
+ or else Nam = Name_Subprogram_Variant
or else Nam = Name_Test_Case;
end Is_Subprogram_Contract_Annotation;
@@ -19064,9 +20118,12 @@ package body Sem_Util is
then
return True;
- -- A constant is a synchronized object by default
+ -- A constant is a synchronized object by default, unless its type is
+ -- access-to-variable type.
- elsif Ekind (Id) = E_Constant then
+ elsif Ekind (Id) = E_Constant
+ and then not Is_Access_Variable (Etype (Id))
+ then
return True;
-- A variable is a synchronized object if it is subject to pragma
@@ -19158,7 +20215,7 @@ package body Sem_Util is
function Is_True (U : Uint) return Boolean is
begin
- return (U /= 0);
+ return U /= 0;
end Is_True;
--------------------------------------
@@ -19556,7 +20613,7 @@ package body Sem_Util is
function Is_View_Conversion (N : Node_Id) return Boolean is
begin
if Nkind (N) = N_Type_Conversion
- and then Nkind (Unqual_Conv (N)) = N_Identifier
+ and then Nkind (Unqual_Conv (N)) in N_Has_Etype
then
if Is_Tagged_Type (Etype (N))
and then Is_Tagged_Type (Etype (Unqual_Conv (N)))
@@ -24304,350 +25361,6 @@ package body Sem_Util is
return Num;
end Number_Of_Elements_In_Array;
- -------------------------
- -- Object_Access_Level --
- -------------------------
-
- -- Returns the static accessibility level of the view denoted by Obj. Note
- -- that the value returned is the result of a call to Scope_Depth. Only
- -- scope depths associated with dynamic scopes can actually be returned.
- -- Since only relative levels matter for accessibility checking, the fact
- -- that the distance between successive levels of accessibility is not
- -- always one is immaterial (invariant: if level(E2) is deeper than
- -- level(E1), then Scope_Depth(E1) < Scope_Depth(E2)).
-
- function Object_Access_Level (Obj : Node_Id) return Uint is
- function Is_Interface_Conversion (N : Node_Id) return Boolean;
- -- Determine whether N is a construct of the form
- -- Some_Type (Operand._tag'Address)
- -- This construct appears in the context of dispatching calls.
-
- function Reference_To (Obj : Node_Id) return Node_Id;
- -- An explicit dereference is created when removing side effects from
- -- expressions for constraint checking purposes. In this case a local
- -- access type is created for it. The correct access level is that of
- -- the original source node. We detect this case by noting that the
- -- prefix of the dereference is created by an object declaration whose
- -- initial expression is a reference.
-
- -----------------------------
- -- Is_Interface_Conversion --
- -----------------------------
-
- function Is_Interface_Conversion (N : Node_Id) return Boolean is
- begin
- return Nkind (N) = N_Unchecked_Type_Conversion
- and then Nkind (Expression (N)) = N_Attribute_Reference
- and then Attribute_Name (Expression (N)) = Name_Address;
- end Is_Interface_Conversion;
-
- ------------------
- -- Reference_To --
- ------------------
-
- function Reference_To (Obj : Node_Id) return Node_Id is
- Pref : constant Node_Id := Prefix (Obj);
- begin
- if Is_Entity_Name (Pref)
- and then Nkind (Parent (Entity (Pref))) = N_Object_Declaration
- and then Present (Expression (Parent (Entity (Pref))))
- and then Nkind (Expression (Parent (Entity (Pref)))) = N_Reference
- then
- return (Prefix (Expression (Parent (Entity (Pref)))));
- else
- return Empty;
- end if;
- end Reference_To;
-
- -- Local variables
-
- E : Entity_Id;
- Orig_Obj : Node_Id := Original_Node (Obj);
- Orig_Pre : Node_Id;
-
- -- Start of processing for Object_Access_Level
-
- begin
- -- In the case of an expanded implicit dereference we swap the original
- -- object to be the expanded conversion.
-
- if Nkind (Obj) = N_Explicit_Dereference
- and then Nkind (Orig_Obj) /= N_Explicit_Dereference
- then
- Orig_Obj := Obj;
- end if;
-
- -- Calculate the object node's accessibility level
-
- if Nkind (Orig_Obj) = N_Defining_Identifier
- or else Is_Entity_Name (Orig_Obj)
- then
- if Nkind (Orig_Obj) = N_Defining_Identifier then
- E := Orig_Obj;
- else
- E := Entity (Orig_Obj);
- end if;
-
- if Is_Prival (E) then
- E := Prival_Link (E);
- end if;
-
- -- If E is a type then it denotes a current instance. For this case
- -- we add one to the normal accessibility level of the type to ensure
- -- that current instances are treated as always being deeper than
- -- than the level of any visible named access type (see 3.10.2(21)).
-
- if Is_Type (E) then
- return Type_Access_Level (E) + 1;
-
- elsif Present (Renamed_Object (E)) then
- return Object_Access_Level (Renamed_Object (E));
-
- -- Similarly, if E is a component of the current instance of a
- -- protected type, any instance of it is assumed to be at a deeper
- -- level than the type. For a protected object (whose type is an
- -- anonymous protected type) its components are at the same level
- -- as the type itself.
-
- elsif not Is_Overloadable (E)
- and then Ekind (Scope (E)) = E_Protected_Type
- and then Comes_From_Source (Scope (E))
- then
- return Type_Access_Level (Scope (E)) + 1;
-
- -- An object of a named access type gets its level from its
- -- associated type.
-
- elsif Is_Named_Access_Type (Etype (E)) then
- return Type_Access_Level (Etype (E));
-
- else
- return Scope_Depth (Enclosing_Dynamic_Scope (E));
- end if;
-
- elsif Nkind (Orig_Obj) in N_Indexed_Component | N_Selected_Component then
- Orig_Pre := Original_Node (Prefix (Orig_Obj));
-
- if Is_Access_Type (Etype (Orig_Pre)) then
- return Type_Access_Level (Etype (Orig_Pre));
- else
- return Object_Access_Level (Prefix (Orig_Obj));
- end if;
-
- elsif Nkind (Orig_Obj) = N_Explicit_Dereference then
- Orig_Pre := Original_Node (Prefix (Orig_Obj));
-
- -- If the prefix is a selected access discriminant then we make a
- -- recursive call on the prefix, which will in turn check the level
- -- of the prefix object of the selected discriminant.
-
- -- In Ada 2012, if the discriminant has implicit dereference and
- -- the context is a selected component, treat this as an object of
- -- unknown scope (see below). This is necessary in compile-only mode;
- -- otherwise expansion will already have transformed the prefix into
- -- a temporary.
-
- if Nkind (Orig_Pre) = N_Selected_Component
- and then Ekind (Etype (Orig_Pre)) = E_Anonymous_Access_Type
- and then
- Ekind (Entity (Selector_Name (Orig_Pre))) = E_Discriminant
- and then
- (not Has_Implicit_Dereference
- (Entity (Selector_Name (Orig_Pre)))
- or else Nkind (Parent (Obj)) /= N_Selected_Component)
- then
- return Object_Access_Level (Prefix (Orig_Obj));
-
- -- Detect an interface conversion in the context of a dispatching
- -- call. Use the original form of the conversion to find the access
- -- level of the operand.
-
- elsif Is_Interface (Etype (Orig_Obj))
- and then Is_Interface_Conversion (Orig_Pre)
- and then Nkind (Orig_Obj) = N_Type_Conversion
- then
- return Object_Access_Level (Orig_Obj);
-
- elsif not Comes_From_Source (Orig_Obj) then
- declare
- Ref : constant Node_Id := Reference_To (Orig_Obj);
- begin
- if Present (Ref) then
- return Object_Access_Level (Ref);
- else
- return Type_Access_Level (Etype (Prefix (Orig_Obj)));
- end if;
- end;
-
- else
- return Type_Access_Level (Etype (Prefix (Orig_Obj)));
- end if;
-
- elsif Nkind (Orig_Obj) in N_Type_Conversion | N_Unchecked_Type_Conversion
- then
- return Object_Access_Level (Expression (Orig_Obj));
-
- elsif Nkind (Orig_Obj) = N_Function_Call then
-
- -- Function results are objects, so we get either the access level of
- -- the function or, in the case of an indirect call, the level of the
- -- access-to-subprogram type. (This code is used for Ada 95, but it
- -- looks wrong, because it seems that we should be checking the level
- -- of the call itself, even for Ada 95. However, using the Ada 2005
- -- version of the code causes regressions in several tests that are
- -- compiled with -gnat95. ???)
-
- if Ada_Version < Ada_2005 then
- if Is_Entity_Name (Name (Orig_Obj)) then
- return Subprogram_Access_Level (Entity (Name (Orig_Obj)));
- else
- return Type_Access_Level (Etype (Prefix (Name (Orig_Obj))));
- end if;
-
- -- For Ada 2005, the level of the result object of a function call is
- -- defined to be the level of the call's innermost enclosing master.
- -- We determine that by querying the depth of the innermost enclosing
- -- dynamic scope.
-
- else
- Return_Master_Scope_Depth_Of_Call : declare
- function Innermost_Master_Scope_Depth
- (N : Node_Id) return Uint;
- -- Returns the scope depth of the given node's innermost
- -- enclosing dynamic scope (effectively the accessibility
- -- level of the innermost enclosing master).
-
- ----------------------------------
- -- Innermost_Master_Scope_Depth --
- ----------------------------------
-
- function Innermost_Master_Scope_Depth
- (N : Node_Id) return Uint
- is
- Node_Par : Node_Id := Parent (N);
-
- begin
- -- Locate the nearest enclosing node (by traversing Parents)
- -- that Defining_Entity can be applied to, and return the
- -- depth of that entity's nearest enclosing dynamic scope.
-
- while Present (Node_Par) loop
- case Nkind (Node_Par) is
- when N_Abstract_Subprogram_Declaration
- | N_Block_Statement
- | N_Body_Stub
- | N_Component_Declaration
- | N_Entry_Body
- | N_Entry_Declaration
- | N_Exception_Declaration
- | N_Formal_Object_Declaration
- | N_Formal_Package_Declaration
- | N_Formal_Subprogram_Declaration
- | N_Formal_Type_Declaration
- | N_Full_Type_Declaration
- | N_Function_Specification
- | N_Generic_Declaration
- | N_Generic_Instantiation
- | N_Implicit_Label_Declaration
- | N_Incomplete_Type_Declaration
- | N_Loop_Parameter_Specification
- | N_Number_Declaration
- | N_Object_Declaration
- | N_Package_Declaration
- | N_Package_Specification
- | N_Parameter_Specification
- | N_Private_Extension_Declaration
- | N_Private_Type_Declaration
- | N_Procedure_Specification
- | N_Proper_Body
- | N_Protected_Type_Declaration
- | N_Renaming_Declaration
- | N_Single_Protected_Declaration
- | N_Single_Task_Declaration
- | N_Subprogram_Declaration
- | N_Subtype_Declaration
- | N_Subunit
- | N_Task_Type_Declaration
- =>
- return Scope_Depth
- (Nearest_Dynamic_Scope
- (Defining_Entity (Node_Par)));
-
- -- For a return statement within a function, return
- -- the depth of the function itself. This is not just
- -- a small optimization, but matters when analyzing
- -- the expression in an expression function before
- -- the body is created.
-
- when N_Simple_Return_Statement =>
- if Ekind (Current_Scope) = E_Function then
- return Scope_Depth (Current_Scope);
- end if;
-
- when others =>
- null;
- end case;
-
- Node_Par := Parent (Node_Par);
- end loop;
-
- pragma Assert (False);
-
- -- Should never reach the following return
-
- return Scope_Depth (Current_Scope) + 1;
- end Innermost_Master_Scope_Depth;
-
- -- Start of processing for Return_Master_Scope_Depth_Of_Call
-
- begin
- -- Expanded code may have clobbered the scoping data from the
- -- original object node - so use the expanded one.
-
- return Innermost_Master_Scope_Depth (Obj);
- end Return_Master_Scope_Depth_Of_Call;
- end if;
-
- -- For convenience we handle qualified expressions, even though they
- -- aren't technically object names.
-
- elsif Nkind (Orig_Obj) = N_Qualified_Expression then
- return Object_Access_Level (Expression (Orig_Obj));
-
- -- Ditto for aggregates. They have the level of the temporary that
- -- will hold their value.
-
- elsif Nkind (Orig_Obj) = N_Aggregate then
- return Object_Access_Level (Current_Scope);
-
- -- Treat an Old/Loop_Entry attribute reference like an aggregate.
- -- AARM 6.1.1(27.d) says "... the implicit constant declaration
- -- defines the accessibility level of X'Old", so that is what
- -- we are trying to implement here.
-
- elsif Nkind (Orig_Obj) = N_Attribute_Reference
- and then Attribute_Name (Orig_Obj) in Name_Old | Name_Loop_Entry
- then
- return Object_Access_Level (Current_Scope);
-
- -- Move up the attribute reference when we encounter a 'Access variation
-
- elsif Nkind (Orig_Obj) = N_Attribute_Reference
- and then Attribute_Name (Orig_Obj) in Name_Access
- | Name_Unchecked_Access
- | Name_Unrestricted_Access
- then
- return Object_Access_Level (Prefix (Orig_Obj));
-
- -- Otherwise return the scope level of Standard. (If there are cases
- -- that fall through to this point they will be treated as having
- -- global accessibility for now. ???)
-
- else
- return Scope_Depth (Standard_Standard);
- end if;
- end Object_Access_Level;
-
----------------------------------
-- Old_Requires_Transient_Scope --
----------------------------------
@@ -24874,6 +25587,100 @@ package body Sem_Util is
Write_Eol;
end Output_Name;
+ ------------------
+ -- Param_Entity --
+ ------------------
+
+ -- This would be trivial, simply a test for an identifier that was a
+ -- reference to a formal, if it were not for the fact that a previous call
+ -- to Expand_Entry_Parameter will have modified the reference to the
+ -- identifier. A formal of a protected entity is rewritten as
+
+ -- typ!(recobj).rec.all'Constrained
+
+ -- where rec is a selector whose Entry_Formal link points to the formal
+
+ -- If the type of the entry parameter has a representation clause, then an
+ -- extra temp is involved (see below).
+
+ -- For a formal of a task entity, the formal is rewritten as a local
+ -- renaming.
+
+ -- In addition, a formal that is marked volatile because it is aliased
+ -- through an address clause is rewritten as dereference as well.
+
+ function Param_Entity (N : Node_Id) return Entity_Id is
+ Renamed_Obj : Node_Id;
+
+ begin
+ -- Simple reference case
+
+ if Nkind (N) in N_Identifier | N_Expanded_Name then
+ if Is_Formal (Entity (N)) then
+ return Entity (N);
+
+ -- Handle renamings of formal parameters and formals of tasks that
+ -- are rewritten as renamings.
+
+ elsif Nkind (Parent (Entity (N))) = N_Object_Renaming_Declaration then
+ Renamed_Obj := Get_Referenced_Object (Renamed_Object (Entity (N)));
+
+ if Is_Entity_Name (Renamed_Obj)
+ and then Is_Formal (Entity (Renamed_Obj))
+ then
+ return Entity (Renamed_Obj);
+
+ elsif
+ Nkind (Parent (Parent (Entity (N)))) = N_Accept_Statement
+ then
+ return Entity (N);
+ end if;
+ end if;
+
+ else
+ if Nkind (N) = N_Explicit_Dereference then
+ declare
+ P : Node_Id := Prefix (N);
+ S : Node_Id;
+ E : Entity_Id;
+ Decl : Node_Id;
+
+ begin
+ -- If the type of an entry parameter has a representation
+ -- clause, then the prefix is not a selected component, but
+ -- instead a reference to a temp pointing at the selected
+ -- component. In this case, set P to be the initial value of
+ -- that temp.
+
+ if Nkind (P) = N_Identifier then
+ E := Entity (P);
+
+ if Ekind (E) = E_Constant then
+ Decl := Parent (E);
+
+ if Nkind (Decl) = N_Object_Declaration then
+ P := Expression (Decl);
+ end if;
+ end if;
+ end if;
+
+ if Nkind (P) = N_Selected_Component then
+ S := Selector_Name (P);
+
+ if Present (Entry_Formal (Entity (S))) then
+ return Entry_Formal (Entity (S));
+ end if;
+
+ elsif Nkind (Original_Node (N)) = N_Identifier then
+ return Param_Entity (Original_Node (N));
+ end if;
+ end;
+ end if;
+ end if;
+
+ return (Empty);
+ end Param_Entity;
+
----------------------
-- Policy_In_Effect --
----------------------
@@ -24959,6 +25766,18 @@ package body Sem_Util is
return Kind;
end Policy_In_Effect;
+ -------------------------------
+ -- Preanalyze_Without_Errors --
+ -------------------------------
+
+ procedure Preanalyze_Without_Errors (N : Node_Id) is
+ Status : constant Boolean := Get_Ignore_Errors;
+ begin
+ Set_Ignore_Errors (True);
+ Preanalyze (N);
+ Set_Ignore_Errors (Status);
+ end Preanalyze_Without_Errors;
+
-----------------------
-- Predicate_Enabled --
-----------------------
@@ -26148,6 +26967,19 @@ package body Sem_Util is
end if;
end Same_Object;
+ ---------------------------------
+ -- Same_Or_Aliased_Subprograms --
+ ---------------------------------
+
+ function Same_Or_Aliased_Subprograms
+ (S : Entity_Id;
+ E : Entity_Id) return Boolean
+ is
+ Subp_Alias : constant Entity_Id := Alias (S);
+ begin
+ return S = E or else (Present (Subp_Alias) and then Subp_Alias = E);
+ end Same_Or_Aliased_Subprograms;
+
---------------
-- Same_Type --
---------------
@@ -29590,6 +30422,911 @@ package body Sem_Util is
end Interval_Lists;
+ package body Old_Attr_Util is
+ package body Conditional_Evaluation is
+ type Determining_Expr_Context is
+ (No_Context, If_Expr, Case_Expr, Short_Circuit_Op, Membership_Test);
+
+ -- Determining_Expr_Context enumeration elements (except for
+ -- No_Context) correspond to the list items in RM 6.1.1 definition
+ -- of "determining expression".
+
+ type Determining_Expr
+ (Context : Determining_Expr_Context := No_Context)
+ is record
+ Expr : Node_Id := Empty;
+ case Context is
+ when Short_Circuit_Op =>
+ Is_And_Then : Boolean;
+ when If_Expr =>
+ Is_Then_Part : Boolean;
+ when Case_Expr =>
+ Alternatives : Node_Id;
+ when Membership_Test =>
+ -- Given a subexpression of <exp4> in a membership test
+ -- <exp1> in <exp2> | <exp3> | <exp4> | <exp5>
+ -- the corresponding determining expression value would
+ -- have First_Non_Preceding = <exp4> (See RM 6.1.1).
+ First_Non_Preceding : Node_Id;
+ when No_Context =>
+ null;
+ end case;
+ end record;
+
+ type Determining_Expression_List is
+ array (Positive range <>) of Determining_Expr;
+
+ function Determining_Condition (Det : Determining_Expr)
+ return Node_Id;
+ -- Given a determining expression, build a Boolean-valued
+ -- condition that incorporates that expression into condition
+ -- suitable for deciding whether to initialize a 'Old constant.
+ -- Polarity is "True => initialize the constant".
+
+ function Determining_Expressions
+ (Expr : Node_Id; Expr_Trailer : Node_Id := Empty)
+ return Determining_Expression_List;
+ -- Given a conditionally evaluated expression, return its
+ -- determining expressions.
+ -- See RM 6.1.1 for definition of term "determining expressions".
+ -- Tests should be performed in the order they occur in the
+ -- array, with short circuiting.
+ -- A determining expression need not be of a boolean type (e.g.,
+ -- it might be the determining expression of a case expression).
+ -- The Expr_Trailer parameter should be defaulted for nonrecursive
+ -- calls.
+
+ function Is_Conditionally_Evaluated (Expr : Node_Id) return Boolean;
+ -- See RM 6.1.1 for definition of term "conditionally evaluated".
+
+ function Is_Known_On_Entry (Expr : Node_Id) return Boolean;
+ -- See RM 6.1.1 for definition of term "known on entry".
+
+ --------------------------------------
+ -- Conditional_Evaluation_Condition --
+ --------------------------------------
+
+ function Conditional_Evaluation_Condition
+ (Expr : Node_Id) return Node_Id
+ is
+ Determiners : constant Determining_Expression_List :=
+ Determining_Expressions (Expr);
+ Loc : constant Source_Ptr := Sloc (Expr);
+ Result : Node_Id :=
+ New_Occurrence_Of (Standard_True, Loc);
+ begin
+ pragma Assert (Determiners'Length > 0 or else
+ Is_Anonymous_Access_Type (Etype (Expr)));
+
+ for I in Determiners'Range loop
+ Result := Make_And_Then
+ (Loc,
+ Left_Opnd => Result,
+ Right_Opnd =>
+ Determining_Condition (Determiners (I)));
+ end loop;
+ return Result;
+ end Conditional_Evaluation_Condition;
+
+ ---------------------------
+ -- Determining_Condition --
+ ---------------------------
+
+ function Determining_Condition (Det : Determining_Expr) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Det.Expr);
+ begin
+ case Det.Context is
+ when Short_Circuit_Op =>
+ if Det.Is_And_Then then
+ return New_Copy_Tree (Det.Expr);
+ else
+ return Make_Op_Not (Loc, New_Copy_Tree (Det.Expr));
+ end if;
+
+ when If_Expr =>
+ if Det.Is_Then_Part then
+ return New_Copy_Tree (Det.Expr);
+ else
+ return Make_Op_Not (Loc, New_Copy_Tree (Det.Expr));
+ end if;
+
+ when Case_Expr =>
+ declare
+ Alts : List_Id := Discrete_Choices (Det.Alternatives);
+ begin
+ if Nkind (First (Alts)) = N_Others_Choice then
+ Alts := Others_Discrete_Choices (First (Alts));
+ end if;
+
+ return Make_In (Loc,
+ Left_Opnd => New_Copy_Tree (Det.Expr),
+ Right_Opnd => Empty,
+ Alternatives => New_Copy_List (Alts));
+ end;
+
+ when Membership_Test =>
+ declare
+ function Copy_Prefix
+ (List : List_Id; Suffix_Start : Node_Id)
+ return List_Id;
+ -- Given a list and a member of that list, returns
+ -- a copy (similar to Nlists.New_Copy_List) of the
+ -- prefix of the list up to but not including
+ -- Suffix_Start.
+
+ -----------------
+ -- Copy_Prefix --
+ -----------------
+
+ function Copy_Prefix
+ (List : List_Id; Suffix_Start : Node_Id)
+ return List_Id
+ is
+ Result : constant List_Id := New_List;
+ Elem : Node_Id := First (List);
+ begin
+ while Elem /= Suffix_Start loop
+ Append (New_Copy (Elem), Result);
+ Next (Elem);
+ pragma Assert (Present (Elem));
+ end loop;
+ return Result;
+ end Copy_Prefix;
+
+ begin
+ return Make_In (Loc,
+ Left_Opnd => New_Copy_Tree (Left_Opnd (Det.Expr)),
+ Right_Opnd => Empty,
+ Alternatives => Copy_Prefix
+ (Alternatives (Det.Expr),
+ Det.First_Non_Preceding));
+ end;
+
+ when No_Context =>
+ raise Program_Error;
+ end case;
+ end Determining_Condition;
+
+ -----------------------------
+ -- Determining_Expressions --
+ -----------------------------
+
+ function Determining_Expressions
+ (Expr : Node_Id; Expr_Trailer : Node_Id := Empty)
+ return Determining_Expression_List
+ is
+ Par : Node_Id := Expr;
+ Trailer : Node_Id := Expr_Trailer;
+ Next_Element : Determining_Expr;
+ begin
+ -- We want to stop climbing up the tree when we reach the
+ -- postcondition expression. An aspect_specification is
+ -- transformed into a pragma, so reaching a pragma is our
+ -- termination condition. This relies on the fact that
+ -- pragmas are not allowed in declare expressions (or any
+ -- other kind of expression).
+
+ loop
+ Next_Element.Expr := Empty;
+
+ case Nkind (Par) is
+ when N_Short_Circuit =>
+ if Trailer = Right_Opnd (Par) then
+ Next_Element :=
+ (Expr => Left_Opnd (Par),
+ Context => Short_Circuit_Op,
+ Is_And_Then => Nkind (Par) = N_And_Then);
+ end if;
+
+ when N_If_Expression =>
+ -- For an expression like
+ -- (if C1 then ... elsif C2 then ... else Foo'Old)
+ -- the RM says are two determining expressions,
+ -- C1 and C2. Our treatment here (where we only add
+ -- one determining expression to the list) is ok because
+ -- we will see two if-expressions, one within the other.
+
+ if Trailer /= First (Expressions (Par)) then
+ Next_Element :=
+ (Expr => First (Expressions (Par)),
+ Context => If_Expr,
+ Is_Then_Part =>
+ Trailer = Next (First (Expressions (Par))));
+ end if;
+
+ when N_Case_Expression_Alternative =>
+ pragma Assert (Nkind (Parent (Par)) = N_Case_Expression);
+
+ Next_Element :=
+ (Expr => Expression (Parent (Par)),
+ Context => Case_Expr,
+ Alternatives => Par);
+
+ when N_Membership_Test =>
+ if Trailer /= Left_Opnd (Par)
+ and then Is_Non_Empty_List (Alternatives (Par))
+ and then Trailer /= First (Alternatives (Par))
+ then
+ pragma Assert (not Present (Right_Opnd (Par)));
+ pragma Assert
+ (Is_List_Member (Trailer)
+ and then List_Containing (Trailer)
+ = Alternatives (Par));
+
+ -- This one is different than the others
+ -- because one element in the array result
+ -- may represent multiple determining
+ -- expressions (i.e. every member of the list
+ -- Alternatives (Par)
+ -- up to but not including Trailer).
+
+ Next_Element :=
+ (Expr => Par,
+ Context => Membership_Test,
+ First_Non_Preceding => Trailer);
+ end if;
+
+ when N_Pragma =>
+ declare
+ Previous : constant Node_Id := Prev (Par);
+ Prev_Expr : Node_Id;
+ begin
+ if Nkind (Previous) = N_Pragma and then
+ Split_PPC (Previous)
+ then
+ -- A source-level postcondition of
+ -- A and then B and then C
+ -- results in
+ -- pragma Postcondition (A);
+ -- pragma Postcondition (B);
+ -- pragma Postcondition (C);
+ -- with Split_PPC set to True on all but the
+ -- last pragma. We account for that here.
+
+ Prev_Expr :=
+ Expression (First
+ (Pragma_Argument_Associations (Previous)));
+
+ -- This Analyze call is needed in the case when
+ -- Sem_Attr.Analyze_Attribute calls
+ -- Eligible_For_Conditional_Evaluation. Without
+ -- it, we end up passing an unanalyzed expression
+ -- to Is_Known_On_Entry and that doesn't work.
+
+ Analyze (Prev_Expr);
+
+ Next_Element :=
+ (Expr => Prev_Expr,
+ Context => Short_Circuit_Op,
+ Is_And_Then => True);
+
+ return Determining_Expressions (Prev_Expr)
+ & Next_Element;
+ else
+ pragma Assert
+ (Get_Pragma_Id (Pragma_Name (Par)) in
+ Pragma_Post | Pragma_Postcondition
+ | Pragma_Post_Class | Pragma_Refined_Post
+ | Pragma_Check | Pragma_Contract_Cases);
+
+ return (1 .. 0 => <>); -- recursion terminates here
+ end if;
+ end;
+
+ when N_Empty =>
+ -- This case should be impossible, but if it does
+ -- happen somehow then we don't want an infinite loop.
+ raise Program_Error;
+
+ when others =>
+ null;
+ end case;
+
+ Trailer := Par;
+ Par := Parent (Par);
+
+ if Present (Next_Element.Expr) then
+ return Determining_Expressions
+ (Expr => Par, Expr_Trailer => Trailer)
+ & Next_Element;
+ end if;
+ end loop;
+ end Determining_Expressions;
+
+ -----------------------------------------
+ -- Eligible_For_Conditional_Evaluation --
+ -----------------------------------------
+
+ function Eligible_For_Conditional_Evaluation
+ (Expr : Node_Id) return Boolean
+ is
+ begin
+ if Is_Anonymous_Access_Type (Etype (Expr)) then
+ -- The code in exp_attr.adb that also builds declarations
+ -- for 'Old constants doesn't handle the anonymous access
+ -- type case correctly, so we avoid that problem by
+ -- returning True here.
+ return True;
+ elsif Ada_Version < Ada_2020 then
+ return False;
+ elsif not Is_Conditionally_Evaluated (Expr) then
+ return False;
+ else
+ declare
+ Determiners : constant Determining_Expression_List :=
+ Determining_Expressions (Expr);
+ begin
+ pragma Assert (Determiners'Length > 0);
+
+ for Idx in Determiners'Range loop
+ if not Is_Known_On_Entry (Determiners (Idx).Expr) then
+ return False;
+ end if;
+ end loop;
+ end;
+ return True;
+ end if;
+ end Eligible_For_Conditional_Evaluation;
+
+ --------------------------------
+ -- Is_Conditionally_Evaluated --
+ --------------------------------
+
+ function Is_Conditionally_Evaluated (Expr : Node_Id) return Boolean
+ is
+ -- There are three possibilities - the expression is
+ -- unconditionally evaluated, repeatedly evaluated, or
+ -- conditionally evaluated (see RM 6.1.1). So we implement
+ -- this test by testing for the other two.
+
+ function Is_Repeatedly_Evaluated (Expr : Node_Id) return Boolean;
+ -- See RM 6.1.1 for definition of "repeatedly evaluated".
+
+ -----------------------------
+ -- Is_Repeatedly_Evaluated --
+ -----------------------------
+
+ function Is_Repeatedly_Evaluated (Expr : Node_Id) return Boolean is
+ Par : Node_Id := Expr;
+ Trailer : Node_Id := Empty;
+
+ -- There are three ways that an expression can be repeatedly
+ -- evaluated.
+ begin
+ -- An aspect_specification is transformed into a pragma, so
+ -- reaching a pragma is our termination condition. We want to
+ -- stop when we reach the postcondition expression.
+
+ while Nkind (Par) /= N_Pragma loop
+ pragma Assert (Present (Par));
+
+ -- test for case 1:
+ -- A subexpression of a predicate of a
+ -- quantified_expression.
+
+ if Nkind (Par) = N_Quantified_Expression
+ and then Trailer = Condition (Par)
+ then
+ return True;
+ end if;
+
+ -- test for cases 2 and 3:
+ -- A subexpression of the expression of an
+ -- array_component_association or of
+ -- a container_element_associatiation.
+
+ if Nkind (Par) = N_Component_Association
+ and then Trailer = Expression (Par)
+ then
+ -- determine whether Par is part of an array aggregate
+ -- or a container aggregate
+ declare
+ Rover : Node_Id := Par;
+ begin
+ while Nkind (Rover) not in N_Has_Etype loop
+ pragma Assert (Present (Rover));
+ Rover := Parent (Rover);
+ end loop;
+ if Present (Etype (Rover)) then
+ if Is_Array_Type (Etype (Rover))
+ or else Is_Container_Aggregate (Rover)
+ then
+ return True;
+ end if;
+ end if;
+ end;
+ end if;
+
+ Trailer := Par;
+ Par := Parent (Par);
+ end loop;
+
+ return False;
+ end Is_Repeatedly_Evaluated;
+
+ begin
+ if not Is_Potentially_Unevaluated (Expr) then
+ -- the expression is unconditionally evaluated
+ return False;
+ elsif Is_Repeatedly_Evaluated (Expr) then
+ return False;
+ end if;
+
+ return True;
+ end Is_Conditionally_Evaluated;
+
+ -----------------------
+ -- Is_Known_On_Entry --
+ -----------------------
+
+ function Is_Known_On_Entry (Expr : Node_Id) return Boolean is
+ -- ??? This implementation is incomplete. See RM 6.1.1
+ -- for details. In particular, this function *should* return
+ -- True for a function call (or a user-defined literal, which
+ -- is equivalent to a function call) if all actual parameters
+ -- (including defaulted params) are known on entry and the
+ -- function has "Globals => null" specified; the current
+ -- implementation will incorrectly return False in this case.
+
+ function All_Exps_Known_On_Entry
+ (Expr_List : List_Id) return Boolean;
+ -- Given a list of expressions, returns False iff
+ -- Is_Known_On_Entry is False for at least one list element.
+
+ -----------------------------
+ -- All_Exps_Known_On_Entry --
+ -----------------------------
+
+ function All_Exps_Known_On_Entry
+ (Expr_List : List_Id) return Boolean
+ is
+ Expr : Node_Id := First (Expr_List);
+ begin
+ while Present (Expr) loop
+ if not Is_Known_On_Entry (Expr) then
+ return False;
+ end if;
+ Next (Expr);
+ end loop;
+ return True;
+ end All_Exps_Known_On_Entry;
+
+ begin
+ if Is_Static_Expression (Expr) then
+ return True;
+ end if;
+
+ if Is_Attribute_Old (Expr) then
+ return True;
+ end if;
+
+ declare
+ Pref : Node_Id := Expr;
+ begin
+ loop
+ case Nkind (Pref) is
+ when N_Selected_Component =>
+ null;
+
+ when N_Indexed_Component =>
+ if not All_Exps_Known_On_Entry (Expressions (Pref))
+ then
+ return False;
+ end if;
+
+ when N_Slice =>
+ return False; -- just to be clear about this case
+
+ when others =>
+ exit;
+ end case;
+
+ Pref := Prefix (Pref);
+ end loop;
+
+ if Is_Entity_Name (Pref)
+ and then Is_Constant_Object (Entity (Pref))
+ then
+ declare
+ Obj : constant Entity_Id := Entity (Pref);
+ Obj_Typ : constant Entity_Id := Etype (Obj);
+ begin
+ case Ekind (Obj) is
+ when E_In_Parameter =>
+ if not Is_Elementary_Type (Obj_Typ) then
+ return False;
+ elsif Is_Aliased (Obj) then
+ return False;
+ end if;
+
+ when E_Constant =>
+ -- return False for a deferred constant
+ if Present (Full_View (Obj)) then
+ return False;
+ end if;
+
+ -- return False if not "all views are constant".
+ if Is_Immutably_Limited_Type (Obj_Typ)
+ or Needs_Finalization (Obj_Typ)
+ then
+ return False;
+ end if;
+
+ when others =>
+ null;
+ end case;
+ end;
+
+ return True;
+ end if;
+
+ -- ??? Cope with a malformed tree. Code to cope with a
+ -- nonstatic use of an enumeration literal should not be
+ -- necessary.
+ if Is_Entity_Name (Pref)
+ and then Ekind (Entity (Pref)) = E_Enumeration_Literal
+ then
+ return True;
+ end if;
+ end;
+
+ case Nkind (Expr) is
+ when N_Unary_Op =>
+ return Is_Known_On_Entry (Right_Opnd (Expr));
+
+ when N_Binary_Op =>
+ return Is_Known_On_Entry (Left_Opnd (Expr))
+ and then Is_Known_On_Entry (Right_Opnd (Expr));
+
+ when N_Type_Conversion | N_Qualified_Expression =>
+ return Is_Known_On_Entry (Expression (Expr));
+
+ when N_If_Expression =>
+ if not All_Exps_Known_On_Entry (Expressions (Expr)) then
+ return False;
+ end if;
+
+ when N_Case_Expression =>
+ if not Is_Known_On_Entry (Expression (Expr)) then
+ return False;
+ end if;
+
+ declare
+ Alt : Node_Id := First (Alternatives (Expr));
+ begin
+ while Present (Alt) loop
+ if not Is_Known_On_Entry (Expression (Alt)) then
+ return False;
+ end if;
+ Next (Alt);
+ end loop;
+ end;
+
+ return True;
+
+ when others =>
+ null;
+ end case;
+
+ return False;
+ end Is_Known_On_Entry;
+
+ end Conditional_Evaluation;
+
+ package body Indirect_Temps is
+
+ Indirect_Temp_Access_Type_Char : constant Character := 'K';
+ -- The character passed to Make_Temporary when declaring
+ -- the access type that is used in the implementation of an
+ -- indirect temporary.
+
+ --------------------------
+ -- Indirect_Temp_Needed --
+ --------------------------
+
+ function Indirect_Temp_Needed (Typ : Entity_Id) return Boolean is
+ begin
+ -- There should be no correctness issues if the only cases where
+ -- this function returns False are cases where Typ is an
+ -- anonymous access type and we need to generate a saooaaat (a
+ -- stand-alone object of an anonymous access type) in order get
+ -- accessibility right. In other cases where this function
+ -- returns False, there would be no correctness problems with
+ -- returning True instead; however, returning False when we can
+ -- generally results in simpler code.
+
+ return False
+
+ -- If Typ is not definite, then we cannot generate
+ -- Temp : Typ;
+
+ or else not Is_Definite_Subtype (Typ)
+
+ -- If Typ is tagged, then generating
+ -- Temp : Typ;
+ -- might generate an object with the wrong tag. If we had
+ -- a predicate that indicated whether the nominal tag is
+ -- trustworthy, we could use that predicate here.
+
+ or else Is_Tagged_Type (Typ)
+
+ -- If Typ needs finalization, then generating an implicit
+ -- Temp : Typ;
+ -- declaration could have user-visible side effects.
+
+ or else Needs_Finalization (Typ)
+
+ -- In the anonymous access type case, we need to
+ -- generate a saooaaat. We don't want the code in
+ -- in exp_attr.adb that deals with the case where this
+ -- function returns False to have to deal with that case
+ -- (just to avoid code duplication). So we cheat a little
+ -- bit and return True here for an anonymous access type.
+
+ or else Is_Anonymous_Access_Type (Typ);
+
+ -- ??? Unimplemented - spec description says:
+ -- For an unconstrained-but-definite discriminated subtype,
+ -- returns True if the potential difference in size between an
+ -- unconstrained object and a constrained object is large.
+ --
+ -- For example,
+ -- type Typ (Len : Natural := 0) is
+ -- record F : String (1 .. Len); end record;
+ --
+ -- See Large_Max_Size_Mutable function elsewhere in this
+ -- file (currently declared inside of
+ -- New_Requires_Transient_Scope, so it would have to be
+ -- moved if we want it to be callable from here).
+
+ end Indirect_Temp_Needed;
+
+ ---------------------------
+ -- Declare_Indirect_Temp --
+ ---------------------------
+
+ procedure Declare_Indirect_Temp
+ (Attr_Prefix : Node_Id; Indirect_Temp : out Entity_Id)
+ is
+ Loc : constant Source_Ptr := Sloc (Attr_Prefix);
+ Prefix_Type : constant Entity_Id := Etype (Attr_Prefix);
+ Temp_Id : constant Entity_Id :=
+ Make_Temporary (Loc, 'P', Attr_Prefix);
+
+ procedure Declare_Indirect_Temp_Via_Allocation;
+ -- Handle the usual case.
+
+ -------------------------------------------
+ -- Declare_Indirect_Temp_Via_Allocation --
+ -------------------------------------------
+
+ procedure Declare_Indirect_Temp_Via_Allocation is
+ Access_Type_Id : constant Entity_Id
+ := Make_Temporary
+ (Loc, Indirect_Temp_Access_Type_Char, Attr_Prefix);
+
+ Temp_Decl : constant Node_Id :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp_Id,
+ Object_Definition =>
+ New_Occurrence_Of (Access_Type_Id, Loc));
+
+ Allocate_Class_Wide : constant Boolean :=
+ Is_Specific_Tagged_Type (Prefix_Type);
+ -- If True then access type designates the class-wide type in
+ -- order to preserve (at run time) the value of the underlying
+ -- tag.
+ -- ??? We could do better here (in the case where Prefix_Type
+ -- is tagged and specific) if we had a predicate which takes an
+ -- expression and returns True iff the expression is of
+ -- a specific tagged type and the underlying tag (at run time)
+ -- is statically known to match that of the specific type.
+ -- In that case, Allocate_Class_Wide could safely be False.
+
+ function Designated_Subtype_Mark return Node_Id;
+ -- Usually, a subtype mark indicating the subtype of the
+ -- attribute prefix. If that subtype is a specific tagged
+ -- type, then returns the corresponding class-wide type.
+ -- If the prefix is of an anonymous access type, then returns
+ -- the designated type of that type.
+
+ -----------------------------
+ -- Designated_Subtype_Mark --
+ -----------------------------
+
+ function Designated_Subtype_Mark return Node_Id is
+ Typ : Entity_Id := Prefix_Type;
+ begin
+ if Allocate_Class_Wide then
+ if Is_Private_Type (Typ)
+ and then Present (Full_View (Typ))
+ then
+ Typ := Full_View (Typ);
+ end if;
+ Typ := Class_Wide_Type (Typ);
+ end if;
+
+ return New_Occurrence_Of (Typ, Loc);
+ end Designated_Subtype_Mark;
+
+ Access_Type_Def : constant Node_Id
+ := Make_Access_To_Object_Definition
+ (Loc, Subtype_Indication => Designated_Subtype_Mark);
+
+ Access_Type_Decl : constant Node_Id
+ := Make_Full_Type_Declaration
+ (Loc, Access_Type_Id,
+ Type_Definition => Access_Type_Def);
+ begin
+ Set_Ekind (Temp_Id, E_Variable);
+ Set_Etype (Temp_Id, Access_Type_Id);
+ Set_Ekind (Access_Type_Id, E_Access_Type);
+
+ if Append_Decls_In_Reverse_Order then
+ Append_Item (Temp_Decl, Is_Eval_Stmt => False);
+ Append_Item (Access_Type_Decl, Is_Eval_Stmt => False);
+ else
+ Append_Item (Access_Type_Decl, Is_Eval_Stmt => False);
+ Append_Item (Temp_Decl, Is_Eval_Stmt => False);
+ end if;
+
+ Analyze (Access_Type_Decl);
+ Analyze (Temp_Decl);
+
+ pragma Assert
+ (Is_Access_Type_For_Indirect_Temp (Access_Type_Id));
+
+ declare
+ Expression : Node_Id := Attr_Prefix;
+ Allocator : Node_Id;
+ begin
+ if Allocate_Class_Wide then
+ -- generate T'Class'(T'Class (<prefix>))
+ Expression :=
+ Make_Type_Conversion (Loc,
+ Subtype_Mark => Designated_Subtype_Mark,
+ Expression => Expression);
+ end if;
+
+ Allocator :=
+ Make_Allocator (Loc,
+ Make_Qualified_Expression
+ (Loc,
+ Subtype_Mark => Designated_Subtype_Mark,
+ Expression => Expression));
+
+ -- Allocate saved prefix value on the secondary stack
+ -- in order to avoid introducing a storage leak. This
+ -- allocated object is never explicitly reclaimed.
+ --
+ -- ??? Emit storage leak warning if RE_SS_Pool
+ -- unavailable?
+
+ if RTE_Available (RE_SS_Pool) then
+ Set_Storage_Pool (Allocator, RTE (RE_SS_Pool));
+ Set_Procedure_To_Call
+ (Allocator, RTE (RE_SS_Allocate));
+ Set_Uses_Sec_Stack (Current_Scope);
+ end if;
+
+ Append_Item
+ (Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Temp_Id, Loc),
+ Expression => Allocator),
+ Is_Eval_Stmt => True);
+ end;
+ end Declare_Indirect_Temp_Via_Allocation;
+
+ begin
+ Indirect_Temp := Temp_Id;
+
+ if Is_Anonymous_Access_Type (Prefix_Type) then
+ -- In the anonymous access type case, we do not want a level
+ -- indirection (which would result in declaring an
+ -- access-to-access type); that would result in correctness
+ -- problems - the accessibility level of the type of the
+ -- 'Old constant would be wrong (See 6.1.1.). So in that case,
+ -- we do not generate an allocator. Instead we generate
+ -- Temp : access Designated := null;
+ -- which is unconditionally elaborated and then
+ -- Temp := <attribute prefix>;
+ -- which is conditionally executed.
+
+ declare
+ Temp_Decl : constant Node_Id :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp_Id,
+ Object_Definition =>
+ Make_Access_Definition
+ (Loc,
+ Constant_Present =>
+ Is_Access_Constant (Prefix_Type),
+ Subtype_Mark =>
+ New_Occurrence_Of
+ (Designated_Type (Prefix_Type), Loc)));
+ begin
+ Append_Item (Temp_Decl, Is_Eval_Stmt => False);
+ Analyze (Temp_Decl);
+ Append_Item
+ (Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Temp_Id, Loc),
+ Expression => Attr_Prefix),
+ Is_Eval_Stmt => True);
+ end;
+ else
+ -- the usual case
+ Declare_Indirect_Temp_Via_Allocation;
+ end if;
+ end Declare_Indirect_Temp;
+
+ -------------------------
+ -- Indirect_Temp_Value --
+ -------------------------
+
+ function Indirect_Temp_Value
+ (Temp : Entity_Id;
+ Typ : Entity_Id;
+ Loc : Source_Ptr) return Node_Id
+ is
+ Result : Node_Id;
+ begin
+ if Is_Anonymous_Access_Type (Typ) then
+ -- No indirection in this case; just evaluate the temp.
+ Result := New_Occurrence_Of (Temp, Loc);
+ Set_Etype (Result, Etype (Temp));
+
+ else
+ Result := Make_Explicit_Dereference (Loc,
+ New_Occurrence_Of (Temp, Loc));
+
+ Set_Etype (Result, Designated_Type (Etype (Temp)));
+
+ if Is_Specific_Tagged_Type (Typ) then
+ -- The designated type of the access type is class-wide, so
+ -- convert to the specific type.
+
+ Result :=
+ Make_Type_Conversion (Loc,
+ Subtype_Mark => New_Occurrence_Of (Typ, Loc),
+ Expression => Result);
+
+ Set_Etype (Result, Typ);
+ end if;
+ end if;
+
+ return Result;
+ end Indirect_Temp_Value;
+
+ function Is_Access_Type_For_Indirect_Temp
+ (T : Entity_Id) return Boolean is
+ begin
+ if Is_Access_Type (T)
+ and then not Comes_From_Source (T)
+ and then Is_Internal_Name (Chars (T))
+ and then Nkind (Scope (T)) in N_Entity
+ and then Ekind (Scope (T))
+ in E_Entry | E_Entry_Family | E_Function | E_Procedure
+ and then
+ (Present (Postconditions_Proc (Scope (T)))
+ or else Present (Contract (Scope (T))))
+ then
+ -- ??? Should define a flag for this. We could incorrectly
+ -- return True if other clients of Make_Temporary happen to
+ -- pass in the same character.
+ declare
+ Name : constant String := Get_Name_String (Chars (T));
+ begin
+ if Name (Name'First) = Indirect_Temp_Access_Type_Char then
+ return True;
+ end if;
+ end;
+ end if;
+ return False;
+ end Is_Access_Type_For_Indirect_Temp;
+
+ end Indirect_Temps;
+ end Old_Attr_Util;
begin
Erroutc.Subprogram_Name_Ptr := Subprogram_Name'Access;
end Sem_Util;
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index e2147e0..1b993f9 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -25,6 +25,7 @@
-- Package containing utility procedures used throughout the semantics
+with Aspects; use Aspects;
with Atree; use Atree;
with Einfo; use Einfo;
with Exp_Tss; use Exp_Tss;
@@ -42,6 +43,36 @@ package Sem_Util is
-- including the cases where there can't be any because e.g. the type is
-- not tagged.
+ type Accessibility_Level_Kind is
+ (Dynamic_Level,
+ Object_Decl_Level,
+ Zero_On_Dynamic_Level);
+ -- Accessibility_Level_Kind is an enumerated type which captures the
+ -- different modes in which an accessibility level could be obtained for
+ -- a given expression.
+
+ -- When in the context of the function Accessibility_Level,
+ -- Accessibility_Level_Kind signals what type of accessibility level to
+ -- obtain. For example, when Level is Dynamic_Level, a defining identifier
+ -- associated with a SAOOAAT may be returned or an N_Integer_Literal node.
+ -- When the level is Object_Decl_Level, an N_Integer_Literal node is
+ -- returned containing the level of the declaration of the object if
+ -- relevant (be it a SAOOAAT or otherwise). Finally, Zero_On_Dynamic_Level
+ -- returns library level for all cases where the accessibility level is
+ -- dynamic (used to bypass static accessibility checks in dynamic cases).
+
+ function Accessibility_Level
+ (Expr : Node_Id;
+ Level : Accessibility_Level_Kind;
+ In_Return_Context : Boolean := False) return Node_Id;
+ -- Centralized accessibility level calculation routine for finding the
+ -- accessibility level of a given expression Expr.
+
+ -- In_Return_Context forcing the Accessibility_Level calculations to be
+ -- carried out "as if" Expr existed in a return value. This is useful for
+ -- calculating the accessibility levels for discriminant associations
+ -- and return aggregates.
+
function Acquire_Warning_Match_String (Str_Lit : Node_Id) return String;
-- Used by pragma Warnings (Off, string), and Warn_As_Error (string) to get
-- the given string argument, adding leading and trailing asterisks if they
@@ -80,7 +111,7 @@ package Sem_Util is
function Addressable (V : Int) return Boolean;
pragma Inline (Addressable);
-- Returns True if the value of V is the word size or an addressable factor
- -- of the word size (typically 8, 16, 32 or 64).
+ -- or multiple of the word size (typically 8, 16, 32, 64 or 128).
procedure Aggregate_Constraint_Checks
(Exp : Node_Id;
@@ -157,11 +188,11 @@ package Sem_Util is
-- force an error).
function Async_Readers_Enabled (Id : Entity_Id) return Boolean;
- -- Id should be the entity of a state abstraction, a variable, or a type.
+ -- Id should be the entity of a state abstraction, an object, or a type.
-- Returns True iff Id is subject to external property Async_Readers.
function Async_Writers_Enabled (Id : Entity_Id) return Boolean;
- -- Id should be the entity of a state abstraction, a variable, or a type.
+ -- Id should be the entity of a state abstraction, an object, or a type.
-- Returns True iff Id is subject to external property Async_Writers.
function Available_Full_View_Of_Component (T : Entity_Id) return Boolean;
@@ -349,6 +380,13 @@ package Sem_Util is
-- not necessarily mean that CE could be raised, but a response of True
-- means that for sure CE cannot be raised.
+ procedure Check_Ambiguous_Aggregate (Call : Node_Id);
+ -- Additional information on an ambiguous call in Ada_2020 when a
+ -- subprogram call has an actual that is an aggregate, and the
+ -- presence of container aggregates (or types with the correwponding
+ -- aspect) provides an additional interpretation. Message indicates
+ -- that an aggregate actual should carry a type qualification.
+
procedure Check_Dynamically_Tagged_Expression
(Expr : Node_Id;
Typ : Entity_Id;
@@ -406,9 +444,20 @@ package Sem_Util is
-- Determine whether object or state Id introduces a hidden state. If this
-- is the case, emit an error.
+ procedure Check_Inherited_Nonoverridable_Aspects
+ (Inheritor : Entity_Id;
+ Interface_List : List_Id;
+ Parent_Type : Entity_Id);
+ -- Verify consistency of inherited nonoverridable aspects
+ -- when aspects are inherited from more than one source.
+ -- Parent_Type may be void (e.g., for a tagged task/protected type
+ -- whose declaration includes a non-empty interface list).
+ -- In the error case, error message is associate with Inheritor;
+ -- Inheritor parameter is otherwise unused.
+
procedure Check_Nonvolatile_Function_Profile (Func_Id : Entity_Id);
-- Verify that the profile of nonvolatile function Func_Id does not contain
- -- effectively volatile parameters or return type.
+ -- effectively volatile parameters or return type for reading.
procedure Check_Part_Of_Reference (Var_Id : Entity_Id; Ref : Node_Id);
-- Verify the legality of reference Ref to variable Var_Id when the
@@ -603,7 +652,9 @@ package Sem_Util is
-- in the case of a descendant of a generic formal type (returns Int'Last
-- instead of 0).
- function Defining_Entity (N : Node_Id) return Entity_Id;
+ function Defining_Entity
+ (N : Node_Id;
+ Empty_On_Errors : Boolean := False) return Entity_Id;
-- Given a declaration N, returns the associated defining entity. If the
-- declaration has a specification, the entity is obtained from the
-- specification. If the declaration has a defining unit name, then the
@@ -614,6 +665,16 @@ package Sem_Util is
-- local entities declared during loop expansion. These entities need
-- debugging information, generated through Qualify_Entity_Names, and
-- the loop declaration must be placed in the table Name_Qualify_Units.
+ --
+ -- Set flag Empty_On_Errors to change the behavior of this routine as
+ -- follows:
+ --
+ -- * True - A declaration that lacks a defining entity returns Empty.
+ -- A node that does not allow for a defining entity returns Empty.
+ --
+ -- * False - A declaration that lacks a defining entity is given a new
+ -- internally generated entity which is subsequently returned. A node
+ -- that does not allow for a defining entity raises Program_Error
-- WARNING: There is a matching C declaration of this subprogram in fe.h
@@ -646,6 +707,14 @@ package Sem_Util is
-- indication or a scalar subtype where one of the bounds is a
-- discriminant.
+ function Derivation_Too_Early_To_Inherit
+ (Typ : Entity_Id; Streaming_Op : TSS_Name_Type) return Boolean;
+ -- Returns True if Typ is a derived type, the given Streaming_Op
+ -- (one of Read, Write, Input, or Output) is explicitly specified
+ -- for Typ's parent type, and that attribute specification is *not*
+ -- inherited by Typ because the declaration of Typ precedes that
+ -- of the attribute specification.
+
function Designate_Same_Unit
(Name1 : Node_Id;
Name2 : Node_Id) return Boolean;
@@ -665,22 +734,16 @@ package Sem_Util is
-- private components of protected objects, but is generally useful when
-- restriction No_Implicit_Heap_Allocation is active.
- function Dynamic_Accessibility_Level (N : Node_Id) return Node_Id;
- -- N should be an expression of an access type. Builds an integer literal
- -- except in cases involving anonymous access types, where accessibility
- -- levels are tracked at run time (access parameters and Ada 2012 stand-
- -- alone objects).
-
function Effective_Extra_Accessibility (Id : Entity_Id) return Entity_Id;
-- Same as Einfo.Extra_Accessibility except thtat object renames
-- are looked through.
function Effective_Reads_Enabled (Id : Entity_Id) return Boolean;
- -- Id should be the entity of a state abstraction, a variable, or a type.
+ -- Id should be the entity of a state abstraction, an object, or a type.
-- Returns True iff Id is subject to external property Effective_Reads.
function Effective_Writes_Enabled (Id : Entity_Id) return Boolean;
- -- Id should be the entity of a state abstraction, a variable, or a type.
+ -- Id should be the entity of a state abstraction, an object, or a type.
-- Returns True iff Id is subject to external property Effective_Writes.
function Enclosing_Comp_Unit_Node (N : Node_Id) return Node_Id;
@@ -1015,7 +1078,7 @@ package Sem_Util is
-- discriminants. Otherwise all components of the parent must be included
-- in the subtype for semantic analysis.
- function Get_Accessibility (E : Entity_Id) return Node_Id;
+ function Get_Dynamic_Accessibility (E : Entity_Id) return Entity_Id;
-- Obtain the accessibility level for a given entity formal taking into
-- account both extra and minimum accessibility.
@@ -1243,6 +1306,9 @@ package Sem_Util is
-- as an access type internally, this function tests only for access types
-- known to the programmer. See also Has_Tagged_Component.
+ function Has_Anonymous_Access_Discriminant (Typ : Entity_Id) return Boolean;
+ -- Returns True if Typ has one or more anonymous access discriminants
+
type Alignment_Result is (Known_Compatible, Unknown, Known_Incompatible);
-- Result of Has_Compatible_Alignment test, description found below. Note
-- that the values are arranged in increasing order of problematicness.
@@ -1289,7 +1355,8 @@ package Sem_Util is
function Has_Effectively_Volatile_Profile
(Subp_Id : Entity_Id) return Boolean;
-- Determine whether subprogram Subp_Id has an effectively volatile formal
- -- parameter or returns an effectively volatile value.
+ -- parameter for reading or returns an effectively volatile value for
+ -- reading.
function Has_Full_Default_Initialization (Typ : Entity_Id) return Boolean;
-- Determine whether type Typ defines "full default initialization" as
@@ -1370,6 +1437,20 @@ package Sem_Util is
-- Return True if the loop has no side effect and can therefore be
-- marked for removal. Return False if N is not a N_Loop_Statement.
+ subtype Static_Accessibility_Level_Kind
+ is Accessibility_Level_Kind range Object_Decl_Level
+ .. Zero_On_Dynamic_Level;
+ -- Restrict the reange of Accessibility_Level_Kind to be non-dynamic for
+ -- use in the static version of Accessibility_Level below.
+
+ function Static_Accessibility_Level
+ (Expr : Node_Id;
+ Level : Static_Accessibility_Level_Kind;
+ In_Return_Context : Boolean := False) return Uint;
+ -- Overloaded version of Accessibility_Level which returns a universal
+ -- integer for use in compile-time checking. Note: Level is restricted to
+ -- be non-dynamic.
+
function Has_Overriding_Initialize (T : Entity_Id) return Boolean;
-- Predicate to determine whether a controlled type has a user-defined
-- Initialize primitive (and, in Ada 2012, whether that primitive is
@@ -1491,6 +1572,11 @@ package Sem_Util is
function In_Quantified_Expression (N : Node_Id) return Boolean;
-- Returns true if the expression N occurs within a quantified expression
+ function In_Return_Value (Expr : Node_Id) return Boolean;
+ -- Returns true if the expression Expr occurs within a simple return
+ -- statement or is part of an assignment to the return object in an
+ -- extended return statement.
+
function In_Reverse_Storage_Order_Object (N : Node_Id) return Boolean;
-- Returns True if N denotes a component or subcomponent in a record or
-- array that has Reverse_Storage_Order.
@@ -1595,9 +1681,12 @@ package Sem_Util is
-- True if E is the constructed wrapper for an access_to_subprogram
-- type with Pre/Postconditions.
+ function Is_Access_Variable (E : Entity_Id) return Boolean;
+ -- Determines if type E is an access-to-variable
+
function Is_Actual_In_Out_Parameter (N : Node_Id) return Boolean;
-- Determines if N is an actual parameter of in-out mode in a subprogram
- -- call
+ -- call.
function Is_Actual_Out_Parameter (N : Node_Id) return Boolean;
-- Determines if N is an actual parameter of out mode in a subprogram call
@@ -1627,10 +1716,6 @@ package Sem_Util is
-- Determine whether arbitrary node N denotes a reference to an atomic
-- object as per RM C.6(7) and the crucial remark in RM C.6(8).
- function Is_Atomic_Or_VFA_Object (N : Node_Id) return Boolean;
- -- Determine whether arbitrary node N denotes a reference to an object
- -- which is either atomic or Volatile_Full_Access.
-
function Is_Attribute_Loop_Entry (N : Node_Id) return Boolean;
-- Determine whether node N denotes attribute 'Loop_Entry
@@ -1654,6 +1739,12 @@ package Sem_Util is
-- Determine whether entity Id denotes a procedure with synchronization
-- kind By_Protected_Procedure.
+ function Is_Confirming (Aspect : Nonoverridable_Aspect_Id;
+ Aspect_Spec_1, Aspect_Spec_2 : Node_Id)
+ return Boolean;
+ -- Returns true if the two specifications of the given
+ -- nonoverridable aspect are compatible.
+
function Is_Constant_Bound (Exp : Node_Id) return Boolean;
-- Exp is the expression for an array bound. Determines whether the
-- bound is a compile-time known value, or a constant entity, or an
@@ -1797,16 +1888,39 @@ package Sem_Util is
-- * A protected type
-- * Descendant of type Ada.Synchronous_Task_Control.Suspension_Object
- function Is_Effectively_Volatile_Object (N : Node_Id) return Boolean;
+ function Is_Effectively_Volatile_For_Reading
+ (Id : Entity_Id) return Boolean;
+ -- Determine whether a type or object denoted by entity Id is effectively
+ -- volatile for reading (SPARK RM 7.1.2). To qualify as such, the entity
+ -- must be either
+ -- * Volatile without No_Caching and have Async_Writers or
+ -- Effective_Reads set to True
+ -- * An array type subject to aspect Volatile_Components, unless it has
+ -- Async_Writers and Effective_Reads set to False
+ -- * An array type whose component type is effectively volatile for
+ -- reading
+ -- * A protected type
+ -- * Descendant of type Ada.Synchronous_Task_Control.Suspension_Object
+
+ function Is_Effectively_Volatile_Object
+ (N : Node_Id) return Boolean;
-- Determine whether an arbitrary node denotes an effectively volatile
-- object (SPARK RM 7.1.2).
+ function Is_Effectively_Volatile_Object_For_Reading
+ (N : Node_Id) return Boolean;
+ -- Determine whether an arbitrary node denotes an effectively volatile
+ -- object for reading (SPARK RM 7.1.2).
+
function Is_Entry_Body (Id : Entity_Id) return Boolean;
-- Determine whether entity Id is the body entity of an entry [family]
function Is_Entry_Declaration (Id : Entity_Id) return Boolean;
-- Determine whether entity Id is the spec entity of an entry [family]
+ function Is_Explicitly_Aliased (N : Node_Id) return Boolean;
+ -- Determine if a given node N is an explicitly aliased formal parameter.
+
function Is_Expanded_Priority_Attribute (E : Entity_Id) return Boolean;
-- Check whether a function in a call is an expanded priority attribute,
-- which is transformed into an Rtsfind call to Get_Ceiling. This expansion
@@ -1840,6 +1954,10 @@ package Sem_Util is
-- Returns True iff the number U is a model number of the fixed-point type
-- T, i.e. if it is an exact multiple of Small.
+ function Is_Full_Access_Object (N : Node_Id) return Boolean;
+ -- Determine whether arbitrary node N denotes a reference to a full access
+ -- object as per Ada 2020 RM C.6(8.2).
+
function Is_Fully_Initialized_Type (Typ : Entity_Id) return Boolean;
-- Typ is a type entity. This function returns true if this type is fully
-- initialized, meaning that an object of the type is fully initialized.
@@ -1915,6 +2033,9 @@ package Sem_Util is
-- parameter of the current enclosing subprogram.
-- Why are OUT parameters not considered here ???
+ function Is_Master (N : Node_Id) return Boolean;
+ -- Determine if the given node N constitutes a finalization master
+
function Is_Name_Reference (N : Node_Id) return Boolean;
-- Determine whether arbitrary node N is a reference to a name. This is
-- similar to Is_Object_Reference but returns True only if N can be renamed
@@ -2075,11 +2196,15 @@ package Sem_Util is
-- created for a single task type.
function Is_Special_Aliased_Formal_Access
- (Exp : Node_Id;
- Scop : Entity_Id) return Boolean;
+ (Exp : Node_Id;
+ In_Return_Context : Boolean := False) return Boolean;
-- Determines whether a dynamic check must be generated for explicitly
-- aliased formals within a function Scop for the expression Exp.
+ -- In_Return_Context forces Is_Special_Aliased_Formal_Access to assume
+ -- that Exp is within a return value which is useful for checking
+ -- expressions within discriminant associations of return objects.
+
-- More specially, Is_Special_Aliased_Formal_Access checks that Exp is a
-- 'Access attribute reference within a return statement where the ultimate
-- prefix is an aliased formal of Scop and that Scop returns an anonymous
@@ -2104,9 +2229,9 @@ package Sem_Util is
-- meaning that the name of the call denotes a static function
-- and all of the call's actual parameters are given by static expressions.
- function Is_Subcomponent_Of_Atomic_Object (N : Node_Id) return Boolean;
+ function Is_Subcomponent_Of_Full_Access_Object (N : Node_Id) return Boolean;
-- Determine whether arbitrary node N denotes a reference to a subcomponent
- -- of an atomic object as per RM C.6(7).
+ -- of a full access object as per RM C.6(7).
function Is_Subprogram_Contract_Annotation (Item : Node_Id) return Boolean;
-- Determine whether aspect specification or pragma Item is one of the
@@ -2124,6 +2249,7 @@ package Sem_Util is
-- Refined_Depends
-- Refined_Global
-- Refined_Post
+ -- Subprogram_Variant
-- Test_Case
function Is_Subprogram_Stub_Without_Prior_Declaration
@@ -2145,7 +2271,7 @@ package Sem_Util is
-- such, the object must be
-- * Of a type that yields a synchronized object
-- * An atomic object with enabled Async_Writers
- -- * A constant
+ -- * A constant not of access-to-variable type
-- * A variable subject to pragma Constant_After_Elaboration
function Is_Synchronized_Tagged_Type (E : Entity_Id) return Boolean;
@@ -2578,11 +2704,6 @@ package Sem_Util is
-- is known at compile time. If the bounds are not known at compile time,
-- the function returns the value zero.
- function Object_Access_Level (Obj : Node_Id) return Uint;
- -- Return the accessibility level of the view of the object Obj. For
- -- convenience, qualified expressions applied to object names are also
- -- allowed as actuals for this function.
-
function Original_Aspect_Pragma_Name (N : Node_Id) return Name_Id;
-- Retrieve the name of aspect or pragma N, taking into account a possible
-- rewrite and whether the pragma is generated from an aspect as the names
@@ -2617,6 +2738,12 @@ package Sem_Util is
-- WARNING: this routine should be used in debugging scenarios such as
-- tracking down undefined symbols as it is fairly low level.
+ function Param_Entity (N : Node_Id) return Entity_Id;
+ -- Given an expression N, determines if the expression is a reference
+ -- to a formal (of a subprogram or entry), and if so returns the Id
+ -- of the corresponding formal entity, otherwise returns Empty. Also
+ -- handles the case of references to renamings of formals.
+
function Policy_In_Effect (Policy : Name_Id) return Name_Id;
-- Given a policy, return the policy identifier associated with it. If no
-- such policy is in effect, the value returned is No_Name.
@@ -2800,6 +2927,12 @@ package Sem_Util is
-- mean that different objects are designated, just that this could not
-- be reliably determined at compile time.
+ function Same_Or_Aliased_Subprograms
+ (S : Entity_Id;
+ E : Entity_Id) return Boolean;
+ -- Returns True if the subprogram entity S is the same as E or else S is an
+ -- alias of E.
+
function Same_Type (T1, T2 : Entity_Id) return Boolean;
-- Determines if T1 and T2 represent exactly the same type. Two types
-- are the same if they are identical, or if one is an unconstrained
@@ -3132,6 +3265,9 @@ package Sem_Util is
function Yields_Universal_Type (N : Node_Id) return Boolean;
-- Determine whether unanalyzed node N yields a universal type
+ procedure Preanalyze_Without_Errors (N : Node_Id);
+ -- Preanalyze N without reporting errors
+
package Interval_Lists is
type Discrete_Interval is
record
@@ -3171,11 +3307,97 @@ package Sem_Util is
-- correctly for real types with static predicates, we may need
-- an analogous Real_Interval_List type. Most of the language
-- rules that reference "is statically compatible" pertain to
- -- discriminants and therefore do require support for real types;
+ -- discriminants and therefore do not require support for real types;
-- the exception is 12.5.1(8).
Intervals_Error : exception;
-- Raised when the list of non-empty pair-wise disjoint intervals cannot
-- be built.
end Interval_Lists;
+
+ package Old_Attr_Util is
+ -- Operations related to 'Old attribute evaluation. This
+ -- includes cases where a level of indirection is needed due to
+ -- conditional evaluation as well as support for the
+ -- "known on entry" rules.
+
+ package Conditional_Evaluation is
+ function Eligible_For_Conditional_Evaluation
+ (Expr : Node_Id) return Boolean;
+ -- Given a subexpression of a Postcondition expression
+ -- (typically a 'Old attribute reference), returns True if
+ -- - the expression is conditionally evaluated; and
+ -- - its determining expressions are all known on entry; and
+ -- - Ada_Version >= Ada_2020.
+ -- See RM 6.1.1 for definitions of these terms.
+ --
+ -- Also returns True if Expr is of an anonymous access type;
+ -- this is just because we want the code that knows how to build
+ -- 'Old temps in that case to reside in only one place.
+
+ function Conditional_Evaluation_Condition
+ (Expr : Node_Id) return Node_Id;
+ -- Given an expression which is eligible for conditional evaluation,
+ -- build a Boolean expression whose value indicates whether the
+ -- expression should be evaluated.
+ end Conditional_Evaluation;
+
+ package Indirect_Temps is
+ generic
+ with procedure Append_Item (N : Node_Id; Is_Eval_Stmt : Boolean);
+ -- If Is_Eval_Stmt is True, then N is a statement that should
+ -- only be executed in the case where the 'Old prefix is to be
+ -- evaluated. If Is_Eval_Stmt is False, then N is a declaration
+ -- which should be elaborated unconditionally.
+ -- Client is responsible for ensuring that any appended
+ -- Eval_Stmt nodes are eventually analyzed.
+
+ Append_Decls_In_Reverse_Order : Boolean := False;
+ -- This parameter is for the convenience of exp_prag.adb, where we
+ -- want to Prepend rather than Append so it is better to get the
+ -- Append calls in reverse order.
+
+ procedure Declare_Indirect_Temp
+ (Attr_Prefix : Node_Id; -- prefix of 'Old attribute (or similar?)
+ Indirect_Temp : out Entity_Id);
+ -- Indirect_Temp is of an access type; it is unconditionally
+ -- declared but only conditionally initialized to reference the
+ -- saved value of Attr_Prefix.
+
+ function Indirect_Temp_Needed (Typ : Entity_Id) return Boolean;
+ -- Returns True for a specific tagged type because the temp must
+ -- be of the class-wide type in order to preserve the underlying tag.
+ --
+ -- Also returns True in the case of an anonymous access type
+ -- because we want the code that knows how to deal with
+ -- this case to reside in only one place.
+ --
+ -- For an unconstrained-but-definite discriminated subtype, returns
+ -- True if the potential difference in size between an
+ -- unconstrained object and a constrained object is large.
+ -- [This part is not implemented yet.]
+ --
+ -- Otherwise, returns False if a declaration of the form
+ -- Temp : Typ;
+ -- is legal and side-effect-free (assuming that default
+ -- initialization is suppressed). For example, returns True if Typ is
+ -- indefinite, or if Typ has a controlled part.
+ --
+
+ function Indirect_Temp_Value
+ (Temp : Entity_Id;
+ Typ : Entity_Id;
+ Loc : Source_Ptr) return Node_Id;
+ -- Evaluate a temp declared by Declare_Indirect_Temp.
+
+ function Is_Access_Type_For_Indirect_Temp
+ (T : Entity_Id) return Boolean;
+ -- True for an access type that was declared via a call
+ -- to Declare_Indirect_Temp.
+ -- Indicates that the given access type should be treated
+ -- the same with respect to finalization as a
+ -- user-defined "comes from source" access type.
+
+ end Indirect_Temps;
+ end Old_Attr_Util;
end Sem_Util;
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index b67bb7d..d1acf2f 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -1416,8 +1416,14 @@ package body Sem_Warn is
and then not Warnings_Off_E1
and then not Has_Junk_Name (E1)
then
- Output_Reference_Error
- ("?v?variable& is read but never assigned!");
+ if Is_Access_Type (E1T)
+ or else
+ not Is_Partially_Initialized_Type (E1T, False)
+ then
+ Output_Reference_Error
+ ("?v?variable& is read but never assigned!");
+ end if;
+
May_Need_Initialized_Actual (E1);
end if;
@@ -2248,10 +2254,6 @@ package body Sem_Warn is
------------------------
procedure Check_Unused_Withs (Spec_Unit : Unit_Number_Type := No_Unit) is
- Cnode : Node_Id;
- Item : Node_Id;
- Lunit : Node_Id;
- Ent : Entity_Id;
Munite : constant Entity_Id := Cunit_Entity (Main_Unit);
-- This is needed for checking the special renaming case
@@ -2264,8 +2266,9 @@ package body Sem_Warn is
--------------------
procedure Check_One_Unit (Unit : Unit_Number_Type) is
+ Cnode : constant Node_Id := Cunit (Unit);
+
Is_Visible_Renaming : Boolean := False;
- Pack : Entity_Id;
procedure Check_Inner_Package (Pack : Entity_Id);
-- Pack is a package local to a unit in a with_clause. Both the unit
@@ -2273,7 +2276,7 @@ package body Sem_Warn is
-- referenced, then the only occurrence of Pack is in a USE clause
-- or a pragma, and a warning is worthwhile as well.
- function Check_System_Aux return Boolean;
+ function Check_System_Aux (Lunit : Entity_Id) return Boolean;
-- Before giving a warning on a with_clause for System, check whether
-- a system extension is present.
@@ -2352,7 +2355,7 @@ package body Sem_Warn is
-- Check_System_Aux --
----------------------
- function Check_System_Aux return Boolean is
+ function Check_System_Aux (Lunit : Entity_Id) return Boolean is
Ent : Entity_Id;
begin
@@ -2447,11 +2450,16 @@ package body Sem_Warn is
return False;
end Has_Visible_Entities;
+ -- Local variables
+
+ Ent : Entity_Id;
+ Item : Node_Id;
+ Lunit : Entity_Id;
+ Pack : Entity_Id;
+
-- Start of processing for Check_One_Unit
begin
- Cnode := Cunit (Unit);
-
-- Only do check in units that are part of the extended main unit.
-- This is actually a necessary restriction, because in the case of
-- subprogram acting as its own specification, there can be with's in
@@ -2501,7 +2509,7 @@ package body Sem_Warn is
-- package with only a linker options pragma and nothing
-- else or a pragma elaborate with a body library task).
- elsif Has_Visible_Entities (Entity (Name (Item))) then
+ elsif Has_Visible_Entities (Lunit) then
Error_Msg_N -- CODEFIX
("?u?unit& is not referenced!", Name (Item));
end if;
@@ -2570,64 +2578,56 @@ package body Sem_Warn is
if Unit = Spec_Unit then
Set_No_Entities_Ref_In_Spec (Item);
- elsif Check_System_Aux then
+ elsif Check_System_Aux (Lunit) then
null;
-- Else the warning may be needed
else
- declare
- Eitem : constant Entity_Id :=
- Entity (Name (Item));
-
- begin
- -- Warn if we unreferenced flag set and we
- -- have not had serious errors. The reason we
- -- inhibit the message if there are errors is
- -- to prevent false positives from disabling
- -- expansion.
-
- if not Has_Unreferenced (Eitem)
- and then Serious_Errors_Detected = 0
+ -- Warn if we unreferenced flag set and we have
+ -- not had serious errors. The reason we inhibit
+ -- the message if there are errors is to prevent
+ -- false positives from disabling expansion.
+
+ if not Has_Unreferenced (Lunit)
+ and then Serious_Errors_Detected = 0
+ then
+ -- Get possible package renaming
+
+ Pack := Find_Package_Renaming (Munite, Lunit);
+
+ -- No warning if either the package or its
+ -- renaming is used as a generic actual.
+
+ if Used_As_Generic_Actual (Lunit)
+ or else
+ (Present (Pack)
+ and then
+ Used_As_Generic_Actual (Pack))
+ then
+ exit;
+ end if;
+
+ -- Here we give the warning
+
+ Error_Msg_N -- CODEFIX
+ ("?u?no entities of & are referenced!",
+ Name (Item));
+
+ -- Flag renaming of package as well. If
+ -- the original package has warnings off,
+ -- we suppress the warning on the renaming
+ -- as well.
+
+ if Present (Pack)
+ and then not Has_Warnings_Off (Lunit)
+ and then not Has_Unreferenced (Pack)
then
- -- Get possible package renaming
-
- Pack :=
- Find_Package_Renaming (Munite, Lunit);
-
- -- No warning if either the package or its
- -- renaming is used as a generic actual.
-
- if Used_As_Generic_Actual (Eitem)
- or else
- (Present (Pack)
- and then
- Used_As_Generic_Actual (Pack))
- then
- exit;
- end if;
-
- -- Here we give the warning
-
- Error_Msg_N -- CODEFIX
- ("?u?no entities of & are referenced!",
- Name (Item));
-
- -- Flag renaming of package as well. If
- -- the original package has warnings off,
- -- we suppress the warning on the renaming
- -- as well.
-
- if Present (Pack)
- and then not Has_Warnings_Off (Lunit)
- and then not Has_Unreferenced (Pack)
- then
- Error_Msg_NE -- CODEFIX
- ("?u?no entities of& are referenced!",
- Unit_Declaration_Node (Pack), Pack);
- end if;
+ Error_Msg_NE -- CODEFIX
+ ("?u?no entities of& are referenced!",
+ Unit_Declaration_Node (Pack), Pack);
end if;
- end;
+ end if;
end if;
exit;
diff --git a/gcc/ada/set_targ.adb b/gcc/ada/set_targ.adb
index d707c12..b8578f5 100644
--- a/gcc/ada/set_targ.adb
+++ b/gcc/ada/set_targ.adb
@@ -55,6 +55,7 @@ package body Set_Targ is
S_Float_Words_BE : constant Str := "Float_Words_BE";
S_Int_Size : constant Str := "Int_Size";
S_Long_Double_Size : constant Str := "Long_Double_Size";
+ S_Long_Long_Long_Size : constant Str := "Long_Long_Long_Size";
S_Long_Long_Size : constant Str := "Long_Long_Size";
S_Long_Size : constant Str := "Long_Size";
S_Maximum_Alignment : constant Str := "Maximum_Alignment";
@@ -84,6 +85,7 @@ package body Set_Targ is
S_Float_Words_BE 'Unrestricted_Access,
S_Int_Size 'Unrestricted_Access,
S_Long_Double_Size 'Unrestricted_Access,
+ S_Long_Long_Long_Size 'Unrestricted_Access,
S_Long_Long_Size 'Unrestricted_Access,
S_Long_Size 'Unrestricted_Access,
S_Maximum_Alignment 'Unrestricted_Access,
@@ -111,6 +113,7 @@ package body Set_Targ is
Float_Words_BE 'Address,
Int_Size 'Address,
Long_Double_Size 'Address,
+ Long_Long_Long_Size 'Address,
Long_Long_Size 'Address,
Long_Size 'Address,
Maximum_Alignment 'Address,
@@ -745,8 +748,15 @@ package body Set_Targ is
for J in DTR'Range loop
if not DTR (J) then
- Fail ("missing entry for " & DTN (J).all & " in file "
- & File_Name);
+ -- Make an exception for Long_Long_Long_Size???
+
+ if DTN (J) = S_Long_Long_Long_Size'Unrestricted_Access then
+ Long_Long_Long_Size := Long_Long_Size;
+
+ else
+ Fail ("missing entry for " & DTN (J).all & " in file "
+ & File_Name);
+ end if;
end if;
end loop;
@@ -934,6 +944,7 @@ begin
Double_Scalar_Alignment := Get_Double_Scalar_Alignment;
Float_Words_BE := Get_Float_Words_BE;
Int_Size := Get_Int_Size;
+ Long_Long_Long_Size := Get_Long_Long_Long_Size;
Long_Long_Size := Get_Long_Long_Size;
Long_Size := Get_Long_Size;
Maximum_Alignment := Get_Maximum_Alignment;
diff --git a/gcc/ada/set_targ.ads b/gcc/ada/set_targ.ads
index aa37770..e25f351 100644
--- a/gcc/ada/set_targ.ads
+++ b/gcc/ada/set_targ.ads
@@ -71,6 +71,7 @@ package Set_Targ is
Float_Words_BE : Nat; -- Float words stored big-endian?
Int_Size : Pos; -- Standard.Integer'Size
Long_Double_Size : Pos; -- Standard.Long_Long_Float'Size
+ Long_Long_Long_Size : Pos; -- Standard.Long_Long_Long_Integer'Size
Long_Long_Size : Pos; -- Standard.Long_Long_Integer'Size
Long_Size : Pos; -- Standard.Long_Integer'Size
Maximum_Alignment : Pos; -- Maximum permitted alignment
diff --git a/gcc/ada/sfn_scan.adb b/gcc/ada/sfn_scan.adb
index 1283abc..660d64f 100644
--- a/gcc/ada/sfn_scan.adb
+++ b/gcc/ada/sfn_scan.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 082f06f..c88d9a9 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -13,25 +13,16 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-pragma Style_Checks (All_Checks);
--- No subprogram ordering check, due to logical grouping
-
with Atree; use Atree;
package body Sinfo is
@@ -371,7 +362,8 @@ package body Sinfo is
or else NT (N).Nkind = N_Formal_Concrete_Subprogram_Declaration
or else NT (N).Nkind = N_Formal_Package_Declaration
or else NT (N).Nkind = N_Generic_Association
- or else NT (N).Nkind = N_Iterated_Component_Association);
+ or else NT (N).Nkind = N_Iterated_Component_Association
+ or else NT (N).Nkind = N_Iterated_Element_Association);
return Flag15 (N);
end Box_Present;
@@ -3876,7 +3868,8 @@ package body Sinfo is
or else NT (N).Nkind = N_Formal_Concrete_Subprogram_Declaration
or else NT (N).Nkind = N_Formal_Package_Declaration
or else NT (N).Nkind = N_Generic_Association
- or else NT (N).Nkind = N_Iterated_Component_Association);
+ or else NT (N).Nkind = N_Iterated_Component_Association
+ or else NT (N).Nkind = N_Iterated_Element_Association);
Set_Flag15 (N, Val);
end Set_Box_Present;
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 2583f91..439eef4 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -4251,6 +4245,7 @@ package Sinfo is
-- Expression (Node3)
-- Loop_Parameter_Specification (Node4)
-- Loop_Actions (List5-Sem)
+ -- Box_Present (Flag15)
-- Exactly one of Iterator_Specification or Loop_Parameter_
-- specification is present. If the Key_Expression is absent,
@@ -5414,9 +5409,9 @@ package Sinfo is
-- PARAMETER_SPECIFICATION ::=
-- DEFINING_IDENTIFIER_LIST : [ALIASED] MODE [NULL_EXCLUSION]
- -- SUBTYPE_MARK [:= DEFAULT_EXPRESSION]
+ -- SUBTYPE_MARK [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS]
-- | DEFINING_IDENTIFIER_LIST : ACCESS_DEFINITION
- -- [:= DEFAULT_EXPRESSION]
+ -- [:= DEFAULT_EXPRESSION] [ASPECT_SPECIFICATIONS]
-- Although the syntax allows multiple identifiers in the list, the
-- semantics is as though successive specifications were given with
@@ -7945,8 +7940,8 @@ package Sinfo is
-- operation) are also in this list.
-- Contract_Test_Cases contains a collection of pragmas that correspond
- -- to aspects/pragmas Contract_Cases and Test_Case. The ordering in the
- -- list is in LIFO fashion.
+ -- to aspects/pragmas Contract_Cases, Test_Case and Subprogram_Variant.
+ -- The ordering in the list is in LIFO fashion.
-- Classifications contains pragmas that either declare, categorize, or
-- establish dependencies between subprogram or package inputs and
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index 9f2669e..08db0cf 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads
index 28c080d..9e66d09 100644
--- a/gcc/ada/sinput.ads
+++ b/gcc/ada/sinput.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/snames.adb-tmpl b/gcc/ada/snames.adb-tmpl
index ce9c63d..132c2ca 100644
--- a/gcc/ada/snames.adb-tmpl
+++ b/gcc/ada/snames.adb-tmpl
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 6310442..a9fd7c5 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -148,6 +142,8 @@ package Snames is
Name_Dimension_System : constant Name_Id := N + $;
Name_Disable_Controlled : constant Name_Id := N + $;
Name_Dynamic_Predicate : constant Name_Id := N + $;
+ Name_Exclusive_Functions : constant Name_Id := N + $;
+ Name_Full_Access_Only : constant Name_Id := N + $;
Name_Integer_Literal : constant Name_Id := N + $;
Name_Real_Literal : constant Name_Id := N + $;
Name_Relaxed_Initialization : constant Name_Id := N + $;
@@ -173,6 +169,7 @@ package Snames is
Name_uFinalizer : constant Name_Id := N + $;
Name_uIdepth : constant Name_Id := N + $;
Name_uInit : constant Name_Id := N + $;
+ Name_uInit_Level : constant Name_Id := N + $;
Name_uInvariant : constant Name_Id := N + $;
Name_uMaster : constant Name_Id := N + $;
Name_uObject : constant Name_Id := N + $;
@@ -195,6 +192,7 @@ package Snames is
Name_uTask_Name : constant Name_Id := N + $;
Name_uTrace_Sp : constant Name_Id := N + $;
Name_uType_Invariant : constant Name_Id := N + $;
+ Name_uVariants : constant Name_Id := N + $;
-- Names of predefined primitives used in the expansion of dispatching
-- requeue and select statements, Abort, 'Callable and 'Terminated.
@@ -453,7 +451,6 @@ package Snames is
Name_Overriding_Renamings : constant Name_Id := N + $; -- GNAT
Name_Partition_Elaboration_Policy : constant Name_Id := N + $; -- Ada 05
Name_Persistent_BSS : constant Name_Id := N + $; -- GNAT
- Name_Polling : constant Name_Id := N + $; -- GNAT
Name_Prefix_Exception_Messages : constant Name_Id := N + $; -- GNAT
Name_Priority_Specific_Dispatching : constant Name_Id := N + $; -- Ada 05
Name_Profile : constant Name_Id := N + $; -- Ada 05
@@ -668,6 +665,7 @@ package Snames is
Name_Source_Reference : constant Name_Id := N + $; -- GNAT
Name_Static_Elaboration_Desired : constant Name_Id := N + $; -- GNAT
Name_Stream_Convert : constant Name_Id := N + $; -- GNAT
+ Name_Subprogram_Variant : constant Name_Id := N + $; -- GNAT
Name_Subtitle : constant Name_Id := N + $; -- GNAT
Name_Suppress_All : constant Name_Id := N + $; -- GNAT
Name_Suppress_Debug_Info : constant Name_Id := N + $; -- GNAT
@@ -983,6 +981,7 @@ package Snames is
Name_Machine_Size : constant Name_Id := N + $; -- GNAT
Name_Mantissa : constant Name_Id := N + $; -- Ada 83
Name_Max_Alignment_For_Allocation : constant Name_Id := N + $; -- Ada 12
+ Name_Max_Integer_Size : constant Name_Id := N + $; -- GNAT
Name_Max_Size_In_Storage_Elements : constant Name_Id := N + $;
Name_Maximum_Alignment : constant Name_Id := N + $; -- GNAT
Name_Mechanism_Code : constant Name_Id := N + $; -- GNAT
@@ -1188,19 +1187,21 @@ package Snames is
Name_Signed_16 : constant Name_Id := N + $; -- GNAT
Name_Signed_32 : constant Name_Id := N + $; -- GNAT
Name_Signed_64 : constant Name_Id := N + $; -- GNAT
+ Name_Signed_128 : constant Name_Id := N + $; -- GNAT
Name_Unsigned_8 : constant Name_Id := N + $; -- GNAT
Name_Unsigned_16 : constant Name_Id := N + $; -- GNAT
Name_Unsigned_32 : constant Name_Id := N + $; -- GNAT
Name_Unsigned_64 : constant Name_Id := N + $; -- GNAT
+ Name_Unsigned_128 : constant Name_Id := N + $; -- GNAT
subtype Scalar_Id is Name_Id
- range Name_Short_Float .. Name_Unsigned_64;
+ range Name_Short_Float .. Name_Unsigned_128;
subtype Float_Scalar_Id is Name_Id
range Name_Short_Float .. Name_Long_Long_Float;
subtype Integer_Scalar_Id is Name_Id
- range Name_Signed_8 .. Name_Unsigned_64;
+ range Name_Signed_8 .. Name_Unsigned_128;
-- Names of recognized checks for pragma Suppress
@@ -1676,6 +1677,7 @@ package Snames is
Attribute_Machine_Size,
Attribute_Mantissa,
Attribute_Max_Alignment_For_Allocation,
+ Attribute_Max_Integer_Size,
Attribute_Max_Size_In_Storage_Elements,
Attribute_Maximum_Alignment,
Attribute_Mechanism_Code,
@@ -1940,7 +1942,6 @@ package Snames is
Pragma_Overriding_Renamings,
Pragma_Partition_Elaboration_Policy,
Pragma_Persistent_BSS,
- Pragma_Polling,
Pragma_Prefix_Exception_Messages,
Pragma_Priority_Specific_Dispatching,
Pragma_Profile,
@@ -2101,6 +2102,7 @@ package Snames is
Pragma_Source_Reference,
Pragma_Static_Elaboration_Desired,
Pragma_Stream_Convert,
+ Pragma_Subprogram_Variant,
Pragma_Subtitle,
Pragma_Suppress_All,
Pragma_Suppress_Debug_Info,
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 3aeb95f..d71c415 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -420,6 +420,8 @@ package body Sprint is
Dump_Original_Only := False;
Dump_Freeze_Null := True;
Current_Source_File := No_Source_File;
+ Push_Output;
+ Set_Standard_Output;
if Arg in List_Range then
Sprint_Node_List (List_Id (Arg), New_Lines => True);
@@ -432,6 +434,7 @@ package body Sprint is
end if;
Write_Eol;
+ Pop_Output;
end pg;
--------
@@ -441,8 +444,11 @@ package body Sprint is
procedure po (Arg : Union_Id) is
begin
Dump_Generated_Only := False;
- Dump_Original_Only := True;
+ Dump_Original_Only := True;
+ Dump_Freeze_Null := False;
Current_Source_File := No_Source_File;
+ Push_Output;
+ Set_Standard_Output;
if Arg in List_Range then
Sprint_Node_List (List_Id (Arg), New_Lines => True);
@@ -455,6 +461,7 @@ package body Sprint is
end if;
Write_Eol;
+ Pop_Output;
end po;
----------------------
@@ -473,8 +480,11 @@ package body Sprint is
procedure ps (Arg : Union_Id) is
begin
Dump_Generated_Only := False;
- Dump_Original_Only := False;
+ Dump_Original_Only := False;
+ Dump_Freeze_Null := False;
Current_Source_File := No_Source_File;
+ Push_Output;
+ Set_Standard_Output;
if Arg in List_Range then
Sprint_Node_List (List_Id (Arg), New_Lines => True);
@@ -487,6 +497,7 @@ package body Sprint is
end if;
Write_Eol;
+ Pop_Output;
end ps;
--------------------
diff --git a/gcc/ada/stand.ads b/gcc/ada/stand.ads
index 57b4d55..5742e51 100644
--- a/gcc/ada/stand.ads
+++ b/gcc/ada/stand.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -440,8 +434,8 @@ package Stand is
Universal_Integer : Entity_Id;
-- Entity for universal integer type. The bounds of this type correspond
- -- to the largest supported integer type (i.e. Long_Long_Integer). It is
- -- the type used for runtime calculations in type universal integer.
+ -- to the largest supported integer type (i.e. Long_Long_Long_Integer).
+ -- It is the type used for runtime calculations in type universal integer.
Universal_Real : Entity_Id;
-- Entity for universal real type. The bounds of this type correspond to
@@ -464,11 +458,12 @@ package Stand is
-- These are signed integer types with the indicated sizes. Used for the
-- underlying implementation types for fixed-point and enumeration types.
- Standard_Short_Short_Unsigned : Entity_Id;
- Standard_Short_Unsigned : Entity_Id;
- Standard_Unsigned : Entity_Id;
- Standard_Long_Unsigned : Entity_Id;
- Standard_Long_Long_Unsigned : Entity_Id;
+ Standard_Short_Short_Unsigned : Entity_Id;
+ Standard_Short_Unsigned : Entity_Id;
+ Standard_Unsigned : Entity_Id;
+ Standard_Long_Unsigned : Entity_Id;
+ Standard_Long_Long_Unsigned : Entity_Id;
+ Standard_Long_Long_Long_Unsigned : Entity_Id;
-- Unsigned types with same Esize as corresponding signed integer types
Standard_Unsigned_64 : Entity_Id;
diff --git a/gcc/ada/stringt.adb b/gcc/ada/stringt.adb
index 35e9028..5cdf12c 100644
--- a/gcc/ada/stringt.adb
+++ b/gcc/ada/stringt.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/stringt.ads b/gcc/ada/stringt.ads
index ede7bfd..77a794e 100644
--- a/gcc/ada/stringt.ads
+++ b/gcc/ada/stringt.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index c5f2e1c..e086a5d 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -673,6 +673,13 @@ package body Switch.C is
new String'(Switch_Chars (Ptr .. Max));
return;
+ -- -gnaten (memory to allocate for nodes)
+
+ when 'n' =>
+ Ptr := Ptr + 1;
+ Scan_Pos
+ (Switch_Chars, Max, Ptr, Nodes_Size_In_Meg, C);
+
-- -gnateO= (object path file)
-- This is an internal switch
@@ -723,6 +730,7 @@ package body Switch.C is
when 'P' =>
Treat_Categorization_Errors_As_Warnings := True;
+ Ptr := Ptr + 1;
-- -gnates=file (specify extra file switches for gnat2why)
@@ -808,8 +816,8 @@ package body Switch.C is
-- -gnateu (unrecognized y,V,w switches)
when 'u' =>
- Ptr := Ptr + 1;
Ignore_Unrecognized_VWY_Switches := True;
+ Ptr := Ptr + 1;
-- -gnateV (validity checks on parameters)
@@ -1154,12 +1162,6 @@ package body Switch.C is
Suppress_Options.Overflow_Mode_Assertions := Strict;
end if;
- -- -gnatP (periodic poll)
-
- when 'P' =>
- Ptr := Ptr + 1;
- Polling_Required := True;
-
-- -gnatq (don't quit)
when 'q' =>
diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb
index cd7cbef..316d35e 100644
--- a/gcc/ada/table.adb
+++ b/gcc/ada/table.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads
index e8cbe81..8d1b8d7 100644
--- a/gcc/ada/table.ads
+++ b/gcc/ada/table.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index 9e15710..0be05ae 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -655,12 +655,6 @@ package body Targparm is
Opt.Partition_Elaboration_Policy_Sloc := System_Location;
goto Line_Loop_Continue;
- -- Polling (On)
-
- elsif Looking_At_Skip ("pragma Polling (On);") then
- Opt.Polling_Required := True;
- goto Line_Loop_Continue;
-
-- Queuing Policy
elsif Looking_At_Skip ("pragma Queuing_Policy (") then
diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads
index 7f98a1d..60b2367 100644
--- a/gcc/ada/targparm.ads
+++ b/gcc/ada/targparm.ads
@@ -101,9 +101,6 @@ package Targparm is
-- policy name, and Opt.Task_Dispatching_Policy_Sloc is set to
-- System_Location.
- -- If a pragma Polling (On) appears, then the flag Opt.Polling_Required
- -- is set to True.
-
-- If a pragma Detect_Blocking appears, then the flag Opt.Detect_Blocking
-- is set to True.
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index e76b138..ee1b3ba 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -264,6 +264,9 @@ package body Treepr is
Lid : Int;
begin
+ Push_Output;
+ Set_Standard_Output;
+
if L < 0 then
Lid := L;
@@ -292,6 +295,7 @@ package body Treepr is
-- Now output the list
Print_Tree_List (List_Id (Lid));
+ Pop_Output;
end pl;
--------
@@ -300,6 +304,9 @@ package body Treepr is
procedure pn (N : Union_Id) is
begin
+ Push_Output;
+ Set_Standard_Output;
+
case N is
when List_Low_Bound .. List_High_Bound - 1 =>
pl (Int (N));
@@ -332,6 +339,8 @@ package body Treepr is
Write_Int (Int (N));
Write_Eol;
end case;
+
+ Pop_Output;
end pn;
--------
@@ -869,6 +878,8 @@ package body Treepr is
----------------
procedure Print_Init is
+ Max_Hash_Entries : constant Nat :=
+ Approx_Num_Nodes_And_Entities + Num_Lists + Num_Elists;
begin
Printing_Descendants := True;
Write_Eol;
@@ -877,7 +888,7 @@ package body Treepr is
-- the maximum possible number of entries, so that the hash table
-- cannot get significantly overloaded.
- Hash_Table_Len := (150 * (Num_Nodes + Num_Lists + Num_Elists)) / 100;
+ Hash_Table_Len := (150 * Max_Hash_Entries) / 100;
Hash_Table := new Hash_Table_Type (0 .. Hash_Table_Len - 1);
for J in Hash_Table'Range loop
diff --git a/gcc/ada/ttypes.ads b/gcc/ada/ttypes.ads
index 88542c8..ebd02b3 100644
--- a/gcc/ada/ttypes.ads
+++ b/gcc/ada/ttypes.ads
@@ -130,6 +130,12 @@ package Ttypes is
Get_Targ.Width_From_Size
(Standard_Long_Long_Integer_Size);
+ Standard_Long_Long_Long_Integer_Size : Pos :=
+ Set_Targ.Long_Long_Long_Size;
+ Standard_Long_Long_Long_Integer_Width : Pos :=
+ Get_Targ.Width_From_Size
+ (Standard_Long_Long_Long_Integer_Size);
+
Standard_Short_Float_Size : constant Pos :=
Set_Targ.Float_Size;
Standard_Short_Float_Digits : constant Pos :=
@@ -176,8 +182,10 @@ package Ttypes is
System_Address_Size : constant Pos := Set_Targ.Pointer_Size;
-- System.Address'Size (also size of all thin pointers)
- System_Max_Binary_Modulus_Power : constant Pos :=
- Standard_Long_Long_Integer_Size;
+ System_Max_Integer_Size : Pos := Standard_Long_Long_Long_Integer_Size;
+
+ System_Max_Binary_Modulus_Power : Pos :=
+ Standard_Long_Long_Long_Integer_Size;
System_Max_Nonbinary_Modulus_Power : constant Pos := Standard_Integer_Size;
diff --git a/gcc/ada/types.adb b/gcc/ada/types.adb
index 732e070..a6d829e 100644
--- a/gcc/ada/types.adb
+++ b/gcc/ada/types.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index 6a1d94d..175ffb2 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -265,97 +259,86 @@ package Types is
-- These types are represented as integer indices into various tables.
-- However, they should be treated as private, except in a few documented
- -- cases. In particular it is never appropriate to perform arithmetic
- -- operations using these types.
+ -- cases. In particular it is usually inappropriate to perform arithmetic
+ -- operations using these types. One exception is in computing hash
+ -- functions of these types.
-- In most contexts, the strongly typed interface determines which of these
-- types is present. However, there are some situations (involving untyped
-- traversals of the tree), where it is convenient to be easily able to
-- distinguish these values. The underlying representation in all cases is
-- an integer type Union_Id, and we ensure that the range of the various
- -- possible values for each of the above types is disjoint so that this
- -- distinction is possible.
+ -- possible values for each of the above types is disjoint (except that
+ -- List_Id and Node_Id overlap at Empty) so that this distinction is
+ -- possible.
-- Note: it is also helpful for debugging purposes to make these ranges
-- distinct. If a bug leads to misidentification of a value, then it will
-- typically result in an out of range value and a Constraint_Error.
+ -- The range of Node_Id is most of the nonnegative integers. The other
+ -- ranges are negative. Uint has a very large range, because a substantial
+ -- part of this range is used to store direct values; see Uintp for
+ -- details. The other types have 100 million values, which should be
+ -- plenty.
+
type Union_Id is new Int;
-- The type in the tree for a union of possible ID values
- List_Low_Bound : constant := -100_000_000;
+ -- Following are the Low and High bounds of the various ranges.
+
+ List_Low_Bound : constant := -099_999_999;
-- The List_Id values are subscripts into an array of list headers which
- -- has List_Low_Bound as its lower bound. This value is chosen so that all
- -- List_Id values are negative, and the value zero is in the range of both
- -- List_Id and Node_Id values (see further description below).
+ -- has List_Low_Bound as its lower bound.
List_High_Bound : constant := 0;
- -- Maximum List_Id subscript value. This allows up to 100 million list Id
- -- values, which is in practice infinite, and there is no need to check the
- -- range. The range overlaps the node range by one element (with value
- -- zero), which is used both for the Empty node, and for indicating no
- -- list. The fact that the same value is used is convenient because it
- -- means that the default value of Empty applies to both nodes and lists,
- -- and also is more efficient to test for.
+ -- Maximum List_Id subscript value. The ranges of List_Id and Node_Id
+ -- overlap by one element (with value zero), which is used both for the
+ -- Empty node, and for No_List. The fact that the same value is used is
+ -- convenient because it means that the default value of Empty applies to
+ -- both nodes and lists, and also is more efficient to test for.
Node_Low_Bound : constant := 0;
-- The tree Id values start at zero, because we use zero for Empty (to
- -- allow a zero test for Empty). Actual tree node subscripts start at 0
- -- since Empty is a legitimate node value.
+ -- allow a zero test for Empty).
- Node_High_Bound : constant := 099_999_999;
- -- Maximum number of nodes that can be allocated is 100 million, which
- -- is in practice infinite, and there is no need to check the range.
+ Node_High_Bound : constant :=
+ (if Standard'Address_Size = 32 then 299_999_999 else 1_999_999_999);
- Elist_Low_Bound : constant := 100_000_000;
+ Elist_Low_Bound : constant := -199_999_999;
-- The Elist_Id values are subscripts into an array of elist headers which
-- has Elist_Low_Bound as its lower bound.
- Elist_High_Bound : constant := 199_999_999;
- -- Maximum Elist_Id subscript value. This allows up to 100 million Elists,
- -- which is in practice infinite and there is no need to check the range.
+ Elist_High_Bound : constant := -100_000_000;
- Elmt_Low_Bound : constant := 200_000_000;
+ Elmt_Low_Bound : constant := -299_999_999;
-- Low bound of element Id values. The use of these values is internal to
-- the Elists package, but the definition of the range is included here
-- since it must be disjoint from other Id values. The Elmt_Id values are
-- subscripts into an array of list elements which has this as lower bound.
- Elmt_High_Bound : constant := 299_999_999;
- -- Upper bound of Elmt_Id values. This allows up to 100 million element
- -- list members, which is in practice infinite (no range check needed).
+ Elmt_High_Bound : constant := -200_000_000;
- Names_Low_Bound : constant := 300_000_000;
- -- Low bound for name Id values
+ Names_Low_Bound : constant := -399_999_999;
- Names_High_Bound : constant := 399_999_999;
- -- Maximum number of names that can be allocated is 100 million, which is
- -- in practice infinite and there is no need to check the range.
+ Names_High_Bound : constant := -300_000_000;
- Strings_Low_Bound : constant := 400_000_000;
- -- Low bound for string Id values
+ Strings_Low_Bound : constant := -499_999_999;
- Strings_High_Bound : constant := 499_999_999;
- -- Maximum number of strings that can be allocated is 100 million, which
- -- is in practice infinite and there is no need to check the range.
+ Strings_High_Bound : constant := -400_000_000;
- Ureal_Low_Bound : constant := 500_000_000;
- -- Low bound for Ureal values
+ Ureal_Low_Bound : constant := -599_999_999;
- Ureal_High_Bound : constant := 599_999_999;
- -- Maximum number of Ureal values stored is 100_000_000 which is in
- -- practice infinite so that no check is required.
+ Ureal_High_Bound : constant := -500_000_000;
- Uint_Low_Bound : constant := 600_000_000;
+ Uint_Low_Bound : constant := -2_100_000_000;
-- Low bound for Uint values
- Uint_Table_Start : constant := 2_000_000_000;
+ Uint_Table_Start : constant := -699_999_999;
-- Location where table entries for universal integers start (see
-- Uintp spec for details of the representation of Uint values).
- Uint_High_Bound : constant := 2_099_999_999;
- -- The range of Uint values is very large, since a substantial part
- -- of this range is used to store direct values, see Uintp for details.
+ Uint_High_Bound : constant := -600_000_000;
-- The following subtype definitions are used to provide convenient names
-- for membership tests on Int values to see what data type range they
diff --git a/gcc/ada/types.h b/gcc/ada/types.h
index e7eeae0..76cf950 100644
--- a/gcc/ada/types.h
+++ b/gcc/ada/types.h
@@ -150,30 +150,32 @@ typedef int Union_Id;
/* Range definitions for Tree Data: */
-#define List_Low_Bound -100000000
+#define List_Low_Bound -99999999
#define List_High_Bound 0
#define Node_Low_Bound 0
-#define Node_High_Bound 99999999
+#define Node_High_Bound 1999999999
+/* Above is the correct value of Node_High_Bound for 64-bit machines. It is
+ wrong for 32-bit machines, but that doesn't matter. */
-#define Elist_Low_Bound 100000000
-#define Elist_High_Bound 199999999
+#define Elist_Low_Bound -199999999
+#define Elist_High_Bound -100000000
-#define Elmt_Low_Bound 200000000
-#define Elmt_High_Bound 299999999
+#define Elmt_Low_Bound -299999999
+#define Elmt_High_Bound -200000000
-#define Names_Low_Bound 300000000
-#define Names_High_Bound 399999999
+#define Names_Low_Bound -399999999
+#define Names_High_Bound -300000000
-#define Strings_Low_Bound 400000000
-#define Strings_High_Bound 499999999
+#define Strings_Low_Bound -499999999
+#define Strings_High_Bound -400000000
-#define Ureal_Low_Bound 500000000
-#define Ureal_High_Bound 599999999
+#define Ureal_Low_Bound -599999999
+#define Ureal_High_Bound -500000000
-#define Uint_Low_Bound 600000000
-#define Uint_Table_Start 2000000000
-#define Uint_High_Bound 2099999999
+#define Uint_Low_Bound -2100000000
+#define Uint_Table_Start -699999999
+#define Uint_High_Bound -600000000
SUBTYPE (List_Range, Int, List_Low_Bound, List_High_Bound)
SUBTYPE (Node_Range, Int, Node_Low_Bound, Node_High_Bound)
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb
index 5f479b4..10adaaa 100644
--- a/gcc/ada/uintp.adb
+++ b/gcc/ada/uintp.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -49,7 +43,7 @@ package body Uintp is
Uint_Int_Last : Uint;
-- Uint value containing Int'Last value set by Initialize
- UI_Power_2 : array (Int range 0 .. 64) of Uint;
+ UI_Power_2 : array (Int range 0 .. 128) of Uint;
-- This table is used to memoize exponentiations by powers of 2. The Nth
-- entry, if set, contains the Uint value 2**N. Initially UI_Power_2_Set
-- is zero and only the 0'th entry is set, the invariant being that all
@@ -58,7 +52,7 @@ package body Uintp is
UI_Power_2_Set : Nat;
-- Number of entries set in UI_Power_2;
- UI_Power_10 : array (Int range 0 .. 64) of Uint;
+ UI_Power_10 : array (Int range 0 .. 128) of Uint;
-- This table is used to memoize exponentiations by powers of 10 in the
-- same manner as described above for UI_Power_2.
@@ -1317,9 +1311,9 @@ package body Uintp is
-- Cases which can be done by table lookup
- elsif Right <= Uint_64 then
+ elsif Right <= Uint_128 then
- -- 2**N for N in 2 .. 64
+ -- 2**N for N in 2 .. 128
if Left = Uint_2 then
declare
@@ -1339,7 +1333,7 @@ package body Uintp is
return UI_Power_2 (Right_Int);
end;
- -- 10**N for N in 2 .. 64
+ -- 10**N for N in 2 .. 128
elsif Left = Uint_10 then
declare
diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads
index 652145e..648ee31 100644
--- a/gcc/ada/uintp.ads
+++ b/gcc/ada/uintp.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
@@ -73,6 +67,7 @@ package Uintp is
Uint_63 : constant Uint;
Uint_64 : constant Uint;
Uint_80 : constant Uint;
+ Uint_127 : constant Uint;
Uint_128 : constant Uint;
Uint_Minus_1 : constant Uint;
@@ -479,6 +474,7 @@ private
Uint_63 : constant Uint := Uint (Uint_Direct_Bias + 63);
Uint_64 : constant Uint := Uint (Uint_Direct_Bias + 64);
Uint_80 : constant Uint := Uint (Uint_Direct_Bias + 80);
+ Uint_127 : constant Uint := Uint (Uint_Direct_Bias + 127);
Uint_128 : constant Uint := Uint (Uint_Direct_Bias + 128);
Uint_Minus_1 : constant Uint := Uint (Uint_Direct_Bias - 1);
diff --git a/gcc/ada/uname.adb b/gcc/ada/uname.adb
index 203d1c7..a9b9947 100644
--- a/gcc/ada/uname.adb
+++ b/gcc/ada/uname.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/uname.ads b/gcc/ada/uname.ads
index 2a55c84..a7ede02 100644
--- a/gcc/ada/uname.ads
+++ b/gcc/ada/uname.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/urealp.adb b/gcc/ada/urealp.adb
index 31151c5..f45f261 100644
--- a/gcc/ada/urealp.adb
+++ b/gcc/ada/urealp.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/urealp.ads b/gcc/ada/urealp.ads
index 394bfed..5c511ef 100644
--- a/gcc/ada/urealp.ads
+++ b/gcc/ada/urealp.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 2afd3fc..f986484 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -378,11 +378,6 @@ begin
Write_Switch_Char ("p");
Write_Line ("Suppress all checks");
- -- Line for -gnatP switch
-
- Write_Switch_Char ("P");
- Write_Line ("Generate periodic calls to System.Polling.Poll");
-
-- Line for -gnatq switch
Write_Switch_Char ("q");
diff --git a/gcc/ada/vast.adb b/gcc/ada/vast.adb
index 87de26e..16519c8 100644
--- a/gcc/ada/vast.adb
+++ b/gcc/ada/vast.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/vast.ads b/gcc/ada/vast.ads
index 01dfbfd..5c8226a 100644
--- a/gcc/ada/vast.ads
+++ b/gcc/ada/vast.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/widechar.adb b/gcc/ada/widechar.adb
index 3d3ebaf..0c31b75 100644
--- a/gcc/ada/widechar.adb
+++ b/gcc/ada/widechar.adb
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/ada/widechar.ads b/gcc/ada/widechar.ads
index f81a19b..b0b593e 100644
--- a/gcc/ada/widechar.ads
+++ b/gcc/ada/widechar.ads
@@ -13,16 +13,10 @@
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. --
--- --
--- As a special exception 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/>. --
+-- 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 distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
diff --git a/gcc/alias.c b/gcc/alias.c
index 1cb702b..f6d7a17 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2142,10 +2142,10 @@ compare_base_decls (tree base1, tree base2)
/* If we have two register decls with register specification we
cannot decide unless their assembler names are the same. */
- if (DECL_REGISTER (base1)
- && DECL_REGISTER (base2)
- && HAS_DECL_ASSEMBLER_NAME_P (base1)
- && HAS_DECL_ASSEMBLER_NAME_P (base2)
+ if (VAR_P (base1)
+ && VAR_P (base2)
+ && DECL_HARD_REGISTER (base1)
+ && DECL_HARD_REGISTER (base2)
&& DECL_ASSEMBLER_NAME_SET_P (base1)
&& DECL_ASSEMBLER_NAME_SET_P (base2))
{
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
index 7ec4c14..a8e277c 100644
--- a/gcc/analyzer/ChangeLog
+++ b/gcc/analyzer/ChangeLog
@@ -1,3 +1,321 @@
+2020-10-22 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97514
+ * engine.cc (exploded_graph::add_function_entry): Handle failure
+ to create an enode, rather than asserting.
+
+2020-10-22 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97489
+ * engine.cc (exploded_graph::add_function_entry): Assert that we
+ have a function body.
+ (exploded_graph::on_escaped_function): Reject fndecls that don't
+ have a function body.
+
+2020-10-14 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93388
+ * region-model.cc (region_model::get_initial_value_for_global):
+ Fall back to returning an initial_svalue if
+ decl_region::get_svalue_for_initializer fails.
+ * region.cc (decl_region::get_svalue_for_initializer): Don't
+ attempt to create a compound_svalue if the region has an unknown
+ size.
+
+2020-10-14 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93723
+ * store.cc (binding_map::apply_ctor_to_region): Remove redundant
+ assertion.
+
+2020-10-12 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97258
+ * engine.cc (impl_region_model_context::on_escaped_function): New
+ vfunc.
+ (exploded_graph::add_function_entry): Use m_functions_with_enodes
+ to implement idempotency.
+ (add_any_callbacks): New.
+ (exploded_graph::build_initial_worklist): Use the above to find
+ callbacks that are reachable from global initializers.
+ (exploded_graph::on_escaped_function): New.
+ * exploded-graph.h
+ (impl_region_model_context::on_escaped_function): New decl.
+ (exploded_graph::on_escaped_function): New decl.
+ (exploded_graph::m_functions_with_enodes): New field.
+ * region-model-reachability.cc
+ (reachable_regions::reachable_regions): Replace "store" param with
+ "model" param; use it to initialize m_model.
+ (reachable_regions::add): When getting the svalue for the region,
+ call get_store_value on the model rather than using an initial
+ value.
+ (reachable_regions::mark_escaped_clusters): Add ctxt param and
+ use it to call on_escaped_function when a function_region escapes.
+ * region-model-reachability.h
+ (reachable_regions::reachable_regions): Replace "store" param with
+ "model" param.
+ (reachable_regions::mark_escaped_clusters): Add ctxt param.
+ (reachable_regions::m_model): New field.
+ * region-model.cc (region_model::handle_unrecognized_call): Update
+ for change in reachable_regions ctor.
+ (region_model::handle_unrecognized_call): Pass ctxt to
+ mark_escaped_clusters.
+ (region_model::get_reachable_svalues): Update for change in
+ reachable_regions ctor.
+ (region_model::get_initial_value_for_global): Read-only variables
+ keep their initial values.
+ * region-model.h (region_model_context::on_escaped_function): New
+ vfunc.
+ (noop_region_model_context::on_escaped_function): New.
+
+2020-10-12 David Malcolm <dmalcolm@redhat.com>
+
+ * analyzer.opt (Wanalyzer-write-to-const): New.
+ (Wanalyzer-write-to-string-literal): New.
+ * region-model-impl-calls.cc (region_model::impl_call_memcpy):
+ Call check_for_writable_region.
+ (region_model::impl_call_memset): Likewise.
+ (region_model::impl_call_strcpy): Likewise.
+ * region-model.cc (class write_to_const_diagnostic): New.
+ (class write_to_string_literal_diagnostic): New.
+ (region_model::check_for_writable_region): New.
+ (region_model::set_value): Call check_for_writable_region.
+ * region-model.h (region_model::check_for_writable_region): New
+ decl.
+
+2020-10-07 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97116
+ * sm-malloc.cc (method_p): New.
+ (describe_argument_index): New.
+ (inform_nonnull_attribute): Use describe_argument_index.
+ (possible_null_arg::describe_final_event): Likewise.
+ (null_arg::describe_final_event): Likewise.
+
+2020-09-29 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/95188
+ * engine.cc (stmt_requires_new_enode_p): Split enodes before
+ "signal" calls.
+
+2020-09-29 David Malcolm <dmalcolm@redhat.com>
+
+ * constraint-manager.cc
+ (constraint_manager::add_constraint_internal): Whitespace fixes.
+ Silence -Wsign-compare warning.
+ * engine.cc (maybe_process_run_of_before_supernode_enodes):
+ Silence -Wsign-compare warning.
+
+2020-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ * region-model.h (binop_svalue::dyn_cast_binop_svalue): Remove
+ redundant "virtual". Add FINAL OVERRIDE.
+ (widening_svalue::dyn_cast_widening_svalue): Add FINAL OVERRIDE.
+ (compound_svalue::dyn_cast_compound_svalue): Likewise.
+ (conjured_svalue::dyn_cast_conjured_svalue): Likewise.
+
+2020-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ * diagnostic-manager.cc (null_assignment_sm_context::m_visitor):
+ Remove unused field.
+
+2020-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97233
+ * analyzer.cc (is_longjmp_call_p): Require the initial argument
+ to be a pointer.
+ * engine.cc (exploded_node::on_longjmp): Likewise.
+
+2020-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ * program-state.cc (sm_state_map::print): Update check
+ for m_global_state being the start state.
+
+2020-09-26 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/96646
+ PR analyzer/96841
+ * region-model.cc (region_model::get_representative_path_var):
+ When handling offset_region, wrap the MEM_REF's first argument in
+ an ADDR_EXPR of pointer type, rather than simply using the tree
+ for the parent region. Require the MEM_REF's second argument to
+ be an integer constant.
+
+2020-09-24 David Malcolm <dmalcolm@redhat.com>
+
+ * analyzer.h (struct rejected_constraint): New decl.
+ * analyzer.opt (fanalyzer-feasibility): New option.
+ * diagnostic-manager.cc (path_builder::path_builder): Add
+ "problem" param and use it to initialize new field.
+ (path_builder::get_feasibility_problem): New accessor.
+ (path_builder::m_feasibility_problem): New field.
+ (dedupe_winners::add): Remove inversion of logic in "if" clause,
+ swapping if/else suites. In the !feasible_p suite, inspect
+ flag_analyzer_feasibility and add code to handle when this
+ is off, accepting the infeasible path, but recording the
+ feasibility_problem.
+ (diagnostic_manager::emit_saved_diagnostic): Pass the
+ feasibility_problem to the path_builder.
+ (diagnostic_manager::add_events_for_eedge): If we have
+ a feasibility_problem at this edge, use it to add a custom event.
+ * engine.cc (exploded_path::feasible_p): Pass a
+ rejected_constraint ** to model.maybe_update_for_edge and transfer
+ ownership of any created instance to any feasibility_problem.
+ (feasibility_problem::dump_to_pp): New.
+ * exploded-graph.h (feasibility_problem::feasibility_problem):
+ Drop "model" param; add rejected_constraint * param.
+ (feasibility_problem::~feasibility_problem): New.
+ (feasibility_problem::dump_to_pp): New decl.
+ (feasibility_problem::m_model): Drop field.
+ (feasibility_problem::m_rc): New field.
+ * program-point.cc (function_point::get_location): Handle
+ PK_BEFORE_SUPERNODE and PK_AFTER_SUPERNODE.
+ * program-state.cc (program_state::on_edge): Pass NULL to new
+ param of region_model::maybe_update_for_edge.
+ * region-model.cc (region_model::add_constraint): New overload
+ adding a rejected_constraint ** param.
+ (region_model::maybe_update_for_edge): Add rejected_constraint **
+ param and pass it to the various apply_constraints_for_ calls.
+ (region_model::apply_constraints_for_gcond): Add
+ rejected_constraint ** param and pass it to add_constraint calls.
+ (region_model::apply_constraints_for_gswitch): Likewise.
+ (region_model::apply_constraints_for_exception): Likewise.
+ (rejected_constraint::dump_to_pp): New.
+ * region-model.h (region_model::maybe_update_for_edge):
+ Add rejected_constraint ** param.
+ (region_model::add_constraint): New overload adding a
+ rejected_constraint ** param.
+ (region_model::apply_constraints_for_gcond): Add
+ rejected_constraint ** param.
+ (region_model::apply_constraints_for_gswitch): Likewise.
+ (region_model::apply_constraints_for_exception): Likewise.
+ (struct rejected_constraint): New.
+
+2020-09-23 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97178
+ * engine.cc (impl_run_checkers): Update for change to ext_state
+ ctor.
+ * program-state.cc (selftest::test_sm_state_map): Pass an engine
+ instance to ext_state ctor.
+ (selftest::test_program_state_1): Likewise.
+ (selftest::test_program_state_2): Likewise.
+ (selftest::test_program_state_merging): Likewise.
+ (selftest::test_program_state_merging_2): Likewise.
+ * program-state.h (extrinsic_state::extrinsic_state): Remove NULL
+ default value for "eng" param.
+
+2020-09-23 Tobias Burnus <tobias@codesourcery.com>
+
+ * analyzer-logging.cc: Guard '#pragma ... ignored "-Wformat-diag"'
+ by '#if __GNUC__ >= 10'
+ * analyzer.h: Likewise.
+ * call-string.cc: Likewise.
+
+2020-09-23 David Malcolm <dmalcolm@redhat.com>
+
+ * engine.cc (exploded_node::on_stmt): Replace sequence of dyn_cast
+ with switch.
+
+2020-09-22 David Malcolm <dmalcolm@redhat.com>
+
+ * analysis-plan.cc: Include "json.h".
+ * analyzer.opt (fdump-analyzer-json): New.
+ * call-string.cc: Include "json.h".
+ (call_string::to_json): New.
+ * call-string.h (call_string::to_json): New decl.
+ * checker-path.cc: Include "json.h".
+ * constraint-manager.cc: Include "json.h".
+ (equiv_class::to_json): New.
+ (constraint::to_json): New.
+ (constraint_manager::to_json): New.
+ * constraint-manager.h (equiv_class::to_json): New decl.
+ (constraint::to_json): New decl.
+ (constraint_manager::to_json): New decl.
+ * diagnostic-manager.cc: Include "json.h".
+ (saved_diagnostic::to_json): New.
+ (diagnostic_manager::to_json): New.
+ * diagnostic-manager.h (saved_diagnostic::to_json): New decl.
+ (diagnostic_manager::to_json): New decl.
+ * engine.cc: Include "json.h", <zlib.h>.
+ (exploded_node::status_to_str): New.
+ (exploded_node::to_json): New.
+ (exploded_edge::to_json): New.
+ (exploded_graph::to_json): New.
+ (dump_analyzer_json): New.
+ (impl_run_checkers): Call it.
+ * exploded-graph.h (exploded_node::status_to_str): New decl.
+ (exploded_node::to_json): New.
+ (exploded_edge::to_json): New.
+ (exploded_graph::to_json): New.
+ * pending-diagnostic.cc: Include "json.h".
+ * program-point.cc: Include "json.h".
+ (program_point::to_json): New.
+ * program-point.h (program_point::to_json): New decl.
+ * program-state.cc: Include "json.h".
+ (extrinsic_state::to_json): New.
+ (sm_state_map::to_json): New.
+ (program_state::to_json): New.
+ * program-state.h (extrinsic_state::to_json): New decl.
+ (sm_state_map::to_json): New decl.
+ (program_state::to_json): New decl.
+ * region-model-impl-calls.cc: Include "json.h".
+ * region-model-manager.cc: Include "json.h".
+ * region-model-reachability.cc: Include "json.h".
+ * region-model.cc: Include "json.h".
+ * region-model.h (svalue::to_json): New decl.
+ (region::to_json): New decl.
+ * region.cc: Include "json.h".
+ (region::to_json: New.
+ * sm-file.cc: Include "json.h".
+ * sm-malloc.cc: Include "json.h".
+ * sm-pattern-test.cc: Include "json.h".
+ * sm-sensitive.cc: Include "json.h".
+ * sm-signal.cc: Include "json.h".
+ (signal_delivery_edge_info_t::to_json): New.
+ * sm-taint.cc: Include "json.h".
+ * sm.cc: Include "diagnostic.h", "tree-diagnostic.h", and
+ "json.h".
+ (state_machine::state::to_json): New.
+ (state_machine::to_json): New.
+ * sm.h (state_machine::state::to_json): New.
+ (state_machine::to_json): New.
+ * state-purge.cc: Include "json.h".
+ * store.cc: Include "json.h".
+ (binding_key::get_desc): New.
+ (binding_map::to_json): New.
+ (binding_cluster::to_json): New.
+ (store::to_json): New.
+ * store.h (binding_key::get_desc): New decl.
+ (binding_map::to_json): New decl.
+ (binding_cluster::to_json): New decl.
+ (store::to_json): New decl.
+ * supergraph.cc: Include "json.h".
+ (supergraph::to_json): New.
+ (supernode::to_json): New.
+ (superedge::to_json): New.
+ * supergraph.h (supergraph::to_json): New decl.
+ (supernode::to_json): New decl.
+ (superedge::to_json): New decl.
+ * svalue.cc: Include "json.h".
+ (svalue::to_json): New.
+
+2020-09-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97130
+ * region-model-impl-calls.cc (call_details::get_arg_type): New.
+ * region-model.cc (region_model::on_call_pre): Check that the
+ initial arg is a pointer before calling impl_call_memset and
+ impl_call_strlen.
+ * region-model.h (call_details::get_arg_type): New decl.
+
+2020-09-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93355
+ * sm-malloc.cc (malloc_state_machine::get_default_state): Look at
+ the base region when considering pointers. Treat pointers to
+ decls as being non-heap.
+
2020-09-18 David Malcolm <dmalcolm@redhat.com>
* checker-path.cc (warning_event::get_desc): Handle global state
diff --git a/gcc/analyzer/analysis-plan.cc b/gcc/analyzer/analysis-plan.cc
index 3c8b10b..7e48f52 100644
--- a/gcc/analyzer/analysis-plan.cc
+++ b/gcc/analyzer/analysis-plan.cc
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "ipa-utils.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-core.h"
#include "analyzer/analyzer-logging.h"
diff --git a/gcc/analyzer/analyzer-logging.cc b/gcc/analyzer/analyzer-logging.cc
index d2bbd05..583840a 100644
--- a/gcc/analyzer/analyzer-logging.cc
+++ b/gcc/analyzer/analyzer-logging.cc
@@ -30,7 +30,9 @@ along with GCC; see the file COPYING3. If not see
#if ENABLE_ANALYZER
+#if __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
namespace ana {
diff --git a/gcc/analyzer/analyzer.cc b/gcc/analyzer/analyzer.cc
index 82d4878..c792dc3 100644
--- a/gcc/analyzer/analyzer.cc
+++ b/gcc/analyzer/analyzer.cc
@@ -218,7 +218,10 @@ is_longjmp_call_p (const gcall *call)
{
if (is_special_named_call_p (call, "longjmp", 2)
|| is_special_named_call_p (call, "siglongjmp", 2))
- return true;
+ /* exploded_node::on_longjmp requires a pointer for the initial
+ argument. */
+ if (POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (call, 0))))
+ return true;
return false;
}
diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h
index d234fcf..aa43b7f 100644
--- a/gcc/analyzer/analyzer.h
+++ b/gcc/analyzer/analyzer.h
@@ -71,6 +71,7 @@ class region_model;
class region_model_context;
class impl_region_model_context;
class call_details;
+struct rejected_constraint;
class constraint_manager;
class equiv_class;
@@ -301,7 +302,8 @@ private:
/* Disable -Wformat-diag; we want to be able to use pp_printf
for logging/dumping without complying with the rules for diagnostics. */
-
+#if __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
#endif /* GCC_ANALYZER_ANALYZER_H */
diff --git a/gcc/analyzer/analyzer.opt b/gcc/analyzer/analyzer.opt
index 94a686d..c9df6dc 100644
--- a/gcc/analyzer/analyzer.opt
+++ b/gcc/analyzer/analyzer.opt
@@ -114,6 +114,14 @@ Wanalyzer-use-of-pointer-in-stale-stack-frame
Common Var(warn_analyzer_use_of_pointer_in_stale_stack_frame) Init(1) Warning
Warn about code paths in which a pointer to a stale stack frame is used.
+Wanalyzer-write-to-const
+Common Var(warn_analyzer_write_to_const) Init(1) Warning
+Warn about code paths which attempt to write to a const object.
+
+Wanalyzer-write-to-string-literal
+Common Var(warn_analyzer_write_to_string_literal) Init(1) Warning
+Warn about code paths which attempt to write to a string literal.
+
Wanalyzer-too-complex
Common Var(warn_analyzer_too_complex) Init(0) Warning
Warn if the code is too complicated for the analyzer to fully explore.
@@ -126,6 +134,10 @@ fanalyzer-fine-grained
Common Var(flag_analyzer_fine_grained) Init(0)
Avoid combining multiple statements into one exploded edge.
+fanalyzer-feasibility
+Common Var(flag_analyzer_feasibility) Init(1)
+Verify that paths are feasible when emitting diagnostics.
+
fanalyzer-show-duplicate-count
Common Var(flag_analyzer_show_duplicate_count) Init(0)
Issue a note when diagnostics are deduplicated.
@@ -186,6 +198,10 @@ fdump-analyzer-exploded-nodes-3
Common RejectNegative Var(flag_dump_analyzer_exploded_nodes_3)
Dump a textual representation of the exploded graph to SRCFILE.eg-ID.txt.
+fdump-analyzer-json
+Common RejectNegative Var(flag_dump_analyzer_json)
+Dump analyzer-specific data to a SRCFILE.analyzer.json.gz file.
+
fdump-analyzer-state-purge
Common RejectNegative Var(flag_dump_analyzer_state_purge)
Dump state-purging information to a SRCFILE.state-purge.dot file.
diff --git a/gcc/analyzer/call-string.cc b/gcc/analyzer/call-string.cc
index d363031..8dfd157 100644
--- a/gcc/analyzer/call-string.cc
+++ b/gcc/analyzer/call-string.cc
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "pretty-print.h"
#include "tree.h"
#include "options.h"
+#include "json.h"
#include "analyzer/call-string.h"
#include "ordered-hash-map.h"
#include "options.h"
@@ -38,7 +39,9 @@ along with GCC; see the file COPYING3. If not see
#if ENABLE_ANALYZER
+#if __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wformat-diag"
+#endif
/* class call_string. */
@@ -104,6 +107,34 @@ call_string::print (pretty_printer *pp) const
pp_string (pp, "]");
}
+/* Return a new json::array of the form
+ [{"src_snode_idx" : int,
+ "dst_snode_idx" : int,
+ "funcname" : str},
+ ...for each return_superedge in the callstring]. */
+
+json::value *
+call_string::to_json () const
+{
+ json::array *arr = new json::array ();
+
+ const return_superedge *e;
+ int i;
+ FOR_EACH_VEC_ELT (m_return_edges, i, e)
+ {
+ json::object *e_obj = new json::object ();
+ e_obj->set ("src_snode_idx",
+ new json::integer_number (e->m_src->m_index));
+ e_obj->set ("dst_snode_idx",
+ new json::integer_number (e->m_dest->m_index));
+ e_obj->set ("funcname",
+ new json::string (function_name (e->m_dest->m_fun)));
+ arr->append (e_obj);
+ }
+
+ return arr;
+}
+
/* Generate a hash value for this call_string. */
hashval_t
diff --git a/gcc/analyzer/call-string.h b/gcc/analyzer/call-string.h
index 1b5db0a..5a03c59 100644
--- a/gcc/analyzer/call-string.h
+++ b/gcc/analyzer/call-string.h
@@ -47,6 +47,8 @@ public:
void print (pretty_printer *pp) const;
+ json::value *to_json () const;
+
hashval_t hash () const;
bool empty_p () const { return m_return_edges.is_empty (); }
diff --git a/gcc/analyzer/checker-path.cc b/gcc/analyzer/checker-path.cc
index c281316..1f6d6a8 100644
--- a/gcc/analyzer/checker-path.cc
+++ b/gcc/analyzer/checker-path.cc
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "fibonacci_heap.h"
#include "diagnostic-event-id.h"
#include "shortest-paths.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/sm.h"
diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc
index 521501f..603b228 100644
--- a/gcc/analyzer/constraint-manager.cc
+++ b/gcc/analyzer/constraint-manager.cc
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "graphviz.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "ordered-hash-map.h"
#include "options.h"
@@ -299,6 +300,33 @@ equiv_class::print (pretty_printer *pp) const
pp_character (pp, '}');
}
+/* Return a new json::object of the form
+ {"svals" : [str],
+ "constant" : optional str}. */
+
+json::object *
+equiv_class::to_json () const
+{
+ json::object *ec_obj = new json::object ();
+
+ json::array *sval_arr = new json::array ();
+ int i;
+ const svalue *sval;
+ FOR_EACH_VEC_ELT (m_vars, i, sval)
+ sval_arr->append (sval->to_json ());
+ ec_obj->set ("svals", sval_arr);
+
+ if (m_constant)
+ {
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ pp_printf (&pp, "%qE", m_constant);
+ ec_obj->set ("constant", new json::string (pp_formatted_text (&pp)));
+ }
+
+ return ec_obj;
+}
+
/* Generate a hash value for this equiv_class.
This relies on the ordering of m_vars, and so this object needs to
have been canonicalized for this to be meaningful. */
@@ -499,6 +527,23 @@ constraint::print (pretty_printer *pp, const constraint_manager &cm) const
m_rhs.get_obj (cm).print (pp);
}
+/* Return a new json::object of the form
+ {"lhs" : int, the EC index
+ "op" : str,
+ "rhs" : int, the EC index}. */
+
+json::object *
+constraint::to_json () const
+{
+ json::object *con_obj = new json::object ();
+
+ con_obj->set ("lhs", new json::integer_number (m_lhs.as_int ()));
+ con_obj->set ("op", new json::string (constraint_op_code (m_op)));
+ con_obj->set ("rhs", new json::integer_number (m_rhs.as_int ()));
+
+ return con_obj;
+}
+
/* Generate a hash value for this constraint. */
hashval_t
@@ -768,6 +813,38 @@ debug (const constraint_manager &cm)
cm.dump ();
}
+/* Return a new json::object of the form
+ {"ecs" : array of objects, one per equiv_class
+ "constraints" : array of objects, one per constraint}. */
+
+json::object *
+constraint_manager::to_json () const
+{
+ json::object *cm_obj = new json::object ();
+
+ /* Equivalence classes. */
+ {
+ json::array *ec_arr = new json::array ();
+ int i;
+ equiv_class *ec;
+ FOR_EACH_VEC_ELT (m_equiv_classes, i, ec)
+ ec_arr->append (ec->to_json ());
+ cm_obj->set ("ecs", ec_arr);
+ }
+
+ /* Constraints. */
+ {
+ json::array *con_arr = new json::array ();
+ int i;
+ constraint *c;
+ FOR_EACH_VEC_ELT (m_constraints, i, c)
+ con_arr->append (c->to_json ());
+ cm_obj->set ("constraints", con_arr);
+ }
+
+ return cm_obj;
+}
+
/* Attempt to add the constraint LHS OP RHS to this constraint_manager.
Return true if the constraint could be added (or is already true).
Return false if the constraint contradicts existing knowledge. */
@@ -937,10 +1014,10 @@ constraint_manager::add_unknown_constraint (equiv_class_id lhs_ec_id,
void
constraint_manager::add_constraint_internal (equiv_class_id lhs_id,
- enum constraint_op c_op,
- equiv_class_id rhs_id)
+ enum constraint_op c_op,
+ equiv_class_id rhs_id)
{
- if (m_constraints.length () >= param_analyzer_max_constraints)
+ if (m_constraints.length () >= (unsigned)param_analyzer_max_constraints)
return;
constraint new_c (lhs_id, c_op, rhs_id);
diff --git a/gcc/analyzer/constraint-manager.h b/gcc/analyzer/constraint-manager.h
index 3c31a89..98960ff 100644
--- a/gcc/analyzer/constraint-manager.h
+++ b/gcc/analyzer/constraint-manager.h
@@ -88,6 +88,8 @@ public:
void print (pretty_printer *pp) const;
+ json::object *to_json () const;
+
/* An equivalence class can contain multiple constants (e.g. multiple
different zeroes, for different types); these are just for the last
constant added. */
@@ -160,6 +162,8 @@ class constraint
void print (pretty_printer *pp, const constraint_manager &cm) const;
+ json::object *to_json () const;
+
hashval_t hash () const;
bool operator== (const constraint &other) const;
@@ -215,6 +219,8 @@ public:
void dump (FILE *fp) const;
void dump () const;
+ json::object *to_json () const;
+
const equiv_class &get_equiv_class_by_index (unsigned idx) const
{
return *m_equiv_classes[idx];
diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index 4a95d4c..cb95a95 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "tristate.h"
#include "selftest.h"
#include "ordered-hash-map.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/sm.h"
@@ -114,6 +115,43 @@ saved_diagnostic::operator== (const saved_diagnostic &other) const
&& m_trailing_eedge == other.m_trailing_eedge);
}
+/* Return a new json::object of the form
+ {"sm": optional str,
+ "enode": int,
+ "snode": int,
+ "sval": optional str,
+ "state": optional str,
+ "path_length": int,
+ "pending_diagnostic": str}. */
+
+json::object *
+saved_diagnostic::to_json () const
+{
+ json::object *sd_obj = new json::object ();
+
+ if (m_sm)
+ sd_obj->set ("sm", new json::string (m_sm->get_name ()));
+ sd_obj->set ("enode", new json::integer_number (m_enode->m_index));
+ sd_obj->set ("snode", new json::integer_number (m_snode->m_index));
+ if (m_sval)
+ sd_obj->set ("sval", m_sval->to_json ());
+ if (m_state)
+ sd_obj->set ("state", m_state->to_json ());
+ sd_obj->set ("path_length", new json::integer_number (m_epath_length));
+ sd_obj->set ("pending_diagnostic", new json::string (m_d->get_kind ()));
+
+ /* We're not yet JSONifying the following fields:
+ const gimple *m_stmt;
+ stmt_finder *m_stmt_finder;
+ tree m_var;
+ exploded_edge *m_trailing_eedge;
+ enum status m_status;
+ feasibility_problem *m_problem;
+ */
+
+ return sd_obj;
+}
+
/* State for building a checker_path from a particular exploded_path.
In particular, this precomputes reachability information: the set of
source enodes for which a path be found to the diagnostic enode. */
@@ -122,10 +160,12 @@ class path_builder
{
public:
path_builder (const exploded_graph &eg,
- const exploded_path &epath)
+ const exploded_path &epath,
+ const feasibility_problem *problem)
: m_eg (eg),
m_diag_enode (epath.get_final_enode ()),
- m_reachability (eg, m_diag_enode)
+ m_reachability (eg, m_diag_enode),
+ m_feasibility_problem (problem)
{}
const exploded_node *get_diag_node () const { return m_diag_enode; }
@@ -137,6 +177,11 @@ public:
const extrinsic_state &get_ext_state () const { return m_eg.get_ext_state (); }
+ const feasibility_problem *get_feasibility_problem () const
+ {
+ return m_feasibility_problem;
+ }
+
private:
typedef reachability<eg_traits> enode_reachability;
@@ -147,6 +192,8 @@ private:
/* Precompute all enodes from which the diagnostic is reachable. */
enode_reachability m_reachability;
+
+ const feasibility_problem *m_feasibility_problem;
};
/* class diagnostic_manager. */
@@ -199,6 +246,26 @@ diagnostic_manager::add_diagnostic (const exploded_node *enode,
add_diagnostic (NULL, enode, snode, stmt, finder, NULL_TREE, NULL, 0, d);
}
+/* Return a new json::object of the form
+ {"diagnostics" : [obj for saved_diagnostic]}. */
+
+json::object *
+diagnostic_manager::to_json () const
+{
+ json::object *dm_obj = new json::object ();
+
+ {
+ json::array *sd_arr = new json::array ();
+ int i;
+ saved_diagnostic *sd;
+ FOR_EACH_VEC_ELT (m_saved_diagnostics, i, sd)
+ sd_arr->append (sd->to_json ());
+ dm_obj->set ("diagnostics", sd_arr);
+ }
+
+ return dm_obj;
+}
+
/* A class for identifying sets of duplicated pending_diagnostic.
We want to find the simplest dedupe_candidate amongst those that share a
@@ -378,24 +445,38 @@ public:
sd->m_snode->m_index);
feasibility_problem *p = NULL;
- if (!dc->get_path ().feasible_p (logger, &p, m_engine, eg))
+ if (dc->get_path ().feasible_p (logger, &p, m_engine, eg))
{
if (logger)
- logger->log ("rejecting %qs at EN: %i, SN: %i"
- " due to infeasible path",
+ logger->log ("accepting %qs at EN: %i, SN: %i with feasible path",
sd->m_d->get_kind (), sd->m_enode->m_index,
sd->m_snode->m_index);
- sd->set_infeasible (p);
- delete dc;
- return;
+ sd->set_feasible ();
}
else
- if (logger)
- logger->log ("accepting %qs at EN: %i, SN: %i with feasible path",
- sd->m_d->get_kind (), sd->m_enode->m_index,
- sd->m_snode->m_index);
-
- sd->set_feasible ();
+ {
+ if (flag_analyzer_feasibility)
+ {
+ if (logger)
+ logger->log ("rejecting %qs at EN: %i, SN: %i"
+ " due to infeasible path",
+ sd->m_d->get_kind (), sd->m_enode->m_index,
+ sd->m_snode->m_index);
+ sd->set_infeasible (p);
+ delete dc;
+ return;
+ }
+ else
+ {
+ if (logger)
+ logger->log ("accepting %qs at EN: %i, SN: %i"
+ " despite infeasible path (due to %qs)",
+ sd->m_d->get_kind (), sd->m_enode->m_index,
+ sd->m_snode->m_index,
+ "-fno-analyzer-feasibility");
+ sd->set_infeasible (p);
+ }
+ }
dedupe_key *key = new dedupe_key (*sd, dc->get_path ());
if (dedupe_candidate **slot = m_map.get (key))
@@ -540,7 +621,7 @@ diagnostic_manager::emit_saved_diagnostic (const exploded_graph &eg,
pretty_printer *pp = global_dc->printer->clone ();
/* Precompute all enodes from which the diagnostic is reachable. */
- path_builder pb (eg, epath);
+ path_builder pb (eg, epath, sd.get_feasibility_problem ());
/* This is the diagnostic_path subclass that will be built for
the diagnostic. */
@@ -850,7 +931,6 @@ struct null_assignment_sm_context : public sm_context
const program_state *m_new_state;
const gimple *m_stmt;
const program_point *m_point;
- state_change_visitor *m_visitor;
checker_path *m_emission_path;
const extrinsic_state &m_ext_state;
};
@@ -985,6 +1065,22 @@ diagnostic_manager::add_events_for_eedge (const path_builder &pb,
}
break;
}
+
+ if (pb.get_feasibility_problem ()
+ && &pb.get_feasibility_problem ()->m_eedge == &eedge)
+ {
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ pp_string (&pp,
+ "this path would have been rejected as infeasible"
+ " at this edge: ");
+ pb.get_feasibility_problem ()->dump_to_pp (&pp);
+ emission_path->add_event (new custom_event
+ (dst_point.get_location (),
+ dst_point.get_fndecl (),
+ dst_stack_depth,
+ pp_formatted_text (&pp)));
+ }
}
/* Return true if EEDGE is a significant edge in the path to the diagnostic
diff --git a/gcc/analyzer/diagnostic-manager.h b/gcc/analyzer/diagnostic-manager.h
index 1e310f7..c32f0c4 100644
--- a/gcc/analyzer/diagnostic-manager.h
+++ b/gcc/analyzer/diagnostic-manager.h
@@ -46,6 +46,8 @@ public:
bool operator== (const saved_diagnostic &other) const;
+ json::object *to_json () const;
+
void set_feasible ()
{
gcc_assert (m_status == STATUS_NEW);
@@ -105,6 +107,8 @@ public:
engine *get_engine () const { return m_eng; }
+ json::object *to_json () const;
+
void add_diagnostic (const state_machine *sm,
const exploded_node *enode,
const supernode *snode, const gimple *stmt,
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index d03e23a..d4c654a 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "tristate.h"
#include "ordered-hash-map.h"
#include "selftest.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/call-string.h"
@@ -61,6 +62,7 @@ along with GCC; see the file COPYING3. If not see
#include "analyzer/checker-path.h"
#include "analyzer/state-purge.h"
#include "analyzer/bar-chart.h"
+#include <zlib.h>
/* For an overview, see gcc/doc/analyzer.texi. */
@@ -141,6 +143,12 @@ impl_region_model_context::on_unknown_change (const svalue *sval,
smap->on_unknown_change (sval, is_mutable, m_ext_state);
}
+void
+impl_region_model_context::on_escaped_function (tree fndecl)
+{
+ m_eg->on_escaped_function (fndecl);
+}
+
/* class setjmp_svalue : public svalue. */
/* Implementation of svalue::accept vfunc for setjmp_svalue. */
@@ -764,6 +772,19 @@ eg_traits::dump_args_t::show_enode_details_p (const exploded_node &enode) const
/* class exploded_node : public dnode<eg_traits>. */
+const char *
+exploded_node::status_to_str (enum status s)
+{
+ switch (s)
+ {
+ default: gcc_unreachable ();
+ case STATUS_WORKLIST: return "WORKLIST";
+ case STATUS_PROCESSED: return "PROCESSED";
+ case STATUS_MERGER: return "MERGER";
+ case STATUS_BULK_MERGED: return "BULK_MERGED";
+ }
+}
+
/* exploded_node's ctor. */
exploded_node::exploded_node (const point_and_state &ps,
@@ -952,6 +973,28 @@ exploded_node::dump (const extrinsic_state &ext_state) const
dump (stderr, ext_state);
}
+/* Return a new json::object of the form
+ {"point" : object for program_point,
+ "state" : object for program_state,
+ "status" : str,
+ "idx" : int,
+ "processed_stmts" : int}. */
+
+json::object *
+exploded_node::to_json (const extrinsic_state &ext_state) const
+{
+ json::object *enode_obj = new json::object ();
+
+ enode_obj->set ("point", get_point ().to_json ());
+ enode_obj->set ("state", get_state ().to_json (ext_state));
+ enode_obj->set ("status", new json::string (status_to_str (m_status)));
+ enode_obj->set ("idx", new json::integer_number (m_index));
+ enode_obj->set ("processed_stmts",
+ new json::integer_number (m_num_processed_stmts));
+
+ return enode_obj;
+}
+
} // namespace ana
/* Return true if FNDECL has a gimple body. */
@@ -1026,62 +1069,88 @@ exploded_node::on_stmt (exploded_graph &eg,
&old_state, state,
stmt);
- if (const gassign *assign = dyn_cast <const gassign *> (stmt))
- state->m_region_model->on_assignment (assign, &ctxt);
-
- if (const greturn *return_ = dyn_cast <const greturn *> (stmt))
- state->m_region_model->on_return (return_, &ctxt);
-
- /* Track whether we have a gcall to a function that's not recognized by
- anything, for which we don't have a function body, or for which we
- don't know the fndecl. */
bool unknown_side_effects = false;
- if (const gcall *call = dyn_cast <const gcall *> (stmt))
+
+ switch (gimple_code (stmt))
{
- /* Debugging/test support. */
- if (is_special_named_call_p (call, "__analyzer_describe", 2))
- state->m_region_model->impl_call_analyzer_describe (call, &ctxt);
- else if (is_special_named_call_p (call, "__analyzer_dump", 0))
- {
- /* Handle the builtin "__analyzer_dump" by dumping state
- to stderr. */
- state->dump (eg.get_ext_state (), true);
- }
- else if (is_special_named_call_p (call, "__analyzer_dump_path", 0))
- {
- /* Handle the builtin "__analyzer_dump_path" by queuing a
- diagnostic at this exploded_node. */
- ctxt.warn (new dump_path_diagnostic ());
- }
- else if (is_special_named_call_p (call, "__analyzer_dump_region_model", 0))
- {
- /* Handle the builtin "__analyzer_dump_region_model" by dumping
- the region model's state to stderr. */
- state->m_region_model->dump (false);
- }
- else if (is_special_named_call_p (call, "__analyzer_eval", 1))
- state->m_region_model->impl_call_analyzer_eval (call, &ctxt);
- else if (is_special_named_call_p (call, "__analyzer_break", 0))
- {
- /* Handle the builtin "__analyzer_break" by triggering a
- breakpoint. */
- /* TODO: is there a good cross-platform way to do this? */
- raise (SIGINT);
- }
- else if (is_special_named_call_p (call, "__analyzer_dump_exploded_nodes",
- 1))
- {
- /* This is handled elsewhere. */
- }
- else if (is_setjmp_call_p (call))
- state->m_region_model->on_setjmp (call, this, &ctxt);
- else if (is_longjmp_call_p (call))
- {
- on_longjmp (eg, call, state, &ctxt);
- return on_stmt_flags::terminate_path ();
- }
- else
- unknown_side_effects = state->m_region_model->on_call_pre (call, &ctxt);
+ default:
+ /* No-op for now. */
+ break;
+
+ case GIMPLE_ASSIGN:
+ {
+ const gassign *assign = as_a <const gassign *> (stmt);
+ state->m_region_model->on_assignment (assign, &ctxt);
+ }
+ break;
+
+ case GIMPLE_ASM:
+ /* No-op for now. */
+ break;
+
+ case GIMPLE_CALL:
+ {
+ /* Track whether we have a gcall to a function that's not recognized by
+ anything, for which we don't have a function body, or for which we
+ don't know the fndecl. */
+ const gcall *call = as_a <const gcall *> (stmt);
+
+ /* Debugging/test support. */
+ if (is_special_named_call_p (call, "__analyzer_describe", 2))
+ state->m_region_model->impl_call_analyzer_describe (call, &ctxt);
+ else if (is_special_named_call_p (call, "__analyzer_dump", 0))
+ {
+ /* Handle the builtin "__analyzer_dump" by dumping state
+ to stderr. */
+ state->dump (eg.get_ext_state (), true);
+ }
+ else if (is_special_named_call_p (call, "__analyzer_dump_path", 0))
+ {
+ /* Handle the builtin "__analyzer_dump_path" by queuing a
+ diagnostic at this exploded_node. */
+ ctxt.warn (new dump_path_diagnostic ());
+ }
+ else if (is_special_named_call_p (call, "__analyzer_dump_region_model",
+ 0))
+ {
+ /* Handle the builtin "__analyzer_dump_region_model" by dumping
+ the region model's state to stderr. */
+ state->m_region_model->dump (false);
+ }
+ else if (is_special_named_call_p (call, "__analyzer_eval", 1))
+ state->m_region_model->impl_call_analyzer_eval (call, &ctxt);
+ else if (is_special_named_call_p (call, "__analyzer_break", 0))
+ {
+ /* Handle the builtin "__analyzer_break" by triggering a
+ breakpoint. */
+ /* TODO: is there a good cross-platform way to do this? */
+ raise (SIGINT);
+ }
+ else if (is_special_named_call_p (call,
+ "__analyzer_dump_exploded_nodes",
+ 1))
+ {
+ /* This is handled elsewhere. */
+ }
+ else if (is_setjmp_call_p (call))
+ state->m_region_model->on_setjmp (call, this, &ctxt);
+ else if (is_longjmp_call_p (call))
+ {
+ on_longjmp (eg, call, state, &ctxt);
+ return on_stmt_flags::terminate_path ();
+ }
+ else
+ unknown_side_effects
+ = state->m_region_model->on_call_pre (call, &ctxt);
+ }
+ break;
+
+ case GIMPLE_RETURN:
+ {
+ const greturn *return_ = as_a <const greturn *> (stmt);
+ state->m_region_model->on_return (return_, &ctxt);
+ }
+ break;
}
bool any_sm_changes = false;
@@ -1214,6 +1283,7 @@ exploded_node::on_longjmp (exploded_graph &eg,
region_model_context *ctxt) const
{
tree buf_ptr = gimple_call_arg (longjmp_call, 0);
+ gcc_assert (POINTER_TYPE_P (TREE_TYPE (buf_ptr)));
region_model *new_region_model = new_state->m_region_model;
const svalue *buf_ptr_sval = new_region_model->get_rvalue (buf_ptr, ctxt);
@@ -1502,6 +1572,30 @@ exploded_edge::dump_dot (graphviz_out *gv, const dump_args_t &) const
pp_printf (pp, "\"];\n");
}
+/* Return a new json::object of the form
+ {"src_idx": int, the index of the source exploded edge,
+ "dst_idx": int, the index of the destination exploded edge,
+ "sedge": (optional) object for the superedge, if any,
+ "custom": (optional) str, a description, if this is a custom edge}. */
+
+json::object *
+exploded_edge::to_json () const
+{
+ json::object *eedge_obj = new json::object ();
+ eedge_obj->set ("src_idx", new json::integer_number (m_src->m_index));
+ eedge_obj->set ("dst_idx", new json::integer_number (m_dest->m_index));
+ if (m_sedge)
+ eedge_obj->set ("sedge", m_sedge->to_json ());
+ if (m_custom_info)
+ {
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ m_custom_info->print (&pp);
+ eedge_obj->set ("custom", new json::string (pp_formatted_text (&pp)));
+ }
+ return eedge_obj;
+}
+
/* struct stats. */
/* stats' ctor. */
@@ -1843,6 +1937,17 @@ exploded_graph::~exploded_graph ()
exploded_node *
exploded_graph::add_function_entry (function *fun)
{
+ gcc_assert (gimple_has_body_p (fun->decl));
+
+ /* Be idempotent. */
+ if (m_functions_with_enodes.contains (fun))
+ {
+ logger * const logger = get_logger ();
+ if (logger)
+ logger->log ("entrypoint for %qE already exists", fun->decl);
+ return NULL;
+ }
+
program_point point = program_point::from_function_entry (m_sg, fun);
program_state state (m_ext_state);
state.push_frame (m_ext_state, fun);
@@ -1851,9 +1956,13 @@ exploded_graph::add_function_entry (function *fun)
return NULL;
exploded_node *enode = get_or_create_node (point, state, NULL);
- /* We should never fail to add such a node. */
- gcc_assert (enode);
+ if (!enode)
+ return NULL;
+
add_edge (m_origin, enode, NULL);
+
+ m_functions_with_enodes.add (fun);
+
return enode;
}
@@ -2173,6 +2282,18 @@ toplevel_function_p (cgraph_node *node, function *fun, logger *logger)
return true;
}
+/* Callback for walk_tree for finding callbacks within initializers;
+ ensure they are treated as possible entrypoints to the analysis. */
+
+static tree
+add_any_callbacks (tree *tp, int *, void *data)
+{
+ exploded_graph *eg = (exploded_graph *)data;
+ if (TREE_CODE (*tp) == FUNCTION_DECL)
+ eg->on_escaped_function (*tp);
+ return NULL_TREE;
+}
+
/* Add initial nodes to EG, with entrypoints for externally-callable
functions. */
@@ -2198,6 +2319,19 @@ exploded_graph::build_initial_worklist ()
logger->log ("did not create enode for %qE entrypoint", fun->decl);
}
}
+
+ /* Find callbacks that are reachable from global initializers. */
+ varpool_node *vpnode;
+ FOR_EACH_VARIABLE (vpnode)
+ {
+ tree decl = vpnode->decl;
+ if (!TREE_PUBLIC (decl))
+ continue;
+ tree init = DECL_INITIAL (decl);
+ if (!init)
+ continue;
+ walk_tree (&init, add_any_callbacks, this, NULL);
+ }
}
/* The main loop of the analysis.
@@ -2541,7 +2675,7 @@ maybe_process_run_of_before_supernode_enodes (exploded_node *enode)
}
got_merger:
gcc_assert (it->m_merger_idx >= 0);
- gcc_assert (it->m_merger_idx < merged_states.length ());
+ gcc_assert ((unsigned)it->m_merger_idx < merged_states.length ());
}
/* Create merger nodes. */
@@ -2589,13 +2723,23 @@ static bool
stmt_requires_new_enode_p (const gimple *stmt,
const gimple *prev_stmt)
{
- /* Stop consolidating at calls to
- "__analyzer_dump_exploded_nodes", so they always appear at the
- start of an exploded_node. */
if (const gcall *call = dyn_cast <const gcall *> (stmt))
- if (is_special_named_call_p (call, "__analyzer_dump_exploded_nodes",
- 1))
- return true;
+ {
+ /* Stop consolidating at calls to
+ "__analyzer_dump_exploded_nodes", so they always appear at the
+ start of an exploded_node. */
+ if (is_special_named_call_p (call, "__analyzer_dump_exploded_nodes",
+ 1))
+ return true;
+
+ /* sm-signal.cc injects an additional custom eedge at "signal" calls
+ from the registration enode to the handler enode, separate from the
+ regular next state, which defeats the "detect state change" logic
+ in process_node. Work around this via special-casing, to ensure
+ we split the enode immediately before any "signal" call. */
+ if (is_special_named_call_p (call, "signal", 2))
+ return true;
+ }
/* If we had a PREV_STMT with an unknown location, and this stmt
has a known location, then if a state change happens here, it
@@ -3057,6 +3201,55 @@ exploded_graph::dump_states_for_supernode (FILE *out,
snode->m_index, state_idx);
}
+/* Return a new json::object of the form
+ {"nodes" : [objs for enodes],
+ "edges" : [objs for eedges],
+ "ext_state": object for extrinsic_state,
+ "diagnostic_manager": object for diagnostic_manager}. */
+
+json::object *
+exploded_graph::to_json () const
+{
+ json::object *egraph_obj = new json::object ();
+
+ /* Nodes. */
+ {
+ json::array *nodes_arr = new json::array ();
+ unsigned i;
+ exploded_node *n;
+ FOR_EACH_VEC_ELT (m_nodes, i, n)
+ nodes_arr->append (n->to_json (m_ext_state));
+ egraph_obj->set ("nodes", nodes_arr);
+ }
+
+ /* Edges. */
+ {
+ json::array *edges_arr = new json::array ();
+ unsigned i;
+ exploded_edge *n;
+ FOR_EACH_VEC_ELT (m_edges, i, n)
+ edges_arr->append (n->to_json ());
+ egraph_obj->set ("edges", edges_arr);
+ }
+
+ /* m_sg is JSONified at the top-level. */
+
+ egraph_obj->set ("ext_state", m_ext_state.to_json ());
+ egraph_obj->set ("diagnostic_manager", m_diagnostic_manager.to_json ());
+
+ /* The following fields aren't yet being JSONified:
+ worklist m_worklist;
+ const state_purge_map *const m_purge_map;
+ const analysis_plan &m_plan;
+ stats m_global_stats;
+ function_stat_map_t m_per_function_stats;
+ stats m_functionless_stats;
+ call_string_data_map_t m_per_call_string_data;
+ auto_vec<int> m_PK_AFTER_SUPERNODE_per_snode; */
+
+ return egraph_obj;
+}
+
/* Look for the last use of SEARCH_STMT within this path.
If found write the edge's index to *OUT_IDX and return true, otherwise
return false. */
@@ -3148,7 +3341,8 @@ exploded_path::feasible_p (logger *logger, feasibility_problem **out,
sedge->get_description (false));
const gimple *last_stmt = src_point.get_supernode ()->get_last_stmt ();
- if (!model.maybe_update_for_edge (*sedge, last_stmt, NULL))
+ rejected_constraint *rc = NULL;
+ if (!model.maybe_update_for_edge (*sedge, last_stmt, NULL, &rc))
{
if (logger)
{
@@ -3156,8 +3350,10 @@ exploded_path::feasible_p (logger *logger, feasibility_problem **out,
model.dump_to_pp (logger->get_printer (), true, false);
}
if (out)
- *out = new feasibility_problem (edge_idx, model, *eedge,
- last_stmt);
+ *out = new feasibility_problem (edge_idx, *eedge,
+ last_stmt, rc);
+ else
+ delete rc;
return false;
}
}
@@ -3263,6 +3459,22 @@ exploded_path::dump () const
dump (stderr);
}
+/* class feasibility_problem. */
+
+void
+feasibility_problem::dump_to_pp (pretty_printer *pp) const
+{
+ pp_printf (pp, "edge from EN: %i to EN: %i",
+ m_eedge.m_src->m_index, m_eedge.m_dest->m_index);
+ if (m_rc)
+ {
+ pp_string (pp, "; rejected constraint: ");
+ m_rc->dump_to_pp (pp);
+ pp_string (pp, "; rmodel: ");
+ m_rc->m_model.dump_to_pp (pp, true, false);
+ }
+}
+
/* A family of cluster subclasses for use when generating .dot output for
exploded graphs (-fdump-analyzer-exploded-graph), for grouping the
enodes into hierarchical boxes.
@@ -3757,6 +3969,36 @@ exploded_graph::get_node_by_index (int idx) const
return enode;
}
+/* Ensure that there is an exploded_node for a top-level call to FNDECL. */
+
+void
+exploded_graph::on_escaped_function (tree fndecl)
+{
+ logger * const logger = get_logger ();
+ LOG_FUNC_1 (logger, "%qE", fndecl);
+
+ cgraph_node *cgnode = cgraph_node::get (fndecl);
+ if (!cgnode)
+ return;
+
+ function *fun = cgnode->get_fun ();
+ if (!fun)
+ return;
+
+ if (!gimple_has_body_p (fndecl))
+ return;
+
+ exploded_node *enode = add_function_entry (fun);
+ if (logger)
+ {
+ if (enode)
+ logger->log ("created EN %i for %qE entrypoint",
+ enode->m_index, fun->decl);
+ else
+ logger->log ("did not create enode for %qE entrypoint", fun->decl);
+ }
+}
+
/* A collection of classes for visualizing the callgraph in .dot form
(as represented in the supergraph). */
@@ -4241,6 +4483,39 @@ private:
auto_delete_vec<auto_vec <exploded_node *> > m_enodes_per_snodes;
};
+/* Implement -fdump-analyzer-json. */
+
+static void
+dump_analyzer_json (const supergraph &sg,
+ const exploded_graph &eg)
+{
+ auto_timevar tv (TV_ANALYZER_DUMP);
+ char *filename = concat (dump_base_name, ".analyzer.json.gz", NULL);
+ gzFile output = gzopen (filename, "w");
+ if (!output)
+ {
+ error_at (UNKNOWN_LOCATION, "unable to open %qs for writing", filename);
+ free (filename);
+ return;
+ }
+
+ json::object *toplev_obj = new json::object ();
+ toplev_obj->set ("sgraph", sg.to_json ());
+ toplev_obj->set ("egraph", eg.to_json ());
+
+ pretty_printer pp;
+ toplev_obj->print (&pp);
+ pp_formatted_text (&pp);
+
+ delete toplev_obj;
+
+ if (gzputs (output, pp_formatted_text (&pp)) == EOF
+ || gzclose (output))
+ error_at (UNKNOWN_LOCATION, "error writing %qs", filename);
+
+ free (filename);
+}
+
/* Run the analysis "engine". */
void
@@ -4295,7 +4570,7 @@ impl_run_checkers (logger *logger)
}
/* Extrinsic state shared by nodes in the graph. */
- const extrinsic_state ext_state (checkers, logger, &eng);
+ const extrinsic_state ext_state (checkers, &eng, logger);
const analysis_plan plan (sg, logger);
@@ -4341,6 +4616,9 @@ impl_run_checkers (logger *logger)
free (filename);
}
+ if (flag_dump_analyzer_json)
+ dump_analyzer_json (sg, eg);
+
delete purge_map;
}
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index 04e878f..b207b1d 100644
--- a/gcc/analyzer/exploded-graph.h
+++ b/gcc/analyzer/exploded-graph.h
@@ -66,6 +66,8 @@ class impl_region_model_context : public region_model_context
void on_unexpected_tree_code (tree t,
const dump_location_t &loc) FINAL OVERRIDE;
+ void on_escaped_function (tree fndecl) FINAL OVERRIDE;
+
exploded_graph *m_eg;
log_user m_logger;
const exploded_node *m_enode_for_diag;
@@ -165,6 +167,7 @@ class exploded_node : public dnode<eg_traits>
/* Node was processed by maybe_process_run_of_before_supernode_enodes. */
STATUS_BULK_MERGED
};
+ static const char * status_to_str (enum status s);
exploded_node (const point_and_state &ps, int index);
@@ -179,6 +182,8 @@ class exploded_node : public dnode<eg_traits>
void dump (FILE *fp, const extrinsic_state &ext_state) const;
void dump (const extrinsic_state &ext_state) const;
+ json::object *to_json (const extrinsic_state &ext_state) const;
+
/* The result of on_stmt. */
struct on_stmt_flags
{
@@ -307,6 +312,8 @@ class exploded_edge : public dedge<eg_traits>
void dump_dot (graphviz_out *gv, const dump_args_t &args)
const FINAL OVERRIDE;
+ json::object *to_json () const;
+
//private:
const superedge *const m_sedge;
@@ -782,6 +789,8 @@ public:
void dump_states_for_supernode (FILE *, const supernode *snode) const;
void dump_exploded_nodes () const;
+ json::object *to_json () const;
+
exploded_node *get_node_by_index (int idx) const;
const call_string_data_map_t *get_per_call_string_data () const
@@ -792,6 +801,8 @@ public:
return m_worklist.get_scc_id (node);
}
+ void on_escaped_function (tree fndecl);
+
private:
void print_bar_charts (pretty_printer *pp) const;
@@ -838,6 +849,10 @@ private:
call_string_data_map_t m_per_call_string_data;
auto_vec<int> m_PK_AFTER_SUPERNODE_per_snode;
+
+ /* Functions with a top-level enode, to make add_function_entry
+ be idempotent, for use in handling callbacks. */
+ hash_set<function *> m_functions_with_enodes;
};
/* A path within an exploded_graph: a sequence of edges. */
@@ -873,17 +888,20 @@ class feasibility_problem
{
public:
feasibility_problem (unsigned eedge_idx,
- const region_model &model,
const exploded_edge &eedge,
- const gimple *last_stmt)
- : m_eedge_idx (eedge_idx), m_model (model), m_eedge (eedge),
- m_last_stmt (last_stmt)
+ const gimple *last_stmt,
+ rejected_constraint *rc)
+ : m_eedge_idx (eedge_idx), m_eedge (eedge),
+ m_last_stmt (last_stmt), m_rc (rc)
{}
+ ~feasibility_problem () { delete m_rc; }
+
+ void dump_to_pp (pretty_printer *pp) const;
unsigned m_eedge_idx;
- region_model m_model;
const exploded_edge &m_eedge;
const gimple *m_last_stmt;
+ rejected_constraint *m_rc;
};
/* Finding the shortest exploded_path within an exploded_graph. */
diff --git a/gcc/analyzer/pending-diagnostic.cc b/gcc/analyzer/pending-diagnostic.cc
index c196903..502d177 100644
--- a/gcc/analyzer/pending-diagnostic.cc
+++ b/gcc/analyzer/pending-diagnostic.cc
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "diagnostic.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc
index ef19e6e..0aadd73 100644
--- a/gcc/analyzer/program-point.cc
+++ b/gcc/analyzer/program-point.cc
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple-pretty-print.h"
#include "gcc-rich-location.h"
+#include "json.h"
#include "analyzer/call-string.h"
#include "ordered-hash-map.h"
#include "options.h"
@@ -198,8 +199,12 @@ function_point::get_location () const
const gimple *stmt = get_stmt ();
if (stmt)
return stmt->location;
-
- return UNKNOWN_LOCATION;
+ if (m_kind == PK_BEFORE_SUPERNODE)
+ return m_supernode->get_start_location ();
+ else if (m_kind == PK_AFTER_SUPERNODE)
+ return m_supernode->get_end_location ();
+ else
+ return UNKNOWN_LOCATION;
}
/* Create a function_point representing the entrypoint of function FUN. */
@@ -281,6 +286,43 @@ program_point::dump () const
pp_flush (&pp);
}
+/* Return a new json::object of the form
+ {"kind" : str,
+ "snode_idx" : int (optional), the index of the supernode,
+ "from_edge_snode_idx" : int (only for kind=='PK_BEFORE_SUPERNODE'),
+ "stmt_idx": int (only for kind=='PK_BEFORE_STMT',
+ "call_string": object for the call_string}. */
+
+json::object *
+program_point::to_json () const
+{
+ json::object *point_obj = new json::object ();
+
+ point_obj->set ("kind",
+ new json::string (point_kind_to_string (get_kind ())));
+
+ if (get_supernode ())
+ point_obj->set ("snode_idx",
+ new json::integer_number (get_supernode ()->m_index));
+
+ switch (get_kind ())
+ {
+ default: break;
+ case PK_BEFORE_SUPERNODE:
+ if (const superedge *sedge = get_from_edge ())
+ point_obj->set ("from_edge_snode_idx",
+ new json::integer_number (sedge->m_src->m_index));
+ break;
+ case PK_BEFORE_STMT:
+ point_obj->set ("stmt_idx", new json::integer_number (get_stmt_idx ()));
+ break;
+ }
+
+ point_obj->set ("call_string", m_call_string.to_json ());
+
+ return point_obj;
+}
+
/* Generate a hash value for this program_point. */
hashval_t
diff --git a/gcc/analyzer/program-point.h b/gcc/analyzer/program-point.h
index 97fd0a5..d804621 100644
--- a/gcc/analyzer/program-point.h
+++ b/gcc/analyzer/program-point.h
@@ -175,6 +175,8 @@ public:
void print_source_line (pretty_printer *pp) const;
void dump () const;
+ json::object *to_json () const;
+
hashval_t hash () const;
bool operator== (const program_point &other) const
{
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index 71bb286..5bb8907 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "diagnostic.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/sm.h"
@@ -99,6 +100,26 @@ extrinsic_state::dump () const
dump_to_file (stderr);
}
+/* Return a new json::object of the form
+ {"checkers" : array of objects, one for each state_machine}. */
+
+json::object *
+extrinsic_state::to_json () const
+{
+ json::object *ext_state_obj = new json::object ();
+
+ {
+ json::array *checkers_arr = new json::array ();
+ unsigned i;
+ state_machine *sm;
+ FOR_EACH_VEC_ELT (m_checkers, i, sm)
+ checkers_arr->append (sm->to_json ());
+ ext_state_obj->set ("checkers", checkers_arr);
+ }
+
+ return ext_state_obj;
+}
+
/* Get the region_model_manager for this extrinsic_state. */
region_model_manager *
@@ -139,7 +160,7 @@ sm_state_map::print (const region_model *model,
bool first = true;
if (!multiline)
pp_string (pp, "{");
- if (m_global_state != 0)
+ if (m_global_state != m_sm.get_start_state ())
{
if (multiline)
pp_string (pp, " ");
@@ -208,6 +229,33 @@ sm_state_map::dump (bool simple) const
pp_flush (&pp);
}
+/* Return a new json::object of the form
+ {"global" : (optional) value for global state,
+ SVAL_DESC : value for state}. */
+
+json::object *
+sm_state_map::to_json () const
+{
+ json::object *map_obj = new json::object ();
+
+ if (m_global_state != m_sm.get_start_state ())
+ map_obj->set ("global", m_global_state->to_json ());
+ for (map_t::iterator iter = m_map.begin ();
+ iter != m_map.end ();
+ ++iter)
+ {
+ const svalue *sval = (*iter).first;
+ entry_t e = (*iter).second;
+
+ label_text sval_desc = sval->get_desc ();
+ map_obj->set (sval_desc.m_buffer, e.m_state->to_json ());
+ sval_desc.maybe_free ();
+
+ /* This doesn't yet JSONify e.m_origin. */
+ }
+ return map_obj;
+}
+
/* Return true if no states have been set within this map
(all expressions are for the start state). */
@@ -733,6 +781,43 @@ program_state::dump (const extrinsic_state &ext_state,
dump_to_file (ext_state, summarize, true, stderr);
}
+/* Return a new json::object of the form
+ {"store" : object for store,
+ "constraints" : object for constraint_manager,
+ "curr_frame" : (optional) str for current frame,
+ "checkers" : { STATE_NAME : object per sm_state_map },
+ "valid" : true/false}. */
+
+json::object *
+program_state::to_json (const extrinsic_state &ext_state) const
+{
+ json::object *state_obj = new json::object ();
+
+ state_obj->set ("store", m_region_model->get_store ()->to_json ());
+ state_obj->set ("constraints",
+ m_region_model->get_constraints ()->to_json ());
+ if (m_region_model->get_current_frame ())
+ state_obj->set ("curr_frame",
+ m_region_model->get_current_frame ()->to_json ());
+
+ /* Provide m_checker_states as an object, using names as keys. */
+ {
+ json::object *checkers_obj = new json::object ();
+
+ int i;
+ sm_state_map *smap;
+ FOR_EACH_VEC_ELT (m_checker_states, i, smap)
+ if (!smap->is_empty_p ())
+ checkers_obj->set (ext_state.get_name (i), smap->to_json ());
+
+ state_obj->set ("checkers", checkers_obj);
+ }
+
+ state_obj->set ("valid", new json::literal (m_valid));
+
+ return state_obj;
+}
+
/* Update this program_state to reflect a top-level call to FUN.
The params will have initial_svalues. */
@@ -787,7 +872,7 @@ program_state::on_edge (exploded_graph &eg,
last_stmt);
if (!m_region_model->maybe_update_for_edge (*succ,
last_stmt,
- &ctxt))
+ &ctxt, NULL))
{
logger * const logger = eg.get_logger ();
if (logger)
@@ -1055,7 +1140,8 @@ test_sm_state_map ()
state_machine *sm = make_malloc_state_machine (NULL);
auto_delete_vec <state_machine> checkers;
checkers.safe_push (sm);
- extrinsic_state ext_state (checkers);
+ engine eng;
+ extrinsic_state ext_state (checkers, &eng);
state_machine::state_t start = sm->get_start_state ();
/* Test setting states on svalue_id instances directly. */
@@ -1187,7 +1273,7 @@ test_program_state_1 ()
checkers.safe_push (sm);
engine eng;
- extrinsic_state ext_state (checkers, NULL, &eng);
+ extrinsic_state ext_state (checkers, &eng);
region_model_manager *mgr = eng.get_model_manager ();
program_state s (ext_state);
region_model *model = s.m_region_model;
@@ -1216,7 +1302,7 @@ test_program_state_2 ()
auto_delete_vec <state_machine> checkers;
engine eng;
- extrinsic_state ext_state (checkers, NULL, &eng);
+ extrinsic_state ext_state (checkers, &eng);
program_state s (ext_state);
region_model *model = s.m_region_model;
@@ -1239,7 +1325,7 @@ test_program_state_merging ()
auto_delete_vec <state_machine> checkers;
checkers.safe_push (make_malloc_state_machine (NULL));
engine eng;
- extrinsic_state ext_state (checkers, NULL, &eng);
+ extrinsic_state ext_state (checkers, &eng);
region_model_manager *mgr = eng.get_model_manager ();
program_state s0 (ext_state);
@@ -1304,7 +1390,8 @@ test_program_state_merging_2 ()
program_point point (program_point::origin ());
auto_delete_vec <state_machine> checkers;
checkers.safe_push (make_signal_state_machine (NULL));
- extrinsic_state ext_state (checkers);
+ engine eng;
+ extrinsic_state ext_state (checkers, &eng);
const state_machine::state test_state_0 ("test state 0", 0);
const state_machine::state test_state_1 ("test state 1", 1);
diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h
index cb0df8c..094d256 100644
--- a/gcc/analyzer/program-state.h
+++ b/gcc/analyzer/program-state.h
@@ -29,8 +29,8 @@ class extrinsic_state
{
public:
extrinsic_state (auto_delete_vec <state_machine> &checkers,
- logger *logger = NULL,
- engine *eng = NULL)
+ engine *eng,
+ logger *logger = NULL)
: m_checkers (checkers), m_logger (logger), m_engine (eng)
{
}
@@ -53,6 +53,8 @@ public:
void dump_to_file (FILE *outf) const;
void dump () const;
+ json::object *to_json () const;
+
engine *get_engine () const { return m_engine; }
region_model_manager *get_model_manager () const;
@@ -109,6 +111,8 @@ public:
pretty_printer *pp) const;
void dump (bool simple) const;
+ json::object *to_json () const;
+
bool is_empty_p () const;
hashval_t hash () const;
@@ -204,6 +208,8 @@ public:
bool multiline, FILE *outf) const;
void dump (const extrinsic_state &ext_state, bool simple) const;
+ json::object *to_json (const extrinsic_state &ext_state) const;
+
void push_frame (const extrinsic_state &ext_state, function *fun);
function * get_current_function () const;
diff --git a/gcc/analyzer/region-model-impl-calls.cc b/gcc/analyzer/region-model-impl-calls.cc
index 6582ffb..ef84e63 100644
--- a/gcc/analyzer/region-model-impl-calls.cc
+++ b/gcc/analyzer/region-model-impl-calls.cc
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "selftest.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "ordered-hash-map.h"
@@ -103,6 +104,14 @@ call_details::get_arg_tree (unsigned idx) const
return gimple_call_arg (m_call, idx);
}
+/* Get the type of argument IDX. */
+
+tree
+call_details::get_arg_type (unsigned idx) const
+{
+ return TREE_TYPE (gimple_call_arg (m_call, idx));
+}
+
/* Get argument IDX at the callsite as an svalue. */
const svalue *
@@ -296,6 +305,8 @@ region_model::impl_call_memcpy (const call_details &cd)
return;
}
+ check_for_writable_region (dest_reg, cd.get_ctxt ());
+
/* Otherwise, mark region's contents as unknown. */
mark_region_as_unknown (dest_reg);
}
@@ -337,6 +348,8 @@ region_model::impl_call_memset (const call_details &cd)
}
}
+ check_for_writable_region (dest_reg, cd.get_ctxt ());
+
/* Otherwise, mark region's contents as unknown. */
mark_region_as_unknown (dest_reg);
return false;
@@ -388,6 +401,8 @@ region_model::impl_call_strcpy (const call_details &cd)
cd.maybe_set_lhs (dest_sval);
+ check_for_writable_region (dest_reg, cd.get_ctxt ());
+
/* For now, just mark region's contents as unknown. */
mark_region_as_unknown (dest_reg);
}
diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc
index da8fa01..8dd3ad0 100644
--- a/gcc/analyzer/region-model-manager.cc
+++ b/gcc/analyzer/region-model-manager.cc
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "selftest.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "ordered-hash-map.h"
diff --git a/gcc/analyzer/region-model-reachability.cc b/gcc/analyzer/region-model-reachability.cc
index 681b8f7..3a6b312 100644
--- a/gcc/analyzer/region-model-reachability.cc
+++ b/gcc/analyzer/region-model-reachability.cc
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "cfg.h"
#include "digraph.h"
+#include "json.h"
#include "analyzer/call-string.h"
#include "analyzer/program-point.h"
#include "analyzer/store.h"
@@ -57,9 +58,9 @@ along with GCC; see the file COPYING3. If not see
namespace ana {
-reachable_regions::reachable_regions (store *store,
+reachable_regions::reachable_regions (region_model *model,
region_model_manager *mgr)
-: m_store (store), m_mgr (mgr),
+: m_model (model), m_store (model->get_store ()), m_mgr (mgr),
m_reachable_base_regs (), m_mutable_base_regs ()
{
}
@@ -134,7 +135,7 @@ reachable_regions::add (const region *reg, bool is_mutable)
if (binding_cluster *bind_cluster = m_store->get_cluster (base_reg))
bind_cluster->for_each_value (handle_sval_cb, this);
else
- handle_sval (m_mgr->get_or_create_initial_value (base_reg));
+ handle_sval (m_model->get_store_value (reg));
}
void
@@ -205,17 +206,24 @@ reachable_regions::handle_parm (const svalue *sval, tree param_type)
}
}
-/* Update m_store to mark the clusters that were found to be mutable
- as having escaped. */
+/* Update the store to mark the clusters that were found to be mutable
+ as having escaped.
+ Notify CTXT about escaping function_decls. */
void
-reachable_regions::mark_escaped_clusters ()
+reachable_regions::mark_escaped_clusters (region_model_context *ctxt)
{
+ gcc_assert (ctxt);
for (hash_set<const region *>::iterator iter = m_mutable_base_regs.begin ();
iter != m_mutable_base_regs.end (); ++iter)
{
const region *base_reg = *iter;
m_store->mark_as_escaped (base_reg);
+
+ /* If we have a function that's escaped, potentially add
+ it to the worklist. */
+ if (const function_region *fn_reg = base_reg->dyn_cast_function_region ())
+ ctxt->on_escaped_function (fn_reg->get_fndecl ());
}
}
diff --git a/gcc/analyzer/region-model-reachability.h b/gcc/analyzer/region-model-reachability.h
index aba1a58..fe305b0 100644
--- a/gcc/analyzer/region-model-reachability.h
+++ b/gcc/analyzer/region-model-reachability.h
@@ -35,7 +35,7 @@ namespace ana {
class reachable_regions
{
public:
- reachable_regions (store *store, region_model_manager *mgr);
+ reachable_regions (region_model *model, region_model_manager *mgr);
/* Callback called for each cluster when initializing this object. */
static void init_cluster_cb (const region *base_reg,
@@ -59,8 +59,9 @@ public:
void handle_parm (const svalue *sval, tree param_type);
/* Update the store to mark the clusters that were found to be mutable
- as having escaped. */
- void mark_escaped_clusters ();
+ as having escaped.
+ Notify CTXT about escaping function_decls. */
+ void mark_escaped_clusters (region_model_context *ctxt);
/* Iteration over reachable base regions. */
hash_set<const region *>::iterator begin ()
@@ -94,6 +95,7 @@ public:
DEBUG_FUNCTION void dump () const;
private:
+ region_model *m_model;
store *m_store;
region_model_manager *m_mgr;
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 1312391..06c0c86 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "selftest.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "ordered-hash-map.h"
@@ -737,12 +738,14 @@ region_model::on_call_pre (const gcall *call, region_model_context *ctxt)
/* No side-effects (tracking stream state is out-of-scope
for the analyzer). */
}
- else if (is_named_call_p (callee_fndecl, "memset", call, 3))
+ else if (is_named_call_p (callee_fndecl, "memset", call, 3)
+ && POINTER_TYPE_P (cd.get_arg_type (0)))
{
impl_call_memset (cd);
return false;
}
- else if (is_named_call_p (callee_fndecl, "strlen", call, 1))
+ else if (is_named_call_p (callee_fndecl, "strlen", call, 1)
+ && POINTER_TYPE_P (cd.get_arg_type (0)))
{
if (impl_call_strlen (cd))
return false;
@@ -833,7 +836,7 @@ region_model::handle_unrecognized_call (const gcall *call,
{
tree fndecl = get_fndecl_for_call (call, ctxt);
- reachable_regions reachable_regs (&m_store, m_mgr);
+ reachable_regions reachable_regs (this, m_mgr);
/* Determine the reachable regions and their mutability. */
{
@@ -881,7 +884,7 @@ region_model::handle_unrecognized_call (const gcall *call,
}
/* Mark any clusters that have escaped. */
- reachable_regs.mark_escaped_clusters ();
+ reachable_regs.mark_escaped_clusters (ctxt);
/* Update bindings for all clusters that have escaped, whether above,
or previously. */
@@ -901,7 +904,7 @@ void
region_model::get_reachable_svalues (svalue_set *out,
const svalue *extra_sval)
{
- reachable_regions reachable_regs (&m_store, m_mgr);
+ reachable_regions reachable_regs (this, m_mgr);
/* Add globals and regions that already escaped in previous
unknown calls. */
@@ -1330,35 +1333,39 @@ region_model::get_initial_value_for_global (const region *reg) const
an unknown value if an unknown call has occurred, unless this is
static to-this-TU and hasn't escaped. Globals that have escaped
are explicitly tracked, so we shouldn't hit this case for them. */
- if (m_store.called_unknown_fn_p () && TREE_PUBLIC (decl))
+ if (m_store.called_unknown_fn_p ()
+ && TREE_PUBLIC (decl)
+ && !TREE_READONLY (decl))
return m_mgr->get_or_create_unknown_svalue (reg->get_type ());
/* If we are on a path from the entrypoint from "main" and we have a
global decl defined in this TU that hasn't been touched yet, then
the initial value of REG can be taken from the initialization value
of the decl. */
- if (called_from_main_p () && !DECL_EXTERNAL (decl))
+ if ((called_from_main_p () && !DECL_EXTERNAL (decl))
+ || TREE_READONLY (decl))
{
- /* Get the initializer value for base_reg. */
- const svalue *base_reg_init
- = base_reg->get_svalue_for_initializer (m_mgr);
- gcc_assert (base_reg_init);
- if (reg == base_reg)
- return base_reg_init;
- else
+ /* Attempt to get the initializer value for base_reg. */
+ if (const svalue *base_reg_init
+ = base_reg->get_svalue_for_initializer (m_mgr))
{
- /* Get the value for REG within base_reg_init. */
- binding_cluster c (base_reg);
- c.bind (m_mgr->get_store_manager (), base_reg, base_reg_init,
- BK_direct);
- const svalue *sval
- = c.get_any_binding (m_mgr->get_store_manager (), reg);
- if (sval)
+ if (reg == base_reg)
+ return base_reg_init;
+ else
{
- if (reg->get_type ())
- sval = m_mgr->get_or_create_cast (reg->get_type (),
- sval);
- return sval;
+ /* Get the value for REG within base_reg_init. */
+ binding_cluster c (base_reg);
+ c.bind (m_mgr->get_store_manager (), base_reg, base_reg_init,
+ BK_direct);
+ const svalue *sval
+ = c.get_any_binding (m_mgr->get_store_manager (), reg);
+ if (sval)
+ {
+ if (reg->get_type ())
+ sval = m_mgr->get_or_create_cast (reg->get_type (),
+ sval);
+ return sval;
+ }
}
}
}
@@ -1529,16 +1536,131 @@ region_model::deref_rvalue (const svalue *ptr_sval, tree ptr_tree,
return m_mgr->get_symbolic_region (ptr_sval);
}
+/* A subclass of pending_diagnostic for complaining about writes to
+ constant regions of memory. */
+
+class write_to_const_diagnostic
+: public pending_diagnostic_subclass<write_to_const_diagnostic>
+{
+public:
+ write_to_const_diagnostic (const region *reg, tree decl)
+ : m_reg (reg), m_decl (decl)
+ {}
+
+ const char *get_kind () const FINAL OVERRIDE
+ {
+ return "write_to_const_diagnostic";
+ }
+
+ bool operator== (const write_to_const_diagnostic &other) const
+ {
+ return (m_reg == other.m_reg
+ && m_decl == other.m_decl);
+ }
+
+ bool emit (rich_location *rich_loc) FINAL OVERRIDE
+ {
+ bool warned = warning_at (rich_loc, OPT_Wanalyzer_write_to_const,
+ "write to %<const%> object %qE", m_decl);
+ if (warned)
+ inform (DECL_SOURCE_LOCATION (m_decl), "declared here");
+ return warned;
+ }
+
+ label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
+ {
+ return ev.formatted_print ("write to %<const%> object %qE here", m_decl);
+ }
+
+private:
+ const region *m_reg;
+ tree m_decl;
+};
+
+/* A subclass of pending_diagnostic for complaining about writes to
+ string literals. */
+
+class write_to_string_literal_diagnostic
+: public pending_diagnostic_subclass<write_to_string_literal_diagnostic>
+{
+public:
+ write_to_string_literal_diagnostic (const region *reg)
+ : m_reg (reg)
+ {}
+
+ const char *get_kind () const FINAL OVERRIDE
+ {
+ return "write_to_string_literal_diagnostic";
+ }
+
+ bool operator== (const write_to_string_literal_diagnostic &other) const
+ {
+ return m_reg == other.m_reg;
+ }
+
+ bool emit (rich_location *rich_loc) FINAL OVERRIDE
+ {
+ return warning_at (rich_loc, OPT_Wanalyzer_write_to_string_literal,
+ "write to string literal");
+ /* Ideally we would show the location of the STRING_CST as well,
+ but it is not available at this point. */
+ }
+
+ label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
+ {
+ return ev.formatted_print ("write to string literal here");
+ }
+
+private:
+ const region *m_reg;
+};
+
+/* Use CTXT to warn If DEST_REG is a region that shouldn't be written to. */
+
+void
+region_model::check_for_writable_region (const region* dest_reg,
+ region_model_context *ctxt) const
+{
+ /* Fail gracefully if CTXT is NULL. */
+ if (!ctxt)
+ return;
+
+ const region *base_reg = dest_reg->get_base_region ();
+ switch (base_reg->get_kind ())
+ {
+ default:
+ break;
+ case RK_DECL:
+ {
+ const decl_region *decl_reg = as_a <const decl_region *> (base_reg);
+ tree decl = decl_reg->get_decl ();
+ /* Warn about writes to const globals.
+ Don't warn for writes to const locals, and params in particular,
+ since we would warn in push_frame when setting them up (e.g the
+ "this" param is "T* const"). */
+ if (TREE_READONLY (decl)
+ && is_global_var (decl))
+ ctxt->warn (new write_to_const_diagnostic (dest_reg, decl));
+ }
+ break;
+ case RK_STRING:
+ ctxt->warn (new write_to_string_literal_diagnostic (dest_reg));
+ break;
+ }
+}
+
/* Set the value of the region given by LHS_REG to the value given
by RHS_SVAL. */
void
region_model::set_value (const region *lhs_reg, const svalue *rhs_sval,
- region_model_context */*ctxt*/)
+ region_model_context *ctxt)
{
gcc_assert (lhs_reg);
gcc_assert (rhs_sval);
+ check_for_writable_region (lhs_reg, ctxt);
+
m_store.set_value (m_mgr->get_store_manager(), lhs_reg, rhs_sval,
BK_direct);
}
@@ -1807,6 +1929,20 @@ region_model::add_constraint (tree lhs, enum tree_code op, tree rhs,
return true;
}
+/* As above, but when returning false, if OUT is non-NULL, write a
+ new rejected_constraint to *OUT. */
+
+bool
+region_model::add_constraint (tree lhs, enum tree_code op, tree rhs,
+ region_model_context *ctxt,
+ rejected_constraint **out)
+{
+ bool sat = add_constraint (lhs, op, rhs, ctxt);
+ if (!sat && out)
+ *out = new rejected_constraint (*this, lhs, op, rhs);
+ return sat;
+}
+
/* Subroutine of region_model::add_constraint for handling optimized
&& and || conditionals.
@@ -2123,11 +2259,14 @@ region_model::get_representative_path_var (const region *reg,
path_var offset_pv
= get_representative_path_var (offset_reg->get_byte_offset (),
visited);
- if (!offset_pv)
+ if (!offset_pv || TREE_CODE (offset_pv.m_tree) != INTEGER_CST)
return path_var (NULL_TREE, 0);
+ tree addr_parent = build1 (ADDR_EXPR,
+ build_pointer_type (reg->get_type ()),
+ parent_pv.m_tree);
return path_var (build2 (MEM_REF,
reg->get_type (),
- parent_pv.m_tree, offset_pv.m_tree),
+ addr_parent, offset_pv.m_tree),
parent_pv.m_stack_depth);
}
@@ -2185,6 +2324,8 @@ region_model::update_for_phis (const supernode *snode,
/* Attempt to update this model for taking EDGE (where the last statement
was LAST_STMT), returning true if the edge can be taken, false
otherwise.
+ When returning false, if OUT is non-NULL, write a new rejected_constraint
+ to it.
For CFG superedges where LAST_STMT is a conditional or a switch
statement, attempt to add the relevant conditions for EDGE to this
@@ -2204,7 +2345,8 @@ region_model::update_for_phis (const supernode *snode,
bool
region_model::maybe_update_for_edge (const superedge &edge,
const gimple *last_stmt,
- region_model_context *ctxt)
+ region_model_context *ctxt,
+ rejected_constraint **out)
{
/* Handle frame updates for interprocedural edges. */
switch (edge.m_kind)
@@ -2244,20 +2386,21 @@ region_model::maybe_update_for_edge (const superedge &edge,
if (const gcond *cond_stmt = dyn_cast <const gcond *> (last_stmt))
{
const cfg_superedge *cfg_sedge = as_a <const cfg_superedge *> (&edge);
- return apply_constraints_for_gcond (*cfg_sedge, cond_stmt, ctxt);
+ return apply_constraints_for_gcond (*cfg_sedge, cond_stmt, ctxt, out);
}
if (const gswitch *switch_stmt = dyn_cast <const gswitch *> (last_stmt))
{
const switch_cfg_superedge *switch_sedge
= as_a <const switch_cfg_superedge *> (&edge);
- return apply_constraints_for_gswitch (*switch_sedge, switch_stmt, ctxt);
+ return apply_constraints_for_gswitch (*switch_sedge, switch_stmt,
+ ctxt, out);
}
/* Apply any constraints due to an exception being thrown. */
if (const cfg_superedge *cfg_sedge = dyn_cast <const cfg_superedge *> (&edge))
if (cfg_sedge->get_flags () & EDGE_EH)
- return apply_constraints_for_exception (last_stmt, ctxt);
+ return apply_constraints_for_exception (last_stmt, ctxt, out);
return true;
}
@@ -2335,12 +2478,15 @@ region_model::update_for_call_summary (const callgraph_superedge &cg_sedge,
If they are feasible, add the constraints and return true.
Return false if the constraints contradict existing knowledge
- (and so the edge should not be taken). */
+ (and so the edge should not be taken).
+ When returning false, if OUT is non-NULL, write a new rejected_constraint
+ to it. */
bool
region_model::apply_constraints_for_gcond (const cfg_superedge &sedge,
const gcond *cond_stmt,
- region_model_context *ctxt)
+ region_model_context *ctxt,
+ rejected_constraint **out)
{
::edge cfg_edge = sedge.get_cfg_edge ();
gcc_assert (cfg_edge != NULL);
@@ -2351,7 +2497,7 @@ region_model::apply_constraints_for_gcond (const cfg_superedge &sedge,
tree rhs = gimple_cond_rhs (cond_stmt);
if (cfg_edge->flags & EDGE_FALSE_VALUE)
op = invert_tree_comparison (op, false /* honor_nans */);
- return add_constraint (lhs, op, rhs, ctxt);
+ return add_constraint (lhs, op, rhs, ctxt, out);
}
/* Given an EDGE guarded by SWITCH_STMT, determine appropriate constraints
@@ -2360,12 +2506,15 @@ region_model::apply_constraints_for_gcond (const cfg_superedge &sedge,
If they are feasible, add the constraints and return true.
Return false if the constraints contradict existing knowledge
- (and so the edge should not be taken). */
+ (and so the edge should not be taken).
+ When returning false, if OUT is non-NULL, write a new rejected_constraint
+ to it. */
bool
region_model::apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
const gswitch *switch_stmt,
- region_model_context *ctxt)
+ region_model_context *ctxt,
+ rejected_constraint **out)
{
tree index = gimple_switch_index (switch_stmt);
tree case_label = edge.get_case_label ();
@@ -2377,13 +2526,13 @@ region_model::apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
if (upper_bound)
{
/* Range. */
- if (!add_constraint (index, GE_EXPR, lower_bound, ctxt))
+ if (!add_constraint (index, GE_EXPR, lower_bound, ctxt, out))
return false;
- return add_constraint (index, LE_EXPR, upper_bound, ctxt);
+ return add_constraint (index, LE_EXPR, upper_bound, ctxt, out);
}
else
/* Single-value. */
- return add_constraint (index, EQ_EXPR, lower_bound, ctxt);
+ return add_constraint (index, EQ_EXPR, lower_bound, ctxt, out);
}
else
{
@@ -2403,14 +2552,16 @@ region_model::apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
/* Exclude this range-valued case.
For now, we just exclude the boundary values.
TODO: exclude the values within the region. */
- if (!add_constraint (index, NE_EXPR, other_lower_bound, ctxt))
+ if (!add_constraint (index, NE_EXPR, other_lower_bound,
+ ctxt, out))
return false;
- if (!add_constraint (index, NE_EXPR, other_upper_bound, ctxt))
+ if (!add_constraint (index, NE_EXPR, other_upper_bound,
+ ctxt, out))
return false;
}
else
/* Exclude this single-valued case. */
- if (!add_constraint (index, NE_EXPR, other_lower_bound, ctxt))
+ if (!add_constraint (index, NE_EXPR, other_lower_bound, ctxt, out))
return false;
}
return true;
@@ -2422,11 +2573,14 @@ region_model::apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
If they are feasible, add the constraints and return true.
Return false if the constraints contradict existing knowledge
- (and so the edge should not be taken). */
+ (and so the edge should not be taken).
+ When returning false, if OUT is non-NULL, write a new rejected_constraint
+ to it. */
bool
region_model::apply_constraints_for_exception (const gimple *last_stmt,
- region_model_context *ctxt)
+ region_model_context *ctxt,
+ rejected_constraint **out)
{
gcc_assert (last_stmt);
if (const gcall *call = dyn_cast <const gcall *> (last_stmt))
@@ -2439,7 +2593,7 @@ region_model::apply_constraints_for_exception (const gimple *last_stmt,
leak report due to the result being lost when following
the EH edge. */
if (tree lhs = gimple_call_lhs (call))
- return add_constraint (lhs, EQ_EXPR, null_pointer_node, ctxt);
+ return add_constraint (lhs, EQ_EXPR, null_pointer_node, ctxt, out);
return true;
}
return true;
@@ -2859,6 +3013,19 @@ debug (const region_model &rmodel)
rmodel.dump (false);
}
+/* struct rejected_constraint. */
+
+void
+rejected_constraint::dump_to_pp (pretty_printer *pp) const
+{
+ region_model m (m_model);
+ const svalue *lhs_sval = m.get_rvalue (m_lhs, NULL);
+ const svalue *rhs_sval = m.get_rvalue (m_rhs, NULL);
+ lhs_sval->dump_to_pp (pp, true);
+ pp_printf (pp, " %s ", op_symbol_code (m_op));
+ rhs_sval->dump_to_pp (pp, true);
+}
+
/* class engine. */
/* Dump the managed objects by class to LOGGER, and the per-class totals. */
diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h
index 1bb9798..5ad4a49 100644
--- a/gcc/analyzer/region-model.h
+++ b/gcc/analyzer/region-model.h
@@ -256,6 +256,8 @@ public:
void dump (bool simple=true) const;
label_text get_desc (bool simple=true) const;
+ json::value *to_json () const;
+
virtual const region_svalue *
dyn_cast_region_svalue () const { return NULL; }
virtual const constant_svalue *
@@ -804,7 +806,10 @@ public:
}
enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_BINOP; }
- virtual const binop_svalue *dyn_cast_binop_svalue () const { return this; }
+ const binop_svalue *dyn_cast_binop_svalue () const FINAL OVERRIDE
+ {
+ return this;
+ }
void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
void accept (visitor *v) const FINAL OVERRIDE;
@@ -1065,7 +1070,10 @@ public:
}
enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_WIDENING; }
- const widening_svalue *dyn_cast_widening_svalue () const { return this; }
+ const widening_svalue *dyn_cast_widening_svalue () const FINAL OVERRIDE
+ {
+ return this;
+ }
void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
void accept (visitor *v) const FINAL OVERRIDE;
@@ -1156,7 +1164,10 @@ public:
compound_svalue (tree type, const binding_map &map);
enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_COMPOUND; }
- const compound_svalue *dyn_cast_compound_svalue () const { return this; }
+ const compound_svalue *dyn_cast_compound_svalue () const FINAL OVERRIDE
+ {
+ return this;
+ }
void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
void accept (visitor *v) const FINAL OVERRIDE;
@@ -1261,7 +1272,10 @@ public:
}
enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONJURED; }
- const conjured_svalue *dyn_cast_conjured_svalue () const { return this; }
+ const conjured_svalue *dyn_cast_conjured_svalue () const FINAL OVERRIDE
+ {
+ return this;
+ }
void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
void accept (visitor *v) const FINAL OVERRIDE;
@@ -1400,6 +1414,8 @@ public:
virtual void dump_to_pp (pretty_printer *pp, bool simple) const = 0;
void dump (bool simple) const;
+ json::value *to_json () const;
+
bool non_null_p () const;
static int cmp_ptrs (const void *, const void *);
@@ -2482,6 +2498,7 @@ public:
bool maybe_set_lhs (const svalue *result) const;
tree get_arg_tree (unsigned idx) const;
+ tree get_arg_type (unsigned idx) const;
const svalue *get_arg_svalue (unsigned idx) const;
void dump_to_pp (pretty_printer *pp, bool simple) const;
@@ -2581,7 +2598,8 @@ class region_model
bool maybe_update_for_edge (const superedge &edge,
const gimple *last_stmt,
- region_model_context *ctxt);
+ region_model_context *ctxt,
+ rejected_constraint **out);
const region *push_frame (function *fun, const vec<const svalue *> *arg_sids,
region_model_context *ctxt);
@@ -2625,6 +2643,9 @@ class region_model
region_model_context *ctxt);
bool add_constraint (tree lhs, enum tree_code op, tree rhs,
region_model_context *ctxt);
+ bool add_constraint (tree lhs, enum tree_code op, tree rhs,
+ region_model_context *ctxt,
+ rejected_constraint **out);
const region *create_region_for_heap_alloc (const svalue *size_in_bytes);
const region *create_region_for_alloca (const svalue *size_in_bytes);
@@ -2694,12 +2715,15 @@ class region_model
region_model_context *ctxt);
bool apply_constraints_for_gcond (const cfg_superedge &edge,
const gcond *cond_stmt,
- region_model_context *ctxt);
+ region_model_context *ctxt,
+ rejected_constraint **out);
bool apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
const gswitch *switch_stmt,
- region_model_context *ctxt);
+ region_model_context *ctxt,
+ rejected_constraint **out);
bool apply_constraints_for_exception (const gimple *last_stmt,
- region_model_context *ctxt);
+ region_model_context *ctxt,
+ rejected_constraint **out);
int poison_any_pointers_to_descendents (const region *reg,
enum poison_kind pkind);
@@ -2712,6 +2736,9 @@ class region_model
bool called_from_main_p () const;
const svalue *get_initial_value_for_global (const region *reg) const;
+ void check_for_writable_region (const region* dest_reg,
+ region_model_context *ctxt) const;
+
/* Storing this here to avoid passing it around everywhere. */
region_model_manager *const m_mgr;
@@ -2768,6 +2795,9 @@ class region_model_context
know how to handle the tree code of T at LOC. */
virtual void on_unexpected_tree_code (tree t,
const dump_location_t &loc) = 0;
+
+ /* Hook for clients to be notified when a function_decl escapes. */
+ virtual void on_escaped_function (tree fndecl) = 0;
};
/* A "do nothing" subclass of region_model_context. */
@@ -2794,6 +2824,8 @@ public:
{
}
void on_unexpected_tree_code (tree, const dump_location_t &) OVERRIDE {}
+
+ void on_escaped_function (tree) OVERRIDE {}
};
/* A subclass of region_model_context for determining if operations fail
@@ -2846,6 +2878,24 @@ struct model_merger
region_model *m_merged_model;
};
+/* A record that can (optionally) be written out when
+ region_model::add_constraint fails. */
+
+struct rejected_constraint
+{
+ rejected_constraint (const region_model &model,
+ tree lhs, enum tree_code op, tree rhs)
+ : m_model (model), m_lhs (lhs), m_op (op), m_rhs (rhs)
+ {}
+
+ void dump_to_pp (pretty_printer *pp) const;
+
+ region_model m_model;
+ tree m_lhs;
+ enum tree_code m_op;
+ tree m_rhs;
+};
+
/* A bundle of state. */
class engine
diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc
index 53f32dc..adf0e2c 100644
--- a/gcc/analyzer/region.cc
+++ b/gcc/analyzer/region.cc
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "selftest.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "ordered-hash-map.h"
@@ -460,6 +461,17 @@ region::dump (bool simple) const
pp_flush (&pp);
}
+/* Return a new json::string describing the region. */
+
+json::value *
+region::to_json () const
+{
+ label_text desc = get_desc (true);
+ json::value *reg_js = new json::string (desc.m_buffer);
+ desc.maybe_free ();
+ return reg_js;
+}
+
/* Generate a description of this region. */
DEBUG_FUNCTION label_text
@@ -915,7 +927,9 @@ decl_region::get_svalue_for_constructor (tree ctor,
Get an svalue for the initial value of this region at entry to
"main" (either based on DECL_INITIAL, or implicit initialization to
- zero. */
+ zero.
+
+ Return NULL if there is a problem. */
const svalue *
decl_region::get_svalue_for_initializer (region_model_manager *mgr) const
@@ -923,12 +937,20 @@ decl_region::get_svalue_for_initializer (region_model_manager *mgr) const
tree init = DECL_INITIAL (m_decl);
if (!init)
{
- /* Implicit initialization to zero; use a compound_svalue for it. */
+ /* Implicit initialization to zero; use a compound_svalue for it.
+ Doing so requires that we have a concrete binding for this region,
+ which can fail if we have a region with unknown size
+ (e.g. "extern const char arr[];"). */
+ const binding_key *binding
+ = binding_key::make (mgr->get_store_manager (), this, BK_direct);
+ if (binding->symbolic_p ())
+ return NULL;
+
binding_cluster c (this);
c.zero_fill_region (mgr->get_store_manager (), this);
return mgr->get_or_create_compound_svalue (TREE_TYPE (m_decl),
c.get_map ());
- }
+ }
if (TREE_CODE (init) == CONSTRUCTOR)
return get_svalue_for_constructor (init, mgr);
diff --git a/gcc/analyzer/sm-file.cc b/gcc/analyzer/sm-file.cc
index 58a0fd4..d201071 100644
--- a/gcc/analyzer/sm-file.cc
+++ b/gcc/analyzer/sm-file.cc
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-path.h"
#include "diagnostic-metadata.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index 90d1da1..fd12a35 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-path.h"
#include "diagnostic-metadata.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
@@ -183,7 +184,9 @@ public:
if (const region_svalue *ptr = sval->dyn_cast_region_svalue ())
{
const region *reg = ptr->get_pointee ();
- if (reg->get_kind () == RK_STRING)
+ const region *base_reg = reg->get_base_region ();
+ if (base_reg->get_kind () == RK_DECL
+ || base_reg->get_kind () == RK_STRING)
return m_non_heap;
}
return m_start;
@@ -559,15 +562,40 @@ public:
};
+/* Return true if FNDECL is a C++ method. */
+
+static bool
+method_p (tree fndecl)
+{
+ return TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE;
+}
+
+/* Return a 1-based description of ARG_IDX (0-based) of FNDECL.
+ Compare with %P in the C++ FE (implemented in cp/error.c: parm_to_string
+ as called from cp_printer). */
+
+static label_text
+describe_argument_index (tree fndecl, int arg_idx)
+{
+ if (method_p (fndecl))
+ if (arg_idx == 0)
+ return label_text::borrow ("'this'");
+ pretty_printer pp;
+ pp_printf (&pp, "%u", arg_idx + 1 - method_p (fndecl));
+ return label_text::take (xstrdup (pp_formatted_text (&pp)));
+}
+
/* Subroutine for use by possible_null_arg::emit and null_arg::emit.
Issue a note informing that the pertinent argument must be non-NULL. */
static void
inform_nonnull_attribute (tree fndecl, int arg_idx)
{
+ label_text arg_desc = describe_argument_index (fndecl, arg_idx);
inform (DECL_SOURCE_LOCATION (fndecl),
- "argument %u of %qD must be non-null",
- arg_idx + 1, fndecl);
+ "argument %s of %qD must be non-null",
+ arg_desc.m_buffer, fndecl);
+ arg_desc.maybe_free ();
/* Ideally we would use the location of the parm and underline the
attribute also - but we don't have the location_t values at this point
in the middle-end.
@@ -615,15 +643,19 @@ public:
label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
{
+ label_text arg_desc = describe_argument_index (m_fndecl, m_arg_idx);
+ label_text result;
if (m_origin_of_unchecked_event.known_p ())
- return ev.formatted_print ("argument %u (%qE) from %@ could be NULL"
- " where non-null expected",
- m_arg_idx + 1, ev.m_expr,
- &m_origin_of_unchecked_event);
+ result = ev.formatted_print ("argument %s (%qE) from %@ could be NULL"
+ " where non-null expected",
+ arg_desc.m_buffer, ev.m_expr,
+ &m_origin_of_unchecked_event);
else
- return ev.formatted_print ("argument %u (%qE) could be NULL"
- " where non-null expected",
- m_arg_idx + 1, ev.m_expr);
+ result = ev.formatted_print ("argument %s (%qE) could be NULL"
+ " where non-null expected",
+ arg_desc.m_buffer, ev.m_expr);
+ arg_desc.maybe_free ();
+ return result;
}
private:
@@ -711,13 +743,17 @@ public:
label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
{
+ label_text arg_desc = describe_argument_index (m_fndecl, m_arg_idx);
+ label_text result;
if (zerop (ev.m_expr))
- return ev.formatted_print ("argument %u NULL where non-null expected",
- m_arg_idx + 1);
+ result = ev.formatted_print ("argument %s NULL where non-null expected",
+ arg_desc.m_buffer);
else
- return ev.formatted_print ("argument %u (%qE) NULL"
- " where non-null expected",
- m_arg_idx + 1, ev.m_expr);
+ result = ev.formatted_print ("argument %s (%qE) NULL"
+ " where non-null expected",
+ arg_desc.m_buffer, ev.m_expr);
+ arg_desc.maybe_free ();
+ return result;
}
private:
diff --git a/gcc/analyzer/sm-pattern-test.cc b/gcc/analyzer/sm-pattern-test.cc
index bb6d3b1..c430476 100644
--- a/gcc/analyzer/sm-pattern-test.cc
+++ b/gcc/analyzer/sm-pattern-test.cc
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-path.h"
#include "diagnostic-metadata.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
diff --git a/gcc/analyzer/sm-sensitive.cc b/gcc/analyzer/sm-sensitive.cc
index 49f9eb3..aec0a6a 100644
--- a/gcc/analyzer/sm-sensitive.cc
+++ b/gcc/analyzer/sm-sensitive.cc
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-path.h"
#include "diagnostic-metadata.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
diff --git a/gcc/analyzer/sm-signal.cc b/gcc/analyzer/sm-signal.cc
index bf6ea48..2e05de8 100644
--- a/gcc/analyzer/sm-signal.cc
+++ b/gcc/analyzer/sm-signal.cc
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-path.h"
#include "diagnostic-metadata.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
@@ -220,6 +221,12 @@ public:
pp_string (pp, "signal delivered");
}
+ json::object *to_json () const
+ {
+ json::object *custom_obj = new json::object ();
+ return custom_obj;
+ }
+
void update_model (region_model *model,
const exploded_edge &eedge) FINAL OVERRIDE
{
diff --git a/gcc/analyzer/sm-taint.cc b/gcc/analyzer/sm-taint.cc
index 49bbd6d..37491d8 100644
--- a/gcc/analyzer/sm-taint.cc
+++ b/gcc/analyzer/sm-taint.cc
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-path.h"
#include "diagnostic-metadata.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "diagnostic-event-id.h"
#include "analyzer/analyzer-logging.h"
diff --git a/gcc/analyzer/sm.cc b/gcc/analyzer/sm.cc
index a333063..3fe75ef 100644
--- a/gcc/analyzer/sm.cc
+++ b/gcc/analyzer/sm.cc
@@ -29,6 +29,9 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "diagnostic-core.h"
#include "pretty-print.h"
+#include "diagnostic.h"
+#include "tree-diagnostic.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "analyzer/sm.h"
@@ -56,6 +59,17 @@ state_machine::state::dump_to_pp (pretty_printer *pp) const
pp_string (pp, m_name);
}
+/* Return a new json::string describing the state. */
+
+json::value *
+state_machine::state::to_json () const
+{
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ dump_to_pp (&pp);
+ return new json::string (pp_formatted_text (&pp));
+}
+
/* class state_machine. */
/* state_machine's ctor. */
@@ -109,6 +123,28 @@ state_machine::dump_to_pp (pretty_printer *pp) const
}
}
+/* Return a new json::object of the form
+ {"name" : str,
+ "states" : [str]}. */
+
+json::object *
+state_machine::to_json () const
+{
+ json::object *sm_obj = new json::object ();
+
+ sm_obj->set ("name", new json::string (m_name));
+ {
+ json::array *states_arr = new json::array ();
+ unsigned i;
+ state *s;
+ FOR_EACH_VEC_ELT (m_states, i, s)
+ states_arr->append (s->to_json ());
+ sm_obj->set ("states", states_arr);
+ }
+
+ return sm_obj;
+}
+
/* Create instances of the various state machines, each using LOGGER,
and populate OUT with them. */
diff --git a/gcc/analyzer/sm.h b/gcc/analyzer/sm.h
index f44ad92..46b93ff 100644
--- a/gcc/analyzer/sm.h
+++ b/gcc/analyzer/sm.h
@@ -48,6 +48,7 @@ public:
const char *get_name () const { return m_name; }
virtual void dump_to_pp (pretty_printer *pp) const;
+ virtual json::value *to_json () const;
unsigned get_id () const { return m_id; }
@@ -121,6 +122,8 @@ public:
void dump_to_pp (pretty_printer *pp) const;
+ json::object *to_json () const;
+
state_t get_start_state () const { return m_start; }
protected:
diff --git a/gcc/analyzer/state-purge.cc b/gcc/analyzer/state-purge.cc
index d5a24b4..e4942a6 100644
--- a/gcc/analyzer/state-purge.cc
+++ b/gcc/analyzer/state-purge.cc
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "gimple-pretty-print.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/call-string.h"
#include "digraph.h"
diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc
index 1348895..7e91add 100644
--- a/gcc/analyzer/store.cc
+++ b/gcc/analyzer/store.cc
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "selftest.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "ordered-hash-map.h"
@@ -122,6 +123,17 @@ binding_key::dump (bool simple) const
pp_flush (&pp);
}
+/* Get a description of this binding_key. */
+
+label_text
+binding_key::get_desc (bool simple) const
+{
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ dump_to_pp (&pp, simple);
+ return label_text::take (xstrdup (pp_formatted_text (&pp)));
+}
+
/* qsort callback. */
int
@@ -366,6 +378,37 @@ binding_map::dump (bool simple) const
pp_flush (&pp);
}
+/* Return a new json::object of the form
+ {KEY_DESC : SVALUE_DESC,
+ ...for the various key/value pairs in this binding_map}. */
+
+json::object *
+binding_map::to_json () const
+{
+ json::object *map_obj = new json::object ();
+
+ auto_vec <const binding_key *> binding_keys;
+ for (map_t::iterator iter = m_map.begin ();
+ iter != m_map.end (); ++iter)
+ {
+ const binding_key *key = (*iter).first;
+ binding_keys.safe_push (key);
+ }
+ binding_keys.qsort (binding_key::cmp_ptrs);
+
+ const binding_key *key;
+ unsigned i;
+ FOR_EACH_VEC_ELT (binding_keys, i, key)
+ {
+ const svalue *value = *const_cast <map_t &> (m_map).get (key);
+ label_text key_desc = key->get_desc ();
+ map_obj->set (key_desc.m_buffer, value->to_json ());
+ key_desc.maybe_free ();
+ }
+
+ return map_obj;
+}
+
/* Get the child region of PARENT_REG based upon INDEX within a
CONSTRUCTOR. */
@@ -412,7 +455,6 @@ binding_map::apply_ctor_to_region (const region *parent_reg, tree ctor,
{
gcc_assert (parent_reg);
gcc_assert (TREE_CODE (ctor) == CONSTRUCTOR);
- gcc_assert (!CONSTRUCTOR_NO_CLEARING (ctor));
unsigned ix;
tree index;
@@ -657,6 +699,23 @@ binding_cluster::dump (bool simple) const
pp_flush (&pp);
}
+/* Return a new json::object of the form
+ {"escaped": true/false,
+ "touched": true/false,
+ "map" : object for the the binding_map. */
+
+json::object *
+binding_cluster::to_json () const
+{
+ json::object *cluster_obj = new json::object ();
+
+ cluster_obj->set ("escaped", new json::literal (m_escaped));
+ cluster_obj->set ("touched", new json::literal (m_touched));
+ cluster_obj->set ("map", m_map.to_json ());
+
+ return cluster_obj;
+}
+
/* Add a binding of SVAL of kind KIND to REG, unpacking SVAL if it is a
compound_sval. */
@@ -1575,6 +1634,64 @@ store::dump (bool simple) const
pp_flush (&pp);
}
+/* Return a new json::object of the form
+ {PARENT_REGION_DESC: {BASE_REGION_DESC: object for binding_map,
+ ... for each cluster within parent region},
+ ...for each parent region,
+ "called_unknown_function": true/false}. */
+
+json::object *
+store::to_json () const
+{
+ json::object *store_obj = new json::object ();
+
+ /* Sort into some deterministic order. */
+ auto_vec<const region *> base_regions;
+ for (cluster_map_t::iterator iter = m_cluster_map.begin ();
+ iter != m_cluster_map.end (); ++iter)
+ {
+ const region *base_reg = (*iter).first;
+ base_regions.safe_push (base_reg);
+ }
+ base_regions.qsort (region::cmp_ptrs);
+
+ /* Gather clusters, organize by parent region, so that we can group
+ together locals, globals, etc. */
+ auto_vec<const region *> parent_regions;
+ get_sorted_parent_regions (&parent_regions, base_regions);
+
+ const region *parent_reg;
+ unsigned i;
+ FOR_EACH_VEC_ELT (parent_regions, i, parent_reg)
+ {
+ gcc_assert (parent_reg);
+
+ json::object *clusters_in_parent_reg_obj = new json::object ();
+
+ const region *base_reg;
+ unsigned j;
+ FOR_EACH_VEC_ELT (base_regions, j, base_reg)
+ {
+ /* This is O(N * M), but N ought to be small. */
+ if (base_reg->get_parent_region () != parent_reg)
+ continue;
+ binding_cluster *cluster
+ = *const_cast<cluster_map_t &> (m_cluster_map).get (base_reg);
+ label_text base_reg_desc = base_reg->get_desc ();
+ clusters_in_parent_reg_obj->set (base_reg_desc.m_buffer,
+ cluster->to_json ());
+ base_reg_desc.maybe_free ();
+ }
+ label_text parent_reg_desc = parent_reg->get_desc ();
+ store_obj->set (parent_reg_desc.m_buffer, clusters_in_parent_reg_obj);
+ parent_reg_desc.maybe_free ();
+ }
+
+ store_obj->set ("called_unknown_fn", new json::literal (m_called_unknown_fn));
+
+ return store_obj;
+}
+
/* Get any svalue bound to REG, or NULL. */
const svalue *
diff --git a/gcc/analyzer/store.h b/gcc/analyzer/store.h
index 83a4310..0f4e7ab 100644
--- a/gcc/analyzer/store.h
+++ b/gcc/analyzer/store.h
@@ -159,6 +159,7 @@ public:
virtual void dump_to_pp (pretty_printer *pp, bool simple) const;
void dump (bool simple) const;
+ label_text get_desc (bool simple=true) const;
static int cmp_ptrs (const void *, const void *);
static int cmp (const binding_key *, const binding_key *);
@@ -340,6 +341,8 @@ public:
void dump_to_pp (pretty_printer *pp, bool simple, bool multiline) const;
void dump (bool simple) const;
+ json::object *to_json () const;
+
bool apply_ctor_to_region (const region *parent_reg, tree ctor,
region_model_manager *mgr);
@@ -392,6 +395,8 @@ public:
void dump_to_pp (pretty_printer *pp, bool simple, bool multiline) const;
void dump (bool simple) const;
+ json::object *to_json () const;
+
void bind (store_manager *mgr, const region *, const svalue *,
binding_kind kind);
@@ -517,6 +522,8 @@ public:
void dump (bool simple) const;
void summarize_to_pp (pretty_printer *pp, bool simple) const;
+ json::object *to_json () const;
+
const svalue *get_direct_binding (store_manager *mgr, const region *reg);
const svalue *get_default_binding (store_manager *mgr, const region *reg);
const svalue *get_any_binding (store_manager *mgr, const region *reg) const;
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index 7c6fed3..735c4a3 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-dfa.h"
#include "cfganal.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "ordered-hash-map.h"
#include "options.h"
@@ -374,6 +375,38 @@ supergraph::dump_dot (const char *path, const dump_args_t &dump_args) const
fclose (fp);
}
+/* Return a new json::object of the form
+ {"nodes" : [objs for snodes],
+ "edges" : [objs for sedges]}. */
+
+json::object *
+supergraph::to_json () const
+{
+ json::object *sgraph_obj = new json::object ();
+
+ /* Nodes. */
+ {
+ json::array *nodes_arr = new json::array ();
+ unsigned i;
+ supernode *n;
+ FOR_EACH_VEC_ELT (m_nodes, i, n)
+ nodes_arr->append (n->to_json ());
+ sgraph_obj->set ("nodes", nodes_arr);
+ }
+
+ /* Edges. */
+ {
+ json::array *edges_arr = new json::array ();
+ unsigned i;
+ superedge *n;
+ FOR_EACH_VEC_ELT (m_edges, i, n)
+ edges_arr->append (n->to_json ());
+ sgraph_obj->set ("edges", edges_arr);
+ }
+
+ return sgraph_obj;
+}
+
/* Create a supernode for BB within FUN and add it to this supergraph.
If RETURNING_CALL is non-NULL, the supernode represents the resumption
@@ -594,6 +627,63 @@ supernode::dump_dot_id (pretty_printer *pp) const
pp_printf (pp, "node_%i", m_index);
}
+/* Return a new json::object of the form
+ {"idx": int,
+ "bb_idx": int,
+ "m_returning_call": optional str,
+ "phis": [str],
+ "stmts" : [str]}. */
+
+json::object *
+supernode::to_json () const
+{
+ json::object *snode_obj = new json::object ();
+
+ snode_obj->set ("idx", new json::integer_number (m_index));
+ snode_obj->set ("bb_idx", new json::integer_number (m_bb->index));
+
+ if (m_returning_call)
+ {
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ pp_gimple_stmt_1 (&pp, m_returning_call, 0, (dump_flags_t)0);
+ snode_obj->set ("returning_call",
+ new json::string (pp_formatted_text (&pp)));
+ }
+
+ /* Phi nodes. */
+ {
+ json::array *phi_arr = new json::array ();
+ for (gphi_iterator gpi = const_cast<supernode *> (this)->start_phis ();
+ !gsi_end_p (gpi); gsi_next (&gpi))
+ {
+ const gimple *stmt = gsi_stmt (gpi);
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ pp_gimple_stmt_1 (&pp, stmt, 0, (dump_flags_t)0);
+ phi_arr->append (new json::string (pp_formatted_text (&pp)));
+ }
+ snode_obj->set ("phis", phi_arr);
+ }
+
+ /* Statements. */
+ {
+ json::array *stmt_arr = new json::array ();
+ int i;
+ gimple *stmt;
+ FOR_EACH_VEC_ELT (m_stmts, i, stmt)
+ {
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ pp_gimple_stmt_1 (&pp, stmt, 0, (dump_flags_t)0);
+ stmt_arr->append (new json::string (pp_formatted_text (&pp)));
+ }
+ snode_obj->set ("stmts", stmt_arr);
+ }
+
+ return snode_obj;
+}
+
/* Get a location_t for the start of this supernode. */
location_t
@@ -759,6 +849,28 @@ superedge::dump_dot (graphviz_out *gv, const dump_args_t &) const
pp_printf (pp, "\"];\n");
}
+/* Return a new json::object of the form
+ {"src_idx": int, the index of the source supernode,
+ "dst_idx": int, the index of the destination supernode,
+ "desc" : str. */
+
+json::object *
+superedge::to_json () const
+{
+ json::object *sedge_obj = new json::object ();
+ sedge_obj->set ("src_idx", new json::integer_number (m_src->m_index));
+ sedge_obj->set ("dst_idx", new json::integer_number (m_dest->m_index));
+
+ {
+ pretty_printer pp;
+ pp_format_decoder (&pp) = default_tree_printer;
+ dump_label_to_pp (&pp, false);
+ sedge_obj->set ("desc", new json::string (pp_formatted_text (&pp)));
+ }
+
+ return sedge_obj;
+}
+
/* If this is an intraprocedural superedge, return the associated
CFG edge. Otherwise, return NULL. */
diff --git a/gcc/analyzer/supergraph.h b/gcc/analyzer/supergraph.h
index c25043d..40ae9ff 100644
--- a/gcc/analyzer/supergraph.h
+++ b/gcc/analyzer/supergraph.h
@@ -148,6 +148,8 @@ public:
void dump_dot_to_file (FILE *fp, const dump_args_t &) const;
void dump_dot (const char *path, const dump_args_t &) const;
+ json::object *to_json () const;
+
int num_nodes () const { return m_nodes.length (); }
int num_edges () const { return m_edges.length (); }
@@ -231,6 +233,8 @@ class supernode : public dnode<supergraph_traits>
void dump_dot (graphviz_out *gv, const dump_args_t &args) const OVERRIDE;
void dump_dot_id (pretty_printer *pp) const;
+ json::object *to_json () const;
+
location_t get_start_location () const;
location_t get_end_location () const;
@@ -289,6 +293,8 @@ class superedge : public dedge<supergraph_traits>
virtual void dump_label_to_pp (pretty_printer *pp,
bool user_facing) const = 0;
+ json::object *to_json () const;
+
enum edge_kind get_kind () const { return m_kind; }
virtual cfg_superedge *dyn_cast_cfg_superedge () { return NULL; }
diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc
index fcab578..ae3b678 100644
--- a/gcc/analyzer/svalue.cc
+++ b/gcc/analyzer/svalue.cc
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "bitmap.h"
#include "selftest.h"
#include "function.h"
+#include "json.h"
#include "analyzer/analyzer.h"
#include "analyzer/analyzer-logging.h"
#include "options.h"
@@ -116,6 +117,17 @@ svalue::get_desc (bool simple) const
return label_text::take (xstrdup (pp_formatted_text (&pp)));
}
+/* Return a new json::string describing the svalue. */
+
+json::value *
+svalue::to_json () const
+{
+ label_text desc = get_desc (true);
+ json::value *sval_js = new json::string (desc.m_buffer);
+ desc.maybe_free ();
+ return sval_js;
+}
+
/* If this svalue is a constant_svalue, return the underlying tree constant.
Otherwise return NULL_TREE. */
diff --git a/gcc/attr-fnspec.h b/gcc/attr-fnspec.h
new file mode 100644
index 0000000..d38b84a
--- /dev/null
+++ b/gcc/attr-fnspec.h
@@ -0,0 +1,154 @@
+/* Handling of fnspec attribute specifiers
+ Copyright (C) 2008-2020 Free Software Foundation, Inc.
+ Contributed by Richard Guenther <rguenther@suse.de>
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ 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.
+
+ 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/>. */
+
+/* Parse string of attribute "fn spec". This is an internal attribute
+ describing side effects of a function as follows:
+
+ character 0 specifies properties of return values as follows:
+ '1'...'4' specifies number of argument function returns (as in memset)
+ 'm' specifies that returned value is noalias (as in malloc)
+ '.' specifies that nothing is known.
+ character 1 specifies additional function properties
+ ' ' specifies that nothing is known
+
+ character 2+2i specifies properties of argument number i as follows:
+ 'x' or 'X' specifies that parameter is unused.
+ 'r' or 'R' specifies that the memory pointed to by the parameter is only
+ read and does not escape
+ 'w' or 'W' specifies that the memory pointed to by the parameter does not
+ escape
+ '.' specifies that nothing is known.
+ The uppercase letter in addition specifies that the memory pointed to
+ by the parameter is not dereferenced. For 'r' only read applies
+ transitively to pointers read from the pointed-to memory.
+
+ character 3+2i specifies additional properties of argument number i
+ as follows:
+ ' ' nothing is known
+ */
+
+#ifndef ATTR_FNSPEC_H
+#define ATTR_FNSPEC_H
+
+class attr_fnspec
+{
+private:
+ /* fn spec attribute string. */
+ const char *str;
+ /* length of the fn spec string. */
+ const unsigned len;
+ /* Number of characters specifying return value. */
+ const unsigned int return_desc_size = 2;
+ /* Number of characters specifying size. */
+ const unsigned int arg_desc_size = 2;
+
+ /* Return start of specifier of arg i. */
+ unsigned int arg_idx (int i)
+ {
+ return return_desc_size + arg_desc_size * i;
+ }
+
+public:
+ attr_fnspec (const char *str, unsigned len)
+ : str (str), len (len)
+ {
+ if (flag_checking)
+ verify ();
+ }
+ attr_fnspec (const_tree identifier)
+ : str (TREE_STRING_POINTER (identifier)),
+ len (TREE_STRING_LENGTH (identifier))
+ {
+ if (flag_checking)
+ verify ();
+ }
+
+ /* Return true if arg I is specified. */
+ bool
+ arg_specified_p (unsigned int i)
+ {
+ return len >= arg_idx (i + 1);
+ }
+
+ /* True if the argument is not dereferenced recursively, thus only
+ directly reachable memory is read or written. */
+ bool
+ arg_direct_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx] == 'R' || str[idx] == 'W';
+ }
+
+ /* True if argument is used. */
+ bool
+ arg_used_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx] != 'x' && str[idx] != 'X';
+ }
+
+ /* True if memory reached by the argument is readonly (not clobbered). */
+ bool
+ arg_readonly_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx] == 'r' || str[idx] == 'R';
+ }
+
+ /* True if the argument does not escape. */
+ bool
+ arg_noescape_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx] == 'w' || str[idx] == 'W'
+ || str[idx] == 'R' || str[idx] == 'r';
+ }
+
+ /* Return true if function returns value of its parameter. If ARG_NO is
+ non-NULL return initialize it to the argument returned. */
+ bool
+ returns_arg (unsigned int *arg_no)
+ {
+ if (str[0] >= '1' && str[0] <= '4')
+ {
+ if (arg_no)
+ *arg_no = str[0] - '1';
+ return true;
+ }
+ return false;
+ }
+
+ /* Nonzero if the return value does not alias with anything. Functions
+ with the malloc attribute have this set on their return value. */
+ bool
+ returns_noalias_p ()
+ {
+ return str[0] == 'm';
+ }
+
+ /* Check validity of the string. */
+ void verify ();
+};
+
+#endif /* ATTR_FNSPEC_H */
diff --git a/gcc/attribs.c b/gcc/attribs.c
index abc7536..a6f6b70 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -2049,6 +2049,8 @@ init_attr_rdwr_indices (rdwr_map *rwm, tree attrs)
/* The (optional) list of VLA bounds. */
tree vblist = TREE_CHAIN (mode);
+ if (vblist)
+ vblist = TREE_VALUE (vblist);
mode = TREE_VALUE (mode);
if (TREE_CODE (mode) != STRING_CST)
@@ -2107,6 +2109,7 @@ init_attr_rdwr_indices (rdwr_map *rwm, tree attrs)
is followed by a comma and a dollar sign its bound is
on the list. Otherwise it's a VLA with an unspecified
bound. */
+ acc.static_p = p[-2] == 's';
acc.minsize = HOST_WIDE_INT_M1U;
}
@@ -2256,50 +2259,45 @@ attr_access::array_as_string (tree type) const
if (this->str)
{
- /* For array parameters (but not pointers) create an array type
- that corresponds to the form of the parameter including its
+ /* For array parameters (but not pointers) create a temporary array
+ type that corresponds to the form of the parameter including its
qualifiers even though they apply to the pointer, not the array
type. */
const bool vla_p = minsize == HOST_WIDE_INT_M1U;
tree eltype = TREE_TYPE (type);
- tree artype;
-
tree index_type = NULL_TREE;
+
if (minsize == HOST_WIDE_INT_M1U)
{
/* Determine if this is a VLA (an array whose most significant
bound is nonconstant and whose access string has "$]" in it)
extract the bound expression from SIZE. */
const char *p = end;
- for ( ; *p-- != ']'; );
+ for ( ; p != str && *p-- != ']'; );
if (*p == '$')
index_type = build_index_type (TREE_VALUE (size));
}
- else if (minsize)
+ else if (minsize)
index_type = build_index_type (size_int (minsize - 1));
- artype = build_array_type (eltype, index_type);
-
+ tree arat = NULL_TREE;
if (static_p || vla_p)
{
tree flag = static_p ? integer_one_node : NULL_TREE;
/* Hack: there's no language-independent way to encode
the "static" specifier or the "*" notation in an array type.
- Temporarily add an attribute to have the pretty printer add
- "static" or "*", and remove it later. The static notation
- is only valid in the most significant bound but [*] can be
- used for any bound. Because [*] is represented the same as
- [0] this hack only works for the most significant bound like
- static and the others are rendered as [0]. */
- tree at = tree_cons (get_identifier ("array"), flag, NULL_TREE);
- TYPE_ATTRIBUTES (artype) = at;
+ Add a "fake" attribute to have the pretty-printer add "static"
+ or "*". The "[static N]" notation is only valid in the most
+ significant bound but [*] can be used for any bound. Because
+ [*] is represented the same as [0] this hack only works for
+ the most significant bound like static and the others are
+ rendered as [0]. */
+ arat = build_tree_list (get_identifier ("array"), flag);
}
- TYPE_ATOMIC (artype) = TYPE_ATOMIC (type);
- TYPE_READONLY (artype) = TYPE_READONLY (type);
- TYPE_RESTRICT (artype) = TYPE_RESTRICT (type);
- TYPE_VOLATILE (artype) = TYPE_VOLATILE (type);
- type = artype;
+ const int quals = TYPE_QUALS (type);
+ type = build_array_type (eltype, index_type);
+ type = build_type_attribute_qual_variant (type, arat, quals);
}
/* Format the type using the current pretty printer. The generic tree
@@ -2309,10 +2307,6 @@ attr_access::array_as_string (tree type) const
typstr = pp_formatted_text (pp);
delete pp;
- if (this->str)
- /* Remove the attribute that wasn't installed by decl_attributes. */
- TYPE_ATTRIBUTES (type) = NULL_TREE;
-
return typstr;
}
diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def
index 3239311..778bc8a 100644
--- a/gcc/builtin-attrs.def
+++ b/gcc/builtin-attrs.def
@@ -66,7 +66,7 @@ DEF_ATTR_FOR_INT (6)
DEF_ATTR_STRING (ATTR_##ENUM, VALUE) \
DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL, \
ATTR_##ENUM, ATTR_NULL)
-DEF_ATTR_FOR_STRING (STR1, "1")
+DEF_ATTR_FOR_STRING (STR1, "1 ")
#undef DEF_ATTR_FOR_STRING
/* Construct a tree for a list of two integers. */
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 45efc1c..72627b5 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -183,7 +183,6 @@ static void maybe_emit_chk_warning (tree, enum built_in_function);
static void maybe_emit_sprintf_chk_warning (tree, enum built_in_function);
static void maybe_emit_free_warning (tree);
static tree fold_builtin_object_size (tree, tree);
-static bool get_range (tree, signop, offset_int[2], const vr_values * = NULL);
static bool check_read_access (tree, tree, tree = NULL_TREE, int = 1);
unsigned HOST_WIDE_INT target_newline;
@@ -199,7 +198,7 @@ static void expand_builtin_sync_synchronize (void);
access_ref::access_ref (tree bound /* = NULL_TREE */,
bool minaccess /* = false */)
- : ref ()
+: ref (), eval ([](tree x){ return x; }), trail1special (true), base0 (true)
{
/* Set to valid. */
offrng[0] = offrng[1] = 0;
@@ -214,7 +213,7 @@ access_ref::access_ref (tree bound /* = NULL_TREE */,
set the bounds of the access to reflect both it and MINACCESS.
BNDRNG[0] is the size of the minimum access. */
tree rng[2];
- if (bound && get_size_range (bound, rng, true))
+ if (bound && get_size_range (bound, rng, SR_ALLOW_ZERO))
{
bndrng[0] = wi::to_offset (rng[0]);
bndrng[1] = wi::to_offset (rng[1]);
@@ -222,6 +221,131 @@ access_ref::access_ref (tree bound /* = NULL_TREE */,
}
}
+/* Return the maximum amount of space remaining and if non-null, set
+ argument to the minimum. */
+
+offset_int
+access_ref::size_remaining (offset_int *pmin /* = NULL */) const
+{
+ offset_int minbuf;
+ if (!pmin)
+ pmin = &minbuf;
+
+ /* add_offset() ensures the offset range isn't inverted. */
+ gcc_checking_assert (offrng[0] <= offrng[1]);
+
+ if (base0)
+ {
+ /* The offset into referenced object is zero-based (i.e., it's
+ not referenced by a pointer into middle of some unknown object). */
+ if (offrng[0] < 0 && offrng[1] < 0)
+ {
+ /* If the offset is negative the remaining size is zero. */
+ *pmin = 0;
+ return 0;
+ }
+
+ if (sizrng[1] <= offrng[0])
+ {
+ /* If the starting offset is greater than or equal to the upper
+ bound on the size of the object, the space remaining is zero.
+ As a special case, if it's equal, set *PMIN to -1 to let
+ the caller know the offset is valid and just past the end. */
+ *pmin = sizrng[1] == offrng[0] ? -1 : 0;
+ return 0;
+ }
+
+ /* Otherwise return the size minus the lower bound of the offset. */
+ offset_int or0 = offrng[0] < 0 ? 0 : offrng[0];
+
+ *pmin = sizrng[0] - or0;
+ return sizrng[1] - or0;
+ }
+
+ /* The offset to the referenced object isn't zero-based (i.e., it may
+ refer to a byte other than the first. The size of such an object
+ is constrained only by the size of the address space (the result
+ of max_object_size()). */
+ if (sizrng[1] <= offrng[0])
+ {
+ *pmin = 0;
+ return 0;
+ }
+
+ offset_int or0 = offrng[0] < 0 ? 0 : offrng[0];
+
+ *pmin = sizrng[0] - or0;
+ return sizrng[1] - or0;
+}
+
+/* Add the range [MIN, MAX] to the offset range. For known objects (with
+ zero-based offsets) at least one of whose offset's bounds is in range,
+ constrain the other (or both) to the bounds of the object (i.e., zero
+ and the upper bound of its size). This improves the quality of
+ diagnostics. */
+
+void access_ref::add_offset (const offset_int &min, const offset_int &max)
+{
+ if (min <= max)
+ {
+ /* To add an ordinary range just add it to the bounds. */
+ offrng[0] += min;
+ offrng[1] += max;
+ }
+ else if (!base0)
+ {
+ /* To add an inverted range to an offset to an unknown object
+ expand it to the maximum. */
+ add_max_offset ();
+ return;
+ }
+ else
+ {
+ /* To add an inverted range to an offset to an known object set
+ the upper bound to the maximum representable offset value
+ (which may be greater than MAX_OBJECT_SIZE).
+ The lower bound is either the sum of the current offset and
+ MIN when abs(MAX) is greater than the former, or zero otherwise.
+ Zero because then then inverted range includes the negative of
+ the lower bound. */
+ offset_int maxoff = wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node));
+ offrng[1] = maxoff;
+
+ if (max >= 0)
+ {
+ offrng[0] = 0;
+ return;
+ }
+
+ offrng[1] = maxoff;
+ offset_int absmax = wi::abs (max);
+ if (offrng[0] < absmax)
+ offrng[0] += min;
+ else
+ offrng[0] = 0;
+ }
+
+ if (!base0)
+ return;
+
+ /* When referencing a known object check to see if the offset computed
+ so far is in bounds... */
+ offset_int remrng[2];
+ remrng[1] = size_remaining (remrng);
+ if (remrng[1] > 0 || remrng[0] < 0)
+ {
+ /* ...if so, constrain it so that neither bound exceeds the size of
+ the object. Out of bounds offsets are left unchanged, and, for
+ better or worse, become in bounds later. They should be detected
+ and diagnosed at the point they first become invalid by
+ -Warray-bounds. */
+ if (offrng[0] < 0)
+ offrng[0] = 0;
+ if (offrng[1] > sizrng[1])
+ offrng[1] = sizrng[1];
+ }
+}
+
/* Return true if NAME starts with __builtin_ or __sync_. */
static bool
@@ -2159,95 +2283,98 @@ mathfn_built_in_2 (tree type, combined_fn fn)
switch (fn)
{
- 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 (CEIL)
- CASE_MATHFN (CEXPI)
- CASE_MATHFN_FLOATN (COPYSIGN)
- CASE_MATHFN (COS)
- CASE_MATHFN (COSH)
- CASE_MATHFN (DREM)
- CASE_MATHFN (ERF)
- CASE_MATHFN (ERFC)
- CASE_MATHFN (EXP)
- CASE_MATHFN (EXP10)
- CASE_MATHFN (EXP2)
- CASE_MATHFN (EXPM1)
- CASE_MATHFN (FABS)
- CASE_MATHFN (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 (GAMMA)
- CASE_MATHFN_REENT (GAMMA) /* GAMMA_R */
- CASE_MATHFN (HUGE_VAL)
- CASE_MATHFN (HYPOT)
- CASE_MATHFN (ILOGB)
- CASE_MATHFN (ICEIL)
- CASE_MATHFN (IFLOOR)
- CASE_MATHFN (INF)
- CASE_MATHFN (IRINT)
- CASE_MATHFN (IROUND)
- CASE_MATHFN (ISINF)
- CASE_MATHFN (J0)
- CASE_MATHFN (J1)
- CASE_MATHFN (JN)
- CASE_MATHFN (LCEIL)
- CASE_MATHFN (LDEXP)
- CASE_MATHFN (LFLOOR)
- CASE_MATHFN (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 (NEARBYINT)
- CASE_MATHFN (NEXTAFTER)
- CASE_MATHFN (NEXTTOWARD)
- CASE_MATHFN (POW)
- CASE_MATHFN (POWI)
- CASE_MATHFN (POW10)
- CASE_MATHFN (REMAINDER)
- CASE_MATHFN (REMQUO)
- CASE_MATHFN_FLOATN (RINT)
- CASE_MATHFN_FLOATN (ROUND)
- CASE_MATHFN_FLOATN (ROUNDEVEN)
- CASE_MATHFN (SCALB)
- CASE_MATHFN (SCALBLN)
- CASE_MATHFN (SCALBN)
- CASE_MATHFN (SIGNBIT)
- CASE_MATHFN (SIGNIFICAND)
- CASE_MATHFN (SIN)
- CASE_MATHFN (SINCOS)
- CASE_MATHFN (SINH)
- CASE_MATHFN_FLOATN (SQRT)
- CASE_MATHFN (TAN)
- CASE_MATHFN (TANH)
- CASE_MATHFN (TGAMMA)
- CASE_MATHFN_FLOATN (TRUNC)
- CASE_MATHFN (Y0)
- CASE_MATHFN (Y1)
+#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 (CEIL) \
+ CASE_MATHFN (CEXPI) \
+ CASE_MATHFN_FLOATN (COPYSIGN) \
+ CASE_MATHFN (COS) \
+ CASE_MATHFN (COSH) \
+ CASE_MATHFN (DREM) \
+ CASE_MATHFN (ERF) \
+ CASE_MATHFN (ERFC) \
+ CASE_MATHFN (EXP) \
+ CASE_MATHFN (EXP10) \
+ CASE_MATHFN (EXP2) \
+ CASE_MATHFN (EXPM1) \
+ CASE_MATHFN (FABS) \
+ CASE_MATHFN (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 (GAMMA) \
+ CASE_MATHFN_REENT (GAMMA) /* GAMMA_R */ \
+ CASE_MATHFN (HUGE_VAL) \
+ CASE_MATHFN (HYPOT) \
+ CASE_MATHFN (ILOGB) \
+ CASE_MATHFN (ICEIL) \
+ CASE_MATHFN (IFLOOR) \
+ CASE_MATHFN (INF) \
+ CASE_MATHFN (IRINT) \
+ CASE_MATHFN (IROUND) \
+ CASE_MATHFN (ISINF) \
+ CASE_MATHFN (J0) \
+ CASE_MATHFN (J1) \
+ CASE_MATHFN (JN) \
+ CASE_MATHFN (LCEIL) \
+ CASE_MATHFN (LDEXP) \
+ CASE_MATHFN (LFLOOR) \
+ CASE_MATHFN (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 (NEARBYINT) \
+ CASE_MATHFN (NEXTAFTER) \
+ CASE_MATHFN (NEXTTOWARD) \
+ CASE_MATHFN (POW) \
+ CASE_MATHFN (POWI) \
+ CASE_MATHFN (POW10) \
+ CASE_MATHFN (REMAINDER) \
+ CASE_MATHFN (REMQUO) \
+ CASE_MATHFN_FLOATN (RINT) \
+ CASE_MATHFN_FLOATN (ROUND) \
+ CASE_MATHFN_FLOATN (ROUNDEVEN) \
+ CASE_MATHFN (SCALB) \
+ CASE_MATHFN (SCALBLN) \
+ CASE_MATHFN (SCALBN) \
+ CASE_MATHFN (SIGNBIT) \
+ CASE_MATHFN (SIGNIFICAND) \
+ CASE_MATHFN (SIN) \
+ CASE_MATHFN (SINCOS) \
+ CASE_MATHFN (SINH) \
+ CASE_MATHFN_FLOATN (SQRT) \
+ CASE_MATHFN (TAN) \
+ CASE_MATHFN (TANH) \
+ CASE_MATHFN (TGAMMA) \
+ CASE_MATHFN_FLOATN (TRUNC) \
+ CASE_MATHFN (Y0) \
+ CASE_MATHFN (Y1) \
CASE_MATHFN (YN)
+ SEQ_OF_CASE_MATHFN
+
default:
return END_BUILTINS;
}
@@ -2277,6 +2404,10 @@ mathfn_built_in_2 (tree type, combined_fn fn)
return END_BUILTINS;
}
+#undef CASE_MATHFN
+#undef CASE_MATHFN_FLOATN
+#undef CASE_MATHFN_REENT
+
/* Return mathematic function equivalent to FN but operating directly on TYPE,
if available. If IMPLICIT_P is true use the implicit builtin declaration,
otherwise use the explicit declaration. If we can't do the conversion,
@@ -2312,6 +2443,61 @@ mathfn_built_in (tree type, enum built_in_function fn)
return mathfn_built_in_1 (type, as_combined_fn (fn), /*implicit=*/ 1);
}
+/* Return the type associated with a built in function, i.e., the one
+ to be passed to mathfn_built_in to get the type-specific
+ function. */
+
+tree
+mathfn_built_in_type (combined_fn fn)
+{
+#define CASE_MATHFN(MATHFN) \
+ case CFN_BUILT_IN_##MATHFN: \
+ return double_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F: \
+ return float_type_node; \
+ case CFN_BUILT_IN_##MATHFN##L: \
+ return long_double_type_node;
+
+#define CASE_MATHFN_FLOATN(MATHFN) \
+ CASE_MATHFN(MATHFN) \
+ case CFN_BUILT_IN_##MATHFN##F16: \
+ return float16_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F32: \
+ return float32_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F64: \
+ return float64_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F128: \
+ return float128_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F32X: \
+ return float32x_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F64X: \
+ return float64x_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F128X: \
+ return float128x_type_node;
+
+/* Similar to above, but appends _R after any F/L suffix. */
+#define CASE_MATHFN_REENT(MATHFN) \
+ case CFN_BUILT_IN_##MATHFN##_R: \
+ return double_type_node; \
+ case CFN_BUILT_IN_##MATHFN##F_R: \
+ return float_type_node; \
+ case CFN_BUILT_IN_##MATHFN##L_R: \
+ return long_double_type_node;
+
+ switch (fn)
+ {
+ SEQ_OF_CASE_MATHFN
+
+ default:
+ return NULL_TREE;
+ }
+
+#undef CASE_MATHFN
+#undef CASE_MATHFN_FLOATN
+#undef CASE_MATHFN_REENT
+#undef SEQ_OF_CASE_MATHFN
+}
+
/* If BUILT_IN_NORMAL function FNDECL has an associated internal function,
return its code, otherwise return IFN_LAST. Note that this function
only tests whether the function is defined in internals.def, not whether
@@ -2733,7 +2919,7 @@ expand_builtin_cexpi (tree exp, rtx target)
/* Compute into op1 and op2. */
expand_twoval_unop (sincos_optab, op0, op2, op1, 0);
}
- else if (targetm.libc_has_function (function_sincos))
+ else if (targetm.libc_has_function (function_sincos, type))
{
tree call, fn = NULL_TREE;
tree top1, top2;
@@ -3480,8 +3666,14 @@ maybe_warn_for_bound (int opt, location_t loc, tree exp, tree func,
if (warned)
{
if (pad && pad->dst.ref)
- inform (DECL_SOURCE_LOCATION (pad->dst.ref),
- "destination object declared here");
+ {
+ if (DECL_P (pad->dst.ref))
+ inform (DECL_SOURCE_LOCATION (pad->dst.ref),
+ "destination object declared here");
+ else if (EXPR_HAS_LOCATION (pad->dst.ref))
+ inform (EXPR_LOCATION (pad->dst.ref),
+ "destination object allocated here");
+ }
TREE_NO_WARNING (exp) = true;
}
@@ -3688,15 +3880,24 @@ inform_access (const access_ref &ref, access_mode mode)
if (!ref.ref)
return;
- /* Convert offset range and avoid including a zero range since it isn't
- necessarily meaningful. */
- long long minoff = 0, maxoff = 0;
- if (wi::fits_shwi_p (ref.offrng[0])
- && wi::fits_shwi_p (ref.offrng[1]))
- {
- minoff = ref.offrng[0].to_shwi ();
- maxoff = ref.offrng[1].to_shwi ();
- }
+ /* Convert offset range and avoid including a zero range since it
+ isn't necessarily meaningful. */
+ HOST_WIDE_INT diff_min = tree_to_shwi (TYPE_MIN_VALUE (ptrdiff_type_node));
+ HOST_WIDE_INT diff_max = tree_to_shwi (TYPE_MAX_VALUE (ptrdiff_type_node));
+ HOST_WIDE_INT minoff;
+ HOST_WIDE_INT maxoff = diff_max;
+ if (wi::fits_shwi_p (ref.offrng[0]))
+ minoff = ref.offrng[0].to_shwi ();
+ else
+ minoff = ref.offrng[0] < 0 ? diff_min : diff_max;
+
+ if (wi::fits_shwi_p (ref.offrng[1]))
+ maxoff = ref.offrng[1].to_shwi ();
+
+ if (maxoff <= diff_min || maxoff >= diff_max)
+ /* Avoid mentioning an upper bound that's equal to or in excess
+ of the maximum of ptrdiff_t. */
+ maxoff = minoff;
/* Convert size range and always include it since all sizes are
meaningful. */
@@ -3730,23 +3931,27 @@ inform_access (const access_ref &ref, access_mode mode)
sprintf (sizestr, "[%llu, %llu]", minsize, maxsize);
}
- else
+ else if (DECL_P (ref.ref))
loc = DECL_SOURCE_LOCATION (ref.ref);
+ else if (EXPR_P (ref.ref) && EXPR_HAS_LOCATION (ref.ref))
+ loc = EXPR_LOCATION (ref.ref);
+ else
+ return;
if (mode == access_read_write || mode == access_write_only)
{
- if (DECL_P (ref.ref))
+ if (allocfn == NULL_TREE)
{
if (minoff == maxoff)
{
if (minoff == 0)
- inform (loc, "destination object %qD", ref.ref);
+ inform (loc, "destination object %qE", ref.ref);
else
- inform (loc, "at offset %lli into destination object %qD",
+ inform (loc, "at offset %wi into destination object %qE",
minoff, ref.ref);
}
else
- inform (loc, "at offset [%lli, %lli] into destination object %qD",
+ inform (loc, "at offset [%wi, %wi] into destination object %qE",
minoff, maxoff, ref.ref);
return;
}
@@ -3758,12 +3963,12 @@ inform_access (const access_ref &ref, access_mode mode)
sizestr, allocfn);
else
inform (loc,
- "at offset %lli into destination object of size %s "
+ "at offset %wi into destination object of size %s "
"allocated by %qE", minoff, sizestr, allocfn);
}
else
inform (loc,
- "at offset [%lli, %lli] into destination object of size %s "
+ "at offset [%wi, %wi] into destination object of size %s "
"allocated by %qE",
minoff, maxoff, sizestr, allocfn);
@@ -3777,11 +3982,11 @@ inform_access (const access_ref &ref, access_mode mode)
if (minoff == 0)
inform (loc, "source object %qD", ref.ref);
else
- inform (loc, "at offset %lli into source object %qD",
+ inform (loc, "at offset %wi into source object %qD",
minoff, ref.ref);
}
else
- inform (loc, "at offset [%lli, %lli] into source object %qD",
+ inform (loc, "at offset [%wi, %wi] into source object %qD",
minoff, maxoff, ref.ref);
return;
}
@@ -3793,12 +3998,12 @@ inform_access (const access_ref &ref, access_mode mode)
sizestr, allocfn);
else
inform (loc,
- "at offset %lli into source object of size %s "
+ "at offset %wi into source object of size %s "
"allocated by %qE", minoff, sizestr, allocfn);
}
else
inform (loc,
- "at offset [%lli, %lli] into source object of size %s "
+ "at offset [%wi, %wi] into source object of size %s "
"allocated by %qE",
minoff, maxoff, sizestr, allocfn);
}
@@ -4083,8 +4288,14 @@ check_access (tree exp, tree dstwrite,
&& range[0]
&& TREE_CODE (slen) == INTEGER_CST
&& tree_int_cst_lt (slen, range[0]));
-
- if (!overread && pad && pad->src.sizrng[1] >= 0 && pad->src.offrng[0] >= 0)
+ /* If none is determined try to get a better answer based on the details
+ in PAD. */
+ if (!overread
+ && pad
+ && pad->src.sizrng[1] >= 0
+ && pad->src.offrng[0] >= 0
+ && (pad->src.offrng[1] < 0
+ || pad->src.offrng[0] <= pad->src.offrng[1]))
{
/* Set RANGE to that of MAXREAD, bounded by PAD->SRC.BNDRNG if
PAD is nonnull and BNDRNG is valid. */
@@ -4146,7 +4357,7 @@ check_read_access (tree exp, tree src, tree bound /* = NULL_TREE */,
tree
gimple_call_alloc_size (gimple *stmt, wide_int rng1[2] /* = NULL */,
- const vr_values *rvals /* = NULL */)
+ range_query * /* = NULL */)
{
if (!stmt)
return NULL_TREE;
@@ -4198,14 +4409,17 @@ gimple_call_alloc_size (gimple *stmt, wide_int rng1[2] /* = NULL */,
if (!rng1)
rng1 = rng1_buf;
+ /* Use maximum precision to avoid overflow below. */
const int prec = ADDR_MAX_PRECISION;
- const tree size_max = TYPE_MAX_VALUE (sizetype);
- if (!get_range (size, rng1, rvals))
- {
- /* Use the full non-negative range on failure. */
- rng1[0] = wi::zero (prec);
- rng1[1] = wi::to_wide (size_max, prec);
- }
+
+ {
+ tree r[2];
+ /* Determine the largest valid range size, including zero. */
+ if (!get_size_range (size, r, SR_ALLOW_ZERO | SR_USE_LARGEST))
+ return NULL_TREE;
+ rng1[0] = wi::to_wide (r[0], prec);
+ rng1[1] = wi::to_wide (r[1], prec);
+ }
if (argidx2 > nargs && TREE_CODE (size) == INTEGER_CST)
return fold_convert (sizetype, size);
@@ -4214,26 +4428,24 @@ gimple_call_alloc_size (gimple *stmt, wide_int rng1[2] /* = NULL */,
of the upper bounds as a constant. Ignore anti-ranges. */
tree n = argidx2 < nargs ? gimple_call_arg (stmt, argidx2) : integer_one_node;
wide_int rng2[2];
- if (!get_range (n, rng2, rvals))
- {
+ {
+ tree r[2];
/* As above, use the full non-negative range on failure. */
- rng2[0] = wi::zero (prec);
- rng2[1] = wi::to_wide (size_max, prec);
- }
-
- /* Extend to the maximum precision to avoid overflow. */
- rng1[0] = wide_int::from (rng1[0], prec, UNSIGNED);
- rng1[1] = wide_int::from (rng1[1], prec, UNSIGNED);
- rng2[0] = wide_int::from (rng2[0], prec, UNSIGNED);
- rng2[1] = wide_int::from (rng2[1], prec, UNSIGNED);
+ if (!get_size_range (n, r, SR_ALLOW_ZERO | SR_USE_LARGEST))
+ return NULL_TREE;
+ rng2[0] = wi::to_wide (r[0], prec);
+ rng2[1] = wi::to_wide (r[1], prec);
+ }
/* Compute products of both bounds for the caller but return the lesser
of SIZE_MAX and the product of the upper bounds as a constant. */
rng1[0] = rng1[0] * rng2[0];
rng1[1] = rng1[1] * rng2[1];
+
+ const tree size_max = TYPE_MAX_VALUE (sizetype);
if (wi::gtu_p (rng1[1], wi::to_wide (size_max, prec)))
{
- rng1[1] = wi::to_wide (size_max);
+ rng1[1] = wi::to_wide (size_max, prec);
return size_max;
}
@@ -4247,7 +4459,7 @@ gimple_call_alloc_size (gimple *stmt, wide_int rng1[2] /* = NULL */,
tree
gimple_parm_array_size (tree ptr, wide_int rng[2],
- const vr_values * /* = NULL */)
+ range_query * /* = NULL */)
{
/* For a function argument try to determine the byte size of the array
from the current function declaratation (e.g., attribute access or
@@ -4281,12 +4493,9 @@ gimple_parm_array_size (tree ptr, wide_int rng[2],
rng[0] = wi::zero (prec);
rng[1] = wi::uhwi (access->minsize, prec);
- /* If the PTR argument points to an array multiply MINSIZE by the size
- of array element type. Otherwise, multiply it by the size of what
- the pointer points to. */
+ /* Multiply the array bound encoded in the attribute by the size
+ of what the pointer argument to which it decays points to. */
tree eltype = TREE_TYPE (TREE_TYPE (ptr));
- if (TREE_CODE (eltype) == ARRAY_TYPE)
- eltype = TREE_TYPE (eltype);
tree size = TYPE_SIZE_UNIT (eltype);
if (!size || TREE_CODE (size) != INTEGER_CST)
return NULL_TREE;
@@ -4295,22 +4504,140 @@ gimple_parm_array_size (tree ptr, wide_int rng[2],
return var;
}
-/* Wrapper around the wide_int overload of get_range. Returns the same
- result but accepts offset_int instead. */
+/* Wrapper around the wide_int overload of get_range that accepts
+ offset_int instead. For middle end expressions returns the same
+ result. For a subset of nonconstamt expressions emitted by the front
+ end determines a more precise range than would be possible otherwise. */
static bool
-get_range (tree x, signop sgn, offset_int r[2],
- const vr_values *rvals /* = NULL */)
+get_offset_range (tree x, gimple *stmt, offset_int r[2], range_query *rvals)
{
+ offset_int add = 0;
+ if (TREE_CODE (x) == PLUS_EXPR)
+ {
+ /* Handle constant offsets in pointer addition expressions seen
+ n the front end IL. */
+ tree op = TREE_OPERAND (x, 1);
+ if (TREE_CODE (op) == INTEGER_CST)
+ {
+ op = fold_convert (signed_type_for (TREE_TYPE (op)), op);
+ add = wi::to_offset (op);
+ x = TREE_OPERAND (x, 0);
+ }
+ }
+
+ if (TREE_CODE (x) == NOP_EXPR)
+ /* Also handle conversions to sizetype seen in the front end IL. */
+ x = TREE_OPERAND (x, 0);
+
+ tree type = TREE_TYPE (x);
+
+ if (TREE_CODE (x) != INTEGER_CST
+ && TREE_CODE (x) != SSA_NAME)
+ {
+ if (TYPE_UNSIGNED (type)
+ && TYPE_PRECISION (type) == TYPE_PRECISION (sizetype))
+ type = signed_type_for (type);
+
+ r[0] = wi::to_offset (TYPE_MIN_VALUE (type)) + add;
+ r[1] = wi::to_offset (TYPE_MAX_VALUE (type)) + add;
+ return x;
+ }
+
wide_int wr[2];
- if (!get_range (x, wr, rvals))
+ if (!get_range (x, stmt, wr, rvals))
return false;
+ signop sgn = SIGNED;
+ /* Only convert signed integers or unsigned sizetype to a signed
+ offset and avoid converting large positive values in narrower
+ types to negative offsets. */
+ if (TYPE_UNSIGNED (type)
+ && wr[0].get_precision () < TYPE_PRECISION (sizetype))
+ sgn = UNSIGNED;
+
r[0] = offset_int::from (wr[0], sgn);
r[1] = offset_int::from (wr[1], sgn);
return true;
}
+/* Return the argument that the call STMT to a built-in function returns
+ or null if it doesn't. On success, set OFFRNG[] to the range of offsets
+ from the argument reflected in the value returned by the built-in if it
+ can be determined, otherwise to 0 and HWI_M1U respectively. */
+
+static tree
+gimple_call_return_array (gimple *stmt, offset_int offrng[2],
+ range_query *rvals)
+{
+ if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)
+ || gimple_call_num_args (stmt) < 1)
+ return NULL_TREE;
+
+ tree fn = gimple_call_fndecl (stmt);
+ switch (DECL_FUNCTION_CODE (fn))
+ {
+ case BUILT_IN_MEMCPY:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMSET:
+ case BUILT_IN_STPCPY:
+ case BUILT_IN_STPCPY_CHK:
+ case BUILT_IN_STPNCPY:
+ case BUILT_IN_STPNCPY_CHK:
+ case BUILT_IN_STRCAT:
+ case BUILT_IN_STRCAT_CHK:
+ case BUILT_IN_STRCPY:
+ case BUILT_IN_STRCPY_CHK:
+ case BUILT_IN_STRNCAT:
+ case BUILT_IN_STRNCAT_CHK:
+ case BUILT_IN_STRNCPY:
+ case BUILT_IN_STRNCPY_CHK:
+ offrng[0] = offrng[1] = 0;
+ return gimple_call_arg (stmt, 0);
+
+ case BUILT_IN_MEMPCPY:
+ case BUILT_IN_MEMPCPY_CHK:
+ {
+ tree off = gimple_call_arg (stmt, 2);
+ if (!get_offset_range (off, stmt, offrng, rvals))
+ {
+ offrng[0] = 0;
+ offrng[1] = HOST_WIDE_INT_M1U;
+ }
+ return gimple_call_arg (stmt, 0);
+ }
+
+ case BUILT_IN_MEMCHR:
+ {
+ tree off = gimple_call_arg (stmt, 2);
+ if (get_offset_range (off, stmt, offrng, rvals))
+ offrng[0] = 0;
+ else
+ {
+ offrng[0] = 0;
+ offrng[1] = HOST_WIDE_INT_M1U;
+ }
+ return gimple_call_arg (stmt, 0);
+ }
+
+ case BUILT_IN_STRCHR:
+ case BUILT_IN_STRRCHR:
+ case BUILT_IN_STRSTR:
+ {
+ offrng[0] = 0;
+ offrng[1] = HOST_WIDE_INT_M1U;
+ }
+ return gimple_call_arg (stmt, 0);
+
+ default:
+ break;
+ }
+
+ return NULL_TREE;
+}
+
/* Helper to compute the size of the object referenced by the PTR
expression which must have pointer type, using Object Size type
OSTYPE (only the least significant 2 bits are used).
@@ -4320,81 +4647,112 @@ get_range (tree x, signop sgn, offset_int r[2],
the object(s).
VISITED is used to avoid visiting the same PHI operand multiple
times, and, when nonnull, RVALS to determine range information.
- Returns true on success, false when the size cannot be determined.
+ Returns true on success, false when a meaningful size (or range)
+ cannot be determined.
The function is intended for diagnostics and should not be used
to influence code generation or optimization. */
static bool
-compute_objsize (tree ptr, int ostype, access_ref *pref,
- bitmap *visited, const vr_values *rvals /* = NULL */)
+compute_objsize (tree ptr, int ostype, access_ref *pref, bitmap *visited,
+ range_query *rvals)
{
+ STRIP_NOPS (ptr);
+
const bool addr = TREE_CODE (ptr) == ADDR_EXPR;
if (addr)
ptr = TREE_OPERAND (ptr, 0);
if (DECL_P (ptr))
{
- /* Bail if the reference is to the pointer itself (as opposed
- to what it points to). */
+ pref->ref = ptr;
+
if (!addr && POINTER_TYPE_P (TREE_TYPE (ptr)))
- return false;
+ {
+ /* Set the maximum size if the reference is to the pointer
+ itself (as opposed to what it points to). */
+ pref->set_max_size_range ();
+ return true;
+ }
- tree size = decl_init_size (ptr, false);
- if (!size || TREE_CODE (size) != INTEGER_CST)
- return false;
+ if (tree size = decl_init_size (ptr, false))
+ if (TREE_CODE (size) == INTEGER_CST)
+ {
+ pref->sizrng[0] = pref->sizrng[1] = wi::to_offset (size);
+ return true;
+ }
- pref->ref = ptr;
- pref->sizrng[0] = pref->sizrng[1] = wi::to_offset (size);
+ pref->set_max_size_range ();
return true;
}
const tree_code code = TREE_CODE (ptr);
+ if (code == BIT_FIELD_REF)
+ {
+ tree ref = TREE_OPERAND (ptr, 0);
+ if (!compute_objsize (ref, ostype, pref, visited, rvals))
+ return false;
+
+ offset_int off = wi::to_offset (pref->eval (TREE_OPERAND (ptr, 2)));
+ pref->add_offset (off / BITS_PER_UNIT);
+ return true;
+ }
+
if (code == COMPONENT_REF)
{
+ tree ref = TREE_OPERAND (ptr, 0);
tree field = TREE_OPERAND (ptr, 1);
if (ostype == 0)
{
- /* For raw memory functions like memcpy bail if the size
- of the enclosing object cannot be determined. */
- tree ref = TREE_OPERAND (ptr, 0);
- if (!compute_objsize (ref, ostype, pref, visited, rvals)
- || !pref->ref)
+ /* In OSTYPE zero (for raw memory functions like memcpy), use
+ the maximum size instead if the identity of the enclosing
+ object cannot be determined. */
+ if (!compute_objsize (ref, ostype, pref, visited, rvals))
return false;
/* Otherwise, use the size of the enclosing object and add
the offset of the member to the offset computed so far. */
tree offset = byte_position (field);
- if (TREE_CODE (offset) != INTEGER_CST)
- return false;
- offset_int off = wi::to_offset (offset);
- pref->offrng[0] += off;
- pref->offrng[1] += off;
+ if (TREE_CODE (offset) == INTEGER_CST)
+ pref->add_offset (wi::to_offset (offset));
+ else
+ pref->add_max_offset ();
return true;
}
- /* Bail if the reference is to the pointer itself (as opposed
- to what it points to). */
if (!addr && POINTER_TYPE_P (TREE_TYPE (field)))
- return false;
-
- pref->ref = field;
- /* Only return constant sizes for now while callers depend
- on it. INT0LEN is true for interior zero-length arrays. */
- bool int0len = false;
- tree size = component_ref_size (ptr, &int0len);
- if (int0len)
{
- pref->sizrng[0] = pref->sizrng[1] = 0;
+ /* Set maximum size if the reference is to the pointer member
+ itself (as opposed to what it points to). */
+ pref->set_max_size_range ();
return true;
}
- if (!size || TREE_CODE (size) != INTEGER_CST)
- return false;
+ pref->ref = field;
- pref->sizrng[0] = pref->sizrng[1] = wi::to_offset (size);
+ /* SAM is set for array members that might need special treatment. */
+ special_array_member sam;
+ tree size = component_ref_size (ptr, &sam);
+ if (sam == special_array_member::int_0)
+ pref->sizrng[0] = pref->sizrng[1] = 0;
+ else if (!pref->trail1special && sam == special_array_member::trail_1)
+ pref->sizrng[0] = pref->sizrng[1] = 1;
+ else if (size && TREE_CODE (size) == INTEGER_CST)
+ pref->sizrng[0] = pref->sizrng[1] = wi::to_offset (size);
+ else
+ {
+ /* When the size of the member is unknown it's either a flexible
+ array member or a trailing special array member (either zero
+ length or one-element). Set the size to the maximum minus
+ the constant size of the type. */
+ pref->sizrng[0] = 0;
+ pref->sizrng[1] = wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node));
+ if (tree recsize = TYPE_SIZE_UNIT (TREE_TYPE (ref)))
+ if (TREE_CODE (recsize) == INTEGER_CST)
+ pref->sizrng[1] -= wi::to_offset (recsize);
+ }
return true;
}
@@ -4424,10 +4782,13 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
return false;
offset_int orng[2];
- tree off = TREE_OPERAND (ptr, 1);
- if (!get_range (off, SIGNED, orng, rvals))
- /* Fail unless the size of the object is zero. */
- return pref->sizrng[0] == 0 && pref->sizrng[0] == pref->sizrng[1];
+ tree off = pref->eval (TREE_OPERAND (ptr, 1));
+ if (!get_offset_range (off, NULL, orng, rvals))
+ {
+ /* Set ORNG to the maximum offset representable in ptrdiff_t. */
+ orng[1] = wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node));
+ orng[0] = -orng[1] - 1;
+ }
if (TREE_CODE (ptr) == ARRAY_REF)
{
@@ -4446,7 +4807,10 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
tree eltype = TREE_TYPE (ptr);
tree tpsize = TYPE_SIZE_UNIT (eltype);
if (!tpsize || TREE_CODE (tpsize) != INTEGER_CST)
- return false;
+ {
+ pref->add_max_offset ();
+ return true;
+ }
offset_int sz = wi::to_offset (tpsize);
orng[0] *= sz;
@@ -4454,37 +4818,136 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
if (ostype && TREE_CODE (eltype) == ARRAY_TYPE)
{
- /* Execpt for the permissive raw memory functions which
- use the size of the whole object determined above,
- use the size of the referenced array. */
- pref->sizrng[0] = pref->offrng[0] + orng[0] + sz;
- pref->sizrng[1] = pref->offrng[1] + orng[1] + sz;
+ /* Except for the permissive raw memory functions which use
+ the size of the whole object determined above, use the size
+ of the referenced array. Because the overall offset is from
+ the beginning of the complete array object add this overall
+ offset to the size of array. */
+ offset_int sizrng[2] =
+ {
+ pref->offrng[0] + orng[0] + sz,
+ pref->offrng[1] + orng[1] + sz
+ };
+ if (sizrng[1] < sizrng[0])
+ std::swap (sizrng[0], sizrng[1]);
+ if (sizrng[0] >= 0 && sizrng[0] <= pref->sizrng[0])
+ pref->sizrng[0] = sizrng[0];
+ if (sizrng[1] >= 0 && sizrng[1] <= pref->sizrng[1])
+ pref->sizrng[1] = sizrng[1];
}
}
- pref->offrng[0] += orng[0];
- pref->offrng[1] += orng[1];
+ pref->add_offset (orng[0], orng[1]);
+ return true;
+ }
+ if (code == TARGET_MEM_REF)
+ {
+ tree ref = TREE_OPERAND (ptr, 0);
+ if (!compute_objsize (ref, ostype, pref, visited, rvals))
+ return false;
+
+ /* TODO: Handle remaining operands. Until then, add maximum offset. */
+ pref->ref = ptr;
+ pref->add_max_offset ();
return true;
}
+ if (code == INTEGER_CST)
+ {
+ /* Pointer constants other than null are most likely the result
+ of erroneous null pointer addition/subtraction. Set size to
+ zero. For null pointers, set size to the maximum for now
+ since those may be the result of jump threading. */
+ if (integer_zerop (ptr))
+ pref->set_max_size_range ();
+ else
+ pref->sizrng[0] = pref->sizrng[1] = 0;
+ pref->ref = ptr;
+
+ return true;
+ }
+
+ if (code == STRING_CST)
+ {
+ pref->sizrng[0] = pref->sizrng[1] = TREE_STRING_LENGTH (ptr);
+ return true;
+ }
+
+ if (code == POINTER_PLUS_EXPR)
+ {
+ tree ref = TREE_OPERAND (ptr, 0);
+ if (!compute_objsize (ref, ostype, pref, visited, rvals))
+ return false;
+
+ offset_int orng[2];
+ tree off = pref->eval (TREE_OPERAND (ptr, 1));
+ if (get_offset_range (off, NULL, orng, rvals))
+ pref->add_offset (orng[0], orng[1]);
+ else
+ pref->add_max_offset ();
+ return true;
+ }
+
+ if (code == VIEW_CONVERT_EXPR)
+ {
+ ptr = TREE_OPERAND (ptr, 0);
+ return compute_objsize (ptr, ostype, pref, visited, rvals);
+ }
+
if (TREE_CODE (ptr) == SSA_NAME)
{
gimple *stmt = SSA_NAME_DEF_STMT (ptr);
if (is_gimple_call (stmt))
{
/* If STMT is a call to an allocation function get the size
- from its argument(s). If successful, also set *PDECL to
- PTR for the caller to include in diagnostics. */
+ from its argument(s). If successful, also set *PREF->REF
+ to PTR for the caller to include in diagnostics. */
wide_int wr[2];
if (gimple_call_alloc_size (stmt, wr, rvals))
{
pref->ref = ptr;
pref->sizrng[0] = offset_int::from (wr[0], UNSIGNED);
pref->sizrng[1] = offset_int::from (wr[1], UNSIGNED);
- return true;
+ /* Constrain both bounds to a valid size. */
+ offset_int maxsize = wi::to_offset (max_object_size ());
+ if (pref->sizrng[0] > maxsize)
+ pref->sizrng[0] = maxsize;
+ if (pref->sizrng[1] > maxsize)
+ pref->sizrng[1] = maxsize;
}
- return false;
+ else
+ {
+ /* For functions known to return one of their pointer arguments
+ try to determine what the returned pointer points to, and on
+ success add OFFRNG which was set to the offset added by
+ the function (e.g., memchr) to the overall offset. */
+ offset_int offrng[2];
+ if (tree ret = gimple_call_return_array (stmt, offrng, rvals))
+ {
+ if (!compute_objsize (ret, ostype, pref, visited, rvals))
+ return false;
+
+ /* Cap OFFRNG[1] to at most the remaining size of
+ the object. */
+ offset_int remrng[2];
+ remrng[1] = pref->size_remaining (remrng);
+ if (remrng[1] < offrng[1])
+ offrng[1] = remrng[1];
+ pref->add_offset (offrng[0], offrng[1]);
+ }
+ else
+ {
+ /* For other calls that might return arbitrary pointers
+ including into the middle of objects set the size
+ range to maximum, clear PREF->BASE0, and also set
+ PREF->REF to include in diagnostics. */
+ pref->set_max_size_range ();
+ pref->base0 = false;
+ pref->ref = ptr;
+ }
+ }
+ return true;
}
if (gimple_nop_p (stmt))
@@ -4493,62 +4956,74 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
of the array from the current function declaratation
(e.g., attribute access or related). */
wide_int wr[2];
- tree ref = gimple_parm_array_size (ptr, wr, rvals);
- if (!ref)
- return NULL_TREE;
- pref->ref = ref;
- pref->sizrng[0] = offset_int::from (wr[0], UNSIGNED);
- pref->sizrng[1] = offset_int::from (wr[1], UNSIGNED);
+ if (tree ref = gimple_parm_array_size (ptr, wr, rvals))
+ {
+ pref->sizrng[0] = offset_int::from (wr[0], UNSIGNED);
+ pref->sizrng[1] = offset_int::from (wr[1], UNSIGNED);
+ pref->ref = ref;
+ return true;
+ }
+
+ pref->set_max_size_range ();
+ pref->base0 = false;
+ pref->ref = ptr;
+ if (tree var = SSA_NAME_VAR (ptr))
+ if (TREE_CODE (var) == PARM_DECL)
+ pref->ref = var;
+
return true;
}
/* TODO: Handle PHI. */
if (!is_gimple_assign (stmt))
- return false;
+ {
+ /* Clear BASE0 since the assigned pointer might point into
+ the middle of the object, set the maximum size range and,
+ if the SSA_NAME refers to a function argumnent, set
+ PREF->REF to it. */
+ pref->base0 = false;
+ pref->set_max_size_range ();
+ if (tree var = SSA_NAME_VAR (ptr))
+ if (TREE_CODE (var) == PARM_DECL)
+ pref->ref = var;
+ return true;
+ }
ptr = gimple_assign_rhs1 (stmt);
tree_code code = gimple_assign_rhs_code (stmt);
- if (TREE_CODE (TREE_TYPE (ptr)) != POINTER_TYPE)
- /* Avoid conversions from non-pointers. */
- return false;
- if (code == POINTER_PLUS_EXPR)
+ if (code == POINTER_PLUS_EXPR
+ && TREE_CODE (TREE_TYPE (ptr)) == POINTER_TYPE)
{
- /* If the the offset in the expression can be determined use
- it to adjust the overall offset. Otherwise, set the overall
- offset to the maximum. */
+ /* Compute the size of the object first. */
+ if (!compute_objsize (ptr, ostype, pref, visited, rvals))
+ return false;
+
offset_int orng[2];
tree off = gimple_assign_rhs2 (stmt);
- if (!get_range (off, SIGNED, orng, rvals))
- {
- orng[0] = wi::to_offset (TYPE_MIN_VALUE (ptrdiff_type_node));
- orng[1] = wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node));
- }
-
- pref->offrng[0] += orng[0];
- pref->offrng[1] += orng[1];
+ if (get_offset_range (off, stmt, orng, rvals))
+ pref->add_offset (orng[0], orng[1]);
+ else
+ pref->add_max_offset ();
+ return true;
}
- else if (code != ADDR_EXPR)
- return false;
-
- return compute_objsize (ptr, ostype, pref, visited, rvals);
- }
- tree type = TREE_TYPE (ptr);
- type = TYPE_MAIN_VARIANT (type);
- if (TREE_CODE (ptr) == ADDR_EXPR)
- ptr = TREE_OPERAND (ptr, 0);
+ if (code == ADDR_EXPR)
+ return compute_objsize (ptr, ostype, pref, visited, rvals);
- if (TREE_CODE (type) == ARRAY_TYPE
- && !array_at_struct_end_p (ptr))
- {
- if (tree size = TYPE_SIZE_UNIT (type))
- return get_range (size, UNSIGNED, pref->sizrng, rvals);
+ /* This could be an assignment from a nonlocal pointer. Save PTR
+ to mention in diagnostics but otherwise treat it as a pointer
+ to an unknown object. */
+ pref->ref = ptr;
}
- return false;
+ /* Assume all other expressions point into an unknown object
+ of the maximum valid size. */
+ pref->base0 = false;
+ pref->set_max_size_range ();
+ return true;
}
/* A "public" wrapper around the above. Clients should use this overload
@@ -4556,7 +5031,7 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
tree
compute_objsize (tree ptr, int ostype, access_ref *pref,
- const vr_values *rvals /* = NULL */)
+ range_query *rvals /* = NULL */)
{
bitmap visited = NULL;
@@ -4569,27 +5044,10 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
if (!success)
return NULL_TREE;
- if (pref->offrng[1] < pref->offrng[0])
- {
- if (pref->offrng[1] < 0
- && pref->sizrng[1] <= pref->offrng[0])
- return size_zero_node;
-
- return wide_int_to_tree (sizetype, pref->sizrng[1]);
- }
-
- if (pref->offrng[0] < 0)
- {
- if (pref->offrng[1] < 0)
- return size_zero_node;
-
- pref->offrng[0] = 0;
- }
-
- if (pref->sizrng[1] <= pref->offrng[0])
- return size_zero_node;
-
- return wide_int_to_tree (sizetype, pref->sizrng[1] - pref->offrng[0]);
+ offset_int maxsize = pref->size_remaining ();
+ if (pref->base0 && pref->offrng[0] < 0 && pref->offrng[1] >= 0)
+ pref->offrng[0] = 0;
+ return wide_int_to_tree (sizetype, maxsize);
}
/* Transitional wrapper around the above. The function should be removed
@@ -4597,13 +5055,13 @@ compute_objsize (tree ptr, int ostype, access_ref *pref,
tree
compute_objsize (tree ptr, int ostype, tree *pdecl /* = NULL */,
- tree *poff /* = NULL */, const vr_values *rvals /* = NULL */)
+ tree *poff /* = NULL */, range_query *rvals /* = NULL */)
{
/* Set the initial offsets to zero and size to negative to indicate
none has been computed yet. */
access_ref ref;
tree size = compute_objsize (ptr, ostype, &ref, rvals);
- if (!size)
+ if (!size || !ref.base0)
return NULL_TREE;
if (pdecl)
@@ -5882,13 +6340,21 @@ expand_builtin_strncmp (tree exp, ATTRIBUTE_UNUSED rtx target,
tree size2 = compute_objsize (arg2, 1, &ref2);
tree func = get_callee_fndecl (exp);
- if (size1 && size2)
+ if (size1 && size2 && bndrng[0] && !integer_zerop (bndrng[0]))
{
- tree maxsize = tree_int_cst_le (size1, size2) ? size2 : size1;
-
- if (tree_int_cst_lt (maxsize, bndrng[0]))
+ offset_int rem1 = ref1.size_remaining ();
+ offset_int rem2 = ref2.size_remaining ();
+ if (rem1 == 0 || rem2 == 0)
maybe_warn_for_bound (OPT_Wstringop_overread, loc, exp, func,
- bndrng, maxsize);
+ bndrng, integer_zero_node);
+ else
+ {
+ offset_int maxrem = wi::max (rem1, rem2, UNSIGNED);
+ if (maxrem < wi::to_offset (bndrng[0]))
+ maybe_warn_for_bound (OPT_Wstringop_overread, loc, exp,
+ func, bndrng,
+ wide_int_to_tree (sizetype, maxrem));
+ }
}
else if (bndrng[0]
&& !integer_zerop (bndrng[0])
@@ -9764,7 +10230,7 @@ fold_builtin_sincos (location_t loc,
}
if (!call)
{
- if (!targetm.libc_has_function (function_c99_math_complex)
+ if (!targetm.libc_has_function (function_c99_math_complex, type)
|| !builtin_decl_implicit_p (fn))
return NULL_TREE;
fndecl = builtin_decl_explicit (fn);
@@ -12436,3 +12902,14 @@ builtin_with_linkage_p (tree decl)
}
return false;
}
+
+/* Return true if OFFRNG is bounded to a subrange of offset values
+ valid for the largest possible object. */
+
+bool
+access_ref::offset_bounded () const
+{
+ tree min = TYPE_MIN_VALUE (ptrdiff_type_node);
+ tree max = TYPE_MAX_VALUE (ptrdiff_type_node);
+ return wi::to_offset (min) <= offrng[0] && offrng[1] <= wi::to_offset (max);
+}
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 102322b..95428c0 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -138,34 +138,41 @@ along with GCC; see the file COPYING3. If not see
#undef DEF_C94_BUILTIN
#define DEF_C94_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc94, ATTRS, targetm.libc_has_function (function_c94), true)
+ true, true, !flag_isoc94, ATTRS, \
+ targetm.libc_has_function (function_c94, NULL_TREE), true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C99 or above. */
#undef DEF_C99_BUILTIN
#define DEF_C99_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_misc), true)
+ true, true, !flag_isoc99, ATTRS, \
+ targetm.libc_has_function (function_c99_misc, NULL_TREE), true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C11 or above. */
#undef DEF_C11_BUILTIN
#define DEF_C11_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc11, ATTRS, targetm.libc_has_function (function_c11_misc), true)
+ true, true, !flag_isoc11, ATTRS, \
+ targetm.libc_has_function (function_c11_misc, NULL_TREE), true)
/* Like DEF_LIB_BUILTIN, except that the function is only a part of
the standard in C2x or above. */
#undef DEF_C2X_BUILTIN
#define DEF_C2X_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc2x, ATTRS, targetm.libc_has_function (function_c2x_misc), true)
+ true, true, !flag_isoc2x, ATTRS, \
+ targetm.libc_has_function (function_c2x_misc, NULL_TREE), true)
/* Like DEF_C99_BUILTIN, but for complex math functions. */
#undef DEF_C99_COMPL_BUILTIN
#define DEF_C99_COMPL_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_math_complex), true)
+ true, true, !flag_isoc99, ATTRS, \
+ targetm.libc_has_function (function_c99_math_complex, \
+ NULL_TREE), \
+ true)
/* Builtin that is specified by C99 and C90 reserve the name for future use.
We can still recognize the builtin in C90 mode but we can't produce it
@@ -173,7 +180,8 @@ along with GCC; see the file COPYING3. If not see
#undef DEF_C99_C90RES_BUILTIN
#define DEF_C99_C90RES_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
- true, true, !flag_isoc99, ATTRS, targetm.libc_has_function (function_c99_misc), true)
+ true, true, !flag_isoc99, ATTRS, \
+ targetm.libc_has_function (function_c99_misc, NULL_TREE), true)
/* Builtin that C99 reserve the name for future use. We can still recognize
the builtin in C99 mode but we can't produce it implicitly. */
diff --git a/gcc/builtins.h b/gcc/builtins.h
index 8136b76..c09f36d 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -109,6 +109,7 @@ extern void expand_builtin_setjmp_receiver (rtx);
extern void expand_builtin_update_setjmp_buf (rtx);
extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree mathfn_built_in (tree, combined_fn);
+extern tree mathfn_built_in_type (combined_fn);
extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, scalar_int_mode);
extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, scalar_int_mode);
extern rtx expand_builtin_saveregs (void);
@@ -172,6 +173,52 @@ struct access_ref
For string functions the size of the actual access is
further constrained by the length of the string. */
offset_int bndrng[2];
+
+ /* Return true if OFFRNG is the constant zero. */
+ bool offset_zero () const
+ {
+ return offrng[0] == 0 && offrng[1] == 0;
+ }
+
+ /* Return true if OFFRNG is bounded to a subrange of offset values
+ valid for the largest possible object. */
+ bool offset_bounded () const;
+
+ /* Return the maximum amount of space remaining and if non-null, set
+ argument to the minimum. */
+ offset_int size_remaining (offset_int * = NULL) const;
+
+ /* Set the size range to the maximum. */
+ void set_max_size_range ()
+ {
+ sizrng[0] = 0;
+ sizrng[1] = wi::to_offset (max_object_size ());
+ }
+
+ /* Add OFF to the offset range. */
+ void add_offset (const offset_int &off)
+ {
+ add_offset (off, off);
+ }
+
+ /* Add the range [MIN, MAX] to the offset range. */
+ void add_offset (const offset_int &, const offset_int &);
+
+ /* Add the maximum representable offset to the offset range. */
+ void add_max_offset ()
+ {
+ offset_int maxoff = wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node));
+ add_offset (-maxoff - 1, maxoff);
+ }
+
+ /* Used to fold integer expressions when called from front ends. */
+ tree (*eval)(tree);
+ /* Set if trailing one-element arrays should be treated as flexible
+ array members. */
+ bool trail1special;
+ /* Set if valid offsets must start at zero (for declared and allocated
+ objects but not for others referenced by pointers). */
+ bool base0;
};
/* Describes a pair of references used in an access by built-in
@@ -195,15 +242,14 @@ struct access_data
access_mode mode;
};
-class vr_values;
+class range_query;
extern tree gimple_call_alloc_size (gimple *, wide_int[2] = NULL,
- const vr_values * = NULL);
-extern tree gimple_parm_array_size (tree, wide_int[2], const vr_values * = NULL);
+ range_query * = NULL);
+extern tree gimple_parm_array_size (tree, wide_int[2], range_query * = NULL);
+extern tree compute_objsize (tree, int, access_ref *, range_query * = NULL);
extern tree compute_objsize (tree, int, tree * = NULL, tree * = NULL,
- const vr_values * = NULL);
-extern tree compute_objsize (tree, int, access_ref *, const vr_values * = NULL);
-
-extern bool check_access (tree, tree, tree, tree, tree, access_mode,
- const access_data * = NULL);
+ range_query * = NULL);
+extern bool check_access (tree, tree, tree, tree, tree,
+ access_mode, const access_data * = NULL);
#endif /* GCC_BUILTINS_H */
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index bc002cf..27a59c2 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,87 @@
+2020-10-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * c-common.c (c_common_finalize_early_debug): Update for new thunk api.
+
+2020-10-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91741
+ * c-common.c (verify_tree): Handle PAREN_SIZEOF_EXPR.
+ (c_common_init_ts): Likewise.
+ * c-common.def (PAREN_SIZEOF_EXPR): New tree code.
+ * c-common.h (maybe_warn_sizeof_array_div): Declare.
+ * c-warn.c (sizeof_pointer_memaccess_warning): Unwrap NOP_EXPRs.
+ (maybe_warn_sizeof_array_div): New function.
+ * c.opt (Wsizeof-array-div): New option.
+
+2020-10-23 Martin Sebor <msebor@redhat.com>
+
+ PR c/97463
+ * c-warn.c (warn_parm_ptrarray_mismatch): Move null test earlier.
+
+2020-10-22 Martin Liska <mliska@suse.cz>
+
+ PR c/94722
+ * c-attribs.c (handle_no_stack_protect_function_attribute): New.
+ (handle_stack_protect_attribute): Add error message for a
+ no_stack_protector function.
+
+2020-10-22 Martin Liska <mliska@suse.cz>
+
+ * c-cppbuiltin.c (c_cpp_builtins): Use the stack_protector enum.
+
+2020-10-22 Jan Hubicka <hubicka@ucw.cz>
+
+ * c-gimplify.c: Include tree-nested.h
+ (c_genericize): Update for new nested function info.
+
+2020-10-14 Martin Sebor <msebor@redhat.com>
+
+ PR c/97413
+ * c-attribs.c (build_attr_access_from_parms): Wrap chain of VLA
+ bounds in an extra list.
+
+2020-10-05 Richard Biener <rguenther@suse.de>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97197
+ * c-pretty-print.c: Include langhooks.h.
+ (c_pretty_printer::postfix_expression): Handle TARGET_MEM_REF as
+ expression.
+ (c_pretty_printer::expression): Handle TARGET_MEM_REF as
+ unary_expression.
+ (c_pretty_printer::unary_expression): Handle TARGET_MEM_REF.
+
+2020-09-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97189
+ * c-attribs.c (append_access_attr): Use the function declaration
+ location for a warning about an attribute access argument.
+
+2020-09-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94695
+ * c.opt (Wrange-loop-construct): New option.
+
+2020-09-23 Martin Sebor <msebor@redhat.com>
+
+ PR c/97131
+ * c-warn.c (warn_parm_ptrarray_mismatch): Handle more invalid input.
+
+2020-09-23 Marek Polacek <polacek@redhat.com>
+
+ PR c/97125
+ * c-gimplify.c (c_genericize): Only call do_warn_duplicated_branches_r
+ after loops and other structured control constructs have been lowered.
+
+2020-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ * c.opt (Wbuiltin-declaration-mismatch): Fix typo in variable name:
+ warn_builtin_declaraion_mismatch -> warn_builtin_declaration_mismatch.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ * c.opt (Wctad-maybe-unsupported): New option.
+
2020-09-19 Martin Sebor <msebor@redhat.com>
PR c/50584
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 70b0003..a3b2b3d 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -65,6 +65,8 @@ static tree handle_no_sanitize_undefined_attribute (tree *, tree, tree, int,
static tree handle_asan_odr_indicator_attribute (tree *, tree, tree, int,
bool *);
static tree handle_stack_protect_attribute (tree *, tree, tree, int, bool *);
+static tree handle_no_stack_protector_function_attribute (tree *, tree,
+ tree, int, bool *);
static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
static tree handle_noclone_attribute (tree *, tree, tree, int, bool *);
static tree handle_nocf_check_attribute (tree *, tree, tree, int, bool *);
@@ -248,6 +250,14 @@ static const struct attribute_spec::exclusions attr_noinit_exclusions[] =
ATTR_EXCL (NULL, false, false, false),
};
+static const struct attribute_spec::exclusions attr_stack_protect_exclusions[] =
+{
+ ATTR_EXCL ("stack_protect", true, false, false),
+ ATTR_EXCL ("no_stack_protector", true, false, false),
+ ATTR_EXCL (NULL, false, false, false),
+};
+
+
/* Table of machine-independent attributes common to all C-like languages.
Current list of processed common attributes: nonnull. */
@@ -275,7 +285,11 @@ const struct attribute_spec c_common_attribute_table[] =
{ "volatile", 0, 0, true, false, false, false,
handle_noreturn_attribute, NULL },
{ "stack_protect", 0, 0, true, false, false, false,
- handle_stack_protect_attribute, NULL },
+ handle_stack_protect_attribute,
+ attr_stack_protect_exclusions },
+ { "no_stack_protector", 0, 0, true, false, false, false,
+ handle_no_stack_protector_function_attribute,
+ attr_stack_protect_exclusions },
{ "noinline", 0, 0, true, false, false, false,
handle_noinline_attribute,
attr_noinline_exclusions },
@@ -1156,6 +1170,22 @@ handle_stack_protect_attribute (tree *node, tree name, tree, int,
return NULL_TREE;
}
+/* Handle a "no_stack_protector" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_stack_protector_function_attribute (tree *node, tree name, tree,
+ int, bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "noipa" attribute; arguments as in
struct attribute_spec.handler. */
@@ -4151,18 +4181,12 @@ append_access_attr (tree node[3], tree attrs, const char *attrstr,
"missing in previous designation",
attrstr);
else if (newa->internal_p || cura->internal_p)
- {
- /* Mismatch in the value of the size argument and a VLA
- bound. */
- location_t argloc = curloc;
- if (tree arg = get_argument (node[2], newa->sizarg))
- argloc = DECL_SOURCE_LOCATION (arg);
- warned = warning_at (argloc, OPT_Wattributes,
- "attribute %qs positional argument 2 "
- "conflicts with previous designation "
- "by argument %u",
- attrstr, cura->sizarg + 1);
- }
+ /* Mismatch in the value of the size argument and a VLA bound. */
+ warned = warning_at (curloc, OPT_Wattributes,
+ "attribute %qs positional argument 2 "
+ "conflicts with previous designation "
+ "by argument %u",
+ attrstr, cura->sizarg + 1);
else
/* Mismatch in the value of the size argument between two
explicit access attributes. */
@@ -4553,10 +4577,11 @@ handle_access_attribute (tree node[3], tree name, tree args,
result in the following attribute access:
value: "+^2[*],$0$1^3[*],$1$1"
- chain: <0, x> <1, y>
+ list: < <0, x> <1, y> >
- where each <node> on the chain corresponds to one VLA bound for each
- of the two parameters. */
+ where the list has a single value which itself is is a list each
+ of whose <node>s corresponds to one VLA bound for each of the two
+ parameters. */
tree
build_attr_access_from_parms (tree parms, bool skip_voidptr)
@@ -4660,13 +4685,17 @@ build_attr_access_from_parms (tree parms, bool skip_voidptr)
if (!spec.length ())
return NULL_TREE;
+ /* Attribute access takes a two or three arguments. Wrap VBLIST in
+ another list in case it has more nodes than would otherwise fit. */
+ vblist = build_tree_list (NULL_TREE, vblist);
+
/* Build a single attribute access with the string describing all
array arguments and an optional list of any non-parameter VLA
bounds in order. */
tree str = build_string (spec.length (), spec.c_str ());
tree attrargs = tree_cons (NULL_TREE, str, vblist);
tree name = get_identifier ("access");
- return tree_cons (name, attrargs, NULL_TREE);
+ return build_tree_list (name, attrargs);
}
/* Handle a "nothrow" attribute; arguments as in
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e16ca38..1787dfd 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1854,6 +1854,7 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
{
case CONSTRUCTOR:
case SIZEOF_EXPR:
+ case PAREN_SIZEOF_EXPR:
return;
case COMPOUND_EXPR:
@@ -8142,6 +8143,7 @@ void
c_common_init_ts (void)
{
MARK_TS_EXP (SIZEOF_EXPR);
+ MARK_TS_EXP (PAREN_SIZEOF_EXPR);
MARK_TS_EXP (C_MAYBE_CONST_EXPR);
MARK_TS_EXP (EXCESS_PRECISION_EXPR);
MARK_TS_EXP (BREAK_STMT);
@@ -9132,7 +9134,7 @@ c_common_finalize_early_debug (void)
functions that are still reachable at this point. */
struct cgraph_node *cnode;
FOR_EACH_FUNCTION (cnode)
- if (!cnode->alias && !cnode->thunk.thunk_p
+ if (!cnode->alias && !cnode->thunk
&& (cnode->has_gimple_body_p () || !DECL_IS_BUILTIN (cnode->decl)))
(*debug_hooks->early_global_decl) (cnode->decl);
}
diff --git a/gcc/c-family/c-common.def b/gcc/c-family/c-common.def
index 1954bfe..3d3e497 100644
--- a/gcc/c-family/c-common.def
+++ b/gcc/c-family/c-common.def
@@ -55,6 +55,9 @@ DEFTREECODE (USERDEF_LITERAL, "userdef_literal", tcc_exceptional, 3)
or for the purpose of -Wsizeof-pointer-memaccess warning. */
DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", tcc_expression, 1)
+/* Like above, but enclosed in parentheses. Used to suppress warnings. */
+DEFTREECODE (PAREN_SIZEOF_EXPR, "paren_sizeof_expr", tcc_expression, 1)
+
/* Used to represent a `for' statement. The operands are
FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, and FOR_SCOPE,
respectively. */
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 3d96092..bb38e6c 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1373,6 +1373,7 @@ extern void warn_for_omitted_condop (location_t, tree);
extern bool warn_for_restrict (unsigned, tree *, unsigned);
extern void warn_for_address_or_pointer_of_packed_member (tree, tree);
extern void warn_parm_array_mismatch (location_t, tree, tree);
+extern void maybe_warn_sizeof_array_div (location_t, tree, tree, tree, tree);
/* Places where an lvalue, or modifiable lvalue, may be required.
Used to select diagnostic messages in lvalue_error and
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 74ecca8..e5ebb79 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1427,13 +1427,13 @@ c_cpp_builtins (cpp_reader *pfile)
/* Make the choice of the stack protector runtime visible to source code.
The macro names and values here were chosen for compatibility with an
earlier implementation, i.e. ProPolice. */
- if (flag_stack_protect == 4)
+ if (flag_stack_protect == SPCT_FLAG_EXPLICIT)
cpp_define (pfile, "__SSP_EXPLICIT__=4");
- if (flag_stack_protect == 3)
+ if (flag_stack_protect == SPCT_FLAG_STRONG)
cpp_define (pfile, "__SSP_STRONG__=3");
- if (flag_stack_protect == 2)
+ if (flag_stack_protect == SPCT_FLAG_ALL)
cpp_define (pfile, "__SSP_ALL__=2");
- else if (flag_stack_protect == 1)
+ else if (flag_stack_protect == SPCT_FLAG_DEFAULT)
cpp_define (pfile, "__SSP__=1");
if (flag_openacc)
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index 8b326c9..a7c0ec3 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "dumpfile.h"
#include "c-ubsan.h"
+#include "tree-nested.h"
/* The gimplification pass converts the language-dependent trees
(ld-trees) emitted by the parser into language-independent trees
@@ -533,10 +534,6 @@ c_genericize (tree fndecl)
&pset);
}
- if (warn_duplicated_branches)
- walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
- do_warn_duplicated_branches_r, NULL);
-
/* Genericize loops and other structured control constructs. The C++
front end has already done this in lang-specific code. */
if (!c_dialect_cxx ())
@@ -550,6 +547,10 @@ c_genericize (tree fndecl)
pop_cfun ();
}
+ if (warn_duplicated_branches)
+ walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
+ do_warn_duplicated_branches_r, NULL);
+
/* Dump the C-specific tree IR. */
dump_orig = get_dump_info (TDI_original, &local_dump_flags);
if (dump_orig)
@@ -572,7 +573,8 @@ c_genericize (tree fndecl)
/* Dump all nested functions now. */
cgn = cgraph_node::get_create (fndecl);
- for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
+ for (cgn = first_nested_function (cgn);
+ cgn; cgn = next_nested_function (cgn))
c_genericize (cgn->decl);
}
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index acffd7b..8953e3b 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "tree-pretty-print.h"
#include "selftest.h"
+#include "langhooks.h"
/* The pretty-printer code is primarily designed to closely follow
(GNU) C and C++ grammars. That is to be contrasted with spaghetti
@@ -1693,6 +1694,7 @@ c_pretty_printer::postfix_expression (tree e)
break;
case MEM_REF:
+ case TARGET_MEM_REF:
expression (e);
break;
@@ -1859,6 +1861,62 @@ c_pretty_printer::unary_expression (tree e)
}
break;
+ case TARGET_MEM_REF:
+ /* TARGET_MEM_REF can't appear directly from source, but can appear
+ during late GIMPLE optimizations and through late diagnostic we might
+ need to support it. Print it as dereferencing of a pointer after
+ cast to the TARGET_MEM_REF type, with pointer arithmetics on some
+ pointer to single byte types, so
+ *(type *)((char *) ptr + step * index + index2) if all the operands
+ are present and the casts are needed. */
+ pp_c_star (this);
+ if (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (TMR_BASE (e)))) == NULL_TREE
+ || !integer_onep (TYPE_SIZE_UNIT
+ (TREE_TYPE (TREE_TYPE (TMR_BASE (e))))))
+ {
+ if (TYPE_SIZE_UNIT (TREE_TYPE (e))
+ && integer_onep (TYPE_SIZE_UNIT (TREE_TYPE (e))))
+ {
+ pp_c_left_paren (this);
+ pp_c_type_cast (this, build_pointer_type (TREE_TYPE (e)));
+ }
+ else
+ {
+ pp_c_type_cast (this, build_pointer_type (TREE_TYPE (e)));
+ pp_c_left_paren (this);
+ pp_c_type_cast (this, build_pointer_type (char_type_node));
+ }
+ }
+ else if (!lang_hooks.types_compatible_p
+ (TREE_TYPE (e), TREE_TYPE (TREE_TYPE (TMR_BASE (e)))))
+ {
+ pp_c_type_cast (this, build_pointer_type (TREE_TYPE (e)));
+ pp_c_left_paren (this);
+ }
+ else
+ pp_c_left_paren (this);
+ pp_c_cast_expression (this, TMR_BASE (e));
+ if (TMR_STEP (e) && TMR_INDEX (e))
+ {
+ pp_plus (this);
+ pp_c_cast_expression (this, TMR_INDEX (e));
+ pp_c_star (this);
+ pp_c_cast_expression (this, TMR_STEP (e));
+ }
+ if (TMR_INDEX2 (e))
+ {
+ pp_plus (this);
+ pp_c_cast_expression (this, TMR_INDEX2 (e));
+ }
+ if (!integer_zerop (TMR_OFFSET (e)))
+ {
+ pp_plus (this);
+ pp_c_integer_constant (this,
+ fold_convert (ssizetype, TMR_OFFSET (e)));
+ }
+ pp_c_right_paren (this);
+ break;
+
case REALPART_EXPR:
case IMAGPART_EXPR:
pp_c_ws_string (this, code == REALPART_EXPR ? "__real__" : "__imag__");
@@ -2295,6 +2353,7 @@ c_pretty_printer::expression (tree e)
case ADDR_EXPR:
case INDIRECT_REF:
case MEM_REF:
+ case TARGET_MEM_REF:
case NEGATE_EXPR:
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index d6db85b..68b093e 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -3177,6 +3177,10 @@ warn_parm_ptrarray_mismatch (location_t origloc, tree curparms, tree newparms)
{
curtyp = TREE_TYPE (curtyp);
newtyp = TREE_TYPE (newtyp);
+
+ if (!newtyp)
+ /* Bail on error. */
+ return;
}
while (TREE_CODE (curtyp) == POINTER_TYPE
&& TREE_CODE (newtyp) == POINTER_TYPE);
@@ -3186,6 +3190,7 @@ warn_parm_ptrarray_mismatch (location_t origloc, tree curparms, tree newparms)
{
if (curtyp == error_mark_node
|| newtyp == error_mark_node)
+ /* Bail on error. */
return;
continue;
@@ -3660,3 +3665,50 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms)
inform (origloc, "previously declared as %s", curparmstr.c_str ());
}
}
+
+/* Warn about divisions of two sizeof operators when the first one is applied
+ to an array and the divisor does not equal the size of the array element.
+ For instance:
+
+ sizeof (ARR) / sizeof (OP)
+
+ ARR is the array argument of the first sizeof, ARR_TYPE is its ARRAY_TYPE.
+ OP1 is the whole second SIZEOF_EXPR, or its argument; TYPE1 is the type
+ of the second argument. */
+
+void
+maybe_warn_sizeof_array_div (location_t loc, tree arr, tree arr_type,
+ tree op1, tree type1)
+{
+ tree elt_type = TREE_TYPE (arr_type);
+
+ if (!warn_sizeof_array_div
+ /* Don't warn on multidimensional arrays. */
+ || TREE_CODE (elt_type) == ARRAY_TYPE)
+ return;
+
+ if (!tree_int_cst_equal (TYPE_SIZE (elt_type), TYPE_SIZE (type1)))
+ {
+ auto_diagnostic_group d;
+ if (warning_at (loc, OPT_Wsizeof_array_div,
+ "expression does not compute the number of "
+ "elements in this array; element type is "
+ "%qT, not %qT", elt_type, type1))
+ {
+ if (EXPR_HAS_LOCATION (op1))
+ {
+ location_t op1_loc = EXPR_LOCATION (op1);
+ gcc_rich_location richloc (op1_loc);
+ richloc.add_fixit_insert_before (op1_loc, "(");
+ richloc.add_fixit_insert_after (op1_loc, ")");
+ inform (&richloc, "add parentheses around %qE to "
+ "silence this warning", op1);
+ }
+ else
+ inform (loc, "add parentheses around the second %<sizeof%> "
+ "to silence this warning");
+ if (DECL_P (arr))
+ inform (DECL_SOURCE_LOCATION (arr), "array %qD declared here", arr);
+ }
+ }
+}
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 7a61351..1009def 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -371,7 +371,7 @@ C ObjC C++ ObjC++ Var(warn_frame_address) Warning LangEnabledBy(C ObjC C++ ObjC+
Warn when __builtin_frame_address or __builtin_return_address is used unsafely.
Wbuiltin-declaration-mismatch
-C ObjC C++ ObjC++ Var(warn_builtin_declaraion_mismatch) Init(1) Warning
+C ObjC C++ ObjC++ Var(warn_builtin_declaration_mismatch) Init(1) Warning
Warn when a built-in function is declared with the wrong signature.
Wbuiltin-macro-redefined
@@ -475,6 +475,11 @@ Wcpp
C ObjC C++ ObjC++ CppReason(CPP_W_WARNING_DIRECTIVE)
; Documented in common.opt
+Wctad-maybe-unsupported
+C++ ObjC++ Var(warn_ctad_maybe_unsupported) Warning
+Warn when performing class template argument deduction on a type with no
+deduction guides.
+
Wctor-dtor-privacy
C++ ObjC++ Var(warn_ctor_dtor_privacy) Warning
Warn when all constructors and destructors are private.
@@ -795,6 +800,10 @@ Wpacked-not-aligned
C ObjC C++ ObjC++ Var(warn_packed_not_aligned) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn when fields in a struct with the packed attribute are misaligned.
+Wrange-loop-construct
+C++ ObjC++ Var(warn_range_loop_construct) Warning LangEnabledBy(C++ ObjC++,Wall)
+Warn when a range-based for-loop is creating unnecessary copies.
+
Wredundant-tags
C++ ObjC++ Var(warn_redundant_tags) Warning
Warn when a class or enumerated type is referenced using a redundant class-key.
@@ -807,6 +816,11 @@ Wsizeof-pointer-div
C ObjC C++ ObjC++ Var(warn_sizeof_pointer_div) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about suspicious divisions of two sizeof expressions that don't work correctly with pointers.
+Wsizeof-array-div
+C ObjC C++ ObjC++ Var(warn_sizeof_array_div) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about divisions of two sizeof operators when the first one is applied
+to an array and the divisor does not equal the size of the array element.
+
Wsizeof-pointer-memaccess
C ObjC C++ ObjC++ Var(warn_sizeof_pointer_memaccess) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about suspicious length parameters to certain string functions if the argument uses sizeof.
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 839bfa1..8c6893b 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,17 @@
+2020-10-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91741
+ * c-parser.c (c_parser_binary_expression): Implement -Wsizeof-array-div.
+ (c_parser_postfix_expression): Set PAREN_SIZEOF_EXPR.
+ (c_parser_expr_list): Handle PAREN_SIZEOF_EXPR like SIZEOF_EXPR.
+ * c-tree.h (char_type_p): Declare.
+ * c-typeck.c (char_type_p): No longer static.
+
+2020-10-23 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97552
+ * c-decl.c (get_parm_array_spec): Handle static VLA parameters.
+
2020-09-19 Martin Sebor <msebor@redhat.com>
PR c/50584
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 81b9adb..1673b95 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5784,6 +5784,9 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs)
continue;
}
+ if (pd->u.array.static_p)
+ spec += 's';
+
if (TREE_CODE (nelts) == INTEGER_CST)
{
/* Skip all constant bounds except the most significant one.
@@ -5796,9 +5799,8 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs)
return attrs;
char buf[40];
- const char *code = pd->u.array.static_p ? "s" : "";
unsigned HOST_WIDE_INT n = tree_to_uhwi (nelts);
- sprintf (buf, "%s%llu", code, (unsigned long long)n);
+ sprintf (buf, "%llu", (unsigned long long)n);
spec += buf;
break;
}
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 7d58356..b6a7ef4 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -7876,7 +7876,7 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after,
enum tree_code op;
/* The source location of this operation. */
location_t loc;
- /* The sizeof argument if expr.original_code == SIZEOF_EXPR. */
+ /* The sizeof argument if expr.original_code == {PAREN_,}SIZEOF_EXPR. */
tree sizeof_arg;
} stack[NUM_PRECS];
int sp;
@@ -7894,9 +7894,11 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after,
c_inhibit_evaluation_warnings -= (stack[sp - 1].expr.value \
== truthvalue_true_node); \
break; \
- case TRUNC_DIV_EXPR: \
- if (stack[sp - 1].expr.original_code == SIZEOF_EXPR \
- && stack[sp].expr.original_code == SIZEOF_EXPR) \
+ case TRUNC_DIV_EXPR: \
+ if ((stack[sp - 1].expr.original_code == SIZEOF_EXPR \
+ || stack[sp - 1].expr.original_code == PAREN_SIZEOF_EXPR) \
+ && (stack[sp].expr.original_code == SIZEOF_EXPR \
+ || stack[sp].expr.original_code == PAREN_SIZEOF_EXPR)) \
{ \
tree type0 = stack[sp - 1].sizeof_arg; \
tree type1 = stack[sp].sizeof_arg; \
@@ -7910,18 +7912,23 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after,
&& !(TREE_CODE (first_arg) == PARM_DECL \
&& C_ARRAY_PARAMETER (first_arg) \
&& warn_sizeof_array_argument)) \
- { \
- auto_diagnostic_group d; \
- if (warning_at (stack[sp].loc, OPT_Wsizeof_pointer_div, \
- "division %<sizeof (%T) / sizeof (%T)%> " \
- "does not compute the number of array " \
- "elements", \
- type0, type1)) \
- if (DECL_P (first_arg)) \
- inform (DECL_SOURCE_LOCATION (first_arg), \
- "first %<sizeof%> operand was declared here"); \
- } \
- } \
+ { \
+ auto_diagnostic_group d; \
+ if (warning_at (stack[sp].loc, OPT_Wsizeof_pointer_div, \
+ "division %<sizeof (%T) / sizeof (%T)%> " \
+ "does not compute the number of array " \
+ "elements", \
+ type0, type1)) \
+ if (DECL_P (first_arg)) \
+ inform (DECL_SOURCE_LOCATION (first_arg), \
+ "first %<sizeof%> operand was declared here"); \
+ } \
+ else if (TREE_CODE (type0) == ARRAY_TYPE \
+ && !char_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type0))) \
+ && stack[sp].expr.original_code != PAREN_SIZEOF_EXPR) \
+ maybe_warn_sizeof_array_div (stack[sp].loc, first_arg, type0, \
+ stack[sp].sizeof_arg, type1); \
+ } \
break; \
default: \
break; \
@@ -9177,6 +9184,9 @@ c_parser_postfix_expression (c_parser *parser)
if (expr.original_code != C_MAYBE_CONST_EXPR
&& expr.original_code != SIZEOF_EXPR)
expr.original_code = ERROR_MARK;
+ /* Remember that we saw ( ) around the sizeof. */
+ if (expr.original_code == SIZEOF_EXPR)
+ expr.original_code = PAREN_SIZEOF_EXPR;
/* Don't change EXPR.ORIGINAL_TYPE. */
location_t loc_close_paren = c_parser_peek_token (parser)->location;
set_c_expr_source_range (&expr, loc_open_paren, loc_close_paren);
@@ -10792,7 +10802,8 @@ c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p,
if (locations)
locations->safe_push (expr.get_location ());
if (sizeof_arg != NULL
- && expr.original_code == SIZEOF_EXPR)
+ && (expr.original_code == SIZEOF_EXPR
+ || expr.original_code == PAREN_SIZEOF_EXPR))
{
sizeof_arg[0] = c_last_sizeof_arg;
sizeof_arg_loc[0] = c_last_sizeof_loc;
@@ -10815,7 +10826,8 @@ c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p,
locations->safe_push (expr.get_location ());
if (++idx < 3
&& sizeof_arg != NULL
- && expr.original_code == SIZEOF_EXPR)
+ && (expr.original_code == SIZEOF_EXPR
+ || expr.original_code == PAREN_SIZEOF_EXPR))
{
sizeof_arg[idx] = c_last_sizeof_arg;
sizeof_arg_loc[idx] = c_last_sizeof_loc;
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index 287b1df..1f783db 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -675,6 +675,7 @@ extern location_t c_last_sizeof_loc;
extern struct c_switch *c_switch_stack;
+extern bool char_type_p (tree);
extern tree c_objc_common_truthvalue_conversion (location_t, tree);
extern tree require_complete_type (location_t, tree);
extern bool same_translation_unit_p (const_tree, const_tree);
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index dd3e309..459090e 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3719,7 +3719,7 @@ parser_build_unary_op (location_t loc, enum tree_code code, struct c_expr arg)
/* Returns true if TYPE is a character type, *not* including wchar_t. */
-static bool
+bool
char_type_p (tree type)
{
return (type == char_type_node
diff --git a/gcc/calls.c b/gcc/calls.c
index 0e5c696..17b8e2f 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -17,6 +17,7 @@ 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 INCLUDE_STRING
#include "config.h"
#include "system.h"
#include "coretypes.h"
@@ -57,6 +58,8 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "builtins.h"
#include "gimple-fold.h"
+#include "attr-fnspec.h"
+#include "value-query.h"
#include "tree-pretty-print.h"
@@ -641,25 +644,15 @@ decl_return_flags (tree fndecl)
if (!attr)
return 0;
- attr = TREE_VALUE (TREE_VALUE (attr));
- if (!attr || TREE_STRING_LENGTH (attr) < 1)
- return 0;
-
- switch (TREE_STRING_POINTER (attr)[0])
- {
- case '1':
- case '2':
- case '3':
- case '4':
- return ERF_RETURNS_ARG | (TREE_STRING_POINTER (attr)[0] - '1');
+ attr_fnspec fnspec (TREE_VALUE (TREE_VALUE (attr)));
- case 'm':
- return ERF_NOALIAS;
+ unsigned int arg;
+ if (fnspec.returns_arg (&arg))
+ return ERF_RETURNS_ARG | arg;
- case '.':
- default:
- return 0;
- }
+ if (fnspec.returns_noalias_p ())
+ return ERF_NOALIAS;
+ return 0;
}
/* Return nonzero when FNDECL represents a call to setjmp. */
@@ -1243,14 +1236,17 @@ alloc_max_size (void)
after adjusting it if necessary to make EXP a represents a valid size
of object, or a valid size argument to an allocation function declared
with attribute alloc_size (whose argument may be signed), or to a string
- manipulation function like memset. When ALLOW_ZERO is true, allow
- returning a range of [0, 0] for a size in an anti-range [1, N] where
- N > PTRDIFF_MAX. A zero range is a (nearly) invalid argument to
- allocation functions like malloc but it is a valid argument to
- functions like memset. */
+ manipulation function like memset.
+ When ALLOW_ZERO is set in FLAGS, allow returning a range of [0, 0] for
+ a size in an anti-range [1, N] where N > PTRDIFF_MAX. A zero range is
+ a (nearly) invalid argument to allocation functions like malloc but it
+ is a valid argument to functions like memset.
+ When USE_LARGEST is set in FLAGS set RANGE to the largest valid subrange
+ in a multi-range, otherwise to the smallest valid subrange. */
bool
-get_size_range (tree exp, tree range[2], bool allow_zero /* = false */)
+get_size_range (range_query *query, tree exp, gimple *stmt, tree range[2],
+ int flags /* = 0 */)
{
if (!exp)
return false;
@@ -1269,7 +1265,19 @@ get_size_range (tree exp, tree range[2], bool allow_zero /* = false */)
enum value_range_kind range_type;
if (integral)
- range_type = determine_value_range (exp, &min, &max);
+ {
+ value_range vr;
+ if (query && query->range_of_expr (vr, exp, stmt))
+ {
+ if (vr.undefined_p ())
+ vr.set_varying (TREE_TYPE (exp));
+ range_type = vr.kind ();
+ min = wi::to_wide (vr.min ());
+ max = wi::to_wide (vr.max ());
+ }
+ else
+ range_type = determine_value_range (exp, &min, &max);
+ }
else
range_type = VR_VARYING;
@@ -1322,25 +1330,50 @@ get_size_range (tree exp, tree range[2], bool allow_zero /* = false */)
min = wi::zero (expprec);
}
}
- else if (wi::eq_p (0, min - 1))
+ else
{
- /* EXP is unsigned and not in the range [1, MAX]. That means
- it's either zero or greater than MAX. Even though 0 would
- normally be detected by -Walloc-zero, unless ALLOW_ZERO
- is true, set the range to [MAX, TYPE_MAX] so that when MAX
- is greater than the limit the whole range is diagnosed. */
- if (allow_zero)
- min = max = wi::zero (expprec);
- else
+ wide_int maxsize = wi::to_wide (max_object_size ());
+ min = wide_int::from (min, maxsize.get_precision (), UNSIGNED);
+ max = wide_int::from (max, maxsize.get_precision (), UNSIGNED);
+ if (wi::eq_p (0, min - 1))
+ {
+ /* EXP is unsigned and not in the range [1, MAX]. That means
+ it's either zero or greater than MAX. Even though 0 would
+ normally be detected by -Walloc-zero, unless ALLOW_ZERO
+ is set, set the range to [MAX, TYPE_MAX] so that when MAX
+ is greater than the limit the whole range is diagnosed. */
+ wide_int maxsize = wi::to_wide (max_object_size ());
+ if (flags & SR_ALLOW_ZERO)
+ {
+ if (wi::leu_p (maxsize, max + 1)
+ || !(flags & SR_USE_LARGEST))
+ min = max = wi::zero (expprec);
+ else
+ {
+ min = max + 1;
+ max = wi::to_wide (TYPE_MAX_VALUE (exptype));
+ }
+ }
+ else
+ {
+ min = max + 1;
+ max = wi::to_wide (TYPE_MAX_VALUE (exptype));
+ }
+ }
+ else if ((flags & SR_USE_LARGEST)
+ && wi::ltu_p (max + 1, maxsize))
{
+ /* When USE_LARGEST is set and the larger of the two subranges
+ is a valid size, use it... */
min = max + 1;
- max = wi::to_wide (TYPE_MAX_VALUE (exptype));
+ max = maxsize;
+ }
+ else
+ {
+ /* ...otherwise use the smaller subrange. */
+ max = min - 1;
+ min = wi::zero (expprec);
}
- }
- else
- {
- max = min - 1;
- min = wi::zero (expprec);
}
}
@@ -1350,6 +1383,12 @@ get_size_range (tree exp, tree range[2], bool allow_zero /* = false */)
return true;
}
+bool
+get_size_range (tree exp, tree range[2], int flags /* = 0 */)
+{
+ return get_size_range (/*query=*/NULL, exp, /*stmt=*/NULL, range, flags);
+}
+
/* Diagnose a call EXP to function FN decorated with attribute alloc_size
whose argument numbers given by IDX with values given by ARGS exceed
the maximum object size or cause an unsigned oveflow (wrapping) when
@@ -1924,7 +1963,10 @@ static void
maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp)
{
auto_diagnostic_group adg;
- bool warned = false;
+
+ /* Set if a warning has been issued for any argument (used to decide
+ whether to emit an informational note at the end). */
+ bool any_warned = false;
/* A string describing the attributes that the warnings issued by this
function apply to. Used to print one informational note per function
@@ -1974,27 +2016,60 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp)
else
access_size = rwm->get (sizidx)->size;
- bool warned = false;
+ /* Format the value or range to avoid an explosion of messages. */
+ char sizstr[80];
+ tree sizrng[2] = { size_zero_node, build_all_ones_cst (sizetype) };
+ if (get_size_range (access_size, sizrng, true))
+ {
+ const char *s0 = print_generic_expr_to_str (sizrng[0]);
+ if (tree_int_cst_equal (sizrng[0], sizrng[1]))
+ {
+ gcc_checking_assert (strlen (s0) < sizeof sizstr);
+ strcpy (sizstr, s0);
+ }
+ else
+ {
+ const char *s1 = print_generic_expr_to_str (sizrng[1]);
+ gcc_checking_assert (strlen (s0) + strlen (s1)
+ < sizeof sizstr - 4);
+ sprintf (sizstr, "[%s, %s]", s0, s1);
+ }
+ }
+ else
+ *sizstr = '\0';
+
+ /* Set if a warning has been issued for the current argument. */
+ bool arg_warned = false;
location_t loc = EXPR_LOCATION (exp);
tree ptr = access.second.ptr;
- tree sizrng[2] = { size_zero_node, build_all_ones_cst (sizetype) };
- if (get_size_range (access_size, sizrng, true)
+ if (*sizstr
&& tree_int_cst_sgn (sizrng[0]) < 0
&& tree_int_cst_sgn (sizrng[1]) < 0)
{
/* Warn about negative sizes. */
- if (tree_int_cst_equal (sizrng[0], sizrng[1]))
- warned = warning_at (loc, OPT_Wstringop_overflow_,
- "%Kargument %i value %E is negative",
- exp, sizidx + 1, access_size);
+ if (access.second.internal_p)
+ {
+ const std::string argtypestr
+ = access.second.array_as_string (ptrtype);
+
+ arg_warned = warning_at (loc, OPT_Wstringop_overflow_,
+ "%Kbound argument %i value %s is "
+ "negative for a variable length array "
+ "argument %i of type %s",
+ exp, sizidx + 1, sizstr,
+ ptridx + 1, argtypestr.c_str ());
+ }
else
- warned = warning_at (loc, OPT_Wstringop_overflow_,
- "%Kargument %i range [%E, %E] is negative",
- exp, sizidx + 1, sizrng[0], sizrng[1]);
- if (warned)
+ arg_warned = warning_at (loc, OPT_Wstringop_overflow_,
+ "%Kargument %i value %s is negative",
+ exp, sizidx + 1, sizstr);
+
+ if (arg_warned)
{
append_attrname (access, attrstr, sizeof attrstr);
- /* Avoid warning again for the same attribute. */
+ /* Remember a warning has been issued and avoid warning
+ again below for the same attribute. */
+ any_warned = true;
continue;
}
}
@@ -2006,7 +2081,6 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp)
/* Multiply ACCESS_SIZE by the size of the type the pointer
argument points to. If it's incomplete the size is used
as is. */
- access_size = NULL_TREE;
if (tree argsize = TYPE_SIZE_UNIT (argtype))
if (TREE_CODE (argsize) == INTEGER_CST)
{
@@ -2028,35 +2102,44 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp)
different from also declaring the pointer argument with
attribute nonnull when the function accepts null pointers
only when the corresponding size is zero. */
- if (tree_int_cst_equal (sizrng[0], sizrng[1]))
- warned = warning_at (loc, OPT_Wnonnull,
- "%Kargument %i is null but "
- "the corresponding size argument %i "
- "value is %E",
- exp, ptridx + 1, sizidx + 1, access_size);
+ if (access.second.internal_p)
+ {
+ const std::string argtypestr
+ = access.second.array_as_string (ptrtype);
+
+ arg_warned = warning_at (loc, OPT_Wnonnull,
+ "%Kargument %i of variable length "
+ "array %s is null but "
+ "the corresponding bound argument "
+ "%i value is %s",
+ exp, sizidx + 1, argtypestr.c_str (),
+ ptridx + 1, sizstr);
+ }
else
- warned = warning_at (loc, OPT_Wnonnull,
- "%Kargument %i is null but "
- "the corresponding size argument %i "
- "range is [%E, %E]",
- exp, ptridx + 1, sizidx + 1,
- sizrng[0], sizrng[1]);
+ arg_warned = warning_at (loc, OPT_Wnonnull,
+ "%Kargument %i is null but "
+ "the corresponding size argument "
+ "%i value is %s",
+ exp, ptridx + 1, sizidx + 1,
+ sizstr);
}
else if (access_size && access.second.static_p)
{
/* Warn about null pointers for [static N] array arguments
but do not warn for ordinary (i.e., nonstatic) arrays. */
- warned = warning_at (loc, OPT_Wnonnull,
- "%Kargument %i to %<%T[static %E]%> null "
- "where non-null expected",
- exp, ptridx + 1, argtype,
- sizrng[0]);
+ arg_warned = warning_at (loc, OPT_Wnonnull,
+ "%Kargument %i to %<%T[static %E]%> "
+ "is null where non-null expected",
+ exp, ptridx + 1, argtype,
+ access_size);
}
- if (warned)
+ if (arg_warned)
{
append_attrname (access, attrstr, sizeof attrstr);
- /* Avoid warning again for the same attribute. */
+ /* Remember a warning has been issued and avoid warning
+ again below for the same attribute. */
+ any_warned = true;
continue;
}
}
@@ -2101,7 +2184,7 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp)
if (TREE_NO_WARNING (exp))
{
- warned = true;
+ any_warned = true;
if (access.second.internal_p)
inform (loc, "referencing argument %u of type %qT",
@@ -2124,7 +2207,7 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp)
"in a call with type %qT and attribute %qs",
fntype, attrstr);
}
- else if (warned)
+ else if (any_warned)
{
if (fndecl)
inform (DECL_SOURCE_LOCATION (fndecl),
diff --git a/gcc/calls.h b/gcc/calls.h
index dfb951c..f32b630 100644
--- a/gcc/calls.h
+++ b/gcc/calls.h
@@ -133,7 +133,17 @@ extern bool reference_callee_copied (CUMULATIVE_ARGS *,
extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]);
extern tree get_attr_nonstring_decl (tree, tree * = NULL);
extern bool maybe_warn_nonstring_arg (tree, tree);
-extern bool get_size_range (tree, tree[2], bool = false);
+enum size_range_flags
+ {
+ /* Set to consider zero a valid range. */
+ SR_ALLOW_ZERO = 1,
+ /* Set to use the largest subrange of a set of ranges as opposed
+ to the smallest. */
+ SR_USE_LARGEST = 2
+ };
+extern bool get_size_range (tree, tree[2], int = 0);
+extern bool get_size_range (class range_query *, tree, gimple *,
+ tree[2], int = 0);
extern rtx rtx_for_static_chain (const_tree, bool);
extern bool cxx17_empty_base_field_p (const_tree);
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 270a48f..d82324f 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -959,55 +959,23 @@ scale_bbs_frequencies (basic_block *bbs, int nbbs,
bbs[i]->count = bbs[i]->count.apply_probability (p);
}
-/* Helper types for hash tables. */
-
-struct htab_bb_copy_original_entry
-{
- /* Block we are attaching info to. */
- int index1;
- /* Index of original or copy (depending on the hashtable) */
- int index2;
-};
-
-struct bb_copy_hasher : nofree_ptr_hash <htab_bb_copy_original_entry>
-{
- static inline hashval_t hash (const htab_bb_copy_original_entry *);
- static inline bool equal (const htab_bb_copy_original_entry *existing,
- const htab_bb_copy_original_entry * candidate);
-};
-
-inline hashval_t
-bb_copy_hasher::hash (const htab_bb_copy_original_entry *data)
-{
- return data->index1;
-}
-
-inline bool
-bb_copy_hasher::equal (const htab_bb_copy_original_entry *data,
- const htab_bb_copy_original_entry *data2)
-{
- return data->index1 == data2->index1;
-}
-
/* Data structures used to maintain mapping between basic blocks and
copies. */
-static hash_table<bb_copy_hasher> *bb_original;
-static hash_table<bb_copy_hasher> *bb_copy;
+typedef hash_map<int_hash<int, -1, -2>, int> copy_map_t;
+static copy_map_t *bb_original;
+static copy_map_t *bb_copy;
/* And between loops and copies. */
-static hash_table<bb_copy_hasher> *loop_copy;
-static object_allocator<htab_bb_copy_original_entry> *original_copy_bb_pool;
+static copy_map_t *loop_copy;
/* Initialize the data structures to maintain mapping between blocks
and its copies. */
void
initialize_original_copy_tables (void)
{
- original_copy_bb_pool = new object_allocator<htab_bb_copy_original_entry>
- ("original_copy");
- bb_original = new hash_table<bb_copy_hasher> (10);
- bb_copy = new hash_table<bb_copy_hasher> (10);
- loop_copy = new hash_table<bb_copy_hasher> (10);
+ bb_original = new copy_map_t (10);
+ bb_copy = new copy_map_t (10);
+ loop_copy = new copy_map_t (10);
}
/* Reset the data structures to maintain mapping between blocks and
@@ -1016,7 +984,6 @@ initialize_original_copy_tables (void)
void
reset_original_copy_tables (void)
{
- gcc_assert (original_copy_bb_pool);
bb_original->empty ();
bb_copy->empty ();
loop_copy->empty ();
@@ -1027,15 +994,12 @@ reset_original_copy_tables (void)
void
free_original_copy_tables (void)
{
- gcc_assert (original_copy_bb_pool);
delete bb_copy;
bb_copy = NULL;
delete bb_original;
bb_original = NULL;
delete loop_copy;
loop_copy = NULL;
- delete original_copy_bb_pool;
- original_copy_bb_pool = NULL;
}
/* Return true iff we have had a call to initialize_original_copy_tables
@@ -1044,51 +1008,31 @@ free_original_copy_tables (void)
bool
original_copy_tables_initialized_p (void)
{
- return original_copy_bb_pool != NULL;
+ return bb_copy != NULL;
}
/* Removes the value associated with OBJ from table TAB. */
static void
-copy_original_table_clear (hash_table<bb_copy_hasher> *tab, unsigned obj)
+copy_original_table_clear (copy_map_t *tab, unsigned obj)
{
- htab_bb_copy_original_entry **slot;
- struct htab_bb_copy_original_entry key, *elt;
-
- if (!original_copy_bb_pool)
+ if (!original_copy_tables_initialized_p ())
return;
- key.index1 = obj;
- slot = tab->find_slot (&key, NO_INSERT);
- if (!slot)
- return;
-
- elt = *slot;
- tab->clear_slot (slot);
- original_copy_bb_pool->remove (elt);
+ tab->remove (obj);
}
/* Sets the value associated with OBJ in table TAB to VAL.
Do nothing when data structures are not initialized. */
static void
-copy_original_table_set (hash_table<bb_copy_hasher> *tab,
+copy_original_table_set (copy_map_t *tab,
unsigned obj, unsigned val)
{
- struct htab_bb_copy_original_entry **slot;
- struct htab_bb_copy_original_entry key;
-
- if (!original_copy_bb_pool)
+ if (!original_copy_tables_initialized_p ())
return;
- key.index1 = obj;
- slot = tab->find_slot (&key, INSERT);
- if (!*slot)
- {
- *slot = original_copy_bb_pool->allocate ();
- (*slot)->index1 = obj;
- }
- (*slot)->index2 = val;
+ tab->put (obj, val);
}
/* Set original for basic block. Do nothing when data structures are not
@@ -1103,15 +1047,11 @@ set_bb_original (basic_block bb, basic_block original)
basic_block
get_bb_original (basic_block bb)
{
- struct htab_bb_copy_original_entry *entry;
- struct htab_bb_copy_original_entry key;
-
- gcc_assert (original_copy_bb_pool);
+ gcc_assert (original_copy_tables_initialized_p ());
- key.index1 = bb->index;
- entry = bb_original->find (&key);
+ int *entry = bb_original->get (bb->index);
if (entry)
- return BASIC_BLOCK_FOR_FN (cfun, entry->index2);
+ return BASIC_BLOCK_FOR_FN (cfun, *entry);
else
return NULL;
}
@@ -1128,15 +1068,11 @@ set_bb_copy (basic_block bb, basic_block copy)
basic_block
get_bb_copy (basic_block bb)
{
- struct htab_bb_copy_original_entry *entry;
- struct htab_bb_copy_original_entry key;
+ gcc_assert (original_copy_tables_initialized_p ());
- gcc_assert (original_copy_bb_pool);
-
- key.index1 = bb->index;
- entry = bb_copy->find (&key);
+ int *entry = bb_copy->get (bb->index);
if (entry)
- return BASIC_BLOCK_FOR_FN (cfun, entry->index2);
+ return BASIC_BLOCK_FOR_FN (cfun, *entry);
else
return NULL;
}
@@ -1158,15 +1094,11 @@ set_loop_copy (class loop *loop, class loop *copy)
class loop *
get_loop_copy (class loop *loop)
{
- struct htab_bb_copy_original_entry *entry;
- struct htab_bb_copy_original_entry key;
-
- gcc_assert (original_copy_bb_pool);
+ gcc_assert (original_copy_tables_initialized_p ());
- key.index1 = loop->num;
- entry = loop_copy->find (&key);
+ int *entry = loop_copy->get (loop->num);
if (entry)
- return get_loop (cfun, entry->index2);
+ return get_loop (cfun, *entry);
else
return NULL;
}
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 1eaa1da..f3f17d3 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1762,13 +1762,6 @@ clear_tree_used (tree block)
clear_tree_used (t);
}
-enum {
- SPCT_FLAG_DEFAULT = 1,
- SPCT_FLAG_ALL = 2,
- SPCT_FLAG_STRONG = 3,
- SPCT_FLAG_EXPLICIT = 4
-};
-
/* Examine TYPE and determine a bit mask of the following features. */
#define SPCT_HAS_LARGE_CHAR_ARRAY 1
@@ -1838,11 +1831,12 @@ stack_protect_decl_phase (tree decl)
if (bits & SPCT_HAS_SMALL_CHAR_ARRAY)
has_short_buffer = true;
- if (flag_stack_protect == SPCT_FLAG_ALL
- || flag_stack_protect == SPCT_FLAG_STRONG
- || (flag_stack_protect == SPCT_FLAG_EXPLICIT
- && lookup_attribute ("stack_protect",
- DECL_ATTRIBUTES (current_function_decl))))
+ tree attribs = DECL_ATTRIBUTES (current_function_decl);
+ if (!lookup_attribute ("no_stack_protector", attribs)
+ && (flag_stack_protect == SPCT_FLAG_ALL
+ || flag_stack_protect == SPCT_FLAG_STRONG
+ || (flag_stack_protect == SPCT_FLAG_EXPLICIT
+ && lookup_attribute ("stack_protect", attribs))))
{
if ((bits & (SPCT_HAS_SMALL_CHAR_ARRAY | SPCT_HAS_LARGE_CHAR_ARRAY))
&& !(bits & SPCT_HAS_AGGREGATE))
@@ -2143,6 +2137,7 @@ expand_used_vars (void)
set are actually used by the optimized function. Lay them out. */
expand_used_vars_for_block (outer_block, true);
+ tree attribs = DECL_ATTRIBUTES (current_function_decl);
if (stack_vars_num > 0)
{
bool has_addressable_vars = false;
@@ -2152,10 +2147,10 @@ expand_used_vars (void)
/* If stack protection is enabled, we don't share space between
vulnerable data and non-vulnerable data. */
if (flag_stack_protect != 0
+ && !lookup_attribute ("no_stack_protector", attribs)
&& (flag_stack_protect != SPCT_FLAG_EXPLICIT
|| (flag_stack_protect == SPCT_FLAG_EXPLICIT
- && lookup_attribute ("stack_protect",
- DECL_ATTRIBUTES (current_function_decl)))))
+ && lookup_attribute ("stack_protect", attribs))))
has_addressable_vars = add_stack_protection_conflicts ();
if (flag_stack_protect == SPCT_FLAG_STRONG && has_addressable_vars)
@@ -2168,38 +2163,40 @@ expand_used_vars (void)
dump_stack_var_partition ();
}
- switch (flag_stack_protect)
- {
- case SPCT_FLAG_ALL:
- create_stack_guard ();
- break;
- case SPCT_FLAG_STRONG:
- if (gen_stack_protect_signal
- || cfun->calls_alloca
- || has_protected_decls
- || lookup_attribute ("stack_protect",
- DECL_ATTRIBUTES (current_function_decl)))
+ if (!lookup_attribute ("no_stack_protector", attribs))
+ switch (flag_stack_protect)
+ {
+ case SPCT_FLAG_ALL:
create_stack_guard ();
- break;
+ break;
- case SPCT_FLAG_DEFAULT:
- if (cfun->calls_alloca
- || has_protected_decls
- || lookup_attribute ("stack_protect",
- DECL_ATTRIBUTES (current_function_decl)))
- create_stack_guard ();
- break;
+ case SPCT_FLAG_STRONG:
+ if (gen_stack_protect_signal
+ || cfun->calls_alloca
+ || has_protected_decls
+ || lookup_attribute ("stack_protect",
+ DECL_ATTRIBUTES (current_function_decl)))
+ create_stack_guard ();
+ break;
- case SPCT_FLAG_EXPLICIT:
- if (lookup_attribute ("stack_protect",
- DECL_ATTRIBUTES (current_function_decl)))
- create_stack_guard ();
- break;
+ case SPCT_FLAG_DEFAULT:
+ if (cfun->calls_alloca
+ || has_protected_decls
+ || lookup_attribute ("stack_protect",
+ DECL_ATTRIBUTES (current_function_decl)))
+ create_stack_guard ();
+ break;
- default:
- break;
- }
+ case SPCT_FLAG_EXPLICIT:
+ if (lookup_attribute ("stack_protect",
+ DECL_ATTRIBUTES (current_function_decl)))
+ create_stack_guard ();
+ break;
+
+ default:
+ break;
+ }
/* Assign rtl to each variable based on these partitions. */
if (stack_vars_num > 0)
@@ -2220,11 +2217,11 @@ expand_used_vars (void)
expand_stack_vars (stack_protect_decl_phase_1, &data);
/* Phase 2 contains other kinds of arrays. */
- if (flag_stack_protect == SPCT_FLAG_ALL
- || flag_stack_protect == SPCT_FLAG_STRONG
- || (flag_stack_protect == SPCT_FLAG_EXPLICIT
- && lookup_attribute ("stack_protect",
- DECL_ATTRIBUTES (current_function_decl))))
+ if (!lookup_attribute ("no_stack_protector", attribs)
+ && (flag_stack_protect == SPCT_FLAG_ALL
+ || flag_stack_protect == SPCT_FLAG_STRONG
+ || (flag_stack_protect == SPCT_FLAG_EXPLICIT
+ && lookup_attribute ("stack_protect", attribs))))
expand_stack_vars (stack_protect_decl_phase_2, &data);
}
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 71c6b63..14c006d 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -1391,8 +1391,6 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
}
/* Redirect edges. */
- for (j = 0; j < num_edges; j++)
- new_edges[j] = NULL;
for (i = 0; i < n; i++)
{
edge_iterator ei;
@@ -1401,15 +1399,26 @@ copy_bbs (basic_block *bbs, unsigned n, basic_block *new_bbs,
FOR_EACH_EDGE (e, ei, new_bb->succs)
{
- for (j = 0; j < num_edges; j++)
- if (edges[j] && edges[j]->src == bb && edges[j]->dest == e->dest)
- new_edges[j] = e;
-
if (!(e->dest->flags & BB_DUPLICATED))
continue;
redirect_edge_and_branch_force (e, get_bb_copy (e->dest));
}
}
+ for (j = 0; j < num_edges; j++)
+ {
+ if (!edges[j])
+ new_edges[j] = NULL;
+ else
+ {
+ basic_block src = edges[j]->src;
+ basic_block dest = edges[j]->dest;
+ if (src->flags & BB_DUPLICATED)
+ src = get_bb_copy (src);
+ if (dest->flags & BB_DUPLICATED)
+ dest = get_bb_copy (dest);
+ new_edges[j] = find_edge (src, dest);
+ }
+ }
/* Clear information about duplicates. */
for (i = 0; i < n; i++)
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 7720e6e..33a26cc 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1202,10 +1202,10 @@ release_recorded_exits (function *fn)
/* Returns the list of the exit edges of a LOOP. */
-vec<edge>
+auto_vec<edge>
get_loop_exit_edges (const class loop *loop, basic_block *body)
{
- vec<edge> edges = vNULL;
+ auto_vec<edge> edges;
edge e;
unsigned i;
edge_iterator ei;
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index be97828..d14689d 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -383,7 +383,7 @@ extern basic_block *get_loop_body_in_custom_order (const class loop *,
extern basic_block *get_loop_body_in_custom_order (const class loop *, void *,
int (*) (const void *, const void *, void *));
-extern vec<edge> get_loop_exit_edges (const class loop *, basic_block * = NULL);
+extern auto_vec<edge> get_loop_exit_edges (const class loop *, basic_block * = NULL);
extern edge single_exit (const class loop *);
extern edge single_likely_exit (class loop *loop, vec<edge>);
extern unsigned num_loop_branches (const class loop *);
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 73134a2..3c9e2a0 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -126,7 +126,7 @@ fix_loop_placement (class loop *loop, bool *irred_invalidated)
{
unsigned i;
edge e;
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
class loop *father = current_loops->tree_root, *act;
bool ret = false;
@@ -157,7 +157,6 @@ fix_loop_placement (class loop *loop, bool *irred_invalidated)
ret = true;
}
- exits.release ();
return ret;
}
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index b43adaa..d1a773d 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -64,6 +64,8 @@ along with GCC; see the file COPYING3. If not see
#include "selftest.h"
#include "tree-into-ssa.h"
#include "ipa-inline.h"
+#include "tree-nested.h"
+#include "symtab-thunks.h"
/* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */
#include "tree-pass.h"
@@ -517,13 +519,8 @@ cgraph_node::create (tree decl)
node->ifunc_resolver = true;
node->register_symbol ();
+ maybe_record_nested_function (node);
- if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
- {
- node->origin = cgraph_node::get_create (DECL_CONTEXT (decl));
- node->next_nested = node->origin->nested;
- node->origin->nested = node;
- }
return node;
}
@@ -633,15 +630,17 @@ cgraph_node::create_thunk (tree alias, tree, bool this_adjusting,
? virtual_value == wi::to_wide (virtual_offset)
: virtual_value == 0);
- node->thunk.fixed_offset = fixed_offset;
- node->thunk.virtual_value = virtual_value;
- node->thunk.indirect_offset = indirect_offset;
- node->thunk.alias = real_alias;
- node->thunk.this_adjusting = this_adjusting;
- node->thunk.virtual_offset_p = virtual_offset != NULL;
- node->thunk.thunk_p = true;
+ node->thunk = true;
node->definition = true;
+ thunk_info *i = thunk_info::get_create (node);
+ i->fixed_offset = fixed_offset;
+ i->virtual_value = virtual_value;
+ i->indirect_offset = indirect_offset;
+ i->alias = real_alias;
+ i->this_adjusting = this_adjusting;
+ i->virtual_offset_p = virtual_offset != NULL;
+
return node;
}
@@ -914,7 +913,7 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
= decl_maybe_in_construction_p (NULL, NULL, call_stmt,
caller->decl);
else
- edge->in_polymorphic_cdtor = caller->thunk.thunk_p;
+ edge->in_polymorphic_cdtor = caller->thunk;
if (callee)
caller->calls_declare_variant_alt |= callee->declare_variant_alt;
@@ -1861,22 +1860,7 @@ cgraph_node::remove (void)
*/
force_output = false;
forced_by_abi = false;
- cgraph_node *next;
- for (cgraph_node *n = nested; n; n = next)
- {
- next = n->next_nested;
- n->origin = NULL;
- n->next_nested = NULL;
- }
- nested = NULL;
- if (origin)
- {
- cgraph_node **node2 = &origin->nested;
- while (*node2 != this)
- node2 = &(*node2)->next_nested;
- *node2 = next_nested;
- }
unregister ();
if (prev_sibling_clone)
prev_sibling_clone->next_sibling_clone = next_sibling_clone;
@@ -2072,6 +2056,20 @@ cgraph_edge::dump_edge_flags (FILE *f)
fprintf (f, "(can throw external) ");
}
+/* Dump edge to stderr. */
+
+void
+cgraph_edge::debug (void)
+{
+ fprintf (stderr, "%s -> %s ", caller->dump_asm_name (),
+ callee == NULL ? "(null)" : callee->dump_asm_name ());
+ dump_edge_flags (stderr);
+ fprintf (stderr, "\n\n");
+ caller->debug ();
+ if (callee != NULL)
+ callee->debug ();
+}
+
/* Dump call graph node to file F. */
void
@@ -2125,7 +2123,7 @@ cgraph_node::dump (FILE *f)
}
if (tp_first_run > 0)
fprintf (f, " first_run:%" PRId64, (int64_t) tp_first_run);
- if (origin)
+ if (cgraph_node *origin = nested_function_origin (this))
fprintf (f, " nested in:%s", origin->dump_asm_name ());
if (gimple_has_body_p (decl))
fprintf (f, " body");
@@ -2178,37 +2176,17 @@ cgraph_node::dump (FILE *f)
fprintf (f, "\n");
- if (thunk.thunk_p)
+ if (thunk)
{
fprintf (f, " Thunk");
- if (thunk.alias)
- fprintf (f, " of %s (asm:%s)",
- lang_hooks.decl_printable_name (thunk.alias, 2),
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk.alias)));
- fprintf (f, " fixed offset %i virtual value %i indirect_offset %i "
- "has virtual offset %i\n",
- (int)thunk.fixed_offset,
- (int)thunk.virtual_value,
- (int)thunk.indirect_offset,
- (int)thunk.virtual_offset_p);
+ thunk_info::get (this)->dump (f);
}
else if (former_thunk_p ())
- fprintf (f, " Former thunk fixed offset %i virtual value %i "
- "indirect_offset %i has virtual offset %i\n",
- (int)thunk.fixed_offset,
- (int)thunk.virtual_value,
- (int)thunk.indirect_offset,
- (int)thunk.virtual_offset_p);
- if (alias && thunk.alias
- && DECL_P (thunk.alias))
{
- fprintf (f, " Alias of %s",
- lang_hooks.decl_printable_name (thunk.alias, 2));
- if (DECL_ASSEMBLER_NAME_SET_P (thunk.alias))
- fprintf (f, " (asm:%s)",
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk.alias)));
- fprintf (f, "\n");
+ fprintf (f, " Former thunk ");
+ thunk_info::get (this)->dump (f);
}
+ else gcc_checking_assert (!thunk_info::get (this));
fprintf (f, " Called by: ");
@@ -2272,18 +2250,17 @@ cgraph_node::dump (FILE *f)
edge->dump_edge_flags (f);
if (edge->indirect_info->param_index != -1)
{
- fprintf (f, " of param:%i", edge->indirect_info->param_index);
+ fprintf (f, "of param:%i ", edge->indirect_info->param_index);
if (edge->indirect_info->agg_contents)
- fprintf (f, " loaded from %s %s at offset %i",
+ fprintf (f, "loaded from %s %s at offset %i ",
edge->indirect_info->member_ptr ? "member ptr" : "aggregate",
edge->indirect_info->by_ref ? "passed by reference":"",
(int)edge->indirect_info->offset);
if (edge->indirect_info->vptr_changed)
- fprintf (f, " (vptr maybe changed)");
+ fprintf (f, "(vptr maybe changed) ");
}
- fprintf (f, " Num speculative call targets: %i",
+ fprintf (f, "num speculative call targets: %i\n",
edge->indirect_info->num_speculative_call_targets);
- fprintf (f, "\n");
if (edge->indirect_info->polymorphic)
edge->indirect_info->context.dump (f);
}
@@ -2335,19 +2312,6 @@ cgraph_function_possibly_inlined_p (tree decl)
return DECL_POSSIBLY_INLINED (decl);
}
-/* cgraph_node is no longer nested function; update cgraph accordingly. */
-void
-cgraph_node::unnest (void)
-{
- cgraph_node **node2 = &origin->nested;
- gcc_assert (origin);
-
- while (*node2 != this)
- node2 = &(*node2)->next_nested;
- *node2 = next_nested;
- origin = NULL;
-}
-
/* Return function availability. See cgraph.h for description of individual
return values. */
enum availability
@@ -2463,11 +2427,11 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback)
if (avail <= AVAIL_INTERPOSABLE)
return false;
for (e = callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p
+ if (e->caller->thunk
&& (include_overwritable
|| e->caller->get_availability () > AVAIL_INTERPOSABLE)
&& !(exclude_virtual_thunks
- && e->caller->thunk.virtual_offset_p))
+ && thunk_info::get (e->caller)->virtual_offset_p))
if (e->caller->call_for_symbol_thunks_and_aliases (callback, data,
include_overwritable,
exclude_virtual_thunks))
@@ -2541,7 +2505,7 @@ set_nothrow_flag_1 (cgraph_node *node, bool nothrow, bool non_call,
set_nothrow_flag_1 (alias, nothrow, non_call, changed);
}
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p
+ if (e->caller->thunk
&& (!nothrow || e->caller->get_availability () > AVAIL_INTERPOSABLE))
set_nothrow_flag_1 (e->caller, nothrow, non_call, changed);
}
@@ -2590,7 +2554,7 @@ set_malloc_flag_1 (cgraph_node *node, bool malloc_p, bool *changed)
}
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p
+ if (e->caller->thunk
&& (!malloc_p || e->caller->get_availability () > AVAIL_INTERPOSABLE))
set_malloc_flag_1 (e->caller, malloc_p, changed);
}
@@ -2709,13 +2673,13 @@ set_const_flag_1 (cgraph_node *node, bool set_const, bool looping,
set_const_flag_1 (alias, set_const, looping, changed);
}
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p
+ if (e->caller->thunk
&& (!set_const || e->caller->get_availability () > AVAIL_INTERPOSABLE))
{
/* Virtual thunks access virtual offset in the vtable, so they can
only be pure, never const. */
if (set_const
- && (e->caller->thunk.virtual_offset_p
+ && (thunk_info::get (e->caller)->virtual_offset_p
|| !node->binds_to_current_def_p (e->caller)))
*changed |= e->caller->set_pure_flag (true, looping);
else
@@ -3059,7 +3023,7 @@ collect_callers_of_node_1 (cgraph_node *node, void *data)
if (avail > AVAIL_INTERPOSABLE)
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
if (!cs->indirect_inlining_edge
- && !cs->caller->thunk.thunk_p)
+ && !cs->caller->thunk)
redirect_callers->safe_push (cs);
return false;
}
@@ -3090,7 +3054,7 @@ clone_of_p (cgraph_node *node, cgraph_node *node2)
|| node2->former_clone_of == node->decl)
return true;
- if (!node->thunk.thunk_p && !node->former_thunk_p ())
+ if (!node->thunk && !node->former_thunk_p ())
{
while (node2 && node->decl != node2->decl)
node2 = node2->clone_of;
@@ -3100,9 +3064,9 @@ clone_of_p (cgraph_node *node, cgraph_node *node2)
/* There are no virtual clones of thunks so check former_clone_of or if we
might have skipped thunks because this adjustments are no longer
necessary. */
- while (node->thunk.thunk_p || node->former_thunk_p ())
+ while (node->thunk || node->former_thunk_p ())
{
- if (!node->thunk.this_adjusting)
+ if (!thunk_info::get (node)->this_adjusting)
return false;
/* In case of instrumented expanded thunks, which can have multiple calls
in them, we do not know how to continue and just have to be
@@ -3666,7 +3630,7 @@ cgraph_node::verify_node (void)
}
}
- if (analyzed && thunk.thunk_p)
+ if (analyzed && thunk)
{
if (!callees)
{
@@ -3785,27 +3749,32 @@ cgraph_node::verify_node (void)
}
}
- if (nested != NULL)
+ if (nested_function_info *info = nested_function_info::get (this))
{
- for (cgraph_node *n = nested; n != NULL; n = n->next_nested)
+ if (info->nested != NULL)
{
- if (n->origin == NULL)
+ for (cgraph_node *n = info->nested; n != NULL;
+ n = next_nested_function (n))
{
- error ("missing origin for a node in a nested list");
- error_found = true;
- }
- else if (n->origin != this)
- {
- error ("origin points to a different parent");
- error_found = true;
- break;
+ nested_function_info *ninfo = nested_function_info::get (n);
+ if (ninfo->origin == NULL)
+ {
+ error ("missing origin for a node in a nested list");
+ error_found = true;
+ }
+ else if (ninfo->origin != this)
+ {
+ error ("origin points to a different parent");
+ error_found = true;
+ break;
+ }
}
}
- }
- if (next_nested != NULL && origin == NULL)
- {
- error ("missing origin for a node in a nested list");
- error_found = true;
+ if (info->next_nested != NULL && info->origin == NULL)
+ {
+ error ("missing origin for a node in a nested list");
+ error_found = true;
+ }
}
if (error_found)
@@ -3845,7 +3814,7 @@ cgraph_node::function_symbol (enum availability *availability,
{
cgraph_node *node = ultimate_alias_target (availability, ref);
- while (node->thunk.thunk_p)
+ while (node->thunk)
{
enum availability a;
@@ -3872,7 +3841,7 @@ cgraph_node::function_or_virtual_thunk_symbol
{
cgraph_node *node = ultimate_alias_target (availability, ref);
- while (node->thunk.thunk_p && !node->thunk.virtual_offset_p)
+ while (node->thunk && !thunk_info::get (node)->virtual_offset_p)
{
enum availability a;
@@ -3886,16 +3855,27 @@ cgraph_node::function_or_virtual_thunk_symbol
}
/* When doing LTO, read cgraph_node's body from disk if it is not already
- present. */
+ present. Also perform any necessary clone materializations. */
bool
-cgraph_node::get_untransformed_body (void)
+cgraph_node::get_untransformed_body ()
{
lto_file_decl_data *file_data;
const char *data, *name;
size_t len;
tree decl = this->decl;
+ /* See if there is clone to be materialized.
+ (inline clones does not need materialization, but we can be seeing
+ an inline clone of real clone). */
+ cgraph_node *p = this;
+ for (cgraph_node *c = clone_of; c; c = c->clone_of)
+ {
+ if (c->decl != decl)
+ p->materialize_clone ();
+ p = c;
+ }
+
/* Check if body is already there. Either we have gimple body or
the function is thunk and in that case we set DECL_ARGUMENTS. */
if (DECL_ARGUMENTS (decl) || gimple_has_body_p (decl))
@@ -4009,6 +3989,8 @@ cgraph_node::get_fun () const
void
cgraph_c_finalize (void)
{
+ nested_function_info::release ();
+ thunk_info::release ();
symtab = NULL;
x_cgraph_nodes_queue = NULL;
@@ -4044,7 +4026,7 @@ bool
cgraph_node::has_thunk_p (cgraph_node *node, void *)
{
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p)
+ if (e->caller->thunk)
return true;
return false;
}
@@ -4116,6 +4098,21 @@ cgraph_node::check_calls_comdat_local_p ()
return false;
}
+/* Return true if this node represents a former, i.e. an expanded, thunk. */
+
+bool
+cgraph_node::former_thunk_p (void)
+{
+ if (thunk)
+ return false;
+ thunk_info *i = thunk_info::get (this);
+ if (!i)
+ return false;
+ gcc_checking_assert (i->fixed_offset || i->virtual_offset_p
+ || i->indirect_offset);
+ return true;
+}
+
/* A stashed copy of "symtab" for use by selftest::symbol_table_test.
This needs to be a global so that it can be a GC root, and thus
prevent the stashed copy from being garbage-collected if the GC runs
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 0211f08..9eb48d5 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -681,52 +681,6 @@ extern const char * const cgraph_availability_names[];
extern const char * const ld_plugin_symbol_resolution_names[];
extern const char * const tls_model_names[];
-/* Sub-structure of cgraph_node. Holds information about thunk, used only for
- same body aliases.
-
- Thunks are basically wrappers around methods which are introduced in case
- of multiple inheritance in order to adjust the value of the "this" pointer
- or of the returned value.
-
- In the case of this-adjusting thunks, each back-end can override the
- can_output_mi_thunk/output_mi_thunk target hooks to generate a minimal thunk
- (with a tail call for instance) directly as assembly. For the default hook
- or for the case where the can_output_mi_thunk hooks return false, the thunk
- is gimplified and lowered using the regular machinery. */
-
-struct GTY(()) cgraph_thunk_info {
- /* Offset used to adjust "this". */
- HOST_WIDE_INT fixed_offset;
-
- /* Offset in the virtual table to get the offset to adjust "this". Valid iff
- VIRTUAL_OFFSET_P is true. */
- HOST_WIDE_INT virtual_value;
-
- /* Offset from "this" to get the offset to adjust "this". Zero means: this
- offset is to be ignored. */
- HOST_WIDE_INT indirect_offset;
-
- /* Thunk target, i.e. the method that this thunk wraps. Depending on the
- TARGET_USE_LOCAL_THUNK_ALIAS_P macro, this may have to be a new alias. */
- tree alias;
-
- /* Nonzero for a "this" adjusting thunk and zero for a result adjusting
- thunk. */
- bool this_adjusting;
-
- /* If true, this thunk is what we call a virtual thunk. In this case:
- * for this-adjusting thunks, after the FIXED_OFFSET based adjustment is
- done, add to the result the offset found in the vtable at:
- vptr + VIRTUAL_VALUE
- * for result-adjusting thunks, the FIXED_OFFSET adjustment is done after
- the virtual one. */
- bool virtual_offset_p;
-
- /* Set to true when alias node (the cgraph_node to which this struct belong)
- is a thunk. Access to any other fields is invalid if this is false. */
- bool thunk_p;
-};
-
/* Represent which DECL tree (or reference to such tree)
will be replaced by another tree while versioning. */
struct GTY(()) ipa_replace_map
@@ -921,14 +875,15 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Constructor. */
explicit cgraph_node (int uid)
: symtab_node (SYMTAB_FUNCTION), callees (NULL), callers (NULL),
- indirect_calls (NULL), origin (NULL), nested (NULL), next_nested (NULL),
+ indirect_calls (NULL),
next_sibling_clone (NULL), prev_sibling_clone (NULL), clones (NULL),
clone_of (NULL), call_site_hash (NULL), former_clone_of (NULL),
simdclone (NULL), simd_clones (NULL), ipa_transforms_to_apply (vNULL),
- inlined_to (NULL), rtl (NULL), clone (), thunk (),
+ inlined_to (NULL), rtl (NULL), clone (),
count (profile_count::uninitialized ()),
count_materialization_scale (REG_BR_PROB_BASE), profile_id (0),
- unit_id (0), tp_first_run (0), used_as_abstract_origin (false),
+ unit_id (0), tp_first_run (0), thunk (false),
+ used_as_abstract_origin (false),
lowered (false), process (false), frequency (NODE_FREQUENCY_NORMAL),
only_called_at_startup (false), only_called_at_exit (false),
tm_clone (false), dispatcher_function (false), calls_comdat_local (false),
@@ -1078,7 +1033,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Add thunk alias into callgraph. The alias declaration is ALIAS and it
aliases DECL with an adjustments made into the first parameter.
- See comments in struct cgraph_thunk_info for detail on the parameters. */
+ See comments in struct symtab-thunks.h for detail on the parameters. */
cgraph_node * create_thunk (tree alias, tree, bool this_adjusting,
HOST_WIDE_INT fixed_offset,
HOST_WIDE_INT virtual_value,
@@ -1099,13 +1054,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
cgraph_node *ultimate_alias_target (availability *availability = NULL,
symtab_node *ref = NULL);
- /* Expand thunk NODE to gimple if possible.
- When FORCE_GIMPLE_THUNK is true, gimple thunk is created and
- no assembler is produced.
- When OUTPUT_ASM_THUNK is true, also produce assembler for
- thunks that are not lowered. */
- bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk);
-
/* Call expand_thunk on all callers that are thunks and analyze those
nodes that were expanded. */
void expand_all_artificial_thunks ();
@@ -1145,12 +1093,14 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* When doing LTO, read cgraph_node's body from disk if it is not already
present. */
- bool get_untransformed_body (void);
+ bool get_untransformed_body ();
/* Prepare function body. When doing LTO, read cgraph_node's body from disk
if it is not already present. When some IPA transformations are scheduled,
apply them. */
- bool get_body (void);
+ bool get_body ();
+
+ void materialize_clone (void);
/* Release memory used to represent body of function.
Use this only for functions that are released before being translated to
@@ -1161,9 +1111,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Return the DECL_STRUCT_FUNCTION of the function. */
struct function *get_fun () const;
- /* cgraph_node is no longer nested function; update cgraph accordingly. */
- void unnest (void);
-
/* Bring cgraph node local. */
void make_local (void);
@@ -1325,7 +1272,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
inline bool has_gimple_body_p (void);
/* Return true if this node represents a former, i.e. an expanded, thunk. */
- inline bool former_thunk_p (void);
+ bool former_thunk_p (void);
/* Check if function calls comdat local. This is used to recompute
calls_comdat_local flag after function transformations. */
@@ -1436,13 +1383,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* List of edges representing indirect calls with a yet undetermined
callee. */
cgraph_edge *indirect_calls;
- /* For nested functions points to function the node is nested in. */
- cgraph_node *origin;
- /* Points to first nested function, if any. */
- cgraph_node *nested;
- /* Pointer to the next function with same origin, if any. */
- cgraph_node *next_nested;
- /* Pointer to the next clone. */
cgraph_node *next_sibling_clone;
cgraph_node *prev_sibling_clone;
cgraph_node *clones;
@@ -1470,7 +1410,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
struct cgraph_rtl_info *rtl;
cgraph_clone_info clone;
- cgraph_thunk_info thunk;
/* Expected number of executions: calculated in profile.c. */
profile_count count;
@@ -1484,6 +1423,8 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Time profiler: first run of function. */
int tp_first_run;
+ /* True when symbol is a thunk. */
+ unsigned thunk : 1;
/* Set when decl is an abstract function pointed to by the
ABSTRACT_DECL_ORIGIN of a reachable function. */
unsigned used_as_abstract_origin : 1;
@@ -2022,6 +1963,9 @@ private:
/* Output flags of edge to a file F. */
void dump_edge_flags (FILE *f);
+ /* Dump edge to stderr. */
+ void DEBUG_FUNCTION debug (void);
+
/* Verify that call graph edge corresponds to DECL from the associated
statement. Return true if the verification should fail. */
bool verify_corresponds_to_fndecl (tree decl);
@@ -2246,6 +2190,10 @@ struct asmname_hasher : ggc_ptr_hash <symtab_node>
static bool equal (symtab_node *n, const_tree t);
};
+struct thunk_info;
+template <class T> class function_summary;
+typedef function_summary <thunk_info *> thunk_summary;
+
class GTY((tag ("SYMTAB"))) symbol_table
{
public:
@@ -2262,6 +2210,7 @@ public:
function_flags_ready (false), cpp_implicit_aliases_done (false),
section_hash (NULL), assembler_name_hash (NULL), init_priority_hash (NULL),
dump_file (NULL), ipa_clones_dump_file (NULL), cloned_nodes (),
+ m_thunks (NULL),
m_first_edge_removal_hook (NULL), m_first_cgraph_removal_hook (NULL),
m_first_edge_duplicated_hook (NULL), m_first_cgraph_duplicated_hook (NULL),
m_first_cgraph_insertion_hook (NULL), m_first_varpool_insertion_hook (NULL),
@@ -2293,13 +2242,6 @@ public:
functions inserted into callgraph already at construction time. */
void process_new_functions (void);
- /* Once all functions from compilation unit are in memory, produce all clones
- and update all calls. We might also do this on demand if we don't want to
- bring all functions to memory prior compilation, but current WHOPR
- implementation does that and it is bit easier to keep everything right
- in this order. */
- void materialize_all_clones (void);
-
/* Register a symbol NODE. */
inline void register_symbol (symtab_node *node);
@@ -2550,6 +2492,9 @@ public:
hash_set <const cgraph_node *> GTY ((skip)) cloned_nodes;
+ /* Thunk annotations. */
+ thunk_summary *m_thunks;
+
private:
/* Allocate a cgraph_edge structure and fill it with data according to the
parameters of which only CALLEE can be NULL (when creating an indirect
@@ -2624,6 +2569,9 @@ cgraph_inline_failed_type_t cgraph_inline_failed_type (cgraph_inline_failed_t);
void cgraphunit_c_finalize (void);
int tp_first_run_node_cmp (const void *pa, const void *pb);
+/* In symtab-thunks.cc */
+void symtab_thunks_cc_finalize (void);
+
/* Initialize datastructures so DECL is a function in lowered gimple form.
IN_SSA is true if the gimple is in SSA. */
basic_block init_lowered_empty_function (tree, bool, profile_count);
@@ -3094,18 +3042,7 @@ symbol_table::next_function_with_gimple_body (cgraph_node *node)
inline bool
cgraph_node::has_gimple_body_p (void)
{
- return definition && !thunk.thunk_p && !alias;
-}
-
-/* Return true if this node represents a former, i.e. an expanded, thunk. */
-
-inline bool
-cgraph_node::former_thunk_p (void)
-{
- return (!thunk.thunk_p
- && (thunk.fixed_offset
- || thunk.virtual_offset_p
- || thunk.indirect_offset));
+ return definition && !thunk && !alias;
}
/* Walk all functions with body defined. */
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index db61c21..41c6efb 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -85,6 +85,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-vrp.h"
#include "ipa-prop.h"
#include "ipa-fnsummary.h"
+#include "symtab-thunks.h"
/* Create clone of edge in the node N represented by CALL_EXPR
the callgraph. */
@@ -183,28 +184,28 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
cgraph_node *new_thunk, *thunk_of;
thunk_of = thunk->callees->callee->ultimate_alias_target ();
- if (thunk_of->thunk.thunk_p)
+ if (thunk_of->thunk)
node = duplicate_thunk_for_node (thunk_of, node);
if (!DECL_ARGUMENTS (thunk->decl))
thunk->get_untransformed_body ();
+ thunk_info *i = thunk_info::get (thunk);
cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
- if (cs->caller->thunk.thunk_p
- && cs->caller->thunk.fixed_offset == thunk->thunk.fixed_offset
- && cs->caller->thunk.virtual_value == thunk->thunk.virtual_value
- && cs->caller->thunk.indirect_offset == thunk->thunk.indirect_offset
- && cs->caller->thunk.this_adjusting == thunk->thunk.this_adjusting
- && cs->caller->thunk.virtual_offset_p == thunk->thunk.virtual_offset_p)
- return cs->caller;
+ if (cs->caller->thunk)
+ {
+ thunk_info *i2 = thunk_info::get (cs->caller);
+ if (*i2 == *i)
+ return cs->caller;
+ }
tree new_decl;
if (node->clone.param_adjustments)
{
/* We do not need to duplicate this_adjusting thunks if we have removed
this. */
- if (thunk->thunk.this_adjusting
+ if (i->this_adjusting
&& !node->clone.param_adjustments->first_param_intact_p ())
return node;
@@ -256,7 +257,7 @@ void
cgraph_edge::redirect_callee_duplicating_thunks (cgraph_node *n)
{
cgraph_node *orig_to = callee->ultimate_alias_target ();
- if (orig_to->thunk.thunk_p)
+ if (orig_to->thunk)
n = duplicate_thunk_for_node (orig_to, n);
redirect_callee (n);
@@ -270,14 +271,14 @@ cgraph_node::expand_all_artificial_thunks ()
{
cgraph_edge *e;
for (e = callers; e;)
- if (e->caller->thunk.thunk_p)
+ if (e->caller->thunk)
{
cgraph_node *thunk = e->caller;
e = e->next_caller;
- if (thunk->expand_thunk (false, false))
+ if (expand_thunk (thunk, false, false))
{
- thunk->thunk.thunk_p = false;
+ thunk->thunk = false;
thunk->analyze ();
ipa_analyze_node (thunk);
inline_analyze_function (thunk);
@@ -382,13 +383,7 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count,
}
new_node->decl = new_decl;
new_node->register_symbol ();
- new_node->origin = origin;
new_node->lto_file_data = lto_file_data;
- if (new_node->origin)
- {
- new_node->next_nested = new_node->origin->nested;
- new_node->origin->nested = new_node;
- }
new_node->analyzed = analyzed;
new_node->definition = definition;
new_node->versionable = versionable;
@@ -818,7 +813,7 @@ cgraph_node::create_edge_including_clones (cgraph_node *callee,
if (node)
while (node != this)
/* Thunk clones do not get updated while copying inline function body. */
- if (!node->thunk.thunk_p)
+ if (!node->thunk)
{
cgraph_edge *edge = node->get_edge (old_stmt);
@@ -1089,114 +1084,57 @@ void cgraph_node::remove_from_clone_tree ()
/* Given virtual clone, turn it into actual clone. */
-static void
-cgraph_materialize_clone (cgraph_node *node)
-{
- bitmap_obstack_initialize (NULL);
- node->former_clone_of = node->clone_of->decl;
- if (node->clone_of->former_clone_of)
- node->former_clone_of = node->clone_of->former_clone_of;
- /* Copy the OLD_VERSION_NODE function tree to the new version. */
- tree_function_versioning (node->clone_of->decl, node->decl,
- node->clone.tree_map, node->clone.param_adjustments,
- true, NULL, NULL);
- if (symtab->dump_file)
- {
- dump_function_to_file (node->clone_of->decl, symtab->dump_file,
- dump_flags);
- dump_function_to_file (node->decl, symtab->dump_file, dump_flags);
- }
-
- cgraph_node *clone_of = node->clone_of;
- /* Function is no longer clone. */
- node->remove_from_clone_tree ();
- if (!clone_of->analyzed && !clone_of->clones)
- {
- clone_of->release_body ();
- clone_of->remove_callees ();
- clone_of->remove_all_references ();
- }
- bitmap_obstack_release (NULL);
-}
-
-/* Once all functions from compilation unit are in memory, produce all clones
- and update all calls. We might also do this on demand if we don't want to
- bring all functions to memory prior compilation, but current WHOPR
- implementation does that and it is a bit easier to keep everything right in
- this order. */
-
void
-symbol_table::materialize_all_clones (void)
+cgraph_node::materialize_clone ()
{
- cgraph_node *node;
- bool stabilized = false;
-
-
+ clone_of->get_untransformed_body ();
+ former_clone_of = clone_of->decl;
+ if (clone_of->former_clone_of)
+ former_clone_of = clone_of->former_clone_of;
if (symtab->dump_file)
- fprintf (symtab->dump_file, "Materializing clones\n");
-
- cgraph_node::checking_verify_cgraph_nodes ();
-
- /* We can also do topological order, but number of iterations should be
- bounded by number of IPA passes since single IPA pass is probably not
- going to create clones of clones it created itself. */
- while (!stabilized)
{
- stabilized = true;
- FOR_EACH_FUNCTION (node)
+ fprintf (symtab->dump_file, "cloning %s to %s\n",
+ clone_of->dump_name (),
+ dump_name ());
+ if (clone.tree_map)
{
- if (node->clone_of && node->decl != node->clone_of->decl
- && !gimple_has_body_p (node->decl))
+ fprintf (symtab->dump_file, " replace map:");
+ for (unsigned int i = 0;
+ i < vec_safe_length (clone.tree_map);
+ i++)
{
- if (!node->clone_of->clone_of)
- node->clone_of->get_untransformed_body ();
- if (gimple_has_body_p (node->clone_of->decl))
- {
- if (symtab->dump_file)
- {
- fprintf (symtab->dump_file, "cloning %s to %s\n",
- node->clone_of->dump_name (),
- node->dump_name ());
- if (node->clone.tree_map)
- {
- unsigned int i;
- fprintf (symtab->dump_file, " replace map:");
- for (i = 0;
- i < vec_safe_length (node->clone.tree_map);
- i++)
- {
- ipa_replace_map *replace_info;
- replace_info = (*node->clone.tree_map)[i];
- fprintf (symtab->dump_file, "%s %i -> ",
- i ? "," : "", replace_info->parm_num);
- print_generic_expr (symtab->dump_file,
- replace_info->new_tree);
- }
- fprintf (symtab->dump_file, "\n");
- }
- if (node->clone.param_adjustments)
- node->clone.param_adjustments->dump (symtab->dump_file);
- }
- cgraph_materialize_clone (node);
- stabilized = false;
- }
+ ipa_replace_map *replace_info;
+ replace_info = (*clone.tree_map)[i];
+ fprintf (symtab->dump_file, "%s %i -> ",
+ i ? "," : "", replace_info->parm_num);
+ print_generic_expr (symtab->dump_file,
+ replace_info->new_tree);
}
+ fprintf (symtab->dump_file, "\n");
}
+ if (clone.param_adjustments)
+ clone.param_adjustments->dump (symtab->dump_file);
}
- FOR_EACH_FUNCTION (node)
- if (!node->analyzed && node->callees)
- {
- node->remove_callees ();
- node->remove_all_references ();
- }
- else
- node->clear_stmts_in_references ();
+ /* Copy the OLD_VERSION_NODE function tree to the new version. */
+ tree_function_versioning (clone_of->decl, decl,
+ clone.tree_map, clone.param_adjustments,
+ true, NULL, NULL);
if (symtab->dump_file)
- fprintf (symtab->dump_file, "Materialization Call site updates done.\n");
-
- cgraph_node::checking_verify_cgraph_nodes ();
+ {
+ dump_function_to_file (clone_of->decl, symtab->dump_file,
+ dump_flags);
+ dump_function_to_file (decl, symtab->dump_file, dump_flags);
+ }
- symtab->remove_unreachable_nodes (symtab->dump_file);
+ cgraph_node *this_clone_of = clone_of;
+ /* Function is no longer clone. */
+ remove_from_clone_tree ();
+ if (!this_clone_of->analyzed && !this_clone_of->clones)
+ {
+ this_clone_of->release_body ();
+ this_clone_of->remove_callees ();
+ this_clone_of->remove_all_references ();
+ }
}
#include "gt-cgraphclones.h"
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index bedb6e2..d2d98c8 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -207,6 +207,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "ipa-inline.h"
#include "omp-offload.h"
+#include "symtab-thunks.h"
/* Queue of cgraph nodes scheduled to be added into cgraph. This is a
secondary queue used during optimization to accommodate passes that
@@ -217,9 +218,6 @@ static void expand_all_functions (void);
static void mark_functions_to_output (void);
static void handle_alias_pairs (void);
-/* Used for vtable lookup in thunk adjusting. */
-static GTY (()) tree vtable_entry_type;
-
/* Return true if this symbol is a function from the C frontend specified
directly in RTL form (with "__RTL"). */
@@ -619,9 +617,10 @@ cgraph_node::analyze (void)
location_t saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
- if (thunk.thunk_p)
+ if (thunk)
{
- cgraph_node *t = cgraph_node::get (thunk.alias);
+ thunk_info *info = thunk_info::get (this);
+ cgraph_node *t = cgraph_node::get (info->alias);
create_edge (t, NULL, t->count);
callees->can_throw_external = !TREE_NOTHROW (t->decl);
@@ -635,8 +634,8 @@ cgraph_node::analyze (void)
if (!t->analyzed && t->definition)
t->analyze ();
}
- bool ret = expand_thunk (false, false);
- thunk.alias = NULL;
+ bool ret = expand_thunk (this, false, false);
+ thunk_info::get (this)->alias = NULL;
if (!ret)
return;
}
@@ -673,9 +672,8 @@ cgraph_node::analyze (void)
/* Lower the function. */
if (!lowered)
{
- if (nested)
+ if (first_nested_function (this))
lower_nested_functions (decl);
- gcc_assert (!nested);
gimple_register_cfg_hooks ();
bitmap_obstack_initialize (NULL);
@@ -1223,7 +1221,7 @@ analyze_functions (bool first_time)
See gcc.c-torture/compile/20011119-1.c */
if (!DECL_STRUCT_FUNCTION (decl)
&& !cnode->alias
- && !cnode->thunk.thunk_p
+ && !cnode->thunk
&& !cnode->dispatcher_function)
{
cnode->reset ();
@@ -1378,10 +1376,10 @@ analyze_functions (bool first_time)
if (cnode->definition && !gimple_has_body_p (decl)
&& !cnode->alias
- && !cnode->thunk.thunk_p)
+ && !cnode->thunk)
cnode->reset ();
- gcc_assert (!cnode->definition || cnode->thunk.thunk_p
+ gcc_assert (!cnode->definition || cnode->thunk
|| cnode->alias
|| gimple_has_body_p (decl)
|| cnode->native_rtl_p ());
@@ -1602,6 +1600,7 @@ mark_functions_to_output (void)
FOR_EACH_FUNCTION (node)
{
tree decl = node->decl;
+ node->clear_stmts_in_references ();
gcc_assert (!node->process || node->same_comdat_group);
if (node->process)
@@ -1611,7 +1610,7 @@ mark_functions_to_output (void)
always inlined, as well as those that are reachable from
outside the current compilation unit. */
if (node->analyzed
- && !node->thunk.thunk_p
+ && !node->thunk
&& !node->alias
&& !node->inlined_to
&& !TREE_ASM_WRITTEN (decl)
@@ -1624,7 +1623,7 @@ mark_functions_to_output (void)
for (next = dyn_cast<cgraph_node *> (node->same_comdat_group);
next != node;
next = dyn_cast<cgraph_node *> (next->same_comdat_group))
- if (!next->thunk.thunk_p && !next->alias
+ if (!next->thunk && !next->alias
&& !next->comdat_local_p ())
next->process = 1;
}
@@ -1733,487 +1732,6 @@ init_lowered_empty_function (tree decl, bool in_ssa, profile_count count)
return bb;
}
-/* Adjust PTR by the constant FIXED_OFFSET, by the vtable offset indicated by
- VIRTUAL_OFFSET, and by the indirect offset indicated by INDIRECT_OFFSET, if
- it is non-null. THIS_ADJUSTING is nonzero for a this adjusting thunk and zero
- for a result adjusting thunk. */
-
-tree
-thunk_adjust (gimple_stmt_iterator * bsi,
- tree ptr, bool this_adjusting,
- HOST_WIDE_INT fixed_offset, tree virtual_offset,
- HOST_WIDE_INT indirect_offset)
-{
- gassign *stmt;
- tree ret;
-
- if (this_adjusting
- && fixed_offset != 0)
- {
- stmt = gimple_build_assign
- (ptr, fold_build_pointer_plus_hwi_loc (input_location,
- ptr,
- fixed_offset));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
- }
-
- if (!vtable_entry_type && (virtual_offset || indirect_offset != 0))
- {
- tree vfunc_type = make_node (FUNCTION_TYPE);
- TREE_TYPE (vfunc_type) = integer_type_node;
- TYPE_ARG_TYPES (vfunc_type) = NULL_TREE;
- layout_type (vfunc_type);
-
- vtable_entry_type = build_pointer_type (vfunc_type);
- }
-
- /* If there's a virtual offset, look up that value in the vtable and
- adjust the pointer again. */
- if (virtual_offset)
- {
- tree vtabletmp;
- tree vtabletmp2;
- tree vtabletmp3;
-
- vtabletmp =
- create_tmp_reg (build_pointer_type
- (build_pointer_type (vtable_entry_type)), "vptr");
-
- /* The vptr is always at offset zero in the object. */
- stmt = gimple_build_assign (vtabletmp,
- build1 (NOP_EXPR, TREE_TYPE (vtabletmp),
- ptr));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- /* Form the vtable address. */
- vtabletmp2 = create_tmp_reg (TREE_TYPE (TREE_TYPE (vtabletmp)),
- "vtableaddr");
- stmt = gimple_build_assign (vtabletmp2,
- build_simple_mem_ref (vtabletmp));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- /* Find the entry with the vcall offset. */
- stmt = gimple_build_assign (vtabletmp2,
- fold_build_pointer_plus_loc (input_location,
- vtabletmp2,
- virtual_offset));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- /* Get the offset itself. */
- vtabletmp3 = create_tmp_reg (TREE_TYPE (TREE_TYPE (vtabletmp2)),
- "vcalloffset");
- stmt = gimple_build_assign (vtabletmp3,
- build_simple_mem_ref (vtabletmp2));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- /* Adjust the `this' pointer. */
- ptr = fold_build_pointer_plus_loc (input_location, ptr, vtabletmp3);
- ptr = force_gimple_operand_gsi (bsi, ptr, true, NULL_TREE, false,
- GSI_CONTINUE_LINKING);
- }
-
- /* Likewise for an offset that is stored in the object that contains the
- vtable. */
- if (indirect_offset != 0)
- {
- tree offset_ptr, offset_tree;
-
- /* Get the address of the offset. */
- offset_ptr
- = create_tmp_reg (build_pointer_type
- (build_pointer_type (vtable_entry_type)),
- "offset_ptr");
- stmt = gimple_build_assign (offset_ptr,
- build1 (NOP_EXPR, TREE_TYPE (offset_ptr),
- ptr));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- stmt = gimple_build_assign
- (offset_ptr,
- fold_build_pointer_plus_hwi_loc (input_location, offset_ptr,
- indirect_offset));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- /* Get the offset itself. */
- offset_tree = create_tmp_reg (TREE_TYPE (TREE_TYPE (offset_ptr)),
- "offset");
- stmt = gimple_build_assign (offset_tree,
- build_simple_mem_ref (offset_ptr));
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- /* Adjust the `this' pointer. */
- ptr = fold_build_pointer_plus_loc (input_location, ptr, offset_tree);
- ptr = force_gimple_operand_gsi (bsi, ptr, true, NULL_TREE, false,
- GSI_CONTINUE_LINKING);
- }
-
- if (!this_adjusting
- && fixed_offset != 0)
- /* Adjust the pointer by the constant. */
- {
- tree ptrtmp;
-
- if (VAR_P (ptr))
- ptrtmp = ptr;
- else
- {
- ptrtmp = create_tmp_reg (TREE_TYPE (ptr), "ptr");
- stmt = gimple_build_assign (ptrtmp, ptr);
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
- }
- ptr = fold_build_pointer_plus_hwi_loc (input_location,
- ptrtmp, fixed_offset);
- }
-
- /* Emit the statement and gimplify the adjustment expression. */
- ret = create_tmp_reg (TREE_TYPE (ptr), "adjusted_this");
- stmt = gimple_build_assign (ret, ptr);
- gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-
- return ret;
-}
-
-/* Expand thunk NODE to gimple if possible.
- When FORCE_GIMPLE_THUNK is true, gimple thunk is created and
- no assembler is produced.
- When OUTPUT_ASM_THUNK is true, also produce assembler for
- thunks that are not lowered. */
-
-bool
-cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
-{
- bool this_adjusting = thunk.this_adjusting;
- HOST_WIDE_INT fixed_offset = thunk.fixed_offset;
- HOST_WIDE_INT virtual_value = thunk.virtual_value;
- HOST_WIDE_INT indirect_offset = thunk.indirect_offset;
- tree virtual_offset = NULL;
- tree alias = callees->callee->decl;
- tree thunk_fndecl = decl;
- tree a;
-
- if (!force_gimple_thunk
- && this_adjusting
- && indirect_offset == 0
- && !DECL_EXTERNAL (alias)
- && !DECL_STATIC_CHAIN (alias)
- && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
- virtual_value, alias))
- {
- tree fn_block;
- tree restype = TREE_TYPE (TREE_TYPE (thunk_fndecl));
-
- if (!output_asm_thunks)
- {
- analyzed = true;
- return false;
- }
-
- if (in_lto_p)
- get_untransformed_body ();
- a = DECL_ARGUMENTS (thunk_fndecl);
-
- current_function_decl = thunk_fndecl;
-
- /* Ensure thunks are emitted in their correct sections. */
- resolve_unique_section (thunk_fndecl, 0,
- flag_function_sections);
-
- DECL_RESULT (thunk_fndecl)
- = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
- RESULT_DECL, 0, restype);
- DECL_CONTEXT (DECL_RESULT (thunk_fndecl)) = thunk_fndecl;
-
- /* The back end expects DECL_INITIAL to contain a BLOCK, so we
- create one. */
- fn_block = make_node (BLOCK);
- BLOCK_VARS (fn_block) = a;
- DECL_INITIAL (thunk_fndecl) = fn_block;
- BLOCK_SUPERCONTEXT (fn_block) = thunk_fndecl;
- allocate_struct_function (thunk_fndecl, false);
- init_function_start (thunk_fndecl);
- cfun->is_thunk = 1;
- insn_locations_init ();
- set_curr_insn_location (DECL_SOURCE_LOCATION (thunk_fndecl));
- prologue_location = curr_insn_location ();
-
- targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl,
- fixed_offset, virtual_value, alias);
-
- insn_locations_finalize ();
- init_insn_lengths ();
- free_after_compilation (cfun);
- TREE_ASM_WRITTEN (thunk_fndecl) = 1;
- thunk.thunk_p = false;
- analyzed = false;
- }
- else if (stdarg_p (TREE_TYPE (thunk_fndecl)))
- {
- error ("generic thunk code fails for method %qD which uses %<...%>",
- thunk_fndecl);
- TREE_ASM_WRITTEN (thunk_fndecl) = 1;
- analyzed = true;
- return false;
- }
- else
- {
- tree restype;
- basic_block bb, then_bb, else_bb, return_bb;
- gimple_stmt_iterator bsi;
- int nargs = 0;
- tree arg;
- int i;
- tree resdecl;
- tree restmp = NULL;
-
- gcall *call;
- greturn *ret;
- bool alias_is_noreturn = TREE_THIS_VOLATILE (alias);
-
- /* We may be called from expand_thunk that releases body except for
- DECL_ARGUMENTS. In this case force_gimple_thunk is true. */
- if (in_lto_p && !force_gimple_thunk)
- get_untransformed_body ();
-
- /* We need to force DECL_IGNORED_P when the thunk is created
- after early debug was run. */
- if (force_gimple_thunk)
- DECL_IGNORED_P (thunk_fndecl) = 1;
-
- a = DECL_ARGUMENTS (thunk_fndecl);
-
- current_function_decl = thunk_fndecl;
-
- /* Ensure thunks are emitted in their correct sections. */
- resolve_unique_section (thunk_fndecl, 0,
- flag_function_sections);
-
- bitmap_obstack_initialize (NULL);
-
- if (thunk.virtual_offset_p)
- virtual_offset = size_int (virtual_value);
-
- /* Build the return declaration for the function. */
- restype = TREE_TYPE (TREE_TYPE (thunk_fndecl));
- if (DECL_RESULT (thunk_fndecl) == NULL_TREE)
- {
- resdecl = build_decl (input_location, RESULT_DECL, 0, restype);
- DECL_ARTIFICIAL (resdecl) = 1;
- DECL_IGNORED_P (resdecl) = 1;
- DECL_CONTEXT (resdecl) = thunk_fndecl;
- DECL_RESULT (thunk_fndecl) = resdecl;
- }
- else
- resdecl = DECL_RESULT (thunk_fndecl);
-
- profile_count cfg_count = count;
- if (!cfg_count.initialized_p ())
- cfg_count = profile_count::from_gcov_type (BB_FREQ_MAX).guessed_local ();
-
- bb = then_bb = else_bb = return_bb
- = init_lowered_empty_function (thunk_fndecl, true, cfg_count);
-
- bsi = gsi_start_bb (bb);
-
- /* Build call to the function being thunked. */
- if (!VOID_TYPE_P (restype)
- && (!alias_is_noreturn
- || TREE_ADDRESSABLE (restype)
- || TREE_CODE (TYPE_SIZE_UNIT (restype)) != INTEGER_CST))
- {
- if (DECL_BY_REFERENCE (resdecl))
- {
- restmp = gimple_fold_indirect_ref (resdecl);
- if (!restmp)
- restmp = build2 (MEM_REF,
- TREE_TYPE (TREE_TYPE (resdecl)),
- resdecl,
- build_int_cst (TREE_TYPE (resdecl), 0));
- }
- else if (!is_gimple_reg_type (restype))
- {
- if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
- {
- restmp = resdecl;
-
- if (VAR_P (restmp))
- {
- add_local_decl (cfun, restmp);
- BLOCK_VARS (DECL_INITIAL (current_function_decl))
- = restmp;
- }
- }
- else
- restmp = create_tmp_var (restype, "retval");
- }
- else
- restmp = create_tmp_reg (restype, "retval");
- }
-
- for (arg = a; arg; arg = DECL_CHAIN (arg))
- nargs++;
- auto_vec<tree> vargs (nargs);
- i = 0;
- arg = a;
- if (this_adjusting)
- {
- vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset,
- virtual_offset, indirect_offset));
- arg = DECL_CHAIN (a);
- i = 1;
- }
-
- if (nargs)
- for (; i < nargs; i++, arg = DECL_CHAIN (arg))
- {
- tree tmp = arg;
- DECL_NOT_GIMPLE_REG_P (arg) = 0;
- if (!is_gimple_val (arg))
- {
- tmp = create_tmp_reg (TYPE_MAIN_VARIANT
- (TREE_TYPE (arg)), "arg");
- gimple *stmt = gimple_build_assign (tmp, arg);
- gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
- }
- vargs.quick_push (tmp);
- }
- call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
- callees->call_stmt = call;
- gimple_call_set_from_thunk (call, true);
- if (DECL_STATIC_CHAIN (alias))
- {
- tree p = DECL_STRUCT_FUNCTION (alias)->static_chain_decl;
- tree type = TREE_TYPE (p);
- tree decl = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
- PARM_DECL, create_tmp_var_name ("CHAIN"),
- type);
- DECL_ARTIFICIAL (decl) = 1;
- DECL_IGNORED_P (decl) = 1;
- TREE_USED (decl) = 1;
- DECL_CONTEXT (decl) = thunk_fndecl;
- DECL_ARG_TYPE (decl) = type;
- TREE_READONLY (decl) = 1;
-
- struct function *sf = DECL_STRUCT_FUNCTION (thunk_fndecl);
- sf->static_chain_decl = decl;
-
- gimple_call_set_chain (call, decl);
- }
-
- /* Return slot optimization is always possible and in fact required to
- return values with DECL_BY_REFERENCE. */
- if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))
- && (!is_gimple_reg_type (TREE_TYPE (resdecl))
- || DECL_BY_REFERENCE (resdecl)))
- gimple_call_set_return_slot_opt (call, true);
-
- if (restmp)
- {
- gimple_call_set_lhs (call, restmp);
- gcc_assert (useless_type_conversion_p (TREE_TYPE (restmp),
- TREE_TYPE (TREE_TYPE (alias))));
- }
- gsi_insert_after (&bsi, call, GSI_NEW_STMT);
- if (!alias_is_noreturn)
- {
- if (restmp && !this_adjusting
- && (fixed_offset || virtual_offset))
- {
- tree true_label = NULL_TREE;
-
- if (TREE_CODE (TREE_TYPE (restmp)) == POINTER_TYPE)
- {
- gimple *stmt;
- edge e;
- /* If the return type is a pointer, we need to
- protect against NULL. We know there will be an
- adjustment, because that's why we're emitting a
- thunk. */
- then_bb = create_basic_block (NULL, bb);
- then_bb->count = cfg_count - cfg_count.apply_scale (1, 16);
- return_bb = create_basic_block (NULL, then_bb);
- return_bb->count = cfg_count;
- else_bb = create_basic_block (NULL, else_bb);
- else_bb->count = cfg_count.apply_scale (1, 16);
- add_bb_to_loop (then_bb, bb->loop_father);
- add_bb_to_loop (return_bb, bb->loop_father);
- add_bb_to_loop (else_bb, bb->loop_father);
- remove_edge (single_succ_edge (bb));
- true_label = gimple_block_label (then_bb);
- stmt = gimple_build_cond (NE_EXPR, restmp,
- build_zero_cst (TREE_TYPE (restmp)),
- NULL_TREE, NULL_TREE);
- gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
- e = make_edge (bb, then_bb, EDGE_TRUE_VALUE);
- e->probability = profile_probability::guessed_always ()
- .apply_scale (1, 16);
- e = make_edge (bb, else_bb, EDGE_FALSE_VALUE);
- e->probability = profile_probability::guessed_always ()
- .apply_scale (1, 16);
- make_single_succ_edge (return_bb,
- EXIT_BLOCK_PTR_FOR_FN (cfun), 0);
- make_single_succ_edge (then_bb, return_bb, EDGE_FALLTHRU);
- e = make_edge (else_bb, return_bb, EDGE_FALLTHRU);
- e->probability = profile_probability::always ();
- bsi = gsi_last_bb (then_bb);
- }
-
- restmp = thunk_adjust (&bsi, restmp, /*this_adjusting=*/0,
- fixed_offset, virtual_offset,
- indirect_offset);
- if (true_label)
- {
- gimple *stmt;
- bsi = gsi_last_bb (else_bb);
- stmt = gimple_build_assign (restmp,
- build_zero_cst (TREE_TYPE (restmp)));
- gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
- bsi = gsi_last_bb (return_bb);
- }
- }
- else
- {
- gimple_call_set_tail (call, true);
- cfun->tail_call_marked = true;
- }
-
- /* Build return value. */
- if (!DECL_BY_REFERENCE (resdecl))
- ret = gimple_build_return (restmp);
- else
- ret = gimple_build_return (resdecl);
-
- gsi_insert_after (&bsi, ret, GSI_NEW_STMT);
- }
- else
- {
- gimple_call_set_tail (call, true);
- cfun->tail_call_marked = true;
- remove_edge (single_succ_edge (bb));
- }
-
- cfun->gimple_df->in_ssa_p = true;
- update_max_bb_count ();
- profile_status_for_fn (cfun)
- = cfg_count.initialized_p () && cfg_count.ipa_p ()
- ? PROFILE_READ : PROFILE_GUESSED;
- /* FIXME: C++ FE should stop setting TREE_ASM_WRITTEN on thunks. */
- TREE_ASM_WRITTEN (thunk_fndecl) = false;
- delete_unreachable_blocks ();
- update_ssa (TODO_update_ssa);
- checking_verify_flow_info ();
- free_dominance_info (CDI_DOMINATORS);
-
- /* Since we want to emit the thunk, we explicitly mark its name as
- referenced. */
- thunk.thunk_p = false;
- lowered = true;
- bitmap_obstack_release (NULL);
- }
- current_function_decl = NULL;
- set_cfun (NULL);
- return true;
-}
-
/* Assemble thunks and aliases associated to node. */
void
@@ -2223,13 +1741,13 @@ cgraph_node::assemble_thunks_and_aliases (void)
ipa_ref *ref;
for (e = callers; e;)
- if (e->caller->thunk.thunk_p
+ if (e->caller->thunk
&& !e->caller->inlined_to)
{
cgraph_node *thunk = e->caller;
e = e->next_caller;
- thunk->expand_thunk (true, false);
+ expand_thunk (thunk, true, false);
thunk->assemble_thunks_and_aliases ();
}
else
@@ -2275,6 +1793,9 @@ cgraph_node::expand (void)
announce_function (decl);
process = 0;
gcc_assert (lowered);
+
+ /* Initialize the default bitmap obstack. */
+ bitmap_obstack_initialize (NULL);
get_untransformed_body ();
/* Generate RTL for the body of DECL. */
@@ -2283,9 +1804,6 @@ cgraph_node::expand (void)
gcc_assert (symtab->global_info_ready);
- /* Initialize the default bitmap obstack. */
- bitmap_obstack_initialize (NULL);
-
/* Initialize the RTL code for the function. */
saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
@@ -2299,7 +1817,8 @@ cgraph_node::expand (void)
bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
update_ssa (TODO_update_ssa_only_virtuals);
- execute_all_ipa_transforms (false);
+ if (ipa_transforms_to_apply.exists ())
+ execute_all_ipa_transforms (false);
/* Perform all tree transforms and optimizations. */
@@ -2343,14 +1862,11 @@ cgraph_node::expand (void)
}
gimple_set_body (decl, NULL);
- if (DECL_STRUCT_FUNCTION (decl) == 0
- && !cgraph_node::get (decl)->origin)
+ if (DECL_STRUCT_FUNCTION (decl) == 0)
{
/* Stop pointing to the local nodes about to be freed.
But DECL_INITIAL must remain nonzero so we know this
- was an actual function definition.
- For a nested function, this is done in c_pop_function_context.
- If rest_of_compilation set this to 0, leave it 0. */
+ was an actual function definition. */
if (DECL_INITIAL (decl) != 0)
DECL_INITIAL (decl) = error_mark_node;
}
@@ -2494,6 +2010,7 @@ expand_all_functions (void)
delete ipa_saved_clone_sources;
ipa_saved_clone_sources = NULL;
free (order);
+ free (tp_first_run_order);
}
/* This is used to sort the node types by the cgraph order number. */
@@ -2595,7 +2112,7 @@ output_in_order (void)
cgraph_order_sort *node;
FOR_EACH_DEFINED_FUNCTION (cnode)
- if (cnode->process && !cnode->thunk.thunk_p
+ if (cnode->process && !cnode->thunk
&& !cnode->alias && cnode->no_reorder)
nodes.safe_push (cgraph_order_sort (cnode));
@@ -3000,6 +2517,9 @@ symbol_table::finalize_compilation_unit (void)
/* Gimplify and lower thunks. */
analyze_functions (/*first_time=*/false);
+ /* All nested functions should be lowered now. */
+ nested_function_info::release ();
+
/* Offloading requires LTO infrastructure. */
if (!in_lto_p && g->have_offload)
flag_generate_offload = 1;
@@ -3032,7 +2552,6 @@ cgraphunit_c_finalize (void)
gcc_assert (cgraph_new_nodes.length () == 0);
cgraph_new_nodes.truncate (0);
- vtable_entry_type = NULL;
queued_nodes = &symtab_terminator;
first_analyzed = NULL;
@@ -3062,8 +2581,11 @@ cgraph_node::create_wrapper (cgraph_node *target)
/* Turn alias into thunk and expand it into GIMPLE representation. */
definition = true;
- memset (&thunk, 0, sizeof (cgraph_thunk_info));
- thunk.thunk_p = true;
+ /* Create empty thunk, but be sure we did not keep former thunk around.
+ In that case we would need to preserve the info. */
+ gcc_checking_assert (!thunk_info::get (this));
+ thunk_info::get_create (this);
+ thunk = true;
create_edge (target, NULL, count);
callees->can_throw_external = !TREE_NOTHROW (target->decl);
@@ -3075,11 +2597,10 @@ cgraph_node::create_wrapper (cgraph_node *target)
arguments = TREE_CHAIN (arguments);
}
- expand_thunk (false, true);
+ expand_thunk (this, false, true);
+ thunk_info::remove (this);
/* Inline summary set-up. */
analyze ();
inline_analyze_function (this);
}
-
-#include "gt-cgraphunit.h"
diff --git a/gcc/collect-utils.c b/gcc/collect-utils.c
index d4fa2c3..095db8d 100644
--- a/gcc/collect-utils.c
+++ b/gcc/collect-utils.c
@@ -104,7 +104,8 @@ do_wait (const char *prog, struct pex_obj *pex)
struct pex_obj *
collect_execute (const char *prog, char **argv, const char *outname,
- const char *errname, int flags, bool use_atfile)
+ const char *errname, int flags, bool use_atfile,
+ const char *atsuffix)
{
struct pex_obj *pex;
const char *errmsg;
@@ -126,7 +127,10 @@ collect_execute (const char *prog, char **argv, const char *outname,
/* Note: we assume argv contains at least one element; this is
checked above. */
- response_file = make_temp_file ("");
+ if (!save_temps || !atsuffix)
+ response_file = make_temp_file ("");
+ else
+ response_file = concat (dumppfx, atsuffix, NULL);
f = fopen (response_file, "w");
@@ -202,12 +206,13 @@ collect_execute (const char *prog, char **argv, const char *outname,
}
void
-fork_execute (const char *prog, char **argv, bool use_atfile)
+fork_execute (const char *prog, char **argv, bool use_atfile,
+ const char *atsuffix)
{
struct pex_obj *pex;
pex = collect_execute (prog, argv, NULL, NULL,
- PEX_LAST | PEX_SEARCH, use_atfile);
+ PEX_LAST | PEX_SEARCH, use_atfile, atsuffix);
do_wait (prog, pex);
}
diff --git a/gcc/collect-utils.h b/gcc/collect-utils.h
index 6ff7d9d..4822257 100644
--- a/gcc/collect-utils.h
+++ b/gcc/collect-utils.h
@@ -27,10 +27,10 @@ extern void fatal_signal (int);
extern struct pex_obj *collect_execute (const char *, char **,
const char *, const char *,
- int, bool);
+ int, bool, const char *);
extern int collect_wait (const char *, struct pex_obj *);
extern void do_wait (const char *, struct pex_obj *);
-extern void fork_execute (const char *, char **, bool);
+extern void fork_execute (const char *, char **, bool, const char *);
extern void utils_cleanup (bool);
diff --git a/gcc/collect2.c b/gcc/collect2.c
index f8a5ce4..3a43a5a 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -184,7 +184,8 @@ static int strip_flag; /* true if -s */
static int export_flag; /* true if -bE */
static int aix64_flag; /* true if -b64 */
static int aixrtl_flag; /* true if -brtl */
-static int aixlazy_flag; /* true if -blazy */
+static int aixlazy_flag; /* true if -blazy */
+static int visibility_flag; /* true if -fvisibility */
#endif
enum lto_mode_d {
@@ -643,7 +644,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
/* Run the LTO back end. */
pex = collect_execute (prog, lto_c_argv, NULL, NULL, PEX_SEARCH,
- at_file_supplied);
+ at_file_supplied, NULL);
{
int c;
FILE *stream;
@@ -726,7 +727,8 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
/* Run the linker again, this time replacing the object files
optimized by the LTO with the temporary file generated by the LTO. */
- fork_execute ("ld", out_lto_ld_argv, HAVE_GNU_LD && at_file_supplied);
+ fork_execute ("ld", out_lto_ld_argv, HAVE_GNU_LD && at_file_supplied,
+ NULL);
/* We assume that temp files were created, and therefore we need to take
that into account (maybe run dsymutil). */
post_ld_pass (/*temp_file*/true);
@@ -738,7 +740,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
{
/* Our caller is relying on us to do the link
even though there is no LTO back end work to be done. */
- fork_execute ("ld", lto_ld_argv, HAVE_GNU_LD && at_file_supplied);
+ fork_execute ("ld", lto_ld_argv, HAVE_GNU_LD && at_file_supplied, NULL);
/* No LTO objects were found, so no new temp file. */
post_ld_pass (/*temp_file*/false);
}
@@ -755,7 +757,7 @@ do_link (char **ld_argv)
const char *prog = "ld";
pex = collect_execute (prog, ld_argv, NULL, NULL,
PEX_LAST | PEX_SEARCH,
- HAVE_GNU_LD && at_file_supplied);
+ HAVE_GNU_LD && at_file_supplied, NULL);
int ret = collect_wait (prog, pex);
if (ret)
{
@@ -1239,6 +1241,11 @@ main (int argc, char **argv)
*c_ptr++ = xstrdup (q);
}
}
+#ifdef COLLECT_EXPORT_LIST
+ /* Detect any invocation with -fvisibility. */
+ if (strncmp (q, "-fvisibility", 12) == 0)
+ visibility_flag = 1;
+#endif
}
obstack_free (&temporary_obstack, temporary_firstobj);
*c_ptr++ = "-fno-profile-arcs";
@@ -1716,7 +1723,7 @@ main (int argc, char **argv)
strip_argv[0] = strip_file_name;
strip_argv[1] = output_file;
strip_argv[2] = (char *) 0;
- fork_execute ("strip", real_strip_argv, false);
+ fork_execute ("strip", real_strip_argv, false, NULL);
}
#ifdef COLLECT_EXPORT_LIST
@@ -1799,7 +1806,7 @@ main (int argc, char **argv)
/* Assemble the constructor and destructor tables.
Link the tables in with the rest of the program. */
- fork_execute ("gcc", c_argv, at_file_supplied);
+ fork_execute ("gcc", c_argv, at_file_supplied, NULL);
#ifdef COLLECT_EXPORT_LIST
/* On AIX we must call link because of possible templates resolution. */
do_link (ld2_argv);
@@ -1812,7 +1819,7 @@ main (int argc, char **argv)
maybe_run_lto_and_relink (ld2_argv, object_lst, object, true);
else
{
- fork_execute ("ld", ld2_argv, HAVE_GNU_LD && at_file_supplied);
+ fork_execute ("ld", ld2_argv, HAVE_GNU_LD && at_file_supplied, NULL);
post_ld_pass (/*temp_file*/false);
}
@@ -2131,6 +2138,11 @@ write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED)
fprintf (stream, "\t}\n");
}
+#ifdef COLLECT_EXPORT_LIST
+ /* Set visibility of initializers to default. */
+ if (visibility_flag)
+ fprintf (stream, "#pragma GCC visibility push(default)\n");
+#endif
fprintf (stream, "void %s() {\n", initname);
if (constructors.number > 0 || frames)
{
@@ -2163,11 +2175,24 @@ write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED)
destructors.number + frames);
}
fprintf (stream, "}\n");
+#ifdef COLLECT_EXPORT_LIST
+ if (visibility_flag)
+ fprintf (stream, "#pragma GCC visibility pop\n");
+#endif
if (shared_obj)
{
+#ifdef COLLECT_EXPORT_LIST
+ /* Set visibility of initializers to default. */
+ if (visibility_flag)
+ fprintf (stream, "#pragma GCC visibility push(default)\n");
+#endif
COLLECT_SHARED_INIT_FUNC (stream, initname);
COLLECT_SHARED_FINI_FUNC (stream, fininame);
+#ifdef COLLECT_EXPORT_LIST
+ if (visibility_flag)
+ fprintf (stream, "#pragma GCC visibility pop\n");
+#endif
}
}
@@ -3016,7 +3041,7 @@ do_dsymutil (const char *output_file) {
argv[2] = (char *) 0;
pex = collect_execute (dsymutil, real_argv, NULL, NULL,
- PEX_LAST | PEX_SEARCH, false);
+ PEX_LAST | PEX_SEARCH, false, NULL);
do_wait (dsymutil, pex);
}
diff --git a/gcc/combine.c b/gcc/combine.c
index c88382e..4782e1d 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -11003,8 +11003,11 @@ simplify_shift_const_1 (enum rtx_code code, machine_mode result_mode,
break;
/* For ((int) (cstLL >> count)) >> cst2 just give up. Queuing
up outer sign extension (often left and right shift) is
- hardly more efficient than the original. See PR70429. */
- if (code == ASHIFTRT && int_mode != int_result_mode)
+ hardly more efficient than the original. See PR70429.
+ Similarly punt for rotates with different modes.
+ See PR97386. */
+ if ((code == ASHIFTRT || code == ROTATE)
+ && int_mode != int_result_mode)
break;
rtx count_rtx = gen_int_shift_amount (int_result_mode, count);
diff --git a/gcc/common.opt b/gcc/common.opt
index b833b98..7e789d1 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -47,7 +47,7 @@ Variable
bool in_lto_p = false
; This variable is set to non-0 only by LTO front-end. 1 indicates that
-; the output produced will be used for incrmeental linking (thus weak symbols
+; the output produced will be used for incremental linking (thus weak symbols
; can still be bound) and 2 indicates that the IL is going to be linked and
; and output to LTO object file.
Variable
@@ -1202,7 +1202,7 @@ Common Report Var(flag_data_sections)
Place data items into their own section.
fdbg-cnt-list
-Common Report Var(common_deferred_options) Defer
+Common Report Var(flag_dbg_cnt_list)
List all available debugging counters with their limits and counts.
fdbg-cnt=
@@ -1827,7 +1827,7 @@ Perform interprocedural bitwise constant propagation.
fipa-modref
Common Report Var(flag_ipa_modref) Optimization
-Perform interprocedural modref analysis
+Perform interprocedural modref analysis.
fipa-profile
Common Report Var(flag_ipa_profile) Init(0) Optimization
diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index 12237e2..1e8324e 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -509,15 +509,20 @@ get_available_features (struct __processor_model *cpu_model,
#define XSTATE_OPMASK 0x20
#define XSTATE_ZMM 0x40
#define XSTATE_HI_ZMM 0x80
+#define XSTATE_TILECFG 0x20000
+#define XSTATE_TILEDATA 0x40000
#define XCR_AVX_ENABLED_MASK \
(XSTATE_SSE | XSTATE_YMM)
#define XCR_AVX512F_ENABLED_MASK \
(XSTATE_SSE | XSTATE_YMM | XSTATE_OPMASK | XSTATE_ZMM | XSTATE_HI_ZMM)
+#define XCR_AMX_ENABLED_MASK \
+ (XSTATE_TILECFG | XSTATE_TILEDATA)
/* Check if AVX and AVX512 are usable. */
int avx_usable = 0;
int avx512_usable = 0;
+ int amx_usable = 0;
if ((ecx & bit_OSXSAVE))
{
/* Check if XMM, YMM, OPMASK, upper 256 bits of ZMM0-ZMM15 and
@@ -533,6 +538,8 @@ get_available_features (struct __processor_model *cpu_model,
avx512_usable = ((xcrlow & XCR_AVX512F_ENABLED_MASK)
== XCR_AVX512F_ENABLED_MASK);
}
+ amx_usable = ((xcrlow & XCR_AMX_ENABLED_MASK)
+ == XCR_AMX_ENABLED_MASK);
}
#define set_feature(f) \
@@ -651,6 +658,15 @@ get_available_features (struct __processor_model *cpu_model,
set_feature (FEATURE_PCONFIG);
if (edx & bit_IBT)
set_feature (FEATURE_IBT);
+ if (amx_usable)
+ {
+ if (edx & bit_AMX_TILE)
+ set_feature (FEATURE_AMX_TILE);
+ if (edx & bit_AMX_INT8)
+ set_feature (FEATURE_AMX_INT8);
+ if (edx & bit_AMX_BF16)
+ set_feature (FEATURE_AMX_BF16);
+ }
if (avx512_usable)
{
if (ebx & bit_AVX512F)
@@ -685,10 +701,15 @@ get_available_features (struct __processor_model *cpu_model,
set_feature (FEATURE_AVX5124FMAPS);
if (edx & bit_AVX512VP2INTERSECT)
set_feature (FEATURE_AVX512VP2INTERSECT);
+ if (edx & bit_UINTR)
+ set_feature (FEATURE_UINTR);
__cpuid_count (7, 1, eax, ebx, ecx, edx);
if (eax & bit_AVX512BF16)
set_feature (FEATURE_AVX512BF16);
+ if (eax & bit_HRESET)
+ set_feature (FEATURE_HRESET);
+
}
}
diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c
index 6e34095..bfdca85 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -101,6 +101,9 @@ along with GCC; see the file COPYING3. If not see
(OPTION_MASK_ISA_XSAVEC | OPTION_MASK_ISA_XSAVE_SET)
#define OPTION_MASK_ISA_CLWB_SET OPTION_MASK_ISA_CLWB
#define OPTION_MASK_ISA2_AVX512VP2INTERSECT_SET OPTION_MASK_ISA2_AVX512VP2INTERSECT
+#define OPTION_MASK_ISA2_AMX_TILE_SET OPTION_MASK_ISA2_AMX_TILE
+#define OPTION_MASK_ISA2_AMX_INT8_SET OPTION_MASK_ISA2_AMX_INT8
+#define OPTION_MASK_ISA2_AMX_BF16_SET OPTION_MASK_ISA2_AMX_BF16
/* SSE4 includes both SSE4.1 and SSE4.2. -msse4 should be the same
as -msse4.2. */
@@ -160,6 +163,8 @@ along with GCC; see the file COPYING3. If not see
#define OPTION_MASK_ISA2_ENQCMD_SET OPTION_MASK_ISA2_ENQCMD
#define OPTION_MASK_ISA2_SERIALIZE_SET OPTION_MASK_ISA2_SERIALIZE
#define OPTION_MASK_ISA2_TSXLDTRK_SET OPTION_MASK_ISA2_TSXLDTRK
+#define OPTION_MASK_ISA2_UINTR_SET OPTION_MASK_ISA2_UINTR
+#define OPTION_MASK_ISA2_HRESET_SET OPTION_MASK_ISA2_HRESET
/* Define a set of ISAs which aren't available when a given ISA is
disabled. MMX and SSE ISAs are handled separately. */
@@ -194,6 +199,7 @@ along with GCC; see the file COPYING3. If not see
(OPTION_MASK_ISA_XSAVE | OPTION_MASK_ISA_XSAVEOPT_UNSET \
| OPTION_MASK_ISA_XSAVES_UNSET | OPTION_MASK_ISA_XSAVEC_UNSET \
| OPTION_MASK_ISA_AVX_UNSET)
+#define OPTION_MASK_ISA2_XSAVE_UNSET OPTION_MASK_ISA2_AMX_TILE_UNSET
#define OPTION_MASK_ISA_XSAVEOPT_UNSET OPTION_MASK_ISA_XSAVEOPT
#define OPTION_MASK_ISA_AVX2_UNSET \
(OPTION_MASK_ISA_AVX2 | OPTION_MASK_ISA_AVX512F_UNSET)
@@ -247,6 +253,11 @@ along with GCC; see the file COPYING3. If not see
#define OPTION_MASK_ISA2_SERIALIZE_UNSET OPTION_MASK_ISA2_SERIALIZE
#define OPTION_MASK_ISA2_AVX512VP2INTERSECT_UNSET OPTION_MASK_ISA2_AVX512VP2INTERSECT
#define OPTION_MASK_ISA2_TSXLDTRK_UNSET OPTION_MASK_ISA2_TSXLDTRK
+#define OPTION_MASK_ISA2_AMX_TILE_UNSET OPTION_MASK_ISA2_AMX_TILE
+#define OPTION_MASK_ISA2_AMX_INT8_UNSET OPTION_MASK_ISA2_AMX_INT8
+#define OPTION_MASK_ISA2_AMX_BF16_UNSET OPTION_MASK_ISA2_AMX_BF16
+#define OPTION_MASK_ISA2_UINTR_UNSET OPTION_MASK_ISA2_UINTR
+#define OPTION_MASK_ISA2_HRESET_UNSET OPTION_MASK_ISA2_HRESET
/* SSE4 includes both SSE4.1 and SSE4.2. -mno-sse4 should the same
as -mno-sse4.1. */
@@ -695,6 +706,32 @@ ix86_handle_option (struct gcc_options *opts,
}
return true;
+ case OPT_muintr:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_UINTR_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_UINTR_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_UINTR_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_UINTR_UNSET;
+ }
+ return true;
+
+ case OPT_mhreset:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_HRESET_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_HRESET_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_HRESET_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_HRESET_UNSET;
+ }
+ return true;
+
case OPT_mavx5124fmaps:
if (value)
{
@@ -931,6 +968,47 @@ ix86_handle_option (struct gcc_options *opts,
}
return true;
+ case OPT_mamx_tile:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_TILE_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AMX_TILE_SET;
+ opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XSAVE_SET;
+ opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_XSAVE_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AMX_TILE_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AMX_TILE_UNSET;
+ }
+ return true;
+
+ case OPT_mamx_int8:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_INT8_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AMX_INT8_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AMX_INT8_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AMX_INT8_UNSET;
+ }
+ return true;
+
+ case OPT_mamx_bf16:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_BF16_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AMX_BF16_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AMX_BF16_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AMX_BF16_UNSET;
+ }
+ return true;
+
case OPT_mfma:
if (value)
{
@@ -1265,6 +1343,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_XSAVE_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_XSAVE_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_XSAVE_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_XSAVE_UNSET;
}
return true;
@@ -1745,9 +1825,13 @@ const pta processor_alias_table[] =
PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_FXSR, 0, P_NONE},
{"athlon-mp", PROCESSOR_ATHLON, CPU_ATHLON,
PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_FXSR, 0, P_NONE},
- {"x86-64", PROCESSOR_K8, CPU_K8,
- PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR,
- 0, P_NONE},
+ {"x86-64", PROCESSOR_K8, CPU_K8, PTA_X86_64_BASELINE, 0, P_NONE},
+ {"x86-64-v2", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V2 | PTA_NO_TUNE,
+ 0, P_NONE},
+ {"x86-64-v3", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V3 | PTA_NO_TUNE,
+ 0, P_NONE},
+ {"x86-64-v4", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V4 | PTA_NO_TUNE,
+ 0, P_NONE},
{"eden-x2", PROCESSOR_K8, CPU_K8,
PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR,
0, P_NONE},
diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h
index 84ca97e..8c3f782 100644
--- a/gcc/common/config/i386/i386-cpuinfo.h
+++ b/gcc/common/config/i386/i386-cpuinfo.h
@@ -216,6 +216,11 @@ enum processor_features
FEATURE_XSAVEC,
FEATURE_XSAVEOPT,
FEATURE_XSAVES,
+ FEATURE_AMX_TILE,
+ FEATURE_AMX_INT8,
+ FEATURE_AMX_BF16,
+ FEATURE_UINTR,
+ FEATURE_HRESET,
CPU_FEATURE_MAX
};
diff --git a/gcc/common/config/i386/i386-isas.h b/gcc/common/config/i386/i386-isas.h
index 08c9dbe..888e325 100644
--- a/gcc/common/config/i386/i386-isas.h
+++ b/gcc/common/config/i386/i386-isas.h
@@ -160,4 +160,9 @@ ISA_NAMES_TABLE_START
ISA_NAMES_TABLE_ENTRY("xsaveopt", FEATURE_XSAVEOPT, P_NONE,
"-mxsaveopt")
ISA_NAMES_TABLE_ENTRY("xsaves", FEATURE_XSAVES, P_NONE, "-mxsaves")
+ ISA_NAMES_TABLE_ENTRY("amx-tile", FEATURE_AMX_TILE, P_NONE, "-mamx-tile")
+ ISA_NAMES_TABLE_ENTRY("amx-int8", FEATURE_AMX_INT8, P_NONE, "-mamx-int8")
+ ISA_NAMES_TABLE_ENTRY("amx-bf16", FEATURE_AMX_BF16, P_NONE, "-mamx-bf16")
+ ISA_NAMES_TABLE_ENTRY("uintr", FEATURE_UINTR, P_NONE, "-muintr")
+ ISA_NAMES_TABLE_ENTRY("hreset", FEATURE_HRESET, P_NONE, "-mhreset")
ISA_NAMES_TABLE_END
diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c
index 82c5154..4b6bdf8 100644
--- a/gcc/common/config/riscv/riscv-common.c
+++ b/gcc/common/config/riscv/riscv-common.c
@@ -60,6 +60,14 @@ riscv_implied_info_t riscv_implied_info[] =
{NULL, NULL}
};
+static const riscv_cpu_info riscv_cpu_tables[] =
+{
+#define RISCV_CORE(CORE_NAME, ARCH, TUNE) \
+ {CORE_NAME, ARCH, TUNE},
+#include "../../../config/riscv/riscv-cores.def"
+ {NULL, NULL, NULL}
+};
+
/* Subset list. */
class riscv_subset_list
{
@@ -604,8 +612,10 @@ fail:
std::string
riscv_arch_str (bool version_p)
{
- gcc_assert (current_subset_list);
- return current_subset_list->to_string (version_p);
+ if (current_subset_list)
+ return current_subset_list->to_string (version_p);
+ else
+ return std::string();
}
/* Parse a RISC-V ISA string into an option mask. Must clear or set all arch
@@ -653,6 +663,21 @@ riscv_parse_arch_string (const char *isa, int *flags, location_t loc)
current_subset_list = subset_list;
}
+/* Return the riscv_cpu_info entry for CPU, NULL if not found. */
+
+const riscv_cpu_info *
+riscv_find_cpu (const char *cpu)
+{
+ const riscv_cpu_info *cpu_info = &riscv_cpu_tables[0];
+ for (;cpu_info->name != NULL; ++cpu_info)
+ {
+ const char *name = cpu_info->name;
+ if (strcmp (cpu, name) == 0)
+ return cpu_info;
+ }
+ return NULL;
+}
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -667,6 +692,12 @@ riscv_handle_option (struct gcc_options *opts,
riscv_parse_arch_string (decoded->arg, &opts->x_target_flags, loc);
return true;
+ case OPT_mcpu_:
+ if (riscv_find_cpu (decoded->arg) == NULL)
+ error_at (loc, "%<-mcpu=%s%>: unknown CPU",
+ decoded->arg);
+ return true;
+
default:
return true;
}
@@ -678,15 +709,65 @@ const char *
riscv_expand_arch (int argc ATTRIBUTE_UNUSED,
const char **argv)
{
- static char *_arch_buf;
gcc_assert (argc == 1);
int flags;
location_t loc = UNKNOWN_LOCATION;
riscv_parse_arch_string (argv[0], &flags, loc);
- _arch_buf = xstrdup (riscv_arch_str (false).c_str ());
- return _arch_buf;
+ const std::string arch = riscv_arch_str (false);
+ if (arch.length())
+ return xasprintf ("-march=%s", arch.c_str());
+ else
+ return "";
}
+/* Expand default -mtune option from -mcpu option, use default --with-tune value
+ if -mcpu don't have valid value. */
+
+const char *
+riscv_default_mtune (int argc, const char **argv)
+{
+ gcc_assert (argc == 2);
+ const riscv_cpu_info *cpu = riscv_find_cpu (argv[0]);
+ const char *default_mtune = argv[1];
+ if (cpu)
+ return cpu->tune;
+ else
+ return default_mtune;
+}
+
+/* Expand arch string with implied extensions from -mcpu option. */
+
+const char *
+riscv_expand_arch_from_cpu (int argc ATTRIBUTE_UNUSED,
+ const char **argv)
+{
+ gcc_assert (argc > 0 && argc <= 2);
+ const char *default_arch_str = NULL;
+ const char *arch_str = NULL;
+ if (argc >= 2)
+ default_arch_str = argv[1];
+
+ const riscv_cpu_info *cpu = riscv_find_cpu (argv[0]);
+
+ if (cpu == NULL)
+ {
+ if (default_arch_str == NULL)
+ return "";
+ else
+ arch_str = default_arch_str;
+ }
+ else
+ arch_str = cpu->arch;
+
+ location_t loc = UNKNOWN_LOCATION;
+ int flags;
+
+ riscv_parse_arch_string (arch_str, &flags, loc);
+ const std::string arch = riscv_arch_str (false);
+ return xasprintf ("-march=%s", arch.c_str());
+}
+
+
/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */
static const struct default_options riscv_option_optimization_table[] =
{
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 845f10e..411200d 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -412,7 +412,9 @@ i[34567]86-*-*)
waitpkgintrin.h cldemoteintrin.h avx512bf16vlintrin.h
avx512bf16intrin.h enqcmdintrin.h serializeintrin.h
avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h
- tsxldtrkintrin.h"
+ tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h
+ amxbf16intrin.h x86gprintrin.h uintrintrin.h
+ hresetintrin.h"
;;
x86_64-*-*)
cpu_type=i386
@@ -447,7 +449,9 @@ x86_64-*-*)
waitpkgintrin.h cldemoteintrin.h avx512bf16vlintrin.h
avx512bf16intrin.h enqcmdintrin.h serializeintrin.h
avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h
- tsxldtrkintrin.h"
+ tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h
+ amxbf16intrin.h x86gprintrin.h uintrintrin.h
+ hresetintrin.h"
;;
ia64-*-*)
extra_headers=ia64intrin.h
@@ -658,7 +662,8 @@ tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \
athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \
i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \
-pentium4 pentium4m pentiumpro prescott lakemont"
+pentium4 pentium4m pentiumpro prescott lakemont samuel-2 nehemiah \
+c7 esther"
# 64-bit x86 processors supported by --with-arch=. Each processor
# MUST be separated by exactly one space.
@@ -668,7 +673,8 @@ opteron-sse3 nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom \
slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \
silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \
skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \
-sapphirerapids alderlake x86-64 native"
+sapphirerapids alderlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
+nano-x2 eden-x4 nano-x4 x86-64 x86-64-v2 x86-64-v3 x86-64-v4 native"
# Additional x86 processors supported by --with-cpu=. Each processor
# MUST be separated by exactly one space.
@@ -2972,6 +2978,27 @@ powerpc*-*-linux*)
tm_file="rs6000/secureplt.h ${tm_file}"
fi
;;
+powerpc*-wrs-vxworks7r*)
+
+ # Wind River 7 post SR0600 is mostly like Linux so we setup
+ # our config in a very similar fashion and adjust to a few
+ # specificities.
+
+ # The system compiler is configured with secureplt by default.
+ tm_file="${tm_file} rs6000/secureplt.h"
+
+ tm_file="${tm_file} elfos.h gnu-user.h linux.h freebsd-spec.h"
+ tm_file="${tm_file} rs6000/sysv4.h rs6000/biarch64.h rs6000/default64.h rs6000/linux64.h"
+ tm_file="${tm_file} vx-common.h vxworks.h rs6000/vxworks.h"
+
+ extra_options="${extra_options} rs6000/sysv4.opt linux.opt rs6000/linux64.opt"
+
+ tmake_file="${tmake_file} t-linux rs6000/t-linux64 rs6000/t-fprules rs6000/t-ppccomm"
+ tmake_file="${tmake_file} rs6000/t-vxworks"
+
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+ extra_objs="$extra_objs linux.o rs6000-linux.o"
+ ;;
powerpc-wrs-vxworks*)
tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm rs6000/t-vxworks"
@@ -4454,6 +4481,17 @@ case "${target}" in
if test x${val} != x; then
case " $x86_64_archs " in
*" ${val} "*)
+ # Disallow x86-64-v* for --with-cpu=/--with-tune=
+ # or --with-arch= or --with-arch_32=
+ # It can be only specified in --with-arch_64=
+ case "x$which$val" in
+ xcpu*x86-64-v*|xtune*x86-64-v*|xarchx86-64-v*|xarch_32x86-64-v*)
+ echo "Unknown CPU given in --with-$which=$val." 1>&2
+ exit 1
+ ;;
+ *)
+ ;;
+ esac
# OK
;;
*)
diff --git a/gcc/config.in b/gcc/config.in
index 478e74f..b7c3107 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -394,6 +394,12 @@
#endif
+/* Define if your assembler supports the --gdwarf-5 option. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_GDWARF_5_DEBUG_FLAG
+#endif
+
+
/* Define if your assembler supports .gnu_attribute. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_GNU_ATTRIBUTE
@@ -713,6 +719,13 @@
#endif
+/* Define if your assembler supports --gdwarf-4/--gdwarf-5 even with compiler
+ generated .debug_line. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_WORKING_DWARF_N_FLAG
+#endif
+
+
/* Define if your assembler supports -xbrace_comment option. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_XBRACE_COMMENT_OPTION
@@ -990,6 +1003,13 @@
#endif
+/* Define to 1 if we found a declaration for 'mallinfo2', otherwise define to
+ 0. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_DECL_MALLINFO2
+#endif
+
+
/* Define to 1 if we found a declaration for 'malloc', otherwise define to 0.
*/
#ifndef USED_FOR_TARGET
@@ -1665,6 +1685,12 @@
#endif
+/* Define to 1 if you have the `mallinfo2' function. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_MALLINFO2
+#endif
+
+
/* Define to 1 if you have the <malloc.h> header file. */
#ifndef USED_FOR_TARGET
#undef HAVE_MALLOC_H
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 4f33dd9..732a4dc 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -2024,7 +2024,7 @@ aarch64_expand_builtin_memtag (int fcode, tree exp, rtx target)
return target;
}
-/* Expand an expression EXP as fpsr or cpsr setter (depending on
+/* Expand an expression EXP as fpsr or fpcr setter (depending on
UNSPEC) using MODE. */
static void
aarch64_expand_fpsr_fpcr_setter (int unspec, machine_mode mode, tree exp)
@@ -2034,6 +2034,18 @@ aarch64_expand_fpsr_fpcr_setter (int unspec, machine_mode mode, tree exp)
emit_insn (gen_aarch64_set (unspec, mode, op));
}
+/* Expand a fpsr or fpcr getter (depending on UNSPEC) using MODE.
+ Return the target. */
+static rtx
+aarch64_expand_fpsr_fpcr_getter (enum insn_code icode, machine_mode mode,
+ rtx target)
+{
+ expand_operand op;
+ create_output_operand (&op, target, mode);
+ expand_insn (icode, 1, &op);
+ return op.value;
+}
+
/* Expand an expression EXP that calls built-in function FCODE,
with result going to TARGET if that's convenient. IGNORE is true
if the result of the builtin is ignored. */
@@ -2048,26 +2060,26 @@ aarch64_general_expand_builtin (unsigned int fcode, tree exp, rtx target,
switch (fcode)
{
case AARCH64_BUILTIN_GET_FPCR:
- emit_insn (gen_aarch64_get (UNSPECV_GET_FPCR, SImode, target));
- return target;
+ return aarch64_expand_fpsr_fpcr_getter (CODE_FOR_aarch64_get_fpcrsi,
+ SImode, target);
case AARCH64_BUILTIN_SET_FPCR:
aarch64_expand_fpsr_fpcr_setter (UNSPECV_SET_FPCR, SImode, exp);
return target;
case AARCH64_BUILTIN_GET_FPSR:
- emit_insn (gen_aarch64_get (UNSPECV_GET_FPSR, SImode, target));
- return target;
+ return aarch64_expand_fpsr_fpcr_getter (CODE_FOR_aarch64_get_fpsrsi,
+ SImode, target);
case AARCH64_BUILTIN_SET_FPSR:
aarch64_expand_fpsr_fpcr_setter (UNSPECV_SET_FPSR, SImode, exp);
return target;
case AARCH64_BUILTIN_GET_FPCR64:
- emit_insn (gen_aarch64_get (UNSPECV_GET_FPCR, DImode, target));
- return target;
+ return aarch64_expand_fpsr_fpcr_getter (CODE_FOR_aarch64_get_fpcrdi,
+ DImode, target);
case AARCH64_BUILTIN_SET_FPCR64:
aarch64_expand_fpsr_fpcr_setter (UNSPECV_SET_FPCR, DImode, exp);
return target;
case AARCH64_BUILTIN_GET_FPSR64:
- emit_insn (gen_aarch64_get (UNSPECV_GET_FPSR, DImode, target));
- return target;
+ return aarch64_expand_fpsr_fpcr_getter (CODE_FOR_aarch64_get_fpsrdi,
+ DImode, target);
case AARCH64_BUILTIN_SET_FPSR64:
aarch64_expand_fpsr_fpcr_setter (UNSPECV_SET_FPSR, DImode, exp);
return target;
@@ -2079,20 +2091,13 @@ aarch64_general_expand_builtin (unsigned int fcode, tree exp, rtx target,
arg0 = CALL_EXPR_ARG (exp, 0);
op0 = force_reg (Pmode, expand_normal (arg0));
- if (!target)
- target = gen_reg_rtx (Pmode);
- else
- target = force_reg (Pmode, target);
-
- emit_move_insn (target, op0);
-
if (fcode == AARCH64_PAUTH_BUILTIN_XPACLRI)
{
rtx lr = gen_rtx_REG (Pmode, R30_REGNUM);
icode = CODE_FOR_xpaclri;
emit_move_insn (lr, op0);
emit_insn (GEN_FCN (icode) ());
- emit_move_insn (target, lr);
+ return lr;
}
else
{
@@ -2122,20 +2127,18 @@ aarch64_general_expand_builtin (unsigned int fcode, tree exp, rtx target,
emit_move_insn (x17_reg, op0);
emit_move_insn (x16_reg, op1);
emit_insn (GEN_FCN (icode) ());
- emit_move_insn (target, x17_reg);
+ return x17_reg;
}
- return target;
-
case AARCH64_JSCVT:
- arg0 = CALL_EXPR_ARG (exp, 0);
- op0 = force_reg (DFmode, expand_normal (arg0));
- if (!target)
- target = gen_reg_rtx (SImode);
- else
- target = force_reg (SImode, target);
- emit_insn (GEN_FCN (CODE_FOR_aarch64_fjcvtzs) (target, op0));
- return target;
+ {
+ expand_operand ops[2];
+ create_output_operand (&ops[0], target, SImode);
+ op0 = expand_normal (CALL_EXPR_ARG (exp, 0));
+ create_input_operand (&ops[1], op0, DFmode);
+ expand_insn (CODE_FOR_aarch64_fjcvtzs, 2, ops);
+ return ops[0].value;
+ }
case AARCH64_SIMD_BUILTIN_FCMLA_LANEQ0_V2SF:
case AARCH64_SIMD_BUILTIN_FCMLA_LANEQ90_V2SF:
diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def
index f30ff35..3aa13f6 100644
--- a/gcc/config/aarch64/aarch64-cores.def
+++ b/gcc/config/aarch64/aarch64-cores.def
@@ -103,8 +103,11 @@ AARCH64_CORE("cortex-a75", cortexa75, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2
AARCH64_CORE("cortex-a76", cortexa76, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD, neoversen1, 0x41, 0xd0b, -1)
AARCH64_CORE("cortex-a76ae", cortexa76ae, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS, neoversen1, 0x41, 0xd0e, -1)
AARCH64_CORE("cortex-a77", cortexa77, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS, neoversen1, 0x41, 0xd0d, -1)
+AARCH64_CORE("cortex-a78", cortexa78, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS | AARCH64_FL_PROFILE, neoversen1, 0x41, 0xd41, -1)
+AARCH64_CORE("cortex-a78ae", cortexa78ae, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS | AARCH64_FL_PROFILE, neoversen1, 0x41, 0xd42, -1)
AARCH64_CORE("cortex-a65", cortexa65, cortexa53, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS, cortexa73, 0x41, 0xd06, -1)
AARCH64_CORE("cortex-a65ae", cortexa65ae, cortexa53, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS, cortexa73, 0x41, 0xd43, -1)
+AARCH64_CORE("cortex-x1", cortexx1, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS | AARCH64_FL_PROFILE, neoversen1, 0x41, 0xd44, -1)
AARCH64_CORE("ares", ares, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_PROFILE, neoversen1, 0x41, 0xd0c, -1)
AARCH64_CORE("neoverse-n1", neoversen1, cortexa57, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_PROFILE, neoversen1, 0x41, 0xd0c, -1)
AARCH64_CORE("neoverse-e1", neoversee1, cortexa53, 8_2A, AARCH64_FL_FOR_ARCH8_2 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_DOTPROD | AARCH64_FL_SSBS, cortexa73, 0x41, 0xd4a, -1)
@@ -133,11 +136,15 @@ AARCH64_CORE("thunderx3t110", thunderx3t110, thunderx3t110, 8_3A, AARCH64_FL_
/* ARMv8.4-A Architecture Processors. */
/* Arm ('A') cores. */
-AARCH64_CORE("zeus", zeus, cortexa57, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_SVE | AARCH64_FL_RCPC | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_PROFILE | AARCH64_FL_SSBS | AARCH64_FL_RNG, neoversen1, 0x41, 0xd40, -1)
+AARCH64_CORE("zeus", zeus, cortexa57, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_SVE | AARCH64_FL_RCPC | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_PROFILE | AARCH64_FL_SSBS | AARCH64_FL_RNG, neoversev1, 0x41, 0xd40, -1)
+AARCH64_CORE("neoverse-v1", neoversev1, cortexa57, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_SVE | AARCH64_FL_RCPC | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_PROFILE | AARCH64_FL_SSBS | AARCH64_FL_RNG, neoversev1, 0x41, 0xd40, -1)
/* Qualcomm ('Q') cores. */
AARCH64_CORE("saphira", saphira, saphira, 8_4A, AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_CRYPTO | AARCH64_FL_RCPC, saphira, 0x51, 0xC01, -1)
+/* Armv8.5-A Architecture Processors. */
+AARCH64_CORE("neoverse-n2", neoversen2, cortexa57, 8_5A, AARCH64_FL_FOR_ARCH8_5 | AARCH64_FL_I8MM | AARCH64_FL_BF16 | AARCH64_FL_F16 | AARCH64_FL_SVE | AARCH64_FL_SVE2 | AARCH64_FL_SVE2_BITPERM | AARCH64_FL_RNG | AARCH64_FL_MEMTAG, neoversen2, 0x41, 0xd49, -1)
+
/* ARMv8-A big.LITTLE implementations. */
AARCH64_CORE("cortex-a57.cortex-a53", cortexa57cortexa53, cortexa53, 8A, AARCH64_FL_FOR_ARCH8 | AARCH64_FL_CRC, cortexa57, 0x41, AARCH64_BIG_LITTLE (0xd07, 0xd03), -1)
diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def
index 8257df9..ca08642 100644
--- a/gcc/config/aarch64/aarch64-option-extensions.def
+++ b/gcc/config/aarch64/aarch64-option-extensions.def
@@ -155,7 +155,7 @@ AARCH64_OPT_EXTENSION("sve", AARCH64_FL_SVE, AARCH64_FL_FP | AARCH64_FL_SIMD | \
AARCH64_OPT_EXTENSION("profile", AARCH64_FL_PROFILE, 0, 0, false, "")
/* Enabling/Disabling "rng" only changes "rng". */
-AARCH64_OPT_EXTENSION("rng", AARCH64_FL_RNG, 0, 0, false, "")
+AARCH64_OPT_EXTENSION("rng", AARCH64_FL_RNG, 0, 0, false, "rng")
/* Enabling/Disabling "memtag" only changes "memtag". */
AARCH64_OPT_EXTENSION("memtag", AARCH64_FL_MEMTAG, 0, 0, false, "")
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index c7e828d..7a34c84 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -136,6 +136,25 @@ enum aarch64_addr_query_type {
ADDR_QUERY_ANY
};
+/* Enumerates values that can be arbitrarily mixed into a calculation
+ in order to make the result of the calculation unique to its use case.
+
+ AARCH64_SALT_SSP_SET
+ AARCH64_SALT_SSP_TEST
+ Used when calculating the address of the stack protection canary value.
+ There is a separate value for setting and testing the canary, meaning
+ that these two operations produce unique addresses: they are different
+ from each other, and from all other address calculations.
+
+ The main purpose of this is to prevent the SET address being spilled
+ to the stack and reloaded for the TEST, since that would give an
+ attacker the opportunity to change the address of the expected
+ canary value. */
+enum aarch64_salt_type {
+ AARCH64_SALT_SSP_SET,
+ AARCH64_SALT_SSP_TEST
+};
+
/* A set of tuning parameters contains references to size and time
cost models and vectors for address cost calculations, register
move costs and memory move costs. */
@@ -608,9 +627,9 @@ opt_machine_mode aarch64_ptrue_all_mode (rtx);
rtx aarch64_convert_sve_data_to_pred (rtx, machine_mode, rtx);
rtx aarch64_expand_sve_dupq (rtx, machine_mode, rtx);
void aarch64_expand_mov_immediate (rtx, rtx);
+rtx aarch64_stack_protect_canary_mem (machine_mode, rtx, aarch64_salt_type);
rtx aarch64_ptrue_reg (machine_mode);
rtx aarch64_pfalse_reg (machine_mode);
-bool aarch64_sve_pred_dominates_p (rtx *, rtx);
bool aarch64_sve_same_pred_for_ptest_p (rtx *, rtx *);
void aarch64_emit_sve_pred_move (rtx, rtx, rtx);
void aarch64_expand_sve_mem_move (rtx, rtx, machine_mode);
diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def
index d1b2110..5bc596d 100644
--- a/gcc/config/aarch64/aarch64-simd-builtins.def
+++ b/gcc/config/aarch64/aarch64-simd-builtins.def
@@ -45,8 +45,8 @@
BUILTIN_VDC (COMBINE, combine, 0, ALL)
VAR1 (COMBINEP, combine, 0, ALL, di)
- BUILTIN_VB (BINOP, pmul, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP, fmulx, 0, ALL)
+ BUILTIN_VB (BINOP, pmul, 0, NONE)
+ BUILTIN_VHSDF_HSDF (BINOP, fmulx, 0, FP)
BUILTIN_VHSDF_DF (UNOP, sqrt, 2, ALL)
BUILTIN_VD_BHSI (BINOP, addp, 0, NONE)
VAR1 (UNOP, addp, 0, NONE, di)
@@ -70,26 +70,26 @@
BUILTIN_VSDQ_I (BINOP_UUS, usqadd, 0, ALL)
/* Implemented by aarch64_get_dreg<VSTRUCT:mode><VDC:mode>. */
- BUILTIN_VDC (GETREG, get_dregoi, 0, ALL)
- BUILTIN_VDC (GETREG, get_dregci, 0, ALL)
- BUILTIN_VDC (GETREG, get_dregxi, 0, ALL)
- VAR1 (GETREGP, get_dregoi, 0, ALL, di)
- VAR1 (GETREGP, get_dregci, 0, ALL, di)
- VAR1 (GETREGP, get_dregxi, 0, ALL, di)
+ BUILTIN_VDC (GETREG, get_dregoi, 0, AUTO_FP)
+ BUILTIN_VDC (GETREG, get_dregci, 0, AUTO_FP)
+ BUILTIN_VDC (GETREG, get_dregxi, 0, AUTO_FP)
+ VAR1 (GETREGP, get_dregoi, 0, AUTO_FP, di)
+ VAR1 (GETREGP, get_dregci, 0, AUTO_FP, di)
+ VAR1 (GETREGP, get_dregxi, 0, AUTO_FP, di)
/* Implemented by aarch64_get_qreg<VSTRUCT:mode><VQ:mode>. */
- BUILTIN_VQ (GETREG, get_qregoi, 0, ALL)
- BUILTIN_VQ (GETREG, get_qregci, 0, ALL)
- BUILTIN_VQ (GETREG, get_qregxi, 0, ALL)
- VAR1 (GETREGP, get_qregoi, 0, ALL, v2di)
- VAR1 (GETREGP, get_qregci, 0, ALL, v2di)
- VAR1 (GETREGP, get_qregxi, 0, ALL, v2di)
+ BUILTIN_VQ (GETREG, get_qregoi, 0, AUTO_FP)
+ BUILTIN_VQ (GETREG, get_qregci, 0, AUTO_FP)
+ BUILTIN_VQ (GETREG, get_qregxi, 0, AUTO_FP)
+ VAR1 (GETREGP, get_qregoi, 0, AUTO_FP, v2di)
+ VAR1 (GETREGP, get_qregci, 0, AUTO_FP, v2di)
+ VAR1 (GETREGP, get_qregxi, 0, AUTO_FP, v2di)
/* Implemented by aarch64_set_qreg<VSTRUCT:mode><VQ:mode>. */
- BUILTIN_VQ (SETREG, set_qregoi, 0, ALL)
- BUILTIN_VQ (SETREG, set_qregci, 0, ALL)
- BUILTIN_VQ (SETREG, set_qregxi, 0, ALL)
- VAR1 (SETREGP, set_qregoi, 0, ALL, v2di)
- VAR1 (SETREGP, set_qregci, 0, ALL, v2di)
- VAR1 (SETREGP, set_qregxi, 0, ALL, v2di)
+ BUILTIN_VQ (SETREG, set_qregoi, 0, AUTO_FP)
+ BUILTIN_VQ (SETREG, set_qregci, 0, AUTO_FP)
+ BUILTIN_VQ (SETREG, set_qregxi, 0, AUTO_FP)
+ VAR1 (SETREGP, set_qregoi, 0, AUTO_FP, v2di)
+ VAR1 (SETREGP, set_qregci, 0, AUTO_FP, v2di)
+ VAR1 (SETREGP, set_qregxi, 0, AUTO_FP, v2di)
/* Implemented by aarch64_ld1x2<VQ:mode>. */
BUILTIN_VQ (LOADSTRUCT, ld1x2, 0, ALL)
/* Implemented by aarch64_ld1x2<VDC:mode>. */
@@ -159,7 +159,7 @@
BUILTIN_VQN (TERNOP, raddhn2, 0, NONE)
BUILTIN_VQN (TERNOP, rsubhn2, 0, NONE)
- BUILTIN_VSQN_HSDI (UNOP, sqmovun, 0, ALL)
+ BUILTIN_VSQN_HSDI (UNOPUS, sqmovun, 0, ALL)
/* Implemented by aarch64_<sur>qmovn<mode>. */
BUILTIN_VSQN_HSDI (UNOP, sqmovn, 0, ALL)
BUILTIN_VSQN_HSDI (UNOP, uqmovn, 0, ALL)
@@ -189,11 +189,11 @@
BUILTIN_VQ_HSI (TERNOP, sqdmlal2_n, 0, ALL)
BUILTIN_VQ_HSI (TERNOP, sqdmlsl2_n, 0, ALL)
- BUILTIN_VD_BHSI (BINOP, intrinsic_vec_smult_lo_, 0, ALL)
- BUILTIN_VD_BHSI (BINOPU, intrinsic_vec_umult_lo_, 0, ALL)
+ BUILTIN_VD_BHSI (BINOP, intrinsic_vec_smult_lo_, 0, NONE)
+ BUILTIN_VD_BHSI (BINOPU, intrinsic_vec_umult_lo_, 0, NONE)
- BUILTIN_VQW (BINOP, vec_widen_smult_hi_, 10, ALL)
- BUILTIN_VQW (BINOPU, vec_widen_umult_hi_, 10, ALL)
+ BUILTIN_VQW (BINOP, vec_widen_smult_hi_, 10, NONE)
+ BUILTIN_VQW (BINOPU, vec_widen_umult_hi_, 10, NONE)
BUILTIN_VD_HSI (TERNOP_LANE, vec_smult_lane_, 0, ALL)
BUILTIN_VD_HSI (QUADOP_LANE, vec_smlal_lane_, 0, ALL)
@@ -246,10 +246,10 @@
BUILTIN_VHSDF (BINOP, fcadd270, 0, FP)
/* Implemented by aarch64_fcmla{_lane}{q}<rot><mode>. */
- BUILTIN_VHSDF (TERNOP, fcmla0, 0, ALL)
- BUILTIN_VHSDF (TERNOP, fcmla90, 0, ALL)
- BUILTIN_VHSDF (TERNOP, fcmla180, 0, ALL)
- BUILTIN_VHSDF (TERNOP, fcmla270, 0, ALL)
+ BUILTIN_VHSDF (TERNOP, fcmla0, 0, FP)
+ BUILTIN_VHSDF (TERNOP, fcmla90, 0, FP)
+ BUILTIN_VHSDF (TERNOP, fcmla180, 0, FP)
+ BUILTIN_VHSDF (TERNOP, fcmla270, 0, FP)
BUILTIN_VHSDF (QUADOP_LANE_PAIR, fcmla_lane0, 0, ALL)
BUILTIN_VHSDF (QUADOP_LANE_PAIR, fcmla_lane90, 0, ALL)
BUILTIN_VHSDF (QUADOP_LANE_PAIR, fcmla_lane180, 0, ALL)
@@ -338,12 +338,11 @@
BUILTIN_VHSDF (UNOP, nearbyint, 2, FP)
BUILTIN_VHSDF (UNOP, rint, 2, FP)
BUILTIN_VHSDF (UNOP, round, 2, FP)
- BUILTIN_VHSDF_DF (UNOP, frintn, 2, FP)
+ BUILTIN_VHSDF_HSDF (UNOP, frintn, 2, FP)
VAR1 (UNOP, btrunc, 2, FP, hf)
VAR1 (UNOP, ceil, 2, FP, hf)
VAR1 (UNOP, floor, 2, FP, hf)
- VAR1 (UNOP, frintn, 2, FP, hf)
VAR1 (UNOP, nearbyint, 2, FP, hf)
VAR1 (UNOP, rint, 2, FP, hf)
VAR1 (UNOP, round, 2, FP, hf)
@@ -535,8 +534,8 @@
VAR1 (TERNOPU, crypto_sha256su1, 0, ALL, v4si)
/* Implemented by aarch64_crypto_pmull<mode>. */
- VAR1 (BINOPP, crypto_pmull, 0, ALL, di)
- VAR1 (BINOPP, crypto_pmull, 0, ALL, v2di)
+ VAR1 (BINOPP, crypto_pmull, 0, NONE, di)
+ VAR1 (BINOPP, crypto_pmull, 0, NONE, v2di)
/* Implemented by aarch64_tbl3<mode>. */
VAR1 (BINOP, tbl3, 0, ALL, v8qi)
@@ -667,15 +666,15 @@
BUILTIN_VQ_I (TERNOP, bcaxq, 4, ALL)
/* Implemented by aarch64_fml<f16mac1>l<f16quad>_low<mode>. */
- VAR1 (TERNOP, fmlal_low, 0, ALL, v2sf)
- VAR1 (TERNOP, fmlsl_low, 0, ALL, v2sf)
- VAR1 (TERNOP, fmlalq_low, 0, ALL, v4sf)
- VAR1 (TERNOP, fmlslq_low, 0, ALL, v4sf)
+ VAR1 (TERNOP, fmlal_low, 0, FP, v2sf)
+ VAR1 (TERNOP, fmlsl_low, 0, FP, v2sf)
+ VAR1 (TERNOP, fmlalq_low, 0, FP, v4sf)
+ VAR1 (TERNOP, fmlslq_low, 0, FP, v4sf)
/* Implemented by aarch64_fml<f16mac1>l<f16quad>_high<mode>. */
- VAR1 (TERNOP, fmlal_high, 0, ALL, v2sf)
- VAR1 (TERNOP, fmlsl_high, 0, ALL, v2sf)
- VAR1 (TERNOP, fmlalq_high, 0, ALL, v4sf)
- VAR1 (TERNOP, fmlslq_high, 0, ALL, v4sf)
+ VAR1 (TERNOP, fmlal_high, 0, FP, v2sf)
+ VAR1 (TERNOP, fmlsl_high, 0, FP, v2sf)
+ VAR1 (TERNOP, fmlalq_high, 0, FP, v4sf)
+ VAR1 (TERNOP, fmlslq_high, 0, FP, v4sf)
/* Implemented by aarch64_fml<f16mac1>l_lane_lowv2sf. */
VAR1 (QUADOP_LANE, fmlal_lane_low, 0, ALL, v2sf)
VAR1 (QUADOP_LANE, fmlsl_lane_low, 0, ALL, v2sf)
@@ -713,20 +712,20 @@
VAR2 (QUADOP_LANE_PAIR, bfdot_laneq, 0, ALL, v2sf, v4sf)
/* Implemented by aarch64_bfmmlaqv4sf */
- VAR1 (TERNOP, bfmmlaq, 0, ALL, v4sf)
+ VAR1 (TERNOP, bfmmlaq, 0, AUTO_FP, v4sf)
/* Implemented by aarch64_bfmlal<bt>{_lane{q}}v4sf */
- VAR1 (TERNOP, bfmlalb, 0, ALL, v4sf)
- VAR1 (TERNOP, bfmlalt, 0, ALL, v4sf)
+ VAR1 (TERNOP, bfmlalb, 0, FP, v4sf)
+ VAR1 (TERNOP, bfmlalt, 0, FP, v4sf)
VAR1 (QUADOP_LANE, bfmlalb_lane, 0, ALL, v4sf)
VAR1 (QUADOP_LANE, bfmlalt_lane, 0, ALL, v4sf)
VAR1 (QUADOP_LANE, bfmlalb_lane_q, 0, ALL, v4sf)
VAR1 (QUADOP_LANE, bfmlalt_lane_q, 0, ALL, v4sf)
/* Implemented by aarch64_simd_<sur>mmlav16qi. */
- VAR1 (TERNOP, simd_smmla, 0, ALL, v16qi)
- VAR1 (TERNOPU, simd_ummla, 0, ALL, v16qi)
- VAR1 (TERNOP_SSUS, simd_usmmla, 0, ALL, v16qi)
+ VAR1 (TERNOP, simd_smmla, 0, NONE, v16qi)
+ VAR1 (TERNOPU, simd_ummla, 0, NONE, v16qi)
+ VAR1 (TERNOP_SSUS, simd_usmmla, 0, NONE, v16qi)
/* Implemented by aarch64_bfcvtn{q}{2}<mode> */
VAR1 (UNOP, bfcvtn, 0, ALL, v4bf)
diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md
index cd79aba..31a8c5a 100644
--- a/gcc/config/aarch64/aarch64-sve.md
+++ b/gcc/config/aarch64/aarch64-sve.md
@@ -464,6 +464,95 @@
;;
;; - MNEMONIC is the mnemonic of the associated SVE instruction.
;;
+;; For (3) and (4), we combine these operations with an UNSPEC_SEL
+;; that selects between the result of the FP operation and the "else"
+;; value. (This else value is a merge input for _m ACLE functions
+;; and zero for _z ACLE functions.) The outer pattern then has the form:
+;;
+;; (unspec [pred fp_operation else_value] UNSPEC_SEL)
+;;
+;; This means that the patterns for (3) and (4) have two predicates:
+;; one for the FP operation itself and one for the UNSPEC_SEL.
+;; This pattern is equivalent to the result of combining an instance
+;; of (1) or (2) with a separate vcond instruction, so these patterns
+;; are useful as combine targets too.
+;;
+;; However, in the combine case, the instructions that we want to
+;; combine might use different predicates. Then:
+;;
+;; - Some of the active lanes of the FP operation might be discarded
+;; by the UNSPEC_SEL. It's OK to drop the FP operation on those lanes,
+;; even for SVE_STRICT_GP, since the operations on those lanes are
+;; effectively dead code.
+;;
+;; - Some of the inactive lanes of the FP operation might be selected
+;; by the UNSPEC_SEL, giving unspecified values for those lanes.
+;; SVE_RELAXED_GP lets us extend the FP operation to cover these
+;; extra lanes, but SVE_STRICT_GP does not.
+;;
+;; Thus SVE_RELAXED_GP allows us to ignore the predicate on the FP operation
+;; and operate on exactly the lanes selected by the UNSPEC_SEL predicate.
+;; This typically leads to patterns like:
+;;
+;; (unspec [(match_operand 1 "register_operand" "Upl")
+;; (unspec [(match_operand N)
+;; (const_int SVE_RELAXED_GP)
+;; ...]
+;; UNSPEC_COND_<MNEMONIC>)
+;; ...])
+;;
+;; where operand N is allowed to be anything. These instructions then
+;; have rewrite rules to replace operand N with operand 1, which gives the
+;; instructions a canonical form and means that the original operand N is
+;; not kept live unnecessarily.
+;;
+;; In contrast, SVE_STRICT_GP only allows the UNSPEC_SEL predicate to be
+;; a subset of the FP operation predicate. This case isn't interesting
+;; for FP operations that have an all-true predicate, since such operations
+;; use SVE_RELAXED_GP instead. And it is not possible for instruction
+;; conditions to track the subset relationship for arbitrary registers.
+;; So in practice, the only useful case for SVE_STRICT_GP is the one
+;; in which the predicates match:
+;;
+;; (unspec [(match_operand 1 "register_operand" "Upl")
+;; (unspec [(match_dup 1)
+;; (const_int SVE_STRICT_GP)
+;; ...]
+;; UNSPEC_COND_<MNEMONIC>)
+;; ...])
+;;
+;; This pattern would also be correct for SVE_RELAXED_GP, but it would
+;; be redundant with the one above. However, if the combine pattern
+;; has multiple FP operations, using a match_operand allows combinations
+;; of SVE_STRICT_GP and SVE_RELAXED_GP in the same operation, provided
+;; that the predicates are the same:
+;;
+;; (unspec [(match_operand 1 "register_operand" "Upl")
+;; (...
+;; (unspec [(match_dup 1)
+;; (match_operand:SI N "aarch64_sve_gp_strictness")
+;; ...]
+;; UNSPEC_COND_<MNEMONIC1>)
+;; (unspec [(match_dup 1)
+;; (match_operand:SI M "aarch64_sve_gp_strictness")
+;; ...]
+;; UNSPEC_COND_<MNEMONIC2>) ...)
+;; ...])
+;;
+;; The fully-relaxed version of this pattern is:
+;;
+;; (unspec [(match_operand 1 "register_operand" "Upl")
+;; (...
+;; (unspec [(match_operand:SI N)
+;; (const_int SVE_RELAXED_GP)
+;; ...]
+;; UNSPEC_COND_<MNEMONIC1>)
+;; (unspec [(match_operand:SI M)
+;; (const_int SVE_RELAXED_GP)
+;; ...]
+;; UNSPEC_COND_<MNEMONIC2>) ...)
+;; ...])
+;;
;; -------------------------------------------------------------------------
;; ---- Note on FFR handling
;; -------------------------------------------------------------------------
@@ -3304,18 +3393,18 @@
)
;; Predicated floating-point unary arithmetic, merging with the first input.
-(define_insn_and_rewrite "*cond_<optab><mode>_2"
+(define_insn_and_rewrite "*cond_<optab><mode>_2_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 3)
- (match_operand:SI 4 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")]
SVE_COND_FP_UNARY)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[3], operands[1])"
+ "TARGET_SVE"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>
movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>"
@@ -3326,6 +3415,24 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_2_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")]
+ SVE_COND_FP_UNARY)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>
+ movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point unary arithmetic, merging with an independent
;; value.
;;
@@ -3334,20 +3441,18 @@
;; which is handled above rather than here. Marking all the alternatives
;; as earlyclobber helps to make the instruction more regular to the
;; register allocator.
-(define_insn_and_rewrite "*cond_<optab><mode>_any"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, ?&w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")]
SVE_COND_FP_UNARY)
(match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && !rtx_equal_p (operands[2], operands[3])
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[3])"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
@@ -3359,6 +3464,25 @@
[(set_attr "movprfx" "*,yes,yes")]
)
+(define_insn "*cond_<optab><mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, ?&w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")]
+ SVE_COND_FP_UNARY)
+ (match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[3])"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
+ movprfx\t%0, %3\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>"
+ [(set_attr "movprfx" "*,yes,yes")]
+)
+
;; -------------------------------------------------------------------------
;; ---- [FP] Square root
;; -------------------------------------------------------------------------
@@ -4649,19 +4773,19 @@
;; Predicated floating-point binary operations that take an integer as their
;; second operand, with inactive lanes coming from the first operand.
-(define_insn_and_rewrite "*cond_<optab><mode>_2"
+(define_insn_and_rewrite "*cond_<optab><mode>_2_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")
(match_operand:<V_INT_EQUIV> 3 "register_operand" "w, w")]
SVE_COND_FP_BINARY_INT)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
@@ -4672,24 +4796,41 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_2_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")
+ (match_operand:<V_INT_EQUIV> 3 "register_operand" "w, w")]
+ SVE_COND_FP_BINARY_INT)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point binary operations that take an integer as
;; their second operand, with the values of inactive lanes being distinct
;; from the other inputs.
-(define_insn_and_rewrite "*cond_<optab><mode>_any"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w, w, w")
(match_operand:<V_INT_EQUIV> 3 "register_operand" "w, w, w, w")]
SVE_COND_FP_BINARY_INT)
(match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && !rtx_equal_p (operands[2], operands[4])
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
"@
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
@@ -4713,6 +4854,35 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_<optab><mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w, w, w")
+ (match_operand:<V_INT_EQUIV> 3 "register_operand" "w, w, w, w")]
+ SVE_COND_FP_BINARY_INT)
+ (match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ #"
+ "&& reload_completed
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[2],
+ operands[4], operands[1]));
+ operands[4] = operands[2] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; -------------------------------------------------------------------------
;; ---- [FP] General binary arithmetic corresponding to rtx codes
;; -------------------------------------------------------------------------
@@ -4813,19 +4983,19 @@
)
;; Predicated floating-point operations, merging with the first input.
-(define_insn_and_rewrite "*cond_<optab><mode>_2"
+(define_insn_and_rewrite "*cond_<optab><mode>_2_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
SVE_COND_FP_BINARY)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
@@ -4836,20 +5006,39 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_2_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
+ SVE_COND_FP_BINARY)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Same for operations that take a 1-bit constant.
-(define_insn_and_rewrite "*cond_<optab><mode>_2_const"
+(define_insn_and_rewrite "*cond_<optab><mode>_2_const_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")
(match_operand:SVE_FULL_F 3 "<sve_pred_fp_rhs2_immediate>")]
SVE_COND_FP_BINARY_I1)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3"
@@ -4860,20 +5049,39 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_2_const_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")
+ (match_operand:SVE_FULL_F 3 "<sve_pred_fp_rhs2_immediate>")]
+ SVE_COND_FP_BINARY_I1)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point operations, merging with the second input.
-(define_insn_and_rewrite "*cond_<optab><mode>_3"
+(define_insn_and_rewrite "*cond_<optab><mode>_3_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "0, w")]
SVE_COND_FP_BINARY)
(match_dup 3)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
<sve_fp_op_rev>\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
movprfx\t%0, %3\;<sve_fp_op_rev>\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>"
@@ -4884,14 +5092,33 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_3_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "0, w")]
+ SVE_COND_FP_BINARY)
+ (match_dup 3)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fp_op_rev>\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
+ movprfx\t%0, %3\;<sve_fp_op_rev>\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point operations, merging with an independent value.
-(define_insn_and_rewrite "*cond_<optab><mode>_any"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w, w, w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, 0, w, w, w")]
SVE_COND_FP_BINARY)
@@ -4899,8 +5126,7 @@
UNSPEC_SEL))]
"TARGET_SVE
&& !rtx_equal_p (operands[2], operands[4])
- && !rtx_equal_p (operands[3], operands[4])
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ && !rtx_equal_p (operands[3], operands[4])"
"@
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fp_op_rev>\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
@@ -4925,22 +5151,52 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_<optab><mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w, w, w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, 0, w, w, w")]
+ SVE_COND_FP_BINARY)
+ (match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE
+ && !rtx_equal_p (operands[2], operands[4])
+ && !rtx_equal_p (operands[3], operands[4])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fp_op_rev>\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ #"
+ "&& reload_completed
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[2],
+ operands[4], operands[1]));
+ operands[4] = operands[2] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; Same for operations that take a 1-bit constant.
-(define_insn_and_rewrite "*cond_<optab><mode>_any_const"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_const_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")
(match_operand:SVE_FULL_F 3 "<sve_pred_fp_rhs2_immediate>")]
SVE_COND_FP_BINARY_I1)
(match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, 0, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && !rtx_equal_p (operands[2], operands[4])
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
"@
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
@@ -4963,6 +5219,34 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_<optab><mode>_any_const_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, ?w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")
+ (match_operand:SVE_FULL_F 3 "<sve_pred_fp_rhs2_immediate>")]
+ SVE_COND_FP_BINARY_I1)
+ (match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ #"
+ "&& reload_completed
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[2],
+ operands[4], operands[1]));
+ operands[4] = operands[2] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; -------------------------------------------------------------------------
;; ---- [FP] Addition
;; -------------------------------------------------------------------------
@@ -5001,19 +5285,19 @@
;; Predicated floating-point addition of a constant, merging with the
;; first input.
-(define_insn_and_rewrite "*cond_add<mode>_2_const"
+(define_insn_and_rewrite "*cond_add<mode>_2_const_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, ?w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, 0, w, w")
(match_operand:SVE_FULL_F 3 "aarch64_sve_float_arith_with_sub_immediate" "vsA, vsN, vsA, vsN")]
UNSPEC_COND_FADD)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3
@@ -5026,23 +5310,42 @@
[(set_attr "movprfx" "*,*,yes,yes")]
)
+(define_insn "*cond_add<mode>_2_const_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, ?w, ?w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, 0, w, w")
+ (match_operand:SVE_FULL_F 3 "aarch64_sve_float_arith_with_sub_immediate" "vsA, vsN, vsA, vsN")]
+ UNSPEC_COND_FADD)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3
+ movprfx\t%0, %2\;fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ movprfx\t%0, %2\;fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3"
+ [(set_attr "movprfx" "*,*,yes,yes")]
+)
+
;; Predicated floating-point addition of a constant, merging with an
;; independent value.
-(define_insn_and_rewrite "*cond_add<mode>_any_const"
+(define_insn_and_rewrite "*cond_add<mode>_any_const_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, w, w, ?w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, w, w, w, w")
(match_operand:SVE_FULL_F 3 "aarch64_sve_float_arith_with_sub_immediate" "vsA, vsN, vsA, vsN, vsA, vsN")]
UNSPEC_COND_FADD)
(match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, 0, w, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && !rtx_equal_p (operands[2], operands[4])
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
"@
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3
@@ -5068,6 +5371,37 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_add<mode>_any_const_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, w, w, ?w, ?w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, w, w, w, w")
+ (match_operand:SVE_FULL_F 3 "aarch64_sve_float_arith_with_sub_immediate" "vsA, vsN, vsA, vsN, vsA, vsN")]
+ UNSPEC_COND_FADD)
+ (match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, 0, w, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3
+ #
+ #"
+ "&& reload_completed
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[2],
+ operands[4], operands[1]));
+ operands[4] = operands[2] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; Register merging forms are handled through SVE_COND_FP_BINARY.
;; -------------------------------------------------------------------------
@@ -5110,19 +5444,19 @@
)
;; Predicated FCADD, merging with the first input.
-(define_insn_and_rewrite "*cond_<optab><mode>_2"
+(define_insn_and_rewrite "*cond_<optab><mode>_2_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
SVE_COND_FCADD)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
movprfx\t%0, %2\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>"
@@ -5133,22 +5467,39 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_2_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
+ SVE_COND_FCADD)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
+ movprfx\t%0, %2\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated FCADD, merging with an independent value.
-(define_insn_and_rewrite "*cond_<optab><mode>_any"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, 0, w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w, w, w")]
SVE_COND_FCADD)
(match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && !rtx_equal_p (operands[2], operands[4])
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
"@
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
@@ -5172,6 +5523,35 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_<optab><mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, 0, w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w, w, w")]
+ SVE_COND_FCADD)
+ (match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && !rtx_equal_p (operands[2], operands[4])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;fcadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>, #<rot>
+ #"
+ "&& reload_completed
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[2],
+ operands[4], operands[1]));
+ operands[4] = operands[2] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; -------------------------------------------------------------------------
;; ---- [FP] Subtraction
;; -------------------------------------------------------------------------
@@ -5209,19 +5589,19 @@
;; Predicated floating-point subtraction from a constant, merging with the
;; second input.
-(define_insn_and_rewrite "*cond_sub<mode>_3_const"
+(define_insn_and_rewrite "*cond_sub<mode>_3_const_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "aarch64_sve_float_arith_immediate")
(match_operand:SVE_FULL_F 3 "register_operand" "0, w")]
UNSPEC_COND_FSUB)
(match_dup 3)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE"
"@
fsubr\t%0.<Vetype>, %1/m, %0.<Vetype>, #%2
movprfx\t%0, %3\;fsubr\t%0.<Vetype>, %1/m, %0.<Vetype>, #%2"
@@ -5232,12 +5612,28 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_sub<mode>_3_const_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "aarch64_sve_float_arith_immediate")
+ (match_operand:SVE_FULL_F 3 "register_operand" "0, w")]
+ UNSPEC_COND_FSUB)
+ (match_dup 3)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ fsubr\t%0.<Vetype>, %1/m, %0.<Vetype>, #%2
+ movprfx\t%0, %3\;fsubr\t%0.<Vetype>, %1/m, %0.<Vetype>, #%2"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point subtraction from a constant, merging with an
;; independent value.
-;;
-;; The subtraction predicate and the merge predicate are allowed to be
-;; different.
-(define_insn_and_rewrite "*cond_sub<mode>_relaxed_const"
+(define_insn_and_rewrite "*cond_sub<mode>_const_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
@@ -5272,11 +5668,7 @@
[(set_attr "movprfx" "yes")]
)
-;; Predicated floating-point subtraction from a constant, merging with an
-;; independent value.
-;;
-;; The subtraction predicate and the merge predicate must be the same.
-(define_insn_and_rewrite "*cond_sub<mode>_strict_const"
+(define_insn_and_rewrite "*cond_sub<mode>_const_strict"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, w, ?w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
@@ -5329,19 +5721,19 @@
)
;; Predicated floating-point absolute difference.
-(define_insn_and_rewrite "*aarch64_pred_abd<mode>"
+(define_insn_and_rewrite "*aarch64_pred_abd<mode>_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(match_operand:SI 4 "aarch64_sve_gp_strictness")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "%0, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
UNSPEC_COND_FSUB)]
UNSPEC_COND_FABS))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE"
"@
fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0, %2\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
@@ -5352,6 +5744,25 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*aarch64_pred_abd<mode>_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (match_operand:SI 4 "aarch64_sve_gp_strictness")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "%0, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
+ UNSPEC_COND_FSUB)]
+ UNSPEC_COND_FABS))]
+ "TARGET_SVE"
+ "@
+ fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0, %2\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
(define_expand "@aarch64_cond_abd<mode>"
[(set (match_operand:SVE_FULL_F 0 "register_operand")
(unspec:SVE_FULL_F
@@ -5376,82 +5787,124 @@
;; Predicated floating-point absolute difference, merging with the first
;; input.
-(define_insn_and_rewrite "*aarch64_cond_abd<mode>_2"
+(define_insn_and_rewrite "*aarch64_cond_abd<mode>_2_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(unspec:SVE_FULL_F
- [(match_operand 6)
- (match_operand:SI 7 "aarch64_sve_gp_strictness")
+ [(match_operand 5)
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
UNSPEC_COND_FSUB)]
UNSPEC_COND_FABS)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])
- && aarch64_sve_pred_dominates_p (&operands[6], operands[1])"
+ "TARGET_SVE"
"@
fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0, %2\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
"&& (!rtx_equal_p (operands[1], operands[4])
- || !rtx_equal_p (operands[1], operands[6]))"
+ || !rtx_equal_p (operands[1], operands[5]))"
{
operands[4] = copy_rtx (operands[1]);
- operands[6] = copy_rtx (operands[1]);
+ operands[5] = copy_rtx (operands[1]);
}
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*aarch64_cond_abd<mode>_2_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 4 "aarch64_sve_gp_strictness")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")]
+ UNSPEC_COND_FSUB)]
+ UNSPEC_COND_FABS)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0, %2\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point absolute difference, merging with the second
;; input.
-(define_insn_and_rewrite "*aarch64_cond_abd<mode>_3"
+(define_insn_and_rewrite "*aarch64_cond_abd<mode>_3_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(unspec:SVE_FULL_F
- [(match_operand 6)
- (match_operand:SI 7 "aarch64_sve_gp_strictness")
+ [(match_operand 5)
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "0, w")]
UNSPEC_COND_FSUB)]
UNSPEC_COND_FABS)
(match_dup 3)]
UNSPEC_SEL))]
- "TARGET_SVE
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])
- && aarch64_sve_pred_dominates_p (&operands[6], operands[1])"
+ "TARGET_SVE"
"@
fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
movprfx\t%0, %3\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>"
"&& (!rtx_equal_p (operands[1], operands[4])
- || !rtx_equal_p (operands[1], operands[6]))"
+ || !rtx_equal_p (operands[1], operands[5]))"
{
operands[4] = copy_rtx (operands[1]);
- operands[6] = copy_rtx (operands[1]);
+ operands[5] = copy_rtx (operands[1]);
}
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*aarch64_cond_abd<mode>_3_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 4 "aarch64_sve_gp_strictness")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "0, w")]
+ UNSPEC_COND_FSUB)]
+ UNSPEC_COND_FABS)
+ (match_dup 3)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
+ movprfx\t%0, %3\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point absolute difference, merging with an
;; independent value.
-(define_insn_and_rewrite "*aarch64_cond_abd<mode>_any"
+(define_insn_and_rewrite "*aarch64_cond_abd<mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(unspec:SVE_FULL_F
- [(match_operand 7)
- (match_operand:SI 8 "aarch64_sve_gp_strictness")
+ [(match_operand 6)
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w, w, w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, 0, w, w, w")]
UNSPEC_COND_FSUB)]
@@ -5460,9 +5913,7 @@
UNSPEC_SEL))]
"TARGET_SVE
&& !rtx_equal_p (operands[2], operands[4])
- && !rtx_equal_p (operands[3], operands[4])
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])
- && aarch64_sve_pred_dominates_p (&operands[7], operands[1])"
+ && !rtx_equal_p (operands[3], operands[4])"
"@
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
@@ -5472,18 +5923,18 @@
"&& 1"
{
if (reload_completed
- && register_operand (operands[4], <MODE>mode)
- && !rtx_equal_p (operands[0], operands[4]))
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4]))
{
emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[3],
operands[4], operands[1]));
operands[4] = operands[3] = operands[0];
}
else if (!rtx_equal_p (operands[1], operands[5])
- || !rtx_equal_p (operands[1], operands[7]))
+ || !rtx_equal_p (operands[1], operands[6]))
{
operands[5] = copy_rtx (operands[1]);
- operands[7] = copy_rtx (operands[1]);
+ operands[6] = copy_rtx (operands[1]);
}
else
FAIL;
@@ -5491,6 +5942,42 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*aarch64_cond_abd<mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w, w, w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, 0, w, w, w")]
+ UNSPEC_COND_FSUB)]
+ UNSPEC_COND_FABS)
+ (match_operand:SVE_FULL_F 4 "aarch64_simd_reg_or_zero" "Dz, Dz, Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE
+ && !rtx_equal_p (operands[2], operands[4])
+ && !rtx_equal_p (operands[3], operands[4])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %2.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/m, %2.<Vetype>\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype>
+ #"
+ "&& reload_completed
+ && register_operand (operands[4], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[4])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[3],
+ operands[4], operands[1]));
+ operands[4] = operands[3] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; -------------------------------------------------------------------------
;; ---- [FP] Multiplication
;; -------------------------------------------------------------------------
@@ -6416,20 +6903,20 @@
;; Predicated floating-point ternary operations, merging with the
;; first input.
-(define_insn_and_rewrite "*cond_<optab><mode>_2"
+(define_insn_and_rewrite "*cond_<optab><mode>_2_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "0, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")
(match_operand:SVE_FULL_F 4 "register_operand" "w, w")]
SVE_COND_FP_TERNARY)
(match_dup 2)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE"
"@
<sve_fmad_op>\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype>
movprfx\t%0, %2\;<sve_fmad_op>\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype>"
@@ -6440,22 +6927,42 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_2_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "0, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 4 "register_operand" "w, w")]
+ SVE_COND_FP_TERNARY)
+ (match_dup 2)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fmad_op>\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype>
+ movprfx\t%0, %2\;<sve_fmad_op>\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point ternary operations, merging with the
;; third input.
-(define_insn_and_rewrite "*cond_<optab><mode>_4"
+(define_insn_and_rewrite "*cond_<optab><mode>_4_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")
(match_operand:SVE_FULL_F 4 "register_operand" "0, w")]
SVE_COND_FP_TERNARY)
(match_dup 4)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE"
"@
<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
movprfx\t%0, %4\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>"
@@ -6466,15 +6973,35 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_4_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 4 "register_operand" "0, w")]
+ SVE_COND_FP_TERNARY)
+ (match_dup 4)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ <sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
+ movprfx\t%0, %4\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated floating-point ternary operations, merging with an
;; independent value.
-(define_insn_and_rewrite "*cond_<optab><mode>_any"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, &w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 6)
- (match_operand:SI 7 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, 0, w, w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w, w, 0, w, w")
(match_operand:SVE_FULL_F 4 "register_operand" "w, 0, w, w, w, w")]
@@ -6484,8 +7011,7 @@
"TARGET_SVE
&& !rtx_equal_p (operands[2], operands[5])
&& !rtx_equal_p (operands[3], operands[5])
- && !rtx_equal_p (operands[4], operands[5])
- && aarch64_sve_pred_dominates_p (&operands[6], operands[1])"
+ && !rtx_equal_p (operands[4], operands[5])"
"@
movprfx\t%0.<Vetype>, %1/z, %4.<Vetype>\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
@@ -6511,6 +7037,41 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_<optab><mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, &w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, 0, w, w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w, w, 0, w, w")
+ (match_operand:SVE_FULL_F 4 "register_operand" "w, 0, w, w, w, w")]
+ SVE_COND_FP_TERNARY)
+ (match_operand:SVE_FULL_F 5 "aarch64_simd_reg_or_zero" "Dz, Dz, Dz, Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE
+ && !rtx_equal_p (operands[2], operands[5])
+ && !rtx_equal_p (operands[3], operands[5])
+ && !rtx_equal_p (operands[4], operands[5])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %4.<Vetype>\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fmad_op>\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_fmad_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %4.<Vetype>
+ movprfx\t%0.<Vetype>, %1/m, %4.<Vetype>\;<sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>
+ #"
+ "&& reload_completed
+ && register_operand (operands[5], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[5])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[4],
+ operands[5], operands[1]));
+ operands[5] = operands[4] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; Unpredicated FMLA and FMLS by selected lanes. It doesn't seem worth using
;; (fma ...) since target-independent code won't understand the indexing.
(define_insn "@aarch64_<optab>_lane_<mode>"
@@ -6572,20 +7133,20 @@
)
;; Predicated FCMLA, merging with the third input.
-(define_insn_and_rewrite "*cond_<optab><mode>_4"
+(define_insn_and_rewrite "*cond_<optab><mode>_4_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w")
(match_operand:SVE_FULL_F 4 "register_operand" "0, w")]
SVE_COND_FCMLA)
(match_dup 4)]
UNSPEC_SEL))]
- "TARGET_SVE && aarch64_sve_pred_dominates_p (&operands[5], operands[1])"
+ "TARGET_SVE"
"@
fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
movprfx\t%0, %4\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>"
@@ -6596,23 +7157,41 @@
[(set_attr "movprfx" "*,yes")]
)
+(define_insn "*cond_<optab><mode>_4_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w")
+ (match_operand:SVE_FULL_F 4 "register_operand" "0, w")]
+ SVE_COND_FCMLA)
+ (match_dup 4)]
+ UNSPEC_SEL))]
+ "TARGET_SVE"
+ "@
+ fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
+ movprfx\t%0, %4\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>"
+ [(set_attr "movprfx" "*,yes")]
+)
+
;; Predicated FCMLA, merging with an independent value.
-(define_insn_and_rewrite "*cond_<optab><mode>_any"
+(define_insn_and_rewrite "*cond_<optab><mode>_any_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 6)
- (match_operand:SI 7 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, w, w")
(match_operand:SVE_FULL_F 3 "register_operand" "w, w, w, w")
(match_operand:SVE_FULL_F 4 "register_operand" "w, 0, w, w")]
SVE_COND_FCMLA)
(match_operand:SVE_FULL_F 5 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && !rtx_equal_p (operands[4], operands[5])
- && aarch64_sve_pred_dominates_p (&operands[6], operands[1])"
+ "TARGET_SVE && !rtx_equal_p (operands[4], operands[5])"
"@
movprfx\t%0.<Vetype>, %1/z, %4.<Vetype>\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
@@ -6636,6 +7215,36 @@
[(set_attr "movprfx" "yes")]
)
+(define_insn_and_rewrite "*cond_<optab><mode>_any_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, w, w")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w, w, w, w")
+ (match_operand:SVE_FULL_F 4 "register_operand" "w, 0, w, w")]
+ SVE_COND_FCMLA)
+ (match_operand:SVE_FULL_F 5 "aarch64_simd_reg_or_zero" "Dz, Dz, 0, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && !rtx_equal_p (operands[4], operands[5])"
+ "@
+ movprfx\t%0.<Vetype>, %1/z, %4.<Vetype>\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
+ movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
+ movprfx\t%0.<Vetype>, %1/m, %4.<Vetype>\;fcmla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype>, #<rot>
+ #"
+ "&& reload_completed
+ && register_operand (operands[5], <MODE>mode)
+ && !rtx_equal_p (operands[0], operands[5])"
+ {
+ emit_insn (gen_vcond_mask_<mode><vpred> (operands[0], operands[4],
+ operands[5], operands[1]));
+ operands[5] = operands[4] = operands[0];
+ }
+ [(set_attr "movprfx" "yes")]
+)
+
;; Unpredicated FCMLA with indexing.
(define_insn "@aarch64_<optab>_lane_<mode>"
[(set (match_operand:SVE_FULL_HSF 0 "register_operand" "=w, ?&w")
@@ -7328,34 +7937,52 @@
"TARGET_SVE"
)
-(define_insn_and_rewrite "*aarch64_pred_fac<cmp_op><mode>"
+(define_insn_and_rewrite "*aarch64_pred_fac<cmp_op><mode>_relaxed"
[(set (match_operand:<VPRED> 0 "register_operand" "=Upa")
(unspec:<VPRED>
[(match_operand:<VPRED> 1 "register_operand" "Upl")
(match_operand:SI 4 "aarch64_sve_ptrue_flag")
(unspec:SVE_FULL_F
[(match_operand 5)
- (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w")]
UNSPEC_COND_FABS)
(unspec:SVE_FULL_F
- [(match_operand 7)
- (match_operand:SI 8 "aarch64_sve_gp_strictness")
+ [(match_operand 6)
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 3 "register_operand" "w")]
UNSPEC_COND_FABS)]
SVE_COND_FP_ABS_CMP))]
- "TARGET_SVE
- && aarch64_sve_pred_dominates_p (&operands[5], operands[1])
- && aarch64_sve_pred_dominates_p (&operands[7], operands[1])"
+ "TARGET_SVE"
"fac<cmp_op>\t%0.<Vetype>, %1/z, %2.<Vetype>, %3.<Vetype>"
"&& (!rtx_equal_p (operands[1], operands[5])
- || !rtx_equal_p (operands[1], operands[7]))"
+ || !rtx_equal_p (operands[1], operands[6]))"
{
operands[5] = copy_rtx (operands[1]);
- operands[7] = copy_rtx (operands[1]);
+ operands[6] = copy_rtx (operands[1]);
}
)
+(define_insn "*aarch64_pred_fac<cmp_op><mode>_strict"
+ [(set (match_operand:<VPRED> 0 "register_operand" "=Upa")
+ (unspec:<VPRED>
+ [(match_operand:<VPRED> 1 "register_operand" "Upl")
+ (match_operand:SI 4 "aarch64_sve_ptrue_flag")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (match_operand:SVE_FULL_F 2 "register_operand" "w")]
+ UNSPEC_COND_FABS)
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (match_operand:SI 6 "aarch64_sve_gp_strictness")
+ (match_operand:SVE_FULL_F 3 "register_operand" "w")]
+ UNSPEC_COND_FABS)]
+ SVE_COND_FP_ABS_CMP))]
+ "TARGET_SVE"
+ "fac<cmp_op>\t%0.<Vetype>, %1/z, %2.<Vetype>, %3.<Vetype>"
+)
+
;; -------------------------------------------------------------------------
;; ---- [PRED] Select
;; -------------------------------------------------------------------------
@@ -7937,20 +8564,18 @@
;; the same register (despite having different modes). Making all the
;; alternatives earlyclobber makes things more consistent for the
;; register allocator.
-(define_insn_and_rewrite "*cond_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>"
+(define_insn_and_rewrite "*cond_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>_relaxed"
[(set (match_operand:SVE_FULL_HSDI 0 "register_operand" "=&w, &w, ?&w")
(unspec:SVE_FULL_HSDI
[(match_operand:<SVE_FULL_HSDI:VPRED> 1 "register_operand" "Upl, Upl, Upl")
(unspec:SVE_FULL_HSDI
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")]
SVE_COND_FCVTI)
(match_operand:SVE_FULL_HSDI 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && <SVE_FULL_HSDI:elem_bits> >= <SVE_FULL_F:elem_bits>
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE && <SVE_FULL_HSDI:elem_bits> >= <SVE_FULL_F:elem_bits>"
"@
fcvtz<su>\t%0.<SVE_FULL_HSDI:Vetype>, %1/m, %2.<SVE_FULL_F:Vetype>
movprfx\t%0.<SVE_FULL_HSDI:Vetype>, %1/z, %2.<SVE_FULL_HSDI:Vetype>\;fcvtz<su>\t%0.<SVE_FULL_HSDI:Vetype>, %1/m, %2.<SVE_FULL_F:Vetype>
@@ -7962,6 +8587,25 @@
[(set_attr "movprfx" "*,yes,yes")]
)
+(define_insn "*cond_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>_strict"
+ [(set (match_operand:SVE_FULL_HSDI 0 "register_operand" "=&w, &w, ?&w")
+ (unspec:SVE_FULL_HSDI
+ [(match_operand:<SVE_FULL_HSDI:VPRED> 1 "register_operand" "Upl, Upl, Upl")
+ (unspec:SVE_FULL_HSDI
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")]
+ SVE_COND_FCVTI)
+ (match_operand:SVE_FULL_HSDI 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && <SVE_FULL_HSDI:elem_bits> >= <SVE_FULL_F:elem_bits>"
+ "@
+ fcvtz<su>\t%0.<SVE_FULL_HSDI:Vetype>, %1/m, %2.<SVE_FULL_F:Vetype>
+ movprfx\t%0.<SVE_FULL_HSDI:Vetype>, %1/z, %2.<SVE_FULL_HSDI:Vetype>\;fcvtz<su>\t%0.<SVE_FULL_HSDI:Vetype>, %1/m, %2.<SVE_FULL_F:Vetype>
+ movprfx\t%0, %3\;fcvtz<su>\t%0.<SVE_FULL_HSDI:Vetype>, %1/m, %2.<SVE_FULL_F:Vetype>"
+ [(set_attr "movprfx" "*,yes,yes")]
+)
+
;; Predicated narrowing float-to-integer conversion with merging.
(define_expand "@cond_<optab>_trunc<VNx2DF_ONLY:mode><VNx4SI_ONLY:mode>"
[(set (match_operand:VNx4SI_ONLY 0 "register_operand")
@@ -8101,20 +8745,18 @@
;; the same register (despite having different modes). Making all the
;; alternatives earlyclobber makes things more consistent for the
;; register allocator.
-(define_insn_and_rewrite "*cond_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>"
+(define_insn_and_rewrite "*cond_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>_relaxed"
[(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, ?&w")
(unspec:SVE_FULL_F
[(match_operand:<SVE_FULL_HSDI:VPRED> 1 "register_operand" "Upl, Upl, Upl")
(unspec:SVE_FULL_F
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_HSDI 2 "register_operand" "w, w, w")]
SVE_COND_ICVTF)
(match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
UNSPEC_SEL))]
- "TARGET_SVE
- && <SVE_FULL_HSDI:elem_bits> >= <SVE_FULL_F:elem_bits>
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE && <SVE_FULL_HSDI:elem_bits> >= <SVE_FULL_F:elem_bits>"
"@
<su>cvtf\t%0.<SVE_FULL_F:Vetype>, %1/m, %2.<SVE_FULL_HSDI:Vetype>
movprfx\t%0.<SVE_FULL_HSDI:Vetype>, %1/z, %2.<SVE_FULL_HSDI:Vetype>\;<su>cvtf\t%0.<SVE_FULL_F:Vetype>, %1/m, %2.<SVE_FULL_HSDI:Vetype>
@@ -8126,6 +8768,25 @@
[(set_attr "movprfx" "*,yes,yes")]
)
+(define_insn "*cond_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>_strict"
+ [(set (match_operand:SVE_FULL_F 0 "register_operand" "=&w, &w, ?&w")
+ (unspec:SVE_FULL_F
+ [(match_operand:<SVE_FULL_HSDI:VPRED> 1 "register_operand" "Upl, Upl, Upl")
+ (unspec:SVE_FULL_F
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_HSDI 2 "register_operand" "w, w, w")]
+ SVE_COND_ICVTF)
+ (match_operand:SVE_FULL_F 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE && <SVE_FULL_HSDI:elem_bits> >= <SVE_FULL_F:elem_bits>"
+ "@
+ <su>cvtf\t%0.<SVE_FULL_F:Vetype>, %1/m, %2.<SVE_FULL_HSDI:Vetype>
+ movprfx\t%0.<SVE_FULL_HSDI:Vetype>, %1/z, %2.<SVE_FULL_HSDI:Vetype>\;<su>cvtf\t%0.<SVE_FULL_F:Vetype>, %1/m, %2.<SVE_FULL_HSDI:Vetype>
+ movprfx\t%0, %3\;<su>cvtf\t%0.<SVE_FULL_F:Vetype>, %1/m, %2.<SVE_FULL_HSDI:Vetype>"
+ [(set_attr "movprfx" "*,yes,yes")]
+)
+
;; Predicated widening integer-to-float conversion with merging.
(define_expand "@cond_<optab>_extend<VNx4SI_ONLY:mode><VNx2DF_ONLY:mode>"
[(set (match_operand:VNx2DF_ONLY 0 "register_operand")
diff --git a/gcc/config/aarch64/aarch64-sve2.md b/gcc/config/aarch64/aarch64-sve2.md
index e18b9fe..0cafd0b 100644
--- a/gcc/config/aarch64/aarch64-sve2.md
+++ b/gcc/config/aarch64/aarch64-sve2.md
@@ -1890,18 +1890,18 @@
)
;; These instructions do not take MOVPRFX.
-(define_insn_and_rewrite "*cond_<sve_fp_op><mode>"
+(define_insn_and_rewrite "*cond_<sve_fp_op><mode>_relaxed"
[(set (match_operand:SVE_FULL_SDF 0 "register_operand" "=w")
(unspec:SVE_FULL_SDF
[(match_operand:<VPRED> 1 "register_operand" "Upl")
(unspec:SVE_FULL_SDF
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:<VNARROW> 2 "register_operand" "w")]
SVE2_COND_FP_UNARY_LONG)
(match_operand:SVE_FULL_SDF 3 "register_operand" "0")]
UNSPEC_SEL))]
- "TARGET_SVE2 && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE2"
"<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Ventype>"
"&& !rtx_equal_p (operands[1], operands[4])"
{
@@ -1909,6 +1909,21 @@
}
)
+(define_insn "*cond_<sve_fp_op><mode>_strict"
+ [(set (match_operand:SVE_FULL_SDF 0 "register_operand" "=w")
+ (unspec:SVE_FULL_SDF
+ [(match_operand:<VPRED> 1 "register_operand" "Upl")
+ (unspec:SVE_FULL_SDF
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:<VNARROW> 2 "register_operand" "w")]
+ SVE2_COND_FP_UNARY_LONG)
+ (match_operand:SVE_FULL_SDF 3 "register_operand" "0")]
+ UNSPEC_SEL))]
+ "TARGET_SVE2"
+ "<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Ventype>"
+)
+
;; -------------------------------------------------------------------------
;; ---- [FP<-FP] Narrowing conversions
;; -------------------------------------------------------------------------
@@ -1963,20 +1978,18 @@
"TARGET_SVE2"
)
-(define_insn_and_rewrite "*cond_<sve_fp_op><mode>_any"
+(define_insn_and_rewrite "*cond_<sve_fp_op><mode>_any_relaxed"
[(set (match_operand:VNx4SF_ONLY 0 "register_operand" "=&w, &w, &w")
(unspec:VNx4SF_ONLY
[(match_operand:<VWIDE_PRED> 1 "register_operand" "Upl, Upl, Upl")
(unspec:VNx4SF_ONLY
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:<VWIDE> 2 "register_operand" "w, w, w")]
SVE2_COND_FP_UNARY_NARROWB)
(match_operand:VNx4SF_ONLY 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
UNSPEC_SEL))]
- "TARGET_SVE2
- && !rtx_equal_p (operands[2], operands[3])
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE2 && !rtx_equal_p (operands[2], operands[3])"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vewtype>
movprfx\t%0.<Vewtype>, %1/z, %2.<Vewtype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vewtype>
@@ -1988,6 +2001,25 @@
[(set_attr "movprfx" "*,yes,yes")]
)
+(define_insn "*cond_<sve_fp_op><mode>_any_strict"
+ [(set (match_operand:VNx4SF_ONLY 0 "register_operand" "=&w, &w, &w")
+ (unspec:VNx4SF_ONLY
+ [(match_operand:<VWIDE_PRED> 1 "register_operand" "Upl, Upl, Upl")
+ (unspec:VNx4SF_ONLY
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:<VWIDE> 2 "register_operand" "w, w, w")]
+ SVE2_COND_FP_UNARY_NARROWB)
+ (match_operand:VNx4SF_ONLY 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE2 && !rtx_equal_p (operands[2], operands[3])"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vewtype>
+ movprfx\t%0.<Vewtype>, %1/z, %2.<Vewtype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vewtype>
+ movprfx\t%0, %3\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vewtype>"
+ [(set_attr "movprfx" "*,yes,yes")]
+)
+
;; Predicated FCVTXNT. This doesn't give a natural aarch64_pred_*/cond_*
;; pair because the even elements always have to be supplied for active
;; elements, even if the inactive elements don't matter.
@@ -2113,14 +2145,12 @@
[(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
(unspec:<V_INT_EQUIV>
[(match_operand 4)
- (match_operand:SI 5 "aarch64_sve_gp_strictness")
+ (const_int SVE_RELAXED_GP)
(match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")]
SVE2_COND_INT_UNARY_FP)
(match_operand:<V_INT_EQUIV> 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
UNSPEC_SEL))]
- "TARGET_SVE2
- && !rtx_equal_p (operands[2], operands[3])
- && aarch64_sve_pred_dominates_p (&operands[4], operands[1])"
+ "TARGET_SVE2 && !rtx_equal_p (operands[2], operands[3])"
"@
<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
@@ -2132,6 +2162,25 @@
[(set_attr "movprfx" "*,yes,yes")]
)
+(define_insn "*cond_<sve_fp_op><mode>_strict"
+ [(set (match_operand:<V_INT_EQUIV> 0 "register_operand" "=&w, ?&w, ?&w")
+ (unspec:<V_INT_EQUIV>
+ [(match_operand:<VPRED> 1 "register_operand" "Upl, Upl, Upl")
+ (unspec:<V_INT_EQUIV>
+ [(match_dup 1)
+ (const_int SVE_STRICT_GP)
+ (match_operand:SVE_FULL_F 2 "register_operand" "w, w, w")]
+ SVE2_COND_INT_UNARY_FP)
+ (match_operand:<V_INT_EQUIV> 3 "aarch64_simd_reg_or_zero" "0, Dz, w")]
+ UNSPEC_SEL))]
+ "TARGET_SVE2 && !rtx_equal_p (operands[2], operands[3])"
+ "@
+ <sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
+ movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>
+ movprfx\t%0, %3\;<sve_fp_op>\t%0.<Vetype>, %1/m, %2.<Vetype>"
+ [(set_attr "movprfx" "*,yes,yes")]
+)
+
;; -------------------------------------------------------------------------
;; ---- [INT] Polynomial multiplication
;; -------------------------------------------------------------------------
diff --git a/gcc/config/aarch64/aarch64-tune.md b/gcc/config/aarch64/aarch64-tune.md
index 0e3239c..e060302 100644
--- a/gcc/config/aarch64/aarch64-tune.md
+++ b/gcc/config/aarch64/aarch64-tune.md
@@ -1,5 +1,5 @@
;; -*- buffer-read-only: t -*-
;; Generated automatically by gentune.sh from aarch64-cores.def
(define_attr "tune"
- "cortexa34,cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,octeontx,octeontxt81,octeontxt83,thunderxt81,thunderxt83,emag,xgene1,falkor,qdf24xx,exynosm1,phecda,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,cortexa76ae,cortexa77,cortexa65,cortexa65ae,ares,neoversen1,neoversee1,octeontx2,octeontx2t98,octeontx2t96,octeontx2t93,octeontx2f95,octeontx2f95n,octeontx2f95mm,a64fx,tsv110,thunderx3t110,zeus,saphira,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55,cortexa76cortexa55,cortexr82"
+ "cortexa34,cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,octeontx,octeontxt81,octeontxt83,thunderxt81,thunderxt83,emag,xgene1,falkor,qdf24xx,exynosm1,phecda,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,cortexa76ae,cortexa77,cortexa78,cortexa78ae,cortexa65,cortexa65ae,cortexx1,ares,neoversen1,neoversee1,octeontx2,octeontx2t98,octeontx2t96,octeontx2t93,octeontx2f95,octeontx2f95n,octeontx2f95mm,a64fx,tsv110,thunderx3t110,zeus,neoversev1,saphira,neoversen2,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55,cortexa76cortexa55,cortexr82"
(const (symbol_ref "((enum attr_tune) aarch64_tune)")))
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index b251f39..a8cc545 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1336,6 +1336,58 @@ static const struct tune_params neoversen1_tunings =
&generic_prefetch_tune
};
+static const struct tune_params neoversev1_tunings =
+{
+ &cortexa57_extra_costs,
+ &generic_addrcost_table,
+ &generic_regmove_cost,
+ &cortexa57_vector_cost,
+ &generic_branch_cost,
+ &generic_approx_modes,
+ SVE_256, /* sve_width */
+ 4, /* memmov_cost */
+ 3, /* issue_rate */
+ (AARCH64_FUSE_AES_AESMC | AARCH64_FUSE_CMP_BRANCH), /* fusible_ops */
+ "32:16", /* function_align. */
+ "4", /* jump_align. */
+ "32:16", /* loop_align. */
+ 2, /* int_reassoc_width. */
+ 4, /* fp_reassoc_width. */
+ 2, /* vec_reassoc_width. */
+ 2, /* min_div_recip_mul_sf. */
+ 2, /* min_div_recip_mul_df. */
+ 0, /* max_case_values. */
+ tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */
+ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */
+ &generic_prefetch_tune
+};
+
+static const struct tune_params neoversen2_tunings =
+{
+ &cortexa57_extra_costs,
+ &generic_addrcost_table,
+ &generic_regmove_cost,
+ &cortexa57_vector_cost,
+ &generic_branch_cost,
+ &generic_approx_modes,
+ SVE_128, /* sve_width */
+ 4, /* memmov_cost */
+ 3, /* issue_rate */
+ (AARCH64_FUSE_AES_AESMC | AARCH64_FUSE_CMP_BRANCH), /* fusible_ops */
+ "32:16", /* function_align. */
+ "4", /* jump_align. */
+ "32:16", /* loop_align. */
+ 2, /* int_reassoc_width. */
+ 4, /* fp_reassoc_width. */
+ 2, /* vec_reassoc_width. */
+ 2, /* min_div_recip_mul_sf. */
+ 2, /* min_div_recip_mul_df. */
+ 0, /* max_case_values. */
+ tune_params::AUTOPREFETCHER_WEAK, /* autoprefetcher_model. */
+ (AARCH64_EXTRA_TUNE_NONE), /* tune_flags. */
+ &generic_prefetch_tune
+};
+
static const struct tune_params a64fx_tunings =
{
&generic_extra_costs,
@@ -1935,6 +1987,29 @@ aarch64_sve_abi (void)
return sve_abi;
}
+/* If X is an UNSPEC_SALT_ADDR expression, return the address that it
+ wraps, otherwise return X itself. */
+
+static rtx
+strip_salt (rtx x)
+{
+ rtx search = x;
+ if (GET_CODE (search) == CONST)
+ search = XEXP (search, 0);
+ if (GET_CODE (search) == UNSPEC && XINT (search, 1) == UNSPEC_SALT_ADDR)
+ x = XVECEXP (search, 0, 0);
+ return x;
+}
+
+/* Like strip_offset, but also strip any UNSPEC_SALT_ADDR from the
+ expression. */
+
+static rtx
+strip_offset_and_salt (rtx addr, poly_int64 *offset)
+{
+ return strip_salt (strip_offset (addr, offset));
+}
+
/* Generate code to enable conditional branches in functions over 1 MiB. */
const char *
aarch64_gen_far_branch (rtx * operands, int pos_label, const char * dest,
@@ -2932,14 +3007,9 @@ static enum tls_model
tls_symbolic_operand_type (rtx addr)
{
enum tls_model tls_kind = TLS_MODEL_NONE;
- if (GET_CODE (addr) == CONST)
- {
- poly_int64 addend;
- rtx sym = strip_offset (addr, &addend);
- if (GET_CODE (sym) == SYMBOL_REF)
- tls_kind = SYMBOL_REF_TLS_MODEL (sym);
- }
- else if (GET_CODE (addr) == SYMBOL_REF)
+ poly_int64 offset;
+ addr = strip_offset_and_salt (addr, &offset);
+ if (GET_CODE (addr) == SYMBOL_REF)
tls_kind = SYMBOL_REF_TLS_MODEL (addr);
return tls_kind;
@@ -3404,11 +3474,16 @@ aarch64_split_128bit_move (rtx dst, rtx src)
}
}
+/* Return true if we should split a move from 128-bit value SRC
+ to 128-bit register DEST. */
+
bool
aarch64_split_128bit_move_p (rtx dst, rtx src)
{
- return (! REG_P (src)
- || ! (FP_REGNUM_P (REGNO (dst)) && FP_REGNUM_P (REGNO (src))));
+ if (FP_REGNUM_P (REGNO (dst)))
+ return REG_P (src) && !FP_REGNUM_P (REGNO (src));
+ /* All moves to GPRs need to be split. */
+ return true;
}
/* Split a complex SIMD combine. */
@@ -3694,24 +3769,6 @@ aarch64_pfalse_reg (machine_mode mode)
return gen_lowpart (mode, reg);
}
-/* Return true if predicate PRED1[0] is true whenever predicate PRED2 is
- true, or alternatively if we know that the operation predicated by
- PRED1[0] is safe to perform whenever PRED2 is true. PRED1[1] is a
- aarch64_sve_gp_strictness operand that describes the operation
- predicated by PRED1[0]. */
-
-bool
-aarch64_sve_pred_dominates_p (rtx *pred1, rtx pred2)
-{
- machine_mode mode = GET_MODE (pred2);
- gcc_assert (GET_MODE_CLASS (mode) == MODE_VECTOR_BOOL
- && mode == GET_MODE (pred1[0])
- && aarch64_sve_gp_strictness (pred1[1], SImode));
- return (pred1[0] == CONSTM1_RTX (mode)
- || INTVAL (pred1[1]) == SVE_RELAXED_GP
- || rtx_equal_p (pred1[0], pred2));
-}
-
/* PRED1[0] is a PTEST predicate and PRED1[1] is an aarch64_sve_ptrue_flag
for it. PRED2[0] is the predicate for the instruction whose result
is tested by the PTEST and PRED2[1] is again an aarch64_sve_ptrue_flag
@@ -5239,6 +5296,48 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
as_a <scalar_int_mode> (mode));
}
+/* Return the MEM rtx that provides the canary value that should be used
+ for stack-smashing protection. MODE is the mode of the memory.
+ For SSP_GLOBAL, DECL_RTL is the MEM rtx for the canary variable
+ (__stack_chk_guard), otherwise it has no useful value. SALT_TYPE
+ indicates whether the caller is performing a SET or a TEST operation. */
+
+rtx
+aarch64_stack_protect_canary_mem (machine_mode mode, rtx decl_rtl,
+ aarch64_salt_type salt_type)
+{
+ rtx addr;
+ if (aarch64_stack_protector_guard == SSP_GLOBAL)
+ {
+ gcc_assert (MEM_P (decl_rtl));
+ addr = XEXP (decl_rtl, 0);
+ poly_int64 offset;
+ rtx base = strip_offset_and_salt (addr, &offset);
+ if (!SYMBOL_REF_P (base))
+ return decl_rtl;
+
+ rtvec v = gen_rtvec (2, base, GEN_INT (salt_type));
+ addr = gen_rtx_UNSPEC (Pmode, v, UNSPEC_SALT_ADDR);
+ addr = gen_rtx_CONST (Pmode, addr);
+ addr = plus_constant (Pmode, addr, offset);
+ }
+ else
+ {
+ /* Calculate the address from the system register. */
+ rtx salt = GEN_INT (salt_type);
+ addr = gen_reg_rtx (mode);
+ if (mode == DImode)
+ emit_insn (gen_reg_stack_protect_address_di (addr, salt));
+ else
+ {
+ emit_insn (gen_reg_stack_protect_address_si (addr, salt));
+ addr = convert_memory_address (Pmode, addr);
+ }
+ addr = plus_constant (Pmode, addr, aarch64_stack_protector_guard_offset);
+ }
+ return gen_rtx_MEM (mode, force_reg (Pmode, addr));
+}
+
/* Emit an SVE predicated move from SRC to DEST. PRED is a predicate
that is known to contain PTRUE. */
@@ -8677,8 +8776,6 @@ aarch64_move_imm (HOST_WIDE_INT val, machine_mode mode)
static bool
aarch64_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
{
- rtx base, offset;
-
if (GET_CODE (x) == HIGH)
return true;
@@ -8688,10 +8785,12 @@ aarch64_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
if (GET_CODE (*iter) == CONST_POLY_INT)
return true;
- split_const (x, &base, &offset);
+ poly_int64 offset;
+ rtx base = strip_offset_and_salt (x, &offset);
if (GET_CODE (base) == SYMBOL_REF || GET_CODE (base) == LABEL_REF)
{
- if (aarch64_classify_symbol (base, INTVAL (offset))
+ /* We checked for POLY_INT_CST offsets above. */
+ if (aarch64_classify_symbol (base, offset.to_constant ())
!= SYMBOL_FORCE_TO_MEM)
return true;
else
@@ -9217,9 +9316,8 @@ aarch64_classify_address (struct aarch64_address_info *info,
&& GET_MODE_SIZE (mode).is_constant (&const_size)
&& const_size >= 4)
{
- rtx sym, addend;
-
- split_const (x, &sym, &addend);
+ poly_int64 offset;
+ rtx sym = strip_offset_and_salt (x, &offset);
return ((GET_CODE (sym) == LABEL_REF
|| (GET_CODE (sym) == SYMBOL_REF
&& CONSTANT_POOL_ADDRESS_P (sym)
@@ -9234,10 +9332,12 @@ aarch64_classify_address (struct aarch64_address_info *info,
if (allow_reg_index_p
&& aarch64_base_register_rtx_p (info->base, strict_p))
{
- rtx sym, offs;
- split_const (info->offset, &sym, &offs);
+ poly_int64 offset;
+ HOST_WIDE_INT const_offset;
+ rtx sym = strip_offset_and_salt (info->offset, &offset);
if (GET_CODE (sym) == SYMBOL_REF
- && (aarch64_classify_symbol (sym, INTVAL (offs))
+ && offset.is_constant (&const_offset)
+ && (aarch64_classify_symbol (sym, const_offset)
== SYMBOL_SMALL_ABSOLUTE))
{
/* The symbol and offset must be aligned to the access size. */
@@ -9263,7 +9363,7 @@ aarch64_classify_address (struct aarch64_address_info *info,
if (known_eq (ref_size, 0))
ref_size = GET_MODE_SIZE (DImode);
- return (multiple_p (INTVAL (offs), ref_size)
+ return (multiple_p (const_offset, ref_size)
&& multiple_p (align / BITS_PER_UNIT, ref_size));
}
}
@@ -9295,9 +9395,8 @@ aarch64_address_valid_for_prefetch_p (rtx x, bool strict_p)
bool
aarch64_symbolic_address_p (rtx x)
{
- rtx offset;
-
- split_const (x, &x, &offset);
+ poly_int64 offset;
+ x = strip_offset_and_salt (x, &offset);
return GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF;
}
@@ -10028,27 +10127,16 @@ aarch64_print_operand (FILE *f, rtx x, int code)
switch (code)
{
case 'c':
- switch (GET_CODE (x))
+ if (CONST_INT_P (x))
+ fprintf (f, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
+ else
{
- case CONST_INT:
- fprintf (f, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
- break;
-
- case SYMBOL_REF:
- output_addr_const (f, x);
- break;
-
- case CONST:
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF)
- {
- output_addr_const (f, x);
- break;
- }
- /* Fall through. */
-
- default:
- output_operand_lossage ("unsupported operand for code '%c'", code);
+ poly_int64 offset;
+ rtx base = strip_offset_and_salt (x, &offset);
+ if (SYMBOL_REF_P (base))
+ output_addr_const (f, x);
+ else
+ output_operand_lossage ("unsupported operand for code '%c'", code);
}
break;
@@ -10623,6 +10711,19 @@ aarch64_print_operand_address (FILE *f, machine_mode mode, rtx x)
output_addr_const (f, x);
}
+/* Implement TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA. */
+
+static bool
+aarch64_output_addr_const_extra (FILE *file, rtx x)
+{
+ if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_SALT_ADDR)
+ {
+ output_addr_const (file, XVECEXP (x, 0, 0));
+ return true;
+ }
+ return false;
+}
+
bool
aarch64_label_mentioned_p (rtx x)
{
@@ -15932,6 +16033,7 @@ aarch64_tls_symbol_p (rtx x)
if (! TARGET_HAVE_TLS)
return false;
+ x = strip_salt (x);
if (GET_CODE (x) != SYMBOL_REF)
return false;
@@ -15987,6 +16089,8 @@ aarch64_classify_tls_symbol (rtx x)
enum aarch64_symbol_type
aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset)
{
+ x = strip_salt (x);
+
if (GET_CODE (x) == LABEL_REF)
{
switch (aarch64_cmodel)
@@ -16086,11 +16190,10 @@ aarch64_constant_address_p (rtx x)
bool
aarch64_legitimate_pic_operand_p (rtx x)
{
- if (GET_CODE (x) == SYMBOL_REF
- || (GET_CODE (x) == CONST
- && GET_CODE (XEXP (x, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF))
- return false;
+ poly_int64 offset;
+ x = strip_offset_and_salt (x, &offset);
+ if (GET_CODE (x) == SYMBOL_REF)
+ return false;
return true;
}
@@ -16136,7 +16239,7 @@ aarch64_legitimate_constant_p (machine_mode mode, rtx x)
/* If an offset is being added to something else, we need to allow the
base to be moved into the destination register, meaning that there
are no free temporaries for the offset. */
- x = strip_offset (x, &offset);
+ x = strip_offset_and_salt (x, &offset);
if (!offset.is_constant () && aarch64_offset_temporaries (true, offset) > 0)
return false;
@@ -18035,6 +18138,7 @@ aarch64_mov_operand_p (rtx x, machine_mode mode)
return aarch64_simd_valid_immediate (x, NULL);
}
+ x = strip_salt (x);
if (GET_CODE (x) == SYMBOL_REF && mode == DImode && CONSTANT_ADDRESS_P (x))
return true;
@@ -23890,6 +23994,9 @@ aarch64_libgcc_floating_mode_supported_p
#undef TARGET_PRINT_OPERAND_ADDRESS
#define TARGET_PRINT_OPERAND_ADDRESS aarch64_print_operand_address
+#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
+#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA aarch64_output_addr_const_extra
+
#undef TARGET_OPTAB_SUPPORTED_P
#define TARGET_OPTAB_SUPPORTED_P aarch64_optab_supported_p
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index dbc6b1d..78fe7c43 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -281,6 +281,7 @@
UNSPEC_GEN_TAG_RND ; Generate a random 4-bit MTE tag.
UNSPEC_TAG_SPACE ; Translate address to MTE tag address space.
UNSPEC_LD1RO
+ UNSPEC_SALT_ADDR
])
(define_c_enum "unspecv" [
@@ -1360,13 +1361,14 @@
(define_insn "*movti_aarch64"
[(set (match_operand:TI 0
- "nonimmediate_operand" "= r,w, r,w,r,m,m,w,m")
+ "nonimmediate_operand" "= r,w,w, r,w,r,m,m,w,m")
(match_operand:TI 1
- "aarch64_movti_operand" " rUti,r, w,w,m,r,Z,m,w"))]
+ "aarch64_movti_operand" " rUti,Z,r, w,w,m,r,Z,m,w"))]
"(register_operand (operands[0], TImode)
|| aarch64_reg_or_zero (operands[1], TImode))"
"@
#
+ movi\\t%0.2d, #0
#
#
mov\\t%0.16b, %1.16b
@@ -1375,11 +1377,11 @@
stp\\txzr, xzr, %0
ldr\\t%q0, %1
str\\t%q1, %0"
- [(set_attr "type" "multiple,f_mcr,f_mrc,neon_logic_q, \
+ [(set_attr "type" "multiple,neon_move,f_mcr,f_mrc,neon_logic_q, \
load_16,store_16,store_16,\
load_16,store_16")
- (set_attr "length" "8,8,8,4,4,4,4,4,4")
- (set_attr "arch" "*,*,*,simd,*,*,*,fp,fp")]
+ (set_attr "length" "8,4,8,8,4,4,4,4,4,4")
+ (set_attr "arch" "*,simd,*,*,simd,*,*,*,fp,fp")]
)
;; Split a TImode register-register or register-immediate move into
@@ -1510,9 +1512,9 @@
(define_insn "*movtf_aarch64"
[(set (match_operand:TF 0
- "nonimmediate_operand" "=w,?&r,w ,?r,w,?w,w,m,?r,m ,m")
+ "nonimmediate_operand" "=w,?r ,w ,?r,w,?w,w,m,?r,m ,m")
(match_operand:TF 1
- "general_operand" " w,?r, ?r,w ,Y,Y ,m,w,m ,?r,Y"))]
+ "general_operand" " w,?rY,?r,w ,Y,Y ,m,w,m ,?r,Y"))]
"TARGET_FLOAT && (register_operand (operands[0], TFmode)
|| aarch64_reg_or_fp_zero (operands[1], TFmode))"
"@
@@ -1535,7 +1537,7 @@
(define_split
[(set (match_operand:TF 0 "register_operand" "")
- (match_operand:TF 1 "aarch64_reg_or_imm" ""))]
+ (match_operand:TF 1 "nonmemory_operand" ""))]
"reload_completed && aarch64_split_128bit_move_p (operands[0], operands[1])"
[(const_int 0)]
{
@@ -6881,43 +6883,37 @@
DONE;
})
-;; Named patterns for stack smashing protection.
+;; Defined for -mstack-protector-guard=sysreg, which goes through this
+;; pattern rather than stack_protect_combined_set. Our implementation
+;; of the latter can handle both.
(define_expand "stack_protect_set"
[(match_operand 0 "memory_operand")
- (match_operand 1 "memory_operand")]
+ (match_operand 1 "")]
""
{
- machine_mode mode = GET_MODE (operands[0]);
- if (aarch64_stack_protector_guard != SSP_GLOBAL)
- {
- /* Generate access through the system register. */
- rtx tmp_reg = gen_reg_rtx (mode);
- if (mode == DImode)
- {
- emit_insn (gen_reg_stack_protect_address_di (tmp_reg));
- emit_insn (gen_adddi3 (tmp_reg, tmp_reg,
- GEN_INT (aarch64_stack_protector_guard_offset)));
- }
- else
- {
- emit_insn (gen_reg_stack_protect_address_si (tmp_reg));
- emit_insn (gen_addsi3 (tmp_reg, tmp_reg,
- GEN_INT (aarch64_stack_protector_guard_offset)));
+ emit_insn (gen_stack_protect_combined_set (operands[0], operands[1]));
+ DONE;
+})
- }
- operands[1] = gen_rtx_MEM (mode, tmp_reg);
- }
-
+(define_expand "stack_protect_combined_set"
+ [(match_operand 0 "memory_operand")
+ (match_operand 1 "")]
+ ""
+{
+ machine_mode mode = GET_MODE (operands[0]);
+ operands[1] = aarch64_stack_protect_canary_mem (mode, operands[1],
+ AARCH64_SALT_SSP_SET);
emit_insn ((mode == DImode
? gen_stack_protect_set_di
: gen_stack_protect_set_si) (operands[0], operands[1]));
DONE;
})
+;; Operand 1 is either AARCH64_SALT_SSP_SET or AARCH64_SALT_SSP_TEST.
(define_insn "reg_stack_protect_address_<mode>"
[(set (match_operand:PTR 0 "register_operand" "=r")
- (unspec:PTR [(const_int 0)]
- UNSPEC_SSP_SYSREG))]
+ (unspec:PTR [(match_operand 1 "const_int_operand")]
+ UNSPEC_SSP_SYSREG))]
"aarch64_stack_protector_guard != SSP_GLOBAL"
{
char buf[150];
@@ -6940,37 +6936,29 @@
[(set_attr "length" "12")
(set_attr "type" "multiple")])
+;; Defined for -mstack-protector-guard=sysreg, which goes through this
+;; pattern rather than stack_protect_combined_test. Our implementation
+;; of the latter can handle both.
(define_expand "stack_protect_test"
[(match_operand 0 "memory_operand")
- (match_operand 1 "memory_operand")
+ (match_operand 1 "")
(match_operand 2)]
""
{
- machine_mode mode = GET_MODE (operands[0]);
-
- if (aarch64_stack_protector_guard != SSP_GLOBAL)
- {
- /* Generate access through the system register. The
- sequence we want here is the access
- of the stack offset to come with
- mrs scratch_reg, <system_register>
- add scratch_reg, scratch_reg, :lo12:offset. */
- rtx tmp_reg = gen_reg_rtx (mode);
- if (mode == DImode)
- {
- emit_insn (gen_reg_stack_protect_address_di (tmp_reg));
- emit_insn (gen_adddi3 (tmp_reg, tmp_reg,
- GEN_INT (aarch64_stack_protector_guard_offset)));
- }
- else
- {
- emit_insn (gen_reg_stack_protect_address_si (tmp_reg));
- emit_insn (gen_addsi3 (tmp_reg, tmp_reg,
- GEN_INT (aarch64_stack_protector_guard_offset)));
+ emit_insn (gen_stack_protect_combined_test (operands[0], operands[1],
+ operands[2]));
+ DONE;
+})
- }
- operands[1] = gen_rtx_MEM (mode, tmp_reg);
- }
+(define_expand "stack_protect_combined_test"
+ [(match_operand 0 "memory_operand")
+ (match_operand 1 "")
+ (match_operand 2)]
+ ""
+{
+ machine_mode mode = GET_MODE (operands[0]);
+ operands[1] = aarch64_stack_protect_canary_mem (mode, operands[1],
+ AARCH64_SALT_SSP_TEST);
emit_insn ((mode == DImode
? gen_stack_protect_test_di
: gen_stack_protect_test_si) (operands[0], operands[1]));
diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 50f8b23..85c0d62 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -6088,6 +6088,20 @@ vreinterpretq_u32_p128 (poly128_t __a)
return (uint32x4_t)__a;
}
+__extension__ extern __inline float64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vreinterpretq_f64_p128 (poly128_t __a)
+{
+ return (float64x2_t) __a;
+}
+
+__extension__ extern __inline poly128_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vreinterpretq_p128_f64 (float64x2_t __a)
+{
+ return (poly128_t) __a;
+}
+
/* vset_lane */
__extension__ extern __inline float16x4_t
@@ -12670,6 +12684,13 @@ vceqq_u64 (uint64x2_t __a, uint64x2_t __b)
return (__a == __b);
}
+__extension__ extern __inline uint64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vceqq_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+ return (__a == __b);
+}
+
/* vceq - scalar. */
__extension__ extern __inline uint32_t
@@ -12779,6 +12800,13 @@ vceqz_u64 (uint64x1_t __a)
return (__a == __AARCH64_UINT64_C (0));
}
+__extension__ extern __inline uint64x1_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vceqz_p64 (poly64x1_t __a)
+{
+ return (__a == __AARCH64_UINT64_C (0));
+}
+
__extension__ extern __inline uint32x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vceqzq_f32 (float32x4_t __a)
@@ -12856,6 +12884,13 @@ vceqzq_u64 (uint64x2_t __a)
return (__a == __AARCH64_UINT64_C (0));
}
+__extension__ extern __inline uint64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vceqzq_p64 (poly64x2_t __a)
+{
+ return (__a == __AARCH64_UINT64_C (0));
+}
+
/* vceqz - scalar. */
__extension__ extern __inline uint32_t
@@ -14054,6 +14089,48 @@ vclsq_s32 (int32x4_t __a)
return __builtin_aarch64_clrsbv4si (__a);
}
+__extension__ extern __inline int8x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcls_u8 (uint8x8_t __a)
+{
+ return __builtin_aarch64_clrsbv8qi ((int8x8_t) __a);
+}
+
+__extension__ extern __inline int16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcls_u16 (uint16x4_t __a)
+{
+ return __builtin_aarch64_clrsbv4hi ((int16x4_t) __a);
+}
+
+__extension__ extern __inline int32x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcls_u32 (uint32x2_t __a)
+{
+ return __builtin_aarch64_clrsbv2si ((int32x2_t) __a);
+}
+
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vclsq_u8 (uint8x16_t __a)
+{
+ return __builtin_aarch64_clrsbv16qi ((int8x16_t) __a);
+}
+
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vclsq_u16 (uint16x8_t __a)
+{
+ return __builtin_aarch64_clrsbv8hi ((int16x8_t) __a);
+}
+
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vclsq_u32 (uint32x4_t __a)
+{
+ return __builtin_aarch64_clrsbv4si ((int32x4_t) __a);
+}
+
/* vclz. */
__extension__ extern __inline int8x8_t
@@ -15538,7 +15615,7 @@ vdupq_n_f64 (float64_t __a)
__extension__ extern __inline poly8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_p8 (uint32_t __a)
+vdupq_n_p8 (poly8_t __a)
{
return (poly8x16_t) {__a, __a, __a, __a, __a, __a, __a, __a,
__a, __a, __a, __a, __a, __a, __a, __a};
@@ -15546,21 +15623,21 @@ vdupq_n_p8 (uint32_t __a)
__extension__ extern __inline poly16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_p16 (uint32_t __a)
+vdupq_n_p16 (poly16_t __a)
{
return (poly16x8_t) {__a, __a, __a, __a, __a, __a, __a, __a};
}
__extension__ extern __inline poly64x2_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_p64 (uint64_t __a)
+vdupq_n_p64 (poly64_t __a)
{
return (poly64x2_t) {__a, __a};
}
__extension__ extern __inline int8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_s8 (int32_t __a)
+vdupq_n_s8 (int8_t __a)
{
return (int8x16_t) {__a, __a, __a, __a, __a, __a, __a, __a,
__a, __a, __a, __a, __a, __a, __a, __a};
@@ -15568,7 +15645,7 @@ vdupq_n_s8 (int32_t __a)
__extension__ extern __inline int16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_s16 (int32_t __a)
+vdupq_n_s16 (int16_t __a)
{
return (int16x8_t) {__a, __a, __a, __a, __a, __a, __a, __a};
}
@@ -15589,7 +15666,7 @@ vdupq_n_s64 (int64_t __a)
__extension__ extern __inline uint8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_u8 (uint32_t __a)
+vdupq_n_u8 (uint8_t __a)
{
return (uint8x16_t) {__a, __a, __a, __a, __a, __a, __a, __a,
__a, __a, __a, __a, __a, __a, __a, __a};
@@ -15597,7 +15674,7 @@ vdupq_n_u8 (uint32_t __a)
__extension__ extern __inline uint16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_u16 (uint32_t __a)
+vdupq_n_u16 (uint16_t __a)
{
return (uint16x8_t) {__a, __a, __a, __a, __a, __a, __a, __a};
}
@@ -19613,6 +19690,13 @@ vld4q_p64 (const poly64_t * __a)
return ret;
}
+__extension__ extern __inline poly128_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vldrq_p128 (const poly128_t * __ptr)
+{
+ return *__ptr;
+}
+
/* vldn_dup */
__extension__ extern __inline int8x8x2_t
@@ -23962,42 +24046,42 @@ __extension__ extern __inline uint8x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vqmovun_s16 (int16x8_t __a)
{
- return (uint8x8_t) __builtin_aarch64_sqmovunv8hi (__a);
+ return __builtin_aarch64_sqmovunv8hi_us (__a);
}
__extension__ extern __inline uint16x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vqmovun_s32 (int32x4_t __a)
{
- return (uint16x4_t) __builtin_aarch64_sqmovunv4si (__a);
+ return __builtin_aarch64_sqmovunv4si_us (__a);
}
__extension__ extern __inline uint32x2_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vqmovun_s64 (int64x2_t __a)
{
- return (uint32x2_t) __builtin_aarch64_sqmovunv2di (__a);
+ return __builtin_aarch64_sqmovunv2di_us (__a);
}
-__extension__ extern __inline int8_t
+__extension__ extern __inline uint8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vqmovunh_s16 (int16_t __a)
{
- return (int8_t) __builtin_aarch64_sqmovunhi (__a);
+ return __builtin_aarch64_sqmovunhi_us (__a);
}
-__extension__ extern __inline int16_t
+__extension__ extern __inline uint16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vqmovuns_s32 (int32_t __a)
{
- return (int16_t) __builtin_aarch64_sqmovunsi (__a);
+ return __builtin_aarch64_sqmovunsi_us (__a);
}
-__extension__ extern __inline int32_t
+__extension__ extern __inline uint32_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vqmovund_s64 (int64_t __a)
{
- return (int32_t) __builtin_aarch64_sqmovundi (__a);
+ return __builtin_aarch64_sqmovundi_us (__a);
}
/* vqneg */
@@ -24253,28 +24337,28 @@ vqrshld_s64 (int64_t __a, int64_t __b)
__extension__ extern __inline uint8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqrshlb_u8 (uint8_t __a, uint8_t __b)
+vqrshlb_u8 (uint8_t __a, int8_t __b)
{
return __builtin_aarch64_uqrshlqi_uus (__a, __b);
}
__extension__ extern __inline uint16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqrshlh_u16 (uint16_t __a, uint16_t __b)
+vqrshlh_u16 (uint16_t __a, int16_t __b)
{
return __builtin_aarch64_uqrshlhi_uus (__a, __b);
}
__extension__ extern __inline uint32_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqrshls_u32 (uint32_t __a, uint32_t __b)
+vqrshls_u32 (uint32_t __a, int32_t __b)
{
return __builtin_aarch64_uqrshlsi_uus (__a, __b);
}
__extension__ extern __inline uint64_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqrshld_u64 (uint64_t __a, uint64_t __b)
+vqrshld_u64 (uint64_t __a, int64_t __b)
{
return __builtin_aarch64_uqrshldi_uus (__a, __b);
}
@@ -24553,28 +24637,28 @@ vqshld_s64 (int64_t __a, int64_t __b)
__extension__ extern __inline uint8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqshlb_u8 (uint8_t __a, uint8_t __b)
+vqshlb_u8 (uint8_t __a, int8_t __b)
{
return __builtin_aarch64_uqshlqi_uus (__a, __b);
}
__extension__ extern __inline uint16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqshlh_u16 (uint16_t __a, uint16_t __b)
+vqshlh_u16 (uint16_t __a, int16_t __b)
{
return __builtin_aarch64_uqshlhi_uus (__a, __b);
}
__extension__ extern __inline uint32_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqshls_u32 (uint32_t __a, uint32_t __b)
+vqshls_u32 (uint32_t __a, int32_t __b)
{
return __builtin_aarch64_uqshlsi_uus (__a, __b);
}
__extension__ extern __inline uint64_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vqshld_u64 (uint64_t __a, uint64_t __b)
+vqshld_u64 (uint64_t __a, int64_t __b)
{
return __builtin_aarch64_uqshldi_uus (__a, __b);
}
@@ -26003,6 +26087,13 @@ vrndmq_f64 (float64x2_t __a)
/* vrndn */
+__extension__ extern __inline float32_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vrndns_f32 (float32_t __a)
+{
+ return __builtin_aarch64_frintnsf (__a);
+}
+
__extension__ extern __inline float32x2_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vrndn_f32 (float32x2_t __a)
@@ -26908,7 +26999,7 @@ vshld_s64 (int64_t __a, int64_t __b)
__extension__ extern __inline uint64_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vshld_u64 (uint64_t __a, uint64_t __b)
+vshld_u64 (uint64_t __a, int64_t __b)
{
return __builtin_aarch64_ushldi_uus (__a, __b);
}
@@ -30104,6 +30195,13 @@ vst4q_p64 (poly64_t * __a, poly64x2x4_t __val)
__builtin_aarch64_st4v2di ((__builtin_aarch64_simd_di *) __a, __o);
}
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vstrq_p128 (poly128_t * __ptr, poly128_t __val)
+{
+ *__ptr = __val;
+}
+
/* vsub */
__extension__ extern __inline int64_t
@@ -30491,6 +30589,17 @@ vtrn1q_u32 (uint32x4_t __a, uint32x4_t __b)
#endif
}
+__extension__ extern __inline poly64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vtrn1q_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+#ifdef __AARCH64EB__
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {3, 1});
+#else
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {0, 2});
+#endif
+}
+
__extension__ extern __inline uint64x2_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vtrn1q_u64 (uint64x2_t __a, uint64x2_t __b)
@@ -30761,6 +30870,18 @@ vtrn2q_u64 (uint64x2_t __a, uint64x2_t __b)
#endif
}
+
+__extension__ extern __inline poly64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vtrn2q_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+#ifdef __AARCH64EB__
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {2, 0});
+#else
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {1, 3});
+#endif
+}
+
__extension__ extern __inline float16x4x2_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vtrn_f16 (float16x4_t __a, float16x4_t __b)
@@ -31407,6 +31528,17 @@ vuzp1q_u64 (uint64x2_t __a, uint64x2_t __b)
#endif
}
+__extension__ extern __inline poly64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vuzp1q_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+#ifdef __AARCH64EB__
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {3, 1});
+#else
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {0, 2});
+#endif
+}
+
__extension__ extern __inline float16x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vuzp2_f16 (float16x4_t __a, float16x4_t __b)
@@ -31666,6 +31798,17 @@ vuzp2q_u64 (uint64x2_t __a, uint64x2_t __b)
#endif
}
+__extension__ extern __inline poly64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vuzp2q_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+#ifdef __AARCH64EB__
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {2, 0});
+#else
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {1, 3});
+#endif
+}
+
__INTERLEAVE_LIST (uzp)
/* vzip */
@@ -31934,6 +32077,17 @@ vzip1q_u64 (uint64x2_t __a, uint64x2_t __b)
#endif
}
+__extension__ extern __inline poly64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vzip1q_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+#ifdef __AARCH64EB__
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {3, 1});
+#else
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {0, 2});
+#endif
+}
+
__extension__ extern __inline float16x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vzip2_f16 (float16x4_t __a, float16x4_t __b)
@@ -32198,6 +32352,17 @@ vzip2q_u64 (uint64x2_t __a, uint64x2_t __b)
#endif
}
+__extension__ extern __inline poly64x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vzip2q_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+#ifdef __AARCH64EB__
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {2, 0});
+#else
+ return __builtin_shuffle (__a, __b, (poly64x2_t) {1, 3});
+#endif
+}
+
__INTERLEAVE_LIST (zip)
#undef __INTERLEAVE_LIST
@@ -35659,6 +35824,55 @@ vusmmlaq_s32 (int32x4_t __r, uint8x16_t __a, int8x16_t __b)
#pragma GCC pop_options
+__extension__ extern __inline poly8x8_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vadd_p8 (poly8x8_t __a, poly8x8_t __b)
+{
+ return __a ^ __b;
+}
+
+__extension__ extern __inline poly16x4_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vadd_p16 (poly16x4_t __a, poly16x4_t __b)
+{
+ return __a ^ __b;
+}
+
+__extension__ extern __inline poly64x1_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vadd_p64 (poly64x1_t __a, poly64x1_t __b)
+{
+ return __a ^ __b;
+}
+
+__extension__ extern __inline poly8x16_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vaddq_p8 (poly8x16_t __a, poly8x16_t __b)
+{
+ return __a ^ __b;
+}
+
+__extension__ extern __inline poly16x8_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vaddq_p16 (poly16x8_t __a, poly16x8_t __b)
+{
+ return __a ^__b;
+}
+
+__extension__ extern __inline poly64x2_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vaddq_p64 (poly64x2_t __a, poly64x2_t __b)
+{
+ return __a ^ __b;
+}
+
+__extension__ extern __inline poly128_t
+__attribute ((__always_inline__, __gnu_inline__, __artificial__))
+vaddq_p128 (poly128_t __a, poly128_t __b)
+{
+ return __a ^ __b;
+}
+
#undef __aarch64_vget_lane_any
#undef __aarch64_vdup_lane_any
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 33e8015..db505a4 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -811,23 +811,23 @@ arm_ldrgbwbu_z_qualifiers[SIMD_MAX_BUILTIN_ARGS]
static enum arm_type_qualifiers
arm_strsbwbs_qualifiers[SIMD_MAX_BUILTIN_ARGS]
- = { qualifier_void, qualifier_unsigned, qualifier_const, qualifier_none};
+ = { qualifier_unsigned, qualifier_unsigned, qualifier_const, qualifier_none};
#define STRSBWBS_QUALIFIERS (arm_strsbwbs_qualifiers)
static enum arm_type_qualifiers
arm_strsbwbu_qualifiers[SIMD_MAX_BUILTIN_ARGS]
- = { qualifier_void, qualifier_unsigned, qualifier_const, qualifier_unsigned};
+ = { qualifier_unsigned, qualifier_unsigned, qualifier_const, qualifier_unsigned};
#define STRSBWBU_QUALIFIERS (arm_strsbwbu_qualifiers)
static enum arm_type_qualifiers
arm_strsbwbs_p_qualifiers[SIMD_MAX_BUILTIN_ARGS]
- = { qualifier_void, qualifier_unsigned, qualifier_const,
+ = { qualifier_unsigned, qualifier_unsigned, qualifier_const,
qualifier_none, qualifier_unsigned};
#define STRSBWBS_P_QUALIFIERS (arm_strsbwbs_p_qualifiers)
static enum arm_type_qualifiers
arm_strsbwbu_p_qualifiers[SIMD_MAX_BUILTIN_ARGS]
- = { qualifier_void, qualifier_unsigned, qualifier_const,
+ = { qualifier_unsigned, qualifier_unsigned, qualifier_const,
qualifier_unsigned, qualifier_unsigned};
#define STRSBWBU_P_QUALIFIERS (arm_strsbwbu_p_qualifiers)
diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in
index c98f8ed..8c61ad0 100644
--- a/gcc/config/arm/arm-cpus.in
+++ b/gcc/config/arm/arm-cpus.in
@@ -135,10 +135,6 @@ define feature armv8_1m_main
# Floating point and Neon extensions.
# VFPv1 is not supported in GCC.
-# This feature bit is enabled for all VFP, MVE and
-# MVE with floating point extensions.
-define feature vfp_base
-
# Vector floating point v2.
define feature vfpv2
@@ -251,7 +247,7 @@ define fgroup ALL_SIMD ALL_SIMD_INTERNAL ALL_SIMD_EXTERNAL
# List of all FPU bits to strip out if -mfpu is used to override the
# default. fp16 is deliberately missing from this list.
-define fgroup ALL_FPU_INTERNAL vfp_base vfpv2 vfpv3 vfpv4 fpv5 fp16conv fp_dbl ALL_SIMD_INTERNAL
+define fgroup ALL_FPU_INTERNAL vfpv2 vfpv3 vfpv4 fpv5 fp16conv fp_dbl ALL_SIMD_INTERNAL
# Similarly, but including fp16 and other extensions that aren't part of
# -mfpu support.
define fgroup ALL_FPU_EXTERNAL fp16 bf16
@@ -296,11 +292,11 @@ define fgroup ARMv8r ARMv8a
define fgroup ARMv8_1m_main ARMv8m_main armv8_1m_main
# Useful combinations.
-define fgroup VFPv2 vfp_base vfpv2
+define fgroup VFPv2 vfpv2
define fgroup VFPv3 VFPv2 vfpv3
define fgroup VFPv4 VFPv3 vfpv4 fp16conv
define fgroup FPv5 VFPv4 fpv5
-define fgroup MVE mve vfp_base armv7em
+define fgroup MVE mve armv7em
define fgroup MVE_FP MVE FPv5 fp16 mve_float
define fgroup FP_DBL fp_dbl
@@ -310,6 +306,18 @@ define fgroup NEON FP_D32 neon
define fgroup CRYPTO NEON crypto
define fgroup DOTPROD NEON dotprod
+# Implied feature bits. These are for non-named features shared between fgroups.
+# Shared feature f belonging to fgroups A and B will be erroneously removed if:
+# A and B are enabled by default AND A is disabled by a removal flag.
+# To ensure that f is retained, we must add such bits to the ISA after
+# processing the removal flags. This is implemented by 'implied bits':
+# define implied <name> [<feature-or-fgroup>]+
+# This indicates that, if any of the listed features are enabled, or if any
+# member of a listed fgroup is enabled, then <name> will be implicitly enabled.
+
+# Enabled for all VFP, MVE and MVE with floating point extensions.
+define implied vfp_base MVE MVE_FP ALL_FP
+
# List of all quirk bits to strip out when comparing CPU features with
# architectures.
# xscale isn't really a 'quirk', but it isn't an architecture either and we
@@ -1447,6 +1455,39 @@ begin cpu cortex-a77
part d0d
end cpu cortex-a77
+begin cpu cortex-a78
+ cname cortexa78
+ tune for cortex-a57
+ tune flags LDSCHED
+ architecture armv8.2-a+fp16+dotprod
+ option crypto add FP_ARMv8 CRYPTO
+ costs cortex_a57
+ vendor 41
+ part d41
+end cpu cortex-a78
+
+begin cpu cortex-a78ae
+ cname cortexa78ae
+ tune for cortex-a57
+ tune flags LDSCHED
+ architecture armv8.2-a+fp16+dotprod
+ option crypto add FP_ARMv8 CRYPTO
+ costs cortex_a57
+ vendor 41
+ part d42
+end cpu cortex-a78ae
+
+begin cpu cortex-x1
+ cname cortexx1
+ tune for cortex-a57
+ tune flags LDSCHED
+ architecture armv8.2-a+fp16+dotprod
+ option crypto add FP_ARMv8 CRYPTO
+ costs cortex_a57
+ vendor 41
+ part d44
+end cpu cortex-x1
+
begin cpu neoverse-n1
cname neoversen1
alias !ares
@@ -1478,6 +1519,30 @@ begin cpu cortex-a76.cortex-a55
costs cortex_a57
end cpu cortex-a76.cortex-a55
+# Armv8.4 A-profile Architecture Processors
+begin cpu neoverse-v1
+ cname neoversev1
+ tune for cortex-a57
+ tune flags LDSCHED
+ architecture armv8.4-a+fp16+bf16+i8mm
+ option crypto add FP_ARMv8 CRYPTO
+ costs cortex_a57
+ vendor 41
+ part 0xd40
+end cpu neoverse-v1
+
+# Armv8.5 A-profile Architecture Processors
+begin cpu neoverse-n2
+ cname neoversen2
+ tune for cortex-a57
+ tune flags LDSCHED
+ architecture armv8.5-a+fp16+bf16+i8mm
+ option crypto add FP_ARMv8 CRYPTO
+ costs cortex_a57
+ vendor 41
+ part 0xd49
+end cpu neoverse-n2
+
# V8 M-profile implementations.
begin cpu cortex-m23
cname cortexm23
@@ -1508,6 +1573,10 @@ begin cpu cortex-m55
cname cortexm55
tune flags LDSCHED
architecture armv8.1-m.main+mve.fp+fp.dp
+ option nomve.fp remove mve_float
+ option nomve remove mve mve_float
+ option nofp remove ALL_FP mve_float
+ option nodsp remove MVE mve_float
isa quirk_no_asmcpu
costs v7m
vendor 41
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 0cc0ae7..703d616 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -120,7 +120,6 @@ extern int arm_coproc_mem_operand_no_writeback (rtx);
extern int arm_coproc_mem_operand_wb (rtx, int);
extern int neon_vector_mem_operand (rtx, int, bool);
extern int mve_vector_mem_operand (machine_mode, rtx, bool);
-bool arm_mve_mode_and_operands_type_check (machine_mode, rtx, rtx);
extern int neon_struct_mem_operand (rtx);
extern rtx *neon_vcmla_lane_prepare_operands (rtx *);
@@ -373,9 +372,11 @@ extern void arm_emit_coreregs_64bit_shift (enum rtx_code, rtx, rtx, rtx, rtx,
extern bool arm_fusion_enabled_p (tune_params::fuse_ops);
extern bool arm_valid_symbolic_address_p (rtx);
extern bool arm_validize_comparison (rtx *, rtx *, rtx *);
+extern bool arm_expand_vector_compare (rtx, rtx_code, rtx, rtx, bool);
#endif /* RTX_CODE */
extern bool arm_gen_setmem (rtx *);
+extern void arm_expand_vcond (rtx *, machine_mode);
extern void arm_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel);
extern bool arm_autoinc_modes_ok_p (machine_mode, enum arm_auto_incmodes);
diff --git a/gcc/config/arm/arm-tables.opt b/gcc/config/arm/arm-tables.opt
index ce35661..05f5c08 100644
--- a/gcc/config/arm/arm-tables.opt
+++ b/gcc/config/arm/arm-tables.opt
@@ -241,6 +241,15 @@ EnumValue
Enum(processor_type) String(cortex-a77) Value( TARGET_CPU_cortexa77)
EnumValue
+Enum(processor_type) String(cortex-a78) Value( TARGET_CPU_cortexa78)
+
+EnumValue
+Enum(processor_type) String(cortex-a78ae) Value( TARGET_CPU_cortexa78ae)
+
+EnumValue
+Enum(processor_type) String(cortex-x1) Value( TARGET_CPU_cortexx1)
+
+EnumValue
Enum(processor_type) String(neoverse-n1) Value( TARGET_CPU_neoversen1)
EnumValue
@@ -250,6 +259,12 @@ EnumValue
Enum(processor_type) String(cortex-a76.cortex-a55) Value( TARGET_CPU_cortexa76cortexa55)
EnumValue
+Enum(processor_type) String(neoverse-v1) Value( TARGET_CPU_neoversev1)
+
+EnumValue
+Enum(processor_type) String(neoverse-n2) Value( TARGET_CPU_neoversen2)
+
+EnumValue
Enum(processor_type) String(cortex-m23) Value( TARGET_CPU_cortexm23)
EnumValue
diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md
index 8ea9435..32657da 100644
--- a/gcc/config/arm/arm-tune.md
+++ b/gcc/config/arm/arm-tune.md
@@ -45,7 +45,9 @@
cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,
cortexa73cortexa53,cortexa55,cortexa75,
cortexa76,cortexa76ae,cortexa77,
+ cortexa78,cortexa78ae,cortexx1,
neoversen1,cortexa75cortexa55,cortexa76cortexa55,
- cortexm23,cortexm33,cortexm35p,
- cortexm55,cortexr52"
+ neoversev1,neoversen2,cortexm23,
+ cortexm33,cortexm35p,cortexm55,
+ cortexr52"
(const (symbol_ref "((enum attr_tune) arm_tune)")))
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 022ef6c..dfadaca 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3391,6 +3391,20 @@ arm_configure_build_target (struct arm_build_target *target,
bitmap_ior (target->isa, target->isa, fpu_bits);
}
+ /* There may be implied bits which we still need to enable. These are
+ non-named features which are needed to complete other sets of features,
+ but cannot be enabled from arm-cpus.in due to being shared between
+ multiple fgroups. Each entry in all_implied_fbits is of the form
+ ante -> cons, meaning that if the feature "ante" is enabled, we should
+ implicitly enable "cons". */
+ const struct fbit_implication *impl = all_implied_fbits;
+ while (impl->ante)
+ {
+ if (bitmap_bit_p (target->isa, impl->ante))
+ bitmap_set_bit (target->isa, impl->cons);
+ impl++;
+ }
+
if (!arm_selected_tune)
arm_selected_tune = arm_selected_cpu;
else /* Validate the features passed to -mtune. */
@@ -3415,8 +3429,9 @@ arm_option_override (void)
{
static const enum isa_feature fpu_bitlist_internal[]
= { ISA_ALL_FPU_INTERNAL, isa_nobit };
+ /* isa_bit_mve_float is also part of FP bit list for arch v8.1-m.main. */
static const enum isa_feature fp_bitlist[]
- = { ISA_ALL_FP, isa_nobit };
+ = { ISA_ALL_FP, isa_bit_mve_float, isa_nobit };
static const enum isa_feature quirk_bitlist[] = { ISA_ALL_QUIRKS, isa_nobit};
cl_target_option opts;
@@ -13277,14 +13292,18 @@ arm_coproc_mem_operand_wb (rtx op, int wb_level)
/* Match:
(plus (reg)
- (const)). */
+ (const))
+
+ The encoded immediate for 16-bit modes is multiplied by 2,
+ while the encoded immediate for 32-bit and 64-bit modes is
+ multiplied by 4. */
+ int factor = MIN (GET_MODE_SIZE (GET_MODE (op)), 4);
if (GET_CODE (ind) == PLUS
&& REG_P (XEXP (ind, 0))
&& REG_MODE_OK_FOR_BASE_P (XEXP (ind, 0), VOIDmode)
&& CONST_INT_P (XEXP (ind, 1))
- && INTVAL (XEXP (ind, 1)) > -1024
- && INTVAL (XEXP (ind, 1)) < 1024
- && (INTVAL (XEXP (ind, 1)) & 3) == 0)
+ && IN_RANGE (INTVAL (XEXP (ind, 1)), -255 * factor, 255 * factor)
+ && (INTVAL (XEXP (ind, 1)) & (factor - 1)) == 0)
return TRUE;
return FALSE;
@@ -28946,6 +28965,30 @@ arm_preferred_simd_mode (scalar_mode mode)
default:;
}
+ if (TARGET_HAVE_MVE)
+ switch (mode)
+ {
+ case E_QImode:
+ return V16QImode;
+ case E_HImode:
+ return V8HImode;
+ case E_SImode:
+ return V4SImode;
+
+ default:;
+ }
+
+ if (TARGET_HAVE_MVE_FLOAT)
+ switch (mode)
+ {
+ case E_HFmode:
+ return V8HFmode;
+ case E_SFmode:
+ return V4SFmode;
+
+ default:;
+ }
+
return word_mode;
}
@@ -30630,6 +30673,127 @@ arm_split_atomic_op (enum rtx_code code, rtx old_out, rtx new_out, rtx mem,
arm_post_atomic_barrier (model);
}
+/* Expand code to compare vectors OP0 and OP1 using condition CODE.
+ If CAN_INVERT, store either the result or its inverse in TARGET
+ and return true if TARGET contains the inverse. If !CAN_INVERT,
+ always store the result in TARGET, never its inverse.
+
+ Note that the handling of floating-point comparisons is not
+ IEEE compliant. */
+
+bool
+arm_expand_vector_compare (rtx target, rtx_code code, rtx op0, rtx op1,
+ bool can_invert)
+{
+ machine_mode cmp_result_mode = GET_MODE (target);
+ machine_mode cmp_mode = GET_MODE (op0);
+
+ bool inverted;
+ switch (code)
+ {
+ /* For these we need to compute the inverse of the requested
+ comparison. */
+ case UNORDERED:
+ case UNLT:
+ case UNLE:
+ case UNGT:
+ case UNGE:
+ case UNEQ:
+ case NE:
+ code = reverse_condition_maybe_unordered (code);
+ if (!can_invert)
+ {
+ /* Recursively emit the inverted comparison into a temporary
+ and then store its inverse in TARGET. This avoids reusing
+ TARGET (which for integer NE could be one of the inputs). */
+ rtx tmp = gen_reg_rtx (cmp_result_mode);
+ if (arm_expand_vector_compare (tmp, code, op0, op1, true))
+ gcc_unreachable ();
+ emit_insn (gen_rtx_SET (target, gen_rtx_NOT (cmp_result_mode, tmp)));
+ return false;
+ }
+ inverted = true;
+ break;
+
+ default:
+ inverted = false;
+ break;
+ }
+
+ switch (code)
+ {
+ /* These are natively supported for zero comparisons, but otherwise
+ require the operands to be swapped. */
+ case LE:
+ case LT:
+ if (op1 != CONST0_RTX (cmp_mode))
+ {
+ code = swap_condition (code);
+ std::swap (op0, op1);
+ }
+ /* Fall through. */
+
+ /* These are natively supported for both register and zero operands. */
+ case EQ:
+ case GE:
+ case GT:
+ emit_insn (gen_neon_vc (code, cmp_mode, target, op0, op1));
+ return inverted;
+
+ /* These are natively supported for register operands only.
+ Comparisons with zero aren't useful and should be folded
+ or canonicalized by target-independent code. */
+ case GEU:
+ case GTU:
+ emit_insn (gen_neon_vc (code, cmp_mode, target,
+ op0, force_reg (cmp_mode, op1)));
+ return inverted;
+
+ /* These require the operands to be swapped and likewise do not
+ support comparisons with zero. */
+ case LEU:
+ case LTU:
+ emit_insn (gen_neon_vc (swap_condition (code), cmp_mode,
+ target, force_reg (cmp_mode, op1), op0));
+ return inverted;
+
+ /* These need a combination of two comparisons. */
+ case LTGT:
+ case ORDERED:
+ {
+ /* Operands are LTGT iff (a > b || a > b).
+ Operands are ORDERED iff (a > b || a <= b). */
+ rtx gt_res = gen_reg_rtx (cmp_result_mode);
+ rtx alt_res = gen_reg_rtx (cmp_result_mode);
+ rtx_code alt_code = (code == LTGT ? LT : LE);
+ if (arm_expand_vector_compare (gt_res, GT, op0, op1, true)
+ || arm_expand_vector_compare (alt_res, alt_code, op0, op1, true))
+ gcc_unreachable ();
+ emit_insn (gen_rtx_SET (target, gen_rtx_IOR (cmp_result_mode,
+ gt_res, alt_res)));
+ return inverted;
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Expand a vcond or vcondu pattern with operands OPERANDS.
+ CMP_RESULT_MODE is the mode of the comparison result. */
+
+void
+arm_expand_vcond (rtx *operands, machine_mode cmp_result_mode)
+{
+ rtx mask = gen_reg_rtx (cmp_result_mode);
+ bool inverted = arm_expand_vector_compare (mask, GET_CODE (operands[3]),
+ operands[4], operands[5], true);
+ if (inverted)
+ std::swap (operands[1], operands[2]);
+ emit_insn (gen_neon_vbsl (GET_MODE (operands[0]), operands[0],
+ mask, operands[1], operands[2]));
+}
+
#define MAX_VECT_LEN 16
struct expand_vec_perm_d
@@ -33112,9 +33276,7 @@ arm_expand_divmod_libfunc (rtx libfunc, machine_mode mode,
= smallest_int_mode_for_size (2 * GET_MODE_BITSIZE (mode));
rtx libval = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,
- libval_mode,
- op0, GET_MODE (op0),
- op1, GET_MODE (op1));
+ libval_mode, op0, mode, op1, mode);
rtx quotient = simplify_gen_subreg (mode, libval, libval_mode, 0);
rtx remainder = simplify_gen_subreg (mode, libval, libval_mode,
@@ -33578,17 +33740,4 @@ arm_mode_base_reg_class (machine_mode mode)
struct gcc_target targetm = TARGET_INITIALIZER;
-bool
-arm_mve_mode_and_operands_type_check (machine_mode mode, rtx op0, rtx op1)
-{
- if (!(TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT))
- return true;
- else if (mode == E_BFmode)
- return false;
- else if ((s_register_operand (op0, mode) && MEM_P (op1))
- || (s_register_operand (op1, mode) && MEM_P (op0)))
- return false;
- return true;
-}
-
#include "gt-arm.h"
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index f4d3676..4a63d33 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1110,6 +1110,47 @@ extern const int arm_arch_cde_coproc_bits[];
#define VALID_MVE_STRUCT_MODE(MODE) \
((MODE) == TImode || (MODE) == OImode || (MODE) == XImode)
+/* The conditions under which vector modes are supported for general
+ arithmetic using Neon. */
+
+#define ARM_HAVE_NEON_V8QI_ARITH TARGET_NEON
+#define ARM_HAVE_NEON_V4HI_ARITH TARGET_NEON
+#define ARM_HAVE_NEON_V2SI_ARITH TARGET_NEON
+
+#define ARM_HAVE_NEON_V16QI_ARITH TARGET_NEON
+#define ARM_HAVE_NEON_V8HI_ARITH TARGET_NEON
+#define ARM_HAVE_NEON_V4SI_ARITH TARGET_NEON
+#define ARM_HAVE_NEON_V2DI_ARITH TARGET_NEON
+
+/* HF operations have their own flush-to-zero control (FPSCR.FZ16). */
+#define ARM_HAVE_NEON_V4HF_ARITH TARGET_NEON_FP16INST
+#define ARM_HAVE_NEON_V8HF_ARITH TARGET_NEON_FP16INST
+
+/* SF operations always flush to zero, regardless of FPSCR.FZ, so we can
+ only use them for general arithmetic when -funsafe-math-optimizations
+ is in effect. */
+#define ARM_HAVE_NEON_V2SF_ARITH \
+ (TARGET_NEON && flag_unsafe_math_optimizations)
+#define ARM_HAVE_NEON_V4SF_ARITH ARM_HAVE_NEON_V2SF_ARITH
+
+/* The conditions under which vector modes are supported for general
+ arithmetic by any vector extension. */
+
+#define ARM_HAVE_V8QI_ARITH (ARM_HAVE_NEON_V8QI_ARITH || TARGET_REALLY_IWMMXT)
+#define ARM_HAVE_V4HI_ARITH (ARM_HAVE_NEON_V4HI_ARITH || TARGET_REALLY_IWMMXT)
+#define ARM_HAVE_V2SI_ARITH (ARM_HAVE_NEON_V2SI_ARITH || TARGET_REALLY_IWMMXT)
+
+#define ARM_HAVE_V16QI_ARITH (ARM_HAVE_NEON_V16QI_ARITH || TARGET_HAVE_MVE)
+#define ARM_HAVE_V8HI_ARITH (ARM_HAVE_NEON_V8HI_ARITH || TARGET_HAVE_MVE)
+#define ARM_HAVE_V4SI_ARITH (ARM_HAVE_NEON_V4SI_ARITH || TARGET_HAVE_MVE)
+#define ARM_HAVE_V2DI_ARITH ARM_HAVE_NEON_V2DI_ARITH
+
+#define ARM_HAVE_V4HF_ARITH ARM_HAVE_NEON_V4HF_ARITH
+#define ARM_HAVE_V2SF_ARITH ARM_HAVE_NEON_V2SF_ARITH
+
+#define ARM_HAVE_V8HF_ARITH (ARM_HAVE_NEON_V8HF_ARITH || TARGET_HAVE_MVE_FLOAT)
+#define ARM_HAVE_V4SF_ARITH (ARM_HAVE_NEON_V4SF_ARITH || TARGET_HAVE_MVE_FLOAT)
+
/* The register numbers in sequence, for passing to arm_gen_load_multiple. */
extern int arm_regs_in_sequence[];
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index bffdb0b..1a8e498 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -7289,7 +7289,9 @@
(define_insn "*arm32_mov<mode>"
[(set (match_operand:HFBF 0 "nonimmediate_operand" "=r,m,r,r")
(match_operand:HFBF 1 "general_operand" " m,r,r,F"))]
- "TARGET_32BIT && !TARGET_HARD_FLOAT
+ "TARGET_32BIT
+ && !TARGET_HARD_FLOAT
+ && !TARGET_HAVE_MVE
&& ( s_register_operand (operands[0], <MODE>mode)
|| s_register_operand (operands[1], <MODE>mode))"
"*
@@ -7355,7 +7357,7 @@
if (arm_disable_literal_pool
&& (REG_P (operands[0]) || SUBREG_P (operands[0]))
&& CONST_DOUBLE_P (operands[1])
- && TARGET_HARD_FLOAT
+ && TARGET_VFP_BASE
&& !vfp3_const_double_rtx (operands[1]))
{
rtx clobreg = gen_reg_rtx (SFmode);
@@ -7452,7 +7454,7 @@
if (arm_disable_literal_pool
&& (REG_P (operands[0]) || SUBREG_P (operands[0]))
&& CONSTANT_P (operands[1])
- && TARGET_HARD_FLOAT
+ && TARGET_VFP_BASE
&& !arm_const_double_rtx (operands[1])
&& !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1])))
{
@@ -9212,7 +9214,7 @@
operands[2] = operands[1];
else
{
- rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
+ rtx mem = force_const_mem (SImode, operands[1]);
emit_move_insn (operands[2], mem);
}
}
@@ -9295,7 +9297,7 @@
operands[3] = operands[1];
else
{
- rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
+ rtx mem = force_const_mem (SImode, operands[1]);
emit_move_insn (operands[3], mem);
}
}
diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h
index a801705..6c0d1e2 100644
--- a/gcc/config/arm/arm_mve.h
+++ b/gcc/config/arm/arm_mve.h
@@ -141,6 +141,7 @@
#define vrev64q_m(__inactive, __a, __p) __arm_vrev64q_m(__inactive, __a, __p)
#define vqrdmlashq(__a, __b, __c) __arm_vqrdmlashq(__a, __b, __c)
#define vqrdmlahq(__a, __b, __c) __arm_vqrdmlahq(__a, __b, __c)
+#define vqdmlashq(__a, __b, __c) __arm_vqdmlashq(__a, __b, __c)
#define vqdmlahq(__a, __b, __c) __arm_vqdmlahq(__a, __b, __c)
#define vmvnq_m(__inactive, __a, __p) __arm_vmvnq_m(__inactive, __a, __p)
#define vmlasq(__a, __b, __c) __arm_vmlasq(__a, __b, __c)
@@ -260,6 +261,7 @@
#define vorrq_m(__inactive, __a, __b, __p) __arm_vorrq_m(__inactive, __a, __b, __p)
#define vqaddq_m(__inactive, __a, __b, __p) __arm_vqaddq_m(__inactive, __a, __b, __p)
#define vqdmladhq_m(__inactive, __a, __b, __p) __arm_vqdmladhq_m(__inactive, __a, __b, __p)
+#define vqdmlashq_m(__a, __b, __c, __p) __arm_vqdmlashq_m(__a, __b, __c, __p)
#define vqdmladhxq_m(__inactive, __a, __b, __p) __arm_vqdmladhxq_m(__inactive, __a, __b, __p)
#define vqdmlahq_m(__a, __b, __c, __p) __arm_vqdmlahq_m(__a, __b, __c, __p)
#define vqdmlsdhq_m(__inactive, __a, __b, __p) __arm_vqdmlsdhq_m(__inactive, __a, __b, __p)
@@ -643,6 +645,7 @@
#define vcvtpq_u16_f16(__a) __arm_vcvtpq_u16_f16(__a)
#define vcvtpq_u32_f32(__a) __arm_vcvtpq_u32_f32(__a)
#define vcvtnq_u16_f16(__a) __arm_vcvtnq_u16_f16(__a)
+#define vcvtnq_u32_f32(__a) __arm_vcvtnq_u32_f32(__a)
#define vcvtmq_u16_f16(__a) __arm_vcvtmq_u16_f16(__a)
#define vcvtmq_u32_f32(__a) __arm_vcvtmq_u32_f32(__a)
#define vcvtaq_u16_f16(__a) __arm_vcvtaq_u16_f16(__a)
@@ -1234,9 +1237,6 @@
#define vpselq_u8(__a, __b, __p) __arm_vpselq_u8(__a, __b, __p)
#define vpselq_s8(__a, __b, __p) __arm_vpselq_s8(__a, __b, __p)
#define vrev64q_m_u8(__inactive, __a, __p) __arm_vrev64q_m_u8(__inactive, __a, __p)
-#define vqrdmlashq_n_u8(__a, __b, __c) __arm_vqrdmlashq_n_u8(__a, __b, __c)
-#define vqrdmlahq_n_u8(__a, __b, __c) __arm_vqrdmlahq_n_u8(__a, __b, __c)
-#define vqdmlahq_n_u8(__a, __b, __c) __arm_vqdmlahq_n_u8(__a, __b, __c)
#define vmvnq_m_u8(__inactive, __a, __p) __arm_vmvnq_m_u8(__inactive, __a, __p)
#define vmlasq_n_u8(__a, __b, __c) __arm_vmlasq_n_u8(__a, __b, __c)
#define vmlaq_n_u8(__a, __b, __c) __arm_vmlaq_n_u8(__a, __b, __c)
@@ -1306,6 +1306,7 @@
#define vqdmlsdhxq_s8(__inactive, __a, __b) __arm_vqdmlsdhxq_s8(__inactive, __a, __b)
#define vqdmlsdhq_s8(__inactive, __a, __b) __arm_vqdmlsdhq_s8(__inactive, __a, __b)
#define vqdmlahq_n_s8(__a, __b, __c) __arm_vqdmlahq_n_s8(__a, __b, __c)
+#define vqdmlashq_n_s8(__a, __b, __c) __arm_vqdmlashq_n_s8(__a, __b, __c)
#define vqdmladhxq_s8(__inactive, __a, __b) __arm_vqdmladhxq_s8(__inactive, __a, __b)
#define vqdmladhq_s8(__inactive, __a, __b) __arm_vqdmladhq_s8(__inactive, __a, __b)
#define vmlsdavaxq_s8(__a, __b, __c) __arm_vmlsdavaxq_s8(__a, __b, __c)
@@ -1319,9 +1320,6 @@
#define vpselq_u16(__a, __b, __p) __arm_vpselq_u16(__a, __b, __p)
#define vpselq_s16(__a, __b, __p) __arm_vpselq_s16(__a, __b, __p)
#define vrev64q_m_u16(__inactive, __a, __p) __arm_vrev64q_m_u16(__inactive, __a, __p)
-#define vqrdmlashq_n_u16(__a, __b, __c) __arm_vqrdmlashq_n_u16(__a, __b, __c)
-#define vqrdmlahq_n_u16(__a, __b, __c) __arm_vqrdmlahq_n_u16(__a, __b, __c)
-#define vqdmlahq_n_u16(__a, __b, __c) __arm_vqdmlahq_n_u16(__a, __b, __c)
#define vmvnq_m_u16(__inactive, __a, __p) __arm_vmvnq_m_u16(__inactive, __a, __p)
#define vmlasq_n_u16(__a, __b, __c) __arm_vmlasq_n_u16(__a, __b, __c)
#define vmlaq_n_u16(__a, __b, __c) __arm_vmlaq_n_u16(__a, __b, __c)
@@ -1390,6 +1388,7 @@
#define vqrdmladhq_s16(__inactive, __a, __b) __arm_vqrdmladhq_s16(__inactive, __a, __b)
#define vqdmlsdhxq_s16(__inactive, __a, __b) __arm_vqdmlsdhxq_s16(__inactive, __a, __b)
#define vqdmlsdhq_s16(__inactive, __a, __b) __arm_vqdmlsdhq_s16(__inactive, __a, __b)
+#define vqdmlashq_n_s16(__a, __b, __c) __arm_vqdmlashq_n_s16(__a, __b, __c)
#define vqdmlahq_n_s16(__a, __b, __c) __arm_vqdmlahq_n_s16(__a, __b, __c)
#define vqdmladhxq_s16(__inactive, __a, __b) __arm_vqdmladhxq_s16(__inactive, __a, __b)
#define vqdmladhq_s16(__inactive, __a, __b) __arm_vqdmladhq_s16(__inactive, __a, __b)
@@ -1404,9 +1403,6 @@
#define vpselq_u32(__a, __b, __p) __arm_vpselq_u32(__a, __b, __p)
#define vpselq_s32(__a, __b, __p) __arm_vpselq_s32(__a, __b, __p)
#define vrev64q_m_u32(__inactive, __a, __p) __arm_vrev64q_m_u32(__inactive, __a, __p)
-#define vqrdmlashq_n_u32(__a, __b, __c) __arm_vqrdmlashq_n_u32(__a, __b, __c)
-#define vqrdmlahq_n_u32(__a, __b, __c) __arm_vqrdmlahq_n_u32(__a, __b, __c)
-#define vqdmlahq_n_u32(__a, __b, __c) __arm_vqdmlahq_n_u32(__a, __b, __c)
#define vmvnq_m_u32(__inactive, __a, __p) __arm_vmvnq_m_u32(__inactive, __a, __p)
#define vmlasq_n_u32(__a, __b, __c) __arm_vmlasq_n_u32(__a, __b, __c)
#define vmlaq_n_u32(__a, __b, __c) __arm_vmlaq_n_u32(__a, __b, __c)
@@ -1475,6 +1471,7 @@
#define vqrdmladhq_s32(__inactive, __a, __b) __arm_vqrdmladhq_s32(__inactive, __a, __b)
#define vqdmlsdhxq_s32(__inactive, __a, __b) __arm_vqdmlsdhxq_s32(__inactive, __a, __b)
#define vqdmlsdhq_s32(__inactive, __a, __b) __arm_vqdmlsdhq_s32(__inactive, __a, __b)
+#define vqdmlashq_n_s32(__a, __b, __c) __arm_vqdmlashq_n_s32(__a, __b, __c)
#define vqdmlahq_n_s32(__a, __b, __c) __arm_vqdmlahq_n_s32(__a, __b, __c)
#define vqdmladhxq_s32(__inactive, __a, __b) __arm_vqdmladhxq_s32(__inactive, __a, __b)
#define vqdmladhq_s32(__inactive, __a, __b) __arm_vqdmladhq_s32(__inactive, __a, __b)
@@ -1901,6 +1898,9 @@
#define vqdmladhxq_m_s8(__inactive, __a, __b, __p) __arm_vqdmladhxq_m_s8(__inactive, __a, __b, __p)
#define vqdmladhxq_m_s32(__inactive, __a, __b, __p) __arm_vqdmladhxq_m_s32(__inactive, __a, __b, __p)
#define vqdmladhxq_m_s16(__inactive, __a, __b, __p) __arm_vqdmladhxq_m_s16(__inactive, __a, __b, __p)
+#define vqdmlashq_m_n_s8(__a, __b, __c, __p) __arm_vqdmlashq_m_n_s8(__a, __b, __c, __p)
+#define vqdmlashq_m_n_s32(__a, __b, __c, __p) __arm_vqdmlashq_m_n_s32(__a, __b, __c, __p)
+#define vqdmlashq_m_n_s16(__a, __b, __c, __p) __arm_vqdmlashq_m_n_s16(__a, __b, __c, __p)
#define vqdmlahq_m_n_s8(__a, __b, __c, __p) __arm_vqdmlahq_m_n_s8(__a, __b, __c, __p)
#define vqdmlahq_m_n_s32(__a, __b, __c, __p) __arm_vqdmlahq_m_n_s32(__a, __b, __c, __p)
#define vqdmlahq_m_n_s16(__a, __b, __c, __p) __arm_vqdmlahq_m_n_s16(__a, __b, __c, __p)
@@ -2024,8 +2024,6 @@
#define vmlaldavaq_p_u16(__a, __b, __c, __p) __arm_vmlaldavaq_p_u16(__a, __b, __c, __p)
#define vmlaldavaxq_p_s32(__a, __b, __c, __p) __arm_vmlaldavaxq_p_s32(__a, __b, __c, __p)
#define vmlaldavaxq_p_s16(__a, __b, __c, __p) __arm_vmlaldavaxq_p_s16(__a, __b, __c, __p)
-#define vmlaldavaxq_p_u32(__a, __b, __c, __p) __arm_vmlaldavaxq_p_u32(__a, __b, __c, __p)
-#define vmlaldavaxq_p_u16(__a, __b, __c, __p) __arm_vmlaldavaxq_p_u16(__a, __b, __c, __p)
#define vmlsldavaq_p_s32(__a, __b, __c, __p) __arm_vmlsldavaq_p_s32(__a, __b, __c, __p)
#define vmlsldavaq_p_s16(__a, __b, __c, __p) __arm_vmlsldavaq_p_s16(__a, __b, __c, __p)
#define vmlsldavaxq_p_s32(__a, __b, __c, __p) __arm_vmlsldavaxq_p_s32(__a, __b, __c, __p)
@@ -6961,27 +6959,6 @@ __arm_vrev64q_m_u8 (uint8x16_t __inactive, uint8x16_t __a, mve_pred16_t __p)
__extension__ extern __inline uint8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlashq_n_u8 (uint8x16_t __a, uint8x16_t __b, uint8_t __c)
-{
- return __builtin_mve_vqrdmlashq_n_uv16qi (__a, __b, __c);
-}
-
-__extension__ extern __inline uint8x16_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlahq_n_u8 (uint8x16_t __a, uint8x16_t __b, uint8_t __c)
-{
- return __builtin_mve_vqrdmlahq_n_uv16qi (__a, __b, __c);
-}
-
-__extension__ extern __inline uint8x16_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqdmlahq_n_u8 (uint8x16_t __a, uint8x16_t __b, uint8_t __c)
-{
- return __builtin_mve_vqdmlahq_n_uv16qi (__a, __b, __c);
-}
-
-__extension__ extern __inline uint8x16_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmvnq_m_u8 (uint8x16_t __inactive, uint8x16_t __a, mve_pred16_t __p)
{
return __builtin_mve_vmvnq_m_uv16qi (__inactive, __a, __p);
@@ -7424,6 +7401,13 @@ __arm_vqrdmlashq_n_s8 (int8x16_t __a, int8x16_t __b, int8_t __c)
__extension__ extern __inline int8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_n_s8 (int8x16_t __a, int8x16_t __b, int8_t __c)
+{
+ return __builtin_mve_vqdmlashq_n_sv16qi (__a, __b, __c);
+}
+
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlahq_n_s8 (int8x16_t __a, int8x16_t __b, int8_t __c)
{
return __builtin_mve_vqrdmlahq_n_sv16qi (__a, __b, __c);
@@ -7557,27 +7541,6 @@ __arm_vrev64q_m_u16 (uint16x8_t __inactive, uint16x8_t __a, mve_pred16_t __p)
__extension__ extern __inline uint16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlashq_n_u16 (uint16x8_t __a, uint16x8_t __b, uint16_t __c)
-{
- return __builtin_mve_vqrdmlashq_n_uv8hi (__a, __b, __c);
-}
-
-__extension__ extern __inline uint16x8_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlahq_n_u16 (uint16x8_t __a, uint16x8_t __b, uint16_t __c)
-{
- return __builtin_mve_vqrdmlahq_n_uv8hi (__a, __b, __c);
-}
-
-__extension__ extern __inline uint16x8_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqdmlahq_n_u16 (uint16x8_t __a, uint16x8_t __b, uint16_t __c)
-{
- return __builtin_mve_vqdmlahq_n_uv8hi (__a, __b, __c);
-}
-
-__extension__ extern __inline uint16x8_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmvnq_m_u16 (uint16x8_t __inactive, uint16x8_t __a, mve_pred16_t __p)
{
return __builtin_mve_vmvnq_m_uv8hi (__inactive, __a, __p);
@@ -8019,6 +7982,13 @@ __arm_vqrdmlashq_n_s16 (int16x8_t __a, int16x8_t __b, int16_t __c)
__extension__ extern __inline int16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_n_s16 (int16x8_t __a, int16x8_t __b, int16_t __c)
+{
+ return __builtin_mve_vqdmlashq_n_sv8hi (__a, __b, __c);
+}
+
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlahq_n_s16 (int16x8_t __a, int16x8_t __b, int16_t __c)
{
return __builtin_mve_vqrdmlahq_n_sv8hi (__a, __b, __c);
@@ -8152,27 +8122,6 @@ __arm_vrev64q_m_u32 (uint32x4_t __inactive, uint32x4_t __a, mve_pred16_t __p)
__extension__ extern __inline uint32x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlashq_n_u32 (uint32x4_t __a, uint32x4_t __b, uint32_t __c)
-{
- return __builtin_mve_vqrdmlashq_n_uv4si (__a, __b, __c);
-}
-
-__extension__ extern __inline uint32x4_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlahq_n_u32 (uint32x4_t __a, uint32x4_t __b, uint32_t __c)
-{
- return __builtin_mve_vqrdmlahq_n_uv4si (__a, __b, __c);
-}
-
-__extension__ extern __inline uint32x4_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqdmlahq_n_u32 (uint32x4_t __a, uint32x4_t __b, uint32_t __c)
-{
- return __builtin_mve_vqdmlahq_n_uv4si (__a, __b, __c);
-}
-
-__extension__ extern __inline uint32x4_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmvnq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, mve_pred16_t __p)
{
return __builtin_mve_vmvnq_m_uv4si (__inactive, __a, __p);
@@ -8614,6 +8563,13 @@ __arm_vqrdmlashq_n_s32 (int32x4_t __a, int32x4_t __b, int32_t __c)
__extension__ extern __inline int32x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_n_s32 (int32x4_t __a, int32x4_t __b, int32_t __c)
+{
+ return __builtin_mve_vqdmlashq_n_sv4si (__a, __b, __c);
+}
+
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlahq_n_s32 (int32x4_t __a, int32x4_t __b, int32_t __c)
{
return __builtin_mve_vqrdmlahq_n_sv4si (__a, __b, __c);
@@ -11141,6 +11097,27 @@ __arm_vqrdmlashq_m_n_s16 (int16x8_t __a, int16x8_t __b, int16_t __c, mve_pred16_
__extension__ extern __inline int8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_m_n_s8 (int8x16_t __a, int8x16_t __b, int8_t __c, mve_pred16_t __p)
+{
+ return __builtin_mve_vqdmlashq_m_n_sv16qi (__a, __b, __c, __p);
+}
+
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_m_n_s16 (int16x8_t __a, int16x8_t __b, int16_t __c, mve_pred16_t __p)
+{
+ return __builtin_mve_vqdmlashq_m_n_sv8hi (__a, __b, __c, __p);
+}
+
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_m_n_s32 (int32x4_t __a, int32x4_t __b, int32_t __c, mve_pred16_t __p)
+{
+ return __builtin_mve_vqdmlashq_m_n_sv4si (__a, __b, __c, __p);
+}
+
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlsdhq_m_s8 (int8x16_t __inactive, int8x16_t __a, int8x16_t __b, mve_pred16_t __p)
{
return __builtin_mve_vqrdmlsdhq_m_sv16qi (__inactive, __a, __b, __p);
@@ -11811,20 +11788,6 @@ __arm_vmlaldavaxq_p_s16 (int64_t __a, int16x8_t __b, int16x8_t __c, mve_pred16_t
return __builtin_mve_vmlaldavaxq_p_sv8hi (__a, __b, __c, __p);
}
-__extension__ extern __inline uint64_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vmlaldavaxq_p_u32 (uint64_t __a, uint32x4_t __b, uint32x4_t __c, mve_pred16_t __p)
-{
- return __builtin_mve_vmlaldavaxq_p_uv4si (__a, __b, __c, __p);
-}
-
-__extension__ extern __inline uint64_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vmlaldavaxq_p_u16 (uint64_t __a, uint16x8_t __b, uint16x8_t __c, mve_pred16_t __p)
-{
- return __builtin_mve_vmlaldavaxq_p_uv8hi (__a, __b, __c, __p);
-}
-
__extension__ extern __inline int64_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmlsldavaq_p_s32 (int64_t __a, int32x4_t __b, int32x4_t __c, mve_pred16_t __p)
@@ -13993,64 +13956,56 @@ __extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrdq_scatter_base_wb_s64 (uint64x2_t * __addr, const int __offset, int64x2_t __value)
{
- __builtin_mve_vstrdq_scatter_base_wb_sv2di (*__addr, __offset, __value);
- __builtin_mve_vstrdq_scatter_base_wb_add_sv2di (*__addr, __offset, *__addr);
+ *__addr = __builtin_mve_vstrdq_scatter_base_wb_sv2di (*__addr, __offset, __value);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrdq_scatter_base_wb_u64 (uint64x2_t * __addr, const int __offset, uint64x2_t __value)
{
- __builtin_mve_vstrdq_scatter_base_wb_uv2di (*__addr, __offset, __value);
- __builtin_mve_vstrdq_scatter_base_wb_add_uv2di (*__addr, __offset, *__addr);
+ *__addr = __builtin_mve_vstrdq_scatter_base_wb_uv2di (*__addr, __offset, __value);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrdq_scatter_base_wb_p_s64 (uint64x2_t * __addr, const int __offset, int64x2_t __value, mve_pred16_t __p)
{
- __builtin_mve_vstrdq_scatter_base_wb_p_sv2di (*__addr, __offset, __value, __p);
- __builtin_mve_vstrdq_scatter_base_wb_p_add_sv2di (*__addr, __offset, *__addr, __p);
+ *__addr = __builtin_mve_vstrdq_scatter_base_wb_p_sv2di (*__addr, __offset, __value, __p);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrdq_scatter_base_wb_p_u64 (uint64x2_t * __addr, const int __offset, uint64x2_t __value, mve_pred16_t __p)
{
- __builtin_mve_vstrdq_scatter_base_wb_p_uv2di (*__addr, __offset, __value, __p);
- __builtin_mve_vstrdq_scatter_base_wb_p_add_uv2di (*__addr, __offset, *__addr, __p);
+ *__addr = __builtin_mve_vstrdq_scatter_base_wb_p_uv2di (*__addr, __offset, __value, __p);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrwq_scatter_base_wb_p_s32 (uint32x4_t * __addr, const int __offset, int32x4_t __value, mve_pred16_t __p)
{
- __builtin_mve_vstrwq_scatter_base_wb_p_sv4si (*__addr, __offset, __value, __p);
- __builtin_mve_vstrwq_scatter_base_wb_p_add_sv4si (*__addr, __offset, *__addr, __p);
+ *__addr = __builtin_mve_vstrwq_scatter_base_wb_p_sv4si (*__addr, __offset, __value, __p);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrwq_scatter_base_wb_p_u32 (uint32x4_t * __addr, const int __offset, uint32x4_t __value, mve_pred16_t __p)
{
- __builtin_mve_vstrwq_scatter_base_wb_p_uv4si (*__addr, __offset, __value, __p);
- __builtin_mve_vstrwq_scatter_base_wb_p_add_uv4si (*__addr, __offset, *__addr, __p);
+ *__addr = __builtin_mve_vstrwq_scatter_base_wb_p_uv4si (*__addr, __offset, __value, __p);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrwq_scatter_base_wb_s32 (uint32x4_t * __addr, const int __offset, int32x4_t __value)
{
- __builtin_mve_vstrwq_scatter_base_wb_sv4si (*__addr, __offset, __value);
- __builtin_mve_vstrwq_scatter_base_wb_add_sv4si (*__addr, __offset, *__addr);
+ *__addr = __builtin_mve_vstrwq_scatter_base_wb_sv4si (*__addr, __offset, __value);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrwq_scatter_base_wb_u32 (uint32x4_t * __addr, const int __offset, uint32x4_t __value)
{
- __builtin_mve_vstrwq_scatter_base_wb_uv4si (*__addr, __offset, __value);
- __builtin_mve_vstrwq_scatter_base_wb_add_uv4si (*__addr, __offset, *__addr);
+ *__addr = __builtin_mve_vstrwq_scatter_base_wb_uv4si (*__addr, __offset, __value);
}
__extension__ extern __inline uint8x16_t
@@ -17012,6 +16967,13 @@ __arm_vcvtnq_u16_f16 (float16x8_t __a)
return __builtin_mve_vcvtnq_uv8hi (__a);
}
+__extension__ extern __inline uint32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vcvtnq_u32_f32 (float32x4_t __a)
+{
+ return __builtin_mve_vcvtnq_uv4si (__a);
+}
+
__extension__ extern __inline uint16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vcvtmq_u16_f16 (float16x8_t __a)
@@ -19158,16 +19120,14 @@ __extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrwq_scatter_base_wb_f32 (uint32x4_t * __addr, const int __offset, float32x4_t __value)
{
- __builtin_mve_vstrwq_scatter_base_wb_fv4sf (*__addr, __offset, __value);
- __builtin_mve_vstrwq_scatter_base_wb_add_fv4sf (*__addr, __offset, *__addr);
+ *__addr = __builtin_mve_vstrwq_scatter_base_wb_fv4sf (*__addr, __offset, __value);
}
__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vstrwq_scatter_base_wb_p_f32 (uint32x4_t * __addr, const int __offset, float32x4_t __value, mve_pred16_t __p)
{
- __builtin_mve_vstrwq_scatter_base_wb_p_fv4sf (*__addr, __offset, __value, __p);
- __builtin_mve_vstrwq_scatter_base_wb_p_add_fv4sf (*__addr, __offset, *__addr, __p);
+ *__addr = __builtin_mve_vstrwq_scatter_base_wb_p_fv4sf (*__addr, __offset, __value, __p);
}
__extension__ extern __inline float16x8_t
@@ -23742,27 +23702,6 @@ __arm_vrev64q_m (uint8x16_t __inactive, uint8x16_t __a, mve_pred16_t __p)
__extension__ extern __inline uint8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlashq (uint8x16_t __a, uint8x16_t __b, uint8_t __c)
-{
- return __arm_vqrdmlashq_n_u8 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint8x16_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlahq (uint8x16_t __a, uint8x16_t __b, uint8_t __c)
-{
- return __arm_vqrdmlahq_n_u8 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint8x16_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqdmlahq (uint8x16_t __a, uint8x16_t __b, uint8_t __c)
-{
- return __arm_vqdmlahq_n_u8 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint8x16_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmvnq_m (uint8x16_t __inactive, uint8x16_t __a, mve_pred16_t __p)
{
return __arm_vmvnq_m_u8 (__inactive, __a, __p);
@@ -24204,6 +24143,13 @@ __arm_vqrdmlashq (int8x16_t __a, int8x16_t __b, int8_t __c)
__extension__ extern __inline int8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq (int8x16_t __a, int8x16_t __b, int8_t __c)
+{
+ return __arm_vqdmlashq_n_s8 (__a, __b, __c);
+}
+
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlahq (int8x16_t __a, int8x16_t __b, int8_t __c)
{
return __arm_vqrdmlahq_n_s8 (__a, __b, __c);
@@ -24337,27 +24283,6 @@ __arm_vrev64q_m (uint16x8_t __inactive, uint16x8_t __a, mve_pred16_t __p)
__extension__ extern __inline uint16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlashq (uint16x8_t __a, uint16x8_t __b, uint16_t __c)
-{
- return __arm_vqrdmlashq_n_u16 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint16x8_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlahq (uint16x8_t __a, uint16x8_t __b, uint16_t __c)
-{
- return __arm_vqrdmlahq_n_u16 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint16x8_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqdmlahq (uint16x8_t __a, uint16x8_t __b, uint16_t __c)
-{
- return __arm_vqdmlahq_n_u16 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint16x8_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmvnq_m (uint16x8_t __inactive, uint16x8_t __a, mve_pred16_t __p)
{
return __arm_vmvnq_m_u16 (__inactive, __a, __p);
@@ -24799,6 +24724,13 @@ __arm_vqrdmlashq (int16x8_t __a, int16x8_t __b, int16_t __c)
__extension__ extern __inline int16x8_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq (int16x8_t __a, int16x8_t __b, int16_t __c)
+{
+ return __arm_vqdmlashq_n_s16 (__a, __b, __c);
+}
+
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlahq (int16x8_t __a, int16x8_t __b, int16_t __c)
{
return __arm_vqrdmlahq_n_s16 (__a, __b, __c);
@@ -24932,27 +24864,6 @@ __arm_vrev64q_m (uint32x4_t __inactive, uint32x4_t __a, mve_pred16_t __p)
__extension__ extern __inline uint32x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlashq (uint32x4_t __a, uint32x4_t __b, uint32_t __c)
-{
- return __arm_vqrdmlashq_n_u32 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint32x4_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqrdmlahq (uint32x4_t __a, uint32x4_t __b, uint32_t __c)
-{
- return __arm_vqrdmlahq_n_u32 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint32x4_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vqdmlahq (uint32x4_t __a, uint32x4_t __b, uint32_t __c)
-{
- return __arm_vqdmlahq_n_u32 (__a, __b, __c);
-}
-
-__extension__ extern __inline uint32x4_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmvnq_m (uint32x4_t __inactive, uint32x4_t __a, mve_pred16_t __p)
{
return __arm_vmvnq_m_u32 (__inactive, __a, __p);
@@ -25394,6 +25305,13 @@ __arm_vqrdmlashq (int32x4_t __a, int32x4_t __b, int32_t __c)
__extension__ extern __inline int32x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq (int32x4_t __a, int32x4_t __b, int32_t __c)
+{
+ return __arm_vqdmlashq_n_s32 (__a, __b, __c);
+}
+
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlahq (int32x4_t __a, int32x4_t __b, int32_t __c)
{
return __arm_vqrdmlahq_n_s32 (__a, __b, __c);
@@ -27921,6 +27839,27 @@ __arm_vqrdmlashq_m (int16x8_t __a, int16x8_t __b, int16_t __c, mve_pred16_t __p)
__extension__ extern __inline int8x16_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_m (int8x16_t __a, int8x16_t __b, int8_t __c, mve_pred16_t __p)
+{
+ return __arm_vqdmlashq_m_n_s8 (__a, __b, __c, __p);
+}
+
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_m (int16x8_t __a, int16x8_t __b, int16_t __c, mve_pred16_t __p)
+{
+ return __arm_vqdmlashq_m_n_s16 (__a, __b, __c, __p);
+}
+
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__arm_vqdmlashq_m (int32x4_t __a, int32x4_t __b, int32_t __c, mve_pred16_t __p)
+{
+ return __arm_vqdmlashq_m_n_s32 (__a, __b, __c, __p);
+}
+
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vqrdmlsdhq_m (int8x16_t __inactive, int8x16_t __a, int8x16_t __b, mve_pred16_t __p)
{
return __arm_vqrdmlsdhq_m_s8 (__inactive, __a, __b, __p);
@@ -28591,20 +28530,6 @@ __arm_vmlaldavaxq_p (int64_t __a, int16x8_t __b, int16x8_t __c, mve_pred16_t __p
return __arm_vmlaldavaxq_p_s16 (__a, __b, __c, __p);
}
-__extension__ extern __inline uint64_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vmlaldavaxq_p (uint64_t __a, uint32x4_t __b, uint32x4_t __c, mve_pred16_t __p)
-{
- return __arm_vmlaldavaxq_p_u32 (__a, __b, __c, __p);
-}
-
-__extension__ extern __inline uint64_t
-__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-__arm_vmlaldavaxq_p (uint64_t __a, uint16x8_t __b, uint16x8_t __c, mve_pred16_t __p)
-{
- return __arm_vmlaldavaxq_p_u16 (__a, __b, __c, __p);
-}
-
__extension__ extern __inline int64_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
__arm_vmlsldavaq_p (int64_t __a, int32x4_t __b, int32x4_t __c, mve_pred16_t __p)
@@ -35651,6 +35576,7 @@ enum {
short: __ARM_mve_type_int_n, \
int: __ARM_mve_type_int_n, \
long: __ARM_mve_type_int_n, \
+ double: __ARM_mve_type_fp_n, \
long long: __ARM_mve_type_int_n, \
unsigned char: __ARM_mve_type_int_n, \
unsigned short: __ARM_mve_type_int_n, \
@@ -35723,6 +35649,8 @@ extern void *__ARM_undef;
_Generic(param, type: param, default: *(type *)__ARM_undef)
#define __ARM_mve_coerce1(param, type) \
_Generic(param, type: param, const type: param, default: *(type *)__ARM_undef)
+#define __ARM_mve_coerce2(param, type) \
+ _Generic(param, type: param, float16_t: param, float32_t: param, default: *(type *)__ARM_undef)
#if (__ARM_FEATURE_MVE & 2) /* MVE Floating point. */
@@ -35939,14 +35867,14 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vaddq_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t)), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vaddq_f16 (__ARM_mve_coerce(p0, float16x8_t), __ARM_mve_coerce(p1, float16x8_t)), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vaddq_f32 (__ARM_mve_coerce(p0, float32x4_t), __ARM_mve_coerce(p1, float32x4_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t)), \
- int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t)), \
- int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vaddq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vaddq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)));})
+ int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vaddq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vaddq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)));})
#define __arm_vandq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -35997,8 +35925,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vmulq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8_t)), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vmulq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16_t)), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vmulq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vmulq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vmulq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vmulq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vmulq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)), \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t]: __arm_vmulq_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t]: __arm_vmulq_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t)), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vmulq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t)), \
@@ -36029,8 +35957,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vcmpeqq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8_t)), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vcmpeqq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16_t)), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vcmpeqq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)), \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t]: __arm_vcmpeqq_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t]: __arm_vcmpeqq_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t)), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vcmpeqq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t)), \
@@ -36069,8 +35997,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vcmpeqq_m_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t), p2), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vcmpeqq_m_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vcmpeqq_m_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), p2), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t), p2), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t), p2));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double), p2), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpeqq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double), p2));})
#define __arm_vcmpgtq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36083,8 +36011,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpgtq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vcmpgtq_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t)), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vcmpgtq_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)));})
#define __arm_vcmpleq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36097,8 +36025,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vcmpleq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vcmpleq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t)), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpleq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)));})
#define __arm_vcmpltq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36111,8 +36039,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpltq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vcmpltq_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t)), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vcmpltq_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)));})
#define __arm_vcmpneq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36123,8 +36051,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vcmpneq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8_t)), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vcmpneq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16_t)), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vcmpneq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)), \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t]: __arm_vcmpneq_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t]: __arm_vcmpneq_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t)), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vcmpneq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t)), \
@@ -36179,8 +36107,8 @@ extern void *__ARM_undef;
#define __arm_vmaxnmavq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmavq_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t)), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmavq_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t)));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmavq_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t)), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmavq_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t)));})
#define __arm_vmaxnmq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36191,14 +36119,14 @@ extern void *__ARM_undef;
#define __arm_vmaxnmvq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmvq_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t)), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmvq_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t)));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmvq_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t)), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmvq_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t)));})
#define __arm_vmaxnmvq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmvq_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t)), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmvq_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t)));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmvq_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t)), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmvq_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t)));})
#define __arm_vminnmaq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36209,8 +36137,8 @@ extern void *__ARM_undef;
#define __arm_vminnmavq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmavq_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t)), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmavq_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t)));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmavq_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t)), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmavq_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t)));})
#define __arm_vbrsrq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)])0, \
@@ -36232,8 +36160,8 @@ extern void *__ARM_undef;
#define __arm_vsubq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vsubq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vsubq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vsubq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vsubq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)), \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vsubq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vsubq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t)), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vsubq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)), \
@@ -36252,8 +36180,8 @@ extern void *__ARM_undef;
#define __arm_vminnmvq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmvq_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t)), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmvq_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t)));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmvq_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t)), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmvq_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t)));})
#define __arm_vshlq_r(p0,p1) ({ __typeof(p0) __p0 = (p0); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)])0, \
@@ -36782,10 +36710,15 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t)));})
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
+
+#define __arm_vqdmlashq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
+ __typeof(p1) __p1 = (p1); \
+ __typeof(p2) __p2 = (p2); \
+ _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
+ int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
+ int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
#define __arm_vqrdmlahq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36793,10 +36726,7 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t)));})
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
#define __arm_vmlasq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -36815,10 +36745,7 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t)));})
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
#define __arm_vqrdmladhxq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37011,8 +36938,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vcmpgtq_m_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t), p2), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vcmpgtq_m_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t), p2), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpgtq_m_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t), p2), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t), p2), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t), p2), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double), p2), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgtq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double), p2), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vcmpgtq_m_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vcmpgtq_m_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
@@ -37027,8 +36954,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vcmpleq_m_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t), p2), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vcmpleq_m_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t), p2), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpleq_m_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t), p2), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t), p2), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t), p2));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double), p2), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpleq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double), p2));})
#define __arm_vcmpltq_m(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37041,8 +36968,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vcmpltq_m_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t), p2), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vcmpltq_m_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t), p2), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpltq_m_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t), p2), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t), p2), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t), p2));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double), p2), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpltq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double), p2));})
#define __arm_vcmpneq_m(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37061,8 +36988,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vcmpneq_m_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8_t), p2), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vcmpneq_m_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16_t), p2), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vcmpneq_m_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t), p2), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t), p2), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t), p2));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double), p2), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpneq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double), p2));})
#define __arm_vcvtbq_m(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37116,8 +37043,8 @@ extern void *__ARM_undef;
__typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmaq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmaq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t)), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmaq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmaq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double)), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vfmaq_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16x8_t)), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vfmaq_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32x4_t)));})
@@ -37132,8 +37059,8 @@ extern void *__ARM_undef;
__typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmasq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmasq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t)));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmasq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmasq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double)));})
#define __arm_vmaxnmaq_m(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37156,14 +37083,14 @@ extern void *__ARM_undef;
#define __arm_vmaxnmavq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmavq_p_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmavq_p_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmavq_p_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t), p2), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmavq_p_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t), p2));})
#define __arm_vmaxnmvq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmvq_p_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmvq_p_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vmaxnmvq_p_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t), p2), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vmaxnmvq_p_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t), p2));})
#define __arm_vminnmaq_m(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37174,14 +37101,14 @@ extern void *__ARM_undef;
#define __arm_vminnmavq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmavq_p_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmavq_p_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmavq_p_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t), p2), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmavq_p_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t), p2));})
#define __arm_vminnmvq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmvq_p_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmvq_p_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vminnmvq_p_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t), p2), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vminnmvq_p_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t), p2));})
#define __arm_vrndnq_m(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37248,8 +37175,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpgeq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vcmpgeq_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t)), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vcmpgeq_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t)), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t)), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t)));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double)), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double)));})
#define __arm_vrshrnbq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37353,8 +37280,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vcmpgeq_m_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t), p2), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vcmpgeq_m_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t), p2), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vcmpgeq_m_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t), p2), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16_t), p2), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32_t), p2), \
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce2(__p1, double), p2), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vcmpgeq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce2(__p1, double), p2), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vcmpgeq_m_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vcmpgeq_m_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
@@ -37389,8 +37316,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_m_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, int), p3), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_m_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, int), p3), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_m_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, int), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vaddq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vaddq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vaddq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vaddq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vandq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37531,15 +37458,15 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vfmaq_m_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16x8_t), p3), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vfmaq_m_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32x4_t), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmaq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmaq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmaq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmaq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vfmasq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmasq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmasq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vfmasq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vfmasq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vfmsq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37580,8 +37507,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vmulq_m_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t), p3), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vmulq_m_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t), p3), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vmulq_m_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vmulq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vmulq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vmulq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vmulq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vornq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -37614,8 +37541,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vsubq_m_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t), p3), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vsubq_m_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t), p3), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vsubq_m_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vsubq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vsubq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vsubq_m_n_f16 (__ARM_mve_coerce(__p0, float16x8_t), __ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vsubq_m_n_f32 (__ARM_mve_coerce(__p0, float32x4_t), __ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vorrq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -38113,8 +38040,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_x_n_u32 (__ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t), p3), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vaddq_x_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16x8_t), p3), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vaddq_x_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32x4_t), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vaddq_x_n_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vaddq_x_n_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vaddq_x_n_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vaddq_x_n_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vandq_x(p1,p2,p3) ({ __typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
@@ -38248,8 +38175,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vmulq_x_n_u32 (__ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t), p3), \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vmulq_x_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16x8_t), p3), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vmulq_x_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32x4_t), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vmulq_x_n_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vmulq_x_n_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vmulq_x_n_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vmulq_x_n_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vnegq_x(p1,p2) ({ __typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p1)])0, \
@@ -38337,8 +38264,8 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_float16x8_t]: __arm_vsubq_x_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16x8_t), p3), \
int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_float32x4_t]: __arm_vsubq_x_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32x4_t), p3), \
- int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vsubq_x_n_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce(__p2, float16_t), p3), \
- int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vsubq_x_n_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce(__p2, float32_t), p3));})
+ int (*)[__ARM_mve_type_float16x8_t][__ARM_mve_type_fp_n]: __arm_vsubq_x_n_f16 (__ARM_mve_coerce(__p1, float16x8_t), __ARM_mve_coerce2(__p2, double), p3), \
+ int (*)[__ARM_mve_type_float32x4_t][__ARM_mve_type_fp_n]: __arm_vsubq_x_n_f32 (__ARM_mve_coerce(__p1, float32x4_t), __ARM_mve_coerce2(__p2, double), p3));})
#define __arm_vcmulq_rot90_x(p1,p2,p3) ({ __typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
@@ -38370,8 +38297,8 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vsetq_lane_u16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, uint16x8_t), p2), \
int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vsetq_lane_u32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, uint32x4_t), p2), \
int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint64x2_t]: __arm_vsetq_lane_u64 (__ARM_mve_coerce(__p0, uint64_t), __ARM_mve_coerce(__p1, uint64x2_t), p2), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vsetq_lane_f16 (__ARM_mve_coerce(__p0, float16_t), __ARM_mve_coerce(__p1, float16x8_t), p2), \
- int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vsetq_lane_f32 (__ARM_mve_coerce(__p0, float32_t), __ARM_mve_coerce(__p1, float32x4_t), p2));})
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float16x8_t]: __arm_vsetq_lane_f16 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float16x8_t), p2), \
+ int (*)[__ARM_mve_type_fp_n][__ARM_mve_type_float32x4_t]: __arm_vsetq_lane_f32 (__ARM_mve_coerce2(__p0, double), __ARM_mve_coerce(__p1, float32x4_t), p2));})
#else /* MVE Integer. */
@@ -38895,12 +38822,12 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t]: __arm_vaddq_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t)), \
int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t]: __arm_vaddq_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t)), \
int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vaddq_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32_t)), \
- int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8_t)), \
- int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32_t)));})
+ int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int)), \
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vaddq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int)));})
#define __arm_vandq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -39254,10 +39181,15 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t)));})
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
+
+#define __arm_vqdmlashq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
+ __typeof(p1) __p1 = (p1); \
+ __typeof(p2) __p2 = (p2); \
+ _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
+ int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
+ int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
#define __arm_vqrdmlahq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -39265,10 +39197,7 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t)));})
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
#define __arm_vqrdmladhxq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -39399,10 +39328,7 @@ extern void *__ARM_undef;
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t)), \
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t)), \
- int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)), \
- int (*)[__ARM_mve_type_uint8x16_t][__ARM_mve_type_uint8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_u8 (__ARM_mve_coerce(__p0, uint8x16_t), __ARM_mve_coerce(__p1, uint8x16_t), __ARM_mve_coerce(__p2, uint8_t)), \
- int (*)[__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_u16 (__ARM_mve_coerce(__p0, uint16x8_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16_t)), \
- int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32_t)));})
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlahq_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t)));})
#define __arm_vqdmlsdhq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -40800,6 +40726,14 @@ extern void *__ARM_undef;
int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_m_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t), p3), \
int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqrdmlashq_m_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t), p3));})
+#define __arm_vqdmlashq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
+ __typeof(p1) __p1 = (p1); \
+ __typeof(p2) __p2 = (p2); \
+ _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
+ int (*)[__ARM_mve_type_int8x16_t][__ARM_mve_type_int8x16_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_m_n_s8 (__ARM_mve_coerce(__p0, int8x16_t), __ARM_mve_coerce(__p1, int8x16_t), __ARM_mve_coerce(__p2, int8_t), p3), \
+ int (*)[__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_m_n_s16 (__ARM_mve_coerce(__p0, int16x8_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16_t), p3), \
+ int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int_n]: __arm_vqdmlashq_m_n_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32_t), p3));})
+
#define __arm_vqrshlq_m(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
@@ -41057,9 +40991,7 @@ extern void *__ARM_undef;
__typeof(p2) __p2 = (p2); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \
int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t][__ARM_mve_type_int16x8_t]: __arm_vmlaldavaxq_p_s16 (__ARM_mve_coerce(__p0, int64_t), __ARM_mve_coerce(__p1, int16x8_t), __ARM_mve_coerce(__p2, int16x8_t), p3), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vmlaldavaxq_p_s32 (__ARM_mve_coerce(__p0, int64_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32x4_t), p3), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t][__ARM_mve_type_uint16x8_t]: __arm_vmlaldavaxq_p_u16 (__ARM_mve_coerce(__p0, uint64_t), __ARM_mve_coerce(__p1, uint16x8_t), __ARM_mve_coerce(__p2, uint16x8_t), p3), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vmlaldavaxq_p_u32 (__ARM_mve_coerce(__p0, uint64_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32x4_t), p3));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vmlaldavaxq_p_s32 (__ARM_mve_coerce(__p0, int64_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32x4_t), p3));})
#define __arm_vmlsldavaq_p(p0,p1,p2,p3) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
@@ -41679,16 +41611,16 @@ extern void *__ARM_undef;
#define __arm_vmaxavq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxavq_s8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, int8x16_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxavq_s16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, int16x8_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxavq_s32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, int32x4_t)));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxavq_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxavq_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxavq_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t)));})
#define __arm_vmaxavq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxavq_p_s8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, int8x16_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxavq_p_s16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, int16x8_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxavq_p_s32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, int32x4_t), p2));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxavq_p_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxavq_p_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxavq_p_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t), p2));})
#define __arm_vmaxq_x(p1,p2,p3) ({ __typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
@@ -41703,36 +41635,36 @@ extern void *__ARM_undef;
#define __arm_vmaxvq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxvq_s8 (__ARM_mve_coerce(__p0, int8_t), __ARM_mve_coerce(__p1, int8x16_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxvq_s16 (__ARM_mve_coerce(__p0, int16_t), __ARM_mve_coerce(__p1, int16x8_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxvq_s32 (__ARM_mve_coerce(__p0, int32_t), __ARM_mve_coerce(__p1, int32x4_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vmaxvq_u8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, uint8x16_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vmaxvq_u16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, uint16x8_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vmaxvq_u32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, uint32x4_t)));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxvq_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxvq_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxvq_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vmaxvq_u8 (__p0, __ARM_mve_coerce(__p1, uint8x16_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vmaxvq_u16 (__p0, __ARM_mve_coerce(__p1, uint16x8_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vmaxvq_u32 (__p0,__ARM_mve_coerce(__p1, uint32x4_t)));})
#define __arm_vmaxvq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxvq_p_s8 (__ARM_mve_coerce(__p0, int8_t), __ARM_mve_coerce(__p1, int8x16_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxvq_p_s16 (__ARM_mve_coerce(__p0, int16_t), __ARM_mve_coerce(__p1, int16x8_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxvq_p_s32 (__ARM_mve_coerce(__p0, int32_t), __ARM_mve_coerce(__p1, int32x4_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vmaxvq_p_u8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, uint8x16_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vmaxvq_p_u16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, uint16x8_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vmaxvq_p_u32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, uint32x4_t), p2));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vmaxvq_p_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vmaxvq_p_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vmaxvq_p_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vmaxvq_p_u8 (__p0, __ARM_mve_coerce(__p1, uint8x16_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vmaxvq_p_u16 (__p0, __ARM_mve_coerce(__p1, uint16x8_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vmaxvq_p_u32 (__p0, __ARM_mve_coerce(__p1, uint32x4_t), p2));})
#define __arm_vminavq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminavq_s8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, int8x16_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminavq_s16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, int16x8_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminavq_s32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, int32x4_t)));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminavq_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminavq_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminavq_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t)));})
#define __arm_vminavq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminavq_p_s8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, int8x16_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminavq_p_s16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, int16x8_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminavq_p_s32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, int32x4_t), p2));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminavq_p_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminavq_p_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminavq_p_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t), p2));})
#define __arm_vminq_x(p1,p2,p3) ({ __typeof(p1) __p1 = (p1); \
__typeof(p2) __p2 = (p2); \
@@ -41747,22 +41679,22 @@ extern void *__ARM_undef;
#define __arm_vminvq(p0,p1) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminvq_s8 (__ARM_mve_coerce(__p0, int8_t), __ARM_mve_coerce(__p1, int8x16_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminvq_s16 (__ARM_mve_coerce(__p0, int16_t), __ARM_mve_coerce(__p1, int16x8_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminvq_s32 (__ARM_mve_coerce(__p0, int32_t), __ARM_mve_coerce(__p1, int32x4_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vminvq_u8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, uint8x16_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vminvq_u16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, uint16x8_t)), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vminvq_u32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, uint32x4_t)));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminvq_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminvq_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminvq_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vminvq_u8 (__p0, __ARM_mve_coerce(__p1, uint8x16_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vminvq_u16 (__p0, __ARM_mve_coerce(__p1, uint16x8_t)), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vminvq_u32 (__p0, __ARM_mve_coerce(__p1, uint32x4_t)));})
#define __arm_vminvq_p(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
_Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminvq_p_s8 (__ARM_mve_coerce(__p0, int8_t), __ARM_mve_coerce(__p1, int8x16_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminvq_p_s16 (__ARM_mve_coerce(__p0, int16_t), __ARM_mve_coerce(__p1, int16x8_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminvq_p_s32 (__ARM_mve_coerce(__p0, int32_t), __ARM_mve_coerce(__p1, int32x4_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vminvq_p_u8 (__ARM_mve_coerce(__p0, uint8_t), __ARM_mve_coerce(__p1, uint8x16_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vminvq_p_u16 (__ARM_mve_coerce(__p0, uint16_t), __ARM_mve_coerce(__p1, uint16x8_t), p2), \
- int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vminvq_p_u32 (__ARM_mve_coerce(__p0, uint32_t), __ARM_mve_coerce(__p1, uint32x4_t), p2));})
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int8x16_t]: __arm_vminvq_p_s8 (__p0, __ARM_mve_coerce(__p1, int8x16_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int16x8_t]: __arm_vminvq_p_s16 (__p0, __ARM_mve_coerce(__p1, int16x8_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_int32x4_t]: __arm_vminvq_p_s32 (__p0, __ARM_mve_coerce(__p1, int32x4_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint8x16_t]: __arm_vminvq_p_u8 (__p0, __ARM_mve_coerce(__p1, uint8x16_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint16x8_t]: __arm_vminvq_p_u16 (__p0, __ARM_mve_coerce(__p1, uint16x8_t), p2), \
+ int (*)[__ARM_mve_type_int_n][__ARM_mve_type_uint32x4_t]: __arm_vminvq_p_u32 (__p0, __ARM_mve_coerce(__p1, uint32x4_t), p2));})
#define __arm_vmladavaq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \
__typeof(p1) __p1 = (p1); \
diff --git a/gcc/config/arm/arm_mve_builtins.def b/gcc/config/arm/arm_mve_builtins.def
index 753e40a..f38926f 100644
--- a/gcc/config/arm/arm_mve_builtins.def
+++ b/gcc/config/arm/arm_mve_builtins.def
@@ -312,9 +312,6 @@ VAR3 (TERNOP_NONE_NONE_UNONE_IMM, vshlcq_vec_s, v16qi, v8hi, v4si)
VAR4 (TERNOP_UNONE_UNONE_UNONE_UNONE, vpselq_u, v16qi, v8hi, v4si, v2di)
VAR4 (TERNOP_NONE_NONE_NONE_UNONE, vpselq_s, v16qi, v8hi, v4si, v2di)
VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vrev64q_m_u, v16qi, v8hi, v4si)
-VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vqrdmlashq_n_u, v16qi, v8hi, v4si)
-VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vqrdmlahq_n_u, v16qi, v8hi, v4si)
-VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vqdmlahq_n_u, v16qi, v8hi, v4si)
VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vmvnq_m_u, v16qi, v8hi, v4si)
VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vmlasq_n_u, v16qi, v8hi, v4si)
VAR3 (TERNOP_UNONE_UNONE_UNONE_UNONE, vmlaq_n_u, v16qi, v8hi, v4si)
@@ -384,6 +381,7 @@ VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqrdmladhq_s, v16qi, v8hi, v4si)
VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqdmlsdhxq_s, v16qi, v8hi, v4si)
VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqdmlsdhq_s, v16qi, v8hi, v4si)
VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqdmlahq_n_s, v16qi, v8hi, v4si)
+VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqdmlashq_n_s, v16qi, v8hi, v4si)
VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqdmladhxq_s, v16qi, v8hi, v4si)
VAR3 (TERNOP_NONE_NONE_NONE_NONE, vqdmladhq_s, v16qi, v8hi, v4si)
VAR3 (TERNOP_NONE_NONE_NONE_NONE, vmlsdavaxq_s, v16qi, v8hi, v4si)
@@ -574,6 +572,7 @@ VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmulhq_m_n_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmlsdhxq_m_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmlsdhq_m_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmlahq_m_n_s, v16qi, v8hi, v4si)
+VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmlashq_m_n_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmladhxq_m_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqdmladhq_m_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_NONE_UNONE, vqaddq_m_s, v16qi, v8hi, v4si)
@@ -615,7 +614,6 @@ VAR3 (QUADOP_NONE_NONE_NONE_IMM_UNONE, vrshrq_m_n_s, v16qi, v8hi, v4si)
VAR3 (QUADOP_NONE_NONE_NONE_IMM_UNONE, vqshlq_m_n_s, v16qi, v8hi, v4si)
VAR2 (QUADOP_UNONE_UNONE_UNONE_UNONE_UNONE, vmulltq_poly_m_p, v16qi, v8hi)
VAR2 (QUADOP_UNONE_UNONE_UNONE_UNONE_UNONE, vmullbq_poly_m_p, v16qi, v8hi)
-VAR2 (QUADOP_UNONE_UNONE_UNONE_UNONE_UNONE, vmlaldavaxq_p_u, v8hi, v4si)
VAR2 (QUADOP_UNONE_UNONE_UNONE_UNONE_UNONE, vmlaldavaq_p_u, v8hi, v4si)
VAR2 (QUADOP_UNONE_UNONE_UNONE_IMM_UNONE, vshrntq_m_n_u, v8hi, v4si)
VAR2 (QUADOP_UNONE_UNONE_UNONE_IMM_UNONE, vshrnbq_m_n_u, v8hi, v4si)
@@ -828,19 +826,9 @@ VAR3 (QUADOP_UNONE_UNONE_UNONE_IMM_UNONE, vidupq_m_n_u, v16qi, v8hi, v4si)
VAR3 (TERNOP_UNONE_UNONE_UNONE_IMM, vdwdupq_n_u, v16qi, v4si, v8hi)
VAR3 (TERNOP_UNONE_UNONE_UNONE_IMM, viwdupq_n_u, v16qi, v4si, v8hi)
VAR1 (STRSBWBU, vstrwq_scatter_base_wb_u, v4si)
-VAR1 (STRSBWBU, vstrwq_scatter_base_wb_add_u, v4si)
-VAR1 (STRSBWBU, vstrwq_scatter_base_wb_add_s, v4si)
-VAR1 (STRSBWBU, vstrwq_scatter_base_wb_add_f, v4sf)
VAR1 (STRSBWBU, vstrdq_scatter_base_wb_u, v2di)
-VAR1 (STRSBWBU, vstrdq_scatter_base_wb_add_u, v2di)
-VAR1 (STRSBWBU, vstrdq_scatter_base_wb_add_s, v2di)
VAR1 (STRSBWBU_P, vstrwq_scatter_base_wb_p_u, v4si)
-VAR1 (STRSBWBU_P, vstrwq_scatter_base_wb_p_add_u, v4si)
-VAR1 (STRSBWBU_P, vstrwq_scatter_base_wb_p_add_s, v4si)
-VAR1 (STRSBWBU_P, vstrwq_scatter_base_wb_p_add_f, v4sf)
VAR1 (STRSBWBU_P, vstrdq_scatter_base_wb_p_u, v2di)
-VAR1 (STRSBWBU_P, vstrdq_scatter_base_wb_p_add_u, v2di)
-VAR1 (STRSBWBU_P, vstrdq_scatter_base_wb_p_add_s, v2di)
VAR1 (STRSBWBS, vstrwq_scatter_base_wb_s, v4si)
VAR1 (STRSBWBS, vstrwq_scatter_base_wb_f, v4sf)
VAR1 (STRSBWBS, vstrdq_scatter_base_wb_s, v2di)
diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md
index ff229aa..789e333 100644
--- a/gcc/config/arm/constraints.md
+++ b/gcc/config/arm/constraints.md
@@ -454,10 +454,13 @@
(define_memory_constraint "Uj"
"@internal
- In ARM/Thumb-2 state an VFP load/store address which does not support
- writeback at all (eg vldr.16)."
+ In ARM/Thumb-2 state a VFP load/store address that supports writeback
+ for Neon but not for MVE"
(and (match_code "mem")
- (match_test "TARGET_32BIT && arm_coproc_mem_operand_no_writeback (op)")))
+ (match_test "TARGET_32BIT")
+ (match_test "TARGET_HAVE_MVE
+ ? arm_coproc_mem_operand_no_writeback (op)
+ : neon_vector_mem_operand (op, 2, true)")))
(define_memory_constraint "Uy"
"@internal
diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md
index 0bc9eba..f934872 100644
--- a/gcc/config/arm/iterators.md
+++ b/gcc/config/arm/iterators.md
@@ -66,14 +66,6 @@
;; Integer and float modes supported by Neon and IWMMXT.
(define_mode_iterator VALL [V2DI V2SI V4HI V8QI V2SF V4SI V8HI V16QI V4SF])
-;; Integer and float modes supported by Neon, IWMMXT and MVE, used by
-;; arithmetic epxand patterns.
-(define_mode_iterator VNIM [V16QI V8HI V4SI V4SF])
-
-;; Integer and float modes supported by Neon and IWMMXT but not MVE, used by
-;; arithmetic epxand patterns.
-(define_mode_iterator VNINOTM [V2SI V4HI V8QI V2SF V2DI])
-
;; Integer and float modes supported by Neon, IWMMXT and MVE.
(define_mode_iterator VNIM1 [V16QI V8HI V4SI V4SF V2DI])
@@ -267,6 +259,16 @@
(define_mode_iterator VBFCVT [V4BF V8BF])
(define_mode_iterator VBFCVTM [V2SI SF])
+;; MVE mode iterator.
+(define_mode_iterator MVE_types [V16QI V8HI V4SI V2DI TI V8HF V4SF V2DF])
+(define_mode_iterator MVE_VLD_ST [V16QI V8HI V4SI V8HF V4SF])
+(define_mode_iterator MVE_0 [V8HF V4SF])
+(define_mode_iterator MVE_1 [V16QI V8HI V4SI V2DI])
+(define_mode_iterator MVE_3 [V16QI V8HI])
+(define_mode_iterator MVE_2 [V16QI V8HI V4SI])
+(define_mode_iterator MVE_5 [V8HI V4SI])
+(define_mode_iterator MVE_6 [V8HI V4SI])
+
;;----------------------------------------------------------------------------
;; Code iterators
;;----------------------------------------------------------------------------
@@ -901,6 +903,35 @@
(define_mode_attr cde_suffix [(SI "") (DI "d")])
(define_mode_attr cde_dest [(SI "%0") (DI "%0, %H0")])
+;;MVE mode attribute.
+(define_mode_attr MVE_CNVT [(V8HI "V8HF") (V4SI "V4SF") (V8HF "V8HI")
+ (V4SF "V4SI")])
+(define_mode_attr MVE_LANES [(V16QI "16") (V8HI "8") (V4SI "4")])
+
+(define_mode_attr MVE_constraint [ (V16QI "Ra") (V8HI "Rc") (V4SI "Re")])
+(define_mode_attr MVE_constraint1 [ (V8HI "Ra") (V4SI "Rc")])
+(define_mode_attr MVE_constraint2 [(V16QI "Rb") (V8HI "Rd") (V4SI "Rf")
+ (V8HF "Rd") (V4SF "Rf")])
+(define_mode_attr MVE_constraint3 [ (V8HI "Rb") (V4SI "Rd")])
+
+(define_mode_attr MVE_pred [ (V16QI "mve_imm_7") (V8HI "mve_imm_15")
+ (V4SI "mve_imm_31")])
+(define_mode_attr MVE_pred1 [ (V8HI "mve_imm_7") (V4SI "mve_imm_15")])
+(define_mode_attr MVE_pred2 [(V16QI "mve_imm_8") (V8HI "mve_imm_16")
+ (V4SI "mve_imm_32")
+ (V8HF "mve_imm_16") (V4SF "mve_imm_32")])
+(define_mode_attr MVE_pred3 [ (V8HI "mve_imm_8") (V4SI "mve_imm_16")])
+
+(define_mode_attr MVE_B_ELEM [ (V16QI "V16QI") (V8HI "V8QI") (V4SI "V4QI")])
+(define_mode_attr MVE_H_ELEM [ (V8HI "V8HI") (V4SI "V4HI")])
+
+(define_mode_attr V_sz_elem1 [(V16QI "b") (V8HI "h") (V4SI "w") (V8HF "h")
+ (V4SF "w")])
+(define_mode_attr V_extr_elem [(V16QI "u8") (V8HI "u16") (V4SI "32")
+ (V8HF "u16") (V4SF "32")])
+(define_mode_attr earlyclobber_32 [(V16QI "=w") (V8HI "=w") (V4SI "=&w")
+ (V8HF "=w") (V4SF "=&w")])
+
;;----------------------------------------------------------------------------
;; Code attributes
;;----------------------------------------------------------------------------
@@ -1181,6 +1212,188 @@
(define_int_attr mmla_sfx [(UNSPEC_MATMUL_S "s8") (UNSPEC_MATMUL_U "u8")
(UNSPEC_MATMUL_US "s8")])
+;;MVE int attribute.
+(define_int_attr supf [(VCVTQ_TO_F_S "s") (VCVTQ_TO_F_U "u") (VREV16Q_S "s")
+ (VREV16Q_U "u") (VMVNQ_N_S "s") (VMVNQ_N_U "u")
+ (VCVTAQ_U "u") (VCVTAQ_S "s") (VREV64Q_S "s")
+ (VREV64Q_U "u") (VMVNQ_S "s") (VMVNQ_U "u")
+ (VDUPQ_N_U "u") (VDUPQ_N_S"s") (VADDVQ_S "s")
+ (VADDVQ_U "u") (VADDVQ_S "s") (VADDVQ_U "u")
+ (VMOVLTQ_U "u") (VMOVLTQ_S "s") (VMOVLBQ_S "s")
+ (VMOVLBQ_U "u") (VCVTQ_FROM_F_S "s") (VCVTQ_FROM_F_U "u")
+ (VCVTPQ_S "s") (VCVTPQ_U "u") (VCVTNQ_S "s")
+ (VCVTNQ_U "u") (VCVTMQ_S "s") (VCVTMQ_U "u")
+ (VCLZQ_U "u") (VCLZQ_S "s") (VREV32Q_U "u")
+ (VREV32Q_S "s") (VADDLVQ_U "u") (VADDLVQ_S "s")
+ (VCVTQ_N_TO_F_S "s") (VCVTQ_N_TO_F_U "u")
+ (VCREATEQ_U "u") (VCREATEQ_S "s") (VSHRQ_N_S "s")
+ (VSHRQ_N_U "u") (VCVTQ_N_FROM_F_S "s") (VSHLQ_U "u")
+ (VCVTQ_N_FROM_F_U "u") (VADDLVQ_P_S "s") (VSHLQ_S "s")
+ (VADDLVQ_P_U "u") (VCMPNEQ_U "u") (VCMPNEQ_S "s")
+ (VABDQ_M_S "s") (VABDQ_M_U "u") (VABDQ_S "s")
+ (VABDQ_U "u") (VADDQ_N_S "s") (VADDQ_N_U "u")
+ (VADDVQ_P_S "s") (VADDVQ_P_U "u") (VANDQ_S "s")
+ (VANDQ_U "u") (VBICQ_S "s") (VBICQ_U "u")
+ (VBRSRQ_N_S "s") (VBRSRQ_N_U "u") (VCADDQ_ROT270_S "s")
+ (VCADDQ_ROT270_U "u") (VCADDQ_ROT90_S "s")
+ (VCMPEQQ_S "s") (VCMPEQQ_U "u") (VCADDQ_ROT90_U "u")
+ (VCMPEQQ_N_S "s") (VCMPEQQ_N_U "u") (VCMPNEQ_N_S "s")
+ (VCMPNEQ_N_U "u") (VEORQ_S "s") (VEORQ_U "u")
+ (VHADDQ_N_S "s") (VHADDQ_N_U "u") (VHADDQ_S "s")
+ (VHADDQ_U "u") (VHSUBQ_N_S "s") (VHSUBQ_N_U "u")
+ (VHSUBQ_S "s") (VMAXQ_S "s") (VMAXQ_U "u") (VHSUBQ_U "u")
+ (VMAXVQ_S "s") (VMAXVQ_U "u") (VMINQ_S "s") (VMINQ_U "u")
+ (VMINVQ_S "s") (VMINVQ_U "u") (VMLADAVQ_S "s")
+ (VMLADAVQ_U "u") (VMULHQ_S "s") (VMULHQ_U "u")
+ (VMULLBQ_INT_S "s") (VMULLBQ_INT_U "u") (VQADDQ_S "s")
+ (VMULLTQ_INT_S "s") (VMULLTQ_INT_U "u") (VQADDQ_U "u")
+ (VMULQ_N_S "s") (VMULQ_N_U "u") (VMULQ_S "s")
+ (VMULQ_U "u") (VORNQ_S "s") (VORNQ_U "u") (VORRQ_S "s")
+ (VORRQ_U "u") (VQADDQ_N_S "s") (VQADDQ_N_U "u")
+ (VQRSHLQ_N_S "s") (VQRSHLQ_N_U "u") (VQRSHLQ_S "s")
+ (VQRSHLQ_U "u") (VQSHLQ_N_S "s") (VQSHLQ_N_U "u")
+ (VQSHLQ_R_S "s") (VQSHLQ_R_U "u") (VQSHLQ_S "s")
+ (VQSHLQ_U "u") (VQSUBQ_N_S "s") (VQSUBQ_N_U "u")
+ (VQSUBQ_S "s") (VQSUBQ_U "u") (VRHADDQ_S "s")
+ (VRHADDQ_U "u") (VRMULHQ_S "s") (VRMULHQ_U "u")
+ (VRSHLQ_N_S "s") (VRSHLQ_N_U "u") (VRSHLQ_S "s")
+ (VRSHLQ_U "u") (VRSHRQ_N_S "s") (VRSHRQ_N_U "u")
+ (VSHLQ_N_S "s") (VSHLQ_N_U "u") (VSHLQ_R_S "s")
+ (VSHLQ_R_U "u") (VSUBQ_N_S "s") (VSUBQ_N_U "u")
+ (VSUBQ_S "s") (VSUBQ_U "u") (VADDVAQ_S "s")
+ (VADDVAQ_U "u") (VADDLVAQ_S "s") (VADDLVAQ_U "u")
+ (VBICQ_N_S "s") (VBICQ_N_U "u") (VMLALDAVQ_U "u")
+ (VMLALDAVQ_S "s") (VMLALDAVXQ_U "u") (VMLALDAVXQ_S "s")
+ (VMOVNBQ_U "u") (VMOVNBQ_S "s") (VMOVNTQ_U "u")
+ (VMOVNTQ_S "s") (VORRQ_N_S "s") (VORRQ_N_U "u")
+ (VQMOVNBQ_U "u") (VQMOVNBQ_S "s") (VQMOVNTQ_S "s")
+ (VQMOVNTQ_U "u") (VSHLLBQ_N_U "u") (VSHLLBQ_N_S "s")
+ (VSHLLTQ_N_U "u") (VSHLLTQ_N_S "s") (VRMLALDAVHQ_U "u")
+ (VRMLALDAVHQ_S "s") (VBICQ_M_N_S "s") (VBICQ_M_N_U "u")
+ (VCVTAQ_M_S "s") (VCVTAQ_M_U "u") (VCVTQ_M_TO_F_S "s")
+ (VCVTQ_M_TO_F_U "u") (VQRSHRNBQ_N_S "s")
+ (VQRSHRNBQ_N_U "u") (VABAVQ_S "s") (VABAVQ_U "u")
+ (VRMLALDAVHAQ_U "u") (VRMLALDAVHAQ_S "s") (VSHLCQ_S "s")
+ (VSHLCQ_U "u") (VADDVAQ_P_S "s") (VADDVAQ_P_U "u")
+ (VCLZQ_M_S "s") (VCLZQ_M_U "u") (VCMPEQQ_M_N_S "s")
+ (VCMPEQQ_M_N_U "u") (VCMPEQQ_M_S "s") (VCMPEQQ_M_U "u")
+ (VCMPNEQ_M_N_S "s") (VCMPNEQ_M_N_U "u") (VCMPNEQ_M_S "s")
+ (VCMPNEQ_M_U "u") (VDUPQ_M_N_S "s") (VDUPQ_M_N_U "u")
+ (VMAXVQ_P_S "s") (VMAXVQ_P_U "u") (VMINVQ_P_S "s")
+ (VMINVQ_P_U "u") (VMLADAVAQ_S "s") (VMLADAVAQ_U "u")
+ (VMLADAVQ_P_S "s") (VMLADAVQ_P_U "u") (VMLAQ_N_S "s")
+ (VMLAQ_N_U "u") (VMLASQ_N_S "s") (VMLASQ_N_U "u")
+ (VMVNQ_M_S "s") (VMVNQ_M_U "u") (VPSELQ_S "s")
+ (VPSELQ_U "u") (VQDMLAHQ_N_S "s")
+ (VQDMLASHQ_N_S "s")
+ (VQRDMLAHQ_N_S "s")
+ (VQRDMLASHQ_N_S "s")
+ (VQRSHLQ_M_N_S "s") (VQRSHLQ_M_N_U "u")
+ (VQSHLQ_M_R_S "s") (VQSHLQ_M_R_U "u") (VSRIQ_N_S "s")
+ (VREV64Q_M_S "s") (VREV64Q_M_U "u") (VSRIQ_N_U "u")
+ (VRSHLQ_M_N_S "s") (VRSHLQ_M_N_U "u") (VSHLQ_M_R_S "s")
+ (VSHLQ_M_R_U "u") (VSLIQ_N_S "s") (VSLIQ_N_U "u")
+ (VMLALDAVQ_P_S "s") (VQMOVNBQ_M_S "s") (VMOVLTQ_M_S "s")
+ (VMOVNBQ_M_S "s") (VRSHRNTQ_N_S "s") (VORRQ_M_N_S "s")
+ (VREV32Q_M_S "s") (VQRSHRNTQ_N_S "s") (VMOVNTQ_M_S "s")
+ (VMOVLBQ_M_S "s") (VMLALDAVAQ_S "s") (VQSHRNBQ_N_S "s")
+ (VSHRNBQ_N_S "s") (VRSHRNBQ_N_S "s") (VMLALDAVXQ_P_S "s")
+ (VQMOVNTQ_M_S "s") (VMVNQ_M_N_S "s") (VQSHRNTQ_N_S "s")
+ (VMLALDAVAXQ_S "s") (VSHRNTQ_N_S "s") (VMLALDAVQ_P_U "u")
+ (VQMOVNBQ_M_U "u") (VMOVLTQ_M_U "u") (VMOVNBQ_M_U "u")
+ (VRSHRNTQ_N_U "u") (VORRQ_M_N_U "u") (VREV32Q_M_U "u")
+ (VREV16Q_M_S "s") (VREV16Q_M_U "u")
+ (VQRSHRNTQ_N_U "u") (VMOVNTQ_M_U "u") (VMOVLBQ_M_U "u")
+ (VMLALDAVAQ_U "u") (VQSHRNBQ_N_U "u") (VSHRNBQ_N_U "u")
+ (VRSHRNBQ_N_U "u") (VMLALDAVXQ_P_U "u")
+ (VMVNQ_M_N_U "u") (VQSHRNTQ_N_U "u") (VMLALDAVAXQ_U "u")
+ (VQMOVNTQ_M_U "u") (VSHRNTQ_N_U "u") (VCVTMQ_M_S "s")
+ (VCVTMQ_M_U "u") (VCVTNQ_M_S "s") (VCVTNQ_M_U "u")
+ (VCVTPQ_M_S "s") (VCVTPQ_M_U "u") (VADDLVAQ_P_S "s")
+ (VCVTQ_M_N_FROM_F_U "u") (VCVTQ_M_FROM_F_S "s")
+ (VCVTQ_M_FROM_F_U "u") (VRMLALDAVHQ_P_U "u")
+ (VRMLALDAVHQ_P_S "s") (VADDLVAQ_P_U "u")
+ (VCVTQ_M_N_FROM_F_S "s") (VABAVQ_P_U "u")
+ (VABAVQ_P_S "s") (VSHLQ_M_S "s") (VSHLQ_M_U "u")
+ (VSRIQ_M_N_S "s") (VSRIQ_M_N_U "u") (VSUBQ_M_S "s")
+ (VSUBQ_M_U "u") (VCVTQ_M_N_TO_F_S "s")
+ (VCVTQ_M_N_TO_F_U "u") (VADDQ_M_N_U "u")
+ (VSHLQ_M_N_S "s") (VMAXQ_M_U "u") (VHSUBQ_M_N_U "u")
+ (VMULQ_M_N_S "s") (VQSHLQ_M_U "u") (VRHADDQ_M_S "s")
+ (VEORQ_M_U "u") (VSHRQ_M_N_U "u") (VCADDQ_ROT90_M_U "u")
+ (VMLADAVAQ_P_U "u") (VEORQ_M_S "s") (VBRSRQ_M_N_S "s")
+ (VMULQ_M_U "u") (VQRDMLAHQ_M_N_S "s") (VHSUBQ_M_N_S "s")
+ (VQRSHLQ_M_S "s") (VMULQ_M_N_U "u")
+ (VMULQ_M_S "s") (VQSHLQ_M_N_U "u") (VSLIQ_M_N_U "u")
+ (VMLADAVAQ_P_S "s") (VQRSHLQ_M_U "u")
+ (VMULLBQ_INT_M_U "u") (VSHLQ_M_N_U "u") (VQSUBQ_M_U "u")
+ (VQDMLASHQ_M_N_S "s")
+ (VQRDMLASHQ_M_N_U "u") (VRSHRQ_M_N_S "s")
+ (VORNQ_M_S "s") (VCADDQ_ROT270_M_S "s") (VRHADDQ_M_U "u")
+ (VRSHRQ_M_N_U "u") (VMLASQ_M_N_U "u") (VHSUBQ_M_U "u")
+ (VQSUBQ_M_N_S "s") (VMULLTQ_INT_M_S "s")
+ (VORRQ_M_S "s") (VQDMLAHQ_M_N_U "u") (VRSHLQ_M_S "s")
+ (VHADDQ_M_U "u") (VHADDQ_M_N_S "s") (VMULLTQ_INT_M_U "u")
+ (VORRQ_M_U "u") (VHADDQ_M_S "s") (VHADDQ_M_N_U "u")
+ (VQDMLAHQ_M_N_S "s") (VMAXQ_M_S "s") (VORNQ_M_U "u")
+ (VCADDQ_ROT270_M_U "u") (VQADDQ_M_U "u")
+ (VQRDMLASHQ_M_N_S "s") (VBICQ_M_U "u") (VMINQ_M_U "u")
+ (VSUBQ_M_N_S "s") (VMULLBQ_INT_M_S "s") (VQSUBQ_M_S "s")
+ (VCADDQ_ROT90_M_S "s") (VRMULHQ_M_S "s") (VANDQ_M_U "u")
+ (VMULHQ_M_S "s") (VADDQ_M_S "s") (VQRDMLAHQ_M_N_U "u")
+ (VMLASQ_M_N_S "s") (VHSUBQ_M_S "s") (VRMULHQ_M_U "u")
+ (VQADDQ_M_N_S "s") (VSHRQ_M_N_S "s") (VANDQ_M_S "s")
+ (VABDQ_M_U "u") (VQSHLQ_M_S "s") (VABDQ_M_S "s")
+ (VSUBQ_M_N_U "u") (VMLAQ_M_N_S "s") (VBRSRQ_M_N_U "u")
+ (VADDQ_M_U "u") (VRSHLQ_M_U "u") (VSLIQ_M_N_S "s")
+ (VQADDQ_M_N_U "u") (VADDQ_M_N_S "s") (VQSUBQ_M_N_U "u")
+ (VMLAQ_M_N_U "u") (VMINQ_M_S "s") (VMULHQ_M_U "u")
+ (VQADDQ_M_S "s") (VBICQ_M_S "s") (VQSHLQ_M_N_S "s")
+ (VQSHRNTQ_M_N_S "s") (VQSHRNTQ_M_N_U "u")
+ (VSHRNTQ_M_N_U "u") (VSHRNTQ_M_N_S "s")
+ (VSHRNBQ_M_N_S "s") (VSHRNBQ_M_N_U "u")
+ (VSHLLTQ_M_N_S "s") (VSHLLTQ_M_N_U "u")
+ (VSHLLBQ_M_N_S "s") (VSHLLBQ_M_N_U "u")
+ (VRSHRNTQ_M_N_S "s") (VRSHRNTQ_M_N_U "u")
+ (VRSHRNBQ_M_N_U "u") (VRSHRNBQ_M_N_S "s")
+ (VQSHRNTQ_M_N_U "u") (VQSHRNTQ_M_N_S "s")
+ (VQSHRNBQ_M_N_S "s") (VQSHRNBQ_M_N_U "u")
+ (VQRSHRNTQ_M_N_S "s") (VQRSHRNTQ_M_N_U "u")
+ (VQRSHRNBQ_M_N_S "s") (VQRSHRNBQ_M_N_U "u")
+ (VMLALDAVAXQ_P_S "s")
+ (VMLALDAVAQ_P_S "s") (VMLALDAVAQ_P_U "u")
+ (VSTRWQSB_S "s") (VSTRWQSB_U "u") (VSTRBQSO_S "s")
+ (VSTRBQSO_U "u") (VSTRBQ_S "s") (VSTRBQ_U "u")
+ (VLDRBQGO_S "s") (VLDRBQGO_U "u") (VLDRBQ_S "s")
+ (VLDRBQ_U "u") (VLDRWQGB_S "s") (VLDRWQGB_U "u")
+ (VLD1Q_S "s") (VLD1Q_U "u") (VLDRHQGO_S "s")
+ (VLDRHQGO_U "u") (VLDRHQGSO_S "s") (VLDRHQGSO_U "u")
+ (VLDRHQ_S "s") (VLDRHQ_U "u") (VLDRWQ_S "s")
+ (VLDRWQ_U "u") (VLDRDQGB_S "s") (VLDRDQGB_U "u")
+ (VLDRDQGO_S "s") (VLDRDQGO_U "u") (VLDRDQGSO_S "s")
+ (VLDRDQGSO_U "u") (VLDRWQGO_S "s") (VLDRWQGO_U "u")
+ (VLDRWQGSO_S "s") (VLDRWQGSO_U "u") (VST1Q_S "s")
+ (VST1Q_U "u") (VSTRHQSO_S "s") (VSTRHQSO_U "u")
+ (VSTRHQSSO_S "s") (VSTRHQSSO_U "u") (VSTRHQ_S "s")
+ (VSTRHQ_U "u") (VSTRWQ_S "s") (VSTRWQ_U "u")
+ (VSTRDQSB_S "s") (VSTRDQSB_U "u") (VSTRDQSO_S "s")
+ (VSTRDQSO_U "u") (VSTRDQSSO_S "s") (VSTRDQSSO_U "u")
+ (VSTRWQSO_U "u") (VSTRWQSO_S "s") (VSTRWQSSO_U "u")
+ (VSTRWQSSO_S "s") (VSTRWQSBWB_S "s") (VSTRWQSBWB_U "u")
+ (VLDRWQGBWB_S "s") (VLDRWQGBWB_U "u") (VLDRDQGBWB_S "s")
+ (VLDRDQGBWB_U "u") (VSTRDQSBWB_S "s") (VADCQ_M_S "s")
+ (VSTRDQSBWB_U "u") (VSBCQ_U "u") (VSBCQ_M_U "u")
+ (VSBCQ_S "s") (VSBCQ_M_S "s") (VSBCIQ_U "u")
+ (VSBCIQ_M_U "u") (VSBCIQ_S "s") (VSBCIQ_M_S "s")
+ (VADCQ_U "u") (VADCQ_M_U "u") (VADCQ_S "s")
+ (VADCIQ_U "u") (VADCIQ_M_U "u") (VADCIQ_S "s")
+ (VADCIQ_M_S "s") (SQRSHRL_64 "64") (SQRSHRL_48 "48")
+ (UQRSHLL_64 "64") (UQRSHLL_48 "48") (VSHLCQ_M_S "s")
+ (VSHLCQ_M_U "u")])
+
+(define_int_attr mode1 [(VCTP8Q "8") (VCTP16Q "16") (VCTP32Q "32")
+ (VCTP64Q "64") (VCTP8Q_M "8") (VCTP16Q_M "16")
+ (VCTP32Q_M "32") (VCTP64Q_M "64")])
;; Both kinds of return insn.
(define_code_iterator RETURNS [return simple_return])
@@ -1256,3 +1469,249 @@
;; An iterator for CDE MVE accumulator/non-accumulator versions.
(define_int_attr a [(UNSPEC_VCDE "") (UNSPEC_VCDEA "a")])
+
+;; MVE int iterator.
+(define_int_iterator VCVTQ_TO_F [VCVTQ_TO_F_S VCVTQ_TO_F_U])
+(define_int_iterator VMVNQ_N [VMVNQ_N_U VMVNQ_N_S])
+(define_int_iterator VREV64Q [VREV64Q_S VREV64Q_U])
+(define_int_iterator VCVTQ_FROM_F [VCVTQ_FROM_F_S VCVTQ_FROM_F_U])
+(define_int_iterator VREV16Q [VREV16Q_U VREV16Q_S])
+(define_int_iterator VCVTAQ [VCVTAQ_U VCVTAQ_S])
+(define_int_iterator VMVNQ [VMVNQ_U VMVNQ_S])
+(define_int_iterator VDUPQ_N [VDUPQ_N_U VDUPQ_N_S])
+(define_int_iterator VCLZQ [VCLZQ_U VCLZQ_S])
+(define_int_iterator VADDVQ [VADDVQ_U VADDVQ_S])
+(define_int_iterator VREV32Q [VREV32Q_U VREV32Q_S])
+(define_int_iterator VMOVLBQ [VMOVLBQ_S VMOVLBQ_U])
+(define_int_iterator VMOVLTQ [VMOVLTQ_U VMOVLTQ_S])
+(define_int_iterator VCVTPQ [VCVTPQ_S VCVTPQ_U])
+(define_int_iterator VCVTNQ [VCVTNQ_S VCVTNQ_U])
+(define_int_iterator VCVTMQ [VCVTMQ_S VCVTMQ_U])
+(define_int_iterator VADDLVQ [VADDLVQ_U VADDLVQ_S])
+(define_int_iterator VCTPQ [VCTP8Q VCTP16Q VCTP32Q VCTP64Q])
+(define_int_iterator VCTPQ_M [VCTP8Q_M VCTP16Q_M VCTP32Q_M VCTP64Q_M])
+(define_int_iterator VCVTQ_N_TO_F [VCVTQ_N_TO_F_S VCVTQ_N_TO_F_U])
+(define_int_iterator VCREATEQ [VCREATEQ_U VCREATEQ_S])
+(define_int_iterator VSHRQ_N [VSHRQ_N_S VSHRQ_N_U])
+(define_int_iterator VCVTQ_N_FROM_F [VCVTQ_N_FROM_F_S VCVTQ_N_FROM_F_U])
+(define_int_iterator VADDLVQ_P [VADDLVQ_P_S VADDLVQ_P_U])
+(define_int_iterator VCMPNEQ [VCMPNEQ_U VCMPNEQ_S])
+(define_int_iterator VSHLQ [VSHLQ_S VSHLQ_U])
+(define_int_iterator VABDQ [VABDQ_S VABDQ_U])
+(define_int_iterator VADDQ_N [VADDQ_N_S VADDQ_N_U])
+(define_int_iterator VADDVAQ [VADDVAQ_S VADDVAQ_U])
+(define_int_iterator VADDVQ_P [VADDVQ_P_U VADDVQ_P_S])
+(define_int_iterator VANDQ [VANDQ_U VANDQ_S])
+(define_int_iterator VBICQ [VBICQ_S VBICQ_U])
+(define_int_iterator VBRSRQ_N [VBRSRQ_N_U VBRSRQ_N_S])
+(define_int_iterator VCADDQ_ROT270 [VCADDQ_ROT270_S VCADDQ_ROT270_U])
+(define_int_iterator VCADDQ_ROT90 [VCADDQ_ROT90_U VCADDQ_ROT90_S])
+(define_int_iterator VCMPEQQ [VCMPEQQ_U VCMPEQQ_S])
+(define_int_iterator VCMPEQQ_N [VCMPEQQ_N_S VCMPEQQ_N_U])
+(define_int_iterator VCMPNEQ_N [VCMPNEQ_N_U VCMPNEQ_N_S])
+(define_int_iterator VEORQ [VEORQ_U VEORQ_S])
+(define_int_iterator VHADDQ [VHADDQ_S VHADDQ_U])
+(define_int_iterator VHADDQ_N [VHADDQ_N_U VHADDQ_N_S])
+(define_int_iterator VHSUBQ [VHSUBQ_S VHSUBQ_U])
+(define_int_iterator VHSUBQ_N [VHSUBQ_N_U VHSUBQ_N_S])
+(define_int_iterator VMAXQ [VMAXQ_U VMAXQ_S])
+(define_int_iterator VMAXVQ [VMAXVQ_U VMAXVQ_S])
+(define_int_iterator VMINQ [VMINQ_S VMINQ_U])
+(define_int_iterator VMINVQ [VMINVQ_U VMINVQ_S])
+(define_int_iterator VMLADAVQ [VMLADAVQ_U VMLADAVQ_S])
+(define_int_iterator VMULHQ [VMULHQ_S VMULHQ_U])
+(define_int_iterator VMULLBQ_INT [VMULLBQ_INT_U VMULLBQ_INT_S])
+(define_int_iterator VMULLTQ_INT [VMULLTQ_INT_U VMULLTQ_INT_S])
+(define_int_iterator VMULQ [VMULQ_U VMULQ_S])
+(define_int_iterator VMULQ_N [VMULQ_N_U VMULQ_N_S])
+(define_int_iterator VORNQ [VORNQ_U VORNQ_S])
+(define_int_iterator VORRQ [VORRQ_S VORRQ_U])
+(define_int_iterator VQADDQ [VQADDQ_U VQADDQ_S])
+(define_int_iterator VQADDQ_N [VQADDQ_N_S VQADDQ_N_U])
+(define_int_iterator VQRSHLQ [VQRSHLQ_S VQRSHLQ_U])
+(define_int_iterator VQRSHLQ_N [VQRSHLQ_N_S VQRSHLQ_N_U])
+(define_int_iterator VQSHLQ [VQSHLQ_S VQSHLQ_U])
+(define_int_iterator VQSHLQ_N [VQSHLQ_N_S VQSHLQ_N_U])
+(define_int_iterator VQSHLQ_R [VQSHLQ_R_U VQSHLQ_R_S])
+(define_int_iterator VQSUBQ [VQSUBQ_U VQSUBQ_S])
+(define_int_iterator VQSUBQ_N [VQSUBQ_N_S VQSUBQ_N_U])
+(define_int_iterator VRHADDQ [VRHADDQ_S VRHADDQ_U])
+(define_int_iterator VRMULHQ [VRMULHQ_S VRMULHQ_U])
+(define_int_iterator VRSHLQ [VRSHLQ_S VRSHLQ_U])
+(define_int_iterator VRSHLQ_N [VRSHLQ_N_U VRSHLQ_N_S])
+(define_int_iterator VRSHRQ_N [VRSHRQ_N_S VRSHRQ_N_U])
+(define_int_iterator VSHLQ_N [VSHLQ_N_U VSHLQ_N_S])
+(define_int_iterator VSHLQ_R [VSHLQ_R_S VSHLQ_R_U])
+(define_int_iterator VSUBQ [VSUBQ_S VSUBQ_U])
+(define_int_iterator VSUBQ_N [VSUBQ_N_S VSUBQ_N_U])
+(define_int_iterator VADDLVAQ [VADDLVAQ_S VADDLVAQ_U])
+(define_int_iterator VBICQ_N [VBICQ_N_S VBICQ_N_U])
+(define_int_iterator VMLALDAVQ [VMLALDAVQ_U VMLALDAVQ_S])
+(define_int_iterator VMLALDAVXQ [VMLALDAVXQ_U VMLALDAVXQ_S])
+(define_int_iterator VMOVNBQ [VMOVNBQ_U VMOVNBQ_S])
+(define_int_iterator VMOVNTQ [VMOVNTQ_S VMOVNTQ_U])
+(define_int_iterator VORRQ_N [VORRQ_N_U VORRQ_N_S])
+(define_int_iterator VQMOVNBQ [VQMOVNBQ_U VQMOVNBQ_S])
+(define_int_iterator VQMOVNTQ [VQMOVNTQ_U VQMOVNTQ_S])
+(define_int_iterator VSHLLBQ_N [VSHLLBQ_N_S VSHLLBQ_N_U])
+(define_int_iterator VSHLLTQ_N [VSHLLTQ_N_U VSHLLTQ_N_S])
+(define_int_iterator VRMLALDAVHQ [VRMLALDAVHQ_U VRMLALDAVHQ_S])
+(define_int_iterator VBICQ_M_N [VBICQ_M_N_S VBICQ_M_N_U])
+(define_int_iterator VCVTAQ_M [VCVTAQ_M_S VCVTAQ_M_U])
+(define_int_iterator VCVTQ_M_TO_F [VCVTQ_M_TO_F_S VCVTQ_M_TO_F_U])
+(define_int_iterator VQRSHRNBQ_N [VQRSHRNBQ_N_U VQRSHRNBQ_N_S])
+(define_int_iterator VABAVQ [VABAVQ_S VABAVQ_U])
+(define_int_iterator VSHLCQ [VSHLCQ_S VSHLCQ_U])
+(define_int_iterator VRMLALDAVHAQ [VRMLALDAVHAQ_S VRMLALDAVHAQ_U])
+(define_int_iterator VADDVAQ_P [VADDVAQ_P_S VADDVAQ_P_U])
+(define_int_iterator VCLZQ_M [VCLZQ_M_S VCLZQ_M_U])
+(define_int_iterator VCMPEQQ_M_N [VCMPEQQ_M_N_S VCMPEQQ_M_N_U])
+(define_int_iterator VCMPEQQ_M [VCMPEQQ_M_S VCMPEQQ_M_U])
+(define_int_iterator VCMPNEQ_M_N [VCMPNEQ_M_N_S VCMPNEQ_M_N_U])
+(define_int_iterator VCMPNEQ_M [VCMPNEQ_M_S VCMPNEQ_M_U])
+(define_int_iterator VDUPQ_M_N [VDUPQ_M_N_S VDUPQ_M_N_U])
+(define_int_iterator VMAXVQ_P [VMAXVQ_P_S VMAXVQ_P_U])
+(define_int_iterator VMINVQ_P [VMINVQ_P_S VMINVQ_P_U])
+(define_int_iterator VMLADAVAQ [VMLADAVAQ_S VMLADAVAQ_U])
+(define_int_iterator VMLADAVQ_P [VMLADAVQ_P_S VMLADAVQ_P_U])
+(define_int_iterator VMLAQ_N [VMLAQ_N_S VMLAQ_N_U])
+(define_int_iterator VMLASQ_N [VMLASQ_N_S VMLASQ_N_U])
+(define_int_iterator VMVNQ_M [VMVNQ_M_S VMVNQ_M_U])
+(define_int_iterator VPSELQ [VPSELQ_S VPSELQ_U])
+(define_int_iterator VQDMLAHQ_N [VQDMLAHQ_N_S])
+(define_int_iterator VQDMLASHQ_N [VQDMLASHQ_N_S])
+(define_int_iterator VQRDMLAHQ_N [VQRDMLAHQ_N_S])
+(define_int_iterator VQRDMLASHQ_N [VQRDMLASHQ_N_S])
+(define_int_iterator VQRSHLQ_M_N [VQRSHLQ_M_N_S VQRSHLQ_M_N_U])
+(define_int_iterator VQSHLQ_M_R [VQSHLQ_M_R_S VQSHLQ_M_R_U])
+(define_int_iterator VREV64Q_M [VREV64Q_M_S VREV64Q_M_U])
+(define_int_iterator VRSHLQ_M_N [VRSHLQ_M_N_S VRSHLQ_M_N_U])
+(define_int_iterator VSHLQ_M_R [VSHLQ_M_R_S VSHLQ_M_R_U])
+(define_int_iterator VSLIQ_N [VSLIQ_N_S VSLIQ_N_U])
+(define_int_iterator VSRIQ_N [VSRIQ_N_S VSRIQ_N_U])
+(define_int_iterator VMLALDAVQ_P [VMLALDAVQ_P_U VMLALDAVQ_P_S])
+(define_int_iterator VQMOVNBQ_M [VQMOVNBQ_M_S VQMOVNBQ_M_U])
+(define_int_iterator VMOVLTQ_M [VMOVLTQ_M_U VMOVLTQ_M_S])
+(define_int_iterator VMOVNBQ_M [VMOVNBQ_M_U VMOVNBQ_M_S])
+(define_int_iterator VRSHRNTQ_N [VRSHRNTQ_N_U VRSHRNTQ_N_S])
+(define_int_iterator VORRQ_M_N [VORRQ_M_N_S VORRQ_M_N_U])
+(define_int_iterator VREV32Q_M [VREV32Q_M_S VREV32Q_M_U])
+(define_int_iterator VREV16Q_M [VREV16Q_M_S VREV16Q_M_U])
+(define_int_iterator VQRSHRNTQ_N [VQRSHRNTQ_N_U VQRSHRNTQ_N_S])
+(define_int_iterator VMOVNTQ_M [VMOVNTQ_M_U VMOVNTQ_M_S])
+(define_int_iterator VMOVLBQ_M [VMOVLBQ_M_U VMOVLBQ_M_S])
+(define_int_iterator VMLALDAVAQ [VMLALDAVAQ_S VMLALDAVAQ_U])
+(define_int_iterator VQSHRNBQ_N [VQSHRNBQ_N_U VQSHRNBQ_N_S])
+(define_int_iterator VSHRNBQ_N [VSHRNBQ_N_U VSHRNBQ_N_S])
+(define_int_iterator VRSHRNBQ_N [VRSHRNBQ_N_S VRSHRNBQ_N_U])
+(define_int_iterator VMLALDAVXQ_P [VMLALDAVXQ_P_U VMLALDAVXQ_P_S])
+(define_int_iterator VQMOVNTQ_M [VQMOVNTQ_M_U VQMOVNTQ_M_S])
+(define_int_iterator VMVNQ_M_N [VMVNQ_M_N_U VMVNQ_M_N_S])
+(define_int_iterator VQSHRNTQ_N [VQSHRNTQ_N_U VQSHRNTQ_N_S])
+(define_int_iterator VMLALDAVAXQ [VMLALDAVAXQ_S VMLALDAVAXQ_U])
+(define_int_iterator VSHRNTQ_N [VSHRNTQ_N_S VSHRNTQ_N_U])
+(define_int_iterator VCVTMQ_M [VCVTMQ_M_S VCVTMQ_M_U])
+(define_int_iterator VCVTNQ_M [VCVTNQ_M_S VCVTNQ_M_U])
+(define_int_iterator VCVTPQ_M [VCVTPQ_M_S VCVTPQ_M_U])
+(define_int_iterator VCVTQ_M_N_FROM_F [VCVTQ_M_N_FROM_F_S VCVTQ_M_N_FROM_F_U])
+(define_int_iterator VCVTQ_M_FROM_F [VCVTQ_M_FROM_F_U VCVTQ_M_FROM_F_S])
+(define_int_iterator VRMLALDAVHQ_P [VRMLALDAVHQ_P_S VRMLALDAVHQ_P_U])
+(define_int_iterator VADDLVAQ_P [VADDLVAQ_P_U VADDLVAQ_P_S])
+(define_int_iterator VABAVQ_P [VABAVQ_P_S VABAVQ_P_U])
+(define_int_iterator VSHLQ_M [VSHLQ_M_S VSHLQ_M_U])
+(define_int_iterator VSRIQ_M_N [VSRIQ_M_N_S VSRIQ_M_N_U])
+(define_int_iterator VSUBQ_M [VSUBQ_M_U VSUBQ_M_S])
+(define_int_iterator VCVTQ_M_N_TO_F [VCVTQ_M_N_TO_F_U VCVTQ_M_N_TO_F_S])
+(define_int_iterator VHSUBQ_M [VHSUBQ_M_S VHSUBQ_M_U])
+(define_int_iterator VSLIQ_M_N [VSLIQ_M_N_U VSLIQ_M_N_S])
+(define_int_iterator VRSHLQ_M [VRSHLQ_M_S VRSHLQ_M_U])
+(define_int_iterator VMINQ_M [VMINQ_M_S VMINQ_M_U])
+(define_int_iterator VMULLBQ_INT_M [VMULLBQ_INT_M_U VMULLBQ_INT_M_S])
+(define_int_iterator VMULHQ_M [VMULHQ_M_S VMULHQ_M_U])
+(define_int_iterator VMULQ_M [VMULQ_M_S VMULQ_M_U])
+(define_int_iterator VHSUBQ_M_N [VHSUBQ_M_N_S VHSUBQ_M_N_U])
+(define_int_iterator VHADDQ_M_N [VHADDQ_M_N_S VHADDQ_M_N_U])
+(define_int_iterator VORRQ_M [VORRQ_M_S VORRQ_M_U])
+(define_int_iterator VRMULHQ_M [VRMULHQ_M_U VRMULHQ_M_S])
+(define_int_iterator VQADDQ_M [VQADDQ_M_U VQADDQ_M_S])
+(define_int_iterator VRSHRQ_M_N [VRSHRQ_M_N_S VRSHRQ_M_N_U])
+(define_int_iterator VQSUBQ_M_N [VQSUBQ_M_N_U VQSUBQ_M_N_S])
+(define_int_iterator VADDQ_M [VADDQ_M_U VADDQ_M_S])
+(define_int_iterator VORNQ_M [VORNQ_M_U VORNQ_M_S])
+(define_int_iterator VRHADDQ_M [VRHADDQ_M_U VRHADDQ_M_S])
+(define_int_iterator VQSHLQ_M [VQSHLQ_M_U VQSHLQ_M_S])
+(define_int_iterator VANDQ_M [VANDQ_M_U VANDQ_M_S])
+(define_int_iterator VBICQ_M [VBICQ_M_U VBICQ_M_S])
+(define_int_iterator VSHLQ_M_N [VSHLQ_M_N_S VSHLQ_M_N_U])
+(define_int_iterator VCADDQ_ROT270_M [VCADDQ_ROT270_M_U VCADDQ_ROT270_M_S])
+(define_int_iterator VQRSHLQ_M [VQRSHLQ_M_U VQRSHLQ_M_S])
+(define_int_iterator VQADDQ_M_N [VQADDQ_M_N_U VQADDQ_M_N_S])
+(define_int_iterator VADDQ_M_N [VADDQ_M_N_S VADDQ_M_N_U])
+(define_int_iterator VMAXQ_M [VMAXQ_M_S VMAXQ_M_U])
+(define_int_iterator VQSUBQ_M [VQSUBQ_M_U VQSUBQ_M_S])
+(define_int_iterator VMLASQ_M_N [VMLASQ_M_N_U VMLASQ_M_N_S])
+(define_int_iterator VMLADAVAQ_P [VMLADAVAQ_P_U VMLADAVAQ_P_S])
+(define_int_iterator VBRSRQ_M_N [VBRSRQ_M_N_U VBRSRQ_M_N_S])
+(define_int_iterator VMULQ_M_N [VMULQ_M_N_U VMULQ_M_N_S])
+(define_int_iterator VCADDQ_ROT90_M [VCADDQ_ROT90_M_U VCADDQ_ROT90_M_S])
+(define_int_iterator VMULLTQ_INT_M [VMULLTQ_INT_M_S VMULLTQ_INT_M_U])
+(define_int_iterator VEORQ_M [VEORQ_M_S VEORQ_M_U])
+(define_int_iterator VSHRQ_M_N [VSHRQ_M_N_S VSHRQ_M_N_U])
+(define_int_iterator VSUBQ_M_N [VSUBQ_M_N_S VSUBQ_M_N_U])
+(define_int_iterator VHADDQ_M [VHADDQ_M_S VHADDQ_M_U])
+(define_int_iterator VABDQ_M [VABDQ_M_S VABDQ_M_U])
+(define_int_iterator VMLAQ_M_N [VMLAQ_M_N_S VMLAQ_M_N_U])
+(define_int_iterator VQSHLQ_M_N [VQSHLQ_M_N_S VQSHLQ_M_N_U])
+(define_int_iterator VMLALDAVAQ_P [VMLALDAVAQ_P_U VMLALDAVAQ_P_S])
+(define_int_iterator VMLALDAVAXQ_P [VMLALDAVAXQ_P_S])
+(define_int_iterator VQRSHRNBQ_M_N [VQRSHRNBQ_M_N_U VQRSHRNBQ_M_N_S])
+(define_int_iterator VQRSHRNTQ_M_N [VQRSHRNTQ_M_N_S VQRSHRNTQ_M_N_U])
+(define_int_iterator VQSHRNBQ_M_N [VQSHRNBQ_M_N_U VQSHRNBQ_M_N_S])
+(define_int_iterator VQSHRNTQ_M_N [VQSHRNTQ_M_N_S VQSHRNTQ_M_N_U])
+(define_int_iterator VRSHRNBQ_M_N [VRSHRNBQ_M_N_U VRSHRNBQ_M_N_S])
+(define_int_iterator VRSHRNTQ_M_N [VRSHRNTQ_M_N_U VRSHRNTQ_M_N_S])
+(define_int_iterator VSHLLBQ_M_N [VSHLLBQ_M_N_U VSHLLBQ_M_N_S])
+(define_int_iterator VSHLLTQ_M_N [VSHLLTQ_M_N_U VSHLLTQ_M_N_S])
+(define_int_iterator VSHRNBQ_M_N [VSHRNBQ_M_N_S VSHRNBQ_M_N_U])
+(define_int_iterator VSHRNTQ_M_N [VSHRNTQ_M_N_S VSHRNTQ_M_N_U])
+(define_int_iterator VSTRWSBQ [VSTRWQSB_S VSTRWQSB_U])
+(define_int_iterator VSTRBSOQ [VSTRBQSO_S VSTRBQSO_U])
+(define_int_iterator VSTRBQ [VSTRBQ_S VSTRBQ_U])
+(define_int_iterator VLDRBGOQ [VLDRBQGO_S VLDRBQGO_U])
+(define_int_iterator VLDRBQ [VLDRBQ_S VLDRBQ_U])
+(define_int_iterator VLDRWGBQ [VLDRWQGB_S VLDRWQGB_U])
+(define_int_iterator VLD1Q [VLD1Q_S VLD1Q_U])
+(define_int_iterator VLDRHGOQ [VLDRHQGO_S VLDRHQGO_U])
+(define_int_iterator VLDRHGSOQ [VLDRHQGSO_S VLDRHQGSO_U])
+(define_int_iterator VLDRHQ [VLDRHQ_S VLDRHQ_U])
+(define_int_iterator VLDRWQ [VLDRWQ_S VLDRWQ_U])
+(define_int_iterator VLDRDGBQ [VLDRDQGB_S VLDRDQGB_U])
+(define_int_iterator VLDRDGOQ [VLDRDQGO_S VLDRDQGO_U])
+(define_int_iterator VLDRDGSOQ [VLDRDQGSO_S VLDRDQGSO_U])
+(define_int_iterator VLDRWGOQ [VLDRWQGO_S VLDRWQGO_U])
+(define_int_iterator VLDRWGSOQ [VLDRWQGSO_S VLDRWQGSO_U])
+(define_int_iterator VST1Q [VST1Q_S VST1Q_U])
+(define_int_iterator VSTRHSOQ [VSTRHQSO_S VSTRHQSO_U])
+(define_int_iterator VSTRHSSOQ [VSTRHQSSO_S VSTRHQSSO_U])
+(define_int_iterator VSTRHQ [VSTRHQ_S VSTRHQ_U])
+(define_int_iterator VSTRWQ [VSTRWQ_S VSTRWQ_U])
+(define_int_iterator VSTRDSBQ [VSTRDQSB_S VSTRDQSB_U])
+(define_int_iterator VSTRDSOQ [VSTRDQSO_S VSTRDQSO_U])
+(define_int_iterator VSTRDSSOQ [VSTRDQSSO_S VSTRDQSSO_U])
+(define_int_iterator VSTRWSOQ [VSTRWQSO_S VSTRWQSO_U])
+(define_int_iterator VSTRWSSOQ [VSTRWQSSO_S VSTRWQSSO_U])
+(define_int_iterator VSTRWSBWBQ [VSTRWQSBWB_S VSTRWQSBWB_U])
+(define_int_iterator VLDRWGBWBQ [VLDRWQGBWB_S VLDRWQGBWB_U])
+(define_int_iterator VSTRDSBWBQ [VSTRDQSBWB_S VSTRDQSBWB_U])
+(define_int_iterator VLDRDGBWBQ [VLDRDQGBWB_S VLDRDQGBWB_U])
+(define_int_iterator VADCIQ [VADCIQ_U VADCIQ_S])
+(define_int_iterator VADCIQ_M [VADCIQ_M_U VADCIQ_M_S])
+(define_int_iterator VSBCQ [VSBCQ_U VSBCQ_S])
+(define_int_iterator VSBCQ_M [VSBCQ_M_U VSBCQ_M_S])
+(define_int_iterator VSBCIQ [VSBCIQ_U VSBCIQ_S])
+(define_int_iterator VSBCIQ_M [VSBCIQ_M_U VSBCIQ_M_S])
+(define_int_iterator VADCQ [VADCQ_U VADCQ_S])
+(define_int_iterator VADCQ_M [VADCQ_M_U VADCQ_M_S])
+(define_int_iterator UQRSHLLQ [UQRSHLL_64 UQRSHLL_48])
+(define_int_iterator SQRSHRLQ [SQRSHRL_64 SQRSHRL_48])
+(define_int_iterator VSHLCQ_M [VSHLCQ_M_S VSHLCQ_M_U])
diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md
index 465b39a..ecbaaa9 100644
--- a/gcc/config/arm/mve.md
+++ b/gcc/config/arm/mve.md
@@ -17,654 +17,6 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_mode_iterator MVE_types [V16QI V8HI V4SI V2DI TI V8HF V4SF V2DF])
-(define_mode_iterator MVE_VLD_ST [V16QI V8HI V4SI V8HF V4SF])
-(define_mode_iterator MVE_0 [V8HF V4SF])
-(define_mode_iterator MVE_1 [V16QI V8HI V4SI V2DI])
-(define_mode_iterator MVE_3 [V16QI V8HI])
-(define_mode_iterator MVE_2 [V16QI V8HI V4SI])
-(define_mode_iterator MVE_5 [V8HI V4SI])
-(define_mode_iterator MVE_6 [V8HI V4SI])
-
-(define_c_enum "unspec" [VST4Q VRNDXQ_F VRNDQ_F VRNDPQ_F VRNDNQ_F VRNDMQ_F
- VRNDAQ_F VREV64Q_F VNEGQ_F VDUPQ_N_F VABSQ_F VREV32Q_F
- VCVTTQ_F32_F16 VCVTBQ_F32_F16 VCVTQ_TO_F_S VQNEGQ_S
- VCVTQ_TO_F_U VREV16Q_S VREV16Q_U VADDLVQ_S VMVNQ_N_S
- VMVNQ_N_U VCVTAQ_S VCVTAQ_U VREV64Q_S VREV64Q_U
- VQABSQ_S VNEGQ_S VMVNQ_S VMVNQ_U VDUPQ_N_U VDUPQ_N_S
- VCLZQ_U VCLZQ_S VCLSQ_S VADDVQ_S VADDVQ_U VABSQ_S
- VREV32Q_U VREV32Q_S VMOVLTQ_U VMOVLTQ_S VMOVLBQ_S
- VMOVLBQ_U VCVTQ_FROM_F_S VCVTQ_FROM_F_U VCVTPQ_S
- VCVTPQ_U VCVTNQ_S VCVTNQ_U VCVTMQ_S VCVTMQ_U
- VADDLVQ_U VCTP8Q VCTP16Q VCTP32Q VCTP64Q VPNOT
- VCREATEQ_F VCVTQ_N_TO_F_S VCVTQ_N_TO_F_U VBRSRQ_N_F
- VSUBQ_N_F VCREATEQ_U VCREATEQ_S VSHRQ_N_S VSHRQ_N_U
- VCVTQ_N_FROM_F_S VCVTQ_N_FROM_F_U VADDLVQ_P_S
- VADDLVQ_P_U VCMPNEQ_U VCMPNEQ_S VSHLQ_S VSHLQ_U VABDQ_S
- VADDQ_N_S VADDVAQ_S VADDVQ_P_S VANDQ_S VBICQ_S
- VBRSRQ_N_S VCADDQ_ROT270_S VCADDQ_ROT90_S VCMPEQQ_S
- VCMPEQQ_N_S VCMPNEQ_N_S VEORQ_S VHADDQ_S VHADDQ_N_S
- VHSUBQ_S VHSUBQ_N_S VMAXQ_S VMAXVQ_S VMINQ_S VMINVQ_S
- VMLADAVQ_S VMULHQ_S VMULLBQ_INT_S VMULLTQ_INT_S VMULQ_S
- VMULQ_N_S VORNQ_S VORRQ_S VQADDQ_S VQADDQ_N_S VQRSHLQ_S
- VQRSHLQ_N_S VQSHLQ_S VQSHLQ_N_S VQSHLQ_R_S VQSUBQ_S
- VQSUBQ_N_S VRHADDQ_S VRMULHQ_S VRSHLQ_S VRSHLQ_N_S
- VRSHRQ_N_S VSHLQ_N_S VSHLQ_R_S VSUBQ_S VSUBQ_N_S
- VABDQ_U VADDQ_N_U VADDVAQ_U VADDVQ_P_U VANDQ_U VBICQ_U
- VBRSRQ_N_U VCADDQ_ROT270_U VCADDQ_ROT90_U VCMPEQQ_U
- VCMPEQQ_N_U VCMPNEQ_N_U VEORQ_U VHADDQ_U VHADDQ_N_U
- VHSUBQ_U VHSUBQ_N_U VMAXQ_U VMAXVQ_U VMINQ_U VMINVQ_U
- VMLADAVQ_U VMULHQ_U VMULLBQ_INT_U VMULLTQ_INT_U VMULQ_U
- VMULQ_N_U VORNQ_U VORRQ_U VQADDQ_U VQADDQ_N_U VQRSHLQ_U
- VQRSHLQ_N_U VQSHLQ_U VQSHLQ_N_U VQSHLQ_R_U VQSUBQ_U
- VQSUBQ_N_U VRHADDQ_U VRMULHQ_U VRSHLQ_U VRSHLQ_N_U
- VRSHRQ_N_U VSHLQ_N_U VSHLQ_R_U VSUBQ_U VSUBQ_N_U
- VCMPGEQ_N_S VCMPGEQ_S VCMPGTQ_N_S VCMPGTQ_S VCMPLEQ_N_S
- VCMPLEQ_S VCMPLTQ_N_S VCMPLTQ_S VHCADDQ_ROT270_S
- VHCADDQ_ROT90_S VMAXAQ_S VMAXAVQ_S VMINAQ_S VMINAVQ_S
- VMLADAVXQ_S VMLSDAVQ_S VMLSDAVXQ_S VQDMULHQ_N_S
- VQDMULHQ_S VQRDMULHQ_N_S VQRDMULHQ_S VQSHLUQ_N_S
- VCMPCSQ_N_U VCMPCSQ_U VCMPHIQ_N_U VCMPHIQ_U VABDQ_M_S
- VABDQ_M_U VABDQ_F VADDQ_N_F VANDQ_F VBICQ_F
- VCADDQ_ROT270_F VCADDQ_ROT90_F VCMPEQQ_F VCMPEQQ_N_F
- VCMPGEQ_F VCMPGEQ_N_F VCMPGTQ_F VCMPGTQ_N_F VCMPLEQ_F
- VCMPLEQ_N_F VCMPLTQ_F VCMPLTQ_N_F VCMPNEQ_F VCMPNEQ_N_F
- VCMULQ_F VCMULQ_ROT180_F VCMULQ_ROT270_F VCMULQ_ROT90_F
- VEORQ_F VMAXNMAQ_F VMAXNMAVQ_F VMAXNMQ_F VMAXNMVQ_F
- VMINNMAQ_F VMINNMAVQ_F VMINNMQ_F VMINNMVQ_F VMULQ_F
- VMULQ_N_F VORNQ_F VORRQ_F VSUBQ_F VADDLVAQ_U
- VADDLVAQ_S VBICQ_N_U VBICQ_N_S VCTP8Q_M VCTP16Q_M
- VCTP32Q_M VCTP64Q_M VCVTBQ_F16_F32 VCVTTQ_F16_F32
- VMLALDAVQ_U VMLALDAVXQ_U VMLALDAVXQ_S VMLALDAVQ_S
- VMLSLDAVQ_S VMLSLDAVXQ_S VMOVNBQ_U VMOVNBQ_S
- VMOVNTQ_U VMOVNTQ_S VORRQ_N_S VORRQ_N_U VQDMULLBQ_N_S
- VQDMULLBQ_S VQDMULLTQ_N_S VQDMULLTQ_S VQMOVNBQ_U
- VQMOVNBQ_S VQMOVUNBQ_S VQMOVUNTQ_S VRMLALDAVHXQ_S
- VRMLSLDAVHQ_S VRMLSLDAVHXQ_S VSHLLBQ_S
- VSHLLBQ_U VSHLLTQ_U VSHLLTQ_S VQMOVNTQ_U VQMOVNTQ_S
- VSHLLBQ_N_S VSHLLBQ_N_U VSHLLTQ_N_U VSHLLTQ_N_S
- VRMLALDAVHQ_U VRMLALDAVHQ_S VMULLTQ_POLY_P
- VMULLBQ_POLY_P VBICQ_M_N_S VBICQ_M_N_U VCMPEQQ_M_F
- VCVTAQ_M_S VCVTAQ_M_U VCVTQ_M_TO_F_S VCVTQ_M_TO_F_U
- VQRSHRNBQ_N_U VQRSHRNBQ_N_S VQRSHRUNBQ_N_S
- VRMLALDAVHAQ_S VABAVQ_S VABAVQ_U VSHLCQ_S VSHLCQ_U
- VRMLALDAVHAQ_U VABSQ_M_S VADDVAQ_P_S VADDVAQ_P_U
- VCLSQ_M_S VCLZQ_M_S VCLZQ_M_U VCMPCSQ_M_N_U
- VCMPCSQ_M_U VCMPEQQ_M_N_S VCMPEQQ_M_N_U VCMPEQQ_M_S
- VCMPEQQ_M_U VCMPGEQ_M_N_S VCMPGEQ_M_S VCMPGTQ_M_N_S
- VCMPGTQ_M_S VCMPHIQ_M_N_U VCMPHIQ_M_U VCMPLEQ_M_N_S
- VCMPLEQ_M_S VCMPLTQ_M_N_S VCMPLTQ_M_S VCMPNEQ_M_N_S
- VCMPNEQ_M_N_U VCMPNEQ_M_S VCMPNEQ_M_U VDUPQ_M_N_S
- VDUPQ_M_N_U VDWDUPQ_N_U VDWDUPQ_WB_U VIWDUPQ_N_U
- VIWDUPQ_WB_U VMAXAQ_M_S VMAXAVQ_P_S VMAXVQ_P_S
- VMAXVQ_P_U VMINAQ_M_S VMINAVQ_P_S VMINVQ_P_S VMINVQ_P_U
- VMLADAVAQ_S VMLADAVAQ_U VMLADAVQ_P_S VMLADAVQ_P_U
- VMLADAVXQ_P_S VMLAQ_N_S VMLAQ_N_U VMLASQ_N_S VMLASQ_N_U
- VMLSDAVQ_P_S VMLSDAVXQ_P_S VMVNQ_M_S VMVNQ_M_U
- VNEGQ_M_S VPSELQ_S VPSELQ_U VQABSQ_M_S VQDMLAHQ_N_S
- VQDMLAHQ_N_U VQNEGQ_M_S VQRDMLADHQ_S VQRDMLADHXQ_S
- VQRDMLAHQ_N_S VQRDMLAHQ_N_U VQRDMLASHQ_N_S
- VQRDMLASHQ_N_U VQRDMLSDHQ_S VQRDMLSDHXQ_S VQRSHLQ_M_N_S
- VQRSHLQ_M_N_U VQSHLQ_M_R_S VQSHLQ_M_R_U VREV64Q_M_S
- VREV64Q_M_U VRSHLQ_M_N_S VRSHLQ_M_N_U VSHLQ_M_R_S
- VSHLQ_M_R_U VSLIQ_N_S VSLIQ_N_U VSRIQ_N_S VSRIQ_N_U
- VQDMLSDHXQ_S VQDMLSDHQ_S VQDMLADHXQ_S VQDMLADHQ_S
- VMLSDAVAXQ_S VMLSDAVAQ_S VMLADAVAXQ_S
- VCMPGEQ_M_F VCMPGTQ_M_N_F VMLSLDAVQ_P_S VRMLALDAVHAXQ_S
- VMLSLDAVXQ_P_S VFMAQ_F VMLSLDAVAQ_S VQSHRUNBQ_N_S
- VQRSHRUNTQ_N_S VCMLAQ_F VMINNMAQ_M_F VFMASQ_N_F
- VDUPQ_M_N_F VCMPGTQ_M_F VCMPLTQ_M_F VRMLSLDAVHQ_P_S
- VQSHRUNTQ_N_S VABSQ_M_F VMAXNMAVQ_P_F VFMAQ_N_F
- VRMLSLDAVHXQ_P_S VREV32Q_M_F VRMLSLDAVHAQ_S
- VRMLSLDAVHAXQ_S VCMPLTQ_M_N_F VCMPNEQ_M_F VRNDAQ_M_F
- VRNDPQ_M_F VADDLVAQ_P_S VQMOVUNBQ_M_S VCMPLEQ_M_F
- VCMLAQ_ROT180_F VMLSLDAVAXQ_S VRNDXQ_M_F VFMSQ_F
- VMINNMVQ_P_F VMAXNMVQ_P_F VPSELQ_F VCMLAQ_ROT90_F
- VQMOVUNTQ_M_S VREV64Q_M_F VNEGQ_M_F VRNDMQ_M_F
- VCMPLEQ_M_N_F VCMPGEQ_M_N_F VRNDNQ_M_F VMINNMAVQ_P_F
- VCMPNEQ_M_N_F VRMLALDAVHQ_P_S VRMLALDAVHXQ_P_S
- VCMPEQQ_M_N_F VCMLAQ_ROT270_F VMAXNMAQ_M_F VRNDQ_M_F
- VMLALDAVQ_P_U VMLALDAVQ_P_S VQMOVNBQ_M_S VQMOVNBQ_M_U
- VMOVLTQ_M_U VMOVLTQ_M_S VMOVNBQ_M_U VMOVNBQ_M_S
- VRSHRNTQ_N_U VRSHRNTQ_N_S VORRQ_M_N_S VORRQ_M_N_U
- VREV32Q_M_S VREV32Q_M_U VQRSHRNTQ_N_U VQRSHRNTQ_N_S
- VMOVNTQ_M_U VMOVNTQ_M_S VMOVLBQ_M_U VMOVLBQ_M_S
- VMLALDAVAQ_S VMLALDAVAQ_U VQSHRNBQ_N_U VQSHRNBQ_N_S
- VSHRNBQ_N_U VSHRNBQ_N_S VRSHRNBQ_N_S VRSHRNBQ_N_U
- VMLALDAVXQ_P_U VMLALDAVXQ_P_S VQMOVNTQ_M_U VQMOVNTQ_M_S
- VMVNQ_M_N_U VMVNQ_M_N_S VQSHRNTQ_N_U VQSHRNTQ_N_S
- VMLALDAVAXQ_S VMLALDAVAXQ_U VSHRNTQ_N_S VSHRNTQ_N_U
- VCVTBQ_M_F16_F32 VCVTBQ_M_F32_F16 VCVTTQ_M_F16_F32
- VCVTTQ_M_F32_F16 VCVTMQ_M_S VCVTMQ_M_U VCVTNQ_M_S
- VCVTPQ_M_S VCVTPQ_M_U VCVTQ_M_N_FROM_F_S VCVTNQ_M_U
- VREV16Q_M_S VREV16Q_M_U VREV32Q_M VCVTQ_M_FROM_F_U
- VCVTQ_M_FROM_F_S VRMLALDAVHQ_P_U VADDLVAQ_P_U
- VCVTQ_M_N_FROM_F_U VQSHLUQ_M_N_S VABAVQ_P_S
- VABAVQ_P_U VSHLQ_M_S VSHLQ_M_U VSRIQ_M_N_S
- VSRIQ_M_N_U VSUBQ_M_U VSUBQ_M_S VCVTQ_M_N_TO_F_U
- VCVTQ_M_N_TO_F_S VQADDQ_M_U VQADDQ_M_S
- VRSHRQ_M_N_S VSUBQ_M_N_S VSUBQ_M_N_U VBRSRQ_M_N_S
- VSUBQ_M_N_F VBICQ_M_F VHADDQ_M_U VBICQ_M_U VBICQ_M_S
- VMULQ_M_N_U VHADDQ_M_S VORNQ_M_F VMLAQ_M_N_S VQSUBQ_M_U
- VQSUBQ_M_S VMLAQ_M_N_U VQSUBQ_M_N_U VQSUBQ_M_N_S
- VMULLTQ_INT_M_S VMULLTQ_INT_M_U VMULQ_M_N_S VMULQ_M_N_F
- VMLASQ_M_N_U VMLASQ_M_N_S VMAXQ_M_U VQRDMLAHQ_M_N_U
- VCADDQ_ROT270_M_F VCADDQ_ROT270_M_U VCADDQ_ROT270_M_S
- VQRSHLQ_M_S VMULQ_M_F VRHADDQ_M_U VSHRQ_M_N_U
- VRHADDQ_M_S VMULQ_M_S VMULQ_M_U VQRDMLASHQ_M_N_S
- VRSHLQ_M_S VRSHLQ_M_U VRSHRQ_M_N_U VADDQ_M_N_F
- VADDQ_M_N_S VADDQ_M_N_U VQRDMLASHQ_M_N_U VMAXQ_M_S
- VQRDMLAHQ_M_N_S VORRQ_M_S VORRQ_M_U VORRQ_M_F
- VQRSHLQ_M_U VRMULHQ_M_U VRMULHQ_M_S VMINQ_M_S VMINQ_M_U
- VANDQ_M_F VANDQ_M_U VANDQ_M_S VHSUBQ_M_N_S VHSUBQ_M_N_U
- VMULHQ_M_S VMULHQ_M_U VMULLBQ_INT_M_U
- VMULLBQ_INT_M_S VCADDQ_ROT90_M_F
- VSHRQ_M_N_S VADDQ_M_U VSLIQ_M_N_U
- VQADDQ_M_N_S VBRSRQ_M_N_F VABDQ_M_F VBRSRQ_M_N_U
- VEORQ_M_F VSHLQ_M_N_S VQDMLAHQ_M_N_U VQDMLAHQ_M_N_S
- VSHLQ_M_N_U VMLADAVAQ_P_U VMLADAVAQ_P_S VSLIQ_M_N_S
- VQSHLQ_M_U VQSHLQ_M_S VCADDQ_ROT90_M_U VCADDQ_ROT90_M_S
- VORNQ_M_U VORNQ_M_S VQSHLQ_M_N_S VQSHLQ_M_N_U VADDQ_M_S
- VHADDQ_M_N_S VADDQ_M_F VQADDQ_M_N_U VEORQ_M_S VEORQ_M_U
- VHSUBQ_M_S VHSUBQ_M_U VHADDQ_M_N_U VHCADDQ_ROT90_M_S
- VQRDMLSDHQ_M_S VQRDMLSDHXQ_M_S VQRDMLADHXQ_M_S
- VQDMULHQ_M_S VMLADAVAXQ_P_S VQDMLADHXQ_M_S
- VQRDMULHQ_M_S VMLSDAVAXQ_P_S VQDMULHQ_M_N_S
- VHCADDQ_ROT270_M_S VQDMLSDHQ_M_S VQDMLSDHXQ_M_S
- VMLSDAVAQ_P_S VQRDMLADHQ_M_S VQDMLADHQ_M_S
- VMLALDAVAQ_P_U VMLALDAVAQ_P_S VMLALDAVAXQ_P_U
- VQRSHRNBQ_M_N_U VQRSHRNBQ_M_N_S VQRSHRNTQ_M_N_S
- VQSHRNBQ_M_N_U VQSHRNBQ_M_N_S VQSHRNTQ_M_N_S
- VRSHRNBQ_M_N_U VRSHRNBQ_M_N_S VRSHRNTQ_M_N_U
- VSHLLBQ_M_N_U VSHLLBQ_M_N_S VSHLLTQ_M_N_U VSHLLTQ_M_N_S
- VSHRNBQ_M_N_S VSHRNBQ_M_N_U VSHRNTQ_M_N_S VSHRNTQ_M_N_U
- VMLALDAVAXQ_P_S VQRSHRNTQ_M_N_U VQSHRNTQ_M_N_U
- VRSHRNTQ_M_N_S VQRDMULHQ_M_N_S VRMLALDAVHAQ_P_S
- VMLSLDAVAQ_P_S VMLSLDAVAXQ_P_S VMULLBQ_POLY_M_P
- VMULLTQ_POLY_M_P VQDMULLBQ_M_N_S VQDMULLBQ_M_S
- VQDMULLTQ_M_N_S VQDMULLTQ_M_S VQRSHRUNBQ_M_N_S
- VQRSHRUNTQ_M_N_SVQSHRUNBQ_M_N_S VQSHRUNTQ_M_N_S
- VRMLALDAVHAQ_P_U VRMLALDAVHAXQ_P_S VRMLSLDAVHAQ_P_S
- VRMLSLDAVHAXQ_P_S VQRSHRUNTQ_M_N_S VQSHRUNBQ_M_N_S
- VCMLAQ_M_F VCMLAQ_ROT180_M_F VCMLAQ_ROT270_M_F
- VCMLAQ_ROT90_M_F VCMULQ_M_F VCMULQ_ROT180_M_F
- VCMULQ_ROT270_M_F VCMULQ_ROT90_M_F VFMAQ_M_F
- VFMAQ_M_N_F VFMASQ_M_N_F VFMSQ_M_F VMAXNMQ_M_F
- VMINNMQ_M_F VSUBQ_M_F VSTRWQSB_S VSTRWQSB_U
- VSTRBQSO_S VSTRBQSO_U VSTRBQ_S VSTRBQ_U VLDRBQGO_S
- VLDRBQGO_U VLDRBQ_S VLDRBQ_U VLDRWQGB_S VLDRWQGB_U
- VLD1Q_F VLD1Q_S VLD1Q_U VLDRHQ_F VLDRHQGO_S
- VLDRHQGO_U VLDRHQGSO_S VLDRHQGSO_U VLDRHQ_S VLDRHQ_U
- VLDRWQ_F VLDRWQ_S VLDRWQ_U VLDRDQGB_S VLDRDQGB_U
- VLDRDQGO_S VLDRDQGO_U VLDRDQGSO_S VLDRDQGSO_U
- VLDRHQGO_F VLDRHQGSO_F VLDRWQGB_F VLDRWQGO_F
- VLDRWQGO_S VLDRWQGO_U VLDRWQGSO_F VLDRWQGSO_S
- VLDRWQGSO_U VSTRHQ_F VST1Q_S VST1Q_U VSTRHQSO_S
- VSTRHQSO_U VSTRHQSSO_S VSTRHQSSO_U VSTRHQ_S
- VSTRHQ_U VSTRWQ_S VSTRWQ_U VSTRWQ_F VST1Q_F VSTRDQSB_S
- VSTRDQSB_U VSTRDQSO_S VSTRDQSO_U VSTRDQSSO_S
- VSTRDQSSO_U VSTRWQSO_S VSTRWQSO_U VSTRWQSSO_S
- VSTRWQSSO_U VSTRHQSO_F VSTRHQSSO_F VSTRWQSB_F
- VSTRWQSO_F VSTRWQSSO_F VDDUPQ VDDUPQ_M VDWDUPQ
- VDWDUPQ_M VIDUPQ VIDUPQ_M VIWDUPQ VIWDUPQ_M
- VSTRWQSBWB_S VSTRWQSBWB_U VLDRWQGBWB_S VLDRWQGBWB_U
- VSTRWQSBWB_F VLDRWQGBWB_F VSTRDQSBWB_S VSTRDQSBWB_U
- VLDRDQGBWB_S VLDRDQGBWB_U VADCQ_U VADCQ_M_U VADCQ_S
- VADCQ_M_S VSBCIQ_U VSBCIQ_S VSBCIQ_M_U VSBCIQ_M_S
- VSBCQ_U VSBCQ_S VSBCQ_M_U VSBCQ_M_S VADCIQ_U VADCIQ_M_U
- VADCIQ_S VADCIQ_M_S VLD2Q VLD4Q VST2Q SRSHRL SRSHR
- URSHR URSHRL SQRSHR UQRSHL UQRSHLL_64 VSHLCQ_M_U
- UQRSHLL_48 SQRSHRL_64 SQRSHRL_48 VSHLCQ_M_S])
-
-(define_mode_attr MVE_CNVT [(V8HI "V8HF") (V4SI "V4SF") (V8HF "V8HI")
- (V4SF "V4SI")])
-
-(define_int_attr supf [(VCVTQ_TO_F_S "s") (VCVTQ_TO_F_U "u") (VREV16Q_S "s")
- (VREV16Q_U "u") (VMVNQ_N_S "s") (VMVNQ_N_U "u")
- (VCVTAQ_U "u") (VCVTAQ_S "s") (VREV64Q_S "s")
- (VREV64Q_U "u") (VMVNQ_S "s") (VMVNQ_U "u")
- (VDUPQ_N_U "u") (VDUPQ_N_S"s") (VADDVQ_S "s")
- (VADDVQ_U "u") (VADDVQ_S "s") (VADDVQ_U "u")
- (VMOVLTQ_U "u") (VMOVLTQ_S "s") (VMOVLBQ_S "s")
- (VMOVLBQ_U "u") (VCVTQ_FROM_F_S "s") (VCVTQ_FROM_F_U "u")
- (VCVTPQ_S "s") (VCVTPQ_U "u") (VCVTNQ_S "s")
- (VCVTNQ_U "u") (VCVTMQ_S "s") (VCVTMQ_U "u")
- (VCLZQ_U "u") (VCLZQ_S "s") (VREV32Q_U "u")
- (VREV32Q_S "s") (VADDLVQ_U "u") (VADDLVQ_S "s")
- (VCVTQ_N_TO_F_S "s") (VCVTQ_N_TO_F_U "u")
- (VCREATEQ_U "u") (VCREATEQ_S "s") (VSHRQ_N_S "s")
- (VSHRQ_N_U "u") (VCVTQ_N_FROM_F_S "s") (VSHLQ_U "u")
- (VCVTQ_N_FROM_F_U "u") (VADDLVQ_P_S "s") (VSHLQ_S "s")
- (VADDLVQ_P_U "u") (VCMPNEQ_U "u") (VCMPNEQ_S "s")
- (VABDQ_M_S "s") (VABDQ_M_U "u") (VABDQ_S "s")
- (VABDQ_U "u") (VADDQ_N_S "s") (VADDQ_N_U "u")
- (VADDVQ_P_S "s") (VADDVQ_P_U "u") (VANDQ_S "s")
- (VANDQ_U "u") (VBICQ_S "s") (VBICQ_U "u")
- (VBRSRQ_N_S "s") (VBRSRQ_N_U "u") (VCADDQ_ROT270_S "s")
- (VCADDQ_ROT270_U "u") (VCADDQ_ROT90_S "s")
- (VCMPEQQ_S "s") (VCMPEQQ_U "u") (VCADDQ_ROT90_U "u")
- (VCMPEQQ_N_S "s") (VCMPEQQ_N_U "u") (VCMPNEQ_N_S "s")
- (VCMPNEQ_N_U "u") (VEORQ_S "s") (VEORQ_U "u")
- (VHADDQ_N_S "s") (VHADDQ_N_U "u") (VHADDQ_S "s")
- (VHADDQ_U "u") (VHSUBQ_N_S "s") (VHSUBQ_N_U "u")
- (VHSUBQ_S "s") (VMAXQ_S "s") (VMAXQ_U "u") (VHSUBQ_U "u")
- (VMAXVQ_S "s") (VMAXVQ_U "u") (VMINQ_S "s") (VMINQ_U "u")
- (VMINVQ_S "s") (VMINVQ_U "u") (VMLADAVQ_S "s")
- (VMLADAVQ_U "u") (VMULHQ_S "s") (VMULHQ_U "u")
- (VMULLBQ_INT_S "s") (VMULLBQ_INT_U "u") (VQADDQ_S "s")
- (VMULLTQ_INT_S "s") (VMULLTQ_INT_U "u") (VQADDQ_U "u")
- (VMULQ_N_S "s") (VMULQ_N_U "u") (VMULQ_S "s")
- (VMULQ_U "u") (VORNQ_S "s") (VORNQ_U "u") (VORRQ_S "s")
- (VORRQ_U "u") (VQADDQ_N_S "s") (VQADDQ_N_U "u")
- (VQRSHLQ_N_S "s") (VQRSHLQ_N_U "u") (VQRSHLQ_S "s")
- (VQRSHLQ_U "u") (VQSHLQ_N_S "s") (VQSHLQ_N_U "u")
- (VQSHLQ_R_S "s") (VQSHLQ_R_U "u") (VQSHLQ_S "s")
- (VQSHLQ_U "u") (VQSUBQ_N_S "s") (VQSUBQ_N_U "u")
- (VQSUBQ_S "s") (VQSUBQ_U "u") (VRHADDQ_S "s")
- (VRHADDQ_U "u") (VRMULHQ_S "s") (VRMULHQ_U "u")
- (VRSHLQ_N_S "s") (VRSHLQ_N_U "u") (VRSHLQ_S "s")
- (VRSHLQ_U "u") (VRSHRQ_N_S "s") (VRSHRQ_N_U "u")
- (VSHLQ_N_S "s") (VSHLQ_N_U "u") (VSHLQ_R_S "s")
- (VSHLQ_R_U "u") (VSUBQ_N_S "s") (VSUBQ_N_U "u")
- (VSUBQ_S "s") (VSUBQ_U "u") (VADDVAQ_S "s")
- (VADDVAQ_U "u") (VADDLVAQ_S "s") (VADDLVAQ_U "u")
- (VBICQ_N_S "s") (VBICQ_N_U "u") (VMLALDAVQ_U "u")
- (VMLALDAVQ_S "s") (VMLALDAVXQ_U "u") (VMLALDAVXQ_S "s")
- (VMOVNBQ_U "u") (VMOVNBQ_S "s") (VMOVNTQ_U "u")
- (VMOVNTQ_S "s") (VORRQ_N_S "s") (VORRQ_N_U "u")
- (VQMOVNBQ_U "u") (VQMOVNBQ_S "s") (VQMOVNTQ_S "s")
- (VQMOVNTQ_U "u") (VSHLLBQ_N_U "u") (VSHLLBQ_N_S "s")
- (VSHLLTQ_N_U "u") (VSHLLTQ_N_S "s") (VRMLALDAVHQ_U "u")
- (VRMLALDAVHQ_S "s") (VBICQ_M_N_S "s") (VBICQ_M_N_U "u")
- (VCVTAQ_M_S "s") (VCVTAQ_M_U "u") (VCVTQ_M_TO_F_S "s")
- (VCVTQ_M_TO_F_U "u") (VQRSHRNBQ_N_S "s")
- (VQRSHRNBQ_N_U "u") (VABAVQ_S "s") (VABAVQ_U "u")
- (VRMLALDAVHAQ_U "u") (VRMLALDAVHAQ_S "s") (VSHLCQ_S "s")
- (VSHLCQ_U "u") (VADDVAQ_P_S "s") (VADDVAQ_P_U "u")
- (VCLZQ_M_S "s") (VCLZQ_M_U "u") (VCMPEQQ_M_N_S "s")
- (VCMPEQQ_M_N_U "u") (VCMPEQQ_M_S "s") (VCMPEQQ_M_U "u")
- (VCMPNEQ_M_N_S "s") (VCMPNEQ_M_N_U "u") (VCMPNEQ_M_S "s")
- (VCMPNEQ_M_U "u") (VDUPQ_M_N_S "s") (VDUPQ_M_N_U "u")
- (VMAXVQ_P_S "s") (VMAXVQ_P_U "u") (VMINVQ_P_S "s")
- (VMINVQ_P_U "u") (VMLADAVAQ_S "s") (VMLADAVAQ_U "u")
- (VMLADAVQ_P_S "s") (VMLADAVQ_P_U "u") (VMLAQ_N_S "s")
- (VMLAQ_N_U "u") (VMLASQ_N_S "s") (VMLASQ_N_U "u")
- (VMVNQ_M_S "s") (VMVNQ_M_U "u") (VPSELQ_S "s")
- (VPSELQ_U "u") (VQDMLAHQ_N_S "s") (VQDMLAHQ_N_U "u")
- (VQRDMLAHQ_N_S "s") (VQRDMLAHQ_N_U "u")
- (VQRDMLASHQ_N_S "s") (VQRDMLASHQ_N_U "u")
- (VQRSHLQ_M_N_S "s") (VQRSHLQ_M_N_U "u")
- (VQSHLQ_M_R_S "s") (VQSHLQ_M_R_U "u") (VSRIQ_N_S "s")
- (VREV64Q_M_S "s") (VREV64Q_M_U "u") (VSRIQ_N_U "u")
- (VRSHLQ_M_N_S "s") (VRSHLQ_M_N_U "u") (VSHLQ_M_R_S "s")
- (VSHLQ_M_R_U "u") (VSLIQ_N_S "s") (VSLIQ_N_U "u")
- (VMLALDAVQ_P_S "s") (VQMOVNBQ_M_S "s") (VMOVLTQ_M_S "s")
- (VMOVNBQ_M_S "s") (VRSHRNTQ_N_S "s") (VORRQ_M_N_S "s")
- (VREV32Q_M_S "s") (VQRSHRNTQ_N_S "s") (VMOVNTQ_M_S "s")
- (VMOVLBQ_M_S "s") (VMLALDAVAQ_S "s") (VQSHRNBQ_N_S "s")
- (VSHRNBQ_N_S "s") (VRSHRNBQ_N_S "s") (VMLALDAVXQ_P_S "s")
- (VQMOVNTQ_M_S "s") (VMVNQ_M_N_S "s") (VQSHRNTQ_N_S "s")
- (VMLALDAVAXQ_S "s") (VSHRNTQ_N_S "s") (VMLALDAVQ_P_U "u")
- (VQMOVNBQ_M_U "u") (VMOVLTQ_M_U "u") (VMOVNBQ_M_U "u")
- (VRSHRNTQ_N_U "u") (VORRQ_M_N_U "u") (VREV32Q_M_U "u")
- (VREV16Q_M_S "s") (VREV16Q_M_U "u")
- (VQRSHRNTQ_N_U "u") (VMOVNTQ_M_U "u") (VMOVLBQ_M_U "u")
- (VMLALDAVAQ_U "u") (VQSHRNBQ_N_U "u") (VSHRNBQ_N_U "u")
- (VRSHRNBQ_N_U "u") (VMLALDAVXQ_P_U "u")
- (VMVNQ_M_N_U "u") (VQSHRNTQ_N_U "u") (VMLALDAVAXQ_U "u")
- (VQMOVNTQ_M_U "u") (VSHRNTQ_N_U "u") (VCVTMQ_M_S "s")
- (VCVTMQ_M_U "u") (VCVTNQ_M_S "s") (VCVTNQ_M_U "u")
- (VCVTPQ_M_S "s") (VCVTPQ_M_U "u") (VADDLVAQ_P_S "s")
- (VCVTQ_M_N_FROM_F_U "u") (VCVTQ_M_FROM_F_S "s")
- (VCVTQ_M_FROM_F_U "u") (VRMLALDAVHQ_P_U "u")
- (VRMLALDAVHQ_P_S "s") (VADDLVAQ_P_U "u")
- (VCVTQ_M_N_FROM_F_S "s") (VABAVQ_P_U "u")
- (VABAVQ_P_S "s") (VSHLQ_M_S "s") (VSHLQ_M_U "u")
- (VSRIQ_M_N_S "s") (VSRIQ_M_N_U "u") (VSUBQ_M_S "s")
- (VSUBQ_M_U "u") (VCVTQ_M_N_TO_F_S "s")
- (VCVTQ_M_N_TO_F_U "u") (VADDQ_M_N_U "u")
- (VSHLQ_M_N_S "s") (VMAXQ_M_U "u") (VHSUBQ_M_N_U "u")
- (VMULQ_M_N_S "s") (VQSHLQ_M_U "u") (VRHADDQ_M_S "s")
- (VEORQ_M_U "u") (VSHRQ_M_N_U "u") (VCADDQ_ROT90_M_U "u")
- (VMLADAVAQ_P_U "u") (VEORQ_M_S "s") (VBRSRQ_M_N_S "s")
- (VMULQ_M_U "u") (VQRDMLAHQ_M_N_S "s") (VHSUBQ_M_N_S "s")
- (VQRSHLQ_M_S "s") (VMULQ_M_N_U "u")
- (VMULQ_M_S "s") (VQSHLQ_M_N_U "u") (VSLIQ_M_N_U "u")
- (VMLADAVAQ_P_S "s") (VQRSHLQ_M_U "u")
- (VMULLBQ_INT_M_U "u") (VSHLQ_M_N_U "u") (VQSUBQ_M_U "u")
- (VQRDMLASHQ_M_N_U "u") (VRSHRQ_M_N_S "s")
- (VORNQ_M_S "s") (VCADDQ_ROT270_M_S "s") (VRHADDQ_M_U "u")
- (VRSHRQ_M_N_U "u") (VMLASQ_M_N_U "u") (VHSUBQ_M_U "u")
- (VQSUBQ_M_N_S "s") (VMULLTQ_INT_M_S "s")
- (VORRQ_M_S "s") (VQDMLAHQ_M_N_U "u") (VRSHLQ_M_S "s")
- (VHADDQ_M_U "u") (VHADDQ_M_N_S "s") (VMULLTQ_INT_M_U "u")
- (VORRQ_M_U "u") (VHADDQ_M_S "s") (VHADDQ_M_N_U "u")
- (VQDMLAHQ_M_N_S "s") (VMAXQ_M_S "s") (VORNQ_M_U "u")
- (VCADDQ_ROT270_M_U "u") (VQADDQ_M_U "u")
- (VQRDMLASHQ_M_N_S "s") (VBICQ_M_U "u") (VMINQ_M_U "u")
- (VSUBQ_M_N_S "s") (VMULLBQ_INT_M_S "s") (VQSUBQ_M_S "s")
- (VCADDQ_ROT90_M_S "s") (VRMULHQ_M_S "s") (VANDQ_M_U "u")
- (VMULHQ_M_S "s") (VADDQ_M_S "s") (VQRDMLAHQ_M_N_U "u")
- (VMLASQ_M_N_S "s") (VHSUBQ_M_S "s") (VRMULHQ_M_U "u")
- (VQADDQ_M_N_S "s") (VSHRQ_M_N_S "s") (VANDQ_M_S "s")
- (VABDQ_M_U "u") (VQSHLQ_M_S "s") (VABDQ_M_S "s")
- (VSUBQ_M_N_U "u") (VMLAQ_M_N_S "s") (VBRSRQ_M_N_U "u")
- (VADDQ_M_U "u") (VRSHLQ_M_U "u") (VSLIQ_M_N_S "s")
- (VQADDQ_M_N_U "u") (VADDQ_M_N_S "s") (VQSUBQ_M_N_U "u")
- (VMLAQ_M_N_U "u") (VMINQ_M_S "s") (VMULHQ_M_U "u")
- (VQADDQ_M_S "s") (VBICQ_M_S "s") (VQSHLQ_M_N_S "s")
- (VQSHRNTQ_M_N_S "s") (VQSHRNTQ_M_N_U "u")
- (VSHRNTQ_M_N_U "u") (VSHRNTQ_M_N_S "s")
- (VSHRNBQ_M_N_S "s") (VSHRNBQ_M_N_U "u")
- (VSHLLTQ_M_N_S "s") (VSHLLTQ_M_N_U "u")
- (VSHLLBQ_M_N_S "s") (VSHLLBQ_M_N_U "u")
- (VRSHRNTQ_M_N_S "s") (VRSHRNTQ_M_N_U "u")
- (VRSHRNBQ_M_N_U "u") (VRSHRNBQ_M_N_S "s")
- (VQSHRNTQ_M_N_U "u") (VQSHRNTQ_M_N_S "s")
- (VQSHRNBQ_M_N_S "s") (VQSHRNBQ_M_N_U "u")
- (VQRSHRNTQ_M_N_S "s") (VQRSHRNTQ_M_N_U "u")
- (VQRSHRNBQ_M_N_S "s") (VQRSHRNBQ_M_N_U "u")
- (VMLALDAVAXQ_P_S "s") (VMLALDAVAXQ_P_U "u")
- (VMLALDAVAQ_P_S "s") (VMLALDAVAQ_P_U "u")
- (VSTRWQSB_S "s") (VSTRWQSB_U "u") (VSTRBQSO_S "s")
- (VSTRBQSO_U "u") (VSTRBQ_S "s") (VSTRBQ_U "u")
- (VLDRBQGO_S "s") (VLDRBQGO_U "u") (VLDRBQ_S "s")
- (VLDRBQ_U "u") (VLDRWQGB_S "s") (VLDRWQGB_U "u")
- (VLD1Q_S "s") (VLD1Q_U "u") (VLDRHQGO_S "s")
- (VLDRHQGO_U "u") (VLDRHQGSO_S "s") (VLDRHQGSO_U "u")
- (VLDRHQ_S "s") (VLDRHQ_U "u") (VLDRWQ_S "s")
- (VLDRWQ_U "u") (VLDRDQGB_S "s") (VLDRDQGB_U "u")
- (VLDRDQGO_S "s") (VLDRDQGO_U "u") (VLDRDQGSO_S "s")
- (VLDRDQGSO_U "u") (VLDRWQGO_S "s") (VLDRWQGO_U "u")
- (VLDRWQGSO_S "s") (VLDRWQGSO_U "u") (VST1Q_S "s")
- (VST1Q_U "u") (VSTRHQSO_S "s") (VSTRHQSO_U "u")
- (VSTRHQSSO_S "s") (VSTRHQSSO_U "u") (VSTRHQ_S "s")
- (VSTRHQ_U "u") (VSTRWQ_S "s") (VSTRWQ_U "u")
- (VSTRDQSB_S "s") (VSTRDQSB_U "u") (VSTRDQSO_S "s")
- (VSTRDQSO_U "u") (VSTRDQSSO_S "s") (VSTRDQSSO_U "u")
- (VSTRWQSO_U "u") (VSTRWQSO_S "s") (VSTRWQSSO_U "u")
- (VSTRWQSSO_S "s") (VSTRWQSBWB_S "s") (VSTRWQSBWB_U "u")
- (VLDRWQGBWB_S "s") (VLDRWQGBWB_U "u") (VLDRDQGBWB_S "s")
- (VLDRDQGBWB_U "u") (VSTRDQSBWB_S "s") (VADCQ_M_S "s")
- (VSTRDQSBWB_U "u") (VSBCQ_U "u") (VSBCQ_M_U "u")
- (VSBCQ_S "s") (VSBCQ_M_S "s") (VSBCIQ_U "u")
- (VSBCIQ_M_U "u") (VSBCIQ_S "s") (VSBCIQ_M_S "s")
- (VADCQ_U "u") (VADCQ_M_U "u") (VADCQ_S "s")
- (VADCIQ_U "u") (VADCIQ_M_U "u") (VADCIQ_S "s")
- (VADCIQ_M_S "s") (SQRSHRL_64 "64") (SQRSHRL_48 "48")
- (UQRSHLL_64 "64") (UQRSHLL_48 "48") (VSHLCQ_M_S "s")
- (VSHLCQ_M_U "u")])
-
-(define_int_attr mode1 [(VCTP8Q "8") (VCTP16Q "16") (VCTP32Q "32")
- (VCTP64Q "64") (VCTP8Q_M "8") (VCTP16Q_M "16")
- (VCTP32Q_M "32") (VCTP64Q_M "64")])
-(define_mode_attr MVE_pred2 [(V16QI "mve_imm_8") (V8HI "mve_imm_16")
- (V4SI "mve_imm_32")
- (V8HF "mve_imm_16") (V4SF "mve_imm_32")])
-(define_mode_attr MVE_constraint2 [(V16QI "Rb") (V8HI "Rd") (V4SI "Rf")
- (V8HF "Rd") (V4SF "Rf")])
-(define_mode_attr MVE_LANES [(V16QI "16") (V8HI "8") (V4SI "4")])
-(define_mode_attr MVE_constraint [ (V16QI "Ra") (V8HI "Rc") (V4SI "Re")])
-(define_mode_attr MVE_pred [ (V16QI "mve_imm_7") (V8HI "mve_imm_15")
- (V4SI "mve_imm_31")])
-(define_mode_attr MVE_constraint3 [ (V8HI "Rb") (V4SI "Rd")])
-(define_mode_attr MVE_pred3 [ (V8HI "mve_imm_8") (V4SI "mve_imm_16")])
-(define_mode_attr MVE_constraint1 [ (V8HI "Ra") (V4SI "Rc")])
-(define_mode_attr MVE_pred1 [ (V8HI "mve_imm_7") (V4SI "mve_imm_15")])
-(define_mode_attr MVE_B_ELEM [ (V16QI "V16QI") (V8HI "V8QI") (V4SI "V4QI")])
-(define_mode_attr MVE_H_ELEM [ (V8HI "V8HI") (V4SI "V4HI")])
-(define_mode_attr V_sz_elem1 [(V16QI "b") (V8HI "h") (V4SI "w") (V8HF "h")
- (V4SF "w")])
-(define_mode_attr V_extr_elem [(V16QI "u8") (V8HI "u16") (V4SI "32")
- (V8HF "u16") (V4SF "32")])
-
-(define_mode_attr earlyclobber_32 [(V16QI "=w") (V8HI "=w") (V4SI "=&w")
- (V8HF "=w") (V4SF "=&w")])
-
-(define_int_iterator VCVTQ_TO_F [VCVTQ_TO_F_S VCVTQ_TO_F_U])
-(define_int_iterator VMVNQ_N [VMVNQ_N_U VMVNQ_N_S])
-(define_int_iterator VREV64Q [VREV64Q_S VREV64Q_U])
-(define_int_iterator VCVTQ_FROM_F [VCVTQ_FROM_F_S VCVTQ_FROM_F_U])
-(define_int_iterator VREV16Q [VREV16Q_U VREV16Q_S])
-(define_int_iterator VCVTAQ [VCVTAQ_U VCVTAQ_S])
-(define_int_iterator VMVNQ [VMVNQ_U VMVNQ_S])
-(define_int_iterator VDUPQ_N [VDUPQ_N_U VDUPQ_N_S])
-(define_int_iterator VCLZQ [VCLZQ_U VCLZQ_S])
-(define_int_iterator VADDVQ [VADDVQ_U VADDVQ_S])
-(define_int_iterator VREV32Q [VREV32Q_U VREV32Q_S])
-(define_int_iterator VMOVLBQ [VMOVLBQ_S VMOVLBQ_U])
-(define_int_iterator VMOVLTQ [VMOVLTQ_U VMOVLTQ_S])
-(define_int_iterator VCVTPQ [VCVTPQ_S VCVTPQ_U])
-(define_int_iterator VCVTNQ [VCVTNQ_S VCVTNQ_U])
-(define_int_iterator VCVTMQ [VCVTMQ_S VCVTMQ_U])
-(define_int_iterator VADDLVQ [VADDLVQ_U VADDLVQ_S])
-(define_int_iterator VCTPQ [VCTP8Q VCTP16Q VCTP32Q VCTP64Q])
-(define_int_iterator VCTPQ_M [VCTP8Q_M VCTP16Q_M VCTP32Q_M VCTP64Q_M])
-(define_int_iterator VCVTQ_N_TO_F [VCVTQ_N_TO_F_S VCVTQ_N_TO_F_U])
-(define_int_iterator VCREATEQ [VCREATEQ_U VCREATEQ_S])
-(define_int_iterator VSHRQ_N [VSHRQ_N_S VSHRQ_N_U])
-(define_int_iterator VCVTQ_N_FROM_F [VCVTQ_N_FROM_F_S VCVTQ_N_FROM_F_U])
-(define_int_iterator VADDLVQ_P [VADDLVQ_P_S VADDLVQ_P_U])
-(define_int_iterator VCMPNEQ [VCMPNEQ_U VCMPNEQ_S])
-(define_int_iterator VSHLQ [VSHLQ_S VSHLQ_U])
-(define_int_iterator VABDQ [VABDQ_S VABDQ_U])
-(define_int_iterator VADDQ_N [VADDQ_N_S VADDQ_N_U])
-(define_int_iterator VADDVAQ [VADDVAQ_S VADDVAQ_U])
-(define_int_iterator VADDVQ_P [VADDVQ_P_U VADDVQ_P_S])
-(define_int_iterator VANDQ [VANDQ_U VANDQ_S])
-(define_int_iterator VBICQ [VBICQ_S VBICQ_U])
-(define_int_iterator VBRSRQ_N [VBRSRQ_N_U VBRSRQ_N_S])
-(define_int_iterator VCADDQ_ROT270 [VCADDQ_ROT270_S VCADDQ_ROT270_U])
-(define_int_iterator VCADDQ_ROT90 [VCADDQ_ROT90_U VCADDQ_ROT90_S])
-(define_int_iterator VCMPEQQ [VCMPEQQ_U VCMPEQQ_S])
-(define_int_iterator VCMPEQQ_N [VCMPEQQ_N_S VCMPEQQ_N_U])
-(define_int_iterator VCMPNEQ_N [VCMPNEQ_N_U VCMPNEQ_N_S])
-(define_int_iterator VEORQ [VEORQ_U VEORQ_S])
-(define_int_iterator VHADDQ [VHADDQ_S VHADDQ_U])
-(define_int_iterator VHADDQ_N [VHADDQ_N_U VHADDQ_N_S])
-(define_int_iterator VHSUBQ [VHSUBQ_S VHSUBQ_U])
-(define_int_iterator VHSUBQ_N [VHSUBQ_N_U VHSUBQ_N_S])
-(define_int_iterator VMAXQ [VMAXQ_U VMAXQ_S])
-(define_int_iterator VMAXVQ [VMAXVQ_U VMAXVQ_S])
-(define_int_iterator VMINQ [VMINQ_S VMINQ_U])
-(define_int_iterator VMINVQ [VMINVQ_U VMINVQ_S])
-(define_int_iterator VMLADAVQ [VMLADAVQ_U VMLADAVQ_S])
-(define_int_iterator VMULHQ [VMULHQ_S VMULHQ_U])
-(define_int_iterator VMULLBQ_INT [VMULLBQ_INT_U VMULLBQ_INT_S])
-(define_int_iterator VMULLTQ_INT [VMULLTQ_INT_U VMULLTQ_INT_S])
-(define_int_iterator VMULQ [VMULQ_U VMULQ_S])
-(define_int_iterator VMULQ_N [VMULQ_N_U VMULQ_N_S])
-(define_int_iterator VORNQ [VORNQ_U VORNQ_S])
-(define_int_iterator VORRQ [VORRQ_S VORRQ_U])
-(define_int_iterator VQADDQ [VQADDQ_U VQADDQ_S])
-(define_int_iterator VQADDQ_N [VQADDQ_N_S VQADDQ_N_U])
-(define_int_iterator VQRSHLQ [VQRSHLQ_S VQRSHLQ_U])
-(define_int_iterator VQRSHLQ_N [VQRSHLQ_N_S VQRSHLQ_N_U])
-(define_int_iterator VQSHLQ [VQSHLQ_S VQSHLQ_U])
-(define_int_iterator VQSHLQ_N [VQSHLQ_N_S VQSHLQ_N_U])
-(define_int_iterator VQSHLQ_R [VQSHLQ_R_U VQSHLQ_R_S])
-(define_int_iterator VQSUBQ [VQSUBQ_U VQSUBQ_S])
-(define_int_iterator VQSUBQ_N [VQSUBQ_N_S VQSUBQ_N_U])
-(define_int_iterator VRHADDQ [VRHADDQ_S VRHADDQ_U])
-(define_int_iterator VRMULHQ [VRMULHQ_S VRMULHQ_U])
-(define_int_iterator VRSHLQ [VRSHLQ_S VRSHLQ_U])
-(define_int_iterator VRSHLQ_N [VRSHLQ_N_U VRSHLQ_N_S])
-(define_int_iterator VRSHRQ_N [VRSHRQ_N_S VRSHRQ_N_U])
-(define_int_iterator VSHLQ_N [VSHLQ_N_U VSHLQ_N_S])
-(define_int_iterator VSHLQ_R [VSHLQ_R_S VSHLQ_R_U])
-(define_int_iterator VSUBQ [VSUBQ_S VSUBQ_U])
-(define_int_iterator VSUBQ_N [VSUBQ_N_S VSUBQ_N_U])
-(define_int_iterator VADDLVAQ [VADDLVAQ_S VADDLVAQ_U])
-(define_int_iterator VBICQ_N [VBICQ_N_S VBICQ_N_U])
-(define_int_iterator VMLALDAVQ [VMLALDAVQ_U VMLALDAVQ_S])
-(define_int_iterator VMLALDAVXQ [VMLALDAVXQ_U VMLALDAVXQ_S])
-(define_int_iterator VMOVNBQ [VMOVNBQ_U VMOVNBQ_S])
-(define_int_iterator VMOVNTQ [VMOVNTQ_S VMOVNTQ_U])
-(define_int_iterator VORRQ_N [VORRQ_N_U VORRQ_N_S])
-(define_int_iterator VQMOVNBQ [VQMOVNBQ_U VQMOVNBQ_S])
-(define_int_iterator VQMOVNTQ [VQMOVNTQ_U VQMOVNTQ_S])
-(define_int_iterator VSHLLBQ_N [VSHLLBQ_N_S VSHLLBQ_N_U])
-(define_int_iterator VSHLLTQ_N [VSHLLTQ_N_U VSHLLTQ_N_S])
-(define_int_iterator VRMLALDAVHQ [VRMLALDAVHQ_U VRMLALDAVHQ_S])
-(define_int_iterator VBICQ_M_N [VBICQ_M_N_S VBICQ_M_N_U])
-(define_int_iterator VCVTAQ_M [VCVTAQ_M_S VCVTAQ_M_U])
-(define_int_iterator VCVTQ_M_TO_F [VCVTQ_M_TO_F_S VCVTQ_M_TO_F_U])
-(define_int_iterator VQRSHRNBQ_N [VQRSHRNBQ_N_U VQRSHRNBQ_N_S])
-(define_int_iterator VABAVQ [VABAVQ_S VABAVQ_U])
-(define_int_iterator VSHLCQ [VSHLCQ_S VSHLCQ_U])
-(define_int_iterator VRMLALDAVHAQ [VRMLALDAVHAQ_S VRMLALDAVHAQ_U])
-(define_int_iterator VADDVAQ_P [VADDVAQ_P_S VADDVAQ_P_U])
-(define_int_iterator VCLZQ_M [VCLZQ_M_S VCLZQ_M_U])
-(define_int_iterator VCMPEQQ_M_N [VCMPEQQ_M_N_S VCMPEQQ_M_N_U])
-(define_int_iterator VCMPEQQ_M [VCMPEQQ_M_S VCMPEQQ_M_U])
-(define_int_iterator VCMPNEQ_M_N [VCMPNEQ_M_N_S VCMPNEQ_M_N_U])
-(define_int_iterator VCMPNEQ_M [VCMPNEQ_M_S VCMPNEQ_M_U])
-(define_int_iterator VDUPQ_M_N [VDUPQ_M_N_S VDUPQ_M_N_U])
-(define_int_iterator VMAXVQ_P [VMAXVQ_P_S VMAXVQ_P_U])
-(define_int_iterator VMINVQ_P [VMINVQ_P_S VMINVQ_P_U])
-(define_int_iterator VMLADAVAQ [VMLADAVAQ_S VMLADAVAQ_U])
-(define_int_iterator VMLADAVQ_P [VMLADAVQ_P_S VMLADAVQ_P_U])
-(define_int_iterator VMLAQ_N [VMLAQ_N_S VMLAQ_N_U])
-(define_int_iterator VMLASQ_N [VMLASQ_N_S VMLASQ_N_U])
-(define_int_iterator VMVNQ_M [VMVNQ_M_S VMVNQ_M_U])
-(define_int_iterator VPSELQ [VPSELQ_S VPSELQ_U])
-(define_int_iterator VQDMLAHQ_N [VQDMLAHQ_N_S VQDMLAHQ_N_U])
-(define_int_iterator VQRDMLAHQ_N [VQRDMLAHQ_N_S VQRDMLAHQ_N_U])
-(define_int_iterator VQRDMLASHQ_N [VQRDMLASHQ_N_S VQRDMLASHQ_N_U])
-(define_int_iterator VQRSHLQ_M_N [VQRSHLQ_M_N_S VQRSHLQ_M_N_U])
-(define_int_iterator VQSHLQ_M_R [VQSHLQ_M_R_S VQSHLQ_M_R_U])
-(define_int_iterator VREV64Q_M [VREV64Q_M_S VREV64Q_M_U])
-(define_int_iterator VRSHLQ_M_N [VRSHLQ_M_N_S VRSHLQ_M_N_U])
-(define_int_iterator VSHLQ_M_R [VSHLQ_M_R_S VSHLQ_M_R_U])
-(define_int_iterator VSLIQ_N [VSLIQ_N_S VSLIQ_N_U])
-(define_int_iterator VSRIQ_N [VSRIQ_N_S VSRIQ_N_U])
-(define_int_iterator VMLALDAVQ_P [VMLALDAVQ_P_U VMLALDAVQ_P_S])
-(define_int_iterator VQMOVNBQ_M [VQMOVNBQ_M_S VQMOVNBQ_M_U])
-(define_int_iterator VMOVLTQ_M [VMOVLTQ_M_U VMOVLTQ_M_S])
-(define_int_iterator VMOVNBQ_M [VMOVNBQ_M_U VMOVNBQ_M_S])
-(define_int_iterator VRSHRNTQ_N [VRSHRNTQ_N_U VRSHRNTQ_N_S])
-(define_int_iterator VORRQ_M_N [VORRQ_M_N_S VORRQ_M_N_U])
-(define_int_iterator VREV32Q_M [VREV32Q_M_S VREV32Q_M_U])
-(define_int_iterator VREV16Q_M [VREV16Q_M_S VREV16Q_M_U])
-(define_int_iterator VQRSHRNTQ_N [VQRSHRNTQ_N_U VQRSHRNTQ_N_S])
-(define_int_iterator VMOVNTQ_M [VMOVNTQ_M_U VMOVNTQ_M_S])
-(define_int_iterator VMOVLBQ_M [VMOVLBQ_M_U VMOVLBQ_M_S])
-(define_int_iterator VMLALDAVAQ [VMLALDAVAQ_S VMLALDAVAQ_U])
-(define_int_iterator VQSHRNBQ_N [VQSHRNBQ_N_U VQSHRNBQ_N_S])
-(define_int_iterator VSHRNBQ_N [VSHRNBQ_N_U VSHRNBQ_N_S])
-(define_int_iterator VRSHRNBQ_N [VRSHRNBQ_N_S VRSHRNBQ_N_U])
-(define_int_iterator VMLALDAVXQ_P [VMLALDAVXQ_P_U VMLALDAVXQ_P_S])
-(define_int_iterator VQMOVNTQ_M [VQMOVNTQ_M_U VQMOVNTQ_M_S])
-(define_int_iterator VMVNQ_M_N [VMVNQ_M_N_U VMVNQ_M_N_S])
-(define_int_iterator VQSHRNTQ_N [VQSHRNTQ_N_U VQSHRNTQ_N_S])
-(define_int_iterator VMLALDAVAXQ [VMLALDAVAXQ_S VMLALDAVAXQ_U])
-(define_int_iterator VSHRNTQ_N [VSHRNTQ_N_S VSHRNTQ_N_U])
-(define_int_iterator VCVTMQ_M [VCVTMQ_M_S VCVTMQ_M_U])
-(define_int_iterator VCVTNQ_M [VCVTNQ_M_S VCVTNQ_M_U])
-(define_int_iterator VCVTPQ_M [VCVTPQ_M_S VCVTPQ_M_U])
-(define_int_iterator VCVTQ_M_N_FROM_F [VCVTQ_M_N_FROM_F_S VCVTQ_M_N_FROM_F_U])
-(define_int_iterator VCVTQ_M_FROM_F [VCVTQ_M_FROM_F_U VCVTQ_M_FROM_F_S])
-(define_int_iterator VRMLALDAVHQ_P [VRMLALDAVHQ_P_S VRMLALDAVHQ_P_U])
-(define_int_iterator VADDLVAQ_P [VADDLVAQ_P_U VADDLVAQ_P_S])
-(define_int_iterator VABAVQ_P [VABAVQ_P_S VABAVQ_P_U])
-(define_int_iterator VSHLQ_M [VSHLQ_M_S VSHLQ_M_U])
-(define_int_iterator VSRIQ_M_N [VSRIQ_M_N_S VSRIQ_M_N_U])
-(define_int_iterator VSUBQ_M [VSUBQ_M_U VSUBQ_M_S])
-(define_int_iterator VCVTQ_M_N_TO_F [VCVTQ_M_N_TO_F_U VCVTQ_M_N_TO_F_S])
-(define_int_iterator VHSUBQ_M [VHSUBQ_M_S VHSUBQ_M_U])
-(define_int_iterator VSLIQ_M_N [VSLIQ_M_N_U VSLIQ_M_N_S])
-(define_int_iterator VRSHLQ_M [VRSHLQ_M_S VRSHLQ_M_U])
-(define_int_iterator VMINQ_M [VMINQ_M_S VMINQ_M_U])
-(define_int_iterator VMULLBQ_INT_M [VMULLBQ_INT_M_U VMULLBQ_INT_M_S])
-(define_int_iterator VMULHQ_M [VMULHQ_M_S VMULHQ_M_U])
-(define_int_iterator VMULQ_M [VMULQ_M_S VMULQ_M_U])
-(define_int_iterator VHSUBQ_M_N [VHSUBQ_M_N_S VHSUBQ_M_N_U])
-(define_int_iterator VHADDQ_M_N [VHADDQ_M_N_S VHADDQ_M_N_U])
-(define_int_iterator VORRQ_M [VORRQ_M_S VORRQ_M_U])
-(define_int_iterator VRMULHQ_M [VRMULHQ_M_U VRMULHQ_M_S])
-(define_int_iterator VQADDQ_M [VQADDQ_M_U VQADDQ_M_S])
-(define_int_iterator VRSHRQ_M_N [VRSHRQ_M_N_S VRSHRQ_M_N_U])
-(define_int_iterator VQSUBQ_M_N [VQSUBQ_M_N_U VQSUBQ_M_N_S])
-(define_int_iterator VADDQ_M [VADDQ_M_U VADDQ_M_S])
-(define_int_iterator VORNQ_M [VORNQ_M_U VORNQ_M_S])
-(define_int_iterator VRHADDQ_M [VRHADDQ_M_U VRHADDQ_M_S])
-(define_int_iterator VQSHLQ_M [VQSHLQ_M_U VQSHLQ_M_S])
-(define_int_iterator VANDQ_M [VANDQ_M_U VANDQ_M_S])
-(define_int_iterator VBICQ_M [VBICQ_M_U VBICQ_M_S])
-(define_int_iterator VSHLQ_M_N [VSHLQ_M_N_S VSHLQ_M_N_U])
-(define_int_iterator VCADDQ_ROT270_M [VCADDQ_ROT270_M_U VCADDQ_ROT270_M_S])
-(define_int_iterator VQRSHLQ_M [VQRSHLQ_M_U VQRSHLQ_M_S])
-(define_int_iterator VQADDQ_M_N [VQADDQ_M_N_U VQADDQ_M_N_S])
-(define_int_iterator VADDQ_M_N [VADDQ_M_N_S VADDQ_M_N_U])
-(define_int_iterator VMAXQ_M [VMAXQ_M_S VMAXQ_M_U])
-(define_int_iterator VQSUBQ_M [VQSUBQ_M_U VQSUBQ_M_S])
-(define_int_iterator VMLASQ_M_N [VMLASQ_M_N_U VMLASQ_M_N_S])
-(define_int_iterator VMLADAVAQ_P [VMLADAVAQ_P_U VMLADAVAQ_P_S])
-(define_int_iterator VBRSRQ_M_N [VBRSRQ_M_N_U VBRSRQ_M_N_S])
-(define_int_iterator VMULQ_M_N [VMULQ_M_N_U VMULQ_M_N_S])
-(define_int_iterator VCADDQ_ROT90_M [VCADDQ_ROT90_M_U VCADDQ_ROT90_M_S])
-(define_int_iterator VMULLTQ_INT_M [VMULLTQ_INT_M_S VMULLTQ_INT_M_U])
-(define_int_iterator VEORQ_M [VEORQ_M_S VEORQ_M_U])
-(define_int_iterator VSHRQ_M_N [VSHRQ_M_N_S VSHRQ_M_N_U])
-(define_int_iterator VSUBQ_M_N [VSUBQ_M_N_S VSUBQ_M_N_U])
-(define_int_iterator VHADDQ_M [VHADDQ_M_S VHADDQ_M_U])
-(define_int_iterator VABDQ_M [VABDQ_M_S VABDQ_M_U])
-(define_int_iterator VMLAQ_M_N [VMLAQ_M_N_S VMLAQ_M_N_U])
-(define_int_iterator VQSHLQ_M_N [VQSHLQ_M_N_S VQSHLQ_M_N_U])
-(define_int_iterator VMLALDAVAQ_P [VMLALDAVAQ_P_U VMLALDAVAQ_P_S])
-(define_int_iterator VMLALDAVAXQ_P [VMLALDAVAXQ_P_U VMLALDAVAXQ_P_S])
-(define_int_iterator VQRSHRNBQ_M_N [VQRSHRNBQ_M_N_U VQRSHRNBQ_M_N_S])
-(define_int_iterator VQRSHRNTQ_M_N [VQRSHRNTQ_M_N_S VQRSHRNTQ_M_N_U])
-(define_int_iterator VQSHRNBQ_M_N [VQSHRNBQ_M_N_U VQSHRNBQ_M_N_S])
-(define_int_iterator VQSHRNTQ_M_N [VQSHRNTQ_M_N_S VQSHRNTQ_M_N_U])
-(define_int_iterator VRSHRNBQ_M_N [VRSHRNBQ_M_N_U VRSHRNBQ_M_N_S])
-(define_int_iterator VRSHRNTQ_M_N [VRSHRNTQ_M_N_U VRSHRNTQ_M_N_S])
-(define_int_iterator VSHLLBQ_M_N [VSHLLBQ_M_N_U VSHLLBQ_M_N_S])
-(define_int_iterator VSHLLTQ_M_N [VSHLLTQ_M_N_U VSHLLTQ_M_N_S])
-(define_int_iterator VSHRNBQ_M_N [VSHRNBQ_M_N_S VSHRNBQ_M_N_U])
-(define_int_iterator VSHRNTQ_M_N [VSHRNTQ_M_N_S VSHRNTQ_M_N_U])
-(define_int_iterator VSTRWSBQ [VSTRWQSB_S VSTRWQSB_U])
-(define_int_iterator VSTRBSOQ [VSTRBQSO_S VSTRBQSO_U])
-(define_int_iterator VSTRBQ [VSTRBQ_S VSTRBQ_U])
-(define_int_iterator VLDRBGOQ [VLDRBQGO_S VLDRBQGO_U])
-(define_int_iterator VLDRBQ [VLDRBQ_S VLDRBQ_U])
-(define_int_iterator VLDRWGBQ [VLDRWQGB_S VLDRWQGB_U])
-(define_int_iterator VLD1Q [VLD1Q_S VLD1Q_U])
-(define_int_iterator VLDRHGOQ [VLDRHQGO_S VLDRHQGO_U])
-(define_int_iterator VLDRHGSOQ [VLDRHQGSO_S VLDRHQGSO_U])
-(define_int_iterator VLDRHQ [VLDRHQ_S VLDRHQ_U])
-(define_int_iterator VLDRWQ [VLDRWQ_S VLDRWQ_U])
-(define_int_iterator VLDRDGBQ [VLDRDQGB_S VLDRDQGB_U])
-(define_int_iterator VLDRDGOQ [VLDRDQGO_S VLDRDQGO_U])
-(define_int_iterator VLDRDGSOQ [VLDRDQGSO_S VLDRDQGSO_U])
-(define_int_iterator VLDRWGOQ [VLDRWQGO_S VLDRWQGO_U])
-(define_int_iterator VLDRWGSOQ [VLDRWQGSO_S VLDRWQGSO_U])
-(define_int_iterator VST1Q [VST1Q_S VST1Q_U])
-(define_int_iterator VSTRHSOQ [VSTRHQSO_S VSTRHQSO_U])
-(define_int_iterator VSTRHSSOQ [VSTRHQSSO_S VSTRHQSSO_U])
-(define_int_iterator VSTRHQ [VSTRHQ_S VSTRHQ_U])
-(define_int_iterator VSTRWQ [VSTRWQ_S VSTRWQ_U])
-(define_int_iterator VSTRDSBQ [VSTRDQSB_S VSTRDQSB_U])
-(define_int_iterator VSTRDSOQ [VSTRDQSO_S VSTRDQSO_U])
-(define_int_iterator VSTRDSSOQ [VSTRDQSSO_S VSTRDQSSO_U])
-(define_int_iterator VSTRWSOQ [VSTRWQSO_S VSTRWQSO_U])
-(define_int_iterator VSTRWSSOQ [VSTRWQSSO_S VSTRWQSSO_U])
-(define_int_iterator VSTRWSBWBQ [VSTRWQSBWB_S VSTRWQSBWB_U])
-(define_int_iterator VLDRWGBWBQ [VLDRWQGBWB_S VLDRWQGBWB_U])
-(define_int_iterator VSTRDSBWBQ [VSTRDQSBWB_S VSTRDQSBWB_U])
-(define_int_iterator VLDRDGBWBQ [VLDRDQGBWB_S VLDRDQGBWB_U])
-(define_int_iterator VADCIQ [VADCIQ_U VADCIQ_S])
-(define_int_iterator VADCIQ_M [VADCIQ_M_U VADCIQ_M_S])
-(define_int_iterator VSBCQ [VSBCQ_U VSBCQ_S])
-(define_int_iterator VSBCQ_M [VSBCQ_M_U VSBCQ_M_S])
-(define_int_iterator VSBCIQ [VSBCIQ_U VSBCIQ_S])
-(define_int_iterator VSBCIQ_M [VSBCIQ_M_U VSBCIQ_M_S])
-(define_int_iterator VADCQ [VADCQ_U VADCQ_S])
-(define_int_iterator VADCQ_M [VADCQ_M_U VADCQ_M_S])
-(define_int_iterator UQRSHLLQ [UQRSHLL_64 UQRSHLL_48])
-(define_int_iterator SQRSHRLQ [SQRSHRL_64 SQRSHRL_48])
-(define_int_iterator VSHLCQ_M [VSHLCQ_M_S VSHLCQ_M_U])
-
(define_insn "*mve_mov<mode>"
[(set (match_operand:MVE_types 0 "nonimmediate_operand" "=w,w,r,w,w,r,w,Ux,w")
(match_operand:MVE_types 1 "general_operand" "w,r,w,Dn,Uxi,r,Dm,w,Ul"))]
@@ -1977,15 +1329,25 @@
;;
;; [vmaxq_u, vmaxq_s])
;;
-(define_insn "mve_vmaxq_<supf><mode>"
+(define_insn "mve_vmaxq_s<mode>"
[
(set (match_operand:MVE_2 0 "s_register_operand" "=w")
- (unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand" "w")
- (match_operand:MVE_2 2 "s_register_operand" "w")]
- VMAXQ))
+ (smax:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w")
+ (match_operand:MVE_2 2 "s_register_operand" "w")))
+ ]
+ "TARGET_HAVE_MVE"
+ "vmax.%#<V_s_elem>\t%q0, %q1, %q2"
+ [(set_attr "type" "mve_move")
+])
+
+(define_insn "mve_vmaxq_u<mode>"
+ [
+ (set (match_operand:MVE_2 0 "s_register_operand" "=w")
+ (umax:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w")
+ (match_operand:MVE_2 2 "s_register_operand" "w")))
]
"TARGET_HAVE_MVE"
- "vmax.<supf>%#<V_sz_elem>\t%q0, %q1, %q2"
+ "vmax.%#<V_u_elem>\t%q0, %q1, %q2"
[(set_attr "type" "mve_move")
])
@@ -2037,15 +1399,25 @@
;;
;; [vminq_s, vminq_u])
;;
-(define_insn "mve_vminq_<supf><mode>"
+(define_insn "mve_vminq_s<mode>"
[
(set (match_operand:MVE_2 0 "s_register_operand" "=w")
- (unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand" "w")
- (match_operand:MVE_2 2 "s_register_operand" "w")]
- VMINQ))
+ (smin:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w")
+ (match_operand:MVE_2 2 "s_register_operand" "w")))
+ ]
+ "TARGET_HAVE_MVE"
+ "vmin.%#<V_s_elem>\t%q0, %q1, %q2"
+ [(set_attr "type" "mve_move")
+])
+
+(define_insn "mve_vminq_u<mode>"
+ [
+ (set (match_operand:MVE_2 0 "s_register_operand" "=w")
+ (umin:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w")
+ (match_operand:MVE_2 2 "s_register_operand" "w")))
]
"TARGET_HAVE_MVE"
- "vmin.<supf>%#<V_sz_elem>\t%q0, %q1, %q2"
+ "vmin.%#<V_u_elem>\t%q0, %q1, %q2"
[(set_attr "type" "mve_move")
])
@@ -2199,6 +1571,17 @@
[(set_attr "type" "mve_move")
])
+(define_insn "mve_vmulq<mode>"
+ [
+ (set (match_operand:MVE_2 0 "s_register_operand" "=w")
+ (mult:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w")
+ (match_operand:MVE_2 2 "s_register_operand" "w")))
+ ]
+ "TARGET_HAVE_MVE"
+ "vmul.i%#<V_sz_elem>\t%q0, %q1, %q2"
+ [(set_attr "type" "mve_move")
+])
+
;;
;; [vornq_u, vornq_s])
;;
@@ -2574,6 +1957,17 @@
[(set_attr "type" "mve_move")
])
+(define_insn "mve_vsubq<mode>"
+ [
+ (set (match_operand:MVE_2 0 "s_register_operand" "=w")
+ (minus:MVE_2 (match_operand:MVE_2 1 "s_register_operand" "w")
+ (match_operand:MVE_2 2 "s_register_operand" "w")))
+ ]
+ "TARGET_HAVE_MVE"
+ "vsub.i%#<V_sz_elem>\t%q0, %q1, %q2"
+ [(set_attr "type" "mve_move")
+])
+
;;
;; [vabdq_f])
;;
@@ -3030,9 +2424,8 @@
(define_insn "mve_vmaxnmq_f<mode>"
[
(set (match_operand:MVE_0 0 "s_register_operand" "=w")
- (unspec:MVE_0 [(match_operand:MVE_0 1 "s_register_operand" "w")
- (match_operand:MVE_0 2 "s_register_operand" "w")]
- VMAXNMQ_F))
+ (smax:MVE_0 (match_operand:MVE_0 1 "s_register_operand" "w")
+ (match_operand:MVE_0 2 "s_register_operand" "w")))
]
"TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
"vmaxnm.f%#<V_sz_elem> %q0, %q1, %q2"
@@ -3090,9 +2483,8 @@
(define_insn "mve_vminnmq_f<mode>"
[
(set (match_operand:MVE_0 0 "s_register_operand" "=w")
- (unspec:MVE_0 [(match_operand:MVE_0 1 "s_register_operand" "w")
- (match_operand:MVE_0 2 "s_register_operand" "w")]
- VMINNMQ_F))
+ (smin:MVE_0 (match_operand:MVE_0 1 "s_register_operand" "w")
+ (match_operand:MVE_0 2 "s_register_operand" "w")))
]
"TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
"vminnm.f%#<V_sz_elem> %q0, %q1, %q2"
@@ -3210,9 +2602,8 @@
(define_insn "mve_vmulq_f<mode>"
[
(set (match_operand:MVE_0 0 "s_register_operand" "=w")
- (unspec:MVE_0 [(match_operand:MVE_0 1 "s_register_operand" "w")
- (match_operand:MVE_0 2 "s_register_operand" "w")]
- VMULQ_F))
+ (mult:MVE_0 (match_operand:MVE_0 1 "s_register_operand" "w")
+ (match_operand:MVE_0 2 "s_register_operand" "w")))
]
"TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
"vmul.f%#<V_sz_elem> %q0, %q1, %q2"
@@ -3480,9 +2871,8 @@
(define_insn "mve_vsubq_f<mode>"
[
(set (match_operand:MVE_0 0 "s_register_operand" "=w")
- (unspec:MVE_0 [(match_operand:MVE_0 1 "s_register_operand" "w")
- (match_operand:MVE_0 2 "s_register_operand" "w")]
- VSUBQ_F))
+ (minus:MVE_0 (match_operand:MVE_0 1 "s_register_operand" "w")
+ (match_operand:MVE_0 2 "s_register_operand" "w")))
]
"TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
"vsub.f%#<V_sz_elem>\t%q0, %q1, %q2"
@@ -4310,7 +3700,7 @@
(set_attr "length""8")])
;;
-;; [vqdmlahq_n_s, vqdmlahq_n_u])
+;; [vqdmlahq_n_s])
;;
(define_insn "mve_vqdmlahq_n_<supf><mode>"
[
@@ -4326,6 +3716,22 @@
])
;;
+;; [vqdmlashq_n_s])
+;;
+(define_insn "mve_vqdmlashq_n_<supf><mode>"
+ [
+ (set (match_operand:MVE_2 0 "s_register_operand" "=w")
+ (unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand" "0")
+ (match_operand:MVE_2 2 "s_register_operand" "w")
+ (match_operand:<V_elem> 3 "s_register_operand" "r")]
+ VQDMLASHQ_N))
+ ]
+ "TARGET_HAVE_MVE"
+ "vqdmlash.s%#<V_sz_elem>\t%q0, %q2, %3"
+ [(set_attr "type" "mve_move")
+])
+
+;;
;; [vqnegq_m_s])
;;
(define_insn "mve_vqnegq_m_s<mode>"
@@ -4374,7 +3780,7 @@
])
;;
-;; [vqrdmlahq_n_s, vqrdmlahq_n_u])
+;; [vqrdmlahq_n_s])
;;
(define_insn "mve_vqrdmlahq_n_<supf><mode>"
[
@@ -4390,7 +3796,7 @@
])
;;
-;; [vqrdmlashq_n_s, vqrdmlashq_n_u])
+;; [vqrdmlashq_n_s])
;;
(define_insn "mve_vqrdmlashq_n_<supf><mode>"
[
@@ -6552,6 +5958,23 @@
(set_attr "length""8")])
;;
+;; [vqdmlashq_m_n_s])
+;;
+(define_insn "mve_vqdmlashq_m_n_s<mode>"
+ [
+ (set (match_operand:MVE_2 0 "s_register_operand" "=w")
+ (unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand" "0")
+ (match_operand:MVE_2 2 "s_register_operand" "w")
+ (match_operand:<V_elem> 3 "s_register_operand" "r")
+ (match_operand:HI 4 "vpr_register_operand" "Up")]
+ VQDMLASHQ_M_N_S))
+ ]
+ "TARGET_HAVE_MVE"
+ "vpst\;vqdmlasht.s%#<V_sz_elem>\t%q0, %q2, %3"
+ [(set_attr "type" "mve_move")
+ (set_attr "length""8")])
+
+;;
;; [vqrdmlahq_m_n_s])
;;
(define_insn "mve_vqrdmlahq_m_n_s<mode>"
@@ -7113,7 +6536,7 @@
(set_attr "length""8")])
;;
-;; [vmlaldavaxq_p_u, vmlaldavaxq_p_s])
+;; [vmlaldavaxq_p_s])
;;
(define_insn "mve_vmlaldavaxq_p_<supf><mode>"
[
@@ -10315,38 +9738,10 @@
[(set_attr "type" "mve_move")
(set_attr "length""8")])
-(define_expand "mve_vstrwq_scatter_base_wb_<supf>v4si"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SI 2 "s_register_operand" "w")
- (unspec:V4SI [(const_int 0)] VSTRWSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_wb = gen_reg_rtx (V4SImode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_<supf>v4si_insn (ignore_wb, operands[0],
- operands[1], operands[2]));
- DONE;
-})
-
-(define_expand "mve_vstrwq_scatter_base_wb_add_<supf>v4si"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SI 2 "s_register_operand" "0")
- (unspec:V4SI [(const_int 0)] VSTRWSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_vec = gen_reg_rtx (V4SImode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_<supf>v4si_insn (operands[0], operands[2],
- operands[1], ignore_vec));
- DONE;
-})
-
;;
-;; [vstrwq_scatter_base_wb_s vstrdq_scatter_base_wb_u]
+;; [vstrwq_scatter_base_wb_s vstrwq_scatter_base_wb_u]
;;
-(define_insn "mve_vstrwq_scatter_base_wb_<supf>v4si_insn"
+(define_insn "mve_vstrwq_scatter_base_wb_<supf>v4si"
[(set (mem:BLK (scratch))
(unspec:BLK
[(match_operand:V4SI 1 "s_register_operand" "0")
@@ -10368,42 +9763,10 @@
}
[(set_attr "length" "4")])
-(define_expand "mve_vstrwq_scatter_base_wb_p_<supf>v4si"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SI 2 "s_register_operand" "w")
- (match_operand:HI 3 "vpr_register_operand")
- (unspec:V4SI [(const_int 0)] VSTRWSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_wb = gen_reg_rtx (V4SImode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_p_<supf>v4si_insn (ignore_wb, operands[0],
- operands[1], operands[2],
- operands[3]));
- DONE;
-})
-
-(define_expand "mve_vstrwq_scatter_base_wb_p_add_<supf>v4si"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SI 2 "s_register_operand" "0")
- (match_operand:HI 3 "vpr_register_operand")
- (unspec:V4SI [(const_int 0)] VSTRWSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_vec = gen_reg_rtx (V4SImode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_p_<supf>v4si_insn (operands[0], operands[2],
- operands[1], ignore_vec,
- operands[3]));
- DONE;
-})
-
;;
;; [vstrwq_scatter_base_wb_p_s vstrwq_scatter_base_wb_p_u]
;;
-(define_insn "mve_vstrwq_scatter_base_wb_p_<supf>v4si_insn"
+(define_insn "mve_vstrwq_scatter_base_wb_p_<supf>v4si"
[(set (mem:BLK (scratch))
(unspec:BLK
[(match_operand:V4SI 1 "s_register_operand" "0")
@@ -10426,38 +9789,10 @@
}
[(set_attr "length" "8")])
-(define_expand "mve_vstrwq_scatter_base_wb_fv4sf"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SF 2 "s_register_operand" "w")
- (unspec:V4SI [(const_int 0)] VSTRWQSBWB_F)]
- "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
-{
- rtx ignore_wb = gen_reg_rtx (V4SImode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_fv4sf_insn (ignore_wb,operands[0],
- operands[1], operands[2]));
- DONE;
-})
-
-(define_expand "mve_vstrwq_scatter_base_wb_add_fv4sf"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SI 2 "s_register_operand" "0")
- (unspec:V4SI [(const_int 0)] VSTRWQSBWB_F)]
- "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
-{
- rtx ignore_vec = gen_reg_rtx (V4SFmode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_fv4sf_insn (operands[0], operands[2],
- operands[1], ignore_vec));
- DONE;
-})
-
;;
;; [vstrwq_scatter_base_wb_f]
;;
-(define_insn "mve_vstrwq_scatter_base_wb_fv4sf_insn"
+(define_insn "mve_vstrwq_scatter_base_wb_fv4sf"
[(set (mem:BLK (scratch))
(unspec:BLK
[(match_operand:V4SI 1 "s_register_operand" "0")
@@ -10479,42 +9814,10 @@
}
[(set_attr "length" "4")])
-(define_expand "mve_vstrwq_scatter_base_wb_p_fv4sf"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SF 2 "s_register_operand" "w")
- (match_operand:HI 3 "vpr_register_operand")
- (unspec:V4SI [(const_int 0)] VSTRWQSBWB_F)]
- "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
-{
- rtx ignore_wb = gen_reg_rtx (V4SImode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_p_fv4sf_insn (ignore_wb, operands[0],
- operands[1], operands[2],
- operands[3]));
- DONE;
-})
-
-(define_expand "mve_vstrwq_scatter_base_wb_p_add_fv4sf"
- [(match_operand:V4SI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V4SI 2 "s_register_operand" "0")
- (match_operand:HI 3 "vpr_register_operand")
- (unspec:V4SI [(const_int 0)] VSTRWQSBWB_F)]
- "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
-{
- rtx ignore_vec = gen_reg_rtx (V4SFmode);
- emit_insn (
- gen_mve_vstrwq_scatter_base_wb_p_fv4sf_insn (operands[0], operands[2],
- operands[1], ignore_vec,
- operands[3]));
- DONE;
-})
-
;;
;; [vstrwq_scatter_base_wb_p_f]
;;
-(define_insn "mve_vstrwq_scatter_base_wb_p_fv4sf_insn"
+(define_insn "mve_vstrwq_scatter_base_wb_p_fv4sf"
[(set (mem:BLK (scratch))
(unspec:BLK
[(match_operand:V4SI 1 "s_register_operand" "0")
@@ -10537,38 +9840,10 @@
}
[(set_attr "length" "8")])
-(define_expand "mve_vstrdq_scatter_base_wb_<supf>v2di"
- [(match_operand:V2DI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V2DI 2 "s_register_operand" "w")
- (unspec:V2DI [(const_int 0)] VSTRDSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_wb = gen_reg_rtx (V2DImode);
- emit_insn (
- gen_mve_vstrdq_scatter_base_wb_<supf>v2di_insn (ignore_wb, operands[0],
- operands[1], operands[2]));
- DONE;
-})
-
-(define_expand "mve_vstrdq_scatter_base_wb_add_<supf>v2di"
- [(match_operand:V2DI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V2DI 2 "s_register_operand" "0")
- (unspec:V2DI [(const_int 0)] VSTRDSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_vec = gen_reg_rtx (V2DImode);
- emit_insn (
- gen_mve_vstrdq_scatter_base_wb_<supf>v2di_insn (operands[0], operands[2],
- operands[1], ignore_vec));
- DONE;
-})
-
;;
;; [vstrdq_scatter_base_wb_s vstrdq_scatter_base_wb_u]
;;
-(define_insn "mve_vstrdq_scatter_base_wb_<supf>v2di_insn"
+(define_insn "mve_vstrdq_scatter_base_wb_<supf>v2di"
[(set (mem:BLK (scratch))
(unspec:BLK
[(match_operand:V2DI 1 "s_register_operand" "0")
@@ -10590,42 +9865,10 @@
}
[(set_attr "length" "4")])
-(define_expand "mve_vstrdq_scatter_base_wb_p_<supf>v2di"
- [(match_operand:V2DI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V2DI 2 "s_register_operand" "w")
- (match_operand:HI 3 "vpr_register_operand")
- (unspec:V2DI [(const_int 0)] VSTRDSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_wb = gen_reg_rtx (V2DImode);
- emit_insn (
- gen_mve_vstrdq_scatter_base_wb_p_<supf>v2di_insn (ignore_wb, operands[0],
- operands[1], operands[2],
- operands[3]));
- DONE;
-})
-
-(define_expand "mve_vstrdq_scatter_base_wb_p_add_<supf>v2di"
- [(match_operand:V2DI 0 "s_register_operand" "=w")
- (match_operand:SI 1 "mve_vldrd_immediate" "Ri")
- (match_operand:V2DI 2 "s_register_operand" "0")
- (match_operand:HI 3 "vpr_register_operand")
- (unspec:V2DI [(const_int 0)] VSTRDSBWBQ)]
- "TARGET_HAVE_MVE"
-{
- rtx ignore_vec = gen_reg_rtx (V2DImode);
- emit_insn (
- gen_mve_vstrdq_scatter_base_wb_p_<supf>v2di_insn (operands[0], operands[2],
- operands[1], ignore_vec,
- operands[3]));
- DONE;
-})
-
;;
;; [vstrdq_scatter_base_wb_p_s vstrdq_scatter_base_wb_p_u]
;;
-(define_insn "mve_vstrdq_scatter_base_wb_p_<supf>v2di_insn"
+(define_insn "mve_vstrdq_scatter_base_wb_p_<supf>v2di"
[(set (mem:BLK (scratch))
(unspec:BLK
[(match_operand:V2DI 1 "s_register_operand" "0")
@@ -10643,7 +9886,7 @@
ops[0] = operands[1];
ops[1] = operands[2];
ops[2] = operands[3];
- output_asm_insn ("vpst\;\tvstrdt.u64\t%q2, [%q0, %1]!",ops);
+ output_asm_insn ("vpst;vstrdt.u64\t%q2, [%q0, %1]!",ops);
return "";
}
[(set_attr "length" "8")])
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 3e7b51d..2d76769 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -501,7 +501,7 @@
[(set (match_operand:VDQ 0 "s_register_operand" "=w")
(plus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
(match_operand:VDQ 2 "s_register_operand" "w")))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set (attr "type")
(if_then_else (match_test "<Is_float_mode>")
@@ -509,54 +509,11 @@
(const_string "neon_add<q>")))]
)
-;; As with SFmode, full support for HFmode vector arithmetic is only available
-;; when flag-unsafe-math-optimizations is enabled.
-
-;; Add pattern with modes V8HF and V4HF is split into separate patterns to add
-;; support for standard pattern addv8hf3 in MVE. Following pattern is called
-;; from "addv8hf3" standard pattern inside vec-common.md file.
-
-(define_insn "addv8hf3_neon"
- [(set
- (match_operand:V8HF 0 "s_register_operand" "=w")
- (plus:V8HF
- (match_operand:V8HF 1 "s_register_operand" "w")
- (match_operand:V8HF 2 "s_register_operand" "w")))]
- "TARGET_NEON_FP16INST && flag_unsafe_math_optimizations"
- "vadd.f16\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set_attr "type" "neon_fp_addsub_s_q")]
-)
-
-(define_insn "addv4hf3"
- [(set
- (match_operand:V4HF 0 "s_register_operand" "=w")
- (plus:V4HF
- (match_operand:V4HF 1 "s_register_operand" "w")
- (match_operand:V4HF 2 "s_register_operand" "w")))]
- "TARGET_NEON_FP16INST && flag_unsafe_math_optimizations"
- "vadd.f16\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set_attr "type" "neon_fp_addsub_s_q")]
-)
-
-(define_insn "add<mode>3_fp16"
- [(set
- (match_operand:VH 0 "s_register_operand" "=w")
- (plus:VH
- (match_operand:VH 1 "s_register_operand" "w")
- (match_operand:VH 2 "s_register_operand" "w")))]
- "TARGET_NEON_FP16INST"
- "vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set (attr "type")
- (if_then_else (match_test "<Is_float_mode>")
- (const_string "neon_fp_addsub_s<q>")
- (const_string "neon_add<q>")))]
-)
-
(define_insn "*sub<mode>3_neon"
[(set (match_operand:VDQ 0 "s_register_operand" "=w")
(minus:VDQ (match_operand:VDQ 1 "s_register_operand" "w")
(match_operand:VDQ 2 "s_register_operand" "w")))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set (attr "type")
(if_then_else (match_test "<Is_float_mode>")
@@ -564,33 +521,11 @@
(const_string "neon_sub<q>")))]
)
-(define_insn "sub<mode>3"
- [(set
- (match_operand:VH 0 "s_register_operand" "=w")
- (minus:VH
- (match_operand:VH 1 "s_register_operand" "w")
- (match_operand:VH 2 "s_register_operand" "w")))]
- "TARGET_NEON_FP16INST && flag_unsafe_math_optimizations"
- "vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set_attr "type" "neon_sub<q>")]
-)
-
-(define_insn "sub<mode>3_fp16"
- [(set
- (match_operand:VH 0 "s_register_operand" "=w")
- (minus:VH
- (match_operand:VH 1 "s_register_operand" "w")
- (match_operand:VH 2 "s_register_operand" "w")))]
- "TARGET_NEON_FP16INST"
- "vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set_attr "type" "neon_sub<q>")]
-)
-
(define_insn "*mul<mode>3_neon"
[(set (match_operand:VDQW 0 "s_register_operand" "=w")
(mult:VDQW (match_operand:VDQW 1 "s_register_operand" "w")
(match_operand:VDQW 2 "s_register_operand" "w")))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vmul.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set (attr "type")
(if_then_else (match_test "<Is_float_mode>")
@@ -635,7 +570,7 @@
(plus:VDQW (mult:VDQW (match_operand:VDQW 2 "s_register_operand" "w")
(match_operand:VDQW 3 "s_register_operand" "w"))
(match_operand:VDQW 1 "s_register_operand" "0")))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
[(set (attr "type")
(if_then_else (match_test "<Is_float_mode>")
@@ -648,7 +583,7 @@
(plus:VH (mult:VH (match_operand:VH 2 "s_register_operand" "w")
(match_operand:VH 3 "s_register_operand" "w"))
(match_operand:VH 1 "s_register_operand" "0")))]
- "TARGET_NEON_FP16INST && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vmla.f16\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
[(set_attr "type" "neon_fp_mla_s<q>")]
)
@@ -658,7 +593,7 @@
(minus:VDQW (match_operand:VDQW 1 "s_register_operand" "0")
(mult:VDQW (match_operand:VDQW 2 "s_register_operand" "w")
(match_operand:VDQW 3 "s_register_operand" "w"))))]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3"
[(set (attr "type")
(if_then_else (match_test "<Is_float_mode>")
@@ -676,7 +611,7 @@
(fma:VCVTF (match_operand:VCVTF 1 "register_operand" "w")
(match_operand:VCVTF 2 "register_operand" "w")
(match_operand:VCVTF 3 "register_operand" "0")))]
- "TARGET_NEON && TARGET_FMA && flag_unsafe_math_optimizations"
+ "ARM_HAVE_NEON_<MODE>_ARITH && TARGET_FMA"
"vfma.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set_attr "type" "neon_fp_mla_s<q>")]
)
@@ -697,18 +632,7 @@
(match_operand:VH 1 "register_operand" "w")
(match_operand:VH 2 "register_operand" "w")
(match_operand:VH 3 "register_operand" "0")))]
- "TARGET_NEON_FP16INST && flag_unsafe_math_optimizations"
- "vfma.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set_attr "type" "neon_fp_mla_s<q>")]
-)
-
-(define_insn "fma<VH:mode>4_intrinsic"
- [(set (match_operand:VH 0 "register_operand" "=w")
- (fma:VH
- (match_operand:VH 1 "register_operand" "w")
- (match_operand:VH 2 "register_operand" "w")
- (match_operand:VH 3 "register_operand" "0")))]
- "TARGET_NEON_FP16INST"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vfma.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set_attr "type" "neon_fp_mla_s<q>")]
)
@@ -718,7 +642,7 @@
(fma:VCVTF (neg:VCVTF (match_operand:VCVTF 1 "register_operand" "w"))
(match_operand:VCVTF 2 "register_operand" "w")
(match_operand:VCVTF 3 "register_operand" "0")))]
- "TARGET_NEON && TARGET_FMA && flag_unsafe_math_optimizations"
+ "ARM_HAVE_NEON_<MODE>_ARITH && TARGET_FMA"
"vfms.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set_attr "type" "neon_fp_mla_s<q>")]
)
@@ -1238,7 +1162,7 @@
(parallel [(const_int 0) (const_int 1)]))
(vec_select:V2SF (match_dup 1)
(parallel [(const_int 2) (const_int 3)]))))]
- "TARGET_NEON && flag_unsafe_math_optimizations"
+ "ARM_HAVE_NEON_V4SF_ARITH"
"<VQH_mnem>.f32\t%P0, %e1, %f1"
[(set_attr "vqh_mnem" "<VQH_mnem>")
(set_attr "type" "neon_fp_reduc_<VQH_type>_s_q")]
@@ -1305,7 +1229,7 @@
(define_expand "reduc_plus_scal_<mode>"
[(match_operand:<V_elem> 0 "nonimmediate_operand")
(match_operand:VD 1 "s_register_operand")]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
{
rtx vec = gen_reg_rtx (<MODE>mode);
neon_pairwise_reduce (vec, operands[1], <MODE>mode,
@@ -1318,8 +1242,7 @@
(define_expand "reduc_plus_scal_<mode>"
[(match_operand:<V_elem> 0 "nonimmediate_operand")
(match_operand:VQ 1 "s_register_operand")]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)
- && !BYTES_BIG_ENDIAN"
+ "ARM_HAVE_NEON_<MODE>_ARITH && !BYTES_BIG_ENDIAN"
{
rtx step1 = gen_reg_rtx (<V_HALF>mode);
@@ -1354,7 +1277,7 @@
(define_expand "reduc_smin_scal_<mode>"
[(match_operand:<V_elem> 0 "nonimmediate_operand")
(match_operand:VD 1 "s_register_operand")]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
{
rtx vec = gen_reg_rtx (<MODE>mode);
@@ -1368,8 +1291,7 @@
(define_expand "reduc_smin_scal_<mode>"
[(match_operand:<V_elem> 0 "nonimmediate_operand")
(match_operand:VQ 1 "s_register_operand")]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)
- && !BYTES_BIG_ENDIAN"
+ "ARM_HAVE_NEON_<MODE>_ARITH && !BYTES_BIG_ENDIAN"
{
rtx step1 = gen_reg_rtx (<V_HALF>mode);
@@ -1382,7 +1304,7 @@
(define_expand "reduc_smax_scal_<mode>"
[(match_operand:<V_elem> 0 "nonimmediate_operand")
(match_operand:VD 1 "s_register_operand")]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
{
rtx vec = gen_reg_rtx (<MODE>mode);
neon_pairwise_reduce (vec, operands[1], <MODE>mode,
@@ -1395,8 +1317,7 @@
(define_expand "reduc_smax_scal_<mode>"
[(match_operand:<V_elem> 0 "nonimmediate_operand")
(match_operand:VQ 1 "s_register_operand")]
- "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)
- && !BYTES_BIG_ENDIAN"
+ "ARM_HAVE_NEON_<MODE>_ARITH && !BYTES_BIG_ENDIAN"
{
rtx step1 = gen_reg_rtx (<V_HALF>mode);
@@ -1573,6 +1494,30 @@
[(set_attr "type" "neon_qsub<q>")]
)
+(define_expand "vec_cmp<mode><v_cmp_result>"
+ [(set (match_operand:<V_cmp_result> 0 "s_register_operand")
+ (match_operator:<V_cmp_result> 1 "comparison_operator"
+ [(match_operand:VDQW 2 "s_register_operand")
+ (match_operand:VDQW 3 "reg_or_zero_operand")]))]
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+{
+ arm_expand_vector_compare (operands[0], GET_CODE (operands[1]),
+ operands[2], operands[3], false);
+ DONE;
+})
+
+(define_expand "vec_cmpu<mode><mode>"
+ [(set (match_operand:VDQIW 0 "s_register_operand")
+ (match_operator:VDQIW 1 "comparison_operator"
+ [(match_operand:VDQIW 2 "s_register_operand")
+ (match_operand:VDQIW 3 "reg_or_zero_operand")]))]
+ "TARGET_NEON"
+{
+ arm_expand_vector_compare (operands[0], GET_CODE (operands[1]),
+ operands[2], operands[3], false);
+ DONE;
+})
+
;; Conditional instructions. These are comparisons with conditional moves for
;; vectors. They perform the assignment:
;;
@@ -1586,230 +1531,53 @@
(if_then_else:VDQW
(match_operator 3 "comparison_operator"
[(match_operand:VDQW 4 "s_register_operand")
- (match_operand:VDQW 5 "nonmemory_operand")])
+ (match_operand:VDQW 5 "reg_or_zero_operand")])
(match_operand:VDQW 1 "s_register_operand")
(match_operand:VDQW 2 "s_register_operand")))]
"TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
{
- int inverse = 0;
- int use_zero_form = 0;
- int swap_bsl_operands = 0;
- rtx mask = gen_reg_rtx (<V_cmp_result>mode);
- rtx tmp = gen_reg_rtx (<V_cmp_result>mode);
-
- rtx (*base_comparison) (rtx, rtx, rtx);
- rtx (*complimentary_comparison) (rtx, rtx, rtx);
-
- switch (GET_CODE (operands[3]))
- {
- case GE:
- case GT:
- case LE:
- case LT:
- case EQ:
- if (operands[5] == CONST0_RTX (<MODE>mode))
- {
- use_zero_form = 1;
- break;
- }
- /* Fall through. */
- default:
- if (!REG_P (operands[5]))
- operands[5] = force_reg (<MODE>mode, operands[5]);
- }
-
- switch (GET_CODE (operands[3]))
- {
- case LT:
- case UNLT:
- inverse = 1;
- /* Fall through. */
- case GE:
- case UNGE:
- case ORDERED:
- case UNORDERED:
- base_comparison = gen_neon_vcge<mode>;
- complimentary_comparison = gen_neon_vcgt<mode>;
- break;
- case LE:
- case UNLE:
- inverse = 1;
- /* Fall through. */
- case GT:
- case UNGT:
- base_comparison = gen_neon_vcgt<mode>;
- complimentary_comparison = gen_neon_vcge<mode>;
- break;
- case EQ:
- case NE:
- case UNEQ:
- base_comparison = gen_neon_vceq<mode>;
- complimentary_comparison = gen_neon_vceq<mode>;
- break;
- default:
- gcc_unreachable ();
- }
-
- switch (GET_CODE (operands[3]))
- {
- case LT:
- case LE:
- case GT:
- case GE:
- case EQ:
- /* The easy case. Here we emit one of vcge, vcgt or vceq.
- As a LT b <=> b GE a && a LE b <=> b GT a. Our transformations are:
- a GE b -> a GE b
- a GT b -> a GT b
- a LE b -> b GE a
- a LT b -> b GT a
- a EQ b -> a EQ b
- Note that there also exist direct comparison against 0 forms,
- so catch those as a special case. */
- if (use_zero_form)
- {
- inverse = 0;
- switch (GET_CODE (operands[3]))
- {
- case LT:
- base_comparison = gen_neon_vclt<mode>;
- break;
- case LE:
- base_comparison = gen_neon_vcle<mode>;
- break;
- default:
- /* Do nothing, other zero form cases already have the correct
- base_comparison. */
- break;
- }
- }
-
- if (!inverse)
- emit_insn (base_comparison (mask, operands[4], operands[5]));
- else
- emit_insn (complimentary_comparison (mask, operands[5], operands[4]));
- break;
- case UNLT:
- case UNLE:
- case UNGT:
- case UNGE:
- case NE:
- /* Vector compare returns false for lanes which are unordered, so if we use
- the inverse of the comparison we actually want to emit, then
- swap the operands to BSL, we will end up with the correct result.
- Note that a NE NaN and NaN NE b are true for all a, b.
-
- Our transformations are:
- a GE b -> !(b GT a)
- a GT b -> !(b GE a)
- a LE b -> !(a GT b)
- a LT b -> !(a GE b)
- a NE b -> !(a EQ b) */
-
- if (inverse)
- emit_insn (base_comparison (mask, operands[4], operands[5]));
- else
- emit_insn (complimentary_comparison (mask, operands[5], operands[4]));
-
- swap_bsl_operands = 1;
- break;
- case UNEQ:
- /* We check (a > b || b > a). combining these comparisons give us
- true iff !(a != b && a ORDERED b), swapping the operands to BSL
- will then give us (a == b || a UNORDERED b) as intended. */
-
- emit_insn (gen_neon_vcgt<mode> (mask, operands[4], operands[5]));
- emit_insn (gen_neon_vcgt<mode> (tmp, operands[5], operands[4]));
- emit_insn (gen_ior<v_cmp_result>3 (mask, mask, tmp));
- swap_bsl_operands = 1;
- break;
- case UNORDERED:
- /* Operands are ORDERED iff (a > b || b >= a).
- Swapping the operands to BSL will give the UNORDERED case. */
- swap_bsl_operands = 1;
- /* Fall through. */
- case ORDERED:
- emit_insn (gen_neon_vcgt<mode> (tmp, operands[4], operands[5]));
- emit_insn (gen_neon_vcge<mode> (mask, operands[5], operands[4]));
- emit_insn (gen_ior<v_cmp_result>3 (mask, mask, tmp));
- break;
- default:
- gcc_unreachable ();
- }
+ arm_expand_vcond (operands, <V_cmp_result>mode);
+ DONE;
+})
- if (swap_bsl_operands)
- emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[2],
- operands[1]));
- else
- emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[1],
- operands[2]));
+(define_expand "vcond<V_cvtto><mode>"
+ [(set (match_operand:<V_CVTTO> 0 "s_register_operand")
+ (if_then_else:<V_CVTTO>
+ (match_operator 3 "comparison_operator"
+ [(match_operand:V32 4 "s_register_operand")
+ (match_operand:V32 5 "reg_or_zero_operand")])
+ (match_operand:<V_CVTTO> 1 "s_register_operand")
+ (match_operand:<V_CVTTO> 2 "s_register_operand")))]
+ "TARGET_NEON && (!<Is_float_mode> || flag_unsafe_math_optimizations)"
+{
+ arm_expand_vcond (operands, <V_cmp_result>mode);
DONE;
})
-(define_expand "vcondu<mode><mode>"
- [(set (match_operand:VDQIW 0 "s_register_operand")
- (if_then_else:VDQIW
+(define_expand "vcondu<mode><v_cmp_result>"
+ [(set (match_operand:VDQW 0 "s_register_operand")
+ (if_then_else:VDQW
(match_operator 3 "arm_comparison_operator"
- [(match_operand:VDQIW 4 "s_register_operand")
- (match_operand:VDQIW 5 "s_register_operand")])
- (match_operand:VDQIW 1 "s_register_operand")
- (match_operand:VDQIW 2 "s_register_operand")))]
+ [(match_operand:<V_cmp_result> 4 "s_register_operand")
+ (match_operand:<V_cmp_result> 5 "reg_or_zero_operand")])
+ (match_operand:VDQW 1 "s_register_operand")
+ (match_operand:VDQW 2 "s_register_operand")))]
"TARGET_NEON"
{
- rtx mask;
- int inverse = 0, immediate_zero = 0;
-
- mask = gen_reg_rtx (<V_cmp_result>mode);
-
- if (operands[5] == CONST0_RTX (<MODE>mode))
- immediate_zero = 1;
- else if (!REG_P (operands[5]))
- operands[5] = force_reg (<MODE>mode, operands[5]);
-
- switch (GET_CODE (operands[3]))
- {
- case GEU:
- emit_insn (gen_neon_vcgeu<mode> (mask, operands[4], operands[5]));
- break;
-
- case GTU:
- emit_insn (gen_neon_vcgtu<mode> (mask, operands[4], operands[5]));
- break;
-
- case EQ:
- emit_insn (gen_neon_vceq<mode> (mask, operands[4], operands[5]));
- break;
-
- case LEU:
- if (immediate_zero)
- emit_insn (gen_neon_vcle<mode> (mask, operands[4], operands[5]));
- else
- emit_insn (gen_neon_vcgeu<mode> (mask, operands[5], operands[4]));
- break;
-
- case LTU:
- if (immediate_zero)
- emit_insn (gen_neon_vclt<mode> (mask, operands[4], operands[5]));
- else
- emit_insn (gen_neon_vcgtu<mode> (mask, operands[5], operands[4]));
- break;
-
- case NE:
- emit_insn (gen_neon_vceq<mode> (mask, operands[4], operands[5]));
- inverse = 1;
- break;
-
- default:
- gcc_unreachable ();
- }
-
- if (inverse)
- emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[2],
- operands[1]));
- else
- emit_insn (gen_neon_vbsl<mode> (operands[0], mask, operands[1],
- operands[2]));
+ arm_expand_vcond (operands, <V_cmp_result>mode);
+ DONE;
+})
+(define_expand "vcond_mask_<mode><v_cmp_result>"
+ [(set (match_operand:VDQW 0 "s_register_operand")
+ (if_then_else:VDQW
+ (match_operand:<V_cmp_result> 3 "s_register_operand")
+ (match_operand:VDQW 1 "s_register_operand")
+ (match_operand:VDQW 2 "s_register_operand")))]
+ "TARGET_NEON"
+{
+ emit_insn (gen_neon_vbsl<mode> (operands[0], operands[3], operands[1],
+ operands[2]));
DONE;
})
@@ -1823,7 +1591,7 @@
(match_operand:VCVTF 2 "s_register_operand")]
"TARGET_NEON"
{
- if (!<Is_float_mode> || flag_unsafe_math_optimizations)
+ if (ARM_HAVE_NEON_<MODE>_ARITH)
emit_insn (gen_add<mode>3 (operands[0], operands[1], operands[2]));
else
emit_insn (gen_neon_vadd<mode>_unspec (operands[0], operands[1],
@@ -1837,7 +1605,7 @@
(match_operand:VH 2 "s_register_operand")]
"TARGET_NEON_FP16INST"
{
- emit_insn (gen_add<mode>3_fp16 (operands[0], operands[1], operands[2]));
+ emit_insn (gen_add<mode>3 (operands[0], operands[1], operands[2]));
DONE;
})
@@ -1847,7 +1615,7 @@
(match_operand:VH 2 "s_register_operand")]
"TARGET_NEON_FP16INST"
{
- emit_insn (gen_sub<mode>3_fp16 (operands[0], operands[1], operands[2]));
+ emit_insn (gen_sub<mode>3 (operands[0], operands[1], operands[2]));
DONE;
})
@@ -1942,17 +1710,6 @@
(const_string "neon_mul_<V_elem_ch><q>")))]
)
-(define_insn "mul<mode>3"
- [(set
- (match_operand:VH 0 "s_register_operand" "=w")
- (mult:VH
- (match_operand:VH 1 "s_register_operand" "w")
- (match_operand:VH 2 "s_register_operand" "w")))]
- "TARGET_NEON_FP16INST && flag_unsafe_math_optimizations"
- "vmul.f16\t%<V_reg>0, %<V_reg>1, %<V_reg>2"
- [(set_attr "type" "neon_mul_<VH_elem_ch><q>")]
-)
-
(define_insn "neon_vmulf<mode>"
[(set
(match_operand:VH 0 "s_register_operand" "=w")
@@ -1971,7 +1728,7 @@
(match_operand:VDQW 3 "s_register_operand")]
"TARGET_NEON"
{
- if (!<Is_float_mode> || flag_unsafe_math_optimizations)
+ if (ARM_HAVE_NEON_<MODE>_ARITH)
emit_insn (gen_mul<mode>3add<mode>_neon (operands[0], operands[1],
operands[2], operands[3]));
else
@@ -1999,8 +1756,8 @@
(match_operand:VH 3 "s_register_operand")]
"TARGET_NEON_FP16INST"
{
- emit_insn (gen_fma<mode>4_intrinsic (operands[0], operands[2], operands[3],
- operands[1]));
+ emit_insn (gen_fma<mode>4 (operands[0], operands[2], operands[3],
+ operands[1]));
DONE;
})
@@ -2462,7 +2219,7 @@
(match_operand:VDQW 3 "s_register_operand")]
"TARGET_NEON"
{
- if (!<Is_float_mode> || flag_unsafe_math_optimizations)
+ if (ARM_HAVE_NEON_<MODE>_ARITH)
emit_insn (gen_mul<mode>3neg<mode>add<mode>_neon (operands[0],
operands[1], operands[2], operands[3]));
else
@@ -2569,7 +2326,7 @@
(match_operand:VCVTF 2 "s_register_operand")]
"TARGET_NEON"
{
- if (!<Is_float_mode> || flag_unsafe_math_optimizations)
+ if (ARM_HAVE_NEON_<MODE>_ARITH)
emit_insn (gen_sub<mode>3 (operands[0], operands[1], operands[2]));
else
emit_insn (gen_neon_vsub<mode>_unspec (operands[0], operands[1],
@@ -2644,7 +2401,7 @@
;; These may expand to an UNSPEC pattern when a floating point mode is used
;; without unsafe math optimizations.
-(define_expand "neon_vc<cmp_op><mode>"
+(define_expand "@neon_vc<cmp_op><mode>"
[(match_operand:<V_cmp_result> 0 "s_register_operand")
(neg:<V_cmp_result>
(COMPARISONS:VDQW (match_operand:VDQW 1 "s_register_operand")
@@ -2684,7 +2441,7 @@
}
)
-(define_insn "neon_vc<cmp_op><mode>_insn"
+(define_insn "@neon_vc<cmp_op><mode>_insn"
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w")
(neg:<V_cmp_result>
(COMPARISONS:<V_cmp_result>
@@ -2728,7 +2485,7 @@
[(set_attr "type" "neon_fp_compare_s<q>")]
)
-(define_expand "neon_vc<cmp_op><mode>"
+(define_expand "@neon_vc<cmp_op><mode>"
[(match_operand:<V_cmp_result> 0 "s_register_operand")
(neg:<V_cmp_result>
(COMPARISONS:VH
@@ -2794,7 +2551,7 @@
}
[(set_attr "type" "neon_fp_compare_s<q>")])
-(define_insn "neon_vc<cmp_op>u<mode>"
+(define_insn "@neon_vc<code><mode>"
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w")
(neg:<V_cmp_result>
(GTUGEU:<V_cmp_result>
@@ -4751,7 +4508,7 @@ if (BYTES_BIG_ENDIAN)
[(set_attr "type" "neon_bsl<q>")]
)
-(define_expand "neon_vbsl<mode>"
+(define_expand "@neon_vbsl<mode>"
[(set (match_operand:VDQX 0 "s_register_operand")
(unspec:VDQX [(match_operand:<V_cmp_result> 1 "s_register_operand")
(match_operand:VDQX 2 "s_register_operand")
@@ -6658,7 +6415,7 @@ if (BYTES_BIG_ENDIAN)
[(set (match_operand:VF 0 "s_register_operand" "=w")
(abs:VF (minus:VF (match_operand:VF 1 "s_register_operand" "w")
(match_operand:VF 2 "s_register_operand" "w"))))]
- "TARGET_NEON && flag_unsafe_math_optimizations"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vabd.<V_s_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set_attr "type" "neon_fp_abd_s<q>")]
)
@@ -6668,7 +6425,7 @@ if (BYTES_BIG_ENDIAN)
(abs:VF (unspec:VF [(match_operand:VF 1 "s_register_operand" "w")
(match_operand:VF 2 "s_register_operand" "w")]
UNSPEC_VSUB)))]
- "TARGET_NEON && flag_unsafe_math_optimizations"
+ "ARM_HAVE_NEON_<MODE>_ARITH"
"vabd.<V_if_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2"
[(set_attr "type" "neon_fp_abd_s<q>")]
)
diff --git a/gcc/config/arm/parsecpu.awk b/gcc/config/arm/parsecpu.awk
index 7fc3754..9423e8a 100644
--- a/gcc/config/arm/parsecpu.awk
+++ b/gcc/config/arm/parsecpu.awk
@@ -190,6 +190,23 @@ function gen_isa () {
ORS = z
print "\n"
}
+
+ print "struct fbit_implication {"
+ print " /* Represents a feature implication, where:"
+ print " ante IMPLIES cons"
+ print " meaning that if ante is enabled then we should"
+ print " also implicitly enable cons. */"
+ print " enum isa_feature ante;"
+ print " enum isa_feature cons;"
+ print "};\n"
+ print "static const struct fbit_implication all_implied_fbits[] ="
+ print "{"
+ for (impl in implied_bits) {
+ split (impl, impl_parts, SUBSEP)
+ print " { isa_bit_" impl_parts[2] ", isa_bit_" impl_parts[1] " },"
+ }
+ print " { isa_nobit, isa_nobit }"
+ print "};\n"
}
function gen_data () {
@@ -600,6 +617,40 @@ BEGIN {
parse_ok = 1
}
+/^define implied / {
+ if (NF < 4) fatal("syntax: define implied <name> [<feature-or-fgroup>]+\n" \
+ "Implied bits must be defined with at least one antecedent.")
+ toplevel()
+ fbit = $3
+ if (fbit in features) fatal("implied feature " fbit " aliases a real feature")
+ if (fbit in fgroup) fatal("implied feature " fbit " aliases a feature group")
+ fcount = NF
+ features[fbit] = 1
+ for (n = 4; n <= fcount; n++) {
+ ante = $n
+ if (fbit == ante) fatal("feature cannot imply itself")
+ else if (ante in features) {
+ for (impl in implied_bits) {
+ split(impl, impl_sep, SUBSEP)
+ if (ante == impl_sep[1])
+ fatal(ante " implies implied bit " fbit \
+ ". Chained implications not currently supported")
+ }
+ implied_bits[fbit, ante] = 1
+ } else if (ante in fgroup) {
+ for (bitcomb in fgrp_bits) {
+ split(bitcomb, bitsep, SUBSEP)
+ if (bitsep[1] == ante) {
+ implied_bits[fbit, bitsep[2]] = 1
+ }
+ }
+ } else {
+ fatal("implied bit antecedent " ante " unrecognized")
+ }
+ }
+ parse_ok = 1
+}
+
/^begin fpu / {
if (NF != 3) fatal("syntax: begin fpu <name>")
toplevel()
diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md
index 0a2399d..a3844e9 100644
--- a/gcc/config/arm/unspecs.md
+++ b/gcc/config/arm/unspecs.md
@@ -519,3 +519,803 @@
UNSPEC_BFMAB
UNSPEC_BFMAT
])
+
+;; Enumerators for MVE unspecs.
+(define_c_enum "unspec" [
+ VST4Q
+ VRNDXQ_F
+ VRNDQ_F
+ VRNDPQ_F
+ VRNDNQ_F
+ VRNDMQ_F
+ VRNDAQ_F
+ VREV64Q_F
+ VNEGQ_F
+ VDUPQ_N_F
+ VABSQ_F
+ VREV32Q_F
+ VCVTTQ_F32_F16
+ VCVTBQ_F32_F16
+ VCVTQ_TO_F_S
+ VQNEGQ_S
+ VCVTQ_TO_F_U
+ VREV16Q_S
+ VREV16Q_U
+ VADDLVQ_S
+ VMVNQ_N_S
+ VMVNQ_N_U
+ VCVTAQ_S
+ VCVTAQ_U
+ VREV64Q_S
+ VREV64Q_U
+ VQABSQ_S
+ VNEGQ_S
+ VMVNQ_S
+ VMVNQ_U
+ VDUPQ_N_U
+ VDUPQ_N_S
+ VCLZQ_U
+ VCLZQ_S
+ VCLSQ_S
+ VADDVQ_S
+ VADDVQ_U
+ VABSQ_S
+ VREV32Q_U
+ VREV32Q_S
+ VMOVLTQ_U
+ VMOVLTQ_S
+ VMOVLBQ_S
+ VMOVLBQ_U
+ VCVTQ_FROM_F_S
+ VCVTQ_FROM_F_U
+ VCVTPQ_S
+ VCVTPQ_U
+ VCVTNQ_S
+ VCVTNQ_U
+ VCVTMQ_S
+ VCVTMQ_U
+ VADDLVQ_U
+ VCTP8Q
+ VCTP16Q
+ VCTP32Q
+ VCTP64Q
+ VPNOT
+ VCREATEQ_F
+ VCVTQ_N_TO_F_S
+ VCVTQ_N_TO_F_U
+ VBRSRQ_N_F
+ VSUBQ_N_F
+ VCREATEQ_U
+ VCREATEQ_S
+ VSHRQ_N_S
+ VSHRQ_N_U
+ VCVTQ_N_FROM_F_S
+ VCVTQ_N_FROM_F_U
+ VADDLVQ_P_S
+ VADDLVQ_P_U
+ VCMPNEQ_U
+ VCMPNEQ_S
+ VSHLQ_S
+ VSHLQ_U
+ VABDQ_S
+ VADDQ_N_S
+ VADDVAQ_S
+ VADDVQ_P_S
+ VANDQ_S
+ VBICQ_S
+ VBRSRQ_N_S
+ VCADDQ_ROT270_S
+ VCADDQ_ROT90_S
+ VCMPEQQ_S
+ VCMPEQQ_N_S
+ VCMPNEQ_N_S
+ VEORQ_S
+ VHADDQ_S
+ VHADDQ_N_S
+ VHSUBQ_S
+ VHSUBQ_N_S
+ VMAXQ_S
+ VMAXVQ_S
+ VMINQ_S
+ VMINVQ_S
+ VMLADAVQ_S
+ VMULHQ_S
+ VMULLBQ_INT_S
+ VMULLTQ_INT_S
+ VMULQ_S
+ VMULQ_N_S
+ VORNQ_S
+ VORRQ_S
+ VQADDQ_S
+ VQADDQ_N_S
+ VQRSHLQ_S
+ VQRSHLQ_N_S
+ VQSHLQ_S
+ VQSHLQ_N_S
+ VQSHLQ_R_S
+ VQSUBQ_S
+ VQSUBQ_N_S
+ VRHADDQ_S
+ VRMULHQ_S
+ VRSHLQ_S
+ VRSHLQ_N_S
+ VRSHRQ_N_S
+ VSHLQ_N_S
+ VSHLQ_R_S
+ VSUBQ_S
+ VSUBQ_N_S
+ VABDQ_U
+ VADDQ_N_U
+ VADDVAQ_U
+ VADDVQ_P_U
+ VANDQ_U
+ VBICQ_U
+ VBRSRQ_N_U
+ VCADDQ_ROT270_U
+ VCADDQ_ROT90_U
+ VCMPEQQ_U
+ VCMPEQQ_N_U
+ VCMPNEQ_N_U
+ VEORQ_U
+ VHADDQ_U
+ VHADDQ_N_U
+ VHSUBQ_U
+ VHSUBQ_N_U
+ VMAXQ_U
+ VMAXVQ_U
+ VMINQ_U
+ VMINVQ_U
+ VMLADAVQ_U
+ VMULHQ_U
+ VMULLBQ_INT_U
+ VMULLTQ_INT_U
+ VMULQ_U
+ VMULQ_N_U
+ VORNQ_U
+ VORRQ_U
+ VQADDQ_U
+ VQADDQ_N_U
+ VQRSHLQ_U
+ VQRSHLQ_N_U
+ VQSHLQ_U
+ VQSHLQ_N_U
+ VQSHLQ_R_U
+ VQSUBQ_U
+ VQSUBQ_N_U
+ VRHADDQ_U
+ VRMULHQ_U
+ VRSHLQ_U
+ VRSHLQ_N_U
+ VRSHRQ_N_U
+ VSHLQ_N_U
+ VSHLQ_R_U
+ VSUBQ_U
+ VSUBQ_N_U
+ VCMPGEQ_N_S
+ VCMPGEQ_S
+ VCMPGTQ_N_S
+ VCMPGTQ_S
+ VCMPLEQ_N_S
+ VCMPLEQ_S
+ VCMPLTQ_N_S
+ VCMPLTQ_S
+ VHCADDQ_ROT270_S
+ VHCADDQ_ROT90_S
+ VMAXAQ_S
+ VMAXAVQ_S
+ VMINAQ_S
+ VMINAVQ_S
+ VMLADAVXQ_S
+ VMLSDAVQ_S
+ VMLSDAVXQ_S
+ VQDMULHQ_N_S
+ VQDMULHQ_S
+ VQRDMULHQ_N_S
+ VQRDMULHQ_S
+ VQSHLUQ_N_S
+ VCMPCSQ_N_U
+ VCMPCSQ_U
+ VCMPHIQ_N_U
+ VCMPHIQ_U
+ VABDQ_M_S
+ VABDQ_M_U
+ VABDQ_F
+ VADDQ_N_F
+ VANDQ_F
+ VBICQ_F
+ VCADDQ_ROT270_F
+ VCADDQ_ROT90_F
+ VCMPEQQ_F
+ VCMPEQQ_N_F
+ VCMPGEQ_F
+ VCMPGEQ_N_F
+ VCMPGTQ_F
+ VCMPGTQ_N_F
+ VCMPLEQ_F
+ VCMPLEQ_N_F
+ VCMPLTQ_F
+ VCMPLTQ_N_F
+ VCMPNEQ_F
+ VCMPNEQ_N_F
+ VCMULQ_F
+ VCMULQ_ROT180_F
+ VCMULQ_ROT270_F
+ VCMULQ_ROT90_F
+ VEORQ_F
+ VMAXNMAQ_F
+ VMAXNMAVQ_F
+ VMAXNMQ_F
+ VMAXNMVQ_F
+ VMINNMAQ_F
+ VMINNMAVQ_F
+ VMINNMQ_F
+ VMINNMVQ_F
+ VMULQ_F
+ VMULQ_N_F
+ VORNQ_F
+ VORRQ_F
+ VSUBQ_F
+ VADDLVAQ_U
+ VADDLVAQ_S
+ VBICQ_N_U
+ VBICQ_N_S
+ VCTP8Q_M
+ VCTP16Q_M
+ VCTP32Q_M
+ VCTP64Q_M
+ VCVTBQ_F16_F32
+ VCVTTQ_F16_F32
+ VMLALDAVQ_U
+ VMLALDAVXQ_U
+ VMLALDAVXQ_S
+ VMLALDAVQ_S
+ VMLSLDAVQ_S
+ VMLSLDAVXQ_S
+ VMOVNBQ_U
+ VMOVNBQ_S
+ VMOVNTQ_U
+ VMOVNTQ_S
+ VORRQ_N_S
+ VORRQ_N_U
+ VQDMULLBQ_N_S
+ VQDMULLBQ_S
+ VQDMULLTQ_N_S
+ VQDMULLTQ_S
+ VQMOVNBQ_U
+ VQMOVNBQ_S
+ VQMOVUNBQ_S
+ VQMOVUNTQ_S
+ VRMLALDAVHXQ_S
+ VRMLSLDAVHQ_S
+ VRMLSLDAVHXQ_S
+ VSHLLBQ_S
+ VSHLLBQ_U
+ VSHLLTQ_U
+ VSHLLTQ_S
+ VQMOVNTQ_U
+ VQMOVNTQ_S
+ VSHLLBQ_N_S
+ VSHLLBQ_N_U
+ VSHLLTQ_N_U
+ VSHLLTQ_N_S
+ VRMLALDAVHQ_U
+ VRMLALDAVHQ_S
+ VMULLTQ_POLY_P
+ VMULLBQ_POLY_P
+ VBICQ_M_N_S
+ VBICQ_M_N_U
+ VCMPEQQ_M_F
+ VCVTAQ_M_S
+ VCVTAQ_M_U
+ VCVTQ_M_TO_F_S
+ VCVTQ_M_TO_F_U
+ VQRSHRNBQ_N_U
+ VQRSHRNBQ_N_S
+ VQRSHRUNBQ_N_S
+ VRMLALDAVHAQ_S
+ VABAVQ_S
+ VABAVQ_U
+ VSHLCQ_S
+ VSHLCQ_U
+ VRMLALDAVHAQ_U
+ VABSQ_M_S
+ VADDVAQ_P_S
+ VADDVAQ_P_U
+ VCLSQ_M_S
+ VCLZQ_M_S
+ VCLZQ_M_U
+ VCMPCSQ_M_N_U
+ VCMPCSQ_M_U
+ VCMPEQQ_M_N_S
+ VCMPEQQ_M_N_U
+ VCMPEQQ_M_S
+ VCMPEQQ_M_U
+ VCMPGEQ_M_N_S
+ VCMPGEQ_M_S
+ VCMPGTQ_M_N_S
+ VCMPGTQ_M_S
+ VCMPHIQ_M_N_U
+ VCMPHIQ_M_U
+ VCMPLEQ_M_N_S
+ VCMPLEQ_M_S
+ VCMPLTQ_M_N_S
+ VCMPLTQ_M_S
+ VCMPNEQ_M_N_S
+ VCMPNEQ_M_N_U
+ VCMPNEQ_M_S
+ VCMPNEQ_M_U
+ VDUPQ_M_N_S
+ VDUPQ_M_N_U
+ VDWDUPQ_N_U
+ VDWDUPQ_WB_U
+ VIWDUPQ_N_U
+ VIWDUPQ_WB_U
+ VMAXAQ_M_S
+ VMAXAVQ_P_S
+ VMAXVQ_P_S
+ VMAXVQ_P_U
+ VMINAQ_M_S
+ VMINAVQ_P_S
+ VMINVQ_P_S
+ VMINVQ_P_U
+ VMLADAVAQ_S
+ VMLADAVAQ_U
+ VMLADAVQ_P_S
+ VMLADAVQ_P_U
+ VMLADAVXQ_P_S
+ VMLAQ_N_S
+ VMLAQ_N_U
+ VMLASQ_N_S
+ VMLASQ_N_U
+ VMLSDAVQ_P_S
+ VMLSDAVXQ_P_S
+ VMVNQ_M_S
+ VMVNQ_M_U
+ VNEGQ_M_S
+ VPSELQ_S
+ VPSELQ_U
+ VQABSQ_M_S
+ VQDMLAHQ_N_S
+ VQDMLASHQ_N_S
+ VQNEGQ_M_S
+ VQRDMLADHQ_S
+ VQRDMLADHXQ_S
+ VQRDMLAHQ_N_S
+ VQRDMLASHQ_N_S
+ VQRDMLSDHQ_S
+ VQRDMLSDHXQ_S
+ VQRSHLQ_M_N_S
+ VQRSHLQ_M_N_U
+ VQSHLQ_M_R_S
+ VQSHLQ_M_R_U
+ VREV64Q_M_S
+ VREV64Q_M_U
+ VRSHLQ_M_N_S
+ VRSHLQ_M_N_U
+ VSHLQ_M_R_S
+ VSHLQ_M_R_U
+ VSLIQ_N_S
+ VSLIQ_N_U
+ VSRIQ_N_S
+ VSRIQ_N_U
+ VQDMLSDHXQ_S
+ VQDMLSDHQ_S
+ VQDMLADHXQ_S
+ VQDMLADHQ_S
+ VMLSDAVAXQ_S
+ VMLSDAVAQ_S
+ VMLADAVAXQ_S
+ VCMPGEQ_M_F
+ VCMPGTQ_M_N_F
+ VMLSLDAVQ_P_S
+ VRMLALDAVHAXQ_S
+ VMLSLDAVXQ_P_S
+ VFMAQ_F
+ VMLSLDAVAQ_S
+ VQSHRUNBQ_N_S
+ VQRSHRUNTQ_N_S
+ VCMLAQ_F
+ VMINNMAQ_M_F
+ VFMASQ_N_F
+ VDUPQ_M_N_F
+ VCMPGTQ_M_F
+ VCMPLTQ_M_F
+ VRMLSLDAVHQ_P_S
+ VQSHRUNTQ_N_S
+ VABSQ_M_F
+ VMAXNMAVQ_P_F
+ VFMAQ_N_F
+ VRMLSLDAVHXQ_P_S
+ VREV32Q_M_F
+ VRMLSLDAVHAQ_S
+ VRMLSLDAVHAXQ_S
+ VCMPLTQ_M_N_F
+ VCMPNEQ_M_F
+ VRNDAQ_M_F
+ VRNDPQ_M_F
+ VADDLVAQ_P_S
+ VQMOVUNBQ_M_S
+ VCMPLEQ_M_F
+ VCMLAQ_ROT180_F
+ VMLSLDAVAXQ_S
+ VRNDXQ_M_F
+ VFMSQ_F
+ VMINNMVQ_P_F
+ VMAXNMVQ_P_F
+ VPSELQ_F
+ VCMLAQ_ROT90_F
+ VQMOVUNTQ_M_S
+ VREV64Q_M_F
+ VNEGQ_M_F
+ VRNDMQ_M_F
+ VCMPLEQ_M_N_F
+ VCMPGEQ_M_N_F
+ VRNDNQ_M_F
+ VMINNMAVQ_P_F
+ VCMPNEQ_M_N_F
+ VRMLALDAVHQ_P_S
+ VRMLALDAVHXQ_P_S
+ VCMPEQQ_M_N_F
+ VCMLAQ_ROT270_F
+ VMAXNMAQ_M_F
+ VRNDQ_M_F
+ VMLALDAVQ_P_U
+ VMLALDAVQ_P_S
+ VQMOVNBQ_M_S
+ VQMOVNBQ_M_U
+ VMOVLTQ_M_U
+ VMOVLTQ_M_S
+ VMOVNBQ_M_U
+ VMOVNBQ_M_S
+ VRSHRNTQ_N_U
+ VRSHRNTQ_N_S
+ VORRQ_M_N_S
+ VORRQ_M_N_U
+ VREV32Q_M_S
+ VREV32Q_M_U
+ VQRSHRNTQ_N_U
+ VQRSHRNTQ_N_S
+ VMOVNTQ_M_U
+ VMOVNTQ_M_S
+ VMOVLBQ_M_U
+ VMOVLBQ_M_S
+ VMLALDAVAQ_S
+ VMLALDAVAQ_U
+ VQSHRNBQ_N_U
+ VQSHRNBQ_N_S
+ VSHRNBQ_N_U
+ VSHRNBQ_N_S
+ VRSHRNBQ_N_S
+ VRSHRNBQ_N_U
+ VMLALDAVXQ_P_U
+ VMLALDAVXQ_P_S
+ VQMOVNTQ_M_U
+ VQMOVNTQ_M_S
+ VMVNQ_M_N_U
+ VMVNQ_M_N_S
+ VQSHRNTQ_N_U
+ VQSHRNTQ_N_S
+ VMLALDAVAXQ_S
+ VMLALDAVAXQ_U
+ VSHRNTQ_N_S
+ VSHRNTQ_N_U
+ VCVTBQ_M_F16_F32
+ VCVTBQ_M_F32_F16
+ VCVTTQ_M_F16_F32
+ VCVTTQ_M_F32_F16
+ VCVTMQ_M_S
+ VCVTMQ_M_U
+ VCVTNQ_M_S
+ VCVTPQ_M_S
+ VCVTPQ_M_U
+ VCVTQ_M_N_FROM_F_S
+ VCVTNQ_M_U
+ VREV16Q_M_S
+ VREV16Q_M_U
+ VREV32Q_M
+ VCVTQ_M_FROM_F_U
+ VCVTQ_M_FROM_F_S
+ VRMLALDAVHQ_P_U
+ VADDLVAQ_P_U
+ VCVTQ_M_N_FROM_F_U
+ VQSHLUQ_M_N_S
+ VABAVQ_P_S
+ VABAVQ_P_U
+ VSHLQ_M_S
+ VSHLQ_M_U
+ VSRIQ_M_N_S
+ VSRIQ_M_N_U
+ VSUBQ_M_U
+ VSUBQ_M_S
+ VCVTQ_M_N_TO_F_U
+ VCVTQ_M_N_TO_F_S
+ VQADDQ_M_U
+ VQADDQ_M_S
+ VRSHRQ_M_N_S
+ VSUBQ_M_N_S
+ VSUBQ_M_N_U
+ VBRSRQ_M_N_S
+ VSUBQ_M_N_F
+ VBICQ_M_F
+ VHADDQ_M_U
+ VBICQ_M_U
+ VBICQ_M_S
+ VMULQ_M_N_U
+ VHADDQ_M_S
+ VORNQ_M_F
+ VMLAQ_M_N_S
+ VQSUBQ_M_U
+ VQSUBQ_M_S
+ VMLAQ_M_N_U
+ VQSUBQ_M_N_U
+ VQSUBQ_M_N_S
+ VMULLTQ_INT_M_S
+ VMULLTQ_INT_M_U
+ VMULQ_M_N_S
+ VMULQ_M_N_F
+ VMLASQ_M_N_U
+ VMLASQ_M_N_S
+ VMAXQ_M_U
+ VQRDMLAHQ_M_N_U
+ VCADDQ_ROT270_M_F
+ VCADDQ_ROT270_M_U
+ VCADDQ_ROT270_M_S
+ VQRSHLQ_M_S
+ VMULQ_M_F
+ VRHADDQ_M_U
+ VSHRQ_M_N_U
+ VRHADDQ_M_S
+ VMULQ_M_S
+ VMULQ_M_U
+ VQDMLASHQ_M_N_S
+ VQRDMLASHQ_M_N_S
+ VRSHLQ_M_S
+ VRSHLQ_M_U
+ VRSHRQ_M_N_U
+ VADDQ_M_N_F
+ VADDQ_M_N_S
+ VADDQ_M_N_U
+ VQRDMLASHQ_M_N_U
+ VMAXQ_M_S
+ VQRDMLAHQ_M_N_S
+ VORRQ_M_S
+ VORRQ_M_U
+ VORRQ_M_F
+ VQRSHLQ_M_U
+ VRMULHQ_M_U
+ VRMULHQ_M_S
+ VMINQ_M_S
+ VMINQ_M_U
+ VANDQ_M_F
+ VANDQ_M_U
+ VANDQ_M_S
+ VHSUBQ_M_N_S
+ VHSUBQ_M_N_U
+ VMULHQ_M_S
+ VMULHQ_M_U
+ VMULLBQ_INT_M_U
+ VMULLBQ_INT_M_S
+ VCADDQ_ROT90_M_F
+ VSHRQ_M_N_S
+ VADDQ_M_U
+ VSLIQ_M_N_U
+ VQADDQ_M_N_S
+ VBRSRQ_M_N_F
+ VABDQ_M_F
+ VBRSRQ_M_N_U
+ VEORQ_M_F
+ VSHLQ_M_N_S
+ VQDMLAHQ_M_N_U
+ VQDMLAHQ_M_N_S
+ VSHLQ_M_N_U
+ VMLADAVAQ_P_U
+ VMLADAVAQ_P_S
+ VSLIQ_M_N_S
+ VQSHLQ_M_U
+ VQSHLQ_M_S
+ VCADDQ_ROT90_M_U
+ VCADDQ_ROT90_M_S
+ VORNQ_M_U
+ VORNQ_M_S
+ VQSHLQ_M_N_S
+ VQSHLQ_M_N_U
+ VADDQ_M_S
+ VHADDQ_M_N_S
+ VADDQ_M_F
+ VQADDQ_M_N_U
+ VEORQ_M_S
+ VEORQ_M_U
+ VHSUBQ_M_S
+ VHSUBQ_M_U
+ VHADDQ_M_N_U
+ VHCADDQ_ROT90_M_S
+ VQRDMLSDHQ_M_S
+ VQRDMLSDHXQ_M_S
+ VQRDMLADHXQ_M_S
+ VQDMULHQ_M_S
+ VMLADAVAXQ_P_S
+ VQDMLADHXQ_M_S
+ VQRDMULHQ_M_S
+ VMLSDAVAXQ_P_S
+ VQDMULHQ_M_N_S
+ VHCADDQ_ROT270_M_S
+ VQDMLSDHQ_M_S
+ VQDMLSDHXQ_M_S
+ VMLSDAVAQ_P_S
+ VQRDMLADHQ_M_S
+ VQDMLADHQ_M_S
+ VMLALDAVAQ_P_U
+ VMLALDAVAQ_P_S
+ VQRSHRNBQ_M_N_U
+ VQRSHRNBQ_M_N_S
+ VQRSHRNTQ_M_N_S
+ VQSHRNBQ_M_N_U
+ VQSHRNBQ_M_N_S
+ VQSHRNTQ_M_N_S
+ VRSHRNBQ_M_N_U
+ VRSHRNBQ_M_N_S
+ VRSHRNTQ_M_N_U
+ VSHLLBQ_M_N_U
+ VSHLLBQ_M_N_S
+ VSHLLTQ_M_N_U
+ VSHLLTQ_M_N_S
+ VSHRNBQ_M_N_S
+ VSHRNBQ_M_N_U
+ VSHRNTQ_M_N_S
+ VSHRNTQ_M_N_U
+ VMLALDAVAXQ_P_S
+ VQRSHRNTQ_M_N_U
+ VQSHRNTQ_M_N_U
+ VRSHRNTQ_M_N_S
+ VQRDMULHQ_M_N_S
+ VRMLALDAVHAQ_P_S
+ VMLSLDAVAQ_P_S
+ VMLSLDAVAXQ_P_S
+ VMULLBQ_POLY_M_P
+ VMULLTQ_POLY_M_P
+ VQDMULLBQ_M_N_S
+ VQDMULLBQ_M_S
+ VQDMULLTQ_M_N_S
+ VQDMULLTQ_M_S
+ VQRSHRUNBQ_M_N_S
+ VQSHRUNBQ_M_N_S
+ VQSHRUNTQ_M_N_S
+ VRMLALDAVHAQ_P_U
+ VRMLALDAVHAXQ_P_S
+ VRMLSLDAVHAQ_P_S
+ VRMLSLDAVHAXQ_P_S
+ VQRSHRUNTQ_M_N_S
+ VCMLAQ_M_F
+ VCMLAQ_ROT180_M_F
+ VCMLAQ_ROT270_M_F
+ VCMLAQ_ROT90_M_F
+ VCMULQ_M_F
+ VCMULQ_ROT180_M_F
+ VCMULQ_ROT270_M_F
+ VCMULQ_ROT90_M_F
+ VFMAQ_M_F
+ VFMAQ_M_N_F
+ VFMASQ_M_N_F
+ VFMSQ_M_F
+ VMAXNMQ_M_F
+ VMINNMQ_M_F
+ VSUBQ_M_F
+ VSTRWQSB_S
+ VSTRWQSB_U
+ VSTRBQSO_S
+ VSTRBQSO_U
+ VSTRBQ_S
+ VSTRBQ_U
+ VLDRBQGO_S
+ VLDRBQGO_U
+ VLDRBQ_S
+ VLDRBQ_U
+ VLDRWQGB_S
+ VLDRWQGB_U
+ VLD1Q_F
+ VLD1Q_S
+ VLD1Q_U
+ VLDRHQ_F
+ VLDRHQGO_S
+ VLDRHQGO_U
+ VLDRHQGSO_S
+ VLDRHQGSO_U
+ VLDRHQ_S
+ VLDRHQ_U
+ VLDRWQ_F
+ VLDRWQ_S
+ VLDRWQ_U
+ VLDRDQGB_S
+ VLDRDQGB_U
+ VLDRDQGO_S
+ VLDRDQGO_U
+ VLDRDQGSO_S
+ VLDRDQGSO_U
+ VLDRHQGO_F
+ VLDRHQGSO_F
+ VLDRWQGB_F
+ VLDRWQGO_F
+ VLDRWQGO_S
+ VLDRWQGO_U
+ VLDRWQGSO_F
+ VLDRWQGSO_S
+ VLDRWQGSO_U
+ VSTRHQ_F
+ VST1Q_S
+ VST1Q_U
+ VSTRHQSO_S
+ VSTRHQ_U
+ VSTRWQ_S
+ VSTRWQ_U
+ VSTRWQ_F
+ VST1Q_F
+ VSTRDQSB_S
+ VSTRDQSB_U
+ VSTRDQSO_S
+ VSTRDQSO_U
+ VSTRDQSSO_S
+ VSTRDQSSO_U
+ VSTRWQSO_S
+ VSTRWQSO_U
+ VSTRWQSSO_S
+ VSTRWQSSO_U
+ VSTRHQSO_F
+ VSTRHQSSO_F
+ VSTRWQSB_F
+ VSTRWQSO_F
+ VSTRWQSSO_F
+ VDDUPQ
+ VDDUPQ_M
+ VDWDUPQ
+ VDWDUPQ_M
+ VIDUPQ
+ VIDUPQ_M
+ VIWDUPQ
+ VIWDUPQ_M
+ VSTRWQSBWB_S
+ VSTRWQSBWB_U
+ VLDRWQGBWB_S
+ VLDRWQGBWB_U
+ VSTRWQSBWB_F
+ VLDRWQGBWB_F
+ VSTRDQSBWB_S
+ VSTRDQSBWB_U
+ VLDRDQGBWB_S
+ VLDRDQGBWB_U
+ VADCQ_U
+ VADCQ_M_U
+ VADCQ_S
+ VADCQ_M_S
+ VSBCIQ_U
+ VSBCIQ_S
+ VSBCIQ_M_U
+ VSBCIQ_M_S
+ VSBCQ_U
+ VSBCQ_S
+ VSBCQ_M_U
+ VSBCQ_M_S
+ VADCIQ_U
+ VADCIQ_M_U
+ VADCIQ_S
+ VADCIQ_M_S
+ VLD2Q
+ VLD4Q
+ VST2Q
+ VSHLCQ_M_U
+ VSHLCQ_M_S
+ VSTRHQSO_U
+ VSTRHQSSO_S
+ VSTRHQSSO_U
+ VSTRHQ_S
+ SRSHRL
+ SRSHR
+ URSHR
+ URSHRL
+ SQRSHR
+ UQRSHL
+ UQRSHLL_64
+ UQRSHLL_48
+ SQRSHRL_64
+ SQRSHRL_48
+ VSHLCQ_M_
+])
diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md
index b7e3619..250e503 100644
--- a/gcc/config/arm/vec-common.md
+++ b/gcc/config/arm/vec-common.md
@@ -81,104 +81,53 @@
;; patterns separately for Neon, IWMMXT and MVE.
(define_expand "add<mode>3"
- [(set (match_operand:VNIM 0 "s_register_operand")
- (plus:VNIM (match_operand:VNIM 1 "s_register_operand")
- (match_operand:VNIM 2 "s_register_operand")))]
- "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
- || flag_unsafe_math_optimizations))
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))
- || (TARGET_HAVE_MVE && VALID_MVE_SI_MODE(<MODE>mode))
- || (TARGET_HAVE_MVE_FLOAT && VALID_MVE_SF_MODE(<MODE>mode))"
-{
-})
-
-;; Vector arithmetic. Expanders are blank, then unnamed insns implement
-;; patterns separately for Neon and MVE.
-
-(define_expand "addv8hf3"
- [(set (match_operand:V8HF 0 "s_register_operand")
- (plus:V8HF (match_operand:V8HF 1 "s_register_operand")
- (match_operand:V8HF 2 "s_register_operand")))]
- "(TARGET_HAVE_MVE_FLOAT && VALID_MVE_SF_MODE(V8HFmode))
- || (TARGET_NEON_FP16INST && flag_unsafe_math_optimizations)"
-{
- if (TARGET_NEON_FP16INST && flag_unsafe_math_optimizations)
- emit_insn (gen_addv8hf3_neon (operands[0], operands[1], operands[2]));
-})
-
-;; Vector arithmetic. Expanders are blank, then unnamed insns implement
-;; patterns separately for Neon and IWMMXT.
-
-(define_expand "add<mode>3"
- [(set (match_operand:VNINOTM 0 "s_register_operand")
- (plus:VNINOTM (match_operand:VNINOTM 1 "s_register_operand")
- (match_operand:VNINOTM 2 "s_register_operand")))]
- "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
- || flag_unsafe_math_optimizations))
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
-{
-})
-
-;; Vector arithmetic. Expanders are blank, then unnamed insns implement
-;; patterns separately for IWMMXT and Neon.
+ [(set (match_operand:VDQ 0 "s_register_operand")
+ (plus:VDQ (match_operand:VDQ 1 "s_register_operand")
+ (match_operand:VDQ 2 "s_register_operand")))]
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "sub<mode>3"
- [(set (match_operand:VALL 0 "s_register_operand")
- (minus:VALL (match_operand:VALL 1 "s_register_operand")
- (match_operand:VALL 2 "s_register_operand")))]
- "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
- || flag_unsafe_math_optimizations))
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
-{
-})
+ [(set (match_operand:VDQ 0 "s_register_operand")
+ (minus:VDQ (match_operand:VDQ 1 "s_register_operand")
+ (match_operand:VDQ 2 "s_register_operand")))]
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "mul<mode>3"
- [(set (match_operand:VALLW 0 "s_register_operand")
- (mult:VALLW (match_operand:VALLW 1 "s_register_operand")
- (match_operand:VALLW 2 "s_register_operand")))]
- "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
- || flag_unsafe_math_optimizations))
- || (<MODE>mode == V4HImode && TARGET_REALLY_IWMMXT)"
-{
-})
+ [(set (match_operand:VDQWH 0 "s_register_operand")
+ (mult:VDQWH (match_operand:VDQWH 1 "s_register_operand")
+ (match_operand:VDQWH 2 "s_register_operand")))]
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "smin<mode>3"
[(set (match_operand:VALLW 0 "s_register_operand")
(smin:VALLW (match_operand:VALLW 1 "s_register_operand")
(match_operand:VALLW 2 "s_register_operand")))]
- "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
- || flag_unsafe_math_optimizations))
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
-{
-})
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "umin<mode>3"
[(set (match_operand:VINTW 0 "s_register_operand")
(umin:VINTW (match_operand:VINTW 1 "s_register_operand")
(match_operand:VINTW 2 "s_register_operand")))]
- "TARGET_NEON
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
-{
-})
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "smax<mode>3"
[(set (match_operand:VALLW 0 "s_register_operand")
(smax:VALLW (match_operand:VALLW 1 "s_register_operand")
(match_operand:VALLW 2 "s_register_operand")))]
- "(TARGET_NEON && ((<MODE>mode != V2SFmode && <MODE>mode != V4SFmode)
- || flag_unsafe_math_optimizations))
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
-{
-})
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "umax<mode>3"
[(set (match_operand:VINTW 0 "s_register_operand")
(umax:VINTW (match_operand:VINTW 1 "s_register_operand")
(match_operand:VINTW 2 "s_register_operand")))]
- "TARGET_NEON
- || (TARGET_REALLY_IWMMXT && VALID_IWMMXT_REG_MODE (<MODE>mode))"
-{
-})
+ "ARM_HAVE_<MODE>_ARITH"
+)
(define_expand "vec_perm<mode>"
[(match_operand:VE 0 "s_register_operand")
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index 6a2bc5a..e6c287c 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -387,31 +387,15 @@
(set_attr "arch" "t2,any,any,any,a,t2,any,any,any,any,any,any")]
)
-(define_insn "*mov_load_vfp_hf16"
- [(set (match_operand:HF 0 "s_register_operand" "=t")
- (match_operand:HF 1 "memory_operand" "Uj"))]
- "TARGET_HAVE_MVE_FLOAT"
- "vldr.16\\t%0, %E1"
-)
-
-(define_insn "*mov_store_vfp_hf16"
- [(set (match_operand:HF 0 "memory_operand" "=Uj")
- (match_operand:HF 1 "s_register_operand" "t"))]
- "TARGET_HAVE_MVE_FLOAT"
- "vstr.16\\t%1, %E0"
-)
-
;; HFmode and BFmode moves
(define_insn "*mov<mode>_vfp_<mode>16"
[(set (match_operand:HFBF 0 "nonimmediate_operand"
- "= ?r,?m,t,r,t,r,t, t, Um,r")
+ "= ?r,?m,t,r,t,r,t, t, Uj,r")
(match_operand:HFBF 1 "general_operand"
- " m,r,t,r,r,t,Dv,Um,t, F"))]
+ " m,r,t,r,r,t,Dv,Uj,t, F"))]
"TARGET_32BIT
- && TARGET_VFP_FP16INST
- && arm_mve_mode_and_operands_type_check (<MODE>mode, operands[0],
- operands[1])
+ && (TARGET_VFP_FP16INST || TARGET_HAVE_MVE)
&& (s_register_operand (operands[0], <MODE>mode)
|| s_register_operand (operands[1], <MODE>mode))"
{
@@ -430,9 +414,15 @@
case 6: /* S register from immediate. */
return \"vmov.f16\\t%0, %1\t%@ __<fporbf>\";
case 7: /* S register from memory. */
- return \"vld1.16\\t{%z0}, %A1\";
+ if (TARGET_HAVE_MVE)
+ return \"vldr.16\\t%0, %1\";
+ else
+ return \"vld1.16\\t{%z0}, %A1\";
case 8: /* Memory from S register. */
- return \"vst1.16\\t{%z1}, %A0\";
+ if (TARGET_HAVE_MVE)
+ return \"vstr.16\\t%1, %0\";
+ else
+ return \"vst1.16\\t{%z1}, %A0\";
case 9: /* ARM register from constant. */
{
long bits;
@@ -2135,7 +2125,7 @@
(match_operand:DF 1 "const_double_operand" "F"))
(clobber (match_operand:DF 2 "s_register_operand" "=r"))]
"arm_disable_literal_pool
- && TARGET_HARD_FLOAT
+ && TARGET_VFP_BASE
&& !arm_const_double_rtx (operands[1])
&& !(TARGET_VFP_DOUBLE && vfp3_const_double_rtx (operands[1]))"
"#"
@@ -2161,7 +2151,7 @@
(match_operand:SF 1 "const_double_operand" "E"))
(clobber (match_operand:SF 2 "s_register_operand" "=r"))]
"arm_disable_literal_pool
- && TARGET_HARD_FLOAT
+ && TARGET_VFP_BASE
&& !vfp3_const_double_rtx (operands[1])"
"#"
""
diff --git a/gcc/config/arm/vxworks.h b/gcc/config/arm/vxworks.h
index 2ebfce8..487ec0f 100644
--- a/gcc/config/arm/vxworks.h
+++ b/gcc/config/arm/vxworks.h
@@ -44,7 +44,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
\
if (arm_arch_xscale) \
builtin_define ("_VX_CPU=XSCALE"); \
- if (arm_arch8) \
+ else if (arm_arch8) \
builtin_define ("_VX_CPU=ARMARCH8A"); \
else if (arm_arch7) \
{ \
diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md
index 769d8ea..8e7cf50 100644
--- a/gcc/config/bpf/bpf.md
+++ b/gcc/config/bpf/bpf.md
@@ -165,6 +165,16 @@
"div<msuffix>\t%0,%2"
[(set_attr "type" "<mtype>")])
+;; However, xBPF does provide a signed division operator, sdiv.
+
+(define_insn "div<AM:mode>3"
+ [(set (match_operand:AM 0 "register_operand" "=r,r")
+ (div:AM (match_operand:AM 1 "register_operand" " 0,0")
+ (match_operand:AM 2 "reg_or_imm_operand" "r,I")))]
+ "TARGET_XBPF"
+ "sdiv<msuffix>\t%0,%2"
+ [(set_attr "type" "<mtype>")])
+
;;; Modulus
;; Note that eBPF doesn't provide instructions for signed integer
@@ -178,6 +188,16 @@
"mod<msuffix>\t%0,%2"
[(set_attr "type" "<mtype>")])
+;; Again, xBPF provides a signed version, smod.
+
+(define_insn "mod<AM:mode>3"
+ [(set (match_operand:AM 0 "register_operand" "=r,r")
+ (mod:AM (match_operand:AM 1 "register_operand" " 0,0")
+ (match_operand:AM 2 "reg_or_imm_operand" "r,I")))]
+ "TARGET_XBPF"
+ "smod<msuffix>\t%0,%2"
+ [(set_attr "type" "<mtype>")])
+
;;; Logical AND
(define_insn "and<AM:mode>3"
[(set (match_operand:AM 0 "register_operand" "=r,r")
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 54cd1e4..49c540f 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -125,6 +125,6 @@ extern bool darwin_kextabi_p (void);
extern void darwin_override_options (void);
extern void darwin_patch_builtins (void);
extern void darwin_rename_builtins (void);
-extern bool darwin_libc_has_function (enum function_class fn_class);
+extern bool darwin_libc_has_function (enum function_class fn_class, tree);
#endif /* CONFIG_DARWIN_PROTOS_H */
diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def
index 98677f6..65bf5ad 100644
--- a/gcc/config/darwin-sections.def
+++ b/gcc/config/darwin-sections.def
@@ -198,3 +198,18 @@ DEF_SECTION (objc2_image_info_section, 0,
".section __DATA, __objc_imageinfo, regular, no_dead_strip", 1)
DEF_SECTION (objc2_constant_string_object_section, 0,
".section __DATA, __objc_stringobj, regular, no_dead_strip", 1)
+
+/* Additions for compatibility with later runtime conventions especially for
+ sections containing strings. */
+DEF_SECTION (objc2_data_section, 0, ".section __DATA, __data", 1)
+
+DEF_SECTION (objc2_ivar_section, 0, ".section __DATA, __objc_ivar", 1)
+
+DEF_SECTION (objc2_class_names_section, 0,
+ ".section __TEXT, __objc_classname, cstring_literals", 1)
+
+DEF_SECTION (objc2_method_names_section, 0,
+ ".section __TEXT, __objc_methname, cstring_literals", 1)
+
+DEF_SECTION (objc2_method_types_section, 0,
+ ".section __TEXT, __objc_methtype, cstring_literals", 1)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index c8edfb8..dd4857f 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -136,7 +136,7 @@ output_objc_section_asm_op (const void *directive)
order in the object. The code below implements this by emitting
a section header for each ObjC section the first time that an ObjC
section is requested. */
- if (! been_here)
+ if (darwin_symbol_stubs && ! been_here)
{
section *saved_in_section = in_section;
static const enum darwin_section_enum tomark[] =
@@ -174,20 +174,23 @@ output_objc_section_asm_op (const void *directive)
/* ABI=2 */
static const enum darwin_section_enum tomarkv2[] =
{
+ objc2_method_names_section,
objc2_message_refs_section,
+ objc2_selector_refs_section,
+ objc2_ivar_section,
objc2_classdefs_section,
objc2_metadata_section,
objc2_classrefs_section,
+ objc2_class_names_section,
objc2_classlist_section,
objc2_categorylist_section,
- objc2_selector_refs_section,
objc2_nonlazy_class_section,
objc2_nonlazy_category_section,
objc2_protocollist_section,
objc2_protocolrefs_section,
objc2_super_classrefs_section,
+ objc2_constant_string_object_section,
objc2_image_info_section,
- objc2_constant_string_object_section
} ;
size_t i;
@@ -1436,7 +1439,7 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
gcc_assert (TREE_CODE (ident) == IDENTIFIER_NODE);
p = IDENTIFIER_POINTER (ident);
- gcc_checking_assert (flag_next_runtime == 1 && flag_objc_abi == 2);
+ gcc_checking_assert (flag_next_runtime >= 1 && flag_objc_abi == 2);
objc_metadata_seen = 1;
@@ -1447,11 +1450,20 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
first. */
if (!strncmp (p, "V2_BASE", 7))
return base;
+ else if (!strncmp (p, "V2_CNAM", 7))
+ return darwin_sections[objc2_class_names_section];
+ else if (!strncmp (p, "V2_MNAM", 7))
+ return darwin_sections[objc2_method_names_section];
+ else if (!strncmp (p, "V2_MTYP", 7))
+ return darwin_sections[objc2_method_types_section];
else if (!strncmp (p, "V2_STRG", 7))
return darwin_sections[cstring_section];
else if (!strncmp (p, "G2_META", 7) || !strncmp (p, "G2_CLAS", 7))
return darwin_sections[objc2_classdefs_section];
+ else if (!strncmp (p, "V2_PCOL", 7))
+ return ld_uses_coal_sects ? darwin_sections[data_coal_section]
+ : darwin_sections[objc2_data_section];
else if (!strncmp (p, "V2_MREF", 7))
return darwin_sections[objc2_message_refs_section];
else if (!strncmp (p, "V2_CLRF", 7))
@@ -1487,6 +1499,9 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
else if (!strncmp (p, "V2_CSTR", 7))
return darwin_sections[objc2_constant_string_object_section];
+ else if (!strncmp (p, "V2_IVRF", 7))
+ return darwin_sections[objc2_ivar_section];
+
/* Not recognized, default. */
return base;
}
@@ -1500,7 +1515,7 @@ darwin_objc1_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
gcc_assert (TREE_CODE (ident) == IDENTIFIER_NODE);
p = IDENTIFIER_POINTER (ident);
- gcc_checking_assert (flag_next_runtime == 1 && flag_objc_abi < 2);
+ gcc_checking_assert (flag_next_runtime >= 1 && flag_objc_abi < 2);
objc_metadata_seen = 1;
@@ -1861,6 +1876,14 @@ darwin_globalize_label (FILE *stream, const char *name)
{
if (!!strncmp (name, "_OBJC_", 6))
default_globalize_label (stream, name);
+ /* We have some Objective C cases that need to be global, but only on newer
+ OS versions. */
+ if (flag_objc_abi < 2 || flag_next_runtime < 100700)
+ return;
+ if (!strncmp (name+6, "LabelPro", 8))
+ default_globalize_label (stream, name);
+ if (!strncmp (name+6, "Protocol_", 9))
+ default_globalize_label (stream, name);
}
/* This routine returns non-zero if 'name' starts with the special objective-c
@@ -1879,7 +1902,49 @@ darwin_label_is_anonymous_local_objc_name (const char *name)
while (*p >= '0' && *p <= '9')
p++;
}
- return (!strncmp ((const char *)p, "_OBJC_", 6));
+ if (strncmp ((const char *)p, "_OBJC_", 6) != 0)
+ return false;
+
+ /* We need some of the objective c meta-data symbols to be visible to the
+ linker (when the target OS version is newer). FIXME: this is horrible,
+ we need a better mechanism. */
+
+ if (flag_objc_abi < 2 || flag_next_runtime < 100700)
+ return true;
+
+ p += 6;
+ if (!strncmp ((const char *)p, "ClassRef", 8))
+ return false;
+ else if (!strncmp ((const char *)p, "SelRef", 6))
+ return false;
+ else if (!strncmp ((const char *)p, "Category", 8))
+ {
+ if (p[8] == '_' || p[8] == 'I' || p[8] == 'P' || p[8] == 'C' )
+ return false;
+ return true;
+ }
+ else if (!strncmp ((const char *)p, "ClassMethods", 12))
+ return false;
+ else if (!strncmp ((const char *)p, "Instance", 8))
+ {
+ if (p[8] == 'I' || p[8] == 'M')
+ return false;
+ return true;
+ }
+ else if (!strncmp ((const char *)p, "CLASS_RO", 8))
+ return false;
+ else if (!strncmp ((const char *)p, "METACLASS_RO", 12))
+ return false;
+ else if (!strncmp ((const char *)p, "Protocol", 8))
+ {
+ if (p[8] == '_' || p[8] == 'I' || p[8] == 'P'
+ || p[8] == 'M' || p[8] == 'C' || p[8] == 'O')
+ return false;
+ return true;
+ }
+ else if (!strncmp ((const char *)p, "LabelPro", 8))
+ return false;
+ return true;
}
/* LTO support for Mach-O.
@@ -2384,11 +2449,7 @@ darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
unsigned HOST_WIDE_INT size,
unsigned int l2align)
{
- /* FIXME: We have a fudge to make this work with Java even when the target does
- not use sections anchors -- Java seems to need at least one small item in a
- non-zerofill segment. */
- if ((DARWIN_SECTION_ANCHORS && flag_section_anchors && size < BYTES_ZFILL)
- || (size && size <= 2))
+ if (DARWIN_SECTION_ANCHORS && flag_section_anchors && size < BYTES_ZFILL)
{
/* Put smaller objects in _static_data, where the section anchors system
can get them.
@@ -2414,16 +2475,13 @@ darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
}
else
{
- /* When we are on a non-section anchor target, we can get zero-sized
- items here. However, all we need to do is to bump them to one byte
- and the section alignment will take care of the rest. */
+ /* When we are on a non-section anchor target (or not using section
+ anchors, we can get zero-sized items here. However, all we need to
+ do is to bump them to one byte and the section alignment will take
+ care of the rest. */
char secnam[64];
- unsigned int flags ;
- snprintf (secnam, 64, "__DATA,__%sbss%u", ((size)?"":"zo_"),
- (unsigned) l2align);
- /* We can't anchor (yet, if ever) in zerofill sections, because we can't
- switch to them and emit a label. */
- flags = SECTION_BSS|SECTION_WRITE|SECTION_NO_ANCHOR;
+ snprintf (secnam, 64, "__DATA,__bss");
+ unsigned int flags = SECTION_BSS|SECTION_WRITE|SECTION_NO_ANCHOR;
in_section = get_section (secnam, flags, NULL);
fprintf (fp, "\t.zerofill %s,", secnam);
assemble_name (fp, name);
@@ -2434,7 +2492,7 @@ darwin_emit_local_bss (FILE *fp, tree decl, const char *name,
fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",
size, (unsigned) l2align);
else
- fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED"\n", size);
+ fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED",0\n", size);
}
(*targetm.encode_section_info) (decl, DECL_RTL (decl), false);
@@ -2559,9 +2617,8 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
return;
}
- /* So we have a public symbol (small item fudge for Java, see above). */
- if ((DARWIN_SECTION_ANCHORS && flag_section_anchors && size < BYTES_ZFILL)
- || (size && size <= 2))
+ /* So we have a public symbol. */
+ if (DARWIN_SECTION_ANCHORS && flag_section_anchors && size < BYTES_ZFILL)
{
/* Put smaller objects in data, where the section anchors system can get
them. However, if they are zero-sized punt them to yet a different
@@ -2586,16 +2643,10 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
}
else
{
+ /* Section anchors not in use. */
+ unsigned int flags = SECTION_BSS|SECTION_WRITE|SECTION_NO_ANCHOR;
char secnam[64];
- unsigned int flags ;
- /* When we are on a non-section anchor target, we can get zero-sized
- items here. However, all we need to do is to bump them to one byte
- and the section alignment will take care of the rest. */
- snprintf (secnam, 64, "__DATA,__%spu_bss%u", ((size)?"":"zo_"), l2align);
-
- /* We can't anchor in zerofill sections, because we can't switch
- to them and emit a label. */
- flags = SECTION_BSS|SECTION_WRITE|SECTION_NO_ANCHOR;
+ snprintf (secnam, 64, "__DATA,__common");
in_section = get_section (secnam, flags, NULL);
fprintf (fp, "\t.zerofill %s,", secnam);
assemble_name (fp, name);
@@ -2605,7 +2656,7 @@ fprintf (fp, "# albss: %s (%lld,%d) ro %d cst %d stat %d com %d"
if (l2align)
fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", size, l2align);
else
- fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED"\n", size);
+ fprintf (fp, "," HOST_WIDE_INT_PRINT_UNSIGNED",0\n", size);
}
(* targetm.encode_section_info) (decl, DECL_RTL (decl), false);
}
@@ -3141,10 +3192,14 @@ darwin_override_options (void)
/* Keep track of which (major) version we're generating code for. */
if (darwin_macosx_version_min)
{
- if (strverscmp (darwin_macosx_version_min, "10.6") >= 0)
+ if (strverscmp (darwin_macosx_version_min, "10.7") >= 0)
+ generating_for_darwin_version = 11;
+ else if (strverscmp (darwin_macosx_version_min, "10.6") >= 0)
generating_for_darwin_version = 10;
else if (strverscmp (darwin_macosx_version_min, "10.5") >= 0)
generating_for_darwin_version = 9;
+ else if (strverscmp (darwin_macosx_version_min, "10.4") >= 0)
+ generating_for_darwin_version = 8;
/* Earlier versions are not specifically accounted, until required. */
}
@@ -3160,6 +3215,20 @@ darwin_override_options (void)
should check for correctness re. the ABI. TODO: check and provide the
flags (runtime & ABI) from the lto wrapper). */
+ /* At present, make a hard update to the runtime version based on the target
+ OS version. */
+ if (flag_next_runtime)
+ {
+ if (generating_for_darwin_version > 10)
+ flag_next_runtime = 100705;
+ else if (generating_for_darwin_version > 9)
+ flag_next_runtime = 100608;
+ else if (generating_for_darwin_version > 8)
+ flag_next_runtime = 100508;
+ else
+ flag_next_runtime = 100000;
+ }
+
/* Unless set, force ABI=2 for NeXT and m64, 0 otherwise. */
if (!global_options_set.x_flag_objc_abi)
global_options.x_flag_objc_abi
@@ -3542,7 +3611,8 @@ darwin_rename_builtins (void)
}
bool
-darwin_libc_has_function (enum function_class fn_class)
+darwin_libc_has_function (enum function_class fn_class,
+ tree type ATTRIBUTE_UNUSED)
{
if (fn_class == function_sincos)
return (strverscmp (darwin_macosx_version_min, "10.9") >= 0);
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 55a5361..f9d4fec 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -107,7 +107,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Default to using the NeXT-style runtime, since that's what is
pre-installed on Darwin systems. */
-#define NEXT_OBJC_RUNTIME 1
+#define NEXT_OBJC_RUNTIME 100508
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions. */
@@ -476,6 +476,7 @@ extern GTY(()) int darwin_ms_struct;
debugging data. */
#define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):%{!gdwarf*:--gstabs}}}"
+#define ASM_DEBUG_OPTION_SPEC ""
#define ASM_FINAL_SPEC \
"%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform} %<gsplit-dwarf"
diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h
index b7bdf63..787aca7 100644
--- a/gcc/config/darwin9.h
+++ b/gcc/config/darwin9.h
@@ -41,6 +41,9 @@ along with GCC; see the file COPYING3. If not see
#undef ASM_DEBUG_SPEC
#define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):%{gstabs:--gstabs}}}"
+#undef ASM_DEBUG_OPTION_SPEC
+#define ASM_DEBUG_OPTION_SPEC ""
+
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
do { \
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 0e73fea..763e770 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -67,6 +67,7 @@
UNSPECV_ICACHE_INV])
(define_c_enum "unspec" [
+ UNSPEC_ADDPTR
UNSPEC_VECTOR
UNSPEC_BPERMUTE
UNSPEC_SGPRBASE
@@ -1219,29 +1220,47 @@
; "addptr" is the same as "add" except that it must not write to VCC or SCC
; as a side-effect. Unfortunately GCN does not have a suitable instruction
-; for this, so we use a custom VOP3 add with CC_SAVE_REG as a temp.
-; Note that it is not safe to save/clobber/restore SCC because doing so will
-; break data-flow analysis, so this must use vector registers.
+; for this, so we use CC_SAVE_REG as a temp.
+; Note that it is not safe to save/clobber/restore as separate insns because
+; doing so will break data-flow analysis, so this must use multiple
+; instructions in one insn.
;
; The "v0" should be just "v", but somehow the "0" helps LRA not loop forever
; on testcase pr54713-2.c with -O0. It's only an optimization hint anyway.
+;
+; The SGPR alternative is preferred as it is typically used with mov_sgprbase.
(define_insn "addptrdi3"
- [(set (match_operand:DI 0 "register_operand" "= v")
- (plus:DI (match_operand:DI 1 "register_operand" " v0")
- (match_operand:DI 2 "nonmemory_operand" "vDA")))]
+ [(set (match_operand:DI 0 "register_operand" "= v, Sg")
+ (unspec:DI [
+ (plus:DI (match_operand:DI 1 "register_operand" "^v0,Sg0")
+ (match_operand:DI 2 "nonmemory_operand" "vDA,SgDB"))]
+ UNSPEC_ADDPTR))]
""
{
- rtx new_operands[4] = { operands[0], operands[1], operands[2],
- gen_rtx_REG (DImode, CC_SAVE_REG) };
+ if (which_alternative == 0)
+ {
+ rtx new_operands[4] = { operands[0], operands[1], operands[2],
+ gen_rtx_REG (DImode, CC_SAVE_REG) };
- output_asm_insn ("v_add%^_u32 %L0, %3, %L2, %L1", new_operands);
- output_asm_insn ("v_addc%^_u32 %H0, %3, %H2, %H1, %3", new_operands);
+ output_asm_insn ("v_add%^_u32\t%L0, %3, %L2, %L1", new_operands);
+ output_asm_insn ("v_addc%^_u32\t%H0, %3, %H2, %H1, %3", new_operands);
+ }
+ else
+ {
+ rtx new_operands[4] = { operands[0], operands[1], operands[2],
+ gen_rtx_REG (BImode, CC_SAVE_REG) };
+
+ output_asm_insn ("s_mov_b32\t%3, scc", new_operands);
+ output_asm_insn ("s_add_u32\t%L0, %L1, %L2", new_operands);
+ output_asm_insn ("s_addc_u32\t%H0, %H1, %H2", new_operands);
+ output_asm_insn ("s_cmpk_lg_u32\t%3, 0", new_operands);
+ }
return "";
}
- [(set_attr "type" "vmult")
- (set_attr "length" "16")])
+ [(set_attr "type" "vmult,mult")
+ (set_attr "length" "16,24")])
;; }}}
;; {{{ ALU special cases: Minus
diff --git a/gcc/config/gcn/mkoffload.c b/gcc/config/gcn/mkoffload.c
index 0983b98..f7589a5 100644
--- a/gcc/config/gcn/mkoffload.c
+++ b/gcc/config/gcn/mkoffload.c
@@ -737,7 +737,8 @@ compile_native (const char *infile, const char *outfile, const char *compiler,
obstack_ptr_grow (&argv_obstack, NULL);
const char **new_argv = XOBFINISH (&argv_obstack, const char **);
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ ".gccnative_args");
obstack_free (&argv_obstack, NULL);
}
@@ -1001,7 +1002,7 @@ main (int argc, char **argv)
unsetenv ("LIBRARY_PATH");
/* Run the compiler pass. */
- fork_execute (cc_argv[0], CONST_CAST (char **, cc_argv), true);
+ fork_execute (cc_argv[0], CONST_CAST (char **, cc_argv), true, ".gcc_args");
obstack_free (&cc_argv_obstack, NULL);
in = fopen (gcn_s1_name, "r");
@@ -1022,7 +1023,7 @@ main (int argc, char **argv)
fclose (out);
/* Run the assemble/link pass. */
- fork_execute (ld_argv[0], CONST_CAST (char **, ld_argv), true);
+ fork_execute (ld_argv[0], CONST_CAST (char **, ld_argv), true, ".ld_args");
obstack_free (&ld_argv_obstack, NULL);
in = fopen (gcn_o_name, "r");
diff --git a/gcc/config/i386/adxintrin.h b/gcc/config/i386/adxintrin.h
index 6c15417..6dffe45 100644
--- a/gcc/config/i386/adxintrin.h
+++ b/gcc/config/i386/adxintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <adxintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _ADXINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/amxbf16intrin.h b/gcc/config/i386/amxbf16intrin.h
new file mode 100644
index 0000000..77cc395
--- /dev/null
+++ b/gcc/config/i386/amxbf16intrin.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2020 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/>. */
+
+#if !defined _IMMINTRIN_H_INCLUDED
+#error "Never use <amxbf16intrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef _AMXBF16INTRIN_H_INCLUDED
+#define _AMXBF16INTRIN_H_INCLUDED
+
+#if !defined(__AMX_BF16__)
+#pragma GCC push_options
+#pragma GCC target("amx-bf16")
+#define __DISABLE_AMX_BF16__
+#endif /* __AMX_BF16__ */
+
+#if defined(__x86_64__) && defined(__AMX_BF16__)
+#define _tile_dpbf16ps_internal(dst,src1,src2) \
+ __asm__ volatile\
+ ("{tdpbf16ps\t%%tmm"#src2", %%tmm"#src1", %%tmm"#dst"|tdpbf16ps\t%%tmm"#dst", %%tmm"#src1", %%tmm"#src2"}" ::)
+
+#define _tile_dpbf16ps(dst,src1,src2) \
+ _tile_dpbf16ps_internal (dst, src1, src2)
+
+#endif
+
+#ifdef __DISABLE_AMX_BF16__
+#undef __DISABLE_AMX_BF16__
+#pragma GCC pop_options
+#endif /* __DISABLE_AMX_BF16__ */
+
+#endif /* _AMXBF16INTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/amxint8intrin.h b/gcc/config/i386/amxint8intrin.h
new file mode 100644
index 0000000..f4e410b
--- /dev/null
+++ b/gcc/config/i386/amxint8intrin.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 2020 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/>. */
+
+#if !defined _IMMINTRIN_H_INCLUDED
+#error "Never use <amxint8intrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef _AMXINT8INTRIN_H_INCLUDED
+#define _AMXINT8INTRIN_H_INCLUDED
+
+#if !defined(__AMX_INT8__)
+#pragma GCC push_options
+#pragma GCC target("amx-int8")
+#define __DISABLE_AMX_INT8__
+#endif /* __AMX_INT8__ */
+
+#if defined(__x86_64__) && defined(__AMX_INT8__)
+#define _tile_int8_dp_internal(name,dst,src1,src2) \
+ __asm__ volatile \
+ ("{"#name"\t%%tmm"#src2", %%tmm"#src1", %%tmm"#dst"|"#name"\t%%tmm"#dst", %%tmm"#src1", %%tmm"#src2"}" ::)
+
+#define _tile_dpbssd(dst,src1,src2) \
+ _tile_int8_dp_internal (tdpbssd, dst, src1, src2)
+
+#define _tile_dpbsud(dst,src1,src2) \
+ _tile_int8_dp_internal (tdpbsud, dst, src1, src2)
+
+#define _tile_dpbusd(dst,src1,src2) \
+ _tile_int8_dp_internal (tdpbusd, dst, src1, src2)
+
+#define _tile_dpbuud(dst,src1,src2) \
+ _tile_int8_dp_internal (tdpbuud, dst, src1, src2)
+
+#endif
+
+#ifdef __DISABLE_AMX_INT8__
+#undef __DISABLE_AMX_INT8__
+#pragma GCC pop_options
+#endif /* __DISABLE_AMX_INT8__ */
+
+#endif /* _AMXINT8INTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/amxtileintrin.h b/gcc/config/i386/amxtileintrin.h
new file mode 100644
index 0000000..41fb9a5
--- /dev/null
+++ b/gcc/config/i386/amxtileintrin.h
@@ -0,0 +1,98 @@
+/* Copyright (C) 2020 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/>. */
+
+#if !defined _IMMINTRIN_H_INCLUDED
+#error "Never use <amxtileintrin.h> directly; include <immintrin.h> instead."
+#endif
+
+#ifndef _AMXTILEINTRIN_H_INCLUDED
+#define _AMXTILEINTRIN_H_INCLUDED
+
+#if !defined(__AMX_TILE__)
+#pragma GCC push_options
+#pragma GCC target("amx-tile")
+#define __DISABLE_AMX_TILE__
+#endif /* __AMX_TILE__ */
+
+#if defined(__x86_64__) && defined(__AMX_TILE__)
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_tile_loadconfig (const void *__config)
+{
+ __asm__ volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config)));
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_tile_storeconfig (void *__config)
+{
+ __asm__ volatile ("sttilecfg\t%X0" : "=m" (*((void **)__config)));
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_tile_release (void)
+{
+ __asm__ volatile ("tilerelease" ::);
+}
+
+#define _tile_loadd(dst,base,stride) \
+ _tile_loadd_internal (dst, base, stride)
+
+#define _tile_loadd_internal(dst,base,stride) \
+ __asm__ volatile \
+ ("{tileloadd\t(%0,%1,1), %%tmm"#dst"|tileloadd\t%%tmm"#dst", [%0+%1*1]}" \
+ :: "r" ((const void*) base), "r" ((long) stride))
+
+#define _tile_stream_loadd(dst,base,stride) \
+ _tile_stream_loadd_internal (dst, base, stride)
+
+#define _tile_stream_loadd_internal(dst,base,stride) \
+ __asm__ volatile \
+ ("{tileloaddt1\t(%0,%1,1), %%tmm"#dst"|tileloaddt1\t%%tmm"#dst", [%0+%1*1]}" \
+ :: "r" ((const void*) base), "r" ((long) stride))
+
+#define _tile_stored(dst,base,stride) \
+ _tile_stored_internal (dst, base, stride)
+
+#define _tile_stored_internal(src,base,stride) \
+ __asm__ volatile \
+ ("{tilestored\t%%tmm"#src", (%0,%1,1)|tilestored\t[%0+%1*1], %%tmm"#src"}" \
+ :: "r" ((void*) base), "r" ((long) stride) \
+ : "memory")
+
+#define _tile_zero(dst) \
+ _tile_zero_internal (dst)
+
+#define _tile_zero_internal(dst) \
+ __asm__ volatile \
+ ("tilezero\t%%tmm"#dst ::)
+
+#endif
+
+#ifdef __DISABLE_AMX_TILE__
+#undef __DISABLE_AMX_TILE__
+#pragma GCC pop_options
+#endif /* __DISABLE_AMX_TILE__ */
+
+#endif /* _AMXTILEINTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/avx2intrin.h b/gcc/config/i386/avx2intrin.h
index 6bf1f8c..e29c532 100644
--- a/gcc/config/i386/avx2intrin.h
+++ b/gcc/config/i386/avx2intrin.h
@@ -950,6 +950,9 @@ _mm256_broadcastsi128_si256 (__m128i __X)
return (__m256i) __builtin_ia32_vbroadcastsi256 ((__v2di)__X);
}
+#define _mm_broadcastsi128_si256(X) _mm256_broadcastsi128_si256(X)
+#define _mm_broadcastsd_pd(X) _mm_movedup_pd(X)
+
#ifdef __OPTIMIZE__
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
diff --git a/gcc/config/i386/avx512bwintrin.h b/gcc/config/i386/avx512bwintrin.h
index d19c104..3da05e1 100644
--- a/gcc/config/i386/avx512bwintrin.h
+++ b/gcc/config/i386/avx512bwintrin.h
@@ -36,7 +36,11 @@
/* Internal data types for implementing the intrinsics. */
typedef short __v32hi __attribute__ ((__vector_size__ (64)));
+typedef short __v32hi_u __attribute__ ((__vector_size__ (64), \
+ __may_alias__, __aligned__ (1)));
typedef char __v64qi __attribute__ ((__vector_size__ (64)));
+typedef char __v64qi_u __attribute__ ((__vector_size__ (64), \
+ __may_alias__, __aligned__ (1)));
typedef unsigned long long __mmask64;
@@ -303,6 +307,13 @@ _mm512_maskz_mov_epi16 (__mmask32 __U, __m512i __A)
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_loadu_epi16 (void const *__P)
+{
+ return (__m512i) (*(__v32hi_u *) __P);
+}
+
+extern __inline __m512i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_loadu_epi16 (__m512i __W, __mmask32 __U, void const *__P)
{
return (__m512i) __builtin_ia32_loaddquhi512_mask ((const short *) __P,
@@ -322,6 +333,13 @@ _mm512_maskz_loadu_epi16 (__mmask32 __U, void const *__P)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_storeu_epi16 (void *__P, __m512i __A)
+{
+ *(__v32hi_u *) __P = (__v32hi_u) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_storeu_epi16 (void *__P, __mmask32 __U, __m512i __A)
{
__builtin_ia32_storedquhi512_mask ((short *) __P,
@@ -382,6 +400,13 @@ _kunpackd_mask64 (__mmask32 __A, __mmask32 __B)
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_loadu_epi8 (void const *__P)
+{
+ return (__m512i) (*(__v64qi_u *) __P);
+}
+
+extern __inline __m512i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_loadu_epi8 (__m512i __W, __mmask64 __U, void const *__P)
{
return (__m512i) __builtin_ia32_loaddquqi512_mask ((const char *) __P,
@@ -401,6 +426,13 @@ _mm512_maskz_loadu_epi8 (__mmask64 __U, void const *__P)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_storeu_epi8 (void *__P, __m512i __A)
+{
+ *(__v64qi_u *) __P = (__v64qi_u) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_storeu_epi8 (void *__P, __mmask64 __U, __m512i __A)
{
__builtin_ia32_storedquqi512_mask ((char *) __P,
diff --git a/gcc/config/i386/avx512dqintrin.h b/gcc/config/i386/avx512dqintrin.h
index d28dfab..fd61b70 100644
--- a/gcc/config/i386/avx512dqintrin.h
+++ b/gcc/config/i386/avx512dqintrin.h
@@ -1168,6 +1168,17 @@ _mm_reduce_sd (__m128d __A, __m128d __B, int __C)
extern __inline __m128d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_reduce_round_sd (__m128d __A, __m128d __B, int __C, const int __R)
+{
+ return (__m128d) __builtin_ia32_reducesd_mask_round ((__v2df) __A,
+ (__v2df) __B, __C,
+ (__v2df)
+ _mm_setzero_pd (),
+ (__mmask8) -1, __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_reduce_sd (__m128d __W, __mmask8 __U, __m128d __A,
__m128d __B, int __C)
{
@@ -1179,6 +1190,17 @@ _mm_mask_reduce_sd (__m128d __W, __mmask8 __U, __m128d __A,
extern __inline __m128d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_reduce_round_sd (__m128d __W, __mmask8 __U, __m128d __A,
+ __m128d __B, int __C, const int __R)
+{
+ return (__m128d) __builtin_ia32_reducesd_mask_round ((__v2df) __A,
+ (__v2df) __B, __C,
+ (__v2df) __W,
+ __U, __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_maskz_reduce_sd (__mmask8 __U, __m128d __A, __m128d __B, int __C)
{
return (__m128d) __builtin_ia32_reducesd_mask ((__v2df) __A,
@@ -1187,6 +1209,18 @@ _mm_maskz_reduce_sd (__mmask8 __U, __m128d __A, __m128d __B, int __C)
(__mmask8) __U);
}
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_reduce_round_sd (__mmask8 __U, __m128d __A, __m128d __B,
+ int __C, const int __R)
+{
+ return (__m128d) __builtin_ia32_reducesd_mask_round ((__v2df) __A,
+ (__v2df) __B, __C,
+ (__v2df)
+ _mm_setzero_pd (),
+ __U, __R);
+}
+
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_reduce_ss (__m128 __A, __m128 __B, int __C)
@@ -1197,6 +1231,16 @@ _mm_reduce_ss (__m128 __A, __m128 __B, int __C)
(__mmask8) -1);
}
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_reduce_round_ss (__m128 __A, __m128 __B, int __C, const int __R)
+{
+ return (__m128) __builtin_ia32_reducess_mask_round ((__v4sf) __A,
+ (__v4sf) __B, __C,
+ (__v4sf)
+ _mm_setzero_ps (),
+ (__mmask8) -1, __R);
+}
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
@@ -1211,6 +1255,17 @@ _mm_mask_reduce_ss (__m128 __W, __mmask8 __U, __m128 __A,
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_reduce_round_ss (__m128 __W, __mmask8 __U, __m128 __A,
+ __m128 __B, int __C, const int __R)
+{
+ return (__m128) __builtin_ia32_reducess_mask_round ((__v4sf) __A,
+ (__v4sf) __B, __C,
+ (__v4sf) __W,
+ __U, __R);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_maskz_reduce_ss (__mmask8 __U, __m128 __A, __m128 __B, int __C)
{
return (__m128) __builtin_ia32_reducess_mask ((__v4sf) __A,
@@ -1219,6 +1274,18 @@ _mm_maskz_reduce_ss (__mmask8 __U, __m128 __A, __m128 __B, int __C)
(__mmask8) __U);
}
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_reduce_round_ss (__mmask8 __U, __m128 __A, __m128 __B,
+ int __C, const int __R)
+{
+ return (__m128) __builtin_ia32_reducess_mask_round ((__v4sf) __A,
+ (__v4sf) __B, __C,
+ (__v4sf)
+ _mm_setzero_ps (),
+ __U, __R);
+}
+
extern __inline __m128d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_range_sd (__m128d __A, __m128d __B, int __C)
@@ -1808,6 +1875,17 @@ _mm512_reduce_pd (__m512d __A, int __B)
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_reduce_round_pd (__m512d __A, int __B, const int __R)
+{
+ return (__m512d) __builtin_ia32_reducepd512_mask_round ((__v8df) __A,
+ __B,
+ (__v8df)
+ _mm512_setzero_pd (),
+ (__mmask8) -1, __R);
+}
+
+extern __inline __m512d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_reduce_pd (__m512d __W, __mmask8 __U, __m512d __A, int __B)
{
return (__m512d) __builtin_ia32_reducepd512_mask ((__v8df) __A, __B,
@@ -1817,6 +1895,17 @@ _mm512_mask_reduce_pd (__m512d __W, __mmask8 __U, __m512d __A, int __B)
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_mask_reduce_round_pd (__m512d __W, __mmask8 __U, __m512d __A,
+ int __B, const int __R)
+{
+ return (__m512d) __builtin_ia32_reducepd512_mask_round ((__v8df) __A,
+ __B,
+ (__v8df) __W,
+ __U, __R);
+}
+
+extern __inline __m512d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_maskz_reduce_pd (__mmask8 __U, __m512d __A, int __B)
{
return (__m512d) __builtin_ia32_reducepd512_mask ((__v8df) __A, __B,
@@ -1825,6 +1914,18 @@ _mm512_maskz_reduce_pd (__mmask8 __U, __m512d __A, int __B)
(__mmask8) __U);
}
+extern __inline __m512d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_maskz_reduce_round_pd (__mmask8 __U, __m512d __A, int __B,
+ const int __R)
+{
+ return (__m512d) __builtin_ia32_reducepd512_mask_round ((__v8df) __A,
+ __B,
+ (__v8df)
+ _mm512_setzero_pd (),
+ __U, __R);
+}
+
extern __inline __m512
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_reduce_ps (__m512 __A, int __B)
@@ -1837,6 +1938,17 @@ _mm512_reduce_ps (__m512 __A, int __B)
extern __inline __m512
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_reduce_round_ps (__m512 __A, int __B, const int __R)
+{
+ return (__m512) __builtin_ia32_reduceps512_mask_round ((__v16sf) __A,
+ __B,
+ (__v16sf)
+ _mm512_setzero_ps (),
+ (__mmask16) -1, __R);
+}
+
+extern __inline __m512
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_reduce_ps (__m512 __W, __mmask16 __U, __m512 __A, int __B)
{
return (__m512) __builtin_ia32_reduceps512_mask ((__v16sf) __A, __B,
@@ -1846,6 +1958,17 @@ _mm512_mask_reduce_ps (__m512 __W, __mmask16 __U, __m512 __A, int __B)
extern __inline __m512
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_mask_reduce_round_ps (__m512 __W, __mmask16 __U, __m512 __A, int __B,
+ const int __R)
+{
+ return (__m512) __builtin_ia32_reduceps512_mask_round ((__v16sf) __A,
+ __B,
+ (__v16sf) __W,
+ __U, __R);
+}
+
+extern __inline __m512
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_maskz_reduce_ps (__mmask16 __U, __m512 __A, int __B)
{
return (__m512) __builtin_ia32_reduceps512_mask ((__v16sf) __A, __B,
@@ -1854,6 +1977,18 @@ _mm512_maskz_reduce_ps (__mmask16 __U, __m512 __A, int __B)
(__mmask16) __U);
}
+extern __inline __m512
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_maskz_reduce_round_ps (__mmask16 __U, __m512 __A, int __B,
+ const int __R)
+{
+ return (__m512) __builtin_ia32_reduceps512_mask_round ((__v16sf) __A,
+ __B,
+ (__v16sf)
+ _mm512_setzero_ps (),
+ __U, __R);
+}
+
extern __inline __m256
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_extractf32x8_ps (__m512 __A, const int __imm)
@@ -2440,26 +2575,50 @@ _mm512_fpclass_ps_mask (__m512 __A, const int __imm)
((__m512d) __builtin_ia32_reducepd512_mask ((__v8df)(__m512d)(A), \
(int)(B), (__v8df)_mm512_setzero_pd (), (__mmask8)-1))
+#define _mm512_reduce_round_pd(A, B, R) \
+ ((__m512d) __builtin_ia32_reducepd512_mask_round ((__v8df)(__m512d)(A),\
+ (int)(B), (__v8df)_mm512_setzero_pd (), (__mmask8)-1, (R)))
+
#define _mm512_mask_reduce_pd(W, U, A, B) \
((__m512d) __builtin_ia32_reducepd512_mask ((__v8df)(__m512d)(A), \
(int)(B), (__v8df)(__m512d)(W), (__mmask8)(U)))
+#define _mm512_mask_reduce_round_pd(W, U, A, B, R) \
+ ((__m512d) __builtin_ia32_reducepd512_mask_round ((__v8df)(__m512d)(A),\
+ (int)(B), (__v8df)(__m512d)(W), (U), (R)))
+
#define _mm512_maskz_reduce_pd(U, A, B) \
((__m512d) __builtin_ia32_reducepd512_mask ((__v8df)(__m512d)(A), \
(int)(B), (__v8df)_mm512_setzero_pd (), (__mmask8)(U)))
+#define _mm512_maskz_reduce_round_pd(U, A, B, R) \
+ ((__m512d) __builtin_ia32_reducepd512_mask_round ((__v8df)(__m512d)(A),\
+ (int)(B), (__v8df)_mm512_setzero_pd (), (U), (R)))
+
#define _mm512_reduce_ps(A, B) \
((__m512) __builtin_ia32_reduceps512_mask ((__v16sf)(__m512)(A), \
(int)(B), (__v16sf)_mm512_setzero_ps (), (__mmask16)-1))
+#define _mm512_reduce_round_ps(A, B, R) \
+ ((__m512) __builtin_ia32_reduceps512_mask_round ((__v16sf)(__m512)(A),\
+ (int)(B), (__v16sf)_mm512_setzero_ps (), (__mmask16)-1, (R)))
+
#define _mm512_mask_reduce_ps(W, U, A, B) \
((__m512) __builtin_ia32_reduceps512_mask ((__v16sf)(__m512)(A), \
(int)(B), (__v16sf)(__m512)(W), (__mmask16)(U)))
+#define _mm512_mask_reduce_round_ps(W, U, A, B, R) \
+ ((__m512) __builtin_ia32_reduceps512_mask_round ((__v16sf)(__m512)(A),\
+ (int)(B), (__v16sf)(__m512)(W), (U), (R)))
+
#define _mm512_maskz_reduce_ps(U, A, B) \
((__m512) __builtin_ia32_reduceps512_mask ((__v16sf)(__m512)(A), \
(int)(B), (__v16sf)_mm512_setzero_ps (), (__mmask16)(U)))
+#define _mm512_maskz_reduce_round_ps(U, A, B, R) \
+ ((__m512) __builtin_ia32_reduceps512_mask_round ((__v16sf)(__m512)(A),\
+ (int)(B), (__v16sf)_mm512_setzero_ps (), (__mmask16)(U), (R)))
+
#define _mm512_extractf32x8_ps(X, C) \
((__m256) __builtin_ia32_extractf32x8_mask ((__v16sf)(__m512) (X), \
(int) (C), (__v8sf)(__m256) _mm256_setzero_ps (), (__mmask8)-1))
@@ -2679,6 +2838,20 @@ _mm512_fpclass_ps_mask (__m512 __A, const int __imm)
(__v2df)(__m128d)(B), (int)(C), (__v2df) _mm_setzero_pd (), \
(__mmask8)(U)))
+#define _mm_reduce_round_sd(A, B, C, R) \
+ ((__m128d) __builtin_ia32_reducesd_round ((__v2df)(__m128d)(A), \
+ (__v2df)(__m128d)(B), (int)(C), (__mmask8)(U), (int)(R)))
+
+#define _mm_mask_reduce_round_sd(W, U, A, B, C, R) \
+ ((__m128d) __builtin_ia32_reducesd_mask_round ((__v2df)(__m128d)(A), \
+ (__v2df)(__m128d)(B), (int)(C), (__v2df)(__m128d)(W), \
+ (__mmask8)(U), (int)(R)))
+
+#define _mm_maskz_reduce_round_sd(U, A, B, C, R) \
+ ((__m128d) __builtin_ia32_reducesd_mask_round ((__v2df)(__m128d)(A), \
+ (__v2df)(__m128d)(B), (int)(C), (__v2df) _mm_setzero_pd (), \
+ (__mmask8)(U), (int)(R)))
+
#define _mm_reduce_ss(A, B, C) \
((__m128) __builtin_ia32_reducess_mask ((__v4sf)(__m128)(A), \
(__v4sf)(__m128)(B), (int)(C), (__v4sf) _mm_setzero_ps (), \
@@ -2693,6 +2866,19 @@ _mm512_fpclass_ps_mask (__m512 __A, const int __imm)
(__v4sf)(__m128)(B), (int)(C), (__v4sf) _mm_setzero_ps (), \
(__mmask8)(U)))
+#define _mm_reduce_round_ss(A, B, C, R) \
+ ((__m128) __builtin_ia32_reducess_round ((__v4sf)(__m128)(A), \
+ (__v4sf)(__m128)(B), (int)(C), (__mmask8)(U), (int)(R)))
+
+#define _mm_mask_reduce_round_ss(W, U, A, B, C, R) \
+ ((__m128) __builtin_ia32_reducess_mask_round ((__v4sf)(__m128)(A), \
+ (__v4sf)(__m128)(B), (int)(C), (__v4sf)(__m128)(W), \
+ (__mmask8)(U), (int)(R)))
+
+#define _mm_maskz_reduce_round_ss(U, A, B, C, R) \
+ ((__m128) __builtin_ia32_reducesd_mask_round ((__v4sf)(__m128)(A), \
+ (__v4sf)(__m128)(B), (int)(C), (__v4sf) _mm_setzero_ps (), \
+ (__mmask8)(U), (int)(R)))
#endif
diff --git a/gcc/config/i386/avx512erintrin.h b/gcc/config/i386/avx512erintrin.h
index b9804c9..6ec8ee2 100644
--- a/gcc/config/i386/avx512erintrin.h
+++ b/gcc/config/i386/avx512erintrin.h
@@ -168,6 +168,30 @@ _mm_rcp28_round_sd (__m128d __A, __m128d __B, int __R)
__R);
}
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_rcp28_round_sd (__m128d __W, __mmask8 __U, __m128d __A,
+ __m128d __B, int __R)
+{
+ return (__m128d) __builtin_ia32_rcp28sd_mask_round ((__v2df) __B,
+ (__v2df) __A,
+ (__v2df) __W,
+ __U,
+ __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_rcp28_round_sd (__mmask8 __U, __m128d __A, __m128d __B, int __R)
+{
+ return (__m128d) __builtin_ia32_rcp28sd_mask_round ((__v2df) __B,
+ (__v2df) __A,
+ (__v2df)
+ _mm_setzero_pd (),
+ __U,
+ __R);
+}
+
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_rcp28_round_ss (__m128 __A, __m128 __B, int __R)
@@ -177,6 +201,30 @@ _mm_rcp28_round_ss (__m128 __A, __m128 __B, int __R)
__R);
}
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_rcp28_round_ss (__m128 __W, __mmask8 __U, __m128 __A,
+ __m128 __B, int __R)
+{
+ return (__m128) __builtin_ia32_rcp28ss_mask_round ((__v4sf) __B,
+ (__v4sf) __A,
+ (__v4sf) __W,
+ __U,
+ __R);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_rcp28_round_ss (__mmask8 __U, __m128 __A, __m128 __B, int __R)
+{
+ return (__m128) __builtin_ia32_rcp28ss_mask_round ((__v4sf) __B,
+ (__v4sf) __A,
+ (__v4sf)
+ _mm_setzero_ps (),
+ __U,
+ __R);
+}
+
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_rsqrt28_round_pd (__m512d __A, int __R)
@@ -242,6 +290,30 @@ _mm_rsqrt28_round_sd (__m128d __A, __m128d __B, int __R)
__R);
}
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_rsqrt28_round_sd (__m128d __W, __mmask8 __U, __m128d __A,
+ __m128d __B, int __R)
+{
+ return (__m128d) __builtin_ia32_rsqrt28sd_mask_round ((__v2df) __B,
+ (__v2df) __A,
+ (__v2df) __W,
+ __U,
+ __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_rsqrt28_round_sd (__mmask8 __U, __m128d __A, __m128d __B, int __R)
+{
+ return (__m128d) __builtin_ia32_rsqrt28sd_mask_round ((__v2df) __B,
+ (__v2df) __A,
+ (__v2df)
+ _mm_setzero_pd (),
+ __U,
+ __R);
+}
+
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_rsqrt28_round_ss (__m128 __A, __m128 __B, int __R)
@@ -251,6 +323,30 @@ _mm_rsqrt28_round_ss (__m128 __A, __m128 __B, int __R)
__R);
}
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_rsqrt28_round_ss (__m128 __W, __mmask8 __U, __m128 __A,
+ __m128 __B, int __R)
+{
+ return (__m128) __builtin_ia32_rsqrt28ss_mask_round ((__v4sf) __B,
+ (__v4sf) __A,
+ (__v4sf) __W,
+ __U,
+ __R);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_rsqrt28_round_ss (__mmask8 __U, __m128 __A, __m128 __B, int __R)
+{
+ return (__m128) __builtin_ia32_rsqrt28ss_mask_round ((__v4sf) __B,
+ (__v4sf) __A,
+ (__v4sf)
+ _mm_setzero_ps (),
+ __U,
+ __R);
+}
+
#else
#define _mm512_exp2a23_round_pd(A, C) \
__builtin_ia32_exp2pd_mask(A, (__v8df)_mm512_setzero_pd(), -1, C)
@@ -309,17 +405,69 @@ _mm_rsqrt28_round_ss (__m128 __A, __m128 __B, int __R)
#define _mm_rcp28_round_sd(A, B, R) \
__builtin_ia32_rcp28sd_round(A, B, R)
+#define _mm_mask_rcp28_round_sd(W, U, A, B, R) \
+ __builtin_ia32_rcp28sd_mask_round ((A), (B), (W), (U), (R))
+
+#define _mm_maskz_rcp28_round_sd(U, A, B, R) \
+ __builtin_ia32_rcp28sd_mask_round ((A), (B), (__v2df) _mm_setzero_pd (), \
+ (U), (R))
+
#define _mm_rcp28_round_ss(A, B, R) \
__builtin_ia32_rcp28ss_round(A, B, R)
+#define _mm_mask_rcp28_round_ss(W, U, A, B, R) \
+ __builtin_ia32_rcp28ss_mask_round ((A), (B), (W), (U), (R))
+
+#define _mm_maskz_rcp28_round_ss(U, A, B, R) \
+ __builtin_ia32_rcp28ss_mask_round ((A), (B), (__v4sf) _mm_setzero_ps (), \
+ (U), (R))
+
#define _mm_rsqrt28_round_sd(A, B, R) \
__builtin_ia32_rsqrt28sd_round(A, B, R)
+#define _mm_mask_rsqrt28_round_sd(W, U, A, B, R) \
+ __builtin_ia32_rsqrt28sd_mask_round ((A), (B), (W), (U), (R))
+
+#define _mm_maskz_rsqrt28_round_sd(U, A, B, R) \
+ __builtin_ia32_rsqrt28sd_mask_round ((A), (B), (__v2df) _mm_setzero_pd (),\
+ (U), (R))
+
#define _mm_rsqrt28_round_ss(A, B, R) \
__builtin_ia32_rsqrt28ss_round(A, B, R)
+#define _mm_mask_rsqrt28_round_ss(W, U, A, B, R) \
+ __builtin_ia32_rsqrt28ss_mask_round ((A), (B), (W), (U), (R))
+
+#define _mm_maskz_rsqrt28_round_ss(U, A, B, R) \
+ __builtin_ia32_rsqrt28ss_mask_round ((A), (B), (__v4sf) _mm_setzero_ps (),\
+ (U), (R))
+
#endif
+#define _mm_mask_rcp28_sd(W, U, A, B)\
+ _mm_mask_rcp28_round_sd ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_rcp28_sd(U, A, B)\
+ _mm_maskz_rcp28_round_sd ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_mask_rcp28_ss(W, U, A, B)\
+ _mm_mask_rcp28_round_ss ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_rcp28_ss(U, A, B)\
+ _mm_maskz_rcp28_round_ss ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_mask_rsqrt28_sd(W, U, A, B)\
+ _mm_mask_rsqrt28_round_sd ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_rsqrt28_sd(U, A, B)\
+ _mm_maskz_rsqrt28_round_sd ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_mask_rsqrt28_ss(W, U, A, B)\
+ _mm_mask_rsqrt28_round_ss ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_rsqrt28_ss(U, A, B)\
+ _mm_maskz_rsqrt28_round_ss ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
#define _mm512_exp2a23_pd(A) \
_mm512_exp2a23_round_pd(A, _MM_FROUND_CUR_DIRECTION)
diff --git a/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h
index 729d568..6342fde 100644
--- a/gcc/config/i386/avx512fintrin.h
+++ b/gcc/config/i386/avx512fintrin.h
@@ -2124,6 +2124,18 @@ _mm_maskz_sqrt_round_ss (__mmask8 __U, __m128 __A, __m128 __B, const int __R)
(__v4sf) _mm_setzero_ps (), U, C)
#endif
+#define _mm_mask_sqrt_sd(W, U, A, B) \
+ _mm_mask_sqrt_round_sd ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_sqrt_sd(U, A, B) \
+ _mm_maskz_sqrt_round_sd ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_mask_sqrt_ss(W, U, A, B) \
+ _mm_mask_sqrt_round_ss ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_sqrt_ss(U, A, B) \
+ _mm_maskz_sqrt_round_ss ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_cvtepi8_epi32 (__m128i __A)
@@ -3259,6 +3271,18 @@ _mm_maskz_scalef_round_ss (__mmask8 __U, __m128 __A, __m128 __B, const int __R)
(__v4sf)_mm_setzero_ps (), -1, C)
#endif
+#define _mm_mask_scalef_sd(W, U, A, B) \
+ _mm_mask_scalef_round_sd ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_scalef_sd(U, A, B) \
+ _mm_maskz_scalef_round_sd ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_mask_scalef_ss(W, U, A, B) \
+ _mm_mask_scalef_round_ss ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_scalef_ss(U, A, B) \
+ _mm_maskz_scalef_round_ss ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
#ifdef __OPTIMIZE__
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
@@ -8621,6 +8645,30 @@ _mm_cvt_roundsd_ss (__m128 __A, __m128d __B, const int __R)
__R);
}
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_cvt_roundsd_ss (__m128 __W, __mmask8 __U, __m128 __A,
+ __m128d __B, const int __R)
+{
+ return (__m128) __builtin_ia32_cvtsd2ss_mask_round ((__v4sf) __A,
+ (__v2df) __B,
+ (__v4sf) __W,
+ __U,
+ __R);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_cvt_roundsd_ss (__mmask8 __U, __m128 __A,
+ __m128d __B, const int __R)
+{
+ return (__m128) __builtin_ia32_cvtsd2ss_mask_round ((__v4sf) __A,
+ (__v2df) __B,
+ _mm_setzero_ps (),
+ __U,
+ __R);
+}
+
extern __inline __m128d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_cvt_roundss_sd (__m128d __A, __m128 __B, const int __R)
@@ -8629,6 +8677,30 @@ _mm_cvt_roundss_sd (__m128d __A, __m128 __B, const int __R)
(__v4sf) __B,
__R);
}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_mask_cvt_roundss_sd (__m128d __W, __mmask8 __U, __m128d __A,
+ __m128 __B, const int __R)
+{
+ return (__m128d) __builtin_ia32_cvtss2sd_mask_round ((__v2df) __A,
+ (__v4sf) __B,
+ (__v2df) __W,
+ __U,
+ __R);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_maskz_cvt_roundss_sd (__mmask8 __U, __m128d __A,
+ __m128 __B, const int __R)
+{
+ return (__m128d) __builtin_ia32_cvtss2sd_mask_round ((__v2df) __A,
+ (__v4sf) __B,
+ _mm_setzero_pd (),
+ __U,
+ __R);
+}
#else
#define _mm512_cvt_roundpd_ps(A, B) \
(__m256)__builtin_ia32_cvtpd2ps512_mask(A, (__v8sf)_mm256_undefined_ps(), -1, B)
@@ -8642,10 +8714,37 @@ _mm_cvt_roundss_sd (__m128d __A, __m128 __B, const int __R)
#define _mm_cvt_roundsd_ss(A, B, C) \
(__m128)__builtin_ia32_cvtsd2ss_round(A, B, C)
+#define _mm_mask_cvt_roundsd_ss(W, U, A, B, C) \
+ (__m128)__builtin_ia32_cvtsd2ss_mask_round ((A), (B), (W), (U), (C))
+
+#define _mm_maskz_cvt_roundsd_ss(U, A, B, C) \
+ (__m128)__builtin_ia32_cvtsd2ss_mask_round ((A), (B), _mm_setzero_ps (), \
+ (U), (C))
+
#define _mm_cvt_roundss_sd(A, B, C) \
(__m128d)__builtin_ia32_cvtss2sd_round(A, B, C)
+
+#define _mm_mask_cvt_roundss_sd(W, U, A, B, C) \
+ (__m128d)__builtin_ia32_cvtss2sd_mask_round ((A), (B), (W), (U), (C))
+
+#define _mm_maskz_cvt_roundss_sd(U, A, B, C) \
+ (__m128d)__builtin_ia32_cvtss2sd_mask_round ((A), (B), _mm_setzero_pd (), \
+ (U), (C))
+
#endif
+#define _mm_mask_cvtss_sd(W, U, A, B) \
+ _mm_mask_cvt_roundss_sd ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_cvtss_sd(U, A, B) \
+ _mm_maskz_cvt_roundss_sd ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_mask_cvtsd_ss(W, U, A, B) \
+ _mm_mask_cvt_roundsd_ss ((W), (U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
+#define _mm_maskz_cvtsd_ss(U, A, B) \
+ _mm_maskz_cvt_roundsd_ss ((U), (A), (B), _MM_FROUND_CUR_DIRECTION)
+
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_stream_si512 (__m512i * __P, __m512i __A)
@@ -14265,6 +14364,14 @@ _mm_cvttss_i64 (__m128 __A)
}
#endif /* __x86_64__ */
+extern __inline int
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm512_cvtsi512_si32 (__m512i __A)
+{
+ __v16si __B = (__v16si) __A;
+ return __B[0];
+}
+
extern __inline unsigned
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_cvtss_u32 (__m128 __A)
@@ -14289,6 +14396,34 @@ _mm_cvttss_i32 (__m128 __A)
_MM_FROUND_CUR_DIRECTION);
}
+extern __inline int
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtsd_i32 (__m128d __A)
+{
+ return (int) __builtin_ia32_cvtsd2si ((__v2df) __A);
+}
+
+extern __inline int
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtss_i32 (__m128 __A)
+{
+ return (int) __builtin_ia32_cvtss2si ((__v4sf) __A);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvti32_sd (__m128d __A, int __B)
+{
+ return (__m128d) __builtin_ia32_cvtsi2sd ((__v2df) __A, __B);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvti32_ss (__m128 __A, int __B)
+{
+ return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B);
+}
+
#ifdef __x86_64__
extern __inline unsigned long long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
@@ -14315,6 +14450,34 @@ _mm_cvttsd_i64 (__m128d __A)
return (long long) __builtin_ia32_vcvttsd2si64 ((__v2df) __A,
_MM_FROUND_CUR_DIRECTION);
}
+
+extern __inline long long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtsd_i64 (__m128d __A)
+{
+ return (long long) __builtin_ia32_cvtsd2si64 ((__v2df) __A);
+}
+
+extern __inline long long
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvtss_i64 (__m128 __A)
+{
+ return (long long) __builtin_ia32_cvtss2si64 ((__v4sf) __A);
+}
+
+extern __inline __m128d
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvti64_sd (__m128d __A, long long __B)
+{
+ return (__m128d) __builtin_ia32_cvtsi642sd ((__v2df) __A, __B);
+}
+
+extern __inline __m128
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_cvti64_ss (__m128 __A, long long __B)
+{
+ return (__m128) __builtin_ia32_cvtsi642ss ((__v4sf) __A, __B);
+}
#endif /* __x86_64__ */
extern __inline unsigned
diff --git a/gcc/config/i386/avx512vlbwintrin.h b/gcc/config/i386/avx512vlbwintrin.h
index cd4275e..b4b1d7f 100644
--- a/gcc/config/i386/avx512vlbwintrin.h
+++ b/gcc/config/i386/avx512vlbwintrin.h
@@ -34,6 +34,15 @@
#define __DISABLE_AVX512VLBW__
#endif /* __AVX512VLBW__ */
+/* Internal data types for implementing the intrinsics. */
+typedef short __v16hi_u __attribute__ ((__vector_size__ (32), \
+ __may_alias__, __aligned__ (1)));
+typedef short __v8hi_u __attribute__ ((__vector_size__ (16), \
+ __may_alias__, __aligned__ (1)));
+typedef char __v32qi_u __attribute__ ((__vector_size__ (32), \
+ __may_alias__, __aligned__ (1)));
+typedef char __v16qi_u __attribute__ ((__vector_size__ (16), \
+ __may_alias__, __aligned__ (1)));
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
@@ -75,6 +84,13 @@ _mm_maskz_mov_epi8 (__mmask16 __U, __m128i __A)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_storeu_epi8 (void *__P, __m256i __A)
+{
+ *(__v32qi_u *) __P = (__v32qi_u) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_storeu_epi8 (void *__P, __mmask32 __U, __m256i __A)
{
__builtin_ia32_storedquqi256_mask ((char *) __P,
@@ -84,6 +100,13 @@ _mm256_mask_storeu_epi8 (void *__P, __mmask32 __U, __m256i __A)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_storeu_epi8 (void *__P, __m128i __A)
+{
+ *(__v16qi_u *) __P = (__v16qi_u) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_storeu_epi8 (void *__P, __mmask16 __U, __m128i __A)
{
__builtin_ia32_storedquqi128_mask ((char *) __P,
@@ -93,6 +116,13 @@ _mm_mask_storeu_epi8 (void *__P, __mmask16 __U, __m128i __A)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_loadu_epi16 (void const *__P)
+{
+ return (__m256i) (*(__v16hi_u *) __P);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_loadu_epi16 (__m256i __W, __mmask16 __U, void const *__P)
{
return (__m256i) __builtin_ia32_loaddquhi256_mask ((const short *) __P,
@@ -112,6 +142,13 @@ _mm256_maskz_loadu_epi16 (__mmask16 __U, void const *__P)
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadu_epi16 (void const *__P)
+{
+ return (__m128i) (*(__v8hi_u *) __P);
+}
+
+extern __inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_loadu_epi16 (__m128i __W, __mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_loaddquhi128_mask ((const short *) __P,
@@ -170,6 +207,13 @@ _mm_maskz_mov_epi16 (__mmask8 __U, __m128i __A)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_loadu_epi8 (void const *__P)
+{
+ return (__m256i) (*(__v32qi_u *) __P);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_loadu_epi8 (__m256i __W, __mmask32 __U, void const *__P)
{
return (__m256i) __builtin_ia32_loaddquqi256_mask ((const char *) __P,
@@ -189,6 +233,13 @@ _mm256_maskz_loadu_epi8 (__mmask32 __U, void const *__P)
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadu_epi8 (void const *__P)
+{
+ return (__m128i) (*(__v16qi_u *) __P);
+}
+
+extern __inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_loadu_epi8 (__m128i __W, __mmask16 __U, void const *__P)
{
return (__m128i) __builtin_ia32_loaddquqi128_mask ((const char *) __P,
@@ -3710,6 +3761,13 @@ _mm256_cmple_epu16_mask (__m256i __X, __m256i __Y)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_storeu_epi16 (void *__P, __m256i __A)
+{
+ *(__v16hi_u *) __P = (__v16hi_u) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_storeu_epi16 (void *__P, __mmask16 __U, __m256i __A)
{
__builtin_ia32_storedquhi256_mask ((short *) __P,
@@ -3719,6 +3777,13 @@ _mm256_mask_storeu_epi16 (void *__P, __mmask16 __U, __m256i __A)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_storeu_epi16 (void *__P, __m128i __A)
+{
+ *(__v8hi_u *) __P = (__v8hi_u) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_storeu_epi16 (void *__P, __mmask8 __U, __m128i __A)
{
__builtin_ia32_storedquhi128_mask ((short *) __P,
diff --git a/gcc/config/i386/avx512vlintrin.h b/gcc/config/i386/avx512vlintrin.h
index 7abd601..99666c7 100644
--- a/gcc/config/i386/avx512vlintrin.h
+++ b/gcc/config/i386/avx512vlintrin.h
@@ -36,6 +36,14 @@
/* Internal data types for implementing the intrinsics. */
typedef unsigned int __mmask32;
+typedef int __v4si_u __attribute__ ((__vector_size__ (16), \
+ __may_alias__, __aligned__ (1)));
+typedef int __v8si_u __attribute__ ((__vector_size__ (32), \
+ __may_alias__, __aligned__ (1)));
+typedef long long __v2di_u __attribute__ ((__vector_size__ (16), \
+ __may_alias__, __aligned__ (1)));
+typedef long long __v4di_u __attribute__ ((__vector_size__ (32), \
+ __may_alias__, __aligned__ (1)));
extern __inline __m256d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
@@ -265,6 +273,13 @@ _mm_maskz_mov_epi64 (__mmask8 __U, __m128i __A)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_load_epi64 (void const *__P)
+{
+ return (__m256i) (*(__v4di *) __P);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_load_epi64 (__m256i __W, __mmask8 __U, void const *__P)
{
return (__m256i) __builtin_ia32_movdqa64load256_mask ((__v4di *) __P,
@@ -286,6 +301,13 @@ _mm256_maskz_load_epi64 (__mmask8 __U, void const *__P)
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_load_epi64 (void const *__P)
+{
+ return (__m128i) (*(__v2di *) __P);
+}
+
+extern __inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_load_epi64 (__m128i __W, __mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_movdqa64load128_mask ((__v2di *) __P,
@@ -363,6 +385,13 @@ _mm_maskz_mov_epi32 (__mmask8 __U, __m128i __A)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_load_epi32 (void const *__P)
+{
+ return (__m256i) (*(__v8si *) __P);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_load_epi32 (__m256i __W, __mmask8 __U, void const *__P)
{
return (__m256i) __builtin_ia32_movdqa32load256_mask ((__v8si *) __P,
@@ -384,6 +413,13 @@ _mm256_maskz_load_epi32 (__mmask8 __U, void const *__P)
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_load_epi32 (void const *__P)
+{
+ return (__m128i) (*(__v4si *) __P);
+}
+
+extern __inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_load_epi32 (__m128i __W, __mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_movdqa32load128_mask ((__v4si *) __P,
@@ -405,6 +441,13 @@ _mm_maskz_load_epi32 (__mmask8 __U, void const *__P)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_store_epi32 (void *__P, __m256i __A)
+{
+ *(__v8si *) __P = (__v8si) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_store_epi32 (void *__P, __mmask8 __U, __m256i __A)
{
__builtin_ia32_movdqa32store256_mask ((__v8si *) __P,
@@ -414,6 +457,13 @@ _mm256_mask_store_epi32 (void *__P, __mmask8 __U, __m256i __A)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_store_epi32 (void *__P, __m128i __A)
+{
+ *(__v4si *) __P = (__v4si) __A;
+}
+
+extern __inline void
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_store_epi32 (void *__P, __mmask8 __U, __m128i __A)
{
__builtin_ia32_movdqa32store128_mask ((__v4si *) __P,
@@ -719,6 +769,13 @@ _mm_mask_storeu_ps (void *__P, __mmask8 __U, __m128 __A)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_loadu_epi64 (void const *__P)
+{
+ return (__m256i) (*(__v4di_u *) __P);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_loadu_epi64 (__m256i __W, __mmask8 __U, void const *__P)
{
return (__m256i) __builtin_ia32_loaddqudi256_mask ((const long long *) __P,
@@ -738,6 +795,13 @@ _mm256_maskz_loadu_epi64 (__mmask8 __U, void const *__P)
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadu_epi64 (void const *__P)
+{
+ return (__m128i) (*(__v2di_u *) __P);
+}
+
+extern __inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_loadu_epi64 (__m128i __W, __mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_loaddqudi128_mask ((const long long *) __P,
@@ -789,6 +853,13 @@ _mm_mask_storeu_epi64 (void *__P, __mmask8 __U, __m128i __A)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_loadu_epi32 (void const *__P)
+{
+ return (__m256i) (*(__v8si_u *) __P);
+}
+
+extern __inline __m256i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mask_loadu_epi32 (__m256i __W, __mmask8 __U, void const *__P)
{
return (__m256i) __builtin_ia32_loaddqusi256_mask ((const int *) __P,
@@ -808,6 +879,13 @@ _mm256_maskz_loadu_epi32 (__mmask8 __U, void const *__P)
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadu_epi32 (void const *__P)
+{
+ return (__m128i) (*(__v4si_u *) __P);
+}
+
+extern __inline __m128i
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mask_loadu_epi32 (__m128i __W, __mmask8 __U, void const *__P)
{
return (__m128i) __builtin_ia32_loaddqusi128_mask ((const int *) __P,
@@ -13730,6 +13808,13 @@ _mm256_permutex_pd (__m256d __X, const int __M)
#endif
#define _mm256_permutexvar_ps(A, B) _mm256_permutevar8x32_ps ((B), (A))
+#define _mm256_mask_cvt_roundps_ph(A, B, C, D) \
+ _mm256_mask_cvtps_ph ((A), (B), (C), (D))
+#define _mm256_maskz_cvt_roundps_ph(A, B, C) \
+ _mm256_maskz_cvtps_ph ((A), (B), (C))
+#define _mm_mask_cvt_roundps_ph(A, B, C, D) \
+ _mm_mask_cvtps_ph ((A), (B), (C), (D))
+#define _mm_maskz_cvt_roundps_ph(A, B, C) _mm_maskz_cvtps_ph ((A), (B), (C))
#ifdef __DISABLE_AVX512VL__
#undef __DISABLE_AVX512VL__
diff --git a/gcc/config/i386/avx512vp2intersectintrin.h b/gcc/config/i386/avx512vp2intersectintrin.h
index 60cb52c..f368d83 100644
--- a/gcc/config/i386/avx512vp2intersectintrin.h
+++ b/gcc/config/i386/avx512vp2intersectintrin.h
@@ -1,3 +1,26 @@
+/* Copyright (C) 2019-2020 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/>. */
+
#if !defined _IMMINTRIN_H_INCLUDED
#error "Never use <avx512vp2intersectintrin.h> directly; include <immintrin.h> instead."
#endif
diff --git a/gcc/config/i386/avx512vp2intersectvlintrin.h b/gcc/config/i386/avx512vp2intersectvlintrin.h
index 26eee36..f657840 100644
--- a/gcc/config/i386/avx512vp2intersectvlintrin.h
+++ b/gcc/config/i386/avx512vp2intersectvlintrin.h
@@ -1,3 +1,26 @@
+/* Copyright (C) 2019-2020 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/>. */
+
#if !defined _IMMINTRIN_H_INCLUDED
#error "Never use <avx512vp2intersectintrin.h> directly; include <immintrin.h> instead."
#endif
diff --git a/gcc/config/i386/avxintrin.h b/gcc/config/i386/avxintrin.h
index 22b2bae..fd5cf6a 100644
--- a/gcc/config/i386/avxintrin.h
+++ b/gcc/config/i386/avxintrin.h
@@ -444,6 +444,13 @@ _mm_cmp_ss (__m128 __X, __m128 __Y, const int __P)
(__v4sf)(__m128)(Y), (int)(P)))
#endif
+extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm256_cvtsi256_si32 (__m256i __A)
+{
+ __v8si __B = (__v8si) __A;
+ return __B[0];
+}
+
extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm256_cvtepi32_pd (__m128i __A)
{
diff --git a/gcc/config/i386/bmi2intrin.h b/gcc/config/i386/bmi2intrin.h
index c5de9eb..9fdd08c 100644
--- a/gcc/config/i386/bmi2intrin.h
+++ b/gcc/config/i386/bmi2intrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <bmi2intrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <bmi2intrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _BMI2INTRIN_H_INCLUDED
diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h
index 8ba6e5b..5bd712a 100644
--- a/gcc/config/i386/bmiintrin.h
+++ b/gcc/config/i386/bmiintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <bmiintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _BMIINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/cetintrin.h b/gcc/config/i386/cetintrin.h
index 095bbe0..81c4d72 100644
--- a/gcc/config/i386/cetintrin.h
+++ b/gcc/config/i386/cetintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <cetintrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <cetintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _CETINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/cldemoteintrin.h b/gcc/config/i386/cldemoteintrin.h
index 8c0feca..0c31c35 100644
--- a/gcc/config/i386/cldemoteintrin.h
+++ b/gcc/config/i386/cldemoteintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <cldemoteintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <cldemoteintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _CLDEMOTE_H_INCLUDED
diff --git a/gcc/config/i386/clflushoptintrin.h b/gcc/config/i386/clflushoptintrin.h
index 037f044..a3697f0 100644
--- a/gcc/config/i386/clflushoptintrin.h
+++ b/gcc/config/i386/clflushoptintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <clflushoptintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <clflushoptintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _CLFLUSHOPTINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/clwbintrin.h b/gcc/config/i386/clwbintrin.h
index 84d0939..3f83962 100644
--- a/gcc/config/i386/clwbintrin.h
+++ b/gcc/config/i386/clwbintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <clwbintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <clwbintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _CLWBINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
index af37f5c..0b902d5 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -183,6 +183,10 @@
"@internal Memory operand without REX prefix."
(match_operand 0 "norex_memory_operand"))
+(define_special_memory_constraint "Br"
+ "@internal bcst memory operand."
+ (match_operand 0 "bcst_mem_operand"))
+
(define_constraint "Bs"
"@internal Sibcall memory operand."
(ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER"))
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index bca61d62..22d284e 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -26,6 +26,7 @@
/* %eax */
#define bit_AVX512BF16 (1 << 5)
+#define bit_HRESET (1 << 22)
/* %ecx */
#define bit_SSE3 (1 << 0)
@@ -124,9 +125,13 @@
#define bit_AVX5124FMAPS (1 << 3)
#define bit_AVX512VP2INTERSECT (1 << 8)
#define bit_IBT (1 << 20)
+#define bit_UINTR (1 << 5)
#define bit_PCONFIG (1 << 18)
#define bit_SERIALIZE (1 << 14)
#define bit_TSXLDTRK (1 << 16)
+#define bit_AMX_BF16 (1 << 22)
+#define bit_AMX_TILE (1 << 24)
+#define bit_AMX_INT8 (1 << 25)
/* XFEATURE_ENABLED_MASK register bits (%eax == 0xd, %ecx == 0) */
#define bit_BNDREGS (1 << 3)
diff --git a/gcc/config/i386/emmintrin.h b/gcc/config/i386/emmintrin.h
index 545d3bf..8ff240e 100644
--- a/gcc/config/i386/emmintrin.h
+++ b/gcc/config/i386/emmintrin.h
@@ -715,6 +715,19 @@ _mm_loadu_si64 (void const *__P)
return _mm_loadl_epi64 ((__m128i_u *)__P);
}
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadu_si32 (void const *__P)
+{
+ return _mm_set_epi32 (*(int *)__P, (int)0, (int)0, (int)0);
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadu_si16 (void const *__P)
+{
+ return _mm_set_epi16 (*(short *)__P, (short)0, (short)0, (short)0,
+ (short)0, (short)0, (short)0, (short)0);
+}
+
extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_store_si128 (__m128i *__P, __m128i __B)
{
@@ -739,6 +752,18 @@ _mm_storeu_si64 (void *__P, __m128i __B)
_mm_storel_epi64 ((__m128i_u *)__P, __B);
}
+extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_storeu_si32 (void *__P, __m128i __B)
+{
+ *(__m32_u *)__P = (__m32) ((__v4si)__B)[0];
+}
+
+extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_storeu_si16 (void *__P, __m128i __B)
+{
+ *(__m16_u *)__P = (__m16) ((__v8hi)__B)[0];
+}
+
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_movepi64_pi64 (__m128i __B)
{
diff --git a/gcc/config/i386/enqcmdintrin.h b/gcc/config/i386/enqcmdintrin.h
index 4b2efcb..dcb6507 100644
--- a/gcc/config/i386/enqcmdintrin.h
+++ b/gcc/config/i386/enqcmdintrin.h
@@ -21,12 +21,12 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <enqcmdntrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <enqcmdintrin.h> directly; include <x86gprintrin.h> instead."
#endif
-#ifndef _ENQCMDNTRIN_H_INCLUDED
-#define _ENQCMDNTRIN_H_INCLUDED
+#ifndef _ENQCMDINTRIN_H_INCLUDED
+#define _ENQCMDINTRIN_H_INCLUDED
#ifndef __ENQCMD__
#pragma GCC push_options
@@ -52,4 +52,4 @@ _enqcmds (void * __P, const void * __Q)
#undef __DISABLE_ENQCMD__
#pragma GCC pop_options
#endif /* __DISABLE_ENQCMD__ */
-#endif /* _ENQCMDNTRIN_H_INCLUDED. */
+#endif /* _ENQCMDINTRIN_H_INCLUDED. */
diff --git a/gcc/config/i386/fxsrintrin.h b/gcc/config/i386/fxsrintrin.h
index fde05a7..6e059df 100644
--- a/gcc/config/i386/fxsrintrin.h
+++ b/gcc/config/i386/fxsrintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <fxsrintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _FXSRINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/hresetintrin.h b/gcc/config/i386/hresetintrin.h
new file mode 100644
index 0000000..bdbe253
--- /dev/null
+++ b/gcc/config/i386/hresetintrin.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2020 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/>. */
+
+#if !defined _X86GPRINTRIN_H_INCLUDED
+# error "Never use <hresetintrin.h> directly; include <x86gprintrin.h> instead."
+#endif
+
+#ifndef _HRESETINTRIN_H_INCLUDED
+#define _HRESETINTRIN_H_INCLUDED
+
+#ifndef __HRESET__
+#pragma GCC push_options
+#pragma GCC target ("hreset")
+#define __DISABLE_HRESET__
+#endif /* __HRESET__ */
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_hreset (unsigned int __EAX)
+{
+ __builtin_ia32_hreset (__EAX);
+}
+
+#ifdef __DISABLE_HRESET__
+#undef __DISABLE_HRESET__
+#pragma GCC pop_options
+#endif /* __DISABLE_HRESET__ */
+#endif /* _HRESETINTRIN_H_INCLUDED. */
diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def
index 1adf7c4..964633d 100644
--- a/gcc/config/i386/i386-builtin-types.def
+++ b/gcc/config/i386/i386-builtin-types.def
@@ -194,6 +194,7 @@ DEF_FUNCTION_TYPE (UNSIGNED)
DEF_FUNCTION_TYPE (UINT)
DEF_FUNCTION_TYPE (USHORT)
DEF_FUNCTION_TYPE (INT)
+DEF_FUNCTION_TYPE (UINT8)
DEF_FUNCTION_TYPE (VOID)
DEF_FUNCTION_TYPE (PVOID)
@@ -443,6 +444,7 @@ DEF_FUNCTION_TYPE (V8DF, V8DF, V8DF, INT)
DEF_FUNCTION_TYPE (V8DF, V8DF, V8DF, INT, V8DF, UQI)
DEF_FUNCTION_TYPE (V8DF, V8DF, V8DF, INT, V8DF, QI, INT)
DEF_FUNCTION_TYPE (V8DF, V8DF, INT, V8DF, UQI)
+DEF_FUNCTION_TYPE (V8DF, V8DF, INT, V8DF, UQI, INT)
DEF_FUNCTION_TYPE (V8DF, V8DF, V8DF, V8DI, INT)
DEF_FUNCTION_TYPE (V4DF, V4DF, V4DF, V4DI, INT, UQI)
DEF_FUNCTION_TYPE (V2DF, V2DF, V2DF, V2DI, INT, UQI)
@@ -452,6 +454,7 @@ DEF_FUNCTION_TYPE (V16SF, V16SF, V16SF, INT)
DEF_FUNCTION_TYPE (V16SF, V16SF, V16SF, INT, V16SF, UHI)
DEF_FUNCTION_TYPE (V16SF, V16SF, V16SF, INT, V16SF, HI, INT)
DEF_FUNCTION_TYPE (V16SF, V16SF, INT, V16SF, UHI)
+DEF_FUNCTION_TYPE (V16SF, V16SF, INT, V16SF, UHI, INT)
DEF_FUNCTION_TYPE (V16SI, V16SI, V4SI, INT, V16SI, UHI)
DEF_FUNCTION_TYPE (V16SF, V16SF, V16SF, V16SI, INT)
DEF_FUNCTION_TYPE (V16SF, V16SF, V16SF, V16SI, INT, HI, INT)
@@ -1026,8 +1029,10 @@ DEF_FUNCTION_TYPE (V2DF, V2DF, V2DF, V2DF, UQI, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, V4SF, V4SF, UQI, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, V4SF, V4SF, QI, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, V2DF, V4SF, QI, INT)
+DEF_FUNCTION_TYPE (V4SF, V4SF, V2DF, V4SF, UQI, INT)
DEF_FUNCTION_TYPE (V2DF, V2DF, V2DF, V2DF, QI, INT)
DEF_FUNCTION_TYPE (V2DF, V2DF, V4SF, V2DF, QI, INT)
+DEF_FUNCTION_TYPE (V2DF, V2DF, V4SF, V2DF, UQI, INT)
DEF_FUNCTION_TYPE (V2DF, V2DF, V2DF, V2DF, INT)
DEF_FUNCTION_TYPE (V4SF, V4SF, V4SF, V4SF, INT)
diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def
index fec5cef..882cba5 100644
--- a/gcc/config/i386/i386-builtin.def
+++ b/gcc/config/i386/i386-builtin.def
@@ -452,6 +452,14 @@ BDESC (0, OPTION_MASK_ISA2_SERIALIZE, CODE_FOR_serialize, "__builtin_ia32_serial
BDESC (0, OPTION_MASK_ISA2_TSXLDTRK, CODE_FOR_xsusldtrk, "__builtin_ia32_xsusldtrk", IX86_BUILTIN_XSUSLDTRK, UNKNOWN, (int) VOID_FTYPE_VOID)
BDESC (0, OPTION_MASK_ISA2_TSXLDTRK, CODE_FOR_xresldtrk, "__builtin_ia32_xresldtrk", IX86_BUILTIN_XRESLDTRK, UNKNOWN, (int) VOID_FTYPE_VOID)
+/* UINTR. */
+BDESC (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_UINTR, CODE_FOR_clui, "__builtin_ia32_clui", IX86_BUILTIN_CLUI, UNKNOWN, (int) VOID_FTYPE_VOID)
+BDESC (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_UINTR, CODE_FOR_stui, "__builtin_ia32_stui", IX86_BUILTIN_STUI, UNKNOWN, (int) VOID_FTYPE_VOID)
+BDESC (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_UINTR, CODE_FOR_senduipi, "__builtin_ia32_senduipi", IX86_BUILTIN_SENDUIPI, UNKNOWN, (int) VOID_FTYPE_UINT64)
+
+/* HRESET */
+BDESC (0, OPTION_MASK_ISA2_HRESET, CODE_FOR_hreset, "__builtin_ia32_hreset", IX86_BUILTIN_HRESET, UNKNOWN, (int) VOID_FTYPE_UNSIGNED)
+
BDESC_END (SPECIAL_ARGS, ARGS)
/* Builtins with variable number of arguments. */
@@ -2772,10 +2780,12 @@ BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_fix_notruncv16sfv16si_mask_r
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_cvtps2pd512_mask_round, "__builtin_ia32_cvtps2pd512_mask", IX86_BUILTIN_CVTPS2PD512, UNKNOWN, (int) V8DF_FTYPE_V8SF_V8DF_QI_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_avx512f_ufix_notruncv16sfv16si_mask_round, "__builtin_ia32_cvtps2udq512_mask", IX86_BUILTIN_CVTPS2UDQ512, UNKNOWN, (int) V16SI_FTYPE_V16SF_V16SI_HI_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_sse2_cvtsd2ss_round, "__builtin_ia32_cvtsd2ss_round", IX86_BUILTIN_CVTSD2SS_ROUND, UNKNOWN, (int) V4SF_FTYPE_V4SF_V2DF_INT)
+BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_sse2_cvtsd2ss_mask_round, "__builtin_ia32_cvtsd2ss_mask_round", IX86_BUILTIN_CVTSD2SS_MASK_ROUND, UNKNOWN, (int) V4SF_FTYPE_V4SF_V2DF_V4SF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512F | OPTION_MASK_ISA_64BIT, 0, CODE_FOR_sse2_cvtsi2sdq_round, "__builtin_ia32_cvtsi2sd64", IX86_BUILTIN_CVTSI2SD64, UNKNOWN, (int) V2DF_FTYPE_V2DF_INT64_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_sse_cvtsi2ss_round, "__builtin_ia32_cvtsi2ss32", IX86_BUILTIN_CVTSI2SS32, UNKNOWN, (int) V4SF_FTYPE_V4SF_INT_INT)
BDESC (OPTION_MASK_ISA_AVX512F | OPTION_MASK_ISA_64BIT, 0, CODE_FOR_sse_cvtsi2ssq_round, "__builtin_ia32_cvtsi2ss64", IX86_BUILTIN_CVTSI2SS64, UNKNOWN, (int) V4SF_FTYPE_V4SF_INT64_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_sse2_cvtss2sd_round, "__builtin_ia32_cvtss2sd_round", IX86_BUILTIN_CVTSS2SD_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V4SF_INT)
+BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_sse2_cvtss2sd_mask_round, "__builtin_ia32_cvtss2sd_mask_round", IX86_BUILTIN_CVTSS2SD_MASK_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V4SF_V2DF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_fix_truncv8dfv8si2_mask_round, "__builtin_ia32_cvttpd2dq512_mask", IX86_BUILTIN_CVTTPD2DQ512, UNKNOWN, (int) V8SI_FTYPE_V8DF_V8SI_QI_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_fixuns_truncv8dfv8si2_mask_round, "__builtin_ia32_cvttpd2udq512_mask", IX86_BUILTIN_CVTTPD2UDQ512, UNKNOWN, (int) V8SI_FTYPE_V8DF_V8SI_QI_INT)
BDESC (OPTION_MASK_ISA_AVX512F, 0, CODE_FOR_fix_truncv16sfv16si2_mask_round, "__builtin_ia32_cvttps2dq512_mask", IX86_BUILTIN_CVTTPS2DQ512, UNKNOWN, (int) V16SI_FTYPE_V16SF_V16SI_HI_INT)
@@ -2911,13 +2921,21 @@ BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_exp2v16sf_mask_round, "__b
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_rcp28v8df_mask_round, "__builtin_ia32_rcp28pd_mask", IX86_BUILTIN_RCP28PD, UNKNOWN, (int) V8DF_FTYPE_V8DF_V8DF_QI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_rcp28v16sf_mask_round, "__builtin_ia32_rcp28ps_mask", IX86_BUILTIN_RCP28PS, UNKNOWN, (int) V16SF_FTYPE_V16SF_V16SF_HI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrcp28v2df_round, "__builtin_ia32_rcp28sd_round", IX86_BUILTIN_RCP28SD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT)
+BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrcp28v2df_mask_round, "__builtin_ia32_rcp28sd_mask_round", IX86_BUILTIN_RCP28SD_MASK_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_V2DF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrcp28v4sf_round, "__builtin_ia32_rcp28ss_round", IX86_BUILTIN_RCP28SS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT)
+BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrcp28v4sf_mask_round, "__builtin_ia32_rcp28ss_mask_round", IX86_BUILTIN_RCP28SS_MASK_ROUND, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_V4SF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_rsqrt28v8df_mask_round, "__builtin_ia32_rsqrt28pd_mask", IX86_BUILTIN_RSQRT28PD, UNKNOWN, (int) V8DF_FTYPE_V8DF_V8DF_QI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_rsqrt28v16sf_mask_round, "__builtin_ia32_rsqrt28ps_mask", IX86_BUILTIN_RSQRT28PS, UNKNOWN, (int) V16SF_FTYPE_V16SF_V16SF_HI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrsqrt28v2df_round, "__builtin_ia32_rsqrt28sd_round", IX86_BUILTIN_RSQRT28SD, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT)
+BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrsqrt28v2df_mask_round, "__builtin_ia32_rsqrt28sd_mask_round", IX86_BUILTIN_RSQRT28SD_MASK_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_V2DF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrsqrt28v4sf_round, "__builtin_ia32_rsqrt28ss_round", IX86_BUILTIN_RSQRT28SS, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT)
+BDESC (OPTION_MASK_ISA_AVX512ER, 0, CODE_FOR_avx512er_vmrsqrt28v4sf_mask_round, "__builtin_ia32_rsqrt28ss_mask_round", IX86_BUILTIN_RSQRT28SS_MASK_ROUND, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_V4SF_UQI_INT)
/* AVX512DQ. */
+BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_reducepv8df_mask_round, "__builtin_ia32_reducepd512_mask_round", IX86_BUILTIN_REDUCEPD512_MASK_ROUND, UNKNOWN, (int) V8DF_FTYPE_V8DF_INT_V8DF_UQI_INT)
+BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_reducepv16sf_mask_round, "__builtin_ia32_reduceps512_mask_round", IX86_BUILTIN_REDUCEPS512_MASK_ROUND, UNKNOWN, (int) V16SF_FTYPE_V16SF_INT_V16SF_UHI_INT)
+BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_reducesv2df_mask_round, "__builtin_ia32_reducesd_mask_round", IX86_BUILTIN_REDUCESD128_MASK_ROUND, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT_V2DF_UQI_INT)
+BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_reducesv4sf_mask_round, "__builtin_ia32_reducess_mask_round", IX86_BUILTIN_REDUCESS128_MASK_ROUND, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT_V4SF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_avx512dq_rangesv2df_mask_round, "__builtin_ia32_rangesd128_mask_round", IX86_BUILTIN_RANGESD128, UNKNOWN, (int) V2DF_FTYPE_V2DF_V2DF_INT_V2DF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_avx512dq_rangesv4sf_mask_round, "__builtin_ia32_rangess128_mask_round", IX86_BUILTIN_RANGESS128, UNKNOWN, (int) V4SF_FTYPE_V4SF_V4SF_INT_V4SF_UQI_INT)
BDESC (OPTION_MASK_ISA_AVX512DQ, 0, CODE_FOR_fix_notruncv8dfv8di2_mask_round, "__builtin_ia32_cvtpd2qq512_mask", IX86_BUILTIN_CVTPD2QQ512, UNKNOWN, (int) V8DI_FTYPE_V8DF_V8DI_QI_INT)
diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index ca7a870..504987a 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -1194,6 +1194,11 @@ ix86_init_mmx_sse_builtins (void)
def_builtin (0, OPTION_MASK_ISA2_WAITPKG, "__builtin_ia32_tpause",
UINT8_FTYPE_UNSIGNED_UINT64, IX86_BUILTIN_TPAUSE);
+ /* UINTR. */
+ def_builtin (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_UINTR,
+ "__builtin_ia32_testui",
+ UINT8_FTYPE_VOID, IX86_BUILTIN_TESTUI);
+
/* CLDEMOTE. */
def_builtin (0, OPTION_MASK_ISA2_CLDEMOTE, "__builtin_ia32_cldemote",
VOID_FTYPE_PCVOID, IX86_BUILTIN_CLDEMOTE);
diff --git a/gcc/config/i386/i386-builtins.h b/gcc/config/i386/i386-builtins.h
index cc6a8ce..a88cc0c 100644
--- a/gcc/config/i386/i386-builtins.h
+++ b/gcc/config/i386/i386-builtins.h
@@ -40,6 +40,7 @@ enum ix86_builtins
IX86_BUILTIN_UMONITOR,
IX86_BUILTIN_UMWAIT,
IX86_BUILTIN_TPAUSE,
+ IX86_BUILTIN_TESTUI,
IX86_BUILTIN_CLZERO,
IX86_BUILTIN_CLDEMOTE,
IX86_BUILTIN_VEC_INIT_V2SI,
diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index 3553a37..bbe9ac5 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -588,6 +588,20 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
def_or_undef (parse_in, "__ENQCMD__");
if (isa_flag2 & OPTION_MASK_ISA2_TSXLDTRK)
def_or_undef (parse_in, "__TSXLDTRK__");
+ if (isa_flag2 & OPTION_MASK_ISA2_AMX_TILE)
+ def_or_undef (parse_in, "__AMX_TILE__");
+ if (isa_flag2 & OPTION_MASK_ISA2_AMX_INT8)
+ def_or_undef (parse_in, "__AMX_INT8__");
+ if (isa_flag2 & OPTION_MASK_ISA2_AMX_BF16)
+ def_or_undef (parse_in, "__AMX_BF16__");
+ if (isa_flag & OPTION_MASK_ISA_SAHF)
+ def_or_undef (parse_in, "__LAHF_SAHF__");
+ if (isa_flag2 & OPTION_MASK_ISA2_MOVBE)
+ def_or_undef (parse_in, "__MOVBE__");
+ if (isa_flag2 & OPTION_MASK_ISA2_UINTR)
+ def_or_undef (parse_in, "__UINTR__");
+ if (isa_flag2 & OPTION_MASK_ISA2_HRESET)
+ def_or_undef (parse_in, "__HRESET__");
if (TARGET_IAMCU)
{
def_or_undef (parse_in, "__iamcu");
diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index e6f8b31..3e8afe6 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -1045,7 +1045,8 @@ ix86_binary_operator_ok (enum rtx_code code, machine_mode mode,
rtx src2 = operands[2];
/* Both source operands cannot be in memory. */
- if (MEM_P (src1) && MEM_P (src2))
+ if ((MEM_P (src1) || bcst_mem_operand (src1, mode))
+ && (MEM_P (src2) || bcst_mem_operand (src2, mode)))
return false;
/* Canonicalize operand order for commutative operators. */
@@ -3525,6 +3526,13 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false)
machine_mode mode = GET_MODE (dest);
machine_mode cmpmode = GET_MODE (cmp);
+ /* Simplify trivial VEC_COND_EXPR to avoid ICE in pr97506. */
+ if (rtx_equal_p (op_true, op_false))
+ {
+ emit_move_insn (dest, op_true);
+ return;
+ }
+
/* In AVX512F the result of comparison is an integer mask. */
bool maskcmp = mode != cmpmode && ix86_valid_mask_cmp_mode (mode);
@@ -10225,12 +10233,16 @@ ix86_expand_round_builtin (const struct builtin_description *d,
case V16SF_FTYPE_V16SF_V16SF_V16SF_HI_INT:
case V2DF_FTYPE_V2DF_V2DF_V2DF_QI_INT:
case V2DF_FTYPE_V2DF_V4SF_V2DF_QI_INT:
+ case V2DF_FTYPE_V2DF_V4SF_V2DF_UQI_INT:
case V4SF_FTYPE_V4SF_V4SF_V4SF_QI_INT:
case V4SF_FTYPE_V4SF_V2DF_V4SF_QI_INT:
+ case V4SF_FTYPE_V4SF_V2DF_V4SF_UQI_INT:
nargs = 5;
break;
case V16SF_FTYPE_V16SF_INT_V16SF_HI_INT:
case V8DF_FTYPE_V8DF_INT_V8DF_QI_INT:
+ case V8DF_FTYPE_V8DF_INT_V8DF_UQI_INT:
+ case V16SF_FTYPE_V16SF_INT_V16SF_UHI_INT:
nargs_constant = 4;
nargs = 5;
break;
@@ -10413,6 +10425,7 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
case USHORT_FTYPE_VOID:
case UINT64_FTYPE_VOID:
case UINT_FTYPE_VOID:
+ case UINT8_FTYPE_VOID:
case UNSIGNED_FTYPE_VOID:
nargs = 0;
klass = load;
@@ -11203,6 +11216,19 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
return target;
+ case IX86_BUILTIN_TESTUI:
+ emit_insn (gen_testui ());
+
+ if (target == 0
+ || !register_operand (target, QImode))
+ target = gen_reg_rtx (QImode);
+
+ pat = gen_rtx_LTU (QImode, gen_rtx_REG (CCCmode, FLAGS_REG),
+ const0_rtx);
+ emit_insn (gen_rtx_SET (target, pat));
+
+ return target;
+
case IX86_BUILTIN_CLZERO:
arg0 = CALL_EXPR_ARG (exp, 0);
op0 = expand_normal (arg0);
@@ -12807,6 +12833,14 @@ rdseed_step:
emit_insn (gen_incssp (mode, op0));
return 0;
+ case IX86_BUILTIN_HRESET:
+ icode = CODE_FOR_hreset;
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ op0 = expand_normal (arg0);
+ op0 = force_reg (SImode, op0);
+ emit_insn (gen_hreset (op0));
+ return 0;
+
case IX86_BUILTIN_RSTORSSP:
case IX86_BUILTIN_CLRSSBSY:
arg0 = CALL_EXPR_ARG (exp, 0);
diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
index 2fabd20..82c8091 100644
--- a/gcc/config/i386/i386-options.c
+++ b/gcc/config/i386/i386-options.c
@@ -209,7 +209,12 @@ static struct ix86_target_opts isa2_opts[] =
{ "-mavx512bf16", OPTION_MASK_ISA2_AVX512BF16 },
{ "-menqcmd", OPTION_MASK_ISA2_ENQCMD },
{ "-mserialize", OPTION_MASK_ISA2_SERIALIZE },
- { "-mtsxldtrk", OPTION_MASK_ISA2_TSXLDTRK }
+ { "-mtsxldtrk", OPTION_MASK_ISA2_TSXLDTRK },
+ { "-mamx-tile", OPTION_MASK_ISA2_AMX_TILE },
+ { "-mamx-int8", OPTION_MASK_ISA2_AMX_INT8 },
+ { "-mamx-bf16", OPTION_MASK_ISA2_AMX_BF16 },
+ { "-muintr", OPTION_MASK_ISA2_UINTR },
+ { "-mhreset", OPTION_MASK_ISA2_HRESET }
};
static struct ix86_target_opts isa_opts[] =
{
@@ -1028,11 +1033,16 @@ ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
IX86_ATTR_ISA ("movdir64b", OPT_mmovdir64b),
IX86_ATTR_ISA ("waitpkg", OPT_mwaitpkg),
IX86_ATTR_ISA ("cldemote", OPT_mcldemote),
+ IX86_ATTR_ISA ("uintr", OPT_muintr),
IX86_ATTR_ISA ("ptwrite", OPT_mptwrite),
IX86_ATTR_ISA ("avx512bf16", OPT_mavx512bf16),
IX86_ATTR_ISA ("enqcmd", OPT_menqcmd),
IX86_ATTR_ISA ("serialize", OPT_mserialize),
IX86_ATTR_ISA ("tsxldtrk", OPT_mtsxldtrk),
+ IX86_ATTR_ISA ("amx-tile", OPT_mamx_tile),
+ IX86_ATTR_ISA ("amx-int8", OPT_mamx_int8),
+ IX86_ATTR_ISA ("amx-bf16", OPT_mamx_bf16),
+ IX86_ATTR_ISA ("hreset", OPT_mhreset),
/* enum options */
IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_),
@@ -1893,6 +1903,9 @@ ix86_option_override_internal (bool main_args_p,
opts->x_ix86_stringop_alg = no_stringop;
}
+ if (TARGET_UINTR && !TARGET_64BIT)
+ error ("%<-muintr%> not supported for 32-bit code");
+
if (!opts->x_ix86_arch_string)
opts->x_ix86_arch_string
= TARGET_64BIT_P (opts->x_ix86_isa_flags)
@@ -2052,10 +2065,27 @@ ix86_option_override_internal (bool main_args_p,
return false;
}
+ /* The feature-only micro-architecture levels that use
+ PTA_NO_TUNE are only defined for the x86-64 psABI. */
+ if ((processor_alias_table[i].flags & PTA_NO_TUNE) != 0
+ && (!TARGET_64BIT_P (opts->x_ix86_isa_flags)
+ || opts->x_ix86_abi != SYSV_ABI))
+ {
+ error (G_("%<%s%> architecture level is only defined"
+ " for the x86-64 psABI"), opts->x_ix86_arch_string);
+ return false;
+ }
+
ix86_schedule = processor_alias_table[i].schedule;
ix86_arch = processor_alias_table[i].processor;
- /* Default cpu tuning to the architecture. */
- ix86_tune = ix86_arch;
+
+ /* Default cpu tuning to the architecture, unless the table
+ entry requests not to do this. Used by the x86-64 psABI
+ micro-architecture levels. */
+ if ((processor_alias_table[i].flags & PTA_NO_TUNE) == 0)
+ ix86_tune = ix86_arch;
+ else
+ ix86_tune = PROCESSOR_GENERIC;
if (((processor_alias_table[i].flags & PTA_MMX) != 0)
&& !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_MMX))
@@ -2258,6 +2288,18 @@ ix86_option_override_internal (bool main_args_p,
&& !(opts->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_AVX512BF16))
opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AVX512BF16;
+ if (((processor_alias_table[i].flags & PTA_AMX_TILE) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit
+ & OPTION_MASK_ISA2_AMX_TILE))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_TILE;
+ if (((processor_alias_table[i].flags & PTA_AMX_INT8) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit
+ & OPTION_MASK_ISA2_AMX_INT8))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_INT8;
+ if (((processor_alias_table[i].flags & PTA_AMX_BF16) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit
+ & OPTION_MASK_ISA2_AMX_BF16))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_AMX_BF16;
if (((processor_alias_table[i].flags & PTA_MOVDIRI) != 0)
&& !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_MOVDIRI))
opts->x_ix86_isa_flags |= OPTION_MASK_ISA_MOVDIRI;
@@ -2366,7 +2408,8 @@ ix86_option_override_internal (bool main_args_p,
ix86_arch_features[i] = !!(initial_ix86_arch_features[i] & ix86_arch_mask);
for (i = 0; i < pta_size; i++)
- if (! strcmp (opts->x_ix86_tune_string, processor_alias_table[i].name))
+ if (! strcmp (opts->x_ix86_tune_string, processor_alias_table[i].name)
+ && (processor_alias_table[i].flags & PTA_NO_TUNE) == 0)
{
ix86_schedule = processor_alias_table[i].schedule;
ix86_tune = processor_alias_table[i].processor;
@@ -2410,8 +2453,9 @@ ix86_option_override_internal (bool main_args_p,
auto_vec <const char *> candidates;
for (i = 0; i < pta_size; i++)
- if (!TARGET_64BIT_P (opts->x_ix86_isa_flags)
- || ((processor_alias_table[i].flags & PTA_64BIT) != 0))
+ if ((!TARGET_64BIT_P (opts->x_ix86_isa_flags)
+ || ((processor_alias_table[i].flags & PTA_64BIT) != 0))
+ && (processor_alias_table[i].flags & PTA_NO_TUNE) == 0)
candidates.safe_push (processor_alias_table[i].name);
#ifdef HAVE_LOCAL_CPU_DETECT
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index c890a73..502d240 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1484,7 +1484,7 @@ ix86_reg_parm_stack_space (const_tree fndecl)
bool
ix86_libc_has_function (enum function_class fn_class)
{
- return targetm.libc_has_function (fn_class);
+ return targetm.libc_has_function (fn_class, NULL_TREE);
}
/* Returns value SYSV_ABI, MS_ABI dependent on fntype,
@@ -13098,6 +13098,43 @@ ix86_print_operand (FILE *file, rtx x, int code)
fputs (dstr, file);
}
+ /* Print bcst_mem_operand. */
+ else if (GET_CODE (x) == VEC_DUPLICATE)
+ {
+ machine_mode vmode = GET_MODE (x);
+ /* Must be bcst_memory_operand. */
+ gcc_assert (bcst_mem_operand (x, vmode));
+
+ rtx mem = XEXP (x,0);
+ ix86_print_operand (file, mem, 0);
+
+ switch (vmode)
+ {
+ case E_V2DImode:
+ case E_V2DFmode:
+ fputs ("{1to2}", file);
+ break;
+ case E_V4SImode:
+ case E_V4SFmode:
+ case E_V4DImode:
+ case E_V4DFmode:
+ fputs ("{1to4}", file);
+ break;
+ case E_V8SImode:
+ case E_V8SFmode:
+ case E_V8DFmode:
+ case E_V8DImode:
+ fputs ("{1to8}", file);
+ break;
+ case E_V16SFmode:
+ case E_V16SImode:
+ fputs ("{1to16}", file);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+ }
+
else
{
/* We have patterns that allow zero sets of memory, for instance.
@@ -15131,11 +15168,32 @@ ix86_cc_mode (enum rtx_code code, rtx op0, rtx op1)
/* Codes needing carry flag. */
case GEU: /* CF=0 */
case LTU: /* CF=1 */
+ rtx geu;
/* Detect overflow checks. They need just the carry flag. */
if (GET_CODE (op0) == PLUS
&& (rtx_equal_p (op1, XEXP (op0, 0))
|| rtx_equal_p (op1, XEXP (op0, 1))))
return CCCmode;
+ /* Similarly for *setcc_qi_addqi3_cconly_overflow_1_* patterns.
+ Match LTU of op0
+ (neg:QI (geu:QI (reg:CC_CCC FLAGS_REG) (const_int 0)))
+ and op1
+ (ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))
+ where CC_CCC is either CC or CCC. */
+ else if (code == LTU
+ && GET_CODE (op0) == NEG
+ && GET_CODE (geu = XEXP (op0, 0)) == GEU
+ && REG_P (XEXP (geu, 0))
+ && (GET_MODE (XEXP (geu, 0)) == CCCmode
+ || GET_MODE (XEXP (geu, 0)) == CCmode)
+ && REGNO (XEXP (geu, 0)) == FLAGS_REG
+ && XEXP (geu, 1) == const0_rtx
+ && GET_CODE (op1) == LTU
+ && REG_P (XEXP (op1, 0))
+ && GET_MODE (XEXP (op1, 0)) == GET_MODE (XEXP (geu, 0))
+ && REGNO (XEXP (op1, 0)) == FLAGS_REG
+ && XEXP (op1, 1) == const0_rtx)
+ return CCCmode;
else
return CCmode;
case GTU: /* CF=0 & ZF=0 */
@@ -19749,33 +19807,56 @@ ix86_rtx_costs (rtx x, machine_mode mode, int outer_code_i, int opno,
return false;
case COMPARE:
- if (GET_CODE (XEXP (x, 0)) == ZERO_EXTRACT
- && XEXP (XEXP (x, 0), 1) == const1_rtx
- && CONST_INT_P (XEXP (XEXP (x, 0), 2))
- && XEXP (x, 1) == const0_rtx)
+ rtx op0, op1;
+ op0 = XEXP (x, 0);
+ op1 = XEXP (x, 1);
+ if (GET_CODE (op0) == ZERO_EXTRACT
+ && XEXP (op0, 1) == const1_rtx
+ && CONST_INT_P (XEXP (op0, 2))
+ && op1 == const0_rtx)
{
/* This kind of construct is implemented using test[bwl].
Treat it as if we had an AND. */
- mode = GET_MODE (XEXP (XEXP (x, 0), 0));
+ mode = GET_MODE (XEXP (op0, 0));
*total = (cost->add
- + rtx_cost (XEXP (XEXP (x, 0), 0), mode, outer_code,
+ + rtx_cost (XEXP (op0, 0), mode, outer_code,
opno, speed)
+ rtx_cost (const1_rtx, mode, outer_code, opno, speed));
return true;
}
- if (GET_CODE (XEXP (x, 0)) == PLUS
- && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)))
+ if (GET_CODE (op0) == PLUS && rtx_equal_p (XEXP (op0, 0), op1))
{
/* This is an overflow detection, count it as a normal compare. */
- *total = rtx_cost (XEXP (x, 0), GET_MODE (XEXP (x, 0)),
- COMPARE, 0, speed);
+ *total = rtx_cost (op0, GET_MODE (op0), COMPARE, 0, speed);
+ return true;
+ }
+
+ rtx geu;
+ /* Match x
+ (compare:CCC (neg:QI (geu:QI (reg:CC_CCC FLAGS_REG) (const_int 0)))
+ (ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))) */
+ if (mode == CCCmode
+ && GET_CODE (op0) == NEG
+ && GET_CODE (geu = XEXP (op0, 0)) == GEU
+ && REG_P (XEXP (geu, 0))
+ && (GET_MODE (XEXP (geu, 0)) == CCCmode
+ || GET_MODE (XEXP (geu, 0)) == CCmode)
+ && REGNO (XEXP (geu, 0)) == FLAGS_REG
+ && XEXP (geu, 1) == const0_rtx
+ && GET_CODE (op1) == LTU
+ && REG_P (XEXP (op1, 0))
+ && GET_MODE (XEXP (op1, 0)) == GET_MODE (XEXP (geu, 0))
+ && REGNO (XEXP (op1, 0)) == FLAGS_REG
+ && XEXP (op1, 1) == const0_rtx)
+ {
+ /* This is *setcc_qi_addqi3_cconly_overflow_1_* patterns, a nop. */
+ *total = 0;
return true;
}
/* The embedded comparison operand is completely free. */
- if (!general_operand (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
- && XEXP (x, 1) == const0_rtx)
+ if (!general_operand (op0, GET_MODE (op0)) && op1 == const0_rtx)
*total = 0;
return false;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 92b7475..24207d0 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -203,6 +203,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_SERIALIZE_P(x) TARGET_ISA2_SERIALIZE_P(x)
#define TARGET_TSXLDTRK TARGET_ISA2_TSXLDTRK
#define TARGET_TSXLDTRK_P(x) TARGET_ISA2_TSXLDTRK_P(x)
+#define TARGET_AMX_TILE TARGET_ISA2_AMX_TILE
+#define TARGET_AMX_TILE_P(x) TARGET_ISA2_AMX_TILE(x)
+#define TARGET_AMX_INT8 TARGET_ISA2_AMX_INT8
+#define TARGET_AMX_INT8_P(x) TARGET_ISA2_AMX_INT8(x)
+#define TARGET_AMX_BF16 TARGET_ISA2_AMX_BF16
+#define TARGET_AMX_BF16_P(x) TARGET_ISA2_AMX_BF16(x)
+#define TARGET_UINTR TARGET_ISA2_UINTR
+#define TARGET_UINTR_P(x) TARGET_ISA2_UINTR_P(x)
+#define TARGET_HRESET TARGET_ISA2_HRESET
+#define TARGET_HRESET_P(x) TARGET_ISA2_HRESET_P(x)
#define TARGET_LP64 TARGET_ABI_64
#define TARGET_LP64_P(x) TARGET_ABI_64_P(x)
@@ -1262,6 +1272,10 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
(TARGET_FMA4 && ((MODE) == V4SFmode || (MODE) == V2DFmode \
|| (MODE) == V8SFmode || (MODE) == V4DFmode))
+#define VALID_BCST_MODE_P(MODE) \
+ ((MODE) == SFmode || (MODE) == DFmode \
+ || (MODE) == SImode || (MODE) == DImode)
+
/* It is possible to write patterns to move flags; but until someone
does it, */
#define AVOID_CCMODE_COPIES
@@ -2427,7 +2441,7 @@ const wide_int_bitmask PTA_AVX512F (HOST_WIDE_INT_1U << 40);
const wide_int_bitmask PTA_AVX512ER (HOST_WIDE_INT_1U << 41);
const wide_int_bitmask PTA_AVX512PF (HOST_WIDE_INT_1U << 42);
const wide_int_bitmask PTA_AVX512CD (HOST_WIDE_INT_1U << 43);
-/* Hole after PTA_MPX was removed. */
+const wide_int_bitmask PTA_NO_TUNE (HOST_WIDE_INT_1U << 44);
const wide_int_bitmask PTA_SHA (HOST_WIDE_INT_1U << 45);
const wide_int_bitmask PTA_PREFETCHWT1 (HOST_WIDE_INT_1U << 46);
const wide_int_bitmask PTA_CLFLUSHOPT (HOST_WIDE_INT_1U << 47);
@@ -2466,6 +2480,21 @@ const wide_int_bitmask PTA_ENQCMD (0, HOST_WIDE_INT_1U << 15);
const wide_int_bitmask PTA_CLDEMOTE (0, HOST_WIDE_INT_1U << 16);
const wide_int_bitmask PTA_SERIALIZE (0, HOST_WIDE_INT_1U << 17);
const wide_int_bitmask PTA_TSXLDTRK (0, HOST_WIDE_INT_1U << 18);
+const wide_int_bitmask PTA_AMX_TILE(0, HOST_WIDE_INT_1U << 19);
+const wide_int_bitmask PTA_AMX_INT8(0, HOST_WIDE_INT_1U << 20);
+const wide_int_bitmask PTA_AMX_BF16(0, HOST_WIDE_INT_1U << 21);
+const wide_int_bitmask PTA_UINTR (0, HOST_WIDE_INT_1U << 22);
+const wide_int_bitmask PTA_HRESET(0, HOST_WIDE_INT_1U << 23);
+
+const wide_int_bitmask PTA_X86_64_BASELINE = PTA_64BIT | PTA_MMX | PTA_SSE
+ | PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR;
+const wide_int_bitmask PTA_X86_64_V2 = (PTA_X86_64_BASELINE & (~PTA_NO_SAHF))
+ | PTA_CX16 | PTA_POPCNT | PTA_SSE3 | PTA_SSE4_1 | PTA_SSE4_2 | PTA_SSSE3;
+const wide_int_bitmask PTA_X86_64_V3 = PTA_X86_64_V2
+ | PTA_AVX | PTA_AVX2 | PTA_BMI | PTA_BMI2 | PTA_F16C | PTA_FMA | PTA_LZCNT
+ | PTA_MOVBE | PTA_XSAVE;
+const wide_int_bitmask PTA_X86_64_V4 = PTA_X86_64_V3
+ | PTA_AVX512F | PTA_AVX512BW | PTA_AVX512CD | PTA_AVX512DQ | PTA_AVX512VL;
const wide_int_bitmask PTA_CORE2 = PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2
| PTA_SSE3 | PTA_SSSE3 | PTA_CX16 | PTA_FXSR;
@@ -2499,9 +2528,10 @@ const wide_int_bitmask PTA_TIGERLAKE = PTA_ICELAKE_CLIENT | PTA_MOVDIRI
| PTA_MOVDIR64B | PTA_CLWB | PTA_AVX512VP2INTERSECT;
const wide_int_bitmask PTA_SAPPHIRERAPIDS = PTA_COOPERLAKE | PTA_MOVDIRI
| PTA_MOVDIR64B | PTA_AVX512VP2INTERSECT | PTA_ENQCMD | PTA_CLDEMOTE
- | PTA_PTWRITE | PTA_WAITPKG | PTA_SERIALIZE | PTA_TSXLDTRK;
+ | PTA_PTWRITE | PTA_WAITPKG | PTA_SERIALIZE | PTA_TSXLDTRK | PTA_AMX_TILE
+ | PTA_AMX_INT8 | PTA_AMX_BF16 | PTA_UINTR;
const wide_int_bitmask PTA_ALDERLAKE = PTA_SKYLAKE | PTA_CLDEMOTE | PTA_PTWRITE
- | PTA_WAITPKG | PTA_SERIALIZE;
+ | PTA_WAITPKG | PTA_SERIALIZE | PTA_HRESET;
const wide_int_bitmask PTA_KNL = PTA_BROADWELL | PTA_AVX512PF | PTA_AVX512ER
| PTA_AVX512F | PTA_AVX512CD;
const wide_int_bitmask PTA_BONNELL = PTA_CORE2 | PTA_MOVBE;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 93aae81..8730816 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -186,6 +186,10 @@
;; IRET support
UNSPEC_INTERRUPT_RETURN
+
+ ;; For MOVDIRI and MOVDIR64B support
+ UNSPEC_MOVDIRI
+ UNSPEC_MOVDIR64B
])
(define_c_enum "unspecv" [
@@ -280,10 +284,6 @@
UNSPECV_SETSSBSY
UNSPECV_CLRSSBSY
- ;; For MOVDIRI and MOVDIR64B support
- UNSPECV_MOVDIRI
- UNSPECV_MOVDIR64B
-
;; For TSXLDTRK support
UNSPECV_XSUSLDTRK
UNSPECV_XRESLDTRK
@@ -293,6 +293,12 @@
UNSPECV_UMONITOR
UNSPECV_TPAUSE
+ ;; For UINTR support
+ UNSPECV_CLUI
+ UNSPECV_STUI
+ UNSPECV_TESTUI
+ UNSPECV_SENDUIPI
+
;; For CLDEMOTE support
UNSPECV_CLDEMOTE
@@ -310,6 +316,9 @@
;; For patchable area support
UNSPECV_PATCHABLE_AREA
+
+ ;; For HRESET support
+ UNSPECV_HRESET
])
;; Constants to represent rounding modes in the ROUND instruction
@@ -7039,6 +7048,20 @@
(set (match_operand:SWI48 0 "register_operand")
(minus:SWI48 (match_dup 1) (match_dup 2)))])]
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands)")
+
+(define_mode_iterator CC_CCC [CC CCC])
+
+;; Pre-reload splitter to optimize
+;; *setcc_qi followed by *addqi3_cconly_overflow_1 with the same QI
+;; operand and no intervening flags modifications into nothing.
+(define_insn_and_split "*setcc_qi_addqi3_cconly_overflow_1_<mode>"
+ [(set (reg:CCC FLAGS_REG)
+ (compare:CCC (neg:QI (geu:QI (reg:CC_CCC FLAGS_REG) (const_int 0)))
+ (ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))))]
+ "ix86_pre_reload_split ()"
+ "#"
+ "&& 1"
+ [(const_int 0)])
;; Overflow setting add instructions
@@ -13666,7 +13689,7 @@
(unspec [(const_int 0)] UNSPEC_INTERRUPT_RETURN)]
"reload_completed"
{
- return TARGET_64BIT ? "iretq" : "iret";
+ return TARGET_64BIT ? (TARGET_UINTR ? "uiret" : "iretq") : "iret";
})
;; Used by x86_machine_dependent_reorg to avoid penalty on single byte RET
@@ -21531,17 +21554,17 @@
;; MOVDIRI and MOVDIR64B
(define_insn "movdiri<mode>"
- [(unspec_volatile:SWI48 [(match_operand:SWI48 0 "memory_operand" "m")
- (match_operand:SWI48 1 "register_operand" "r")]
- UNSPECV_MOVDIRI)]
+ [(set (match_operand:SWI48 0 "memory_operand" "=m")
+ (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
+ UNSPEC_MOVDIRI))]
"TARGET_MOVDIRI"
"movdiri\t{%1, %0|%0, %1}"
[(set_attr "type" "other")])
(define_insn "@movdir64b_<mode>"
- [(unspec_volatile:XI [(match_operand:P 0 "register_operand" "r")
- (match_operand:XI 1 "memory_operand")]
- UNSPECV_MOVDIR64B)]
+ [(set (mem:XI (match_operand:P 0 "register_operand" "r"))
+ (unspec:XI [(match_operand:XI 1 "memory_operand" "m")]
+ UNSPEC_MOVDIR64B))]
"TARGET_MOVDIR64B"
"movdir64b\t{%1, %0|%0, %1}"
[(set_attr "type" "other")])
@@ -21571,6 +21594,34 @@
"enqcmd<enqcmd_sfx>\t{%1, %0|%0, %1}"
[(set_attr "type" "other")])
+;; UINTR
+(define_int_iterator UINTR [UNSPECV_CLUI UNSPECV_STUI])
+(define_int_attr uintr [(UNSPECV_CLUI "clui") (UNSPECV_STUI "stui")])
+
+(define_insn "<uintr>"
+ [(unspec_volatile [(const_int 0)] UINTR)]
+ "TARGET_UINTR && TARGET_64BIT"
+ "<uintr>"
+ [(set_attr "type" "other")
+ (set_attr "length" "4")])
+
+(define_insn "testui"
+ [(set (reg:CCC FLAGS_REG)
+ (unspec_volatile:CCC [(const_int 0)] UNSPECV_TESTUI))]
+ "TARGET_UINTR && TARGET_64BIT"
+ "testui"
+ [(set_attr "type" "other")
+ (set_attr "length" "4")])
+
+(define_insn "senduipi"
+ [(unspec_volatile
+ [(match_operand:DI 0 "register_operand" "r")]
+ UNSPECV_SENDUIPI)]
+ "TARGET_UINTR && TARGET_64BIT"
+ "senduipi\t%0"
+ [(set_attr "type" "other")
+ (set_attr "length" "4")])
+
;; WAITPKG
(define_insn "umwait"
@@ -21655,6 +21706,14 @@
(set_attr "length_immediate" "0")
(set_attr "modrm" "0")])
+(define_insn "hreset"
+ [(unspec_volatile [(match_operand:SI 0 "register_operand" "a")]
+ UNSPECV_HRESET)]
+ "TARGET_HRESET"
+ "hreset\t{$0|0}"
+ [(set_attr "type" "other")
+ (set_attr "length" "4")])
+
(include "mmx.md")
(include "sse.md")
(include "sync.md")
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index c9f7195..e6b1695 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -788,6 +788,10 @@ mptwrite
Target Report Mask(ISA2_PTWRITE) Var(ix86_isa_flags2) Save
Support PTWRITE built-in functions and code generation.
+muintr
+Target Report Mask(ISA2_UINTR) Var(ix86_isa_flags2) Save
+Support UINTR built-in functions and code generation.
+
msgx
Target Report Mask(ISA2_SGX) Var(ix86_isa_flags2) Save
Support SGX built-in functions and code generation.
@@ -1114,4 +1118,20 @@ Support SERIALIZE built-in functions and code generation.
mtsxldtrk
Target Report Mask(ISA2_TSXLDTRK) Var(ix86_isa_flags2) Save
-Support TSXLDTRK built-in functions and code generation. \ No newline at end of file
+Support TSXLDTRK built-in functions and code generation.
+
+mamx-tile
+Target Report Mask(ISA2_AMX_TILE) Var(ix86_isa_flags2) Save
+Support AMX-TILE built-in functions and code generation.
+
+mamx-int8
+Target Report Mask(ISA2_AMX_INT8) Var(ix86_isa_flags2) Save
+Support AMX-INT8 built-in functions and code generation.
+
+mamx-bf16
+Target Report Mask(ISA2_AMX_BF16) Var(ix86_isa_flags2) Save
+Support AMX-BF16 built-in functions and code generation.
+
+mhreset
+Target Report Mask(ISA2_HRESET) Var(ix86_isa_flags2) Save
+Support HRESET built-in functions and code generation.
diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h
index fd29797..3568d1f 100644
--- a/gcc/config/i386/ia32intrin.h
+++ b/gcc/config/i386/ia32intrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _X86INTRIN_H_INCLUDED
-# error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <ia32intrin.h> directly; include <x86gprintrin.h> instead."
#endif
/* 32bit bsf */
diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h
index b660d0d..71eae83 100644
--- a/gcc/config/i386/immintrin.h
+++ b/gcc/config/i386/immintrin.h
@@ -24,6 +24,8 @@
#ifndef _IMMINTRIN_H_INCLUDED
#define _IMMINTRIN_H_INCLUDED
+#include <x86gprintrin.h>
+
#include <mmintrin.h>
#include <xmmintrin.h>
@@ -38,16 +40,6 @@
#include <wmmintrin.h>
-#include <fxsrintrin.h>
-
-#include <xsaveintrin.h>
-
-#include <xsaveoptintrin.h>
-
-#include <xsavesintrin.h>
-
-#include <xsavecintrin.h>
-
#include <avxintrin.h>
#include <avx2intrin.h>
@@ -102,217 +94,28 @@
#include <shaintrin.h>
-#include <lzcntintrin.h>
-
-#include <bmiintrin.h>
-
-#include <bmi2intrin.h>
-
#include <fmaintrin.h>
#include <f16cintrin.h>
#include <rtmintrin.h>
-#include <xtestintrin.h>
-
-#include <cetintrin.h>
-
#include <gfniintrin.h>
#include <vaesintrin.h>
#include <vpclmulqdqintrin.h>
-#include <movdirintrin.h>
-
-#include <sgxintrin.h>
-
-#include <pconfigintrin.h>
-
-#include <waitpkgintrin.h>
-
-#include <cldemoteintrin.h>
-
#include <avx512bf16vlintrin.h>
#include <avx512bf16intrin.h>
-#include <enqcmdintrin.h>
+#include <amxtileintrin.h>
-#include <serializeintrin.h>
+#include <amxint8intrin.h>
-#include <tsxldtrkintrin.h>
-
-#include <rdseedintrin.h>
+#include <amxbf16intrin.h>
#include <prfchwintrin.h>
-#include <adxintrin.h>
-
-#include <clwbintrin.h>
-
-#include <clflushoptintrin.h>
-
-#include <wbnoinvdintrin.h>
-
-#include <pkuintrin.h>
-
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_wbinvd (void)
-{
- __builtin_ia32_wbinvd ();
-}
-
-#ifndef __RDRND__
-#pragma GCC push_options
-#pragma GCC target("rdrnd")
-#define __DISABLE_RDRND__
-#endif /* __RDRND__ */
-extern __inline int
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_rdrand16_step (unsigned short *__P)
-{
- return __builtin_ia32_rdrand16_step (__P);
-}
-
-extern __inline int
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_rdrand32_step (unsigned int *__P)
-{
- return __builtin_ia32_rdrand32_step (__P);
-}
-#ifdef __DISABLE_RDRND__
-#undef __DISABLE_RDRND__
-#pragma GCC pop_options
-#endif /* __DISABLE_RDRND__ */
-
-#ifndef __RDPID__
-#pragma GCC push_options
-#pragma GCC target("rdpid")
-#define __DISABLE_RDPID__
-#endif /* __RDPID__ */
-extern __inline unsigned int
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_rdpid_u32 (void)
-{
- return __builtin_ia32_rdpid ();
-}
-#ifdef __DISABLE_RDPID__
-#undef __DISABLE_RDPID__
-#pragma GCC pop_options
-#endif /* __DISABLE_RDPID__ */
-
-#ifdef __x86_64__
-
-#ifndef __FSGSBASE__
-#pragma GCC push_options
-#pragma GCC target("fsgsbase")
-#define __DISABLE_FSGSBASE__
-#endif /* __FSGSBASE__ */
-extern __inline unsigned int
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_readfsbase_u32 (void)
-{
- return __builtin_ia32_rdfsbase32 ();
-}
-
-extern __inline unsigned long long
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_readfsbase_u64 (void)
-{
- return __builtin_ia32_rdfsbase64 ();
-}
-
-extern __inline unsigned int
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_readgsbase_u32 (void)
-{
- return __builtin_ia32_rdgsbase32 ();
-}
-
-extern __inline unsigned long long
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_readgsbase_u64 (void)
-{
- return __builtin_ia32_rdgsbase64 ();
-}
-
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_writefsbase_u32 (unsigned int __B)
-{
- __builtin_ia32_wrfsbase32 (__B);
-}
-
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_writefsbase_u64 (unsigned long long __B)
-{
- __builtin_ia32_wrfsbase64 (__B);
-}
-
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_writegsbase_u32 (unsigned int __B)
-{
- __builtin_ia32_wrgsbase32 (__B);
-}
-
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_writegsbase_u64 (unsigned long long __B)
-{
- __builtin_ia32_wrgsbase64 (__B);
-}
-#ifdef __DISABLE_FSGSBASE__
-#undef __DISABLE_FSGSBASE__
-#pragma GCC pop_options
-#endif /* __DISABLE_FSGSBASE__ */
-
-#ifndef __RDRND__
-#pragma GCC push_options
-#pragma GCC target("rdrnd")
-#define __DISABLE_RDRND__
-#endif /* __RDRND__ */
-extern __inline int
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_rdrand64_step (unsigned long long *__P)
-{
- return __builtin_ia32_rdrand64_step (__P);
-}
-#ifdef __DISABLE_RDRND__
-#undef __DISABLE_RDRND__
-#pragma GCC pop_options
-#endif /* __DISABLE_RDRND__ */
-
-#endif /* __x86_64__ */
-
-#ifndef __PTWRITE__
-#pragma GCC push_options
-#pragma GCC target("ptwrite")
-#define __DISABLE_PTWRITE__
-#endif
-
-#ifdef __x86_64__
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_ptwrite64 (unsigned long long __B)
-{
- __builtin_ia32_ptwrite64 (__B);
-}
-#endif /* __x86_64__ */
-
-extern __inline void
-__attribute__((__gnu_inline__, __always_inline__, __artificial__))
-_ptwrite32 (unsigned __B)
-{
- __builtin_ia32_ptwrite32 (__B);
-}
-#ifdef __DISABLE_PTWRITE__
-#undef __DISABLE_PTWRITE__
-#pragma GCC pop_options
-#endif /* __DISABLE_PTWRITE__ */
-
#endif /* _IMMINTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c
index 15b5c3d..668208c 100644
--- a/gcc/config/i386/intelmic-mkoffload.c
+++ b/gcc/config/i386/intelmic-mkoffload.c
@@ -231,7 +231,7 @@ compile_for_target (struct obstack *argv_obstack)
unsetenv ("LIBRARY_PATH");
unsetenv ("LD_RUN_PATH");
- fork_execute (argv[0], argv, false);
+ fork_execute (argv[0], argv, false, NULL);
obstack_free (argv_obstack, NULL);
/* Restore environment variables. */
@@ -455,7 +455,7 @@ generate_host_descr_file (const char *host_compiler)
obstack_ptr_grow (&argv_obstack, NULL);
char **argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (argv[0], argv, false);
+ fork_execute (argv[0], argv, false, NULL);
obstack_free (&argv_obstack, NULL);
return obj_filename;
@@ -538,7 +538,7 @@ prepare_target_image (const char *target_compiler, int argc, char **argv)
obstack_ptr_grow (&argv_obstack, rename_section_opt);
obstack_ptr_grow (&argv_obstack, NULL);
char **new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
/* Objcopy has created symbols, containing the input file name with
@@ -580,7 +580,7 @@ prepare_target_image (const char *target_compiler, int argc, char **argv)
obstack_ptr_grow (&argv_obstack, opt_for_objcopy[2]);
obstack_ptr_grow (&argv_obstack, NULL);
new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
return target_so_filename;
@@ -672,7 +672,7 @@ main (int argc, char **argv)
obstack_ptr_grow (&argv_obstack, out_obj_filename);
obstack_ptr_grow (&argv_obstack, NULL);
char **new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
/* Run objcopy on the resultant object file to localize generated symbols
@@ -688,7 +688,7 @@ main (int argc, char **argv)
obstack_ptr_grow (&argv_obstack, out_obj_filename);
obstack_ptr_grow (&argv_obstack, NULL);
new_argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (new_argv[0], new_argv, false);
+ fork_execute (new_argv[0], new_argv, false, NULL);
obstack_free (&argv_obstack, NULL);
return 0;
diff --git a/gcc/config/i386/lwpintrin.h b/gcc/config/i386/lwpintrin.h
index d7c3acb..0b5c8bb 100644
--- a/gcc/config/i386/lwpintrin.h
+++ b/gcc/config/i386/lwpintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _X86INTRIN_H_INCLUDED
-# error "Never use <lwpintrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <lwpintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _LWPINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/lzcntintrin.h b/gcc/config/i386/lzcntintrin.h
index 1863a58..6d00e9f 100644
--- a/gcc/config/i386/lzcntintrin.h
+++ b/gcc/config/i386/lzcntintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <lzcntintrin.h> directly; include <x86gprintrin.h> instead."
#endif
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 408e57c..0d0aa93 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -98,3 +98,9 @@ along with GCC; see the file COPYING3. If not see
%{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
" LINK_SPEC_LARGE_ADDR_AWARE "\
%(shared_libgcc_undefs)"
+
+/* Enable sincos optimization, overriding cygming.h. sincos, sincosf
+ and sincosl functions are available on mingw-w64, but not on the
+ original mingw32. */
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h
index 77de7ca..dff42fd 100644
--- a/gcc/config/i386/mmintrin.h
+++ b/gcc/config/i386/mmintrin.h
@@ -42,9 +42,15 @@
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
+typedef int __m32 __attribute__ ((__vector_size__ (4), __may_alias__));
+typedef short __m16 __attribute__ ((__vector_size__ (2), __may_alias__));
/* Unaligned version of the same type */
typedef int __m64_u __attribute__ ((__vector_size__ (8), __may_alias__, __aligned__ (1)));
+typedef int __m32_u __attribute__ ((__vector_size__ (4), \
+ __may_alias__, __aligned__ (1)));
+typedef short __m16_u __attribute__ ((__vector_size__ (2), \
+ __may_alias__, __aligned__ (1)));
/* Internal data types for implementing the intrinsics. */
typedef int __v2si __attribute__ ((__vector_size__ (8)));
diff --git a/gcc/config/i386/movdirintrin.h b/gcc/config/i386/movdirintrin.h
index e7f374a..b2f8406 100644
--- a/gcc/config/i386/movdirintrin.h
+++ b/gcc/config/i386/movdirintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <movdirintrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <movdirintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _MOVDIRINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/pconfigintrin.h b/gcc/config/i386/pconfigintrin.h
index d2a3261..31c493a 100644
--- a/gcc/config/i386/pconfigintrin.h
+++ b/gcc/config/i386/pconfigintrin.h
@@ -1,5 +1,28 @@
-#ifndef _IMMINTRIN_H_INCLUDED
-#error "Never use <pconfigintrin.h> directly; include <immintrin.h> instead."
+/* Copyright (C) 2018-2020 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 _X86GPRINTRIN_H_INCLUDED
+# error "Never use <pconfigintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _PCONFIGINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/pkuintrin.h b/gcc/config/i386/pkuintrin.h
index 6840914..0d2dd51 100644
--- a/gcc/config/i386/pkuintrin.h
+++ b/gcc/config/i386/pkuintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <pkuintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <pkuintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _PKUINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index b03f9cd..be57cda 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1081,6 +1081,19 @@
(ior (match_operand 0 "register_operand")
(match_operand 0 "vector_memory_operand")))
+(define_predicate "bcst_mem_operand"
+ (and (match_code "vec_duplicate")
+ (and (match_test "TARGET_AVX512F")
+ (ior (match_test "TARGET_AVX512VL")
+ (match_test "GET_MODE_SIZE (GET_MODE (op)) == 64")))
+ (match_test "VALID_BCST_MODE_P (GET_MODE_INNER (GET_MODE (op)))")
+ (match_test "memory_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)))")))
+
+; Return true when OP is bcst_mem_operand or vector_memory_operand.
+(define_predicate "bcst_vector_operand"
+ (ior (match_operand 0 "vector_operand")
+ (match_operand 0 "bcst_mem_operand")))
+
;; Return true when OP is either nonimmediate operand, or any
;; CONST_VECTOR.
(define_predicate "nonimmediate_or_const_vector_operand"
diff --git a/gcc/config/i386/rdseedintrin.h b/gcc/config/i386/rdseedintrin.h
index efc7cea..168053a 100644
--- a/gcc/config/i386/rdseedintrin.h
+++ b/gcc/config/i386/rdseedintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <rdseedintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <rdseedintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _RDSEEDINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/rtmintrin.h b/gcc/config/i386/rtmintrin.h
index 463a989..436e517 100644
--- a/gcc/config/i386/rtmintrin.h
+++ b/gcc/config/i386/rtmintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _IMMINTRIN_H_INCLUDED
-# error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <rtmintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _RTMINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/serializeintrin.h b/gcc/config/i386/serializeintrin.h
index 0c35b9e..95f26d6 100644
--- a/gcc/config/i386/serializeintrin.h
+++ b/gcc/config/i386/serializeintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <serializeintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <serializeintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _SERIALIZE_H_INCLUDED
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 934b60a..52635f6 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -1756,8 +1756,8 @@
(define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
[(set (match_operand:VF 0 "register_operand" "=x,v")
(plusminus:VF
- (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
- (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
+ (match_operand:VF 1 "<bcst_round_nimm_predicate>" "<comm>0,v")
+ (match_operand:VF 2 "<bcst_round_nimm_predicate>" "xBm,<bcst_round_constraint>")))]
"TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
&& <mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
@@ -1765,35 +1765,7 @@
v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
[(set_attr "isa" "noavx,avx")
(set_attr "type" "sseadd")
- (set_attr "prefix" "<mask_prefix3>")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*sub<mode>3<mask_name>_bcst"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (minus:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "v")
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
- "TARGET_AVX512F
- && ix86_binary_operator_ok (MINUS, <MODE>mode, operands)
- && <mask_mode512bit_condition>"
- "vsub<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<avx512bcst>}"
- [(set_attr "prefix" "evex")
- (set_attr "type" "sseadd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*add<mode>3<mask_name>_bcst"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (plus:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
- (match_operand:VF_AVX512 2 "register_operand" "v")))]
- "TARGET_AVX512F
- && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)
- && <mask_mode512bit_condition>"
- "vadd<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
- [(set_attr "prefix" "evex")
- (set_attr "type" "sseadd")
+ (set_attr "prefix" "<bcst_mask_prefix3>")
(set_attr "mode" "<MODE>")])
;; Standard scalar operation patterns which preserve the rest of the
@@ -1846,32 +1818,19 @@
(define_insn "*mul<mode>3<mask_name><round_name>"
[(set (match_operand:VF 0 "register_operand" "=x,v")
(mult:VF
- (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
- (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
- "TARGET_SSE
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))
+ (match_operand:VF 1 "<bcst_round_nimm_predicate>" "%0,v")
+ (match_operand:VF 2 "<bcst_round_nimm_predicate>" "xBm,<bcst_round_constraint>")))]
+ "TARGET_SSE && ix86_binary_operator_ok (MULT, <MODE>mode, operands)
&& <mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
mul<ssemodesuffix>\t{%2, %0|%0, %2}
vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
[(set_attr "isa" "noavx,avx")
(set_attr "type" "ssemul")
- (set_attr "prefix" "<mask_prefix3>")
+ (set_attr "prefix" "<bcst_mask_prefix3>")
(set_attr "btver2_decode" "direct,double")
(set_attr "mode" "<MODE>")])
-(define_insn "*mul<mode>3<mask_name>_bcst"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (mult:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
- (match_operand:VF_AVX512 2 "register_operand" "v")))]
- "TARGET_AVX512F && <mask_mode512bit_condition>"
- "vmul<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
- [(set_attr "prefix" "evex")
- (set_attr "type" "ssemul")
- (set_attr "mode" "<MODE>")])
-
;; Standard scalar operation patterns which preserve the rest of the
;; vector for combiner.
(define_insn "*<sse>_vm<multdiv_mnemonic><mode>3"
@@ -1943,26 +1902,14 @@
[(set (match_operand:VF 0 "register_operand" "=x,v")
(div:VF
(match_operand:VF 1 "register_operand" "0,v")
- (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
+ (match_operand:VF 2 "<bcst_round_nimm_predicate>" "xBm,<bcst_round_constraint>")))]
"TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
div<ssemodesuffix>\t{%2, %0|%0, %2}
vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
[(set_attr "isa" "noavx,avx")
(set_attr "type" "ssediv")
- (set_attr "prefix" "<mask_prefix3>")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<avx512>_div<mode>3<mask_name>_bcst"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (div:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "v")
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
- "TARGET_AVX512F && <mask_mode512bit_condition>"
- "vdiv<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<avx512bcst>}"
- [(set_attr "prefix" "evex")
- (set_attr "type" "ssediv")
+ (set_attr "prefix" "<bcst_mask_prefix3>")
(set_attr "mode" "<MODE>")])
(define_insn "<sse>_rcp<mode>2"
@@ -2861,30 +2808,30 @@
DONE;
})
-(define_insn "<mask_codefor>reducep<mode><mask_name>"
+(define_insn "<mask_codefor>reducep<mode><mask_name><round_saeonly_name>"
[(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
(unspec:VF_AVX512VL
- [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
+ [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
(match_operand:SI 2 "const_0_to_255_operand")]
UNSPEC_REDUCE))]
"TARGET_AVX512DQ"
- "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
+ "vreduce<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
[(set_attr "type" "sse")
(set_attr "prefix" "evex")
(set_attr "mode" "<MODE>")])
-(define_insn "reduces<mode><mask_scalar_name>"
+(define_insn "reduces<mode><mask_scalar_name><round_saeonly_scalar_name>"
[(set (match_operand:VF_128 0 "register_operand" "=v")
(vec_merge:VF_128
(unspec:VF_128
[(match_operand:VF_128 1 "register_operand" "v")
- (match_operand:VF_128 2 "nonimmediate_operand" "vm")
+ (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
(match_operand:SI 3 "const_0_to_255_operand")]
UNSPEC_REDUCE)
(match_dup 1)
(const_int 1)))]
"TARGET_AVX512DQ"
- "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2, %3}"
+ "vreduce<ssescalarmodesuffix>\t{%3, <round_saeonly_scalar_mask_op4>%2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2<round_saeonly_scalar_mask_op4>, %3}"
[(set_attr "type" "sse")
(set_attr "prefix" "evex")
(set_attr "mode" "<MODE>")])
@@ -4055,9 +4002,9 @@
(define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
[(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
(fma:VF_SF_AVX512VL
- (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
- (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
- (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
+ (match_operand:VF_SF_AVX512VL 1 "<bcst_round_nimm_predicate>" "%0,0,v")
+ (match_operand:VF_SF_AVX512VL 2 "<bcst_round_nimm_predicate>" "<bcst_round_constraint>,v,<bcst_round_constraint>")
+ (match_operand:VF_SF_AVX512VL 3 "<bcst_round_nimm_predicate>" "v,<bcst_round_constraint>,0")))]
"TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
@@ -4066,46 +4013,6 @@
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
-(define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (fma:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "%0")
- (match_operand:VF_AVX512 2 "register_operand" "v")
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 3 "memory_operand" "m"))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "vfmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_2"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 1 "memory_operand" "m,m"))
- (match_operand:VF_AVX512 2 "register_operand" "0,v")
- (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfmadd132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
- vfmadd231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_3"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "0,v")
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
- (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfmadd132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
- vfmadd231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
(define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
[(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
(vec_merge:VF_AVX512VL
@@ -4171,10 +4078,10 @@
(define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
[(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
(fma:VF_SF_AVX512VL
- (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
- (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
+ (match_operand:VF_SF_AVX512VL 1 "<bcst_round_nimm_predicate>" "%0,0,v")
+ (match_operand:VF_SF_AVX512VL 2 "<bcst_round_nimm_predicate>" "<bcst_round_constraint>,v,<bcst_round_constraint>")
(neg:VF_SF_AVX512VL
- (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
+ (match_operand:VF_SF_AVX512VL 3 "<bcst_round_nimm_predicate>" "v,<bcst_round_constraint>,0"))))]
"TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
@@ -4183,49 +4090,6 @@
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
-(define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (fma:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "%0")
- (match_operand:VF_AVX512 2 "register_operand" "v")
- (neg:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 3 "memory_operand" "m")))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "vfmsub213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_2"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 1 "memory_operand" "m,m"))
- (match_operand:VF_AVX512 2 "register_operand" "0,v")
- (neg:VF_AVX512
- (match_operand:VF_AVX512 3 "register_operand" "v,0"))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfmsub132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
- vfmsub231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_3"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "0,v")
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
- (neg:VF_AVX512
- (match_operand:VF_AVX512 3 "nonimmediate_operand" "v,0"))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfmsub132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
- vfmsub231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
(define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
[(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
(vec_merge:VF_AVX512VL
@@ -4294,9 +4158,9 @@
[(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
(fma:VF_SF_AVX512VL
(neg:VF_SF_AVX512VL
- (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
- (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
- (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
+ (match_operand:VF_SF_AVX512VL 1 "<bcst_round_nimm_predicate>" "%0,0,v"))
+ (match_operand:VF_SF_AVX512VL 2 "<bcst_round_nimm_predicate>" "<bcst_round_constraint>,v,<bcst_round_constraint>")
+ (match_operand:VF_SF_AVX512VL 3 "<bcst_round_nimm_predicate>" "v,<bcst_round_constraint>,0")))]
"TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
@@ -4305,49 +4169,6 @@
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
-(define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (fma:VF_AVX512
- (neg:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "%0"))
- (match_operand:VF_AVX512 2 "register_operand" "v")
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 3 "memory_operand" "m"))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "vfnmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_2"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (neg:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 1 "memory_operand" "m,m")))
- (match_operand:VF_AVX512 2 "register_operand" "0,v")
- (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfnmadd132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
- vfnmadd231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_3"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (neg:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "0,v"))
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
- (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfnmadd132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
- vfnmadd231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
(define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
[(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
(vec_merge:VF_AVX512VL
@@ -4417,10 +4238,10 @@
[(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
(fma:VF_SF_AVX512VL
(neg:VF_SF_AVX512VL
- (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
- (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
+ (match_operand:VF_SF_AVX512VL 1 "<bcst_round_nimm_predicate>" "%0,0,v"))
+ (match_operand:VF_SF_AVX512VL 2 "<bcst_round_nimm_predicate>" "<bcst_round_constraint>,v,<bcst_round_constraint>")
(neg:VF_SF_AVX512VL
- (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
+ (match_operand:VF_SF_AVX512VL 3 "<bcst_round_nimm_predicate>" "v,<bcst_round_constraint>,0"))))]
"TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
"@
vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
@@ -4429,52 +4250,6 @@
[(set_attr "type" "ssemuladd")
(set_attr "mode" "<MODE>")])
-(define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
- (fma:VF_AVX512
- (neg:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "%0"))
- (match_operand:VF_AVX512 2 "register_operand" "v")
- (neg:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 3 "memory_operand" "m")))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "vfnmsub213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_2"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (neg:VF_AVX512
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 1 "memory_operand" "m,m")))
- (match_operand:VF_AVX512 2 "register_operand" "0,v")
- (neg:VF_AVX512
- (match_operand:VF_AVX512 3 "register_operand" "v,0"))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfnmsub132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
- vfnmsub231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
-(define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_3"
- [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
- (fma:VF_AVX512
- (neg:VF_AVX512
- (match_operand:VF_AVX512 1 "register_operand" "0,v"))
- (vec_duplicate:VF_AVX512
- (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
- (neg:VF_AVX512
- (match_operand:VF_AVX512 3 "register_operand" "v,0"))))]
- "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
- "@
- vfnmsub132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
- vfnmsub231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
- [(set_attr "type" "ssemuladd")
- (set_attr "mode" "<MODE>")])
-
(define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
[(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
(vec_merge:VF_AVX512VL
@@ -6374,7 +6149,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "sse2_cvtsd2ss<round_name>"
+(define_insn "sse2_cvtsd2ss<mask_name><round_name>"
[(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
(vec_merge:V4SF
(vec_duplicate:V4SF
@@ -6386,7 +6161,7 @@
"@
cvtsd2ss\t{%2, %0|%0, %2}
cvtsd2ss\t{%2, %0|%0, %q2}
- vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
+ vcvtsd2ss\t{<round_mask_op3>%2, %1, %0<mask_operand3>|<mask_operand3>%0, %1, %q2<round_mask_op3>}"
[(set_attr "isa" "noavx,noavx,avx")
(set_attr "type" "ssecvt")
(set_attr "athlon_decode" "vector,double,*")
@@ -6417,7 +6192,7 @@
(set_attr "prefix" "orig,orig,vex")
(set_attr "mode" "SF")])
-(define_insn "sse2_cvtss2sd<round_saeonly_name>"
+(define_insn "sse2_cvtss2sd<mask_name><round_saeonly_name>"
[(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
(vec_merge:V2DF
(float_extend:V2DF
@@ -6430,7 +6205,7 @@
"@
cvtss2sd\t{%2, %0|%0, %2}
cvtss2sd\t{%2, %0|%0, %k2}
- vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
+ vcvtss2sd\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|<mask_operand3>%0, %1, %k2<round_saeonly_mask_op3>}"
[(set_attr "isa" "noavx,noavx,avx")
(set_attr "type" "ssecvt")
(set_attr "amdfam10_decode" "vector,double,*")
@@ -11563,8 +11338,8 @@
(define_insn "*<plusminus_insn><mode>3"
[(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
(plusminus:VI_AVX2
- (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
- (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
+ (match_operand:VI_AVX2 1 "bcst_vector_operand" "<comm>0,v")
+ (match_operand:VI_AVX2 2 "bcst_vector_operand" "xBm,vmBr")))]
"TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
"@
p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
@@ -11572,31 +11347,7 @@
[(set_attr "isa" "noavx,avx")
(set_attr "type" "sseiadd")
(set_attr "prefix_data16" "1,*")
- (set_attr "prefix" "orig,vex")
- (set_attr "mode" "<sseinsnmode>")])
-
-(define_insn "*sub<mode>3_bcst"
- [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
- (minus:VI48_AVX512VL
- (match_operand:VI48_AVX512VL 1 "register_operand" "v")
- (vec_duplicate:VI48_AVX512VL
- (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
- "TARGET_AVX512F && ix86_binary_operator_ok (MINUS, <MODE>mode, operands)"
- "vpsub<ssemodesuffix>\t{%2<avx512bcst>, %1, %0|%0, %1, %2<avx512bcst>}"
- [(set_attr "type" "sseiadd")
- (set_attr "prefix" "evex")
- (set_attr "mode" "<sseinsnmode>")])
-
-(define_insn "*add<mode>3_bcst"
- [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
- (plus:VI48_AVX512VL
- (vec_duplicate:VI48_AVX512VL
- (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
- (match_operand:VI48_AVX512VL 2 "register_operand" "v")))]
- "TARGET_AVX512F && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
- "vpadd<ssemodesuffix>\t{%1<avx512bcst>, %2, %0|%0, %2, %1<avx512bcst>}"
- [(set_attr "type" "sseiadd")
- (set_attr "prefix" "evex")
+ (set_attr "prefix" "orig,maybe_evex")
(set_attr "mode" "<sseinsnmode>")])
(define_insn "*<plusminus_insn><mode>3_mask"
@@ -12110,24 +11861,13 @@
(set_attr "mode" "TI")])
(define_insn "avx512dq_mul<mode>3<mask_name>"
- [(set (match_operand:VI8 0 "register_operand" "=v")
- (mult:VI8
- (match_operand:VI8 1 "register_operand" "v")
- (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
- "TARGET_AVX512DQ && <mask_mode512bit_condition>"
- "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
- [(set_attr "type" "sseimul")
- (set_attr "prefix" "evex")
- (set_attr "mode" "<sseinsnmode>")])
-
-(define_insn "*avx512dq_mul<mode>3<mask_name>_bcst"
[(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
(mult:VI8_AVX512VL
- (vec_duplicate:VI8_AVX512VL
- (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
- (match_operand:VI8_AVX512VL 2 "register_operand" "v")))]
- "TARGET_AVX512DQ"
- "vpmullq\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
+ (match_operand:VI8_AVX512VL 1 "bcst_vector_operand" "%v")
+ (match_operand:VI8_AVX512VL 2 "bcst_vector_operand" "vmBr")))]
+ "TARGET_AVX512DQ && <mask_mode512bit_condition>
+ && ix86_binary_operator_ok (MULT, <MODE>mode, operands)"
+ "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
[(set_attr "type" "sseimul")
(set_attr "prefix" "evex")
(set_attr "mode" "<sseinsnmode>")])
@@ -12157,10 +11897,10 @@
(define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
[(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
(mult:VI4_AVX512F
- (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
- (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
- "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
- && <mask_mode512bit_condition>"
+ (match_operand:VI4_AVX512F 1 "bcst_vector_operand" "%0,0,v")
+ (match_operand:VI4_AVX512F 2 "bcst_vector_operand" "YrBm,*xBm,vmBr")))]
+ "TARGET_SSE4_1 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)
+ && <mask_mode512bit_condition>"
"@
pmulld\t{%2, %0|%0, %2}
pmulld\t{%2, %0|%0, %2}
@@ -12168,22 +11908,10 @@
[(set_attr "isa" "noavx,noavx,avx")
(set_attr "type" "sseimul")
(set_attr "prefix_extra" "1")
- (set_attr "prefix" "<mask_prefix4>")
+ (set_attr "prefix" "<bcst_mask_prefix4>")
(set_attr "btver2_decode" "vector,vector,vector")
(set_attr "mode" "<sseinsnmode>")])
-(define_insn "*avx512f_mul<mode>3<mask_name>_bcst"
- [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
- (mult:VI4_AVX512VL
- (vec_duplicate:VI4_AVX512VL
- (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
- (match_operand:VI4_AVX512VL 2 "register_operand" "v")))]
- "TARGET_AVX512F"
- "vpmulld\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
- [(set_attr "type" "sseimul")
- (set_attr "prefix" "evex")
- (set_attr "mode" "<sseinsnmode>")])
-
(define_expand "mul<mode>3"
[(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
(mult:VI8_AVX2_AVX512F
@@ -13210,7 +12938,7 @@
[(set (match_operand:VI 0 "register_operand" "=x,x,v")
(and:VI
(not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
- (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
+ (match_operand:VI 2 "bcst_vector_operand" "xBm,xm,vmBr")))]
"TARGET_SSE"
{
char buf[64];
@@ -13309,19 +13037,6 @@
]
(const_string "<sseinsnmode>")))])
-(define_insn "*andnot<mode>3_bcst"
- [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
- (and:VI48_AVX512VL
- (not:VI48_AVX512VL
- (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
- (vec_duplicate:VI48_AVX512VL
- (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
- "TARGET_AVX512F"
- "vpandn<ssemodesuffix>\t{%2<avx512bcst>, %1, %0|%0, %1, %2<avx512bcst>}"
- [(set_attr "type" "sselog")
- (set_attr "prefix" "evex")
- (set_attr "mode" "<sseinsnmode>")])
-
(define_insn "*andnot<mode>3_mask"
[(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
(vec_merge:VI48_AVX512VL
@@ -13351,10 +13066,10 @@
(define_insn "<mask_codefor><code><mode>3<mask_name>"
[(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
(any_logic:VI48_AVX_AVX512F
- (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
- (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
+ (match_operand:VI48_AVX_AVX512F 1 "bcst_vector_operand" "%0,x,v")
+ (match_operand:VI48_AVX_AVX512F 2 "bcst_vector_operand" "xBm,xm,vmBr")))]
"TARGET_SSE && <mask_mode512bit_condition>
- && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
+ && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
{
char buf[64];
const char *ops;
@@ -13540,18 +13255,6 @@
]
(const_string "<sseinsnmode>")))])
-(define_insn "*<code><mode>3_bcst"
- [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
- (any_logic:VI48_AVX512VL
- (vec_duplicate:VI48_AVX512VL
- (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
- (match_operand:VI48_AVX512VL 2 "register_operand" "v")))]
- "TARGET_AVX512F && <mask_avx512vl_condition>"
- "vp<logic><ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
- [(set_attr "type" "sseiadd")
- (set_attr "prefix" "evex")
- (set_attr "mode" "<sseinsnmode>")])
-
(define_mode_iterator VI1248_AVX512VLBW
[(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX512VL && TARGET_AVX512BW")
(V16QI "TARGET_AVX512VL && TARGET_AVX512BW")
@@ -19092,7 +18795,7 @@
(set_attr "type" "sse")
(set_attr "mode" "<MODE>")])
-(define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
+(define_insn "avx512er_vmrcp28<mode><mask_name><round_saeonly_name>"
[(set (match_operand:VF_128 0 "register_operand" "=v")
(vec_merge:VF_128
(unspec:VF_128
@@ -19101,7 +18804,7 @@
(match_operand:VF_128 2 "register_operand" "v")
(const_int 1)))]
"TARGET_AVX512ER"
- "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
+ "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_mask_op3>%1, %2, %0<mask_operand3>|<mask_opernad3>%0, %2, %<iptr>1<round_saeonly_mask_op3>}"
[(set_attr "length_immediate" "1")
(set_attr "prefix" "evex")
(set_attr "type" "sse")
@@ -19118,7 +18821,7 @@
(set_attr "type" "sse")
(set_attr "mode" "<MODE>")])
-(define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
+(define_insn "avx512er_vmrsqrt28<mode><mask_name><round_saeonly_name>"
[(set (match_operand:VF_128 0 "register_operand" "=v")
(vec_merge:VF_128
(unspec:VF_128
@@ -19127,7 +18830,7 @@
(match_operand:VF_128 2 "register_operand" "v")
(const_int 1)))]
"TARGET_AVX512ER"
- "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
+ "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_mask_op3>%1, %2, %0<mask_operand3>|<mask_operand3>%0, %2, %<iptr>1<round_saeonly_mask_op3>}"
[(set_attr "length_immediate" "1")
(set_attr "type" "sse")
(set_attr "prefix" "evex")
diff --git a/gcc/config/i386/subst.md b/gcc/config/i386/subst.md
index 58ea9dc..e037a96 100644
--- a/gcc/config/i386/subst.md
+++ b/gcc/config/i386/subst.md
@@ -60,7 +60,9 @@
(define_subst_attr "mask_prefix" "mask" "vex" "evex")
(define_subst_attr "mask_prefix2" "mask" "maybe_vex" "evex")
(define_subst_attr "mask_prefix3" "mask" "orig,vex" "evex,evex")
+(define_subst_attr "bcst_mask_prefix3" "mask" "orig,maybe_evex" "evex,evex")
(define_subst_attr "mask_prefix4" "mask" "orig,orig,vex" "evex,evex,evex")
+(define_subst_attr "bcst_mask_prefix4" "mask" "orig,orig,maybe_evex" "evex,evex,evex")
(define_subst_attr "mask_expand_op3" "mask" "3" "5")
(define_subst "mask"
@@ -130,9 +132,11 @@
(define_subst_attr "round_mask_op4" "round" "" "<round_mask_operand4>")
(define_subst_attr "round_sd_mask_op4" "round" "" "<round_sd_mask_operand4>")
(define_subst_attr "round_constraint" "round" "vm" "v")
+(define_subst_attr "bcst_round_constraint" "round" "vmBr" "v")
(define_subst_attr "round_constraint2" "round" "m" "v")
(define_subst_attr "round_constraint3" "round" "rm" "r")
(define_subst_attr "round_nimm_predicate" "round" "vector_operand" "register_operand")
+(define_subst_attr "bcst_round_nimm_predicate" "round" "bcst_vector_operand" "register_operand")
(define_subst_attr "round_nimm_scalar_predicate" "round" "nonimmediate_operand" "register_operand")
(define_subst_attr "round_prefix" "round" "vex" "evex")
(define_subst_attr "round_mode512bit_condition" "round" "1" "(<MODE>mode == V16SFmode
diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index 5134e08..e5fb061 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -17,7 +17,8 @@
# <http://www.gnu.org/licenses/>.
OPTIONS_H_EXTRA += $(srcdir)/config/i386/stringop.def
-TM_H += $(srcdir)/config/i386/x86-tune.def
+TM_H += $(srcdir)/config/i386/x86-tune.def \
+ $(srcdir)/common/config/i386/i386-cpuinfo.h
PASSES_EXTRA += $(srcdir)/config/i386/i386-passes.def
i386-c.o: $(srcdir)/config/i386/i386-c.c
diff --git a/gcc/config/i386/t-rtems b/gcc/config/i386/t-rtems
index 7626970..5f078c6 100644
--- a/gcc/config/i386/t-rtems
+++ b/gcc/config/i386/t-rtems
@@ -17,10 +17,10 @@
# <http://www.gnu.org/licenses/>.
#
-MULTILIB_OPTIONS = mtune=i486/mtune=pentium/mtune=pentiumpro msoft-float
+MULTILIB_OPTIONS = march=i486/march=pentium/march=pentiumpro msoft-float
MULTILIB_DIRNAMES= m486 mpentium mpentiumpro soft-float
MULTILIB_MATCHES = msoft-float=mno-80387
-MULTILIB_MATCHES += mtune?pentium=mtune?k6 mtune?pentiumpro=mtune?athlon
+MULTILIB_MATCHES += march?pentium=march?k6 march?pentiumpro=march?athlon
MULTILIB_EXCEPTIONS = \
-mtune=pentium/*msoft-float* \
-mtune=pentiumpro/*msoft-float*
+march=pentium/*msoft-float* \
+march=pentiumpro/*msoft-float*
diff --git a/gcc/config/i386/tbmintrin.h b/gcc/config/i386/tbmintrin.h
index c8a9d77..e03bf91 100644
--- a/gcc/config/i386/tbmintrin.h
+++ b/gcc/config/i386/tbmintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _X86INTRIN_H_INCLUDED
-# error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <tbmintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _TBMINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/tsxldtrkintrin.h b/gcc/config/i386/tsxldtrkintrin.h
index 08b76a9..eab36d0 100644
--- a/gcc/config/i386/tsxldtrkintrin.h
+++ b/gcc/config/i386/tsxldtrkintrin.h
@@ -1,5 +1,28 @@
-#if !defined _IMMINTRIN_H_INCLUDED
-#error "Never use <tsxldtrkintrin.h> directly; include <immintrin.h> instead."
+/* Copyright (C) 2020 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 _X86GPRINTRIN_H_INCLUDED
+# error "Never use <tsxldtrkintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _TSXLDTRKINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/uintrintrin.h b/gcc/config/i386/uintrintrin.h
new file mode 100644
index 0000000..991f642
--- /dev/null
+++ b/gcc/config/i386/uintrintrin.h
@@ -0,0 +1,87 @@
+/* Copyright (C) 2020 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 _X86GPRINTRIN_H_INCLUDED
+# error "Never use <uintrintrin.h> directly; include <x86gprintrin.h> instead."
+#endif
+
+#ifndef _UINTRNTRIN_H_INCLUDED
+#define _UINTRNTRIN_H_INCLUDED
+
+#ifdef __x86_64__
+
+#ifndef __UINTR__
+#pragma GCC push_options
+#pragma GCC target ("uintr")
+#define __DISABLE_UINTR__
+#endif /* __UINTR__ */
+
+struct __uintr_frame
+{
+ /* The position of the most significant bit set in user-interrupt
+ request register. */
+ unsigned long long uirrv;
+ /* RIP of the interrupted user process. */
+ unsigned long long rip;
+ /* RFLAGS of the interrupted user process. */
+ unsigned long long rflags;
+ /* RSP of the interrupted user process. */
+ unsigned long long rsp;
+};
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_clui (void)
+{
+ __builtin_ia32_clui ();
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_stui (void)
+{
+ __builtin_ia32_stui ();
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_senduipi (unsigned long long __R)
+{
+ __builtin_ia32_senduipi (__R);
+}
+
+extern __inline unsigned char
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_testui (void)
+{
+ return __builtin_ia32_testui ();
+}
+
+#ifdef __DISABLE_UINTR__
+#undef __DISABLE_UINTR__
+#pragma GCC pop_options
+#endif /* __DISABLE_UINTR__ */
+
+#endif
+
+#endif /* _UINTRNTRIN_H_INCLUDED. */
diff --git a/gcc/config/i386/waitpkgintrin.h b/gcc/config/i386/waitpkgintrin.h
index 5dbcde3..5046c98 100644
--- a/gcc/config/i386/waitpkgintrin.h
+++ b/gcc/config/i386/waitpkgintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <waitpkgintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <waitpkgintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _WAITPKG_H_INCLUDED
diff --git a/gcc/config/i386/wbnoinvdintrin.h b/gcc/config/i386/wbnoinvdintrin.h
index 5393698..7089e61 100644
--- a/gcc/config/i386/wbnoinvdintrin.h
+++ b/gcc/config/i386/wbnoinvdintrin.h
@@ -1,5 +1,28 @@
-#ifndef _IMMINTRIN_H_INCLUDED
-#error "Never use <wbnoinvdintrin.h> directly; include <immintrin.h> instead."
+/* Copyright (C) 2018-2020 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 _X86GPRINTRIN_H_INCLUDED
+# error "Never use <wbnoinvdintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _WBNOINVDINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/x86gprintrin.h b/gcc/config/i386/x86gprintrin.h
new file mode 100644
index 0000000..ffe07e4
--- /dev/null
+++ b/gcc/config/i386/x86gprintrin.h
@@ -0,0 +1,256 @@
+/* Copyright (C) 2020 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 _X86GPRINTRIN_H_INCLUDED
+#define _X86GPRINTRIN_H_INCLUDED
+
+#include <ia32intrin.h>
+
+#ifndef __iamcu__
+
+#include <stddef.h>
+
+#include <adxintrin.h>
+
+#include <bmiintrin.h>
+
+#include <bmi2intrin.h>
+
+#include <cetintrin.h>
+
+#include <cldemoteintrin.h>
+
+#include <clflushoptintrin.h>
+
+#include <clwbintrin.h>
+
+#include <clzerointrin.h>
+
+#include <enqcmdintrin.h>
+
+#include <fxsrintrin.h>
+
+#include <lzcntintrin.h>
+
+#include <lwpintrin.h>
+
+#include <movdirintrin.h>
+
+#include <mwaitxintrin.h>
+
+#include <pconfigintrin.h>
+
+#include <popcntintrin.h>
+
+#include <pkuintrin.h>
+
+#include <rdseedintrin.h>
+
+#include <rtmintrin.h>
+
+#include <serializeintrin.h>
+
+#include <sgxintrin.h>
+
+#include <tbmintrin.h>
+
+#include <tsxldtrkintrin.h>
+
+#include <uintrintrin.h>
+
+#include <waitpkgintrin.h>
+
+#include <wbnoinvdintrin.h>
+
+#include <xsaveintrin.h>
+
+#include <xsavecintrin.h>
+
+#include <xsaveoptintrin.h>
+
+#include <xsavesintrin.h>
+
+#include <xtestintrin.h>
+
+#include <hresetintrin.h>
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_wbinvd (void)
+{
+ __builtin_ia32_wbinvd ();
+}
+
+#ifndef __RDRND__
+#pragma GCC push_options
+#pragma GCC target("rdrnd")
+#define __DISABLE_RDRND__
+#endif /* __RDRND__ */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_rdrand16_step (unsigned short *__P)
+{
+ return __builtin_ia32_rdrand16_step (__P);
+}
+
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_rdrand32_step (unsigned int *__P)
+{
+ return __builtin_ia32_rdrand32_step (__P);
+}
+#ifdef __DISABLE_RDRND__
+#undef __DISABLE_RDRND__
+#pragma GCC pop_options
+#endif /* __DISABLE_RDRND__ */
+
+#ifndef __RDPID__
+#pragma GCC push_options
+#pragma GCC target("rdpid")
+#define __DISABLE_RDPID__
+#endif /* __RDPID__ */
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_rdpid_u32 (void)
+{
+ return __builtin_ia32_rdpid ();
+}
+#ifdef __DISABLE_RDPID__
+#undef __DISABLE_RDPID__
+#pragma GCC pop_options
+#endif /* __DISABLE_RDPID__ */
+
+#ifdef __x86_64__
+
+#ifndef __FSGSBASE__
+#pragma GCC push_options
+#pragma GCC target("fsgsbase")
+#define __DISABLE_FSGSBASE__
+#endif /* __FSGSBASE__ */
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_readfsbase_u32 (void)
+{
+ return __builtin_ia32_rdfsbase32 ();
+}
+
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_readfsbase_u64 (void)
+{
+ return __builtin_ia32_rdfsbase64 ();
+}
+
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_readgsbase_u32 (void)
+{
+ return __builtin_ia32_rdgsbase32 ();
+}
+
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_readgsbase_u64 (void)
+{
+ return __builtin_ia32_rdgsbase64 ();
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_writefsbase_u32 (unsigned int __B)
+{
+ __builtin_ia32_wrfsbase32 (__B);
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_writefsbase_u64 (unsigned long long __B)
+{
+ __builtin_ia32_wrfsbase64 (__B);
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_writegsbase_u32 (unsigned int __B)
+{
+ __builtin_ia32_wrgsbase32 (__B);
+}
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_writegsbase_u64 (unsigned long long __B)
+{
+ __builtin_ia32_wrgsbase64 (__B);
+}
+#ifdef __DISABLE_FSGSBASE__
+#undef __DISABLE_FSGSBASE__
+#pragma GCC pop_options
+#endif /* __DISABLE_FSGSBASE__ */
+
+#ifndef __RDRND__
+#pragma GCC push_options
+#pragma GCC target("rdrnd")
+#define __DISABLE_RDRND__
+#endif /* __RDRND__ */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_rdrand64_step (unsigned long long *__P)
+{
+ return __builtin_ia32_rdrand64_step (__P);
+}
+#ifdef __DISABLE_RDRND__
+#undef __DISABLE_RDRND__
+#pragma GCC pop_options
+#endif /* __DISABLE_RDRND__ */
+
+#endif /* __x86_64__ */
+
+#ifndef __PTWRITE__
+#pragma GCC push_options
+#pragma GCC target("ptwrite")
+#define __DISABLE_PTWRITE__
+#endif
+
+#ifdef __x86_64__
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_ptwrite64 (unsigned long long __B)
+{
+ __builtin_ia32_ptwrite64 (__B);
+}
+#endif /* __x86_64__ */
+
+extern __inline void
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_ptwrite32 (unsigned __B)
+{
+ __builtin_ia32_ptwrite32 (__B);
+}
+#ifdef __DISABLE_PTWRITE__
+#undef __DISABLE_PTWRITE__
+#pragma GCC pop_options
+#endif /* __DISABLE_PTWRITE__ */
+
+#endif /* __iamcu__ */
+
+#endif /* _X86GPRINTRIN_H_INCLUDED. */
diff --git a/gcc/config/i386/x86intrin.h b/gcc/config/i386/x86intrin.h
index 59fdceb..bc6cb40 100644
--- a/gcc/config/i386/x86intrin.h
+++ b/gcc/config/i386/x86intrin.h
@@ -24,7 +24,7 @@
#ifndef _X86INTRIN_H_INCLUDED
#define _X86INTRIN_H_INCLUDED
-#include <ia32intrin.h>
+#include <x86gprintrin.h>
#ifndef __iamcu__
@@ -37,16 +37,6 @@
#include <xopintrin.h>
-#include <lwpintrin.h>
-
-#include <tbmintrin.h>
-
-#include <popcntintrin.h>
-
-#include <mwaitxintrin.h>
-
-#include <clzerointrin.h>
-
#endif /* __iamcu__ */
#endif /* _X86INTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/xsavecintrin.h b/gcc/config/i386/xsavecintrin.h
index 039e215..06c9f36 100644
--- a/gcc/config/i386/xsavecintrin.h
+++ b/gcc/config/i386/xsavecintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <xsavecintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <xsavecintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _XSAVECINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/xsaveintrin.h b/gcc/config/i386/xsaveintrin.h
index 9f0b8bb..f9cac0d 100644
--- a/gcc/config/i386/xsaveintrin.h
+++ b/gcc/config/i386/xsaveintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <xsaveintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <xsaveintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _XSAVEINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/xsaveoptintrin.h b/gcc/config/i386/xsaveoptintrin.h
index 9da3297..4f2756b 100644
--- a/gcc/config/i386/xsaveoptintrin.h
+++ b/gcc/config/i386/xsaveoptintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <xsaveoptintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <xsaveoptintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _XSAVEOPTINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/xsavesintrin.h b/gcc/config/i386/xsavesintrin.h
index 264f1c4..629a1f3 100644
--- a/gcc/config/i386/xsavesintrin.h
+++ b/gcc/config/i386/xsavesintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#if !defined _IMMINTRIN_H_INCLUDED
-# error "Never use <xsavesintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <xsavesintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _XSAVESINTRIN_H_INCLUDED
diff --git a/gcc/config/i386/xtestintrin.h b/gcc/config/i386/xtestintrin.h
index cb187e4..757cc34 100644
--- a/gcc/config/i386/xtestintrin.h
+++ b/gcc/config/i386/xtestintrin.h
@@ -21,8 +21,8 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _IMMINTRIN_H_INCLUDED
-# error "Never use <xtestintrin.h> directly; include <immintrin.h> instead."
+#ifndef _X86GPRINTRIN_H_INCLUDED
+# error "Never use <xtestintrin.h> directly; include <x86gprintrin.h> instead."
#endif
#ifndef _XTESTINTRIN_H_INCLUDED
diff --git a/gcc/config/linux-protos.h b/gcc/config/linux-protos.h
index 3759187..c52778b 100644
--- a/gcc/config/linux-protos.h
+++ b/gcc/config/linux-protos.h
@@ -19,4 +19,4 @@ along with GCC; see the file COPYING3. If not see
extern bool linux_has_ifunc_p (void);
-extern bool linux_libc_has_function (enum function_class fn_class);
+extern bool linux_libc_has_function (enum function_class fn_class, tree);
diff --git a/gcc/config/linux.c b/gcc/config/linux.c
index 9876153..83ffff4 100644
--- a/gcc/config/linux.c
+++ b/gcc/config/linux.c
@@ -25,7 +25,8 @@ along with GCC; see the file COPYING3. If not see
#include "linux-protos.h"
bool
-linux_libc_has_function (enum function_class fn_class)
+linux_libc_has_function (enum function_class fn_class,
+ tree type ATTRIBUTE_UNUSED)
{
if (OPTION_GLIBC || OPTION_MUSL)
return true;
diff --git a/gcc/config/msp430/msp430.md b/gcc/config/msp430/msp430.md
index f70e61b..ad244bb 100644
--- a/gcc/config/msp430/msp430.md
+++ b/gcc/config/msp430/msp430.md
@@ -1346,12 +1346,12 @@
;; instructions, so we provide a pattern to support it here.
(define_insn "andneghi3"
[(set (match_operand:HI 0 "register_operand" "=r")
- (and:HI (neg:HI (match_operand:HI 1 "register_operand" "r"))
+ (and:HI (neg:HI (match_operand:HI 1 "general_operand" "rm"))
(match_operand 2 "immediate_operand" "n")))]
""
"*
if (REGNO (operands[0]) != REGNO (operands[1]))
- return \"MOV.W\t%1, %0 { INV.W\t%0 { INC.W\t%0 { AND.W\t%2, %0\";
+ return \"MOV%X1.W\t%1, %0 { INV.W\t%0 { INC.W\t%0 { AND.W\t%2, %0\";
else
return \"INV.W\t%0 { INC.W\t%0 { AND.W\t%2, %0\";
"
diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c
index 4fecb2b..a3c4099 100644
--- a/gcc/config/nvptx/mkoffload.c
+++ b/gcc/config/nvptx/mkoffload.c
@@ -399,7 +399,8 @@ compile_native (const char *infile, const char *outfile, const char *compiler,
obstack_ptr_grow (&argv_obstack, NULL);
const char **new_argv = XOBFINISH (&argv_obstack, const char **);
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ ".gccnative_args");
obstack_free (&argv_obstack, NULL);
}
@@ -582,7 +583,8 @@ main (int argc, char **argv)
unsetenv ("COMPILER_PATH");
unsetenv ("LIBRARY_PATH");
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ ".gcc_args");
obstack_free (&argv_obstack, NULL);
xputenv (concat ("GCC_EXEC_PREFIX=", execpath, NULL));
@@ -594,6 +596,7 @@ main (int argc, char **argv)
fatal_error (input_location, "cannot open intermediate ptx file");
process (in, out);
+ fclose (in);
}
fclose (out);
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 0c590d8..1734947 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -368,6 +368,22 @@ nvptx_name_replacement (const char *name)
return name;
}
+/* Return NULL if NAME contains no dot. Otherwise return a copy of NAME
+ with the dots replaced with dollar signs. */
+
+static char *
+nvptx_replace_dot (const char *name)
+{
+ if (strchr (name, '.') == NULL)
+ return NULL;
+
+ char *p = xstrdup (name);
+ for (size_t i = 0; i < strlen (p); ++i)
+ if (p[i] == '.')
+ p[i] = '$';
+ return p;
+}
+
/* If MODE should be treated as two registers of an inner mode, return
that inner mode. Otherwise return VOIDmode. */
@@ -827,26 +843,12 @@ write_var_marker (FILE *file, bool is_defn, bool globalize, const char *name)
fputs ("\n", file);
}
-/* Write a .func or .kernel declaration or definition along with
- a helper comment for use by ld. S is the stream to write to, DECL
- the decl for the function with name NAME. For definitions, emit
- a declaration too. */
+/* Helper function for write_fn_proto. */
-static const char *
-write_fn_proto (std::stringstream &s, bool is_defn,
- const char *name, const_tree decl)
+static void
+write_fn_proto_1 (std::stringstream &s, bool is_defn,
+ const char *name, const_tree decl)
{
- if (is_defn)
- /* Emit a declaration. The PTX assembler gets upset without it. */
- name = write_fn_proto (s, false, name, decl);
- else
- {
- /* Avoid repeating the name replacement. */
- name = nvptx_name_replacement (name);
- if (name[0] == '*')
- name++;
- }
-
write_fn_marker (s, is_defn, TREE_PUBLIC (decl), name);
/* PTX declaration. */
@@ -929,8 +931,38 @@ write_fn_proto (std::stringstream &s, bool is_defn,
s << ")";
s << (is_defn ? "\n" : ";\n");
+}
- return name;
+/* Write a .func or .kernel declaration or definition along with
+ a helper comment for use by ld. S is the stream to write to, DECL
+ the decl for the function with name NAME. For definitions, emit
+ a declaration too. */
+
+static void
+write_fn_proto (std::stringstream &s, bool is_defn,
+ const char *name, const_tree decl)
+{
+ const char *replacement = nvptx_name_replacement (name);
+ char *replaced_dots = NULL;
+ if (replacement != name)
+ name = replacement;
+ else
+ {
+ replaced_dots = nvptx_replace_dot (name);
+ if (replaced_dots)
+ name = replaced_dots;
+ }
+ if (name[0] == '*')
+ name++;
+
+ if (is_defn)
+ /* Emit a declaration. The PTX assembler gets upset without it. */
+ write_fn_proto_1 (s, false, name, decl);
+
+ write_fn_proto_1 (s, is_defn, name, decl);
+
+ if (replaced_dots)
+ XDELETE (replaced_dots);
}
/* Construct a function declaration from a call insn. This can be
@@ -942,6 +974,8 @@ static void
write_fn_proto_from_insn (std::stringstream &s, const char *name,
rtx result, rtx pat)
{
+ char *replaced_dots = NULL;
+
if (!name)
{
s << "\t.callprototype ";
@@ -949,7 +983,15 @@ write_fn_proto_from_insn (std::stringstream &s, const char *name,
}
else
{
- name = nvptx_name_replacement (name);
+ const char *replacement = nvptx_name_replacement (name);
+ if (replacement != name)
+ name = replacement;
+ else
+ {
+ replaced_dots = nvptx_replace_dot (name);
+ if (replaced_dots)
+ name = replaced_dots;
+ }
write_fn_marker (s, false, true, name);
s << "\t.extern .func ";
}
@@ -958,6 +1000,8 @@ write_fn_proto_from_insn (std::stringstream &s, const char *name,
write_return_mode (s, true, GET_MODE (result));
s << name;
+ if (replaced_dots)
+ XDELETE (replaced_dots);
int arg_end = XVECLEN (pat, 0);
for (int i = 1; i < arg_end; i++)
@@ -2101,7 +2145,7 @@ nvptx_assemble_integer (rtx x, unsigned int size, int ARG_UNUSED (aligned_p))
val = INTVAL (XEXP (x, 1));
x = XEXP (x, 0);
gcc_assert (GET_CODE (x) == SYMBOL_REF);
- /* FALLTHROUGH */
+ gcc_fallthrough (); /* FALLTHROUGH */
case SYMBOL_REF:
gcc_assert (size == init_frag.size);
@@ -2349,6 +2393,7 @@ const char *
nvptx_output_mov_insn (rtx dst, rtx src)
{
machine_mode dst_mode = GET_MODE (dst);
+ machine_mode src_mode = GET_MODE (src);
machine_mode dst_inner = (GET_CODE (dst) == SUBREG
? GET_MODE (XEXP (dst, 0)) : dst_mode);
machine_mode src_inner = (GET_CODE (src) == SUBREG
@@ -2375,7 +2420,7 @@ nvptx_output_mov_insn (rtx dst, rtx src)
if (GET_MODE_SIZE (dst_inner) == GET_MODE_SIZE (src_inner))
{
if (GET_MODE_BITSIZE (dst_mode) == 128
- && GET_MODE_BITSIZE (GET_MODE (src)) == 128)
+ && GET_MODE_BITSIZE (src_mode) == 128)
{
/* mov.b128 is not supported. */
if (dst_inner == V2DImode && src_inner == TImode)
@@ -2388,6 +2433,10 @@ nvptx_output_mov_insn (rtx dst, rtx src)
return "%.\tmov.b%T0\t%0, %1;";
}
+ if (GET_MODE_BITSIZE (src_inner) == 128
+ && GET_MODE_BITSIZE (src_mode) == 64)
+ return "%.\tmov.b%T0\t%0, %1;";
+
return "%.\tcvt%t0%t1\t%0, %1;";
}
@@ -2458,9 +2507,20 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee)
if (decl)
{
+ char *replaced_dots = NULL;
const char *name = get_fnname_from_decl (decl);
- name = nvptx_name_replacement (name);
+ const char *replacement = nvptx_name_replacement (name);
+ if (replacement != name)
+ name = replacement;
+ else
+ {
+ replaced_dots = nvptx_replace_dot (name);
+ if (replaced_dots)
+ name = replaced_dots;
+ }
assemble_name (asm_out_file, name);
+ if (replaced_dots)
+ XDELETE (replaced_dots);
}
else
output_address (VOIDmode, callee);
@@ -2598,7 +2658,7 @@ nvptx_print_operand (FILE *file, rtx x, int code)
{
case 'A':
x = XEXP (x, 0);
- /* FALLTHROUGH. */
+ gcc_fallthrough (); /* FALLTHROUGH. */
case 'D':
if (GET_CODE (x) == CONST)
@@ -6531,6 +6591,23 @@ nvptx_set_current_function (tree fndecl)
oacc_bcast_partition = 0;
}
+/* Implement TARGET_LIBC_HAS_FUNCTION. */
+
+bool
+nvptx_libc_has_function (enum function_class fn_class, tree type)
+{
+ if (fn_class == function_sincos)
+ {
+ if (type != NULL_TREE)
+ /* Currently, newlib does not support sincosl. */
+ return type == float_type_node || type == double_type_node;
+ else
+ return true;
+ }
+
+ return default_libc_has_function (fn_class, type);
+}
+
#undef TARGET_OPTION_OVERRIDE
#define TARGET_OPTION_OVERRIDE nvptx_option_override
@@ -6676,6 +6753,9 @@ nvptx_set_current_function (tree fndecl)
#undef TARGET_SET_CURRENT_FUNCTION
#define TARGET_SET_CURRENT_FUNCTION nvptx_set_current_function
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION nvptx_libc_has_function
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-nvptx.h"
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 6ebcc76..17fe157 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -29,7 +29,10 @@
#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"
-#define ASM_SPEC "%{misa=*:-m %*}"
+/* Default needs to be in sync with default for misa in nvptx.opt.
+ We add a default here to work around a hard-coded sm_30 default in
+ nvptx-as. */
+#define ASM_SPEC "%{misa=*:-m %*; :-m sm_35}"
#define TARGET_CPU_CPP_BUILTINS() \
do \
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index 6178e6a..ccbcd09 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -146,6 +146,13 @@
return true;
})
+;; Test for a function symbol ref operand
+(define_predicate "symbol_ref_function_operand"
+ (match_code "symbol_ref")
+{
+ return SYMBOL_REF_FUNCTION_P (op);
+})
+
(define_attr "predicable" "false,true"
(const_string "true"))
@@ -241,6 +248,17 @@
}
[(set_attr "subregs_ok" "true")])
+;; ptxas segfaults on 'mov.u64 %r24,bar+4096', so break it up.
+(define_split
+ [(set (match_operand:DI 0 "nvptx_register_operand")
+ (const:DI (plus:DI (match_operand:DI 1 "symbol_ref_function_operand")
+ (match_operand 2 "const_int_operand"))))]
+ ""
+ [(set (match_dup 0) (match_dup 1))
+ (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))
+ ]
+ "")
+
(define_insn "*mov<mode>_insn"
[(set (match_operand:SDFM 0 "nonimmediate_operand" "=R,R,m")
(match_operand:SDFM 1 "general_operand" "RF,m,R"))]
@@ -365,9 +383,13 @@
[(set (match_operand:QHIM 0 "nvptx_nonimmediate_operand" "=R,m")
(truncate:QHIM (match_operand:SI 1 "nvptx_register_operand" "R,R")))]
""
- "@
- %.\\tcvt%t0.u32\\t%0, %1;
- %.\\tst%A0.u%T0\\t%0, %1;"
+ {
+ if (which_alternative == 1)
+ return "%.\\tst%A0.u%T0\\t%0, %1;";
+ if (GET_MODE (operands[0]) == QImode)
+ return "%.\\tmov%t0\\t%0, %1;";
+ return "%.\\tcvt%t0.u32\\t%0, %1;";
+ }
[(set_attr "subregs_ok" "true")])
(define_insn "truncdi<mode>2"
diff --git a/gcc/config/nvptx/nvptx.opt b/gcc/config/nvptx/nvptx.opt
index 75c3d54..045e354 100644
--- a/gcc/config/nvptx/nvptx.opt
+++ b/gcc/config/nvptx/nvptx.opt
@@ -17,9 +17,11 @@
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
-m32
-Target Report RejectNegative InverseMask(ABI64)
-Generate code for a 32-bit ABI.
+; It's not clear whether this was ever build/tested/used, so this is no longer
+; exposed to the user.
+;m32
+;Target Report RejectNegative InverseMask(ABI64)
+;Generate code for a 32-bit ABI.
m64
Target Report RejectNegative Mask(ABI64)
@@ -37,7 +39,7 @@ msoft-stack
Target Report Mask(SOFT_STACK)
Use custom stacks instead of local memory for automatic storage.
-msoft-stack-reserve-local
+msoft-stack-reserve-local=
Target Report Joined RejectNegative UInteger Var(nvptx_softstack_size) Init(128)
Specify size of .local memory used for stack when the exact amount is not known.
@@ -59,6 +61,7 @@ Enum(ptx_isa) String(sm_30) Value(PTX_ISA_SM30)
EnumValue
Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)
+; Default needs to be in sync with default in ASM_SPEC in nvptx.h.
misa=
-Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM30)
+Target RejectNegative ToLower Joined Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM35)
Specify the version of the ptx ISA to use.
diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h
index 794bf8e..2820720 100644
--- a/gcc/config/pa/pa-hpux11.h
+++ b/gcc/config/pa/pa-hpux11.h
@@ -154,11 +154,6 @@ along with GCC; see the file COPYING3. If not see
%{!mt:%{!pthread:-a shared -lc -a archive}}}}\
%{shared:%{mt|pthread:-lpthread}}"
-/* The libgcc_stub.a library needs to come last. */
-#undef LINK_GCC_C_SEQUENCE_SPEC
-#define LINK_GCC_C_SEQUENCE_SPEC \
- "%G %{!nolibc:%L} %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}}}"
-
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
"%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \
diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h
index f271bbf..970722a 100644
--- a/gcc/config/pa/pa32-linux.h
+++ b/gcc/config/pa/pa32-linux.h
@@ -57,6 +57,11 @@ call_ ## FUNC (void) \
}
#endif
+/* We need to link against libgcc.a for __canonicalize_funcptr_for_compare
+ and $$dyncall. */
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC "libgcc.a%s"
+
#undef WCHAR_TYPE
#define WCHAR_TYPE "long int"
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index c7d127f7..096aa4b 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -103,12 +103,6 @@ along with GCC; see the file COPYING3. If not see
%{shared:%{mt|pthread:-lpthread}}"
#endif
-/* The libgcc_stub.a and milli.a libraries need to come last. */
-#undef LINK_GCC_C_SEQUENCE_SPEC
-#define LINK_GCC_C_SEQUENCE_SPEC "\
- %G %{!nolibc:%L} %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}\
- milli.a%s}}"
-
/* Under hpux11, the normal location of the `ld' and `as' programs is the
/usr/ccs/bin directory. */
@@ -335,8 +329,12 @@ do { \
%{static:crtbeginT%O%s} %{!static:%{!shared:crtbegin%O%s} \
%{shared:crtbeginS%O%s}}"
#endif
+
+/* The libgcc_stub.a and milli.a libraries must come last. We need
+ to link with these libraries whenever start files are needed. */
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+#define ENDFILE_SPEC \
+ "%{!shared:crtend%O%s libgcc_stub.a%s} %{shared:crtendS%O%s} milli.a%s"
/* Since HP uses the .init and .fini sections for array initializers
and finalizers, we need different defines for INIT_SECTION_ASM_OP
diff --git a/gcc/config/riscv/multilib-generator b/gcc/config/riscv/multilib-generator
index 8f4df18..57ee7c3 100755
--- a/gcc/config/riscv/multilib-generator
+++ b/gcc/config/riscv/multilib-generator
@@ -22,14 +22,26 @@
# Each argument to this script is of the form
# <primary arch>-<abi>-<additional arches>-<extensions>
-# For example,
+# Example 1:
# rv32imafd-ilp32d-rv32g-c,v
# means that, in addition to rv32imafd, these configurations can also use the
# rv32imafd-ilp32d libraries: rv32imafdc, rv32imafdv, rv32g, rv32gc, rv32gv
+#
+# Example 2:
+# rv32imafd-ilp32d--c*b
+# means that, in addition to rv32imafd, these configurations can also use the
+# rv32imafd-ilp32d libraries: rv32imafdc-ilp32d, rv32imafdb-ilp32d,
+# rv32imafdcb-ilp32d
from __future__ import print_function
import sys
import collections
+import itertools
+from functools import reduce
+
+#
+# TODO: Add test for this script.
+#
arches = collections.OrderedDict()
abis = collections.OrderedDict()
@@ -37,37 +49,53 @@ required = []
reuse = []
canonical_order = "mafdgqlcbjtpvn"
+LONG_EXT_PREFIXES = ['z', 's', 'h', 'x']
+
+#
+# IMPLIED_EXT(ext) -> implied extension list.
+#
+IMPLIED_EXT = {
+ "d" : ["f"],
+}
def arch_canonicalize(arch):
- # TODO: Support implied extensions, e.g. D implied F in latest spec.
# TODO: Support extension version.
new_arch = ""
if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']:
- # TODO: We should expand g to imadzifencei once we support newer spec.
+ # TODO: We should expand g to imad_zifencei once we support newer spec.
new_arch = arch[:5].replace("g", "imafd")
else:
raise Exception("Unexpected arch: `%s`" % arch[:5])
# Find any Z, S, H or X
- long_ext_prefixes = ['z', 's', 'h', 'x']
- long_ext_prefixes_idx = map(lambda x: arch.find(x), long_ext_prefixes)
+ long_ext_prefixes_idx = map(lambda x: arch.find(x), LONG_EXT_PREFIXES)
# Filter out any non-existent index.
long_ext_prefixes_idx = list(filter(lambda x: x != -1, long_ext_prefixes_idx))
if long_ext_prefixes_idx:
first_long_ext_idx = min(long_ext_prefixes_idx)
long_exts = arch[first_long_ext_idx:].split("_")
- std_exts = arch[5:first_long_ext_idx]
+ std_exts = list(arch[5:first_long_ext_idx])
else:
long_exts = []
- std_exts = arch[5:]
+ std_exts = list(arch[5:])
+
+ #
+ # Handle implied extensions.
+ #
+ for ext in std_exts + long_exts:
+ if ext in IMPLIED_EXT:
+ implied_exts = IMPLIED_EXT[ext]
+ for implied_ext in implied_exts:
+ if implied_ext not in std_exts + long_exts:
+ long_exts.append(implied_ext)
# Single letter extension might appear in the long_exts list,
# becasue we just append extensions list to the arch string.
- std_exts += "".join(filter(lambda x:len(x) == 1, long_exts))
+ std_exts += list(filter(lambda x:len(x) == 1, long_exts))
# Multi-letter extension must be in lexicographic order.
- long_exts = sorted(filter(lambda x:len(x) != 1, long_exts))
+ long_exts = list(sorted(filter(lambda x:len(x) != 1, long_exts)))
# Put extensions in canonical order.
for ext in canonical_order:
@@ -86,15 +114,98 @@ def arch_canonicalize(arch):
new_arch += "_" + "_".join(long_exts)
return new_arch
+#
+# add underline for each multi-char extensions.
+# e.g. ["a", "zfh"] -> ["a", "_zfh"]
+#
+def add_underline_prefix(ext):
+ for long_ext_prefix in LONG_EXT_PREFIXES:
+ if ext.startswith(long_ext_prefix):
+ return "_" + ext
+
+ return ext
+
+#
+# Handle expansion operation.
+#
+# e.g. "a*b" -> [("a",), ("b",), ("a", "b")]
+# "a" -> [("a",)]
+#
+def _expand_combination(ext):
+ exts = list(ext.split("*"))
+
+ # No need to expand if there is no `*`.
+ if len(exts) == 1:
+ return [(exts[0],)]
+
+ # Add underline to every extension.
+ # e.g.
+ # _b * zvamo => _b * _zvamo
+ exts = list(map(lambda x: '_' + x, exts))
+
+ # Generate combination!
+ ext_combs = []
+ for comb_len in range(1, len(exts)+1):
+ for ext_comb in itertools.combinations(exts, comb_len):
+ ext_combs.append(ext_comb)
+
+ return ext_combs
+
+#
+# Input a list and drop duplicated entry.
+# e.g.
+# ["a", "b", "ab", "a"] -> ["a", "b", "ab"]
+#
+def unique(x):
+ #
+ # Drop duplicated entry.
+ # Convert list to set and then convert back to list.
+ #
+ # Add sorted to prevent non-deterministic results in different env.
+ #
+ return list(sorted(list(set(x))))
+
+#
+# Expand EXT string if there is any expansion operator (*).
+# e.g.
+# "a*b,c" -> ["a", "b", "ab", "c"]
+#
+def expand_combination(ext):
+ ext = list(filter(None, ext.split(',')))
+
+ # Expand combination for EXT, got lots of list.
+ # e.g.
+ # a * b => [[("a",), ("b",)], [("a", "b")]]
+ ext_combs = list(map(_expand_combination, ext))
+
+ # Then fold to single list.
+ # e.g.
+ # [[("a",), ("b",)], [("a", "b")]] => [("a",), ("b",), ("a", "b")]
+ ext = list(reduce(lambda x, y: x + y, ext_combs, []))
+
+ # Fold the tuple to string.
+ # e.g.
+ # [("a",), ("b",), ("a", "b")] => ["a", "b", "ab"]
+ ext = map(lambda e : reduce(lambda x, y: x + y, e), ext)
+
+ # Drop duplicated entry.
+ ext = unique(ext)
+
+ return ext
+
for cfg in sys.argv[1:]:
(arch, abi, extra, ext) = cfg.split('-')
arch = arch_canonicalize (arch)
arches[arch] = 1
abis[abi] = 1
extra = list(filter(None, extra.split(',')))
- ext = list(filter(None, ext.split(',')))
- alts = sum([[x] + [x + "_" + y for y in ext] for x in [arch] + extra], [])
+ ext_combs = expand_combination(ext)
+ alts = sum([[x] + [x + y for y in ext_combs] for x in [arch] + extra], [])
alts = list(map(arch_canonicalize, alts))
+
+ # Drop duplicated entry.
+ alts = unique(alts)
+
for alt in alts[1:]:
arches[alt] = 1
reuse.append('march.%s/mabi.%s=march.%s/mabi.%s' % (arch, abi, alt, abi))
diff --git a/gcc/config/riscv/riscv-c.c b/gcc/config/riscv/riscv-c.c
index 735f2f2..c600badb 100644
--- a/gcc/config/riscv/riscv-c.c
+++ b/gcc/config/riscv/riscv-c.c
@@ -90,12 +90,15 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("__riscv_cmodel_medlow");
break;
+ case CM_PIC:
+ /* __riscv_cmodel_pic is deprecated, and will removed in next GCC release.
+ see https://github.com/riscv/riscv-c-api-doc/pull/11 */
+ builtin_define ("__riscv_cmodel_pic");
+ /* FALLTHROUGH. */
+
case CM_MEDANY:
builtin_define ("__riscv_cmodel_medany");
break;
- case CM_PIC:
- builtin_define ("__riscv_cmodel_pic");
- break;
}
}
diff --git a/gcc/config/riscv/riscv-cores.def b/gcc/config/riscv/riscv-cores.def
new file mode 100644
index 0000000..6a13f3e
--- /dev/null
+++ b/gcc/config/riscv/riscv-cores.def
@@ -0,0 +1,49 @@
+/* List of supported core and tune info for RISC-V.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* This is a list of cores that implement RISC-V.
+
+ Before using #include to read this file, define a macro:
+
+ RISCV_CORE(CORE_NAME, ARCH, MICRO_ARCH, TUNE_INFO)
+
+ The CORE_NAME is the name of the core, represented as a string.
+ The ARCH is the default arch of the core, represented as a string,
+ can be NULL if no default arch.
+ The MICRO_ARCH is the name of the core for which scheduling decisions
+ will be made, represented as an identifier.
+ The TUNE_INFO is the detail cost model for this core, represented as an
+ identifier, reference to riscv-tunes.def. */
+
+RISCV_CORE("sifive-e20", "rv32imc", "rocket")
+RISCV_CORE("sifive-e21", "rv32imac", "rocket")
+RISCV_CORE("sifive-e24", "rv32imafc", "rocket")
+RISCV_CORE("sifive-e31", "rv32imac", "sifive-3-series")
+RISCV_CORE("sifive-e34", "rv32imafc", "sifive-3-series")
+RISCV_CORE("sifive-e76", "rv32imafc", "sifive-7-series")
+
+RISCV_CORE("sifive-s21", "rv64imac", "rocket")
+RISCV_CORE("sifive-s51", "rv64imac", "sifive-5-series")
+RISCV_CORE("sifive-s54", "rv64imafdc", "sifive-5-series")
+RISCV_CORE("sifive-s76", "rv64imafdc", "sifive-7-series")
+
+RISCV_CORE("sifive-u54", "rv64imafdc", "sifive-5-series")
+RISCV_CORE("sifive-u74", "rv64imafdc", "sifive-7-series")
+
+#undef RISCV_CORE
diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h
index 358224a..256dab1 100644
--- a/gcc/config/riscv/riscv-protos.h
+++ b/gcc/config/riscv/riscv-protos.h
@@ -94,4 +94,18 @@ extern bool riscv_hard_regno_rename_ok (unsigned, unsigned);
rtl_opt_pass * make_pass_shorten_memrefs (gcc::context *ctxt);
+/* Information about one CPU we know about. */
+struct riscv_cpu_info {
+ /* This CPU's canonical name. */
+ const char *name;
+
+ /* Default arch for this CPU, could be NULL if no default arch. */
+ const char *arch;
+
+ /* Which automaton to use for tuning. */
+ const char *tune;
+};
+
+extern const riscv_cpu_info *riscv_find_cpu (const char *);
+
#endif /* ! GCC_RISCV_PROTOS_H */
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index 63b0c38..989a9f1 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -209,7 +209,7 @@ struct riscv_integer_op {
/* Costs of various operations on the different architectures. */
-struct riscv_tune_info
+struct riscv_tune_param
{
unsigned short fp_add[2];
unsigned short fp_mul[2];
@@ -222,16 +222,16 @@ struct riscv_tune_info
bool slow_unaligned_access;
};
-/* Information about one CPU we know about. */
-struct riscv_cpu_info {
- /* This CPU's canonical name. */
+/* Information about one micro-arch we know about. */
+struct riscv_tune_info {
+ /* This micro-arch canonical name. */
const char *name;
/* Which automaton to use for tuning. */
enum riscv_microarchitecture_type microarchitecture;
- /* Tuning parameters for this CPU. */
- const struct riscv_tune_info *tune_info;
+ /* Tuning parameters for this micro-arch. */
+ const struct riscv_tune_param *tune_param;
};
/* Global variables for machine-dependent things. */
@@ -248,7 +248,7 @@ unsigned riscv_stack_boundary;
static int epilogue_cfa_sp_offset;
/* Which tuning parameters to use. */
-static const struct riscv_tune_info *tune_info;
+static const struct riscv_tune_param *tune_param;
/* Which automaton to use for tuning. */
enum riscv_microarchitecture_type riscv_microarchitecture;
@@ -275,7 +275,7 @@ const enum reg_class riscv_regno_to_class[FIRST_PSEUDO_REGISTER] = {
};
/* Costs to use when optimizing for rocket. */
-static const struct riscv_tune_info rocket_tune_info = {
+static const struct riscv_tune_param rocket_tune_info = {
{COSTS_N_INSNS (4), COSTS_N_INSNS (5)}, /* fp_add */
{COSTS_N_INSNS (4), COSTS_N_INSNS (5)}, /* fp_mul */
{COSTS_N_INSNS (20), COSTS_N_INSNS (20)}, /* fp_div */
@@ -288,7 +288,7 @@ static const struct riscv_tune_info rocket_tune_info = {
};
/* Costs to use when optimizing for Sifive 7 Series. */
-static const struct riscv_tune_info sifive_7_tune_info = {
+static const struct riscv_tune_param sifive_7_tune_info = {
{COSTS_N_INSNS (4), COSTS_N_INSNS (5)}, /* fp_add */
{COSTS_N_INSNS (4), COSTS_N_INSNS (5)}, /* fp_mul */
{COSTS_N_INSNS (20), COSTS_N_INSNS (20)}, /* fp_div */
@@ -301,7 +301,7 @@ static const struct riscv_tune_info sifive_7_tune_info = {
};
/* Costs to use when optimizing for size. */
-static const struct riscv_tune_info optimize_size_tune_info = {
+static const struct riscv_tune_param optimize_size_tune_info = {
{COSTS_N_INSNS (1), COSTS_N_INSNS (1)}, /* fp_add */
{COSTS_N_INSNS (1), COSTS_N_INSNS (1)}, /* fp_mul */
{COSTS_N_INSNS (1), COSTS_N_INSNS (1)}, /* fp_div */
@@ -343,7 +343,7 @@ static const unsigned gpr_save_reg_order[] = {
};
/* A table describing all the processors GCC knows about. */
-static const struct riscv_cpu_info riscv_cpu_info_table[] = {
+static const struct riscv_tune_info riscv_tune_info_table[] = {
{ "rocket", generic, &rocket_tune_info },
{ "sifive-3-series", generic, &rocket_tune_info },
{ "sifive-5-series", generic, &rocket_tune_info },
@@ -351,17 +351,22 @@ static const struct riscv_cpu_info riscv_cpu_info_table[] = {
{ "size", generic, &optimize_size_tune_info },
};
-/* Return the riscv_cpu_info entry for the given name string. */
+/* Return the riscv_tune_info entry for the given name string. */
-static const struct riscv_cpu_info *
-riscv_parse_cpu (const char *cpu_string)
+static const struct riscv_tune_info *
+riscv_parse_tune (const char *tune_string)
{
- for (unsigned i = 0; i < ARRAY_SIZE (riscv_cpu_info_table); i++)
- if (strcmp (riscv_cpu_info_table[i].name, cpu_string) == 0)
- return riscv_cpu_info_table + i;
+ const riscv_cpu_info *cpu = riscv_find_cpu (tune_string);
- error ("unknown cpu %qs for %<-mtune%>", cpu_string);
- return riscv_cpu_info_table;
+ if (cpu)
+ tune_string = cpu->tune;
+
+ for (unsigned i = 0; i < ARRAY_SIZE (riscv_tune_info_table); i++)
+ if (strcmp (riscv_tune_info_table[i].name, tune_string) == 0)
+ return riscv_tune_info_table + i;
+
+ error ("unknown cpu %qs for %<-mtune%>", tune_string);
+ return riscv_tune_info_table;
}
/* Helper function for riscv_build_integer; arguments are as for
@@ -1703,7 +1708,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
instructions it needs. */
if ((cost = riscv_address_insns (XEXP (x, 0), mode, true)) > 0)
{
- *total = COSTS_N_INSNS (cost + tune_info->memory_cost);
+ *total = COSTS_N_INSNS (cost + tune_param->memory_cost);
return true;
}
/* Otherwise use the default handling. */
@@ -1770,7 +1775,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
mode instead. */
mode = GET_MODE (XEXP (x, 0));
if (float_mode_p)
- *total = tune_info->fp_add[mode == DFmode];
+ *total = tune_param->fp_add[mode == DFmode];
else
*total = riscv_binary_cost (x, 1, 3);
return false;
@@ -1779,19 +1784,19 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case ORDERED:
/* (FEQ(A, A) & FEQ(B, B)) compared against 0. */
mode = GET_MODE (XEXP (x, 0));
- *total = tune_info->fp_add[mode == DFmode] + COSTS_N_INSNS (2);
+ *total = tune_param->fp_add[mode == DFmode] + COSTS_N_INSNS (2);
return false;
case UNEQ:
/* (FEQ(A, A) & FEQ(B, B)) compared against FEQ(A, B). */
mode = GET_MODE (XEXP (x, 0));
- *total = tune_info->fp_add[mode == DFmode] + COSTS_N_INSNS (3);
+ *total = tune_param->fp_add[mode == DFmode] + COSTS_N_INSNS (3);
return false;
case LTGT:
/* (FLT(A, A) || FGT(B, B)). */
mode = GET_MODE (XEXP (x, 0));
- *total = tune_info->fp_add[mode == DFmode] + COSTS_N_INSNS (2);
+ *total = tune_param->fp_add[mode == DFmode] + COSTS_N_INSNS (2);
return false;
case UNGE:
@@ -1800,13 +1805,13 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case UNLT:
/* FLT or FLE, but guarded by an FFLAGS read and write. */
mode = GET_MODE (XEXP (x, 0));
- *total = tune_info->fp_add[mode == DFmode] + COSTS_N_INSNS (4);
+ *total = tune_param->fp_add[mode == DFmode] + COSTS_N_INSNS (4);
return false;
case MINUS:
case PLUS:
if (float_mode_p)
- *total = tune_info->fp_add[mode == DFmode];
+ *total = tune_param->fp_add[mode == DFmode];
else
*total = riscv_binary_cost (x, 1, 4);
return false;
@@ -1816,7 +1821,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
rtx op = XEXP (x, 0);
if (GET_CODE (op) == FMA && !HONOR_SIGNED_ZEROS (mode))
{
- *total = (tune_info->fp_mul[mode == DFmode]
+ *total = (tune_param->fp_mul[mode == DFmode]
+ set_src_cost (XEXP (op, 0), mode, speed)
+ set_src_cost (XEXP (op, 1), mode, speed)
+ set_src_cost (XEXP (op, 2), mode, speed));
@@ -1825,23 +1830,23 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
}
if (float_mode_p)
- *total = tune_info->fp_add[mode == DFmode];
+ *total = tune_param->fp_add[mode == DFmode];
else
*total = COSTS_N_INSNS (GET_MODE_SIZE (mode) > UNITS_PER_WORD ? 4 : 1);
return false;
case MULT:
if (float_mode_p)
- *total = tune_info->fp_mul[mode == DFmode];
+ *total = tune_param->fp_mul[mode == DFmode];
else if (!TARGET_MUL)
/* Estimate the cost of a library call. */
*total = COSTS_N_INSNS (speed ? 32 : 6);
else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
- *total = 3 * tune_info->int_mul[0] + COSTS_N_INSNS (2);
+ *total = 3 * tune_param->int_mul[0] + COSTS_N_INSNS (2);
else if (!speed)
*total = COSTS_N_INSNS (1);
else
- *total = tune_info->int_mul[mode == DImode];
+ *total = tune_param->int_mul[mode == DImode];
return false;
case DIV:
@@ -1849,7 +1854,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case MOD:
if (float_mode_p)
{
- *total = tune_info->fp_div[mode == DFmode];
+ *total = tune_param->fp_div[mode == DFmode];
return false;
}
/* Fall through. */
@@ -1860,7 +1865,7 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
/* Estimate the cost of a library call. */
*total = COSTS_N_INSNS (speed ? 32 : 6);
else if (speed)
- *total = tune_info->int_div[mode == DImode];
+ *total = tune_param->int_div[mode == DImode];
else
*total = COSTS_N_INSNS (1);
return false;
@@ -1882,11 +1887,11 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN
case FIX:
case FLOAT_EXTEND:
case FLOAT_TRUNCATE:
- *total = tune_info->fp_add[mode == DFmode];
+ *total = tune_param->fp_add[mode == DFmode];
return false;
case FMA:
- *total = (tune_info->fp_mul[mode == DFmode]
+ *total = (tune_param->fp_mul[mode == DFmode]
+ set_src_cost (XEXP (x, 0), mode, speed)
+ set_src_cost (XEXP (x, 1), mode, speed)
+ set_src_cost (XEXP (x, 2), mode, speed));
@@ -4546,7 +4551,7 @@ riscv_class_max_nregs (reg_class_t rclass, machine_mode mode)
static int
riscv_memory_move_cost (machine_mode mode, reg_class_t rclass, bool in)
{
- return (tune_info->memory_cost
+ return (tune_param->memory_cost
+ memory_move_secondary_cost (mode, rclass, in));
}
@@ -4555,7 +4560,7 @@ riscv_memory_move_cost (machine_mode mode, reg_class_t rclass, bool in)
static int
riscv_issue_rate (void)
{
- return tune_info->issue_rate;
+ return tune_param->issue_rate;
}
/* Auxiliary function to emit RISC-V ELF attribute. */
@@ -4683,7 +4688,7 @@ riscv_init_machine_status (void)
static void
riscv_option_override (void)
{
- const struct riscv_cpu_info *cpu;
+ const struct riscv_tune_info *cpu;
#ifdef SUBTARGET_OVERRIDE_OPTIONS
SUBTARGET_OVERRIDE_OPTIONS;
@@ -4705,26 +4710,28 @@ riscv_option_override (void)
if (TARGET_HARD_FLOAT && (target_flags_explicit & MASK_FDIV) == 0)
target_flags |= MASK_FDIV;
- /* Handle -mtune. */
- cpu = riscv_parse_cpu (riscv_tune_string ? riscv_tune_string :
- RISCV_TUNE_STRING_DEFAULT);
+ /* Handle -mtune, use -mcpu if -mtune is not given, and use default -mtune
+ if -mtune and -mcpu both not not given. */
+ cpu = riscv_parse_tune (riscv_tune_string ? riscv_tune_string :
+ (riscv_cpu_string ? riscv_cpu_string :
+ RISCV_TUNE_STRING_DEFAULT));
riscv_microarchitecture = cpu->microarchitecture;
- tune_info = optimize_size ? &optimize_size_tune_info : cpu->tune_info;
+ tune_param = optimize_size ? &optimize_size_tune_info : cpu->tune_param;
/* Use -mtune's setting for slow_unaligned_access, even when optimizing
for size. For architectures that trap and emulate unaligned accesses,
the performance cost is too great, even for -Os. Similarly, if
-m[no-]strict-align is left unspecified, heed -mtune's advice. */
- riscv_slow_unaligned_access_p = (cpu->tune_info->slow_unaligned_access
+ riscv_slow_unaligned_access_p = (cpu->tune_param->slow_unaligned_access
|| TARGET_STRICT_ALIGN);
if ((target_flags_explicit & MASK_STRICT_ALIGN) == 0
- && cpu->tune_info->slow_unaligned_access)
+ && cpu->tune_param->slow_unaligned_access)
target_flags |= MASK_STRICT_ALIGN;
/* If the user hasn't specified a branch cost, use the processor's
default. */
if (riscv_branch_cost == 0)
- riscv_branch_cost = tune_info->branch_cost;
+ riscv_branch_cost = tune_param->branch_cost;
/* Function to allocate machine-dependent function status. */
init_machine_status = &riscv_init_machine_status;
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index b7b4a1c..172c7ca 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -41,17 +41,27 @@ along with GCC; see the file COPYING3. If not see
#endif
extern const char *riscv_expand_arch (int argc, const char **argv);
+extern const char *riscv_expand_arch_from_cpu (int argc, const char **argv);
+extern const char *riscv_default_mtune (int argc, const char **argv);
# define EXTRA_SPEC_FUNCTIONS \
- { "riscv_expand_arch", riscv_expand_arch },
+ { "riscv_expand_arch", riscv_expand_arch }, \
+ { "riscv_expand_arch_from_cpu", riscv_expand_arch_from_cpu }, \
+ { "riscv_default_mtune", riscv_default_mtune },
/* Support for a compile-time default CPU, et cetera. The rules are:
- --with-arch is ignored if -march is specified.
+ --with-arch is ignored if -march or -mcpu is specified.
--with-abi is ignored if -mabi is specified.
- --with-tune is ignored if -mtune is specified. */
+ --with-tune is ignored if -mtune or -mcpu is specified.
+
+ But using default -march/-mtune value if -mcpu don't have valid option. */
#define OPTION_DEFAULT_SPECS \
- {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
- {"arch", "%{!march=*:-march=%(VALUE)}" }, \
+ {"tune", "%{!mtune=*:" \
+ " %{!mcpu=*:-mtune=%(VALUE)}" \
+ " %{mcpu=*:-mtune=%:riscv_default_mtune(%* %(VALUE))}}" }, \
+ {"arch", "%{!march=*:" \
+ " %{!mcpu=*:-march=%(VALUE)}" \
+ " %{mcpu=*:%:riscv_expand_arch_from_cpu(%* %(VALUE))}}" }, \
{"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \
#ifdef IN_LIBGCC2
@@ -69,8 +79,9 @@ extern const char *riscv_expand_arch (int argc, const char **argv);
%(subtarget_asm_spec)"
#undef DRIVER_SELF_SPECS
-#define DRIVER_SELF_SPECS \
-"%{march=*:-march=%:riscv_expand_arch(%*)}"
+#define DRIVER_SELF_SPECS \
+"%{march=*:%:riscv_expand_arch(%*)} " \
+"%{!march=*:%{mcpu=*:%:riscv_expand_arch_from_cpu(%*)}} "
#define TARGET_DEFAULT_CMODEL CM_MEDLOW
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index f01d3ab..808b4a0 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -79,6 +79,10 @@ mtune=
Target RejectNegative Joined Var(riscv_tune_string)
-mtune=PROCESSOR Optimize the output for PROCESSOR.
+mcpu=
+Target RejectNegative Joined Var(riscv_cpu_string)
+-mcpu=PROCESSOR Use architecture of and optimize the output for PROCESSOR.
+
msmall-data-limit=
Target Joined Separate UInteger Var(g_switch_value) Init(8)
-msmall-data-limit=N Put global and static data smaller than <number> bytes into a special section (on some targets).
diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
index 4820fb3..702767c 100644
--- a/gcc/config/riscv/t-riscv
+++ b/gcc/config/riscv/t-riscv
@@ -24,3 +24,5 @@ riscv-shorten-memrefs.o: $(srcdir)/config/riscv/riscv-shorten-memrefs.c
$(POSTCOMPILE)
PASSES_EXTRA += $(srcdir)/config/riscv/riscv-passes.def
+
+$(common_out_file): $(srcdir)/config/riscv/riscv-cores.def
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index 8a2dcda..df10a8c 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -236,6 +236,9 @@
#define vec_lvebx __builtin_vec_lvebx
#define vec_lvehx __builtin_vec_lvehx
#define vec_lvewx __builtin_vec_lvewx
+#define vec_xl_zext __builtin_vec_ze_lxvrx
+#define vec_xl_sext __builtin_vec_se_lxvrx
+#define vec_xst_trunc __builtin_vec_tr_stxvrx
#define vec_neg __builtin_vec_neg
#define vec_pmsum_be __builtin_vec_vpmsum
#define vec_shasigma_be __builtin_crypto_vshasigma
diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h
index c991363..6984ca5 100644
--- a/gcc/config/rs6000/freebsd64.h
+++ b/gcc/config/rs6000/freebsd64.h
@@ -78,65 +78,7 @@ extern int dot_symbols;
#undef SUBSUBTARGET_OVERRIDE_OPTIONS
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
- do \
- { \
- if (!global_options_set.x_rs6000_alignment_flags) \
- rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
- if (TARGET_64BIT) \
- { \
- if (DEFAULT_ABI != ABI_AIX) \
- { \
- rs6000_current_abi = ABI_AIX; \
- error (INVALID_64BIT, "call"); \
- } \
- dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
- if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
- { \
- rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
- error (INVALID_64BIT, "relocatable"); \
- } \
- if (ELFv2_ABI_CHECK) \
- { \
- rs6000_current_abi = ABI_ELFv2; \
- if (dot_symbols) \
- error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>"); \
- } \
- if (rs6000_isa_flags & OPTION_MASK_EABI) \
- { \
- rs6000_isa_flags &= ~OPTION_MASK_EABI; \
- error (INVALID_64BIT, "eabi"); \
- } \
- if (TARGET_PROTOTYPE) \
- { \
- target_prototype = 0; \
- error (INVALID_64BIT, "prototype"); \
- } \
- if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
- { \
- rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
- error ("%<-m64%> requires a PowerPC64 cpu"); \
- } \
- if ((rs6000_isa_flags_explicit \
- & OPTION_MASK_MINIMAL_TOC) != 0) \
- { \
- if (global_options_set.x_rs6000_current_cmodel \
- && rs6000_current_cmodel != CMODEL_SMALL) \
- error ("%<-mcmodel%> incompatible with other toc options"); \
- SET_CMODEL (CMODEL_SMALL); \
- } \
- else \
- { \
- if (!global_options_set.x_rs6000_current_cmodel) \
- SET_CMODEL (CMODEL_MEDIUM); \
- if (rs6000_current_cmodel != CMODEL_SMALL) \
- { \
- TARGET_NO_FP_IN_TOC = 0; \
- TARGET_NO_SUM_IN_TOC = 0; \
- } \
- } \
- } \
- } \
- while (0)
+ do rs6000_linux64_override_options (); while (0)
#undef ASM_SPEC
#undef LINK_OS_FREEBSD_SPEC
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 2ded330..73b6c01 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -96,90 +96,7 @@ extern int dot_symbols;
#undef SUBSUBTARGET_OVERRIDE_OPTIONS
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
- do \
- { \
- if (!global_options_set.x_rs6000_alignment_flags) \
- rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
- if (rs6000_isa_flags & OPTION_MASK_64BIT) \
- { \
- if (DEFAULT_ABI != ABI_AIX) \
- { \
- rs6000_current_abi = ABI_AIX; \
- error (INVALID_64BIT, "call"); \
- } \
- dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
- if (ELFv2_ABI_CHECK) \
- { \
- rs6000_current_abi = ABI_ELFv2; \
- if (dot_symbols) \
- error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>"); \
- } \
- if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
- { \
- rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
- error (INVALID_64BIT, "relocatable"); \
- } \
- if (rs6000_isa_flags & OPTION_MASK_EABI) \
- { \
- rs6000_isa_flags &= ~OPTION_MASK_EABI; \
- error (INVALID_64BIT, "eabi"); \
- } \
- if (TARGET_PROTOTYPE) \
- { \
- target_prototype = 0; \
- error (INVALID_64BIT, "prototype"); \
- } \
- if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
- { \
- rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
- error ("%<-m64%> requires a PowerPC64 cpu"); \
- } \
- if ((rs6000_isa_flags_explicit \
- & OPTION_MASK_MINIMAL_TOC) != 0) \
- { \
- if (global_options_set.x_rs6000_current_cmodel \
- && rs6000_current_cmodel != CMODEL_SMALL) \
- error ("%<-mcmodel incompatible with other toc options%>"); \
- SET_CMODEL (CMODEL_SMALL); \
- } \
- else \
- { \
- if (!global_options_set.x_rs6000_current_cmodel) \
- SET_CMODEL (CMODEL_MEDIUM); \
- if (rs6000_current_cmodel != CMODEL_SMALL) \
- { \
- if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \
- TARGET_NO_FP_IN_TOC \
- = rs6000_current_cmodel == CMODEL_MEDIUM; \
- if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \
- TARGET_NO_SUM_IN_TOC = 0; \
- } \
- } \
- if (TARGET_PLTSEQ && DEFAULT_ABI != ABI_ELFv2) \
- { \
- if (global_options_set.x_rs6000_pltseq) \
- warning (0, "%qs unsupported for this ABI", \
- "-mpltseq"); \
- rs6000_pltseq = false; \
- } \
- } \
- else \
- { \
- if (!RS6000_BI_ARCH_P) \
- error (INVALID_32BIT, "32"); \
- if (TARGET_PROFILE_KERNEL) \
- { \
- TARGET_PROFILE_KERNEL = 0; \
- error (INVALID_32BIT, "profile-kernel"); \
- } \
- if (global_options_set.x_rs6000_current_cmodel) \
- { \
- SET_CMODEL (CMODEL_SMALL); \
- error (INVALID_32BIT, "cmodel"); \
- } \
- } \
- } \
- while (0)
+ do rs6000_linux64_override_options (); while (0)
#undef ASM_SPEC
#undef LINK_OS_LINUX_SPEC
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 48edc99..e0bce9c 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -262,6 +262,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef toc
#define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
+#ifdef __PCREL__
+#define JUMP_TARGET(name) GLUE(FUNC_NAME(name),@notoc)
+#define FUNC_START(name) \
+ .type FUNC_NAME(name),@function; \
+ .globl FUNC_NAME(name); \
+FUNC_NAME(name): \
+ .localentry FUNC_NAME(name),1
+#else
#define JUMP_TARGET(name) FUNC_NAME(name)
#define FUNC_START(name) \
.type FUNC_NAME(name),@function; \
@@ -270,6 +278,7 @@ FUNC_NAME(name): \
0: addis 2,12,(.TOC.-0b)@ha; \
addi 2,2,(.TOC.-0b)@l; \
.localentry FUNC_NAME(name),.-FUNC_NAME(name)
+#endif /* !__PCREL__ */
#define HIDDEN_FUNC(name) \
FUNC_START(name) \
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index e91a48d..5b05da8 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -1111,7 +1111,7 @@
| RS6000_BTC_UNARY), \
CODE_FOR_ ## ICODE) /* ICODE */
-#define BU_P10_MISC_2(ENUM, NAME, ATTR, ICODE) \
+#define BU_P10_POWERPC64_MISC_2(ENUM, NAME, ATTR, ICODE) \
RS6000_BUILTIN_2 (P10_BUILTIN_ ## ENUM, /* ENUM */ \
"__builtin_" NAME, /* NAME */ \
RS6000_BTM_P10 \
@@ -1145,6 +1145,14 @@
CODE_FOR_ ## ICODE) /* ICODE */
#endif
+#define BU_P10V_OVERLOAD_X(ENUM, NAME) \
+ RS6000_BUILTIN_X (P10_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
+ "__builtin_vec_" NAME, /* NAME */ \
+ RS6000_BTM_P10, /* MASK */ \
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
/* Power 10 Altivec builtins */
#define BU_P10V_AV_0(ENUM, NAME, ATTR, ICODE) \
@@ -1179,6 +1187,15 @@
| RS6000_BTC_TERNARY), \
CODE_FOR_ ## ICODE) /* ICODE */
+#define BU_P10V_AV_X(ENUM, NAME, ATTR) \
+ RS6000_BUILTIN_X (P10_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_altivec_" NAME, /* NAME */ \
+ RS6000_BTM_P10, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_SPECIAL), \
+ CODE_FOR_nothing) /* ICODE */
+
+
/* Insure 0 is not a legitimate index. */
BU_SPECIAL_X (RS6000_BUILTIN_NONE, NULL, 0, RS6000_BTC_MISC)
@@ -1474,6 +1491,18 @@ BU_ALTIVEC_X (LVSR, "lvsr", PURE)
BU_ALTIVEC_X (LVEBX, "lvebx", PURE)
BU_ALTIVEC_X (LVEHX, "lvehx", PURE)
BU_ALTIVEC_X (LVEWX, "lvewx", PURE)
+BU_P10V_AV_X (SE_LXVRBX, "se_lxvrbx", PURE)
+BU_P10V_AV_X (SE_LXVRHX, "se_lxvrhx", PURE)
+BU_P10V_AV_X (SE_LXVRWX, "se_lxvrwx", PURE)
+BU_P10V_AV_X (SE_LXVRDX, "se_lxvrdx", PURE)
+BU_P10V_AV_X (ZE_LXVRBX, "ze_lxvrbx", PURE)
+BU_P10V_AV_X (ZE_LXVRHX, "ze_lxvrhx", PURE)
+BU_P10V_AV_X (ZE_LXVRWX, "ze_lxvrwx", PURE)
+BU_P10V_AV_X (ZE_LXVRDX, "ze_lxvrdx", PURE)
+BU_P10V_AV_X (TR_STXVRBX, "tr_stxvrbx", MEM)
+BU_P10V_AV_X (TR_STXVRHX, "tr_stxvrhx", MEM)
+BU_P10V_AV_X (TR_STXVRWX, "tr_stxvrwx", MEM)
+BU_P10V_AV_X (TR_STXVRDX, "tr_stxvrdx", MEM)
BU_ALTIVEC_X (LVXL, "lvxl", PURE)
BU_ALTIVEC_X (LVXL_V2DF, "lvxl_v2df", PURE)
BU_ALTIVEC_X (LVXL_V2DI, "lvxl_v2di", PURE)
@@ -1740,6 +1769,9 @@ BU_ALTIVEC_OVERLOAD_X (LDL, "ldl")
BU_ALTIVEC_OVERLOAD_X (LVEBX, "lvebx")
BU_ALTIVEC_OVERLOAD_X (LVEHX, "lvehx")
BU_ALTIVEC_OVERLOAD_X (LVEWX, "lvewx")
+BU_P10V_OVERLOAD_X (SE_LXVRX, "se_lxvrx")
+BU_P10V_OVERLOAD_X (ZE_LXVRX, "ze_lxvrx")
+BU_P10V_OVERLOAD_X (TR_STXVRX, "tr_stxvrx")
BU_ALTIVEC_OVERLOAD_X (LVLX, "lvlx")
BU_ALTIVEC_OVERLOAD_X (LVLXL, "lvlxl")
BU_ALTIVEC_OVERLOAD_X (LVRX, "lvrx")
@@ -2727,11 +2759,11 @@ BU_P9_OVERLOAD_2 (CMPRB2, "byte_in_either_range")
BU_P9_OVERLOAD_2 (CMPEQB, "byte_in_set")
/* Builtins for scalar instructions added in ISA 3.1 (power10). */
-BU_P10_MISC_2 (CFUGED, "cfuged", CONST, cfuged)
-BU_P10_MISC_2 (CNTLZDM, "cntlzdm", CONST, cntlzdm)
-BU_P10_MISC_2 (CNTTZDM, "cnttzdm", CONST, cnttzdm)
-BU_P10_MISC_2 (PDEPD, "pdepd", CONST, pdepd)
-BU_P10_MISC_2 (PEXTD, "pextd", CONST, pextd)
+BU_P10_POWERPC64_MISC_2 (CFUGED, "cfuged", CONST, cfuged)
+BU_P10_POWERPC64_MISC_2 (CNTLZDM, "cntlzdm", CONST, cntlzdm)
+BU_P10_POWERPC64_MISC_2 (CNTTZDM, "cnttzdm", CONST, cnttzdm)
+BU_P10_POWERPC64_MISC_2 (PDEPD, "pdepd", CONST, pdepd)
+BU_P10_POWERPC64_MISC_2 (PEXTD, "pextd", CONST, pextd)
/* Builtins for vector instructions added in ISA 3.1 (power10). */
BU_P10V_AV_2 (VCLRLB, "vclrlb", CONST, vclrlb)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index f5982907..cc1e997 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -597,6 +597,9 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags,
/* Tell the user if we support the MMA instructions. */
if ((flags & OPTION_MASK_MMA) != 0)
rs6000_define_or_undefine_macro (define_p, "__MMA__");
+ /* Whether pc-relative code is being generated. */
+ if ((flags & OPTION_MASK_PCREL) != 0)
+ rs6000_define_or_undefine_macro (define_p, "__PCREL__");
}
void
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index a8b52083..b044778 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -57,16 +57,14 @@
#include "gimplify.h"
#include "gimple-fold.h"
#include "gimple-iterator.h"
-#include "gimple-ssa.h"
+#include "ssa.h"
+#include "tree-ssa-propagate.h"
#include "builtins.h"
#include "tree-vector-builder.h"
#if TARGET_XCOFF
#include "xcoffout.h" /* get declarations of xcoff_*_section_name */
#endif
#include "ppc-auxv.h"
-#include "tree-ssa-propagate.h"
-#include "tree-vrp.h"
-#include "tree-ssanames.h"
#include "targhooks.h"
#include "opts.h"
@@ -1154,6 +1152,65 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_LVEBX, ALTIVEC_BUILTIN_LVEBX,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
+ /* vector signed__int128 vec_xl_sext (signed long long, signed char *);
+ vector signed__int128 vec_xl_sext (signed long long, signed short *);
+ vector signed__int128 vec_xl_sext (signed long long, signed int *);
+ vector signed__int128 vec_xl_sext (signed long long, signed longlong *); */
+ { P10_BUILTIN_VEC_SE_LXVRX, P10_BUILTIN_SE_LXVRBX,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI, 0 },
+ { P10_BUILTIN_VEC_SE_LXVRX, P10_BUILTIN_SE_LXVRHX,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI, 0 },
+ { P10_BUILTIN_VEC_SE_LXVRX, P10_BUILTIN_SE_LXVRWX,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI, 0 },
+ { P10_BUILTIN_VEC_SE_LXVRX, P10_BUILTIN_SE_LXVRDX,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTDI, 0 },
+ { P10_BUILTIN_VEC_SE_LXVRX, P10_BUILTIN_SE_LXVRDX,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long, 0 },
+
+ /* vector unsigned__int128 vec_xl_zext (signed long long, unsigned char *);
+ vector unsigned__int128 vec_xl_zext (signed long long, unsigned short *);
+ vector unsigned__int128 vec_xl_zext (signed long long, unsigned int *);
+ vector unsigned__int128 vec_xl_zext (signed long long, unsigned longlong *); */
+ { P10_BUILTIN_VEC_ZE_LXVRX, P10_BUILTIN_ZE_LXVRBX,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI, 0 },
+ { P10_BUILTIN_VEC_ZE_LXVRX, P10_BUILTIN_ZE_LXVRHX,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI, 0 },
+ { P10_BUILTIN_VEC_ZE_LXVRX, P10_BUILTIN_ZE_LXVRWX,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI, 0 },
+ { P10_BUILTIN_VEC_ZE_LXVRX, P10_BUILTIN_ZE_LXVRDX,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTDI, 0 },
+ { P10_BUILTIN_VEC_ZE_LXVRX, P10_BUILTIN_ZE_LXVRDX,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long_long, 0 },
+
+ /* void vec_xst_trunc (vector signed __int128, signed long long, signed char *);
+ void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned char *);
+ void vec_xst_trunc (vector signed __int128, signed long long, signed char *);
+ void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned char *);
+ void vec_xst_trunc (vector signed __int128, signed long long, signed char *);
+ void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned char *);
+ void vec_xst_trunc (vector signed __int128, signed long long, signed char *);
+ void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned char *); */
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRBX, RS6000_BTI_void,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTQI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRBX, RS6000_BTI_void,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRHX, RS6000_BTI_void,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTHI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRHX, RS6000_BTI_void,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTHI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRWX, RS6000_BTI_void,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTSI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRWX, RS6000_BTI_void,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTSI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRDX, RS6000_BTI_void,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_long_long },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRDX, RS6000_BTI_void,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_long_long },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRDX, RS6000_BTI_void,
+ RS6000_BTI_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_INTDI },
+ { P10_BUILTIN_VEC_TR_STXVRX, P10_BUILTIN_TR_STXVRDX, RS6000_BTI_void,
+ RS6000_BTI_unsigned_V1TI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTDI },
+
/* vector float vec_ldl (int, vector float *);
vector float vec_ldl (int, float *); */
{ ALTIVEC_BUILTIN_VEC_LDL, ALTIVEC_BUILTIN_LVXL_V4SF,
@@ -9576,6 +9633,85 @@ swap_endian_selector_for_mode (machine_mode mode)
gen_rtvec_v (16, perm)));
}
+/* For the load and sign extend rightmost elements; load and zero extend
+ rightmost element builtins. */
+static rtx
+altivec_expand_lxvr_builtin (enum insn_code icode, tree exp, rtx target, bool blk, bool sign_extend)
+{
+ rtx pat, addr;
+ tree arg0 = CALL_EXPR_ARG (exp, 0);
+ tree arg1 = CALL_EXPR_ARG (exp, 1);
+ machine_mode tmode = insn_data[icode].operand[0].mode;
+ machine_mode smode = insn_data[icode].operand[1].mode;
+ machine_mode mode0 = Pmode;
+ machine_mode mode1 = Pmode;
+ rtx op0 = expand_normal (arg0);
+ rtx op1 = expand_normal (arg1);
+
+ if (icode == CODE_FOR_nothing)
+ /* Builtin not supported on this processor. */
+ return 0;
+
+ /* If we got invalid arguments bail out before generating bad rtl. */
+ if (arg0 == error_mark_node || arg1 == error_mark_node)
+ return const0_rtx;
+
+ if (target == 0
+ || GET_MODE (target) != tmode
+ || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
+ target = gen_reg_rtx (tmode);
+
+ op1 = copy_to_mode_reg (mode1, op1);
+
+ if (op0 == const0_rtx)
+ addr = gen_rtx_MEM (blk ? BLKmode : tmode, op1);
+ else
+ {
+ op0 = copy_to_mode_reg (mode0, op0);
+ addr = gen_rtx_MEM (blk ? BLKmode : smode,
+ gen_rtx_PLUS (Pmode, op1, op0));
+ }
+
+ if (sign_extend)
+ {
+ rtx discratch = gen_reg_rtx (DImode);
+ rtx tiscratch = gen_reg_rtx (TImode);
+
+ /* Emit the lxvr*x insn. */
+ pat = GEN_FCN (icode) (tiscratch, addr);
+ if (!pat)
+ return 0;
+ emit_insn (pat);
+
+ /* Emit a sign extension from QI,HI,WI to double (DI). */
+ rtx scratch = gen_lowpart (smode, tiscratch);
+ if (icode == CODE_FOR_vsx_lxvrbx)
+ emit_insn (gen_extendqidi2 (discratch, scratch));
+ else if (icode == CODE_FOR_vsx_lxvrhx)
+ emit_insn (gen_extendhidi2 (discratch, scratch));
+ else if (icode == CODE_FOR_vsx_lxvrwx)
+ emit_insn (gen_extendsidi2 (discratch, scratch));
+ /* Assign discratch directly if scratch is already DI. */
+ if (icode == CODE_FOR_vsx_lxvrdx)
+ discratch = scratch;
+
+ /* Emit the sign extension from DI (double) to TI (quad). */
+ emit_insn (gen_extendditi2 (target, discratch));
+
+ return target;
+ }
+ else
+ {
+ /* Zero extend. */
+ pat = GEN_FCN (icode) (target, addr);
+ if (!pat)
+ return 0;
+ emit_insn (pat);
+ return target;
+ }
+ return 0;
+}
+
static rtx
altivec_expand_lv_builtin (enum insn_code icode, tree exp, rtx target, bool blk)
{
@@ -9694,7 +9830,7 @@ altivec_expand_stv_builtin (enum insn_code icode, tree exp)
rtx op0 = expand_normal (arg0);
rtx op1 = expand_normal (arg1);
rtx op2 = expand_normal (arg2);
- rtx pat, addr, rawaddr;
+ rtx pat, addr, rawaddr, truncrtx;
machine_mode tmode = insn_data[icode].operand[0].mode;
machine_mode smode = insn_data[icode].operand[1].mode;
machine_mode mode1 = Pmode;
@@ -9733,6 +9869,25 @@ altivec_expand_stv_builtin (enum insn_code icode, tree exp)
emit_insn (gen_rtx_SET (addr, op0));
}
+ else if (icode == CODE_FOR_vsx_stxvrbx
+ || icode == CODE_FOR_vsx_stxvrhx
+ || icode == CODE_FOR_vsx_stxvrwx
+ || icode == CODE_FOR_vsx_stxvrdx)
+ {
+ truncrtx = gen_rtx_TRUNCATE (tmode, op0);
+ op0 = copy_to_mode_reg (E_TImode, truncrtx);
+
+ if (op1 == const0_rtx)
+ addr = gen_rtx_MEM (Pmode, op2);
+ else
+ {
+ op1 = copy_to_mode_reg (mode1, op1);
+ addr = gen_rtx_MEM (tmode, gen_rtx_PLUS (Pmode, op2, op1));
+ }
+ pat = GEN_FCN (icode) (addr, op0);
+ if (pat)
+ emit_insn (pat);
+ }
else
{
if (! (*insn_data[icode].operand[1].predicate) (op0, smode))
@@ -10752,6 +10907,16 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvehx, exp);
case ALTIVEC_BUILTIN_STVEWX:
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvewx, exp);
+
+ case P10_BUILTIN_TR_STXVRBX:
+ return altivec_expand_stv_builtin (CODE_FOR_vsx_stxvrbx, exp);
+ case P10_BUILTIN_TR_STXVRHX:
+ return altivec_expand_stv_builtin (CODE_FOR_vsx_stxvrhx, exp);
+ case P10_BUILTIN_TR_STXVRWX:
+ return altivec_expand_stv_builtin (CODE_FOR_vsx_stxvrwx, exp);
+ case P10_BUILTIN_TR_STXVRDX:
+ return altivec_expand_stv_builtin (CODE_FOR_vsx_stxvrdx, exp);
+
case ALTIVEC_BUILTIN_STVXL_V2DF:
return altivec_expand_stv_builtin (CODE_FOR_altivec_stvxl_v2df, exp);
case ALTIVEC_BUILTIN_STVXL_V2DI:
@@ -11014,6 +11179,30 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
case ALTIVEC_BUILTIN_LVEWX:
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvewx,
exp, target, false);
+ case P10_BUILTIN_SE_LXVRBX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrbx,
+ exp, target, false, true);
+ case P10_BUILTIN_SE_LXVRHX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrhx,
+ exp, target, false, true);
+ case P10_BUILTIN_SE_LXVRWX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrwx,
+ exp, target, false, true);
+ case P10_BUILTIN_SE_LXVRDX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrdx,
+ exp, target, false, true);
+ case P10_BUILTIN_ZE_LXVRBX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrbx,
+ exp, target, false, false);
+ case P10_BUILTIN_ZE_LXVRHX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrhx,
+ exp, target, false, false);
+ case P10_BUILTIN_ZE_LXVRWX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrwx,
+ exp, target, false, false);
+ case P10_BUILTIN_ZE_LXVRDX:
+ return altivec_expand_lxvr_builtin (CODE_FOR_vsx_lxvrdx,
+ exp, target, false, false);
case ALTIVEC_BUILTIN_LVXL_V2DF:
return altivec_expand_lv_builtin (CODE_FOR_altivec_lvxl_v2df,
exp, target, false);
@@ -12916,15 +13105,13 @@ rs6000_init_builtins (void)
/* Vector pair and vector quad support. */
if (TARGET_EXTRA_BUILTINS)
{
- tree oi_uns_type = make_unsigned_type (256);
- vector_pair_type_node = build_distinct_type_copy (oi_uns_type);
+ vector_pair_type_node = make_unsigned_type (256);
SET_TYPE_MODE (vector_pair_type_node, POImode);
layout_type (vector_pair_type_node);
lang_hooks.types.register_builtin_type (vector_pair_type_node,
"__vector_pair");
- tree xi_uns_type = make_unsigned_type (512);
- vector_quad_type_node = build_distinct_type_copy (xi_uns_type);
+ vector_quad_type_node = make_unsigned_type (512);
SET_TYPE_MODE (vector_quad_type_node, PXImode);
layout_type (vector_quad_type_node);
lang_hooks.types.register_builtin_type (vector_quad_type_node,
@@ -13298,6 +13485,18 @@ altivec_init_builtins (void)
def_builtin ("__builtin_altivec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEBX);
def_builtin ("__builtin_altivec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEHX);
def_builtin ("__builtin_altivec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVEWX);
+ def_builtin ("__builtin_altivec_se_lxvrbx", v16qi_ftype_long_pcvoid, P10_BUILTIN_SE_LXVRBX);
+ def_builtin ("__builtin_altivec_se_lxvrhx", v8hi_ftype_long_pcvoid, P10_BUILTIN_SE_LXVRHX);
+ def_builtin ("__builtin_altivec_se_lxvrwx", v4si_ftype_long_pcvoid, P10_BUILTIN_SE_LXVRWX);
+ def_builtin ("__builtin_altivec_se_lxvrdx", v2di_ftype_long_pcvoid, P10_BUILTIN_SE_LXVRDX);
+ def_builtin ("__builtin_altivec_ze_lxvrbx", v16qi_ftype_long_pcvoid, P10_BUILTIN_ZE_LXVRBX);
+ def_builtin ("__builtin_altivec_ze_lxvrhx", v8hi_ftype_long_pcvoid, P10_BUILTIN_ZE_LXVRHX);
+ def_builtin ("__builtin_altivec_ze_lxvrwx", v4si_ftype_long_pcvoid, P10_BUILTIN_ZE_LXVRWX);
+ def_builtin ("__builtin_altivec_ze_lxvrdx", v2di_ftype_long_pcvoid, P10_BUILTIN_ZE_LXVRDX);
+ def_builtin ("__builtin_altivec_tr_stxvrbx", void_ftype_v1ti_long_pvoid, P10_BUILTIN_TR_STXVRBX);
+ def_builtin ("__builtin_altivec_tr_stxvrhx", void_ftype_v1ti_long_pvoid, P10_BUILTIN_TR_STXVRHX);
+ def_builtin ("__builtin_altivec_tr_stxvrwx", void_ftype_v1ti_long_pvoid, P10_BUILTIN_TR_STXVRWX);
+ def_builtin ("__builtin_altivec_tr_stxvrdx", void_ftype_v1ti_long_pvoid, P10_BUILTIN_TR_STXVRDX);
def_builtin ("__builtin_altivec_lvxl", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_LVXL);
def_builtin ("__builtin_altivec_lvxl_v2df", v2df_ftype_long_pcvoid,
ALTIVEC_BUILTIN_LVXL_V2DF);
@@ -13363,6 +13562,9 @@ altivec_init_builtins (void)
def_builtin ("__builtin_vec_lvebx", v16qi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEBX);
def_builtin ("__builtin_vec_lvehx", v8hi_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEHX);
def_builtin ("__builtin_vec_lvewx", v4si_ftype_long_pcvoid, ALTIVEC_BUILTIN_VEC_LVEWX);
+ def_builtin ("__builtin_vec_se_lxvrx", v1ti_ftype_long_pcvoid, P10_BUILTIN_VEC_SE_LXVRX);
+ def_builtin ("__builtin_vec_ze_lxvrx", v1ti_ftype_long_pcvoid, P10_BUILTIN_VEC_ZE_LXVRX);
+ def_builtin ("__builtin_vec_tr_stxvrx", void_ftype_opaque_long_pvoid, P10_BUILTIN_VEC_TR_STXVRX);
def_builtin ("__builtin_vec_st", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_ST);
def_builtin ("__builtin_vec_ste", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STE);
def_builtin ("__builtin_vec_stl", void_ftype_opaque_long_pvoid, ALTIVEC_BUILTIN_VEC_STL);
diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h
index 9caef01..32681b6 100644
--- a/gcc/config/rs6000/rs6000-internal.h
+++ b/gcc/config/rs6000/rs6000-internal.h
@@ -32,7 +32,7 @@ typedef struct rs6000_stack {
int cr_save_p; /* true if the CR reg needs to be saved */
unsigned int vrsave_mask; /* mask of vec registers to save */
int push_p; /* true if we need to allocate stack space */
- int calls_p; /* true if the function makes any calls */
+ int calls_p; /* true if there are non-sibling calls */
int world_save_p; /* true if we're saving *everything*:
r13-r31, cr, f14-f31, vrsave, v20-v31 */
enum rs6000_abi abi; /* which ABI to use */
diff --git a/gcc/config/rs6000/rs6000-logue.c b/gcc/config/rs6000/rs6000-logue.c
index 0f88ec1..d90cd57 100644
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -714,7 +714,7 @@ rs6000_stack_info (void)
info->altivec_size = 16 * (LAST_ALTIVEC_REGNO + 1
- info->first_altivec_reg_save);
- /* Does this function call anything? */
+ /* Does this function call anything (apart from sibling calls)? */
info->calls_p = (!crtl->is_leaf || cfun->machine->ra_needs_full_frame);
/* Determine if we need to save the condition code registers. */
@@ -5479,7 +5479,18 @@ rs6000_expand_split_stack_prologue (void)
gcc_assert (flag_split_stack && reload_completed);
if (!info->push_p)
- return;
+ {
+ /* We need the -fsplit-stack prologue for functions that make
+ tail calls. Tail calls don't count against crtl->is_leaf.
+ Note that we are called inside a sequence. get_insns will
+ just return that (as yet empty) sequence, so instead we
+ access the function rtl with get_topmost_sequence. */
+ for (insn = get_topmost_sequence ()->first; insn; insn = NEXT_INSN (insn))
+ if (CALL_P (insn))
+ break;
+ if (!insn)
+ return;
+ }
if (global_regs[29])
{
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 6f204ca..4d528a3 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -59,11 +59,12 @@
#include "gimplify.h"
#include "gimple-fold.h"
#include "gimple-iterator.h"
-#include "gimple-ssa.h"
#include "gimple-walk.h"
+#include "ssa.h"
+#include "tree-vectorizer.h"
+#include "tree-ssa-propagate.h"
#include "intl.h"
#include "tm-constrs.h"
-#include "tree-vectorizer.h"
#include "target-globals.h"
#include "builtins.h"
#include "tree-vector-builder.h"
@@ -75,9 +76,6 @@
#endif
#include "case-cfn-macros.h"
#include "ppc-auxv.h"
-#include "tree-ssa-propagate.h"
-#include "tree-vrp.h"
-#include "tree-ssanames.h"
#include "rs6000-internal.h"
#include "opts.h"
@@ -3451,6 +3449,96 @@ rs6000_override_options_after_change (void)
flag_cunroll_grow_size = flag_peel_loops || optimize >= 3;
}
+#ifdef TARGET_USES_LINUX64_OPT
+static void
+rs6000_linux64_override_options ()
+{
+ if (!global_options_set.x_rs6000_alignment_flags)
+ rs6000_alignment_flags = MASK_ALIGN_NATURAL;
+ if (rs6000_isa_flags & OPTION_MASK_64BIT)
+ {
+ if (DEFAULT_ABI != ABI_AIX)
+ {
+ rs6000_current_abi = ABI_AIX;
+ error (INVALID_64BIT, "call");
+ }
+ dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");
+ if (ELFv2_ABI_CHECK)
+ {
+ rs6000_current_abi = ABI_ELFv2;
+ if (dot_symbols)
+ error ("%<-mcall-aixdesc%> incompatible with %<-mabi=elfv2%>");
+ }
+ if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)
+ {
+ rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;
+ error (INVALID_64BIT, "relocatable");
+ }
+ if (rs6000_isa_flags & OPTION_MASK_EABI)
+ {
+ rs6000_isa_flags &= ~OPTION_MASK_EABI;
+ error (INVALID_64BIT, "eabi");
+ }
+ if (TARGET_PROTOTYPE)
+ {
+ target_prototype = 0;
+ error (INVALID_64BIT, "prototype");
+ }
+ if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0)
+ {
+ rs6000_isa_flags |= OPTION_MASK_POWERPC64;
+ error ("%<-m64%> requires a PowerPC64 cpu");
+ }
+ if (!global_options_set.x_rs6000_current_cmodel)
+ SET_CMODEL (CMODEL_MEDIUM);
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_MINIMAL_TOC) != 0)
+ {
+ if (global_options_set.x_rs6000_current_cmodel
+ && rs6000_current_cmodel != CMODEL_SMALL)
+ error ("%<-mcmodel incompatible with other toc options%>");
+ if (TARGET_MINIMAL_TOC)
+ SET_CMODEL (CMODEL_SMALL);
+ else if (TARGET_PCREL
+ || (PCREL_SUPPORTED_BY_OS
+ && (rs6000_isa_flags_explicit & OPTION_MASK_PCREL) == 0))
+ /* Ignore -mno-minimal-toc. */
+ ;
+ else
+ SET_CMODEL (CMODEL_SMALL);
+ }
+ if (rs6000_current_cmodel != CMODEL_SMALL)
+ {
+ if (!global_options_set.x_TARGET_NO_FP_IN_TOC)
+ TARGET_NO_FP_IN_TOC = rs6000_current_cmodel == CMODEL_MEDIUM;
+ if (!global_options_set.x_TARGET_NO_SUM_IN_TOC)
+ TARGET_NO_SUM_IN_TOC = 0;
+ }
+ if (TARGET_PLTSEQ && DEFAULT_ABI != ABI_ELFv2)
+ {
+ if (global_options_set.x_rs6000_pltseq)
+ warning (0, "%qs unsupported for this ABI",
+ "-mpltseq");
+ rs6000_pltseq = false;
+ }
+ }
+ else if (TARGET_64BIT)
+ error (INVALID_32BIT, "32");
+ else
+ {
+ if (TARGET_PROFILE_KERNEL)
+ {
+ profile_kernel = 0;
+ error (INVALID_32BIT, "profile-kernel");
+ }
+ if (global_options_set.x_rs6000_current_cmodel)
+ {
+ SET_CMODEL (CMODEL_SMALL);
+ error (INVALID_32BIT, "cmodel");
+ }
+ }
+}
+#endif
+
/* Override command line options.
Combine build-specific configuration information with options
@@ -4236,7 +4324,9 @@ rs6000_option_override_internal (bool global_init_p)
}
/* Enable Altivec ABI for AIX -maltivec. */
- if (TARGET_XCOFF && (TARGET_ALTIVEC || TARGET_VSX))
+ if (TARGET_XCOFF
+ && (TARGET_ALTIVEC || TARGET_VSX)
+ && !global_options_set.x_rs6000_altivec_abi)
{
if (main_target_opt != NULL && !main_target_opt->x_rs6000_altivec_abi)
error ("target attribute or pragma changes AltiVec ABI");
@@ -5731,7 +5821,7 @@ direct_return (void)
/* Helper for num_insns_constant. Calculate number of instructions to
load VALUE to a single gpr using combinations of addi, addis, ori,
- oris and sldi instructions. */
+ oris, sldi and rldimi instructions. */
static int
num_insns_constant_gpr (HOST_WIDE_INT value)
@@ -5759,7 +5849,7 @@ num_insns_constant_gpr (HOST_WIDE_INT value)
high >>= 1;
- if (low == 0)
+ if (low == 0 || low == high)
return num_insns_constant_gpr (high) + 1;
else if (high == 0)
return num_insns_constant_gpr (low) + 1;
@@ -8364,7 +8454,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
low_int = 0;
high_int = INTVAL (XEXP (x, 1)) - low_int;
sum = force_operand (gen_rtx_PLUS (Pmode, XEXP (x, 0),
- GEN_INT (high_int)), 0);
+ gen_int_mode (high_int, Pmode)), 0);
return plus_constant (Pmode, sum, low_int);
}
else if (GET_CODE (x) == PLUS
@@ -9020,15 +9110,21 @@ rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict)
bool reg_offset_p = reg_offset_addressing_ok_p (mode);
bool quad_offset_p = mode_supports_dq_form (mode);
- /* If this is an unaligned stvx/ldvx type address, discard the outer AND. */
+ if (TARGET_ELF && RS6000_SYMBOL_REF_TLS_P (x))
+ return 0;
+
+ /* Handle unaligned altivec lvx/stvx type addresses. */
if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)
&& GET_CODE (x) == AND
&& CONST_INT_P (XEXP (x, 1))
&& INTVAL (XEXP (x, 1)) == -16)
- x = XEXP (x, 0);
+ {
+ x = XEXP (x, 0);
+ return (legitimate_indirect_address_p (x, reg_ok_strict)
+ || legitimate_indexed_address_p (x, reg_ok_strict)
+ || virtual_stack_registers_memory_p (x));
+ }
- if (TARGET_ELF && RS6000_SYMBOL_REF_TLS_P (x))
- return 0;
if (legitimate_indirect_address_p (x, reg_ok_strict))
return 1;
if (TARGET_UPDATE
@@ -21176,9 +21272,9 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
return true;
}
else if ((outer_code == PLUS
- && reg_or_add_cint_operand (x, VOIDmode))
+ && reg_or_add_cint_operand (x, mode))
|| (outer_code == MINUS
- && reg_or_sub_cint_operand (x, VOIDmode))
+ && reg_or_sub_cint_operand (x, mode))
|| ((outer_code == SET
|| outer_code == IOR
|| outer_code == XOR)
@@ -26957,11 +27053,10 @@ rs6000_const_f32_to_i32 (rtx operand)
void
rs6000_emit_xxspltidp_v2df (rtx dst, long value)
{
- printf("rs6000_emit_xxspltidp_v2df called %ld\n", value);
- printf("rs6000_emit_xxspltidp_v2df called 0x%lx\n", value);
if (((value & 0x7F800000) == 0) && ((value & 0x7FFFFF) != 0))
inform (input_location,
- "the result for the xxspltidp instruction is undefined for subnormal input values.\n");
+ "the result for the xxspltidp instruction "
+ "is undefined for subnormal input values");
emit_insn( gen_xxspltidp_v2df_inst (dst, GEN_INT (value)));
}
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 694ff70..dc06014 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -11554,7 +11554,7 @@
""
{
/* Everything is best done with setbc[r] if available. */
- if (TARGET_POWER10)
+ if (TARGET_POWER10 && TARGET_ISEL)
rs6000_emit_int_cmove (operands[0], operands[1], const1_rtx, const0_rtx);
/* Expanding EQ and NE directly to some machine instructions does not help
@@ -12697,12 +12697,7 @@
""
{
if (rs6000_speculate_indirect_jumps)
- {
- if (TARGET_32BIT)
- emit_jump_insn (gen_tablejumpsi (operands[0], operands[1]));
- else
- emit_jump_insn (gen_tablejumpdi (operands[0], operands[1]));
- }
+ emit_jump_insn (gen_tablejump_normal (Pmode, operands[0], operands[1]));
else
{
rtx ccreg = gen_reg_rtx (CCmode);
@@ -12716,69 +12711,57 @@
DONE;
})
-(define_expand "tablejumpsi"
- [(set (match_dup 3)
- (plus:SI (match_operand:SI 0)
- (match_dup 2)))
- (parallel [(set (pc)
- (match_dup 3))
- (use (label_ref (match_operand 1)))])]
- "TARGET_32BIT && rs6000_speculate_indirect_jumps"
+(define_expand "@tablejump<mode>_normal"
+ [(use (match_operand:SI 0))
+ (use (match_operand:P 1))]
+ "rs6000_speculate_indirect_jumps"
{
+ rtx off;
operands[0] = force_reg (SImode, operands[0]);
- operands[2] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
- operands[3] = gen_reg_rtx (SImode);
+ if (<MODE>mode == SImode)
+ off = operands[0];
+ else
+ {
+ off = gen_reg_rtx (Pmode);
+ rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
+ emit_move_insn (off, src);
+ }
+
+ rtx lab = force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, operands[1]));
+ rtx addr = gen_reg_rtx (Pmode);
+
+ emit_insn (gen_add<mode>3 (addr, off, lab));
+ emit_jump_insn (gen_tablejump_insn_normal (Pmode, addr, operands[1]));
+ DONE;
})
-(define_expand "tablejumpsi_nospec"
- [(set (match_dup 4)
- (plus:SI (match_operand:SI 0)
- (match_dup 3)))
- (parallel [(set (pc)
- (match_dup 4))
- (use (label_ref (match_operand 1)))
- (clobber (match_operand 2))])]
- "TARGET_32BIT && !rs6000_speculate_indirect_jumps"
+(define_expand "@tablejump<mode>_nospec"
+ [(use (match_operand:SI 0))
+ (use (match_operand:P 1))
+ (use (match_operand:CC 2))]
+ "!rs6000_speculate_indirect_jumps"
{
+ rtx off;
operands[0] = force_reg (SImode, operands[0]);
- operands[3] = force_reg (SImode, gen_rtx_LABEL_REF (SImode, operands[1]));
- operands[4] = gen_reg_rtx (SImode);
-})
+ if (<MODE>mode == SImode)
+ off = operands[0];
+ else
+ {
+ off = gen_reg_rtx (Pmode);
+ rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
+ emit_move_insn (off, src);
+ }
-(define_expand "tablejumpdi"
- [(set (match_dup 4)
- (sign_extend:DI (match_operand:SI 0 "lwa_operand")))
- (set (match_dup 3)
- (plus:DI (match_dup 4)
- (match_dup 2)))
- (parallel [(set (pc)
- (match_dup 3))
- (use (label_ref (match_operand 1)))])]
- "TARGET_64BIT && rs6000_speculate_indirect_jumps"
-{
- operands[2] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
- operands[3] = gen_reg_rtx (DImode);
- operands[4] = gen_reg_rtx (DImode);
-})
+ rtx lab = force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, operands[1]));
+ rtx addr = gen_reg_rtx (Pmode);
-(define_expand "tablejumpdi_nospec"
- [(set (match_dup 5)
- (sign_extend:DI (match_operand:SI 0 "lwa_operand")))
- (set (match_dup 4)
- (plus:DI (match_dup 5)
- (match_dup 3)))
- (parallel [(set (pc)
- (match_dup 4))
- (use (label_ref (match_operand 1)))
- (clobber (match_operand 2))])]
- "TARGET_64BIT && !rs6000_speculate_indirect_jumps"
-{
- operands[3] = force_reg (DImode, gen_rtx_LABEL_REF (DImode, operands[1]));
- operands[4] = gen_reg_rtx (DImode);
- operands[5] = gen_reg_rtx (DImode);
+ emit_insn (gen_add<mode>3 (addr, off, lab));
+ emit_jump_insn (gen_tablejump_insn_nospec (Pmode, addr, operands[1],
+ operands[2]));
+ DONE;
})
-(define_insn "*tablejump<mode>_internal1"
+(define_insn "@tablejump<mode>_insn_normal"
[(set (pc)
(match_operand:P 0 "register_operand" "c,*l"))
(use (label_ref (match_operand 1)))]
@@ -12786,7 +12769,7 @@
"b%T0"
[(set_attr "type" "jmpreg")])
-(define_insn "*tablejump<mode>_internal1_nospec"
+(define_insn "@tablejump<mode>_insn_nospec"
[(set (pc)
(match_operand:P 0 "register_operand" "c,*l"))
(use (label_ref (match_operand 1)))
diff --git a/gcc/config/rs6000/smmintrin.h b/gcc/config/rs6000/smmintrin.h
index d78ddba..4c0fc86 100644
--- a/gcc/config/rs6000/smmintrin.h
+++ b/gcc/config/rs6000/smmintrin.h
@@ -42,6 +42,36 @@
#include <altivec.h>
#include <tmmintrin.h>
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_insert_epi8 (__m128i const __A, int const __D, int const __N)
+{
+ __v16qi result = (__v16qi)__A;
+
+ result [__N & 0xf] = __D;
+
+ return (__m128i) result;
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_insert_epi32 (__m128i const __A, int const __D, int const __N)
+{
+ __v4si result = (__v4si)__A;
+
+ result [__N & 3] = __D;
+
+ return (__m128i) result;
+}
+
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_insert_epi64 (__m128i const __A, long long const __D, int const __N)
+{
+ __v2di result = (__v2di)__A;
+
+ result [__N & 1] = __D;
+
+ return (__m128i) result;
+}
+
extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm_extract_epi8 (__m128i __X, const int __N)
{
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 4ff5245..d6347db 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -352,6 +352,8 @@
UNSPEC_VSX_FIRST_MISMATCH_EOS_INDEX
UNSPEC_XXGENPCV
UNSPEC_MTVSBM
+ UNSPEC_EXTENDDITI2
+ UNSPEC_MTVSRD_DITI_W1
UNSPEC_VCNTMB
UNSPEC_VEXPAND
UNSPEC_VEXTRACT
@@ -1253,6 +1255,24 @@
}
})
+;; Load rightmost element from load_data
+;; using lxvrbx, lxvrhx, lxvrwx, lxvrdx.
+(define_insn "vsx_lxvr<wd>x"
+ [(set (match_operand:TI 0 "vsx_register_operand" "=wa")
+ (zero_extend:TI (match_operand:INT_ISA3 1 "memory_operand" "Z")))]
+ "TARGET_POWER10"
+ "lxvr<wd>x %x0,%y1"
+ [(set_attr "type" "vecload")])
+
+;; Store rightmost element into store_data
+;; using stxvrbx, stxvrhx, strvxwx, strvxdx.
+(define_insn "vsx_stxvr<wd>x"
+ [(set (match_operand:INT_ISA3 0 "memory_operand" "=Z")
+ (truncate:INT_ISA3 (match_operand:TI 1 "vsx_register_operand" "wa")))]
+ "TARGET_POWER10"
+ "stxvr<wd>x %x1,%y0"
+ [(set_attr "type" "vecstore")])
+
;; Explicit load/store expanders for the builtin functions for lxvd2x, etc.,
;; when you really want their element-reversing behavior.
(define_insn "vsx_ld_elemrev_v2di"
@@ -4795,6 +4815,37 @@
"vextsw2d %0,%1"
[(set_attr "type" "vecexts")])
+;; ISA 3.1 vector sign extend
+;; Move DI value from GPR to TI mode in VSX register, word 1.
+(define_insn "mtvsrdd_diti_w1"
+ [(set (match_operand:TI 0 "register_operand" "=wa")
+ (unspec:TI [(match_operand:DI 1 "register_operand" "r")]
+ UNSPEC_MTVSRD_DITI_W1))]
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
+ "mtvsrdd %x0,0,%1"
+ [(set_attr "type" "vecmove")])
+
+;; Sign extend 64-bit value in TI reg, word 1, to 128-bit value in TI reg
+(define_insn "extendditi2_vector"
+ [(set (match_operand:TI 0 "gpc_reg_operand" "=v")
+ (unspec:TI [(match_operand:TI 1 "gpc_reg_operand" "v")]
+ UNSPEC_EXTENDDITI2))]
+ "TARGET_POWER10"
+ "vextsd2q %0,%1"
+ [(set_attr "type" "vecexts")])
+
+(define_expand "extendditi2"
+ [(set (match_operand:TI 0 "gpc_reg_operand")
+ (sign_extend:DI (match_operand:DI 1 "gpc_reg_operand")))]
+ "TARGET_POWER10"
+ {
+ /* Move 64-bit src from GPR to vector reg and sign extend to 128-bits. */
+ rtx temp = gen_reg_rtx (TImode);
+ emit_insn (gen_mtvsrdd_diti_w1 (temp, operands[1]));
+ emit_insn (gen_extendditi2_vector (operands[0], temp));
+ DONE;
+ })
+
;; ISA 3.0 Binary Floating-Point Support
@@ -5659,7 +5710,7 @@
{
int i;
int vals_le[16] = {15, 14, 0, 0, 13, 12, 0, 0, 11, 10, 0, 0, 9, 8, 0, 0};
- int vals_be[16] = {7, 6, 0, 0, 5, 4, 0, 0, 3, 2, 0, 0, 1, 0, 0, 0};
+ int vals_be[16] = {0, 0, 0, 1, 0, 0, 2, 3, 0, 0, 4, 5, 0, 0, 6, 7};
rtx rvals[16];
rtx mask = gen_reg_rtx (V16QImode);
@@ -5693,7 +5744,7 @@
"TARGET_P9_VECTOR"
{
int vals_le[16] = {7, 6, 0, 0, 5, 4, 0, 0, 3, 2, 0, 0, 1, 0, 0, 0};
- int vals_be[16] = {15, 14, 0, 0, 13, 12, 0, 0, 11, 10, 0, 0, 9, 8, 0, 0};
+ int vals_be[16] = {0, 0, 8, 9, 0, 0, 10, 11, 0, 0, 12, 13, 0, 0, 14, 15};
int i;
rtx rvals[16];
@@ -6035,7 +6086,7 @@
(match_operand:QI 2 "const_0_to_1_operand" "n")]
UNSPEC_VCNTMB))]
"TARGET_POWER10"
- "vcntmb<VSX_MM_SUFFIX> %0,%1,%2"
+ "vcntmb<wd> %0,%1,%2"
[(set_attr "type" "vecsimple")])
(define_insn "vec_extract_<mode>"
@@ -6043,7 +6094,7 @@
(unspec:SI [(match_operand:VSX_MM 1 "altivec_register_operand" "v")]
UNSPEC_VEXTRACT))]
"TARGET_POWER10"
- "vextract<VSX_MM_SUFFIX>m %0,%1"
+ "vextract<wd>m %0,%1"
[(set_attr "type" "vecsimple")])
(define_insn "vec_expand_<mode>"
@@ -6051,5 +6102,5 @@
(unspec:VSX_MM [(match_operand:VSX_MM 1 "vsx_register_operand" "v")]
UNSPEC_VEXPAND))]
"TARGET_POWER10"
- "vexpand<VSX_MM_SUFFIX>m %0,%1"
+ "vexpand<wd>m %0,%1"
[(set_attr "type" "vecsimple")])
diff --git a/gcc/config/rs6000/vxworks.h b/gcc/config/rs6000/vxworks.h
index 771dddf..87ca3af 100644
--- a/gcc/config/rs6000/vxworks.h
+++ b/gcc/config/rs6000/vxworks.h
@@ -18,10 +18,21 @@ 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/>. */
-/* Note to future editors: VxWorks is mostly an EABI target. We do
- not use rs6000/eabi.h because we would have to override most of
- it anyway. However, if you change that file, consider making
- analogous changes here too. */
+/* The port comes in two very different flavors at this stage:
+
+ - For 653 (AE) and regular versions prior to VxWorks 7, the port
+ comes with its own set of definitions, matching a system compiler
+ configured this way as well as the corresponding run-time
+ environment. This is essentially an eabi system, so changes to
+ eabi.h should usually be reflected here.
+
+ - Starting with VxWorks 7 (post SR600), the system environment
+ was made extremely similar to GNU/Linux and this toolchain is
+ built on top of the corresponding header files. */
+
+/*-------------------------------------------------------------*/
+/* Common definitions first. */
+/*-------------------------------------------------------------*/
/* CPP predefined macros. */
@@ -29,111 +40,156 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
- builtin_define ("__ppc"); \
- builtin_define ("__PPC__"); \
- builtin_define ("__EABI__"); \
builtin_define ("__ELF__"); \
+ if (!TARGET_VXWORKS7) \
+ builtin_define ("__EABI__"); \
+ \
+ /* CPU macros, based on what the system compilers do. */ \
+ if (!TARGET_VXWORKS7) \
+ { \
+ builtin_define ("__ppc"); \
+ /* Namespace violation below, but the system headers \
+ really depend heavily on this. */ \
+ builtin_define ("CPU_FAMILY=PPC"); \
+ \
+ /* __PPC__ isn't actually emitted by the system compiler \
+ prior to vx7 but has been advertised by us for ages. */ \
+ builtin_define ("__PPC__"); \
+ } \
+ else \
+ { \
+ builtin_define ("__PPC__"); \
+ builtin_define ("__powerpc__"); \
+ if (TARGET_64BIT) \
+ { \
+ builtin_define ("__PPC64__"); \
+ builtin_define ("__powerpc64__"); \
+ } \
+ else \
+ { \
+ builtin_define ("__PPC"); \
+ builtin_define ("__powerpc"); \
+ } \
+ } \
+ \
+ /* Asserts for #cpu and #machine. */ \
+ if (TARGET_64BIT) \
+ { \
+ builtin_assert ("cpu=powerpc64"); \
+ builtin_assert ("machine=powerpc64"); \
+ } \
+ else \
+ { \
+ builtin_assert ("cpu=powerpc"); \
+ builtin_assert ("machine=powerpc"); \
+ } \
+ \
+ /* PowerPC VxWorks specificities. */ \
if (!TARGET_SOFT_FLOAT) \
- builtin_define ("__hardfp"); \
+ { \
+ builtin_define ("__hardfp"); \
+ builtin_define ("_WRS_HARDWARE_FP"); \
+ } \
\
- /* C89 namespace violation! */ \
- builtin_define ("CPU_FAMILY=PPC"); \
- \
+ /* Common VxWorks and port items. */ \
VXWORKS_OS_CPP_BUILTINS (); \
+ TARGET_OS_SYSV_CPP_BUILTINS (); \
} \
while (0)
-/* vx6 library path. */
-#if !TARGET_VXWORKS7
-#undef STARTFILE_PREFIX_SPEC
-#define STARTFILE_PREFIX_SPEC \
- "%{mrtp:%{!shared:%:getenv(WIND_BASE /target/lib/usr/lib/ppc/PPC32/common)}}"
+/* Specific CPU macro definitions expected by the system headers,
+ inferred from -mcpu requests by the user. Different versions of
+ VxWorks expect different forms of macros, such as
+
+ -D_VX_CPU=_VX_PPC403 on Vx7 and some variants of Vx6,
+ -DCPU=PPC403 on all Vx6 and earlier. */
+
+#if TARGET_VXWORKS7
+#define VX_CPU_PREFIX "_VX_"
+#else
+#define VX_CPU_PREFIX ""
#endif
-/* Only big endian PPC is supported by VxWorks. */
-#undef BYTES_BIG_ENDIAN
-#define BYTES_BIG_ENDIAN 1
-#undef WORDS_BIG_ENDIAN
-#define WORDS_BIG_ENDIAN 1
+#define VX_CPUDEF(CPUID) \
+ ":-D" VX_CPU_PREFIX "CPU=" VX_CPU_PREFIX #CPUID
-/* We have to kill off the entire specs set created by rs6000/sysv4.h
- and substitute our own set. The top level vxworks.h has done some
- of this for us. */
+#define VX_MCPU(CPU,CPUID) \
+ "mcpu=" #CPU VX_CPUDEF(CPUID)
-#undef SUBTARGET_EXTRA_SPECS
#undef CPP_SPEC
-#undef CC1_SPEC
-#undef ASM_SPEC
-
-#define SUBTARGET_EXTRA_SPECS /* none needed */
+#define CPP_SPEC \
+ "%{!D" VX_CPU_PREFIX "CPU=*:%{" \
+ VX_MCPU(403, PPC403) ";" \
+ VX_MCPU(405, PPC405) ";" \
+ VX_MCPU(440, PPC440) ";" \
+ VX_MCPU(464, PPC464) ";" \
+ VX_MCPU(476, PPC476) ";" \
+ VX_MCPU(603, PPC603) ";" \
+ VX_MCPU(604, PPC604) ";" \
+ VX_MCPU(860, PPC860) ";" \
+ VX_MCPU(e6500, E6500) ";" \
+ VX_MCPU(8540, PPC85XX) ";" \
+ VX_MCPU(8548, PPC85XX) ";" \
+ VX_CPUDEF(PPC604) \
+ "}}" \
+ VXWORKS_ADDITIONAL_CPP_SPEC
/* FIXME: The only reason we allow no -mcpu switch at all is because
- config-ml.in insists on a "." multilib. */
-#define CPP_SPEC \
-"%{!DCPU=*: \
- %{mcpu=403 : -DCPU=PPC403 ; \
- mcpu=405 : -DCPU=PPC405 ; \
- mcpu=440 : -DCPU=PPC440 ; \
- mcpu=464 : -DCPU=PPC464 ; \
- mcpu=476 : -DCPU=PPC476 ; \
- mcpu=603 : -DCPU=PPC603 ; \
- mcpu=604 : -DCPU=PPC604 ; \
- mcpu=860 : -DCPU=PPC860 ; \
- mcpu=8540: -DCPU=PPC85XX ; \
- mcpu=8548: -DCPU=PPC85XX ; \
- : -DCPU=PPC604 }}" \
-VXWORKS_ADDITIONAL_CPP_SPEC
-
-#define CC1_SPEC \
-"%{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default} \
- %{mlittle|mlittle-endian:-mstrict-align}"
-
-#define ASM_SPEC \
-"%(asm_cpu) \
- %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
- %{mrelocatable} %{mrelocatable-lib} %{" FPIC_SPEC ":-K PIC} -mbig"
+ config-ml.in insists on a "." multilib. */
#undef LIB_SPEC
#define LIB_SPEC VXWORKS_LIB_SPEC
-/* For RTPs, leverage linker relaxation. This helps programs referring
- to, typically, kernel services too far away for short calls. This is more
- precise than -mlongcall and can be overriden with -Wl,--no-relax. */
-#define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}"
-
-#undef LINK_SPEC
-#define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC
-
#undef STARTFILE_SPEC
#define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
+
#undef ENDFILE_SPEC
#define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
/* There is no default multilib. */
#undef MULTILIB_DEFAULTS
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_EABI | MASK_STRICT_ALIGN)
+/* No _mcount profiling on VxWorks. */
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
-#undef PROCESSOR_DEFAULT
-#define PROCESSOR_DEFAULT PROCESSOR_PPC604
+/* Initialize library function table. */
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS rs6000_vxworks_init_libfuncs
/* Nor sdata, for kernel mode. We use this in
SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized. */
#undef SDATA_DEFAULT_SIZE
#define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0)
-/* Enforce 16-byte alignment for the stack pointer, to permit general
- compliance with e.g. Altivec instructions requirements. Make sure
- this isn't overruled by the EABI constraints. */
+#undef SUB3TARGET_OVERRIDE_OPTIONS
+#define SUB3TARGET_OVERRIDE_OPTIONS \
+ do { \
+ if (!global_options_set.x_g_switch_value) \
+ g_switch_value = SDATA_DEFAULT_SIZE; \
+ VXWORKS_OVERRIDE_OPTIONS; \
+ } while (0)
-#undef STACK_BOUNDARY
-#define STACK_BOUNDARY (16*BITS_PER_UNIT)
+/* The stack pointer need not be moved while checking the stack. */
+#undef STACK_CHECK_MOVING_SP
-#undef PREFERRED_STACK_BOUNDARY
-#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
+/* Define this to be nonzero if static stack checking is supported. */
+#define STACK_CHECK_STATIC_BUILTIN 1
-#undef ABI_STACK_BOUNDARY
+/* Room needed to allow exception propagation, from what experiments
+ and low level observations taught us ... */
+#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
+
+/* Leverage linker relaxation for RTPs. This helps 32bit programs
+ referring to kernel services too far away for short calls, is more
+ precise than -mlongcall and can be overriden with -Wl,--no-relax. */
+#define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}"
+
+/*-------------------------------------------------------------*/
+/* Pre-VxWorks7 configuration. */
+/*-------------------------------------------------------------*/
+
+#if !TARGET_VXWORKS7
#undef RS6000_STARTING_FRAME_OFFSET
#define RS6000_STARTING_FRAME_OFFSET \
@@ -146,21 +202,79 @@ VXWORKS_ADDITIONAL_CPP_SPEC
RS6000_ALIGN (crtl->outgoing_args_size.to_constant () \
+ STACK_POINTER_OFFSET, 16)
-#undef SUBSUBTARGET_OVERRIDE_OPTIONS
-#define SUBSUBTARGET_OVERRIDE_OPTIONS \
- do { \
- if (!global_options_set.x_g_switch_value) \
- g_switch_value = SDATA_DEFAULT_SIZE; \
- VXWORKS_OVERRIDE_OPTIONS; \
- } while (0)
+/* Enforce 16-byte alignment for the stack pointer, to permit general
+ compliance with e.g. Altivec instructions requirements. Make sure
+ this isn't overruled by the EABI constraints. */
-/* No _mcount profiling on VxWorks. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
+#undef STACK_BOUNDARY
+#define STACK_BOUNDARY (16*BITS_PER_UNIT)
-/* Define this to be nonzero if static stack checking is supported. */
-#define STACK_CHECK_STATIC_BUILTIN 1
+#undef PREFERRED_STACK_BOUNDARY
+#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
+
+#undef ABI_STACK_BOUNDARY
+
+#undef STARTFILE_PREFIX_SPEC
+#define STARTFILE_PREFIX_SPEC \
+ "%{mrtp:%{!shared:%:getenv(WIND_BASE /target/lib/usr/lib/ppc/PPC32/common)}}"
+
+/* For aggregates passing, use the same, consistent ABI as Linux. */
+#define AGGREGATE_PADDING_FIXED 0
+#define AGGREGATES_PAD_UPWARD_ALWAYS 0
+
+#undef ASM_SPEC
+#define ASM_SPEC \
+"%(asm_cpu) \
+ %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
+ %{mrelocatable} %{mrelocatable-lib} %{" FPIC_SPEC ":-K PIC} -mbig"
+
+#undef CC1_SPEC
+#define CC1_SPEC VXWORKS_CC1_SPEC " \
+ %{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default} \
+ %{mlittle|mlittle-endian:-mstrict-align}"
+
+#undef LINK_SPEC
+#define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_EABI | MASK_STRICT_ALIGN)
+
+#undef PROCESSOR_DEFAULT
+#define PROCESSOR_DEFAULT PROCESSOR_PPC604
+
+/* Only big endian PPC is supported by VxWorks. */
+#undef BYTES_BIG_ENDIAN
+#define BYTES_BIG_ENDIAN 1
+
+#undef WORDS_BIG_ENDIAN
+#define WORDS_BIG_ENDIAN 1
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS /* none needed */
+
+#else /* TARGET_VXWORKS7 */
+
+/*-------------------------------------------------------------*/
+/* Post-VxWorks7 (SR600) configuration. */
+/*-------------------------------------------------------------*/
+
+/* VxWorks does not use local symbols for the function entry point. */
+#undef DOT_SYMBOLS
+#define DOT_SYMBOLS 0
+
+#undef LINK_OS_VXWORKS_SPEC
+#define LINK_OS_VXWORKS_SPEC \
+ " %{!mrtp:-r} %{mrtp:-q -static} %{!Xbind-lazy:-z now}"
+
+#undef LINK_OS_EXTRA_SPEC32
+#define LINK_OS_EXTRA_SPEC32 LINK_OS_VXWORKS_SPEC " " VXWORKS_RELAX_LINK_SPEC
+
+#undef LINK_OS_EXTRA_SPEC64
+#define LINK_OS_EXTRA_SPEC64 LINK_OS_VXWORKS_SPEC
+
+/* linux64.h enables this, not supported in vxWorks. */
+#undef TARGET_FLOAT128_ENABLE_TYPE
+#define TARGET_FLOAT128_ENABLE_TYPE 0
+
+#endif /* TARGET_VXWORKS7 */
-/* This platform supports the probing method of stack checking (RTP mode).
- 8K is reserved in the stack to propagate exceptions in case of overflow. */
-#define STACK_CHECK_PROTECT 8192
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 6f1bc07..029f728 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -121,6 +121,7 @@ extern void s390_expand_vec_compare_cc (rtx, enum rtx_code, rtx, rtx, bool);
extern enum rtx_code s390_reverse_condition (machine_mode, enum rtx_code);
extern void s390_expand_vcond (rtx, rtx, rtx, enum rtx_code, rtx, rtx);
extern void s390_expand_vec_init (rtx, rtx);
+extern rtx s390_build_signbit_mask (machine_mode);
extern rtx s390_return_addr_rtx (int, rtx);
extern rtx s390_back_chain_rtx (void);
extern rtx_insn *s390_emit_call (rtx, rtx, rtx, rtx);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index c762840..f9b27f9 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -2467,6 +2467,9 @@ s390_contiguous_bitmask_vector_p (rtx op, int *start, int *end)
rtx elt;
bool b;
+ /* Handle floats by bitcasting them to ints. */
+ op = gen_lowpart (related_int_vector_mode (GET_MODE (op)).require (), op);
+
gcc_assert (!!start == !!end);
if (!const_vec_duplicate_p (op, &elt)
|| !CONST_INT_P (elt))
@@ -5952,6 +5955,7 @@ s390_expand_vec_strlen (rtx target, rtx string, rtx alignment)
rtx temp;
rtx len = gen_reg_rtx (QImode);
rtx cond;
+ rtx mem;
s390_load_address (str_addr_base_reg, XEXP (string, 0));
emit_move_insn (str_idx_reg, const0_rtx);
@@ -5993,10 +5997,10 @@ s390_expand_vec_strlen (rtx target, rtx string, rtx alignment)
LABEL_NUSES (loop_start_label) = 1;
/* Load 16 bytes of the string into VR. */
- emit_move_insn (str_reg,
- gen_rtx_MEM (V16QImode,
- gen_rtx_PLUS (Pmode, str_idx_reg,
- str_addr_base_reg)));
+ mem = gen_rtx_MEM (V16QImode,
+ gen_rtx_PLUS (Pmode, str_idx_reg, str_addr_base_reg));
+ set_mem_align (mem, 128);
+ emit_move_insn (str_reg, mem);
if (into_loop_label != NULL_RTX)
{
emit_label (into_loop_label);
@@ -6863,15 +6867,16 @@ s390_expand_vec_init (rtx target, rtx vals)
}
/* Use vector gen mask or vector gen byte mask if possible. */
- if (all_same && all_const_int
- && (XVECEXP (vals, 0, 0) == const0_rtx
- || s390_contiguous_bitmask_vector_p (XVECEXP (vals, 0, 0),
- NULL, NULL)
- || s390_bytemask_vector_p (XVECEXP (vals, 0, 0), NULL)))
+ if (all_same && all_const_int)
{
- emit_insn (gen_rtx_SET (target,
- gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0))));
- return;
+ rtx vec = gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0));
+ if (XVECEXP (vals, 0, 0) == const0_rtx
+ || s390_contiguous_bitmask_vector_p (vec, NULL, NULL)
+ || s390_bytemask_vector_p (vec, NULL))
+ {
+ emit_insn (gen_rtx_SET (target, vec));
+ return;
+ }
}
/* Use vector replicate instructions. vlrep/vrepi/vrep */
@@ -6949,6 +6954,30 @@ s390_expand_vec_init (rtx target, rtx vals)
}
}
+/* Emit a vector constant that contains 1s in each element's sign bit position
+ and 0s in other positions. MODE is the desired constant's mode. */
+extern rtx
+s390_build_signbit_mask (machine_mode mode)
+{
+ /* Generate the integral element mask value. */
+ machine_mode inner_mode = GET_MODE_INNER (mode);
+ int inner_bitsize = GET_MODE_BITSIZE (inner_mode);
+ wide_int mask_val = wi::set_bit_in_zero (inner_bitsize - 1, inner_bitsize);
+
+ /* Emit the element mask rtx. Use gen_lowpart in order to cast the integral
+ value to the desired mode. */
+ machine_mode int_mode = related_int_vector_mode (mode).require ();
+ rtx mask = immed_wide_int_const (mask_val, GET_MODE_INNER (int_mode));
+ mask = gen_lowpart (inner_mode, mask);
+
+ /* Emit the vector mask rtx by mode the element mask rtx. */
+ int nunits = GET_MODE_NUNITS (mode);
+ rtvec v = rtvec_alloc (nunits);
+ for (int i = 0; i < nunits; i++)
+ RTVEC_ELT (v, i) = mask;
+ return gen_rtx_CONST_VECTOR (mode, v);
+}
+
/* Structure to hold the initial parameters for a compare_and_swap operation
in HImode and QImode. */
@@ -16082,12 +16111,13 @@ s390_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
fenv_var = __builtin_s390_efpc ();
__builtin_s390_sfpc (fenv_var & mask) */
- tree old_fpc = build2 (MODIFY_EXPR, unsigned_type_node, fenv_var, call_efpc);
- tree new_fpc =
- build2 (BIT_AND_EXPR, unsigned_type_node, fenv_var,
- build_int_cst (unsigned_type_node,
- ~(FPC_DXC_MASK | FPC_FLAGS_MASK |
- FPC_EXCEPTION_MASK)));
+ tree old_fpc = build4 (TARGET_EXPR, unsigned_type_node, fenv_var, call_efpc,
+ NULL_TREE, NULL_TREE);
+ tree new_fpc
+ = build2 (BIT_AND_EXPR, unsigned_type_node, fenv_var,
+ build_int_cst (unsigned_type_node,
+ ~(FPC_DXC_MASK | FPC_FLAGS_MASK
+ | FPC_EXCEPTION_MASK)));
tree set_new_fpc = build_call_expr (sfpc, 1, new_fpc);
*hold = build2 (COMPOUND_EXPR, void_type_node, old_fpc, set_new_fpc);
@@ -16106,8 +16136,8 @@ s390_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
__atomic_feraiseexcept ((old_fpc & FPC_FLAGS_MASK) >> FPC_FLAGS_SHIFT); */
old_fpc = create_tmp_var_raw (unsigned_type_node);
- tree store_old_fpc = build2 (MODIFY_EXPR, void_type_node,
- old_fpc, call_efpc);
+ tree store_old_fpc = build4 (TARGET_EXPR, void_type_node, old_fpc, call_efpc,
+ NULL_TREE, NULL_TREE);
set_new_fpc = build_call_expr (sfpc, 1, fenv_var);
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 4c3e540..18edea1 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -1391,23 +1391,55 @@
; (TF|DF|SF|TD|DD|SD) instructions
-; FIXME: load and test instructions turn SNaN into QNaN what is not
-; acceptable if the target will be used afterwards. On the other hand
-; they are quite convenient for implementing comparisons with 0.0. So
-; try to enable them via splitter/peephole if the value isn't needed anymore.
-; See testcases: load-and-test-fp-1.c and load-and-test-fp-2.c
+; load and test instructions turn a signaling NaN into a quiet NaN. Thus they
+; may only be used if the target register is dead afterwards or if fast math
+; is enabled. The former is done via a peephole optimization. Note, load and
+; test instructions may only be used for (in)equality comparisons because
+; relational comparisons must treat a quiet NaN like a signaling NaN which is
+; not the case for load and test instructions. For fast math insn
+; "cmp<mode>_ccs_0_fastmath" applies.
+; See testcases load-and-test-fp-{1,2}.c
+
+(define_peephole2
+ [(set (match_operand:FP 0 "register_operand")
+ (match_operand:FP 1 "const0_operand"))
+ (set (reg:CCZ CC_REGNUM)
+ (compare:CCZ (match_operand:FP 2 "register_operand")
+ (match_operand:FP 3 "register_operand")))]
+ "TARGET_HARD_FLOAT
+ && FP_REG_P (operands[2])
+ && REGNO (operands[0]) == REGNO (operands[3])
+ && peep2_reg_dead_p (2, operands[0])
+ && peep2_reg_dead_p (2, operands[2])"
+ [(parallel
+ [(set (reg:CCZ CC_REGNUM)
+ (compare:CCZ (match_dup 2) (match_dup 1)))
+ (clobber (match_dup 2))])]
+ "")
; ltxbr, ltdbr, ltebr, ltxtr, ltdtr
-(define_insn "*cmp<mode>_ccs_0"
- [(set (reg CC_REGNUM)
- (compare (match_operand:FP 0 "register_operand" "f")
- (match_operand:FP 1 "const0_operand" "")))
- (clobber (match_operand:FP 2 "register_operand" "=0"))]
- "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT"
+(define_insn "*cmp<mode>_ccz_0"
+ [(set (reg:CCZ CC_REGNUM)
+ (compare:CCZ (match_operand:FP 0 "register_operand" "f")
+ (match_operand:FP 1 "const0_operand")))
+ (clobber (match_operand:FP 2 "register_operand" "=0"))]
+ "TARGET_HARD_FLOAT"
"lt<xde><bt>r\t%0,%0"
[(set_attr "op_type" "RRE")
(set_attr "type" "fsimp<mode>")])
+(define_insn "*cmp<mode>_ccs_0_fastmath"
+ [(set (reg CC_REGNUM)
+ (compare (match_operand:FP 0 "register_operand" "f")
+ (match_operand:FP 1 "const0_operand")))]
+ "s390_match_ccmode (insn, CCSmode)
+ && TARGET_HARD_FLOAT
+ && !flag_trapping_math
+ && !flag_signaling_nans"
+ "lt<xde><bt>r\t%0,%0"
+ [(set_attr "op_type" "RRE")
+ (set_attr "type" "fsimp<mode>")])
+
; VX: TFmode in FPR pairs: use cxbr instead of wfcxb
; cxtr, cdtr, cxbr, cdbr, cebr, cdb, ceb, wfcsb, wfcdb
(define_insn "*cmp<mode>_ccs"
diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md
index 2573b7d..3c01cd1 100644
--- a/gcc/config/s390/vector.md
+++ b/gcc/config/s390/vector.md
@@ -1425,35 +1425,45 @@
; Vector copysign, implement using vector select
(define_expand "copysign<mode>3"
- [(set (match_operand:VFT 0 "register_operand" "")
- (if_then_else:VFT
- (eq (match_dup 3)
- (match_dup 4))
- (match_operand:VFT 1 "register_operand" "")
- (match_operand:VFT 2 "register_operand" "")))]
+ [(set (match_operand:VFT 0 "register_operand" "")
+ (ior:VFT
+ (and:VFT (match_operand:VFT 2 "register_operand" "")
+ (match_dup 3))
+ (and:VFT (not:VFT (match_dup 3))
+ (match_operand:VFT 1 "register_operand" ""))))]
"TARGET_VX"
{
- int sz = GET_MODE_BITSIZE (GET_MODE_INNER (<MODE>mode));
- int prec = GET_MODE_PRECISION (GET_MODE_INNER (<tointvec>mode));
- wide_int mask_val = wi::shwi (1l << (sz - 1), prec);
-
- rtx mask = gen_reg_rtx (<tointvec>mode);
-
- int nunits = GET_MODE_NUNITS (<tointvec>mode);
- rtvec v = rtvec_alloc (nunits);
- for (int i = 0; i < nunits; i++)
- RTVEC_ELT (v, i) = GEN_INT (mask_val.to_shwi ());
-
- mask = gen_rtx_CONST_VECTOR (<tointvec>mode, v);
- operands[3] = force_reg (<tointvec>mode, mask);
- operands[4] = CONST0_RTX (<tointvec>mode);
+ rtx mask = s390_build_signbit_mask (<MODE>mode);
+ operands[3] = force_reg (<MODE>mode, mask);
})
;;
;; Integer compares
;;
-(define_insn "*vec_cmp<VICMP_HW_OP:code><VI:mode>_nocc"
+(define_expand "vec_cmp<VI_HW:mode><VI_HW:mode>"
+ [(set (match_operand:VI_HW 0 "register_operand" "")
+ (match_operator:VI_HW 1 ""
+ [(match_operand:VI_HW 2 "register_operand" "")
+ (match_operand:VI_HW 3 "register_operand" "")]))]
+ "TARGET_VX"
+{
+ s390_expand_vec_compare (operands[0], GET_CODE(operands[1]), operands[2], operands[3]);
+ DONE;
+})
+
+(define_expand "vec_cmpu<VI_HW:mode><VI_HW:mode>"
+ [(set (match_operand:VI_HW 0 "register_operand" "")
+ (match_operator:VI_HW 1 ""
+ [(match_operand:VI_HW 2 "register_operand" "")
+ (match_operand:VI_HW 3 "register_operand" "")]))]
+ "TARGET_VX"
+{
+ s390_expand_vec_compare (operands[0], GET_CODE(operands[1]), operands[2], operands[3]);
+ DONE;
+})
+
+(define_insn "*vec_cmp<VICMP_HW_OP:code><VI:mode><VI:mode>_nocc"
[(set (match_operand:VI 2 "register_operand" "=v")
(VICMP_HW_OP:VI (match_operand:VI 0 "register_operand" "v")
(match_operand:VI 1 "register_operand" "v")))]
diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks
index fd1fbfd..221f53c 100644
--- a/gcc/config/t-vxworks
+++ b/gcc/config/t-vxworks
@@ -59,7 +59,7 @@ stmp-int-hdrs: subst-glimits.h
subst-%.h:
cp -p $(srcdir)/$*.h orig-$*.h
ID=$$(echo $(BASEVER_c) | sed -e 's/\./_/g'); \
- sed -e "s/_LIMITS_H__/_LIMITS_H_$${ID}_/" < $(srcdir)/$*.h > $@
+ sed -e "s/_LIMITS_H__/_LIMITS_H__$${ID}_/" < $(srcdir)/$*.h > $@
cp $@ $(srcdir)/$*.h
# Then arrange to restore the original versions after the standard
diff --git a/gcc/config/vx-common.h b/gcc/config/vx-common.h
index f4a1ffd..9cd7b3d 100644
--- a/gcc/config/vx-common.h
+++ b/gcc/config/vx-common.h
@@ -23,8 +23,6 @@ along with GCC; see the file COPYING3. If not see
/* Most of these will probably be overridden by subsequent headers. We
undefine them here just in case, and define VXWORKS_ versions of each,
to be used in port-specific vxworks.h. */
-#undef LIB_SPEC
-#undef LINK_SPEC
#undef LIBGCC_SPEC
#define LIBGCC_SPEC VXWORKS_LIBGCC_SPEC
#undef STARTFILE_SPEC
diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c
index 970d504..ca0f5de 100644
--- a/gcc/config/vxworks.c
+++ b/gcc/config/vxworks.c
@@ -154,8 +154,10 @@ vxworks_override_options (void)
targetm.have_ctors_dtors =
TARGET_VXWORKS_HAVE_CTORS_DTORS || HAVE_INITFINI_ARRAY_SUPPORT;
- /* PIC is only supported for RTPs. */
- if (flag_pic && !TARGET_VXWORKS_RTP)
+ /* PIC is only supported for RTPs. flags_pic might be < 0 here, in
+ contexts where the corresponding switches are not processed,
+ e.g. from --help. We are not generating code in such cases. */
+ if (flag_pic > 0 && !TARGET_VXWORKS_RTP)
error ("PIC is only supported for RTPs");
/* VxWorks comes with non-gdb debuggers which only support strict
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index e50260b0..b7e5970 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -70,6 +70,12 @@ along with GCC; see the file COPYING3. If not see
#endif
+/* Our ports rely on gnu-user.h, which #defines _POSIX_SOURCE for
+ C++ by default. VxWorks doesn't provide 100% of what this implies
+ (e.g. ::mkstemp), so, arrange to prevent that by falling back to
+ the default CPP spec for C++ as well. */
+#undef CPLUSPLUS_CPP_SPEC
+
/* For VxWorks static rtps, the system provides libc_internal.a, a superset of
libgcc.a that we need to use e.g. to satisfy references to __init and
__fini. We still want our libgcc to prevail for symbols it would provide
@@ -84,7 +90,7 @@ along with GCC; see the file COPYING3. If not see
#define VXWORKS_SYSCALL_LIBS_RTP
#if TARGET_VXWORKS7
-#define VXWORKS_NET_LIBS_RTP "-lnet"
+#define VXWORKS_NET_LIBS_RTP "-l%:if-exists-then-else(%:getenv(VSB_DIR /usr/h/public/rtnetStackLib.h) rtnet net)"
#else
#define VXWORKS_NET_LIBS_RTP "-lnet -ldsi"
#endif
@@ -152,8 +158,7 @@ along with GCC; see the file COPYING3. If not see
/* Setup the crtstuff begin/end we might need for dwarf EH registration. */
#if !defined(CONFIG_SJLJ_EXCEPTIONS) && DWARF2_UNWIND_INFO
-#define VX_CRTBEGIN_SPEC \
- "%{!mrtp:vx_crtbegin-kernel.o%s} %{mrtp:vx_crtbegin-rtp.o%s}"
+#define VX_CRTBEGIN_SPEC "vx_crtbegin.o%s"
#define VX_CRTEND_SPEC "-l:vx_crtend.o"
#else
#define VX_CRTBEGIN_SPEC ""
diff --git a/gcc/config/vxworks/_vxworks-versions.h b/gcc/config/vxworks/_vxworks-versions.h
index 0aaf547..15e8bfe 100644
--- a/gcc/config/vxworks/_vxworks-versions.h
+++ b/gcc/config/vxworks/_vxworks-versions.h
@@ -22,17 +22,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef _VXWORKS_VERSIONS_H
#define _VXWORKS_VERSIONS_H 1
-/* All we need is access to the bare _WRS_VXWORKS_MAJOR/MINOR macros
- exposed by version.h. Cheat a bit to make sure we don't drag additional
- header files, which can easily cause #include ordering nightmares. */
+/* All we need is access to the bare _WRS_VXWORKS_MAJOR/MINOR macros,
+ exposed by version.h or already provided somehow (e.g. with a self
+ spec for some reason). When resorting to system headers, cheat a
+ bit to make sure we don't drag additional header files, which can
+ easily cause #include ordering nightmares. */
+#if !defined(_WRS_VXWORKS_MAJOR)
#pragma push_macro("_WRS_KERNEL")
#undef _WRS_KERNEL
#include <version.h>
#pragma pop_macro("_WRS_KERNEL")
+#endif
+
+/* A lot depends on the MAJOR so we really need to make sure we have
+ that. MINOR is less critical and many environments don't actually
+ define it unless it is really meaningful (e.g. 6.4 through 6.9). */
#if !defined(_WRS_VXWORKS_MAJOR)
-#error "VxWorks version macros needed but not defined"
+#error "_WRS_VXWORKS_MAJOR undefined"
+#endif
+
+#if !defined(_WRS_VXWORKS_MINOR)
+#define _WRS_VXWORKS_MINOR 0
#endif
#define _VXWORKS_MAJOR_GT(MAJOR) (_WRS_VXWORKS_MAJOR > (MAJOR))
diff --git a/gcc/configure b/gcc/configure
index 0a09777..f96a89e 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -10022,9 +10022,14 @@ $as_echo_n "checking for zstd.h... " >&6; }
if ${gcc_cv_header_zstd_h+:} false; then :
$as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ # We require version 1.3.0 or later. This is the first version that has
+# ZSTD_getFrameContentSize.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10300
+#error "need zstd 1.3.0 or better"
+#endif
int
main ()
{
@@ -10120,7 +10125,7 @@ fi
for ac_func in times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap setlocale \
- clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo
+ clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -11549,7 +11554,7 @@ fi
done
-for ac_func in mallinfo
+for ac_func in mallinfo mallinfo2
do
ac_tr_decl=`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is declared" >&5
@@ -19013,7 +19018,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19016 "configure"
+#line 19021 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19119,7 +19124,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19122 "configure"
+#line 19127 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -28470,6 +28475,414 @@ $as_echo "#define HAVE_AS_GDWARF2_DEBUG_FLAG 1" >>confdefs.h
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for --gdwarf-5 option" >&5
+$as_echo_n "checking assembler for --gdwarf-5 option... " >&6; }
+if ${gcc_cv_as_gdwarf_5_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_gdwarf_5_flag=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0`
+ then gcc_cv_as_gdwarf_5_flag=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ $as_echo "$insn" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf-5 -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_gdwarf_5_flag=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gdwarf_5_flag" >&5
+$as_echo "$gcc_cv_as_gdwarf_5_flag" >&6; }
+if test $gcc_cv_as_gdwarf_5_flag = yes; then
+
+$as_echo "#define HAVE_AS_GDWARF_5_DEBUG_FLAG 1" >>confdefs.h
+
+fi
+
+
+ dwarf4_debug_info_size=0x46
+ dwarf4_high_pc_form=7
+ dwarf4_debug_aranges_size=0x2c
+ dwarf4_line_sz=9
+ for dwarf4_addr_size in 8 4; do
+ conftest_s="\
+ .file \"a.c\"
+ .text
+.Ltext0:
+ .p2align 4
+ .globl foo
+ .type foo, %function
+foo:
+.LFB0:
+.LM1:
+ $insn
+.LM2:
+.LFE0:
+ .size foo, .-foo
+.Letext0:
+ .section .debug_info,\"\",%progbits
+.Ldebug_info0:
+ .4byte $dwarf4_debug_info_size
+ .2byte 0x4
+ .4byte .Ldebug_abbrev0
+ .byte 0x$dwarf4_addr_size
+ .byte 0x1
+ .ascii \"GNU C17\\0\"
+ .byte 0xc
+ .ascii \"a.c\\0\"
+ .ascii \"/\\0\"
+ .${dwarf4_addr_size}byte .Ltext0
+ .${dwarf4_addr_size}byte .Letext0-.Ltext0
+ .4byte .Ldebug_line0
+ .byte 0x2
+ .ascii \"foo\\0\"
+ .byte 0x1
+ .byte 0x2
+ .byte 0x1
+ .${dwarf4_addr_size}byte .LFB0
+ .${dwarf4_addr_size}byte .LFE0-.LFB0
+ .byte 0x1
+ .byte 0x9c
+ .byte 0
+ .section .debug_abbrev,\"\",%progbits
+.Ldebug_abbrev0:
+ .byte 0x1
+ .byte 0x11
+ .byte 0x1
+ .byte 0x25
+ .byte 0x8
+ .byte 0x13
+ .byte 0xb
+ .byte 0x3
+ .byte 0x8
+ .byte 0x1b
+ .byte 0x8
+ .byte 0x11
+ .byte 0x1
+ .byte 0x12
+ .byte 0x$dwarf4_high_pc_form
+ .byte 0x10
+ .byte 0x17
+ .byte 0
+ .byte 0
+ .byte 0x2
+ .byte 0x2e
+ .byte 0
+ .byte 0x3f
+ .byte 0x19
+ .byte 0x3
+ .byte 0x8
+ .byte 0x3a
+ .byte 0xb
+ .byte 0x3b
+ .byte 0xb
+ .byte 0x39
+ .byte 0xb
+ .byte 0x11
+ .byte 0x1
+ .byte 0x12
+ .byte 0x$dwarf4_high_pc_form
+ .byte 0x40
+ .byte 0x18
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,\"\",%progbits
+ .4byte $dwarf4_debug_aranges_size
+ .2byte 0x2
+ .4byte .Ldebug_info0
+ .byte 0x8
+ .byte 0
+ .2byte 0
+ .2byte 0
+ .${dwarf4_addr_size}byte .Ltext0
+ .${dwarf4_addr_size}byte .Letext0-.Ltext0
+ .${dwarf4_addr_size}byte 0
+ .${dwarf4_addr_size}byte 0
+ .section .debug_line,\"\",%progbits
+.Ldebug_line0:
+ .4byte .LELT0-.LSLT0
+.LSLT0:
+ .2byte 0x4
+ .4byte .LELTP0-.LASLTP0
+.LASLTP0:
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0xf6
+ .byte 0xf2
+ .byte 0xd
+ .byte 0
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 0x1
+ .byte 0
+ .byte 0
+ .byte 0x1
+ .byte 0
+ .ascii \"a.c\\0\"
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 0
+.LELTP0:
+ .byte 0
+ .byte 0x$dwarf4_line_sz
+ .byte 0x2
+ .${dwarf4_addr_size}byte .LM1
+ .byte 0x18
+ .byte 0x5
+ .byte 0x1
+ .byte 0
+ .byte 0x$dwarf4_line_sz
+ .byte 0x2
+ .${dwarf4_addr_size}byte .LM2
+ .byte 0x1
+ .byte 0x5
+ .byte 0x1
+ .byte 0
+ .byte 0x$dwarf4_line_sz
+ .byte 0x2
+ .${dwarf4_addr_size}byte .Letext0
+ .byte 0
+ .byte 0x1
+ .byte 0x1
+.LELT0:
+ .section .debug_str,\"\",%progbits
+ .ident \"GCC\"
+"
+ dwarf4_success=no
+ if test $dwarf4_addr_size = 4; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembly of compiler generated 32-bit .debug_line" >&5
+$as_echo_n "checking assembler for assembly of compiler generated 32-bit .debug_line... " >&6; }
+if ${gcc_cv_as_debug_line_32_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_debug_line_32_flag=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0`
+ then gcc_cv_as_debug_line_32_flag=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ $as_echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_debug_line_32_flag=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_debug_line_32_flag" >&5
+$as_echo "$gcc_cv_as_debug_line_32_flag" >&6; }
+if test $gcc_cv_as_debug_line_32_flag = yes; then
+ dwarf4_success=yes
+fi
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for assembly of compiler generated 64-bit .debug_line" >&5
+$as_echo_n "checking assembler for assembly of compiler generated 64-bit .debug_line... " >&6; }
+if ${gcc_cv_as_debug_line_64_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_debug_line_64_flag=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0`
+ then gcc_cv_as_debug_line_64_flag=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ $as_echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_debug_line_64_flag=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_debug_line_64_flag" >&5
+$as_echo "$gcc_cv_as_debug_line_64_flag" >&6; }
+if test $gcc_cv_as_debug_line_64_flag = yes; then
+ dwarf4_success=yes
+fi
+
+ fi
+ if test $dwarf4_success = yes; then
+ dwarf4_success=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for --gdwarf-4 not refusing compiler generated .debug_line" >&5
+$as_echo_n "checking assembler for --gdwarf-4 not refusing compiler generated .debug_line... " >&6; }
+if ${gcc_cv_as_dwarf_4_debug_line_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_dwarf_4_debug_line_flag=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 36 \) \* 1000 + 0`
+ then gcc_cv_as_dwarf_4_debug_line_flag=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ $as_echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf-4 -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_dwarf_4_debug_line_flag=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_dwarf_4_debug_line_flag" >&5
+$as_echo "$gcc_cv_as_dwarf_4_debug_line_flag" >&6; }
+if test $gcc_cv_as_dwarf_4_debug_line_flag = yes; then
+ dwarf4_success=yes
+fi
+
+ break
+ fi
+ dwarf4_debug_info_size=0x36
+ dwarf4_high_pc_form=6
+ dwarf4_debug_aranges_size=0x1c
+ dwarf4_line_sz=5
+ done
+
+ if test $dwarf4_success = yes; then
+ conftest_s="\
+ .file \"foo.c\"
+ .text
+bar:
+#APP
+# 82 \"xxx.h\" 1
+ $insn
+# 0 \"\" 2
+#NO_APP
+ $insn
+foo:
+ .file 1 \"foo.c\"
+ $insn
+ .file 2 \"foo.h\"
+ ret
+"
+ dwarf4_success=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for --gdwarf-4 with the APP marker" >&5
+$as_echo_n "checking assembler for --gdwarf-4 with the APP marker... " >&6; }
+if ${gcc_cv_as_dwarf_4_app_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_dwarf_4_app_flag=no
+ if test x$gcc_cv_as != x; then
+ $as_echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf-4 -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_dwarf_4_app_flag=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_dwarf_4_app_flag" >&5
+$as_echo "$gcc_cv_as_dwarf_4_app_flag" >&6; }
+if test $gcc_cv_as_dwarf_4_app_flag = yes; then
+ dwarf4_success=yes
+fi
+
+ fi
+
+ if test $dwarf4_success = yes; then
+ conftest_s="\
+ .text
+ .globl foo
+ .type foo, %function
+foo:
+ $insn
+ .size foo, .-foo
+ .file 1 \"foo.c\"
+"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for working --gdwarf-4/--gdwarf-5 for all sources" >&5
+$as_echo_n "checking assembler for working --gdwarf-4/--gdwarf-5 for all sources... " >&6; }
+if ${gcc_cv_as_working_gdwarf_n_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_working_gdwarf_n_flag=no
+ if test x$gcc_cv_as != x; then
+ $as_echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags --gdwarf-4 -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ if test x$gcc_cv_readelf != x \
+ && $gcc_cv_readelf -w conftest.o 2>&1 \
+ | grep conftest.s > /dev/null 2>&1; then
+ gcc_cv_as_working_gdwarf_n_flag=no
+ else
+ gcc_cv_as_working_gdwarf_n_flag=yes
+ fi
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_working_gdwarf_n_flag" >&5
+$as_echo "$gcc_cv_as_working_gdwarf_n_flag" >&6; }
+
+
+ if test $gcc_cv_as_working_gdwarf_n_flag = yes; then
+
+$as_echo "#define HAVE_AS_WORKING_DWARF_N_FLAG 1" >>confdefs.h
+
+ fi
+ fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for --gstabs option" >&5
$as_echo_n "checking assembler for --gstabs option... " >&6; }
if ${gcc_cv_as_gstabs_flag+:} false; then :
@@ -29892,7 +30305,7 @@ supported if the default cpu is power7 or newer" "$LINENO" 5
;;
esac
;;
- xpowerpc64*-*-linux*:*)
+ powerpc64*-*-linux*:*)
as_fn_error $? "--with-long-double-format argument should be ibm or ieee" "$LINENO" 5
with_long_double_format=""
;;
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6a233a3c..9154a54 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1376,8 +1376,13 @@ LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
AC_MSG_CHECKING(for zstd.h)
AC_CACHE_VAL(gcc_cv_header_zstd_h,
+# We require version 1.3.0 or later. This is the first version that has
+# ZSTD_getFrameContentSize.
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-[[#include <zstd.h>]])],
+[[#include <zstd.h>
+#if ZSTD_VERSION_NUMBER < 10300
+#error "need zstd 1.3.0 or better"
+#endif]])],
[gcc_cv_header_zstd_h=yes],
[gcc_cv_header_zstd_h=no])])
AC_MSG_RESULT($gcc_cv_header_zstd_h)
@@ -1408,7 +1413,7 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap setlocale \
- gcc_UNLOCKED_FUNCS madvise mallinfo)
+ gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2)
if test x$ac_cv_func_mbstowcs = xyes; then
AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
@@ -1488,7 +1493,7 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
#endif
])
-gcc_AC_CHECK_DECLS(mallinfo, , ,[
+gcc_AC_CHECK_DECLS(mallinfo mallinfo2, , ,[
#include "ansidecl.h"
#include "system.h"
#ifdef HAVE_MALLOC_H
@@ -5192,6 +5197,247 @@ if test x"$insn" != x; then
[AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1,
[Define if your assembler supports the --gdwarf2 option.])])
+ gcc_GAS_CHECK_FEATURE([--gdwarf-5 option],
+ gcc_cv_as_gdwarf_5_flag,
+ [elf,2,36,0], [--gdwarf-5], [$insn],,
+ [AC_DEFINE(HAVE_AS_GDWARF_5_DEBUG_FLAG, 1,
+[Define if your assembler supports the --gdwarf-5 option.])])
+
+ dwarf4_debug_info_size=0x46
+ dwarf4_high_pc_form=7
+ dwarf4_debug_aranges_size=0x2c
+ dwarf4_line_sz=9
+ for dwarf4_addr_size in 8 4; do
+ conftest_s="\
+ .file \"a.c\"
+ .text
+.Ltext0:
+ .p2align 4
+ .globl foo
+ .type foo, %function
+foo:
+.LFB0:
+.LM1:
+ $insn
+.LM2:
+.LFE0:
+ .size foo, .-foo
+.Letext0:
+ .section .debug_info,\"\",%progbits
+.Ldebug_info0:
+ .4byte $dwarf4_debug_info_size
+ .2byte 0x4
+ .4byte .Ldebug_abbrev0
+ .byte 0x$dwarf4_addr_size
+ .byte 0x1
+ .ascii \"GNU C17\\0\"
+ .byte 0xc
+ .ascii \"a.c\\0\"
+ .ascii \"/\\0\"
+ .${dwarf4_addr_size}byte .Ltext0
+ .${dwarf4_addr_size}byte .Letext0-.Ltext0
+ .4byte .Ldebug_line0
+ .byte 0x2
+ .ascii \"foo\\0\"
+ .byte 0x1
+ .byte 0x2
+ .byte 0x1
+ .${dwarf4_addr_size}byte .LFB0
+ .${dwarf4_addr_size}byte .LFE0-.LFB0
+ .byte 0x1
+ .byte 0x9c
+ .byte 0
+ .section .debug_abbrev,\"\",%progbits
+.Ldebug_abbrev0:
+ .byte 0x1
+ .byte 0x11
+ .byte 0x1
+ .byte 0x25
+ .byte 0x8
+ .byte 0x13
+ .byte 0xb
+ .byte 0x3
+ .byte 0x8
+ .byte 0x1b
+ .byte 0x8
+ .byte 0x11
+ .byte 0x1
+ .byte 0x12
+ .byte 0x$dwarf4_high_pc_form
+ .byte 0x10
+ .byte 0x17
+ .byte 0
+ .byte 0
+ .byte 0x2
+ .byte 0x2e
+ .byte 0
+ .byte 0x3f
+ .byte 0x19
+ .byte 0x3
+ .byte 0x8
+ .byte 0x3a
+ .byte 0xb
+ .byte 0x3b
+ .byte 0xb
+ .byte 0x39
+ .byte 0xb
+ .byte 0x11
+ .byte 0x1
+ .byte 0x12
+ .byte 0x$dwarf4_high_pc_form
+ .byte 0x40
+ .byte 0x18
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,\"\",%progbits
+ .4byte $dwarf4_debug_aranges_size
+ .2byte 0x2
+ .4byte .Ldebug_info0
+ .byte 0x8
+ .byte 0
+ .2byte 0
+ .2byte 0
+ .${dwarf4_addr_size}byte .Ltext0
+ .${dwarf4_addr_size}byte .Letext0-.Ltext0
+ .${dwarf4_addr_size}byte 0
+ .${dwarf4_addr_size}byte 0
+ .section .debug_line,\"\",%progbits
+.Ldebug_line0:
+ .4byte .LELT0-.LSLT0
+.LSLT0:
+ .2byte 0x4
+ .4byte .LELTP0-.LASLTP0
+.LASLTP0:
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0xf6
+ .byte 0xf2
+ .byte 0xd
+ .byte 0
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0x1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 0x1
+ .byte 0
+ .byte 0
+ .byte 0x1
+ .byte 0
+ .ascii \"a.c\\0\"
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 0
+.LELTP0:
+ .byte 0
+ .byte 0x$dwarf4_line_sz
+ .byte 0x2
+ .${dwarf4_addr_size}byte .LM1
+ .byte 0x18
+ .byte 0x5
+ .byte 0x1
+ .byte 0
+ .byte 0x$dwarf4_line_sz
+ .byte 0x2
+ .${dwarf4_addr_size}byte .LM2
+ .byte 0x1
+ .byte 0x5
+ .byte 0x1
+ .byte 0
+ .byte 0x$dwarf4_line_sz
+ .byte 0x2
+ .${dwarf4_addr_size}byte .Letext0
+ .byte 0
+ .byte 0x1
+ .byte 0x1
+.LELT0:
+ .section .debug_str,\"\",%progbits
+ .ident \"GCC\"
+"
+ dwarf4_success=no
+ if test $dwarf4_addr_size = 4; then
+ gcc_GAS_CHECK_FEATURE([assembly of compiler generated 32-bit .debug_line],
+ gcc_cv_as_debug_line_32_flag,
+ [elf,2,36,0], [], [$conftest_s],,
+ [dwarf4_success=yes])
+ else
+ gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line],
+ gcc_cv_as_debug_line_64_flag,
+ [elf,2,36,0], [], [$conftest_s],,
+ [dwarf4_success=yes])
+ fi
+ if test $dwarf4_success = yes; then
+ dwarf4_success=no
+ gcc_GAS_CHECK_FEATURE([--gdwarf-4 not refusing compiler generated .debug_line],
+ gcc_cv_as_dwarf_4_debug_line_flag,
+ [elf,2,36,0], [--gdwarf-4], [$conftest_s],,
+ [dwarf4_success=yes])
+ break
+ fi
+ dwarf4_debug_info_size=0x36
+ dwarf4_high_pc_form=6
+ dwarf4_debug_aranges_size=0x1c
+ dwarf4_line_sz=5
+ done
+
+ if test $dwarf4_success = yes; then
+ conftest_s="\
+ .file \"foo.c\"
+ .text
+bar:
+#APP
+# 82 \"xxx.h\" 1
+ $insn
+# 0 \"\" 2
+#NO_APP
+ $insn
+foo:
+ .file 1 \"foo.c\"
+ $insn
+ .file 2 \"foo.h\"
+ ret
+"
+ dwarf4_success=no
+ gcc_GAS_CHECK_FEATURE([--gdwarf-4 with the APP marker],
+ gcc_cv_as_dwarf_4_app_flag,,
+ [--gdwarf-4], [$conftest_s],, [dwarf4_success=yes])
+ fi
+
+ if test $dwarf4_success = yes; then
+ conftest_s="\
+ .text
+ .globl foo
+ .type foo, %function
+foo:
+ $insn
+ .size foo, .-foo
+ .file 1 \"foo.c\"
+"
+ gcc_GAS_CHECK_FEATURE([working --gdwarf-4/--gdwarf-5 for all sources],
+ gcc_cv_as_working_gdwarf_n_flag,,
+ [--gdwarf-4],
+ [$conftest_s],
+ [changequote(,)dnl
+ if test x$gcc_cv_readelf != x \
+ && $gcc_cv_readelf -w conftest.o 2>&1 \
+ | grep conftest.s > /dev/null 2>&1; then
+ gcc_cv_as_working_gdwarf_n_flag=no
+ else
+ gcc_cv_as_working_gdwarf_n_flag=yes
+ fi
+ changequote([,])dnl])
+ if test $gcc_cv_as_working_gdwarf_n_flag = yes; then
+ AC_DEFINE(HAVE_AS_WORKING_DWARF_N_FLAG, 1,
+[Define if your assembler supports --gdwarf-4/--gdwarf-5 even with
+ compiler generated .debug_line.])
+ fi
+ fi
+
gcc_GAS_CHECK_FEATURE([--gstabs option],
gcc_cv_as_gstabs_flag,
[elf,2,11,0], [--gstabs], [$insn],,
@@ -6255,7 +6501,7 @@ supported if the default cpu is power7 or newer])
;;
esac
;;
- xpowerpc64*-*-linux*:*)
+ powerpc64*-*-linux*:*)
AC_MSG_ERROR([--with-long-double-format argument should be ibm or ieee])
with_long_double_format=""
;;
diff --git a/gcc/convert.c b/gcc/convert.c
index 292c513..7b28332 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -501,7 +501,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
CASE_FLT_FN (BUILT_IN_CEIL):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_CEIL):
/* Only convert in ISO C99 mode. */
- if (!targetm.libc_has_function (function_c99_misc))
+ if (!targetm.libc_has_function (function_c99_misc, intype))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@@ -518,7 +518,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
CASE_FLT_FN (BUILT_IN_FLOOR):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_FLOOR):
/* Only convert in ISO C99 mode. */
- if (!targetm.libc_has_function (function_c99_misc))
+ if (!targetm.libc_has_function (function_c99_misc, intype))
break;
if (outprec < TYPE_PRECISION (integer_type_node)
|| (outprec == TYPE_PRECISION (integer_type_node)
@@ -535,7 +535,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
CASE_FLT_FN (BUILT_IN_ROUND):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_ROUND):
/* Only convert in ISO C99 mode and with -fno-math-errno. */
- if (!targetm.libc_has_function (function_c99_misc)
+ if (!targetm.libc_has_function (function_c99_misc, intype)
|| flag_errno_math)
break;
if (outprec < TYPE_PRECISION (integer_type_node)
@@ -559,7 +559,7 @@ convert_to_integer_1 (tree type, tree expr, bool dofold)
CASE_FLT_FN (BUILT_IN_RINT):
CASE_FLT_FN_FLOATN_NX (BUILT_IN_RINT):
/* Only convert in ISO C99 mode and with -fno-math-errno. */
- if (!targetm.libc_has_function (function_c99_misc)
+ if (!targetm.libc_has_function (function_c99_misc, intype)
|| flag_errno_math)
break;
if (outprec < TYPE_PRECISION (integer_type_node)
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 6b6cfcd..81a1b59 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -219,6 +219,14 @@ enum profile_reproducibility {
PROFILE_REPRODUCIBILITY_MULTITHREADED
};
+/* Type of -fstack-protector-*. */
+enum stack_protector {
+ SPCT_FLAG_DEFAULT = 1,
+ SPCT_FLAG_ALL = 2,
+ SPCT_FLAG_STRONG = 3,
+ SPCT_FLAG_EXPLICIT = 4
+};
+
/* Types of unwind/exception handling info that can be generated. */
enum unwind_info_type
diff --git a/gcc/coverage.c b/gcc/coverage.c
index f353c9c..7711412 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1206,6 +1206,8 @@ coverage_obj_finish (vec<constructor_elt, va_gc> *ctor)
void
coverage_init (const char *filename)
{
+ const char *original_filename = filename;
+ int original_len = strlen (original_filename);
#if HAVE_DOS_BASED_FILE_SYSTEM
const char *separator = "\\";
#else
@@ -1277,9 +1279,9 @@ coverage_init (const char *filename)
bbg_file_name = xstrdup (profile_note_location);
else
{
- bbg_file_name = XNEWVEC (char, len + strlen (GCOV_NOTE_SUFFIX) + 1);
- memcpy (bbg_file_name, filename, len);
- strcpy (bbg_file_name + len, GCOV_NOTE_SUFFIX);
+ bbg_file_name = XNEWVEC (char, original_len + strlen (GCOV_NOTE_SUFFIX) + 1);
+ memcpy (bbg_file_name, original_filename, original_len);
+ strcpy (bbg_file_name + original_len, GCOV_NOTE_SUFFIX);
}
if (!gcov_open (bbg_file_name, -1))
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8e6fd0d..3fe4931 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,567 @@
+2020-10-24 Marek Polacek <polacek@redhat.com>
+
+ PR c++/96241
+ * constexpr.c (cxx_eval_array_reference): Set up ctx->ctor if we
+ are initializing an aggregate. Call free_constructor on the new
+ CONSTRUCTOR if it isn't returned from cxx_eval_constant_expression.
+
+2020-10-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91741
+ * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
+
+2020-10-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97328
+ * constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
+ indexes, instead build a sub-aggregate initialization context
+ with no subobject.
+
+2020-10-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96575
+ * constexpr.c (cxx_eval_constant_expression)
+ <case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
+ (potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
+ now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
+ second operand.
+ <case EMPTY_CLASS_EXPR>: Return true instead of false.
+
+2020-10-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97511
+ * decl.c (duplicate_decls): Return NULL_TREE if
+ DECL_TEMPLATE_PARM_P differ.
+
+2020-10-20 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (push_local_extern_decl_alias): Reconstextualize
+ alias' parm decls. Drop any default args.
+
+2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR c++/97438
+ * coroutines.cc (struct coroutine_info): Add a field to
+ record that we emitted a promise type error.
+ (coro_promise_type_found_p): Check for the case that the
+ promise type contains both return_void and return_value.
+ Emit an error if so, with information about the wrong
+ type methods.
+
+2020-10-16 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/97460
+ * pt.c (push_template_decl): Check DECL_LANG_SPECIFIC in friend
+ case.
+
+2020-10-16 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/96258
+ * parser.c (cp_parser_declaration): Make token2 point to EOF if
+ token1 was EOF.
+
+2020-10-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/95844
+ * decl.c (copy_fn_p): Return false for a function that is neither a
+ constructor nor an assignment operator.
+ (move_signature_fn_p): Likewise.
+
+2020-10-15 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97406
+ PR c++/85901
+ * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
+ (cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
+ (cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
+ (cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
+ for pointers-to-members.
+
+2020-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/97358
+ * pt.c (check_for_bare_parameter_packs): Diagnose use of
+ capture pack.
+
+2020-10-14 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (struct lang_decl_fn): Adjust context comment.
+ (DECL_FRIEND_P): Replace with ...
+ (DECL_UNIQUE_FRIEND_P): ... this. Only for FUNCTION_DECLs.
+ (DECL_FRIEND_CONTEXT): Adjust.
+ * class.c (add_implicitly_declared_members): Detect friendly
+ spaceship from context.
+ * constraint.cc (remove_constraints): Use a checking assert.
+ (maybe_substitute_reqs_for): Use DECL_UNIQUE_FRIEND_P.
+ * decl.c (check_no_redeclaration_friend_default_args):
+ DECL_UNIQUE_FRIEND_P is signficant, not hiddenness.
+ (duplicate_decls): Adjust DECL_UNIQUE_FRIEND_P clearing.
+ (redeclaration_error_message): Use DECL_UNIQUE_FRIEND_P.
+ (start_preparsed_function): Correct in-class friend processing.
+ Refactor some initializers.
+ (grokmethod): Directly check friend decl-spec.
+ * decl2.c (grokfield): Check DECL_UNIQUE_FRIEND_P.
+ * friend.c (do_friend): Set DECL_UNIQUE_FRIEND_P first, remove
+ extraneous conditions. Don't re set it afterwards.
+ * name-lookup.c (lookup_elaborated_type_1): Simplify revealing
+ code.
+ (do_pushtag): Likewise.
+ * pt.c (optimize_specialization_lookup_p): Check
+ DECL_UNIQUE_FRIEND_P.
+ (push_template_decl): Likewise. Drop unneeded friend setting.
+ (type_dependent_expression_p): Check DECL_UNIQUE_FRIEND_P.
+
+2020-10-14 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (push_local_extern_decl_alias): Push into alias's
+ namespace and use pushdecl.
+ (do_pushdecl_with_scope): Clarify behaviour.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR c++/97201
+ * error.c (dump_type_suffix): Handle both the C and C++ forms of
+ zero-length arrays.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR c++/96511
+ PR middle-end/96384
+ * init.c (warn_placement_new_too_small): Call builtin_objsize instead
+ of duplicating what it does.
+
+2020-10-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/96805
+ PR c++/96199
+ * pt.c (tsubst_aggr_type): Don't build a TYPENAME_TYPE when
+ entering_scope.
+ (tsubst_template_decl): Use tsubst_aggr_type.
+
+2020-10-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97052
+ * constraint.cc (build_type_constraint): Temporarily increment
+ processing_template_decl before calling build_concept_check.
+ * pt.c (make_constrained_placeholder_type): Likewise.
+
+2020-10-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96229
+ * parser.c (cp_parser_class_specifier_1): Move call to
+ associate_classtype_constraints from here to ...
+ (cp_parser_class_head): ... here.
+ * pt.c (is_compatible_template_arg): Correct documentation to
+ say "argument is _no_ more constrained than the parameter".
+
+2020-10-07 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97010
+ * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
+ tsubst_copy_and_build explicitly instead of using the RECUR macro.
+ Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand.
+ <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an
+ IDENTIFIER_NODE as its operand.
+
+2020-10-07 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/88115
+ PR libstdc++/97273
+ * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
+ ALIGNOF_EXPR_STD_P differ.
+
+2020-10-07 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (struct language_function): Delete extern_decl_map.
+ (DECL_LOCAL_DECL_ALIAS): New.
+ * name-lookup.h (is_local_extern): Delete.
+ * name-lookup.c (set_local_extern_decl_linkage): Replace with ...
+ (push_local_extern_decl): ... this new function.
+ (do_pushdecl): Call new function after pushing new decl. Unhide
+ hidden non-functions.
+ (is_local_extern): Delete.
+ * decl.c (layout_var_decl): Do not allow VLA local externs.
+ * decl2.c (mark_used): Also mark DECL_LOCAL_DECL_ALIAS. Drop old
+ local-extern treatment.
+ * parser.c (cp_parser_oacc_declare): Deal with local extern aliases.
+ * pt.c (tsubst_expr): Adjust local extern instantiation.
+ * cp-gimplify.c (cp_genericize_r): Remap DECL_LOCAL_DECLs.
+
+2020-10-07 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (DECL_BUILTIN_P): Rename to ...
+ (DECL_UNDECLARED_BUILTIN_P): ... here.
+ * decl.c (duplicate_decls): Adjust.
+ * name-lookup.c (anticipated_builtin_p): Adjust.
+ (do_nonmember_using_decl): Likewise.
+
+2020-10-07 Nathan Sidwell <nathan@acm.org>
+
+ * tree.c (build_cp_fntype_variant): Clear
+ TYPE_DEPENDENT_P_VALID if necessary.
+
+2020-10-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97297
+ * parser.c (cp_parser_direct_declarator): When checking if a
+ name is a function template declaration for the P0634R3 case,
+ look in uninstantiated templates too.
+
+2020-10-05 Marek Polacek <polacek@redhat.com>
+
+ * cp-tree.h (NON_UNION_CLASS_TYPE_P): Fix typo in a comment.
+
+2020-10-05 Richard Biener <rguenther@suse.de>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97197
+ * error.c (dump_expr): Handle TARGET_MEM_REF.
+
+2020-10-05 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (maybe_add_fuzzy_decl): New.
+ (maybe_add_fuzzy_binding): New.
+ (consider_binding_level): Use intermediate sortable vector for
+ namespace bindings.
+
+2020-10-02 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97014
+ * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
+ argument is template_parm_object_p, print its DECL_INITIAL.
+
+2020-10-02 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (lang_decl_base): anticipated_p is not used for
+ anticipatedness.
+ (DECL_ANTICIPATED): Delete.
+ * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
+ use was_hidden.
+ (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
+ (xref_tag_1): Drop DECL_ANTICIPATED assert.
+ * name-lookup.c (name_lookup::adl_class_only): Drop
+ DECL_ANTICIPATED check.
+ (name_lookup::search_adl): Always dedup.
+ (anticipated_builtin_p): Reimplement.
+ (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
+ (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
+ (do_pushtag): Drop DECL_ANTICIPATED setting.
+ * pt.c (push_template_decl): Likewise.
+ (tsubst_friend_class): Likewise.
+
+2020-10-02 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (consider_decl): New, broken out of ...
+ (consider_binding_level): ... here. Iterate the hash table for
+ namespace bindings.
+
+2020-10-02 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
+ * class.c (add_method): Refactor main loop, only pass fns to
+ ctor_omit_inherited_parms.
+ (build_cdtor_clones): Rename bool parms.
+ (clone_cdtor): Call base_ctor_omit_inherited_parms.
+ * method.c (base_ctor_omit_inherited_parms): New, broken out of
+ ...
+ (ctor_omit_inherited_parms): ... here, call it with
+ DECL_CLONED_FUNCTION.
+
+2020-10-02 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (cp_fname_init): Delete declaration.
+ * decl.c (cp_fname_init): Merge into only caller ...
+ (cp_make_fname): ... here & refactor.
+
+2020-10-02 Jason Merril <jason@redhat.com>
+
+ * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
+ (build_op_delete_call): Likewise.
+ * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
+ (build_delete):
+
+2020-10-02 Jason Merril <jason@redhat.com>
+
+ * lambda.c (call_from_lambda_thunk_p): New.
+ * cp-gimplify.c (cp_genericize_r): Use it.
+ * pt.c (tsubst_copy_and_build): Use it.
+ * typeck.c (check_return_expr): Use it.
+ * cp-tree.h: Declare it.
+ (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
+
+2020-10-01 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
+ (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
+ * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
+ (ovl_skip_hidden): Likewise.
+
+2020-10-01 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (pushdecl_top_level): Assert incoming context is
+ null, add global_namespace context.
+ (pushdecl_top_level_and_finish): Likewise.
+ * pt.c (get_template_parm_object): Clear decl context before
+ pushing.
+ * semantics.c (finish_compound_literal): Likewise.
+
+2020-10-01 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (lookup_and_check_tag): Refactor.
+
+2020-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/96994
+ * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
+ setting obj_arg to call.
+
+2020-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97195
+ * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
+ second argument.
+
+2020-10-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90210
+ * pt.c (do_class_deduction): Don't prune explicit deduction guides
+ in copy-list-initialization. In copy-list-initialization, if an
+ explicit deduction guide was selected, give an error.
+
+2020-09-30 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
+ (DECL_HIDDEN_FRIEND_P): Delete.
+ * call.c (add_function_candidate): Drop assert about anticipated
+ decl.
+ (build_new_op_1): Drop koenig lookup flagging for hidden friend.
+ * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
+ * name-lookup.c (do_pushdecl): Likewise.
+ (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
+ * pt.c (check_explicit_specialization): Record found_hidden
+ explicitly.
+
+2020-09-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94695
+ * call.c (ref_conv_binds_directly_p): New function.
+ * cp-tree.h (ref_conv_binds_directly_p): Declare.
+ * parser.c (warn_for_range_copy): New function.
+ (cp_convert_range_for): Call it.
+
+2020-09-29 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
+ indicator.
+ * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
+ (struct cxx_binding): Add type_is_hidden flag.
+ * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
+ adjust.
+ (ovl_skip_hidden): Assert we never see a naked hidden decl.
+ * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
+ lookup_elaborated_type_1).
+ * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
+ (name_lookup::search_namespace_only): Check new hidden markers.
+ (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
+ (update_binding): Update new hidden markers.
+ (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
+ ignoring.
+ (lookup_elaborated_type_1): Use new hidden markers. Reveal the
+ decl here.
+
+2020-09-29 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (create_local_binding): Do not clear
+ INHERITED_VALUE_BINDING_P here.
+ (name_lookup::process_binding): Move done hidden-decl triage to ...
+ (name_lookup::search_namespace_only): ... here, its only caller.
+ (cxx_binding_make): Clear flags here.
+ (push_binding): Not here.
+ (pop_local_binding): RAII.
+ (update_binding): Refactor.
+ (do_pushdecl): Assert we're never revealing a local binding.
+ (do_pushdecl_with_scope): Directly call do_pushdecl.
+ (get_class_binding): Do not clear LOCAL_BINDING_P here.
+ * pt.c (push_template_decl): Set friend & anticipated before
+ pushing.
+
+2020-09-29 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (update_binding): We never meet two implicit
+ typedefs.
+ (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
+ (set_identifier_type_value_with_scope): Do not update binding in
+ the namespace-case. Assert it is already there.
+
+2020-09-25 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
+ and add 'was_hidden'.
+ * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
+ with 'hiding'.
+ (pushdecl): Likewise.
+ (pushdecl_top_level): Drop is_friend parm.
+ * decl.c (check_no_redeclaration_friend_default_args): Rename parm
+ olddelc_hidden_p.
+ (duplicate_decls): Replace 'is_friend' with 'hiding'
+ and 'was_hidden'. Do minimal adjustments in body.
+ (cxx_builtin_function): Pass 'hiding' to pushdecl.
+ * friend.c (do_friend): Pass 'hiding' to pushdecl.
+ * name-lookup.c (supplement_binding_1): Drop defaulted arg to
+ duplicate_decls.
+ (update_binding): Replace 'is_friend' with 'hiding'. Drop
+ defaulted arg to duplicate_decls.
+ (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
+ surprise hidhing. Adjust duplicate_decls calls to inform of old
+ decl's hiddennes.
+ (pushdecl): Replace 'is_friend' with 'hiding'.
+ (set_identifier_type_value_with_scope): Adjust update_binding
+ call.
+ (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
+ (pushdecl_outermost_localscope): Drop default arg to
+ do_pushdecl_with_scope.
+ (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
+ (pushdecl_top_level): Drop is_friend parm.
+ * pt.c (register_specialization): Comment duplicate_decls call
+ args.
+ (push_template_decl): Commont pushdecl_namespace_level.
+ (tsubst_friend_function, tsubst_friend_class): Likewise.
+
+2020-09-25 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.h (enum tag_scope): Replace with ...
+ (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
+ (lookup_type_scope): Replace with ...
+ (lookup_elaborated_type): ... this.
+ (pushtag): Use TAG_how, not tag_scope.
+ * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
+ * decl.c (lookup_and_check_tag): Likewise. Adjust.
+ (xref_tag_1, xref_tag): Likewise. adjust.
+ (start_enum): Adjust lookup_and_check_tag call.
+ * name-lookup.c (lookup_type_scope_1): Rename to ...
+ (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
+ (lookup_type_scope): Rename to ...
+ (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
+ (do_pushtag): Use TAG_how, not tag_scope. Adjust.
+ (pushtag): Likewise.
+ * parser.c (cp_parser_elaborated_type_specifier): Adjust.
+ (cp_parser_class_head): Likewise.
+
+2020-09-25 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (DECL_BUILTIN_P): New.
+ * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
+ builtin.
+ * name-lookup.c (anticipated_builtin): Use it.
+ (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
+ (do_nonmember_using_decl): Use DECL_BUILTIN_P.
+ * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
+ UDRs have function context. Assert we never find a valid duplicate.
+ * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
+
+2020-09-24 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (duplicate_decls): Default is_friend to false.
+ (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
+ (push_template_decl_real): Default is_friend to false. Rename to
+ ...
+ (push_template_decl): ... here. Delete original decl.
+ * name-lookup.h (pushdecl_namespace_level): Default is_friend to
+ false.
+ (pushtag): Default tag_scope to ts_current.
+ * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
+ * decl.c (start_decl): Drop default args to duplicate_decls.
+ (start_enum): Drop default arg to pushtag & xref_tag.
+ (start_preparsed_function): Pass DECL_FRIEND_P to
+ push_template_decl.
+ (grokmethod): Likewise.
+ * friend.c (do_friend): Rename push_template_decl_real calls.
+ * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
+ (vla_capture_type): Likewise.
+ * name-lookup.c (maybe_process_template_type_declaration): Rename
+ push_template_decl_real call.
+ (pushdecl_top_level_and_finish): Drop default arg to
+ pushdecl_namespace_level.
+ * pt.c (push_template_decl_real): Assert no surprising friend
+ functions. Rename to ...
+ (push_template_decl): ... here. Delete original function.
+ (lookup_template_class_1): Drop default args from pushtag.
+ (instantiate_class_template_1): Likewise.
+ * ptree.c (debug_overload): Print hidden and using markers.
+ * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
+ (build_dynamic_cast_1, tinfo_base_init): Likewise.
+ * semantics.c (begin_class_definition): Drop default args to
+ pushtag.
+
+2020-09-24 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/97186
+ * pt.c (maybe_instantiate_noexcept): Local externs are never
+ member fns.
+
+2020-09-23 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.h (typedef cxx_binding): Delete tdef.
+ (typedef cp_binding_level): Likewise.
+ (struct cxx_binding): Flags are bools.
+
+2020-09-23 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/97171
+ * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
+ specialization for DECL_LOCAL_P decls.
+
+2020-09-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/95310
+ * pt.c (corresponding_template_parameter): Define.
+ (keep_template_parm): Use it to adjust the given template
+ parameter to the corresponding in-scope one from ctx_parms.
+
+2020-09-22 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (xref_tag_from_type): Don't declare.
+ * decl.c (xref_tag_from_type): Delete.
+ * pt.c (lookup_template_class_1): Erroneously located class
+ definitions just give error_mark, don't try and inject it into the
+ namespace.
+
+2020-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97145
+ * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
+ calls to __sanitize_ptr_{sub,cmp} builtins.
+
+2020-09-22 Nathan Sidwell <nathan@acm.org>
+
+ * pt.c (instantiate_class_template_1): Do not repush and unhide
+ injected friend.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90583
+ DR 1722
+ * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
+ as noexcept.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ * pt.c (deduction_guides_for): Add a bool parameter. Set it.
+ (do_class_deduction): Warn when CTAD succeeds but the type doesn't
+ have any explicit deduction guides.
+
+2020-09-21 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
+ * lambda.c (begin_lambda_type): Use ts_current to push the tag.
+ * name-lookup.h (enum tag_scope): Drop ts_lambda.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97099
+ * decl.c (redeclaration_error_message): Detect a redeclaration of
+ deduction guides.
+
2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
* cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5606389..bd66251 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2220,11 +2220,6 @@ add_function_candidate (struct z_candidate **candidates,
int viable = 1;
struct rejection_reason *reason = NULL;
- /* At this point we should not see any functions which haven't been
- explicitly declared, except for friend functions which will have
- been found using argument dependent lookup. */
- gcc_assert (!DECL_ANTICIPATED (fn) || DECL_HIDDEN_FRIEND_P (fn));
-
/* The `this', `in_chrg' and VTT arguments to constructors are not
considered in overload resolution. */
if (DECL_CONSTRUCTOR_P (fn))
@@ -4774,7 +4769,16 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
*fn = cand->fn;
/* Build the CALL_EXPR. */
- return build_over_call (cand, LOOKUP_NORMAL, complain);
+ tree ret = build_over_call (cand, LOOKUP_NORMAL, complain);
+
+ /* Set this flag for all callers of this function. In addition to
+ new-expressions, this is called for allocating coroutine state; treat
+ that as an implicit new-expression. */
+ tree call = extract_call_expr (ret);
+ if (TREE_CODE (call) == CALL_EXPR)
+ CALL_FROM_NEW_OR_DELETE_P (call) = 1;
+
+ return ret;
}
/* Build a new call to operator(). This may change ARGS. */
@@ -6151,7 +6155,7 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
case VEC_NEW_EXPR:
case VEC_DELETE_EXPR:
case DELETE_EXPR:
- /* Use build_op_new_call and build_op_delete_call instead. */
+ /* Use build_operator_new_call and build_op_delete_call instead. */
gcc_unreachable ();
case CALL_EXPR:
@@ -6344,11 +6348,6 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
tree call = extract_call_expr (result);
CALL_EXPR_OPERATOR_SYNTAX (call) = true;
- if (processing_template_decl && DECL_HIDDEN_FRIEND_P (cand->fn))
- /* This prevents build_new_function_call from discarding this
- function during instantiation of the enclosing template. */
- KOENIG_LOOKUP_P (call) = 1;
-
/* Specify evaluation order as per P0145R2. */
CALL_EXPR_ORDERED_ARGS (call) = false;
switch (op_is_ordered (code))
@@ -6993,6 +6992,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
if (DECL_DELETED_FN (fn) && alloc_fn)
return NULL_TREE;
+ tree ret;
if (placement)
{
/* The placement args might not be suitable for overload
@@ -7005,7 +7005,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
argarray[i] = CALL_EXPR_ARG (placement, i);
if (!mark_used (fn, complain) && !(complain & tf_error))
return error_mark_node;
- return build_cxx_call (fn, nargs, argarray, complain);
+ ret = build_cxx_call (fn, nargs, argarray, complain);
}
else
{
@@ -7023,7 +7023,6 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
complain);
}
- tree ret;
releasing_vec args;
args->quick_push (addr);
if (destroying)
@@ -7036,8 +7035,18 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
args->quick_push (al);
}
ret = cp_build_function_call_vec (fn, &args, complain);
- return ret;
}
+
+ /* Set this flag for all callers of this function. In addition to
+ delete-expressions, this is called for deallocating coroutine state;
+ treat that as an implicit delete-expression. This is also called for
+ the delete if the constructor throws in a new-expression, and for a
+ deleting destructor (which implements a delete-expression). */
+ tree call = extract_call_expr (ret);
+ if (TREE_CODE (call) == CALL_EXPR)
+ CALL_FROM_NEW_OR_DELETE_P (call) = 1;
+
+ return ret;
}
/* [expr.new]
@@ -8429,6 +8438,28 @@ conv_binds_ref_to_prvalue (conversion *c)
return false;
}
+/* True iff converting EXPR to a reference type TYPE does not involve
+ creating a temporary. */
+
+bool
+ref_conv_binds_directly_p (tree type, tree expr)
+{
+ gcc_assert (TYPE_REF_P (type));
+
+ /* Get the high-water mark for the CONVERSION_OBSTACK. */
+ void *p = conversion_obstack_alloc (0);
+
+ conversion *conv = implicit_conversion (type, TREE_TYPE (expr), expr,
+ /*c_cast_p=*/false,
+ LOOKUP_IMPLICIT, tf_none);
+ bool ret = conv && !conv->bad_p && !conv_binds_ref_to_prvalue (conv);
+
+ /* Free all the conversions we allocated. */
+ obstack_free (&conversion_obstack, p);
+
+ return ret;
+}
+
/* Call the trivial destructor for INSTANCE, which can be either an lvalue of
class type or a pointer to class type. If NO_PTR_DEREF is true and
INSTANCE has pointer type, clobber the pointer rather than what it points
@@ -9200,6 +9231,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
}
call = cxx_constant_value (call, obj_arg);
+ if (obj_arg && !error_operand_p (call))
+ call = build2 (INIT_EXPR, void_type_node, obj_arg, call);
}
}
return call;
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c9a1f75..26f996b 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1006,10 +1006,6 @@ add_method (tree type, tree method, bool via_using)
for (ovl_iterator iter (current_fns); iter; ++iter)
{
tree fn = *iter;
- tree fn_type;
- tree method_type;
- tree parms1;
- tree parms2;
if (TREE_CODE (fn) != TREE_CODE (method))
continue;
@@ -1037,10 +1033,8 @@ add_method (tree type, tree method, bool via_using)
functions in the derived class override and/or hide member
functions with the same name and parameter types in a base
class (rather than conflicting). */
- fn_type = TREE_TYPE (fn);
- method_type = TREE_TYPE (method);
- parms1 = TYPE_ARG_TYPES (fn_type);
- parms2 = TYPE_ARG_TYPES (method_type);
+ tree fn_type = TREE_TYPE (fn);
+ tree method_type = TREE_TYPE (method);
/* Compare the quals on the 'this' parm. Don't compare
the whole types, as used functions are treated as
@@ -1055,137 +1049,149 @@ add_method (tree type, tree method, bool via_using)
|| type_memfn_rqual (fn_type) != type_memfn_rqual (method_type)))
continue;
- /* For templates, the return type and template parameters
- must be identical. */
- if (TREE_CODE (fn) == TEMPLATE_DECL
- && (!same_type_p (TREE_TYPE (fn_type),
- TREE_TYPE (method_type))
- || !comp_template_parms (DECL_TEMPLATE_PARMS (fn),
- DECL_TEMPLATE_PARMS (method))))
+ tree real_fn = fn;
+ tree real_method = method;
+
+ /* Templates and conversion ops must match return types. */
+ if ((DECL_CONV_FN_P (fn) || TREE_CODE (fn) == TEMPLATE_DECL)
+ && !same_type_p (TREE_TYPE (fn_type), TREE_TYPE (method_type)))
continue;
+
+ /* For templates, the template parameters must be identical. */
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ {
+ if (!comp_template_parms (DECL_TEMPLATE_PARMS (fn),
+ DECL_TEMPLATE_PARMS (method)))
+ continue;
- if (! DECL_STATIC_FUNCTION_P (fn))
+ real_fn = DECL_TEMPLATE_RESULT (fn);
+ real_method = DECL_TEMPLATE_RESULT (method);
+ }
+
+ tree parms1 = TYPE_ARG_TYPES (fn_type);
+ tree parms2 = TYPE_ARG_TYPES (method_type);
+ if (! DECL_STATIC_FUNCTION_P (real_fn))
parms1 = TREE_CHAIN (parms1);
- if (! DECL_STATIC_FUNCTION_P (method))
+ if (! DECL_STATIC_FUNCTION_P (real_method))
parms2 = TREE_CHAIN (parms2);
- /* Bring back parameters omitted from an inherited ctor. */
- if (ctor_omit_inherited_parms (fn))
- parms1 = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn));
- if (ctor_omit_inherited_parms (method))
- parms2 = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (method));
+ /* Bring back parameters omitted from an inherited ctor. The
+ method and the function can have different omittedness. */
+ if (ctor_omit_inherited_parms (real_fn))
+ parms1 = FUNCTION_FIRST_USER_PARMTYPE (DECL_CLONED_FUNCTION (real_fn));
+ if (ctor_omit_inherited_parms (real_method))
+ parms2 = (FUNCTION_FIRST_USER_PARMTYPE
+ (DECL_CLONED_FUNCTION (real_method)));
- if (compparms (parms1, parms2)
- && (!DECL_CONV_FN_P (fn)
- || same_type_p (TREE_TYPE (fn_type),
- TREE_TYPE (method_type))))
- {
- if (!equivalently_constrained (fn, method))
- {
- if (processing_template_decl)
- /* We can't check satisfaction in dependent context, wait until
- the class is instantiated. */
- continue;
-
- special_function_kind sfk = special_memfn_p (method);
+ if (!compparms (parms1, parms2))
+ continue;
- if (sfk == sfk_none
- || DECL_INHERITED_CTOR (fn)
- || TREE_CODE (fn) == TEMPLATE_DECL)
- /* Member function templates and non-special member functions
- coexist if they are not equivalently constrained. A member
- function is not hidden by an inherited constructor. */
- continue;
+ if (!equivalently_constrained (fn, method))
+ {
+ if (processing_template_decl)
+ /* We can't check satisfaction in dependent context, wait until
+ the class is instantiated. */
+ continue;
- /* P0848: For special member functions, deleted, unsatisfied, or
- less constrained overloads are ineligible. We implement this
- by removing them from CLASSTYPE_MEMBER_VEC. Destructors don't
- use the notion of eligibility, and the selected destructor can
- be deleted, but removing unsatisfied or less constrained
- overloads has the same effect as overload resolution. */
- bool dtor = (sfk == sfk_destructor);
- if (losem == -1)
- losem = ((!dtor && DECL_DELETED_FN (method))
- || !constraints_satisfied_p (method));
- bool losef = ((!dtor && DECL_DELETED_FN (fn))
- || !constraints_satisfied_p (fn));
- int win;
- if (losem || losef)
- win = losem - losef;
- else
- win = more_constrained (fn, method);
- if (win > 0)
- /* Leave FN in the method vec, discard METHOD. */
- return false;
- else if (win < 0)
- {
- /* Remove FN, add METHOD. */
- current_fns = iter.remove_node (current_fns);
- continue;
- }
- else
- /* Let them coexist for now. */
- continue;
- }
+ special_function_kind sfk = special_memfn_p (method);
- /* If these are versions of the same function, process and
- move on. */
- if (TREE_CODE (fn) == FUNCTION_DECL
- && maybe_version_functions (method, fn, true))
+ if (sfk == sfk_none
+ || DECL_INHERITED_CTOR (fn)
+ || TREE_CODE (fn) == TEMPLATE_DECL)
+ /* Member function templates and non-special member functions
+ coexist if they are not equivalently constrained. A member
+ function is not hidden by an inherited constructor. */
continue;
- if (DECL_INHERITED_CTOR (method))
- {
- if (DECL_INHERITED_CTOR (fn))
- {
- tree basem = DECL_INHERITED_CTOR_BASE (method);
- tree basef = DECL_INHERITED_CTOR_BASE (fn);
- if (flag_new_inheriting_ctors)
- {
- if (basem == basef)
- {
- /* Inheriting the same constructor along different
- paths, combine them. */
- SET_DECL_INHERITED_CTOR
- (fn, ovl_make (DECL_INHERITED_CTOR (method),
- DECL_INHERITED_CTOR (fn)));
- /* And discard the new one. */
- return false;
- }
- else
- /* Inherited ctors can coexist until overload
- resolution. */
- continue;
- }
- error_at (DECL_SOURCE_LOCATION (method),
- "%q#D conflicts with version inherited from %qT",
- method, basef);
- inform (DECL_SOURCE_LOCATION (fn),
- "version inherited from %qT declared here",
- basef);
- }
- /* Otherwise defer to the other function. */
- return false;
- }
-
- if (via_using)
- /* Defer to the local function. */
+ /* P0848: For special member functions, deleted, unsatisfied, or
+ less constrained overloads are ineligible. We implement this
+ by removing them from CLASSTYPE_MEMBER_VEC. Destructors don't
+ use the notion of eligibility, and the selected destructor can
+ be deleted, but removing unsatisfied or less constrained
+ overloads has the same effect as overload resolution. */
+ bool dtor = (sfk == sfk_destructor);
+ if (losem == -1)
+ losem = ((!dtor && DECL_DELETED_FN (method))
+ || !constraints_satisfied_p (method));
+ bool losef = ((!dtor && DECL_DELETED_FN (fn))
+ || !constraints_satisfied_p (fn));
+ int win;
+ if (losem || losef)
+ win = losem - losef;
+ else
+ win = more_constrained (fn, method);
+ if (win > 0)
+ /* Leave FN in the method vec, discard METHOD. */
return false;
- else if (flag_new_inheriting_ctors
- && DECL_INHERITED_CTOR (fn))
+ else if (win < 0)
{
- /* Remove the inherited constructor. */
+ /* Remove FN, add METHOD. */
current_fns = iter.remove_node (current_fns);
continue;
}
else
+ /* Let them coexist for now. */
+ continue;
+ }
+
+ /* If these are versions of the same function, process and
+ move on. */
+ if (TREE_CODE (fn) == FUNCTION_DECL
+ && maybe_version_functions (method, fn, true))
+ continue;
+
+ if (DECL_INHERITED_CTOR (method))
+ {
+ if (!DECL_INHERITED_CTOR (fn))
+ /* Defer to the other function. */
+ return false;
+
+ tree basem = DECL_INHERITED_CTOR_BASE (method);
+ tree basef = DECL_INHERITED_CTOR_BASE (fn);
+ if (flag_new_inheriting_ctors)
{
- error_at (DECL_SOURCE_LOCATION (method),
- "%q#D cannot be overloaded with %q#D", method, fn);
- inform (DECL_SOURCE_LOCATION (fn),
- "previous declaration %q#D", fn);
- return false;
+ if (basem == basef)
+ {
+ /* Inheriting the same constructor along different
+ paths, combine them. */
+ SET_DECL_INHERITED_CTOR
+ (fn, ovl_make (DECL_INHERITED_CTOR (method),
+ DECL_INHERITED_CTOR (fn)));
+ /* And discard the new one. */
+ return false;
+ }
+ else
+ /* Inherited ctors can coexist until overload
+ resolution. */
+ continue;
}
+
+ error_at (DECL_SOURCE_LOCATION (method),
+ "%q#D conflicts with version inherited from %qT",
+ method, basef);
+ inform (DECL_SOURCE_LOCATION (fn),
+ "version inherited from %qT declared here",
+ basef);
+ return false;
+ }
+
+ if (via_using)
+ /* Defer to the local function. */
+ return false;
+ else if (flag_new_inheriting_ctors
+ && DECL_INHERITED_CTOR (fn))
+ {
+ /* Remove the inherited constructor. */
+ current_fns = iter.remove_node (current_fns);
+ continue;
+ }
+ else
+ {
+ error_at (DECL_SOURCE_LOCATION (method),
+ "%q#D cannot be overloaded with %q#D", method, fn);
+ inform (DECL_SOURCE_LOCATION (fn),
+ "previous declaration %q#D", fn);
+ return false;
}
}
@@ -3277,7 +3283,8 @@ add_implicitly_declared_members (tree t, tree* access_decls,
{
tree eq = implicitly_declare_fn (sfk_comparison, t, false, space,
NULL_TREE);
- if (DECL_FRIEND_P (space))
+ bool is_friend = DECL_CONTEXT (space) != t;
+ if (is_friend)
do_friend (NULL_TREE, DECL_NAME (eq), eq,
NULL_TREE, NO_SPECIAL, true);
else
@@ -3286,7 +3293,7 @@ add_implicitly_declared_members (tree t, tree* access_decls,
DECL_CHAIN (eq) = TYPE_FIELDS (t);
TYPE_FIELDS (t) = eq;
}
- maybe_add_class_template_decl_list (t, eq, DECL_FRIEND_P (space));
+ maybe_add_class_template_decl_list (t, eq, is_friend);
}
while (*access_decls)
@@ -4892,7 +4899,7 @@ build_clone (tree fn, tree name, bool need_vtt_parm_p,
will be inserted onto DECL_CHAIN of FN. */
static unsigned
-build_cdtor_clones (tree fn, bool needs_vtt_parm_p, bool omit_inherited_parms_p)
+build_cdtor_clones (tree fn, bool needs_vtt_p, bool base_omits_inherited_p)
{
unsigned count = 0;
@@ -4901,8 +4908,8 @@ build_cdtor_clones (tree fn, bool needs_vtt_parm_p, bool omit_inherited_parms_p)
/* For each constructor, we need two variants: an in-charge version
and a not-in-charge version. */
build_clone (fn, complete_ctor_identifier, false, false);
- build_clone (fn, base_ctor_identifier, needs_vtt_parm_p,
- omit_inherited_parms_p);
+ build_clone (fn, base_ctor_identifier, needs_vtt_p,
+ base_omits_inherited_p);
count += 2;
}
else
@@ -4924,7 +4931,7 @@ build_cdtor_clones (tree fn, bool needs_vtt_parm_p, bool omit_inherited_parms_p)
count++;
}
build_clone (fn, complete_dtor_identifier, false, false);
- build_clone (fn, base_dtor_identifier, needs_vtt_parm_p, false);
+ build_clone (fn, base_dtor_identifier, needs_vtt_p, false);
count += 2;
}
@@ -4948,9 +4955,10 @@ clone_cdtor (tree fn, bool update_methods)
/* Base ctor omits inherited parms it needs a vttparm and inherited
from a virtual nase ctor. */
- bool omit_inherited = ctor_omit_inherited_parms (fn);
+ bool base_omits_inherited = (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
+ && base_ctor_omit_inherited_parms (fn));
- unsigned count = build_cdtor_clones (fn, vtt, omit_inherited);
+ unsigned count = build_cdtor_clones (fn, vtt, base_omits_inherited);
/* Note that this is an abstract function that is never emitted. */
DECL_ABSTRACT_P (fn) = true;
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 72fbdab..7ebdd30 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1355,6 +1355,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
case BUILT_IN_STRSTR:
strops = 2;
strret = 1;
+ break;
+ case BUILT_IN_ASAN_POINTER_COMPARE:
+ case BUILT_IN_ASAN_POINTER_SUBTRACT:
+ /* These builtins shall be ignored during constant expression
+ evaluation. */
+ return void_node;
default:
break;
}
@@ -2336,9 +2342,10 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
tree arg = CALL_EXPR_ARG (t, i);
arg = cxx_eval_constant_expression (ctx, arg, false,
non_constant_p, overflow_p);
- VERIFY_CONSTANT (arg);
if (i == 1)
arg1 = arg;
+ else
+ VERIFY_CONSTANT (arg);
}
gcc_assert (arg1);
return arg1;
@@ -3650,15 +3657,22 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
initializer, it's initialized from {}. But use build_value_init
directly for non-aggregates to avoid creating a garbage CONSTRUCTOR. */
tree val;
+ constexpr_ctx new_ctx;
if (CP_AGGREGATE_TYPE_P (elem_type))
{
tree empty_ctor = build_constructor (init_list_type_node, NULL);
val = digest_init (elem_type, empty_ctor, tf_warning_or_error);
+ new_ctx = *ctx;
+ new_ctx.ctor = build_constructor (elem_type, NULL);
+ ctx = &new_ctx;
}
else
val = build_value_init (elem_type, tf_warning_or_error);
- return cxx_eval_constant_expression (ctx, val, lval, non_constant_p,
- overflow_p);
+ t = cxx_eval_constant_expression (ctx, val, lval, non_constant_p,
+ overflow_p);
+ if (CP_AGGREGATE_TYPE_P (elem_type) && t != ctx->ctor)
+ free_constructor (ctx->ctor);
+ return t;
}
/* Subroutine of cxx_eval_constant_expression.
@@ -3947,7 +3961,8 @@ init_subob_ctx (const constexpr_ctx *ctx, constexpr_ctx &new_ctx,
new_ctx = *ctx;
if (index && TREE_CODE (index) != INTEGER_CST
- && TREE_CODE (index) != FIELD_DECL)
+ && TREE_CODE (index) != FIELD_DECL
+ && TREE_CODE (index) != RANGE_EXPR)
/* This won't have an element in the new CONSTRUCTOR. */
return;
@@ -3960,7 +3975,13 @@ init_subob_ctx (const constexpr_ctx *ctx, constexpr_ctx &new_ctx,
update object to refer to the subobject and ctor to refer to
the (newly created) sub-initializer. */
if (ctx->object)
- new_ctx.object = build_ctor_subob_ref (index, type, ctx->object);
+ {
+ if (index == NULL_TREE || TREE_CODE (index) == RANGE_EXPR)
+ /* There's no well-defined subobject for this index. */
+ new_ctx.object = NULL_TREE;
+ else
+ new_ctx.object = build_ctor_subob_ref (index, type, ctx->object);
+ }
tree elt = build_constructor (type, NULL);
CONSTRUCTOR_NO_CLEARING (elt) = true;
new_ctx.ctor = elt;
@@ -6396,9 +6417,9 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
break;
case EMPTY_CLASS_EXPR:
- /* This is good enough for a function argument that might not get
- used, and they can't do anything with it, so just return it. */
- return t;
+ /* Handle EMPTY_CLASS_EXPR produced by build_call_a by lowering
+ it to an appropriate CONSTRUCTOR. */
+ return build_constructor (TREE_TYPE (t), NULL);
case STATEMENT_LIST:
new_ctx = *ctx;
@@ -8179,13 +8200,11 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
case COMPOUND_EXPR:
{
/* check_return_expr sometimes wraps a TARGET_EXPR in a
- COMPOUND_EXPR; don't get confused. Also handle EMPTY_CLASS_EXPR
- introduced by build_call_a. */
+ COMPOUND_EXPR; don't get confused. */
tree op0 = TREE_OPERAND (t, 0);
tree op1 = TREE_OPERAND (t, 1);
STRIP_NOPS (op1);
- if ((TREE_CODE (op0) == TARGET_EXPR && op1 == TARGET_EXPR_SLOT (op0))
- || TREE_CODE (op1) == EMPTY_CLASS_EXPR)
+ if (TREE_CODE (op0) == TARGET_EXPR && op1 == TARGET_EXPR_SLOT (op0))
return RECUR (op0, want_rval);
else
goto binary;
@@ -8314,7 +8333,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
return true;
case EMPTY_CLASS_EXPR:
- return false;
+ return true;
case GOTO_EXPR:
{
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index d49957a..f4f5174 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -1201,7 +1201,7 @@ set_constraints (tree t, tree ci)
void
remove_constraints (tree t)
{
- gcc_assert (DECL_P (t));
+ gcc_checking_assert (DECL_P (t));
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
@@ -1217,11 +1217,16 @@ maybe_substitute_reqs_for (tree reqs, const_tree decl_)
{
if (reqs == NULL_TREE)
return NULL_TREE;
+
tree decl = CONST_CAST_TREE (decl_);
tree result = STRIP_TEMPLATE (decl);
- if (DECL_FRIEND_P (result))
+
+ if (DECL_UNIQUE_FRIEND_P (result))
{
- tree tmpl = decl == result ? DECL_TI_TEMPLATE (result) : decl;
+ tree tmpl = decl;
+ if (TREE_CODE (decl) != TEMPLATE_DECL)
+ tmpl = DECL_TI_TEMPLATE (result);
+
tree gargs = generic_targs_for (tmpl);
processing_template_decl_sentinel s;
if (uses_template_parms (gargs))
@@ -1427,7 +1432,9 @@ tree
build_type_constraint (tree decl, tree args, tsubst_flags_t complain)
{
tree wildcard = build_nt (WILDCARD_DECL);
+ ++processing_template_decl;
tree check = build_concept_check (decl, wildcard, args, complain);
+ --processing_template_decl;
if (check == error_mark_node)
return error_mark_node;
return unpack_concept_check (check);
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 898b88b..9b9141e 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -94,6 +94,7 @@ struct GTY((for_user)) coroutine_info
/* Flags to avoid repeated errors for per-function issues. */
bool coro_ret_type_error_emitted;
bool coro_promise_error_emitted;
+ bool coro_co_return_error_emitted;
};
struct coroutine_info_hasher : ggc_ptr_hash<coroutine_info>
@@ -470,6 +471,30 @@ coro_promise_type_found_p (tree fndecl, location_t loc)
return false;
}
+ /* Test for errors in the promise type that can be determined now. */
+ tree has_ret_void = lookup_member (coro_info->promise_type,
+ coro_return_void_identifier,
+ /*protect=*/1, /*want_type=*/0,
+ tf_none);
+ tree has_ret_val = lookup_member (coro_info->promise_type,
+ coro_return_value_identifier,
+ /*protect=*/1, /*want_type=*/0,
+ tf_none);
+ if (has_ret_void && has_ret_val)
+ {
+ location_t ploc = DECL_SOURCE_LOCATION (fndecl);
+ if (!coro_info->coro_co_return_error_emitted)
+ error_at (ploc, "the coroutine promise type %qT declares both"
+ " %<return_value%> and %<return_void%>",
+ coro_info->promise_type);
+ inform (DECL_SOURCE_LOCATION (BASELINK_FUNCTIONS (has_ret_void)),
+ "%<return_void%> declared here");
+ inform (DECL_SOURCE_LOCATION (BASELINK_FUNCTIONS (has_ret_val)),
+ "%<return_value%> declared here");
+ coro_info->coro_co_return_error_emitted = true;
+ return false;
+ }
+
/* Try to find the handle type for the promise. */
tree handle_type =
instantiate_coro_handle_for_promise_type (loc, coro_info->promise_type);
@@ -4011,7 +4036,7 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer)
/* 2. Types we need to define or look up. */
tree fr_name = get_fn_local_identifier (orig, "frame");
- tree coro_frame_type = xref_tag (record_type, fr_name, ts_current, false);
+ tree coro_frame_type = xref_tag (record_type, fr_name);
DECL_CONTEXT (TYPE_NAME (coro_frame_type)) = current_scope ();
tree coro_frame_ptr = build_pointer_type (coro_frame_type);
tree act_des_fn_type
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index bc8a03c..44c9d24 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -962,7 +962,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
omp_cxx_notice_variable (wtd->omp_ctx, stmt);
/* Don't dereference parms in a thunk, pass the references through. */
- if ((TREE_CODE (stmt) == CALL_EXPR && CALL_FROM_THUNK_P (stmt))
+ if ((TREE_CODE (stmt) == CALL_EXPR && call_from_lambda_thunk_p (stmt))
|| (TREE_CODE (stmt) == AGGR_INIT_EXPR && AGGR_INIT_FROM_THUNK_P (stmt)))
{
*walk_subtrees = 0;
@@ -980,21 +980,17 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
/* Map block scope extern declarations to visible declarations with the
same name and type in outer scopes if any. */
- if (cp_function_chain->extern_decl_map
- && VAR_OR_FUNCTION_DECL_P (stmt)
- && DECL_EXTERNAL (stmt))
- {
- struct cxx_int_tree_map *h, in;
- in.uid = DECL_UID (stmt);
- h = cp_function_chain->extern_decl_map->find_with_hash (&in, in.uid);
- if (h)
- {
- *stmt_p = h->to;
- TREE_USED (h->to) |= TREE_USED (stmt);
- *walk_subtrees = 0;
- return NULL;
- }
- }
+ if (VAR_OR_FUNCTION_DECL_P (stmt) && DECL_LOCAL_DECL_P (stmt))
+ if (tree alias = DECL_LOCAL_DECL_ALIAS (stmt))
+ {
+ if (alias != error_mark_node)
+ {
+ *stmt_p = alias;
+ TREE_USED (alias) |= TREE_USED (stmt);
+ }
+ *walk_subtrees = 0;
+ return NULL;
+ }
if (TREE_CODE (stmt) == INTEGER_CST
&& TYPE_REF_P (TREE_TYPE (stmt))
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 7135381..5c06ac3 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];
SWITCH_STMT_NO_BREAK_P (in SWITCH_STMT)
LAMBDA_EXPR_CAPTURE_OPTIMIZED (in LAMBDA_EXPR)
IMPLICIT_CONV_EXPR_BRACED_INIT (in IMPLICIT_CONV_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (in CALL_EXPR)
3: IMPLICIT_RVALUE_P (in NON_LVALUE_EXPR or STATIC_CAST_EXPR)
ICS_BAD_FLAG (in _CONV)
FN_TRY_BLOCK_P (in TRY_BLOCK)
@@ -1927,7 +1926,6 @@ struct GTY(()) language_function {
/* Tracking possibly infinite loops. This is a vec<tree> only because
vec<bool> doesn't work with gtype. */
vec<tree, va_gc> *infinite_loops;
- hash_table<cxx_int_tree_map_hasher> *extern_decl_map;
};
/* The current C++-specific per-function global variables. */
@@ -2065,7 +2063,7 @@ enum languages { lang_c, lang_cplusplus };
#define CLASS_TYPE_P(T) \
(RECORD_OR_UNION_CODE_P (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
-/* Nonzero if T is a class type but not an union. */
+/* Nonzero if T is a class type but not a union. */
#define NON_UNION_CLASS_TYPE_P(T) \
(TREE_CODE (T) == RECORD_TYPE && TYPE_LANG_FLAG_5 (T))
@@ -2658,8 +2656,10 @@ struct GTY(()) lang_decl_base {
unsigned not_really_extern : 1; /* var or fn */
unsigned initialized_in_class : 1; /* var or fn */
unsigned threadprivate_or_deleted_p : 1; /* var or fn */
- unsigned anticipated_p : 1; /* fn, type or template */
- /* anticipated_p reused as DECL_OMP_PRIVATIZED_MEMBER in var */
+ /* anticipated_p is no longer used for anticipated_decls (fn, type
+ or template). It is used as DECL_OMP_PRIVATIZED_MEMBER in
+ var. */
+ unsigned anticipated_p : 1;
unsigned friend_or_tls : 1; /* var, fn, type or template */
unsigned unknown_bound_p : 1; /* var */
unsigned odr_used : 1; /* var or fn */
@@ -2696,6 +2696,7 @@ struct GTY(()) lang_decl_min {
In a lambda-capture proxy VAR_DECL, this is DECL_CAPTURED_VARIABLE.
In a function-scope TREE_STATIC VAR_DECL or IMPLICIT_TYPEDEF_P TYPE_DECL,
this is DECL_DISCRIMINATOR.
+ In a DECL_LOCAL_DECL_P decl, this is the namespace decl it aliases.
Otherwise, in a class-scope DECL, this is DECL_ACCESS. */
tree access;
};
@@ -2720,14 +2721,13 @@ struct GTY(()) lang_decl_fn {
unsigned thunk_p : 1;
unsigned this_thunk_p : 1;
- unsigned hidden_friend_p : 1;
unsigned omp_declare_reduction_p : 1;
unsigned has_dependent_explicit_spec_p : 1;
unsigned immediate_fn_p : 1;
unsigned maybe_deleted : 1;
unsigned coroutine_p : 1;
- unsigned spare : 9;
+ unsigned spare : 10;
/* 32-bits padding on 64-bit host. */
@@ -2736,12 +2736,14 @@ struct GTY(()) lang_decl_fn {
thunked to function decl. */
tree befriending_classes;
- /* For a non-virtual FUNCTION_DECL, this is
- DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
+ /* For a virtual FUNCTION_DECL for which
DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
this pointer and result pointer adjusting thunks are
chained here. This pointer thunks to return pointer thunks
- will be chained on the return pointer thunk. */
+ will be chained on the return pointer thunk.
+ For a DECL_CONSTUCTOR_P FUNCTION_DECL, this is the base from
+ whence we inherit. Otherwise, it is the class in which a
+ (namespace-scope) friend is defined (if any). */
tree context;
union lang_decl_u5
@@ -3088,10 +3090,14 @@ struct GTY(()) lang_decl {
(DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
->u.base.odr_used)
-/* Nonzero for DECL means that this decl is just a friend declaration,
- and should not be added to the list of members for this class. */
-#define DECL_FRIEND_P(NODE) \
- (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
+/* Nonzero for FUNCTION_DECL means that this is a friend that is
+ either not pushed into a namespace/looked up in a class (because it
+ is a dependent type, in an uninstantiated template), or it has
+ /only/ been subject to hidden friend injection from one or more
+ befriending classes. Once another decl matches, the flag is
+ cleared. There are requirements on its default parms. */
+#define DECL_UNIQUE_FRIEND_P(NODE) \
+ (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \
->u.base.friend_or_tls)
/* Nonzero if the thread-local variable was declared with __thread as
@@ -3290,8 +3296,8 @@ struct GTY(()) lang_decl {
the DECL_FRIEND_CONTEXT for `f' will be `S'. */
#define DECL_FRIEND_CONTEXT(NODE) \
- ((DECL_DECLARES_FUNCTION_P (NODE) \
- && DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
+ ((DECL_DECLARES_FUNCTION_P (NODE) && !DECL_VIRTUAL_P (NODE) \
+ && !DECL_CONSTRUCTOR_P (NODE)) \
? LANG_DECL_FN_CHECK (NODE)->context \
: NULL_TREE)
@@ -3840,11 +3846,6 @@ struct GTY(()) lang_decl {
should be performed at instantiation time. */
#define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
-/* In a CALL_EXPR, true for allocator calls from new or delete
- expressions. */
-#define CALL_FROM_NEW_OR_DELETE_P(NODE) \
- TREE_LANG_FLAG_2 (CALL_EXPR_CHECK (NODE))
-
/* True if the arguments to NODE should be evaluated in left-to-right
order regardless of PUSH_ARGS_REVERSED. */
#define CALL_EXPR_ORDERED_ARGS(NODE) \
@@ -4028,6 +4029,10 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define DECL_LOCAL_DECL_P(NODE) \
DECL_LANG_FLAG_0 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
+/* The namespace-scope decl a DECL_LOCAL_DECL_P aliases. */
+#define DECL_LOCAL_DECL_ALIAS(NODE) \
+ DECL_ACCESS ((gcc_checking_assert (DECL_LOCAL_DECL_P (NODE)), NODE))
+
/* Nonzero if NODE is the target for genericization of 'return' stmts
in constructors/destructors of targetm.cxx.cdtor_returns_this targets. */
#define LABEL_DECL_CDTOR(NODE) \
@@ -4040,35 +4045,16 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define FNDECL_USED_AUTO(NODE) \
TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
-/* Nonzero if NODE is a DECL which we know about but which has not
- been explicitly declared, such as a built-in function or a friend
- declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P
- will be set. */
-#define DECL_ANTICIPATED(NODE) \
- (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
- ->u.base.anticipated_p)
-
-/* Is DECL NODE a hidden name? */
-#define DECL_HIDDEN_P(NODE) \
- (DECL_LANG_SPECIFIC (NODE) && TYPE_FUNCTION_OR_TEMPLATE_DECL_P (NODE) \
- && DECL_ANTICIPATED (NODE))
-
-/* True if this is a hidden class type. */
-#define TYPE_HIDDEN_P(NODE) \
- (DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) \
- && DECL_ANTICIPATED (TYPE_NAME (NODE)))
+/* True if NODE is an undeclared builtin decl. As soon as the user
+ declares it, the location will be updated. */
+#define DECL_UNDECLARED_BUILTIN_P(NODE) \
+ (DECL_SOURCE_LOCATION(NODE) == BUILTINS_LOCATION)
/* True for artificial decls added for OpenMP privatized non-static
data members. */
#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \
(DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.anticipated_p)
-/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
- within a class but has not been declared in the surrounding scope.
- The function is invisible except via argument dependent lookup. */
-#define DECL_HIDDEN_FRIEND_P(NODE) \
- (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p)
-
/* Nonzero if NODE is an artificial FUNCTION_DECL for
#pragma omp declare reduction. */
#define DECL_OMP_DECLARE_REDUCTION_P(NODE) \
@@ -6221,6 +6207,7 @@ extern bool sufficient_parms_p (const_tree);
extern tree type_decays_to (tree);
extern tree extract_call_expr (tree);
extern tree build_trivial_dtor_call (tree, bool = false);
+extern bool ref_conv_binds_directly_p (tree, tree);
extern tree build_user_type_conversion (tree, tree, int,
tsubst_flags_t);
extern tree build_new_function_call (tree, vec<tree, va_gc> **,
@@ -6461,7 +6448,9 @@ extern void note_iteration_stmt_body_end (bool);
extern void determine_local_discriminator (tree);
extern int decls_match (tree, tree, bool = true);
extern bool maybe_version_functions (tree, tree, bool);
-extern tree duplicate_decls (tree, tree, bool);
+extern tree duplicate_decls (tree, tree,
+ bool hiding = false,
+ bool was_hidden = false);
extern tree declare_local_label (tree);
extern tree define_label (location_t, tree);
extern void check_goto (tree);
@@ -6501,8 +6490,9 @@ extern tree get_scope_of_declarator (const cp_declarator *);
extern void grok_special_member_properties (tree);
extern bool grok_ctor_properties (const_tree, const_tree);
extern bool grok_op_properties (tree, bool);
-extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
-extern tree xref_tag_from_type (tree, tree, tag_scope);
+extern tree xref_tag (tag_types, tree,
+ TAG_how = TAG_how::CURRENT_ONLY,
+ bool tpl_header_p = false);
extern void xref_basetypes (tree, tree);
extern tree start_enum (tree, tree, tree, tree, bool, bool *);
extern void finish_enum_value_list (tree);
@@ -6530,7 +6520,6 @@ extern tree create_implicit_typedef (tree, tree);
extern int local_variable_p (const_tree);
extern tree register_dtor_fn (tree);
extern tmpl_spec_kind current_tmpl_spec_kind (int);
-extern tree cp_fname_init (const char *, tree *);
extern tree cxx_builtin_function (tree decl);
extern tree cxx_builtin_function_ext_scope (tree decl);
extern tree cxx_simulate_builtin_function_decl (tree);
@@ -6781,6 +6770,7 @@ extern tree get_default_ctor (tree);
extern tree get_dtor (tree, tsubst_flags_t);
extern tree strip_inheriting_ctors (tree);
extern tree inherited_ctor_binfo (tree);
+extern bool base_ctor_omit_inherited_parms (tree);
extern bool ctor_omit_inherited_parms (tree);
extern tree locate_ctor (tree);
extern tree implicitly_declare_fn (special_function_kind, tree,
@@ -6850,8 +6840,7 @@ extern void end_template_parm_list (void);
extern void end_template_decl (void);
extern tree maybe_update_decl_type (tree, tree);
extern bool check_default_tmpl_args (tree, tree, bool, bool, int);
-extern tree push_template_decl (tree);
-extern tree push_template_decl_real (tree, bool);
+extern tree push_template_decl (tree, bool is_friend = false);
extern tree add_inherited_template_parms (tree, tree);
extern void template_parm_level_and_index (tree, int*, int*);
extern bool redeclare_class_template (tree, tree, tree);
@@ -7279,6 +7268,7 @@ extern bool lambda_fn_in_template_p (tree);
extern void maybe_add_lambda_conv_op (tree);
extern bool is_lambda_ignored_entity (tree);
extern bool lambda_static_thunk_p (tree);
+extern bool call_from_lambda_thunk_p (tree);
extern tree finish_builtin_launder (location_t, tree,
tsubst_flags_t);
extern tree cp_build_vec_convert (tree, location_t, tree,
@@ -7365,7 +7355,7 @@ inline tree ovl_first (tree) ATTRIBUTE_PURE;
extern tree ovl_make (tree fn,
tree next = NULL_TREE);
extern tree ovl_insert (tree fn, tree maybe_ovl,
- bool using_p = false);
+ int using_or_hidden = 0);
extern tree ovl_skip_hidden (tree) ATTRIBUTE_PURE;
extern void lookup_mark (tree lookup, bool val);
extern tree lookup_add (tree fns, tree lookup);
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index d10c18d..058b9c2 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1420,6 +1420,16 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t)
}
/* fall through */
+ case OFFSET_TYPE:
+ if (TYPE_PTRDATAMEM_P (t))
+ {
+ pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
+ pp_cxx_whitespace (pp);
+ pp_cxx_ptr_operator (pp, t);
+ break;
+ }
+ /* fall through */
+
default:
if (!(TREE_CODE (t) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (t)))
pp_c_specifier_qualifier_list (pp, t);
@@ -1753,7 +1763,20 @@ pp_cxx_function_definition (cxx_pretty_printer *pp, tree t)
void
cxx_pretty_printer::abstract_declarator (tree t)
{
- if (TYPE_PTRMEM_P (t))
+ /* pp_cxx_ptr_operator prints '(' for a pointer-to-member function,
+ or a pointer-to-data-member of array type:
+
+ void (X::*)()
+ int (X::*)[5]
+
+ but not for a pointer-to-data-member of non-array type:
+
+ int X::*
+
+ so be mindful of that. */
+ if (TYPE_PTRMEMFUNC_P (t)
+ || (TYPE_PTRDATAMEM_P (t)
+ && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE))
pp_cxx_right_paren (this);
else if (INDIRECT_TYPE_P (t))
{
@@ -1785,6 +1808,11 @@ cxx_pretty_printer::direct_abstract_declarator (tree t)
direct_abstract_declarator (TYPE_PTRMEMFUNC_FN_TYPE (t));
break;
+ case OFFSET_TYPE:
+ if (TYPE_PTRDATAMEM_P (t))
+ direct_abstract_declarator (TREE_TYPE (t));
+ break;
+
case METHOD_TYPE:
case FUNCTION_TYPE:
pp_cxx_parameter_declaration_clause (this, t);
@@ -1837,7 +1865,10 @@ cxx_pretty_printer::type_id (tree t)
case UNDERLYING_TYPE:
case DECLTYPE_TYPE:
case TEMPLATE_ID_EXPR:
+ case OFFSET_TYPE:
pp_cxx_type_specifier_seq (this, t);
+ if (TYPE_PTRMEM_P (t))
+ abstract_declarator (t);
break;
case TYPE_PACK_EXPANSION:
@@ -1910,6 +1941,8 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
&& TYPE_P (DECL_TEMPLATE_RESULT (arg))))
pp->type_id (arg);
+ else if (template_parm_object_p (arg))
+ pp->expression (DECL_INITIAL (arg));
else
pp->expression (arg);
}
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 13f065d..2de4e16 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -75,7 +75,7 @@ static void record_unknown_type (tree, const char *);
static int member_function_or_else (tree, tree, enum overload_flags);
static tree local_variable_p_walkfn (tree *, int *, void *);
static const char *tag_name (enum tag_types);
-static tree lookup_and_check_tag (enum tag_types, tree, tag_scope, bool);
+static tree lookup_and_check_tag (enum tag_types, tree, TAG_how, bool);
static void maybe_deduce_size_from_array_init (tree, tree);
static void layout_var_decl (tree);
static tree check_initializer (tree, tree, int, vec<tree, va_gc> **);
@@ -1340,19 +1340,17 @@ check_redeclaration_no_default_args (tree decl)
the function or function template in the translation unit." */
static void
-check_no_redeclaration_friend_default_args (tree olddecl, tree newdecl,
- bool olddecl_hidden_friend_p)
+check_no_redeclaration_friend_default_args (tree olddecl, tree newdecl)
{
- if (!olddecl_hidden_friend_p && !DECL_FRIEND_P (newdecl))
+ if (!DECL_UNIQUE_FRIEND_P (olddecl) && !DECL_UNIQUE_FRIEND_P (newdecl))
return;
- tree t1 = FUNCTION_FIRST_USER_PARMTYPE (olddecl);
- tree t2 = FUNCTION_FIRST_USER_PARMTYPE (newdecl);
-
- for (; t1 && t1 != void_list_node;
+ for (tree t1 = FUNCTION_FIRST_USER_PARMTYPE (olddecl),
+ t2 = FUNCTION_FIRST_USER_PARMTYPE (newdecl);
+ t1 && t1 != void_list_node;
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
- if ((olddecl_hidden_friend_p && TREE_PURPOSE (t1))
- || (DECL_FRIEND_P (newdecl) && TREE_PURPOSE (t2)))
+ if ((DECL_UNIQUE_FRIEND_P (olddecl) && TREE_PURPOSE (t1))
+ || (DECL_UNIQUE_FRIEND_P (newdecl) && TREE_PURPOSE (t2)))
{
auto_diagnostic_group d;
if (permerror (DECL_SOURCE_LOCATION (newdecl),
@@ -1435,14 +1433,17 @@ duplicate_function_template_decls (tree newdecl, tree olddecl)
If NEWDECL is not a redeclaration of OLDDECL, NULL_TREE is
returned.
- NEWDECL_IS_FRIEND is true if NEWDECL was declared as a friend. */
+ HIDING is true if the new decl is being hidden. WAS_HIDDEN is true
+ if the old decl was hidden.
+
+ Hidden decls can be anticipated builtins, injected friends, or
+ (coming soon) injected from a local-extern decl. */
tree
-duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
+duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
{
unsigned olddecl_uid = DECL_UID (olddecl);
- int olddecl_friend = 0, types_match = 0, hidden_friend = 0;
- int olddecl_hidden_friend = 0;
+ int types_match = 0;
int new_defines_function = 0;
tree new_template_info;
location_t olddecl_loc = DECL_SOURCE_LOCATION (olddecl);
@@ -1464,15 +1465,13 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_ARTIFICIAL (olddecl)
- /* A C++20 implicit friend operator== uses the normal path (94462). */
- && !DECL_HIDDEN_FRIEND_P (olddecl))
+ && DECL_UNDECLARED_BUILTIN_P (olddecl))
{
if (TREE_CODE (newdecl) != FUNCTION_DECL)
{
/* Avoid warnings redeclaring built-ins which have not been
explicitly declared. */
- if (DECL_ANTICIPATED (olddecl))
+ if (was_hidden)
{
if (TREE_PUBLIC (newdecl)
&& CP_DECL_CONTEXT (newdecl) == global_namespace)
@@ -1508,20 +1507,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
"declaration %q#D", newdecl, olddecl);
return NULL_TREE;
}
- else if (DECL_OMP_DECLARE_REDUCTION_P (olddecl))
- {
- gcc_assert (DECL_OMP_DECLARE_REDUCTION_P (newdecl));
- error_at (newdecl_loc,
- "redeclaration of %<pragma omp declare reduction%>");
- inform (olddecl_loc,
- "previous %<pragma omp declare reduction%> declaration");
- return error_mark_node;
- }
else if (!types_match)
{
/* Avoid warnings redeclaring built-ins which have not been
explicitly declared. */
- if (DECL_ANTICIPATED (olddecl))
+ if (was_hidden)
{
tree t1, t2;
@@ -1561,7 +1551,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
types_match = decls_match (newdecl, olddecl);
if (types_match)
return duplicate_decls (newdecl, olddecl,
- newdecl_is_friend);
+ hiding, was_hidden);
TYPE_ARG_TYPES (TREE_TYPE (olddecl)) = oldargs;
}
goto next_arg;
@@ -1653,7 +1643,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* If a function is explicitly declared "throw ()", propagate that to
the corresponding builtin. */
if (DECL_BUILT_IN_CLASS (olddecl) == BUILT_IN_NORMAL
- && DECL_ANTICIPATED (olddecl)
+ && was_hidden
&& TREE_NOTHROW (newdecl)
&& !TREE_NOTHROW (olddecl))
{
@@ -1816,6 +1806,17 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
}
}
else if (TREE_CODE (newdecl) == FUNCTION_DECL
+ && DECL_OMP_DECLARE_REDUCTION_P (newdecl))
+ {
+ /* OMP UDRs are never duplicates. */
+ gcc_assert (DECL_OMP_DECLARE_REDUCTION_P (olddecl));
+ error_at (newdecl_loc,
+ "redeclaration of %<pragma omp declare reduction%>");
+ inform (olddecl_loc,
+ "previous %<pragma omp declare reduction%> declaration");
+ return error_mark_node;
+ }
+ else if (TREE_CODE (newdecl) == FUNCTION_DECL
&& ((DECL_TEMPLATE_SPECIALIZATION (olddecl)
&& (!DECL_TEMPLATE_INFO (newdecl)
|| (DECL_TI_TEMPLATE (newdecl)
@@ -1984,8 +1985,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
argument expression, that declaration... shall be the only
declaration of the function or function template in the
translation unit." */
- check_no_redeclaration_friend_default_args
- (olddecl, newdecl, DECL_HIDDEN_FRIEND_P (olddecl));
+ check_no_redeclaration_friend_default_args (olddecl, newdecl);
}
}
}
@@ -2002,6 +2002,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
|| DECL_IMPLICIT_TYPEDEF_P (newdecl)))
return NULL_TREE;
+ if (DECL_TEMPLATE_PARM_P (olddecl) != DECL_TEMPLATE_PARM_P (newdecl))
+ return NULL_TREE;
+
if (!validate_constexpr_redeclaration (olddecl, newdecl))
return error_mark_node;
@@ -2075,8 +2078,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& !(new_defines_function && DECL_INITIAL (olddecl) == NULL_TREE)
/* Don't warn about extern decl followed by definition. */
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))
- /* Don't warn about friends, let add_friend take care of it. */
- && ! (newdecl_is_friend || DECL_FRIEND_P (olddecl))
+ /* Don't warn if at least one is/was hidden. */
+ && !(hiding || was_hidden)
/* Don't warn about declaration followed by specialization. */
&& (! DECL_TEMPLATE_SPECIALIZATION (newdecl)
|| DECL_TEMPLATE_SPECIALIZATION (olddecl)))
@@ -2132,20 +2135,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
else
DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
- if (DECL_DECLARES_FUNCTION_P (olddecl))
- {
- olddecl_friend = DECL_FRIEND_P (olddecl);
- olddecl_hidden_friend = DECL_HIDDEN_FRIEND_P (olddecl);
- hidden_friend = (DECL_ANTICIPATED (olddecl)
- && DECL_HIDDEN_FRIEND_P (olddecl)
- && newdecl_is_friend);
- if (!hidden_friend)
- {
- DECL_ANTICIPATED (olddecl) = 0;
- DECL_HIDDEN_FRIEND_P (olddecl) = 0;
- }
- }
-
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
tree old_result = DECL_TEMPLATE_RESULT (olddecl);
@@ -2172,8 +2161,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
declaration of the function or function template in the
translation unit." */
check_no_redeclaration_friend_default_args
- (old_result, new_result, olddecl_hidden_friend);
+ (old_result, new_result);
}
+ if (!DECL_UNIQUE_FRIEND_P (old_result))
+ DECL_UNIQUE_FRIEND_P (new_result) = false;
check_default_args (newdecl);
@@ -2371,6 +2362,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& !DECL_FUNCTION_SPECIFIC_OPTIMIZATION (newdecl))
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (newdecl)
= DECL_FUNCTION_SPECIFIC_OPTIMIZATION (olddecl);
+
+ if (!DECL_UNIQUE_FRIEND_P (olddecl))
+ DECL_UNIQUE_FRIEND_P (newdecl) = false;
}
else
{
@@ -2890,13 +2884,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
}
DECL_UID (olddecl) = olddecl_uid;
- if (olddecl_friend)
- DECL_FRIEND_P (olddecl) = 1;
- if (hidden_friend)
- {
- DECL_ANTICIPATED (olddecl) = 1;
- DECL_HIDDEN_FRIEND_P (olddecl) = 1;
- }
/* NEWDECL contains the merged attribute lists.
Update OLDDECL to be the same. */
@@ -3003,6 +2990,10 @@ redeclaration_error_message (tree newdecl, tree olddecl)
}
}
+ if (deduction_guide_p (olddecl)
+ && deduction_guide_p (newdecl))
+ return G_("deduction guide %q+D redeclared");
+
/* [class.compare.default]: A definition of a comparison operator as
defaulted that appears in a class shall be the first declaration of
that function. */
@@ -3053,29 +3044,34 @@ redeclaration_error_message (tree newdecl, tree olddecl)
"%<gnu_inline%> attribute");
else
return G_("%q+D redeclared inline without "
- "%<gnu_inline%> attribute");
+ "%<gnu_inline%> attribute");
}
}
- /* Core issue #226 (C++0x):
-
+ if (deduction_guide_p (olddecl)
+ && deduction_guide_p (newdecl))
+ return G_("deduction guide %q+D redeclared");
+
+ /* Core issue #226 (C++11):
+
If a friend function template declaration specifies a
default template-argument, that declaration shall be a
definition and shall be the only declaration of the
function template in the translation unit. */
- if ((cxx_dialect != cxx98)
- && TREE_CODE (ot) == FUNCTION_DECL && DECL_FRIEND_P (ot)
- && !check_default_tmpl_args (nt, DECL_TEMPLATE_PARMS (newdecl),
+ if ((cxx_dialect != cxx98)
+ && TREE_CODE (ot) == FUNCTION_DECL && DECL_UNIQUE_FRIEND_P (ot)
+ && !check_default_tmpl_args (nt, DECL_TEMPLATE_PARMS (newdecl),
/*is_primary=*/true,
/*is_partial=*/false,
/*is_friend_decl=*/2))
return G_("redeclaration of friend %q#D "
- "may not have default template arguments");
+ "may not have default template arguments");
return NULL;
}
else if (VAR_P (newdecl)
- && CP_DECL_THREAD_LOCAL_P (newdecl) != CP_DECL_THREAD_LOCAL_P (olddecl)
+ && (CP_DECL_THREAD_LOCAL_P (newdecl)
+ != CP_DECL_THREAD_LOCAL_P (olddecl))
&& (! DECL_LANG_SPECIFIC (olddecl)
|| ! CP_DECL_THREADPRIVATE_P (olddecl)
|| CP_DECL_THREAD_LOCAL_P (newdecl)))
@@ -4589,38 +4585,6 @@ cxx_init_decl_processing (void)
using_eh_for_cleanups ();
}
-/* Generate an initializer for a function naming variable from
- NAME. NAME may be NULL, to indicate a dependent name. TYPE_P is
- filled in with the type of the init. */
-
-tree
-cp_fname_init (const char* name, tree *type_p)
-{
- tree domain = NULL_TREE;
- tree type;
- tree init = NULL_TREE;
- size_t length = 0;
-
- if (name)
- {
- length = strlen (name);
- domain = build_index_type (size_int (length));
- init = build_string (length + 1, name);
- }
-
- type = cp_build_qualified_type (char_type_node, TYPE_QUAL_CONST);
- type = build_cplus_array_type (type, domain);
-
- *type_p = type;
-
- if (init)
- TREE_TYPE (init) = type;
- else
- init = error_mark_node;
-
- return init;
-}
-
/* Create the VAR_DECL for __FUNCTION__ etc. ID is the name to give
the decl, LOC is the location to give the decl, NAME is the
initialization string and TYPE_DEP indicates whether NAME depended
@@ -4631,31 +4595,45 @@ cp_fname_init (const char* name, tree *type_p)
static tree
cp_make_fname_decl (location_t loc, tree id, int type_dep)
{
- const char * name = NULL;
- bool release_name = false;
+ tree domain = NULL_TREE;
+ tree init = NULL_TREE;
+
if (!(type_dep && in_template_function ()))
{
+ const char *name = NULL;
+ bool release_name = false;
+
if (current_function_decl == NULL_TREE)
name = "top level";
- else if (type_dep == 1) /* __PRETTY_FUNCTION__ */
- name = cxx_printable_name (current_function_decl, 2);
- else if (type_dep == 0) /* __FUNCTION__ */
+ else if (type_dep == 0)
{
+ /* __FUNCTION__ */
name = fname_as_string (type_dep);
release_name = true;
}
else
- gcc_unreachable ();
+ {
+ /* __PRETTY_FUNCTION__ */
+ gcc_checking_assert (type_dep == 1);
+ name = cxx_printable_name (current_function_decl, 2);
+ }
+
+ size_t length = strlen (name);
+ domain = build_index_type (size_int (length));
+ init = build_string (length + 1, name);
+ if (release_name)
+ free (const_cast<char *> (name));
}
- tree type;
- tree init = cp_fname_init (name, &type);
- tree decl = build_decl (loc, VAR_DECL, id, type);
- if (release_name)
- free (CONST_CAST (char *, name));
+ tree type = cp_build_qualified_type (char_type_node, TYPE_QUAL_CONST);
+ type = build_cplus_array_type (type, domain);
- /* As we're using pushdecl_with_scope, we must set the context. */
- DECL_CONTEXT (decl) = current_function_decl;
+ if (init)
+ TREE_TYPE (init) = type;
+ else
+ init = error_mark_node;
+
+ tree decl = build_decl (loc, VAR_DECL, id, type);
TREE_READONLY (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
@@ -4664,13 +4642,10 @@ cp_make_fname_decl (location_t loc, tree id, int type_dep)
TREE_USED (decl) = 1;
- if (init)
- {
- SET_DECL_VALUE_EXPR (decl, init);
- DECL_HAS_VALUE_EXPR_P (decl) = 1;
- /* For decl_constant_var_p. */
- DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = 1;
- }
+ SET_DECL_VALUE_EXPR (decl, init);
+ DECL_HAS_VALUE_EXPR_P (decl) = 1;
+ /* For decl_constant_var_p. */
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = 1;
if (current_function_decl)
{
@@ -4682,7 +4657,7 @@ cp_make_fname_decl (location_t loc, tree id, int type_dep)
else
{
DECL_THIS_STATIC (decl) = true;
- pushdecl_top_level_and_finish (decl, NULL_TREE);
+ decl = pushdecl_top_level_and_finish (decl, NULL_TREE);
}
return decl;
@@ -4706,16 +4681,17 @@ cxx_builtin_function (tree decl)
tree id = DECL_NAME (decl);
const char *name = IDENTIFIER_POINTER (id);
+ bool hiding = false;
if (name[0] != '_' || name[1] != '_')
/* In the user's namespace, it must be declared before use. */
- DECL_ANTICIPATED (decl) = 1;
+ hiding = true;
else if (IDENTIFIER_LENGTH (id) > strlen ("___chk")
&& 0 != strncmp (name + 2, "builtin_", strlen ("builtin_"))
&& 0 == memcmp (name + IDENTIFIER_LENGTH (id) - strlen ("_chk"),
"_chk", strlen ("_chk") + 1))
/* Treat __*_chk fortification functions as anticipated as well,
unless they are __builtin_*_chk. */
- DECL_ANTICIPATED (decl) = 1;
+ hiding = true;
/* All builtins that don't begin with an '_' should additionally
go in the 'std' namespace. */
@@ -4725,12 +4701,12 @@ cxx_builtin_function (tree decl)
push_nested_namespace (std_node);
DECL_CONTEXT (std_decl) = FROB_CONTEXT (std_node);
- pushdecl (std_decl);
+ pushdecl (std_decl, hiding);
pop_nested_namespace (std_node);
}
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
- decl = pushdecl (decl);
+ decl = pushdecl (decl, hiding);
return decl;
}
@@ -5353,8 +5329,7 @@ start_decl (const cp_declarator *declarator,
about this situation, and so we check here. */
if (initialized && DECL_INITIALIZED_IN_CLASS_P (field))
error ("duplicate initialization of %qD", decl);
- field = duplicate_decls (decl, field,
- /*newdecl_is_friend=*/false);
+ field = duplicate_decls (decl, field);
if (field == error_mark_node)
return error_mark_node;
else if (field)
@@ -5368,8 +5343,7 @@ start_decl (const cp_declarator *declarator,
? current_template_parms
: NULL_TREE);
if (field && field != error_mark_node
- && duplicate_decls (decl, field,
- /*newdecl_is_friend=*/false))
+ && duplicate_decls (decl, field))
decl = field;
}
@@ -5854,7 +5828,8 @@ layout_var_decl (tree decl)
&& DECL_SIZE (decl) != NULL_TREE
&& ! TREE_CONSTANT (DECL_SIZE (decl)))
{
- if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
+ if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST
+ && !DECL_LOCAL_DECL_P (decl))
constant_expression_warning (DECL_SIZE (decl));
else
{
@@ -9919,7 +9894,7 @@ grokfndecl (tree ctype,
/* Attempt to merge the declarations. This can fail, in
the case of some invalid specialization declarations. */
pushed_scope = push_scope (ctype);
- ok = duplicate_decls (decl, old_decl, friendp);
+ ok = duplicate_decls (decl, old_decl);
if (pushed_scope)
pop_scope (pushed_scope);
if (!ok)
@@ -14197,6 +14172,10 @@ copy_fn_p (const_tree d)
accept those as copy functions. */
return 0;
+ if (!DECL_CONSTRUCTOR_P (d)
+ && DECL_NAME (d) != assign_op_identifier)
+ return 0;
+
args = FUNCTION_FIRST_USER_PARMTYPE (d);
if (!args)
return 0;
@@ -14270,6 +14249,10 @@ move_signature_fn_p (const_tree d)
tree arg_type;
bool result = false;
+ if (!DECL_CONSTRUCTOR_P (d)
+ && DECL_NAME (d) != assign_op_identifier)
+ return 0;
+
args = FUNCTION_FIRST_USER_PARMTYPE (d);
if (!args)
return 0;
@@ -14849,18 +14832,17 @@ check_elaborated_type_specifier (enum tag_types tag_code,
return type;
}
-/* Lookup NAME in elaborate type specifier in scope according to
- SCOPE and issue diagnostics if necessary.
- Return *_TYPE node upon success, NULL_TREE when the NAME is not
- found, and ERROR_MARK_NODE for type error. */
+/* Lookup NAME of an elaborated type specifier according to SCOPE and
+ issue diagnostics if necessary. Return *_TYPE node upon success,
+ NULL_TREE when the NAME is not found, and ERROR_MARK_NODE for type
+ error. */
static tree
lookup_and_check_tag (enum tag_types tag_code, tree name,
- tag_scope scope, bool template_header_p)
+ TAG_how how, bool template_header_p)
{
- tree t;
tree decl;
- if (scope == ts_global)
+ if (how == TAG_how::GLOBAL)
{
/* First try ordinary name lookup, ignoring hidden class name
injected via friend declaration. */
@@ -14873,77 +14855,78 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
If we find one, that name will be made visible rather than
creating a new tag. */
if (!decl)
- decl = lookup_type_scope (name, ts_within_enclosing_non_class);
+ decl = lookup_elaborated_type (name, TAG_how::INNERMOST_NON_CLASS);
}
else
- decl = lookup_type_scope (name, scope);
-
- if (decl
- && (DECL_CLASS_TEMPLATE_P (decl)
- /* If scope is ts_current we're defining a class, so ignore a
- template template parameter. */
- || (scope != ts_current
- && DECL_TEMPLATE_TEMPLATE_PARM_P (decl))))
- decl = DECL_TEMPLATE_RESULT (decl);
-
- if (decl && TREE_CODE (decl) == TYPE_DECL)
- {
- /* Look for invalid nested type:
- class C {
- class C {};
- }; */
- if (scope == ts_current && DECL_SELF_REFERENCE_P (decl))
- {
- error ("%qD has the same name as the class in which it is "
- "declared",
- decl);
- return error_mark_node;
- }
+ decl = lookup_elaborated_type (name, how);
- /* Two cases we need to consider when deciding if a class
- template is allowed as an elaborated type specifier:
- 1. It is a self reference to its own class.
- 2. It comes with a template header.
- For example:
-
- template <class T> class C {
- class C *c1; // DECL_SELF_REFERENCE_P is true
- class D;
- };
- template <class U> class C; // template_header_p is true
- template <class T> class C<T>::D {
- class C *c2; // DECL_SELF_REFERENCE_P is true
- }; */
-
- t = check_elaborated_type_specifier (tag_code,
- decl,
- template_header_p
- | DECL_SELF_REFERENCE_P (decl));
- if (template_header_p && t && CLASS_TYPE_P (t)
- && (!CLASSTYPE_TEMPLATE_INFO (t)
- || (!PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))))
- {
- error ("%qT is not a template", t);
- inform (location_of (t), "previous declaration here");
- if (TYPE_CLASS_SCOPE_P (t)
- && CLASSTYPE_TEMPLATE_INFO (TYPE_CONTEXT (t)))
- inform (input_location,
- "perhaps you want to explicitly add %<%T::%>",
- TYPE_CONTEXT (t));
- t = error_mark_node;
- }
+ if (!decl)
+ /* We found nothing. */
+ return NULL_TREE;
- return t;
- }
- else if (decl && TREE_CODE (decl) == TREE_LIST)
+ if (TREE_CODE (decl) == TREE_LIST)
{
error ("reference to %qD is ambiguous", name);
print_candidates (decl);
return error_mark_node;
}
- else
+
+ if (DECL_CLASS_TEMPLATE_P (decl)
+ /* If scope is TAG_how::CURRENT_ONLY we're defining a class,
+ so ignore a template template parameter. */
+ || (how != TAG_how::CURRENT_ONLY && DECL_TEMPLATE_TEMPLATE_PARM_P (decl)))
+ decl = DECL_TEMPLATE_RESULT (decl);
+
+ if (TREE_CODE (decl) != TYPE_DECL)
+ /* Found not-a-type. */
return NULL_TREE;
+
+ /* Look for invalid nested type:
+ class C {
+ class C {};
+ }; */
+ if (how == TAG_how::CURRENT_ONLY && DECL_SELF_REFERENCE_P (decl))
+ {
+ error ("%qD has the same name as the class in which it is "
+ "declared", decl);
+ return error_mark_node;
+ }
+
+ /* Two cases we need to consider when deciding if a class
+ template is allowed as an elaborated type specifier:
+ 1. It is a self reference to its own class.
+ 2. It comes with a template header.
+
+ For example:
+
+ template <class T> class C {
+ class C *c1; // DECL_SELF_REFERENCE_P is true
+ class D;
+ };
+ template <class U> class C; // template_header_p is true
+ template <class T> class C<T>::D {
+ class C *c2; // DECL_SELF_REFERENCE_P is true
+ }; */
+
+ tree t = check_elaborated_type_specifier (tag_code, decl,
+ template_header_p
+ | DECL_SELF_REFERENCE_P (decl));
+ if (template_header_p && t && CLASS_TYPE_P (t)
+ && (!CLASSTYPE_TEMPLATE_INFO (t)
+ || (!PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))))
+ {
+ error ("%qT is not a template", t);
+ inform (location_of (t), "previous declaration here");
+ if (TYPE_CLASS_SCOPE_P (t)
+ && CLASSTYPE_TEMPLATE_INFO (TYPE_CONTEXT (t)))
+ inform (input_location,
+ "perhaps you want to explicitly add %<%T::%>",
+ TYPE_CONTEXT (t));
+ return error_mark_node;
+ }
+
+ return t;
}
/* Get the struct, enum or union (TAG_CODE says which) with tag NAME.
@@ -14963,7 +14946,7 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
static tree
xref_tag_1 (enum tag_types tag_code, tree name,
- tag_scope scope, bool template_header_p)
+ TAG_how how, bool template_header_p)
{
enum tree_code code;
tree context = NULL_TREE;
@@ -14989,23 +14972,23 @@ xref_tag_1 (enum tag_types tag_code, tree name,
/* In case of anonymous name, xref_tag is only called to
make type node and push name. Name lookup is not required. */
tree t = NULL_TREE;
- if (scope != ts_lambda && !IDENTIFIER_ANON_P (name))
- t = lookup_and_check_tag (tag_code, name, scope, template_header_p);
-
+ if (!IDENTIFIER_ANON_P (name))
+ t = lookup_and_check_tag (tag_code, name, how, template_header_p);
+
if (t == error_mark_node)
return error_mark_node;
- if (scope != ts_current && t && current_class_type
+ if (how != TAG_how::CURRENT_ONLY && t && current_class_type
&& template_class_depth (current_class_type)
&& template_header_p)
{
if (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM)
return t;
- /* Since SCOPE is not TS_CURRENT, we are not looking at a
- definition of this tag. Since, in addition, we are currently
- processing a (member) template declaration of a template
- class, we must be very careful; consider:
+ /* Since HOW is not TAG_how::CURRENT_ONLY, we are not looking at
+ a definition of this tag. Since, in addition, we are
+ currently processing a (member) template declaration of a
+ template class, we must be very careful; consider:
template <class X> struct S1
@@ -15044,19 +15027,14 @@ xref_tag_1 (enum tag_types tag_code, tree name,
error ("use of enum %q#D without previous declaration", name);
return error_mark_node;
}
- else
- {
- t = make_class_type (code);
- TYPE_CONTEXT (t) = context;
- if (scope == ts_lambda)
- {
- /* Mark it as a lambda type. */
- CLASSTYPE_LAMBDA_EXPR (t) = error_mark_node;
- /* And push it into current scope. */
- scope = ts_current;
- }
- t = pushtag (name, t, scope);
- }
+
+ t = make_class_type (code);
+ TYPE_CONTEXT (t) = context;
+ if (IDENTIFIER_LAMBDA_P (name))
+ /* Mark it as a lambda type right now. Our caller will
+ correct the value. */
+ CLASSTYPE_LAMBDA_EXPR (t) = error_mark_node;
+ t = pushtag (name, t, how);
}
else
{
@@ -15081,23 +15059,6 @@ xref_tag_1 (enum tag_types tag_code, tree name,
inform (location_of (t), "previous declaration %qD", t);
return error_mark_node;
}
-
- if (scope != ts_within_enclosing_non_class && TYPE_HIDDEN_P (t))
- {
- /* This is no longer an invisible friend. Make it
- visible. */
- tree decl = TYPE_NAME (t);
-
- DECL_ANTICIPATED (decl) = false;
- DECL_FRIEND_P (decl) = false;
-
- if (TYPE_TEMPLATE_INFO (t))
- {
- tree tmpl = TYPE_TI_TEMPLATE (t);
- DECL_ANTICIPATED (tmpl) = false;
- DECL_FRIEND_P (tmpl) = false;
- }
- }
}
return t;
@@ -15107,33 +15068,14 @@ xref_tag_1 (enum tag_types tag_code, tree name,
tree
xref_tag (enum tag_types tag_code, tree name,
- tag_scope scope, bool template_header_p)
+ TAG_how how, bool template_header_p)
{
- tree ret;
- bool subtime;
- subtime = timevar_cond_start (TV_NAME_LOOKUP);
- ret = xref_tag_1 (tag_code, name, scope, template_header_p);
+ bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
+ tree ret = xref_tag_1 (tag_code, name, how, template_header_p);
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return ret;
}
-
-tree
-xref_tag_from_type (tree old, tree id, tag_scope scope)
-{
- enum tag_types tag_kind;
-
- if (TREE_CODE (old) == RECORD_TYPE)
- tag_kind = (CLASSTYPE_DECLARED_CLASS (old) ? class_type : record_type);
- else
- tag_kind = union_type;
-
- if (id == NULL_TREE)
- id = TYPE_IDENTIFIER (old);
-
- return xref_tag (tag_kind, id, scope, false);
-}
-
/* Create the binfo hierarchy for REF with (possibly NULL) base list
BASE_LIST. For each element on BASE_LIST the TREE_PURPOSE is an
access_* node, and the TREE_VALUE is the type of the base-class.
@@ -15428,7 +15370,7 @@ start_enum (tree name, tree enumtype, tree underlying_type,
forward reference. */
if (!enumtype)
enumtype = lookup_and_check_tag (enum_type, name,
- /*tag_scope=*/ts_current,
+ /*tag_scope=*/TAG_how::CURRENT_ONLY,
/*template_header_p=*/false);
/* In case of a template_decl, the only check that should be deferred
@@ -15490,7 +15432,7 @@ start_enum (tree name, tree enumtype, tree underlying_type,
|| TREE_CODE (enumtype) != ENUMERAL_TYPE)
{
enumtype = cxx_make_type (ENUMERAL_TYPE);
- enumtype = pushtag (name, enumtype, /*tag_scope=*/ts_current);
+ enumtype = pushtag (name, enumtype);
/* std::byte aliases anything. */
if (enumtype != error_mark_node
@@ -15499,8 +15441,7 @@ start_enum (tree name, tree enumtype, tree underlying_type,
TYPE_ALIAS_SET (enumtype) = 0;
}
else
- enumtype = xref_tag (enum_type, name, /*tag_scope=*/ts_current,
- false);
+ enumtype = xref_tag (enum_type, name);
if (enumtype == error_mark_node)
return error_mark_node;
@@ -16175,36 +16116,21 @@ bool
start_preparsed_function (tree decl1, tree attrs, int flags)
{
tree ctype = NULL_TREE;
- tree fntype;
- tree restype;
- int doing_friend = 0;
- cp_binding_level *bl;
- tree current_function_parms;
- struct c_fileinfo *finfo
- = get_fileinfo (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1)));
- bool honor_interface;
+ bool doing_friend = false;
/* Sanity check. */
gcc_assert (VOID_TYPE_P (TREE_VALUE (void_list_node)));
gcc_assert (TREE_CHAIN (void_list_node) == NULL_TREE);
- fntype = TREE_TYPE (decl1);
+ tree fntype = TREE_TYPE (decl1);
if (TREE_CODE (fntype) == METHOD_TYPE)
ctype = TYPE_METHOD_BASETYPE (fntype);
-
- /* ISO C++ 11.4/5. A friend function defined in a class is in
- the (lexical) scope of the class in which it is defined. */
- if (!ctype && DECL_FRIEND_P (decl1))
+ else
{
ctype = DECL_FRIEND_CONTEXT (decl1);
- /* CTYPE could be null here if we're dealing with a template;
- for example, `inline friend float foo()' inside a template
- will have no CTYPE set. */
- if (ctype && TREE_CODE (ctype) != RECORD_TYPE)
- ctype = NULL_TREE;
- else
- doing_friend = 1;
+ if (ctype)
+ doing_friend = true;
}
if (DECL_DECLARED_INLINE_P (decl1)
@@ -16271,7 +16197,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
by push_nested_class.) */
if (processing_template_decl)
{
- tree newdecl1 = push_template_decl (decl1);
+ tree newdecl1 = push_template_decl (decl1, doing_friend);
if (newdecl1 == error_mark_node)
{
if (ctype || DECL_STATIC_FUNCTION_P (decl1))
@@ -16287,7 +16213,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
check_function_type (decl1, DECL_ARGUMENTS (decl1));
/* Build the return declaration for the function. */
- restype = TREE_TYPE (fntype);
+ tree restype = TREE_TYPE (fntype);
if (DECL_RESULT (decl1) == NULL_TREE)
{
@@ -16377,7 +16303,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
/* Save the parm names or decls from this function's declarator
where store_parm_decls will find them. */
- current_function_parms = DECL_ARGUMENTS (decl1);
+ tree current_function_parms = DECL_ARGUMENTS (decl1);
/* Let the user know we're compiling this function. */
announce_function (decl1);
@@ -16394,7 +16320,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
even when processing a template; this is how we get
CFUN set up, and our per-function variables initialized.
FIXME factor out the non-RTL stuff. */
- bl = current_binding_level;
+ cp_binding_level *bl = current_binding_level;
allocate_struct_function (decl1, processing_template_decl);
/* Initialize the language data structures. Whenever we start
@@ -16449,14 +16375,16 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
}
}
- honor_interface = (!DECL_TEMPLATE_INSTANTIATION (decl1)
- /* Implicitly-defined methods (like the
- destructor for a class in which no destructor
- is explicitly declared) must not be defined
- until their definition is needed. So, we
- ignore interface specifications for
- compiler-generated functions. */
- && !DECL_ARTIFICIAL (decl1));
+ bool honor_interface = (!DECL_TEMPLATE_INSTANTIATION (decl1)
+ /* Implicitly-defined methods (like the
+ destructor for a class in which no destructor
+ is explicitly declared) must not be defined
+ until their definition is needed. So, we
+ ignore interface specifications for
+ compiler-generated functions. */
+ && !DECL_ARTIFICIAL (decl1));
+ struct c_fileinfo *finfo
+ = get_fileinfo (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1)));
if (processing_template_decl)
/* Don't mess with interface flags. */;
@@ -17376,18 +17304,17 @@ grokmethod (cp_decl_specifier_seq *declspecs,
/* We process method specializations in finish_struct_1. */
if (processing_template_decl && !DECL_TEMPLATE_SPECIALIZATION (fndecl))
{
- fndecl = push_template_decl (fndecl);
+ /* Avoid calling decl_spec_seq... until we have to. */
+ bool friendp = decl_spec_seq_has_spec_p (declspecs, ds_friend);
+ fndecl = push_template_decl (fndecl, friendp);
if (fndecl == error_mark_node)
return fndecl;
}
- if (! DECL_FRIEND_P (fndecl))
+ if (DECL_CHAIN (fndecl) && !decl_spec_seq_has_spec_p (declspecs, ds_friend))
{
- if (DECL_CHAIN (fndecl))
- {
- fndecl = copy_node (fndecl);
- TREE_CHAIN (fndecl) = NULL_TREE;
- }
+ fndecl = copy_node (fndecl);
+ TREE_CHAIN (fndecl) = NULL_TREE;
}
cp_finish_decl (fndecl, NULL_TREE, false, NULL_TREE, 0);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index fd48a21..2f0d637 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1021,7 +1021,7 @@ grokfield (const cp_declarator *declarator,
asmspec_tree, flags);
/* Pass friends back this way. */
- if (DECL_FRIEND_P (value))
+ if (DECL_UNIQUE_FRIEND_P (value))
return void_type_node;
DECL_IN_AGGR_P (value) = 1;
@@ -5567,6 +5567,22 @@ mark_used (tree decl, tsubst_flags_t complain)
return false;
}
+ if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_LOCAL_DECL_P (decl))
+ {
+ if (!DECL_LANG_SPECIFIC (decl))
+ /* An unresolved dependent local extern. */
+ return true;
+
+ DECL_ODR_USED (decl) = 1;
+ auto alias = DECL_LOCAL_DECL_ALIAS (decl);
+ if (!alias || alias == error_mark_node)
+ return true;
+
+ /* Process the underlying decl. */
+ decl = alias;
+ TREE_USED (decl) = true;
+ }
+
cp_warn_deprecated_use (decl, complain);
/* We can only check DECL_ODR_USED on variables or functions with
@@ -5650,14 +5666,7 @@ mark_used (tree decl, tsubst_flags_t complain)
&& !DECL_ARTIFICIAL (decl)
&& !decl_defined_p (decl)
&& no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/false))
- {
- if (is_local_extern (decl))
- /* There's no way to define a local extern, and adding it to
- the vector interferes with GC, so give an error now. */
- no_linkage_error (decl);
- else
- vec_safe_push (no_linkage_decls, decl);
- }
+ vec_safe_push (no_linkage_decls, decl);
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (decl)
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ecb41e8..396558b 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -951,8 +951,11 @@ dump_type_suffix (cxx_pretty_printer *pp, tree t, int flags)
if (tree dtype = TYPE_DOMAIN (t))
{
tree max = TYPE_MAX_VALUE (dtype);
- /* Zero-length arrays have an upper bound of SIZE_MAX. */
- if (integer_all_onesp (max))
+ /* Zero-length arrays have a null upper bound in C and SIZE_MAX
+ in C++. Handle both since the type might be constructed by
+ the middle end and end up here as a result of a warning (see
+ PR c++/97201). */
+ if (!max || integer_all_onesp (max))
pp_character (pp, '0');
else if (tree_fits_shwi_p (max))
pp_wide_integer (pp, tree_to_shwi (max) + 1);
@@ -2400,6 +2403,64 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
}
break;
+ case TARGET_MEM_REF:
+ /* TARGET_MEM_REF can't appear directly from source, but can appear
+ during late GIMPLE optimizations and through late diagnostic we might
+ need to support it. Print it as dereferencing of a pointer after
+ cast to the TARGET_MEM_REF type, with pointer arithmetics on some
+ pointer to single byte types, so
+ *(type *)((char *) ptr + step * index + index2) if all the operands
+ are present and the casts are needed. */
+ pp_cxx_star (pp);
+ pp_cxx_left_paren (pp);
+ if (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (TMR_BASE (t)))) == NULL_TREE
+ || !integer_onep (TYPE_SIZE_UNIT
+ (TREE_TYPE (TREE_TYPE (TMR_BASE (t))))))
+ {
+ if (TYPE_SIZE_UNIT (TREE_TYPE (t))
+ && integer_onep (TYPE_SIZE_UNIT (TREE_TYPE (t))))
+ {
+ pp_cxx_left_paren (pp);
+ dump_type (pp, build_pointer_type (TREE_TYPE (t)), flags);
+ }
+ else
+ {
+ dump_type (pp, build_pointer_type (TREE_TYPE (t)), flags);
+ pp_cxx_right_paren (pp);
+ pp_cxx_left_paren (pp);
+ pp_cxx_left_paren (pp);
+ dump_type (pp, build_pointer_type (char_type_node), flags);
+ }
+ pp_cxx_right_paren (pp);
+ }
+ else if (!same_type_p (TREE_TYPE (t),
+ TREE_TYPE (TREE_TYPE (TMR_BASE (t)))))
+ {
+ dump_type (pp, build_pointer_type (TREE_TYPE (t)), flags);
+ pp_cxx_right_paren (pp);
+ pp_cxx_left_paren (pp);
+ }
+ dump_expr (pp, TMR_BASE (t), flags);
+ if (TMR_STEP (t) && TMR_INDEX (t))
+ {
+ pp_cxx_ws_string (pp, "+");
+ dump_expr (pp, TMR_INDEX (t), flags);
+ pp_cxx_ws_string (pp, "*");
+ dump_expr (pp, TMR_STEP (t), flags);
+ }
+ if (TMR_INDEX2 (t))
+ {
+ pp_cxx_ws_string (pp, "+");
+ dump_expr (pp, TMR_INDEX2 (t), flags);
+ }
+ if (!integer_zerop (TMR_OFFSET (t)))
+ {
+ pp_cxx_ws_string (pp, "+");
+ dump_expr (pp, fold_convert (ssizetype, TMR_OFFSET (t)), flags);
+ }
+ pp_cxx_right_paren (pp);
+ break;
+
case NEGATE_EXPR:
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index fa20a93..56fa960 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -481,8 +481,8 @@ do_friend (tree ctype, tree declarator, tree decl,
gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
gcc_assert (!ctype || MAYBE_CLASS_TYPE_P (ctype));
- /* Every decl that gets here is a friend of something. */
- DECL_FRIEND_P (decl) = 1;
+ /* Friend functions are unique, until proved otherwise. */
+ DECL_UNIQUE_FRIEND_P (decl) = 1;
if (DECL_OVERRIDE_P (decl) || DECL_FINAL_P (decl))
error ("friend declaration %qD may not have virt-specifiers",
@@ -558,7 +558,7 @@ do_friend (tree ctype, tree declarator, tree decl,
else if (class_template_depth)
/* We rely on tsubst_friend_function to check the
validity of the declaration later. */
- decl = push_template_decl_real (decl, /*is_friend=*/true);
+ decl = push_template_decl (decl, /*is_friend=*/true);
else
decl = check_classfn (ctype, decl,
template_member_p
@@ -581,25 +581,19 @@ do_friend (tree ctype, tree declarator, tree decl,
error ("member %qD declared as friend before type %qT defined",
decl, ctype);
}
- /* A global friend.
- @@ or possibly a friend from a base class ?!? */
- else if (TREE_CODE (decl) == FUNCTION_DECL)
+ else
{
+ /* Namespace-scope friend function. */
int is_friend_template = PROCESSING_REAL_TEMPLATE_DECL_P ();
- /* Friends must all go through the overload machinery,
- even though they may not technically be overloaded.
-
- Note that because classes all wind up being top-level
- in their scope, their friend wind up in top-level scope as well. */
if (funcdef_flag)
SET_DECL_FRIEND_CONTEXT (decl, current_class_type);
if (! DECL_USE_TEMPLATE (decl))
{
/* We must check whether the decl refers to template
- arguments before push_template_decl_real adds a
- reference to the containing template class. */
+ arguments before push_template_decl adds a reference to
+ the containing template class. */
int warn = (warn_nontemplate_friend
&& ! funcdef_flag && ! is_friend_template
&& current_template_parms
@@ -611,10 +605,10 @@ do_friend (tree ctype, tree declarator, tree decl,
general, such a declaration depends on template
parameters. Instead, we call pushdecl when the class
is instantiated. */
- decl = push_template_decl_real (decl, /*is_friend=*/true);
+ decl = push_template_decl (decl, /*is_friend=*/true);
else if (current_function_decl)
/* pushdecl will check there's a local decl already. */
- decl = pushdecl (decl, /*is_friend=*/true);
+ decl = pushdecl (decl, /*hiding=*/true);
else
{
/* We can't use pushdecl, as we might be in a template
@@ -624,7 +618,7 @@ do_friend (tree ctype, tree declarator, tree decl,
tree ns = decl_namespace_context (decl);
push_nested_namespace (ns);
- decl = pushdecl_namespace_level (decl, /*is_friend=*/true);
+ decl = pushdecl_namespace_level (decl, /*hiding=*/true);
pop_nested_namespace (ns);
}
@@ -653,7 +647,6 @@ do_friend (tree ctype, tree declarator, tree decl,
add_friend (current_class_type,
is_friend_template ? DECL_TI_TEMPLATE (decl) : decl,
/*complain=*/true);
- DECL_FRIEND_P (decl) = 1;
}
return decl;
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e84e985..1bddb655 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "asan.h"
#include "stor-layout.h"
+#include "builtins.h"
static bool begin_init_stmts (tree *, tree *);
static tree finish_init_stmts (bool, tree, tree);
@@ -2564,27 +2565,6 @@ throw_bad_array_new_length (void)
return build_cxx_call (fn, 0, NULL, tf_warning_or_error);
}
-/* Attempt to find the initializer for flexible array field T in the
- initializer INIT, when non-null. Returns the initializer when
- successful and NULL otherwise. */
-static tree
-find_flexarray_init (tree t, tree init)
-{
- if (!init || init == error_mark_node)
- return NULL_TREE;
-
- unsigned HOST_WIDE_INT idx;
- tree field, elt;
-
- /* Iterate over all top-level initializer elements. */
- FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (init), idx, field, elt)
- /* If the member T is found, return it. */
- if (field == t)
- return elt;
-
- return NULL_TREE;
-}
-
/* Attempt to verify that the argument, OPER, of a placement new expression
refers to an object sufficiently large for an object of TYPE or an array
of NELTS of such objects when NELTS is non-null, and issue a warning when
@@ -2601,17 +2581,6 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
{
location_t loc = cp_expr_loc_or_input_loc (oper);
- /* The number of bytes to add to or subtract from the size of the provided
- buffer based on an offset into an array or an array element reference.
- Although intermediate results may be negative (as in a[3] - 2) a valid
- final result cannot be. */
- offset_int adjust = 0;
- /* True when the size of the entire destination object should be used
- to compute the possibly optimistic estimate of the available space. */
- bool use_obj_size = false;
- /* True when the reference to the destination buffer is an ADDR_EXPR. */
- bool addr_expr = false;
-
STRIP_NOPS (oper);
/* Using a function argument or a (non-array) variable as an argument
@@ -2625,231 +2594,96 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
/* Evaluate any constant expressions. */
size = fold_non_dependent_expr (size);
- /* Handle the common case of array + offset expression when the offset
- is a constant. */
- if (TREE_CODE (oper) == POINTER_PLUS_EXPR)
- {
- /* If the offset is compile-time constant, use it to compute a more
- accurate estimate of the size of the buffer. Since the operand
- of POINTER_PLUS_EXPR is represented as an unsigned type, convert
- it to signed first.
- Otherwise, use the size of the entire array as an optimistic
- estimate (this may lead to false negatives). */
- tree adj = TREE_OPERAND (oper, 1);
- adj = fold_for_warn (adj);
- if (CONSTANT_CLASS_P (adj))
- adjust += wi::to_offset (convert (ssizetype, adj));
- else
- use_obj_size = true;
-
- oper = TREE_OPERAND (oper, 0);
-
- STRIP_NOPS (oper);
- }
-
- if (TREE_CODE (oper) == TARGET_EXPR)
- oper = TREE_OPERAND (oper, 1);
- else if (TREE_CODE (oper) == ADDR_EXPR)
- {
- addr_expr = true;
- oper = TREE_OPERAND (oper, 0);
- }
-
- STRIP_NOPS (oper);
-
- if (TREE_CODE (oper) == ARRAY_REF
- && (addr_expr || TREE_CODE (TREE_TYPE (oper)) == ARRAY_TYPE))
- {
- /* Similar to the offset computed above, see if the array index
- is a compile-time constant. If so, and unless the offset was
- not a compile-time constant, use the index to determine the
- size of the buffer. Otherwise, use the entire array as
- an optimistic estimate of the size. */
- const_tree adj = fold_non_dependent_expr (TREE_OPERAND (oper, 1));
- if (!use_obj_size && CONSTANT_CLASS_P (adj))
- adjust += wi::to_offset (adj);
- else
- {
- use_obj_size = true;
- adjust = 0;
- }
+ access_ref ref;
+ ref.eval = [](tree x){ return fold_non_dependent_expr (x); };
+ ref.trail1special = warn_placement_new < 2;
+ tree objsize = compute_objsize (oper, 1, &ref);
+ if (!objsize)
+ return;
- oper = TREE_OPERAND (oper, 0);
- }
+ offset_int bytes_avail = wi::to_offset (objsize);
+ offset_int bytes_need;
- /* Refers to the declared object that constains the subobject referenced
- by OPER. When the object is initialized, makes it possible to determine
- the actual size of a flexible array member used as the buffer passed
- as OPER to placement new. */
- tree var_decl = NULL_TREE;
- /* True when operand is a COMPONENT_REF, to distinguish flexible array
- members from arrays of unspecified size. */
- bool compref = TREE_CODE (oper) == COMPONENT_REF;
-
- /* For COMPONENT_REF (i.e., a struct member) the size of the entire
- enclosing struct. Used to validate the adjustment (offset) into
- an array at the end of a struct. */
- offset_int compsize = 0;
-
- /* Descend into a struct or union to find the member whose address
- is being used as the argument. */
- if (TREE_CODE (oper) == COMPONENT_REF)
+ if (CONSTANT_CLASS_P (size))
+ bytes_need = wi::to_offset (size);
+ else if (nelts && CONSTANT_CLASS_P (nelts))
+ bytes_need = (wi::to_offset (nelts)
+ * wi::to_offset (TYPE_SIZE_UNIT (type)));
+ else if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
+ bytes_need = wi::to_offset (TYPE_SIZE_UNIT (type));
+ else
{
- tree comptype = TREE_TYPE (TREE_OPERAND (oper, 0));
- compsize = wi::to_offset (TYPE_SIZE_UNIT (comptype));
-
- tree op0 = oper;
- while (TREE_CODE (op0 = TREE_OPERAND (op0, 0)) == COMPONENT_REF);
- STRIP_ANY_LOCATION_WRAPPER (op0);
- if (VAR_P (op0))
- var_decl = op0;
- oper = TREE_OPERAND (oper, 1);
+ /* The type is a VLA. */
+ return;
}
- STRIP_ANY_LOCATION_WRAPPER (oper);
- tree opertype = TREE_TYPE (oper);
- if ((addr_expr || !INDIRECT_TYPE_P (opertype))
- && (VAR_P (oper)
- || TREE_CODE (oper) == FIELD_DECL
- || TREE_CODE (oper) == PARM_DECL))
- {
- /* A possibly optimistic estimate of the number of bytes available
- in the destination buffer. */
- offset_int bytes_avail = 0;
- /* True when the estimate above is in fact the exact size
- of the destination buffer rather than an estimate. */
- bool exact_size = true;
-
- /* Treat members of unions and members of structs uniformly, even
- though the size of a member of a union may be viewed as extending
- to the end of the union itself (it is by __builtin_object_size). */
- if ((VAR_P (oper) || use_obj_size)
- && DECL_SIZE_UNIT (oper)
- && tree_fits_uhwi_p (DECL_SIZE_UNIT (oper)))
- {
- /* Use the size of the entire array object when the expression
- refers to a variable or its size depends on an expression
- that's not a compile-time constant. */
- bytes_avail = wi::to_offset (DECL_SIZE_UNIT (oper));
- exact_size = !use_obj_size;
- }
- else if (tree opersize = TYPE_SIZE_UNIT (opertype))
- {
- /* Use the size of the type of the destination buffer object
- as the optimistic estimate of the available space in it.
- Use the maximum possible size for zero-size arrays and
- flexible array members (except of initialized objects
- thereof). */
- if (TREE_CODE (opersize) == INTEGER_CST)
- bytes_avail = wi::to_offset (opersize);
- }
-
- if (bytes_avail == 0)
- {
- if (var_decl)
- {
- /* Constructing into a buffer provided by the flexible array
- member of a declared object (which is permitted as a G++
- extension). If the array member has been initialized,
- determine its size from the initializer. Otherwise,
- the array size is zero. */
- if (tree init = find_flexarray_init (oper,
- DECL_INITIAL (var_decl)))
- bytes_avail = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (init)));
- }
- else
- bytes_avail = (wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node))
- - compsize);
- }
-
- tree_code oper_code = TREE_CODE (opertype);
-
- if (compref && oper_code == ARRAY_TYPE)
- {
- tree nelts = array_type_nelts_top (opertype);
- tree nelts_cst = maybe_constant_value (nelts);
- if (TREE_CODE (nelts_cst) == INTEGER_CST
- && integer_onep (nelts_cst)
- && !var_decl
- && warn_placement_new < 2)
- return;
- }
-
- /* Reduce the size of the buffer by the adjustment computed above
- from the offset and/or the index into the array. */
- if (bytes_avail < adjust || adjust < 0)
- bytes_avail = 0;
- else
- {
- tree elttype = (TREE_CODE (opertype) == ARRAY_TYPE
- ? TREE_TYPE (opertype) : opertype);
- if (tree eltsize = TYPE_SIZE_UNIT (elttype))
- {
- bytes_avail -= adjust * wi::to_offset (eltsize);
- if (bytes_avail < 0)
- bytes_avail = 0;
- }
- }
+ if (bytes_avail >= bytes_need)
+ return;
- /* The minimum amount of space needed for the allocation. This
- is an optimistic estimate that makes it possible to detect
- placement new invocation for some undersize buffers but not
- others. */
- offset_int bytes_need;
+ /* True when the size to mention in the warning is exact as opposed
+ to "at least N". */
+ const bool exact_size = (ref.offrng[0] == ref.offrng[1]
+ || ref.sizrng[1] - ref.offrng[0] == 0);
- if (nelts)
- nelts = fold_for_warn (nelts);
-
- if (CONSTANT_CLASS_P (size))
- bytes_need = wi::to_offset (size);
- else if (nelts && CONSTANT_CLASS_P (nelts))
- bytes_need = (wi::to_offset (nelts)
- * wi::to_offset (TYPE_SIZE_UNIT (type)));
- else if (tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
- bytes_need = wi::to_offset (TYPE_SIZE_UNIT (type));
- else
- {
- /* The type is a VLA. */
- return;
- }
+ tree opertype = ref.ref ? TREE_TYPE (ref.ref) : TREE_TYPE (oper);
+ bool warned = false;
+ if (nelts)
+ nelts = fold_for_warn (nelts);
+ if (nelts)
+ if (CONSTANT_CLASS_P (nelts))
+ warned = warning_at (loc, OPT_Wplacement_new_,
+ (exact_size
+ ? G_("placement new constructing an object "
+ "of type %<%T [%wu]%> and size %qwu "
+ "in a region of type %qT and size %qwi")
+ : G_("placement new constructing an object "
+ "of type %<%T [%wu]%> and size %qwu "
+ "in a region of type %qT and size "
+ "at most %qwu")),
+ type, tree_to_uhwi (nelts),
+ bytes_need.to_uhwi (),
+ opertype, bytes_avail.to_uhwi ());
+ else
+ warned = warning_at (loc, OPT_Wplacement_new_,
+ (exact_size
+ ? G_("placement new constructing an array "
+ "of objects of type %qT and size %qwu "
+ "in a region of type %qT and size %qwi")
+ : G_("placement new constructing an array "
+ "of objects of type %qT and size %qwu "
+ "in a region of type %qT and size "
+ "at most %qwu")),
+ type, bytes_need.to_uhwi (), opertype,
+ bytes_avail.to_uhwi ());
+ else
+ warned = warning_at (loc, OPT_Wplacement_new_,
+ (exact_size
+ ? G_("placement new constructing an object "
+ "of type %qT and size %qwu in a region "
+ "of type %qT and size %qwi")
+ : G_("placement new constructing an object "
+ "of type %qT "
+ "and size %qwu in a region of type %qT "
+ "and size at most %qwu")),
+ type, bytes_need.to_uhwi (), opertype,
+ bytes_avail.to_uhwi ());
+
+ if (!warned || !ref.ref)
+ return;
- if (bytes_avail < bytes_need)
- {
- if (nelts)
- if (CONSTANT_CLASS_P (nelts))
- warning_at (loc, OPT_Wplacement_new_,
- exact_size ?
- "placement new constructing an object of type "
- "%<%T [%wu]%> and size %qwu in a region of type %qT "
- "and size %qwi"
- : "placement new constructing an object of type "
- "%<%T [%wu]%> and size %qwu in a region of type %qT "
- "and size at most %qwu",
- type, tree_to_uhwi (nelts), bytes_need.to_uhwi (),
- opertype, bytes_avail.to_uhwi ());
- else
- warning_at (loc, OPT_Wplacement_new_,
- exact_size ?
- "placement new constructing an array of objects "
- "of type %qT and size %qwu in a region of type %qT "
- "and size %qwi"
- : "placement new constructing an array of objects "
- "of type %qT and size %qwu in a region of type %qT "
- "and size at most %qwu",
- type, bytes_need.to_uhwi (), opertype,
- bytes_avail.to_uhwi ());
- else
- warning_at (loc, OPT_Wplacement_new_,
- exact_size ?
- "placement new constructing an object of type %qT "
- "and size %qwu in a region of type %qT and size %qwi"
- : "placement new constructing an object of type %qT "
- "and size %qwu in a region of type %qT and size "
- "at most %qwu",
- type, bytes_need.to_uhwi (), opertype,
- bytes_avail.to_uhwi ());
- }
- }
+ if (ref.offrng[0] == 0 || !ref.offset_bounded ())
+ /* Avoid mentioning the offset when its lower bound is zero
+ or when it's impossibly large. */
+ inform (DECL_SOURCE_LOCATION (ref.ref),
+ "%qD declared here", ref.ref);
+ else if (ref.offrng[0] == ref.offrng[1])
+ inform (DECL_SOURCE_LOCATION (ref.ref),
+ "at offset %wi from %qD declared here",
+ ref.offrng[0].to_shwi (), ref.ref);
+ else
+ inform (DECL_SOURCE_LOCATION (ref.ref),
+ "at offset [%wi, %wi] from %qD declared here",
+ ref.offrng[0].to_shwi (), ref.offrng[1].to_shwi (), ref.ref);
}
/* True if alignof(T) > __STDCPP_DEFAULT_NEW_ALIGNMENT__. */
@@ -3433,10 +3267,6 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
}
}
- tree alloc_call_expr = extract_call_expr (alloc_call);
- if (TREE_CODE (alloc_call_expr) == CALL_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (alloc_call_expr) = 1;
-
if (cookie_size)
alloc_call = maybe_wrap_new_for_constexpr (alloc_call, elt_type,
cookie_size);
@@ -4145,10 +3975,6 @@ build_vec_delete_1 (location_t loc, tree base, tree maxindex, tree type,
/*placement=*/NULL_TREE,
/*alloc_fn=*/NULL_TREE,
complain);
-
- tree deallocate_call_expr = extract_call_expr (deallocate_expr);
- if (TREE_CODE (deallocate_call_expr) == CALL_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (deallocate_call_expr) = 1;
}
body = loop;
@@ -5073,12 +4899,6 @@ build_delete (location_t loc, tree otype, tree addr,
if (do_delete == error_mark_node)
return error_mark_node;
- else if (do_delete)
- {
- tree do_delete_call_expr = extract_call_expr (do_delete);
- if (TREE_CODE (do_delete_call_expr) == CALL_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (do_delete_call_expr) = 1;
- }
if (do_delete && !TREE_SIDE_EFFECTS (expr))
expr = do_delete;
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index c94fe8e..1a1647f 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -134,8 +134,7 @@ begin_lambda_type (tree lambda)
IDENTIFIER_LAMBDA_P (name) = true;
/* Create the new RECORD_TYPE for this lambda. */
- tree type = xref_tag (/*tag_code=*/record_type, name,
- /*scope=*/ts_lambda, /*template_header_p=*/false);
+ tree type = xref_tag (/*tag_code=*/record_type, name);
if (type == error_mark_node)
return error_mark_node;
@@ -476,7 +475,7 @@ static GTY(()) tree max_id;
static tree
vla_capture_type (tree array_type)
{
- tree type = xref_tag (record_type, make_anon_name (), ts_current, false);
+ tree type = xref_tag (record_type, make_anon_name ());
xref_basetypes (type, NULL_TREE);
type = begin_class_definition (type);
if (!ptr_id)
@@ -1189,6 +1188,8 @@ maybe_add_lambda_conv_op (tree type)
tree name = make_conv_op_name (rettype);
tree thistype = cp_build_qualified_type (type, TYPE_QUAL_CONST);
tree fntype = build_method_type_directly (thistype, rettype, void_list_node);
+ /* DR 1722: The conversion function should be noexcept. */
+ fntype = build_exception_variant (fntype, noexcept_true_spec);
tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype);
SET_DECL_LANGUAGE (convfn, lang_cplusplus);
tree fn = convfn;
@@ -1324,6 +1325,13 @@ lambda_static_thunk_p (tree fn)
&& LAMBDA_TYPE_P (CP_DECL_CONTEXT (fn)));
}
+bool
+call_from_lambda_thunk_p (tree call)
+{
+ return (CALL_FROM_THUNK_P (call)
+ && lambda_static_thunk_p (current_function_decl));
+}
+
/* Returns true iff VAL is a lambda-related declaration which should
be ignored by unqualified lookup. */
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 1058fd0..6e4c5f7 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -551,31 +551,51 @@ inherited_ctor_binfo (tree fndecl)
return inherited_ctor_binfo (binfo, fndecl);
}
-/* True if we should omit all user-declared parameters from constructor FN,
- because it is a base clone of a ctor inherited from a virtual base. */
+
+/* True if we should omit all user-declared parameters from a base
+ construtor built from complete constructor FN.
+ That's when the ctor is inherited from a virtual base. */
bool
-ctor_omit_inherited_parms (tree fn)
+base_ctor_omit_inherited_parms (tree comp_ctor)
{
+ gcc_checking_assert (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (comp_ctor));
+
if (!flag_new_inheriting_ctors)
/* We only optimize away the parameters in the new model. */
return false;
- if (!DECL_BASE_CONSTRUCTOR_P (fn)
- || !CLASSTYPE_VBASECLASSES (DECL_CONTEXT (fn)))
+
+ if (!CLASSTYPE_VBASECLASSES (DECL_CONTEXT (comp_ctor)))
return false;
- if (FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn)) == void_list_node)
+ if (FUNCTION_FIRST_USER_PARMTYPE (comp_ctor) == void_list_node)
/* No user-declared parameters to omit. */
return false;
- tree binfo = inherited_ctor_binfo (fn);
- for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
+ for (tree binfo = inherited_ctor_binfo (comp_ctor);
+ binfo;
+ binfo = BINFO_INHERITANCE_CHAIN (binfo))
if (BINFO_VIRTUAL_P (binfo))
return true;
return false;
}
+
+/* True if we should omit all user-declared parameters from constructor FN,
+ because it is a base clone of a ctor inherited from a virtual base. */
+
+bool
+ctor_omit_inherited_parms (tree fn)
+{
+ gcc_checking_assert (TREE_CODE (fn) == FUNCTION_DECL);
+
+ if (!DECL_BASE_CONSTRUCTOR_P (fn))
+ return false;
+
+ return base_ctor_omit_inherited_parms (DECL_CLONED_FUNCTION (fn));
+}
+
/* True iff constructor(s) INH inherited into BINFO initializes INIT_BINFO.
This can be true for multiple virtual bases as well as one direct
non-virtual base. */
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index bbeaf64..4637427 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
static cxx_binding *cxx_binding_make (tree value, tree type);
static cp_binding_level *innermost_nonclass_level (void);
+static tree do_pushdecl (tree decl, bool hiding);
static void set_identifier_type_value_with_scope (tree id, tree decl,
cp_binding_level *b);
static name_hint maybe_suggest_missing_std_header (location_t location,
@@ -55,6 +56,15 @@ static name_hint suggest_alternatives_for_1 (location_t location, tree name,
#define MAYBE_STAT_DECL(N) (STAT_HACK_P (N) ? STAT_DECL (N) : N)
#define MAYBE_STAT_TYPE(N) (STAT_HACK_P (N) ? STAT_TYPE (N) : NULL_TREE)
+/* For regular (maybe) overloaded functions, we have OVL_HIDDEN_P.
+ But we also need to indicate hiddenness on implicit type decls
+ (injected friend classes), and (coming soon) decls injected from
+ block-scope externs. It is too awkward to press the existing
+ overload marking for that. If we have a hidden non-function, we
+ always create a STAT_HACK, and use these two markers as needed. */
+#define STAT_TYPE_HIDDEN_P(N) OVL_HIDDEN_P (N)
+#define STAT_DECL_HIDDEN_P(N) OVL_DEDUP_P (N)
+
/* Create a STAT_HACK node with DECL as the value binding and TYPE as
the type binding. */
@@ -77,7 +87,6 @@ create_local_binding (cp_binding_level *level, tree name)
{
cxx_binding *binding = cxx_binding_make (NULL, NULL);
- INHERITED_VALUE_BINDING_P (binding) = false;
LOCAL_BINDING_P (binding) = true;
binding->scope = level;
binding->previous = IDENTIFIER_BINDING (name);
@@ -480,22 +489,17 @@ name_lookup::add_type (tree new_type)
}
/* Process a found binding containing NEW_VAL and NEW_TYPE. Returns
- true if we actually found something noteworthy. */
+ true if we actually found something noteworthy. Hiddenness has
+ already been handled in the caller. */
bool
name_lookup::process_binding (tree new_val, tree new_type)
{
/* Did we really see a type? */
if (new_type
- && ((want & LOOK_want::TYPE_NAMESPACE) == LOOK_want::NAMESPACE
- || (!bool (want & LOOK_want::HIDDEN_FRIEND)
- && DECL_LANG_SPECIFIC (new_type)
- && DECL_ANTICIPATED (new_type))))
+ && (want & LOOK_want::TYPE_NAMESPACE) == LOOK_want::NAMESPACE)
new_type = NULL_TREE;
- if (new_val && !bool (want & LOOK_want::HIDDEN_FRIEND))
- new_val = ovl_skip_hidden (new_val);
-
/* Do we really see a value? */
if (new_val)
switch (TREE_CODE (new_val))
@@ -544,8 +548,29 @@ name_lookup::search_namespace_only (tree scope)
bool found = false;
if (tree *binding = find_namespace_slot (scope, name))
- found |= process_binding (MAYBE_STAT_DECL (*binding),
- MAYBE_STAT_TYPE (*binding));
+ {
+ tree value = *binding, type = NULL_TREE;
+
+ if (STAT_HACK_P (value))
+ {
+ type = STAT_TYPE (value);
+ value = STAT_DECL (value);
+
+ if (!bool (want & LOOK_want::HIDDEN_FRIEND))
+ {
+ if (STAT_TYPE_HIDDEN_P (*binding))
+ type = NULL_TREE;
+ if (STAT_DECL_HIDDEN_P (*binding))
+ value = NULL_TREE;
+ else
+ value = ovl_skip_hidden (value);
+ }
+ }
+ else if (!bool (want & LOOK_want::HIDDEN_FRIEND))
+ value = ovl_skip_hidden (value);
+
+ found |= process_binding (value, type);
+ }
return found;
}
@@ -818,12 +843,6 @@ name_lookup::adl_class_only (tree type)
if (CP_DECL_CONTEXT (fn) != context)
continue;
- /* Only interested in anticipated friends. (Non-anticipated
- ones will have been inserted during the namespace
- adl.) */
- if (!DECL_ANTICIPATED (fn))
- continue;
-
/* Template specializations are never found by name lookup.
(Templates themselves can be found, but not template
specializations.) */
@@ -1055,11 +1074,8 @@ name_lookup::adl_template_arg (tree arg)
tree
name_lookup::search_adl (tree fns, vec<tree, va_gc> *args)
{
- if (fns)
- {
- deduping = true;
- lookup_mark (fns, true);
- }
+ deduping = true;
+ lookup_mark (fns, true);
value = fns;
unsigned ix;
@@ -1954,15 +1970,18 @@ cxx_binding_init (cxx_binding *binding, tree value, tree type)
static cxx_binding *
cxx_binding_make (tree value, tree type)
{
- cxx_binding *binding;
- if (free_bindings)
- {
- binding = free_bindings;
- free_bindings = binding->previous;
- }
+ cxx_binding *binding = free_bindings;
+
+ if (binding)
+ free_bindings = binding->previous;
else
binding = ggc_alloc<cxx_binding> ();
+ /* Clear flags by default. */
+ LOCAL_BINDING_P (binding) = false;
+ INHERITED_VALUE_BINDING_P (binding) = false;
+ HIDDEN_TYPE_BINDING_P (binding) = false;
+
cxx_binding_init (binding, value, type);
return binding;
@@ -2009,7 +2028,6 @@ push_binding (tree id, tree decl, cp_binding_level* level)
/* Now, fill in the binding information. */
binding->previous = IDENTIFIER_BINDING (id);
- INHERITED_VALUE_BINDING_P (binding) = 0;
LOCAL_BINDING_P (binding) = (level != class_binding_level);
/* And put it on the front of the list of bindings for ID. */
@@ -2022,8 +2040,6 @@ push_binding (tree id, tree decl, cp_binding_level* level)
void
pop_local_binding (tree id, tree decl)
{
- cxx_binding *binding;
-
if (id == NULL_TREE)
/* It's easiest to write the loops that call this function without
checking whether or not the entities involved have names. We
@@ -2031,18 +2047,20 @@ pop_local_binding (tree id, tree decl)
return;
/* Get the innermost binding for ID. */
- binding = IDENTIFIER_BINDING (id);
+ cxx_binding *binding = IDENTIFIER_BINDING (id);
/* The name should be bound. */
gcc_assert (binding != NULL);
- /* The DECL will be either the ordinary binding or the type
- binding for this identifier. Remove that binding. */
+ /* The DECL will be either the ordinary binding or the type binding
+ for this identifier. Remove that binding. We don't have to
+ clear HIDDEN_TYPE_BINDING_P, as the whole binding will be going
+ away. */
if (binding->value == decl)
binding->value = NULL_TREE;
else
{
- gcc_assert (binding->type == decl);
+ gcc_checking_assert (binding->type == decl);
binding->type = NULL_TREE;
}
@@ -2110,19 +2128,9 @@ strip_using_decl (tree decl)
static bool
anticipated_builtin_p (tree ovl)
{
- if (TREE_CODE (ovl) != OVERLOAD)
- return false;
-
- if (!OVL_HIDDEN_P (ovl))
- return false;
-
- tree fn = OVL_FUNCTION (ovl);
- gcc_checking_assert (DECL_ANTICIPATED (fn));
-
- if (DECL_HIDDEN_FRIEND_P (fn))
- return false;
-
- return true;
+ return (TREE_CODE (ovl) == OVERLOAD
+ && OVL_HIDDEN_P (ovl)
+ && DECL_UNDECLARED_BUILTIN_P (OVL_FUNCTION (ovl)));
}
/* BINDING records an existing declaration for a name in the current scope.
@@ -2232,7 +2240,7 @@ supplement_binding_1 (cxx_binding *binding, tree decl)
&& DECL_EXTERNAL (target_decl) && DECL_EXTERNAL (target_bval)
&& !DECL_CLASS_SCOPE_P (target_decl))
{
- duplicate_decls (decl, binding->value, /*newdecl_is_friend=*/false);
+ duplicate_decls (decl, binding->value);
ok = false;
}
else if (TREE_CODE (decl) == NAMESPACE_DECL
@@ -2354,48 +2362,66 @@ matching_fn_p (tree one, tree two)
static tree
update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
- tree old, tree decl, bool is_friend)
+ tree old, tree decl, bool hiding = false)
{
+ tree old_type = NULL_TREE;
+ bool hide_type = false;
+ bool hide_value = false;
+
+ if (!slot)
+ {
+ old_type = binding->type;
+ hide_type = HIDDEN_TYPE_BINDING_P (binding);
+ if (!old_type)
+ hide_value = hide_type, hide_type = false;
+ }
+ else if (STAT_HACK_P (*slot))
+ {
+ old_type = STAT_TYPE (*slot);
+ hide_type = STAT_TYPE_HIDDEN_P (*slot);
+ hide_value = STAT_DECL_HIDDEN_P (*slot);
+ }
+
tree to_val = decl;
- tree old_type = slot ? MAYBE_STAT_TYPE (*slot) : binding->type;
tree to_type = old_type;
+ bool local_overload = false;
gcc_assert (level->kind == sk_namespace ? !binding
: level->kind != sk_class && !slot);
if (old == error_mark_node)
old = NULL_TREE;
- if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl))
+ if (DECL_IMPLICIT_TYPEDEF_P (decl))
{
- tree other = to_type;
-
- if (old && TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
- other = old;
-
- /* Pushing an artificial typedef. See if this matches either
- the type slot or the old value slot. */
- if (!other)
- ;
- else if (same_type_p (TREE_TYPE (other), TREE_TYPE (decl)))
- /* Two artificial decls to same type. Do nothing. */
- return other;
- else
- goto conflict;
+ /* Pushing an artificial decl. We should not find another
+ artificial decl here already -- lookup_elaborated_type will
+ have already found it. */
+ gcc_checking_assert (!to_type
+ && !(old && DECL_IMPLICIT_TYPEDEF_P (old)));
if (old)
{
- /* Slide decl into the type slot, keep old unaltered */
+ /* Put DECL into the type slot. */
+ gcc_checking_assert (!to_type);
+ hide_type = hiding;
to_type = decl;
to_val = old;
- goto done;
}
+ else
+ hide_value = hiding;
+
+ goto done;
}
- if (old && TREE_CODE (old) == TYPE_DECL && DECL_ARTIFICIAL (old))
+ if (old && DECL_IMPLICIT_TYPEDEF_P (old))
{
- /* Slide old into the type slot. */
+ /* OLD is an implicit typedef. Move it to to_type. */
+ gcc_checking_assert (!to_type);
+
to_type = old;
+ hide_type = hide_value;
old = NULL_TREE;
+ hide_value = false;
}
if (DECL_DECLARES_FUNCTION_P (decl))
@@ -2410,13 +2436,14 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
if (iter.using_p () && matching_fn_p (fn, decl))
{
+ gcc_checking_assert (!iter.hidden_p ());
/* If a function declaration in namespace scope or
block scope has the same name and the same
parameter-type- list (8.3.5) as a function
introduced by a using-declaration, and the
declarations do not declare the same function,
the program is ill-formed. [namespace.udecl]/14 */
- if (tree match = duplicate_decls (decl, fn, is_friend))
+ if (tree match = duplicate_decls (decl, fn, hiding))
return match;
else
/* FIXME: To preserve existing error behavior, we
@@ -2436,60 +2463,70 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
warning (OPT_Wshadow, "%q#D hides constructor for %q#D",
decl, to_type);
- to_val = ovl_insert (decl, old);
- }
- else if (!old)
- ;
- else if (TREE_CODE (old) != TREE_CODE (decl))
- /* Different kinds of decls conflict. */
- goto conflict;
- else if (TREE_CODE (old) == TYPE_DECL)
- {
- if (same_type_p (TREE_TYPE (old), TREE_TYPE (decl)))
- /* Two type decls to the same type. Do nothing. */
- return old;
- else
- goto conflict;
+ local_overload = old && level->kind != sk_namespace;
+ to_val = ovl_insert (decl, old, -int (hiding));
}
- else if (TREE_CODE (old) == NAMESPACE_DECL)
+ else if (old)
{
- /* Two maybe-aliased namespaces. If they're to the same target
- namespace, that's ok. */
- if (ORIGINAL_NAMESPACE (old) != ORIGINAL_NAMESPACE (decl))
+ if (TREE_CODE (old) != TREE_CODE (decl))
+ /* Different kinds of decls conflict. */
goto conflict;
-
- /* The new one must be an alias at this point. */
- gcc_assert (DECL_NAMESPACE_ALIAS (decl));
- return old;
- }
- else if (TREE_CODE (old) == VAR_DECL)
- {
- /* There can be two block-scope declarations of the same
- variable, so long as they are `extern' declarations. */
- if (!DECL_EXTERNAL (old) || !DECL_EXTERNAL (decl))
- goto conflict;
- else if (tree match = duplicate_decls (decl, old, false))
- return match;
+ else if (TREE_CODE (old) == TYPE_DECL)
+ {
+ if (same_type_p (TREE_TYPE (old), TREE_TYPE (decl)))
+ {
+ /* Two type decls to the same type. Do nothing. */
+ gcc_checking_assert (!hiding);
+ return old;
+ }
+ else
+ goto conflict;
+ }
+ else if (TREE_CODE (old) == NAMESPACE_DECL)
+ {
+ /* Two maybe-aliased namespaces. If they're to the same target
+ namespace, that's ok. */
+ if (ORIGINAL_NAMESPACE (old) != ORIGINAL_NAMESPACE (decl))
+ goto conflict;
+
+ /* The new one must be an alias at this point. */
+ gcc_assert (DECL_NAMESPACE_ALIAS (decl) && !hiding);
+ return old;
+ }
+ else if (TREE_CODE (old) == VAR_DECL)
+ {
+ /* There can be two block-scope declarations of the same
+ variable, so long as they are `extern' declarations. */
+ if (!DECL_EXTERNAL (old) || !DECL_EXTERNAL (decl))
+ goto conflict;
+ else if (tree match = duplicate_decls (decl, old))
+ {
+ gcc_checking_assert (!hide_value && !hiding);
+ return match;
+ }
+ else
+ goto conflict;
+ }
else
- goto conflict;
- }
- else
- {
- conflict:
- diagnose_name_conflict (decl, old);
- to_val = NULL_TREE;
+ {
+ conflict:
+ diagnose_name_conflict (decl, old);
+ to_val = NULL_TREE;
+ }
}
+ else if (hiding)
+ hide_value = true;
done:
if (to_val)
{
- if (level->kind == sk_namespace || to_type == decl || to_val == decl)
- add_decl_to_level (level, decl);
- else
+ if (local_overload)
{
gcc_checking_assert (binding->value && OVL_P (binding->value));
update_local_overload (binding, to_val);
}
+ else
+ add_decl_to_level (level, decl);
if (slot)
{
@@ -2497,16 +2534,26 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
{
STAT_TYPE (*slot) = to_type;
STAT_DECL (*slot) = to_val;
+ STAT_TYPE_HIDDEN_P (*slot) = hide_type;
+ STAT_DECL_HIDDEN_P (*slot) = hide_value;
+ }
+ else if (to_type || hide_value)
+ {
+ *slot = stat_hack (to_val, to_type);
+ STAT_TYPE_HIDDEN_P (*slot) = hide_type;
+ STAT_DECL_HIDDEN_P (*slot) = hide_value;
}
- else if (to_type)
- *slot = stat_hack (to_val, to_type);
else
- *slot = to_val;
+ {
+ gcc_checking_assert (!hide_type);
+ *slot = to_val;
+ }
}
else
{
binding->type = to_type;
binding->value = to_val;
+ HIDDEN_TYPE_BINDING_P (binding) = hide_type || hide_value;
}
}
@@ -2857,9 +2904,12 @@ set_decl_context_in_fn (tree ctx, tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL
|| (VAR_P (decl) && DECL_EXTERNAL (decl)))
- /* Make sure local externs are marked as such. */
+ /* Make sure local externs are marked as such. OMP UDRs really
+ are nested functions. */
gcc_checking_assert (DECL_LOCAL_DECL_P (decl)
- && DECL_NAMESPACE_SCOPE_P (decl));
+ && (DECL_NAMESPACE_SCOPE_P (decl)
+ || (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_OMP_DECLARE_REDUCTION_P (decl))));
if (!DECL_CONTEXT (decl)
/* When parsing the parameter list of a function declarator,
@@ -2872,108 +2922,113 @@ set_decl_context_in_fn (tree ctx, tree decl)
DECL_CONTEXT (decl) = ctx;
}
-/* DECL is a local-scope decl with linkage. SHADOWED is true if the
- name is already bound at the current level.
-
- [basic.link] If there is a visible declaration of an entity with
- linkage having the same name and type, ignoring entities declared
- outside the innermost enclosing namespace scope, the block scope
- declaration declares that same entity and receives the linkage of
- the previous declaration.
-
- Also, make sure that this decl matches any existing external decl
- in the enclosing namespace. */
+/* DECL is a local extern decl. Find or create the namespace-scope
+ decl that it aliases. Also, determines the linkage of DECL. */
static void
-set_local_extern_decl_linkage (tree decl, bool shadowed)
+push_local_extern_decl_alias (tree decl)
{
- tree ns_value = decl; /* Unique marker. */
+ if (dependent_type_p (TREE_TYPE (decl)))
+ return;
+ /* EH specs were not part of the function type prior to c++17, but
+ we still can't go pushing dependent eh specs into the namespace. */
+ if (cxx_dialect < cxx17
+ && TREE_CODE (decl) == FUNCTION_DECL
+ && (value_dependent_expression_p
+ (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (decl)))))
+ return;
- if (!shadowed)
- {
- tree loc_value = innermost_non_namespace_value (DECL_NAME (decl));
- if (!loc_value)
- {
- ns_value
- = find_namespace_value (current_namespace, DECL_NAME (decl));
- loc_value = ns_value;
- }
- if (loc_value == error_mark_node
- /* An ambiguous lookup. */
- || (loc_value && TREE_CODE (loc_value) == TREE_LIST))
- loc_value = NULL_TREE;
-
- for (ovl_iterator iter (loc_value); iter; ++iter)
- if (!iter.hidden_p ()
- && (TREE_STATIC (*iter) || DECL_EXTERNAL (*iter))
- && decls_match (*iter, decl))
- {
- /* The standard only says that the local extern inherits
- linkage from the previous decl; in particular, default
- args are not shared. Add the decl into a hash table to
- make sure only the previous decl in this case is seen
- by the middle end. */
- struct cxx_int_tree_map *h;
-
- /* We inherit the outer decl's linkage. But we're a
- different decl. */
- TREE_PUBLIC (decl) = TREE_PUBLIC (*iter);
-
- if (cp_function_chain->extern_decl_map == NULL)
- cp_function_chain->extern_decl_map
- = hash_table<cxx_int_tree_map_hasher>::create_ggc (20);
-
- h = ggc_alloc<cxx_int_tree_map> ();
- h->uid = DECL_UID (decl);
- h->to = *iter;
- cxx_int_tree_map **loc = cp_function_chain->extern_decl_map
- ->find_slot (h, INSERT);
- *loc = h;
- break;
- }
- }
+ gcc_checking_assert (!DECL_LANG_SPECIFIC (decl)
+ || !DECL_TEMPLATE_INFO (decl));
+ if (DECL_LANG_SPECIFIC (decl) && DECL_LOCAL_DECL_ALIAS (decl))
+ /* We're instantiating a non-dependent local decl, it already
+ knows the alias. */
+ return;
- if (TREE_PUBLIC (decl))
- {
- /* DECL is externally visible. Make sure it matches a matching
- decl in the namespace scope. We only really need to check
- this when inserting the decl, not when we find an existing
- match in the current scope. However, in practice we're
- going to be inserting a new decl in the majority of cases --
- who writes multiple extern decls for the same thing in the
- same local scope? Doing it here often avoids a duplicate
- namespace lookup. */
+ tree alias = NULL_TREE;
- /* Avoid repeating a lookup. */
- if (ns_value == decl)
- ns_value = find_namespace_value (current_namespace, DECL_NAME (decl));
+ if (DECL_SIZE (decl) && !TREE_CONSTANT (DECL_SIZE (decl)))
+ /* Do not let a VLA creep into a namespace. Diagnostic will be
+ emitted in layout_var_decl later. */
+ alias = error_mark_node;
+ else
+ {
+ /* First look for a decl that matches. */
+ tree ns = CP_DECL_CONTEXT (decl);
+ tree binding = find_namespace_value (ns, DECL_NAME (decl));
- if (ns_value == error_mark_node
- || (ns_value && TREE_CODE (ns_value) == TREE_LIST))
- ns_value = NULL_TREE;
+ if (binding && TREE_CODE (binding) != TREE_LIST)
+ for (ovl_iterator iter (binding); iter; ++iter)
+ if (decls_match (*iter, decl))
+ {
+ alias = *iter;
+ break;
+ }
- for (ovl_iterator iter (ns_value); iter; ++iter)
+ if (!alias)
{
- tree other = *iter;
-
- if (!(TREE_PUBLIC (other) || DECL_EXTERNAL (other)))
- ; /* Not externally visible. */
- else if (DECL_EXTERN_C_P (decl) && DECL_EXTERN_C_P (other))
- ; /* Both are extern "C", we'll check via that mechanism. */
- else if (TREE_CODE (other) != TREE_CODE (decl)
- || ((VAR_P (decl) || matching_fn_p (other, decl))
- && !comptypes (TREE_TYPE (decl), TREE_TYPE (other),
- COMPARE_REDECLARATION)))
+ /* No existing namespace-scope decl. Make one. */
+ alias = copy_decl (decl);
+ if (TREE_CODE (alias) == FUNCTION_DECL)
{
- auto_diagnostic_group d;
- if (permerror (DECL_SOURCE_LOCATION (decl),
- "local external declaration %q#D", decl))
- inform (DECL_SOURCE_LOCATION (other),
- "does not match previous declaration %q#D", other);
- break;
+ /* Recontextualize the parms. */
+ for (tree *chain = &DECL_ARGUMENTS (alias);
+ *chain; chain = &DECL_CHAIN (*chain))
+ {
+ *chain = copy_decl (*chain);
+ DECL_CONTEXT (*chain) = alias;
+ }
+
+ tree type = TREE_TYPE (alias);
+ for (tree args = TYPE_ARG_TYPES (type);
+ args; args = TREE_CHAIN (args))
+ if (TREE_PURPOSE (args))
+ {
+ /* There are default args. Lose them. */
+ tree nargs = NULL_TREE;
+ tree *chain = &nargs;
+ for (args = TYPE_ARG_TYPES (type);
+ args; args = TREE_CHAIN (args))
+ if (args == void_list_node)
+ {
+ *chain = args;
+ break;
+ }
+ else
+ {
+ *chain
+ = build_tree_list (NULL_TREE, TREE_VALUE (args));
+ chain = &TREE_CHAIN (*chain);
+ }
+
+ tree fn_type = build_function_type (TREE_TYPE (type), nargs);
+
+ fn_type = apply_memfn_quals
+ (fn_type, type_memfn_quals (type));
+
+ fn_type = build_cp_fntype_variant
+ (fn_type, type_memfn_rqual (type),
+ TYPE_RAISES_EXCEPTIONS (type),
+ TYPE_HAS_LATE_RETURN_TYPE (type));
+
+ TREE_TYPE (alias) = fn_type;
+ break;
+ }
}
+
+ /* This is the real thing. */
+ DECL_LOCAL_DECL_P (alias) = false;
+
+ /* Expected default linkage is from the namespace. */
+ TREE_PUBLIC (alias) = TREE_PUBLIC (ns);
+ push_nested_namespace (ns);
+ alias = do_pushdecl (alias, /* hiding= */true);
+ pop_nested_namespace (ns);
}
}
+
+ retrofit_lang_decl (decl);
+ DECL_LOCAL_DECL_ALIAS (decl) = alias;
}
/* Record DECL as belonging to the current lexical scope. Check for
@@ -2986,12 +3041,12 @@ set_local_extern_decl_linkage (tree decl, bool shadowed)
says. */
static tree
-do_pushdecl (tree decl, bool is_friend)
+do_pushdecl (tree decl, bool hiding)
{
if (decl == error_mark_node)
return error_mark_node;
- if (!DECL_TEMPLATE_PARM_P (decl) && current_function_decl && !is_friend)
+ if (!DECL_TEMPLATE_PARM_P (decl) && current_function_decl && !hiding)
set_decl_context_in_fn (current_function_decl, decl);
/* The binding level we will be pushing into. During local class
@@ -3031,17 +3086,14 @@ do_pushdecl (tree decl, bool is_friend)
old = binding->value;
}
- if (current_function_decl && VAR_OR_FUNCTION_DECL_P (decl)
- && DECL_EXTERNAL (decl))
- set_local_extern_decl_linkage (decl, old != NULL_TREE);
-
if (old == error_mark_node)
old = NULL_TREE;
for (ovl_iterator iter (old); iter; ++iter)
if (iter.using_p ())
; /* Ignore using decls here. */
- else if (tree match = duplicate_decls (decl, *iter, is_friend))
+ else if (tree match
+ = duplicate_decls (decl, *iter, hiding, iter.hidden_p ()))
{
if (match == error_mark_node)
;
@@ -3049,18 +3101,14 @@ do_pushdecl (tree decl, bool is_friend)
/* The IDENTIFIER will have the type referring to the
now-smashed TYPE_DECL, because ...? Reset it. */
SET_IDENTIFIER_TYPE_VALUE (name, TREE_TYPE (match));
- else if (iter.hidden_p () && !DECL_HIDDEN_P (match))
+ else if (iter.hidden_p () && !hiding)
{
/* Unhiding a previously hidden decl. */
tree head = iter.reveal_node (old);
if (head != old)
{
- if (!ns)
- {
- update_local_overload (binding, head);
- binding->value = head;
- }
- else if (STAT_HACK_P (*slot))
+ gcc_checking_assert (ns);
+ if (STAT_HACK_P (*slot))
STAT_DECL (*slot) = head;
else
*slot = head;
@@ -3069,6 +3117,16 @@ do_pushdecl (tree decl, bool is_friend)
/* We need to check and register the decl now. */
check_extern_c_conflict (match);
}
+ else if (slot && !hiding
+ && STAT_HACK_P (*slot) && STAT_DECL_HIDDEN_P (*slot))
+ {
+ /* Unhide the non-function. */
+ gcc_checking_assert (old == match);
+ if (!STAT_TYPE (*slot))
+ *slot = match;
+ else
+ STAT_DECL (*slot) = match;
+ }
return match;
}
@@ -3085,7 +3143,7 @@ do_pushdecl (tree decl, bool is_friend)
{
check_default_args (decl);
- if (is_friend)
+ if (hiding)
{
if (level->kind != sk_namespace)
{
@@ -3098,8 +3156,6 @@ do_pushdecl (tree decl, bool is_friend)
/* Don't attempt to push it. */
return error_mark_node;
}
- /* Hide it from ordinary lookup. */
- DECL_ANTICIPATED (decl) = DECL_HIDDEN_FRIEND_P (decl) = true;
}
}
@@ -3109,7 +3165,7 @@ do_pushdecl (tree decl, bool is_friend)
if (TREE_CODE (decl) == NAMESPACE_DECL)
/* A local namespace alias. */
- set_identifier_type_value (name, NULL_TREE);
+ set_identifier_type_value_with_scope (name, NULL_TREE, level);
if (!binding)
binding = create_local_binding (level, name);
@@ -3123,7 +3179,7 @@ do_pushdecl (tree decl, bool is_friend)
old = MAYBE_STAT_DECL (*slot);
}
- old = update_binding (level, binding, slot, old, decl, is_friend);
+ old = update_binding (level, binding, slot, old, decl, hiding);
if (old != decl)
/* An existing decl matched, use it. */
@@ -3137,10 +3193,7 @@ do_pushdecl (tree decl, bool is_friend)
if (TYPE_NAME (type) != decl)
set_underlying_type (decl);
- if (!ns)
- set_identifier_type_value_with_scope (name, decl, level);
- else
- SET_IDENTIFIER_TYPE_VALUE (name, global_type_node);
+ set_identifier_type_value_with_scope (name, decl, level);
}
/* If this is a locally defined typedef in a function that
@@ -3149,12 +3202,21 @@ do_pushdecl (tree decl, bool is_friend)
if (!instantiating_current_function_p ())
record_locally_defined_typedef (decl);
}
- else if (VAR_P (decl))
- maybe_register_incomplete_var (decl);
+ else
+ {
+ if (VAR_P (decl) && !DECL_LOCAL_DECL_P (decl))
+ maybe_register_incomplete_var (decl);
- if ((VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL)
- && DECL_EXTERN_C_P (decl))
- check_extern_c_conflict (decl);
+ if (VAR_OR_FUNCTION_DECL_P (decl))
+ {
+ if (DECL_LOCAL_DECL_P (decl)
+ && TREE_CODE (CP_DECL_CONTEXT (decl)) == NAMESPACE_DECL)
+ push_local_extern_decl_alias (decl);
+
+ if (DECL_EXTERN_C_P (decl))
+ check_extern_c_conflict (decl);
+ }
+ }
}
else
add_decl_to_level (level, decl);
@@ -3167,10 +3229,10 @@ do_pushdecl (tree decl, bool is_friend)
we push it. */
tree
-pushdecl (tree x, bool is_friend)
+pushdecl (tree x, bool hiding)
{
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
- tree ret = do_pushdecl (x, is_friend);
+ tree ret = do_pushdecl (x, hiding);
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return ret;
}
@@ -3755,8 +3817,9 @@ identifier_type_value (tree id)
}
/* Push a definition of struct, union or enum tag named ID. into
- binding_level B. DECL is a TYPE_DECL for the type. We assume that
- the tag ID is not already defined. */
+ binding_level B. DECL is a TYPE_DECL for the type. DECL has
+ already been pushed into its binding level. This is bookkeeping to
+ find it easily. */
static void
set_identifier_type_value_with_scope (tree id, tree decl, cp_binding_level *b)
@@ -3768,20 +3831,25 @@ set_identifier_type_value_with_scope (tree id, tree decl, cp_binding_level *b)
/* Shadow the marker, not the real thing, so that the marker
gets restored later. */
tree old_type_value = REAL_IDENTIFIER_TYPE_VALUE (id);
- b->type_shadowed
- = tree_cons (id, old_type_value, b->type_shadowed);
+ b->type_shadowed = tree_cons (id, old_type_value, b->type_shadowed);
type = decl ? TREE_TYPE (decl) : NULL_TREE;
TREE_TYPE (b->type_shadowed) = type;
}
else
{
- tree *slot = find_namespace_slot (current_namespace, id, true);
gcc_assert (decl);
- update_binding (b, NULL, slot, MAYBE_STAT_DECL (*slot), decl, false);
+ if (CHECKING_P)
+ {
+ tree *slot = find_namespace_slot (current_namespace, id);
+ gcc_checking_assert (slot
+ && (decl == MAYBE_STAT_TYPE (*slot)
+ || decl == MAYBE_STAT_DECL (*slot)));
+ }
/* Store marker instead of real type. */
type = global_type_node;
}
+
SET_IDENTIFIER_TYPE_VALUE (id, type);
}
@@ -3827,18 +3895,26 @@ constructor_name_p (tree name, tree type)
/* Same as pushdecl, but define X in binding-level LEVEL. We rely on the
caller to set DECL_CONTEXT properly.
- Note that this must only be used when X will be the new innermost
- binding for its name, as we tack it onto the front of IDENTIFIER_BINDING
- without checking to see if the current IDENTIFIER_BINDING comes from a
- closer binding level than LEVEL. */
+ Warning: For class and block-scope this must only be used when X
+ will be the new innermost binding for its name, as we tack it onto
+ the front of IDENTIFIER_BINDING without checking to see if the
+ current IDENTIFIER_BINDING comes from a closer binding level than
+ LEVEL.
+
+ Warning: For namespace scope, this will look in LEVEL for an
+ existing binding to match, but if not found will push the decl into
+ CURRENT_NAMESPACE. Use push_nested_namespace/pushdecl/
+ pop_nested_namespace if you really need to push it into a foreign
+ namespace. */
static tree
-do_pushdecl_with_scope (tree x, cp_binding_level *level, bool is_friend)
+do_pushdecl_with_scope (tree x, cp_binding_level *level, bool hiding = false)
{
cp_binding_level *b;
if (level->kind == sk_class)
{
+ gcc_checking_assert (!hiding);
b = class_binding_level;
class_binding_level = level;
pushdecl_class_level (x);
@@ -3851,7 +3927,7 @@ do_pushdecl_with_scope (tree x, cp_binding_level *level, bool is_friend)
current_function_decl = NULL_TREE;
b = current_binding_level;
current_binding_level = level;
- x = pushdecl (x, is_friend);
+ x = do_pushdecl (x, hiding);
current_binding_level = b;
current_function_decl = function_decl;
}
@@ -3871,7 +3947,7 @@ pushdecl_outermost_localscope (tree x)
n->kind != sk_function_parms; n = b->level_chain)
b = n;
- tree ret = b ? do_pushdecl_with_scope (x, b, false) : error_mark_node;
+ tree ret = b ? do_pushdecl_with_scope (x, b) : error_mark_node;
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return ret;
@@ -3934,7 +4010,7 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p,
}
else if (old.using_p ())
continue; /* This is a using decl. */
- else if (old.hidden_p () && !DECL_HIDDEN_FRIEND_P (old_fn))
+ else if (old.hidden_p () && DECL_UNDECLARED_BUILTIN_P (old_fn))
continue; /* This is an anticipated builtin. */
else if (!matching_fn_p (new_fn, old_fn))
continue; /* Parameters do not match. */
@@ -4390,8 +4466,6 @@ get_class_binding (tree name, cp_binding_level *scope)
value_binding,
type_binding,
scope);
- /* This is a class-scope binding, not a block-scope binding. */
- LOCAL_BINDING_P (binding) = 0;
set_inherited_value_binding_p (binding, value_binding, class_type);
}
else
@@ -4849,8 +4923,15 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
/* Since decl is a function, old should contain a function decl. */
if (!OVL_P (old))
- goto not_found;
+ {
+ not_found:
+ /* It didn't work, go back to the explicit scope. */
+ DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
+ error ("%qD should have been declared inside %qD", decl, scope);
+ return;
+ }
+
/* We handle these in check_explicit_instantiation_namespace. */
if (processing_explicit_instantiation)
return;
@@ -4860,13 +4941,14 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
match. But, we'll check later, when we construct the
template. */
return;
+
/* Instantiations or specializations of templates may be declared as
friends in any namespace. */
if (friendp && DECL_USE_TEMPLATE (decl))
return;
- tree found;
- found = NULL_TREE;
+ tree found = NULL_TREE;
+ bool hidden_p = false;
for (lkp_iterator iter (old); iter; ++iter)
{
@@ -4882,17 +4964,20 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
{
if (found)
{
- /* We found more than one matching declaration. */
+ /* We found more than one matching declaration. This
+ can happen if we have two inline namespace children,
+ each containing a suitable declaration. */
DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
goto ambiguous;
}
found = ofn;
+ hidden_p = iter.hidden_p ();
}
}
if (found)
{
- if (DECL_HIDDEN_FRIEND_P (found))
+ if (hidden_p)
{
pedwarn (DECL_SOURCE_LOCATION (decl), 0,
"%qD has not been declared within %qD", decl, scope);
@@ -4903,10 +4988,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
goto found;
}
- not_found:
- /* It didn't work, go back to the explicit scope. */
- DECL_CONTEXT (decl) = FROB_CONTEXT (scope);
- error ("%qD should have been declared inside %qD", decl, scope);
+ goto not_found;
}
/* Return the namespace where the current declaration is declared. */
@@ -5069,14 +5151,13 @@ do_namespace_alias (tree alias, tree name_space)
if appropriate. */
tree
-pushdecl_namespace_level (tree x, bool is_friend)
+pushdecl_namespace_level (tree x, bool hiding)
{
cp_binding_level *b = current_binding_level;
tree t;
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
- t = do_pushdecl_with_scope
- (x, NAMESPACE_LEVEL (current_namespace), is_friend);
+ t = do_pushdecl_with_scope (x, NAMESPACE_LEVEL (current_namespace), hiding);
/* Now, the type_shadowed stack may screw us. Munge it so it does
what we want. */
@@ -6024,6 +6105,101 @@ qualified_namespace_lookup (tree scope, name_lookup *lookup)
return found;
}
+/* If DECL is suitably visible to the user, consider its name for
+ spelling correction. */
+
+static void
+consider_decl (tree decl, best_match <tree, const char *> &bm,
+ bool consider_impl_names)
+{
+ /* Skip compiler-generated variables (e.g. __for_begin/__for_end
+ within range for). */
+ if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl))
+ return;
+
+ tree suggestion = DECL_NAME (decl);
+ if (!suggestion)
+ return;
+
+ /* Don't suggest names that are for anonymous aggregate types, as
+ they are an implementation detail generated by the compiler. */
+ if (IDENTIFIER_ANON_P (suggestion))
+ return;
+
+ const char *suggestion_str = IDENTIFIER_POINTER (suggestion);
+
+ /* Ignore internal names with spaces in them. */
+ if (strchr (suggestion_str, ' '))
+ return;
+
+ /* Don't suggest names that are reserved for use by the
+ implementation, unless NAME began with an underscore. */
+ if (!consider_impl_names
+ && name_reserved_for_implementation_p (suggestion_str))
+ return;
+
+ bm.consider (suggestion_str);
+}
+
+/* If DECL is suitably visible to the user, add its name to VEC and
+ return true. Otherwise return false. */
+
+static bool
+maybe_add_fuzzy_decl (auto_vec<tree> &vec, tree decl)
+{
+ /* Skip compiler-generated variables (e.g. __for_begin/__for_end
+ within range for). */
+ if (TREE_CODE (decl) == VAR_DECL && DECL_ARTIFICIAL (decl))
+ return false;
+
+ tree suggestion = DECL_NAME (decl);
+ if (!suggestion)
+ return false;
+
+ /* Don't suggest names that are for anonymous aggregate types, as
+ they are an implementation detail generated by the compiler. */
+ if (IDENTIFIER_ANON_P (suggestion))
+ return false;
+
+ vec.safe_push (suggestion);
+
+ return true;
+}
+
+/* Examing the namespace binding BINDING, and add at most one instance
+ of the name, if it contains a visible entity of interest. */
+
+void
+maybe_add_fuzzy_binding (auto_vec<tree> &vec, tree binding,
+ lookup_name_fuzzy_kind kind)
+{
+ tree value = NULL_TREE;
+
+ if (STAT_HACK_P (binding))
+ {
+ if (!STAT_TYPE_HIDDEN_P (binding)
+ && STAT_TYPE (binding))
+ {
+ if (maybe_add_fuzzy_decl (vec, STAT_TYPE (binding)))
+ return;
+ }
+ else if (!STAT_DECL_HIDDEN_P (binding))
+ value = STAT_DECL (binding);
+ }
+ else
+ value = binding;
+
+ value = ovl_skip_hidden (value);
+ if (value)
+ {
+ value = OVL_FIRST (value);
+ if (kind != FUZZY_LOOKUP_TYPENAME
+ || TREE_CODE (STRIP_TEMPLATE (value)) == TYPE_DECL)
+ if (maybe_add_fuzzy_decl (vec, value))
+ return;
+ }
+}
+
/* Helper function for lookup_name_fuzzy.
Traverse binding level LVL, looking for good name matches for NAME
(and BM). */
@@ -6047,54 +6223,71 @@ consider_binding_level (tree name, best_match <tree, const char *> &bm,
with an underscore. */
bool consider_implementation_names = (IDENTIFIER_POINTER (name)[0] == '_');
- for (tree t = lvl->names; t; t = TREE_CHAIN (t))
- {
- tree d = t;
-
- /* OVERLOADs or decls from using declaration are wrapped into
- TREE_LIST. */
- if (TREE_CODE (d) == TREE_LIST)
- d = OVL_FIRST (TREE_VALUE (d));
-
- /* Don't use bindings from implicitly declared functions,
- as they were likely misspellings themselves. */
- if (TREE_TYPE (d) == error_mark_node)
- continue;
-
- /* Skip anticipated decls of builtin functions. */
- if (TREE_CODE (d) == FUNCTION_DECL
- && fndecl_built_in_p (d)
- && DECL_ANTICIPATED (d))
- continue;
-
- /* Skip compiler-generated variables (e.g. __for_begin/__for_end
- within range for). */
- if (TREE_CODE (d) == VAR_DECL
- && DECL_ARTIFICIAL (d))
- continue;
+ if (lvl->kind != sk_namespace)
+ for (tree t = lvl->names; t; t = TREE_CHAIN (t))
+ {
+ tree d = t;
- tree suggestion = DECL_NAME (d);
- if (!suggestion)
- continue;
+ /* OVERLOADs or decls from using declaration are wrapped into
+ TREE_LIST. */
+ if (TREE_CODE (d) == TREE_LIST)
+ d = OVL_FIRST (TREE_VALUE (d));
- /* Don't suggest names that are for anonymous aggregate types, as
- they are an implementation detail generated by the compiler. */
- if (IDENTIFIER_ANON_P (suggestion))
- continue;
+ /* Don't use bindings from implicitly declared functions,
+ as they were likely misspellings themselves. */
+ if (TREE_TYPE (d) == error_mark_node)
+ continue;
- const char *suggestion_str = IDENTIFIER_POINTER (suggestion);
+ /* If we want a typename, ignore non-types. */
+ if (kind == FUZZY_LOOKUP_TYPENAME
+ && TREE_CODE (STRIP_TEMPLATE (d)) != TYPE_DECL)
+ continue;
- /* Ignore internal names with spaces in them. */
- if (strchr (suggestion_str, ' '))
- continue;
+ consider_decl (d, bm, consider_implementation_names);
+ }
+ else
+ {
+ /* We need to iterate over the namespace hash table, in order to
+ not mention hidden entities. But hash table iteration is
+ (essentially) unpredictable, our correction-distance measure
+ is very granular, and we pick the first of equal distances.
+ Hence, we need to call the distance-measurer in a predictable
+ order. So, iterate over the namespace hash, inserting
+ visible names into a vector. Then sort the vector. Then
+ determine spelling distance. */
+
+ tree ns = lvl->this_entity;
+ auto_vec<tree> vec;
+
+ hash_table<named_decl_hash>::iterator end
+ (DECL_NAMESPACE_BINDINGS (ns)->end ());
+ for (hash_table<named_decl_hash>::iterator iter
+ (DECL_NAMESPACE_BINDINGS (ns)->begin ()); iter != end; ++iter)
+ maybe_add_fuzzy_binding (vec, *iter, kind);
+
+ vec.qsort ([] (const void *a_, const void *b_)
+ {
+ return strcmp (IDENTIFIER_POINTER (*(const tree *)a_),
+ IDENTIFIER_POINTER (*(const tree *)b_));
+ });
+
+ /* Examine longest to shortest. */
+ for (unsigned ix = vec.length (); ix--;)
+ {
+ const char *str = IDENTIFIER_POINTER (vec[ix]);
- /* Don't suggest names that are reserved for use by the
- implementation, unless NAME began with an underscore. */
- if (name_reserved_for_implementation_p (suggestion_str)
- && !consider_implementation_names)
- continue;
+ /* Ignore internal names with spaces in them. */
+ if (strchr (str, ' '))
+ continue;
+
+ /* Don't suggest names that are reserved for use by the
+ implementation, unless NAME began with an underscore. */
+ if (!consider_implementation_names
+ && name_reserved_for_implementation_p (str))
+ continue;
- bm.consider (suggestion_str);
+ bm.consider (str);
+ }
}
}
@@ -6461,86 +6654,37 @@ lookup_name_1 (tree name, LOOK_where where, LOOK_want want)
for (cxx_binding *iter = nullptr;
(iter = outer_binding (name, iter, bool (where & LOOK_where::CLASS)));)
{
- tree binding;
-
/* Skip entities we don't want. */
if (!bool (where & (LOCAL_BINDING_P (iter)
? LOOK_where::BLOCK : LOOK_where::CLASS)))
continue;
/* If this is the kind of thing we're looking for, we're done. */
- if (iter->value
- && (bool (want & LOOK_want::HIDDEN_LAMBDA)
- || !is_lambda_ignored_entity (iter->value))
- && qualify_lookup (iter->value, want))
- binding = iter->value;
- else if (bool (want & LOOK_want::TYPE)
- && qualify_lookup (iter->type, want))
- binding = iter->type;
- else
- binding = NULL_TREE;
-
- if (binding)
+ if (iter->value)
{
- if (TREE_CODE (binding) == TYPE_DECL && DECL_HIDDEN_P (binding))
+ tree binding = NULL_TREE;
+
+ if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
+ && (bool (want & LOOK_want::HIDDEN_LAMBDA)
+ || !is_lambda_ignored_entity (iter->value))
+ && qualify_lookup (iter->value, want))
+ binding = iter->value;
+ else if (bool (want & LOOK_want::TYPE)
+ && !HIDDEN_TYPE_BINDING_P (iter)
+ && iter->type)
+ binding = iter->type;
+
+ if (binding)
{
- /* A non namespace-scope binding can only be hidden in the
- presence of a local class, due to friend declarations.
-
- In particular, consider:
-
- struct C;
- void f() {
- struct A {
- friend struct B;
- friend struct C;
- void g() {
- B* b; // error: B is hidden
- C* c; // OK, finds ::C
- }
- };
- B *b; // error: B is hidden
- C *c; // OK, finds ::C
- struct B {};
- B *bb; // OK
- }
-
- The standard says that "B" is a local class in "f"
- (but not nested within "A") -- but that name lookup
- for "B" does not find this declaration until it is
- declared directly with "f".
-
- In particular:
-
- [class.friend]
-
- If a friend declaration appears in a local class and
- the name specified is an unqualified name, a prior
- declaration is looked up without considering scopes
- that are outside the innermost enclosing non-class
- scope. For a friend function declaration, if there is
- no prior declaration, the program is ill-formed. For a
- friend class declaration, if there is no prior
- declaration, the class that is specified belongs to the
- innermost enclosing non-class scope, but if it is
- subsequently referenced, its name is not found by name
- lookup until a matching declaration is provided in the
- innermost enclosing nonclass scope.
-
- So just keep looking for a non-hidden binding.
- */
- gcc_assert (TREE_CODE (binding) == TYPE_DECL);
- continue;
+ /* The saved lookups for an operator record 'nothing
+ found' as error_mark_node. We need to stop the search
+ here, but not return the error mark node. */
+ if (binding == error_mark_node)
+ binding = NULL_TREE;
+
+ val = binding;
+ goto found;
}
-
- /* The saved lookups for an operator record 'nothing
- found' as error_mark_node. We need to stop the search
- here, but not return the error mark node. */
- if (binding == error_mark_node)
- binding = NULL_TREE;
-
- val = binding;
- goto found;
}
}
@@ -6580,22 +6724,20 @@ lookup_name (tree name)
}
/* Look up NAME for type used in elaborated name specifier in
- the scopes given by SCOPE. SCOPE can be either TS_CURRENT or
- TS_WITHIN_ENCLOSING_NON_CLASS. Although not implied by the
- name, more scopes are checked if cleanup or template parameter
- scope is encountered.
+ the scopes given by HOW.
Unlike lookup_name_1, we make sure that NAME is actually
declared in the desired scope, not from inheritance, nor using
directive. For using declaration, there is DR138 still waiting
to be resolved. Hidden name coming from an earlier friend
- declaration is also returned.
+ declaration is also returned, and will be made visible unless HOW
+ is TAG_how::HIDDEN_FRIEND.
A TYPE_DECL best matching the NAME is returned. Catching error
and issuing diagnostics are caller's responsibility. */
static tree
-lookup_type_scope_1 (tree name, tag_scope scope)
+lookup_elaborated_type_1 (tree name, TAG_how how)
{
cp_binding_level *b = current_binding_level;
@@ -6610,30 +6752,46 @@ lookup_type_scope_1 (tree name, tag_scope scope)
if (!(b->kind == sk_cleanup
|| b->kind == sk_template_parms
|| b->kind == sk_function_parms
- || (b->kind == sk_class
- && scope == ts_within_enclosing_non_class)))
+ || (b->kind == sk_class && how != TAG_how::CURRENT_ONLY)))
return NULL_TREE;
/* Check if this is the kind of thing we're looking for. If
- SCOPE is TS_CURRENT, also make sure it doesn't come from
- base class. For ITER->VALUE, we can simply use
- INHERITED_VALUE_BINDING_P. For ITER->TYPE, we have to
- use our own check.
+ HOW is TAG_how::CURRENT_ONLY, also make sure it doesn't
+ come from base class. For ITER->VALUE, we can simply use
+ INHERITED_VALUE_BINDING_P. For ITER->TYPE, we have to use
+ our own check.
We check ITER->TYPE before ITER->VALUE in order to handle
typedef struct C {} C;
correctly. */
+
if (tree type = iter->type)
- if (qualify_lookup (type, LOOK_want::TYPE)
- && (scope != ts_current
- || LOCAL_BINDING_P (iter)
- || DECL_CONTEXT (type) == iter->scope->this_entity))
- return type;
-
- if (qualify_lookup (iter->value, LOOK_want::TYPE)
- && (scope != ts_current
- || !INHERITED_VALUE_BINDING_P (iter)))
- return iter->value;
+ {
+ if (qualify_lookup (type, LOOK_want::TYPE)
+ && (how != TAG_how::CURRENT_ONLY
+ || LOCAL_BINDING_P (iter)
+ || DECL_CONTEXT (type) == iter->scope->this_entity))
+ {
+ if (how != TAG_how::HIDDEN_FRIEND)
+ /* It is no longer a hidden binding. */
+ HIDDEN_TYPE_BINDING_P (iter) = false;
+
+ return type;
+ }
+ }
+ else
+ {
+ if (qualify_lookup (iter->value, LOOK_want::TYPE)
+ && (how != TAG_how::CURRENT_ONLY
+ || !INHERITED_VALUE_BINDING_P (iter)))
+ {
+ if (how != TAG_how::HIDDEN_FRIEND && !iter->type)
+ /* It is no longer a hidden binding. */
+ HIDDEN_TYPE_BINDING_P (iter) = false;
+
+ return iter->value;
+ }
+ }
}
/* Now check if we can look in namespace scope. */
@@ -6641,8 +6799,7 @@ lookup_type_scope_1 (tree name, tag_scope scope)
if (!(b->kind == sk_cleanup
|| b->kind == sk_template_parms
|| b->kind == sk_function_parms
- || (b->kind == sk_class
- && scope == ts_within_enclosing_non_class)))
+ || (b->kind == sk_class && how != TAG_how::CURRENT_ONLY)))
return NULL_TREE;
/* Look in the innermost namespace. */
@@ -6651,43 +6808,47 @@ lookup_type_scope_1 (tree name, tag_scope scope)
{
/* If this is the kind of thing we're looking for, we're done. */
if (tree type = MAYBE_STAT_TYPE (*slot))
- if (qualify_lookup (type, LOOK_want::TYPE))
+ {
+ if (how != TAG_how::HIDDEN_FRIEND)
+ /* No longer hidden. */
+ STAT_TYPE_HIDDEN_P (*slot) = false;
+
return type;
+ }
+ else if (tree decl = MAYBE_STAT_DECL (*slot))
+ {
+ if (qualify_lookup (decl, LOOK_want::TYPE))
+ {
+ if (how != TAG_how::HIDDEN_FRIEND && STAT_HACK_P (*slot)
+ && STAT_DECL_HIDDEN_P (*slot))
+ {
+ if (STAT_TYPE (*slot))
+ STAT_DECL_HIDDEN_P (*slot) = false;
+ else
+ /* There is no type, just remove the stat
+ hack. */
+ *slot = decl;
+ }
- if (tree decl = MAYBE_STAT_DECL (*slot))
- if (qualify_lookup (decl, LOOK_want::TYPE))
- return decl;
+ return decl;
+ }
+ }
}
return NULL_TREE;
}
-
+
/* Wrapper for lookup_type_scope_1. */
tree
-lookup_type_scope (tree name, tag_scope scope)
+lookup_elaborated_type (tree name, TAG_how how)
{
- tree ret;
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
- ret = lookup_type_scope_1 (name, scope);
+ tree ret = lookup_elaborated_type_1 (name, how);
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return ret;
}
-/* Returns true iff DECL is a block-scope extern declaration of a function
- or variable. We will already have determined validity of the decl
- when pushing it. So we do not have to redo that lookup. */
-
-bool
-is_local_extern (tree decl)
-{
- if ((TREE_CODE (decl) == FUNCTION_DECL
- || TREE_CODE (decl) == VAR_DECL))
- return DECL_LOCAL_DECL_P (decl);
-
- return false;
-}
-
/* The type TYPE is being declared. If it is a class template, or a
specialization of a class template, do any processing required and
perform error-checking. If IS_FRIEND is nonzero, this TYPE is
@@ -6723,11 +6884,11 @@ maybe_process_template_type_declaration (tree type, int is_friend,
if (processing_template_decl)
{
- /* This may change after the call to
- push_template_decl_real, but we want the original value. */
+ /* This may change after the call to push_template_decl, but
+ we want the original value. */
tree name = DECL_NAME (decl);
- decl = push_template_decl_real (decl, is_friend);
+ decl = push_template_decl (decl, is_friend);
if (decl == error_mark_node)
return error_mark_node;
@@ -6779,7 +6940,7 @@ maybe_process_template_type_declaration (tree type, int is_friend,
Returns TYPE upon success and ERROR_MARK_NODE otherwise. */
static tree
-do_pushtag (tree name, tree type, tag_scope scope)
+do_pushtag (tree name, tree type, TAG_how how)
{
tree decl;
@@ -6796,10 +6957,9 @@ do_pushtag (tree name, tree type, tag_scope scope)
declaration, these scopes are not scopes from the point of
view of the language. */
|| (b->kind == sk_template_parms
- && (b->explicit_spec_p || scope == ts_global)))
+ && (b->explicit_spec_p || how == TAG_how::GLOBAL)))
b = b->level_chain;
- else if (b->kind == sk_class
- && scope != ts_current)
+ else if (b->kind == sk_class && how != TAG_how::CURRENT_ONLY)
{
b = b->level_chain;
if (b->kind == sk_template_parms)
@@ -6833,7 +6993,7 @@ do_pushtag (tree name, tree type, tag_scope scope)
: TYPE_P (cs) ? cs == current_class_type
: cs == current_namespace);
- if (scope == ts_current
+ if (how == TAG_how::CURRENT_ONLY
|| (cs && TREE_CODE (cs) == FUNCTION_DECL))
context = cs;
else if (cs && TYPE_P (cs))
@@ -6853,18 +7013,8 @@ do_pushtag (tree name, tree type, tag_scope scope)
tdef = create_implicit_typedef (name, type);
DECL_CONTEXT (tdef) = FROB_CONTEXT (context);
- if (scope == ts_within_enclosing_non_class)
- {
- /* This is a friend. Make this TYPE_DECL node hidden from
- ordinary name lookup. Its corresponding TEMPLATE_DECL
- will be marked in push_template_decl_real. */
- retrofit_lang_decl (tdef);
- DECL_ANTICIPATED (tdef) = 1;
- DECL_FRIEND_P (tdef) = 1;
- }
-
decl = maybe_process_template_type_declaration
- (type, scope == ts_within_enclosing_non_class, b);
+ (type, how == TAG_how::HIDDEN_FRIEND, b);
if (decl == error_mark_node)
return decl;
@@ -6885,7 +7035,8 @@ do_pushtag (tree name, tree type, tag_scope scope)
}
else if (b->kind != sk_template_parms)
{
- decl = do_pushdecl_with_scope (decl, b, /*is_friend=*/false);
+ decl = do_pushdecl_with_scope
+ (decl, b, /*hiding=*/(how == TAG_how::HIDDEN_FRIEND));
if (decl == error_mark_node)
return decl;
@@ -6951,11 +7102,10 @@ do_pushtag (tree name, tree type, tag_scope scope)
/* Wrapper for do_pushtag. */
tree
-pushtag (tree name, tree type, tag_scope scope)
+pushtag (tree name, tree type, TAG_how how)
{
- tree ret;
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
- ret = do_pushtag (name, type, scope);
+ tree ret = do_pushtag (name, type, how);
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return ret;
}
@@ -7283,11 +7433,13 @@ finish_using_directive (tree target, tree attribs)
/* Pushes X into the global namespace. */
tree
-pushdecl_top_level (tree x, bool is_friend)
+pushdecl_top_level (tree x)
{
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
do_push_to_top_level ();
- x = pushdecl_namespace_level (x, is_friend);
+ gcc_checking_assert (!DECL_CONTEXT (x));
+ DECL_CONTEXT (x) = FROB_CONTEXT (global_namespace);
+ x = pushdecl_namespace_level (x);
do_pop_from_top_level ();
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
return x;
@@ -7301,7 +7453,9 @@ pushdecl_top_level_and_finish (tree x, tree init)
{
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
do_push_to_top_level ();
- x = pushdecl_namespace_level (x, false);
+ gcc_checking_assert (!DECL_CONTEXT (x));
+ DECL_CONTEXT (x) = FROB_CONTEXT (global_namespace);
+ x = pushdecl_namespace_level (x);
cp_finish_decl (x, init, false, NULL_TREE, 0);
do_pop_from_top_level ();
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 723fbb0..d63ff10 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -47,12 +47,8 @@ struct GTY(()) binding_entry_s {
extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
extern binding_entry binding_table_find (binding_table, tree);
-/* Datatype that represents binding established by a declaration between
- a name and a C++ entity. */
-typedef struct cxx_binding cxx_binding;
-
/* The datatype used to implement C++ scope. */
-typedef struct cp_binding_level cp_binding_level;
+struct cp_binding_level;
/* Nonzero if this binding is for a local scope, as opposed to a class
or namespace scope. */
@@ -62,6 +58,14 @@ typedef struct cp_binding_level cp_binding_level;
currently being defined. */
#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
+/* The IMPLICIT_TYPEDEF is hidden from ordinary name lookup (it was
+ injected via a local class's friend decl). The typdef may be in the
+ VALUE or the TYPE slot. We do not get the situation where the
+ value and type slots are both filled and both hidden. */
+#define HIDDEN_TYPE_BINDING_P(NODE) ((NODE)->type_is_hidden)
+
+/* Datatype that represents binding established by a declaration between
+ a name and a C++ entity. */
struct GTY(()) cxx_binding {
/* Link to chain together various bindings for this name. */
cxx_binding *previous;
@@ -71,8 +75,10 @@ struct GTY(()) cxx_binding {
tree type;
/* The scope at which this binding was made. */
cp_binding_level *scope;
- unsigned value_is_inherited : 1;
- unsigned is_local : 1;
+
+ bool value_is_inherited : 1;
+ bool is_local : 1;
+ bool type_is_hidden : 1;
};
/* Datatype used to temporarily save C++ bindings (for implicit
@@ -125,23 +131,6 @@ enum scope_kind {
sk_omp /* An OpenMP structured block. */
};
-/* The scope where the class/struct/union/enum tag applies. */
-enum tag_scope {
- ts_current = 0, /* Current scope only. This is for the
- class-key identifier;
- case mentioned in [basic.lookup.elab]/2,
- or the class/enum definition
- class-key identifier { ... }; */
- ts_global = 1, /* All scopes. This is the 3.4.1
- [basic.lookup.unqual] lookup mentioned
- in [basic.lookup.elab]/2. */
- ts_within_enclosing_non_class = 2, /* Search within enclosing non-class
- only, for friend class lookup
- according to [namespace.memdef]/3
- and [class.friend]/9. */
- ts_lambda = 3 /* Declaring a lambda closure. */
-};
-
struct GTY(()) cp_class_binding {
cxx_binding *base;
/* The bound name. */
@@ -328,7 +317,19 @@ inline tree lookup_name (tree name, LOOK_want want)
return lookup_name (name, LOOK_where::ALL, want);
}
-extern tree lookup_type_scope (tree, tag_scope);
+enum class TAG_how
+{
+ CURRENT_ONLY = 0, // Look and insert only in current scope
+
+ GLOBAL = 1, // Unqualified lookup, innermost-non-class insertion
+
+ INNERMOST_NON_CLASS = 2, // Look and insert only into
+ // innermost-non-class
+
+ HIDDEN_FRIEND = 3, // As INNERMOST_NON_CLASS, but hide it
+};
+
+extern tree lookup_elaborated_type (tree, TAG_how);
extern tree get_namespace_binding (tree ns, tree id);
extern void set_global_binding (tree decl);
inline tree get_global_binding (tree id)
@@ -341,9 +342,8 @@ extern tree lookup_qualified_name (tree scope, tree name,
extern tree lookup_qualified_name (tree scope, const char *name,
LOOK_want = LOOK_want::NORMAL,
bool = true);
-extern bool is_local_extern (tree);
extern bool pushdecl_class_level (tree);
-extern tree pushdecl_namespace_level (tree, bool);
+extern tree pushdecl_namespace_level (tree, bool hiding = false);
extern bool push_class_level_binding (tree, tree);
extern tree get_local_decls ();
extern int function_parm_depth (void);
@@ -369,11 +369,11 @@ extern void cp_emit_debug_info_for_using (tree, tree);
extern void finish_nonmember_using_decl (tree scope, tree name);
extern void finish_using_directive (tree target, tree attribs);
-extern tree pushdecl (tree, bool is_friend = false);
+extern tree pushdecl (tree, bool hiding = false);
extern tree pushdecl_outermost_localscope (tree);
-extern tree pushdecl_top_level (tree, bool is_friend = false);
+extern tree pushdecl_top_level (tree);
extern tree pushdecl_top_level_and_finish (tree, tree);
-extern tree pushtag (tree, tree, tag_scope);
+extern tree pushtag (tree, tree, TAG_how = TAG_how::CURRENT_ONLY);
extern int push_namespace (tree, bool make_inline = false);
extern void pop_namespace (void);
extern void push_nested_namespace (tree);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index fba3fcc..7ec7d42 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12646,6 +12646,64 @@ do_range_for_auto_deduction (tree decl, tree range_expr)
}
}
+/* Warns when the loop variable should be changed to a reference type to
+ avoid unnecessary copying. I.e., from
+
+ for (const auto x : range)
+
+ where range returns a reference, to
+
+ for (const auto &x : range)
+
+ if this version doesn't make a copy. DECL is the RANGE_DECL; EXPR is the
+ *__for_begin expression.
+ This function is never called when processing_template_decl is on. */
+
+static void
+warn_for_range_copy (tree decl, tree expr)
+{
+ if (!warn_range_loop_construct
+ || decl == error_mark_node)
+ return;
+
+ location_t loc = DECL_SOURCE_LOCATION (decl);
+ tree type = TREE_TYPE (decl);
+
+ if (from_macro_expansion_at (loc))
+ return;
+
+ if (TYPE_REF_P (type))
+ {
+ /* TODO: Implement reference warnings. */
+ return;
+ }
+ else if (!CP_TYPE_CONST_P (type))
+ return;
+
+ /* Since small trivially copyable types are cheap to copy, we suppress the
+ warning for them. 64B is a common size of a cache line. */
+ if (TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST
+ || (tree_to_uhwi (TYPE_SIZE_UNIT (type)) <= 64
+ && trivially_copyable_p (type)))
+ return;
+
+ tree rtype = cp_build_reference_type (type, /*rval*/false);
+ /* If we could initialize the reference directly, it wouldn't involve any
+ copies. */
+ if (!ref_conv_binds_directly_p (rtype, expr))
+ return;
+
+ auto_diagnostic_group d;
+ if (warning_at (loc, OPT_Wrange_loop_construct,
+ "loop variable %qD creates a copy from type %qT",
+ decl, type))
+ {
+ gcc_rich_location richloc (loc);
+ richloc.add_fixit_insert_before ("&");
+ inform (&richloc, "use reference type to prevent copying");
+ }
+}
+
/* Converts a range-based for-statement into a normal
for-statement, as per the definition.
@@ -12656,7 +12714,7 @@ do_range_for_auto_deduction (tree decl, tree range_expr)
{
auto &&__range = RANGE_EXPR;
- for (auto __begin = BEGIN_EXPR, end = END_EXPR;
+ for (auto __begin = BEGIN_EXPR, __end = END_EXPR;
__begin != __end;
++__begin)
{
@@ -12756,14 +12814,16 @@ cp_convert_range_for (tree statement, tree range_decl, tree range_expr,
cp_maybe_mangle_decomp (range_decl, decomp_first_name, decomp_cnt);
/* The declaration is initialized with *__begin inside the loop body. */
- cp_finish_decl (range_decl,
- build_x_indirect_ref (input_location, begin, RO_UNARY_STAR,
- tf_warning_or_error),
+ tree deref_begin = build_x_indirect_ref (input_location, begin, RO_UNARY_STAR,
+ tf_warning_or_error);
+ cp_finish_decl (range_decl, deref_begin,
/*is_constant_init*/false, NULL_TREE,
LOOKUP_ONLYCONVERTING);
if (VAR_P (range_decl) && DECL_DECOMPOSITION_P (range_decl))
cp_finish_decomp (range_decl, decomp_first_name, decomp_cnt);
+ warn_for_range_copy (range_decl, deref_begin);
+
return statement;
}
@@ -13437,10 +13497,8 @@ cp_parser_declaration (cp_parser* parser)
/* Try to figure out what kind of declaration is present. */
cp_token *token1 = cp_lexer_peek_token (parser->lexer);
- cp_token *token2 = NULL;
-
- if (token1->type != CPP_EOF)
- token2 = cp_lexer_peek_nth_token (parser->lexer, 2);
+ cp_token *token2 = (token1->type == CPP_EOF
+ ? token1 : cp_lexer_peek_nth_token (parser->lexer, 2));
/* Get the high-water mark for the DECLARATOR_OBSTACK. */
void *p = obstack_alloc (&declarator_obstack, 0);
@@ -19057,21 +19115,20 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
definition of a new type; a new type can only be declared in a
declaration context. */
- tag_scope ts;
- bool template_p;
+ TAG_how how;
if (is_friend)
/* Friends have special name lookup rules. */
- ts = ts_within_enclosing_non_class;
+ how = TAG_how::HIDDEN_FRIEND;
else if (is_declaration
&& cp_lexer_next_token_is (parser->lexer,
CPP_SEMICOLON))
/* This is a `class-key identifier ;' */
- ts = ts_current;
+ how = TAG_how::CURRENT_ONLY;
else
- ts = ts_global;
+ how = TAG_how::GLOBAL;
- template_p =
+ bool template_p =
(template_parm_lists_apply
&& (cp_parser_next_token_starts_class_definition_p (parser)
|| cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)));
@@ -19084,7 +19141,8 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
token->location,
/*declarator=*/NULL))
return error_mark_node;
- type = xref_tag (tag_type, identifier, ts, template_p);
+
+ type = xref_tag (tag_type, identifier, how, template_p);
}
}
@@ -21728,8 +21786,14 @@ cp_parser_direct_declarator (cp_parser* parser,
templates, assume S::p to name a type. Otherwise,
don't. */
tree decl
- = cp_parser_lookup_name_simple (parser, unqualified_name,
- token->location);
+ = cp_parser_lookup_name (parser, unqualified_name,
+ none_type,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ /*check_dependency=*/false,
+ /*ambiguous_decls=*/NULL,
+ token->location);
+
if (!is_overloaded_fn (decl)
/* Allow
template<typename T>
@@ -23978,10 +24042,6 @@ cp_parser_class_specifier_1 (cp_parser* parser)
= parser->in_unbraced_linkage_specification_p;
parser->in_unbraced_linkage_specification_p = false;
- // Associate constraints with the type.
- if (flag_concepts)
- type = associate_classtype_constraints (type);
-
/* Start the class. */
if (nested_name_specifier_p)
{
@@ -24708,10 +24768,10 @@ cp_parser_class_head (cp_parser* parser,
/* If the class was unnamed, create a dummy name. */
if (!id)
id = make_anon_name ();
- tag_scope tag_scope = (parser->in_type_id_in_expr_p
- ? ts_within_enclosing_non_class
- : ts_current);
- type = xref_tag (class_key, id, tag_scope,
+ TAG_how how = (parser->in_type_id_in_expr_p
+ ? TAG_how::INNERMOST_NON_CLASS
+ : TAG_how::CURRENT_ONLY);
+ type = xref_tag (class_key, id, how,
parser->num_template_parameter_lists);
}
@@ -24749,6 +24809,10 @@ cp_parser_class_head (cp_parser* parser,
fixup_attribute_variants (type);
}
+ /* Associate constraints with the type. */
+ if (flag_concepts)
+ type = associate_classtype_constraints (type);
+
/* We will have entered the scope containing the class; the names of
base classes should be looked up in that context. For example:
@@ -41110,6 +41174,10 @@ cp_parser_oacc_declare (cp_parser *parser, cp_token *pragma_tok)
}
if (!found_in_scope)
+ /* This seems to ignore the existence of cleanup scopes?
+ What is the meaning for local extern decls? The local
+ extern is in this scope, but it is referring to a decl that
+ is namespace scope. */
for (tree d = current_binding_level->names; d; d = TREE_CHAIN (d))
if (d == decl)
{
@@ -41139,6 +41207,16 @@ cp_parser_oacc_declare (cp_parser *parser, cp_token *pragma_tok)
{
tree id;
+ if (DECL_LOCAL_DECL_P (decl))
+ /* We need to mark the aliased decl, as that is the entity
+ that is being referred to. This won't work for
+ dependent variables, but it didn't work for them before
+ DECL_LOCAL_DECL_P was a thing either. But then
+ dependent local extern variable decls are as rare as
+ hen's teeth. */
+ if (auto alias = DECL_LOCAL_DECL_ALIAS (decl))
+ decl = alias;
+
if (OMP_CLAUSE_MAP_KIND (t) == GOMP_MAP_LINK)
id = get_identifier ("omp declare target link");
else
@@ -42567,7 +42645,7 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
if (current_function_decl)
{
block_scope = true;
- DECL_CONTEXT (fndecl) = global_namespace;
+ DECL_CONTEXT (fndecl) = current_function_decl;
DECL_LOCAL_DECL_P (fndecl) = true;
if (!processing_template_decl)
pushdecl (fndecl);
@@ -42592,7 +42670,9 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
else
{
DECL_CONTEXT (fndecl) = current_namespace;
- pushdecl (fndecl);
+ tree d = pushdecl (fndecl);
+ /* We should never meet a matched duplicate decl. */
+ gcc_checking_assert (d == error_mark_node || d == fndecl);
}
if (!block_scope)
start_preparsed_function (fndecl, NULL_TREE, SF_PRE_PARSED);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index fe45de8..dc664ec 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1181,7 +1181,7 @@ optimize_specialization_lookup_p (tree tmpl)
not have template information. The optimized lookup relies
on having ARGS be the template arguments for both the class
and the function template. */
- && !DECL_FRIEND_P (DECL_TEMPLATE_RESULT (tmpl)));
+ && !DECL_UNIQUE_FRIEND_P (DECL_TEMPLATE_RESULT (tmpl)));
}
/* Make sure ARGS doesn't use any inappropriate typedefs; we should have
@@ -1635,7 +1635,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
for the specialization, we want this to look as if
there were no definition, and vice versa. */
DECL_INITIAL (fn) = NULL_TREE;
- duplicate_decls (spec, fn, is_friend);
+ duplicate_decls (spec, fn, /*hiding=*/is_friend);
/* The call to duplicate_decls will have applied
[temp.expl.spec]:
@@ -1662,7 +1662,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
}
else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{
- tree dd = duplicate_decls (spec, fn, is_friend);
+ tree dd = duplicate_decls (spec, fn, /*hiding=*/is_friend);
if (dd == error_mark_node)
/* We've already complained in duplicate_decls. */
return error_mark_node;
@@ -1677,7 +1677,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
}
}
else if (fn)
- return duplicate_decls (spec, fn, is_friend);
+ return duplicate_decls (spec, fn, /*hiding=*/is_friend);
/* A specialization must be declared in the same namespace as the
template it is specializing. */
@@ -2988,6 +2988,7 @@ check_explicit_specialization (tree declarator,
tree tmpl = NULL_TREE;
tree targs = NULL_TREE;
bool was_template_id = (TREE_CODE (declarator) == TEMPLATE_ID_EXPR);
+ bool found_hidden = false;
/* Make sure that the declarator is a TEMPLATE_ID_EXPR. */
if (!was_template_id)
@@ -3008,12 +3009,15 @@ check_explicit_specialization (tree declarator,
fns = lookup_qualified_name (CP_DECL_CONTEXT (decl), dname,
LOOK_want::NORMAL, true);
if (fns == error_mark_node)
- /* If lookup fails, look for a friend declaration so we can
- give a better diagnostic. */
- fns = (lookup_qualified_name
- (CP_DECL_CONTEXT (decl), dname,
- LOOK_want::NORMAL | LOOK_want::HIDDEN_FRIEND,
- /*complain*/true));
+ {
+ /* If lookup fails, look for a friend declaration so we can
+ give a better diagnostic. */
+ fns = (lookup_qualified_name
+ (CP_DECL_CONTEXT (decl), dname,
+ LOOK_want::NORMAL | LOOK_want::HIDDEN_FRIEND,
+ /*complain*/true));
+ found_hidden = true;
+ }
if (fns == error_mark_node || !is_overloaded_fn (fns))
{
@@ -3122,8 +3126,7 @@ check_explicit_specialization (tree declarator,
return error_mark_node;
else
{
- if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_HIDDEN_FRIEND_P (tmpl))
+ if (found_hidden && TREE_CODE (decl) == FUNCTION_DECL)
{
auto_diagnostic_group d;
if (pedwarn (DECL_SOURCE_LOCATION (decl), 0,
@@ -3132,8 +3135,9 @@ check_explicit_specialization (tree declarator,
inform (DECL_SOURCE_LOCATION (tmpl),
"friend declaration here");
}
- else if (!ctype && !is_friend
- && CP_DECL_CONTEXT (decl) == current_namespace)
+
+ if (!ctype && !is_friend
+ && CP_DECL_CONTEXT (decl) == current_namespace)
check_unqualified_spec_or_inst (tmpl, DECL_SOURCE_LOCATION (decl));
tree gen_tmpl = most_general_template (tmpl);
@@ -4226,11 +4230,6 @@ check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */)
if (!processing_template_decl || !t || t == error_mark_node)
return false;
- /* A lambda might use a parameter pack from the containing context. */
- if (current_class_type && LAMBDA_TYPE_P (current_class_type)
- && CLASSTYPE_TEMPLATE_INFO (current_class_type))
- return false;
-
if (TREE_CODE (t) == TYPE_DECL)
t = TREE_TYPE (t);
@@ -4240,6 +4239,18 @@ check_for_bare_parameter_packs (tree t, location_t loc /* = UNKNOWN_LOCATION */)
cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
delete ppd.visited;
+ /* It's OK for a lambda to have an unexpanded parameter pack from the
+ containing context, but do complain about unexpanded capture packs. */
+ if (current_class_type && LAMBDA_TYPE_P (current_class_type)
+ && CLASSTYPE_TEMPLATE_INFO (current_class_type))
+ for (; parameter_packs;
+ parameter_packs = TREE_CHAIN (parameter_packs))
+ {
+ tree pack = TREE_VALUE (parameter_packs);
+ if (is_capture_proxy (pack))
+ break;
+ }
+
if (parameter_packs)
{
if (loc == UNKNOWN_LOCATION)
@@ -5669,7 +5680,7 @@ template_parm_outer_level (tree t, void *data)
If IS_FRIEND is true, DECL is a friend declaration. */
tree
-push_template_decl_real (tree decl, bool is_friend)
+push_template_decl (tree decl, bool is_friend)
{
tree tmpl;
tree args;
@@ -5694,8 +5705,10 @@ push_template_decl_real (tree decl, bool is_friend)
&& DECL_TEMPLATE_SPECIALIZATION (decl)
&& TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl))));
- if (TREE_CODE (decl) == FUNCTION_DECL && DECL_FRIEND_P (decl))
- is_friend = true;
+ /* No surprising friend functions. */
+ gcc_checking_assert (is_friend
+ || !(TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_UNIQUE_FRIEND_P (decl)));
if (is_friend)
/* For a friend, we want the context of the friend, not
@@ -5864,7 +5877,8 @@ push_template_decl_real (tree decl, bool is_friend)
|| TREE_CODE (ctx) == FUNCTION_DECL
|| (CLASS_TYPE_P (ctx) && TYPE_BEING_DEFINED (ctx))
|| (TREE_CODE (decl) == TYPE_DECL && LAMBDA_TYPE_P (TREE_TYPE (decl)))
- || (is_friend && !DECL_TEMPLATE_INFO (decl)))
+ || (is_friend && !(DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_INFO (decl))))
{
if (DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_INFO (decl)
@@ -6016,16 +6030,9 @@ push_template_decl_real (tree decl, bool is_friend)
if (!ctx
&& !(is_friend && template_class_depth (current_class_type) > 0))
{
- tmpl = pushdecl_namespace_level (tmpl, is_friend);
+ tmpl = pushdecl_namespace_level (tmpl, /*hiding=*/is_friend);
if (tmpl == error_mark_node)
return error_mark_node;
-
- /* Hide template friend classes that haven't been declared yet. */
- if (is_friend && TREE_CODE (decl) == TYPE_DECL)
- {
- DECL_ANTICIPATED (tmpl) = 1;
- DECL_FRIEND_P (tmpl) = 1;
- }
}
}
else
@@ -6096,12 +6103,6 @@ push_template_decl_real (tree decl, bool is_friend)
return DECL_TEMPLATE_RESULT (tmpl);
}
-tree
-push_template_decl (tree decl)
-{
- return push_template_decl_real (decl, false);
-}
-
/* FN is an inheriting constructor that inherits from the constructor
template INHERITED; turn FN into a constructor template with a matching
template header. */
@@ -7094,12 +7095,12 @@ get_template_parm_object (tree expr, tsubst_flags_t complain)
tree type = cp_build_qualified_type (TREE_TYPE (expr), TYPE_QUAL_CONST);
decl = create_temporary_var (type);
+ DECL_CONTEXT (decl) = NULL_TREE;
TREE_STATIC (decl) = true;
DECL_DECLARED_CONSTEXPR_P (decl) = true;
TREE_READONLY (decl) = true;
DECL_NAME (decl) = name;
SET_DECL_ASSEMBLER_NAME (decl, name);
- DECL_CONTEXT (decl) = global_namespace;
comdat_linkage (decl);
if (!zero_init_p (type))
@@ -8130,9 +8131,10 @@ canonicalize_expr_argument (tree arg, tsubst_flags_t complain)
return canon;
}
-// A template declaration can be substituted for a constrained
-// template template parameter only when the argument is more
-// constrained than the parameter.
+/* A template declaration can be substituted for a constrained
+ template template parameter only when the argument is no more
+ constrained than the parameter. */
+
static bool
is_compatible_template_arg (tree parm, tree arg)
{
@@ -9856,12 +9858,11 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
&& !PRIMARY_TEMPLATE_P (gen_tmpl)
&& !LAMBDA_TYPE_P (TREE_TYPE (gen_tmpl))
&& TREE_CODE (CP_DECL_CONTEXT (gen_tmpl)) == NAMESPACE_DECL)
- {
- found = xref_tag_from_type (TREE_TYPE (gen_tmpl),
- DECL_NAME (gen_tmpl),
- /*tag_scope=*/ts_global);
- return found;
- }
+ /* This occurs when the user has tried to define a tagged type
+ in a scope that forbids it. We emitted an error during the
+ parse. We didn't complete the bail out then, so here we
+ are. */
+ return error_mark_node;
context = DECL_CONTEXT (gen_tmpl);
if (context && TYPE_P (context))
@@ -9944,7 +9945,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
/* A local class. Make sure the decl gets registered properly. */
if (context == current_function_decl)
- if (pushtag (DECL_NAME (gen_tmpl), t, /*tag_scope=*/ts_current)
+ if (pushtag (DECL_NAME (gen_tmpl), t)
== error_mark_node)
return error_mark_node;
@@ -10244,6 +10245,42 @@ lookup_and_finish_template_variable (tree templ, tree targs,
return convert_from_reference (templ);
}
+/* If the set of template parameters PARMS contains a template parameter
+ at the given LEVEL and INDEX, then return this parameter. Otherwise
+ return NULL_TREE. */
+
+static tree
+corresponding_template_parameter (tree parms, int level, int index)
+{
+ while (TMPL_PARMS_DEPTH (parms) > level)
+ parms = TREE_CHAIN (parms);
+
+ if (TMPL_PARMS_DEPTH (parms) != level
+ || TREE_VEC_LENGTH (TREE_VALUE (parms)) <= index)
+ return NULL_TREE;
+
+ tree t = TREE_VALUE (TREE_VEC_ELT (TREE_VALUE (parms), index));
+ /* As in template_parm_to_arg. */
+ if (TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == TEMPLATE_DECL)
+ t = TREE_TYPE (t);
+ else
+ t = DECL_INITIAL (t);
+
+ gcc_assert (TEMPLATE_PARM_P (t));
+ return t;
+}
+
+/* Return the template parameter from PARMS that positionally corresponds
+ to the template parameter PARM, or else return NULL_TREE. */
+
+static tree
+corresponding_template_parameter (tree parms, tree parm)
+{
+ int level, index;
+ template_parm_level_and_index (parm, &level, &index);
+ return corresponding_template_parameter (parms, level, index);
+}
+
struct pair_fn_data
{
@@ -10550,6 +10587,14 @@ keep_template_parm (tree t, void* data)
BOUND_TEMPLATE_TEMPLATE_PARM itself. */
t = TREE_TYPE (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t));
+ /* This template parameter might be an argument to a cached dependent
+ specalization that was formed earlier inside some other template, in
+ which case the parameter is not among the ones that are in-scope.
+ Look in CTX_PARMS to find the corresponding in-scope template
+ parameter, and use it instead. */
+ if (tree in_scope = corresponding_template_parameter (ftpi->ctx_parms, t))
+ t = in_scope;
+
/* Arguments like const T yield parameters like const T. This means that
a template-id like X<T, const T> would yield two distinct parameters:
T and const T. Adjust types to their unqualified versions. */
@@ -11039,7 +11084,7 @@ tsubst_friend_function (tree decl, tree args)
into the namespace of the template. */
ns = decl_namespace_context (new_friend);
push_nested_namespace (ns);
- old_decl = pushdecl_namespace_level (new_friend, /*is_friend=*/true);
+ old_decl = pushdecl_namespace_level (new_friend, /*hiding=*/true);
pop_nested_namespace (ns);
if (old_decl == error_mark_node)
@@ -11268,11 +11313,6 @@ tsubst_friend_class (tree friend_tmpl, tree args)
CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl))
= INNERMOST_TEMPLATE_ARGS (CLASSTYPE_TI_ARGS (TREE_TYPE (tmpl)));
- /* It is hidden. */
- retrofit_lang_decl (DECL_TEMPLATE_RESULT (tmpl));
- DECL_ANTICIPATED (tmpl)
- = DECL_ANTICIPATED (DECL_TEMPLATE_RESULT (tmpl)) = true;
-
/* Substitute into and set the constraints on the new declaration. */
if (tree ci = get_constraints (friend_tmpl))
{
@@ -11284,7 +11324,7 @@ tsubst_friend_class (tree friend_tmpl, tree args)
}
/* Inject this template into the enclosing namspace scope. */
- tmpl = pushdecl_namespace_level (tmpl, true);
+ tmpl = pushdecl_namespace_level (tmpl, /*hiding=*/true);
}
}
@@ -11854,7 +11894,7 @@ instantiate_class_template_1 (tree type)
tsubst_enum. */
if (name)
SET_IDENTIFIER_TYPE_VALUE (name, newtag);
- pushtag (name, newtag, /*tag_scope=*/ts_current);
+ pushtag (name, newtag);
}
}
else if (DECL_DECLARES_FUNCTION_P (t))
@@ -12030,29 +12070,11 @@ instantiate_class_template_1 (tree type)
adjust_processing_template_decl = true;
--processing_template_decl;
}
- else if (TREE_CODE (friend_type) != BOUND_TEMPLATE_TEMPLATE_PARM
- && !CLASSTYPE_USE_TEMPLATE (friend_type)
- && TYPE_HIDDEN_P (friend_type))
- {
- /* friend class C;
-
- where C hasn't been declared yet. Let's lookup name
- from namespace scope directly, bypassing any name that
- come from dependent base class. */
- tree ns = decl_namespace_context (TYPE_MAIN_DECL (friend_type));
-
- /* The call to xref_tag_from_type does injection for friend
- classes. */
- push_nested_namespace (ns);
- friend_type =
- xref_tag_from_type (friend_type, NULL_TREE,
- /*tag_scope=*/ts_current);
- pop_nested_namespace (ns);
- }
else if (uses_template_parms (friend_type))
/* friend class C<T>; */
friend_type = tsubst (friend_type, args,
tf_warning_or_error, NULL_TREE);
+
/* Otherwise it's
friend class C;
@@ -13433,7 +13455,8 @@ tsubst_aggr_type (tree t,
complain, in_decl);
if (argvec == error_mark_node)
r = error_mark_node;
- else if (cxx_dialect >= cxx17 && dependent_scope_p (context))
+ else if (!entering_scope
+ && cxx_dialect >= cxx17 && dependent_scope_p (context))
{
/* See maybe_dependent_member_ref. */
tree name = TYPE_IDENTIFIER (t);
@@ -13941,7 +13964,7 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
if (!lambda_fntype)
set_constraints (r, ci);
- if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t))
+ if (DECL_FRIEND_CONTEXT (t))
SET_DECL_FRIEND_CONTEXT (r,
tsubst (DECL_FRIEND_CONTEXT (t),
args, complain, in_decl));
@@ -14142,7 +14165,11 @@ tsubst_template_decl (tree t, tree args, tsubst_flags_t complain,
class_p = true;
inner = TREE_TYPE (inner);
}
- inner = tsubst (inner, args, complain, in_decl);
+ if (class_p)
+ inner = tsubst_aggr_type (inner, args, complain,
+ in_decl, /*entering*/1);
+ else
+ inner = tsubst (inner, args, complain, in_decl);
}
--processing_template_decl;
if (inner == error_mark_node)
@@ -16507,6 +16534,14 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case FUNCTION_DECL:
if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
r = tsubst (t, args, complain, in_decl);
+ else if (DECL_LOCAL_DECL_P (t))
+ {
+ /* Local specialization will have been created when we
+ instantiated the DECL_EXPR_DECL. */
+ r = retrieve_local_specialization (t);
+ if (!r)
+ r = error_mark_node;
+ }
else if (local_variable_p (t)
&& uses_template_parms (DECL_CONTEXT (t)))
{
@@ -18079,18 +18114,15 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
}
else if (DECL_IMPLICIT_TYPEDEF_P (t))
/* We already did a pushtag. */;
- else if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_OMP_DECLARE_REDUCTION_P (decl)
- && DECL_FUNCTION_SCOPE_P (pattern_decl))
+ else if (VAR_OR_FUNCTION_DECL_P (decl)
+ && DECL_LOCAL_DECL_P (decl))
{
- /* We pretend this is regular local extern decl of
- a namespace-scope fn. Then we make it really
- local, it is a nested function. */
- gcc_checking_assert (DECL_LOCAL_DECL_P (decl));
- DECL_CONTEXT (decl) = global_namespace;
- pushdecl (decl);
- DECL_CONTEXT (decl) = current_function_decl;
- if (cp_check_omp_declare_reduction (decl))
+ if (TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
+ DECL_CONTEXT (decl) = NULL_TREE;
+ decl = pushdecl (decl);
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_OMP_DECLARE_REDUCTION_P (decl)
+ && cp_check_omp_declare_reduction (decl))
instantiate_body (pattern_decl, args, decl, true);
}
else
@@ -19256,7 +19288,8 @@ out:
}
/* Like tsubst but deals with expressions and performs semantic
- analysis. FUNCTION_P is true if T is the "F" in "F (ARGS)". */
+ analysis. FUNCTION_P is true if T is the "F" in "F (ARGS)" or
+ "F<TARGS> (ARGS)". */
tree
tsubst_copy_and_build (tree t,
@@ -19338,7 +19371,10 @@ tsubst_copy_and_build (tree t,
case TEMPLATE_ID_EXPR:
{
tree object;
- tree templ = RECUR (TREE_OPERAND (t, 0));
+ tree templ = tsubst_copy_and_build (TREE_OPERAND (t, 0), args,
+ complain, in_decl,
+ function_p,
+ integral_constant_expression_p);
tree targs = TREE_OPERAND (t, 1);
if (targs)
@@ -19385,13 +19421,21 @@ tsubst_copy_and_build (tree t,
}
else
object = NULL_TREE;
- templ = lookup_template_function (templ, targs);
+
+ tree tid = lookup_template_function (templ, targs);
if (object)
- RETURN (build3 (COMPONENT_REF, TREE_TYPE (templ),
- object, templ, NULL_TREE));
+ RETURN (build3 (COMPONENT_REF, TREE_TYPE (tid),
+ object, tid, NULL_TREE));
+ else if (identifier_p (templ))
+ {
+ /* C++20 P0846: we can encounter an IDENTIFIER_NODE here when
+ name lookup found nothing when parsing the template name. */
+ gcc_assert (cxx_dialect >= cxx20 || seen_error ());
+ RETURN (tid);
+ }
else
- RETURN (baselink_for_fns (templ));
+ RETURN (baselink_for_fns (tid));
}
case INDIRECT_REF:
@@ -19927,7 +19971,7 @@ tsubst_copy_and_build (tree t,
/* Stripped-down processing for a call in a thunk. Specifically, in
the thunk template for a generic lambda. */
- if (CALL_FROM_THUNK_P (t))
+ if (call_from_lambda_thunk_p (t))
{
/* Now that we've expanded any packs, the number of call args
might be different. */
@@ -19982,14 +20026,17 @@ tsubst_copy_and_build (tree t,
/* We do not perform argument-dependent lookup if normal
lookup finds a non-function, in accordance with the
- expected resolution of DR 218. */
+ resolution of DR 218. */
if (koenig_p
&& ((is_overloaded_fn (function)
/* If lookup found a member function, the Koenig lookup is
not appropriate, even if an unqualified-name was used
to denote the function. */
&& !DECL_FUNCTION_MEMBER_P (get_first_fn (function)))
- || identifier_p (function))
+ || identifier_p (function)
+ /* C++20 P0846: Lookup found nothing. */
+ || (TREE_CODE (function) == TEMPLATE_ID_EXPR
+ && identifier_p (TREE_OPERAND (function, 0))))
/* Only do this when substitution turns a dependent call
into a non-dependent call. */
&& type_dependent_expression_p_push (t)
@@ -19997,9 +20044,13 @@ tsubst_copy_and_build (tree t,
function = perform_koenig_lookup (function, call_args, tf_none);
if (function != NULL_TREE
- && identifier_p (function)
+ && (identifier_p (function)
+ || (TREE_CODE (function) == TEMPLATE_ID_EXPR
+ && identifier_p (TREE_OPERAND (function, 0))))
&& !any_type_dependent_arguments_p (call_args))
{
+ if (TREE_CODE (function) == TEMPLATE_ID_EXPR)
+ function = TREE_OPERAND (function, 0);
if (koenig_p && (complain & tf_warning_or_error))
{
/* For backwards compatibility and good diagnostics, try
@@ -25365,15 +25416,20 @@ maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain)
push_deferring_access_checks (dk_no_deferred);
input_location = DECL_SOURCE_LOCATION (fn);
- /* If needed, set current_class_ptr for the benefit of
- tsubst_copy/PARM_DECL. */
- tree tdecl = DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (fn));
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tdecl))
+ if (!DECL_LOCAL_DECL_P (fn))
{
- tree this_parm = DECL_ARGUMENTS (tdecl);
- current_class_ptr = NULL_TREE;
- current_class_ref = cp_build_fold_indirect_ref (this_parm);
- current_class_ptr = this_parm;
+ /* If needed, set current_class_ptr for the benefit of
+ tsubst_copy/PARM_DECL. The exception pattern will
+ refer to the parm of the template, not the
+ instantiation. */
+ tree tdecl = DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (fn));
+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tdecl))
+ {
+ tree this_parm = DECL_ARGUMENTS (tdecl);
+ current_class_ptr = NULL_TREE;
+ current_class_ref = cp_build_fold_indirect_ref (this_parm);
+ current_class_ptr = this_parm;
+ }
}
/* If this function is represented by a TEMPLATE_DECL, then
@@ -26997,7 +27053,7 @@ type_dependent_expression_p (tree expression)
&& !(DECL_CLASS_SCOPE_P (expression)
&& dependent_type_p (DECL_CONTEXT (expression)))
&& !(DECL_LANG_SPECIFIC (expression)
- && DECL_FRIEND_P (expression)
+ && DECL_UNIQUE_FRIEND_P (expression)
&& (!DECL_FRIEND_CONTEXT (expression)
|| dependent_type_p (DECL_FRIEND_CONTEXT (expression))))
&& !DECL_LOCAL_DECL_P (expression))
@@ -27881,7 +27937,9 @@ make_constrained_placeholder_type (tree type, tree con, tree args)
tree expr = tmpl;
if (TREE_CODE (con) == FUNCTION_DECL)
expr = ovl_make (tmpl);
+ ++processing_template_decl;
expr = build_concept_check (expr, type, args, tf_warning_or_error);
+ --processing_template_decl;
PLACEHOLDER_TYPE_CONSTRAINTS (type) = expr;
@@ -28830,17 +28888,19 @@ static GTY((deletable)) hash_map<tree, tree_pair_p> *dguide_cache;
/* Return the non-aggregate deduction guides for deducible template TMPL. The
aggregate candidate is added separately because it depends on the
- initializer. */
+ initializer. Set ANY_DGUIDES_P if we find a non-implicit deduction
+ guide. */
static tree
-deduction_guides_for (tree tmpl, tsubst_flags_t complain)
+deduction_guides_for (tree tmpl, bool &any_dguides_p, tsubst_flags_t complain)
{
tree guides = NULL_TREE;
if (DECL_ALIAS_TEMPLATE_P (tmpl))
{
tree under = DECL_ORIGINAL_TYPE (DECL_TEMPLATE_RESULT (tmpl));
tree tinfo = get_template_info (under);
- guides = deduction_guides_for (TI_TEMPLATE (tinfo), complain);
+ guides = deduction_guides_for (TI_TEMPLATE (tinfo), any_dguides_p,
+ complain);
}
else
{
@@ -28849,6 +28909,8 @@ deduction_guides_for (tree tmpl, tsubst_flags_t complain)
LOOK_want::NORMAL, /*complain*/false);
if (guides == error_mark_node)
guides = NULL_TREE;
+ else
+ any_dguides_p = true;
}
/* Cache the deduction guides for a template. We also remember the result of
@@ -28940,6 +29002,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init,
tree type = TREE_TYPE (tmpl);
bool try_list_ctor = false;
+ bool list_init_p = false;
releasing_vec rv_args = NULL;
vec<tree,va_gc> *&args = *&rv_args;
@@ -28947,6 +29010,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init,
args = make_tree_vector ();
else if (BRACE_ENCLOSED_INITIALIZER_P (init))
{
+ list_init_p = true;
try_list_ctor = TYPE_HAS_LIST_CTOR (type);
if (try_list_ctor && CONSTRUCTOR_NELTS (init) == 1)
{
@@ -28974,13 +29038,15 @@ do_class_deduction (tree ptype, tree tmpl, tree init,
if (args == NULL)
return error_mark_node;
- tree cands = deduction_guides_for (tmpl, complain);
+ bool any_dguides_p = false;
+ tree cands = deduction_guides_for (tmpl, any_dguides_p, complain);
if (cands == error_mark_node)
return error_mark_node;
- /* Prune explicit deduction guides in copy-initialization context. */
+ /* Prune explicit deduction guides in copy-initialization context (but
+ not copy-list-initialization). */
bool elided = false;
- if (flags & LOOKUP_ONLYCONVERTING)
+ if (!list_init_p && (flags & LOOKUP_ONLYCONVERTING))
{
for (lkp_iterator iter (cands); !elided && iter; ++iter)
if (DECL_NONCONVERTING_P (STRIP_TEMPLATE (*iter)))
@@ -29049,18 +29115,57 @@ do_class_deduction (tree ptype, tree tmpl, tree init,
--cp_unevaluated_operand;
}
- if (call == error_mark_node
- && (complain & tf_warning_or_error))
+ if (call == error_mark_node)
{
- error ("class template argument deduction failed:");
+ if (complain & tf_warning_or_error)
+ {
+ error ("class template argument deduction failed:");
- ++cp_unevaluated_operand;
- call = build_new_function_call (cands, &args, complain | tf_decltype);
- --cp_unevaluated_operand;
+ ++cp_unevaluated_operand;
+ call = build_new_function_call (cands, &args,
+ complain | tf_decltype);
+ --cp_unevaluated_operand;
- if (elided)
- inform (input_location, "explicit deduction guides not considered "
- "for copy-initialization");
+ if (elided)
+ inform (input_location, "explicit deduction guides not considered "
+ "for copy-initialization");
+ }
+ return error_mark_node;
+ }
+ /* [over.match.list]/1: In copy-list-initialization, if an explicit
+ constructor is chosen, the initialization is ill-formed. */
+ else if (flags & LOOKUP_ONLYCONVERTING)
+ {
+ tree fndecl = cp_get_callee_fndecl_nofold (call);
+ if (fndecl && DECL_NONCONVERTING_P (fndecl))
+ {
+ if (complain & tf_warning_or_error)
+ {
+ // TODO: Pass down location from cp_finish_decl.
+ error ("class template argument deduction for %qT failed: "
+ "explicit deduction guide selected in "
+ "copy-list-initialization", type);
+ inform (DECL_SOURCE_LOCATION (fndecl),
+ "explicit deduction guide declared here");
+
+ }
+ return error_mark_node;
+ }
+ }
+
+ /* If CTAD succeeded but the type doesn't have any explicit deduction
+ guides, this deduction might not be what the user intended. */
+ if (call != error_mark_node && !any_dguides_p)
+ {
+ tree fndecl = cp_get_callee_fndecl_nofold (call);
+ if (fndecl != NULL_TREE
+ && (!DECL_IN_SYSTEM_HEADER (fndecl)
+ || global_dc->dc_warn_system_headers)
+ && warning (OPT_Wctad_maybe_unsupported,
+ "%qT may not intend to support class template argument "
+ "deduction", type))
+ inform (input_location, "add a deduction guide to suppress this "
+ "warning");
}
return cp_build_qualified_type (TREE_TYPE (call), cp_type_quals (ptype));
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index 11833e3..a28b722 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -332,8 +332,12 @@ debug_overload (tree node)
tree decl = *iter;
auto xloc = expand_location (DECL_SOURCE_LOCATION (decl));
auto fullname = decl_as_string (decl, 0);
+ bool using_p = iter.using_p ();
+ bool hidden_p = iter.hidden_p ();
- fprintf (file, "%p: %s:%d:%d \"%s\"\n", (void *)decl,
+ fprintf (file, "%p:%c%c %s:%d:%d \"%s\"\n", (void *)decl,
+ hidden_p ? 'H' : '-',
+ using_p ? 'U' : '-',
xloc.file, xloc.line, xloc.column, fullname);
}
}
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 0ab3c42..7c4bff7 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -169,8 +169,7 @@ init_rtti_processing (void)
tree type_info_type;
push_nested_namespace (std_node);
- type_info_type = xref_tag (class_type, get_identifier ("type_info"),
- /*tag_scope=*/ts_current, false);
+ type_info_type = xref_tag (class_type, get_identifier ("type_info"));
pop_nested_namespace (std_node);
const_type_info_type_node
= cp_build_qualified_type (type_info_type, TYPE_QUAL_CONST);
@@ -761,9 +760,7 @@ build_dynamic_cast_1 (location_t loc, tree type, tree expr,
push_abi_namespace ();
tinfo_ptr = xref_tag (class_type,
- get_identifier ("__class_type_info"),
- /*tag_scope=*/ts_current, false);
-
+ get_identifier ("__class_type_info"));
tinfo_ptr = build_pointer_type
(cp_build_qualified_type
(tinfo_ptr, TYPE_QUAL_CONST));
@@ -948,10 +945,8 @@ tinfo_base_init (tinfo_s *ti, tree target)
vtable_ptr = ti->vtable;
if (!vtable_ptr)
{
- tree real_type;
push_abi_namespace ();
- real_type = xref_tag (class_type, ti->name,
- /*tag_scope=*/ts_current, false);
+ tree real_type = xref_tag (class_type, ti->name);
pop_abi_namespace ();
if (!COMPLETE_TYPE_P (real_type))
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 11996c9..1e42cd7 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3030,6 +3030,7 @@ finish_compound_literal (tree type, tree compound_literal,
&& initializer_constant_valid_p (compound_literal, type))
{
tree decl = create_temporary_var (type);
+ DECL_CONTEXT (decl) = NULL_TREE;
DECL_INITIAL (decl) = compound_literal;
TREE_STATIC (decl) = 1;
if (literal_type_p (type) && CP_TYPE_CONST_NON_VOLATILE_P (type))
@@ -3216,13 +3217,13 @@ begin_class_definition (tree t)
if (t == error_mark_node || ! MAYBE_CLASS_TYPE_P (t))
{
t = make_class_type (RECORD_TYPE);
- pushtag (make_anon_name (), t, /*tag_scope=*/ts_current);
+ pushtag (make_anon_name (), t);
}
if (TYPE_BEING_DEFINED (t))
{
t = make_class_type (TREE_CODE (t));
- pushtag (TYPE_IDENTIFIER (t), t, /*tag_scope=*/ts_current);
+ pushtag (TYPE_IDENTIFIER (t), t);
}
maybe_process_partial_specialization (t);
pushclass (t);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index e860660..9bc37ac 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2237,13 +2237,13 @@ ovl_make (tree fn, tree next)
return result;
}
-/* Add FN to the (potentially NULL) overload set OVL. USING_P is
- true, if FN is via a using declaration. We also pay attention to
- DECL_HIDDEN. We keep the hidden decls first, but remaining ones
- are unordered. */
+/* Add FN to the (potentially NULL) overload set OVL. USING_OR_HIDDEN
+ is > 0, if FN is via a using declaration. USING_OR_HIDDEN is < 0,
+ if FN is hidden. (A decl cannot be both using and hidden.) We
+ keep the hidden decls first, but remaining ones are unordered. */
tree
-ovl_insert (tree fn, tree maybe_ovl, bool using_p)
+ovl_insert (tree fn, tree maybe_ovl, int using_or_hidden)
{
tree result = maybe_ovl;
tree insert_after = NULL_TREE;
@@ -2257,13 +2257,13 @@ ovl_insert (tree fn, tree maybe_ovl, bool using_p)
insert_after = maybe_ovl;
}
- bool hidden_p = DECL_HIDDEN_P (fn);
- if (maybe_ovl || using_p || hidden_p || TREE_CODE (fn) == TEMPLATE_DECL)
+ if (maybe_ovl || using_or_hidden || TREE_CODE (fn) == TEMPLATE_DECL)
{
maybe_ovl = ovl_make (fn, maybe_ovl);
- if (hidden_p)
+
+ if (using_or_hidden < 0)
OVL_HIDDEN_P (maybe_ovl) = true;
- if (using_p)
+ if (using_or_hidden > 0)
OVL_DEDUP_P (maybe_ovl) = OVL_USING_P (maybe_ovl) = true;
}
else
@@ -2285,18 +2285,8 @@ ovl_insert (tree fn, tree maybe_ovl, bool using_p)
tree
ovl_skip_hidden (tree ovl)
{
- for (;
- ovl && TREE_CODE (ovl) == OVERLOAD && OVL_HIDDEN_P (ovl);
- ovl = OVL_CHAIN (ovl))
- gcc_checking_assert (DECL_HIDDEN_P (OVL_FUNCTION (ovl)));
-
- if (ovl && TREE_CODE (ovl) != OVERLOAD && DECL_HIDDEN_P (ovl))
- {
- /* Any hidden functions should have been wrapped in an
- overload, but injected friend classes will not. */
- gcc_checking_assert (!DECL_DECLARES_FUNCTION_P (ovl));
- ovl = NULL_TREE;
- }
+ while (ovl && TREE_CODE (ovl) == OVERLOAD && OVL_HIDDEN_P (ovl))
+ ovl = OVL_CHAIN (ovl);
return ovl;
}
@@ -2648,6 +2638,9 @@ build_cp_fntype_variant (tree type, cp_ref_qualifier rqual,
/* Need to build a new variant. */
v = build_variant_type_copy (type);
+ if (!TYPE_DEPENDENT_P (v))
+ /* We no longer know that it's not type-dependent. */
+ TYPE_DEPENDENT_P_VALID (v) = false;
TYPE_RAISES_EXCEPTIONS (v) = raises;
TYPE_HAS_LATE_RETURN_TYPE (v) = late;
switch (rqual)
@@ -3810,6 +3803,8 @@ cp_tree_equal (tree t1, tree t2)
if (SIZEOF_EXPR_TYPE_P (t2))
o2 = TREE_TYPE (o2);
}
+ else if (ALIGNOF_EXPR_STD_P (t1) != ALIGNOF_EXPR_STD_P (t2))
+ return false;
if (TREE_CODE (o1) != TREE_CODE (o2))
return false;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9166156..48d34f1 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4706,14 +4706,13 @@ cp_build_binary_op (const op_location_t &location,
{
tree type0 = TREE_OPERAND (op0, 0);
tree type1 = TREE_OPERAND (op1, 0);
- tree first_arg = type0;
+ tree first_arg = tree_strip_any_location_wrapper (type0);
if (!TYPE_P (type0))
type0 = TREE_TYPE (type0);
if (!TYPE_P (type1))
type1 = TREE_TYPE (type1);
if (INDIRECT_TYPE_P (type0) && same_type_p (TREE_TYPE (type0), type1))
{
- STRIP_ANY_LOCATION_WRAPPER (first_arg);
if (!(TREE_CODE (first_arg) == PARM_DECL
&& DECL_ARRAY_PARAMETER_P (first_arg)
&& warn_sizeof_array_argument)
@@ -4729,6 +4728,13 @@ cp_build_binary_op (const op_location_t &location,
"first %<sizeof%> operand was declared here");
}
}
+ else if (TREE_CODE (type0) == ARRAY_TYPE
+ && !char_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type0)))
+ /* Set by finish_parenthesized_expr. */
+ && !TREE_NO_WARNING (op1)
+ && (complain & tf_warning))
+ maybe_warn_sizeof_array_div (location, first_arg, type0,
+ op1, non_reference (type1));
}
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE
@@ -10171,7 +10177,7 @@ check_return_expr (tree retval, bool *no_warning)
/* The call in a (lambda) thunk needs no conversions. */
if (TREE_CODE (retval) == CALL_EXPR
- && CALL_FROM_THUNK_P (retval))
+ && call_from_lambda_thunk_p (retval))
converted = true;
/* First convert the value to the function's return type, then
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 1ae5199..2d7945c 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,22 @@
+2020-10-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * decl.cc (finish_thunk): Update for new thunk api.
+
+2020-10-22 Jan Hubicka <hubicka@ucw.cz>
+
+ * decl.cc: Include tree-nested.h
+ (get_symbol_decl): Update for new nested function info.
+
+2020-10-12 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * dmd/MERGE: Merge upstream dmd 70aabfb51
+
+2020-10-12 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * dmd/MERGE: Merge upstream dmd 3a9790525
+ * d-target.cc (Target::isVectorTypeSupported): Adjust return codes for
+ invalid size and invalid base type.
+
2020-09-12 Iain Buclaw <ibuclaw@gdcproject.org>
PR d/97002
diff --git a/gcc/d/d-target.cc b/gcc/d/d-target.cc
index 4a38cca..78f1420 100644
--- a/gcc/d/d-target.cc
+++ b/gcc/d/d-target.cc
@@ -241,7 +241,7 @@ Target::isVectorTypeSupported (int sz, Type *type)
{
/* Size must be greater than zero, and a power of two. */
if (sz <= 0 || sz & (sz - 1))
- return 2;
+ return 3;
/* __vector(void[]) is treated same as __vector(ubyte[]) */
if (type == Type::tvoid)
@@ -249,7 +249,7 @@ Target::isVectorTypeSupported (int sz, Type *type)
/* No support for non-trivial types, complex types, or booleans. */
if (!type->isTypeBasic () || type->iscomplex () || type->ty == Tbool)
- return 3;
+ return 2;
/* In [simd/vector extensions], which vector types are supported depends on
the target. The implementation is expected to only support the vector
@@ -258,7 +258,7 @@ Target::isVectorTypeSupported (int sz, Type *type)
tree ctype = build_vector_type (build_ctype (type), nunits);
if (!targetm.vector_mode_supported_p (TYPE_MODE (ctype)))
- return 3;
+ return 2;
return 0;
}
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 161a85a..457894f 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -53,6 +53,10 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "debug.h"
#include "tree-pretty-print.h"
+#include "tree-nested.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
#include "d-tree.h"
@@ -1280,8 +1284,8 @@ get_symbol_decl (Declaration *decl)
all static chain passing is handled by the front-end. Do this even
if we are not emitting the body. */
struct cgraph_node *node = cgraph_node::get_create (decl->csym);
- if (node->origin)
- node->unnest ();
+ if (nested_function_origin (node))
+ unnest_function (node);
}
/* Mark compiler generated temporaries as artificial. */
@@ -1701,7 +1705,7 @@ finish_thunk (tree thunk, tree function)
if (!stdarg_p (TREE_TYPE (thunk)))
{
thunk_node->create_edge (funcn, NULL, thunk_node->count);
- thunk_node->expand_thunk (false, true);
+ expand_thunk (thunk_node, false, true);
}
/* Tell the back-end to not bother inlining the function, this is
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 4676645..5f6193f 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-e49192807967c6f11252683a731c5a0159ef36da
+70aabfb511d55f2bfbdccbac7868519d9d4b63da
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/declaration.c b/gcc/d/dmd/declaration.c
index 08b2950..f490cc5 100644
--- a/gcc/d/dmd/declaration.c
+++ b/gcc/d/dmd/declaration.c
@@ -340,6 +340,13 @@ void AliasDeclaration::semantic(Scope *sc)
void AliasDeclaration::aliasSemantic(Scope *sc)
{
//printf("AliasDeclaration::semantic() %s\n", toChars());
+
+ // as AliasDeclaration::semantic, in case we're called first.
+ // see https://issues.dlang.org/show_bug.cgi?id=21001
+ storage_class |= sc->stc & STCdeprecated;
+ protection = sc->protection;
+ userAttribDecl = sc->userAttribDecl;
+
// TypeTraits needs to know if it's located in an AliasDeclaration
sc->flags |= SCOPEalias;
diff --git a/gcc/d/dmd/mtype.c b/gcc/d/dmd/mtype.c
index 36471557..bc66be0 100644
--- a/gcc/d/dmd/mtype.c
+++ b/gcc/d/dmd/mtype.c
@@ -3824,12 +3824,12 @@ Type *TypeVector::semantic(Loc loc, Scope *sc)
case 1: // no support at all
error(loc, "SIMD vector types not supported on this platform");
return terror;
- case 2: // invalid size
- error(loc, "%d byte vector type %s is not supported on this platform", sz, toChars());
- return terror;
- case 3: // invalid base type
+ case 2: // invalid base type
error(loc, "vector type %s is not supported on this platform", toChars());
return terror;
+ case 3: // invalid size
+ error(loc, "%d byte vector type %s is not supported on this platform", sz, toChars());
+ return terror;
default:
assert(0);
}
diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c
index d3ba634..7abb48a 100644
--- a/gcc/data-streamer-in.c
+++ b/gcc/data-streamer-in.c
@@ -186,6 +186,17 @@ streamer_read_poly_uint64 (class lto_input_block *ib)
return res;
}
+/* Read a poly_int64 from IB. */
+
+poly_int64
+streamer_read_poly_int64 (class lto_input_block *ib)
+{
+ poly_int64 res;
+ for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
+ res.coeffs[i] = streamer_read_hwi (ib);
+ return res;
+}
+
/* Read gcov_type value from IB. */
gcov_type
diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c
index 6603839..fb8a90a 100644
--- a/gcc/data-streamer-out.c
+++ b/gcc/data-streamer-out.c
@@ -229,6 +229,15 @@ streamer_write_poly_uint64 (struct output_block *ob, poly_uint64 work)
streamer_write_uhwi_stream (ob->main_stream, work.coeffs[i]);
}
+/* Write a poly_int64 value WORK to OB->main_stream. */
+
+void
+streamer_write_poly_int64 (struct output_block *ob, poly_int64 work)
+{
+ for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
+ streamer_write_hwi_stream (ob->main_stream, work.coeffs[i]);
+}
+
/* Write a gcov counter value WORK to OB->main_stream. */
void
diff --git a/gcc/data-streamer.h b/gcc/data-streamer.h
index 61fa3f9..6ab586f 100644
--- a/gcc/data-streamer.h
+++ b/gcc/data-streamer.h
@@ -54,6 +54,7 @@ void streamer_write_zero (struct output_block *);
void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT);
void streamer_write_hwi (struct output_block *, HOST_WIDE_INT);
void streamer_write_poly_uint64 (struct output_block *, poly_uint64);
+void streamer_write_poly_int64 (struct output_block *, poly_int64);
void streamer_write_gcov_count (struct output_block *, gcov_type);
void streamer_write_string (struct output_block *, struct lto_output_stream *,
const char *, bool);
@@ -84,6 +85,7 @@ const char *bp_unpack_string (class data_in *, struct bitpack_d *);
unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *);
HOST_WIDE_INT streamer_read_hwi (class lto_input_block *);
poly_uint64 streamer_read_poly_uint64 (class lto_input_block *);
+poly_int64 streamer_read_poly_int64 (class lto_input_block *);
gcov_type streamer_read_gcov_count (class lto_input_block *);
wide_int streamer_read_wide_int (class lto_input_block *);
widest_int streamer_read_widest_int (class lto_input_block *);
diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c
index ae98a28..2a2dd57 100644
--- a/gcc/dbgcnt.c
+++ b/gcc/dbgcnt.c
@@ -45,6 +45,7 @@ static struct string2counter_map map[debug_counter_number_of_counters] =
typedef std::pair<unsigned int, unsigned int> limit_tuple;
static vec<limit_tuple> limits[debug_counter_number_of_counters];
+static vec<limit_tuple> original_limits[debug_counter_number_of_counters];
static unsigned int count[debug_counter_number_of_counters];
@@ -79,7 +80,10 @@ dbg_cnt (enum debug_counter index)
{
print_limit_reach (map[index].name, v, false);
if (min == max)
- limits[index].pop ();
+ {
+ print_limit_reach (map[index].name, v, true);
+ limits[index].pop ();
+ }
return true;
}
else if (v < max)
@@ -131,6 +135,8 @@ dbg_cnt_set_limit_by_index (enum debug_counter index, const char *name,
}
}
+ original_limits[index] = limits[index].copy ();
+
return true;
}
@@ -223,25 +229,27 @@ void
dbg_cnt_list_all_counters (void)
{
int i;
- printf (" %-30s %s\n", G_("counter name"), G_("closed intervals"));
- printf ("-----------------------------------------------------------------\n");
+ fprintf (stderr, " %-30s%-15s %s\n", G_("counter name"),
+ G_("counter value"), G_("closed intervals"));
+ fprintf (stderr, "-----------------------------------------------------------------\n");
for (i = 0; i < debug_counter_number_of_counters; i++)
{
- printf (" %-30s ", map[i].name);
- if (limits[i].exists ())
+ fprintf (stderr, " %-30s%-15d ", map[i].name, count[i]);
+ if (original_limits[i].exists ())
{
- for (int j = limits[i].length () - 1; j >= 0; j--)
+ for (int j = original_limits[i].length () - 1; j >= 0; j--)
{
- printf ("[%u, %u]", limits[i][j].first, limits[i][j].second);
+ fprintf (stderr, "[%u, %u]", original_limits[i][j].first,
+ original_limits[i][j].second);
if (j > 0)
- printf (", ");
+ fprintf (stderr, ", ");
}
- putchar ('\n');
+ fprintf (stderr, "\n");
}
else
- printf ("unset\n");
+ fprintf (stderr, "unset\n");
}
- printf ("\n");
+ fprintf (stderr, "\n");
}
#if CHECKING_P
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index cf8775b..07946a8 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -171,6 +171,7 @@ DEBUG_COUNTER (if_after_reload)
DEBUG_COUNTER (if_conversion)
DEBUG_COUNTER (if_conversion_tree)
DEBUG_COUNTER (ipa_cp_bits)
+DEBUG_COUNTER (ipa_mod_ref)
DEBUG_COUNTER (ipa_sra_params)
DEBUG_COUNTER (ipa_sra_retvalues)
DEBUG_COUNTER (ira_move)
diff --git a/gcc/dfp.c b/gcc/dfp.c
index fef39a5..4a0f68e 100644
--- a/gcc/dfp.c
+++ b/gcc/dfp.c
@@ -740,4 +740,6 @@ decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, machine_mode mode)
decimal_real_from_string (r, max);
if (sign)
decimal128SetSign ((decimal128 *) r->sig, 1);
+
+ r->sign = sign;
}
diff --git a/gcc/doc/analyzer.texi b/gcc/doc/analyzer.texi
index 92c12e1..96fe9bb 100644
--- a/gcc/doc/analyzer.texi
+++ b/gcc/doc/analyzer.texi
@@ -329,7 +329,8 @@ we only emit the simplest path (which could be intraprocedural, if
it can be reproduced without a caller). We apply a check that
each duplicate warning's shortest path is feasible, rejecting any
warnings for which the shortest path is infeasible (which could lead to
-false negatives).
+false negatives). This check can be suppressed (for debugging purposes)
+using @option{-fno-analyzer-feasibility}.
We use the shortest feasible @code{exploded_path} through the
@code{exploded_graph} (a list of @code{exploded_edge *}) to build a
@@ -488,6 +489,9 @@ truthfulness of the argument. This is useful for writing DejaGnu tests.
@subsection Other Debugging Techniques
+The option @option{-fdump-analyzer-json} will dump both the supergraph
+and the exploded graph in compressed JSON form.
+
One approach when tracking down where a particular bogus state is
introduced into the @code{exploded_graph} is to add custom code to
@code{program_state::validate}.
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 5571c4f..5be1cbe 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3680,6 +3680,10 @@ This attribute adds stack protection code to the function if
flags @option{-fstack-protector}, @option{-fstack-protector-strong}
or @option{-fstack-protector-explicit} are set.
+@item no_stack_protector
+@cindex @code{no_stack_protector} function attribute
+This attribute prevents stack protection code for the function.
+
@item target (@var{string}, @dots{})
@cindex @code{target} function attribute
Multiple target back ends implement the @code{target} attribute
@@ -6623,6 +6627,31 @@ Enable/disable the generation of the XSAVEOPT instructions.
@cindex @code{target("xsaves")} function attribute, x86
Enable/disable the generation of the XSAVES instructions.
+@item amx-tile
+@itemx no-amx-tile
+@cindex @code{target("amx-tile")} function attribute, x86
+Enable/disable the generation of the AMX-TILE instructions.
+
+@item amx-int8
+@itemx no-amx-int8
+@cindex @code{target("amx-int8")} function attribute, x86
+Enable/disable the generation of the AMX-INT8 instructions.
+
+@item amx-bf16
+@itemx no-amx-bf16
+@cindex @code{target("amx-bf16")} function attribute, x86
+Enable/disable the generation of the AMX-BF16 instructions.
+
+@item uintr
+@itemx no-uintr
+@cindex @code{target("uintr")} function attribute, x86
+Enable/disable the generation of the UINTR instructions.
+
+@item hreset
+@itemx no-hreset
+@cindex @code{target("hreset")} function attribute, x86
+Enable/disable the generation of the HRESET instruction.
+
@item cld
@itemx no-cld
@cindex @code{target("cld")} function attribute, x86
@@ -12760,7 +12789,7 @@ Outside strict ISO C mode (@option{-ansi}, @option{-std=c90},
@code{j1f}, @code{j1l}, @code{j1}, @code{jnf}, @code{jnl}, @code{jn},
@code{lgammaf_r}, @code{lgammal_r}, @code{lgamma_r}, @code{mempcpy},
@code{pow10f}, @code{pow10l}, @code{pow10}, @code{printf_unlocked},
-@code{rindex}, @code{roundeven}, @code{roundevenf}, @code{roudnevenl},
+@code{rindex}, @code{roundeven}, @code{roundevenf}, @code{roundevenl},
@code{scalbf}, @code{scalbl}, @code{scalb},
@code{signbit}, @code{signbitf}, @code{signbitl}, @code{signbitd32},
@code{signbitd64}, @code{signbitd128}, @code{significandf},
@@ -17635,6 +17664,37 @@ Perform a 64-bit parallel bits extract operation, as if implemented by the
@code{pextd} instruction.
@findex __builtin_pextd
+@smallexample
+@exdent vector signed __int128 vsx_xl_sext (signed long long, signed char *);
+@exdent vector signed __int128 vsx_xl_sext (signed long long, signed short *);
+@exdent vector signed __int128 vsx_xl_sext (signed long long, signed int *);
+@exdent vector signed __int128 vsx_xl_sext (signed long long, signed long long *);
+@exdent vector unsigned __int128 vsx_xl_zext (signed long long, unsigned char *);
+@exdent vector unsigned __int128 vsx_xl_zext (signed long long, unsigned short *);
+@exdent vector unsigned __int128 vsx_xl_zext (signed long long, unsigned int *);
+@exdent vector unsigned __int128 vsx_xl_zext (signed long long, unsigned long long *);
+@end smallexample
+
+Load (and sign extend) to an __int128 vector, as if implemented by the ISA 3.1
+@code{lxvrbx} @code{lxvrhx} @code{lxvrwx} @code{lxvrdx} instructions.
+@findex vsx_xl_sext
+@findex vsx_xl_zext
+
+@smallexample
+@exdent void vec_xst_trunc (vector signed __int128, signed long long, signed char *);
+@exdent void vec_xst_trunc (vector signed __int128, signed long long, signed short *);
+@exdent void vec_xst_trunc (vector signed __int128, signed long long, signed int *);
+@exdent void vec_xst_trunc (vector signed __int128, signed long long, signed long long *);
+@exdent void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned char *);
+@exdent void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned short *);
+@exdent void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned int *);
+@exdent void vec_xst_trunc (vector unsigned __int128, signed long long, unsigned long long *);
+@end smallexample
+
+Truncate and store the rightmost element of a vector, as if implemented by the
+ISA 3.1 @code{stxvrbx} @code{stxvrhx} @code{stxvrwx} @code{stxvrdx} instructions.
+@findex vec_xst_trunc
+
@node PowerPC AltiVec/VSX Built-in Functions
@subsection PowerPC AltiVec/VSX Built-in Functions
@@ -20961,9 +21021,9 @@ given by the third argument, using natural element order in the second
argument. The rest of the second argument is unchanged. If the byte
index is greater than 14 for halfwords, greater than 12 for words, or
greater than 8 for doublewords the result is undefined. For little-endian,
-the generated code will be semantically equivalent to @code{vins[bhw]rx}
+the generated code will be semantically equivalent to @code{vins[bhwd]rx}
instructions. Similarly for big-endian it will be semantically equivalent
-to @code{vins[bhw]lx}. Note that some fairly anomalous results can be
+to @code{vins[bhwd]lx}. Note that some fairly anomalous results can be
generated if the byte index is not aligned on an element boundary for the
type of element being inserted.
@findex vec_insertl
@@ -20996,8 +21056,8 @@ for halfwords, 12 for words, or 8 for doublewords, the intrinsic will be
rejected. Note that the underlying hardware instruction uses the same register
for the second argument and the result.
For little-endian, the code generation will be semantically equivalent to
-@code{vins[bhw]lx}, while for big-endian it will be semantically equivalent to
-@code{vins[bhw]rx}.
+@code{vins[bhwd]lx}, while for big-endian it will be semantically equivalent to
+@code{vins[bhwd]rx}.
Note that some fairly anomalous results can be generated if the byte index is
not aligned on an element boundary for the sort of element being inserted.
@findex vec_inserth
@@ -21584,10 +21644,10 @@ void amo_stdat_smin (int64_t *, int64_t);
ISA 3.1 of the PowerPC added new Matrix-Multiply Assist (MMA) instructions.
GCC provides support for these instructions through the following built-in
functions which are enabled with the @code{-mmma} option. The vec_t type
-below is defined to be a normal vector unsigned char type.  The uint2, uint4
+below is defined to be a normal vector unsigned char type. The uint2, uint4
and uint8 parameters are 2-bit, 4-bit and 8-bit unsigned integer constants
-respectively.  The compiler will verify that they are constants and that
-their values are within range. 
+respectively. The compiler will verify that they are constants and that
+their values are within range.
The built-in functions supported are:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8be2b4f..edea7ee 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -236,7 +236,8 @@ in the following sections.
-Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
-Wno-class-conversion -Wclass-memaccess @gol
-Wcomma-subscript -Wconditionally-supported @gol
--Wno-conversion-null -Wctor-dtor-privacy -Wno-delete-incomplete @gol
+-Wno-conversion-null -Wctad-maybe-unsupported @gol
+-Wctor-dtor-privacy -Wno-delete-incomplete @gol
-Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
-Weffc++ -Wextra-semi -Wno-inaccessible-base @gol
-Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
@@ -244,7 +245,7 @@ in the following sections.
-Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
-Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
-Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
--Wredundant-move -Wredundant-tags @gol
+-Wrange-loop-construct -Wredundant-move -Wredundant-tags @gol
-Wreorder -Wregister @gol
-Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
-Wno-non-template-friend -Wold-style-cast @gol
@@ -362,6 +363,7 @@ Objective-C and Objective-C++ Dialects}.
-Wno-shift-overflow -Wshift-overflow=@var{n} @gol
-Wsign-compare -Wsign-conversion @gol
-Wno-sizeof-array-argument @gol
+-Wsizeof-array-div @gol
-Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
-Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
-Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
@@ -392,6 +394,7 @@ Objective-C and Objective-C++ Dialects}.
-fanalyzer @gol
-fanalyzer-call-summaries @gol
-fanalyzer-checker=@var{name} @gol
+-fno-analyzer-feasibility @gol
-fanalyzer-fine-grained @gol
-fanalyzer-state-merge @gol
-fanalyzer-state-purge @gol
@@ -406,6 +409,7 @@ Objective-C and Objective-C++ Dialects}.
-fdump-analyzer-exploded-nodes @gol
-fdump-analyzer-exploded-nodes-2 @gol
-fdump-analyzer-exploded-nodes-3 @gol
+-fdump-analyzer-json @gol
-fdump-analyzer-state-purge @gol
-fdump-analyzer-supergraph @gol
-Wno-analyzer-double-fclose @gol
@@ -426,6 +430,8 @@ Objective-C and Objective-C++ Dialects}.
-Wno-analyzer-use-after-free @gol
-Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
-Wno-analyzer-use-of-uninitialized-value @gol
+-Wno-analyzer-write-to-const @gol
+-Wno-analyzer-write-to-string-literal @gol
}
@item C and Objective-C-only Warning Options
@@ -483,7 +489,7 @@ Objective-C and Objective-C++ Dialects}.
-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
-fif-conversion2 -findirect-inlining @gol
-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
--finline-small-functions -fipa-cp -fipa-cp-clone @gol
+-finline-small-functions -fipa-modref -fipa-cp -fipa-cp-clone @gol
-fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
-fipa-reference -fipa-reference-addressable @gol
-fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
@@ -1104,7 +1110,7 @@ Objective-C and Objective-C++ Dialects}.
-march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
@emph{Nvidia PTX Options}
-@gccoptlist{-m32 -m64 -mmainkernel -moptimize}
+@gccoptlist{-m64 -mmainkernel -moptimize}
@emph{OpenRISC Options}
@gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
@@ -1359,6 +1365,7 @@ See RS/6000 and PowerPC Options.
-mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
-mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
-mrdseed -msgx -mavx512vp2intersect -mserialize -mtsxldtrk@gol
+-mamx-tile -mamx-int8 -mamx-bf16 -muintr -mhreset@gol
-mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
@@ -3304,6 +3311,25 @@ void f(int *a, int b, int c) @{
Enabled by default with @option{-std=c++20}.
+@item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
+@opindex Wctad-maybe-unsupported
+@opindex Wno-ctad-maybe-unsupported
+Warn when performing class template argument deduction (CTAD) on a type with
+no explicitly written deduction guides. This warning will point out cases
+where CTAD succeeded only because the compiler synthesized the implicit
+deduction guides, which might not be what the programmer intended. Certain
+style guides allow CTAD only on types that specifically "opt-in"; i.e., on
+types that are designed to support CTAD. This warning can be suppressed with
+the following pattern:
+
+@smallexample
+struct allow_ctad_t; // any name works
+template <typename T> struct S @{
+ S(T) @{ @}
+@};
+S(allow_ctad_t) -> S<void>; // guide with incomplete parameter type will never be considered
+@end smallexample
+
@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
@opindex Wctor-dtor-privacy
@opindex Wno-ctor-dtor-privacy
@@ -3582,6 +3608,24 @@ treats the return value as if it were designated by an rvalue.
This warning is enabled by @option{-Wextra}.
+@item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
+@opindex Wrange-loop-construct
+@opindex Wno-range-loop-construct
+This warning warns when a C++ range-based for-loop is creating an unnecessary
+copy. This can happen when the range declaration is not a reference, but
+probably should be. For example:
+
+@smallexample
+struct S @{ char arr[128]; @};
+void fn () @{
+ S arr[5];
+ for (const auto x : arr) @{ @dots{} @}
+@}
+@end smallexample
+
+It does not warn when the type being copied is a trivially-copyable type whose
+size is less than 64 bytes. This warning is enabled by @option{-Wall}.
+
@item -Wredundant-tags @r{(C++ and Objective-C++ only)}
@opindex Wredundant-tags
@opindex Wno-redundant-tags
@@ -4304,7 +4348,8 @@ options:
@gccoptlist{-fno-diagnostics-show-caret @gol
-fno-diagnostics-show-line-numbers @gol
-fdiagnostics-color=never @gol
--fdiagnostics-urls=never}
+-fdiagnostics-urls=never @gol
+-fdiagnostics-path-format=separate-events}
In the future, if GCC changes the default appearance of its diagnostics, the
corresponding option to disable the new behavior will be added to this list.
@@ -5251,11 +5296,13 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wparentheses @gol
-Wpessimizing-move @r{(only for C++)} @gol
-Wpointer-sign @gol
+-Wrange-loop-construct @r{(only for C++)} @gol
-Wreorder @gol
-Wrestrict @gol
-Wreturn-type @gol
-Wsequence-point @gol
-Wsign-compare @r{(only in C++)} @gol
+-Wsizeof-array-div @gol
-Wsizeof-pointer-div @gol
-Wsizeof-pointer-memaccess @gol
-Wstrict-aliasing @gol
@@ -8010,6 +8057,23 @@ real to lower precision real values. This option is also enabled by
@opindex Wscalar-storage-order
Do not warn on suspicious constructs involving reverse scalar storage order.
+@item -Wsizeof-array-div
+@opindex Wsizeof-array-div
+@opindex Wno-sizeof-array-div
+Warn about divisions of two sizeof operators when the first one is applied
+to an array and the divisor does not equal the size of the array element.
+In such a case, the computation will not yield the number of elements in the
+array, which is likely what the user intended. This warning warns e.g. about
+@smallexample
+int fn ()
+@{
+ int arr[10];
+ return sizeof (arr) / sizeof (short);
+@}
+@end smallexample
+
+This warning is enabled by @option{-Wall}.
+
@item -Wsizeof-pointer-div
@opindex Wsizeof-pointer-div
@opindex Wno-sizeof-pointer-div
@@ -8758,6 +8822,8 @@ Enabling this option effectively enables the following warnings:
-Wanalyzer-unsafe-call-within-signal-handler @gol
-Wanalyzer-use-after-free @gol
-Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
+-Wanalyzer-write-to-const @gol
+-Wanalyzer-write-to-string-literal @gol
}
This option is only available if GCC was configured with analyzer
@@ -8940,6 +9006,30 @@ to disable it.
This diagnostic warns for paths through the code in which a pointer
is dereferenced that points to a variable in a stale stack frame.
+@item -Wno-analyzer-write-to-const
+@opindex Wanalyzer-write-to-const
+@opindex Wno-analyzer-write-to-const
+This warning requires @option{-fanalyzer}, which enables it; use
+@option{-Wno-analyzer-write-to-const}
+to disable it.
+
+This diagnostic warns for paths through the code in which the analyzer
+detects an attempt to write through a pointer to a @code{const} object.
+However, the analyzer does not prioritize detection of such paths, so
+false negatives are more likely relative to other warnings.
+
+@item -Wno-analyzer-write-to-string-literal
+@opindex Wanalyzer-write-to-string-literal
+@opindex Wno-analyzer-write-to-string-literal
+This warning requires @option{-fanalyzer}, which enables it; use
+@option{-Wno-analyzer-write-to-string-literal}
+to disable it.
+
+This diagnostic warns for paths through the code in which the analyzer
+detects an attempt to write through a pointer to a string literal.
+However, the analyzer does not prioritize detection of such paths, so
+false negatives are more likely relative to other warnings.
+
@end table
Pertinent parameters for controlling the exploration are:
@@ -8972,6 +9062,17 @@ such as the @code{taint} checker that implements
@option{-Wanalyzer-tainted-array-index}, and this option is required
to enable them.
+@item -fno-analyzer-feasibility
+@opindex fanalyzer-feasibility
+@opindex fno-analyzer-feasibility
+This option is intended for analyzer developers.
+
+By default the analyzer verifies that there is a feasible control flow path
+for each diagnostic it emits: that the conditions that hold are not mutually
+exclusive. Diagnostics for which no feasible path can be found are rejected.
+This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
+debugging issues in this code.
+
@item -fanalyzer-fine-grained
@opindex fanalyzer-fine-grained
@opindex fno-analyzer-fine-grained
@@ -9103,6 +9204,12 @@ Dump a textual representation of the ``exploded graph'' to
one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
This is typically a large number of dump files.
+@item -fdump-analyzer-json
+@opindex fdump-analyzer-json
+Dump a compressed JSON representation of analyzer internals to
+@file{@var{file}.analyzer.json.gz}. The precise format is subject
+to change.
+
@item -fdump-analyzer-state-purge
@opindex fdump-analyzer-state-purge
As per @option{-fdump-analyzer-supergraph}, dump a representation of the
@@ -9649,6 +9756,7 @@ compilation time.
-fif-conversion @gol
-fif-conversion2 @gol
-finline-functions-called-once @gol
+-fipa-modref @gol
-fipa-profile @gol
-fipa-pure-const @gol
-fipa-reference @gol
@@ -10744,11 +10852,18 @@ default at any optimization level.
@opindex fipa-profile
Perform interprocedural profile propagation. The functions called only from
cold functions are marked as cold. Also functions executed once (such as
-@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
-functions and loop less parts of functions executed once are then optimized for
-size.
+@code{cold}, @code{noreturn}, static constructors or destructors) are
+identified. Cold functions and loop less parts of functions executed once are
+then optimized for size.
Enabled by default at @option{-O} and higher.
+@item -fipa-modref
+@opindex fipa-modref
+Perform interprocedural mod/ref analysis. This optimization analyzes the side
+effects of functions (memory locations that are modified or referenced) and
+enables better optimization across the function call boundary. This flag is
+enabled by default at @option{-O} and higher.
+
@item -fipa-cp
@opindex fipa-cp
Perform interprocedural constant propagation.
@@ -10832,7 +10947,7 @@ callers are impacted, therefore need to be patched as well.
@gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
-fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
-fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
--fipa-stack-alignment}
+-fipa-stack-alignment -fipa-modref}
@item inline-only-static
@@ -11554,7 +11669,18 @@ Do not remove unused C++ allocations in dead code elimination.
@item -fallow-store-data-races
@opindex fallow-store-data-races
-Allow the compiler to introduce new data races on stores.
+Allow the compiler to perform optimizations that may introduce new data races
+on stores, without proving that the variable cannot be concurrently accessed
+by other threads. Does not affect optimization of local data. It is safe to
+use this option if it is known that global data will not be accessed by
+multiple threads.
+
+Examples of optimizations enabled by @option{-fallow-store-data-races} include
+hoisting or if-conversions that may cause a value that was already in memory
+to be re-written with that same value. Such re-writing is safe in a single
+threaded context but may be unsafe in a multi-threaded context. Note that on
+some processors, if-conversions may be required in order to enable
+vectorization.
Enabled at level @option{-Ofast}.
@@ -11667,7 +11793,7 @@ to more aggressive optimization decisions.
When a file is compiled with @option{-flto} without
@option{-fuse-linker-plugin}, the generated object file is larger than
a regular object file because it contains GIMPLE bytecodes and the usual
-final code (see @option{-ffat-lto-objects}. This means that
+final code (see @option{-ffat-lto-objects}). This means that
object files with LTO information can be linked as normal object
files; if @option{-fno-lto} is passed to the linker, no
interprocedural optimizations are applied. Note that when
@@ -12725,6 +12851,18 @@ Deeper chains are still handled by late inlining.
Probability (in percent) that C++ inline function with comdat visibility
are shared across multiple compilation units.
+@item ipa-modref-max-bases
+@item ipa-modref-max-refs
+@item ipa-modref-max-accesses
+Specifies the maximal number of base pointers, referneces and accesses stored
+for a single function by mod/ref analysis.
+
+@item ipa-modref-max-tests
+Specifies the maxmal number of tests alias oracle can perform to disambiguate
+memory locations using the mod/ref information. This parameter ought to be
+bigger than @option{--param ipa-modref-max-bases} and @option{--param
+ipa-modref-max-refs}.
+
@item profile-func-internal-id
A parameter to control whether to use function internal id in profile
database lookup. If the value is 0, the compiler uses an id that
@@ -13337,6 +13475,9 @@ loop in the loop nest by a given number of iterations. The strip
length can be changed using the @option{loop-block-tile-size}
parameter.
+@item ipa-jump-function-lookups
+Specifies number of statements visited during jump function offset discovery.
+
@item ipa-cp-value-list-size
IPA-CP attempts to track all possible values and types passed to a function's
parameter in order to propagate them and perform devirtualization.
@@ -13374,6 +13515,10 @@ of iterations of a loop known, it adds a bonus of
@option{ipa-cp-loop-hint-bonus} to the profitability score of
the candidate.
+@item ipa-max-loop-predicates
+The maximum number of different predicates IPA will use to describe when
+loops in a function have known properties.
+
@item ipa-max-aa-steps
During its analysis of function bodies, IPA-CP employs alias analysis
in order to track values pointed to by function parameters. In order
@@ -17473,8 +17618,10 @@ performance of the code. Permissible values for this option are:
@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
@samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
+@samp{cortex-a78}, @samp{cortex-a78ae},
@samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
-@samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
+@samp{neoverse-e1}, @samp{neoverse-n1}, @samp{neoverse-n2},
+@samp{neoverse-v1}, @samp{qdf24xx}, @samp{saphira},
@samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
@samp{octeontx81}, @samp{octeontx83},
@samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
@@ -17487,7 +17634,7 @@ performance of the code. Permissible values for this option are:
@samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
@samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
-@samp{cortex-r82}, @samp{native}.
+@samp{cortex-r82}, @samp{cortex-x1}, @samp{native}.
The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
@samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
@@ -19314,16 +19461,17 @@ Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
@samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
@samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
@samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
+@samp{cortex-a78}, @samp{cortex-a78ae},
@samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
@samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
@samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
@samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
-@samp{cortex-m35p}, @samp{cortex-m55},
+@samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-x1},
@samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
@samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
-@samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
-@samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
-@samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
+@samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
+@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
+@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
Additionally, this option can specify that GCC should tune the performance
of the code for a big.LITTLE system. Permissible names are:
@@ -25485,17 +25633,16 @@ These options are defined for Nvidia PTX:
@table @gcctabopt
-@item -m32
-@itemx -m64
-@opindex m32
+@item -m64
@opindex m64
-Generate code for 32-bit or 64-bit ABI.
+Ignored, but preserved for backward compatibility. Only 64-bit ABI is
+supported.
@item -misa=@var{ISA-string}
@opindex march
Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
strings must be lower-case. Valid ISA strings include @samp{sm_30} and
-@samp{sm_35}. The default ISA is sm_30.
+@samp{sm_35}. The default ISA is sm_35.
@item -mmainkernel
@opindex mmainkernel
@@ -25872,14 +26019,30 @@ Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
@samp{rv32imaf}.
+When @option{-march=} is not specified, use the setting from @option{-mcpu}.
+
+If both @option{-march} and @option{-mcpu=} are not specified, the default for
+this argument is system dependent, users who want a specific architecture
+extensions should specify one explicitly.
+
+@item -mcpu=@var{processor-string}
+@opindex mcpu
+Use architecture of and optimize the output for the given processor, specified
+by particular CPU name.
+Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
+@samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
+@samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
+@samp{sifive-u54}, and @samp{sifive-u74}.
+
@item -mtune=@var{processor-string}
@opindex mtune
-Optimize the output for the given processor, specified by microarchitecture
-name. Permissible values for this option are: @samp{rocket},
+Optimize the output for the given processor, specified by microarchitecture or
+particular CPU name. Permissible values for this option are: @samp{rocket},
@samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
-and @samp{size}.
+@samp{size}, and all valid options for @option{-mcpu=}.
-When @option{-mtune=} is not specified, the default is @samp{rocket}.
+When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
+the default is @samp{rocket} if both are not specified.
The @samp{size} choice is not intended for use by end-users. This is used
when @option{-Os} is specified. It overrides the instruction cost info
@@ -27612,7 +27775,7 @@ system representing a certain processor type. Possible values for
@var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
@samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
@samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
-@samp{z14}/@samp{arch12}, and @samp{native}.
+@samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13}, and @samp{native}.
The default is @option{-march=z900}.
@@ -29162,7 +29325,7 @@ Generate instructions for the machine type @var{cpu-type}. In contrast to
for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
to generate code that may not run at all on processors other than the one
indicated. Specifying @option{-march=@var{cpu-type}} implies
-@option{-mtune=@var{cpu-type}}.
+@option{-mtune=@var{cpu-type}}, except where noted otherwise.
The choices for @var{cpu-type} are:
@@ -29178,6 +29341,19 @@ of the selected instruction set.
@item x86-64
A generic CPU with 64-bit extensions.
+@item x86-64-v2
+@itemx x86-64-v3
+@itemx x86-64-v4
+These choices for @var{cpu-type} select the corresponding
+micro-architecture level from the x86-64 psABI. They are only available
+when compiling for an x86-64 target that uses the System V psABI@.
+
+Since these @var{cpu-type} values do not have a corresponding
+@option{-mtune} setting, using @option{-march} with these values enables
+generic tuning. Specific tuning can be enabled using the
+@option{-mtune=@var{other-cpu-type}} option with an appropriate
+@var{other-cpu-type} value.
+
@item i386
Original Intel i386 CPU@.
@@ -30117,6 +30293,8 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@need 200
@itemx -menqcmd
@opindex menqcmd
+@itemx -muintr
+@opindex muintr
@need 200
@itemx -mtsxldtrk
@opindex mtsxldtrk
@@ -30141,6 +30319,18 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@need 200
@itemx -mserialize
@opindex mserialize
+@need 200
+@itemx -mamx-tile
+@opindex mamx-tile
+@need 200
+@itemx -mamx-int8
+@opindex mamx-int8
+@need 200
+@itemx -mamx-bf16
+@opindex mamx-bf16
+@need 200
+@itemx -mhreset
+@opindex mhreset
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,
@@ -30149,8 +30339,8 @@ WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
-ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE
-or CLDEMOTE extended instruction sets. Each has a corresponding
+ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
+UINTR, HRESET 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
@@ -31514,6 +31704,19 @@ crt0%O%s %:if-exists(crti%O%s) \
%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
@end smallexample
+@item @code{if-exists-then-else}
+The @code{if-exists-then-else} spec function takes at least two arguments
+and an optional third one. The first argument is an absolute pathname to a
+file. If the file exists, the function returns the second argument.
+If the file does not exist, the function returns the third argument if there
+is one, or NULL otherwise. This can be used to expand one text, or optionally
+another, based on the existence of a file. Here is a small example of its
+usage:
+
+@smallexample
+-l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
+@end smallexample
+
@item @code{replace-outfile}
The @code{replace-outfile} spec function takes two arguments. It looks for the
first argument in the outfiles array and replaces it with the second argument. Here
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 65b2e55..49316a5 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1527,6 +1527,9 @@ optabs on vectors.
Target supports fully-masked (also known as fully-predicated) loops,
so that vector loops can handle partial as well as full vectors.
+@item vect_masked_load
+Target supports vector masked loads.
+
@item vect_masked_store
Target supports vector masked stores.
@@ -2249,6 +2252,15 @@ Target supports the execution of @code{avx512f} instructions.
@item avx512vp2intersect
Target supports the execution of @code{avx512vp2intersect} instructions.
+@item amx_tile
+Target supports the execution of @code{amx-tile} instructions.
+
+@item amx_int8
+Target supports the execution of @code{amx-int8} instructions.
+
+@item amx_bf16
+Target supports the execution of @code{amx-bf16} instructions.
+
@item cell_hw
Test system can execute AltiVec and Cell PPU instructions.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 8e9e770..97437e8 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5602,9 +5602,12 @@ refers to the global ``variable'' @code{errno}. (On certain systems,
macro, a reasonable default is used.
@end defmac
-@deftypefn {Target Hook} bool TARGET_LIBC_HAS_FUNCTION (enum function_class @var{fn_class})
+@deftypefn {Target Hook} bool TARGET_LIBC_HAS_FUNCTION (enum function_class @var{fn_class}, tree @var{type})
This hook determines whether a function from a class of functions
-@var{fn_class} is present in the target C library.
+@var{fn_class} is present in the target C library. If @var{type} is NULL,
+the caller asks for support for all standard (float, double, long double)
+types. If @var{type} is non-NULL, the caller asks for support for a
+specific type.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_LIBC_HAS_FAST_FUNCTION (int @var{fcode})
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4096c0c0..534877b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3347,6 +3347,8 @@ output_asm_line_debug_info (void)
|| !debug_variable_location_views));
}
+static bool asm_outputs_debug_line_str (void);
+
/* Minimum line offset in a special line info. opcode.
This value was chosen to give a reasonable range of values. */
#define DWARF_LINE_BASE -10
@@ -4731,6 +4733,35 @@ reset_indirect_string (indirect_string_node **h, void *)
return 1;
}
+/* Add a string representing a file or filepath attribute value to a DIE. */
+
+static inline void
+add_filepath_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind,
+ const char *str)
+{
+ if (! asm_outputs_debug_line_str ())
+ add_AT_string (die, attr_kind, str);
+ else
+ {
+ dw_attr_node attr;
+ struct indirect_string_node *node;
+
+ if (!debug_line_str_hash)
+ debug_line_str_hash
+ = hash_table<indirect_string_hasher>::create_ggc (10);
+
+ node = find_AT_string_in_table (str, debug_line_str_hash);
+ set_indirect_string (node);
+ node->form = DW_FORM_line_strp;
+
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_str;
+ attr.dw_attr_val.val_entry = NULL;
+ attr.dw_attr_val.v.val_str = node;
+ add_dwarf_attr (die, &attr);
+ }
+}
+
/* Find out whether a string should be output inline in DIE
or out-of-line in .debug_str section. */
@@ -11839,6 +11870,29 @@ output_ranges (void)
for -gsplit-dwarf we should use DW_FORM_strx instead. */ \
&& !dwarf_split_debug_info)
+
+/* Returns TRUE if we are outputting DWARF5 and the assembler supports
+ DWARF5 .debug_line tables using .debug_line_str or we generate
+ it ourselves, except for split-dwarf which doesn't have a
+ .debug_line_str. */
+static bool
+asm_outputs_debug_line_str (void)
+{
+ if (dwarf_version >= 5
+ && ! output_asm_line_debug_info ()
+ && DWARF5_USE_DEBUG_LINE_STR)
+ return true;
+ else
+ {
+#if defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) && defined(HAVE_AS_WORKING_DWARF_N_FLAG)
+ return !dwarf_split_debug_info && dwarf_version >= 5;
+#else
+ return false;
+#endif
+ }
+}
+
+
/* Assign .debug_rnglists indexes. */
static void
@@ -20514,6 +20568,15 @@ add_name_attribute (dw_die_ref die, const char *name_string)
}
}
+/* Generate a DW_AT_name attribute given some string value representing a
+ file or filepath to be included as value of the attribute. */
+static void
+add_filename_attribute (dw_die_ref die, const char *name_string)
+{
+ if (name_string != NULL && *name_string != 0)
+ add_filepath_AT_string (die, DW_AT_name, name_string);
+}
+
/* Generate a DW_AT_description attribute given some string value to be included
as the value of the attribute. */
@@ -20640,7 +20703,7 @@ add_comp_dir_attribute (dw_die_ref die)
{
const char * wd = comp_dir_string ();
if (wd != NULL)
- add_AT_string (die, DW_AT_comp_dir, wd);
+ add_filepath_AT_string (die, DW_AT_comp_dir, wd);
}
/* Given a tree node VALUE describing a scalar attribute ATTR (i.e. a bound, a
@@ -24482,7 +24545,7 @@ gen_compile_unit_die (const char *filename)
if (filename)
{
- add_name_attribute (die, filename);
+ add_filename_attribute (die, filename);
/* Don't add cwd for <built-in>. */
if (filename[0] != '<')
add_comp_dir_attribute (die);
@@ -28733,7 +28796,8 @@ init_sections_and_labels (bool early_lto_debug)
SECTION_DEBUG, NULL);
debug_str_section = get_section (DEBUG_STR_SECTION,
DEBUG_STR_SECTION_FLAGS, NULL);
- if (!dwarf_split_debug_info && !output_asm_line_debug_info ())
+ if ((!dwarf_split_debug_info && !output_asm_line_debug_info ())
+ || asm_outputs_debug_line_str ())
debug_line_str_section = get_section (DEBUG_LINE_STR_SECTION,
DEBUG_STR_SECTION_FLAGS, NULL);
@@ -31704,6 +31768,27 @@ dwarf2out_finish (const char *filename)
ASM_OUTPUT_LABEL (asm_out_file, debug_line_section_label);
if (! output_asm_line_debug_info ())
output_line_info (false);
+ else if (asm_outputs_debug_line_str ())
+ {
+ /* When gas outputs DWARF5 .debug_line[_str] then we have to
+ tell it the comp_dir and main file name for the zero entry
+ line table. */
+ const char *comp_dir, *filename0;
+
+ comp_dir = comp_dir_string ();
+ if (comp_dir == NULL)
+ comp_dir = "";
+
+ filename0 = get_AT_string (comp_unit_die (), DW_AT_name);
+ if (filename0 == NULL)
+ filename0 = "";
+
+ fprintf (asm_out_file, "\t.file 0 ");
+ output_quoted_string (asm_out_file, remap_debug_filename (comp_dir));
+ fputc (' ', asm_out_file);
+ output_quoted_string (asm_out_file, remap_debug_filename (filename0));
+ fputc ('\n', asm_out_file);
+ }
if (dwarf_split_debug_info && info_section_emitted)
{
@@ -32020,37 +32105,9 @@ dwarf2out_early_finish (const char *filename)
/* Add the name for the main input file now. We delayed this from
dwarf2out_init to avoid complications with PCH. */
- add_name_attribute (comp_unit_die (), remap_debug_filename (filename));
+ add_filename_attribute (comp_unit_die (), remap_debug_filename (filename));
add_comp_dir_attribute (comp_unit_die ());
- /* When emitting DWARF5 .debug_line_str, move DW_AT_name and
- DW_AT_comp_dir into .debug_line_str section. */
- if (!output_asm_line_debug_info ()
- && dwarf_version >= 5
- && DWARF5_USE_DEBUG_LINE_STR)
- {
- for (int i = 0; i < 2; i++)
- {
- dw_attr_node *a = get_AT (comp_unit_die (),
- i ? DW_AT_comp_dir : DW_AT_name);
- if (a == NULL
- || AT_class (a) != dw_val_class_str
- || strlen (AT_string (a)) + 1 <= DWARF_OFFSET_SIZE)
- continue;
-
- if (! debug_line_str_hash)
- debug_line_str_hash
- = hash_table<indirect_string_hasher>::create_ggc (10);
-
- struct indirect_string_node *node
- = find_AT_string_in_table (AT_string (a), debug_line_str_hash);
- set_indirect_string (node);
- node->form = DW_FORM_line_strp;
- a->dw_attr_val.v.val_str->refcount--;
- a->dw_attr_val.v.val_str = node;
- }
- }
-
/* With LTO early dwarf was really finished at compile-time, so make
sure to adjust the phase after annotating the LTRANS CU DIE. */
if (in_lto_p)
diff --git a/gcc/expr.c b/gcc/expr.c
index 1a15f24..9d951e8 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5168,6 +5168,8 @@ expand_assignment (tree to, tree from, bool nontemporal)
rtx reg, mem;
reg = expand_expr (from, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+ /* Handle PARALLEL. */
+ reg = maybe_emit_group_store (reg, TREE_TYPE (from));
reg = force_not_mem (reg);
mem = expand_expr (to, NULL_RTX, VOIDmode, EXPAND_WRITE);
if (TREE_CODE (to) == MEM_REF && REF_REVERSE_STORAGE_ORDER (to))
@@ -6922,7 +6924,7 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size,
insn_code icode = CODE_FOR_nothing;
tree elt;
tree elttype = TREE_TYPE (type);
- int elt_size = tree_to_uhwi (TYPE_SIZE (elttype));
+ int elt_size = vector_element_bits (type);
machine_mode eltmode = TYPE_MODE (elttype);
HOST_WIDE_INT bitsize;
HOST_WIDE_INT bitpos;
@@ -6987,6 +6989,15 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size,
}
}
+ /* Compute the size of the elements in the CTOR. It differs
+ from the size of the vector type elements only when the
+ CTOR elements are vectors themselves. */
+ tree val_type = TREE_TYPE (CONSTRUCTOR_ELT (exp, 0)->value);
+ if (VECTOR_TYPE_P (val_type))
+ bitsize = tree_to_uhwi (TYPE_SIZE (val_type));
+ else
+ bitsize = elt_size;
+
/* If the constructor has fewer elements than the vector,
clear the whole array first. Similarly if this is static
constructor of a non-BLKmode object. */
@@ -7001,11 +7012,7 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size,
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value)
{
- tree sz = TYPE_SIZE (TREE_TYPE (value));
- int n_elts_here
- = tree_to_uhwi (int_const_binop (TRUNC_DIV_EXPR, sz,
- TYPE_SIZE (elttype)));
-
+ int n_elts_here = bitsize / elt_size;
count += n_elts_here;
if (mostly_zeros_p (value))
zero_count += n_elts_here;
@@ -7045,7 +7052,6 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size,
HOST_WIDE_INT eltpos;
tree value = ce->value;
- bitsize = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (value)));
if (cleared && initializer_zerop (value))
continue;
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index d0659c6..e8ce051 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -383,4 +383,17 @@ enum parloops_schedule_type
PARLOOPS_SCHEDULE_RUNTIME
};
+/* EVRP mode. */
+enum evrp_mode
+{
+ EVRP_MODE_EVRP_FIRST = 0,
+ EVRP_MODE_EVRP_ONLY = 1,
+ EVRP_MODE_RVRP_ONLY = 2,
+ EVRP_MODE_RVRP_FIRST = 3,
+ EVRP_MODE_TRACE = 4,
+ EVRP_MODE_DEBUG = 8 | EVRP_MODE_TRACE,
+ EVRP_MODE_RVRP_TRACE = EVRP_MODE_RVRP_ONLY | EVRP_MODE_TRACE,
+ EVRP_MODE_RVRP_DEBUG = EVRP_MODE_RVRP_ONLY | EVRP_MODE_DEBUG
+};
+
#endif /* ! GCC_FLAG_TYPES_H */
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 0cc80ad..ebd32bb 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -15489,6 +15489,8 @@ ptr_difference_const (tree e1, tree e2, poly_int64_pod *diff)
tree
convert_to_ptrofftype_loc (location_t loc, tree off)
{
+ if (ptrofftype_p (TREE_TYPE (off)))
+ return off;
return fold_convert_loc (loc, sizetype, off);
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 3c8701e..0dd7931 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,179 @@
+2020-10-22 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.h (enum gfc_omp_memorder): Add.
+ (gfc_omp_clauses): Use it.
+ * openmp.c (gfc_match_omp_flush): Match memorder clauses.
+ * trans-openmp.c (gfc_trans_omp_flush): Handle them.
+ (gfc_trans_omp_directive): Update call.
+
+2020-10-21 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/45516
+ * class.c: Add _deallocate to the vtable documentation
+ comment.
+
+2020-10-16 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/95979
+ * expr.c (gfc_check_init_expr): Fix check of return code from
+ gfc_intrinsic_func_interface.
+ * intrinsic.c (gfc_intrinsic_func_interface): Add further attempt
+ of simplification of elemental intrinsics with array arguments.
+ * iresolve.c (gfc_resolve_index_func): Keep optional KIND argument
+ for simplification of elemental use of INDEX.
+
+2020-10-15 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ * trans-decl.c (gfc_build_builtin_function_decls): Fix the coarray fndecls.
+
+2020-10-14 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97390
+ * scanner.c (load_line): Fix line-truncation warning for !$acc
+ and !gcc$ in free-form source code.
+
+2020-10-14 Steven G. Kargl <kargl@gcc.gnu.org>
+ Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/95614
+ * decl.c (gfc_get_common): Use gfc_match_common_name instead
+ of match_common_name.
+ * decl.c (gfc_bind_idents): Use gfc_match_common_name instead
+ of match_common_name.
+ * match.c : Rename match_common_name to gfc_match_common_name.
+ * match.c (gfc_match_common): Use gfc_match_common_name instead
+ of match_common_name.
+ * match.h : Rename match_common_name to gfc_match_common_name.
+ * resolve.c (resolve_common_vars): Check each symbol in a
+ common block has a global symbol. If there is a global symbol
+ issue an error if the symbol type is a module or a program.
+
+2020-10-12 Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/96099
+ * decl.c (gfc_match_implicit): Check for numeric and logical
+ types.
+
+2020-10-07 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/47469
+ * trans-expr.c (arrayfunc_assign_needs_temporary): Tidy detection
+ of pointer and allocatable functions.
+
+2020-10-04 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/97272
+ * trans-intrinsic.c (strip_kind_from_actual): Helper function for
+ removal of KIND argument.
+ (gfc_conv_intrinsic_minmaxloc): Ignore KIND argument here, as it
+ is treated elsewhere.
+
+2020-10-02 Jan Hubicka <hubicka@ucw.cz>
+
+ * trans-decl.c (gfc_build_library_function_decl_with_spec): Verify
+ fnspec.
+ (gfc_build_intrinsic_function_decls): Update fnspecs.
+ (gfc_build_builtin_function_decls): Update fnspecs.
+ * trans-io.c (gfc_build_io_library_fndecls): Update fnspecs.
+ * trans-types.c (create_fn_spec): Update fnspecs.
+
+2020-09-30 Jan Hubicka <jh@suse.cz>
+
+ * trans-decl.c (gfc_build_intrinsic_function_decls): Add traling dots
+ to spec strings so they match the number of parameters; do not use
+ R and W for non-pointer parameters. Drop pointless specifier on
+ caf_stop_numeric and caf_get_team.
+
+2020-09-30 Jan Hubicka <hubicka@ucw.cz>
+
+ * trans-io.c (gfc_build_io_library_fndecls): Add trailing dots so
+ length of spec string matches number of arguments.
+
+2020-09-30 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97242
+ * expr.c (gfc_is_not_contiguous): Fix check.
+ (gfc_check_pointer_assign): Use it.
+
+2020-09-30 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/97045
+ * trans-array.c (gfc_conv_array_ref): Make sure that the class
+ decl is passed to build_array_ref in the case of unlimited
+ polymorphic entities.
+ * trans-expr.c (gfc_conv_derived_to_class): Ensure that array
+ refs do not preceed the _len component. Free the _len expr.
+ * trans-stmt.c (trans_associate_var): Reset 'need_len_assign'
+ for polymorphic scalars.
+ * trans.c (gfc_build_array_ref): When the vptr size is used for
+ span, multiply by the _len field of unlimited polymorphic
+ entities, when non-zero.
+
+2020-09-30 Tom de Vries <tdevries@suse.de>
+
+ * f95-lang.c (gfc_init_builtin_functions): Update
+ targetm.libc_has_function call.
+
+2020-09-28 Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ Revert:
+ 2020-09-27 Steven G. Kargl <kargl@gcc.gnu.org>
+ Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/95614
+ * decl.c (gfc_get_common): Use gfc_match_common_name instead
+ of match_common_name.
+ * decl.c (gfc_bind_idents): Use gfc_match_common_name instead
+ of match_common_name.
+ * match.c : Rename match_common_name to gfc_match_common_name.
+ * match.c (gfc_match_common): Use gfc_match_common_name instead
+ of match_common_name.
+ * match.h : Rename match_common_name to gfc_match_common_name.
+ * resolve.c (resolve_common_vars): Check each symbol in a
+ common block has a global symbol. If there is a global symbol
+ issue an error if the symbol type is known as is not a common
+ block name.
+
+2020-09-27 Steven G. Kargl <kargl@gcc.gnu.org>
+ Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/95614
+ * decl.c (gfc_get_common): Use gfc_match_common_name instead
+ of match_common_name.
+ * decl.c (gfc_bind_idents): Use gfc_match_common_name instead
+ of match_common_name.
+ * match.c : Rename match_common_name to gfc_match_common_name.
+ * match.c (gfc_match_common): Use gfc_match_common_name instead
+ of match_common_name.
+ * match.h : Rename match_common_name to gfc_match_common_name.
+ * resolve.c (resolve_common_vars): Check each symbol in a
+ common block has a global symbol. If there is a global symbol
+ issue an error if the symbol type is known as is not a common
+ block name.
+
+2020-09-24 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/96495
+ * trans-expr.c (gfc_conv_procedure_call): Take the deallocation
+ of allocatable result components of a scalar result outside the
+ scalarization loop. Find and use the stored result.
+
+2020-09-21 Harald Anlauf <anlauf@gmx.de>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ * iresolve.c (gfc_resolve_mvbits): Remove unneeded conversion of
+ FROMPOS, LEN and TOPOS arguments to fit a C int.
+ * trans-intrinsic.c (gfc_conv_intrinsic_mvbits): Add inline
+ expansion of MVBITS intrinsic elemental subroutine and add code
+ for runtime argument checking.
+ (gfc_conv_intrinsic_subroutine): Recognise MVBITS intrinsic, but
+ defer handling to gfc_trans_call.
+ * trans-stmt.c (replace_ss):
+ (gfc_trans_call): Adjust to handle inline expansion, scalarization
+ of intrinsic subroutine MVBITS in gfc_conv_intrinsic_mvbits.
+ * trans.h (gfc_conv_intrinsic_mvbits): Add prototype for
+ gfc_conv_intrinsic_mvbits.
+
2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
* interface.c (gfc_compare_actual_formal): Add assertion after
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index dfa4840..5677d92 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -49,6 +49,8 @@ along with GCC; see the file COPYING3. If not see
* _copy: A procedure pointer to a copying procedure.
* _final: A procedure pointer to a wrapper function, which frees
allocatable components and calls FINAL subroutines.
+ * _deallocate: A procedure pointer to a deallocation procedure; nonnull
+ only for a recursive derived type.
After these follow procedure pointer components for the specific
type-bound procedures. */
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 326e6f5..6df3206 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4835,7 +4835,7 @@ gfc_match_implicit (void)
/* Last chance -- check <TYPE> <SELECTOR> (<RANGE>). */
if (ts.type == BT_CHARACTER)
m = gfc_match_char_spec (&ts);
- else if (ts.type != BT_DERIVED)
+ else if (gfc_numeric_ts(&ts) || ts.type == BT_LOGICAL)
{
m = gfc_match_kind_spec (&ts, false);
if (m == MATCH_NO)
@@ -6007,7 +6007,7 @@ get_bind_c_idents (void)
found_id = MATCH_YES;
gfc_get_ha_symbol (name, &tmp_sym);
}
- else if (match_common_name (name) == MATCH_YES)
+ else if (gfc_match_common_name (name) == MATCH_YES)
{
found_id = MATCH_YES;
com_block = gfc_get_common (name, 0);
@@ -6052,7 +6052,7 @@ get_bind_c_idents (void)
found_id = MATCH_YES;
gfc_get_ha_symbol (name, &tmp_sym);
}
- else if (match_common_name (name) == MATCH_YES)
+ else if (gfc_match_common_name (name) == MATCH_YES)
{
found_id = MATCH_YES;
com_block = gfc_get_common (name, 0);
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 68784a2..32d905a 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2904,7 +2904,7 @@ gfc_check_init_expr (gfc_expr *e)
&& (e->value.function.isym->conversion == 1);
if (!conversion && (!gfc_is_intrinsic (sym, 0, e->where)
- || (m = gfc_intrinsic_func_interface (e, 0)) != MATCH_YES))
+ || (m = gfc_intrinsic_func_interface (e, 0)) == MATCH_NO))
{
gfc_error ("Function %qs in initialization expression at %L "
"must be an intrinsic function",
@@ -4366,10 +4366,18 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue,
contiguous. */
if (lhs_attr.contiguous
- && lhs_attr.dimension > 0
- && !gfc_is_simply_contiguous (rvalue, false, true))
- gfc_warning (OPT_Wextra, "Assignment to contiguous pointer from "
- "non-contiguous target at %L", &rvalue->where);
+ && lhs_attr.dimension > 0)
+ {
+ if (gfc_is_not_contiguous (rvalue))
+ {
+ gfc_error ("Assignment to contiguous pointer from "
+ "non-contiguous target at %L", &rvalue->where);
+ return false;
+ }
+ if (!gfc_is_simply_contiguous (rvalue, false, true))
+ gfc_warning (OPT_Wextra, "Assignment to contiguous pointer from "
+ "non-contiguous target at %L", &rvalue->where);
+ }
/* Warn if it is the LHS pointer may lives longer than the RHS target. */
if (warn_target_lifetime
@@ -5935,7 +5943,7 @@ gfc_is_not_contiguous (gfc_expr *array)
{
/* Array-ref shall be last ref. */
- if (ar)
+ if (ar && ar->type != AR_ELEMENT)
return true;
if (ref->type == REF_ARRAY)
@@ -5955,10 +5963,11 @@ gfc_is_not_contiguous (gfc_expr *array)
if (gfc_ref_dimen_size (ar, i, &ref_size, NULL))
{
- if (gfc_dep_difference (ar->as->lower[i], ar->as->upper[i], &arr_size))
+ if (gfc_dep_difference (ar->as->upper[i], ar->as->lower[i], &arr_size))
{
/* a(2:4,2:) is known to be non-contiguous, but
a(2:4,i:i) can be contiguous. */
+ mpz_add_ui (arr_size, arr_size, 1L);
if (previous_incomplete && mpz_cmp_si (ref_size, 1) != 0)
{
mpz_clear (arr_size);
@@ -5979,7 +5988,10 @@ gfc_is_not_contiguous (gfc_expr *array)
&& ar->dimen_type[i] == DIMEN_RANGE
&& ar->stride[i] && ar->stride[i]->expr_type == EXPR_CONSTANT
&& mpz_cmp_si (ar->stride[i]->value.integer, 1) != 0)
- return true;
+ {
+ mpz_clear (ref_size);
+ return true;
+ }
mpz_clear (ref_size);
}
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index e3288d7..526b721 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -881,7 +881,7 @@ gfc_init_builtin_functions (void)
BUILT_IN_POWIF, "powif", ATTR_CONST_NOTHROW_LEAF_LIST);
- if (targetm.libc_has_function (function_c99_math_complex))
+ if (targetm.libc_has_function (function_c99_math_complex, NULL_TREE))
{
gfc_define_builtin ("__builtin_cbrtl", mfunc_longdouble[0],
BUILT_IN_CBRTL, "cbrtl",
@@ -903,7 +903,7 @@ gfc_init_builtin_functions (void)
ATTR_CONST_NOTHROW_LEAF_LIST);
}
- if (targetm.libc_has_function (function_sincos))
+ if (targetm.libc_has_function (function_sincos, NULL_TREE))
{
gfc_define_builtin ("__builtin_sincosl",
func_longdouble_longdoublep_longdoublep,
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 3629545..0bed2e1 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1361,6 +1361,14 @@ enum gfc_omp_requires_kind
| OMP_REQ_ATOMIC_MEM_ORDER_RELAXED)
};
+enum gfc_omp_memorder
+{
+ OMP_MEMORDER_ACQ_REL,
+ OMP_MEMORDER_RELEASE,
+ OMP_MEMORDER_ACQUIRE,
+ OMP_MEMORDER_LAST
+};
+
typedef struct gfc_omp_clauses
{
struct gfc_expr *if_expr;
@@ -1376,6 +1384,7 @@ typedef struct gfc_omp_clauses
bool inbranch, notinbranch, defaultmap, nogroup;
bool sched_simd, sched_monotonic, sched_nonmonotonic;
bool simd, threads, depend_source, order_concurrent;
+ enum gfc_omp_memorder memorder;
enum gfc_omp_cancel_kind cancel;
enum gfc_omp_proc_bind_kind proc_bind;
struct gfc_expr *safelen_expr;
@@ -1664,6 +1673,9 @@ typedef struct gfc_symbol
/* Set if the dummy argument of a procedure could be an array despite
being called with a scalar actual argument. */
unsigned maybe_array:1;
+ /* Set if this should be passed by value, but is not a VALUE argument
+ according to the Fortran standard. */
+ unsigned pass_as_value:1;
int refs;
struct gfc_namespace *ns; /* namespace containing this symbol */
@@ -3240,7 +3252,7 @@ bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *);
bool gfc_type_compatible (gfc_typespec *, gfc_typespec *);
void gfc_copy_formal_args_intr (gfc_symbol *, gfc_intrinsic_sym *,
- gfc_actual_arglist *);
+ gfc_actual_arglist *, bool copy_type = false);
void gfc_free_finalizer (gfc_finalizer *el); /* Needed in resolve.c, too */
@@ -3265,6 +3277,8 @@ void gfc_intrinsic_done_1 (void);
char gfc_type_letter (bt, bool logical_equals_int = false);
gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *);
+gfc_symbol *gfc_get_intrinsic_function_symbol (gfc_expr *);
+gfc_symbol *gfc_find_intrinsic_symbol (gfc_expr *);
bool gfc_convert_type (gfc_expr *, gfc_typespec *, int);
bool gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int,
bool array = false);
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 6a5b3e9..06622a6 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -122,6 +122,43 @@ gfc_get_intrinsic_sub_symbol (const char *name)
return sym;
}
+/* Get a symbol for a resolved function, with its special name. The
+ actual argument list needs to be set by the caller. */
+
+gfc_symbol *
+gfc_get_intrinsic_function_symbol (gfc_expr *expr)
+{
+ gfc_symbol *sym;
+
+ gfc_get_symbol (expr->value.function.name, gfc_intrinsic_namespace, &sym);
+ sym->attr.external = 1;
+ sym->attr.function = 1;
+ sym->attr.always_explicit = 1;
+ sym->attr.proc = PROC_INTRINSIC;
+ sym->attr.flavor = FL_PROCEDURE;
+ sym->result = sym;
+ if (expr->rank > 0)
+ {
+ sym->attr.dimension = 1;
+ sym->as = gfc_get_array_spec ();
+ sym->as->type = AS_ASSUMED_SHAPE;
+ sym->as->rank = expr->rank;
+ }
+ return sym;
+}
+
+/* Find a symbol for a resolved intrinsic procedure, return NULL if
+ not found. */
+
+gfc_symbol *
+gfc_find_intrinsic_symbol (gfc_expr *expr)
+{
+ gfc_symbol *sym;
+ gfc_find_symbol (expr->value.function.name, gfc_intrinsic_namespace,
+ 0, &sym);
+ return sym;
+}
+
/* Return a pointer to the name of a conversion function given two
typespecs. */
@@ -5038,6 +5075,11 @@ got_specific:
if (!sym->module)
gfc_intrinsic_symbol (sym);
+ /* Have another stab at simplification since elemental intrinsics with array
+ actual arguments would be missed by the calls above to do_simplify. */
+ if (isym->elemental)
+ gfc_simplify_expr (expr, 1);
+
return MATCH_YES;
}
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 1ec3dc5..ad51008 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -1297,11 +1297,7 @@ gfc_resolve_index_func (gfc_expr *f, gfc_actual_arglist *a)
f->ts.type = BT_INTEGER;
if (kind)
- {
- f->ts.kind = mpz_get_si ((kind)->value.integer);
- a_back->next = NULL;
- gfc_free_actual_arglist (a_kind);
- }
+ f->ts.kind = mpz_get_si ((kind)->value.integer);
else
f->ts.kind = gfc_default_integer_kind;
@@ -3312,21 +3308,7 @@ gfc_resolve_mvbits (gfc_code *c)
{
static const sym_intent INTENTS[] = {INTENT_IN, INTENT_IN, INTENT_IN,
INTENT_INOUT, INTENT_IN};
-
const char *name;
- gfc_typespec ts;
- gfc_clear_ts (&ts);
-
- /* FROMPOS, LEN and TOPOS are restricted to small values. As such,
- they will be converted so that they fit into a C int. */
- ts.type = BT_INTEGER;
- ts.kind = gfc_c_int_kind;
- if (c->ext.actual->next->expr->ts.kind != gfc_c_int_kind)
- gfc_convert_type (c->ext.actual->next->expr, &ts, 2);
- if (c->ext.actual->next->next->expr->ts.kind != gfc_c_int_kind)
- gfc_convert_type (c->ext.actual->next->next->expr, &ts, 2);
- if (c->ext.actual->next->next->next->next->expr->ts.kind != gfc_c_int_kind)
- gfc_convert_type (c->ext.actual->next->next->next->next->expr, &ts, 2);
/* TO and FROM are guaranteed to have the same kind parameter. */
name = gfc_get_string (PREFIX ("mvbits_i%d"),
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index cb09c5f..bee73e7 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -5166,7 +5166,8 @@ gfc_get_common (const char *name, int from_module)
/* Match a common block name. */
-match match_common_name (char *name)
+match
+gfc_match_common_name (char *name)
{
match m;
@@ -5218,7 +5219,7 @@ gfc_match_common (void)
for (;;)
{
- m = match_common_name (name);
+ m = gfc_match_common_name (name);
if (m == MATCH_ERROR)
goto cleanup;
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h
index 7bf70d7..4ccb596 100644
--- a/gcc/fortran/match.h
+++ b/gcc/fortran/match.h
@@ -103,11 +103,9 @@ match gfc_match_call (void);
/* We want to use this function to check for a common-block-name
that can exist in a bind statement, so removed the "static"
- declaration of the function in match.c.
+ declaration of the function in match.c. */
- TODO: should probably rename this now that it'll be globally seen to
- gfc_match_common_name. */
-match match_common_name (char *name);
+match gfc_match_common_name (char *name);
match gfc_match_common (void);
match gfc_match_block_data (void);
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 1efce33..b143ba7 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -2766,15 +2766,44 @@ match
gfc_match_omp_flush (void)
{
gfc_omp_namelist *list = NULL;
+ gfc_omp_clauses *c = NULL;
+ gfc_gobble_whitespace ();
+ enum gfc_omp_memorder mo = OMP_MEMORDER_LAST;
+ if (gfc_match_omp_eos () == MATCH_NO && gfc_peek_ascii_char () != '(')
+ {
+ if (gfc_match ("acq_rel") == MATCH_YES)
+ mo = OMP_MEMORDER_ACQ_REL;
+ else if (gfc_match ("release") == MATCH_YES)
+ mo = OMP_MEMORDER_RELEASE;
+ else if (gfc_match ("acquire") == MATCH_YES)
+ mo = OMP_MEMORDER_ACQUIRE;
+ else
+ {
+ gfc_error ("Expected AQC_REL, RELEASE, or ACQUIRE at %C");
+ return MATCH_ERROR;
+ }
+ c = gfc_get_omp_clauses ();
+ c->memorder = mo;
+ }
gfc_match_omp_variable_list (" (", &list, true);
+ if (list && mo != OMP_MEMORDER_LAST)
+ {
+ gfc_error ("List specified together with memory order clause in FLUSH "
+ "directive at %C");
+ gfc_free_omp_namelist (list);
+ gfc_free_omp_clauses (c);
+ return MATCH_ERROR;
+ }
if (gfc_match_omp_eos () != MATCH_YES)
{
gfc_error ("Unexpected junk after $OMP FLUSH statement at %C");
gfc_free_omp_namelist (list);
+ gfc_free_omp_clauses (c);
return MATCH_ERROR;
}
new_st.op = EXEC_OMP_FLUSH;
new_st.ext.omp_namelist = list;
+ new_st.ext.omp_clauses = c;
return MATCH_YES;
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 7d772d5..d54bd58 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -936,9 +936,16 @@ static void
resolve_common_vars (gfc_common_head *common_block, bool named_common)
{
gfc_symbol *csym = common_block->head;
+ gfc_gsymbol *gsym;
for (; csym; csym = csym->common_next)
{
+ gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name);
+ if (gsym && (gsym->type == GSYM_MODULE || gsym->type == GSYM_PROGRAM))
+ gfc_error_now ("Global entity %qs at %L cannot appear in a "
+ "COMMON block at %L", gsym->name,
+ &gsym->where, &csym->common_block->where);
+
/* gfc_add_in_common may have been called before, but the reported errors
have been ignored to continue parsing.
We do the checks again here. */
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 6f93508..fd11f5a 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1876,13 +1876,13 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char)
if (((*pbuf)[comment_ix+1] == 'g' || (*pbuf)[comment_ix+1] == 'G')
&& ((*pbuf)[comment_ix+2] == 'c' || (*pbuf)[comment_ix+2] == 'C')
&& ((*pbuf)[comment_ix+3] == 'c' || (*pbuf)[comment_ix+3] == 'C')
- && (*pbuf)[comment_ix+4] == '$')
+ && c == '$')
first_comment = seen_comment = false;
if (flag_openacc
&& (*pbuf)[comment_ix+1] == '$'
&& ((*pbuf)[comment_ix+2] == 'a' || (*pbuf)[comment_ix+2] == 'A')
&& ((*pbuf)[comment_ix+3] == 'c' || (*pbuf)[comment_ix+3] == 'C')
- && ((*pbuf)[comment_ix+4] == 'c' || (*pbuf)[comment_ix+4] == 'C'))
+ && (c == 'c' || c == 'C'))
first_comment = seen_comment = false;
}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index df1e896..a112c81 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -4645,12 +4645,13 @@ add_proc_interface (gfc_symbol *sym, ifsrc source, gfc_formal_arglist *formal)
declaration statement (see match_proc_decl()) to create the formal
args based on the args of a given named interface.
- When an actual argument list is provided, skip the absent arguments.
+ When an actual argument list is provided, skip the absent arguments
+ unless copy_type is true.
To be used together with gfc_se->ignore_optional. */
void
gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src,
- gfc_actual_arglist *actual)
+ gfc_actual_arglist *actual, bool copy_type)
{
gfc_formal_arglist *head = NULL;
gfc_formal_arglist *tail = NULL;
@@ -4677,13 +4678,27 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src,
act_arg = act_arg->next;
continue;
}
- act_arg = act_arg->next;
}
formal_arg = gfc_get_formal_arglist ();
gfc_get_symbol (curr_arg->name, gfc_current_ns, &(formal_arg->sym));
/* May need to copy more info for the symbol. */
- formal_arg->sym->ts = curr_arg->ts;
+ if (copy_type && act_arg->expr != NULL)
+ {
+ formal_arg->sym->ts = act_arg->expr->ts;
+ if (act_arg->expr->rank > 0)
+ {
+ formal_arg->sym->attr.dimension = 1;
+ formal_arg->sym->as = gfc_get_array_spec();
+ formal_arg->sym->as->rank = -1;
+ formal_arg->sym->as->type = AS_ASSUMED_RANK;
+ }
+ if (act_arg->name && strcmp (act_arg->name, "%VAL") == 0)
+ formal_arg->sym->pass_as_value = 1;
+ }
+ else
+ formal_arg->sym->ts = curr_arg->ts;
+
formal_arg->sym->attr.optional = curr_arg->optional;
formal_arg->sym->attr.value = curr_arg->value;
formal_arg->sym->attr.intent = curr_arg->intent;
@@ -4708,6 +4723,8 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src,
/* Validate changes. */
gfc_commit_symbol (formal_arg->sym);
+ if (actual)
+ act_arg = act_arg->next;
}
/* Add the interface to the symbol. */
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 261759d..af346e4 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3875,7 +3875,20 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
decl = sym->backend_decl;
}
else if (sym->ts.type == BT_CLASS)
- decl = NULL_TREE;
+ {
+ if (UNLIMITED_POLY (sym))
+ {
+ gfc_expr *class_expr = gfc_find_and_cut_at_last_class_ref (expr);
+ gfc_init_se (&tmpse, NULL);
+ gfc_conv_expr (&tmpse, class_expr);
+ if (!se->class_vptr)
+ se->class_vptr = gfc_class_vptr_get (tmpse.expr);
+ gfc_free_expr (class_expr);
+ decl = tmpse.expr;
+ }
+ else
+ decl = NULL_TREE;
+ }
se->expr = build_array_ref (se->expr, offset, decl, se->class_vptr);
}
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 3b5bf0c..a41ef75 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "gomp-constants.h"
#include "gimplify.h"
#include "omp-general.h"
+#include "attr-fnspec.h"
#define MAX_LABEL_VALUE 99999
@@ -3344,6 +3345,11 @@ gfc_build_library_function_decl_with_spec (tree name, const char *spec,
tree ret;
va_list args;
va_start (args, nargs);
+ if (flag_checking)
+ {
+ attr_fnspec fnspec (spec, strlen (spec));
+ fnspec.verify ();
+ }
ret = build_library_function_decl_1 (name, spec, rettype, nargs, args);
va_end (args);
return ret;
@@ -3363,144 +3369,144 @@ gfc_build_intrinsic_function_decls (void)
/* String functions. */
gfor_fndecl_compare_string = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("compare_string")), "..R.R",
+ get_identifier (PREFIX("compare_string")), ". . R . R ",
integer_type_node, 4, gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node);
DECL_PURE_P (gfor_fndecl_compare_string) = 1;
TREE_NOTHROW (gfor_fndecl_compare_string) = 1;
gfor_fndecl_concat_string = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("concat_string")), "..W.R.R",
+ get_identifier (PREFIX("concat_string")), ". . W . R . R ",
void_type_node, 6, gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node);
TREE_NOTHROW (gfor_fndecl_concat_string) = 1;
gfor_fndecl_string_len_trim = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_len_trim")), "..R",
+ get_identifier (PREFIX("string_len_trim")), ". . R ",
gfc_charlen_type_node, 2, gfc_charlen_type_node, pchar1_type_node);
DECL_PURE_P (gfor_fndecl_string_len_trim) = 1;
TREE_NOTHROW (gfor_fndecl_string_len_trim) = 1;
gfor_fndecl_string_index = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_index")), "..R.R.",
+ get_identifier (PREFIX("string_index")), ". . R . R . ",
gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
DECL_PURE_P (gfor_fndecl_string_index) = 1;
TREE_NOTHROW (gfor_fndecl_string_index) = 1;
gfor_fndecl_string_scan = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_scan")), "..R.R.",
+ get_identifier (PREFIX("string_scan")), ". . R . R . ",
gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
DECL_PURE_P (gfor_fndecl_string_scan) = 1;
TREE_NOTHROW (gfor_fndecl_string_scan) = 1;
gfor_fndecl_string_verify = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_verify")), "..R.R.",
+ get_identifier (PREFIX("string_verify")), ". . R . R . ",
gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar1_type_node,
gfc_charlen_type_node, pchar1_type_node, gfc_logical4_type_node);
DECL_PURE_P (gfor_fndecl_string_verify) = 1;
TREE_NOTHROW (gfor_fndecl_string_verify) = 1;
gfor_fndecl_string_trim = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_trim")), ".Ww.R",
+ get_identifier (PREFIX("string_trim")), ". W w . R ",
void_type_node, 4, build_pointer_type (gfc_charlen_type_node),
build_pointer_type (pchar1_type_node), gfc_charlen_type_node,
pchar1_type_node);
gfor_fndecl_string_minmax = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_minmax")), ".Ww.R",
+ get_identifier (PREFIX("string_minmax")), ". W w . R ",
void_type_node, -4, build_pointer_type (gfc_charlen_type_node),
build_pointer_type (pchar1_type_node), integer_type_node,
integer_type_node);
gfor_fndecl_adjustl = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("adjustl")), ".W.R",
+ get_identifier (PREFIX("adjustl")), ". W . R ",
void_type_node, 3, pchar1_type_node, gfc_charlen_type_node,
pchar1_type_node);
TREE_NOTHROW (gfor_fndecl_adjustl) = 1;
gfor_fndecl_adjustr = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("adjustr")), ".W.R",
+ get_identifier (PREFIX("adjustr")), ". W . R ",
void_type_node, 3, pchar1_type_node, gfc_charlen_type_node,
pchar1_type_node);
TREE_NOTHROW (gfor_fndecl_adjustr) = 1;
gfor_fndecl_select_string = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("select_string")), ".R.R.",
+ get_identifier (PREFIX("select_string")), ". R . R . ",
integer_type_node, 4, pvoid_type_node, integer_type_node,
pchar1_type_node, gfc_charlen_type_node);
DECL_PURE_P (gfor_fndecl_select_string) = 1;
TREE_NOTHROW (gfor_fndecl_select_string) = 1;
gfor_fndecl_compare_string_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("compare_string_char4")), "..R.R",
+ get_identifier (PREFIX("compare_string_char4")), ". . R . R ",
integer_type_node, 4, gfc_charlen_type_node, pchar4_type_node,
gfc_charlen_type_node, pchar4_type_node);
DECL_PURE_P (gfor_fndecl_compare_string_char4) = 1;
TREE_NOTHROW (gfor_fndecl_compare_string_char4) = 1;
gfor_fndecl_concat_string_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("concat_string_char4")), "..W.R.R",
+ get_identifier (PREFIX("concat_string_char4")), ". . W . R . R ",
void_type_node, 6, gfc_charlen_type_node, pchar4_type_node,
gfc_charlen_type_node, pchar4_type_node, gfc_charlen_type_node,
pchar4_type_node);
TREE_NOTHROW (gfor_fndecl_concat_string_char4) = 1;
gfor_fndecl_string_len_trim_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_len_trim_char4")), "..R",
+ get_identifier (PREFIX("string_len_trim_char4")), ". . R ",
gfc_charlen_type_node, 2, gfc_charlen_type_node, pchar4_type_node);
DECL_PURE_P (gfor_fndecl_string_len_trim_char4) = 1;
TREE_NOTHROW (gfor_fndecl_string_len_trim_char4) = 1;
gfor_fndecl_string_index_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_index_char4")), "..R.R.",
+ get_identifier (PREFIX("string_index_char4")), ". . R . R . ",
gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
DECL_PURE_P (gfor_fndecl_string_index_char4) = 1;
TREE_NOTHROW (gfor_fndecl_string_index_char4) = 1;
gfor_fndecl_string_scan_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_scan_char4")), "..R.R.",
+ get_identifier (PREFIX("string_scan_char4")), ". . R . R . ",
gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
DECL_PURE_P (gfor_fndecl_string_scan_char4) = 1;
TREE_NOTHROW (gfor_fndecl_string_scan_char4) = 1;
gfor_fndecl_string_verify_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_verify_char4")), "..R.R.",
+ get_identifier (PREFIX("string_verify_char4")), ". . R . R . ",
gfc_charlen_type_node, 5, gfc_charlen_type_node, pchar4_type_node,
gfc_charlen_type_node, pchar4_type_node, gfc_logical4_type_node);
DECL_PURE_P (gfor_fndecl_string_verify_char4) = 1;
TREE_NOTHROW (gfor_fndecl_string_verify_char4) = 1;
gfor_fndecl_string_trim_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_trim_char4")), ".Ww.R",
+ get_identifier (PREFIX("string_trim_char4")), ". W w . R ",
void_type_node, 4, build_pointer_type (gfc_charlen_type_node),
build_pointer_type (pchar4_type_node), gfc_charlen_type_node,
pchar4_type_node);
gfor_fndecl_string_minmax_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("string_minmax_char4")), ".Ww.R",
+ get_identifier (PREFIX("string_minmax_char4")), ". W w . R ",
void_type_node, -4, build_pointer_type (gfc_charlen_type_node),
build_pointer_type (pchar4_type_node), integer_type_node,
integer_type_node);
gfor_fndecl_adjustl_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("adjustl_char4")), ".W.R",
+ get_identifier (PREFIX("adjustl_char4")), ". W . R ",
void_type_node, 3, pchar4_type_node, gfc_charlen_type_node,
pchar4_type_node);
TREE_NOTHROW (gfor_fndecl_adjustl_char4) = 1;
gfor_fndecl_adjustr_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("adjustr_char4")), ".W.R",
+ get_identifier (PREFIX("adjustr_char4")), ". W . R ",
void_type_node, 3, pchar4_type_node, gfc_charlen_type_node,
pchar4_type_node);
TREE_NOTHROW (gfor_fndecl_adjustr_char4) = 1;
gfor_fndecl_select_string_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("select_string_char4")), ".R.R.",
+ get_identifier (PREFIX("select_string_char4")), ". R . R . ",
integer_type_node, 4, pvoid_type_node, integer_type_node,
pvoid_type_node, gfc_charlen_type_node);
DECL_PURE_P (gfor_fndecl_select_string_char4) = 1;
@@ -3510,28 +3516,28 @@ gfc_build_intrinsic_function_decls (void)
/* Conversion between character kinds. */
gfor_fndecl_convert_char1_to_char4 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("convert_char1_to_char4")), ".w.R",
+ get_identifier (PREFIX("convert_char1_to_char4")), ". w . R ",
void_type_node, 3, build_pointer_type (pchar4_type_node),
gfc_charlen_type_node, pchar1_type_node);
gfor_fndecl_convert_char4_to_char1 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("convert_char4_to_char1")), ".w.R",
+ get_identifier (PREFIX("convert_char4_to_char1")), ". w . R ",
void_type_node, 3, build_pointer_type (pchar1_type_node),
gfc_charlen_type_node, pchar4_type_node);
/* Misc. functions. */
gfor_fndecl_ttynam = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("ttynam")), ".W",
+ get_identifier (PREFIX("ttynam")), ". W . . ",
void_type_node, 3, pchar_type_node, gfc_charlen_type_node,
integer_type_node);
gfor_fndecl_fdate = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("fdate")), ".W",
+ get_identifier (PREFIX("fdate")), ". W . ",
void_type_node, 2, pchar_type_node, gfc_charlen_type_node);
gfor_fndecl_ctime = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("ctime")), ".W",
+ get_identifier (PREFIX("ctime")), ". W . . ",
void_type_node, 3, pchar_type_node, gfc_charlen_type_node,
gfc_int8_type_node);
@@ -3541,19 +3547,19 @@ gfc_build_intrinsic_function_decls (void)
gfc_int4_type_node);
gfor_fndecl_sc_kind = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("selected_char_kind")), "..R",
+ get_identifier (PREFIX("selected_char_kind")), ". . R ",
gfc_int4_type_node, 2, gfc_charlen_type_node, pchar_type_node);
DECL_PURE_P (gfor_fndecl_sc_kind) = 1;
TREE_NOTHROW (gfor_fndecl_sc_kind) = 1;
gfor_fndecl_si_kind = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("selected_int_kind")), ".R",
+ get_identifier (PREFIX("selected_int_kind")), ". R ",
gfc_int4_type_node, 1, pvoid_type_node);
DECL_PURE_P (gfor_fndecl_si_kind) = 1;
TREE_NOTHROW (gfor_fndecl_si_kind) = 1;
gfor_fndecl_sr_kind = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("selected_real_kind2008")), ".RR",
+ get_identifier (PREFIX("selected_real_kind2008")), ". R R ",
gfc_int4_type_node, 3, pvoid_type_node, pvoid_type_node,
pvoid_type_node);
DECL_PURE_P (gfor_fndecl_sr_kind) = 1;
@@ -3694,13 +3700,13 @@ gfc_build_intrinsic_function_decls (void)
/* Other functions. */
gfor_fndecl_size0 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("size0")), ".R",
+ get_identifier (PREFIX("size0")), ". R ",
gfc_array_index_type, 1, pvoid_type_node);
DECL_PURE_P (gfor_fndecl_size0) = 1;
TREE_NOTHROW (gfor_fndecl_size0) = 1;
gfor_fndecl_size1 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("size1")), ".R",
+ get_identifier (PREFIX("size1")), ". R . ",
gfc_array_index_type, 2, pvoid_type_node, gfc_array_index_type);
DECL_PURE_P (gfor_fndecl_size1) = 1;
TREE_NOTHROW (gfor_fndecl_size1) = 1;
@@ -3718,7 +3724,7 @@ gfc_build_intrinsic_function_decls (void)
2, gfc_int4_type_node, gfc_int4_type_node);
gfor_fndecl_is_contiguous0 = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("is_contiguous0")), ".R",
+ get_identifier (PREFIX("is_contiguous0")), ". R ",
gfc_int4_type_node, 1, pvoid_type_node);
DECL_PURE_P (gfor_fndecl_is_contiguous0) = 1;
TREE_NOTHROW (gfor_fndecl_is_contiguous0) = 1;
@@ -3740,7 +3746,7 @@ gfc_build_builtin_function_decls (void)
TREE_THIS_VOLATILE (gfor_fndecl_stop_numeric) = 1;
gfor_fndecl_stop_string = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("stop_string")), ".R.",
+ get_identifier (PREFIX("stop_string")), ". R . . ",
void_type_node, 3, pchar_type_node, size_type_node,
boolean_type_node);
/* STOP doesn't return. */
@@ -3753,7 +3759,7 @@ gfc_build_builtin_function_decls (void)
TREE_THIS_VOLATILE (gfor_fndecl_error_stop_numeric) = 1;
gfor_fndecl_error_stop_string = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("error_stop_string")), ".R.",
+ get_identifier (PREFIX("error_stop_string")), ". R . . ",
void_type_node, 3, pchar_type_node, size_type_node,
boolean_type_node);
/* ERROR STOP doesn't return. */
@@ -3764,32 +3770,32 @@ gfc_build_builtin_function_decls (void)
void_type_node, 1, gfc_int8_type_node);
gfor_fndecl_pause_string = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("pause_string")), ".R.",
+ get_identifier (PREFIX("pause_string")), ". R . ",
void_type_node, 2, pchar_type_node, size_type_node);
gfor_fndecl_runtime_error = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("runtime_error")), ".R",
+ get_identifier (PREFIX("runtime_error")), ". R ",
void_type_node, -1, pchar_type_node);
/* The runtime_error function does not return. */
TREE_THIS_VOLATILE (gfor_fndecl_runtime_error) = 1;
gfor_fndecl_runtime_error_at = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("runtime_error_at")), ".RR",
+ get_identifier (PREFIX("runtime_error_at")), ". R R ",
void_type_node, -2, pchar_type_node, pchar_type_node);
/* The runtime_error_at function does not return. */
TREE_THIS_VOLATILE (gfor_fndecl_runtime_error_at) = 1;
gfor_fndecl_runtime_warning_at = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("runtime_warning_at")), ".RR",
+ get_identifier (PREFIX("runtime_warning_at")), ". R R ",
void_type_node, -2, pchar_type_node, pchar_type_node);
gfor_fndecl_generate_error = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("generate_error")), ".R.R",
+ get_identifier (PREFIX("generate_error")), ". R . R ",
void_type_node, 3, pvoid_type_node, integer_type_node,
pchar_type_node);
gfor_fndecl_os_error_at = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("os_error_at")), ".RR",
+ get_identifier (PREFIX("os_error_at")), ". R R ",
void_type_node, -2, pchar_type_node, pchar_type_node);
/* The os_error_at function does not return. */
TREE_THIS_VOLATILE (gfor_fndecl_os_error_at) = 1;
@@ -3813,7 +3819,7 @@ gfc_build_builtin_function_decls (void)
/* Keep the array dimension in sync with the call, later in this file. */
gfor_fndecl_set_options = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("set_options")), "..R",
+ get_identifier (PREFIX("set_options")), ". . R ",
void_type_node, 2, integer_type_node,
build_pointer_type (integer_type_node));
@@ -3830,11 +3836,11 @@ gfc_build_builtin_function_decls (void)
void_type_node, 1, integer_type_node);
gfor_fndecl_in_pack = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("internal_pack")), ".r",
+ get_identifier (PREFIX("internal_pack")), ". r ",
pvoid_type_node, 1, pvoid_type_node);
gfor_fndecl_in_unpack = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("internal_unpack")), ".wR",
+ get_identifier (PREFIX("internal_unpack")), ". w R ",
void_type_node, 2, pvoid_type_node, pvoid_type_node);
/* These two builtins write into what the first argument points to and
@@ -3843,15 +3849,15 @@ gfc_build_builtin_function_decls (void)
which is copied into the descriptor pointed by the first argument,
effectively escaping that way. See PR92123. */
gfor_fndecl_cfi_to_gfc = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("cfi_desc_to_gfc_desc")), ".w.",
+ get_identifier (PREFIX("cfi_desc_to_gfc_desc")), ". w . ",
void_type_node, 2, pvoid_type_node, ppvoid_type_node);
gfor_fndecl_gfc_to_cfi = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("gfc_desc_to_cfi_desc")), ".w.",
+ get_identifier (PREFIX("gfc_desc_to_cfi_desc")), ". w . ",
void_type_node, 2, ppvoid_type_node, pvoid_type_node);
gfor_fndecl_associated = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("associated")), ".RR",
+ get_identifier (PREFIX("associated")), ". R R ",
integer_type_node, 2, ppvoid_type_node, ppvoid_type_node);
DECL_PURE_P (gfor_fndecl_associated) = 1;
TREE_NOTHROW (gfor_fndecl_associated) = 1;
@@ -3864,9 +3870,9 @@ gfc_build_builtin_function_decls (void)
pppchar_type
= build_pointer_type (build_pointer_type (pchar_type_node));
- gfor_fndecl_caf_init = gfc_build_library_function_decl (
- get_identifier (PREFIX("caf_init")), void_type_node,
- 2, pint_type, pppchar_type);
+ gfor_fndecl_caf_init = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("caf_init")), ". W W ",
+ void_type_node, 2, pint_type, pppchar_type);
gfor_fndecl_caf_finalize = gfc_build_library_function_decl (
get_identifier (PREFIX("caf_finalize")), void_type_node, 0);
@@ -3880,49 +3886,55 @@ gfc_build_builtin_function_decls (void)
2, integer_type_node, integer_type_node);
gfor_fndecl_caf_register = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_register")), "RRWWWWR", void_type_node, 7,
+ get_identifier (PREFIX("caf_register")), ". . . W w w w . ",
+ void_type_node, 7,
size_type_node, integer_type_node, ppvoid_type_node, pvoid_type_node,
pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_deregister")), "WRWWR", void_type_node, 5,
+ get_identifier (PREFIX("caf_deregister")), ". W . w w . ",
+ void_type_node, 5,
ppvoid_type_node, integer_type_node, pint_type, pchar_type_node,
size_type_node);
gfor_fndecl_caf_get = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_get")), ".R.RRWRRRW", void_type_node, 10,
+ get_identifier (PREFIX("caf_get")), ". r . . r r w . . . w ",
+ void_type_node, 10,
pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
boolean_type_node, pint_type);
gfor_fndecl_caf_send = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_send")), ".R.RRRRRRWR", void_type_node, 11,
+ get_identifier (PREFIX("caf_send")), ". r . . w r r . . . w ",
+ void_type_node, 11,
pvoid_type_node, size_type_node, integer_type_node, pvoid_type_node,
pvoid_type_node, pvoid_type_node, integer_type_node, integer_type_node,
boolean_type_node, pint_type, pvoid_type_node);
gfor_fndecl_caf_sendget = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sendget")), ".R.RRRR.RRRRRR",
+ get_identifier (PREFIX("caf_sendget")), ". r . . w r r . . r r . . . w ",
void_type_node, 14, pvoid_type_node, size_type_node, integer_type_node,
pvoid_type_node, pvoid_type_node, pvoid_type_node, size_type_node,
integer_type_node, pvoid_type_node, pvoid_type_node, integer_type_node,
integer_type_node, boolean_type_node, integer_type_node);
gfor_fndecl_caf_get_by_ref = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_get_by_ref")), ".RWRRRRRWR", void_type_node,
+ get_identifier (PREFIX("caf_get_by_ref")), ". r . w r . . . . w . ",
+ void_type_node,
10, pvoid_type_node, integer_type_node, pvoid_type_node,
pvoid_type_node, integer_type_node, integer_type_node,
boolean_type_node, boolean_type_node, pint_type, integer_type_node);
gfor_fndecl_caf_send_by_ref = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_send_by_ref")), ".RRRRRRRWR",
+ get_identifier (PREFIX("caf_send_by_ref")), ". r . r r . . . . w . ",
void_type_node, 10, pvoid_type_node, integer_type_node, pvoid_type_node,
pvoid_type_node, integer_type_node, integer_type_node,
boolean_type_node, boolean_type_node, pint_type, integer_type_node);
gfor_fndecl_caf_sendget_by_ref
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sendget_by_ref")), ".RR.RRRRRWWRR",
+ get_identifier (PREFIX("caf_sendget_by_ref")),
+ ". r . r r . r . . . w w . . ",
void_type_node, 13, pvoid_type_node, integer_type_node,
pvoid_type_node, pvoid_type_node, integer_type_node,
pvoid_type_node, integer_type_node, integer_type_node,
@@ -3930,15 +3942,15 @@ gfc_build_builtin_function_decls (void)
integer_type_node);
gfor_fndecl_caf_sync_all = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sync_all")), ".WW", void_type_node,
+ get_identifier (PREFIX("caf_sync_all")), ". w w . ", void_type_node,
3, pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_sync_memory = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sync_memory")), ".WW", void_type_node,
+ get_identifier (PREFIX("caf_sync_memory")), ". w w . ", void_type_node,
3, pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_sync_images = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sync_images")), ".RRWW", void_type_node,
+ get_identifier (PREFIX("caf_sync_images")), ". . r w w . ", void_type_node,
5, integer_type_node, pint_type, pint_type,
pchar_type_node, size_type_node);
@@ -3949,67 +3961,67 @@ gfc_build_builtin_function_decls (void)
TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop) = 1;
gfor_fndecl_caf_error_stop_str = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_error_stop_str")), ".R.",
+ get_identifier (PREFIX("caf_error_stop_str")), ". r . ",
void_type_node, 2, pchar_type_node, size_type_node);
/* CAF's ERROR STOP doesn't return. */
TREE_THIS_VOLATILE (gfor_fndecl_caf_error_stop_str) = 1;
- gfor_fndecl_caf_stop_numeric = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_stop_numeric")), ".R.",
+ gfor_fndecl_caf_stop_numeric = gfc_build_library_function_decl (
+ get_identifier (PREFIX("caf_stop_numeric")),
void_type_node, 1, integer_type_node);
/* CAF's STOP doesn't return. */
TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_numeric) = 1;
gfor_fndecl_caf_stop_str = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_stop_str")), ".R.",
+ get_identifier (PREFIX("caf_stop_str")), ". r . ",
void_type_node, 2, pchar_type_node, size_type_node);
/* CAF's STOP doesn't return. */
TREE_THIS_VOLATILE (gfor_fndecl_caf_stop_str) = 1;
gfor_fndecl_caf_atomic_def = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_atomic_define")), "R..RW",
+ get_identifier (PREFIX("caf_atomic_define")), ". r . . w w . . ",
void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
pvoid_type_node, pint_type, integer_type_node, integer_type_node);
gfor_fndecl_caf_atomic_ref = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_atomic_ref")), "R..WW",
+ get_identifier (PREFIX("caf_atomic_ref")), ". r . . w w . . ",
void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
pvoid_type_node, pint_type, integer_type_node, integer_type_node);
gfor_fndecl_caf_atomic_cas = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_atomic_cas")), "R..WRRW",
+ get_identifier (PREFIX("caf_atomic_cas")), ". r . . w r r w . . ",
void_type_node, 9, pvoid_type_node, size_type_node, integer_type_node,
pvoid_type_node, pvoid_type_node, pvoid_type_node, pint_type,
integer_type_node, integer_type_node);
gfor_fndecl_caf_atomic_op = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_atomic_op")), ".R..RWW",
+ get_identifier (PREFIX("caf_atomic_op")), ". . r . . r w w . . ",
void_type_node, 9, integer_type_node, pvoid_type_node, size_type_node,
integer_type_node, pvoid_type_node, pvoid_type_node, pint_type,
integer_type_node, integer_type_node);
gfor_fndecl_caf_lock = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_lock")), "R..WWW",
+ get_identifier (PREFIX("caf_lock")), ". r . . w w w . ",
void_type_node, 7, pvoid_type_node, size_type_node, integer_type_node,
pint_type, pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_unlock = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_unlock")), "R..WW",
+ get_identifier (PREFIX("caf_unlock")), ". r . . w w . ",
void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_event_post = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_event_post")), "R..WW",
+ get_identifier (PREFIX("caf_event_post")), ". r . . w w . ",
void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_event_wait = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_event_wait")), "R..WW",
+ get_identifier (PREFIX("caf_event_wait")), ". r . . w w . ",
void_type_node, 6, pvoid_type_node, size_type_node, integer_type_node,
pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_event_query = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_event_query")), "R..WW",
+ get_identifier (PREFIX("caf_event_query")), ". r . . w w ",
void_type_node, 5, pvoid_type_node, size_type_node, integer_type_node,
pint_type, pint_type);
@@ -4020,19 +4032,19 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_caf_failed_images
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_failed_images")), "WRR",
+ get_identifier (PREFIX("caf_failed_images")), ". w . r ",
void_type_node, 3, pvoid_type_node, ppvoid_type_node,
integer_type_node);
gfor_fndecl_caf_form_team
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_form_team")), "RWR",
+ get_identifier (PREFIX("caf_form_team")), ". . W . ",
void_type_node, 3, integer_type_node, ppvoid_type_node,
integer_type_node);
gfor_fndecl_caf_change_team
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_change_team")), "RR",
+ get_identifier (PREFIX("caf_change_team")), ". w . ",
void_type_node, 2, ppvoid_type_node,
integer_type_node);
@@ -4041,49 +4053,49 @@ gfc_build_builtin_function_decls (void)
get_identifier (PREFIX("caf_end_team")), void_type_node, 0);
gfor_fndecl_caf_get_team
- = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_get_team")), "R",
+ = gfc_build_library_function_decl (
+ get_identifier (PREFIX("caf_get_team")),
void_type_node, 1, integer_type_node);
gfor_fndecl_caf_sync_team
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sync_team")), "RR",
+ get_identifier (PREFIX("caf_sync_team")), ". r . ",
void_type_node, 2, ppvoid_type_node,
integer_type_node);
gfor_fndecl_caf_team_number
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_team_number")), "R",
+ get_identifier (PREFIX("caf_team_number")), ". r ",
integer_type_node, 1, integer_type_node);
gfor_fndecl_caf_image_status
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_image_status")), "RR",
+ get_identifier (PREFIX("caf_image_status")), ". . r ",
integer_type_node, 2, integer_type_node, ppvoid_type_node);
gfor_fndecl_caf_stopped_images
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_stopped_images")), "WRR",
+ get_identifier (PREFIX("caf_stopped_images")), ". w r r ",
void_type_node, 3, pvoid_type_node, ppvoid_type_node,
integer_type_node);
gfor_fndecl_co_broadcast = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_co_broadcast")), "W.WW",
+ get_identifier (PREFIX("caf_co_broadcast")), ". w . w w . ",
void_type_node, 5, pvoid_type_node, integer_type_node,
pint_type, pchar_type_node, size_type_node);
gfor_fndecl_co_max = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_co_max")), "W.WW",
+ get_identifier (PREFIX("caf_co_max")), ". w . w w . . ",
void_type_node, 6, pvoid_type_node, integer_type_node,
pint_type, pchar_type_node, integer_type_node, size_type_node);
gfor_fndecl_co_min = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_co_min")), "W.WW",
+ get_identifier (PREFIX("caf_co_min")), ". w . w w . . ",
void_type_node, 6, pvoid_type_node, integer_type_node,
pint_type, pchar_type_node, integer_type_node, size_type_node);
gfor_fndecl_co_reduce = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_co_reduce")), "W.R.WW",
+ get_identifier (PREFIX("caf_co_reduce")), ". w r . . w w . . ",
void_type_node, 8, pvoid_type_node,
build_pointer_type (build_varargs_function_type_list (void_type_node,
NULL_TREE)),
@@ -4091,12 +4103,12 @@ gfc_build_builtin_function_decls (void)
integer_type_node, size_type_node);
gfor_fndecl_co_sum = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_co_sum")), "W.WW",
+ get_identifier (PREFIX("caf_co_sum")), ". w . w w . ",
void_type_node, 5, pvoid_type_node, integer_type_node,
pint_type, pchar_type_node, size_type_node);
gfor_fndecl_caf_is_present = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_is_present")), "RRR",
+ get_identifier (PREFIX("caf_is_present")), ". r . r ",
integer_type_node, 3, pvoid_type_node, integer_type_node,
pvoid_type_node);
}
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index e6385be2..5a6e696 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -728,7 +728,7 @@ gfc_conv_derived_to_class (gfc_se *parmse, gfc_expr *e,
gfc_expr *len;
gfc_se se;
- len = gfc_copy_expr (e);
+ len = gfc_find_and_cut_at_last_class_ref (e);
gfc_add_len_component (len);
gfc_init_se (&se, NULL);
gfc_conv_expr (&se, len);
@@ -739,6 +739,7 @@ gfc_conv_derived_to_class (gfc_se *parmse, gfc_expr *e,
integer_zero_node));
else
tmp = se.expr;
+ gfc_free_expr (len);
}
else
tmp = integer_zero_node;
@@ -6424,6 +6425,26 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
if (!finalized && !e->must_finalize)
{
+ bool scalar_res_outside_loop;
+ scalar_res_outside_loop = e->expr_type == EXPR_FUNCTION
+ && parm_rank == 0
+ && parmse.loop;
+
+ if (scalar_res_outside_loop)
+ {
+ /* Go through the ss chain to find the argument and use
+ the stored value. */
+ gfc_ss *tmp_ss = parmse.loop->ss;
+ for (; tmp_ss; tmp_ss = tmp_ss->next)
+ if (tmp_ss->info
+ && tmp_ss->info->expr == e
+ && tmp_ss->info->data.scalar.value != NULL_TREE)
+ {
+ tmp = tmp_ss->info->data.scalar.value;
+ break;
+ }
+ }
+
if ((e->ts.type == BT_CLASS
&& GFC_CLASS_TYPE_P (TREE_TYPE (tmp)))
|| e->ts.type == BT_DERIVED)
@@ -6432,7 +6453,11 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else if (e->ts.type == BT_CLASS)
tmp = gfc_deallocate_alloc_comp (CLASS_DATA (e)->ts.u.derived,
tmp, parm_rank);
- gfc_prepend_expr_to_block (&post, tmp);
+
+ if (scalar_res_outside_loop)
+ gfc_add_expr_to_block (&parmse.loop->post, tmp);
+ else
+ gfc_prepend_expr_to_block (&post, tmp);
}
}
@@ -9788,12 +9813,8 @@ arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2)
return true;
/* Functions returning pointers or allocatables need temporaries. */
- c = expr2->value.function.esym
- ? (expr2->value.function.esym->attr.pointer
- || expr2->value.function.esym->attr.allocatable)
- : (expr2->symtree->n.sym->attr.pointer
- || expr2->symtree->n.sym->attr.allocatable);
- if (c)
+ if (gfc_expr_attr (expr2).pointer
+ || gfc_expr_attr (expr2).allocatable)
return true;
/* Character array functions need temporaries unless the
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 2f58ce7..f9df1c9 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -4258,12 +4258,60 @@ gfc_get_symbol_for_expr (gfc_expr * expr, bool ignore_optional)
return sym;
}
+/* Remove empty actual arguments. */
+
+static void
+remove_empty_actual_arguments (gfc_actual_arglist **ap)
+{
+ while (*ap)
+ {
+ if ((*ap)->expr == NULL)
+ {
+ gfc_actual_arglist *r = *ap;
+ *ap = r->next;
+ r->next = NULL;
+ gfc_free_actual_arglist (r);
+ }
+ else
+ ap = &((*ap)->next);
+ }
+}
+
+/* Generate the right symbol for the specific intrinsic function and
+ modify the expr accordingly. This assumes that absent optional
+ arguments should be removed. FIXME: This should be extended for
+ procedures which do not ignore optional arguments (PR 97454). */
+
+gfc_symbol *
+specific_intrinsic_symbol (gfc_expr *expr)
+{
+ gfc_symbol *sym;
+
+ sym = gfc_find_intrinsic_symbol (expr);
+ if (sym == NULL)
+ {
+ sym = gfc_get_intrinsic_function_symbol (expr);
+ sym->ts = expr->ts;
+ if (sym->ts.type == BT_CHARACTER && sym->ts.u.cl)
+ sym->ts.u.cl = gfc_new_charlen (sym->ns, NULL);
+
+ gfc_copy_formal_args_intr (sym, expr->value.function.isym,
+ expr->value.function.actual, true);
+ sym->backend_decl
+ = gfc_get_extern_function_decl (sym, expr->value.function.actual);
+ }
+ remove_empty_actual_arguments (&(expr->value.function.actual));
+
+ return sym;
+}
+
/* Generate a call to an external intrinsic function. */
static void
gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
{
gfc_symbol *sym;
vec<tree, va_gc> *append_args;
+ bool specific_symbol;
gcc_assert (!se->ss || se->ss->info->expr == expr);
@@ -4272,7 +4320,28 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
else
gcc_assert (expr->rank == 0);
- sym = gfc_get_symbol_for_expr (expr, se->ignore_optional);
+ switch (expr->value.function.isym->id)
+ {
+ case GFC_ISYM_FINDLOC:
+ case GFC_ISYM_MAXLOC:
+ case GFC_ISYM_MINLOC:
+ case GFC_ISYM_MAXVAL:
+ case GFC_ISYM_MINVAL:
+ specific_symbol = true;
+ break;
+ default:
+ specific_symbol = false;
+ }
+
+ if (specific_symbol)
+ {
+ /* Need to copy here because specific_intrinsic_symbol modifies
+ expr to omit the absent optional arguments. */
+ expr = gfc_copy_expr (expr);
+ sym = specific_intrinsic_symbol (expr);
+ }
+ else
+ sym = gfc_get_symbol_for_expr (expr, se->ignore_optional);
/* Calls to libgfortran_matmul need to be appended special arguments,
to be able to call the BLAS ?gemm functions if required and possible. */
@@ -4322,7 +4391,11 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
gfc_conv_procedure_call (se, sym, expr->value.function.actual, expr,
append_args);
- gfc_free_symbol (sym);
+
+ if (specific_symbol)
+ gfc_free_expr (expr);
+ else
+ gfc_free_symbol (sym);
}
/* ANY and ALL intrinsics. ANY->op == NE_EXPR, ALL->op == EQ_EXPR.
@@ -5093,6 +5166,22 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr)
}
+/* Remove unneeded kind= argument from actual argument list when the
+ result conversion is dealt with in a different place. */
+
+static void
+strip_kind_from_actual (gfc_actual_arglist * actual)
+{
+ for (gfc_actual_arglist *a = actual; a; a = a->next)
+ {
+ if (a && a->name && strcmp (a->name, "kind") == 0)
+ {
+ gfc_free_expr (a->expr);
+ a->expr = NULL;
+ }
+ }
+}
+
/* Emit code for minloc or maxloc intrinsic. There are many different cases
we need to handle. For performance reasons we sometimes create two
loops instead of one, where the second one is much simpler.
@@ -5226,19 +5315,17 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, enum tree_code op)
if (arrayexpr->ts.type == BT_CHARACTER)
{
- gfc_actual_arglist *a, *b;
+ gfc_actual_arglist *a;
a = actual;
- while (a->next)
+ strip_kind_from_actual (a);
+ while (a)
{
- b = a->next;
- if (b->expr == NULL || strcmp (b->name, "dim") == 0)
+ if (a->name && strcmp (a->name, "dim") == 0)
{
- a->next = b->next;
- b->next = NULL;
- gfc_free_actual_arglist (b);
+ gfc_free_expr (a->expr);
+ a->expr = NULL;
}
- else
- a = b;
+ a = a->next;
}
gfc_conv_intrinsic_funcall (se, expr);
return;
@@ -5997,29 +6084,16 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, enum tree_code op)
if (arrayexpr->ts.type == BT_CHARACTER)
{
- gfc_actual_arglist *a2, *a3;
- a2 = actual->next; /* dim */
- a3 = a2->next; /* mask */
- if (a2->expr == NULL || expr->rank == 0)
+ gfc_actual_arglist *dim = actual->next;
+ if (expr->rank == 0 && dim->expr != 0)
{
- if (a3->expr == NULL)
- actual->next = NULL;
- else
- {
- actual->next = a3;
- a2->next = NULL;
- }
- gfc_free_actual_arglist (a2);
+ gfc_free_expr (dim->expr);
+ dim->expr = NULL;
}
- else
- if (a3->expr == NULL)
- {
- a2->next = NULL;
- gfc_free_actual_arglist (a3);
- }
gfc_conv_intrinsic_funcall (se, expr);
return;
}
+
type = gfc_typenode_for_spec (&expr->ts);
/* Initialize the result. */
limit = gfc_create_var (type, "limit");
@@ -11947,6 +12021,169 @@ conv_intrinsic_event_query (gfc_code *code)
return gfc_finish_block (&se.pre);
}
+
+/* This is a peculiar case because of the need to do dependency checking.
+ It is called via trans-stmt.c(gfc_trans_call), where it is picked out as
+ a special case and this function called instead of
+ gfc_conv_procedure_call. */
+void
+gfc_conv_intrinsic_mvbits (gfc_se *se, gfc_actual_arglist *actual_args,
+ gfc_loopinfo *loop)
+{
+ gfc_actual_arglist *actual;
+ gfc_se argse[5];
+ gfc_expr *arg[5];
+ gfc_ss *lss;
+ int n;
+
+ tree from, frompos, len, to, topos;
+ tree lenmask, oldbits, newbits, bitsize;
+ tree type, utype, above, mask1, mask2;
+
+ if (loop)
+ lss = loop->ss;
+ else
+ lss = gfc_ss_terminator;
+
+ actual = actual_args;
+ for (n = 0; n < 5; n++, actual = actual->next)
+ {
+ arg[n] = actual->expr;
+ gfc_init_se (&argse[n], NULL);
+
+ if (lss != gfc_ss_terminator)
+ {
+ gfc_copy_loopinfo_to_se (&argse[n], loop);
+ /* Find the ss for the expression if it is there. */
+ argse[n].ss = lss;
+ gfc_mark_ss_chain_used (lss, 1);
+ }
+
+ gfc_conv_expr (&argse[n], arg[n]);
+
+ if (loop)
+ lss = argse[n].ss;
+ }
+
+ from = argse[0].expr;
+ frompos = argse[1].expr;
+ len = argse[2].expr;
+ to = argse[3].expr;
+ topos = argse[4].expr;
+
+ /* The type of the result (TO). */
+ type = TREE_TYPE (to);
+ bitsize = build_int_cst (integer_type_node, TYPE_PRECISION (type));
+
+ /* Optionally generate code for runtime argument check. */
+ if (gfc_option.rtcheck & GFC_RTCHECK_BITS)
+ {
+ tree nbits, below, ccond;
+ tree fp = fold_convert (long_integer_type_node, frompos);
+ tree ln = fold_convert (long_integer_type_node, len);
+ tree tp = fold_convert (long_integer_type_node, topos);
+ below = fold_build2_loc (input_location, LT_EXPR,
+ logical_type_node, frompos,
+ build_int_cst (TREE_TYPE (frompos), 0));
+ above = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, frompos,
+ fold_convert (TREE_TYPE (frompos), bitsize));
+ ccond = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+ logical_type_node, below, above);
+ gfc_trans_runtime_check (true, false, ccond, &argse[1].pre,
+ &arg[1]->where,
+ "FROMPOS argument (%ld) out of range 0:%d "
+ "in intrinsic MVBITS", fp, bitsize);
+ below = fold_build2_loc (input_location, LT_EXPR,
+ logical_type_node, len,
+ build_int_cst (TREE_TYPE (len), 0));
+ above = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, len,
+ fold_convert (TREE_TYPE (len), bitsize));
+ ccond = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+ logical_type_node, below, above);
+ gfc_trans_runtime_check (true, false, ccond, &argse[2].pre,
+ &arg[2]->where,
+ "LEN argument (%ld) out of range 0:%d "
+ "in intrinsic MVBITS", ln, bitsize);
+ below = fold_build2_loc (input_location, LT_EXPR,
+ logical_type_node, topos,
+ build_int_cst (TREE_TYPE (topos), 0));
+ above = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, topos,
+ fold_convert (TREE_TYPE (topos), bitsize));
+ ccond = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+ logical_type_node, below, above);
+ gfc_trans_runtime_check (true, false, ccond, &argse[4].pre,
+ &arg[4]->where,
+ "TOPOS argument (%ld) out of range 0:%d "
+ "in intrinsic MVBITS", tp, bitsize);
+
+ /* The tests above ensure that FROMPOS, LEN and TOPOS fit into short
+ integers. Additions below cannot overflow. */
+ nbits = fold_convert (long_integer_type_node, bitsize);
+ above = fold_build2_loc (input_location, PLUS_EXPR,
+ long_integer_type_node, fp, ln);
+ ccond = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, above, nbits);
+ gfc_trans_runtime_check (true, false, ccond, &argse[1].pre,
+ &arg[1]->where,
+ "FROMPOS(%ld)+LEN(%ld)>BIT_SIZE(%d) "
+ "in intrinsic MVBITS", fp, ln, bitsize);
+ above = fold_build2_loc (input_location, PLUS_EXPR,
+ long_integer_type_node, tp, ln);
+ ccond = fold_build2_loc (input_location, GT_EXPR,
+ logical_type_node, above, nbits);
+ gfc_trans_runtime_check (true, false, ccond, &argse[4].pre,
+ &arg[4]->where,
+ "TOPOS(%ld)+LEN(%ld)>BIT_SIZE(%d) "
+ "in intrinsic MVBITS", tp, ln, bitsize);
+ }
+
+ for (n = 0; n < 5; n++)
+ {
+ gfc_add_block_to_block (&se->pre, &argse[n].pre);
+ gfc_add_block_to_block (&se->post, &argse[n].post);
+ }
+
+ /* lenmask = (LEN >= bit_size (TYPE)) ? ~(TYPE)0 : ((TYPE)1 << LEN) - 1 */
+ above = fold_build2_loc (input_location, GE_EXPR, logical_type_node,
+ len, fold_convert (TREE_TYPE (len), bitsize));
+ mask1 = build_int_cst (type, -1);
+ mask2 = fold_build2_loc (input_location, LSHIFT_EXPR, type,
+ build_int_cst (type, 1), len);
+ mask2 = fold_build2_loc (input_location, MINUS_EXPR, type,
+ mask2, build_int_cst (type, 1));
+ lenmask = fold_build3_loc (input_location, COND_EXPR, type,
+ above, mask1, mask2);
+
+ /* newbits = (((UTYPE)(FROM) >> FROMPOS) & lenmask) << TOPOS.
+ * For valid frompos+len <= bit_size(FROM) the conversion to unsigned is
+ * not strictly necessary; artificial bits from rshift will be masked. */
+ utype = unsigned_type_for (type);
+ newbits = fold_build2_loc (input_location, RSHIFT_EXPR, utype,
+ fold_convert (utype, from), frompos);
+ newbits = fold_build2_loc (input_location, BIT_AND_EXPR, type,
+ fold_convert (type, newbits), lenmask);
+ newbits = fold_build2_loc (input_location, LSHIFT_EXPR, type,
+ newbits, topos);
+
+ /* oldbits = TO & (~(lenmask << TOPOS)). */
+ oldbits = fold_build2_loc (input_location, LSHIFT_EXPR, type,
+ lenmask, topos);
+ oldbits = fold_build1_loc (input_location, BIT_NOT_EXPR, type, oldbits);
+ oldbits = fold_build2_loc (input_location, BIT_AND_EXPR, type, oldbits, to);
+
+ /* TO = newbits | oldbits. */
+ se->expr = fold_build2_loc (input_location, BIT_IOR_EXPR, type,
+ oldbits, newbits);
+
+ /* Return the assignment. */
+ se->expr = fold_build2_loc (input_location, MODIFY_EXPR,
+ void_type_node, to, se->expr);
+}
+
+
static tree
conv_intrinsic_move_alloc (gfc_code *code)
{
@@ -12279,6 +12516,10 @@ gfc_conv_intrinsic_subroutine (gfc_code *code)
res = conv_intrinsic_kill_sub (code);
break;
+ case GFC_ISYM_MVBITS:
+ res = NULL_TREE;
+ break;
+
case GFC_ISYM_SYSTEM_CLOCK:
res = conv_intrinsic_system_clock (code);
break;
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 21bdd5e..666dc37 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -328,165 +328,165 @@ gfc_build_io_library_fndecls (void)
dt_parm_type = build_pointer_type (st_parameter[IOPARM_ptype_dt].type);
iocall[IOCALL_X_INTEGER] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_integer")), ".wW",
+ get_identifier (PREFIX("transfer_integer")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_INTEGER_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_integer_write")), ".wR",
+ get_identifier (PREFIX("transfer_integer_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_LOGICAL] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_logical")), ".wW",
+ get_identifier (PREFIX("transfer_logical")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_LOGICAL_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_logical_write")), ".wR",
+ get_identifier (PREFIX("transfer_logical_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_CHARACTER] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_character")), ".wW",
+ get_identifier (PREFIX("transfer_character")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_charlen_type_node);
iocall[IOCALL_X_CHARACTER_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_character_write")), ".wR",
+ get_identifier (PREFIX("transfer_character_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_charlen_type_node);
iocall[IOCALL_X_CHARACTER_WIDE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_character_wide")), ".wW",
+ get_identifier (PREFIX("transfer_character_wide")), ". w W . . ",
void_type_node, 4, dt_parm_type, pvoid_type_node,
gfc_charlen_type_node, gfc_int4_type_node);
iocall[IOCALL_X_CHARACTER_WIDE_WRITE] =
gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_character_wide_write")), ".wR",
+ get_identifier (PREFIX("transfer_character_wide_write")), ". w R . . ",
void_type_node, 4, dt_parm_type, pvoid_type_node,
gfc_charlen_type_node, gfc_int4_type_node);
iocall[IOCALL_X_REAL] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_real")), ".wW",
+ get_identifier (PREFIX("transfer_real")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_REAL_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_real_write")), ".wR",
+ get_identifier (PREFIX("transfer_real_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_COMPLEX] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_complex")), ".wW",
+ get_identifier (PREFIX("transfer_complex")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_COMPLEX_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_complex_write")), ".wR",
+ get_identifier (PREFIX("transfer_complex_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
/* Version for __float128. */
iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_real128")), ".wW",
+ get_identifier (PREFIX("transfer_real128")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_REAL128_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_real128_write")), ".wR",
+ get_identifier (PREFIX("transfer_real128_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_complex128")), ".wW",
+ get_identifier (PREFIX("transfer_complex128")), ". w W . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_COMPLEX128_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_complex128_write")), ".wR",
+ get_identifier (PREFIX("transfer_complex128_write")), ". w R . ",
void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node);
iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_array")), ".ww",
+ get_identifier (PREFIX("transfer_array")), ". w w . . ",
void_type_node, 4, dt_parm_type, pvoid_type_node,
integer_type_node, gfc_charlen_type_node);
iocall[IOCALL_X_ARRAY_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_array_write")), ".wr",
+ get_identifier (PREFIX("transfer_array_write")), ". w r . . ",
void_type_node, 4, dt_parm_type, pvoid_type_node,
integer_type_node, gfc_charlen_type_node);
iocall[IOCALL_X_DERIVED] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("transfer_derived")), ".wrR",
- void_type_node, 2, dt_parm_type, pvoid_type_node, pchar_type_node);
+ get_identifier (PREFIX("transfer_derived")), ". w r ",
+ void_type_node, 2, dt_parm_type, pvoid_type_node);
/* Library entry points */
iocall[IOCALL_READ] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_read")), ".w",
+ get_identifier (PREFIX("st_read")), ". w ",
void_type_node, 1, dt_parm_type);
iocall[IOCALL_WRITE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_write")), ".w",
+ get_identifier (PREFIX("st_write")), ". w ",
void_type_node, 1, dt_parm_type);
parm_type = build_pointer_type (st_parameter[IOPARM_ptype_open].type);
iocall[IOCALL_OPEN] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_open")), ".w",
+ get_identifier (PREFIX("st_open")), ". w ",
void_type_node, 1, parm_type);
parm_type = build_pointer_type (st_parameter[IOPARM_ptype_close].type);
iocall[IOCALL_CLOSE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_close")), ".w",
+ get_identifier (PREFIX("st_close")), ". w ",
void_type_node, 1, parm_type);
parm_type = build_pointer_type (st_parameter[IOPARM_ptype_inquire].type);
iocall[IOCALL_INQUIRE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_inquire")), ".w",
+ get_identifier (PREFIX("st_inquire")), ". w ",
void_type_node, 1, parm_type);
iocall[IOCALL_IOLENGTH] = gfc_build_library_function_decl_with_spec(
- get_identifier (PREFIX("st_iolength")), ".w",
+ get_identifier (PREFIX("st_iolength")), ". w ",
void_type_node, 1, dt_parm_type);
parm_type = build_pointer_type (st_parameter[IOPARM_ptype_wait].type);
iocall[IOCALL_WAIT] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_wait_async")), ".w",
+ get_identifier (PREFIX("st_wait_async")), ". w ",
void_type_node, 1, parm_type);
parm_type = build_pointer_type (st_parameter[IOPARM_ptype_filepos].type);
iocall[IOCALL_REWIND] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_rewind")), ".w",
+ get_identifier (PREFIX("st_rewind")), ". w ",
void_type_node, 1, parm_type);
iocall[IOCALL_BACKSPACE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_backspace")), ".w",
+ get_identifier (PREFIX("st_backspace")), ". w ",
void_type_node, 1, parm_type);
iocall[IOCALL_ENDFILE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_endfile")), ".w",
+ get_identifier (PREFIX("st_endfile")), ". w ",
void_type_node, 1, parm_type);
iocall[IOCALL_FLUSH] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_flush")), ".w",
+ get_identifier (PREFIX("st_flush")), ". w ",
void_type_node, 1, parm_type);
/* Library helpers */
iocall[IOCALL_READ_DONE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_read_done")), ".w",
+ get_identifier (PREFIX("st_read_done")), ". w ",
void_type_node, 1, dt_parm_type);
iocall[IOCALL_WRITE_DONE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_write_done")), ".w",
+ get_identifier (PREFIX("st_write_done")), ". w ",
void_type_node, 1, dt_parm_type);
iocall[IOCALL_IOLENGTH_DONE] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_iolength_done")), ".w",
+ get_identifier (PREFIX("st_iolength_done")), ". w ",
void_type_node, 1, dt_parm_type);
iocall[IOCALL_SET_NML_VAL] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_set_nml_var")), ".w.R",
+ get_identifier (PREFIX("st_set_nml_var")), ". w . R . . . ",
void_type_node, 6, dt_parm_type, pvoid_type_node, pvoid_type_node,
gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node());
iocall[IOCALL_SET_NML_DTIO_VAL] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_set_nml_dtio_var")), ".w.R",
+ get_identifier (PREFIX("st_set_nml_dtio_var")), ". w . R . . . . . ",
void_type_node, 8, dt_parm_type, pvoid_type_node, pvoid_type_node,
gfc_int4_type_node, gfc_charlen_type_node, get_dtype_type_node(),
pvoid_type_node, pvoid_type_node);
iocall[IOCALL_SET_NML_VAL_DIM] = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("st_set_nml_var_dim")), ".w",
+ get_identifier (PREFIX("st_set_nml_var_dim")), ". w . . . . ",
void_type_node, 5, dt_parm_type, gfc_int4_type_node,
gfc_array_index_type, gfc_array_index_type, gfc_array_index_type);
}
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 378088a..bd7e13d 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see
#include "gomp-constants.h"
#include "omp-general.h"
#include "omp-low.h"
+#include "memmodel.h" /* For MEMMODEL_ enums. */
+
#undef GCC_DIAG_STYLE
#define GCC_DIAG_STYLE __gcc_tdiag__
#include "diagnostic-core.h"
@@ -4785,10 +4787,30 @@ gfc_trans_oacc_combined_directive (gfc_code *code)
}
static tree
-gfc_trans_omp_flush (void)
+gfc_trans_omp_flush (gfc_code *code)
{
- tree decl = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
- return build_call_expr_loc (input_location, decl, 0);
+ tree call;
+ if (!code->ext.omp_clauses
+ || code->ext.omp_clauses->memorder == OMP_MEMORDER_LAST)
+ {
+ call = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
+ call = build_call_expr_loc (input_location, call, 0);
+ }
+ else
+ {
+ enum memmodel mo = MEMMODEL_LAST;
+ switch (code->ext.omp_clauses->memorder)
+ {
+ case OMP_MEMORDER_ACQ_REL: mo = MEMMODEL_ACQ_REL; break;
+ case OMP_MEMORDER_RELEASE: mo = MEMMODEL_RELEASE; break;
+ case OMP_MEMORDER_ACQUIRE: mo = MEMMODEL_ACQUIRE; break;
+ default: gcc_unreachable (); break;
+ }
+ call = builtin_decl_explicit (BUILT_IN_ATOMIC_THREAD_FENCE);
+ call = build_call_expr_loc (input_location, call, 1,
+ build_int_cst (integer_type_node, mo));
+ }
+ return call;
}
static tree
@@ -6033,7 +6055,7 @@ gfc_trans_omp_directive (gfc_code *code)
case EXEC_OMP_DO_SIMD:
return gfc_trans_omp_do_simd (code, NULL, NULL, NULL_TREE);
case EXEC_OMP_FLUSH:
- return gfc_trans_omp_flush ();
+ return gfc_trans_omp_flush (code);
case EXEC_OMP_MASTER:
return gfc_trans_omp_master (code);
case EXEC_OMP_ORDERED:
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 67cba1d..f4c3ed6 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -198,6 +198,13 @@ replace_ss (gfc_se *se, gfc_ss *old_ss, gfc_ss *new_ss)
*sess = new_ss;
new_ss->next = old_ss->next;
+ /* Make sure that trailing references are not lost. */
+ if (old_ss->info
+ && old_ss->info->data.array.ref
+ && old_ss->info->data.array.ref->next
+ && !(new_ss->info->data.array.ref
+ && new_ss->info->data.array.ref->next))
+ new_ss->info->data.array.ref = old_ss->info->data.array.ref;
for (loopss = &(se->loop->ss); *loopss != gfc_ss_terminator;
loopss = &((*loopss)->loop_chain))
@@ -383,6 +390,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check,
tree index = NULL_TREE;
tree maskexpr = NULL_TREE;
tree tmp;
+ bool is_intrinsic_mvbits;
/* A CALL starts a new block because the actual arguments may have to
be evaluated first. */
@@ -397,17 +405,29 @@ gfc_trans_call (gfc_code * code, bool dependency_check,
get_proc_ifc_for_call (code),
GFC_SS_REFERENCE);
+ /* MVBITS is inlined but needs the dependency checking found here. */
+ is_intrinsic_mvbits = code->resolved_isym
+ && code->resolved_isym->id == GFC_ISYM_MVBITS;
+
/* Is not an elemental subroutine call with array valued arguments. */
if (ss == gfc_ss_terminator)
{
- /* Translate the call. */
- has_alternate_specifier
- = gfc_conv_procedure_call (&se, code->resolved_sym, code->ext.actual,
- code->expr1, NULL);
+ if (is_intrinsic_mvbits)
+ {
+ has_alternate_specifier = 0;
+ gfc_conv_intrinsic_mvbits (&se, code->ext.actual, NULL);
+ }
+ else
+ {
+ /* Translate the call. */
+ has_alternate_specifier =
+ gfc_conv_procedure_call (&se, code->resolved_sym,
+ code->ext.actual, code->expr1, NULL);
- /* A subroutine without side-effect, by definition, does nothing! */
- TREE_SIDE_EFFECTS (se.expr) = 1;
+ /* A subroutine without side-effect, by definition, does nothing! */
+ TREE_SIDE_EFFECTS (se.expr) = 1;
+ }
/* Chain the pieces together and return the block. */
if (has_alternate_specifier)
@@ -490,10 +510,18 @@ gfc_trans_call (gfc_code * code, bool dependency_check,
TREE_TYPE (maskexpr), maskexpr);
}
- /* Add the subroutine call to the block. */
- gfc_conv_procedure_call (&loopse, code->resolved_sym,
- code->ext.actual, code->expr1,
- NULL);
+ if (is_intrinsic_mvbits)
+ {
+ has_alternate_specifier = 0;
+ gfc_conv_intrinsic_mvbits (&loopse, code->ext.actual, &loop);
+ }
+ else
+ {
+ /* Add the subroutine call to the block. */
+ gfc_conv_procedure_call (&loopse, code->resolved_sym,
+ code->ext.actual, code->expr1,
+ NULL);
+ }
if (mask && count1)
{
@@ -2107,6 +2135,7 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
/* Obtain a temporary class container for the result. */
gfc_conv_derived_to_class (&se, e, sym->ts, tmp, false, false);
se.expr = build_fold_indirect_ref_loc (input_location, se.expr);
+ need_len_assign = false;
}
else
{
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index e586633..6b8589d74 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2257,7 +2257,8 @@ gfc_sym_type (gfc_symbol * sym)
else
type = gfc_typenode_for_spec (&sym->ts, sym->attr.codimension);
- if (sym->attr.dummy && !sym->attr.function && !sym->attr.value)
+ if (sym->attr.dummy && !sym->attr.function && !sym->attr.value
+ && !sym->pass_as_value)
byref = 1;
else
byref = 0;
@@ -2955,20 +2956,33 @@ create_fn_spec (gfc_symbol *sym, tree fntype)
memset (&spec, 0, sizeof (spec));
spec[0] = '.';
- spec_len = 1;
+ spec[1] = ' ';
+ spec_len = 2;
if (sym->attr.entry_master)
- spec[spec_len++] = 'R';
+ {
+ spec[spec_len++] = 'R';
+ spec[spec_len++] = ' ';
+ }
if (gfc_return_by_reference (sym))
{
gfc_symbol *result = sym->result ? sym->result : sym;
if (result->attr.pointer || sym->attr.proc_pointer)
- spec[spec_len++] = '.';
+ {
+ spec[spec_len++] = '.';
+ spec[spec_len++] = ' ';
+ }
else
- spec[spec_len++] = 'w';
+ {
+ spec[spec_len++] = 'w';
+ spec[spec_len++] = ' ';
+ }
if (sym->ts.type == BT_CHARACTER)
- spec[spec_len++] = 'R';
+ {
+ spec[spec_len++] = 'R';
+ spec[spec_len++] = ' ';
+ }
}
for (f = gfc_sym_get_dummy_args (sym); f; f = f->next)
@@ -2983,11 +2997,20 @@ create_fn_spec (gfc_symbol *sym, tree fntype)
&& (CLASS_DATA (f->sym)->ts.u.derived->attr.proc_pointer_comp
|| CLASS_DATA (f->sym)->ts.u.derived->attr.pointer_comp))
|| (f->sym->ts.type == BT_INTEGER && f->sym->ts.is_c_interop))
- spec[spec_len++] = '.';
+ {
+ spec[spec_len++] = '.';
+ spec[spec_len++] = ' ';
+ }
else if (f->sym->attr.intent == INTENT_IN)
- spec[spec_len++] = 'r';
+ {
+ spec[spec_len++] = 'r';
+ spec[spec_len++] = ' ';
+ }
else if (f->sym)
- spec[spec_len++] = 'w';
+ {
+ spec[spec_len++] = 'w';
+ spec[spec_len++] = ' ';
+ }
}
tmp = build_tree_list (NULL_TREE, build_string (spec_len, spec));
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 6815b17..f1c8f0e 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -445,7 +445,28 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr)
/* If decl or vptr are non-null, pointer arithmetic for the array reference
is likely. Generate the 'span' for the array reference. */
if (vptr)
- span = gfc_vptr_size_get (vptr);
+ {
+ span = gfc_vptr_size_get (vptr);
+
+ /* Check if this is an unlimited polymorphic object carrying a character
+ payload. In this case, the 'len' field is non-zero. */
+ if (decl && GFC_CLASS_TYPE_P (TREE_TYPE (decl)))
+ {
+ tmp = gfc_class_len_or_zero_get (decl);
+ if (!integer_zerop (tmp))
+ {
+ tree cond;
+ tree stype = TREE_TYPE (span);
+ tmp = fold_convert (stype, tmp);
+ cond = fold_build2_loc (input_location, EQ_EXPR,
+ logical_type_node, tmp,
+ build_int_cst (stype, 0));
+ tmp = fold_build2 (MULT_EXPR, stype, span, tmp);
+ span = fold_build3_loc (input_location, COND_EXPR, stype,
+ cond, span, tmp);
+ }
+ }
+ }
else if (decl)
span = get_array_span (type, decl);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index b49ba32..eef90f6 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -821,6 +821,10 @@ bool gfc_omp_private_outer_ref (tree);
struct gimplify_omp_ctx;
void gfc_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, tree);
+/* In trans-intrinsic.c. */
+void gfc_conv_intrinsic_mvbits (gfc_se *, gfc_actual_arglist *,
+ gfc_loopinfo *);
+
/* Runtime library function decls. */
extern GTY(()) tree gfor_fndecl_pause_numeric;
extern GTY(()) tree gfor_fndecl_pause_string;
diff --git a/gcc/function.c b/gcc/function.c
index c612959..f903a1e 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2846,7 +2846,7 @@ assign_parm_adjust_stack_rtl (struct assign_parm_data_one *data)
/* If stack protection is in effect for this function, don't leave any
pointers in their passed stack slots. */
else if (crtl->stack_protect_guard
- && (flag_stack_protect == 2
+ && (flag_stack_protect == SPCT_FLAG_ALL
|| data->arg.pass_by_reference
|| POINTER_TYPE_P (data->nominal_type)))
stack_parm = NULL;
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 531f4e0..cdf4d4f 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -416,6 +416,7 @@ static void try_generate_repro (const char **argv);
static const char *getenv_spec_function (int, const char **);
static const char *if_exists_spec_function (int, const char **);
static const char *if_exists_else_spec_function (int, const char **);
+static const char *if_exists_then_else_spec_function (int, const char **);
static const char *sanitize_spec_function (int, const char **);
static const char *replace_outfile_spec_function (int, const char **);
static const char *remove_outfile_spec_function (int, const char **);
@@ -430,6 +431,7 @@ static const char *pass_through_libs_spec_func (int, const char **);
static const char *dumps_spec_func (int, const char **);
static const char *greater_than_spec_func (int, const char **);
static const char *debug_level_greater_than_spec_func (int, const char **);
+static const char *dwarf_version_greater_than_spec_func (int, const char **);
static const char *find_fortran_preinclude_file (int, const char **);
static char *convert_white_space (char *);
static char *quote_spec (char *);
@@ -876,22 +878,39 @@ proper position among the other output files. */
#endif /* HAVE_LD_COMPRESS_DEBUG >= 2 */
/* Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g'
- to the assembler. */
+ to the assembler, when compiling assembly sources only. */
#ifndef ASM_DEBUG_SPEC
+# if defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) && defined(HAVE_AS_WORKING_DWARF_N_FLAG)
+/* If --gdwarf-N is supported and as can handle even compiler generated
+ .debug_line with it, supply --gdwarf-N in ASM_DEBUG_OPTION_SPEC rather
+ than in ASM_DEBUG_SPEC, so that it applies to both .s and .c etc.
+ compilations. */
+# define ASM_DEBUG_DWARF_OPTION ""
+# elif defined(HAVE_AS_GDWARF_5_DEBUG_FLAG)
+# define ASM_DEBUG_DWARF_OPTION "%{%:dwarf-version-gt(4):--gdwarf-5;" \
+ "%:dwarf-version-gt(3):--gdwarf-4;" \
+ "%:dwarf-version-gt(2):--gdwarf-3;" \
+ ":--gdwarf2}"
+# else
+# define ASM_DEBUG_DWARF_OPTION "--gdwarf2"
+# endif
# if defined(DBX_DEBUGGING_INFO) && defined(DWARF2_DEBUGGING_INFO) \
&& defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
# define ASM_DEBUG_SPEC \
(PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \
? "%{%:debug-level-gt(0):" \
- "%{gdwarf*:--gdwarf2}%{!gdwarf*:%{g*:--gstabs}}}" ASM_MAP \
+ "%{gdwarf*:" ASM_DEBUG_DWARF_OPTION "};" \
+ ":%{g*:--gstabs}}" ASM_MAP \
: "%{%:debug-level-gt(0):" \
- "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP)
+ "%{gstabs*:--gstabs;" \
+ ":%{g*:" ASM_DEBUG_DWARF_OPTION "}}}" ASM_MAP)
# else
# if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG)
# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):--gstabs}}" ASM_MAP
# endif
# if defined(DWARF2_DEBUGGING_INFO) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG)
-# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):--gdwarf2}}" ASM_MAP
+# define ASM_DEBUG_SPEC "%{g*:%{%:debug-level-gt(0):" \
+ ASM_DEBUG_DWARF_OPTION "}}" ASM_MAP
# endif
# endif
#endif
@@ -899,6 +918,32 @@ proper position among the other output files. */
# define ASM_DEBUG_SPEC ""
#endif
+/* Define ASM_DEBUG_OPTION_SPEC to be a spec suitable for translating '-g'
+ to the assembler when compiling all sources. */
+#ifndef ASM_DEBUG_OPTION_SPEC
+# if defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) && defined(HAVE_AS_WORKING_DWARF_N_FLAG)
+# define ASM_DEBUG_OPTION_DWARF_OPT \
+ "%{%:dwarf-version-gt(4):--gdwarf-5 ;" \
+ "%:dwarf-version-gt(3):--gdwarf-4 ;" \
+ "%:dwarf-version-gt(2):--gdwarf-3 ;" \
+ ":--gdwarf2 }"
+# if defined(DBX_DEBUGGING_INFO) && defined(DWARF2_DEBUGGING_INFO)
+# define ASM_DEBUG_OPTION_SPEC \
+ (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \
+ ? "%{%:debug-level-gt(0):" \
+ "%{gdwarf*:" ASM_DEBUG_OPTION_DWARF_OPT "}}" \
+ : "%{%:debug-level-gt(0):" \
+ "%{!gstabs*:%{g*:" ASM_DEBUG_OPTION_DWARF_OPT "}}}")
+# elif defined(DWARF2_DEBUGGING_INFO)
+# define ASM_DEBUG_OPTION_SPEC "%{g*:%{%:debug-level-gt(0):" \
+ ASM_DEBUG_OPTION_DWARF_OPT "}}"
+# endif
+# endif
+#endif
+#ifndef ASM_DEBUG_OPTION_SPEC
+# define ASM_DEBUG_OPTION_SPEC ""
+#endif
+
/* Here is the spec for running the linker, after compiling all files. */
/* This is overridable by the target in case they need to specify the
@@ -1113,6 +1158,7 @@ proper position among the other output files. */
#endif
static const char *asm_debug = ASM_DEBUG_SPEC;
+static const char *asm_debug_option = ASM_DEBUG_OPTION_SPEC;
static const char *cpp_spec = CPP_SPEC;
static const char *cc1_spec = CC1_SPEC;
static const char *cc1plus_spec = CC1PLUS_SPEC;
@@ -1212,6 +1258,7 @@ static const char *asm_options =
to the assembler equivalents. */
"%{v} %{w:-W} %{I*} "
#endif
+"%(asm_debug_option)"
ASM_COMPRESS_DEBUG_SPEC
"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
@@ -1608,6 +1655,7 @@ static struct spec_list static_specs[] =
{
INIT_STATIC_SPEC ("asm", &asm_spec),
INIT_STATIC_SPEC ("asm_debug", &asm_debug),
+ INIT_STATIC_SPEC ("asm_debug_option", &asm_debug_option),
INIT_STATIC_SPEC ("asm_final", &asm_final_spec),
INIT_STATIC_SPEC ("asm_options", &asm_options),
INIT_STATIC_SPEC ("invoke_as", &invoke_as),
@@ -1676,6 +1724,7 @@ static const struct spec_function static_spec_functions[] =
{ "getenv", getenv_spec_function },
{ "if-exists", if_exists_spec_function },
{ "if-exists-else", if_exists_else_spec_function },
+ { "if-exists-then-else", if_exists_then_else_spec_function },
{ "sanitize", sanitize_spec_function },
{ "replace-outfile", replace_outfile_spec_function },
{ "remove-outfile", remove_outfile_spec_function },
@@ -1690,6 +1739,7 @@ static const struct spec_function static_spec_functions[] =
{ "dumps", dumps_spec_func },
{ "gt", greater_than_spec_func },
{ "debug-level-gt", debug_level_greater_than_spec_func },
+ { "dwarf-version-gt", dwarf_version_greater_than_spec_func },
{ "fortran-preinclude-file", find_fortran_preinclude_file},
#ifdef EXTRA_SPEC_FUNCTIONS
EXTRA_SPEC_FUNCTIONS
@@ -10039,6 +10089,29 @@ if_exists_else_spec_function (int argc, const char **argv)
return argv[1];
}
+/* if-exists-then-else built-in spec function.
+
+ Checks to see if the file specified by the absolute pathname in
+ the first arg exists. Returns the second arg if so, otherwise returns
+ the third arg if it is present. */
+
+static const char *
+if_exists_then_else_spec_function (int argc, const char **argv)
+{
+
+ /* Must have two or three arguments. */
+ if (argc != 2 && argc != 3)
+ return NULL;
+
+ if (IS_ABSOLUTE_PATH (argv[0]) && ! access (argv[0], R_OK))
+ return argv[1];
+
+ if (argc == 3)
+ return argv[2];
+
+ return NULL;
+}
+
/* sanitize built-in spec function.
This returns non-NULL, if sanitizing address, thread or
@@ -10614,6 +10687,27 @@ debug_level_greater_than_spec_func (int argc, const char **argv)
return NULL;
}
+/* Returns "" if dwarf_version is greater than ARGV[ARGC-1].
+ Otherwise, return NULL. */
+
+static const char *
+dwarf_version_greater_than_spec_func (int argc, const char **argv)
+{
+ char *converted;
+
+ if (argc != 1)
+ fatal_error (input_location,
+ "wrong number of arguments to %%:dwarf-version-gt");
+
+ long arg = strtol (argv[0], &converted, 10);
+ gcc_assert (converted != argv[0]);
+
+ if (dwarf_version > arg)
+ return "";
+
+ return NULL;
+}
+
static void
path_prefix_reset (path_prefix *prefix)
{
diff --git a/gcc/gcov.c b/gcc/gcov.c
index b302e21..36938bd 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -1940,6 +1940,7 @@ read_count_file (void)
while ((tag = gcov_read_unsigned ()))
{
unsigned length = gcov_read_unsigned ();
+ int read_length = (int)length;
unsigned long base = gcov_position ();
if (tag == GCOV_TAG_OBJECT_SUMMARY)
@@ -1972,7 +1973,6 @@ read_count_file (void)
}
else if (tag == GCOV_TAG_FOR_COUNTER (GCOV_COUNTER_ARCS) && fn)
{
- int read_length = (int)length;
length = abs (read_length);
if (length != GCOV_TAG_COUNTER_LENGTH (fn->counts.size ()))
goto mismatch;
@@ -1980,10 +1980,10 @@ read_count_file (void)
if (read_length > 0)
for (ix = 0; ix != fn->counts.size (); ix++)
fn->counts[ix] += gcov_read_counter ();
- else
- length = 0;
}
- gcov_sync (base, length);
+ if (read_length < 0)
+ read_length = 0;
+ gcov_sync (base, read_length);
if ((error = gcov_is_error ()))
{
fnotice (stderr,
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index a59a882..dd21ade 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1726,7 +1726,8 @@ open_base_files (void)
"except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h",
"target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h",
"ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", "omp-general.h",
- "omp-offload.h", "ipa-modref-tree.h", "ipa-modref.h", NULL
+ "omp-offload.h", "ipa-modref-tree.h", "ipa-modref.h", "symtab-thunks.h",
+ NULL
};
const char *const *ifp;
outf_p gtype_desc_c;
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 94da02f..571c50e 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -742,7 +742,7 @@ ggc_rlimit_bound (double limit)
appears to be ignored. Ignore such silliness. If a limit
this small was actually effective for mmap, GCC wouldn't even
start up. */
- && rlim.rlim_cur >= 8 * 1024 * 1024)
+ && rlim.rlim_cur >= 8 * ONE_M)
limit = rlim.rlim_cur;
# endif /* RLIMIT_AS or RLIMIT_DATA */
#endif /* HAVE_GETRLIMIT */
@@ -761,7 +761,7 @@ ggc_min_expand_heuristic (void)
/* The heuristic is a percentage equal to 30% + 70%*(RAM/1GB), yielding
a lower bound of 30% and an upper bound of 100% (when RAM >= 1GB). */
- min_expand /= 1024*1024*1024;
+ min_expand /= ONE_G;
min_expand *= 70;
min_expand = MIN (min_expand, 70);
min_expand += 30;
@@ -776,8 +776,8 @@ ggc_min_heapsize_heuristic (void)
double phys_kbytes = physmem_total ();
double limit_kbytes = ggc_rlimit_bound (phys_kbytes * 2);
- phys_kbytes /= 1024; /* Convert to Kbytes. */
- limit_kbytes /= 1024;
+ phys_kbytes /= ONE_K; /* Convert to Kbytes. */
+ limit_kbytes /= ONE_K;
/* The heuristic is RAM/8, with a lower bound of 4M and an upper
bound of 128M (when RAM >= 1GB). */
@@ -790,7 +790,7 @@ ggc_min_heapsize_heuristic (void)
struct rlimit rlim;
if (getrlimit (RLIMIT_RSS, &rlim) == 0
&& rlim.rlim_cur != (rlim_t) RLIM_INFINITY)
- phys_kbytes = MIN (phys_kbytes, rlim.rlim_cur / 1024);
+ phys_kbytes = MIN (phys_kbytes, rlim.rlim_cur / ONE_K);
}
# endif
@@ -798,12 +798,12 @@ ggc_min_heapsize_heuristic (void)
*next* GC would be within 20Mb of the limit or within a quarter of
the limit, whichever is larger. If GCC does hit the data limit,
compilation will fail, so this tries to be conservative. */
- limit_kbytes = MAX (0, limit_kbytes - MAX (limit_kbytes / 4, 20 * 1024));
+ limit_kbytes = MAX (0, limit_kbytes - MAX (limit_kbytes / 4, 20 * ONE_K));
limit_kbytes = (limit_kbytes * 100) / (110 + ggc_min_expand_heuristic ());
phys_kbytes = MIN (phys_kbytes, limit_kbytes);
- phys_kbytes = MAX (phys_kbytes, 4 * 1024);
- phys_kbytes = MIN (phys_kbytes, 128 * 1024);
+ phys_kbytes = MAX (phys_kbytes, 4 * ONE_K);
+ phys_kbytes = MIN (phys_kbytes, 128 * ONE_K);
return phys_kbytes;
}
@@ -1008,13 +1008,19 @@ ggc_prune_overhead_list (void)
}
}
-/* Return memory used by heap in kb, 0 if this info is not available. */
+/* Print memory used by heap if this info is available. */
void
report_heap_memory_use ()
{
-#ifdef HAVE_MALLINFO
+#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
+#ifdef HAVE_MALLINFO2
+ #define MALLINFO_FN mallinfo2
+#else
+ #define MALLINFO_FN mallinfo
+#endif
if (!quiet_flag)
- fprintf (stderr," {heap %luk}", (unsigned long)(mallinfo().arena / 1024));
+ fprintf (stderr, " {heap " PRsa (0) "}",
+ SIZE_AMOUNT (MALLINFO_FN ().arena));
#endif
}
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 53b311c..07e108f 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -1164,9 +1164,9 @@ release_pages (void)
{
fprintf (stderr, " {GC");
if (n1)
- fprintf (stderr, " released %luk", (unsigned long)(n1 / 1024));
+ fprintf (stderr, " released " PRsa (0), SIZE_AMOUNT (n1));
if (n2)
- fprintf (stderr, " madv_dontneed %luk", (unsigned long)(n2 / 1024));
+ fprintf (stderr, " madv_dontneed " PRsa (0), SIZE_AMOUNT (n2));
fprintf (stderr, "}");
}
}
@@ -2184,7 +2184,7 @@ ggc_collect (void)
total allocations haven't expanded much since the last
collection. */
float allocated_last_gc =
- MAX (G.allocated_last_gc, (size_t)param_ggc_min_heapsize * 1024);
+ MAX (G.allocated_last_gc, (size_t)param_ggc_min_heapsize * ONE_K);
/* It is also good time to get memory block pool into limits. */
memory_block_pool::trim ();
@@ -2208,7 +2208,7 @@ ggc_collect (void)
/* Output this later so we do not interfere with release_pages. */
if (!quiet_flag)
- fprintf (stderr, " {GC %luk -> ", (unsigned long) allocated / 1024);
+ fprintf (stderr, " {GC " PRsa (0) " -> ", SIZE_AMOUNT (allocated));
/* Indicate that we've seen collections at this context depth. */
G.context_depth_collections = ((unsigned long)1 << (G.context_depth + 1)) - 1;
@@ -2235,7 +2235,7 @@ ggc_collect (void)
timevar_pop (TV_GC);
if (!quiet_flag)
- fprintf (stderr, "%luk}", (unsigned long) G.allocated / 1024);
+ fprintf (stderr, PRsa (0) "}", SIZE_AMOUNT (G.allocated));
if (GGC_DEBUG_LEVEL >= 2)
fprintf (G.debug_file, "END COLLECTING\n");
}
@@ -2250,9 +2250,8 @@ ggc_trim ()
sweep_pages ();
release_pages ();
if (!quiet_flag)
- fprintf (stderr, " {GC trimmed to %luk, %luk mapped}",
- (unsigned long) G.allocated / 1024,
- (unsigned long) G.bytes_mapped / 1024);
+ fprintf (stderr, " {GC trimmed to " PRsa (0) ", " PRsa (0) " mapped}",
+ SIZE_AMOUNT (G.allocated), SIZE_AMOUNT (G.bytes_mapped));
timevar_pop (TV_GC);
}
@@ -2269,7 +2268,7 @@ ggc_grow (void)
else
ggc_collect ();
if (!quiet_flag)
- fprintf (stderr, " {GC %luk} ", (unsigned long) G.allocated / 1024);
+ fprintf (stderr, " {GC " PRsa (0) "} ", SIZE_AMOUNT (G.allocated));
}
void
diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc
index b93ef7a..456a7cb 100644
--- a/gcc/gimple-array-bounds.cc
+++ b/gcc/gimple-array-bounds.cc
@@ -188,7 +188,7 @@ array_bounds_checker::check_array_ref (location_t location, tree ref,
tree decl = NULL_TREE;
/* Set for accesses to interior zero-length arrays. */
- bool interior_zero_len = false;
+ special_array_member sam{ };
tree up_bound_p1;
@@ -220,7 +220,7 @@ array_bounds_checker::check_array_ref (location_t location, tree ref,
{
/* Try to determine the size of the trailing array from
its initializer (if it has one). */
- if (tree refsize = component_ref_size (arg, &interior_zero_len))
+ if (tree refsize = component_ref_size (arg, &sam))
if (TREE_CODE (refsize) == INTEGER_CST)
maxbound = refsize;
}
@@ -325,7 +325,7 @@ array_bounds_checker::check_array_ref (location_t location, tree ref,
"array subscript %E is below array bounds of %qT",
low_sub, artype);
- if (!warned && interior_zero_len)
+ if (!warned && sam == special_array_member::int_0)
warned = warning_at (location, OPT_Wzero_length_bounds,
(TREE_CODE (low_sub) == INTEGER_CST
? G_("array subscript %E is outside the bounds "
@@ -372,6 +372,20 @@ array_bounds_checker::check_array_ref (location_t location, tree ref,
return warned;
}
+/* Hack around the internal representation constraints and build a zero
+ element array type that actually renders as T[0] in diagnostcs. */
+
+static tree
+build_zero_elt_array_type (tree eltype)
+{
+ tree idxtype = build_range_type (sizetype, size_zero_node, NULL_TREE);
+ tree arrtype = build_array_type (eltype, idxtype);
+ arrtype = build_distinct_type_copy (TYPE_MAIN_VARIANT (arrtype));
+ TYPE_SIZE (arrtype) = bitsize_zero_node;
+ TYPE_SIZE_UNIT (arrtype) = size_zero_node;
+ return arrtype;
+}
+
/* Checks one MEM_REF in REF, located at LOCATION, for out-of-bounds
references to string constants. If VRP can determine that the array
subscript is a constant, check if it is outside valid range.
@@ -547,7 +561,10 @@ array_bounds_checker::check_mem_ref (location_t location, tree ref,
return false;
offset_int nelts = arrbounds[1] / eltsize;
- reftype = build_array_type_nelts (reftype, nelts.to_uhwi ());
+ if (nelts == 0)
+ reftype = build_zero_elt_array_type (reftype);
+ else
+ reftype = build_array_type_nelts (reftype, nelts.to_uhwi ());
}
else if (TREE_CODE (arg) == ADDR_EXPR)
{
diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc
index b330cf4..b64e31f 100644
--- a/gcc/gimple-isel.cc
+++ b/gcc/gimple-isel.cc
@@ -35,6 +35,74 @@ along with GCC; see the file COPYING3. If not see
#include "tree-cfg.h"
#include "bitmap.h"
#include "tree-ssa-dce.h"
+#include "memmodel.h"
+#include "optabs.h"
+
+/* Expand all ARRAY_REF(VIEW_CONVERT_EXPR) gimple assignments into calls to
+ internal function based on vector type of selected expansion.
+ i.e.:
+ VIEW_CONVERT_EXPR<int[4]>(u)[_1] = = i_4(D);
+ =>
+ _7 = u;
+ _8 = .VEC_SET (_7, i_4(D), _1);
+ u = _8; */
+
+static gimple *
+gimple_expand_vec_set_expr (gimple_stmt_iterator *gsi)
+{
+ enum tree_code code;
+ gcall *new_stmt = NULL;
+ gassign *ass_stmt = NULL;
+
+ /* Only consider code == GIMPLE_ASSIGN. */
+ gassign *stmt = dyn_cast<gassign *> (gsi_stmt (*gsi));
+ if (!stmt)
+ return NULL;
+
+ tree lhs = gimple_assign_lhs (stmt);
+ code = TREE_CODE (lhs);
+ if (code != ARRAY_REF)
+ return NULL;
+
+ tree val = gimple_assign_rhs1 (stmt);
+ tree op0 = TREE_OPERAND (lhs, 0);
+ if (TREE_CODE (op0) == VIEW_CONVERT_EXPR && DECL_P (TREE_OPERAND (op0, 0))
+ && VECTOR_TYPE_P (TREE_TYPE (TREE_OPERAND (op0, 0)))
+ && TYPE_MODE (TREE_TYPE (lhs))
+ == TYPE_MODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))))
+ {
+ tree pos = TREE_OPERAND (lhs, 1);
+ tree view_op0 = TREE_OPERAND (op0, 0);
+ machine_mode outermode = TYPE_MODE (TREE_TYPE (view_op0));
+ if (auto_var_in_fn_p (view_op0, cfun->decl)
+ && !TREE_ADDRESSABLE (view_op0) && can_vec_set_var_idx_p (outermode))
+ {
+ location_t loc = gimple_location (stmt);
+ tree var_src = make_ssa_name (TREE_TYPE (view_op0));
+ tree var_dst = make_ssa_name (TREE_TYPE (view_op0));
+
+ ass_stmt = gimple_build_assign (var_src, view_op0);
+ gimple_set_vuse (ass_stmt, gimple_vuse (stmt));
+ gimple_set_location (ass_stmt, loc);
+ gsi_insert_before (gsi, ass_stmt, GSI_SAME_STMT);
+
+ new_stmt
+ = gimple_build_call_internal (IFN_VEC_SET, 3, var_src, val, pos);
+ gimple_call_set_lhs (new_stmt, var_dst);
+ gimple_set_location (new_stmt, loc);
+ gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
+
+ ass_stmt = gimple_build_assign (view_op0, var_dst);
+ gimple_set_location (ass_stmt, loc);
+ gsi_insert_before (gsi, ass_stmt, GSI_SAME_STMT);
+
+ gimple_move_vops (ass_stmt, stmt);
+ gsi_remove (gsi, true);
+ }
+ }
+
+ return ass_stmt;
+}
/* Expand all VEC_COND_EXPR gimple assignments into calls to internal
function based on type of selected expansion. */
@@ -138,22 +206,11 @@ gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi,
if (icode == CODE_FOR_nothing)
{
if (tcode == LT_EXPR
- && op0a == op0
- && TREE_CODE (op0) == VECTOR_CST)
+ && op0a == op0)
{
/* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR
into a constant when only get_vcond_eq_icode is supported.
- Verify < 0 and != 0 behave the same and change it to NE_EXPR. */
- unsigned HOST_WIDE_INT nelts;
- if (!VECTOR_CST_NELTS (op0).is_constant (&nelts))
- {
- if (VECTOR_CST_STEPPED_P (op0))
- gcc_unreachable ();
- nelts = vector_cst_encoded_nelts (op0);
- }
- for (unsigned int i = 0; i < nelts; ++i)
- if (tree_int_cst_sgn (vector_cst_elt (op0, i)) == 1)
- gcc_unreachable ();
+ Try changing it to NE_EXPR. */
tcode = NE_EXPR;
}
if (tcode == EQ_EXPR || tcode == NE_EXPR)
@@ -176,7 +233,7 @@ gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi,
VEC_COND_EXPR assignments. */
static unsigned int
-gimple_expand_vec_cond_exprs (void)
+gimple_expand_vec_exprs (void)
{
gimple_stmt_iterator gsi;
basic_block bb;
@@ -189,12 +246,15 @@ gimple_expand_vec_cond_exprs (void)
{
gimple *g = gimple_expand_vec_cond_expr (&gsi,
&vec_cond_ssa_name_uses);
+
if (g != NULL)
{
tree lhs = gimple_assign_lhs (gsi_stmt (gsi));
gimple_set_lhs (g, lhs);
gsi_replace (&gsi, g, false);
}
+
+ gimple_expand_vec_set_expr (&gsi);
}
}
@@ -237,7 +297,7 @@ public:
virtual unsigned int execute (function *)
{
- return gimple_expand_vec_cond_exprs ();
+ return gimple_expand_vec_exprs ();
}
}; // class pass_gimple_isel
diff --git a/gcc/gimple-loop-versioning.cc b/gcc/gimple-loop-versioning.cc
index 2687088..afe353e 100644
--- a/gcc/gimple-loop-versioning.cc
+++ b/gcc/gimple-loop-versioning.cc
@@ -277,7 +277,7 @@ private:
{
public:
name_prop (loop_info &li) : m_li (li) {}
- tree get_value (tree, gimple *) FINAL OVERRIDE;
+ tree value_of_expr (tree name, gimple *) FINAL OVERRIDE;
private:
/* Information about the versioning we've performed on the loop. */
@@ -512,8 +512,7 @@ loop_versioning::lv_dom_walker::before_dom_children (basic_block bb)
m_range_analyzer.enter (bb);
if (bb == bb->loop_father->header)
- m_lv.prune_loop_conditions (bb->loop_father,
- m_range_analyzer.get_vr_values ());
+ m_lv.prune_loop_conditions (bb->loop_father, &m_range_analyzer);
for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
gsi_next (&si))
@@ -534,8 +533,7 @@ loop_versioning::lv_dom_walker::after_dom_children (basic_block bb)
Return the new value if so, otherwise return null. */
tree
-loop_versioning::name_prop::get_value (tree val,
- gimple *stmt ATTRIBUTE_UNUSED)
+loop_versioning::name_prop::value_of_expr (tree val, gimple *)
{
if (TREE_CODE (val) == SSA_NAME
&& bitmap_bit_p (&m_li.unity_names, SSA_NAME_VERSION (val)))
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
new file mode 100644
index 0000000..13b9933
--- /dev/null
+++ b/gcc/gimple-range-cache.cc
@@ -0,0 +1,877 @@
+/* Gimple ranger SSA cache implementation.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "insn-codes.h"
+#include "tree.h"
+#include "gimple.h"
+#include "ssa.h"
+#include "gimple-pretty-print.h"
+#include "gimple-range.h"
+
+// During contructor, allocate the vector of ssa_names.
+
+non_null_ref::non_null_ref ()
+{
+ m_nn.create (0);
+ m_nn.safe_grow_cleared (num_ssa_names);
+ bitmap_obstack_initialize (&m_bitmaps);
+}
+
+// Free any bitmaps which were allocated,a swell as the vector itself.
+
+non_null_ref::~non_null_ref ()
+{
+ bitmap_obstack_release (&m_bitmaps);
+ m_nn.release ();
+}
+
+// Return true if NAME has a non-null dereference in block bb. If this is the
+// first query for NAME, calculate the summary first.
+
+bool
+non_null_ref::non_null_deref_p (tree name, basic_block bb)
+{
+ if (!POINTER_TYPE_P (TREE_TYPE (name)))
+ return false;
+
+ unsigned v = SSA_NAME_VERSION (name);
+ if (!m_nn[v])
+ process_name (name);
+
+ return bitmap_bit_p (m_nn[v], bb->index);
+}
+
+// Allocate an populate the bitmap for NAME. An ON bit for a block
+// index indicates there is a non-null reference in that block. In
+// order to populate the bitmap, a quick run of all the immediate uses
+// are made and the statement checked to see if a non-null dereference
+// is made on that statement.
+
+void
+non_null_ref::process_name (tree name)
+{
+ unsigned v = SSA_NAME_VERSION (name);
+ use_operand_p use_p;
+ imm_use_iterator iter;
+ bitmap b;
+
+ // Only tracked for pointers.
+ if (!POINTER_TYPE_P (TREE_TYPE (name)))
+ return;
+
+ // Already processed if a bitmap has been allocated.
+ if (m_nn[v])
+ return;
+
+ b = BITMAP_ALLOC (&m_bitmaps);
+
+ // Loop over each immediate use and see if it implies a non-null value.
+ FOR_EACH_IMM_USE_FAST (use_p, iter, name)
+ {
+ gimple *s = USE_STMT (use_p);
+ unsigned index = gimple_bb (s)->index;
+ tree value;
+ enum tree_code comp_code;
+
+ // If bit is already set for this block, dont bother looking again.
+ if (bitmap_bit_p (b, index))
+ continue;
+
+ // If we can infer a != 0 range, then set the bit for this BB
+ if (infer_value_range (s, name, &comp_code, &value))
+ {
+ if (comp_code == NE_EXPR && integer_zerop (value))
+ bitmap_set_bit (b, index);
+ }
+ }
+
+ m_nn[v] = b;
+}
+
+// -------------------------------------------------------------------------
+
+// This class implements a cache of ranges indexed by basic block. It
+// represents all that is known about an SSA_NAME on entry to each
+// block. It caches a range-for-type varying range so it doesn't need
+// to be reformed all the time. If a range is ever always associated
+// with a type, we can use that instead. Whenever varying is being
+// set for a block, the cache simply points to this cached one rather
+// than create a new one each time.
+
+class ssa_block_ranges
+{
+public:
+ ssa_block_ranges (tree t, irange_allocator *allocator);
+ ~ssa_block_ranges ();
+
+ void set_bb_range (const basic_block bb, const irange &r);
+ void set_bb_varying (const basic_block bb);
+ bool get_bb_range (irange &r, const basic_block bb);
+ bool bb_range_p (const basic_block bb);
+
+ void dump(FILE *f);
+private:
+ vec<irange *> m_tab;
+ irange *m_type_range;
+ tree m_type;
+ irange_allocator *m_irange_allocator;
+};
+
+
+// Initialize a block cache for an ssa_name of type T.
+
+ssa_block_ranges::ssa_block_ranges (tree t, irange_allocator *allocator)
+{
+ gcc_checking_assert (TYPE_P (t));
+ m_type = t;
+ m_irange_allocator = allocator;
+
+ m_tab.create (0);
+ m_tab.safe_grow_cleared (last_basic_block_for_fn (cfun));
+
+ // Create the cached type range.
+ m_type_range = m_irange_allocator->allocate (2);
+ m_type_range->set_varying (t);
+
+ m_tab[ENTRY_BLOCK_PTR_FOR_FN (cfun)->index] = m_type_range;
+}
+
+// Destruct block range.
+
+ssa_block_ranges::~ssa_block_ranges ()
+{
+ m_tab.release ();
+}
+
+// Set the range for block BB to be R.
+
+void
+ssa_block_ranges::set_bb_range (const basic_block bb, const irange &r)
+{
+ irange *m = m_irange_allocator->allocate (r);
+ m_tab[bb->index] = m;
+}
+
+// Set the range for block BB to the range for the type.
+
+void
+ssa_block_ranges::set_bb_varying (const basic_block bb)
+{
+ m_tab[bb->index] = m_type_range;
+}
+
+// Return the range associated with block BB in R. Return false if
+// there is no range.
+
+bool
+ssa_block_ranges::get_bb_range (irange &r, const basic_block bb)
+{
+ irange *m = m_tab[bb->index];
+ if (m)
+ {
+ r = *m;
+ return true;
+ }
+ return false;
+}
+
+// Return true if a range is present.
+
+bool
+ssa_block_ranges::bb_range_p (const basic_block bb)
+{
+ return m_tab[bb->index] != NULL;
+}
+
+
+// Print the list of known ranges for file F in a nice format.
+
+void
+ssa_block_ranges::dump (FILE *f)
+{
+ basic_block bb;
+ int_range_max r;
+
+ FOR_EACH_BB_FN (bb, cfun)
+ if (get_bb_range (r, bb))
+ {
+ fprintf (f, "BB%d -> ", bb->index);
+ r.dump (f);
+ fprintf (f, "\n");
+ }
+}
+
+// -------------------------------------------------------------------------
+
+// Initialize the block cache.
+
+block_range_cache::block_range_cache ()
+{
+ m_ssa_ranges.create (0);
+ m_ssa_ranges.safe_grow_cleared (num_ssa_names);
+ m_irange_allocator = new irange_allocator;
+}
+
+// Remove any m_block_caches which have been created.
+
+block_range_cache::~block_range_cache ()
+{
+ unsigned x;
+ for (x = 0; x < m_ssa_ranges.length (); ++x)
+ {
+ if (m_ssa_ranges[x])
+ delete m_ssa_ranges[x];
+ }
+ delete m_irange_allocator;
+ // Release the vector itself.
+ m_ssa_ranges.release ();
+}
+
+// Return a reference to the m_block_cache for NAME. If it has not been
+// accessed yet, allocate it.
+
+ssa_block_ranges &
+block_range_cache::get_block_ranges (tree name)
+{
+ unsigned v = SSA_NAME_VERSION (name);
+ if (v >= m_ssa_ranges.length ())
+ m_ssa_ranges.safe_grow_cleared (num_ssa_names + 1);
+
+ if (!m_ssa_ranges[v])
+ m_ssa_ranges[v] = new ssa_block_ranges (TREE_TYPE (name), m_irange_allocator);
+
+ return *(m_ssa_ranges[v]);
+}
+
+// Set the range for NAME on entry to block BB to R.
+
+void
+block_range_cache::set_bb_range (tree name, const basic_block bb,
+ const irange &r)
+{
+ return get_block_ranges (name).set_bb_range (bb, r);
+}
+
+// Set the range for NAME on entry to block BB to varying.
+
+void
+block_range_cache::set_bb_varying (tree name, const basic_block bb)
+{
+ return get_block_ranges (name).set_bb_varying (bb);
+}
+
+// Return the range for NAME on entry to BB in R. Return true if there
+// is one.
+
+bool
+block_range_cache::get_bb_range (irange &r, tree name, const basic_block bb)
+{
+ return get_block_ranges (name).get_bb_range (r, bb);
+}
+
+// Return true if NAME has a range set in block BB.
+
+bool
+block_range_cache::bb_range_p (tree name, const basic_block bb)
+{
+ return get_block_ranges (name).bb_range_p (bb);
+}
+
+// Print all known block caches to file F.
+
+void
+block_range_cache::dump (FILE *f)
+{
+ unsigned x;
+ for (x = 0; x < m_ssa_ranges.length (); ++x)
+ {
+ if (m_ssa_ranges[x])
+ {
+ fprintf (f, " Ranges for ");
+ print_generic_expr (f, ssa_name (x), TDF_NONE);
+ fprintf (f, ":\n");
+ m_ssa_ranges[x]->dump (f);
+ fprintf (f, "\n");
+ }
+ }
+}
+
+// Print all known ranges on entry to blobk BB to file F.
+
+void
+block_range_cache::dump (FILE *f, basic_block bb, bool print_varying)
+{
+ unsigned x;
+ int_range_max r;
+ bool summarize_varying = false;
+ for (x = 1; x < m_ssa_ranges.length (); ++x)
+ {
+ if (!gimple_range_ssa_p (ssa_name (x)))
+ continue;
+ if (m_ssa_ranges[x] && m_ssa_ranges[x]->get_bb_range (r, bb))
+ {
+ if (!print_varying && r.varying_p ())
+ {
+ summarize_varying = true;
+ continue;
+ }
+ print_generic_expr (f, ssa_name (x), TDF_NONE);
+ fprintf (f, "\t");
+ r.dump(f);
+ fprintf (f, "\n");
+ }
+ }
+ // If there were any varying entries, lump them all together.
+ if (summarize_varying)
+ {
+ fprintf (f, "VARYING_P on entry : ");
+ for (x = 1; x < num_ssa_names; ++x)
+ {
+ if (!gimple_range_ssa_p (ssa_name (x)))
+ continue;
+ if (m_ssa_ranges[x] && m_ssa_ranges[x]->get_bb_range (r, bb))
+ {
+ if (r.varying_p ())
+ {
+ print_generic_expr (f, ssa_name (x), TDF_NONE);
+ fprintf (f, " ");
+ }
+ }
+ }
+ fprintf (f, "\n");
+ }
+}
+
+// -------------------------------------------------------------------------
+
+// Initialize a global cache.
+
+ssa_global_cache::ssa_global_cache ()
+{
+ m_tab.create (0);
+ m_tab.safe_grow_cleared (num_ssa_names);
+ m_irange_allocator = new irange_allocator;
+}
+
+// Deconstruct a global cache.
+
+ssa_global_cache::~ssa_global_cache ()
+{
+ m_tab.release ();
+ delete m_irange_allocator;
+}
+
+// Retrieve the global range of NAME from cache memory if it exists.
+// Return the value in R.
+
+bool
+ssa_global_cache::get_global_range (irange &r, tree name) const
+{
+ unsigned v = SSA_NAME_VERSION (name);
+ if (v >= m_tab.length ())
+ return false;
+
+ irange *stow = m_tab[v];
+ if (!stow)
+ return false;
+ r = *stow;
+ return true;
+}
+
+// Set the range for NAME to R in the global cache.
+
+void
+ssa_global_cache::set_global_range (tree name, const irange &r)
+{
+ unsigned v = SSA_NAME_VERSION (name);
+ if (v >= m_tab.length ())
+ m_tab.safe_grow_cleared (num_ssa_names + 1);
+
+ irange *m = m_tab[v];
+ if (m && m->fits_p (r))
+ *m = r;
+ else
+ m_tab[v] = m_irange_allocator->allocate (r);
+}
+
+// Set the range for NAME to R in the glonbal cache.
+
+void
+ssa_global_cache::clear_global_range (tree name)
+{
+ unsigned v = SSA_NAME_VERSION (name);
+ if (v >= m_tab.length ())
+ m_tab.safe_grow_cleared (num_ssa_names + 1);
+ m_tab[v] = NULL;
+}
+
+// Clear the global cache.
+
+void
+ssa_global_cache::clear ()
+{
+ memset (m_tab.address(), 0, m_tab.length () * sizeof (irange *));
+}
+
+// Dump the contents of the global cache to F.
+
+void
+ssa_global_cache::dump (FILE *f)
+{
+ unsigned x;
+ int_range_max r;
+ fprintf (f, "Non-varying global ranges:\n");
+ fprintf (f, "=========================:\n");
+ for ( x = 1; x < num_ssa_names; x++)
+ if (gimple_range_ssa_p (ssa_name (x)) &&
+ get_global_range (r, ssa_name (x)) && !r.varying_p ())
+ {
+ print_generic_expr (f, ssa_name (x), TDF_NONE);
+ fprintf (f, " : ");
+ r.dump (f);
+ fprintf (f, "\n");
+ }
+ fputc ('\n', f);
+}
+
+// --------------------------------------------------------------------------
+
+ranger_cache::ranger_cache (range_query &q) : query (q)
+{
+ m_workback.create (0);
+ m_workback.safe_grow_cleared (last_basic_block_for_fn (cfun));
+ m_update_list.create (0);
+ m_update_list.safe_grow_cleared (last_basic_block_for_fn (cfun));
+ m_update_list.truncate (0);
+ m_poor_value_list.create (0);
+ m_poor_value_list.safe_grow_cleared (20);
+ m_poor_value_list.truncate (0);
+}
+
+ranger_cache::~ranger_cache ()
+{
+ m_poor_value_list.release ();
+ m_workback.release ();
+ m_update_list.release ();
+}
+
+// Push a request for a new lookup in block BB of name. Return true if
+// the request is actually made (ie, isn't a duplicate).
+
+bool
+ranger_cache::push_poor_value (basic_block bb, tree name)
+{
+ if (m_poor_value_list.length ())
+ {
+ // Don't push anything else to the same block. If there are multiple
+ // things required, another request will come during a later evaluation
+ // and this prevents oscillation building uneccessary depth.
+ if ((m_poor_value_list.last ()).bb == bb)
+ return false;
+ }
+
+ struct update_record rec;
+ rec.bb = bb;
+ rec.calc = name;
+ m_poor_value_list.safe_push (rec);
+ return true;
+}
+
+// Provide lookup for the gori-computes class to access the best known range
+// of an ssa_name in any given basic block. Note, this does no additonal
+// lookups, just accesses the data that is already known.
+
+void
+ranger_cache::ssa_range_in_bb (irange &r, tree name, basic_block bb)
+{
+ gimple *s = SSA_NAME_DEF_STMT (name);
+ basic_block def_bb = ((s && gimple_bb (s)) ? gimple_bb (s) :
+ ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ if (bb == def_bb)
+ {
+ // NAME is defined in this block, so request its current value
+ if (!m_globals.get_global_range (r, name))
+ {
+ // If it doesn't have a value calculated, it means it's a
+ // "poor" value being used in some calculation. Queue it up
+ // as a poor value to be improved later.
+ r = gimple_range_global (name);
+ if (push_poor_value (bb, name))
+ {
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file,
+ "*CACHE* no global def in bb %d for ", bb->index);
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, " depth : %d\n",
+ m_poor_value_list.length ());
+ }
+ }
+ }
+ }
+ // Look for the on-entry value of name in BB from the cache.
+ else if (!m_on_entry.get_bb_range (r, name, bb))
+ {
+ // If it has no entry then mark this as a poor value.
+ if (push_poor_value (bb, name))
+ {
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file,
+ "*CACHE* no on entry range in bb %d for ", bb->index);
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, " depth : %d\n", m_poor_value_list.length ());
+ }
+ }
+ // Try to pick up any known global value as a best guess for now.
+ if (!m_globals.get_global_range (r, name))
+ r = gimple_range_global (name);
+ }
+
+ // Check if pointers have any non-null dereferences. Non-call
+ // exceptions mean we could throw in the middle of the block, so just
+ // punt for now on those.
+ if (r.varying_p () && m_non_null.non_null_deref_p (name, bb) &&
+ !cfun->can_throw_non_call_exceptions)
+ r = range_nonzero (TREE_TYPE (name));
+}
+
+// Return a static range for NAME on entry to basic block BB in R. If
+// calc is true, fill any cache entries required between BB and the
+// def block for NAME. Otherwise, return false if the cache is empty.
+
+bool
+ranger_cache::block_range (irange &r, basic_block bb, tree name, bool calc)
+{
+ gcc_checking_assert (gimple_range_ssa_p (name));
+
+ if (calc)
+ {
+ gimple *def_stmt = SSA_NAME_DEF_STMT (name);
+ basic_block def_bb = NULL;
+ if (def_stmt)
+ def_bb = gimple_bb (def_stmt);;
+ if (!def_bb)
+ {
+ // If we get to the entry block, this better be a default def
+ // or range_on_entry was called for a block not dominated by
+ // the def.
+ gcc_checking_assert (SSA_NAME_IS_DEFAULT_DEF (name));
+ def_bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);
+ }
+
+ // There is no range on entry for the definition block.
+ if (def_bb == bb)
+ return false;
+
+ // Otherwise, go figure out what is known in predecessor blocks.
+ fill_block_cache (name, bb, def_bb);
+ gcc_checking_assert (m_on_entry.bb_range_p (name, bb));
+ }
+ return m_on_entry.get_bb_range (r, name, bb);
+}
+
+// Add BB to the list of blocks to update, unless it's already in the list.
+
+void
+ranger_cache::add_to_update (basic_block bb)
+{
+ if (!m_update_list.contains (bb))
+ m_update_list.quick_push (bb);
+}
+
+// If there is anything in the iterative update_list, continue
+// processing NAME until the list of blocks is empty.
+
+void
+ranger_cache::iterative_cache_update (tree name)
+{
+ basic_block bb;
+ edge_iterator ei;
+ edge e;
+ int_range_max new_range;
+ int_range_max current_range;
+ int_range_max e_range;
+
+ // Process each block by seeing if its calculated range on entry is
+ // the same as its cached value. If there is a difference, update
+ // the cache to reflect the new value, and check to see if any
+ // successors have cache entries which may need to be checked for
+ // updates.
+
+ while (m_update_list.length () > 0)
+ {
+ bb = m_update_list.pop ();
+ gcc_checking_assert (m_on_entry.bb_range_p (name, bb));
+ m_on_entry.get_bb_range (current_range, name, bb);
+
+ // Calculate the "new" range on entry by unioning the pred edges.
+ new_range.set_undefined ();
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " edge %d->%d :", e->src->index, bb->index);
+ // Get whatever range we can for this edge.
+ if (!outgoing_edge_range_p (e_range, e, name))
+ {
+ ssa_range_in_bb (e_range, name, e->src);
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "No outgoing edge range, picked up ");
+ e_range.dump(dump_file);
+ fprintf (dump_file, "\n");
+ }
+ }
+ else
+ {
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "outgoing range :");
+ e_range.dump(dump_file);
+ fprintf (dump_file, "\n");
+ }
+ }
+ new_range.union_ (e_range);
+ if (new_range.varying_p ())
+ break;
+ }
+
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "FWD visiting block %d for ", bb->index);
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, " starting range : ");
+ current_range.dump (dump_file);
+ fprintf (dump_file, "\n");
+ }
+
+ // If the range on entry has changed, update it.
+ if (new_range != current_range)
+ {
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, " Updating range to ");
+ new_range.dump (dump_file);
+ fprintf (dump_file, "\n Updating blocks :");
+ }
+ m_on_entry.set_bb_range (name, bb, new_range);
+ // Mark each successor that has a range to re-check its range
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (m_on_entry.bb_range_p (name, e->dest))
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " bb%d",e->dest->index);
+ add_to_update (e->dest);
+ }
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "\n");
+ }
+ }
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "DONE visiting blocks for ");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+}
+
+// Make sure that the range-on-entry cache for NAME is set for block BB.
+// Work back through the CFG to DEF_BB ensuring the range is calculated
+// on the block/edges leading back to that point.
+
+void
+ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
+{
+ edge_iterator ei;
+ edge e;
+ int_range_max block_result;
+ int_range_max undefined;
+ unsigned poor_list_start = m_poor_value_list.length ();
+
+ // At this point we shouldn't be looking at the def, entry or exit block.
+ gcc_checking_assert (bb != def_bb && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) &&
+ bb != EXIT_BLOCK_PTR_FOR_FN (cfun));
+
+ // If the block cache is set, then we've already visited this block.
+ if (m_on_entry.bb_range_p (name, bb))
+ return;
+
+ // Visit each block back to the DEF. Initialize each one to UNDEFINED.
+ // m_visited at the end will contain all the blocks that we needed to set
+ // the range_on_entry cache for.
+ m_workback.truncate (0);
+ m_workback.quick_push (bb);
+ undefined.set_undefined ();
+ m_on_entry.set_bb_range (name, bb, undefined);
+ gcc_checking_assert (m_update_list.length () == 0);
+
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "\n");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, " : ");
+ }
+
+ while (m_workback.length () > 0)
+ {
+ basic_block node = m_workback.pop ();
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "BACK visiting block %d for ", node->index);
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
+ FOR_EACH_EDGE (e, ei, node->preds)
+ {
+ basic_block pred = e->src;
+ int_range_max r;
+
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " %d->%d ",e->src->index, e->dest->index);
+
+ // If the pred block is the def block add this BB to update list.
+ if (pred == def_bb)
+ {
+ add_to_update (node);
+ continue;
+ }
+
+ // If the pred is entry but NOT def, then it is used before
+ // defined, it'll get set to [] and no need to update it.
+ if (pred == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "entry: bail.");
+ continue;
+ }
+
+ // Regardless of whether we have visited pred or not, if the
+ // pred has a non-null reference, revisit this block.
+ if (m_non_null.non_null_deref_p (name, pred))
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "nonnull: update ");
+ add_to_update (node);
+ }
+
+ // If the pred block already has a range, or if it can contribute
+ // something new. Ie, the edge generates a range of some sort.
+ if (m_on_entry.get_bb_range (r, name, pred))
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "has cache, ");
+ if (!r.undefined_p () || has_edge_range_p (e, name))
+ {
+ add_to_update (node);
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "update. ");
+ }
+ continue;
+ }
+
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "pushing undefined pred block. ");
+ // If the pred hasn't been visited (has no range), add it to
+ // the list.
+ gcc_checking_assert (!m_on_entry.bb_range_p (name, pred));
+ m_on_entry.set_bb_range (name, pred, undefined);
+ m_workback.quick_push (pred);
+ }
+ }
+
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "\n");
+
+ // Now fill in the marked blocks with values.
+ iterative_cache_update (name);
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " iterative update done.\n");
+
+ // Now that the cache has been updated, check to see if there were any
+ // SSA_NAMES used in filling the cache which were "poor values".
+ // We can evaluate them, and inject any new values into the iteration
+ // list, and see if it improves any on-entry values.
+ if (poor_list_start != m_poor_value_list.length ())
+ {
+ gcc_checking_assert (poor_list_start < m_poor_value_list.length ());
+ while (poor_list_start < m_poor_value_list.length ())
+ {
+ // Find a range for this unresolved value.
+ // Note, this may spawn new cache filling cycles, but by the time it
+ // is finished, the work vectors will all be back to the same state
+ // as before the call. The update record vector will always be
+ // returned to the current state upon return.
+ struct update_record rec = m_poor_value_list.pop ();
+ basic_block calc_bb = rec.bb;
+ int_range_max tmp;
+
+ // The update work list should be empty at this point.
+ gcc_checking_assert (m_update_list.length () == 0);
+
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, "(%d:%d)Calculating ",
+ m_poor_value_list.length () + 1, poor_list_start);
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, " used poor value for ");
+ print_generic_expr (dump_file, rec.calc, TDF_SLIM);
+ fprintf (dump_file, " in bb%d, trying to improve:\n",
+ calc_bb->index);
+ }
+
+ // It must have at least one edge, pick edge 0. we just want to
+ // calculate a range at the exit from the block so the caches feeding
+ // this block will be filled up.
+ gcc_checking_assert (EDGE_SUCC (calc_bb, 0));
+ query.range_on_edge (tmp, EDGE_SUCC (calc_bb, 0), rec.calc);
+
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " Checking successors of bb%d :",
+ calc_bb->index);
+
+ // Try recalculating any successor blocks with the new value.
+ // Note that even if this value is refined from the initial value,
+ // it may not affect the calculation, but the iterative update
+ // will resolve that efficently.
+ FOR_EACH_EDGE (e, ei, calc_bb->succs)
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "bb%d: ", e->dest->index);
+ // Only update active cache entries.
+ if (m_on_entry.bb_range_p (name, e->dest))
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "update ");
+ add_to_update (e->dest);
+ }
+ }
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "\n");
+ // Now see if there is a new value.
+ iterative_cache_update (name);
+ }
+ }
+
+}
diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
new file mode 100644
index 0000000..29ab01e
--- /dev/null
+++ b/gcc/gimple-range-cache.h
@@ -0,0 +1,120 @@
+/* Header file for gimple ranger SSA cache.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@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/>. */
+
+#ifndef GCC_SSA_RANGE_CACHE_H
+#define GCC_SSA_RANGE_CACHE_H
+
+#include "gimple-range-gori.h"
+
+// Class used to track non-null references of an SSA name. A vector
+// of bitmaps indexed by SSA name is maintained. When indexed by
+// basic block, an on-bit indicates there is a non-null dereference
+// for that SSA in that block.
+
+class non_null_ref
+{
+public:
+ non_null_ref ();
+ ~non_null_ref ();
+ bool non_null_deref_p (tree name, basic_block bb);
+private:
+ vec <bitmap> m_nn;
+ void process_name (tree name);
+ bitmap_obstack m_bitmaps;
+};
+
+// This class manages a vector of pointers to ssa_block ranges. It
+// provides the basis for the "range on entry" cache for all
+// SSA names.
+
+class block_range_cache
+{
+public:
+ block_range_cache ();
+ ~block_range_cache ();
+
+ void set_bb_range (tree name, const basic_block bb, const irange &r);
+ void set_bb_varying (tree name, const basic_block bb);
+ bool get_bb_range (irange &r, tree name, const basic_block bb);
+ bool bb_range_p (tree name, const basic_block bb);
+
+ void dump (FILE *f);
+ void dump (FILE *f, basic_block bb, bool print_varying = true);
+private:
+ vec<class ssa_block_ranges *> m_ssa_ranges;
+ ssa_block_ranges &get_block_ranges (tree name);
+ irange_allocator *m_irange_allocator;
+};
+
+// This global cache is used with the range engine as markers for what
+// has been visited during this incarnation. Once the ranger evaluates
+// a name, it is typically not re-evaluated again.
+
+class ssa_global_cache
+{
+public:
+ ssa_global_cache ();
+ ~ssa_global_cache ();
+ bool get_global_range (irange &r, tree name) const;
+ void set_global_range (tree name, const irange &r);
+ void clear_global_range (tree name);
+ void clear ();
+ void dump (FILE *f = stderr);
+private:
+ vec<irange *> m_tab;
+ class irange_allocator *m_irange_allocator;
+};
+
+// This class provides all the caches a global ranger may need, and makes
+// them available for gori-computes to query so outgoing edges can be
+// properly calculated.
+
+class ranger_cache : public gori_compute_cache
+{
+public:
+ ranger_cache (class range_query &q);
+ ~ranger_cache ();
+
+ virtual void ssa_range_in_bb (irange &r, tree name, basic_block bb);
+ bool block_range (irange &r, basic_block bb, tree name, bool calc = true);
+
+ ssa_global_cache m_globals;
+ block_range_cache m_on_entry;
+ non_null_ref m_non_null;
+private:
+ void add_to_update (basic_block bb);
+ void fill_block_cache (tree name, basic_block bb, basic_block def_bb);
+ void iterative_cache_update (tree name);
+
+ vec<basic_block> m_workback;
+ vec<basic_block> m_update_list;
+
+ // Iterative "poor value" calculations.
+ struct update_record
+ {
+ basic_block bb; // Block which value needs to be calculated in.
+ tree calc; // SSA_NAME which needs its value calculated.
+ };
+ bool push_poor_value (basic_block bb, tree name);
+ vec<update_record> m_poor_value_list;
+ class range_query &query;
+};
+
+#endif // GCC_SSA_RANGE_CACHE_H
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
new file mode 100644
index 0000000..b42dcd6
--- /dev/null
+++ b/gcc/gimple-range-edge.cc
@@ -0,0 +1,197 @@
+/* Gimple range edge functionaluity.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@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/>. */
+
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "ssa.h"
+#include "gimple-pretty-print.h"
+#include "gimple-iterator.h"
+#include "tree-cfg.h"
+#include "gimple-range.h"
+
+// If there is a range control statment at the end of block BB, return it.
+// Otherwise return NULL.
+
+gimple *
+gimple_outgoing_range_stmt_p (basic_block bb)
+{
+ gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb);
+ if (!gsi_end_p (gsi))
+ {
+ gimple *s = gsi_stmt (gsi);
+ if (is_a<gcond *> (s) && gimple_range_handler (s))
+ return gsi_stmt (gsi);
+ gswitch *sw = dyn_cast<gswitch *> (s);
+ if (sw && irange::supports_type_p (TREE_TYPE (gimple_switch_index (sw))))
+ return gsi_stmt (gsi);
+ }
+ return NULL;
+}
+
+
+outgoing_range::outgoing_range ()
+{
+ m_edge_table = NULL;
+}
+
+outgoing_range::~outgoing_range ()
+{
+ if (m_edge_table)
+ delete m_edge_table;
+}
+
+
+// Get a range for a switch edge E from statement S and return it in R.
+// Use a cached value if it exists, or calculate it if not.
+
+bool
+outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
+{
+ gcc_checking_assert (is_a<gswitch *> (s));
+ gswitch *sw = as_a<gswitch *> (s);
+
+ // ADA currently has cases where the index is 64 bits and the case
+ // arguments are 32 bit, causing a trap when we create a case_range.
+ // Until this is resolved (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87798)
+ // punt on switches where the labels dont match the argument.
+ if (gimple_switch_num_labels (sw) > 1 &&
+ TYPE_PRECISION (TREE_TYPE (CASE_LOW (gimple_switch_label (sw, 1)))) !=
+ TYPE_PRECISION (TREE_TYPE (gimple_switch_index (sw))))
+ return false;
+
+ if (!m_edge_table)
+ m_edge_table = new hash_map<edge, irange *> (n_edges_for_fn (cfun));
+
+ irange **val = m_edge_table->get (e);
+ if (!val)
+ {
+ calc_switch_ranges (sw);
+ val = m_edge_table->get (e);
+ gcc_checking_assert (val);
+ }
+ r = **val;
+ return true;
+}
+
+
+// Calculate all switch edges from SW and cache them in the hash table.
+
+void
+outgoing_range::calc_switch_ranges (gswitch *sw)
+{
+ bool existed;
+ unsigned x, lim;
+ lim = gimple_switch_num_labels (sw);
+ tree type = TREE_TYPE (gimple_switch_index (sw));
+ edge default_edge = gimple_switch_default_edge (cfun, sw);
+
+ // This should be the first call into this switch.
+ //
+ // Allocate an int_range_max for the default range case, start with
+ // varying and intersect each other case from it.
+ irange *default_range = m_range_allocator.allocate (255);
+ default_range->set_varying (type);
+
+ for (x = 1; x < lim; x++)
+ {
+ edge e = gimple_switch_edge (cfun, sw, x);
+
+ // If this edge is the same as the default edge, do nothing else.
+ if (e == default_edge)
+ continue;
+
+ tree low = CASE_LOW (gimple_switch_label (sw, x));
+ tree high = CASE_HIGH (gimple_switch_label (sw, x));
+ if (!high)
+ high = low;
+
+ // Remove the case range from the default case.
+ int_range_max def_range (low, high);
+ range_cast (def_range, type);
+ def_range.invert ();
+ default_range->intersect (def_range);
+
+ // Create/union this case with anything on else on the edge.
+ int_range_max case_range (low, high);
+ range_cast (case_range, type);
+ irange *&slot = m_edge_table->get_or_insert (e, &existed);
+ if (existed)
+ {
+ case_range.union_ (*slot);
+ if (slot->fits_p (case_range))
+ {
+ *slot = case_range;
+ continue;
+ }
+ }
+ // If there was an existing range and it doesn't fit, we lose the memory.
+ // It'll get reclaimed when the obstack is freed. This seems less
+ // intrusive than allocating max ranges for each case.
+ slot = m_range_allocator.allocate (case_range);
+ }
+
+ irange *&slot = m_edge_table->get_or_insert (default_edge, &existed);
+ // This should be the first call into this switch.
+ gcc_checking_assert (!existed);
+ slot = default_range;
+}
+
+
+// Calculate the range forced on on edge E by control flow, return it
+// in R. Return the statment which defines the range, otherwise
+// return NULL
+
+gimple *
+outgoing_range::edge_range_p (irange &r, edge e)
+{
+ // Determine if there is an outgoing edge.
+ gimple *s = gimple_outgoing_range_stmt_p (e->src);
+ if (!s)
+ return NULL;
+
+ if (is_a<gcond *> (s))
+ {
+ if (e->flags & EDGE_TRUE_VALUE)
+ r = int_range<2> (boolean_true_node, boolean_true_node);
+ else if (e->flags & EDGE_FALSE_VALUE)
+ r = int_range<2> (boolean_false_node, boolean_false_node);
+ else
+ gcc_unreachable ();
+ return s;
+ }
+
+ gcc_checking_assert (is_a<gswitch *> (s));
+ gswitch *sw = as_a<gswitch *> (s);
+ tree type = TREE_TYPE (gimple_switch_index (sw));
+
+ if (!irange::supports_type_p (type))
+ return NULL;
+
+ if (get_edge_range (r, sw, e))
+ return s;
+
+ return NULL;
+}
diff --git a/gcc/gimple-range-edge.h b/gcc/gimple-range-edge.h
new file mode 100644
index 0000000..400c814
--- /dev/null
+++ b/gcc/gimple-range-edge.h
@@ -0,0 +1,55 @@
+/* Gimple range edge header file.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@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/>. */
+
+#ifndef GIMPLE_RANGE_EDGE_H
+#define GIMPLE_RANGE_EDGE_H
+
+// This class is used to query ranges on constant edges in GIMPLE.
+//
+// For a COND_EXPR, the TRUE edge will return [1,1] and the false edge a [0,0].
+//
+// For SWITCH_EXPR, it is awkward to calculate ranges. When a request
+// is made, the entire switch is evalauted and the results cached.
+// Any future requests to that switch will use the cached value, providing
+// dramatic decrease in computation time.
+//
+// The API is simple, just ask for the range on the edge.
+// The return value is NULL for no range, or the branch statement which the
+// edge gets the range from, along with the range.
+
+class outgoing_range
+{
+public:
+ outgoing_range ();
+ ~outgoing_range ();
+ gimple *edge_range_p (irange &r, edge e);
+private:
+ void calc_switch_ranges (gswitch *sw);
+ bool get_edge_range (irange &r, gimple *s, edge e);
+
+ hash_map<edge, irange *> *m_edge_table;
+ irange_allocator m_range_allocator;
+};
+
+// If there is a range control statment at the end of block BB, return it.
+gimple *gimple_outgoing_range_stmt_p (basic_block bb);
+
+#endif // GIMPLE_RANGE_EDGE_H
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
new file mode 100644
index 0000000..5d50b11
--- /dev/null
+++ b/gcc/gimple-range-gori.cc
@@ -0,0 +1,1325 @@
+/* Gimple range GORI functions.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "ssa.h"
+#include "gimple-pretty-print.h"
+#include "gimple-range.h"
+
+
+/* RANGE_DEF_CHAIN is used to determine what SSA names in a block can
+ have range information calculated for them, and what the
+ dependencies on each other are.
+
+ Information for a basic block is calculated once and stored. It is
+ only calculated the first time a query is made, so if no queries
+ are made, there is little overhead.
+
+ The def_chain bitmap is indexed by SSA_NAME_VERSION. Bits are set
+ within this bitmap to indicate SSA names that are defined in the
+ SAME block and used to calculate this SSA name.
+
+
+ <bb 2> :
+ _1 = x_4(D) + -2;
+ _2 = _1 * 4;
+ j_7 = foo ();
+ q_5 = _2 + 3;
+ if (q_5 <= 13)
+
+ _1 : x_4(D)
+ _2 : 1 x_4(D)
+ q_5 : _1 _2 x_4(D)
+
+ This dump indicates the bits set in the def_chain vector.
+ as well as demonstrates the def_chain bits for the related ssa_names.
+
+ Checking the chain for _2 indicates that _1 and x_4 are used in
+ its evaluation.
+
+ Def chains also only include statements which are valid gimple
+ so a def chain will only span statements for which the range
+ engine implements operations for. */
+
+
+class range_def_chain
+{
+public:
+ range_def_chain ();
+ ~range_def_chain ();
+ bool has_def_chain (tree name);
+ bitmap get_def_chain (tree name);
+ bool in_chain_p (tree name, tree def);
+private:
+ vec<bitmap> m_def_chain; // SSA_NAME : def chain components.
+ void build_def_chain (tree name, bitmap result, basic_block bb);
+};
+
+
+// Construct a range_def_chain.
+
+range_def_chain::range_def_chain ()
+{
+ m_def_chain.create (0);
+ m_def_chain.safe_grow_cleared (num_ssa_names);
+}
+
+// Destruct a range_def_chain.
+
+range_def_chain::~range_def_chain ()
+{
+ unsigned x;
+ for (x = 0; x < m_def_chain.length (); ++x)
+ if (m_def_chain[x])
+ BITMAP_FREE (m_def_chain[x]);
+ m_def_chain.release ();
+}
+
+// Return true if NAME is in the def chain of DEF. If BB is provided,
+// only return true if the defining statement of DEF is in BB.
+
+bool
+range_def_chain::in_chain_p (tree name, tree def)
+{
+ gcc_checking_assert (gimple_range_ssa_p (def));
+ gcc_checking_assert (gimple_range_ssa_p (name));
+
+ // Get the defintion chain for DEF.
+ bitmap chain = get_def_chain (def);
+
+ if (chain == NULL)
+ return false;
+ return bitmap_bit_p (chain, SSA_NAME_VERSION (name));
+}
+
+// Build def_chains for NAME if it is in BB. Copy the def chain into RESULT.
+
+void
+range_def_chain::build_def_chain (tree name, bitmap result, basic_block bb)
+{
+ bitmap b;
+ gimple *def_stmt = SSA_NAME_DEF_STMT (name);
+ // Add this operand into the result.
+ bitmap_set_bit (result, SSA_NAME_VERSION (name));
+
+ if (gimple_bb (def_stmt) == bb && !is_a<gphi *>(def_stmt))
+ {
+ // Get the def chain for the operand.
+ b = get_def_chain (name);
+ // If there was one, copy it into result.
+ if (b)
+ bitmap_ior_into (result, b);
+ }
+}
+
+// Return TRUE if NAME has been processed for a def_chain.
+
+inline bool
+range_def_chain::has_def_chain (tree name)
+{
+ // Ensure there is an entry in the internal vector.
+ unsigned v = SSA_NAME_VERSION (name);
+ if (v >= m_def_chain.length ())
+ m_def_chain.safe_grow_cleared (num_ssa_names + 1);
+ return (m_def_chain[v] != NULL);
+}
+
+// Calculate the def chain for NAME and all of its dependent
+// operands. Only using names in the same BB. Return the bitmap of
+// all names in the m_def_chain. This only works for supported range
+// statements.
+
+bitmap
+range_def_chain::get_def_chain (tree name)
+{
+ tree ssa1, ssa2, ssa3;
+ unsigned v = SSA_NAME_VERSION (name);
+
+ // If it has already been processed, just return the cached value.
+ if (has_def_chain (name))
+ return m_def_chain[v];
+
+ // No definition chain for default defs.
+ if (SSA_NAME_IS_DEFAULT_DEF (name))
+ return NULL;
+
+ gimple *stmt = SSA_NAME_DEF_STMT (name);
+ if (gimple_range_handler (stmt))
+ {
+ ssa1 = gimple_range_ssa_p (gimple_range_operand1 (stmt));
+ ssa2 = gimple_range_ssa_p (gimple_range_operand2 (stmt));
+ ssa3 = NULL_TREE;
+ }
+ else if (is_a<gassign *> (stmt)
+ && gimple_assign_rhs_code (stmt) == COND_EXPR)
+ {
+ gassign *st = as_a<gassign *> (stmt);
+ ssa1 = gimple_range_ssa_p (gimple_assign_rhs1 (st));
+ ssa2 = gimple_range_ssa_p (gimple_assign_rhs2 (st));
+ ssa3 = gimple_range_ssa_p (gimple_assign_rhs3 (st));
+ }
+ else
+ return NULL;
+
+ basic_block bb = gimple_bb (stmt);
+
+ m_def_chain[v] = BITMAP_ALLOC (NULL);
+
+ if (ssa1)
+ build_def_chain (ssa1, m_def_chain[v], bb);
+ if (ssa2)
+ build_def_chain (ssa2, m_def_chain[v], bb);
+ if (ssa3)
+ build_def_chain (ssa3, m_def_chain[v], bb);
+
+ // If we run into pathological cases where the defintion chains are
+ // huge (ie huge basic block fully unrolled) we might be able to limit
+ // this by deciding here that if some criteria is satisfied, we change the
+ // def_chain back to be just the ssa-names. That will help prevent chains
+ // of a_2 = b_6 + a_8 from creating a pathological case.
+ return m_def_chain[v];
+}
+
+// -------------------------------------------------------------------
+
+/* GORI_MAP is used to accumulate what SSA names in a block can
+ generate range information, and provides tools for the block ranger
+ to enable it to efficiently calculate these ranges.
+
+ GORI stands for "Generates Outgoing Range Information."
+
+ It utilizes the range_def_chain class to contruct def_chains.
+ Information for a basic block is calculated once and stored. It is
+ only calculated the first time a query is made. If no queries are
+ made, there is little overhead.
+
+ one bitmap is maintained for each basic block:
+ m_outgoing : a set bit indicates a range can be generated for a name.
+
+ Generally speaking, the m_outgoing vector is the union of the
+ entire def_chain of all SSA names used in the last statement of the
+ block which generate ranges. */
+
+class gori_map : public range_def_chain
+{
+public:
+ gori_map ();
+ ~gori_map ();
+
+ bool is_export_p (tree name, basic_block bb);
+ bool def_chain_in_export_p (tree name, basic_block bb);
+
+ void dump (FILE *f);
+ void dump (FILE *f, basic_block bb);
+private:
+ bitmap_obstack m_bitmaps;
+ vec<bitmap> m_outgoing; // BB: Outgoing ranges calculatable on edges
+ void maybe_add_gori (tree name, basic_block bb);
+ void calculate_gori (basic_block bb);
+ bitmap exports (basic_block bb);
+};
+
+
+// Initialize a gori-map structure.
+
+gori_map::gori_map ()
+{
+ m_outgoing.create (0);
+ m_outgoing.safe_grow_cleared (last_basic_block_for_fn (cfun));
+ bitmap_obstack_initialize (&m_bitmaps);
+}
+
+// Free any memory the GORI map allocated.
+
+gori_map::~gori_map ()
+{
+ bitmap_obstack_release (&m_bitmaps);
+ m_outgoing.release ();
+}
+
+// Return the bitmap vector of all export from BB. Calculate if necessary.
+
+bitmap
+gori_map::exports (basic_block bb)
+{
+ if (!m_outgoing[bb->index])
+ calculate_gori (bb);
+ return m_outgoing[bb->index];
+}
+
+// Return true if NAME is can have ranges generated for it from basic
+// block BB.
+
+bool
+gori_map::is_export_p (tree name, basic_block bb)
+{
+ return bitmap_bit_p (exports (bb), SSA_NAME_VERSION (name));
+}
+
+// Return true if any element in the def chain of NAME is in the
+// export list for BB.
+
+bool
+gori_map::def_chain_in_export_p (tree name, basic_block bb)
+{
+ bitmap a = exports (bb);
+ bitmap b = get_def_chain (name);
+ if (a && b)
+ return bitmap_intersect_p (a, b);
+ return false;
+}
+
+// If NAME is non-NULL and defined in block BB, calculate the def
+// chain and add it to m_outgoing.
+
+void
+gori_map::maybe_add_gori (tree name, basic_block bb)
+{
+ if (name)
+ {
+ gimple *s = SSA_NAME_DEF_STMT (name);
+ bitmap r = get_def_chain (name);
+ // Check if there is a def chain, and it is in this block.
+ if (r && gimple_bb (s) == bb)
+ bitmap_copy (m_outgoing[bb->index], r);
+ // Def chain doesn't include itself, and even if there isn't a
+ // def chain, this name should be added to exports.
+ bitmap_set_bit (m_outgoing[bb->index], SSA_NAME_VERSION (name));
+ }
+}
+
+// Calculate all the required information for BB.
+
+void
+gori_map::calculate_gori (basic_block bb)
+{
+ tree name;
+ if (bb->index >= (signed int)m_outgoing.length ())
+ m_outgoing.safe_grow_cleared (last_basic_block_for_fn (cfun));
+ gcc_checking_assert (m_outgoing[bb->index] == NULL);
+ m_outgoing[bb->index] = BITMAP_ALLOC (&m_bitmaps);
+
+ // If this block's last statement may generate range informaiton, go
+ // calculate it.
+ gimple *stmt = gimple_outgoing_range_stmt_p (bb);
+ if (!stmt)
+ return;
+ if (is_a<gcond *> (stmt))
+ {
+ gcond *gc = as_a<gcond *>(stmt);
+ name = gimple_range_ssa_p (gimple_cond_lhs (gc));
+ maybe_add_gori (name, gimple_bb (stmt));
+
+ name = gimple_range_ssa_p (gimple_cond_rhs (gc));
+ maybe_add_gori (name, gimple_bb (stmt));
+ }
+ else
+ {
+ gswitch *gs = as_a<gswitch *>(stmt);
+ name = gimple_range_ssa_p (gimple_switch_index (gs));
+ maybe_add_gori (name, gimple_bb (stmt));
+ }
+}
+
+// Dump the table information for BB to file F.
+
+void
+gori_map::dump (FILE *f, basic_block bb)
+{
+ bool header = false;
+ const char *header_string = "bb%-4d ";
+ const char *header2 = " ";
+ bool printed_something = false;;
+ unsigned x, y;
+ bitmap_iterator bi;
+
+ // BB was not processed.
+ if (!m_outgoing[bb->index])
+ return;
+
+ // Dump the def chain for each SSA_NAME defined in BB.
+ for (x = 1; x < num_ssa_names; x++)
+ {
+ tree name = ssa_name (x);
+ if (!name)
+ continue;
+ gimple *stmt = SSA_NAME_DEF_STMT (name);
+ bitmap chain = (has_def_chain (name) ? get_def_chain (name) : NULL);
+ if (stmt && gimple_bb (stmt) == bb && chain && !bitmap_empty_p (chain))
+ {
+ fprintf (f, header_string, bb->index);
+ header_string = header2;
+ header = true;
+ print_generic_expr (f, name, TDF_SLIM);
+ fprintf (f, " : ");
+ EXECUTE_IF_SET_IN_BITMAP (chain, 0, y, bi)
+ {
+ print_generic_expr (f, ssa_name (y), TDF_SLIM);
+ fprintf (f, " ");
+ }
+ fprintf (f, "\n");
+ }
+ }
+
+ printed_something |= header;
+
+ // Now dump the export vector.
+ header = false;
+ EXECUTE_IF_SET_IN_BITMAP (m_outgoing[bb->index], 0, y, bi)
+ {
+ if (!header)
+ {
+ fprintf (f, header_string, bb->index);
+ fprintf (f, "exports: ");
+ header_string = header2;
+ header = true;
+ }
+ print_generic_expr (f, ssa_name (y), TDF_SLIM);
+ fprintf (f, " ");
+ }
+ if (header)
+ fputc ('\n', f);
+
+ printed_something |= header;
+ if (printed_something)
+ fprintf (f, "\n");
+}
+
+// Dump the entire GORI map structure to file F.
+
+void
+gori_map::dump (FILE *f)
+{
+ basic_block bb;
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ dump (f, bb);
+ if (m_outgoing[bb->index])
+ fprintf (f, "\n");
+ }
+}
+
+DEBUG_FUNCTION void
+debug (gori_map &g)
+{
+ g.dump (stderr);
+}
+
+// -------------------------------------------------------------------
+
+// Construct a gori_compute object.
+
+gori_compute::gori_compute ()
+{
+ // Create a boolean_type true and false range.
+ m_bool_zero = int_range<2> (boolean_false_node, boolean_false_node);
+ m_bool_one = int_range<2> (boolean_true_node, boolean_true_node);
+ m_gori_map = new gori_map;
+}
+
+// Destruct a gori_compute_object.
+
+gori_compute::~gori_compute ()
+{
+ delete m_gori_map;
+}
+
+// Provide a default of VARYING for all incoming SSA names.
+
+void
+gori_compute::ssa_range_in_bb (irange &r, tree name, basic_block)
+{
+ r.set_varying (TREE_TYPE (name));
+}
+
+void
+gori_compute::expr_range_in_bb (irange &r, tree expr, basic_block bb)
+{
+ if (gimple_range_ssa_p (expr))
+ ssa_range_in_bb (r, expr, bb);
+ else
+ get_tree_range (r, expr);
+}
+
+// Calculate the range for NAME if the lhs of statement S has the
+// range LHS. Return the result in R. Return false if no range can be
+// calculated.
+
+bool
+gori_compute::compute_name_range_op (irange &r, gimple *stmt,
+ const irange &lhs, tree name)
+{
+ int_range_max op1_range, op2_range;
+
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+
+ // Operand 1 is the name being looked for, evaluate it.
+ if (op1 == name)
+ {
+ expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
+ if (!op2)
+ {
+ // The second parameter to a unary operation is the range
+ // for the type of operand1, but if it can be reduced
+ // further, the results will be better. Start with what we
+ // know of the range of OP1 instead of the full type.
+ return gimple_range_calc_op1 (r, stmt, lhs, op1_range);
+ }
+ // If we need the second operand, get a value and evaluate.
+ expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
+ if (gimple_range_calc_op1 (r, stmt, lhs, op2_range))
+ r.intersect (op1_range);
+ else
+ r = op1_range;
+ return true;
+ }
+
+ if (op2 == name)
+ {
+ expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
+ expr_range_in_bb (r, op2, gimple_bb (stmt));
+ if (gimple_range_calc_op2 (op2_range, stmt, lhs, op1_range))
+ r.intersect (op2_range);
+ return true;
+ }
+ return false;
+}
+
+// Given the switch S, return an evaluation in R for NAME when the lhs
+// evaluates to LHS. Returning false means the name being looked for
+// was not resolvable.
+
+bool
+gori_compute::compute_operand_range_switch (irange &r, gswitch *s,
+ const irange &lhs,
+ tree name)
+{
+ tree op1 = gimple_switch_index (s);
+
+ // If name matches, the range is simply the range from the edge.
+ // Empty ranges are viral as they are on a path which isn't
+ // executable.
+ if (op1 == name || lhs.undefined_p ())
+ {
+ r = lhs;
+ return true;
+ }
+
+ // If op1 is in the defintion chain, pass lhs back.
+ if (gimple_range_ssa_p (op1) && m_gori_map->in_chain_p (name, op1))
+ return compute_operand_range (r, SSA_NAME_DEF_STMT (op1), lhs, name);
+
+ return false;
+}
+
+// Return TRUE if GS is a logical && or || expression.
+
+static inline bool
+is_gimple_logical_p (const gimple *gs)
+{
+ // Look for boolean and/or condition.
+ if (gimple_code (gs) == GIMPLE_ASSIGN)
+ switch (gimple_expr_code (gs))
+ {
+ case TRUTH_AND_EXPR:
+ case TRUTH_OR_EXPR:
+ return true;
+
+ case BIT_AND_EXPR:
+ case BIT_IOR_EXPR:
+ // Bitwise operations on single bits are logical too.
+ if (types_compatible_p (TREE_TYPE (gimple_assign_rhs1 (gs)),
+ boolean_type_node))
+ return true;
+ break;
+
+ default:
+ break;
+ }
+ return false;
+}
+
+// Return an evaluation for NAME as it would appear in STMT when the
+// statement's lhs evaluates to LHS. If successful, return TRUE and
+// store the evaluation in R, otherwise return FALSE.
+
+bool
+gori_compute::compute_operand_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name)
+{
+ // Empty ranges are viral as they are on an unexecutable path.
+ if (lhs.undefined_p ())
+ {
+ r.set_undefined ();
+ return true;
+ }
+ if (is_a<gswitch *> (stmt))
+ return compute_operand_range_switch (r, as_a<gswitch *> (stmt), lhs, name);
+ if (!gimple_range_handler (stmt))
+ return false;
+
+ tree op1 = gimple_range_ssa_p (gimple_range_operand1 (stmt));
+ tree op2 = gimple_range_ssa_p (gimple_range_operand2 (stmt));
+
+ // The base ranger handles NAME on this statement.
+ if (op1 == name || op2 == name)
+ return compute_name_range_op (r, stmt, lhs, name);
+
+ if (is_gimple_logical_p (stmt))
+ return compute_logical_operands (r, stmt, lhs, name);
+
+ // NAME is not in this stmt, but one of the names in it ought to be
+ // derived from it.
+ bool op1_in_chain = op1 && m_gori_map->in_chain_p (name, op1);
+ bool op2_in_chain = op2 && m_gori_map->in_chain_p (name, op2);
+ if (op1_in_chain && op2_in_chain)
+ return compute_operand1_and_operand2_range (r, stmt, lhs, name);
+ if (op1_in_chain)
+ return compute_operand1_range (r, stmt, lhs, name);
+ if (op2_in_chain)
+ return compute_operand2_range (r, stmt, lhs, name);
+
+ // If neither operand is derived, this statement tells us nothing.
+ return false;
+}
+
+// Return TRUE if range R is either a true or false compatible range.
+
+static bool
+range_is_either_true_or_false (const irange &r)
+{
+ if (r.undefined_p ())
+ return false;
+
+ // This is complicated by the fact that Ada has multi-bit booleans,
+ // so true can be ~[0, 0] (i.e. [1,MAX]).
+ tree type = r.type ();
+ gcc_checking_assert (range_compatible_p (type, boolean_type_node));
+ return (r.singleton_p () || !r.contains_p (build_zero_cst (type)));
+}
+
+// A pair of ranges for true/false paths.
+
+struct tf_range
+{
+ tf_range () { }
+ tf_range (const irange &t_range, const irange &f_range)
+ {
+ true_range = t_range;
+ false_range = f_range;
+ }
+ int_range_max true_range, false_range;
+};
+
+// Evaluate a binary logical expression by combining the true and
+// false ranges for each of the operands based on the result value in
+// the LHS.
+
+bool
+gori_compute::logical_combine (irange &r, enum tree_code code,
+ const irange &lhs,
+ const tf_range &op1, const tf_range &op2)
+{
+ if (op1.true_range.varying_p ()
+ && op1.false_range.varying_p ()
+ && op2.true_range.varying_p ()
+ && op2.false_range.varying_p ())
+ return false;
+
+ // This is not a simple fold of a logical expression, rather it
+ // determines ranges which flow through the logical expression.
+ //
+ // Assuming x_8 is an unsigned char, and relational statements:
+ // b_1 = x_8 < 20
+ // b_2 = x_8 > 5
+ // consider the logical expression and branch:
+ // c_2 = b_1 && b_2
+ // if (c_2)
+ //
+ // To determine the range of x_8 on either edge of the branch, one
+ // must first determine what the range of x_8 is when the boolean
+ // values of b_1 and b_2 are both true and false.
+ // b_1 TRUE x_8 = [0, 19]
+ // b_1 FALSE x_8 = [20, 255]
+ // b_2 TRUE x_8 = [6, 255]
+ // b_2 FALSE x_8 = [0,5].
+ //
+ // These ranges are then combined based on the expected outcome of
+ // the branch. The range on the TRUE side of the branch must satisfy
+ // b_1 == true && b_2 == true
+ //
+ // In terms of x_8, that means both x_8 == [0, 19] and x_8 = [6, 255]
+ // must be true. The range of x_8 on the true side must be the
+ // intersection of both ranges since both must be true. Thus the
+ // range of x_8 on the true side is [6, 19].
+ //
+ // To determine the ranges on the FALSE side, all 3 combinations of
+ // failing ranges must be considered, and combined as any of them
+ // can cause the false result.
+ //
+ // If the LHS can be TRUE or FALSE, then evaluate both a TRUE and
+ // FALSE results and combine them. If we fell back to VARYING any
+ // range restrictions that have been discovered up to this point
+ // would be lost.
+ if (!range_is_either_true_or_false (lhs))
+ {
+ int_range_max r1;
+ if (logical_combine (r1, code, m_bool_zero, op1, op2)
+ && logical_combine (r, code, m_bool_one, op1, op2))
+ {
+ r.union_ (r1);
+ return true;
+ }
+ return false;
+ }
+
+ switch (code)
+ {
+ // A logical AND combines ranges from 2 boolean conditions.
+ // c_2 = b_1 && b_2
+ case TRUTH_AND_EXPR:
+ case BIT_AND_EXPR:
+ if (!lhs.zero_p ())
+ {
+ // The TRUE side is the intersection of the the 2 true ranges.
+ r = op1.true_range;
+ r.intersect (op2.true_range);
+ }
+ else
+ {
+ // The FALSE side is the union of the other 3 cases.
+ int_range_max ff (op1.false_range);
+ ff.intersect (op2.false_range);
+ int_range_max tf (op1.true_range);
+ tf.intersect (op2.false_range);
+ int_range_max ft (op1.false_range);
+ ft.intersect (op2.true_range);
+ r = ff;
+ r.union_ (tf);
+ r.union_ (ft);
+ }
+ break;
+ // A logical OR combines ranges from 2 boolean conditons.
+ // c_2 = b_1 || b_2
+ case TRUTH_OR_EXPR:
+ case BIT_IOR_EXPR:
+ if (lhs.zero_p ())
+ {
+ // An OR operation will only take the FALSE path if both
+ // operands are false, so [20, 255] intersect [0, 5] is the
+ // union: [0,5][20,255].
+ r = op1.false_range;
+ r.intersect (op2.false_range);
+ }
+ else
+ {
+ // The TRUE side of an OR operation will be the union of
+ // the other three combinations.
+ int_range_max tt (op1.true_range);
+ tt.intersect (op2.true_range);
+ int_range_max tf (op1.true_range);
+ tf.intersect (op2.false_range);
+ int_range_max ft (op1.false_range);
+ ft.intersect (op2.true_range);
+ r = tt;
+ r.union_ (tf);
+ r.union_ (ft);
+ }
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ return true;
+}
+
+// Helper function for compute_logical_operands_in_chain that computes
+// the range of logical statements that can be computed without
+// chasing down operands. These are things like [0 = x | y] where we
+// know neither operand can be non-zero, or [1 = x & y] where we know
+// neither operand can be zero.
+
+bool
+gori_compute::optimize_logical_operands (tf_range &range,
+ gimple *stmt,
+ const irange &lhs,
+ tree name,
+ tree op)
+{
+ enum tree_code code = gimple_expr_code (stmt);
+
+ // Optimize [0 = x | y], since neither operand can ever be non-zero.
+ if ((code == BIT_IOR_EXPR || code == TRUTH_OR_EXPR) && lhs.zero_p ())
+ {
+ if (!compute_operand_range (range.false_range, SSA_NAME_DEF_STMT (op),
+ m_bool_zero, name))
+ expr_range_in_bb (range.false_range, name, gimple_bb (stmt));
+ range.true_range = range.false_range;
+ return true;
+ }
+ // Optimize [1 = x & y], since neither operand can ever be zero.
+ if ((code == BIT_AND_EXPR || code == TRUTH_AND_EXPR) && lhs == m_bool_one)
+ {
+ if (!compute_operand_range (range.true_range, SSA_NAME_DEF_STMT (op),
+ m_bool_one, name))
+ expr_range_in_bb (range.true_range, name, gimple_bb (stmt));
+ range.false_range = range.true_range;
+ return true;
+ }
+ return false;
+}
+
+// Given a logical STMT, calculate true and false ranges for each
+// potential path of NAME, assuming NAME came through the OP chain if
+// OP_IN_CHAIN is true.
+
+void
+gori_compute::compute_logical_operands_in_chain (tf_range &range,
+ gimple *stmt,
+ const irange &lhs,
+ tree name,
+ tree op, bool op_in_chain)
+{
+ if (!op_in_chain)
+ {
+ // If op is not in chain, use its known value.
+ expr_range_in_bb (range.true_range, name, gimple_bb (stmt));
+ range.false_range = range.true_range;
+ return;
+ }
+ if (optimize_logical_operands (range, stmt, lhs, name, op))
+ return;
+
+ // Calulate ranges for true and false on both sides, since the false
+ // path is not always a simple inversion of the true side.
+ if (!compute_operand_range (range.true_range, SSA_NAME_DEF_STMT (op),
+ m_bool_one, name))
+ expr_range_in_bb (range.true_range, name, gimple_bb (stmt));
+ if (!compute_operand_range (range.false_range, SSA_NAME_DEF_STMT (op),
+ m_bool_zero, name))
+ expr_range_in_bb (range.false_range, name, gimple_bb (stmt));
+}
+
+// Given a logical STMT, calculate true and false for each potential
+// path using NAME, and resolve the outcome based on the logical
+// operator.
+
+bool
+gori_compute::compute_logical_operands (irange &r, gimple *stmt,
+ const irange &lhs,
+ tree name)
+{
+ // Reaching this point means NAME is not in this stmt, but one of
+ // the names in it ought to be derived from it.
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+ gcc_checking_assert (op1 != name && op2 != name);
+
+ bool op1_in_chain = (gimple_range_ssa_p (op1)
+ && m_gori_map->in_chain_p (name, op1));
+ bool op2_in_chain = (gimple_range_ssa_p (op2)
+ && m_gori_map->in_chain_p (name, op2));
+
+ // If neither operand is derived, then this stmt tells us nothing.
+ if (!op1_in_chain && !op2_in_chain)
+ return false;
+
+ tf_range op1_range, op2_range;
+ compute_logical_operands_in_chain (op1_range, stmt, lhs,
+ name, op1, op1_in_chain);
+ compute_logical_operands_in_chain (op2_range, stmt, lhs,
+ name, op2, op2_in_chain);
+ return logical_combine (r, gimple_expr_code (stmt), lhs,
+ op1_range, op2_range);
+}
+
+// Calculate a range for NAME from the operand 1 position of STMT
+// assuming the result of the statement is LHS. Return the range in
+// R, or false if no range could be calculated.
+
+bool
+gori_compute::compute_operand1_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name)
+{
+ int_range_max op1_range, op2_range;
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+
+ expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
+
+ // Now calcuated the operand and put that result in r.
+ if (op2)
+ {
+ expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
+ if (!gimple_range_calc_op1 (r, stmt, lhs, op2_range))
+ return false;
+ }
+ else
+ {
+ // We pass op1_range to the unary operation. Nomally it's a
+ // hidden range_for_type parameter, but sometimes having the
+ // actual range can result in better information.
+ if (!gimple_range_calc_op1 (r, stmt, lhs, op1_range))
+ return false;
+ }
+
+ // Intersect the calculated result with the known result.
+ op1_range.intersect (r);
+
+ gimple *src_stmt = SSA_NAME_DEF_STMT (op1);
+ // If def stmt is outside of this BB, then name must be an import.
+ if (!src_stmt || (gimple_bb (src_stmt) != gimple_bb (stmt)))
+ {
+ // If this isn't the right import statement, then abort calculation.
+ if (!src_stmt || gimple_get_lhs (src_stmt) != name)
+ return false;
+ return compute_name_range_op (r, src_stmt, op1_range, name);
+ }
+ // Then feed this range back as the LHS of the defining statement.
+ return compute_operand_range (r, src_stmt, op1_range, name);
+}
+
+
+// Calculate a range for NAME from the operand 2 position of S
+// assuming the result of the statement is LHS. Return the range in
+// R, or false if no range could be calculated.
+
+bool
+gori_compute::compute_operand2_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name)
+{
+ int_range_max op1_range, op2_range;
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+
+ expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
+ expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
+
+ // Intersect with range for op2 based on lhs and op1.
+ if (!gimple_range_calc_op2 (r, stmt, lhs, op1_range))
+ return false;
+ op2_range.intersect (r);
+
+ gimple *src_stmt = SSA_NAME_DEF_STMT (op2);
+ // If def stmt is outside of this BB, then name must be an import.
+ if (!src_stmt || (gimple_bb (src_stmt) != gimple_bb (stmt)))
+ {
+ // If this isn't the right src statement, then abort calculation.
+ if (!src_stmt || gimple_get_lhs (src_stmt) != name)
+ return false;
+ return compute_name_range_op (r, src_stmt, op2_range, name);
+ }
+ // Then feed this range back as the LHS of the defining statement.
+ return compute_operand_range (r, src_stmt, op2_range, name);
+}
+
+// Calculate a range for NAME from both operand positions of S
+// assuming the result of the statement is LHS. Return the range in
+// R, or false if no range could be calculated.
+
+bool
+gori_compute::compute_operand1_and_operand2_range
+ (irange &r,
+ gimple *stmt,
+ const irange &lhs,
+ tree name)
+{
+ int_range_max op_range;
+
+ // Calculate a good a range for op2. Since op1 == op2, this will
+ // have already included whatever the actual range of name is.
+ if (!compute_operand2_range (op_range, stmt, lhs, name))
+ return false;
+
+ // Now get the range thru op1.
+ if (!compute_operand1_range (r, stmt, lhs, name))
+ return false;
+
+ // Whichever range is the most permissive is the one we need to
+ // use. (?) OR is that true? Maybe this should be intersection?
+ r.union_ (op_range);
+ return true;
+}
+
+// Return TRUE if a range can be calcalated for NAME on edge E.
+
+bool
+gori_compute::has_edge_range_p (edge e, tree name)
+{
+ return (m_gori_map->is_export_p (name, e->src)
+ || m_gori_map->def_chain_in_export_p (name, e->src));
+}
+
+// Dump what is known to GORI computes to listing file F.
+
+void
+gori_compute::dump (FILE *f)
+{
+ m_gori_map->dump (f);
+}
+
+// Calculate a range on edge E and return it in R. Try to evaluate a
+// range for NAME on this edge. Return FALSE if this is either not a
+// control edge or NAME is not defined by this edge.
+
+bool
+gori_compute::outgoing_edge_range_p (irange &r, edge e, tree name)
+{
+ int_range_max lhs;
+
+ gcc_checking_assert (gimple_range_ssa_p (name));
+ // Determine if there is an outgoing edge.
+ gimple *stmt = outgoing.edge_range_p (lhs, e);
+ if (!stmt)
+ return false;
+
+ // If NAME can be calculated on the edge, use that.
+ if (m_gori_map->is_export_p (name, e->src))
+ {
+ if (compute_operand_range (r, stmt, lhs, name))
+ {
+ // Sometimes compatible types get interchanged. See PR97360.
+ // Make sure we are returning the type of the thing we asked for.
+ if (!r.undefined_p () && r.type () != TREE_TYPE (name))
+ {
+ gcc_checking_assert (range_compatible_p (r.type (),
+ TREE_TYPE (name)));
+ range_cast (r, TREE_TYPE (name));
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+// --------------------------------------------------------------------------
+
+// Cache for SSAs that appear on the RHS of a boolean assignment.
+//
+// Boolean assignments of logical expressions (i.e. LHS = j_5 > 999)
+// have SSA operands whose range depend on the LHS of the assigment.
+// That is, the range of j_5 when LHS is true is different than when
+// LHS is false.
+//
+// This class caches the TRUE/FALSE ranges of such SSAs to avoid
+// recomputing.
+
+class logical_stmt_cache
+{
+public:
+ logical_stmt_cache ();
+ ~logical_stmt_cache ();
+ void set_range (tree lhs, tree name, const tf_range &);
+ bool get_range (tf_range &r, tree lhs, tree name) const;
+ bool cacheable_p (gimple *, const irange *lhs_range = NULL) const;
+ void dump (FILE *, gimple *stmt) const;
+ tree same_cached_name (tree lhs1, tree lh2) const;
+private:
+ tree cached_name (tree lhs) const;
+ void slot_diagnostics (tree lhs, const tf_range &range) const;
+ struct cache_entry
+ {
+ cache_entry (tree name, const irange &t_range, const irange &f_range);
+ void dump (FILE *out) const;
+ tree name;
+ tf_range range;
+ };
+ vec<cache_entry *> m_ssa_cache;
+};
+
+logical_stmt_cache::cache_entry::cache_entry (tree name,
+ const irange &t_range,
+ const irange &f_range)
+ : name (name), range (t_range, f_range)
+{
+}
+
+logical_stmt_cache::logical_stmt_cache ()
+{
+ m_ssa_cache.create (num_ssa_names + num_ssa_names / 10);
+ m_ssa_cache.safe_grow_cleared (num_ssa_names);
+}
+
+logical_stmt_cache::~logical_stmt_cache ()
+{
+ for (unsigned i = 0; i < m_ssa_cache.length (); ++i)
+ if (m_ssa_cache[i])
+ delete m_ssa_cache[i];
+ m_ssa_cache.release ();
+}
+
+// Dump cache_entry to OUT.
+
+void
+logical_stmt_cache::cache_entry::dump (FILE *out) const
+{
+ fprintf (out, "name=");
+ print_generic_expr (out, name, TDF_SLIM);
+ fprintf (out, " ");
+ range.true_range.dump (out);
+ fprintf (out, ", ");
+ range.false_range.dump (out);
+ fprintf (out, "\n");
+}
+
+// Update range for cache entry of NAME as it appears in the defining
+// statement of LHS.
+
+void
+logical_stmt_cache::set_range (tree lhs, tree name, const tf_range &range)
+{
+ unsigned version = SSA_NAME_VERSION (lhs);
+ if (version >= m_ssa_cache.length ())
+ m_ssa_cache.safe_grow_cleared (num_ssa_names + num_ssa_names / 10);
+
+ cache_entry *slot = m_ssa_cache[version];
+ slot_diagnostics (lhs, range);
+ if (slot)
+ {
+ // The IL must have changed. Update the carried SSA name for
+ // consistency. Testcase is libgomp.fortran/doacross1.f90.
+ if (slot->name != name)
+ slot->name = name;
+ return;
+ }
+ m_ssa_cache[version]
+ = new cache_entry (name, range.true_range, range.false_range);
+}
+
+// If there is a cached entry of NAME, set it in R and return TRUE,
+// otherwise return FALSE. LHS is the defining statement where NAME
+// appeared.
+
+bool
+logical_stmt_cache::get_range (tf_range &r, tree lhs, tree name) const
+{
+ gcc_checking_assert (cacheable_p (SSA_NAME_DEF_STMT (lhs)));
+ if (cached_name (lhs) == name)
+ {
+ unsigned version = SSA_NAME_VERSION (lhs);
+ if (m_ssa_cache[version])
+ {
+ r = m_ssa_cache[version]->range;
+ return true;
+ }
+ }
+ return false;
+}
+
+// If the defining statement of LHS is in the cache, return the SSA
+// operand being cached. That is, return SSA for LHS = SSA .RELOP. OP2.
+
+tree
+logical_stmt_cache::cached_name (tree lhs) const
+{
+ unsigned version = SSA_NAME_VERSION (lhs);
+
+ if (version >= m_ssa_cache.length ())
+ return NULL;
+
+ if (m_ssa_cache[version])
+ return m_ssa_cache[version]->name;
+ return NULL;
+}
+
+// Return TRUE if the cached name for LHS1 is the same as the
+// cached name for LHS2.
+
+tree
+logical_stmt_cache::same_cached_name (tree lhs1, tree lhs2) const
+{
+ tree name = cached_name (lhs1);
+ if (name && name == cached_name (lhs2))
+ return name;
+ return NULL;
+}
+
+// Return TRUE if STMT is a statement we are interested in caching.
+// LHS_RANGE is any known range for the LHS of STMT.
+
+bool
+logical_stmt_cache::cacheable_p (gimple *stmt, const irange *lhs_range) const
+{
+ if (gimple_code (stmt) == GIMPLE_ASSIGN
+ && types_compatible_p (TREE_TYPE (gimple_assign_lhs (stmt)),
+ boolean_type_node)
+ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
+ {
+ switch (gimple_expr_code (stmt))
+ {
+ case TRUTH_AND_EXPR:
+ case BIT_AND_EXPR:
+ case TRUTH_OR_EXPR:
+ case BIT_IOR_EXPR:
+ return !lhs_range || range_is_either_true_or_false (*lhs_range);
+ default:
+ return false;
+ }
+ }
+ return false;
+}
+
+// Output debugging diagnostics for the cache entry for LHS. RANGE is
+// the new range that is being cached.
+
+void
+logical_stmt_cache::slot_diagnostics (tree lhs, const tf_range &range) const
+{
+ gimple *stmt = SSA_NAME_DEF_STMT (lhs);
+ unsigned version = SSA_NAME_VERSION (lhs);
+ cache_entry *slot = m_ssa_cache[version];
+
+ if (!slot)
+ {
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file ? dump_file : stderr, "registering range for: ");
+ dump (dump_file ? dump_file : stderr, stmt);
+ }
+ return;
+ }
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file ? dump_file : stderr,
+ "reusing range for SSA #%d\n", version);
+ if (CHECKING_P && (slot->range.true_range != range.true_range
+ || slot->range.false_range != range.false_range))
+ {
+ fprintf (stderr, "FATAL: range altered for cached: ");
+ dump (stderr, stmt);
+ fprintf (stderr, "Attempt to change to:\n");
+ fprintf (stderr, "TRUE=");
+ range.true_range.dump (stderr);
+ fprintf (stderr, ", FALSE=");
+ range.false_range.dump (stderr);
+ fprintf (stderr, "\n");
+ gcc_unreachable ();
+ }
+}
+
+// Dump the cache information for STMT.
+
+void
+logical_stmt_cache::dump (FILE *out, gimple *stmt) const
+{
+ tree lhs = gimple_assign_lhs (stmt);
+ cache_entry *entry = m_ssa_cache[SSA_NAME_VERSION (lhs)];
+
+ print_gimple_stmt (out, stmt, 0, TDF_SLIM);
+ if (entry)
+ {
+ fprintf (out, "\tname = ");
+ print_generic_expr (out, entry->name);
+ fprintf (out, " lhs(%d)= ", SSA_NAME_VERSION (lhs));
+ print_generic_expr (out, lhs);
+ fprintf (out, "\n\tTRUE=");
+ entry->range.true_range.dump (out);
+ fprintf (out, ", FALSE=");
+ entry->range.false_range.dump (out);
+ fprintf (out, "\n");
+ }
+ else
+ fprintf (out, "[EMPTY]\n");
+}
+
+gori_compute_cache::gori_compute_cache ()
+{
+ m_cache = new logical_stmt_cache;
+}
+
+gori_compute_cache::~gori_compute_cache ()
+{
+ delete m_cache;
+}
+
+// Caching version of compute_operand_range. If NAME, as it appears
+// in STMT, has already been cached return it from the cache,
+// otherwise compute the operand range as normal and cache it.
+
+bool
+gori_compute_cache::compute_operand_range (irange &r, gimple *stmt,
+ const irange &lhs_range, tree name)
+{
+ bool cacheable = m_cache->cacheable_p (stmt, &lhs_range);
+ if (cacheable)
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ tf_range range;
+ if (m_cache->get_range (range, lhs, name))
+ {
+ if (lhs_range.zero_p ())
+ r = range.false_range;
+ else
+ r = range.true_range;
+ return true;
+ }
+ }
+ if (super::compute_operand_range (r, stmt, lhs_range, name))
+ {
+ if (cacheable)
+ cache_stmt (stmt);
+ return true;
+ }
+ return false;
+}
+
+// Cache STMT if possible.
+
+void
+gori_compute_cache::cache_stmt (gimple *stmt)
+{
+ gcc_checking_assert (m_cache->cacheable_p (stmt));
+ enum tree_code code = gimple_expr_code (stmt);
+ tree lhs = gimple_assign_lhs (stmt);
+ tree op1 = gimple_range_operand1 (stmt);
+ tree op2 = gimple_range_operand2 (stmt);
+ int_range_max r_true_side, r_false_side;
+
+ // LHS = s_5 && 999.
+ if (TREE_CODE (op2) == INTEGER_CST)
+ {
+ range_operator *handler = range_op_handler (code, TREE_TYPE (lhs));
+ int_range_max op2_range;
+ expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
+ tree type = TREE_TYPE (op1);
+ handler->op1_range (r_true_side, type, m_bool_one, op2_range);
+ handler->op1_range (r_false_side, type, m_bool_zero, op2_range);
+ m_cache->set_range (lhs, op1, tf_range (r_true_side, r_false_side));
+ }
+ // LHS = s_5 && b_8.
+ else if (tree cached_name = m_cache->same_cached_name (op1, op2))
+ {
+ tf_range op1_range, op2_range;
+ gcc_assert (m_cache->get_range (op1_range, op1, cached_name));
+ gcc_assert (m_cache->get_range (op2_range, op2, cached_name));
+ gcc_assert (logical_combine (r_true_side, code, m_bool_one,
+ op1_range, op2_range));
+ gcc_assert (logical_combine (r_false_side, code, m_bool_zero,
+ op1_range, op2_range));
+ m_cache->set_range (lhs, cached_name,
+ tf_range (r_true_side, r_false_side));
+ }
+}
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
new file mode 100644
index 0000000..8ef452b
--- /dev/null
+++ b/gcc/gimple-range-gori.h
@@ -0,0 +1,138 @@
+/* Header file for gimple range GORI structures.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@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/>. */
+
+#ifndef GCC_GIMPLE_RANGE_GORI_H
+#define GCC_GIMPLE_RANGE_GORI_H
+
+
+// This class is used to determine which SSA_NAMES can have ranges
+// calculated for them on outgoing edges from basic blocks. This represents
+// ONLY the effect of the basic block edge->src on a range.
+//
+// There are 2 primary entry points:
+//
+// has_edge_range_p (edge e, tree name)
+// returns true if the outgoing edge *may* be able to produce range
+// information for ssa_name NAME on edge E.
+// FALSE is returned if this edge does not affect the range of NAME.
+//
+// outgoing_edge_range_p (irange &range, edge e, tree name)
+// Actually does the calculation of RANGE for name on E
+// This represents application of whatever static range effect edge E
+// may have on NAME, not any cumulative effect.
+
+// There are also some internal APIs
+//
+// ssa_range_in_bb () is an internal routine which is used to start any
+// calculation chain using SSA_NAMES which come from outside the block. ie
+// a_2 = b_4 - 8
+// if (a_2 < 30)
+// on the true edge, a_2 is known to be [0, 29]
+// b_4 can be calculated as [8, 37]
+// during this calculation, b_4 is considered an "import" and ssa_range_in_bb
+// is queried for a starting range which is used in the calculation.
+// A default value of VARYING provides the raw static info for the edge.
+//
+// If there is any known range for b_4 coming into this block, it can refine
+// the results. This allows for cascading results to be propogated.
+// if b_4 is [100, 200] on entry to the block, feeds into the calculation
+// of a_2 = [92, 192], and finally on the true edge the range would be
+// an empty range [] because it is not possible for the true edge to be taken.
+//
+// expr_range_in_bb is simply a wrapper which calls ssa_range_in_bb for
+// SSA_NAMES and otherwise simply calculates the range of the expression.
+//
+// The remaining routines are internal use only.
+
+class gori_compute
+{
+public:
+ gori_compute ();
+ ~gori_compute ();
+ bool outgoing_edge_range_p (irange &r, edge e, tree name);
+ bool has_edge_range_p (edge e, tree name);
+ void dump (FILE *f);
+protected:
+ virtual void ssa_range_in_bb (irange &r, tree name, basic_block bb);
+ virtual bool compute_operand_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name);
+
+ void expr_range_in_bb (irange &r, tree expr, basic_block bb);
+ bool compute_logical_operands (irange &r, gimple *stmt,
+ const irange &lhs,
+ tree name);
+ void compute_logical_operands_in_chain (class tf_range &range,
+ gimple *stmt, const irange &lhs,
+ tree name, tree op,
+ bool op_in_chain);
+ bool optimize_logical_operands (tf_range &range, gimple *stmt,
+ const irange &lhs, tree name, tree op);
+ bool logical_combine (irange &r, enum tree_code code, const irange &lhs,
+ const class tf_range &op1_range,
+ const class tf_range &op2_range);
+ int_range<2> m_bool_zero; // Boolean false cached.
+ int_range<2> m_bool_one; // Boolean true cached.
+
+private:
+ bool compute_operand_range_switch (irange &r, gswitch *stmt,
+ const irange &lhs, tree name);
+ bool compute_name_range_op (irange &r, gimple *stmt, const irange &lhs,
+ tree name);
+ bool compute_operand1_range (irange &r, gimple *stmt, const irange &lhs,
+ tree name);
+ bool compute_operand2_range (irange &r, gimple *stmt, const irange &lhs,
+ tree name);
+ bool compute_operand1_and_operand2_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name);
+
+ class gori_map *m_gori_map;
+ outgoing_range outgoing; // Edge values for COND_EXPR & SWITCH_EXPR.
+};
+
+
+// This class adds a cache to gori_computes for logical expressions.
+// bool result = x && y
+// requires calcuation of both X and Y for both true and false results.
+// There are 4 combinations [0,0][0,0] [0,0][1,1] [1,1][0,0] and [1,1][1,1].
+// Note that each pair of possible results for X and Y are used twice, and
+// the calcuation of those results are the same each time.
+//
+// The cache simply checks if a stmt is cachable, and if so, saves both the
+// true and false results for the next time the query is made.
+//
+// This is used to speed up long chains of logical operations which
+// quickly become exponential.
+
+class gori_compute_cache : public gori_compute
+{
+public:
+ gori_compute_cache ();
+ ~gori_compute_cache ();
+protected:
+ virtual bool compute_operand_range (irange &r, gimple *stmt,
+ const irange &lhs, tree name);
+private:
+ void cache_stmt (gimple *);
+ typedef gori_compute super;
+ class logical_stmt_cache *m_cache;
+};
+
+#endif // GCC_GIMPLE_RANGE_GORI_H
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
new file mode 100644
index 0000000..267ebad
--- /dev/null
+++ b/gcc/gimple-range.cc
@@ -0,0 +1,1348 @@
+/* Code for GIMPLE range related routines.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "insn-codes.h"
+#include "rtl.h"
+#include "tree.h"
+#include "gimple.h"
+#include "ssa.h"
+#include "gimple-pretty-print.h"
+#include "gimple-iterator.h"
+#include "optabs-tree.h"
+#include "gimple-fold.h"
+#include "tree-cfg.h"
+#include "fold-const.h"
+#include "tree-cfg.h"
+#include "wide-int.h"
+#include "fold-const.h"
+#include "case-cfn-macros.h"
+#include "omp-general.h"
+#include "cfgloop.h"
+#include "tree-ssa-loop.h"
+#include "tree-scalar-evolution.h"
+#include "dbgcnt.h"
+#include "alloc-pool.h"
+#include "vr-values.h"
+#include "gimple-range.h"
+
+
+// Adjust the range for a pointer difference where the operands came
+// from a memchr.
+//
+// This notices the following sequence:
+//
+// def = __builtin_memchr (arg, 0, sz)
+// n = def - arg
+//
+// The range for N can be narrowed to [0, PTRDIFF_MAX - 1].
+
+static void
+adjust_pointer_diff_expr (irange &res, const gimple *diff_stmt)
+{
+ tree op0 = gimple_assign_rhs1 (diff_stmt);
+ tree op1 = gimple_assign_rhs2 (diff_stmt);
+ tree op0_ptype = TREE_TYPE (TREE_TYPE (op0));
+ tree op1_ptype = TREE_TYPE (TREE_TYPE (op1));
+ gimple *call;
+
+ if (TREE_CODE (op0) == SSA_NAME
+ && TREE_CODE (op1) == SSA_NAME
+ && (call = SSA_NAME_DEF_STMT (op0))
+ && is_gimple_call (call)
+ && gimple_call_builtin_p (call, BUILT_IN_MEMCHR)
+ && TYPE_MODE (op0_ptype) == TYPE_MODE (char_type_node)
+ && TYPE_PRECISION (op0_ptype) == TYPE_PRECISION (char_type_node)
+ && TYPE_MODE (op1_ptype) == TYPE_MODE (char_type_node)
+ && TYPE_PRECISION (op1_ptype) == TYPE_PRECISION (char_type_node)
+ && gimple_call_builtin_p (call, BUILT_IN_MEMCHR)
+ && vrp_operand_equal_p (op1, gimple_call_arg (call, 0))
+ && integer_zerop (gimple_call_arg (call, 1)))
+ {
+ tree max = vrp_val_max (ptrdiff_type_node);
+ wide_int wmax = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max)));
+ tree expr_type = gimple_expr_type (diff_stmt);
+ tree range_min = build_zero_cst (expr_type);
+ tree range_max = wide_int_to_tree (expr_type, wmax - 1);
+ int_range<2> r (range_min, range_max);
+ res.intersect (r);
+ }
+}
+
+// This function looks for situations when walking the use/def chains
+// may provide additonal contextual range information not exposed on
+// this statement. Like knowing the IMAGPART return value from a
+// builtin function is a boolean result.
+
+// We should rework how we're called, as we have an op_unknown entry
+// for IMAGPART_EXPR and POINTER_DIFF_EXPR in range-ops just so this
+// function gets called.
+
+static void
+gimple_range_adjustment (irange &res, const gimple *stmt)
+{
+ switch (gimple_expr_code (stmt))
+ {
+ case POINTER_DIFF_EXPR:
+ adjust_pointer_diff_expr (res, stmt);
+ return;
+
+ case IMAGPART_EXPR:
+ {
+ tree name = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+ if (TREE_CODE (name) == SSA_NAME)
+ {
+ gimple *def_stmt = SSA_NAME_DEF_STMT (name);
+ if (def_stmt && is_gimple_call (def_stmt)
+ && gimple_call_internal_p (def_stmt))
+ {
+ switch (gimple_call_internal_fn (def_stmt))
+ {
+ case IFN_ADD_OVERFLOW:
+ case IFN_SUB_OVERFLOW:
+ case IFN_MUL_OVERFLOW:
+ case IFN_ATOMIC_COMPARE_EXCHANGE:
+ {
+ int_range<2> r;
+ r.set_varying (boolean_type_node);
+ tree type = TREE_TYPE (gimple_assign_lhs (stmt));
+ range_cast (r, type);
+ res.intersect (r);
+ }
+ default:
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+// Return a range in R for the tree EXPR. Return true if a range is
+// representable.
+
+bool
+get_tree_range (irange &r, tree expr)
+{
+ tree type;
+ if (TYPE_P (expr))
+ type = expr;
+ else
+ type = TREE_TYPE (expr);
+
+ // Return false if the type isn't suported.
+ if (!irange::supports_type_p (type))
+ return false;
+
+ switch (TREE_CODE (expr))
+ {
+ case INTEGER_CST:
+ r.set (expr, expr);
+ return true;
+
+ case SSA_NAME:
+ r = gimple_range_global (expr);
+ return true;
+
+ case ADDR_EXPR:
+ {
+ // Handle &var which can show up in phi arguments.
+ bool ov;
+ if (tree_single_nonzero_warnv_p (expr, &ov))
+ {
+ r = range_nonzero (type);
+ return true;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ r.set_varying (type);
+ return true;
+}
+
+// Fold this unary statement using R1 as operand1's range, returning
+// the result in RES. Return false if the operation fails.
+
+bool
+gimple_range_fold (irange &res, const gimple *stmt, const irange &r1)
+{
+ gcc_checking_assert (gimple_range_handler (stmt));
+
+ tree type = gimple_expr_type (stmt);
+ // Unary SSA operations require the LHS type as the second range.
+ int_range<2> r2 (type);
+
+ return gimple_range_fold (res, stmt, r1, r2);
+}
+
+// Fold this binary statement using R1 and R2 as the operands ranges,
+// returning the result in RES. Return false if the operation fails.
+
+bool
+gimple_range_fold (irange &res, const gimple *stmt,
+ const irange &r1, const irange &r2)
+{
+ gcc_checking_assert (gimple_range_handler (stmt));
+
+ gimple_range_handler (stmt)->fold_range (res, gimple_expr_type (stmt),
+ r1, r2);
+
+ // If there are any gimple lookups, do those now.
+ gimple_range_adjustment (res, stmt);
+ return true;
+}
+
+// Return the base of the RHS of an assignment.
+
+tree
+gimple_range_base_of_assignment (const gimple *stmt)
+{
+ gcc_checking_assert (gimple_code (stmt) == GIMPLE_ASSIGN);
+ tree op1 = gimple_assign_rhs1 (stmt);
+ if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
+ return get_base_address (TREE_OPERAND (op1, 0));
+ return op1;
+}
+
+// Return the first operand of this statement if it is a valid operand
+// supported by ranges, otherwise return NULL_TREE. Special case is
+// &(SSA_NAME expr), return the SSA_NAME instead of the ADDR expr.
+
+tree
+gimple_range_operand1 (const gimple *stmt)
+{
+ gcc_checking_assert (gimple_range_handler (stmt));
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ return gimple_cond_lhs (stmt);
+ case GIMPLE_ASSIGN:
+ {
+ tree base = gimple_range_base_of_assignment (stmt);
+ if (base && TREE_CODE (base) == MEM_REF)
+ {
+ // If the base address is an SSA_NAME, we return it
+ // here. This allows processing of the range of that
+ // name, while the rest of the expression is simply
+ // ignored. The code in range_ops will see the
+ // ADDR_EXPR and do the right thing.
+ tree ssa = TREE_OPERAND (base, 0);
+ if (TREE_CODE (ssa) == SSA_NAME)
+ return ssa;
+ }
+ return base;
+ }
+ default:
+ break;
+ }
+ return NULL;
+}
+
+// Return the second operand of statement STMT, otherwise return NULL_TREE.
+
+tree
+gimple_range_operand2 (const gimple *stmt)
+{
+ gcc_checking_assert (gimple_range_handler (stmt));
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ return gimple_cond_rhs (stmt);
+ case GIMPLE_ASSIGN:
+ if (gimple_num_ops (stmt) >= 3)
+ return gimple_assign_rhs2 (stmt);
+ default:
+ break;
+ }
+ return NULL_TREE;
+}
+
+// Calculate what we can determine of the range of this unary
+// statement's operand if the lhs of the expression has the range
+// LHS_RANGE. Return false if nothing can be determined.
+
+bool
+gimple_range_calc_op1 (irange &r, const gimple *stmt, const irange &lhs_range)
+{
+ gcc_checking_assert (gimple_num_ops (stmt) < 3);
+
+ // An empty range is viral.
+ tree type = TREE_TYPE (gimple_range_operand1 (stmt));
+ if (lhs_range.undefined_p ())
+ {
+ r.set_undefined ();
+ return true;
+ }
+ // Unary operations require the type of the first operand in the
+ // second range position.
+ int_range<2> type_range (type);
+ return gimple_range_handler (stmt)->op1_range (r, type, lhs_range,
+ type_range);
+}
+
+// Calculate what we can determine of the range of this statement's
+// first operand if the lhs of the expression has the range LHS_RANGE
+// and the second operand has the range OP2_RANGE. Return false if
+// nothing can be determined.
+
+bool
+gimple_range_calc_op1 (irange &r, const gimple *stmt,
+ const irange &lhs_range, const irange &op2_range)
+{
+ // Unary operation are allowed to pass a range in for second operand
+ // as there are often additional restrictions beyond the type which
+ // can be imposed. See operator_cast::op1_range().
+ tree type = TREE_TYPE (gimple_range_operand1 (stmt));
+ // An empty range is viral.
+ if (op2_range.undefined_p () || lhs_range.undefined_p ())
+ {
+ r.set_undefined ();
+ return true;
+ }
+ return gimple_range_handler (stmt)->op1_range (r, type, lhs_range,
+ op2_range);
+}
+
+// Calculate what we can determine of the range of this statement's
+// second operand if the lhs of the expression has the range LHS_RANGE
+// and the first operand has the range OP1_RANGE. Return false if
+// nothing can be determined.
+
+bool
+gimple_range_calc_op2 (irange &r, const gimple *stmt,
+ const irange &lhs_range, const irange &op1_range)
+{
+ tree type = TREE_TYPE (gimple_range_operand2 (stmt));
+ // An empty range is viral.
+ if (op1_range.undefined_p () || lhs_range.undefined_p ())
+ {
+ r.set_undefined ();
+ return true;
+ }
+ return gimple_range_handler (stmt)->op2_range (r, type, lhs_range,
+ op1_range);
+}
+
+// Calculate a range for statement S and return it in R. If NAME is provided it
+// represents the SSA_NAME on the LHS of the statement. It is only required
+// if there is more than one lhs/output. If a range cannot
+// be calculated, return false.
+
+bool
+gimple_ranger::calc_stmt (irange &r, gimple *s, tree name)
+{
+ bool res = false;
+ // If name is specified, make sure it is an LHS of S.
+ gcc_checking_assert (name ? SSA_NAME_DEF_STMT (name) == s : true);
+
+ if (gimple_range_handler (s))
+ res = range_of_range_op (r, s);
+ else if (is_a<gphi *>(s))
+ res = range_of_phi (r, as_a<gphi *> (s));
+ else if (is_a<gcall *>(s))
+ res = range_of_call (r, as_a<gcall *> (s));
+ else if (is_a<gassign *> (s) && gimple_assign_rhs_code (s) == COND_EXPR)
+ res = range_of_cond_expr (r, as_a<gassign *> (s));
+ else
+ {
+ // If no name is specified, try the expression kind.
+ if (!name)
+ {
+ tree t = gimple_expr_type (s);
+ if (!irange::supports_type_p (t))
+ return false;
+ r.set_varying (t);
+ return true;
+ }
+ // We don't understand the stmt, so return the global range.
+ r = gimple_range_global (name);
+ return true;
+ }
+ if (res)
+ {
+ if (r.undefined_p ())
+ return true;
+ // We sometimes get compatible types copied from operands, make sure
+ // the correct type is being returned.
+ if (name && TREE_TYPE (name) != r.type ())
+ {
+ gcc_checking_assert (range_compatible_p (r.type (),
+ TREE_TYPE (name)));
+ range_cast (r, TREE_TYPE (name));
+ }
+ return true;
+ }
+ return false;
+}
+
+// Calculate a range for range_op statement S and return it in R. If any
+// If a range cannot be calculated, return false.
+
+bool
+gimple_ranger::range_of_range_op (irange &r, gimple *s)
+{
+ int_range_max range1, range2;
+ tree type = gimple_expr_type (s);
+ gcc_checking_assert (irange::supports_type_p (type));
+
+ tree op1 = gimple_range_operand1 (s);
+ tree op2 = gimple_range_operand2 (s);
+
+ if (range_of_non_trivial_assignment (r, s))
+ return true;
+
+ if (range_of_expr (range1, op1, s))
+ {
+ if (!op2)
+ return gimple_range_fold (r, s, range1);
+
+ if (range_of_expr (range2, op2, s))
+ return gimple_range_fold (r, s, range1, range2);
+ }
+ r.set_varying (type);
+ return true;
+}
+
+// Calculate the range of a non-trivial assignment. That is, is one
+// inolving arithmetic on an SSA name (for example, an ADDR_EXPR).
+// Return the range in R.
+//
+// If a range cannot be calculated, return false.
+
+bool
+gimple_ranger::range_of_non_trivial_assignment (irange &r, gimple *stmt)
+{
+ if (gimple_code (stmt) != GIMPLE_ASSIGN)
+ return false;
+
+ tree base = gimple_range_base_of_assignment (stmt);
+ if (base)
+ {
+ if (TREE_CODE (base) == MEM_REF)
+ {
+ if (TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
+ {
+ int_range_max range1;
+ tree ssa = TREE_OPERAND (base, 0);
+ if (range_of_expr (range1, ssa, stmt))
+ {
+ tree type = TREE_TYPE (ssa);
+ range_operator *op = range_op_handler (POINTER_PLUS_EXPR,
+ type);
+ int_range<2> offset (TREE_OPERAND (base, 1),
+ TREE_OPERAND (base, 1));
+ op->fold_range (r, type, range1, offset);
+ return true;
+ }
+ }
+ return false;
+ }
+ if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
+ {
+ // Handle "= &a" and return non-zero.
+ r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt)));
+ return true;
+ }
+ }
+ return false;
+}
+
+// Calculate a range for phi statement S and return it in R.
+// If a range cannot be calculated, return false.
+
+bool
+gimple_ranger::range_of_phi (irange &r, gphi *phi)
+{
+ tree phi_def = gimple_phi_result (phi);
+ tree type = TREE_TYPE (phi_def);
+ int_range_max arg_range;
+ unsigned x;
+
+ if (!irange::supports_type_p (type))
+ return false;
+
+ // Start with an empty range, unioning in each argument's range.
+ r.set_undefined ();
+ for (x = 0; x < gimple_phi_num_args (phi); x++)
+ {
+ tree arg = gimple_phi_arg_def (phi, x);
+ edge e = gimple_phi_arg_edge (phi, x);
+
+ range_on_edge (arg_range, e, arg);
+ r.union_ (arg_range);
+ // Once the value reaches varying, stop looking.
+ if (r.varying_p ())
+ break;
+ }
+
+ // If SCEV is available, query if this PHI has any knonwn values.
+ if (scev_initialized_p () && !POINTER_TYPE_P (TREE_TYPE (phi_def)))
+ {
+ value_range loop_range;
+ class loop *l = loop_containing_stmt (phi);
+ if (l && loop_outer (l))
+ {
+ range_of_ssa_name_with_loop_info (loop_range, phi_def, l, phi);
+ if (!loop_range.varying_p ())
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " Loops range found for ");
+ print_generic_expr (dump_file, phi_def, TDF_SLIM);
+ fprintf (dump_file, ": ");
+ loop_range.dump (dump_file);
+ fprintf (dump_file, " and calculated range :");
+ r.dump (dump_file);
+ fprintf (dump_file, "\n");
+ }
+ r.intersect (loop_range);
+ }
+ }
+ }
+
+ return true;
+}
+
+// Calculate a range for call statement S and return it in R.
+// If a range cannot be calculated, return false.
+
+bool
+gimple_ranger::range_of_call (irange &r, gcall *call)
+{
+ tree type = gimple_call_return_type (call);
+ tree lhs = gimple_call_lhs (call);
+ bool strict_overflow_p;
+
+ if (!irange::supports_type_p (type))
+ return false;
+
+ if (range_of_builtin_call (r, call))
+ ;
+ else if (gimple_stmt_nonnegative_warnv_p (call, &strict_overflow_p))
+ r.set (build_int_cst (type, 0), TYPE_MAX_VALUE (type));
+ else if (gimple_call_nonnull_result_p (call)
+ || gimple_call_nonnull_arg (call))
+ r = range_nonzero (type);
+ else
+ r.set_varying (type);
+
+ // If there is an LHS, intersect that with what is known.
+ if (lhs)
+ {
+ value_range def;
+ def = gimple_range_global (lhs);
+ r.intersect (def);
+ }
+ return true;
+}
+
+// Return the range of a __builtin_ubsan* in CALL and set it in R.
+// CODE is the type of ubsan call (PLUS_EXPR, MINUS_EXPR or
+// MULT_EXPR).
+
+static void
+range_of_builtin_ubsan_call (range_query &query, irange &r, gcall *call,
+ tree_code code)
+{
+ gcc_checking_assert (code == PLUS_EXPR || code == MINUS_EXPR
+ || code == MULT_EXPR);
+ tree type = gimple_call_return_type (call);
+ range_operator *op = range_op_handler (code, type);
+ gcc_checking_assert (op);
+ int_range_max ir0, ir1;
+ tree arg0 = gimple_call_arg (call, 0);
+ tree arg1 = gimple_call_arg (call, 1);
+ gcc_assert (query.range_of_expr (ir0, arg0, call));
+ gcc_assert (query.range_of_expr (ir1, arg1, call));
+
+ bool saved_flag_wrapv = flag_wrapv;
+ // Pretend the arithmetic is wrapping. If there is any overflow,
+ // we'll complain, but will actually do wrapping operation.
+ flag_wrapv = 1;
+ op->fold_range (r, type, ir0, ir1);
+ flag_wrapv = saved_flag_wrapv;
+
+ // If for both arguments vrp_valueize returned non-NULL, this should
+ // have been already folded and if not, it wasn't folded because of
+ // overflow. Avoid removing the UBSAN_CHECK_* calls in that case.
+ if (r.singleton_p ())
+ r.set_varying (type);
+}
+
+// For a builtin in CALL, return a range in R if known and return
+// TRUE. Otherwise return FALSE.
+
+bool
+range_of_builtin_call (range_query &query, irange &r, gcall *call)
+{
+ combined_fn func = gimple_call_combined_fn (call);
+ if (func == CFN_LAST)
+ return false;
+
+ tree type = gimple_call_return_type (call);
+ tree arg;
+ int mini, maxi, zerov, prec;
+ scalar_int_mode mode;
+
+ switch (func)
+ {
+ case CFN_BUILT_IN_CONSTANT_P:
+ if (cfun->after_inlining)
+ {
+ r.set_zero (type);
+ // r.equiv_clear ();
+ return true;
+ }
+ arg = gimple_call_arg (call, 0);
+ if (query.range_of_expr (r, arg, call) && r.singleton_p ())
+ {
+ r.set (build_one_cst (type), build_one_cst (type));
+ return true;
+ }
+ break;
+
+ CASE_CFN_FFS:
+ CASE_CFN_POPCOUNT:
+ // __builtin_ffs* and __builtin_popcount* return [0, prec].
+ arg = gimple_call_arg (call, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec;
+ gcc_assert (query.range_of_expr (r, arg, call));
+ // If arg is non-zero, then ffs or popcount are non-zero.
+ if (!range_includes_zero_p (&r))
+ mini = 1;
+ // If some high bits are known to be zero, decrease the maximum.
+ if (!r.undefined_p ())
+ {
+ if (TYPE_SIGN (r.type ()) == SIGNED)
+ range_cast (r, unsigned_type_for (r.type ()));
+ wide_int max = r.upper_bound ();
+ maxi = wi::floor_log2 (max) + 1;
+ }
+ r.set (build_int_cst (type, mini), build_int_cst (type, maxi));
+ return true;
+
+ CASE_CFN_PARITY:
+ r.set (build_zero_cst (type), build_one_cst (type));
+ return true;
+
+ CASE_CFN_CLZ:
+ // __builtin_c[lt]z* return [0, prec-1], except when the
+ // argument is 0, but that is undefined behavior.
+ //
+ // For __builtin_c[lt]z* consider argument of 0 always undefined
+ // behavior, for internal fns depending on C?Z_DEFINED_VALUE_AT_ZERO.
+ arg = gimple_call_arg (call, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec - 1;
+ mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
+ if (gimple_call_internal_p (call))
+ {
+ if (optab_handler (clz_optab, mode) != CODE_FOR_nothing
+ && CLZ_DEFINED_VALUE_AT_ZERO (mode, zerov) == 2)
+ {
+ // Only handle the single common value.
+ if (zerov == prec)
+ maxi = prec;
+ else
+ // Magic value to give up, unless we can prove arg is non-zero.
+ mini = -2;
+ }
+ }
+
+ gcc_assert (query.range_of_expr (r, arg, call));
+ // From clz of minimum we can compute result maximum.
+ if (r.constant_p ())
+ {
+ int newmaxi = prec - 1 - wi::floor_log2 (r.lower_bound ());
+ // Argument is unsigned, so do nothing if it is [0, ...] range.
+ if (newmaxi != prec)
+ {
+ mini = 0;
+ maxi = newmaxi;
+ }
+ }
+ else if (!range_includes_zero_p (&r))
+ {
+ maxi = prec - 1;
+ mini = 0;
+ }
+ if (mini == -2)
+ break;
+ // From clz of maximum we can compute result minimum.
+ if (r.constant_p ())
+ {
+ int newmini = prec - 1 - wi::floor_log2 (r.upper_bound ());
+ if (newmini == prec)
+ {
+ // Argument range is [0, 0]. If CLZ_DEFINED_VALUE_AT_ZERO
+ // is 2 with VALUE of prec, return [prec, prec], otherwise
+ // ignore the range.
+ if (maxi == prec)
+ mini = prec;
+ }
+ else
+ mini = newmini;
+ }
+ if (mini == -2)
+ break;
+ r.set (build_int_cst (type, mini), build_int_cst (type, maxi));
+ return true;
+
+ CASE_CFN_CTZ:
+ // __builtin_ctz* return [0, prec-1], except for when the
+ // argument is 0, but that is undefined behavior.
+ //
+ // For __builtin_ctz* consider argument of 0 always undefined
+ // behavior, for internal fns depending on CTZ_DEFINED_VALUE_AT_ZERO.
+ arg = gimple_call_arg (call, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec - 1;
+ mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
+ if (gimple_call_internal_p (call))
+ {
+ if (optab_handler (ctz_optab, mode) != CODE_FOR_nothing
+ && CTZ_DEFINED_VALUE_AT_ZERO (mode, zerov) == 2)
+ {
+ // Handle only the two common values.
+ if (zerov == -1)
+ mini = -1;
+ else if (zerov == prec)
+ maxi = prec;
+ else
+ // Magic value to give up, unless we can prove arg is non-zero.
+ mini = -2;
+ }
+ }
+ gcc_assert (query.range_of_expr (r, arg, call));
+ if (!r.undefined_p ())
+ {
+ if (r.lower_bound () != 0)
+ {
+ mini = 0;
+ maxi = prec - 1;
+ }
+ // If some high bits are known to be zero, we can decrease
+ // the maximum.
+ wide_int max = r.upper_bound ();
+ if (max == 0)
+ {
+ // Argument is [0, 0]. If CTZ_DEFINED_VALUE_AT_ZERO
+ // is 2 with value -1 or prec, return [-1, -1] or [prec, prec].
+ // Otherwise ignore the range.
+ if (mini == -1)
+ maxi = -1;
+ else if (maxi == prec)
+ mini = prec;
+ }
+ // If value at zero is prec and 0 is in the range, we can't lower
+ // the upper bound. We could create two separate ranges though,
+ // [0,floor_log2(max)][prec,prec] though.
+ else if (maxi != prec)
+ maxi = wi::floor_log2 (max);
+ }
+ if (mini == -2)
+ break;
+ r.set (build_int_cst (type, mini), build_int_cst (type, maxi));
+ return true;
+
+ CASE_CFN_CLRSB:
+ arg = gimple_call_arg (call, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ r.set (build_int_cst (type, 0), build_int_cst (type, prec - 1));
+ return true;
+ case CFN_UBSAN_CHECK_ADD:
+ range_of_builtin_ubsan_call (query, r, call, PLUS_EXPR);
+ return true;
+ case CFN_UBSAN_CHECK_SUB:
+ range_of_builtin_ubsan_call (query, r, call, MINUS_EXPR);
+ return true;
+ case CFN_UBSAN_CHECK_MUL:
+ range_of_builtin_ubsan_call (query, r, call, MULT_EXPR);
+ return true;
+
+ case CFN_GOACC_DIM_SIZE:
+ case CFN_GOACC_DIM_POS:
+ // Optimizing these two internal functions helps the loop
+ // optimizer eliminate outer comparisons. Size is [1,N]
+ // and pos is [0,N-1].
+ {
+ bool is_pos = func == CFN_GOACC_DIM_POS;
+ int axis = oacc_get_ifn_dim_arg (call);
+ int size = oacc_get_fn_dim_size (current_function_decl, axis);
+ if (!size)
+ // If it's dynamic, the backend might know a hardware limitation.
+ size = targetm.goacc.dim_limit (axis);
+
+ r.set (build_int_cst (type, is_pos ? 0 : 1),
+ size
+ ? build_int_cst (type, size - is_pos) : vrp_val_max (type));
+ return true;
+ }
+
+ case CFN_BUILT_IN_STRLEN:
+ if (tree lhs = gimple_call_lhs (call))
+ if (ptrdiff_type_node
+ && (TYPE_PRECISION (ptrdiff_type_node)
+ == TYPE_PRECISION (TREE_TYPE (lhs))))
+ {
+ tree type = TREE_TYPE (lhs);
+ tree max = vrp_val_max (ptrdiff_type_node);
+ wide_int wmax
+ = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max)));
+ tree range_min = build_zero_cst (type);
+ // To account for the terminating NULL, the maximum length
+ // is one less than the maximum array size, which in turn
+ // is one less than PTRDIFF_MAX (or SIZE_MAX where it's
+ // smaller than the former type).
+ // FIXME: Use max_object_size() - 1 here.
+ tree range_max = wide_int_to_tree (type, wmax - 2);
+ r.set (range_min, range_max);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+}
+
+
+bool
+gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
+{
+ return ::range_of_builtin_call (*this, r, call);
+}
+
+// Calculate a range for COND_EXPR statement S and return it in R.
+// If a range cannot be calculated, return false.
+
+bool
+gimple_ranger::range_of_cond_expr (irange &r, gassign *s)
+{
+ int_range_max cond_range, range1, range2;
+ tree cond = gimple_assign_rhs1 (s);
+ tree op1 = gimple_assign_rhs2 (s);
+ tree op2 = gimple_assign_rhs3 (s);
+
+ gcc_checking_assert (gimple_assign_rhs_code (s) == COND_EXPR);
+ gcc_checking_assert (useless_type_conversion_p (TREE_TYPE (op1),
+ TREE_TYPE (op2)));
+ if (!irange::supports_type_p (TREE_TYPE (op1)))
+ return false;
+
+ gcc_assert (range_of_expr (cond_range, cond, s));
+ gcc_assert (range_of_expr (range1, op1, s));
+ gcc_assert (range_of_expr (range2, op2, s));
+
+ // If the condition is known, choose the appropriate expression.
+ if (cond_range.singleton_p ())
+ {
+ // False, pick second operand.
+ if (cond_range.zero_p ())
+ r = range2;
+ else
+ r = range1;
+ }
+ else
+ {
+ r = range1;
+ r.union_ (range2);
+ }
+ return true;
+}
+
+bool
+gimple_ranger::range_of_expr (irange &r, tree expr, gimple *stmt)
+{
+ if (!gimple_range_ssa_p (expr))
+ return get_tree_range (r, expr);
+
+ // If there is no statement, just get the global value.
+ if (!stmt)
+ {
+ if (!m_cache.m_globals.get_global_range (r, expr))
+ r = gimple_range_global (expr);
+ return true;
+ }
+
+ basic_block bb = gimple_bb (stmt);
+ gimple *def_stmt = SSA_NAME_DEF_STMT (expr);
+
+ // If name is defined in this block, try to get an range from S.
+ if (def_stmt && gimple_bb (def_stmt) == bb)
+ gcc_assert (range_of_stmt (r, def_stmt, expr));
+ else
+ // Otherwise OP comes from outside this block, use range on entry.
+ range_on_entry (r, bb, expr);
+
+ // No range yet, see if there is a dereference in the block.
+ // We don't care if it's between the def and a use within a block
+ // because the entire block must be executed anyway.
+ // FIXME:?? For non-call exceptions we could have a statement throw
+ // which causes an early block exit.
+ // in which case we may need to walk from S back to the def/top of block
+ // to make sure the deref happens between S and there before claiming
+ // there is a deref. Punt for now.
+ if (!cfun->can_throw_non_call_exceptions && r.varying_p () &&
+ m_cache.m_non_null.non_null_deref_p (expr, bb))
+ r = range_nonzero (TREE_TYPE (expr));
+
+ return true;
+}
+
+// Return the range of NAME on entry to block BB in R.
+
+void
+gimple_ranger::range_on_entry (irange &r, basic_block bb, tree name)
+{
+ int_range_max entry_range;
+ gcc_checking_assert (gimple_range_ssa_p (name));
+
+ // Start with any known range
+ gcc_assert (range_of_stmt (r, SSA_NAME_DEF_STMT (name), name));
+
+ // Now see if there is any on_entry value which may refine it.
+ if (m_cache.block_range (entry_range, bb, name))
+ r.intersect (entry_range);
+}
+
+// Calculate the range for NAME at the end of block BB and return it in R.
+// Return false if no range can be calculated.
+
+void
+gimple_ranger::range_on_exit (irange &r, basic_block bb, tree name)
+{
+ // on-exit from the exit block?
+ gcc_checking_assert (bb != EXIT_BLOCK_PTR_FOR_FN (cfun));
+
+ gimple *s = last_stmt (bb);
+ // If there is no statement in the block and this isn't the entry
+ // block, go get the range_on_entry for this block. For the entry
+ // block, a NULL stmt will return the global value for NAME.
+ if (!s && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun))
+ range_on_entry (r, bb, name);
+ else
+ gcc_assert (range_of_expr (r, name, s));
+ gcc_checking_assert (r.undefined_p ()
+ || range_compatible_p (r.type (), TREE_TYPE (name)));
+}
+
+// Calculate a range for NAME on edge E and return it in R.
+
+bool
+gimple_ranger::range_on_edge (irange &r, edge e, tree name)
+{
+ int_range_max edge_range;
+ gcc_checking_assert (irange::supports_type_p (TREE_TYPE (name)));
+
+ // PHI arguments can be constants, catch these here.
+ if (!gimple_range_ssa_p (name))
+ {
+ gcc_assert (range_of_expr (r, name));
+ return true;
+ }
+
+ range_on_exit (r, e->src, name);
+ gcc_checking_assert (r.undefined_p ()
+ || range_compatible_p (r.type(), TREE_TYPE (name)));
+
+ // Check to see if NAME is defined on edge e.
+ if (m_cache.outgoing_edge_range_p (edge_range, e, name))
+ r.intersect (edge_range);
+
+ return true;
+}
+
+// Calculate a range for statement S and return it in R. If NAME is
+// provided it represents the SSA_NAME on the LHS of the statement.
+// It is only required if there is more than one lhs/output. Check
+// the global cache for NAME first to see if the evaluation can be
+// avoided. If a range cannot be calculated, return false.
+
+bool
+gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name)
+{
+ // If no name, simply call the base routine.
+ if (!name)
+ name = gimple_get_lhs (s);
+
+ if (!name)
+ return calc_stmt (r, s, NULL_TREE);
+
+ gcc_checking_assert (TREE_CODE (name) == SSA_NAME &&
+ irange::supports_type_p (TREE_TYPE (name)));
+
+ // If this STMT has already been processed, return that value.
+ if (m_cache.m_globals.get_global_range (r, name))
+ return true;
+ // Avoid infinite recursion by initializing global cache
+ int_range_max tmp = gimple_range_global (name);
+ m_cache.m_globals.set_global_range (name, tmp);
+
+ gcc_assert (calc_stmt (r, s, name));
+
+ if (is_a<gphi *> (s))
+ r.intersect (tmp);
+ m_cache.m_globals.set_global_range (name, r);
+ return true;
+}
+
+// This routine will export whatever global ranges are known to GCC
+// SSA_RANGE_NAME_INFO fields.
+
+void
+gimple_ranger::export_global_ranges ()
+{
+ unsigned x;
+ int_range_max r;
+ if (dump_file)
+ {
+ fprintf (dump_file, "Exported global range table\n");
+ fprintf (dump_file, "===========================\n");
+ }
+
+ for ( x = 1; x < num_ssa_names; x++)
+ {
+ tree name = ssa_name (x);
+ if (name && !SSA_NAME_IN_FREE_LIST (name)
+ && gimple_range_ssa_p (name)
+ && m_cache.m_globals.get_global_range (r, name)
+ && !r.varying_p())
+ {
+ // Make sure the new range is a subset of the old range.
+ int_range_max old_range;
+ old_range = gimple_range_global (name);
+ old_range.intersect (r);
+ /* Disable this while we fix tree-ssa/pr61743-2.c. */
+ //gcc_checking_assert (old_range == r);
+
+ // WTF? Can't write non-null pointer ranges?? stupid set_range_info!
+ if (!POINTER_TYPE_P (TREE_TYPE (name)) && !r.undefined_p ())
+ {
+ value_range vr = r;
+ set_range_info (name, vr);
+ if (dump_file)
+ {
+ print_generic_expr (dump_file, name , TDF_SLIM);
+ fprintf (dump_file, " --> ");
+ vr.dump (dump_file);
+ fprintf (dump_file, "\n");
+ fprintf (dump_file, " irange : ");
+ r.dump (dump_file);
+ fprintf (dump_file, "\n");
+ }
+ }
+ }
+ }
+}
+
+// Print the known table values to file F.
+
+void
+gimple_ranger::dump (FILE *f)
+{
+ basic_block bb;
+
+ FOR_EACH_BB_FN (bb, cfun)
+ {
+ unsigned x;
+ edge_iterator ei;
+ edge e;
+ int_range_max range;
+ fprintf (f, "\n=========== BB %d ============\n", bb->index);
+ m_cache.m_on_entry.dump (f, bb);
+
+ dump_bb (f, bb, 4, TDF_NONE);
+
+ // Now find any globals defined in this block.
+ for (x = 1; x < num_ssa_names; x++)
+ {
+ tree name = ssa_name (x);
+ if (gimple_range_ssa_p (name) && SSA_NAME_DEF_STMT (name) &&
+ gimple_bb (SSA_NAME_DEF_STMT (name)) == bb &&
+ m_cache.m_globals.get_global_range (range, name))
+ {
+ if (!range.varying_p ())
+ {
+ print_generic_expr (f, name, TDF_SLIM);
+ fprintf (f, " : ");
+ range.dump (f);
+ fprintf (f, "\n");
+ }
+
+ }
+ }
+
+ // And now outgoing edges, if they define anything.
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ {
+ for (x = 1; x < num_ssa_names; x++)
+ {
+ tree name = gimple_range_ssa_p (ssa_name (x));
+ if (name && m_cache.outgoing_edge_range_p (range, e, name))
+ {
+ gimple *s = SSA_NAME_DEF_STMT (name);
+ // Only print the range if this is the def block, or
+ // the on entry cache for either end of the edge is
+ // set.
+ if ((s && bb == gimple_bb (s)) ||
+ m_cache.block_range (range, bb, name, false) ||
+ m_cache.block_range (range, e->dest, name, false))
+ {
+ range_on_edge (range, e, name);
+ if (!range.varying_p ())
+ {
+ fprintf (f, "%d->%d ", e->src->index,
+ e->dest->index);
+ char c = ' ';
+ if (e->flags & EDGE_TRUE_VALUE)
+ fprintf (f, " (T)%c", c);
+ else if (e->flags & EDGE_FALSE_VALUE)
+ fprintf (f, " (F)%c", c);
+ else
+ fprintf (f, " ");
+ print_generic_expr (f, name, TDF_SLIM);
+ fprintf(f, " : \t");
+ range.dump(f);
+ fprintf (f, "\n");
+ }
+ }
+ }
+ }
+ }
+ }
+
+ m_cache.m_globals.dump (dump_file);
+ fprintf (f, "\n");
+
+ if (dump_flags & TDF_DETAILS)
+ {
+ fprintf (f, "\nDUMPING GORI MAP\n");
+ m_cache.dump (f);
+ fprintf (f, "\n");
+ }
+}
+
+// If SCEV has any information about phi node NAME, return it as a range in R.
+
+void
+gimple_ranger::range_of_ssa_name_with_loop_info (irange &r, tree name,
+ class loop *l, gphi *phi)
+{
+ gcc_checking_assert (TREE_CODE (name) == SSA_NAME);
+ tree min, max, type = TREE_TYPE (name);
+ if (bounds_of_var_in_loop (&min, &max, this, l, phi, name))
+ {
+ // ?? We could do better here. Since MIN/MAX can only be an
+ // SSA, SSA +- INTEGER_CST, or INTEGER_CST, we could easily call
+ // the ranger and solve anything not an integer.
+ if (TREE_CODE (min) != INTEGER_CST)
+ min = vrp_val_min (type);
+ if (TREE_CODE (max) != INTEGER_CST)
+ max = vrp_val_max (type);
+ r.set (min, max);
+ }
+ else
+ r.set_varying (type);
+}
+
+// --------------------------------------------------------------------------
+// trace_ranger implementation.
+
+
+trace_ranger::trace_ranger ()
+{
+ indent = 0;
+ trace_count = 0;
+}
+
+// If dumping, return true and print the prefix for the next output line.
+
+bool
+trace_ranger::dumping (unsigned counter, bool trailing)
+{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ // Print counter index as well as INDENT spaces.
+ if (!trailing)
+ fprintf (dump_file, " %-7u ", counter);
+ else
+ fprintf (dump_file, " ");
+ unsigned x;
+ for (x = 0; x< indent; x++)
+ fputc (' ', dump_file);
+ return true;
+ }
+ return false;
+}
+
+// After calling a routine, if dumping, print the CALLER, NAME, and RESULT,
+// returning RESULT.
+
+bool
+trace_ranger::trailer (unsigned counter, const char *caller, bool result,
+ tree name, const irange &r)
+{
+ if (dumping (counter, true))
+ {
+ indent -= bump;
+ fputs(result ? "TRUE : " : "FALSE : ", dump_file);
+ fprintf (dump_file, "(%u) ", counter);
+ fputs (caller, dump_file);
+ fputs (" (",dump_file);
+ if (name)
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fputs (") ",dump_file);
+ if (result)
+ {
+ r.dump (dump_file);
+ fputc('\n', dump_file);
+ }
+ else
+ fputc('\n', dump_file);
+ // Marks the end of a request.
+ if (indent == 0)
+ fputc('\n', dump_file);
+ }
+ return result;
+}
+
+// Tracing version of range_on_edge. Call it with printing wrappers.
+
+bool
+trace_ranger::range_on_edge (irange &r, edge e, tree name)
+{
+ unsigned idx = ++trace_count;
+ if (dumping (idx))
+ {
+ fprintf (dump_file, "range_on_edge (");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, ") on edge %d->%d\n", e->src->index, e->dest->index);
+ indent += bump;
+ }
+
+ bool res = gimple_ranger::range_on_edge (r, e, name);
+ trailer (idx, "range_on_edge", true, name, r);
+ return res;
+}
+
+// Tracing version of range_on_entry. Call it with printing wrappers.
+
+void
+trace_ranger::range_on_entry (irange &r, basic_block bb, tree name)
+{
+ unsigned idx = ++trace_count;
+ if (dumping (idx))
+ {
+ fprintf (dump_file, "range_on_entry (");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, ") to BB %d\n", bb->index);
+ indent += bump;
+ }
+
+ gimple_ranger::range_on_entry (r, bb, name);
+
+ trailer (idx, "range_on_entry", true, name, r);
+}
+
+// Tracing version of range_on_exit. Call it with printing wrappers.
+
+void
+trace_ranger::range_on_exit (irange &r, basic_block bb, tree name)
+{
+ unsigned idx = ++trace_count;
+ if (dumping (idx))
+ {
+ fprintf (dump_file, "range_on_exit (");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, ") from BB %d\n", bb->index);
+ indent += bump;
+ }
+
+ gimple_ranger::range_on_exit (r, bb, name);
+
+ trailer (idx, "range_on_exit", true, name, r);
+}
+
+// Tracing version of range_of_stmt. Call it with printing wrappers.
+
+bool
+trace_ranger::range_of_stmt (irange &r, gimple *s, tree name)
+{
+ bool res;
+ unsigned idx = ++trace_count;
+ if (dumping (idx))
+ {
+ fprintf (dump_file, "range_of_stmt (");
+ if (name)
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fputs (") at stmt ", dump_file);
+ print_gimple_stmt (dump_file, s, 0, TDF_SLIM);
+ indent += bump;
+ }
+
+ res = gimple_ranger::range_of_stmt (r, s, name);
+
+ return trailer (idx, "range_of_stmt", res, name, r);
+}
+
+// Tracing version of range_of_expr. Call it with printing wrappers.
+
+bool
+trace_ranger::range_of_expr (irange &r, tree name, gimple *s)
+{
+ bool res;
+ unsigned idx = ++trace_count;
+ if (dumping (idx))
+ {
+ fprintf (dump_file, "range_of_expr(");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fputs (")", dump_file);
+ if (s)
+ {
+ fputs (" at stmt ", dump_file);
+ print_gimple_stmt (dump_file, s, 0, TDF_SLIM);
+ }
+ else
+ fputs ("\n", dump_file);
+ indent += bump;
+ }
+
+ res = gimple_ranger::range_of_expr (r, name, s);
+
+ return trailer (idx, "range_of_expr", res, name, r);
+}
diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h
new file mode 100644
index 0000000..0aa6d46
--- /dev/null
+++ b/gcc/gimple-range.h
@@ -0,0 +1,184 @@
+/* Header file for the GIMPLE range interface.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Contributed by Andrew MacLeod <amacleod@redhat.com>
+ and Aldy Hernandez <aldyh@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/>. */
+
+#ifndef GCC_GIMPLE_RANGE_STMT_H
+#define GCC_GIMPLE_RANGE_STMT_H
+
+
+#include "range.h"
+#include "range-op.h"
+#include "gimple-range-edge.h"
+#include "gimple-range-gori.h"
+#include "gimple-range-cache.h"
+#include "value-query.h"
+
+// This is the basic range generator interface.
+//
+// This base class provides all the API entry points, but only provides
+// functionality at the statement level. Ie, it can calculate ranges on
+// statements, but does no additonal lookup.
+//
+// All the range_of_* methods will return a range if the types is
+// supported by the range engine. It may be the full range for the
+// type, AKA varying_p or it may be a refined range. If the range
+// type is not supported, then false is returned. Non-statement
+// related methods return whatever the current global value is.
+
+
+class gimple_ranger : public range_query
+{
+public:
+ gimple_ranger () : m_cache (*this) { }
+ virtual bool range_of_stmt (irange &r, gimple *, tree name = NULL) OVERRIDE;
+ virtual bool range_of_expr (irange &r, tree name, gimple * = NULL) OVERRIDE;
+ virtual bool range_on_edge (irange &r, edge e, tree name) OVERRIDE;
+ virtual void range_on_entry (irange &r, basic_block bb, tree name);
+ virtual void range_on_exit (irange &r, basic_block bb, tree name);
+ void export_global_ranges ();
+ void dump (FILE *f);
+protected:
+ bool calc_stmt (irange &r, gimple *s, tree name = NULL_TREE);
+ bool range_of_range_op (irange &r, gimple *s);
+ bool range_of_call (irange &r, gcall *call);
+ bool range_of_cond_expr (irange &r, gassign* cond);
+ ranger_cache m_cache;
+private:
+ bool range_of_phi (irange &r, gphi *phi);
+ bool range_of_non_trivial_assignment (irange &r, gimple *s);
+ bool range_of_builtin_call (irange &r, gcall *call);
+ bool range_with_loop_info (irange &r, tree name);
+ void range_of_ssa_name_with_loop_info (irange &, tree, class loop *,
+ gphi *);
+};
+
+// Calculate a basic range for a tree expression.
+extern bool get_tree_range (irange &r, tree expr);
+
+// These routines provide a GIMPLE interface to the range-ops code.
+extern tree gimple_range_operand1 (const gimple *s);
+extern tree gimple_range_operand2 (const gimple *s);
+extern tree gimple_range_base_of_assignment (const gimple *s);
+extern bool gimple_range_fold (irange &res, const gimple *s,
+ const irange &r1);
+extern bool gimple_range_fold (irange &res, const gimple *s,
+ const irange &r1,
+ const irange &r2);
+extern bool gimple_range_calc_op1 (irange &r, const gimple *s,
+ const irange &lhs_range);
+extern bool gimple_range_calc_op1 (irange &r, const gimple *s,
+ const irange &lhs_range,
+ const irange &op2_range);
+extern bool gimple_range_calc_op2 (irange &r, const gimple *s,
+ const irange &lhs_range,
+ const irange &op1_range);
+
+
+// Return the range_operator pointer for this statement. This routine
+// can also be used to gate whether a routine is range-ops enabled.
+
+static inline range_operator *
+gimple_range_handler (const gimple *s)
+{
+ if ((gimple_code (s) == GIMPLE_ASSIGN) || (gimple_code (s) == GIMPLE_COND))
+ return range_op_handler (gimple_expr_code (s), gimple_expr_type (s));
+ return NULL;
+}
+
+// Return EXP if it is an SSA_NAME with a type supported by gimple ranges.
+
+static inline tree
+gimple_range_ssa_p (tree exp)
+{
+ if (exp && TREE_CODE (exp) == SSA_NAME &&
+ !SSA_NAME_IS_VIRTUAL_OPERAND (exp) &&
+ irange::supports_type_p (TREE_TYPE (exp)))
+ return exp;
+ return NULL_TREE;
+}
+
+// Return true if TYPE1 and TYPE2 are compatible range types.
+
+static inline bool
+range_compatible_p (tree type1, tree type2)
+{
+ // types_compatible_p requires conversion in both directions to be useless.
+ // GIMPLE only requires a cast one way in order to be compatible.
+ // Ranges really only need the sign and precision to be the same.
+ return (TYPE_PRECISION (type1) == TYPE_PRECISION (type2)
+ && TYPE_SIGN (type1) == TYPE_SIGN (type2));
+}
+
+// Return the legacy GCC global range for NAME if it has one, otherwise
+// return VARYING.
+
+static inline value_range
+gimple_range_global (tree name)
+{
+ gcc_checking_assert (gimple_range_ssa_p (name));
+ tree type = TREE_TYPE (name);
+#if 0
+ // Reenable picking up global ranges when we are OK failing tests that look
+ // for builtin_unreachable in the code, like
+ // RUNTESTFLAGS=dg.exp=pr61034.C check-g++
+ // pre-optimizations (inlining) set a global range which causes the ranger
+ // to remove the condition which leads to builtin_unreachable.
+ if (!POINTER_TYPE_P (type) && SSA_NAME_RANGE_INFO (name))
+ {
+ // Return a range from an SSA_NAME's available range.
+ wide_int min, max;
+ enum value_range_kind kind = get_range_info (name, &min, &max);
+ return value_range (type, min, max, kind);
+ }
+#endif
+ // Otherwise return range for the type.
+ return value_range (type);
+}
+
+
+// This class overloads the ranger routines to provide tracing facilties
+// Entry and exit values to each of the APIs is placed in the dumpfile.
+
+class trace_ranger : public gimple_ranger
+{
+public:
+ trace_ranger ();
+ virtual bool range_of_stmt (irange &r, gimple *s, tree name = NULL_TREE);
+ virtual bool range_of_expr (irange &r, tree name, gimple *s = NULL);
+ virtual bool range_on_edge (irange &r, edge e, tree name);
+ virtual void range_on_entry (irange &r, basic_block bb, tree name);
+ virtual void range_on_exit (irange &r, basic_block bb, tree name);
+private:
+ static const unsigned bump = 2;
+ unsigned indent;
+ unsigned trace_count; // Current trace index count.
+
+ bool dumping (unsigned counter, bool trailing = false);
+ bool trailer (unsigned counter, const char *caller, bool result, tree name,
+ const irange &r);
+};
+
+// Flag to enable debugging the various internal Caches.
+#define DEBUG_RANGE_CACHE (dump_file && (param_evrp_mode & EVRP_MODE_DEBUG))
+
+// Temporary external interface to share with vr_values.
+bool range_of_builtin_call (range_query &query, irange &r, gcall *call);
+
+#endif // GCC_GIMPLE_RANGE_STMT_H
diff --git a/gcc/gimple-ssa-evrp-analyze.c b/gcc/gimple-ssa-evrp-analyze.c
index 9f8ce55..485774d 100644
--- a/gcc/gimple-ssa-evrp-analyze.c
+++ b/gcc/gimple-ssa-evrp-analyze.c
@@ -54,7 +54,6 @@ evrp_range_analyzer::evrp_range_analyzer (bool update_global_ranges)
FOR_EACH_EDGE (e, ei, bb->preds)
e->flags |= EDGE_EXECUTABLE;
}
- vr_values = new class vr_values;
}
/* Push an unwinding marker onto the unwinding stack. */
@@ -87,15 +86,14 @@ evrp_range_analyzer::try_find_new_range (tree name,
const value_range_equiv *old_vr = get_value_range (name);
/* Discover VR when condition is true. */
- vr_values->extract_range_for_var_from_comparison_expr (name, code, op,
- limit, &vr);
+ extract_range_for_var_from_comparison_expr (name, code, op, limit, &vr);
/* If we found any usable VR, set the VR to ssa_name and create a
PUSH old value in the stack with the old VR. */
if (!vr.undefined_p () && !vr.varying_p ())
{
if (old_vr->equal_p (vr, /*ignore_equivs=*/true))
return NULL;
- value_range_equiv *new_vr = vr_values->allocate_value_range_equiv ();
+ value_range_equiv *new_vr = allocate_value_range_equiv ();
new_vr->move (&vr);
return new_vr;
}
@@ -214,7 +212,7 @@ evrp_range_analyzer::record_ranges_from_incoming_edge (basic_block bb)
tem.intersect (vrs[i].second);
if (tem.equal_p (*old_vr))
{
- vr_values->free_value_range (vrs[i].second);
+ free_value_range (vrs[i].second);
continue;
}
push_value_range (vrs[i].first, vrs[i].second);
@@ -261,7 +259,7 @@ evrp_range_analyzer::record_ranges_from_phis (basic_block bb)
value_range_equiv vr_result;
bool interesting = stmt_interesting_for_vrp (phi);
if (!has_unvisited_preds && interesting)
- vr_values->extract_range_from_phi_node (phi, &vr_result);
+ extract_range_from_phi_node (phi, &vr_result);
else
{
vr_result.set_varying (TREE_TYPE (lhs));
@@ -274,9 +272,9 @@ evrp_range_analyzer::record_ranges_from_phis (basic_block bb)
&& interesting
&& (l = loop_containing_stmt (phi))
&& l->header == gimple_bb (phi))
- vr_values->adjust_range_with_scev (&vr_result, l, phi, lhs);
+ adjust_range_with_scev (&vr_result, l, phi, lhs);
}
- vr_values->update_value_range (lhs, &vr_result);
+ update_value_range (lhs, &vr_result);
/* Set the SSA with the value range. */
if (m_update_global_ranges)
@@ -303,7 +301,7 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
{
edge taken_edge;
value_range_equiv vr;
- vr_values->extract_range_from_stmt (stmt, &taken_edge, &output, &vr);
+ extract_range_from_stmt (stmt, &taken_edge, &output, &vr);
if (output)
{
/* Set the SSA with the value range. There are two cases to
@@ -321,7 +319,7 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
{
/* Case one. We can just update the underlying range
information as well as the global information. */
- vr_values->update_value_range (output, &vr);
+ update_value_range (output, &vr);
if (m_update_global_ranges)
set_ssa_range_info (output, &vr);
}
@@ -332,18 +330,17 @@ evrp_range_analyzer::record_ranges_from_stmt (gimple *stmt, bool temporary)
a new range and push the old range onto the stack. We
also have to be very careful about sharing the underlying
bitmaps. Ugh. */
- value_range_equiv *new_vr
- = vr_values->allocate_value_range_equiv ();
+ value_range_equiv *new_vr = allocate_value_range_equiv ();
new_vr->set (vr.min (), vr.max (), NULL, vr.kind ());
vr.equiv_clear ();
push_value_range (output, new_vr);
}
}
else
- vr_values->set_defs_to_varying (stmt);
+ set_defs_to_varying (stmt);
}
else
- vr_values->set_defs_to_varying (stmt);
+ set_defs_to_varying (stmt);
/* See if we can derive a range for any of STMT's operands. */
tree op;
@@ -429,7 +426,7 @@ evrp_range_analyzer::push_value_range (tree var, value_range_equiv *vr)
dump_value_range (dump_file, vr);
fprintf (dump_file, "\n");
}
- value_range_equiv *old_vr = vr_values->swap_vr_value (var, vr);
+ value_range_equiv *old_vr = swap_vr_value (var, vr);
stack.safe_push (std::make_pair (var, old_vr));
}
@@ -451,7 +448,7 @@ evrp_range_analyzer::pop_value_range ()
}
/* We saved off a lattice entry, now give it back and release
the one we popped. */
- value_range_equiv *popped_vr = vr_values->swap_vr_value (var, vr);
+ value_range_equiv *popped_vr = swap_vr_value (var, vr);
if (popped_vr)
- vr_values->free_value_range (popped_vr);
+ free_value_range (popped_vr);
}
diff --git a/gcc/gimple-ssa-evrp-analyze.h b/gcc/gimple-ssa-evrp-analyze.h
index 8abbbe3..c6d27f5 100644
--- a/gcc/gimple-ssa-evrp-analyze.h
+++ b/gcc/gimple-ssa-evrp-analyze.h
@@ -20,13 +20,12 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GIMPLE_SSA_EVRP_ANALYZE_H
#define GCC_GIMPLE_SSA_EVRP_ANALYZE_H
-class evrp_range_analyzer
+class evrp_range_analyzer : public vr_values
{
public:
evrp_range_analyzer (bool update_global_ranges);
~evrp_range_analyzer (void)
{
- delete vr_values;
stack.release ();
}
@@ -36,34 +35,18 @@ class evrp_range_analyzer
void leave (basic_block);
void record_ranges_from_stmt (gimple *, bool);
- /* Main interface to retrieve range information. */
- const value_range_equiv *get_value_range (const_tree op)
- { return vr_values->get_value_range (op); }
-
/* Record a new unwindable range. */
void push_value_range (tree var, value_range_equiv *vr);
- /* Dump all the current value ranges. This is primarily
- a debugging interface. */
- void dump_all_value_ranges (FILE *fp)
- { vr_values->dump_all_value_ranges (fp); }
-
/* A bit of a wart. This should ideally go away. */
void vrp_visit_cond_stmt (gcond *cond, edge *e)
{
- simplify_using_ranges simpl (vr_values);
+ simplify_using_ranges simpl (this);
simpl.vrp_visit_cond_stmt (cond, e);
}
- /* Get the underlying vr_values class instance. If TRANSFER is
- true, then we are transferring ownership. Else we keep ownership.
-
- This should be converted to a unique_ptr. */
- class vr_values *get_vr_values (void) { return vr_values; }
-
private:
DISABLE_COPY_AND_ASSIGN (evrp_range_analyzer);
- class vr_values *vr_values;
void pop_value_range ();
value_range_equiv *try_find_new_range (tree, tree op, tree_code code,
diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c
index e8fde63..309cdd9 100644
--- a/gcc/gimple-ssa-evrp.c
+++ b/gcc/gimple-ssa-evrp.c
@@ -41,15 +41,19 @@ along with GCC; see the file COPYING3. If not see
#include "tree-cfgcleanup.h"
#include "vr-values.h"
#include "gimple-ssa-evrp-analyze.h"
+#include "gimple-range.h"
+
+// This is the classic EVRP folder which uses a dominator walk and pushes
+// ranges into the next block if it is a single predecessor block.
class evrp_folder : public substitute_and_fold_engine
{
public:
- evrp_folder () : m_range_analyzer (/*update_global_ranges=*/true),
- m_vr_values (m_range_analyzer.get_vr_values ()),
- simplifier (m_vr_values)
- {
- }
+ evrp_folder () :
+ substitute_and_fold_engine (),
+ m_range_analyzer (/*update_global_ranges=*/true),
+ simplifier (&m_range_analyzer)
+ { }
~evrp_folder ()
{
@@ -61,9 +65,9 @@ public:
}
}
- tree get_value (tree op, gimple *stmt ATTRIBUTE_UNUSED) OVERRIDE
+ tree value_of_expr (tree name, gimple *stmt) OVERRIDE
{
- return m_vr_values->op_with_constant_singleton_value_range (op);
+ return m_range_analyzer.value_of_expr (name, stmt);
}
void pre_fold_bb (basic_block bb) OVERRIDE
@@ -95,17 +99,213 @@ public:
void post_new_stmt (gimple *stmt) OVERRIDE
{
- m_range_analyzer.get_vr_values ()->set_defs_to_varying (stmt);
+ m_range_analyzer.set_defs_to_varying (stmt);
}
-private:
+protected:
DISABLE_COPY_AND_ASSIGN (evrp_folder);
- class evrp_range_analyzer m_range_analyzer;
- class vr_values *m_vr_values;
-
+ evrp_range_analyzer m_range_analyzer;
simplify_using_ranges simplifier;
};
+// This is a ranger based folder which continues to use the dominator
+// walk to access the substitute and fold machinery. Ranges are calculated
+// on demand.
+
+class rvrp_folder : public substitute_and_fold_engine
+{
+public:
+
+ rvrp_folder () : substitute_and_fold_engine (), m_simplifier ()
+ {
+ if (param_evrp_mode & EVRP_MODE_TRACE)
+ m_ranger = new trace_ranger ();
+ else
+ m_ranger = new gimple_ranger ();
+ m_simplifier.set_range_query (m_ranger);
+ }
+
+ ~rvrp_folder ()
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ m_ranger->dump (dump_file);
+ delete m_ranger;
+ }
+
+ tree value_of_expr (tree name, gimple *s = NULL) OVERRIDE
+ {
+ return m_ranger->value_of_expr (name, s);
+ }
+
+ tree value_on_edge (edge e, tree name) OVERRIDE
+ {
+ return m_ranger->value_on_edge (e, name);
+ }
+
+ tree value_of_stmt (gimple *s, tree name = NULL) OVERRIDE
+ {
+ return m_ranger->value_of_stmt (s, name);
+ }
+
+ bool fold_stmt (gimple_stmt_iterator *gsi) OVERRIDE
+ {
+ return m_simplifier.simplify (gsi);
+ }
+
+private:
+ DISABLE_COPY_AND_ASSIGN (rvrp_folder);
+ gimple_ranger *m_ranger;
+ simplify_using_ranges m_simplifier;
+};
+
+// In a hybrid folder, start with an EVRP folder, and add the required
+// fold_stmt bits to either try the ranger first or second.
+//
+// The 3 value_* routines will always query both EVRP and the ranger for
+// a result, and ensure they return the same value. If either returns a value
+// when the other doesn't, it is flagged in the listing, and the discoverd
+// value is returned.
+//
+// The simplifier is unable to process 2 different sources, thus we try to
+// use one engine, and if it fails to simplify, try using the other engine.
+// It is reported when the first attempt fails and the second succeeds.
+
+class hybrid_folder : public evrp_folder
+{
+public:
+ hybrid_folder (bool evrp_first)
+ {
+ if (param_evrp_mode & EVRP_MODE_TRACE)
+ m_ranger = new trace_ranger ();
+ else
+ m_ranger = new gimple_ranger ();
+
+ if (evrp_first)
+ {
+ first = &m_range_analyzer;
+ second = m_ranger;
+ }
+ else
+ {
+ first = m_ranger;
+ second = &m_range_analyzer;
+ }
+ }
+
+ ~hybrid_folder ()
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ m_ranger->dump (dump_file);
+ delete m_ranger;
+ }
+
+ bool fold_stmt (gimple_stmt_iterator *gsi) OVERRIDE
+ {
+ simplifier.set_range_query (first);
+ if (simplifier.simplify (gsi))
+ return true;
+
+ simplifier.set_range_query (second);
+ if (simplifier.simplify (gsi))
+ {
+ if (dump_file)
+ fprintf (dump_file, "EVRP:hybrid: Second query simplifed stmt\n");
+ return true;
+ }
+ return false;
+ }
+
+ tree value_of_expr (tree name, gimple *) OVERRIDE;
+ tree value_on_edge (edge, tree name) OVERRIDE;
+ tree value_of_stmt (gimple *, tree name) OVERRIDE;
+
+private:
+ DISABLE_COPY_AND_ASSIGN (hybrid_folder);
+ gimple_ranger *m_ranger;
+ range_query *first;
+ range_query *second;
+ tree choose_value (tree evrp_val, tree ranger_val);
+};
+
+
+tree
+hybrid_folder::value_of_expr (tree op, gimple *stmt)
+{
+ tree evrp_ret = evrp_folder::value_of_expr (op, stmt);
+ tree ranger_ret = m_ranger->value_of_expr (op, stmt);
+ return choose_value (evrp_ret, ranger_ret);
+}
+
+tree
+hybrid_folder::value_on_edge (edge e, tree op)
+{
+ // Call evrp::value_of_expr directly. Otherwise another dual call is made
+ // via hybrid_folder::value_of_expr, but without an edge.
+ tree evrp_ret = evrp_folder::value_of_expr (op, NULL);
+ tree ranger_ret = m_ranger->value_on_edge (e, op);
+ return choose_value (evrp_ret, ranger_ret);
+}
+
+tree
+hybrid_folder::value_of_stmt (gimple *stmt, tree op)
+{
+ // Call evrp::value_of_expr directly. Otherwise another dual call is made
+ // via hybrid_folder::value_of_expr, but without a stmt.
+ tree evrp_ret;
+ if (op)
+ evrp_ret = evrp_folder::value_of_expr (op, NULL);
+ else
+ evrp_ret = NULL_TREE;
+
+ tree ranger_ret = m_ranger->value_of_stmt (stmt, op);
+ return choose_value (evrp_ret, ranger_ret);
+}
+
+// Given trees returned by EVRP and Ranger, choose/report the value to use
+// by the folder.
+
+tree
+hybrid_folder::choose_value (tree evrp_val, tree ranger_val)
+{
+ // If both found the same value, just return it.
+ if (evrp_val && ranger_val && !compare_values (evrp_val, ranger_val))
+ return evrp_val;
+
+ // If neither returned a value, return NULL_TREE.
+ if (!ranger_val && !evrp_val)
+ return NULL_TREE;
+
+ // Otherwise there is a discrepancy to flag.
+ if (dump_file)
+ {
+ if (evrp_val && ranger_val)
+ fprintf (dump_file, "EVRP:hybrid: Disagreement\n");
+ if (evrp_val)
+ {
+ fprintf (dump_file, "EVRP:hybrid: EVRP found singleton ");
+ print_generic_expr (dump_file, evrp_val);
+ fprintf (dump_file, "\n");
+ }
+ if (ranger_val)
+ {
+ fprintf (dump_file, "EVRP:hybrid: RVRP found singleton ");
+ print_generic_expr (dump_file, ranger_val);
+ fprintf (dump_file, "\n");
+ }
+ }
+
+ // If one value was found, return it.
+ if (!evrp_val)
+ return ranger_val;
+ if (!ranger_val)
+ return evrp_val;
+
+ // If values are different, return the first calculated value.
+ if ((param_evrp_mode & EVRP_MODE_RVRP_FIRST) == EVRP_MODE_RVRP_FIRST)
+ return ranger_val;
+ return evrp_val;
+}
+
/* Main entry point for the early vrp pass which is a simplified non-iterative
version of vrp where basic blocks are visited in dominance order. Value
ranges discovered in early vrp will also be used by ipa-vrp. */
@@ -122,8 +322,36 @@ execute_early_vrp ()
scev_initialize ();
calculate_dominance_info (CDI_DOMINATORS);
- evrp_folder folder;
- folder.substitute_and_fold ();
+ // Only the last 2 bits matter for choosing the folder.
+ switch (param_evrp_mode & EVRP_MODE_RVRP_FIRST)
+ {
+ case EVRP_MODE_EVRP_ONLY:
+ {
+ evrp_folder folder;
+ folder.substitute_and_fold ();
+ break;
+ }
+ case EVRP_MODE_RVRP_ONLY:
+ {
+ rvrp_folder folder;
+ folder.substitute_and_fold ();
+ break;
+ }
+ case EVRP_MODE_EVRP_FIRST:
+ {
+ hybrid_folder folder (true);
+ folder.substitute_and_fold ();
+ break;
+ }
+ case EVRP_MODE_RVRP_FIRST:
+ {
+ hybrid_folder folder (false);
+ folder.substitute_and_fold ();
+ break;
+ }
+ default:
+ gcc_unreachable ();
+ }
scev_finalize ();
loop_optimizer_finalize ();
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 70b031f..fff034f 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -546,8 +546,8 @@ fmtresult::type_max_digits (tree type, int base)
}
static bool
-get_int_range (tree, HOST_WIDE_INT *, HOST_WIDE_INT *, bool, HOST_WIDE_INT,
- const vr_values *);
+get_int_range (tree, gimple *, HOST_WIDE_INT *, HOST_WIDE_INT *,
+ bool, HOST_WIDE_INT, range_query *);
struct call_info;
@@ -597,7 +597,7 @@ struct directive
/* Format conversion function that given a directive and an argument
returns the formatting result. */
- fmtresult (*fmtfunc) (const directive &, tree, const vr_values *);
+ fmtresult (*fmtfunc) (const directive &, tree, range_query *);
/* Return True when the format flag CHR has been used. */
bool get_flag (char chr) const
@@ -634,10 +634,7 @@ struct directive
or 0, whichever is greater. For a non-constant ARG in some range
set width to its range adjusting each bound to -1 if it's less.
For an indeterminate ARG set width to [0, INT_MAX]. */
- void set_width (tree arg, const vr_values *vr)
- {
- get_int_range (arg, width, width + 1, true, 0, vr);
- }
+ void set_width (tree arg, range_query *);
/* Set both bounds of the precision range to VAL. */
void set_precision (HOST_WIDE_INT val)
@@ -650,10 +647,7 @@ struct directive
or -1 whichever is greater. For a non-constant ARG in some range
set precision to its range adjusting each bound to -1 if it's less.
For an indeterminate ARG set precision to [-1, INT_MAX]. */
- void set_precision (tree arg, const vr_values *vr)
- {
- get_int_range (arg, prec, prec + 1, false, -1, vr);
- }
+ void set_precision (tree arg, range_query *query);
/* Return true if both width and precision are known to be
either constant or in some range, false otherwise. */
@@ -956,10 +950,22 @@ struct call_info
}
};
+void
+directive::set_width (tree arg, range_query *query)
+{
+ get_int_range (arg, info->callstmt, width, width + 1, true, 0, query);
+}
+
+void
+directive::set_precision (tree arg, range_query *query)
+{
+ get_int_range (arg, info->callstmt, prec, prec + 1, false, -1, query);
+}
+
/* Return the result of formatting a no-op directive (such as '%n'). */
static fmtresult
-format_none (const directive &, tree, const vr_values *)
+format_none (const directive &, tree, range_query *)
{
fmtresult res (0);
return res;
@@ -968,7 +974,7 @@ format_none (const directive &, tree, const vr_values *)
/* Return the result of formatting the '%%' directive. */
static fmtresult
-format_percent (const directive &, tree, const vr_values *)
+format_percent (const directive &, tree, range_query *)
{
fmtresult res (1);
return res;
@@ -1026,9 +1032,10 @@ build_intmax_type_nodes (tree *pintmax, tree *puintmax)
the determined range are replaced with NEGBOUND. */
static bool
-get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
+get_int_range (tree arg, gimple *stmt,
+ HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
bool absolute, HOST_WIDE_INT negbound,
- const class vr_values *vr_values)
+ range_query *query)
{
/* The type of the result. */
const_tree type = integer_type_node;
@@ -1067,10 +1074,10 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
&& TYPE_PRECISION (argtype) <= TYPE_PRECISION (type))
{
/* Try to determine the range of values of the integer argument. */
- const value_range_equiv *vr
- = CONST_CAST (class vr_values *, vr_values)->get_value_range (arg);
+ value_range vr;
+ query->range_of_expr (vr, arg, stmt);
- if (!vr->undefined_p () && !vr->varying_p () && !vr->symbolic_p ())
+ if (!vr.undefined_p () && !vr.varying_p ())
{
HOST_WIDE_INT type_min
= (TYPE_UNSIGNED (argtype)
@@ -1080,8 +1087,8 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
HOST_WIDE_INT type_max = tree_to_uhwi (TYPE_MAX_VALUE (argtype));
tree type = TREE_TYPE (arg);
- tree tmin = wide_int_to_tree (type, vr->lower_bound ());
- tree tmax = wide_int_to_tree (type, vr->upper_bound ());
+ tree tmin = wide_int_to_tree (type, vr.lower_bound ());
+ tree tmax = wide_int_to_tree (type, vr.upper_bound ());
*pmin = TREE_INT_CST_LOW (tmin);
*pmax = TREE_INT_CST_LOW (tmax);
@@ -1103,8 +1110,8 @@ get_int_range (tree arg, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax,
/* Handle an argument with an unknown range as if none had been
provided. */
if (unknown)
- return get_int_range (NULL_TREE, pmin, pmax, absolute,
- negbound, vr_values);
+ return get_int_range (NULL_TREE, NULL, pmin, pmax, absolute,
+ negbound, query);
}
/* Adjust each bound as specified by ABSOLUTE and NEGBOUND. */
@@ -1189,7 +1196,7 @@ adjust_range_for_overflow (tree dirtype, tree *argmin, tree *argmax)
used when the directive argument or its value isn't known. */
static fmtresult
-format_integer (const directive &dir, tree arg, const vr_values *vr_values)
+format_integer (const directive &dir, tree arg, range_query *query)
{
tree intmax_type_node;
tree uintmax_type_node;
@@ -1372,13 +1379,13 @@ format_integer (const directive &dir, tree arg, const vr_values *vr_values)
{
/* Try to determine the range of values of the integer argument
(range information is not available for pointers). */
- const value_range_equiv *vr
- = CONST_CAST (class vr_values *, vr_values)->get_value_range (arg);
+ value_range vr;
+ query->range_of_expr (vr, arg, dir.info->callstmt);
- if (!vr->varying_p () && !vr->undefined_p () && !vr->symbolic_p ())
+ if (!vr.varying_p () && !vr.undefined_p ())
{
- argmin = wide_int_to_tree (TREE_TYPE (arg), vr->lower_bound ());
- argmax = wide_int_to_tree (TREE_TYPE (arg), vr->upper_bound ());
+ argmin = wide_int_to_tree (TREE_TYPE (arg), vr.lower_bound ());
+ argmax = wide_int_to_tree (TREE_TYPE (arg), vr.upper_bound ());
/* Set KNOWNRANGE if the argument is in a known subrange
of the directive's type and neither width nor precision
@@ -1404,7 +1411,7 @@ format_integer (const directive &dir, tree arg, const vr_values *vr_values)
if (code == INTEGER_CST)
{
arg = gimple_assign_rhs1 (def);
- return format_integer (dir, arg, vr_values);
+ return format_integer (dir, arg, query);
}
if (code == NOP_EXPR)
@@ -1449,16 +1456,16 @@ format_integer (const directive &dir, tree arg, const vr_values *vr_values)
/* For unsigned conversions/directives or signed when
the minimum is positive, use the minimum and maximum to compute
the shortest and longest output, respectively. */
- res.range.min = format_integer (dir, argmin, vr_values).range.min;
- res.range.max = format_integer (dir, argmax, vr_values).range.max;
+ res.range.min = format_integer (dir, argmin, query).range.min;
+ res.range.max = format_integer (dir, argmax, query).range.max;
}
else if (tree_int_cst_sgn (argmax) < 0)
{
/* For signed conversions/directives if maximum is negative,
use the minimum as the longest output and maximum as the
shortest output. */
- res.range.min = format_integer (dir, argmax, vr_values).range.min;
- res.range.max = format_integer (dir, argmin, vr_values).range.max;
+ res.range.min = format_integer (dir, argmax, query).range.min;
+ res.range.max = format_integer (dir, argmin, query).range.max;
}
else
{
@@ -1467,11 +1474,11 @@ format_integer (const directive &dir, tree arg, const vr_values *vr_values)
length of the output of both minimum and maximum and pick the
longer. */
unsigned HOST_WIDE_INT max1
- = format_integer (dir, argmin, vr_values).range.max;
+ = format_integer (dir, argmin, query).range.max;
unsigned HOST_WIDE_INT max2
- = format_integer (dir, argmax, vr_values).range.max;
+ = format_integer (dir, argmax, query).range.max;
res.range.min
- = format_integer (dir, integer_zero_node, vr_values).range.min;
+ = format_integer (dir, integer_zero_node, query).range.min;
res.range.max = MAX (max1, max2);
}
@@ -1820,7 +1827,7 @@ format_floating (const directive &dir, const HOST_WIDE_INT prec[2])
ARG. */
static fmtresult
-format_floating (const directive &dir, tree arg, const vr_values *)
+format_floating (const directive &dir, tree arg, range_query *)
{
HOST_WIDE_INT prec[] = { dir.prec[0], dir.prec[1] };
tree type = (dir.modifier == FMT_LEN_L || dir.modifier == FMT_LEN_ll
@@ -2014,7 +2021,8 @@ format_floating (const directive &dir, tree arg, const vr_values *)
Used by the format_string function below. */
static fmtresult
-get_string_length (tree str, unsigned eltsize, const vr_values *vr)
+get_string_length (tree str, gimple *stmt, unsigned eltsize,
+ range_query *query)
{
if (!str)
return fmtresult ();
@@ -2025,7 +2033,7 @@ get_string_length (tree str, unsigned eltsize, const vr_values *vr)
c_strlen_data lendata = { };
lendata.maxbound = str;
if (eltsize == 1)
- get_range_strlen_dynamic (str, &lendata, vr);
+ get_range_strlen_dynamic (str, stmt, &lendata, query);
else
{
/* Determine the length of the shortest and longest string referenced
@@ -2122,7 +2130,7 @@ get_string_length (tree str, unsigned eltsize, const vr_values *vr)
vsprinf). */
static fmtresult
-format_character (const directive &dir, tree arg, const vr_values *vr_values)
+format_character (const directive &dir, tree arg, range_query *query)
{
fmtresult res;
@@ -2135,7 +2143,7 @@ format_character (const directive &dir, tree arg, const vr_values *vr_values)
res.range.min = 0;
HOST_WIDE_INT min, max;
- if (get_int_range (arg, &min, &max, false, 0, vr_values))
+ if (get_int_range (arg, dir.info->callstmt, &min, &max, false, 0, query))
{
if (min == 0 && max == 0)
{
@@ -2433,7 +2441,7 @@ alias_offset (tree arg, tree dst, HOST_WIDE_INT dst_fld)
vsprinf). */
static fmtresult
-format_string (const directive &dir, tree arg, const vr_values *vr_values)
+format_string (const directive &dir, tree arg, range_query *query)
{
fmtresult res;
@@ -2462,7 +2470,7 @@ format_string (const directive &dir, tree arg, const vr_values *vr_values)
gcc_checking_assert (count_by == 2 || count_by == 4);
}
- fmtresult slen = get_string_length (arg, count_by, vr_values);
+ fmtresult slen = get_string_length (arg, dir.info->callstmt, count_by, query);
if (slen.range.min == slen.range.max
&& slen.range.min < HOST_WIDE_INT_MAX)
{
@@ -2634,7 +2642,7 @@ format_string (const directive &dir, tree arg, const vr_values *vr_values)
/* Format plain string (part of the format string itself). */
static fmtresult
-format_plain (const directive &dir, tree, const vr_values *)
+format_plain (const directive &dir, tree, range_query *)
{
fmtresult res (dir.len);
return res;
@@ -3030,7 +3038,7 @@ bytes_remaining (unsigned HOST_WIDE_INT navail, const format_result &res)
static bool
format_directive (const call_info &info,
format_result *res, const directive &dir,
- const class vr_values *vr_values)
+ range_query *query)
{
/* Offset of the beginning of the directive from the beginning
of the format string. */
@@ -3055,7 +3063,7 @@ format_directive (const call_info &info,
return false;
/* Compute the range of lengths of the formatted output. */
- fmtresult fmtres = dir.fmtfunc (dir, dir.arg, vr_values);
+ fmtresult fmtres = dir.fmtfunc (dir, dir.arg, query);
/* Record whether the output of all directives is known to be
bounded by some maximum, implying that their arguments are
@@ -3386,7 +3394,7 @@ static size_t
parse_directive (call_info &info,
directive &dir, format_result *res,
const char *str, unsigned *argno,
- const vr_values *vr_values)
+ range_query *query)
{
const char *pcnt = strchr (str, target_percent);
dir.beg = str;
@@ -3711,7 +3719,7 @@ parse_directive (call_info &info,
if (star_width)
{
if (INTEGRAL_TYPE_P (TREE_TYPE (star_width)))
- dir.set_width (star_width, vr_values);
+ dir.set_width (star_width, query);
else
{
/* Width specified by a va_list takes on the range [0, -INT_MIN]
@@ -3744,7 +3752,7 @@ parse_directive (call_info &info,
if (star_precision)
{
if (INTEGRAL_TYPE_P (TREE_TYPE (star_precision)))
- dir.set_precision (star_precision, vr_values);
+ dir.set_precision (star_precision, query);
else
{
/* Precision specified by a va_list takes on the range [-1, INT_MAX]
@@ -3958,7 +3966,7 @@ maybe_warn_overlap (call_info &info, format_result *res)
that caused the processing to be terminated early). */
static bool
-compute_format_length (call_info &info, format_result *res, const vr_values *vr)
+compute_format_length (call_info &info, format_result *res, range_query *query)
{
if (dump_file)
{
@@ -3995,10 +4003,10 @@ compute_format_length (call_info &info, format_result *res, const vr_values *vr)
{
directive dir (&info, dirno);
- size_t n = parse_directive (info, dir, res, pf, &argno, vr);
+ size_t n = parse_directive (info, dir, res, pf, &argno, query);
/* Return failure if the format function fails. */
- if (!format_directive (info, res, dir, vr))
+ if (!format_directive (info, res, dir, query))
return false;
/* Return success when the directive is zero bytes long and it's
@@ -4288,7 +4296,7 @@ get_user_idx_format (tree fndecl, unsigned *idx_args)
gsi_next should not be performed in the caller. */
bool
-handle_printf_call (gimple_stmt_iterator *gsi, const vr_values *vr_values)
+handle_printf_call (gimple_stmt_iterator *gsi, range_query *query)
{
init_target_to_host_charmap ();
@@ -4557,14 +4565,14 @@ handle_printf_call (gimple_stmt_iterator *gsi, const vr_values *vr_values)
/* Try to determine the range of values of the argument
and use the greater of the two at level 1 and the smaller
of them at level 2. */
- const value_range_equiv *vr
- = CONST_CAST (class vr_values *, vr_values)->get_value_range (size);
+ value_range vr;
+ query->range_of_expr (vr, size, info.callstmt);
- if (!vr->undefined_p () && !vr->symbolic_p ())
+ if (!vr.undefined_p ())
{
tree type = TREE_TYPE (size);
- tree tmin = wide_int_to_tree (type, vr->lower_bound ());
- tree tmax = wide_int_to_tree (type, vr->upper_bound ());
+ tree tmin = wide_int_to_tree (type, vr.lower_bound ());
+ tree tmax = wide_int_to_tree (type, vr.upper_bound ());
unsigned HOST_WIDE_INT minsize = TREE_INT_CST_LOW (tmin);
unsigned HOST_WIDE_INT maxsize = TREE_INT_CST_LOW (tmax);
dstsize = warn_level < 2 ? maxsize : minsize;
@@ -4675,7 +4683,7 @@ handle_printf_call (gimple_stmt_iterator *gsi, const vr_values *vr_values)
never set to true again). */
res.posunder4k = posunder4k && dstptr;
- bool success = compute_format_length (info, &res, vr_values);
+ bool success = compute_format_length (info, &res, query);
if (res.warned)
gimple_set_no_warning (info.callstmt, true);
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index fa2609f..28fc2e2 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -3804,7 +3804,7 @@ imm_store_chain_info::output_merged_store (merged_store_group *group)
Similarly, if there is a whole region clear first, prefer expanding
it together compared to expanding clear first followed by merged
further stores. */
- unsigned cnt[4] = { ~0, ~0, ~0, ~0 };
+ unsigned cnt[4] = { ~0U, ~0U, ~0U, ~0U };
int pass_min = 0;
for (int pass = 0; pass < 4; ++pass)
{
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
index 9e80e5d..33824a7 100644
--- a/gcc/gimple-ssa-warn-alloca.c
+++ b/gcc/gimple-ssa-warn-alloca.c
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "calls.h"
#include "cfgloop.h"
#include "intl.h"
+#include "gimple-range.h"
static unsigned HOST_WIDE_INT adjusted_warn_limit (bool);
@@ -99,12 +100,6 @@ enum alloca_type {
// Alloca argument may be too large.
ALLOCA_BOUND_MAYBE_LARGE,
- // Alloca argument is bounded but of an indeterminate size.
- ALLOCA_BOUND_UNKNOWN,
-
- // Alloca argument was casted from a signed integer.
- ALLOCA_CAST_FROM_SIGNED,
-
// Alloca appears in a loop.
ALLOCA_IN_LOOP,
@@ -135,6 +130,15 @@ public:
}
};
+/* Return TRUE if the user specified a limit for either VLAs or ALLOCAs. */
+
+static bool
+warn_limit_specified_p (bool is_vla)
+{
+ unsigned HOST_WIDE_INT max = is_vla ? warn_vla_limit : warn_alloca_limit;
+ return max != HOST_WIDE_INT_MAX;
+}
+
/* Return the value of the argument N to -Walloca-larger-than= or
-Wvla-larger-than= adjusted for the target data model so that
when N == HOST_WIDE_INT_MAX, the adjusted value is set to
@@ -158,183 +162,15 @@ adjusted_warn_limit (bool idx)
return limits[idx];
}
-
-// NOTE: When we get better range info, this entire function becomes
-// irrelevant, as it should be possible to get range info for an SSA
-// name at any point in the program.
-//
-// We have a few heuristics up our sleeve to determine if a call to
-// alloca() is within bounds. Try them out and return the type of
-// alloca call with its assumed limit (if applicable).
-//
-// Given a known argument (ARG) to alloca() and an EDGE (E)
-// calculating said argument, verify that the last statement in the BB
-// in E->SRC is a gate comparing ARG to an acceptable bound for
-// alloca(). See examples below.
-//
-// If set, ARG_CASTED is the possible unsigned argument to which ARG
-// was casted to. This is to handle cases where the controlling
-// predicate is looking at a casted value, not the argument itself.
-// arg_casted = (size_t) arg;
-// if (arg_casted < N)
-// goto bb3;
-// else
-// goto bb5;
-//
-// MAX_SIZE is WARN_ALLOCA= adjusted for VLAs. It is the maximum size
-// in bytes we allow for arg.
-
-static class alloca_type_and_limit
-alloca_call_type_by_arg (tree arg, tree arg_casted, edge e,
- unsigned HOST_WIDE_INT max_size)
-{
- basic_block bb = e->src;
- gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gimple *last = gsi_stmt (gsi);
-
- const offset_int maxobjsize = tree_to_shwi (max_object_size ());
-
- /* When MAX_SIZE is greater than or equal to PTRDIFF_MAX treat
- allocations that aren't visibly constrained as OK, otherwise
- report them as (potentially) unbounded. */
- alloca_type unbounded_result = (max_size < maxobjsize.to_uhwi ()
- ? ALLOCA_UNBOUNDED : ALLOCA_OK);
-
- if (!last || gimple_code (last) != GIMPLE_COND)
- {
- return alloca_type_and_limit (unbounded_result);
- }
-
- enum tree_code cond_code = gimple_cond_code (last);
- if (e->flags & EDGE_TRUE_VALUE)
- ;
- else if (e->flags & EDGE_FALSE_VALUE)
- cond_code = invert_tree_comparison (cond_code, false);
- else
- return alloca_type_and_limit (unbounded_result);
-
- // Check for:
- // if (ARG .COND. N)
- // goto <bb 3>;
- // else
- // goto <bb 4>;
- // <bb 3>:
- // alloca(ARG);
- if ((cond_code == LE_EXPR
- || cond_code == LT_EXPR
- || cond_code == GT_EXPR
- || cond_code == GE_EXPR)
- && (gimple_cond_lhs (last) == arg
- || gimple_cond_lhs (last) == arg_casted))
- {
- if (TREE_CODE (gimple_cond_rhs (last)) == INTEGER_CST)
- {
- tree rhs = gimple_cond_rhs (last);
- int tst = wi::cmpu (wi::to_widest (rhs), max_size);
- if ((cond_code == LT_EXPR && tst == -1)
- || (cond_code == LE_EXPR && (tst == -1 || tst == 0)))
- return alloca_type_and_limit (ALLOCA_OK);
- else
- {
- // Let's not get too specific as to how large the limit
- // may be. Someone's clearly an idiot when things
- // degrade into "if (N > Y) alloca(N)".
- if (cond_code == GT_EXPR || cond_code == GE_EXPR)
- rhs = integer_zero_node;
- return alloca_type_and_limit (ALLOCA_BOUND_MAYBE_LARGE,
- wi::to_wide (rhs));
- }
- }
- else
- {
- /* Analogous to ALLOCA_UNBOUNDED, when MAX_SIZE is greater
- than or equal to PTRDIFF_MAX, treat allocations with
- an unknown bound as OK. */
- alloca_type unknown_result
- = (max_size < maxobjsize.to_uhwi ()
- ? ALLOCA_BOUND_UNKNOWN : ALLOCA_OK);
- return alloca_type_and_limit (unknown_result);
- }
- }
-
- // Similarly, but check for a comparison with an unknown LIMIT.
- // if (LIMIT .COND. ARG)
- // alloca(arg);
- //
- // Where LIMIT has a bound of unknown range.
- //
- // Note: All conditions of the form (ARG .COND. XXXX) where covered
- // by the previous check above, so we only need to look for (LIMIT
- // .COND. ARG) here.
- tree limit = gimple_cond_lhs (last);
- if ((gimple_cond_rhs (last) == arg
- || gimple_cond_rhs (last) == arg_casted)
- && TREE_CODE (limit) == SSA_NAME)
- {
- wide_int min, max;
- value_range_kind range_type = get_range_info (limit, &min, &max);
-
- if (range_type == VR_UNDEFINED || range_type == VR_VARYING)
- return alloca_type_and_limit (ALLOCA_BOUND_UNKNOWN);
-
- // ?? It looks like the above `if' is unnecessary, as we never
- // get any VR_RANGE or VR_ANTI_RANGE here. If we had a range
- // for LIMIT, I suppose we would have taken care of it in
- // alloca_call_type(), or handled above where we handle (ARG .COND. N).
- //
- // If this ever triggers, we should probably figure out why and
- // handle it, though it is likely to be just an ALLOCA_UNBOUNDED.
- return alloca_type_and_limit (unbounded_result);
- }
-
- return alloca_type_and_limit (unbounded_result);
-}
-
-// Return TRUE if SSA's definition is a cast from a signed type.
-// If so, set *INVALID_CASTED_TYPE to the signed type.
-
-static bool
-cast_from_signed_p (tree ssa, tree *invalid_casted_type)
-{
- gimple *def = SSA_NAME_DEF_STMT (ssa);
- if (def
- && !gimple_nop_p (def)
- && gimple_assign_cast_p (def)
- && !TYPE_UNSIGNED (TREE_TYPE (gimple_assign_rhs1 (def))))
- {
- *invalid_casted_type = TREE_TYPE (gimple_assign_rhs1 (def));
- return true;
- }
- return false;
-}
-
-// Return TRUE if X has a maximum range of MAX, basically covering the
-// entire domain, in which case it's no range at all.
-
-static bool
-is_max (tree x, wide_int max)
-{
- return wi::max_value (TREE_TYPE (x)) == max;
-}
-
// Analyze the alloca call in STMT and return the alloca type with its
// corresponding limit (if applicable). IS_VLA is set if the alloca
// call was created by the gimplifier for a VLA.
-//
-// If the alloca call may be too large because of a cast from a signed
-// type to an unsigned type, set *INVALID_CASTED_TYPE to the
-// problematic signed type.
static class alloca_type_and_limit
-alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type)
+alloca_call_type (range_query &query, gimple *stmt, bool is_vla)
{
gcc_assert (gimple_alloca_call_p (stmt));
- bool tentative_cast_from_signed = false;
tree len = gimple_call_arg (stmt, 0);
- tree len_casted = NULL;
- wide_int min, max;
- edge_iterator ei;
- edge e;
gcc_assert (!is_vla || warn_vla_limit >= 0);
gcc_assert (is_vla || warn_alloca_limit >= 0);
@@ -361,118 +197,9 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type)
return alloca_type_and_limit (ALLOCA_OK);
}
- // Check the range info if available.
- if (TREE_CODE (len) == SSA_NAME)
- {
- value_range_kind range_type = get_range_info (len, &min, &max);
- if (range_type == VR_RANGE)
- {
- if (wi::leu_p (max, max_size))
- return alloca_type_and_limit (ALLOCA_OK);
- else
- {
- // A cast may have created a range we don't care
- // about. For instance, a cast from 16-bit to
- // 32-bit creates a range of 0..65535, even if there
- // is not really a determinable range in the
- // underlying code. In this case, look through the
- // cast at the original argument, and fall through
- // to look at other alternatives.
- //
- // We only look at through the cast when its from
- // unsigned to unsigned, otherwise we may risk
- // looking at SIGNED_INT < N, which is clearly not
- // what we want. In this case, we'd be interested
- // in a VR_RANGE of [0..N].
- //
- // Note: None of this is perfect, and should all go
- // away with better range information. But it gets
- // most of the cases.
- gimple *def = SSA_NAME_DEF_STMT (len);
- if (gimple_assign_cast_p (def))
- {
- tree rhs1 = gimple_assign_rhs1 (def);
- tree rhs1type = TREE_TYPE (rhs1);
-
- // Bail if the argument type is not valid.
- if (!INTEGRAL_TYPE_P (rhs1type))
- return alloca_type_and_limit (ALLOCA_OK);
-
- if (TYPE_UNSIGNED (rhs1type))
- {
- len_casted = rhs1;
- range_type = get_range_info (len_casted, &min, &max);
- }
- }
- // An unknown range or a range of the entire domain is
- // really no range at all.
- if (range_type == VR_VARYING
- || (!len_casted && is_max (len, max))
- || (len_casted && is_max (len_casted, max)))
- {
- // Fall through.
- }
- else if (range_type == VR_ANTI_RANGE)
- return alloca_type_and_limit (ALLOCA_UNBOUNDED);
-
- if (range_type != VR_VARYING)
- {
- const offset_int maxobjsize
- = wi::to_offset (max_object_size ());
- alloca_type result = (max_size < maxobjsize
- ? ALLOCA_BOUND_MAYBE_LARGE : ALLOCA_OK);
- return alloca_type_and_limit (result, max);
- }
- }
- }
- else if (range_type == VR_ANTI_RANGE)
- {
- // There may be some wrapping around going on. Catch it
- // with this heuristic. Hopefully, this VR_ANTI_RANGE
- // nonsense will go away, and we won't have to catch the
- // sign conversion problems with this crap.
- //
- // This is here to catch things like:
- // void foo(signed int n) {
- // if (n < 100)
- // alloca(n);
- // ...
- // }
- if (cast_from_signed_p (len, invalid_casted_type))
- {
- // Unfortunately this also triggers:
- //
- // __SIZE_TYPE__ n = (__SIZE_TYPE__)blah;
- // if (n < 100)
- // alloca(n);
- //
- // ...which is clearly bounded. So, double check that
- // the paths leading up to the size definitely don't
- // have a bound.
- tentative_cast_from_signed = true;
- }
- }
- // No easily determined range and try other things.
- }
-
- // If we couldn't find anything, try a few heuristics for things we
- // can easily determine. Check these misc cases but only accept
- // them if all predecessors have a known bound.
- class alloca_type_and_limit ret = alloca_type_and_limit (ALLOCA_OK);
- FOR_EACH_EDGE (e, ei, gimple_bb (stmt)->preds)
- {
- gcc_assert (!len_casted || TYPE_UNSIGNED (TREE_TYPE (len_casted)));
- ret = alloca_call_type_by_arg (len, len_casted, e, max_size);
- if (ret.type != ALLOCA_OK)
- break;
- }
-
- if (ret.type != ALLOCA_OK && tentative_cast_from_signed)
- ret = alloca_type_and_limit (ALLOCA_CAST_FROM_SIGNED);
-
+ struct alloca_type_and_limit ret = alloca_type_and_limit (ALLOCA_OK);
// If we have a declared maximum size, we can take it into account.
- if (ret.type != ALLOCA_OK
- && gimple_call_builtin_p (stmt, BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX))
+ if (gimple_call_builtin_p (stmt, BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX))
{
tree arg = gimple_call_arg (stmt, 2);
if (compare_tree_int (arg, max_size) <= 0)
@@ -485,9 +212,37 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type)
? ALLOCA_BOUND_MAYBE_LARGE : ALLOCA_OK);
ret = alloca_type_and_limit (result, wi::to_wide (arg));
}
+ return ret;
+ }
+
+ // If the user specified a limit, use it.
+ int_range_max r;
+ if (warn_limit_specified_p (is_vla)
+ && TREE_CODE (len) == SSA_NAME
+ && query.range_of_expr (r, len, stmt)
+ && !r.varying_p ())
+ {
+ // The invalid bits are anything outside of [0, MAX_SIZE].
+ static int_range<2> invalid_range (build_int_cst (size_type_node, 0),
+ build_int_cst (size_type_node,
+ max_size),
+ VR_ANTI_RANGE);
+
+ r.intersect (invalid_range);
+ if (r.undefined_p ())
+ return alloca_type_and_limit (ALLOCA_OK);
+
+ return alloca_type_and_limit (ALLOCA_BOUND_MAYBE_LARGE,
+ wi::to_wide (integer_zero_node));
}
- return ret;
+ const offset_int maxobjsize = tree_to_shwi (max_object_size ());
+ /* When MAX_SIZE is greater than or equal to PTRDIFF_MAX treat
+ allocations that aren't visibly constrained as OK, otherwise
+ report them as (potentially) unbounded. */
+ alloca_type unbounded_result = (max_size < maxobjsize.to_uhwi ()
+ ? ALLOCA_UNBOUNDED : ALLOCA_OK);
+ return alloca_type_and_limit (unbounded_result);
}
// Return TRUE if STMT is in a loop, otherwise return FALSE.
@@ -503,6 +258,7 @@ in_loop_p (gimple *stmt)
unsigned int
pass_walloca::execute (function *fun)
{
+ gimple_ranger ranger;
basic_block bb;
FOR_EACH_BB_FN (bb, fun)
{
@@ -535,9 +291,8 @@ pass_walloca::execute (function *fun)
else if (warn_alloca_limit < 0)
continue;
- tree invalid_casted_type = NULL;
class alloca_type_and_limit t
- = alloca_call_type (stmt, is_vla, &invalid_casted_type);
+ = alloca_call_type (ranger, stmt, is_vla);
unsigned HOST_WIDE_INT adjusted_alloca_limit
= adjusted_warn_limit (false);
@@ -599,13 +354,6 @@ pass_walloca::execute (function *fun)
}
}
break;
- case ALLOCA_BOUND_UNKNOWN:
- warning_at (loc, wcode,
- (is_vla
- ? G_("%Gvariable-length array bound is unknown")
- : G_("%G%<alloca%> bound is unknown")),
- stmt);
- break;
case ALLOCA_UNBOUNDED:
warning_at (loc, wcode,
(is_vla
@@ -618,17 +366,6 @@ pass_walloca::execute (function *fun)
warning_at (loc, wcode,
"%Guse of %<alloca%> within a loop", stmt);
break;
- case ALLOCA_CAST_FROM_SIGNED:
- gcc_assert (invalid_casted_type != NULL_TREE);
- warning_at (loc, wcode,
- (is_vla
- ? G_("%Gargument to variable-length array "
- "may be too large due to "
- "conversion from %qT to %qT")
- : G_("%Gargument to %<alloca%> may be too large "
- "due to conversion from %qT to %qT")),
- stmt, invalid_casted_type, size_type_node);
- break;
case ALLOCA_ARG_IS_ZERO:
warning_at (loc, wcode,
(is_vla
diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c
index 512fc13..3a79e72 100644
--- a/gcc/gimple-ssa-warn-restrict.c
+++ b/gcc/gimple-ssa-warn-restrict.c
@@ -25,7 +25,6 @@
#include "backend.h"
#include "tree.h"
#include "gimple.h"
-#include "domwalk.h"
#include "tree-pass.h"
#include "builtins.h"
#include "ssa.h"
@@ -41,6 +40,7 @@
#include "calls.h"
#include "cfgloop.h"
#include "intl.h"
+#include "gimple-range.h"
namespace {
@@ -77,21 +77,10 @@ pass_wrestrict::gate (function *fun ATTRIBUTE_UNUSED)
return warn_array_bounds || warn_restrict || warn_stringop_overflow;
}
-/* Class to walk the basic blocks of a function in dominator order. */
-class wrestrict_dom_walker : public dom_walker
-{
- public:
- wrestrict_dom_walker () : dom_walker (CDI_DOMINATORS) {}
+static void check_call (range_query *, gimple *);
- edge before_dom_children (basic_block) FINAL OVERRIDE;
- bool handle_gimple_call (gimple_stmt_iterator *);
-
- private:
- void check_call (gimple *);
-};
-
-edge
-wrestrict_dom_walker::before_dom_children (basic_block bb)
+static void
+wrestrict_walk (range_query *query, basic_block bb)
{
/* Iterate over statements, looking for function calls. */
for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
@@ -101,21 +90,17 @@ wrestrict_dom_walker::before_dom_children (basic_block bb)
if (!is_gimple_call (stmt))
continue;
- check_call (stmt);
+ check_call (query, stmt);
}
-
- return NULL;
}
-/* Execute the pass for function FUN, walking in dominator order. */
-
unsigned
pass_wrestrict::execute (function *fun)
{
- calculate_dominance_info (CDI_DOMINATORS);
-
- wrestrict_dom_walker walker;
- walker.walk (ENTRY_BLOCK_PTR_FOR_FN (fun));
+ gimple_ranger ranger;
+ basic_block bb;
+ FOR_EACH_BB_FN (bb, fun)
+ wrestrict_walk (&ranger, bb);
return 0;
}
@@ -159,11 +144,15 @@ public:
only the destination reference is. */
bool strbounded_p;
- builtin_memref (tree, tree);
+ builtin_memref (range_query *, gimple *, tree, tree);
tree offset_out_of_bounds (int, offset_int[3]) const;
private:
+ /* Call statement to the built-in. */
+ gimple *stmt;
+
+ range_query *query;
/* Ctor helper to set or extend OFFRANGE based on argument. */
void extend_offset_range (tree);
@@ -197,7 +186,7 @@ class builtin_access
&& detect_overlap != &builtin_access::no_overlap);
}
- builtin_access (gimple *, builtin_memref &, builtin_memref &);
+ builtin_access (range_query *, gimple *, builtin_memref &, builtin_memref &);
/* Entry point to determine overlap. */
bool overlap ();
@@ -233,9 +222,10 @@ class builtin_access
/* Initialize a memory reference representation from a pointer EXPR and
a size SIZE in bytes. If SIZE is NULL_TREE then the size is assumed
- to be unknown. */
+ to be unknown. STMT is the statement in which expr appears in. */
-builtin_memref::builtin_memref (tree expr, tree size)
+builtin_memref::builtin_memref (range_query *query, gimple *stmt, tree expr,
+ tree size)
: ptr (expr),
ref (),
base (),
@@ -245,7 +235,9 @@ builtin_memref::builtin_memref (tree expr, tree size)
offrange (),
sizrange (),
maxobjsize (tree_to_shwi (max_object_size ())),
- strbounded_p ()
+ strbounded_p (),
+ stmt (stmt),
+ query (query)
{
/* Unfortunately, wide_int default ctor is a no-op so array members
of the type must be set individually. */
@@ -264,7 +256,7 @@ builtin_memref::builtin_memref (tree expr, tree size)
tree range[2];
/* Determine the size range, allowing for the result to be [0, 0]
for SIZE in the anti-range ~[0, N] where N >= PTRDIFF_MAX. */
- get_size_range (size, range, true);
+ get_size_range (query, size, stmt, range, SR_ALLOW_ZERO);
sizrange[0] = wi::to_offset (range[0]);
sizrange[1] = wi::to_offset (range[1]);
/* get_size_range returns SIZE_MAX for the maximum size.
@@ -341,7 +333,24 @@ builtin_memref::extend_offset_range (tree offset)
/* A pointer offset is represented as sizetype but treated
as signed. */
wide_int min, max;
- value_range_kind rng = get_range_info (offset, &min, &max);
+ value_range_kind rng;
+ value_range vr;
+ if (query && query->range_of_expr (vr, offset, stmt))
+ {
+ rng = vr.kind ();
+ if (!vr.undefined_p ())
+ {
+ min = wi::to_wide (vr.min ());
+ max = wi::to_wide (vr.max ());
+ }
+ }
+ else
+ {
+ /* There is a global version here because
+ check_bounds_or_overlap may be called from gimple
+ fold during gimple lowering. */
+ rng = get_range_info (offset, &min, &max);
+ }
if (rng == VR_ANTI_RANGE && wi::lts_p (max, min))
{
/* Convert an anti-range whose upper bound is less than
@@ -658,7 +667,8 @@ builtin_memref::offset_out_of_bounds (int strict, offset_int ooboff[3]) const
/* Create an association between the memory references DST and SRC
for access by a call EXPR to a memory or string built-in funtion. */
-builtin_access::builtin_access (gimple *call, builtin_memref &dst,
+builtin_access::builtin_access (range_query *query, gimple *call,
+ builtin_memref &dst,
builtin_memref &src)
: dstref (&dst), srcref (&src), sizrange (), ovloff (), ovlsiz (),
dstoff (), srcoff (), dstsiz (), srcsiz ()
@@ -797,7 +807,7 @@ builtin_access::builtin_access (gimple *call, builtin_memref &dst,
tree size = gimple_call_arg (call, sizeargno);
tree range[2];
- if (get_size_range (size, range, true))
+ if (get_size_range (query, size, call, range, true))
{
bounds[0] = wi::to_offset (range[0]);
bounds[1] = wi::to_offset (range[1]);
@@ -1873,8 +1883,8 @@ maybe_diag_access_bounds (gimple *call, tree func, int strict,
/* Check a CALL statement for restrict-violations and issue warnings
if/when appropriate. */
-void
-wrestrict_dom_walker::check_call (gimple *call)
+static void
+check_call (range_query *query, gimple *call)
{
/* Avoid checking the call if it has already been diagnosed for
some reason. */
@@ -1964,7 +1974,7 @@ wrestrict_dom_walker::check_call (gimple *call)
|| (dstwr && !INTEGRAL_TYPE_P (TREE_TYPE (dstwr))))
return;
- if (!check_bounds_or_overlap (call, dst, src, dstwr, NULL_TREE))
+ if (!check_bounds_or_overlap (query, call, dst, src, dstwr, NULL_TREE))
return;
/* Avoid diagnosing the call again. */
@@ -1985,14 +1995,25 @@ check_bounds_or_overlap (gimple *call, tree dst, tree src, tree dstsize,
tree srcsize, bool bounds_only /* = false */,
bool do_warn /* = true */)
{
+ return check_bounds_or_overlap (/*range_query=*/NULL,
+ call, dst, src, dstsize, srcsize,
+ bounds_only, do_warn);
+}
+
+int
+check_bounds_or_overlap (range_query *query,
+ gimple *call, tree dst, tree src, tree dstsize,
+ tree srcsize, bool bounds_only /* = false */,
+ bool do_warn /* = true */)
+{
tree func = gimple_call_fndecl (call);
- builtin_memref dstref (dst, dstsize);
- builtin_memref srcref (src, srcsize);
+ builtin_memref dstref (query, call, dst, dstsize);
+ builtin_memref srcref (query, call, src, srcsize);
/* Create a descriptor of the access. This may adjust both DSTREF
and SRCREF based on one another and the kind of the access. */
- builtin_access acs (call, dstref, srcref);
+ builtin_access acs (query, call, dstref, srcref);
/* Set STRICT to the value of the -Warray-bounds=N argument for
string functions or when N > 1. */
diff --git a/gcc/gimple-ssa-warn-restrict.h b/gcc/gimple-ssa-warn-restrict.h
index 7bae95a..3dba9c0 100644
--- a/gcc/gimple-ssa-warn-restrict.h
+++ b/gcc/gimple-ssa-warn-restrict.h
@@ -22,5 +22,8 @@
extern int check_bounds_or_overlap (gimple *, tree, tree, tree, tree,
bool = false, bool = true);
+extern int check_bounds_or_overlap (class range_query *, gimple *,
+ tree, tree, tree, tree,
+ bool = false, bool = true);
#endif /* GIMPLE_SSA_WARN_RESTRICT_H */
diff --git a/gcc/gimple.c b/gcc/gimple.c
index fd4e0fa..f19e24d 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "asan.h"
#include "langhooks.h"
+#include "attr-fnspec.h"
/* All the tuples have their operand vector (if present) at the very bottom
@@ -387,6 +388,10 @@ gimple_build_call_from_tree (tree t, tree fnptrtype)
&& fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
&& ALLOCA_FUNCTION_CODE_P (DECL_FUNCTION_CODE (fndecl)))
gimple_call_set_alloca_for_var (call, CALL_ALLOCA_FOR_VAR_P (t));
+ else if (fndecl
+ && (DECL_IS_OPERATOR_NEW_P (fndecl)
+ || DECL_IS_OPERATOR_DELETE_P (fndecl)))
+ gimple_call_set_from_new_or_delete (call, CALL_FROM_NEW_OR_DELETE_P (t));
else
gimple_call_set_from_thunk (call, CALL_FROM_THUNK_P (t));
gimple_call_set_va_arg_pack (call, CALL_EXPR_VA_ARG_PACK (t));
@@ -1508,31 +1513,26 @@ gimple_call_arg_flags (const gcall *stmt, unsigned arg)
{
const_tree attr = gimple_call_fnspec (stmt);
- if (!attr || 1 + arg >= (unsigned) TREE_STRING_LENGTH (attr))
+ if (!attr)
return 0;
- switch (TREE_STRING_POINTER (attr)[1 + arg])
- {
- case 'x':
- case 'X':
- return EAF_UNUSED;
-
- case 'R':
- return EAF_DIRECT | EAF_NOCLOBBER | EAF_NOESCAPE;
-
- case 'r':
- return EAF_NOCLOBBER | EAF_NOESCAPE;
-
- case 'W':
- return EAF_DIRECT | EAF_NOESCAPE;
-
- case 'w':
- return EAF_NOESCAPE;
+ int flags = 0;
+ attr_fnspec fnspec (attr);
- case '.':
- default:
- return 0;
+ if (!fnspec.arg_specified_p (arg))
+ ;
+ else if (!fnspec.arg_used_p (arg))
+ flags = EAF_UNUSED;
+ else
+ {
+ if (fnspec.arg_direct_p (arg))
+ flags |= EAF_DIRECT;
+ if (fnspec.arg_noescape_p (arg))
+ flags |= EAF_NOESCAPE;
+ if (fnspec.arg_readonly_p (arg))
+ flags |= EAF_NOCLOBBER;
}
+ return flags;
}
/* Detects return flags for the call STMT. */
@@ -1546,24 +1546,17 @@ gimple_call_return_flags (const gcall *stmt)
return ERF_NOALIAS;
attr = gimple_call_fnspec (stmt);
- if (!attr || TREE_STRING_LENGTH (attr) < 1)
+ if (!attr)
return 0;
+ attr_fnspec fnspec (attr);
- switch (TREE_STRING_POINTER (attr)[0])
- {
- case '1':
- case '2':
- case '3':
- case '4':
- return ERF_RETURNS_ARG | (TREE_STRING_POINTER (attr)[0] - '1');
-
- case 'm':
- return ERF_NOALIAS;
+ unsigned int arg_no;
+ if (fnspec.returns_arg (&arg_no))
+ return ERF_RETURNS_ARG | arg_no;
- case '.':
- default:
- return 0;
- }
+ if (fnspec.returns_noalias_p ())
+ return ERF_NOALIAS;
+ return 0;
}
@@ -2713,12 +2706,12 @@ gimple_builtin_call_types_compatible_p (const gimple *stmt, tree fndecl)
/* Return true when STMT is operator a replaceable delete call. */
bool
-gimple_call_replaceable_operator_delete_p (const gcall *stmt)
+gimple_call_operator_delete_p (const gcall *stmt)
{
tree fndecl;
if ((fndecl = gimple_call_fndecl (stmt)) != NULL_TREE)
- return DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (fndecl);
+ return DECL_IS_OPERATOR_DELETE_P (fndecl);
return false;
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6cc7e66..3c9b996 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -149,6 +149,7 @@ enum gf_mask {
GF_CALL_MUST_TAIL_CALL = 1 << 9,
GF_CALL_BY_DESCRIPTOR = 1 << 10,
GF_CALL_NOCF_CHECK = 1 << 11,
+ GF_CALL_FROM_NEW_OR_DELETE = 1 << 12,
GF_OMP_PARALLEL_COMBINED = 1 << 0,
GF_OMP_TASK_TASKLOOP = 1 << 0,
GF_OMP_TASK_TASKWAIT = 1 << 1,
@@ -1604,7 +1605,7 @@ extern alias_set_type gimple_get_alias_set (tree);
extern bool gimple_ior_addresses_taken (bitmap, gimple *);
extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
extern combined_fn gimple_call_combined_fn (const gimple *);
-extern bool gimple_call_replaceable_operator_delete_p (const gcall *);
+extern bool gimple_call_operator_delete_p (const gcall *);
extern bool gimple_call_builtin_p (const gimple *);
extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
@@ -3387,6 +3388,29 @@ gimple_call_from_thunk_p (gcall *s)
}
+/* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
+ to operator new or delete created from a new or delete expression. */
+
+static inline void
+gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
+{
+ if (from_new_or_delete_p)
+ s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
+ else
+ s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
+}
+
+
+/* Return true if GIMPLE_CALL S is a call to operator new or delete from
+ from a new or delete expression. */
+
+static inline bool
+gimple_call_from_new_or_delete (gcall *s)
+{
+ return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
+}
+
+
/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
argument pack in its argument list. */
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 2dea03cc..29f385c 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -67,6 +67,7 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "omp-offload.h"
#include "context.h"
+#include "tree-nested.h"
/* Hash set of poisoned variables in a bind expr. */
static hash_set<tree> *asan_poisoned_variables = NULL;
@@ -959,7 +960,8 @@ unshare_body (tree fndecl)
delete visited;
if (cgn)
- for (cgn = cgn->nested; cgn; cgn = cgn->next_nested)
+ for (cgn = first_nested_function (cgn); cgn;
+ cgn = next_nested_function (cgn))
unshare_body (cgn->decl);
}
@@ -1002,7 +1004,8 @@ unvisit_body (tree fndecl)
unmark_visited (&DECL_SIZE_UNIT (DECL_RESULT (fndecl)));
if (cgn)
- for (cgn = cgn->nested; cgn; cgn = cgn->next_nested)
+ for (cgn = first_nested_function (cgn);
+ cgn; cgn = next_nested_function (cgn))
unvisit_body (cgn->decl);
}
@@ -1468,15 +1471,22 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
if (flag_openacc && oacc_declare_returns != NULL)
{
- tree *c = oacc_declare_returns->get (t);
+ tree key = t;
+ if (DECL_HAS_VALUE_EXPR_P (key))
+ {
+ key = DECL_VALUE_EXPR (key);
+ if (TREE_CODE (key) == INDIRECT_REF)
+ key = TREE_OPERAND (key, 0);
+ }
+ tree *c = oacc_declare_returns->get (key);
if (c != NULL)
{
if (ret_clauses)
OMP_CLAUSE_CHAIN (*c) = ret_clauses;
- ret_clauses = *c;
+ ret_clauses = unshare_expr (*c);
- oacc_declare_returns->remove (t);
+ oacc_declare_returns->remove (key);
if (oacc_declare_returns->is_empty ())
{
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 6b590f6..3ad6c96 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-6fd6418efb983827717f648a11bb5ca6fe93af30
+28f3df468666787f83f94220312383a7c267a8ce
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 8bbc557..e76bc69 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -1823,6 +1823,31 @@ Expression::make_unknown_reference(Named_object* no, Location location)
return new Unknown_expression(no, location);
}
+// Start exporting a type conversion for a constant, if needed. This
+// returns whether we need to export a closing parenthesis.
+
+bool
+Expression::export_constant_type(Export_function_body* efb, Type* type)
+{
+ if (type == NULL
+ || type->is_abstract()
+ || type == efb->type_context())
+ return false;
+ efb->write_c_string("$convert(");
+ efb->write_type(type);
+ efb->write_c_string(", ");
+ return true;
+}
+
+// Finish a type conversion for a constant.
+
+void
+Expression::finish_export_constant_type(Export_function_body* efb, bool needed)
+{
+ if (needed)
+ efb->write_c_string(")");
+}
+
// A boolean expression.
class Boolean_expression : public Expression
@@ -1878,8 +1903,7 @@ class Boolean_expression : public Expression
{ return 1; }
void
- do_export(Export_function_body* efb) const
- { efb->write_c_string(this->val_ ? "$true" : "$false"); }
+ do_export(Export_function_body* efb) const;
void
do_dump_expression(Ast_dump_context* ast_dump_context) const
@@ -1926,6 +1950,16 @@ Boolean_expression::do_determine_type(const Type_context* context)
this->type_ = Type::lookup_bool_type();
}
+// Export a boolean constant.
+
+void
+Boolean_expression::do_export(Export_function_body* efb) const
+{
+ bool exported_type = Expression::export_constant_type(efb, this->type_);
+ efb->write_c_string(this->val_ ? "$true" : "$false");
+ Expression::finish_export_constant_type(efb, exported_type);
+}
+
// Import a boolean constant.
Expression*
@@ -2055,7 +2089,9 @@ String_expression::export_string(String_dump* exp,
void
String_expression::do_export(Export_function_body* efb) const
{
+ bool exported_type = Expression::export_constant_type(efb, this->type_);
String_expression::export_string(efb, this);
+ Expression::finish_export_constant_type(efb, exported_type);
}
// Import a string expression.
@@ -2547,16 +2583,7 @@ Integer_expression::export_integer(String_dump* exp, const mpz_t val)
void
Integer_expression::do_export(Export_function_body* efb) const
{
- bool added_type = false;
- if (this->type_ != NULL
- && !this->type_->is_abstract()
- && this->type_ != efb->type_context())
- {
- efb->write_c_string("$convert(");
- efb->write_type(this->type_);
- efb->write_c_string(", ");
- added_type = true;
- }
+ bool exported_type = Expression::export_constant_type(efb, this->type_);
Integer_expression::export_integer(efb, this->val_);
if (this->is_character_constant_)
@@ -2564,8 +2591,7 @@ Integer_expression::do_export(Export_function_body* efb) const
// A trailing space lets us reliably identify the end of the number.
efb->write_c_string(" ");
- if (added_type)
- efb->write_c_string(")");
+ Expression::finish_export_constant_type(efb, exported_type);
}
// Import an integer, floating point, or complex value. This handles
@@ -2953,23 +2979,13 @@ Float_expression::export_float(String_dump *exp, const mpfr_t val)
void
Float_expression::do_export(Export_function_body* efb) const
{
- bool added_type = false;
- if (this->type_ != NULL
- && !this->type_->is_abstract()
- && this->type_ != efb->type_context())
- {
- efb->write_c_string("$convert(");
- efb->write_type(this->type_);
- efb->write_c_string(", ");
- added_type = true;
- }
+ bool exported_type = Expression::export_constant_type(efb, this->type_);
Float_expression::export_float(efb, this->val_);
// A trailing space lets us reliably identify the end of the number.
efb->write_c_string(" ");
- if (added_type)
- efb->write_c_string(")");
+ Expression::finish_export_constant_type(efb, exported_type);
}
// Dump a floating point number to the dump file.
@@ -3184,23 +3200,13 @@ Complex_expression::export_complex(String_dump* exp, const mpc_t val)
void
Complex_expression::do_export(Export_function_body* efb) const
{
- bool added_type = false;
- if (this->type_ != NULL
- && !this->type_->is_abstract()
- && this->type_ != efb->type_context())
- {
- efb->write_c_string("$convert(");
- efb->write_type(this->type_);
- efb->write_c_string(", ");
- added_type = true;
- }
+ bool exported_type = Expression::export_constant_type(efb, this->type_);
Complex_expression::export_complex(efb, this->val_);
// A trailing space lets us reliably identify the end of the number.
efb->write_c_string(" ");
- if (added_type)
- efb->write_c_string(")");
+ Expression::finish_export_constant_type(efb, exported_type);
}
// Dump a complex expression to the dump file.
@@ -14529,21 +14535,19 @@ Selector_expression::lower_method_expression(Gogo* gogo)
is_pointer = true;
type = type->points_to();
}
- Named_type* nt = type->named_type();
- if (nt == NULL)
- {
- go_error_at(location,
- ("method expression requires named type or "
- "pointer to named type"));
- return Expression::make_error(location);
- }
+ Named_type* nt = type->named_type();
+ Struct_type* st = type->struct_type();
bool is_ambiguous;
- Method* method = nt->method_function(name, &is_ambiguous);
+ Method* method = NULL;
+ if (nt != NULL)
+ method = nt->method_function(name, &is_ambiguous);
+ else if (st != NULL)
+ method = st->method_function(name, &is_ambiguous);
const Typed_identifier* imethod = NULL;
if (method == NULL && !is_pointer)
{
- Interface_type* it = nt->interface_type();
+ Interface_type* it = type->interface_type();
if (it != NULL)
imethod = it->find_method(name);
}
@@ -14551,16 +14555,28 @@ Selector_expression::lower_method_expression(Gogo* gogo)
if ((method == NULL && imethod == NULL)
|| (left_type->named_type() != NULL && left_type->points_to() != NULL))
{
- if (!is_ambiguous)
- go_error_at(location, "type %<%s%s%> has no method %<%s%>",
- is_pointer ? "*" : "",
- nt->message_name().c_str(),
- Gogo::message_name(name).c_str());
+ if (nt != NULL)
+ {
+ if (!is_ambiguous)
+ go_error_at(location, "type %<%s%s%> has no method %<%s%>",
+ is_pointer ? "*" : "",
+ nt->message_name().c_str(),
+ Gogo::message_name(name).c_str());
+ else
+ go_error_at(location, "method %<%s%s%> is ambiguous in type %<%s%>",
+ Gogo::message_name(name).c_str(),
+ is_pointer ? "*" : "",
+ nt->message_name().c_str());
+ }
else
- go_error_at(location, "method %<%s%s%> is ambiguous in type %<%s%>",
- Gogo::message_name(name).c_str(),
- is_pointer ? "*" : "",
- nt->message_name().c_str());
+ {
+ if (!is_ambiguous)
+ go_error_at(location, "type has no method %<%s%>",
+ Gogo::message_name(name).c_str());
+ else
+ go_error_at(location, "method %<%s%> is ambiguous",
+ Gogo::message_name(name).c_str());
+ }
return Expression::make_error(location);
}
@@ -14657,7 +14673,7 @@ Selector_expression::lower_method_expression(Gogo* gogo)
Expression* ve = Expression::make_var_reference(vno, location);
Expression* bm;
if (method != NULL)
- bm = Type::bind_field_or_method(gogo, nt, ve, name, location);
+ bm = Type::bind_field_or_method(gogo, type, ve, name, location);
else
bm = Expression::make_interface_field_reference(ve, name, location);
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index acb2732..d297523 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -1237,6 +1237,14 @@ class Expression
virtual void
do_dump_expression(Ast_dump_context*) const = 0;
+ // Start exporting a type conversion for a constant, if needed.
+ static bool
+ export_constant_type(Export_function_body*, Type*);
+
+ // Finish exporting a type conversion for a constant.
+ static void
+ finish_export_constant_type(Export_function_body*, bool);
+
// Varargs lowering creates a slice object (unnamed compiler temp)
// to contain the variable length collection of values. The enum
// below tells the lowering routine whether it can mark that temp
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 82d4c1f..f40f131 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -3508,6 +3508,10 @@ Finalize_methods::type(Type* t)
case Type::TYPE_NAMED:
{
Named_type* nt = t->named_type();
+
+ if (nt->is_alias())
+ return TRAVERSE_CONTINUE;
+
Type* rt = nt->real_type();
if (rt->classification() != Type::TYPE_STRUCT)
{
@@ -6208,7 +6212,7 @@ Function::import_func(Import* imp, std::string* pname,
return false;
}
- *body = imp->read(static_cast<size_t>(llen));
+ imp->read(static_cast<size_t>(llen), body);
}
return true;
diff --git a/gcc/go/gofrontend/import.cc b/gcc/go/gofrontend/import.cc
index c63ae24..c6c1178 100644
--- a/gcc/go/gofrontend/import.cc
+++ b/gcc/go/gofrontend/import.cc
@@ -1375,8 +1375,8 @@ Import::read_name()
// Read LENGTH bytes from the stream.
-std::string
-Import::read(size_t length)
+void
+Import::read(size_t length, std::string* out)
{
const char* data;
if (!this->stream_->peek(length, &data))
@@ -1385,10 +1385,11 @@ Import::read(size_t length)
go_error_at(this->location_, "import error at %d: expected %d bytes",
this->stream_->pos(), static_cast<int>(length));
this->stream_->set_saw_error();
- return "";
+ *out = std::string("");
+ return;
}
+ *out = std::string(data, length);
this->advance(length);
- return std::string(data, length);
}
// Turn a string into a integer with appropriate error handling.
@@ -1487,7 +1488,7 @@ Stream_from_file::~Stream_from_file()
bool
Stream_from_file::do_peek(size_t length, const char** bytes)
{
- if (this->data_.length() <= length)
+ if (this->data_.length() >= length)
{
*bytes = this->data_.data();
return true;
@@ -1504,7 +1505,7 @@ Stream_from_file::do_peek(size_t length, const char** bytes)
return false;
}
- if (lseek(this->fd_, - got, SEEK_CUR) != 0)
+ if (lseek(this->fd_, - got, SEEK_CUR) < 0)
{
if (!this->saw_error())
go_fatal_error(Linemap::unknown_location(), "lseek failed: %m");
@@ -1524,7 +1525,7 @@ Stream_from_file::do_peek(size_t length, const char** bytes)
void
Stream_from_file::do_advance(size_t skip)
{
- if (lseek(this->fd_, skip, SEEK_CUR) != 0)
+ if (lseek(this->fd_, skip, SEEK_CUR) < 0)
{
if (!this->saw_error())
go_fatal_error(Linemap::unknown_location(), "lseek failed: %m");
@@ -1532,7 +1533,7 @@ Stream_from_file::do_advance(size_t skip)
}
if (!this->data_.empty())
{
- if (this->data_.length() < skip)
+ if (this->data_.length() > skip)
this->data_.erase(0, skip);
else
this->data_.clear();
diff --git a/gcc/go/gofrontend/import.h b/gcc/go/gofrontend/import.h
index b12b3b8..1d8aae4 100644
--- a/gcc/go/gofrontend/import.h
+++ b/gcc/go/gofrontend/import.h
@@ -240,10 +240,10 @@ class Import : public Import_expression
get_char()
{ return this->stream_->get_char(); }
- // Read LENGTH characters into a string and advance past them. On
- // EOF reports an error and returns an empty string.
- std::string
- read(size_t length);
+ // Read LENGTH characters into *OUT and advance past them. On
+ // EOF reports an error and sets *OUT to an empty string.
+ void
+ read(size_t length, std::string* out);
// Return true at the end of the stream.
bool
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index a059ee4..ad89807 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -4627,7 +4627,8 @@ Type_case_clauses::Type_case_clause::traverse(Traverse* traverse)
// statements.
void
-Type_case_clauses::Type_case_clause::lower(Type* switch_val_type,
+Type_case_clauses::Type_case_clause::lower(Gogo* gogo,
+ Type* switch_val_type,
Block* b,
Temporary_statement* descriptor_temp,
Unnamed_label* break_label,
@@ -4666,9 +4667,16 @@ Type_case_clauses::Type_case_clause::lower(Type* switch_val_type,
Expression::make_nil(loc),
loc);
else if (type->interface_type() == NULL)
- cond = Expression::make_binary(OPERATOR_EQEQ, ref,
- Expression::make_type_descriptor(type, loc),
- loc);
+ {
+ if (!gogo->need_eqtype())
+ cond = Expression::make_binary(OPERATOR_EQEQ, ref,
+ Expression::make_type_descriptor(type, loc),
+ loc);
+ else
+ cond = Runtime::make_call(Runtime::EQTYPE, loc, 2,
+ Expression::make_type_descriptor(type, loc),
+ ref);
+ }
else
cond = Runtime::make_call(Runtime::IFACET2IP, loc, 2,
Expression::make_type_descriptor(type, loc),
@@ -4826,7 +4834,8 @@ Type_case_clauses::check_duplicates() const
// BREAK_LABEL is the label at the end of the type switch.
void
-Type_case_clauses::lower(Type* switch_val_type, Block* b,
+Type_case_clauses::lower(Gogo* gogo, Type* switch_val_type,
+ Block* b,
Temporary_statement* descriptor_temp,
Unnamed_label* break_label) const
{
@@ -4838,7 +4847,7 @@ Type_case_clauses::lower(Type* switch_val_type, Block* b,
++p)
{
if (!p->is_default())
- p->lower(switch_val_type, b, descriptor_temp, break_label,
+ p->lower(gogo, switch_val_type, b, descriptor_temp, break_label,
&stmts_label);
else
{
@@ -4850,7 +4859,7 @@ Type_case_clauses::lower(Type* switch_val_type, Block* b,
go_assert(stmts_label == NULL);
if (default_case != NULL)
- default_case->lower(switch_val_type, b, descriptor_temp, break_label,
+ default_case->lower(gogo, switch_val_type, b, descriptor_temp, break_label,
NULL);
}
@@ -4905,7 +4914,7 @@ Type_switch_statement::do_traverse(Traverse* traverse)
// equality testing.
Statement*
-Type_switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
+Type_switch_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing,
Statement_inserter*)
{
const Location loc = this->location();
@@ -4943,7 +4952,7 @@ Type_switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
b->add_statement(s);
if (this->clauses_ != NULL)
- this->clauses_->lower(val_type, b, descriptor_temp, this->break_label());
+ this->clauses_->lower(gogo, val_type, b, descriptor_temp, this->break_label());
s = Statement::make_unnamed_label_statement(this->break_label_);
b->add_statement(s);
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index f1c6be9..47092b4 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -2089,7 +2089,7 @@ class Type_case_clauses
// Lower to if and goto statements.
void
- lower(Type*, Block*, Temporary_statement* descriptor_temp,
+ lower(Gogo*, Type*, Block*, Temporary_statement* descriptor_temp,
Unnamed_label* break_label) const;
// Return true if these clauses may fall through to the statements
@@ -2138,7 +2138,7 @@ class Type_case_clauses
// Lower to if and goto statements.
void
- lower(Type*, Block*, Temporary_statement* descriptor_temp,
+ lower(Gogo*, Type*, Block*, Temporary_statement* descriptor_temp,
Unnamed_label* break_label, Unnamed_label** stmts_label) const;
// Return true if this clause may fall through to execute the
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 7f65b4a..eb9c766 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -5182,7 +5182,11 @@ Function_type::do_export(Export* exp) const
first = false;
else
exp->write_c_string(", ");
- exp->write_name(p->name());
+ // The hash for a function type ignores parameter names, so
+ // we don't want to write them out here. If we did write
+ // them out, we could get spurious changes in export data
+ // when recompiling a package.
+ exp->write_name("");
exp->write_c_string(" ");
if (!is_varargs || p + 1 != this->parameters_->end())
exp->write_type(p->type());
@@ -5213,7 +5217,7 @@ Function_type::do_export(Export* exp) const
first = false;
else
exp->write_c_string(", ");
- exp->write_name(p->name());
+ exp->write_name("");
exp->write_c_string(" ");
exp->write_type(p->type());
}
@@ -5350,8 +5354,12 @@ Function_type::copy_with_receiver_as_param(bool want_pointer_receiver) const
++p)
new_params->push_back(*p);
}
- return Type::make_function_type(NULL, new_params, this->results_,
- this->location_);
+ Function_type* ret = Type::make_function_type(NULL, new_params,
+ this->results_,
+ this->location_);
+ if (this->is_varargs_)
+ ret->set_is_varargs();
+ return ret;
}
// Make a copy of a function type ignoring any receiver and adding a
diff --git a/gcc/hash-table.h b/gcc/hash-table.h
index 32f3a63..487003c 100644
--- a/gcc/hash-table.h
+++ b/gcc/hash-table.h
@@ -819,7 +819,7 @@ hash_table<Descriptor, Lazy, Allocator>::expand ()
if (!is_empty (x) && !is_deleted (x))
{
value_type *q = find_empty_slot_for_expand (Descriptor::hash (x));
- new ((void*) q) value_type (x);
+ new ((void*) q) value_type (std::move (x));
}
p++;
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 8efc77d..792d2ca 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-phinodes.h"
#include "ssa-iterators.h"
#include "explow.h"
+#include "rtl-iter.h"
/* The names of each internal function, indexed by function number. */
const char *const internal_fn_name_array[] = {
@@ -93,7 +94,7 @@ init_internal_fns ()
{
#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) \
if (FNSPEC) internal_fn_fnspec_array[IFN_##CODE] = \
- build_string ((int) sizeof (FNSPEC), FNSPEC ? FNSPEC : "");
+ build_string ((int) sizeof (FNSPEC) - 1, FNSPEC ? FNSPEC : "");
#include "internal-fn.def"
internal_fn_fnspec_array[IFN_LAST] = 0;
}
@@ -115,6 +116,7 @@ init_internal_fns ()
#define vec_condeq_direct { 0, 0, false }
#define scatter_store_direct { 3, 1, false }
#define len_store_direct { 3, 3, false }
+#define vec_set_direct { 3, 3, false }
#define unary_direct { 0, 0, true }
#define binary_direct { 0, 0, true }
#define ternary_direct { 0, 0, true }
@@ -2644,7 +2646,7 @@ expand_vect_cond_mask_optab_fn (internal_fn, gcall *stmt, convert_optab optab)
rtx_op2 = expand_normal (op2);
mask = force_reg (mask_mode, mask);
- rtx_op1 = force_reg (GET_MODE (rtx_op1), rtx_op1);
+ rtx_op1 = force_reg (mode, rtx_op1);
rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
create_output_operand (&ops[0], target, mode);
@@ -2658,6 +2660,45 @@ expand_vect_cond_mask_optab_fn (internal_fn, gcall *stmt, convert_optab optab)
#define expand_vec_cond_mask_optab_fn expand_vect_cond_mask_optab_fn
+/* Expand VEC_SET internal functions. */
+
+static void
+expand_vec_set_optab_fn (internal_fn, gcall *stmt, convert_optab optab)
+{
+ tree lhs = gimple_call_lhs (stmt);
+ tree op0 = gimple_call_arg (stmt, 0);
+ tree op1 = gimple_call_arg (stmt, 1);
+ tree op2 = gimple_call_arg (stmt, 2);
+ rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
+ rtx src = expand_normal (op0);
+
+ machine_mode outermode = TYPE_MODE (TREE_TYPE (op0));
+ scalar_mode innermode = GET_MODE_INNER (outermode);
+
+ rtx value = expand_normal (op1);
+ rtx pos = expand_normal (op2);
+
+ class expand_operand ops[3];
+ enum insn_code icode = optab_handler (optab, outermode);
+
+ if (icode != CODE_FOR_nothing)
+ {
+ rtx temp = gen_reg_rtx (outermode);
+ emit_move_insn (temp, src);
+
+ create_fixed_operand (&ops[0], temp);
+ create_input_operand (&ops[1], value, innermode);
+ create_convert_operand_from (&ops[2], pos, TYPE_MODE (TREE_TYPE (op2)),
+ true);
+ if (maybe_expand_insn (icode, 3, ops))
+ {
+ emit_move_insn (target, temp);
+ return;
+ }
+ }
+ gcc_unreachable ();
+}
+
static void
expand_ABNORMAL_DISPATCHER (internal_fn, gcall *)
{
@@ -2945,6 +2986,32 @@ expand_gather_load_optab_fn (internal_fn, gcall *stmt, direct_optab optab)
emit_move_insn (lhs_rtx, ops[0].value);
}
+/* Helper for expand_DIVMOD. Return true if the sequence starting with
+ INSN contains any call insns or insns with {,U}{DIV,MOD} rtxes. */
+
+static bool
+contains_call_div_mod (rtx_insn *insn)
+{
+ subrtx_iterator::array_type array;
+ for (; insn; insn = NEXT_INSN (insn))
+ if (CALL_P (insn))
+ return true;
+ else if (INSN_P (insn))
+ FOR_EACH_SUBRTX (iter, array, PATTERN (insn), NONCONST)
+ switch (GET_CODE (*iter))
+ {
+ case CALL:
+ case DIV:
+ case UDIV:
+ case MOD:
+ case UMOD:
+ return true;
+ default:
+ break;
+ }
+ return false;
+ }
+
/* Expand DIVMOD() using:
a) optab handler for udivmod/sdivmod if it is available.
b) If optab_handler doesn't exist, generate call to
@@ -2967,10 +3034,44 @@ expand_DIVMOD (internal_fn, gcall *call_stmt)
rtx op1 = expand_normal (arg1);
rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
- rtx quotient, remainder, libfunc;
+ rtx quotient = NULL_RTX, remainder = NULL_RTX;
+ rtx_insn *insns = NULL;
+
+ if (TREE_CODE (arg1) == INTEGER_CST)
+ {
+ /* For DIVMOD by integral constants, there could be efficient code
+ expanded inline e.g. using shifts and plus/minus. Try to expand
+ the division and modulo and if it emits any library calls or any
+ {,U}{DIV,MOD} rtxes throw it away and use a divmod optab or
+ divmod libcall. */
+ struct separate_ops ops;
+ ops.code = TRUNC_DIV_EXPR;
+ ops.type = type;
+ ops.op0 = make_tree (ops.type, op0);
+ ops.op1 = arg1;
+ ops.op2 = NULL_TREE;
+ ops.location = gimple_location (call_stmt);
+ start_sequence ();
+ quotient = expand_expr_real_2 (&ops, NULL_RTX, mode, EXPAND_NORMAL);
+ if (contains_call_div_mod (get_insns ()))
+ quotient = NULL_RTX;
+ else
+ {
+ ops.code = TRUNC_MOD_EXPR;
+ remainder = expand_expr_real_2 (&ops, NULL_RTX, mode, EXPAND_NORMAL);
+ if (contains_call_div_mod (get_insns ()))
+ remainder = NULL_RTX;
+ }
+ if (remainder)
+ insns = get_insns ();
+ end_sequence ();
+ }
+
+ if (remainder)
+ emit_insn (insns);
/* Check if optab_handler exists for divmod_optab for given mode. */
- if (optab_handler (tab, mode) != CODE_FOR_nothing)
+ else if (optab_handler (tab, mode) != CODE_FOR_nothing)
{
quotient = gen_reg_rtx (mode);
remainder = gen_reg_rtx (mode);
@@ -2978,7 +3079,7 @@ expand_DIVMOD (internal_fn, gcall *call_stmt)
}
/* Generate call to divmod libfunc if it exists. */
- else if ((libfunc = optab_libfunc (tab, mode)) != NULL_RTX)
+ else if (rtx libfunc = optab_libfunc (tab, mode))
targetm.expand_divmod_libfunc (libfunc, mode, op0, op1,
&quotient, &remainder);
@@ -3253,6 +3354,7 @@ multi_vector_optab_supported_p (convert_optab optab, tree_pair types,
#define direct_fold_left_optab_supported_p direct_optab_supported_p
#define direct_mask_fold_left_optab_supported_p direct_optab_supported_p
#define direct_check_ptrs_optab_supported_p direct_optab_supported_p
+#define direct_vec_set_optab_supported_p direct_optab_supported_p
/* Return the optab used by internal function FN. */
@@ -3693,6 +3795,7 @@ internal_fn_stored_value_index (internal_fn fn)
switch (fn)
{
case IFN_MASK_STORE:
+ case IFN_MASK_STORE_LANES:
case IFN_SCATTER_STORE:
case IFN_MASK_SCATTER_STORE:
case IFN_LEN_STORE:
diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
index 13e6082..310d37a 100644
--- a/gcc/internal-fn.def
+++ b/gcc/internal-fn.def
@@ -145,6 +145,8 @@ DEF_INTERNAL_OPTAB_FN (VCONDU, 0, vcondu, vec_condu)
DEF_INTERNAL_OPTAB_FN (VCONDEQ, 0, vcondeq, vec_condeq)
DEF_INTERNAL_OPTAB_FN (VCOND_MASK, 0, vcond_mask, vec_cond_mask)
+DEF_INTERNAL_OPTAB_FN (VEC_SET, 0, vec_set, vec_set)
+
DEF_INTERNAL_OPTAB_FN (LEN_STORE, 0, len_store, len_store)
DEF_INTERNAL_OPTAB_FN (WHILE_ULT, ECF_CONST | ECF_NOTHROW, while_ult, while)
@@ -309,17 +311,18 @@ DEF_INTERNAL_FN (GOMP_SIMD_ORDERED_END, ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (LOOP_VECTORIZED, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (LOOP_DIST_ALIAS, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (ANNOTATE, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ".R.")
+DEF_INTERNAL_FN (UBSAN_NULL, ECF_LEAF | ECF_NOTHROW, ". R . ")
DEF_INTERNAL_FN (UBSAN_BOUNDS, ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ".RR..")
+DEF_INTERNAL_FN (UBSAN_VPTR, ECF_LEAF | ECF_NOTHROW, ". R R . . ")
DEF_INTERNAL_FN (UBSAN_CHECK_ADD, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (UBSAN_CHECK_SUB, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (UBSAN_CHECK_MUL, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ".R.")
+DEF_INTERNAL_FN (UBSAN_PTR, ECF_LEAF | ECF_NOTHROW, ". R . ")
DEF_INTERNAL_FN (UBSAN_OBJECT_SIZE, ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (ABNORMAL_DISPATCHER, ECF_NORETURN, NULL)
DEF_INTERNAL_FN (BUILTIN_EXPECT, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
-DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW, "..R..")
+DEF_INTERNAL_FN (ASAN_CHECK, ECF_TM_PURE | ECF_LEAF | ECF_NOTHROW,
+ ". . R . . ")
DEF_INTERNAL_FN (ASAN_MARK, ECF_LEAF | ECF_NOTHROW, NULL)
DEF_INTERNAL_FN (ASAN_POISON, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
DEF_INTERNAL_FN (ASAN_POISON_USE, ECF_LEAF | ECF_NOTHROW | ECF_NOVOPS, NULL)
@@ -343,8 +346,8 @@ DEF_INTERNAL_FN (PHI, 0, NULL)
thought to clobber memory and can be gcse'd within a single
parallel region, but not across FORK/JOIN boundaries. They take a
single INTEGER_CST argument. This might be overly conservative. */
-DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, ".")
-DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, ".")
+DEF_INTERNAL_FN (GOACC_DIM_SIZE, ECF_CONST | ECF_NOTHROW | ECF_LEAF, NULL)
+DEF_INTERNAL_FN (GOACC_DIM_POS, ECF_PURE | ECF_NOTHROW | ECF_LEAF, NULL)
/* OpenACC looping abstraction. See internal-fn.h for usage. */
DEF_INTERNAL_FN (GOACC_LOOP, ECF_PURE | ECF_NOTHROW, NULL)
diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c
index feea458..350c474 100644
--- a/gcc/ipa-comdats.c
+++ b/gcc/ipa-comdats.c
@@ -128,7 +128,7 @@ propagate_comdat_group (struct symtab_node *symbol,
if (cgraph_node * cn = dyn_cast <cgraph_node *> (symbol2))
{
/* Thunks cannot call across section boundary. */
- if (cn->thunk.thunk_p)
+ if (cn->thunk)
newgroup = propagate_comdat_group (symbol2, newgroup, map);
/* If we see inline clone, its comdat group actually
corresponds to the comdat group of the function it
@@ -344,7 +344,7 @@ ipa_comdats (void)
if (!symbol->get_comdat_group ()
&& !symbol->alias
&& (!(fun = dyn_cast <cgraph_node *> (symbol))
- || !fun->thunk.thunk_p)
+ || !fun->thunk)
&& symbol->real_symbol_p ())
{
tree *val = map.get (symbol);
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index b3e7d41..f981366 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -595,7 +595,7 @@ determine_versionability (struct cgraph_node *node,
/* There are a number of generic reasons functions cannot be versioned. We
also cannot remove parameters if there are type attributes such as fnspec
present. */
- if (node->alias || node->thunk.thunk_p)
+ if (node->alias || node->thunk)
reason = "alias or thunk";
else if (!node->versionable)
reason = "not a tree_versionable_function";
@@ -646,7 +646,7 @@ determine_versionability (struct cgraph_node *node,
reason = "external function which calls va_arg_pack_len";
}
- if (reason && dump_file && !node->alias && !node->thunk.thunk_p)
+ if (reason && dump_file && !node->alias && !node->thunk)
fprintf (dump_file, "Function %s is not versionable, reason: %s.\n",
node->dump_name (), reason);
@@ -691,7 +691,7 @@ gather_caller_stats (struct cgraph_node *node, void *data)
struct cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
- if (!cs->caller->thunk.thunk_p)
+ if (!cs->caller->thunk)
{
if (cs->count.ipa ().initialized_p ())
stats->count_sum += cs->count.ipa ();
@@ -1155,7 +1155,7 @@ count_callers (cgraph_node *node, void *data)
for (cgraph_edge *cs = node->callers; cs; cs = cs->next_caller)
/* Local thunks can be handled transparently, but if the thunk cannot
be optimized out, count it as a real use. */
- if (!cs->caller->thunk.thunk_p || !cs->caller->local)
+ if (!cs->caller->thunk || !cs->caller->local)
++*caller_count;
return false;
}
@@ -1168,7 +1168,7 @@ set_single_call_flag (cgraph_node *node, void *)
{
cgraph_edge *cs = node->callers;
/* Local thunks can be handled transparently, skip them. */
- while (cs && cs->caller->thunk.thunk_p && cs->caller->local)
+ while (cs && cs->caller->thunk && cs->caller->local)
cs = cs->next_caller;
if (cs && IPA_NODE_REF (cs->caller))
{
@@ -1215,7 +1215,7 @@ initialize_node_lattices (struct cgraph_node *node)
}
if (dump_file && (dump_flags & TDF_DETAILS)
- && !node->alias && !node->thunk.thunk_p)
+ && !node->alias && !node->thunk)
{
fprintf (dump_file, "Initializing lattices of %s\n",
node->dump_name ());
@@ -1240,7 +1240,7 @@ initialize_node_lattices (struct cgraph_node *node)
node->clone.param_adjustments->get_surviving_params (&surviving_params);
if (dump_file && (dump_flags & TDF_DETAILS)
- && !node->alias && !node->thunk.thunk_p)
+ && !node->alias && !node->thunk)
{
bool first = true;
for (int j = 0; j < ipa_get_param_count (info); j++)
@@ -2806,12 +2806,12 @@ propagate_aggs_across_jump_function (struct cgraph_edge *cs,
non-thunk) destination, the call passes through a thunk. */
static bool
-call_passes_through_thunk_p (cgraph_edge *cs)
+call_passes_through_thunk (cgraph_edge *cs)
{
cgraph_node *alias_or_thunk = cs->callee;
while (alias_or_thunk->alias)
alias_or_thunk = alias_or_thunk->get_alias_target ();
- return alias_or_thunk->thunk.thunk_p;
+ return alias_or_thunk->thunk;
}
/* Propagate constants from the caller to the callee of CS. INFO describes the
@@ -2853,7 +2853,7 @@ propagate_constants_across_call (struct cgraph_edge *cs)
/* If this call goes through a thunk we must not propagate to the first (0th)
parameter. However, we might need to uncover a thunk from below a series
of aliases first. */
- if (call_passes_through_thunk_p (cs))
+ if (call_passes_through_thunk (cs))
{
ret |= set_all_contains_variable (ipa_get_parm_lattices (callee_info,
0));
@@ -3117,30 +3117,40 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
return target;
}
+/* If an indirect edge IE can be turned into a direct one based on data in
+ AVALS, return the destination. Store into *SPECULATIVE a boolean determinig
+ whether the discovered target is only speculative guess. */
-/* If an indirect edge IE can be turned into a direct one based on KNOWN_CSTS,
- KNOWN_CONTEXTS (which can be vNULL) or KNOWN_AGGS (which also can be vNULL)
- return the destination. */
+tree
+ipa_get_indirect_edge_target (struct cgraph_edge *ie,
+ ipa_call_arg_values *avals,
+ bool *speculative)
+{
+ return ipa_get_indirect_edge_target_1 (ie, avals->m_known_vals,
+ avals->m_known_contexts,
+ avals->m_known_aggs,
+ NULL, speculative);
+}
+
+/* The same functionality as above overloaded for ipa_auto_call_arg_values. */
tree
ipa_get_indirect_edge_target (struct cgraph_edge *ie,
- vec<tree> known_csts,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs,
+ ipa_auto_call_arg_values *avals,
bool *speculative)
{
- return ipa_get_indirect_edge_target_1 (ie, known_csts, known_contexts,
- known_aggs, NULL, speculative);
+ return ipa_get_indirect_edge_target_1 (ie, avals->m_known_vals,
+ avals->m_known_contexts,
+ avals->m_known_aggs,
+ NULL, speculative);
}
-/* Calculate devirtualization time bonus for NODE, assuming we know KNOWN_CSTS
- and KNOWN_CONTEXTS. */
+/* Calculate devirtualization time bonus for NODE, assuming we know information
+ about arguments stored in AVALS. */
static int
devirtualization_time_bonus (struct cgraph_node *node,
- vec<tree> known_csts,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs)
+ ipa_auto_call_arg_values *avals)
{
struct cgraph_edge *ie;
int res = 0;
@@ -3153,8 +3163,7 @@ devirtualization_time_bonus (struct cgraph_node *node,
tree target;
bool speculative;
- target = ipa_get_indirect_edge_target (ie, known_csts, known_contexts,
- known_aggs, &speculative);
+ target = ipa_get_indirect_edge_target (ie, avals, &speculative);
if (!target)
continue;
@@ -3187,14 +3196,24 @@ devirtualization_time_bonus (struct cgraph_node *node,
return res;
}
-/* Return time bonus incurred because of HINTS. */
+/* Return time bonus incurred because of hints stored in ESTIMATES. */
static int
-hint_time_bonus (cgraph_node *node, ipa_hints hints)
+hint_time_bonus (cgraph_node *node, const ipa_call_estimates &estimates)
{
int result = 0;
+ ipa_hints hints = estimates.hints;
if (hints & (INLINE_HINT_loop_iterations | INLINE_HINT_loop_stride))
result += opt_for_fn (node->decl, param_ipa_cp_loop_hint_bonus);
+
+ sreal bonus_for_one = opt_for_fn (node->decl, param_ipa_cp_loop_hint_bonus);
+
+ if (hints & INLINE_HINT_loop_iterations)
+ result += (estimates.loops_with_known_iterations * bonus_for_one).to_int ();
+
+ if (hints & INLINE_HINT_loop_stride)
+ result += (estimates.loops_with_known_strides * bonus_for_one).to_int ();
+
return result;
}
@@ -3306,32 +3325,27 @@ context_independent_aggregate_values (class ipcp_param_lattices *plats)
return res;
}
-/* Allocate KNOWN_CSTS, KNOWN_CONTEXTS and, if non-NULL, KNOWN_AGGS and
- populate them with values of parameters that are known independent of the
- context. INFO describes the function. If REMOVABLE_PARAMS_COST is
- non-NULL, the movement cost of all removable parameters will be stored in
- it. */
+/* Grow vectors in AVALS and fill them with information about values of
+ parameters that are known to be independent of the context. Only calculate
+ m_known_aggs if CALCULATE_AGGS is true. INFO describes the function. If
+ REMOVABLE_PARAMS_COST is non-NULL, the movement cost of all removable
+ parameters will be stored in it.
+
+ TODO: Also grow context independent value range vectors. */
static bool
gather_context_independent_values (class ipa_node_params *info,
- vec<tree> *known_csts,
- vec<ipa_polymorphic_call_context>
- *known_contexts,
- vec<ipa_agg_value_set> *known_aggs,
+ ipa_auto_call_arg_values *avals,
+ bool calculate_aggs,
int *removable_params_cost)
{
int i, count = ipa_get_param_count (info);
bool ret = false;
- known_csts->create (0);
- known_contexts->create (0);
- known_csts->safe_grow_cleared (count, true);
- known_contexts->safe_grow_cleared (count, true);
- if (known_aggs)
- {
- known_aggs->create (0);
- known_aggs->safe_grow_cleared (count, true);
- }
+ avals->m_known_vals.safe_grow_cleared (count, true);
+ avals->m_known_contexts.safe_grow_cleared (count, true);
+ if (calculate_aggs)
+ avals->m_known_aggs.safe_grow_cleared (count, true);
if (removable_params_cost)
*removable_params_cost = 0;
@@ -3345,7 +3359,7 @@ gather_context_independent_values (class ipa_node_params *info,
{
ipcp_value<tree> *val = lat->values;
gcc_checking_assert (TREE_CODE (val->value) != TREE_BINFO);
- (*known_csts)[i] = val->value;
+ avals->m_known_vals[i] = val->value;
if (removable_params_cost)
*removable_params_cost
+= estimate_move_cost (TREE_TYPE (val->value), false);
@@ -3363,15 +3377,15 @@ gather_context_independent_values (class ipa_node_params *info,
/* Do not account known context as reason for cloning. We can see
if it permits devirtualization. */
if (ctxlat->is_single_const ())
- (*known_contexts)[i] = ctxlat->values->value;
+ avals->m_known_contexts[i] = ctxlat->values->value;
- if (known_aggs)
+ if (calculate_aggs)
{
vec<ipa_agg_value> agg_items;
struct ipa_agg_value_set *agg;
agg_items = context_independent_aggregate_values (plats);
- agg = &(*known_aggs)[i];
+ agg = &avals->m_known_aggs[i];
agg->items = agg_items;
agg->by_ref = plats->aggs_by_ref;
ret |= !agg_items.is_empty ();
@@ -3381,29 +3395,25 @@ gather_context_independent_values (class ipa_node_params *info,
return ret;
}
-/* Perform time and size measurement of NODE with the context given in
- KNOWN_CSTS, KNOWN_CONTEXTS and KNOWN_AGGS, calculate the benefit and cost
- given BASE_TIME of the node without specialization, REMOVABLE_PARAMS_COST of
- all context-independent removable parameters and EST_MOVE_COST of estimated
- movement of the considered parameter and store it into VAL. */
+/* Perform time and size measurement of NODE with the context given in AVALS,
+ calculate the benefit compared to the node without specialization and store
+ it into VAL. Take into account REMOVABLE_PARAMS_COST of all
+ context-independent or unused removable parameters and EST_MOVE_COST, the
+ estimated movement of the considered parameter. */
static void
-perform_estimation_of_a_value (cgraph_node *node, vec<tree> known_csts,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs,
- int removable_params_cost,
- int est_move_cost, ipcp_value_base *val)
-{
- int size, time_benefit;
- sreal time, base_time;
- ipa_hints hints;
-
- estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
- known_aggs, &size, &time,
- &base_time, &hints);
- base_time -= time;
- if (base_time > 65535)
- base_time = 65535;
+perform_estimation_of_a_value (cgraph_node *node,
+ ipa_auto_call_arg_values *avals,
+ int removable_params_cost, int est_move_cost,
+ ipcp_value_base *val)
+{
+ int time_benefit;
+ ipa_call_estimates estimates;
+
+ estimate_ipcp_clone_size_and_time (node, avals, &estimates);
+ sreal time_delta = estimates.nonspecialized_time - estimates.time;
+ if (time_delta > 65535)
+ time_delta = 65535;
/* Extern inline functions have no cloning local time benefits because they
will be inlined anyway. The only reason to clone them is if it enables
@@ -3411,12 +3421,12 @@ perform_estimation_of_a_value (cgraph_node *node, vec<tree> known_csts,
if (DECL_EXTERNAL (node->decl) && DECL_DECLARED_INLINE_P (node->decl))
time_benefit = 0;
else
- time_benefit = base_time.to_int ()
- + devirtualization_time_bonus (node, known_csts, known_contexts,
- known_aggs)
- + hint_time_bonus (node, hints)
+ time_benefit = time_delta.to_int ()
+ + devirtualization_time_bonus (node, avals)
+ + hint_time_bonus (node, estimates)
+ removable_params_cost + est_move_cost;
+ int size = estimates.size;
gcc_checking_assert (size >=0);
/* The inliner-heuristics based estimates may think that in certain
contexts some functions do not have any size at all but we want
@@ -3438,7 +3448,7 @@ static long
get_max_overall_size (cgraph_node *node)
{
long max_new_size = orig_overall_size;
- long large_unit = opt_for_fn (node->decl, param_large_unit_insns);
+ long large_unit = opt_for_fn (node->decl, param_ipa_cp_large_unit_insns);
if (max_new_size < large_unit)
max_new_size = large_unit;
int unit_growth = opt_for_fn (node->decl, param_ipa_cp_unit_growth);
@@ -3454,9 +3464,6 @@ estimate_local_effects (struct cgraph_node *node)
{
class ipa_node_params *info = IPA_NODE_REF (node);
int i, count = ipa_get_param_count (info);
- vec<tree> known_csts;
- vec<ipa_polymorphic_call_context> known_contexts;
- vec<ipa_agg_value_set> known_aggs;
bool always_const;
int removable_params_cost;
@@ -3466,33 +3473,29 @@ estimate_local_effects (struct cgraph_node *node)
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nEstimating effects for %s.\n", node->dump_name ());
- always_const = gather_context_independent_values (info, &known_csts,
- &known_contexts, &known_aggs,
+ ipa_auto_call_arg_values avals;
+ always_const = gather_context_independent_values (info, &avals, true,
&removable_params_cost);
- int devirt_bonus = devirtualization_time_bonus (node, known_csts,
- known_contexts, known_aggs);
+ int devirt_bonus = devirtualization_time_bonus (node, &avals);
if (always_const || devirt_bonus
|| (removable_params_cost && node->can_change_signature))
{
struct caller_statistics stats;
- ipa_hints hints;
- sreal time, base_time;
- int size;
+ ipa_call_estimates estimates;
init_caller_stats (&stats);
node->call_for_symbol_thunks_and_aliases (gather_caller_stats, &stats,
false);
- estimate_ipcp_clone_size_and_time (node, known_csts, known_contexts,
- known_aggs, &size, &time,
- &base_time, &hints);
- time -= devirt_bonus;
- time -= hint_time_bonus (node, hints);
- time -= removable_params_cost;
- size -= stats.n_calls * removable_params_cost;
+ estimate_ipcp_clone_size_and_time (node, &avals, &estimates);
+ sreal time = estimates.nonspecialized_time - estimates.time;
+ time += devirt_bonus;
+ time += hint_time_bonus (node, estimates);
+ time += removable_params_cost;
+ int size = estimates.size - stats.n_calls * removable_params_cost;
if (dump_file)
fprintf (dump_file, " - context independent values, size: %i, "
- "time_benefit: %f\n", size, (base_time - time).to_double ());
+ "time_benefit: %f\n", size, (time).to_double ());
if (size <= 0 || node->local)
{
@@ -3503,8 +3506,7 @@ estimate_local_effects (struct cgraph_node *node)
"known contexts, code not going to grow.\n");
}
else if (good_cloning_opportunity_p (node,
- MIN ((base_time - time).to_int (),
- 65536),
+ MIN ((time).to_int (), 65536),
stats.freq_sum, stats.count_sum,
size))
{
@@ -3515,7 +3517,8 @@ estimate_local_effects (struct cgraph_node *node)
if (dump_file)
fprintf (dump_file, " Decided to specialize for all "
- "known contexts, growth deemed beneficial.\n");
+ "known contexts, growth (to %li) deemed "
+ "beneficial.\n", overall_size);
}
else if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Not cloning for all contexts because "
@@ -3536,18 +3539,17 @@ estimate_local_effects (struct cgraph_node *node)
if (lat->bottom
|| !lat->values
- || known_csts[i])
+ || avals.m_known_vals[i])
continue;
for (val = lat->values; val; val = val->next)
{
gcc_checking_assert (TREE_CODE (val->value) != TREE_BINFO);
- known_csts[i] = val->value;
+ avals.m_known_vals[i] = val->value;
int emc = estimate_move_cost (TREE_TYPE (val->value), true);
- perform_estimation_of_a_value (node, known_csts, known_contexts,
- known_aggs,
- removable_params_cost, emc, val);
+ perform_estimation_of_a_value (node, &avals, removable_params_cost,
+ emc, val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -3559,7 +3561,7 @@ estimate_local_effects (struct cgraph_node *node)
val->local_time_benefit, val->local_size_cost);
}
}
- known_csts[i] = NULL_TREE;
+ avals.m_known_vals[i] = NULL_TREE;
}
for (i = 0; i < count; i++)
@@ -3574,15 +3576,14 @@ estimate_local_effects (struct cgraph_node *node)
if (ctxlat->bottom
|| !ctxlat->values
- || !known_contexts[i].useless_p ())
+ || !avals.m_known_contexts[i].useless_p ())
continue;
for (val = ctxlat->values; val; val = val->next)
{
- known_contexts[i] = val->value;
- perform_estimation_of_a_value (node, known_csts, known_contexts,
- known_aggs,
- removable_params_cost, 0, val);
+ avals.m_known_contexts[i] = val->value;
+ perform_estimation_of_a_value (node, &avals, removable_params_cost,
+ 0, val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -3594,20 +3595,18 @@ estimate_local_effects (struct cgraph_node *node)
val->local_time_benefit, val->local_size_cost);
}
}
- known_contexts[i] = ipa_polymorphic_call_context ();
+ avals.m_known_contexts[i] = ipa_polymorphic_call_context ();
}
for (i = 0; i < count; i++)
{
class ipcp_param_lattices *plats = ipa_get_parm_lattices (info, i);
- struct ipa_agg_value_set *agg;
- struct ipcp_agg_lattice *aglat;
if (plats->aggs_bottom || !plats->aggs)
continue;
- agg = &known_aggs[i];
- for (aglat = plats->aggs; aglat; aglat = aglat->next)
+ ipa_agg_value_set *agg = &avals.m_known_aggs[i];
+ for (ipcp_agg_lattice *aglat = plats->aggs; aglat; aglat = aglat->next)
{
ipcp_value<tree> *val;
if (aglat->bottom || !aglat->values
@@ -3624,8 +3623,7 @@ estimate_local_effects (struct cgraph_node *node)
item.value = val->value;
agg->items.safe_push (item);
- perform_estimation_of_a_value (node, known_csts, known_contexts,
- known_aggs,
+ perform_estimation_of_a_value (node, &avals,
removable_params_cost, 0, val);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -3645,10 +3643,6 @@ estimate_local_effects (struct cgraph_node *node)
}
}
}
-
- known_csts.release ();
- known_contexts.release ();
- ipa_release_agg_values (known_aggs);
}
@@ -4704,7 +4698,7 @@ find_more_scalar_values_for_callers_subset (struct cgraph_node *node,
if (!IPA_EDGE_REF (cs)
|| i >= ipa_get_cs_argument_count (IPA_EDGE_REF (cs))
|| (i == 0
- && call_passes_through_thunk_p (cs)))
+ && call_passes_through_thunk (cs)))
{
newval = NULL_TREE;
break;
@@ -5372,31 +5366,34 @@ copy_useful_known_contexts (vec<ipa_polymorphic_call_context> known_contexts)
return vNULL;
}
-/* Copy KNOWN_CSTS and modify the copy according to VAL and INDEX. If
- non-empty, replace KNOWN_CONTEXTS with its copy too. */
+/* Copy known scalar values from AVALS into KNOWN_CSTS and modify the copy
+ according to VAL and INDEX. If non-empty, replace KNOWN_CONTEXTS with its
+ copy too. */
static void
-modify_known_vectors_with_val (vec<tree> *known_csts,
- vec<ipa_polymorphic_call_context> *known_contexts,
- ipcp_value<tree> *val,
- int index)
+copy_known_vectors_add_val (ipa_auto_call_arg_values *avals,
+ vec<tree> *known_csts,
+ vec<ipa_polymorphic_call_context> *known_contexts,
+ ipcp_value<tree> *val, int index)
{
- *known_csts = known_csts->copy ();
- *known_contexts = copy_useful_known_contexts (*known_contexts);
+ *known_csts = avals->m_known_vals.copy ();
+ *known_contexts = copy_useful_known_contexts (avals->m_known_contexts);
(*known_csts)[index] = val->value;
}
-/* Replace KNOWN_CSTS with its copy. Also copy KNOWN_CONTEXTS and modify the
- copy according to VAL and INDEX. */
+/* Copy known scalar values from AVALS into KNOWN_CSTS. Similarly, copy
+ contexts to KNOWN_CONTEXTS and modify the copy according to VAL and
+ INDEX. */
static void
-modify_known_vectors_with_val (vec<tree> *known_csts,
- vec<ipa_polymorphic_call_context> *known_contexts,
- ipcp_value<ipa_polymorphic_call_context> *val,
- int index)
-{
- *known_csts = known_csts->copy ();
- *known_contexts = known_contexts->copy ();
+copy_known_vectors_add_val (ipa_auto_call_arg_values *avals,
+ vec<tree> *known_csts,
+ vec<ipa_polymorphic_call_context> *known_contexts,
+ ipcp_value<ipa_polymorphic_call_context> *val,
+ int index)
+{
+ *known_csts = avals->m_known_vals.copy ();
+ *known_contexts = avals->m_known_contexts.copy ();
(*known_contexts)[index] = val->value;
}
@@ -5433,16 +5430,15 @@ ipcp_val_agg_replacement_ok_p (ipa_agg_replacement_value *,
return offset == -1;
}
-/* Decide whether to create a special version of NODE for value VAL of parameter
- at the given INDEX. If OFFSET is -1, the value is for the parameter itself,
- otherwise it is stored at the given OFFSET of the parameter. KNOWN_CSTS,
- KNOWN_CONTEXTS and KNOWN_AGGS describe the other already known values. */
+/* Decide whether to create a special version of NODE for value VAL of
+ parameter at the given INDEX. If OFFSET is -1, the value is for the
+ parameter itself, otherwise it is stored at the given OFFSET of the
+ parameter. AVALS describes the other already known values. */
template <typename valtype>
static bool
decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
- ipcp_value<valtype> *val, vec<tree> known_csts,
- vec<ipa_polymorphic_call_context> known_contexts)
+ ipcp_value<valtype> *val, ipa_auto_call_arg_values *avals)
{
struct ipa_agg_replacement_value *aggvals;
int freq_sum, caller_count;
@@ -5492,13 +5488,16 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
fprintf (dump_file, " Creating a specialized node of %s.\n",
node->dump_name ());
+ vec<tree> known_csts;
+ vec<ipa_polymorphic_call_context> known_contexts;
+
callers = gather_edges_for_value (val, node, caller_count);
if (offset == -1)
- modify_known_vectors_with_val (&known_csts, &known_contexts, val, index);
+ copy_known_vectors_add_val (avals, &known_csts, &known_contexts, val, index);
else
{
- known_csts = known_csts.copy ();
- known_contexts = copy_useful_known_contexts (known_contexts);
+ known_csts = avals->m_known_vals.copy ();
+ known_contexts = copy_useful_known_contexts (avals->m_known_contexts);
}
find_more_scalar_values_for_callers_subset (node, known_csts, callers);
find_more_contexts_for_caller_subset (node, &known_contexts, callers);
@@ -5508,6 +5507,9 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
val->spec_node = create_specialized_node (node, known_csts, known_contexts,
aggvals, callers);
overall_size += val->local_size_cost;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " overall size reached %li\n",
+ overall_size);
/* TODO: If for some lattice there is only one other known value
left, make a special node for it too. */
@@ -5522,8 +5524,6 @@ decide_whether_version_node (struct cgraph_node *node)
{
class ipa_node_params *info = IPA_NODE_REF (node);
int i, count = ipa_get_param_count (info);
- vec<tree> known_csts;
- vec<ipa_polymorphic_call_context> known_contexts;
bool ret = false;
if (count == 0)
@@ -5533,8 +5533,8 @@ decide_whether_version_node (struct cgraph_node *node)
fprintf (dump_file, "\nEvaluating opportunities for %s.\n",
node->dump_name ());
- gather_context_independent_values (info, &known_csts, &known_contexts,
- NULL, NULL);
+ ipa_auto_call_arg_values avals;
+ gather_context_independent_values (info, &avals, false, NULL);
for (i = 0; i < count;i++)
{
@@ -5543,12 +5543,11 @@ decide_whether_version_node (struct cgraph_node *node)
ipcp_lattice<ipa_polymorphic_call_context> *ctxlat = &plats->ctxlat;
if (!lat->bottom
- && !known_csts[i])
+ && !avals.m_known_vals[i])
{
ipcp_value<tree> *val;
for (val = lat->values; val; val = val->next)
- ret |= decide_about_value (node, i, -1, val, known_csts,
- known_contexts);
+ ret |= decide_about_value (node, i, -1, val, &avals);
}
if (!plats->aggs_bottom)
@@ -5557,22 +5556,20 @@ decide_whether_version_node (struct cgraph_node *node)
ipcp_value<tree> *val;
for (aglat = plats->aggs; aglat; aglat = aglat->next)
if (!aglat->bottom && aglat->values
- /* If the following is false, the one value is in
- known_aggs. */
+ /* If the following is false, the one value has been considered
+ for cloning for all contexts. */
&& (plats->aggs_contain_variable
|| !aglat->is_single_const ()))
for (val = aglat->values; val; val = val->next)
- ret |= decide_about_value (node, i, aglat->offset, val,
- known_csts, known_contexts);
+ ret |= decide_about_value (node, i, aglat->offset, val, &avals);
}
if (!ctxlat->bottom
- && known_contexts[i].useless_p ())
+ && avals.m_known_contexts[i].useless_p ())
{
ipcp_value<ipa_polymorphic_call_context> *val;
for (val = ctxlat->values; val; val = val->next)
- ret |= decide_about_value (node, i, -1, val, known_csts,
- known_contexts);
+ ret |= decide_about_value (node, i, -1, val, &avals);
}
info = IPA_NODE_REF (node);
@@ -5595,11 +5592,9 @@ decide_whether_version_node (struct cgraph_node *node)
if (!adjust_callers_for_value_intersection (callers, node))
{
/* If node is not called by anyone, or all its caller edges are
- self-recursive, the node is not really be in use, no need to
- do cloning. */
+ self-recursive, the node is not really in use, no need to do
+ cloning. */
callers.release ();
- known_csts.release ();
- known_contexts.release ();
info->do_clone_for_all_contexts = false;
return ret;
}
@@ -5608,6 +5603,9 @@ decide_whether_version_node (struct cgraph_node *node)
fprintf (dump_file, " - Creating a specialized node of %s "
"for all known contexts.\n", node->dump_name ());
+ vec<tree> known_csts = avals.m_known_vals.copy ();
+ vec<ipa_polymorphic_call_context> known_contexts
+ = copy_useful_known_contexts (avals.m_known_contexts);
find_more_scalar_values_for_callers_subset (node, known_csts, callers);
find_more_contexts_for_caller_subset (node, &known_contexts, callers);
ipa_agg_replacement_value *aggvals
@@ -5625,11 +5623,6 @@ decide_whether_version_node (struct cgraph_node *node)
IPA_NODE_REF (clone)->is_all_contexts_clone = true;
ret = true;
}
- else
- {
- known_csts.release ();
- known_contexts.release ();
- }
return ret;
}
@@ -5668,7 +5661,7 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node *node,
struct cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
- if (cs->caller->thunk.thunk_p
+ if (cs->caller->thunk
&& cs->caller->call_for_symbol_thunks_and_aliases
(has_undead_caller_from_outside_scc_p, NULL, true))
return true;
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 86d01ad..f27c5f0 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -141,6 +141,11 @@ ipa_dump_hints (FILE *f, ipa_hints hints)
hints &= ~INLINE_HINT_known_hot;
fprintf (f, " known_hot");
}
+ if (hints & INLINE_HINT_builtin_constant_p)
+ {
+ hints &= ~INLINE_HINT_builtin_constant_p;
+ fprintf (f, " builtin_constant_p");
+ }
gcc_assert (!hints);
}
@@ -310,6 +315,36 @@ set_hint_predicate (predicate **p, predicate new_predicate)
}
}
+/* Find if NEW_PREDICATE is already in V and if so, increment its freq.
+ Otherwise add a new item to the vector with this predicate and frerq equal
+ to add_freq, unless the number of predicates would exceed MAX_NUM_PREDICATES
+ in which case the function does nothing. */
+
+static void
+add_freqcounting_predicate (vec<ipa_freqcounting_predicate, va_gc> **v,
+ const predicate &new_predicate, sreal add_freq,
+ unsigned max_num_predicates)
+{
+ if (new_predicate == false || new_predicate == true)
+ return;
+ ipa_freqcounting_predicate *f;
+ for (int i = 0; vec_safe_iterate (*v, i, &f); i++)
+ if (new_predicate == f->predicate)
+ {
+ f->freq += add_freq;
+ return;
+ }
+ if (vec_safe_length (*v) >= max_num_predicates)
+ /* Too many different predicates to account for. */
+ return;
+
+ ipa_freqcounting_predicate fcp;
+ fcp.predicate = NULL;
+ set_hint_predicate (&fcp.predicate, new_predicate);
+ fcp.freq = add_freq;
+ vec_safe_push (*v, fcp);
+ return;
+}
/* Compute what conditions may or may not hold given information about
parameters. RET_CLAUSE returns truths that may hold in a specialized copy,
@@ -320,19 +355,18 @@ set_hint_predicate (predicate **p, predicate new_predicate)
is always false in the second and also builtin_constant_p tests cannot use
the fact that parameter is indeed a constant.
- KNOWN_VALS is partial mapping of parameters of NODE to constant values.
- KNOWN_AGGS is a vector of aggregate known offset/value set for each
- parameter. Return clause of possible truths. When INLINE_P is true, assume
- that we are inlining.
+ When INLINE_P is true, assume that we are inlining. AVAL contains known
+ information about argument values. The function does not modify its content
+ and so AVALs could also be of type ipa_call_arg_values but so far all
+ callers work with the auto version and so we avoid the conversion for
+ convenience.
- ERROR_MARK means compile time invariant. */
+ ERROR_MARK value of an argument means compile time invariant. */
static void
evaluate_conditions_for_known_args (struct cgraph_node *node,
bool inline_p,
- vec<tree> known_vals,
- vec<value_range> known_value_ranges,
- vec<ipa_agg_value_set> known_aggs,
+ ipa_auto_call_arg_values *avals,
clause_t *ret_clause,
clause_t *ret_nonspec_clause)
{
@@ -351,38 +385,33 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
/* We allow call stmt to have fewer arguments than the callee function
(especially for K&R style programs). So bound check here (we assume
- known_aggs vector, if non-NULL, has the same length as
- known_vals). */
- gcc_checking_assert (!known_aggs.length () || !known_vals.length ()
- || (known_vals.length () == known_aggs.length ()));
+ m_known_aggs vector is either empty or has the same length as
+ m_known_vals). */
+ gcc_checking_assert (!avals->m_known_aggs.length ()
+ || !avals->m_known_vals.length ()
+ || (avals->m_known_vals.length ()
+ == avals->m_known_aggs.length ()));
if (c->agg_contents)
{
- struct ipa_agg_value_set *agg;
-
if (c->code == predicate::changed
&& !c->by_ref
- && c->operand_num < (int)known_vals.length ()
- && (known_vals[c->operand_num] == error_mark_node))
+ && (avals->safe_sval_at(c->operand_num) == error_mark_node))
continue;
- if (c->operand_num < (int)known_aggs.length ())
+ if (ipa_agg_value_set *agg = avals->safe_aggval_at (c->operand_num))
{
- agg = &known_aggs[c->operand_num];
- val = ipa_find_agg_cst_for_param (agg,
- c->operand_num
- < (int) known_vals.length ()
- ? known_vals[c->operand_num]
- : NULL,
- c->offset, c->by_ref);
+ tree sval = avals->safe_sval_at (c->operand_num);
+ val = ipa_find_agg_cst_for_param (agg, sval, c->offset,
+ c->by_ref);
}
else
val = NULL_TREE;
}
- else if (c->operand_num < (int) known_vals.length ())
+ else
{
- val = known_vals[c->operand_num];
- if (val == error_mark_node && c->code != predicate::changed)
+ val = avals->safe_sval_at (c->operand_num);
+ if (val && val == error_mark_node && c->code != predicate::changed)
val = NULL_TREE;
}
@@ -446,53 +475,54 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
continue;
}
}
- if (c->operand_num < (int) known_value_ranges.length ()
+ if (c->operand_num < (int) avals->m_known_value_ranges.length ()
&& !c->agg_contents
- && !known_value_ranges[c->operand_num].undefined_p ()
- && !known_value_ranges[c->operand_num].varying_p ()
- && TYPE_SIZE (c->type)
- == TYPE_SIZE (known_value_ranges[c->operand_num].type ())
&& (!val || TREE_CODE (val) != INTEGER_CST))
{
- value_range vr = known_value_ranges[c->operand_num];
- if (!useless_type_conversion_p (c->type, vr.type ()))
+ value_range vr = avals->m_known_value_ranges[c->operand_num];
+ if (!vr.undefined_p ()
+ && !vr.varying_p ()
+ && (TYPE_SIZE (c->type) == TYPE_SIZE (vr.type ())))
{
- value_range res;
- range_fold_unary_expr (&res, NOP_EXPR,
+ if (!useless_type_conversion_p (c->type, vr.type ()))
+ {
+ value_range res;
+ range_fold_unary_expr (&res, NOP_EXPR,
c->type, &vr, vr.type ());
- vr = res;
- }
- tree type = c->type;
+ vr = res;
+ }
+ tree type = c->type;
- for (j = 0; vec_safe_iterate (c->param_ops, j, &op); j++)
- {
- if (vr.varying_p () || vr.undefined_p ())
- break;
+ for (j = 0; vec_safe_iterate (c->param_ops, j, &op); j++)
+ {
+ if (vr.varying_p () || vr.undefined_p ())
+ break;
- value_range res;
- if (!op->val[0])
- range_fold_unary_expr (&res, op->code, op->type, &vr, type);
- else if (!op->val[1])
+ value_range res;
+ if (!op->val[0])
+ range_fold_unary_expr (&res, op->code, op->type, &vr, type);
+ else if (!op->val[1])
+ {
+ value_range op0 (op->val[0], op->val[0]);
+ range_fold_binary_expr (&res, op->code, op->type,
+ op->index ? &op0 : &vr,
+ op->index ? &vr : &op0);
+ }
+ else
+ gcc_unreachable ();
+ type = op->type;
+ vr = res;
+ }
+ if (!vr.varying_p () && !vr.undefined_p ())
{
- value_range op0 (op->val[0], op->val[0]);
- range_fold_binary_expr (&res, op->code, op->type,
- op->index ? &op0 : &vr,
- op->index ? &vr : &op0);
+ value_range res;
+ value_range val_vr (c->val, c->val);
+ range_fold_binary_expr (&res, c->code, boolean_type_node,
+ &vr,
+ &val_vr);
+ if (res.zero_p ())
+ continue;
}
- else
- gcc_unreachable ();
- type = op->type;
- vr = res;
- }
- if (!vr.varying_p () && !vr.undefined_p ())
- {
- value_range res;
- value_range val_vr (c->val, c->val);
- range_fold_binary_expr (&res, c->code, boolean_type_node,
- &vr,
- &val_vr);
- if (res.zero_p ())
- continue;
}
}
@@ -538,24 +568,20 @@ fre_will_run_p (struct cgraph_node *node)
(if non-NULL) conditions evaluated for nonspecialized clone called
in a given context.
- KNOWN_VALS_PTR and KNOWN_AGGS_PTR must be non-NULL and will be filled by
- known constant and aggregate values of parameters.
-
- KNOWN_CONTEXT_PTR, if non-NULL, will be filled by polymorphic call contexts
- of parameter used by a polymorphic call. */
+ Vectors in AVALS will be populated with useful known information about
+ argument values - information not known to have any uses will be omitted -
+ except for m_known_contexts which will only be calculated if
+ COMPUTE_CONTEXTS is true. */
void
evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
clause_t *clause_ptr,
clause_t *nonspec_clause_ptr,
- vec<tree> *known_vals_ptr,
- vec<ipa_polymorphic_call_context>
- *known_contexts_ptr,
- vec<ipa_agg_value_set> *known_aggs_ptr)
+ ipa_auto_call_arg_values *avals,
+ bool compute_contexts)
{
struct cgraph_node *callee = e->callee->ultimate_alias_target ();
class ipa_fn_summary *info = ipa_fn_summaries->get (callee);
- auto_vec<value_range, 32> known_value_ranges;
class ipa_edge_args *args;
if (clause_ptr)
@@ -563,7 +589,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
if (ipa_node_params_sum
&& !e->call_stmt_cannot_inline_p
- && (info->conds || known_contexts_ptr)
+ && (info->conds || compute_contexts)
&& (args = IPA_EDGE_REF (e)) != NULL)
{
struct cgraph_node *caller;
@@ -608,15 +634,15 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
if (cst)
{
gcc_checking_assert (TREE_CODE (cst) != TREE_BINFO);
- if (!known_vals_ptr->length ())
- vec_safe_grow_cleared (known_vals_ptr, count, true);
- (*known_vals_ptr)[i] = cst;
+ if (!avals->m_known_vals.length ())
+ avals->m_known_vals.safe_grow_cleared (count, true);
+ avals->m_known_vals[i] = cst;
}
else if (inline_p && !es->param[i].change_prob)
{
- if (!known_vals_ptr->length ())
- vec_safe_grow_cleared (known_vals_ptr, count, true);
- (*known_vals_ptr)[i] = error_mark_node;
+ if (!avals->m_known_vals.length ())
+ avals->m_known_vals.safe_grow_cleared (count, true);
+ avals->m_known_vals[i] = error_mark_node;
}
/* If we failed to get simple constant, try value range. */
@@ -624,19 +650,20 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
&& vrp_will_run_p (caller)
&& ipa_is_param_used_by_ipa_predicates (callee_pi, i))
{
- value_range vr
+ value_range vr
= ipa_value_range_from_jfunc (caller_parms_info, e, jf,
ipa_get_type (callee_pi,
i));
if (!vr.undefined_p () && !vr.varying_p ())
{
- if (!known_value_ranges.length ())
+ if (!avals->m_known_value_ranges.length ())
{
- known_value_ranges.safe_grow (count, true);
+ avals->m_known_value_ranges.safe_grow (count, true);
for (int i = 0; i < count; ++i)
- new (&known_value_ranges[i]) value_range ();
+ new (&avals->m_known_value_ranges[i])
+ value_range ();
}
- known_value_ranges[i] = vr;
+ avals->m_known_value_ranges[i] = vr;
}
}
@@ -648,31 +675,31 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
caller, &jf->agg);
if (agg.items.length ())
{
- if (!known_aggs_ptr->length ())
- vec_safe_grow_cleared (known_aggs_ptr, count, true);
- (*known_aggs_ptr)[i] = agg;
+ if (!avals->m_known_aggs.length ())
+ avals->m_known_aggs.safe_grow_cleared (count, true);
+ avals->m_known_aggs[i] = agg;
}
}
}
/* For calls used in polymorphic calls we further determine
polymorphic call context. */
- if (known_contexts_ptr
+ if (compute_contexts
&& ipa_is_param_used_by_polymorphic_call (callee_pi, i))
{
ipa_polymorphic_call_context
ctx = ipa_context_from_jfunc (caller_parms_info, e, i, jf);
if (!ctx.useless_p ())
{
- if (!known_contexts_ptr->length ())
- known_contexts_ptr->safe_grow_cleared (count, true);
- (*known_contexts_ptr)[i]
+ if (!avals->m_known_contexts.length ())
+ avals->m_known_contexts.safe_grow_cleared (count, true);
+ avals->m_known_contexts[i]
= ipa_context_from_jfunc (caller_parms_info, e, i, jf);
}
}
}
else
- gcc_assert (!count || callee->thunk.thunk_p);
+ gcc_assert (!count || callee->thunk);
}
else if (e->call_stmt && !e->call_stmt_cannot_inline_p && info->conds)
{
@@ -685,18 +712,14 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
cst = NULL;
if (cst)
{
- if (!known_vals_ptr->length ())
- vec_safe_grow_cleared (known_vals_ptr, count, true);
- (*known_vals_ptr)[i] = cst;
+ if (!avals->m_known_vals.length ())
+ avals->m_known_vals.safe_grow_cleared (count, true);
+ avals->m_known_vals[i] = cst;
}
}
}
- evaluate_conditions_for_known_args (callee, inline_p,
- *known_vals_ptr,
- known_value_ranges,
- *known_aggs_ptr,
- clause_ptr,
+ evaluate_conditions_for_known_args (callee, inline_p, avals, clause_ptr,
nonspec_clause_ptr);
}
@@ -722,13 +745,18 @@ ipa_call_summary::~ipa_call_summary ()
ipa_fn_summary::~ipa_fn_summary ()
{
- if (loop_iterations)
- edge_predicate_pool.remove (loop_iterations);
- if (loop_stride)
- edge_predicate_pool.remove (loop_stride);
+ unsigned len = vec_safe_length (loop_iterations);
+ for (unsigned i = 0; i < len; i++)
+ edge_predicate_pool.remove ((*loop_iterations)[i].predicate);
+ len = vec_safe_length (loop_strides);
+ for (unsigned i = 0; i < len; i++)
+ edge_predicate_pool.remove ((*loop_strides)[i].predicate);
vec_free (conds);
vec_free (size_time_table);
vec_free (call_size_time_table);
+ vec_free (loop_iterations);
+ vec_free (loop_strides);
+ builtin_constant_p_parms.release ();
}
void
@@ -741,24 +769,33 @@ ipa_fn_summary_t::remove_callees (cgraph_node *node)
ipa_call_summaries->remove (e);
}
-/* Same as remap_predicate_after_duplication but handle hint predicate *P.
- Additionally care about allocating new memory slot for updated predicate
- and set it to NULL when it becomes true or false (and thus uninteresting).
- */
+/* Duplicate predicates in loop hint vector, allocating memory for them and
+ remove and deallocate any uninteresting (true or false) ones. Return the
+ result. */
-static void
-remap_hint_predicate_after_duplication (predicate **p,
- clause_t possible_truths)
+static vec<ipa_freqcounting_predicate, va_gc> *
+remap_freqcounting_preds_after_dup (vec<ipa_freqcounting_predicate, va_gc> *v,
+ clause_t possible_truths)
{
- predicate new_predicate;
+ if (vec_safe_length (v) == 0)
+ return NULL;
- if (!*p)
- return;
+ vec<ipa_freqcounting_predicate, va_gc> *res = v->copy ();
+ int len = res->length();
+ for (int i = len - 1; i >= 0; i--)
+ {
+ predicate new_predicate
+ = (*res)[i].predicate->remap_after_duplication (possible_truths);
+ /* We do not want to free previous predicate; it is used by node
+ origin. */
+ (*res)[i].predicate = NULL;
+ set_hint_predicate (&(*res)[i].predicate, new_predicate);
+
+ if (!(*res)[i].predicate)
+ res->unordered_remove (i);
+ }
- new_predicate = (*p)->remap_after_duplication (possible_truths);
- /* We do not want to free previous predicate; it is used by node origin. */
- *p = NULL;
- set_hint_predicate (p, new_predicate);
+ return res;
}
@@ -781,7 +818,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
vec<size_time_entry, va_gc> *entry = info->size_time_table;
/* Use SRC parm info since it may not be copied yet. */
class ipa_node_params *parms_info = IPA_NODE_REF (src);
- vec<tree> known_vals = vNULL;
+ ipa_auto_call_arg_values avals;
int count = ipa_get_param_count (parms_info);
int i, j;
clause_t possible_truths;
@@ -792,7 +829,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
struct cgraph_edge *edge, *next;
info->size_time_table = 0;
- known_vals.safe_grow_cleared (count, true);
+ avals.m_known_vals.safe_grow_cleared (count, true);
for (i = 0; i < count; i++)
{
struct ipa_replace_map *r;
@@ -801,20 +838,17 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
{
if (r->parm_num == i)
{
- known_vals[i] = r->new_tree;
+ avals.m_known_vals[i] = r->new_tree;
break;
}
}
}
evaluate_conditions_for_known_args (dst, false,
- known_vals,
- vNULL,
- vNULL,
+ &avals,
&possible_truths,
/* We are going to specialize,
so ignore nonspec truths. */
NULL);
- known_vals.release ();
info->account_size_time (0, 0, true_pred, true_pred);
@@ -871,13 +905,25 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
new_predicate = es->predicate->remap_after_duplication
(possible_truths);
if (new_predicate == false && *es->predicate != false)
- optimized_out_size += es->call_stmt_size * ipa_fn_summary::size_scale;
+ optimized_out_size
+ += es->call_stmt_size * ipa_fn_summary::size_scale;
edge_set_predicate (edge, &new_predicate);
}
- remap_hint_predicate_after_duplication (&info->loop_iterations,
+ info->loop_iterations
+ = remap_freqcounting_preds_after_dup (info->loop_iterations,
possible_truths);
- remap_hint_predicate_after_duplication (&info->loop_stride,
+ info->loop_strides
+ = remap_freqcounting_preds_after_dup (info->loop_strides,
possible_truths);
+ if (info->builtin_constant_p_parms.length())
+ {
+ vec <int, va_heap, vl_ptr> parms = info->builtin_constant_p_parms;
+ int ip;
+ info->builtin_constant_p_parms = vNULL;
+ for (i = 0; parms.iterate (i, &ip); i++)
+ if (!avals.m_known_vals[ip])
+ info->builtin_constant_p_parms.safe_push (ip);
+ }
/* If inliner or someone after inliner will ever start producing
non-trivial clones, we will get trouble with lack of information
@@ -888,17 +934,24 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
else
{
info->size_time_table = vec_safe_copy (info->size_time_table);
- if (info->loop_iterations)
+ info->loop_iterations = vec_safe_copy (info->loop_iterations);
+ info->loop_strides = vec_safe_copy (info->loop_strides);
+
+ info->builtin_constant_p_parms
+ = info->builtin_constant_p_parms.copy ();
+
+ ipa_freqcounting_predicate *f;
+ for (int i = 0; vec_safe_iterate (info->loop_iterations, i, &f); i++)
{
- predicate p = *info->loop_iterations;
- info->loop_iterations = NULL;
- set_hint_predicate (&info->loop_iterations, p);
+ predicate p = *f->predicate;
+ f->predicate = NULL;
+ set_hint_predicate (&f->predicate, p);
}
- if (info->loop_stride)
+ for (int i = 0; vec_safe_iterate (info->loop_strides, i, &f); i++)
{
- predicate p = *info->loop_stride;
- info->loop_stride = NULL;
- set_hint_predicate (&info->loop_stride, p);
+ predicate p = *f->predicate;
+ f->predicate = NULL;
+ set_hint_predicate (&f->predicate, p);
}
}
if (!dst->inlined_to)
@@ -980,6 +1033,9 @@ dump_ipa_call_summary (FILE *f, int indent, struct cgraph_node *node,
else if (prob != REG_BR_PROB_BASE)
fprintf (f, "%*s op%i change %f%% of time\n", indent + 2, "", i,
prob * 100.0 / REG_BR_PROB_BASE);
+ if (es->param[i].points_to_local_or_readonly_memory)
+ fprintf (f, "%*s op%i points to local or readonly memory\n",
+ indent + 2, "", i);
}
if (!edge->inline_failed)
{
@@ -1029,6 +1085,13 @@ ipa_dump_fn_summary (FILE *f, struct cgraph_node *node)
fprintf (f, " inlinable");
if (s->fp_expressions)
fprintf (f, " fp_expression");
+ if (s->builtin_constant_p_parms.length ())
+ {
+ fprintf (f, " builtin_constant_p_parms");
+ for (unsigned int i = 0;
+ i < s->builtin_constant_p_parms.length (); i++)
+ fprintf (f, " %i", s->builtin_constant_p_parms[i]);
+ }
fprintf (f, "\n global time: %f\n", s->time.to_double ());
fprintf (f, " self size: %i\n", ss->self_size);
fprintf (f, " global size: %i\n", ss->size);
@@ -1057,15 +1120,28 @@ ipa_dump_fn_summary (FILE *f, struct cgraph_node *node)
}
fprintf (f, "\n");
}
- if (s->loop_iterations)
+ ipa_freqcounting_predicate *fcp;
+ bool first_fcp = true;
+ for (int i = 0; vec_safe_iterate (s->loop_iterations, i, &fcp); i++)
{
- fprintf (f, " loop iterations:");
- s->loop_iterations->dump (f, s->conds);
+ if (first_fcp)
+ {
+ fprintf (f, " loop iterations:");
+ first_fcp = false;
+ }
+ fprintf (f, " %3.2f for ", fcp->freq.to_double ());
+ fcp->predicate->dump (f, s->conds);
}
- if (s->loop_stride)
+ first_fcp = true;
+ for (int i = 0; vec_safe_iterate (s->loop_strides, i, &fcp); i++)
{
- fprintf (f, " loop stride:");
- s->loop_stride->dump (f, s->conds);
+ if (first_fcp)
+ {
+ fprintf (f, " loop strides:");
+ first_fcp = false;
+ }
+ fprintf (f, " %3.2f for :", fcp->freq.to_double ());
+ fcp->predicate->dump (f, s->conds);
}
fprintf (f, " calls:\n");
dump_ipa_call_summary (f, 4, node, s);
@@ -1467,6 +1543,21 @@ fail:
return false;
}
+/* Record to SUMMARY that PARM is used by builtin_constant_p. */
+
+static void
+add_builtin_constant_p_parm (class ipa_fn_summary *summary, int parm)
+{
+ int ip;
+
+ /* Avoid duplicates. */
+ for (unsigned int i = 0;
+ summary->builtin_constant_p_parms.iterate (i, &ip); i++)
+ if (ip == parm)
+ return;
+ summary->builtin_constant_p_parms.safe_push (parm);
+}
+
/* If BB ends by a conditional we can turn into predicates, attach corresponding
predicates to the CFG edges. */
@@ -1548,6 +1639,8 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi,
op2 = gimple_call_arg (set_stmt, 0);
if (!decompose_param_expr (fbi, set_stmt, op2, &index, &param_type, &aggpos))
return;
+ if (!aggpos.by_ref)
+ add_builtin_constant_p_parm (summary, index);
FOR_EACH_EDGE (e, ei, bb->succs) if (e->flags & EDGE_FALSE_VALUE)
{
predicate p = add_condition (summary, params_summary, index,
@@ -2430,6 +2523,47 @@ fp_expression_p (gimple *stmt)
return false;
}
+/* Return true if T references memory location that is local
+ for the function (that means, dead after return) or read-only. */
+
+bool
+refs_local_or_readonly_memory_p (tree t)
+{
+ /* Non-escaping memory is fine. */
+ t = get_base_address (t);
+ if ((TREE_CODE (t) == MEM_REF
+ || TREE_CODE (t) == TARGET_MEM_REF))
+ return points_to_local_or_readonly_memory_p (TREE_OPERAND (t, 0));
+
+ /* Automatic variables are fine. */
+ if (DECL_P (t)
+ && auto_var_in_fn_p (t, current_function_decl))
+ return true;
+
+ /* Read-only variables are fine. */
+ if (DECL_P (t) && TREE_READONLY (t))
+ return true;
+
+ return false;
+}
+
+/* Return true if T is a pointer pointing to memory location that is local
+ for the function (that means, dead after return) or read-only. */
+
+bool
+points_to_local_or_readonly_memory_p (tree t)
+{
+ /* See if memory location is clearly invalid. */
+ if (integer_zerop (t))
+ return flag_delete_null_pointer_checks;
+ if (TREE_CODE (t) == SSA_NAME)
+ return !ptr_deref_may_alias_global_p (t);
+ if (TREE_CODE (t) == ADDR_EXPR)
+ return refs_local_or_readonly_memory_p (TREE_OPERAND (t, 0));
+ return false;
+}
+
+
/* Analyze function body for NODE.
EARLY indicates run from early optimization pipeline. */
@@ -2514,12 +2648,13 @@ analyze_function_body (struct cgraph_node *node, bool early)
if (fbi.info)
compute_bb_predicates (&fbi, node, info, params_summary);
+ const profile_count entry_count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
order = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
nblocks = pre_and_rev_post_order_compute (NULL, order, false);
for (n = 0; n < nblocks; n++)
{
bb = BASIC_BLOCK_FOR_FN (cfun, order[n]);
- freq = bb->count.to_sreal_scale (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count);
+ freq = bb->count.to_sreal_scale (entry_count);
if (clobber_only_eh_bb_p (bb))
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2630,6 +2765,9 @@ analyze_function_body (struct cgraph_node *node, bool early)
int prob = param_change_prob (&fbi, stmt, i);
gcc_assert (prob >= 0 && prob <= REG_BR_PROB_BASE);
es->param[i].change_prob = prob;
+ es->param[i].points_to_local_or_readonly_memory
+ = points_to_local_or_readonly_memory_p
+ (gimple_call_arg (stmt, i));
}
}
@@ -2758,25 +2896,29 @@ analyze_function_body (struct cgraph_node *node, bool early)
if (nonconstant_names.exists () && !early)
{
+ ipa_fn_summary *s = ipa_fn_summaries->get (node);
class loop *loop;
- predicate loop_iterations = true;
- predicate loop_stride = true;
+ unsigned max_loop_predicates = opt_for_fn (node->decl,
+ param_ipa_max_loop_predicates);
if (dump_file && (dump_flags & TDF_DETAILS))
flow_loops_dump (dump_file, NULL, 0);
scev_initialize ();
FOR_EACH_LOOP (loop, 0)
{
- vec<edge> exits;
+ predicate loop_iterations = true;
+ sreal header_freq;
edge ex;
unsigned int j;
class tree_niter_desc niter_desc;
- if (loop->header->aux)
- bb_predicate = *(predicate *) loop->header->aux;
- else
- bb_predicate = false;
+ if (!loop->header->aux)
+ continue;
+
+ profile_count phdr_count = loop_preheader_edge (loop)->count ();
+ sreal phdr_freq = phdr_count.to_sreal_scale (entry_count);
- exits = get_loop_exit_edges (loop);
+ bb_predicate = *(predicate *) loop->header->aux;
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
FOR_EACH_VEC_ELT (exits, j, ex)
if (number_of_iterations_exit (loop, ex, &niter_desc, false)
&& !is_gimple_min_invariant (niter_desc.niter))
@@ -2790,11 +2932,10 @@ analyze_function_body (struct cgraph_node *node, bool early)
will_be_nonconstant = bb_predicate & will_be_nonconstant;
if (will_be_nonconstant != true
&& will_be_nonconstant != false)
- /* This is slightly inprecise. We may want to represent each
- loop with independent predicate. */
loop_iterations &= will_be_nonconstant;
}
- exits.release ();
+ add_freqcounting_predicate (&s->loop_iterations, loop_iterations,
+ phdr_freq, max_loop_predicates);
}
/* To avoid quadratic behavior we analyze stride predicates only
@@ -2803,14 +2944,17 @@ analyze_function_body (struct cgraph_node *node, bool early)
for (loop = loops_for_fn (cfun)->tree_root->inner;
loop != NULL; loop = loop->next)
{
+ predicate loop_stride = true;
basic_block *body = get_loop_body (loop);
+ profile_count phdr_count = loop_preheader_edge (loop)->count ();
+ sreal phdr_freq = phdr_count.to_sreal_scale (entry_count);
for (unsigned i = 0; i < loop->num_nodes; i++)
{
gimple_stmt_iterator gsi;
- if (body[i]->aux)
- bb_predicate = *(predicate *) body[i]->aux;
- else
- bb_predicate = false;
+ if (!body[i]->aux)
+ continue;
+
+ bb_predicate = *(predicate *) body[i]->aux;
for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi);
gsi_next (&gsi))
{
@@ -2839,16 +2983,13 @@ analyze_function_body (struct cgraph_node *node, bool early)
will_be_nonconstant = bb_predicate & will_be_nonconstant;
if (will_be_nonconstant != true
&& will_be_nonconstant != false)
- /* This is slightly inprecise. We may want to represent
- each loop with independent predicate. */
loop_stride = loop_stride & will_be_nonconstant;
}
}
+ add_freqcounting_predicate (&s->loop_strides, loop_stride,
+ phdr_freq, max_loop_predicates);
free (body);
}
- ipa_fn_summary *s = ipa_fn_summaries->get (node);
- set_hint_predicate (&s->loop_iterations, loop_iterations);
- set_hint_predicate (&s->loop_stride, loop_stride);
scev_finalize ();
}
FOR_ALL_BB_FN (bb, my_function)
@@ -2910,12 +3051,12 @@ compute_fn_summary (struct cgraph_node *node, bool early)
class ipa_size_summary *size_info = ipa_size_summaries->get_create (node);
/* Estimate the stack size for the function if we're optimizing. */
- self_stack_size = optimize && !node->thunk.thunk_p
+ self_stack_size = optimize && !node->thunk
? estimated_stack_frame_size (node) : 0;
size_info->estimated_self_stack_size = self_stack_size;
info->estimated_stack_size = self_stack_size;
- if (node->thunk.thunk_p)
+ if (node->thunk)
{
ipa_call_summary *es = ipa_call_summaries->get_create (node->callees);
predicate t = true;
@@ -3009,15 +3150,14 @@ compute_fn_summary_for_current (void)
return 0;
}
-/* Estimate benefit devirtualizing indirect edge IE, provided KNOWN_VALS,
- KNOWN_CONTEXTS and KNOWN_AGGS. */
+/* Estimate benefit devirtualizing indirect edge IE and return true if it can
+ be devirtualized and inlined, provided m_known_vals, m_known_contexts and
+ m_known_aggs in AVALS. Return false straight away if AVALS is NULL. */
static bool
estimate_edge_devirt_benefit (struct cgraph_edge *ie,
int *size, int *time,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs)
+ ipa_call_arg_values *avals)
{
tree target;
struct cgraph_node *callee;
@@ -3025,13 +3165,13 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie,
enum availability avail;
bool speculative;
- if (!known_vals.length () && !known_contexts.length ())
+ if (!avals
+ || (!avals->m_known_vals.length() && !avals->m_known_contexts.length ()))
return false;
if (!opt_for_fn (ie->caller->decl, flag_indirect_inlining))
return false;
- target = ipa_get_indirect_edge_target (ie, known_vals, known_contexts,
- known_aggs, &speculative);
+ target = ipa_get_indirect_edge_target (ie, avals, &speculative);
if (!target || speculative)
return false;
@@ -3055,17 +3195,13 @@ estimate_edge_devirt_benefit (struct cgraph_edge *ie,
}
/* Increase SIZE, MIN_SIZE (if non-NULL) and TIME for size and time needed to
- handle edge E with probability PROB.
- Set HINTS if edge may be devirtualized.
- KNOWN_VALS, KNOWN_AGGS and KNOWN_CONTEXTS describe context of the call
- site. */
+ handle edge E with probability PROB. Set HINTS accordingly if edge may be
+ devirtualized. AVALS, if non-NULL, describes the context of the call site
+ as far as values of parameters are concerened. */
static inline void
estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size,
- sreal *time,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs,
+ sreal *time, ipa_call_arg_values *avals,
ipa_hints *hints)
{
class ipa_call_summary *es = ipa_call_summaries->get (e);
@@ -3074,8 +3210,7 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size,
int cur_size;
if (!e->callee && hints && e->maybe_hot_p ()
- && estimate_edge_devirt_benefit (e, &call_size, &call_time,
- known_vals, known_contexts, known_aggs))
+ && estimate_edge_devirt_benefit (e, &call_size, &call_time, avals))
*hints |= INLINE_HINT_indirect_call;
cur_size = call_size * ipa_fn_summary::size_scale;
*size += cur_size;
@@ -3087,9 +3222,9 @@ estimate_edge_size_and_time (struct cgraph_edge *e, int *size, int *min_size,
/* Increase SIZE, MIN_SIZE and TIME for size and time needed to handle all
- calls in NODE. POSSIBLE_TRUTHS, KNOWN_VALS, KNOWN_AGGS and KNOWN_CONTEXTS
- describe context of the call site.
-
+ calls in NODE. POSSIBLE_TRUTHS and AVALS describe the context of the call
+ site.
+
Helper for estimate_calls_size_and_time which does the same but
(in most cases) faster. */
@@ -3098,9 +3233,7 @@ estimate_calls_size_and_time_1 (struct cgraph_node *node, int *size,
int *min_size, sreal *time,
ipa_hints *hints,
clause_t possible_truths,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs)
+ ipa_call_arg_values *avals)
{
struct cgraph_edge *e;
for (e = node->callees; e; e = e->next_callee)
@@ -3109,10 +3242,8 @@ estimate_calls_size_and_time_1 (struct cgraph_node *node, int *size,
{
gcc_checking_assert (!ipa_call_summaries->get (e));
estimate_calls_size_and_time_1 (e->callee, size, min_size, time,
- hints,
- possible_truths,
- known_vals, known_contexts,
- known_aggs);
+ hints, possible_truths, avals);
+
continue;
}
class ipa_call_summary *es = ipa_call_summaries->get (e);
@@ -3130,9 +3261,7 @@ estimate_calls_size_and_time_1 (struct cgraph_node *node, int *size,
so we do not need to compute probabilities. */
estimate_edge_size_and_time (e, size,
es->predicate ? NULL : min_size,
- time,
- known_vals, known_contexts,
- known_aggs, hints);
+ time, avals, hints);
}
}
for (e = node->indirect_calls; e; e = e->next_callee)
@@ -3142,9 +3271,7 @@ estimate_calls_size_and_time_1 (struct cgraph_node *node, int *size,
|| es->predicate->evaluate (possible_truths))
estimate_edge_size_and_time (e, size,
es->predicate ? NULL : min_size,
- time,
- known_vals, known_contexts, known_aggs,
- hints);
+ time, avals, hints);
}
}
@@ -3166,8 +3293,7 @@ summarize_calls_size_and_time (struct cgraph_node *node,
int size = 0;
sreal time = 0;
- estimate_edge_size_and_time (e, &size, NULL, &time,
- vNULL, vNULL, vNULL, NULL);
+ estimate_edge_size_and_time (e, &size, NULL, &time, NULL, NULL);
struct predicate pred = true;
class ipa_call_summary *es = ipa_call_summaries->get (e);
@@ -3181,8 +3307,7 @@ summarize_calls_size_and_time (struct cgraph_node *node,
int size = 0;
sreal time = 0;
- estimate_edge_size_and_time (e, &size, NULL, &time,
- vNULL, vNULL, vNULL, NULL);
+ estimate_edge_size_and_time (e, &size, NULL, &time, NULL, NULL);
struct predicate pred = true;
class ipa_call_summary *es = ipa_call_summaries->get (e);
@@ -3193,17 +3318,15 @@ summarize_calls_size_and_time (struct cgraph_node *node,
}
/* Increase SIZE, MIN_SIZE and TIME for size and time needed to handle all
- calls in NODE. POSSIBLE_TRUTHS, KNOWN_VALS, KNOWN_AGGS and KNOWN_CONTEXTS
- describe context of the call site. */
+ calls in NODE. POSSIBLE_TRUTHS and AVALS (the latter if non-NULL) describe
+ context of the call site. */
static void
estimate_calls_size_and_time (struct cgraph_node *node, int *size,
int *min_size, sreal *time,
ipa_hints *hints,
clause_t possible_truths,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs)
+ ipa_call_arg_values *avals)
{
class ipa_fn_summary *sum = ipa_fn_summaries->get (node);
bool use_table = true;
@@ -3222,9 +3345,10 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
use_table = false;
/* If there is an indirect edge that may be optimized, we need
to go the slow way. */
- else if ((known_vals.length ()
- || known_contexts.length ()
- || known_aggs.length ()) && hints)
+ else if (avals && hints
+ && (avals->m_known_vals.length ()
+ || avals->m_known_contexts.length ()
+ || avals->m_known_aggs.length ()))
{
class ipa_node_params *params_summary = IPA_NODE_REF (node);
unsigned int nargs = params_summary
@@ -3233,13 +3357,13 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
for (unsigned int i = 0; i < nargs && use_table; i++)
{
if (ipa_is_param_used_by_indirect_call (params_summary, i)
- && ((known_vals.length () > i && known_vals[i])
- || (known_aggs.length () > i
- && known_aggs[i].items.length ())))
+ && (avals->safe_sval_at (i)
+ || (avals->m_known_aggs.length () > i
+ && avals->m_known_aggs[i].items.length ())))
use_table = false;
else if (ipa_is_param_used_by_polymorphic_call (params_summary, i)
- && (known_contexts.length () > i
- && !known_contexts[i].useless_p ()))
+ && (avals->m_known_contexts.length () > i
+ && !avals->m_known_contexts[i].useless_p ()))
use_table = false;
}
}
@@ -3282,8 +3406,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
< ipa_fn_summary::max_size_time_table_size)
{
estimate_calls_size_and_time_1 (node, &old_size, NULL, &old_time, NULL,
- possible_truths, known_vals,
- known_contexts, known_aggs);
+ possible_truths, avals);
gcc_assert (*size == old_size);
if (time && (*time - old_time > 1 || *time - old_time < -1)
&& dump_file)
@@ -3295,38 +3418,29 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
/* Slow path by walking all edges. */
else
estimate_calls_size_and_time_1 (node, size, min_size, time, hints,
- possible_truths, known_vals, known_contexts,
- known_aggs);
+ possible_truths, avals);
}
-/* Default constructor for ipa call context.
- Memory allocation of known_vals, known_contexts
- and known_aggs vectors is owned by the caller, but can
- be release by ipa_call_context::release.
-
- inline_param_summary is owned by the caller. */
-ipa_call_context::ipa_call_context (cgraph_node *node,
- clause_t possible_truths,
+/* Main constructor for ipa call context. Memory allocation of ARG_VALUES
+ is owned by the caller. INLINE_PARAM_SUMMARY is also owned by the
+ caller. */
+
+ipa_call_context::ipa_call_context (cgraph_node *node, clause_t possible_truths,
clause_t nonspec_possible_truths,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context>
- known_contexts,
- vec<ipa_agg_value_set> known_aggs,
vec<inline_param_summary>
- inline_param_summary)
+ inline_param_summary,
+ ipa_auto_call_arg_values *arg_values)
: m_node (node), m_possible_truths (possible_truths),
m_nonspec_possible_truths (nonspec_possible_truths),
m_inline_param_summary (inline_param_summary),
- m_known_vals (known_vals),
- m_known_contexts (known_contexts),
- m_known_aggs (known_aggs)
+ m_avals (arg_values)
{
}
/* Set THIS to be a duplicate of CTX. Copy all relevant info. */
void
-ipa_call_context::duplicate_from (const ipa_call_context &ctx)
+ipa_cached_call_context::duplicate_from (const ipa_call_context &ctx)
{
m_node = ctx.m_node;
m_possible_truths = ctx.m_possible_truths;
@@ -3350,67 +3464,65 @@ ipa_call_context::duplicate_from (const ipa_call_context &ctx)
break;
}
}
- m_known_vals = vNULL;
- if (ctx.m_known_vals.exists ())
+ m_avals.m_known_vals = vNULL;
+ if (ctx.m_avals.m_known_vals.exists ())
{
- unsigned int n = MIN (ctx.m_known_vals.length (), nargs);
+ unsigned int n = MIN (ctx.m_avals.m_known_vals.length (), nargs);
for (unsigned int i = 0; i < n; i++)
if (ipa_is_param_used_by_indirect_call (params_summary, i)
- && ctx.m_known_vals[i])
+ && ctx.m_avals.m_known_vals[i])
{
- m_known_vals = ctx.m_known_vals.copy ();
+ m_avals.m_known_vals = ctx.m_avals.m_known_vals.copy ();
break;
}
}
- m_known_contexts = vNULL;
- if (ctx.m_known_contexts.exists ())
+ m_avals.m_known_contexts = vNULL;
+ if (ctx.m_avals.m_known_contexts.exists ())
{
- unsigned int n = MIN (ctx.m_known_contexts.length (), nargs);
+ unsigned int n = MIN (ctx.m_avals.m_known_contexts.length (), nargs);
for (unsigned int i = 0; i < n; i++)
if (ipa_is_param_used_by_polymorphic_call (params_summary, i)
- && !ctx.m_known_contexts[i].useless_p ())
+ && !ctx.m_avals.m_known_contexts[i].useless_p ())
{
- m_known_contexts = ctx.m_known_contexts.copy ();
+ m_avals.m_known_contexts = ctx.m_avals.m_known_contexts.copy ();
break;
}
}
- m_known_aggs = vNULL;
- if (ctx.m_known_aggs.exists ())
+ m_avals.m_known_aggs = vNULL;
+ if (ctx.m_avals.m_known_aggs.exists ())
{
- unsigned int n = MIN (ctx.m_known_aggs.length (), nargs);
+ unsigned int n = MIN (ctx.m_avals.m_known_aggs.length (), nargs);
for (unsigned int i = 0; i < n; i++)
if (ipa_is_param_used_by_indirect_call (params_summary, i)
- && !ctx.m_known_aggs[i].is_empty ())
+ && !ctx.m_avals.m_known_aggs[i].is_empty ())
{
- m_known_aggs = ipa_copy_agg_values (ctx.m_known_aggs);
+ m_avals.m_known_aggs
+ = ipa_copy_agg_values (ctx.m_avals.m_known_aggs);
break;
}
}
+
+ m_avals.m_known_value_ranges = vNULL;
}
-/* Release memory used by known_vals/contexts/aggs vectors.
- If ALL is true release also inline_param_summary.
- This happens when context was previously duplicated to be stored
- into cache. */
+/* Release memory used by known_vals/contexts/aggs vectors. and
+ inline_param_summary. */
void
-ipa_call_context::release (bool all)
+ipa_cached_call_context::release ()
{
/* See if context is initialized at first place. */
if (!m_node)
return;
- ipa_release_agg_values (m_known_aggs, all);
- if (all)
- {
- m_known_vals.release ();
- m_known_contexts.release ();
- m_inline_param_summary.release ();
- }
+ ipa_release_agg_values (m_avals.m_known_aggs, true);
+ m_avals.m_known_vals.release ();
+ m_avals.m_known_contexts.release ();
+ m_inline_param_summary.release ();
}
/* Return true if CTX describes the same call context as THIS. */
@@ -3454,95 +3566,95 @@ ipa_call_context::equal_to (const ipa_call_context &ctx)
return false;
}
}
- if (m_known_vals.exists () || ctx.m_known_vals.exists ())
+ if (m_avals.m_known_vals.exists () || ctx.m_avals.m_known_vals.exists ())
{
for (unsigned int i = 0; i < nargs; i++)
{
if (!ipa_is_param_used_by_indirect_call (params_summary, i))
continue;
- if (i >= m_known_vals.length () || !m_known_vals[i])
+ if (i >= m_avals.m_known_vals.length () || !m_avals.m_known_vals[i])
{
- if (i < ctx.m_known_vals.length () && ctx.m_known_vals[i])
+ if (i < ctx.m_avals.m_known_vals.length ()
+ && ctx.m_avals.m_known_vals[i])
return false;
continue;
}
- if (i >= ctx.m_known_vals.length () || !ctx.m_known_vals[i])
+ if (i >= ctx.m_avals.m_known_vals.length ()
+ || !ctx.m_avals.m_known_vals[i])
{
- if (i < m_known_vals.length () && m_known_vals[i])
+ if (i < m_avals.m_known_vals.length () && m_avals.m_known_vals[i])
return false;
continue;
}
- if (m_known_vals[i] != ctx.m_known_vals[i])
+ if (m_avals.m_known_vals[i] != ctx.m_avals.m_known_vals[i])
return false;
}
}
- if (m_known_contexts.exists () || ctx.m_known_contexts.exists ())
+ if (m_avals.m_known_contexts.exists ()
+ || ctx.m_avals.m_known_contexts.exists ())
{
for (unsigned int i = 0; i < nargs; i++)
{
if (!ipa_is_param_used_by_polymorphic_call (params_summary, i))
continue;
- if (i >= m_known_contexts.length ()
- || m_known_contexts[i].useless_p ())
+ if (i >= m_avals.m_known_contexts.length ()
+ || m_avals.m_known_contexts[i].useless_p ())
{
- if (i < ctx.m_known_contexts.length ()
- && !ctx.m_known_contexts[i].useless_p ())
+ if (i < ctx.m_avals.m_known_contexts.length ()
+ && !ctx.m_avals.m_known_contexts[i].useless_p ())
return false;
continue;
}
- if (i >= ctx.m_known_contexts.length ()
- || ctx.m_known_contexts[i].useless_p ())
+ if (i >= ctx.m_avals.m_known_contexts.length ()
+ || ctx.m_avals.m_known_contexts[i].useless_p ())
{
- if (i < m_known_contexts.length ()
- && !m_known_contexts[i].useless_p ())
+ if (i < m_avals.m_known_contexts.length ()
+ && !m_avals.m_known_contexts[i].useless_p ())
return false;
continue;
}
- if (!m_known_contexts[i].equal_to
- (ctx.m_known_contexts[i]))
+ if (!m_avals.m_known_contexts[i].equal_to
+ (ctx.m_avals.m_known_contexts[i]))
return false;
}
}
- if (m_known_aggs.exists () || ctx.m_known_aggs.exists ())
+ if (m_avals.m_known_aggs.exists () || ctx.m_avals.m_known_aggs.exists ())
{
for (unsigned int i = 0; i < nargs; i++)
{
if (!ipa_is_param_used_by_indirect_call (params_summary, i))
continue;
- if (i >= m_known_aggs.length () || m_known_aggs[i].is_empty ())
+ if (i >= m_avals.m_known_aggs.length ()
+ || m_avals.m_known_aggs[i].is_empty ())
{
- if (i < ctx.m_known_aggs.length ()
- && !ctx.m_known_aggs[i].is_empty ())
+ if (i < ctx.m_avals.m_known_aggs.length ()
+ && !ctx.m_avals.m_known_aggs[i].is_empty ())
return false;
continue;
}
- if (i >= ctx.m_known_aggs.length ()
- || ctx.m_known_aggs[i].is_empty ())
+ if (i >= ctx.m_avals.m_known_aggs.length ()
+ || ctx.m_avals.m_known_aggs[i].is_empty ())
{
- if (i < m_known_aggs.length ()
- && !m_known_aggs[i].is_empty ())
+ if (i < m_avals.m_known_aggs.length ()
+ && !m_avals.m_known_aggs[i].is_empty ())
return false;
continue;
}
- if (!m_known_aggs[i].equal_to (ctx.m_known_aggs[i]))
+ if (!m_avals.m_known_aggs[i].equal_to (ctx.m_avals.m_known_aggs[i]))
return false;
}
}
return true;
}
-/* Estimate size and time needed to execute call in the given context.
- Additionally determine hints determined by the context. Finally compute
- minimal size needed for the call that is independent on the call context and
- can be used for fast estimates. Return the values in RET_SIZE,
- RET_MIN_SIZE, RET_TIME and RET_HINTS. */
+/* Fill in the selected fields in ESTIMATES with value estimated for call in
+ this context. Always compute size and min_size. Only compute time and
+ nonspecialized_time if EST_TIMES is true. Only compute hints if EST_HINTS
+ is true. */
void
-ipa_call_context::estimate_size_and_time (int *ret_size,
- int *ret_min_size,
- sreal *ret_time,
- sreal *ret_nonspecialized_time,
- ipa_hints *ret_hints)
+ipa_call_context::estimate_size_and_time (ipa_call_estimates *estimates,
+ bool est_times, bool est_hints)
{
class ipa_fn_summary *info = ipa_fn_summaries->get (m_node);
size_time_entry *e;
@@ -3550,6 +3662,8 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
sreal time = 0;
int min_size = 0;
ipa_hints hints = 0;
+ sreal loops_with_known_iterations = 0;
+ sreal loops_with_known_strides = 0;
int i;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -3572,9 +3686,9 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
if (m_node->callees || m_node->indirect_calls)
estimate_calls_size_and_time (m_node, &size, &min_size,
- ret_time ? &time : NULL,
- ret_hints ? &hints : NULL, m_possible_truths,
- m_known_vals, m_known_contexts, m_known_aggs);
+ est_times ? &time : NULL,
+ est_hints ? &hints : NULL, m_possible_truths,
+ &m_avals);
sreal nonspecialized_time = time;
@@ -3600,7 +3714,7 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
known to be constant in a specialized setting. */
if (nonconst)
size += e->size;
- if (!ret_time)
+ if (!est_times)
continue;
nonspecialized_time += e->time;
if (!nonconst)
@@ -3640,36 +3754,58 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
if (time > nonspecialized_time)
time = nonspecialized_time;
- if (ret_hints)
+ if (est_hints)
{
- if (info->loop_iterations
- && !info->loop_iterations->evaluate (m_possible_truths))
- hints |= INLINE_HINT_loop_iterations;
- if (info->loop_stride
- && !info->loop_stride->evaluate (m_possible_truths))
- hints |= INLINE_HINT_loop_stride;
if (info->scc_no)
hints |= INLINE_HINT_in_scc;
if (DECL_DECLARED_INLINE_P (m_node->decl))
hints |= INLINE_HINT_declared_inline;
+ if (info->builtin_constant_p_parms.length ()
+ && DECL_DECLARED_INLINE_P (m_node->decl))
+ hints |= INLINE_HINT_builtin_constant_p;
+
+ ipa_freqcounting_predicate *fcp;
+ for (i = 0; vec_safe_iterate (info->loop_iterations, i, &fcp); i++)
+ if (!fcp->predicate->evaluate (m_possible_truths))
+ {
+ hints |= INLINE_HINT_loop_iterations;
+ loops_with_known_iterations += fcp->freq;
+ }
+ estimates->loops_with_known_iterations = loops_with_known_iterations;
+
+ for (i = 0; vec_safe_iterate (info->loop_strides, i, &fcp); i++)
+ if (!fcp->predicate->evaluate (m_possible_truths))
+ {
+ hints |= INLINE_HINT_loop_stride;
+ loops_with_known_strides += fcp->freq;
+ }
+ estimates->loops_with_known_strides = loops_with_known_strides;
}
size = RDIV (size, ipa_fn_summary::size_scale);
min_size = RDIV (min_size, ipa_fn_summary::size_scale);
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\n size:%i time:%f nonspec time:%f\n", (int) size,
- time.to_double (), nonspecialized_time.to_double ());
- if (ret_time)
- *ret_time = time;
- if (ret_nonspecialized_time)
- *ret_nonspecialized_time = nonspecialized_time;
- if (ret_size)
- *ret_size = size;
- if (ret_min_size)
- *ret_min_size = min_size;
- if (ret_hints)
- *ret_hints = hints;
+ {
+ fprintf (dump_file, "\n size:%i", (int) size);
+ if (est_times)
+ fprintf (dump_file, " time:%f nonspec time:%f",
+ time.to_double (), nonspecialized_time.to_double ());
+ if (est_hints)
+ fprintf (dump_file, " loops with known iterations:%f "
+ "known strides:%f", loops_with_known_iterations.to_double (),
+ loops_with_known_strides.to_double ());
+ fprintf (dump_file, "\n");
+ }
+ if (est_times)
+ {
+ estimates->time = time;
+ estimates->nonspecialized_time = nonspecialized_time;
+ }
+ estimates->size = size;
+ estimates->min_size = min_size;
+ if (est_hints)
+ estimates->hints = hints;
return;
}
@@ -3681,24 +3817,15 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
void
estimate_ipcp_clone_size_and_time (struct cgraph_node *node,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context>
- known_contexts,
- vec<ipa_agg_value_set> known_aggs,
- int *ret_size, sreal *ret_time,
- sreal *ret_nonspec_time,
- ipa_hints *hints)
+ ipa_auto_call_arg_values *avals,
+ ipa_call_estimates *estimates)
{
clause_t clause, nonspec_clause;
- /* TODO: Also pass known value ranges. */
- evaluate_conditions_for_known_args (node, false, known_vals, vNULL,
- known_aggs, &clause, &nonspec_clause);
- ipa_call_context ctx (node, clause, nonspec_clause,
- known_vals, known_contexts,
- known_aggs, vNULL);
- ctx.estimate_size_and_time (ret_size, NULL, ret_time,
- ret_nonspec_time, hints);
+ evaluate_conditions_for_known_args (node, false, avals, &clause,
+ &nonspec_clause);
+ ipa_call_context ctx (node, clause, nonspec_clause, vNULL, avals);
+ ctx.estimate_size_and_time (estimates);
}
/* Return stack frame offset where frame of NODE is supposed to start inside
@@ -3742,15 +3869,17 @@ inline_update_callee_summaries (struct cgraph_node *node, int depth)
ipa_call_summaries->get (e)->loop_depth += depth;
}
-/* Update change_prob of EDGE after INLINED_EDGE has been inlined.
+/* Update change_prob and points_to_local_or_readonly_memory of EDGE after
+ INLINED_EDGE has been inlined.
+
When function A is inlined in B and A calls C with parameter that
changes with probability PROB1 and C is known to be passthrough
of argument if B that change with probability PROB2, the probability
of change is now PROB1*PROB2. */
static void
-remap_edge_change_prob (struct cgraph_edge *inlined_edge,
- struct cgraph_edge *edge)
+remap_edge_params (struct cgraph_edge *inlined_edge,
+ struct cgraph_edge *edge)
{
if (ipa_node_params_sum)
{
@@ -3784,7 +3913,16 @@ remap_edge_change_prob (struct cgraph_edge *inlined_edge,
prob = 1;
es->param[i].change_prob = prob;
+
+ if (inlined_es
+ ->param[id].points_to_local_or_readonly_memory)
+ es->param[i].points_to_local_or_readonly_memory = true;
}
+ if (!es->param[i].points_to_local_or_readonly_memory
+ && jfunc->type == IPA_JF_CONST
+ && points_to_local_or_readonly_memory_p
+ (ipa_get_jf_constant (jfunc)))
+ es->param[i].points_to_local_or_readonly_memory = true;
}
}
}
@@ -3804,7 +3942,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
class ipa_node_params *params_summary,
class ipa_fn_summary *callee_info,
vec<int> operand_map,
- vec<int> offset_map,
+ vec<HOST_WIDE_INT> offset_map,
clause_t possible_truths,
predicate *toplev_predicate)
{
@@ -3817,7 +3955,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
if (e->inline_failed)
{
class ipa_call_summary *es = ipa_call_summaries->get (e);
- remap_edge_change_prob (inlined_edge, e);
+ remap_edge_params (inlined_edge, e);
if (es->predicate)
{
@@ -3843,7 +3981,7 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
predicate p;
next = e->next_callee;
- remap_edge_change_prob (inlined_edge, e);
+ remap_edge_params (inlined_edge, e);
if (es->predicate)
{
p = es->predicate->remap_after_inlining
@@ -3857,32 +3995,29 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
}
}
-/* Same as remap_predicate, but set result into hint *HINT. */
+/* Run remap_after_inlining on each predicate in V. */
static void
-remap_hint_predicate (class ipa_fn_summary *info,
- class ipa_node_params *params_summary,
- class ipa_fn_summary *callee_info,
- predicate **hint,
- vec<int> operand_map,
- vec<int> offset_map,
- clause_t possible_truths,
- predicate *toplev_predicate)
-{
- predicate p;
+remap_freqcounting_predicate (class ipa_fn_summary *info,
+ class ipa_node_params *params_summary,
+ class ipa_fn_summary *callee_info,
+ vec<ipa_freqcounting_predicate, va_gc> *v,
+ vec<int> operand_map,
+ vec<HOST_WIDE_INT> offset_map,
+ clause_t possible_truths,
+ predicate *toplev_predicate)
- if (!*hint)
- return;
- p = (*hint)->remap_after_inlining
- (info, params_summary, callee_info,
- operand_map, offset_map,
- possible_truths, *toplev_predicate);
- if (p != false && p != true)
+{
+ ipa_freqcounting_predicate *fcp;
+ for (int i = 0; vec_safe_iterate (v, i, &fcp); i++)
{
- if (!*hint)
- set_hint_predicate (hint, p);
- else
- **hint &= p;
+ predicate p
+ = fcp->predicate->remap_after_inlining (info, params_summary,
+ callee_info, operand_map,
+ offset_map, possible_truths,
+ *toplev_predicate);
+ if (p != false && p != true)
+ *fcp->predicate &= p;
}
}
@@ -3898,7 +4033,7 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
clause_t clause = 0; /* not_inline is known to be false. */
size_time_entry *e;
auto_vec<int, 8> operand_map;
- auto_vec<int, 8> offset_map;
+ auto_vec<HOST_WIDE_INT, 8> offset_map;
int i;
predicate toplev_predicate;
class ipa_call_summary *es = ipa_call_summaries->get (edge);
@@ -3914,10 +4049,8 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
if (callee_info->conds)
{
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
- evaluate_properties_for_edge (edge, true, &clause, NULL,
- &known_vals, NULL, &known_aggs);
+ ipa_auto_call_arg_values avals;
+ evaluate_properties_for_edge (edge, true, &clause, NULL, &avals, false);
}
if (ipa_node_params_sum && callee_info->conds)
{
@@ -3957,8 +4090,13 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
operand_map[i] = map;
gcc_assert (map < ipa_get_param_count (params_summary));
}
+
+ int ip;
+ for (i = 0; callee_info->builtin_constant_p_parms.iterate (i, &ip); i++)
+ if (ip < count && operand_map[ip] >= 0)
+ add_builtin_constant_p_parm (info, operand_map[ip]);
}
- sreal freq = edge->sreal_frequency ();
+ sreal freq = edge->sreal_frequency ();
for (i = 0; vec_safe_iterate (callee_info->size_time_table, i, &e); i++)
{
predicate p;
@@ -3992,12 +4130,12 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
remap_edge_summaries (edge, edge->callee, info, params_summary,
callee_info, operand_map,
offset_map, clause, &toplev_predicate);
- remap_hint_predicate (info, params_summary, callee_info,
- &callee_info->loop_iterations,
- operand_map, offset_map, clause, &toplev_predicate);
- remap_hint_predicate (info, params_summary, callee_info,
- &callee_info->loop_stride,
- operand_map, offset_map, clause, &toplev_predicate);
+ remap_freqcounting_predicate (info, params_summary, callee_info,
+ info->loop_iterations, operand_map,
+ offset_map, clause, &toplev_predicate);
+ remap_freqcounting_predicate (info, params_summary, callee_info,
+ info->loop_strides, operand_map,
+ offset_map, clause, &toplev_predicate);
HOST_WIDE_INT stack_frame_offset = ipa_get_stack_frame_offset (edge->callee);
HOST_WIDE_INT peak = stack_frame_offset + callee_info->estimated_stack_size;
@@ -4011,8 +4149,7 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
int edge_size = 0;
sreal edge_time = 0;
- estimate_edge_size_and_time (edge, &edge_size, NULL, &edge_time, vNULL,
- vNULL, vNULL, 0);
+ estimate_edge_size_and_time (edge, &edge_size, NULL, &edge_time, NULL, 0);
/* Unaccount size and time of the optimized out call. */
info->account_size_time (-edge_size, -edge_time,
es->predicate ? *es->predicate : true,
@@ -4054,7 +4191,7 @@ ipa_update_overall_fn_summary (struct cgraph_node *node, bool reset)
estimate_calls_size_and_time (node, &size_info->size, &info->min_size,
&info->time, NULL,
~(clause_t) (1 << predicate::false_condition),
- vNULL, vNULL, vNULL);
+ NULL);
size_info->size = RDIV (size_info->size, ipa_fn_summary::size_scale);
info->min_size = RDIV (info->min_size, ipa_fn_summary::size_scale);
}
@@ -4084,7 +4221,7 @@ inline_analyze_function (struct cgraph_node *node)
if (dump_file)
fprintf (dump_file, "\nAnalyzing function: %s\n", node->dump_name ());
- if (opt_for_fn (node->decl, optimize) && !node->thunk.thunk_p)
+ if (opt_for_fn (node->decl, optimize) && !node->thunk)
inline_indirect_intraprocedural_analysis (node);
compute_fn_summary (node, false);
if (!optimize)
@@ -4169,12 +4306,19 @@ read_ipa_call_summary (class lto_input_block *ib, struct cgraph_edge *e,
{
es->param.safe_grow_cleared (length, true);
for (i = 0; i < length; i++)
- es->param[i].change_prob = streamer_read_uhwi (ib);
+ {
+ es->param[i].change_prob = streamer_read_uhwi (ib);
+ es->param[i].points_to_local_or_readonly_memory
+ = streamer_read_uhwi (ib);
+ }
}
else
{
for (i = 0; i < length; i++)
- streamer_read_uhwi (ib);
+ {
+ streamer_read_uhwi (ib);
+ streamer_read_uhwi (ib);
+ }
}
}
@@ -4322,12 +4466,43 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
info->size_time_table->quick_push (e);
}
- p.stream_in (&ib);
- if (info)
- set_hint_predicate (&info->loop_iterations, p);
- p.stream_in (&ib);
- if (info)
- set_hint_predicate (&info->loop_stride, p);
+ count2 = streamer_read_uhwi (&ib);
+ for (j = 0; j < count2; j++)
+ {
+ p.stream_in (&ib);
+ sreal fcp_freq = sreal::stream_in (&ib);
+ if (info)
+ {
+ ipa_freqcounting_predicate fcp;
+ fcp.predicate = NULL;
+ set_hint_predicate (&fcp.predicate, p);
+ fcp.freq = fcp_freq;
+ vec_safe_push (info->loop_iterations, fcp);
+ }
+ }
+ count2 = streamer_read_uhwi (&ib);
+ for (j = 0; j < count2; j++)
+ {
+ p.stream_in (&ib);
+ sreal fcp_freq = sreal::stream_in (&ib);
+ if (info)
+ {
+ ipa_freqcounting_predicate fcp;
+ fcp.predicate = NULL;
+ set_hint_predicate (&fcp.predicate, p);
+ fcp.freq = fcp_freq;
+ vec_safe_push (info->loop_strides, fcp);
+ }
+ }
+ count2 = streamer_read_uhwi (&ib);
+ if (info && count2)
+ info->builtin_constant_p_parms.reserve_exact (count2);
+ for (j = 0; j < count2; j++)
+ {
+ int parm = streamer_read_uhwi (&ib);
+ if (info)
+ info->builtin_constant_p_parms.quick_push (parm);
+ }
for (e = node->callees; e; e = e->next_callee)
read_ipa_call_summary (&ib, e, info != NULL);
for (e = node->indirect_calls; e; e = e->next_callee)
@@ -4399,7 +4574,10 @@ write_ipa_call_summary (struct output_block *ob, struct cgraph_edge *e)
streamer_write_uhwi (ob, 0);
streamer_write_uhwi (ob, es->param.length ());
for (i = 0; i < (int) es->param.length (); i++)
- streamer_write_uhwi (ob, es->param[i].change_prob);
+ {
+ streamer_write_uhwi (ob, es->param[i].change_prob);
+ streamer_write_uhwi (ob, es->param[i].points_to_local_or_readonly_memory);
+ }
}
@@ -4487,14 +4665,24 @@ ipa_fn_summary_write (void)
e->exec_predicate.stream_out (ob);
e->nonconst_predicate.stream_out (ob);
}
- if (info->loop_iterations)
- info->loop_iterations->stream_out (ob);
- else
- streamer_write_uhwi (ob, 0);
- if (info->loop_stride)
- info->loop_stride->stream_out (ob);
- else
- streamer_write_uhwi (ob, 0);
+ ipa_freqcounting_predicate *fcp;
+ streamer_write_uhwi (ob, vec_safe_length (info->loop_iterations));
+ for (i = 0; vec_safe_iterate (info->loop_iterations, i, &fcp); i++)
+ {
+ fcp->predicate->stream_out (ob);
+ fcp->freq.stream_out (ob);
+ }
+ streamer_write_uhwi (ob, vec_safe_length (info->loop_strides));
+ for (i = 0; vec_safe_iterate (info->loop_strides, i, &fcp); i++)
+ {
+ fcp->predicate->stream_out (ob);
+ fcp->freq.stream_out (ob);
+ }
+ streamer_write_uhwi (ob, info->builtin_constant_p_parms.length ());
+ int ip;
+ for (i = 0; info->builtin_constant_p_parms.iterate (i, &ip);
+ i++)
+ streamer_write_uhwi (ob, ip);
for (edge = cnode->callees; edge; edge = edge->next_callee)
write_ipa_call_summary (ob, edge);
for (edge = cnode->indirect_calls; edge; edge = edge->next_callee)
@@ -4614,6 +4802,8 @@ public:
virtual unsigned int execute (function *)
{
ipa_free_fn_summary ();
+ /* Free ipa-prop structures if they are no longer needed. */
+ ipa_free_all_structures_after_iinln ();
if (!flag_wpa)
ipa_free_size_summary ();
return 0;
diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h
index c6ddc9f..3ecedb5 100644
--- a/gcc/ipa-fnsummary.h
+++ b/gcc/ipa-fnsummary.h
@@ -49,7 +49,10 @@ enum ipa_hints_vals {
Set by simple_edge_hints in ipa-inline-analysis.c. */
INLINE_HINT_cross_module = 64,
/* We know that the callee is hot by profile. */
- INLINE_HINT_known_hot = 128
+ INLINE_HINT_known_hot = 128,
+ /* There is builtin_constant_p dependent on parameter which is usually
+ a strong hint to inline. */
+ INLINE_HINT_builtin_constant_p = 256
};
typedef int ipa_hints;
@@ -101,6 +104,19 @@ public:
}
};
+/* Structure to capture how frequently some interesting events occur given a
+ particular predicate. The structure is used to estimate how often we
+ encounter loops with known iteration count or stride in various
+ contexts. */
+
+struct GTY(()) ipa_freqcounting_predicate
+{
+ /* The described event happens with this frequency... */
+ sreal freq;
+ /* ...when this predicate evaluates to false. */
+ class predicate * GTY((skip)) predicate;
+};
+
/* Function inlining information. */
class GTY(()) ipa_fn_summary
{
@@ -110,10 +126,13 @@ public:
ipa_fn_summary ()
: min_size (0),
inlinable (false), single_caller (false),
- fp_expressions (false), estimated_stack_size (false),
+ fp_expressions (false),
+ estimated_stack_size (false),
time (0), conds (NULL),
- size_time_table (NULL), call_size_time_table (NULL), loop_iterations (NULL),
- loop_stride (NULL), growth (0), scc_no (0)
+ size_time_table (NULL), call_size_time_table (NULL),
+ loop_iterations (NULL), loop_strides (NULL),
+ builtin_constant_p_parms (vNULL),
+ growth (0), scc_no (0)
{
}
@@ -125,7 +144,8 @@ public:
estimated_stack_size (s.estimated_stack_size),
time (s.time), conds (s.conds), size_time_table (s.size_time_table),
call_size_time_table (NULL),
- loop_iterations (s.loop_iterations), loop_stride (s.loop_stride),
+ loop_iterations (s.loop_iterations), loop_strides (s.loop_strides),
+ builtin_constant_p_parms (s.builtin_constant_p_parms),
growth (s.growth), scc_no (s.scc_no)
{}
@@ -164,12 +184,12 @@ public:
vec<size_time_entry, va_gc> *size_time_table;
vec<size_time_entry, va_gc> *call_size_time_table;
- /* Predicate on when some loop in the function becomes to have known
- bounds. */
- predicate * GTY((skip)) loop_iterations;
- /* Predicate on when some loop in the function becomes to have known
- stride. */
- predicate * GTY((skip)) loop_stride;
+ /* Predicates on when some loops in the function can have known bounds. */
+ vec<ipa_freqcounting_predicate, va_gc> *loop_iterations;
+ /* Predicates on when some loops in the function can have known strides. */
+ vec<ipa_freqcounting_predicate, va_gc> *loop_strides;
+ /* Parameters tested by builtin_constant_p. */
+ vec<int, va_heap, vl_ptr> GTY((skip)) builtin_constant_p_parms;
/* Estimated growth for inlining all copies of the function before start
of small functions inlining.
This value will get out of date as the callers are duplicated, but
@@ -287,6 +307,39 @@ public:
ipa_call_summary *dst_data);
};
+/* Estimated execution times, code sizes and other information about the
+ code executing a call described by ipa_call_context. */
+
+struct ipa_call_estimates
+{
+ /* Estimated size needed to execute call in the given context. */
+ int size;
+
+ /* Minimal size needed for the call that is + independent on the call context
+ and can be used for fast estimates. */
+ int min_size;
+
+ /* Estimated time needed to execute call in the given context. */
+ sreal time;
+
+ /* Estimated time needed to execute the function when not ignoring
+ computations known to be constant in this context. */
+ sreal nonspecialized_time;
+
+ /* Further discovered reasons why to inline or specialize the give calls. */
+ ipa_hints hints;
+
+ /* Frequency how often a loop with known number of iterations is encountered.
+ Calculated with hints. */
+ sreal loops_with_known_iterations;
+
+ /* Frequency how often a loop with known strides is encountered. Calculated
+ with hints. */
+ sreal loops_with_known_strides;
+};
+
+class ipa_cached_call_context;
+
/* This object describe a context of call. That is a summary of known
information about its parameters. Main purpose of this context is
to give more realistic estimations of function runtime, size and
@@ -297,20 +350,14 @@ public:
ipa_call_context (cgraph_node *node,
clause_t possible_truths,
clause_t nonspec_possible_truths,
- vec<tree> known_vals,
- vec<ipa_polymorphic_call_context> known_contexts,
- vec<ipa_agg_value_set> known_aggs,
- vec<inline_param_summary> m_inline_param_summary);
+ vec<inline_param_summary> inline_param_summary,
+ ipa_auto_call_arg_values *arg_values);
ipa_call_context ()
: m_node(NULL)
{
}
- void estimate_size_and_time (int *ret_size, int *ret_min_size,
- sreal *ret_time,
- sreal *ret_nonspecialized_time,
- ipa_hints *ret_hints);
- void duplicate_from (const ipa_call_context &ctx);
- void release (bool all = false);
+ void estimate_size_and_time (ipa_call_estimates *estimates,
+ bool est_times = true, bool est_hints = true);
bool equal_to (const ipa_call_context &);
bool exists_p ()
{
@@ -328,14 +375,21 @@ private:
/* Inline summary maintains info about change probabilities. */
vec<inline_param_summary> m_inline_param_summary;
- /* The following is used only to resolve indirect calls. */
+ /* Even after having calculated clauses, the information about argument
+ values is used to resolve indirect calls. */
+ ipa_call_arg_values m_avals;
- /* Vector describing known values of parameters. */
- vec<tree> m_known_vals;
- /* Vector describing known polymorphic call contexts. */
- vec<ipa_polymorphic_call_context> m_known_contexts;
- /* Vector describing known aggregate values. */
- vec<ipa_agg_value_set> m_known_aggs;
+ friend ipa_cached_call_context;
+};
+
+/* Variant of ipa_call_context that is stored in a cache over a longer period
+ of time. */
+
+class ipa_cached_call_context : public ipa_call_context
+{
+public:
+ void duplicate_from (const ipa_call_context &ctx);
+ void release ();
};
extern fast_call_summary <ipa_call_summary *, va_heap> *ipa_call_summaries;
@@ -348,25 +402,22 @@ void ipa_dump_hints (FILE *f, ipa_hints);
void ipa_free_fn_summary (void);
void ipa_free_size_summary (void);
void inline_analyze_function (struct cgraph_node *node);
-void estimate_ipcp_clone_size_and_time (struct cgraph_node *,
- vec<tree>,
- vec<ipa_polymorphic_call_context>,
- vec<ipa_agg_value_set>,
- int *, sreal *, sreal *,
- ipa_hints *);
+void estimate_ipcp_clone_size_and_time (struct cgraph_node *node,
+ ipa_auto_call_arg_values *avals,
+ ipa_call_estimates *estimates);
void ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge);
void ipa_update_overall_fn_summary (struct cgraph_node *node, bool reset = true);
void compute_fn_summary (struct cgraph_node *, bool);
+bool refs_local_or_readonly_memory_p (tree);
+bool points_to_local_or_readonly_memory_p (tree);
void evaluate_properties_for_edge (struct cgraph_edge *e,
bool inline_p,
clause_t *clause_ptr,
clause_t *nonspec_clause_ptr,
- vec<tree> *known_vals_ptr,
- vec<ipa_polymorphic_call_context>
- *known_contexts_ptr,
- vec<ipa_agg_value_set> *);
+ ipa_auto_call_arg_values *avals,
+ bool compute_contexts);
void ipa_fnsummary_c_finalize (void);
HOST_WIDE_INT ipa_get_stack_frame_offset (struct cgraph_node *node);
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 1cd5872..d5423a7 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -556,6 +556,7 @@ func_checker::compare_gimple_call (gcall *s1, gcall *s2)
|| gimple_call_tail_p (s1) != gimple_call_tail_p (s2)
|| gimple_call_return_slot_opt_p (s1) != gimple_call_return_slot_opt_p (s2)
|| gimple_call_from_thunk_p (s1) != gimple_call_from_thunk_p (s2)
+ || gimple_call_from_new_or_delete (s1) != gimple_call_from_new_or_delete (s2)
|| gimple_call_va_arg_pack_p (s1) != gimple_call_va_arg_pack_p (s2)
|| gimple_call_alloca_for_var_p (s1) != gimple_call_alloca_for_var_p (s2))
return false;
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index d2b4e78..8cae076 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see
#include "stor-layout.h"
#include "dbgcnt.h"
#include "tree-vector-builder.h"
+#include "symtab-thunks.h"
using namespace ipa_icf_gimple;
@@ -530,22 +531,14 @@ sem_function::equals_wpa (sem_item *item,
m_compared_func = static_cast<sem_function *> (item);
- if (cnode->thunk.thunk_p != cnode2->thunk.thunk_p)
- return return_false_with_msg ("thunk_p mismatch");
+ if (cnode->thunk != cnode2->thunk)
+ return return_false_with_msg ("thunk mismatch");
+ if (cnode->former_thunk_p () != cnode2->former_thunk_p ())
+ return return_false_with_msg ("former_thunk_p mismatch");
- if (cnode->thunk.thunk_p)
- {
- if (cnode->thunk.fixed_offset != cnode2->thunk.fixed_offset)
- return return_false_with_msg ("thunk fixed_offset mismatch");
- if (cnode->thunk.virtual_value != cnode2->thunk.virtual_value)
- return return_false_with_msg ("thunk virtual_value mismatch");
- if (cnode->thunk.indirect_offset != cnode2->thunk.indirect_offset)
- return return_false_with_msg ("thunk indirect_offset mismatch");
- if (cnode->thunk.this_adjusting != cnode2->thunk.this_adjusting)
- return return_false_with_msg ("thunk this_adjusting mismatch");
- if (cnode->thunk.virtual_offset_p != cnode2->thunk.virtual_offset_p)
- return return_false_with_msg ("thunk virtual_offset_p mismatch");
- }
+ if ((cnode->thunk || cnode->former_thunk_p ())
+ && thunk_info::get (cnode) != thunk_info::get (cnode2))
+ return return_false_with_msg ("thunk_info mismatch");
/* Compare special function DECL attributes. */
if (DECL_FUNCTION_PERSONALITY (decl)
@@ -968,7 +961,7 @@ redirect_all_callers (cgraph_node *n, cgraph_node *to)
/* Redirecting thunks to interposable symbols or symbols in other sections
may not be supported by target output code. Play safe for now and
punt on redirection. */
- if (!e->caller->thunk.thunk_p)
+ if (!e->caller->thunk)
{
struct cgraph_edge *nexte = e->next_caller;
e->redirect_callee (to);
@@ -1362,7 +1355,7 @@ sem_function::init (ipa_icf_gimple::func_checker *checker)
edge_count = n_edges_for_fn (func);
cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
- if (!cnode->thunk.thunk_p)
+ if (!cnode->thunk)
{
cfg_checksum = coverage_compute_cfg_checksum (func);
@@ -1407,12 +1400,7 @@ sem_function::init (ipa_icf_gimple::func_checker *checker)
else
{
cfg_checksum = 0;
- inchash::hash hstate;
- hstate.add_hwi (cnode->thunk.fixed_offset);
- hstate.add_hwi (cnode->thunk.virtual_value);
- hstate.add_flag (cnode->thunk.this_adjusting);
- hstate.add_flag (cnode->thunk.virtual_offset_p);
- gcode_hash = hstate.end ();
+ gcode_hash = thunk_info::get (cnode)->hash ();
}
m_checker = NULL;
@@ -1494,7 +1482,7 @@ sem_function::parse (cgraph_node *node, bitmap_obstack *stack,
tree fndecl = node->decl;
function *func = DECL_STRUCT_FUNCTION (fndecl);
- if (!func || (!node->has_gimple_body_p () && !node->thunk.thunk_p))
+ if (!func || (!node->has_gimple_body_p () && !node->thunk))
return NULL;
if (lookup_attribute_by_prefix ("omp ", DECL_ATTRIBUTES (node->decl)) != NULL)
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index 148efbc..acbf82e 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -57,7 +57,7 @@ fast_call_summary<edge_growth_cache_entry *, va_heap> *edge_growth_cache = NULL;
class node_context_cache_entry
{
public:
- ipa_call_context ctx;
+ ipa_cached_call_context ctx;
sreal time, nonspec_time;
int size;
ipa_hints hints;
@@ -184,20 +184,16 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
ipa_hints hints;
struct cgraph_node *callee;
clause_t clause, nonspec_clause;
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_polymorphic_call_context, 32> known_contexts;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
+ ipa_auto_call_arg_values avals;
class ipa_call_summary *es = ipa_call_summaries->get (edge);
int min_size = -1;
callee = edge->callee->ultimate_alias_target ();
gcc_checking_assert (edge->inline_failed);
- evaluate_properties_for_edge (edge, true,
- &clause, &nonspec_clause, &known_vals,
- &known_contexts, &known_aggs);
- ipa_call_context ctx (callee, clause, nonspec_clause, known_vals,
- known_contexts, known_aggs, es->param);
+ evaluate_properties_for_edge (edge, true, &clause, &nonspec_clause,
+ &avals, true);
+ ipa_call_context ctx (callee, clause, nonspec_clause, es->param, &avals);
if (node_context_cache != NULL)
{
node_context_summary *e = node_context_cache->get_create (callee);
@@ -212,16 +208,12 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
&& !opt_for_fn (callee->decl, flag_profile_partial_training)
&& !callee->count.ipa_p ())
{
- sreal chk_time, chk_nonspec_time;
- int chk_size, chk_min_size;
-
- ipa_hints chk_hints;
- ctx.estimate_size_and_time (&chk_size, &chk_min_size,
- &chk_time, &chk_nonspec_time,
- &chk_hints);
- gcc_assert (chk_size == size && chk_time == time
- && chk_nonspec_time == nonspec_time
- && chk_hints == hints);
+ ipa_call_estimates chk_estimates;
+ ctx.estimate_size_and_time (&chk_estimates);
+ gcc_assert (chk_estimates.size == size
+ && chk_estimates.time == time
+ && chk_estimates.nonspecialized_time == nonspec_time
+ && chk_estimates.hints == hints);
}
}
else
@@ -230,19 +222,29 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
node_context_cache_miss++;
else
node_context_cache_clear++;
- e->entry.ctx.release (true);
- ctx.estimate_size_and_time (&size, &min_size,
- &time, &nonspec_time, &hints);
+ e->entry.ctx.release ();
+ ipa_call_estimates estimates;
+ ctx.estimate_size_and_time (&estimates);
+ size = estimates.size;
e->entry.size = size;
+ time = estimates.time;
e->entry.time = time;
+ nonspec_time = estimates.nonspecialized_time;
e->entry.nonspec_time = nonspec_time;
+ hints = estimates.hints;
e->entry.hints = hints;
e->entry.ctx.duplicate_from (ctx);
}
}
else
- ctx.estimate_size_and_time (&size, &min_size,
- &time, &nonspec_time, &hints);
+ {
+ ipa_call_estimates estimates;
+ ctx.estimate_size_and_time (&estimates);
+ size = estimates.size;
+ time = estimates.time;
+ nonspec_time = estimates.nonspecialized_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
@@ -255,7 +257,6 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time)
: edge->caller->count.ipa ())))
hints |= INLINE_HINT_known_hot;
- ctx.release ();
gcc_checking_assert (size >= 0);
gcc_checking_assert (time >= 0);
@@ -307,9 +308,6 @@ do_estimate_edge_size (struct cgraph_edge *edge)
int size;
struct cgraph_node *callee;
clause_t clause, nonspec_clause;
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_polymorphic_call_context, 32> known_contexts;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
/* When we do caching, use do_estimate_edge_time to populate the entry. */
@@ -325,15 +323,13 @@ do_estimate_edge_size (struct cgraph_edge *edge)
/* Early inliner runs without caching, go ahead and do the dirty work. */
gcc_checking_assert (edge->inline_failed);
- evaluate_properties_for_edge (edge, true,
- &clause, &nonspec_clause,
- &known_vals, &known_contexts,
- &known_aggs);
- ipa_call_context ctx (callee, clause, nonspec_clause, known_vals,
- known_contexts, known_aggs, vNULL);
- ctx.estimate_size_and_time (&size, NULL, NULL, NULL, NULL);
- ctx.release ();
- return size;
+ ipa_auto_call_arg_values avals;
+ evaluate_properties_for_edge (edge, true, &clause, &nonspec_clause,
+ &avals, true);
+ ipa_call_context ctx (callee, clause, nonspec_clause, vNULL, &avals);
+ ipa_call_estimates estimates;
+ ctx.estimate_size_and_time (&estimates, false, false);
+ return estimates.size;
}
@@ -343,19 +339,15 @@ do_estimate_edge_size (struct cgraph_edge *edge)
ipa_hints
do_estimate_edge_hints (struct cgraph_edge *edge)
{
- ipa_hints hints;
struct cgraph_node *callee;
clause_t clause, nonspec_clause;
- auto_vec<tree, 32> known_vals;
- auto_vec<ipa_polymorphic_call_context, 32> known_contexts;
- auto_vec<ipa_agg_value_set, 32> known_aggs;
/* When we do caching, use do_estimate_edge_time to populate the entry. */
if (edge_growth_cache != NULL)
{
do_estimate_edge_time (edge);
- hints = edge_growth_cache->get (edge)->hints;
+ ipa_hints hints = edge_growth_cache->get (edge)->hints;
gcc_checking_assert (hints);
return hints - 1;
}
@@ -364,15 +356,13 @@ do_estimate_edge_hints (struct cgraph_edge *edge)
/* Early inliner runs without caching, go ahead and do the dirty work. */
gcc_checking_assert (edge->inline_failed);
- evaluate_properties_for_edge (edge, true,
- &clause, &nonspec_clause,
- &known_vals, &known_contexts,
- &known_aggs);
- ipa_call_context ctx (callee, clause, nonspec_clause, known_vals,
- known_contexts, known_aggs, vNULL);
- ctx.estimate_size_and_time (NULL, NULL, NULL, NULL, &hints);
- ctx.release ();
- hints |= simple_edge_hints (edge);
+ ipa_auto_call_arg_values avals;
+ evaluate_properties_for_edge (edge, true, &clause, &nonspec_clause,
+ &avals, true);
+ ipa_call_context ctx (callee, clause, nonspec_clause, vNULL, &avals);
+ ipa_call_estimates estimates;
+ ctx.estimate_size_and_time (&estimates, false, true);
+ ipa_hints hints = estimates.hints | simple_edge_hints (edge);
return hints;
}
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 5e37e61..3782cce 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -48,6 +48,9 @@ along with GCC; see the file COPYING3. If not see
#include "cfg.h"
#include "basic-block.h"
#include "ipa-utils.h"
+#include "ipa-modref-tree.h"
+#include "ipa-modref.h"
+#include "symtab-thunks.h"
int ncalls_inlined;
int nfunctions_inlined;
@@ -351,14 +354,18 @@ inline_call (struct cgraph_edge *e, bool update_original,
to = e->caller;
if (to->inlined_to)
to = to->inlined_to;
- if (to->thunk.thunk_p)
+ if (to->thunk)
{
struct cgraph_node *target = to->callees->callee;
thunk_expansion = true;
+
+ /* Remove all annotations, but keep thunk info. */
+ thunk_info info = *thunk_info::get (to);
symtab->call_cgraph_removal_hooks (to);
+ *thunk_info::get_create (to) = info;
if (in_lto_p)
to->get_untransformed_body ();
- to->expand_thunk (false, true);
+ expand_thunk (to, false, true);
/* When thunk is instrumented we may have multiple callees. */
for (e = to->callees; e && e->callee != target; e = e->next_callee)
;
@@ -487,6 +494,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
gcc_assert (curr->callee->inlined_to == to);
old_size = ipa_size_summaries->get (to)->size;
+ ipa_merge_modref_summary_after_inlining (e);
ipa_merge_fn_summary_after_inlining (e);
if (e->in_polymorphic_cdtor)
mark_all_inlined_calls_cdtor (e->callee);
@@ -561,9 +569,9 @@ save_inline_function_body (struct cgraph_node *node)
first_clone = node->clones;
/* Arrange first clone to not be thunk as those do not have bodies. */
- if (first_clone->thunk.thunk_p)
+ if (first_clone->thunk)
{
- while (first_clone->thunk.thunk_p)
+ while (first_clone->thunk)
first_clone = first_clone->next_sibling_clone;
first_clone->prev_sibling_clone->next_sibling_clone
= first_clone->next_sibling_clone;
@@ -641,16 +649,16 @@ save_inline_function_body (struct cgraph_node *node)
tree_function_versioning (node->decl, first_clone->decl,
NULL, NULL, true, NULL, NULL);
- /* The function will be short lived and removed after we inline all the clones,
- but make it internal so we won't confuse ourself. */
+ /* The function will be short lived and removed after we inline all the
+ clones, but make it internal so we won't confuse ourself. */
DECL_EXTERNAL (first_clone->decl) = 0;
TREE_PUBLIC (first_clone->decl) = 0;
DECL_COMDAT (first_clone->decl) = 0;
first_clone->ipa_transforms_to_apply.release ();
/* When doing recursive inlining, the clone may become unnecessary.
- This is possible i.e. in the case when the recursive function is proved to be
- non-throwing and the recursion happens only in the EH landing pad.
+ This is possible i.e. in the case when the recursive function is proved to
+ be non-throwing and the recursion happens only in the EH landing pad.
We cannot remove the clone until we are done with saving the body.
Remove it now. */
if (!first_clone->callers)
@@ -670,11 +678,11 @@ static bool
preserve_function_body_p (struct cgraph_node *node)
{
gcc_assert (symtab->global_info_ready);
- gcc_assert (!node->alias && !node->thunk.thunk_p);
+ gcc_assert (!node->alias && !node->thunk);
/* Look if there is any non-thunk clone around. */
for (node = node->clones; node; node = node->next_sibling_clone)
- if (!node->thunk.thunk_p)
+ if (!node->thunk)
return true;
return false;
}
@@ -693,6 +701,14 @@ inline_transform (struct cgraph_node *node)
if (cfun->after_inlining)
return 0;
+ cgraph_node *next_clone;
+ for (cgraph_node *n = node->clones; n; n = next_clone)
+ {
+ next_clone = n->next_sibling_clone;
+ if (n->decl != node->decl)
+ n->materialize_clone ();
+ }
+
/* We might need the body of this function so that we can expand
it inline somewhere else. */
if (preserve_function_body_p (node))
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index c667de2..8db2345 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -398,26 +398,42 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
return inlinable;
}
-/* Return inlining_insns_single limit for function N. If HINT is true
+/* Return inlining_insns_single limit for function N. If HINT or HINT2 is true
scale up the bound. */
static int
-inline_insns_single (cgraph_node *n, bool hint)
+inline_insns_single (cgraph_node *n, bool hint, bool hint2)
{
- if (hint)
+ if (hint && hint2)
+ {
+ int64_t spd = opt_for_fn (n->decl, param_inline_heuristics_hint_percent);
+ spd = spd * spd;
+ if (spd > 1000000)
+ spd = 1000000;
+ return opt_for_fn (n->decl, param_max_inline_insns_single) * spd / 100;
+ }
+ if (hint || hint2)
return opt_for_fn (n->decl, param_max_inline_insns_single)
* opt_for_fn (n->decl, param_inline_heuristics_hint_percent) / 100;
return opt_for_fn (n->decl, param_max_inline_insns_single);
}
-/* Return inlining_insns_auto limit for function N. If HINT is true
+/* Return inlining_insns_auto limit for function N. If HINT or HINT2 is true
scale up the bound. */
static int
-inline_insns_auto (cgraph_node *n, bool hint)
+inline_insns_auto (cgraph_node *n, bool hint, bool hint2)
{
int max_inline_insns_auto = opt_for_fn (n->decl, param_max_inline_insns_auto);
- if (hint)
+ if (hint && hint2)
+ {
+ int64_t spd = opt_for_fn (n->decl, param_inline_heuristics_hint_percent);
+ spd = spd * spd;
+ if (spd > 1000000)
+ spd = 1000000;
+ return max_inline_insns_auto * spd / 100;
+ }
+ if (hint || hint2)
return max_inline_insns_auto
* opt_for_fn (n->decl, param_inline_heuristics_hint_percent) / 100;
return max_inline_insns_auto;
@@ -566,8 +582,8 @@ can_inline_edge_by_limits_p (struct cgraph_edge *e, bool report,
int growth = estimate_edge_growth (e);
if (growth > opt_for_fn (caller->decl, param_max_inline_insns_size)
&& (!DECL_DECLARED_INLINE_P (callee->decl)
- && growth >= MAX (inline_insns_single (caller, false),
- inline_insns_auto (caller, false))))
+ && growth >= MAX (inline_insns_single (caller, false, false),
+ inline_insns_auto (caller, false, false))))
{
e->inline_failed = CIF_OPTIMIZATION_MISMATCH;
inlinable = false;
@@ -806,7 +822,7 @@ inlining_speedup (struct cgraph_edge *edge,
}
/* Return true if the speedup for inlining E is bigger than
- PARAM_MAX_INLINE_MIN_SPEEDUP. */
+ param_inline_min_speedup. */
static bool
big_speedup_p (struct cgraph_edge *e)
@@ -855,7 +871,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
&& (!e->count.ipa ().initialized_p () || !e->maybe_hot_p ()))
&& ipa_fn_summaries->get (callee)->min_size
- ipa_call_summaries->get (e)->call_stmt_size
- > inline_insns_auto (e->caller, true))
+ > inline_insns_auto (e->caller, true, true))
{
e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
want_inline = false;
@@ -864,7 +880,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
|| e->count.ipa ().nonzero_p ())
&& ipa_fn_summaries->get (callee)->min_size
- ipa_call_summaries->get (e)->call_stmt_size
- > inline_insns_single (e->caller, true))
+ > inline_insns_single (e->caller, true, true))
{
e->inline_failed = (DECL_DECLARED_INLINE_P (callee->decl)
? CIF_MAX_INLINE_INSNS_SINGLE_LIMIT
@@ -875,10 +891,14 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
{
int growth = estimate_edge_growth (e);
ipa_hints hints = estimate_edge_hints (e);
+ /* We have two independent groups of hints. If one matches in each
+ of groups the limits are inreased. If both groups matches, limit
+ is increased even more. */
bool apply_hints = (hints & (INLINE_HINT_indirect_call
| INLINE_HINT_known_hot
| INLINE_HINT_loop_iterations
| INLINE_HINT_loop_stride));
+ bool apply_hints2 = (hints & INLINE_HINT_builtin_constant_p);
if (growth <= opt_for_fn (to->decl,
param_max_inline_insns_size))
@@ -888,9 +908,11 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
Avoid computation of big_speedup_p when not necessary to change
outcome of decision. */
else if (DECL_DECLARED_INLINE_P (callee->decl)
- && growth >= inline_insns_single (e->caller, apply_hints)
- && (apply_hints
- || growth >= inline_insns_single (e->caller, true)
+ && growth >= inline_insns_single (e->caller, apply_hints,
+ apply_hints2)
+ && (apply_hints || apply_hints2
+ || growth >= inline_insns_single (e->caller, true,
+ apply_hints2)
|| !big_speedup_p (e)))
{
e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
@@ -902,7 +924,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
param_max_inline_insns_small))
{
/* growth_positive_p is expensive, always test it last. */
- if (growth >= inline_insns_single (e->caller, false)
+ if (growth >= inline_insns_single (e->caller, false, false)
|| growth_positive_p (callee, e, growth))
{
e->inline_failed = CIF_NOT_DECLARED_INLINED;
@@ -912,13 +934,15 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
/* Apply param_max_inline_insns_auto limit for functions not declared
inline. Bypass the limit when speedup seems big. */
else if (!DECL_DECLARED_INLINE_P (callee->decl)
- && growth >= inline_insns_auto (e->caller, apply_hints)
- && (apply_hints
- || growth >= inline_insns_auto (e->caller, true)
+ && growth >= inline_insns_auto (e->caller, apply_hints,
+ apply_hints2)
+ && (apply_hints || apply_hints2
+ || growth >= inline_insns_auto (e->caller, true,
+ apply_hints2)
|| !big_speedup_p (e)))
{
/* growth_positive_p is expensive, always test it last. */
- if (growth >= inline_insns_single (e->caller, false)
+ if (growth >= inline_insns_single (e->caller, false, false)
|| growth_positive_p (callee, e, growth))
{
e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
@@ -927,7 +951,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
}
/* If call is cold, do not inline when function body would grow. */
else if (!e->maybe_hot_p ()
- && (growth >= inline_insns_single (e->caller, false)
+ && (growth >= inline_insns_single (e->caller, false, false)
|| growth_positive_p (callee, e, growth)))
{
e->inline_failed = CIF_UNLIKELY_CALL;
@@ -1111,8 +1135,8 @@ static bool
wrapper_heuristics_may_apply (struct cgraph_node *where, int size)
{
return size < (DECL_DECLARED_INLINE_P (where->decl)
- ? inline_insns_single (where, false)
- : inline_insns_auto (where, false));
+ ? inline_insns_single (where, false, false)
+ : inline_insns_auto (where, false, false));
}
/* A cost model driving the inlining heuristics in a way so the edges with
@@ -1317,6 +1341,8 @@ edge_badness (struct cgraph_edge *edge, bool dump)
| INLINE_HINT_loop_stride))
|| callee_info->growth <= 0)
badness = badness.shift (badness > 0 ? -2 : 2);
+ if (hints & INLINE_HINT_builtin_constant_p)
+ badness = badness.shift (badness > 0 ? -4 : 4);
if (hints & (INLINE_HINT_same_scc))
badness = badness.shift (badness > 0 ? 3 : -3);
else if (hints & (INLINE_HINT_in_scc))
@@ -1921,7 +1947,7 @@ inline_small_functions (void)
if (!node->inlined_to)
{
if (!node->alias && node->analyzed
- && (node->has_gimple_body_p () || node->thunk.thunk_p)
+ && (node->has_gimple_body_p () || node->thunk)
&& opt_for_fn (node->decl, optimize))
{
class ipa_fn_summary *info = ipa_fn_summaries->get (node);
@@ -2770,9 +2796,6 @@ ipa_inline (void)
}
}
- /* Free ipa-prop structures if they are no longer needed. */
- ipa_free_all_structures_after_iinln ();
-
if (dump_enabled_p ())
dump_printf (MSG_NOTE,
"\nInlined %i calls, eliminated %i functions\n\n",
diff --git a/gcc/ipa-modref-tree.c b/gcc/ipa-modref-tree.c
index e37dee6..94c68cc 100644
--- a/gcc/ipa-modref-tree.c
+++ b/gcc/ipa-modref-tree.c
@@ -28,18 +28,20 @@ along with GCC; see the file COPYING3. If not see
#if CHECKING_P
+namespace selftest {
static void
test_insert_search_collapse ()
{
modref_base_node<alias_set_type> *base_node;
modref_ref_node<alias_set_type> *ref_node;
+ modref_access_node a = unspecified_modref_access_node;
- modref_tree<alias_set_type> *t = new modref_tree<alias_set_type>(1, 2);
+ modref_tree<alias_set_type> *t = new modref_tree<alias_set_type>(1, 2, 2);
ASSERT_FALSE (t->every_base);
/* Insert into an empty tree. */
- t->insert (1, 2);
+ t->insert (1, 2, a);
ASSERT_NE (t->bases, NULL);
ASSERT_EQ (t->bases->length (), 1);
ASSERT_FALSE (t->every_base);
@@ -57,7 +59,7 @@ test_insert_search_collapse ()
ASSERT_EQ (ref_node->ref, 2);
/* Insert when base exists but ref does not. */
- t->insert (1, 3);
+ t->insert (1, 3, a);
ASSERT_NE (t->bases, NULL);
ASSERT_EQ (t->bases->length (), 1);
ASSERT_EQ (t->search (1), base_node);
@@ -70,7 +72,7 @@ test_insert_search_collapse ()
/* Insert when base and ref exist, but access is not dominated by nor
dominates other accesses. */
- t->insert (1, 2);
+ t->insert (1, 2, a);
ASSERT_EQ (t->bases->length (), 1);
ASSERT_EQ (t->search (1), base_node);
@@ -78,12 +80,12 @@ test_insert_search_collapse ()
ASSERT_NE (ref_node, NULL);
/* Insert when base and ref exist and access is dominated. */
- t->insert (1, 2);
+ t->insert (1, 2, a);
ASSERT_EQ (t->search (1), base_node);
ASSERT_EQ (base_node->search (2), ref_node);
/* Insert ref to trigger ref list collapse for base 1. */
- t->insert (1, 4);
+ t->insert (1, 4, a);
ASSERT_EQ (t->search (1), base_node);
ASSERT_EQ (base_node->refs, NULL);
ASSERT_EQ (base_node->search (2), NULL);
@@ -91,7 +93,7 @@ test_insert_search_collapse ()
ASSERT_TRUE (base_node->every_ref);
/* Further inserts to collapsed ref list are ignored. */
- t->insert (1, 5);
+ t->insert (1, 5, a);
ASSERT_EQ (t->search (1), base_node);
ASSERT_EQ (base_node->refs, NULL);
ASSERT_EQ (base_node->search (2), NULL);
@@ -99,16 +101,18 @@ test_insert_search_collapse ()
ASSERT_TRUE (base_node->every_ref);
/* Insert base to trigger base list collapse. */
- t->insert (5, 6);
+ t->insert (5, 6, a);
ASSERT_TRUE (t->every_base);
ASSERT_EQ (t->bases, NULL);
ASSERT_EQ (t->search (1), NULL);
/* Further inserts to collapsed base list are ignored. */
- t->insert (7, 8);
+ t->insert (7, 8, a);
ASSERT_TRUE (t->every_base);
ASSERT_EQ (t->bases, NULL);
ASSERT_EQ (t->search (1), NULL);
+
+ delete t;
}
static void
@@ -116,24 +120,25 @@ test_merge ()
{
modref_tree<alias_set_type> *t1, *t2;
modref_base_node<alias_set_type> *base_node;
-
- t1 = new modref_tree<alias_set_type>(3, 4);
- t1->insert (1, 1);
- t1->insert (1, 2);
- t1->insert (1, 3);
- t1->insert (2, 1);
- t1->insert (3, 1);
-
- t2 = new modref_tree<alias_set_type>(10, 10);
- t2->insert (1, 2);
- t2->insert (1, 3);
- t2->insert (1, 4);
- t2->insert (3, 2);
- t2->insert (3, 3);
- t2->insert (3, 4);
- t2->insert (3, 5);
-
- t1->merge (t2);
+ modref_access_node a = unspecified_modref_access_node;
+
+ t1 = new modref_tree<alias_set_type>(3, 4, 1);
+ t1->insert (1, 1, a);
+ t1->insert (1, 2, a);
+ t1->insert (1, 3, a);
+ t1->insert (2, 1, a);
+ t1->insert (3, 1, a);
+
+ t2 = new modref_tree<alias_set_type>(10, 10, 10);
+ t2->insert (1, 2, a);
+ t2->insert (1, 3, a);
+ t2->insert (1, 4, a);
+ t2->insert (3, 2, a);
+ t2->insert (3, 3, a);
+ t2->insert (3, 4, a);
+ t2->insert (3, 5, a);
+
+ t1->merge (t2, NULL);
ASSERT_FALSE (t1->every_base);
ASSERT_NE (t1->bases, NULL);
@@ -152,16 +157,21 @@ test_merge ()
base_node = t1->search (3);
ASSERT_EQ (base_node->refs, NULL);
ASSERT_TRUE (base_node->every_ref);
+
+ delete t1;
+ delete t2;
}
void
-modref_tree_c_tests ()
+ipa_modref_tree_c_tests ()
{
test_insert_search_collapse ();
test_merge ();
}
+} // namespace selftest
+
#endif
void
@@ -219,11 +229,21 @@ void gt_pch_nx (modref_base_node<tree_node*>*, gt_pointer_operator, void *) {}
void gt_ggc_mx (modref_ref_node<int>* &r)
{
ggc_test_and_set_mark (r);
+ if (r->accesses)
+ {
+ ggc_test_and_set_mark (r->accesses);
+ gt_ggc_mx (r->accesses);
+ }
}
void gt_ggc_mx (modref_ref_node<tree_node*>* &r)
{
ggc_test_and_set_mark (r);
+ if (r->accesses)
+ {
+ ggc_test_and_set_mark (r->accesses);
+ gt_ggc_mx (r->accesses);
+ }
if (r->ref)
gt_ggc_mx (r->ref);
}
@@ -233,4 +253,6 @@ void gt_pch_nx (modref_ref_node<tree_node*>*) {}
void gt_pch_nx (modref_ref_node<int>*, gt_pointer_operator, void *) {}
void gt_pch_nx (modref_ref_node<tree_node*>*, gt_pointer_operator, void *) {}
-
+void gt_ggc_mx (modref_access_node &)
+{
+}
diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h
index 3bdd305..b37280d 100644
--- a/gcc/ipa-modref-tree.h
+++ b/gcc/ipa-modref-tree.h
@@ -18,20 +18,142 @@ 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/>. */
+/* modref_tree represent a decision tree that can be used by alias analysis
+ oracle to determine whether given memory access can be affected by a function
+ call. For every function we collect two trees, one for loads and other
+ for stores. Tree consist of following levels:
+
+ 1) Base: this level represent base alias set of the acecess and refers
+ to sons (ref nodes). Flag all_refs means that all possible references
+ are aliasing.
+
+ Because for LTO streaming we need to stream types rahter than alias sets
+ modref_base_node is implemented as a template.
+ 2) Ref: this level represent ref alias set and links to acesses unless
+ all_refs flag is et.
+ Again ref is an template to allow LTO streaming.
+ 3) Access: this level represent info about individual accesses. Presently
+ we record whether access is trhough a dereference of a function parameter
+*/
+
#ifndef GCC_MODREF_TREE_H
#define GCC_MODREF_TREE_H
struct ipa_modref_summary;
+/* Memory access. */
+struct GTY(()) modref_access_node
+{
+
+ /* Access range information (in bits). */
+ poly_int64 offset;
+ poly_int64 size;
+ poly_int64 max_size;
+
+ /* Offset from parmeter pointer to the base of the access (in bytes). */
+ poly_int64 parm_offset;
+
+ /* Index of parameter which specifies the base of access. -1 if base is not
+ a function parameter. */
+ int parm_index;
+ bool parm_offset_known;
+
+ /* Return true if access node holds no useful info. */
+ bool useful_p () const
+ {
+ return parm_index != -1;
+ }
+ /* Return true if range info is useful. */
+ bool range_info_useful_p () const
+ {
+ return parm_index != -1 && parm_offset_known;
+ }
+ /* Return true if both accesses are the same. */
+ bool operator == (modref_access_node &a) const
+ {
+ if (parm_index != a.parm_index)
+ return false;
+ if (parm_index >= 0)
+ {
+ if (parm_offset_known != a.parm_offset_known)
+ return false;
+ if (parm_offset_known
+ && !known_eq (parm_offset, a.parm_offset))
+ return false;
+ }
+ if (range_info_useful_p ()
+ && (!known_eq (a.offset, offset)
+ || !known_eq (a.size, size)
+ || !known_eq (a.max_size, max_size)))
+ return false;
+ return true;
+ }
+};
+
+/* Access node specifying no useful info. */
+const modref_access_node unspecified_modref_access_node
+ = {0, -1, -1, 0, -1, false};
template <typename T>
struct GTY((user)) modref_ref_node
{
T ref;
+ bool every_access;
+ vec <modref_access_node, va_gc> *accesses;
modref_ref_node (T ref):
- ref (ref)
+ ref (ref),
+ every_access (false),
+ accesses (NULL)
{}
+
+ /* Search REF; return NULL if failed. */
+ modref_access_node *search (modref_access_node access)
+ {
+ size_t i;
+ modref_access_node *a;
+ FOR_EACH_VEC_SAFE_ELT (accesses, i, a)
+ if (*a == access)
+ return a;
+ return NULL;
+ }
+
+ /* Collapse the tree. */
+ void collapse ()
+ {
+ vec_free (accesses);
+ accesses = NULL;
+ every_access = true;
+ }
+
+ /* Insert access with OFFSET and SIZE.
+ Collapse tree if it has more than MAX_ACCESSES entries.
+ Return true if record was changed. */
+ bool insert_access (modref_access_node a, size_t max_accesses)
+ {
+ /* If this base->ref pair has no access information, bail out. */
+ if (every_access)
+ return false;
+
+ /* Otherwise, insert a node for the ref of the access under the base. */
+ modref_access_node *access_node = search (a);
+ if (access_node)
+ return false;
+
+ /* If this base->ref pair has too many accesses stored, we will clear
+ all accesses and bail out. */
+ if ((accesses && accesses->length () >= max_accesses)
+ || !a.useful_p ())
+ {
+ if (dump_file && a.useful_p ())
+ fprintf (dump_file,
+ "--param param=modref-max-accesses limit reached\n");
+ collapse ();
+ return true;
+ }
+ vec_safe_push (accesses, a);
+ return true;
+ }
};
/* Base of an access. */
@@ -58,8 +180,11 @@ struct GTY((user)) modref_base_node
return NULL;
}
- /* Insert REF; collapse tree if there are more than MAX_REFS. */
- modref_ref_node <T> *insert_ref (T ref, size_t max_refs)
+ /* Insert REF; collapse tree if there are more than MAX_REFS.
+ Return inserted ref and if CHANGED is non-null set it to true if
+ something changed. */
+ modref_ref_node <T> *insert_ref (T ref, size_t max_refs,
+ bool *changed = NULL)
{
modref_ref_node <T> *ref_node;
@@ -67,17 +192,14 @@ struct GTY((user)) modref_base_node
if (every_ref)
return NULL;
- if (!ref)
- {
- collapse ();
- return NULL;
- }
-
/* Otherwise, insert a node for the ref of the access under the base. */
ref_node = search (ref);
if (ref_node)
return ref_node;
+ if (changed)
+ *changed = true;
+
/* Collapse the node if too full already. */
if (refs && refs->length () >= max_refs)
{
@@ -95,12 +217,36 @@ struct GTY((user)) modref_base_node
void collapse ()
{
- vec_free (refs);
+ size_t i;
+ modref_ref_node <T> *r;
+
+ if (refs)
+ {
+ FOR_EACH_VEC_SAFE_ELT (refs, i, r)
+ {
+ r->collapse ();
+ ggc_free (r);
+ }
+ vec_free (refs);
+ }
refs = NULL;
every_ref = true;
}
};
+/* Map translating parameters across function call. */
+
+struct modref_parm_map
+{
+ /* Index of parameter we translate to.
+ -1 indicates that parameter is unknown
+ -2 indicates that parmaeter points to local memory and access can be
+ discarded. */
+ int parm_index;
+ bool parm_offset_known;
+ poly_int64 parm_offset;
+};
+
/* Access tree for a single function. */
template <typename T>
struct GTY((user)) modref_tree
@@ -108,15 +254,21 @@ struct GTY((user)) modref_tree
vec <modref_base_node <T> *, va_gc> *bases;
size_t max_bases;
size_t max_refs;
+ size_t max_accesses;
bool every_base;
- modref_tree (size_t max_bases, size_t max_refs):
+ modref_tree (size_t max_bases, size_t max_refs, size_t max_accesses):
bases (NULL),
max_bases (max_bases),
max_refs (max_refs),
+ max_accesses (max_accesses),
every_base (false) {}
- modref_base_node <T> *insert_base (T base)
+ /* Insert BASE; collapse tree if there are more than MAX_REFS.
+ Return inserted base and if CHANGED is non-null set it to true if
+ something changed. */
+
+ modref_base_node <T> *insert_base (T base, bool *changed = NULL)
{
modref_base_node <T> *base_node;
@@ -129,6 +281,9 @@ struct GTY((user)) modref_tree
if (base_node)
return base_node;
+ if (changed)
+ *changed = true;
+
/* Collapse the node if too full already. */
if (bases && bases->length () >= max_bases)
{
@@ -144,63 +299,204 @@ struct GTY((user)) modref_tree
return base_node;
}
- /* Insert memory access to the tree. */
- void insert (T base, T ref)
+ /* Insert memory access to the tree.
+ Return true if something changed. */
+ bool insert (T base, T ref, modref_access_node a)
{
- modref_base_node <T> *base_node;
+ if (every_base)
+ return false;
- base_node = insert_base (base);
+ bool changed = false;
- if (!base && !ref)
+ /* No useful information tracked; collapse everything. */
+ if (!base && !ref && !a.useful_p ())
{
collapse ();
- return;
+ return true;
}
- if (!base_node)
- return;
- gcc_assert (search (base) != NULL);
- base_node->insert_ref (ref, max_refs);
- if (!base && base_node->every_ref)
+ modref_base_node <T> *base_node = insert_base (base, &changed);
+ if (!base_node || base_node->every_ref)
+ return changed;
+ gcc_checking_assert (search (base) != NULL);
+
+ /* No useful ref info tracked; collapse base. */
+ if (!ref && !a.useful_p ())
{
- collapse ();
- return;
+ base_node->collapse ();
+ return true;
+ }
+
+ modref_ref_node <T> *ref_node = base_node->insert_ref (ref, max_refs,
+ &changed);
+
+ /* If we failed to insert ref, just see if there is a cleanup possible. */
+ if (!ref_node)
+ {
+ /* No useful ref information and no useful base; collapse everyting. */
+ if (!base && base_node->every_ref)
+ {
+ collapse ();
+ gcc_checking_assert (changed);
+ }
+ else if (changed)
+ cleanup ();
+ }
+ else
+ {
+ if (ref_node->every_access)
+ return changed;
+ changed |= ref_node->insert_access (a, max_accesses);
+ /* See if we failed to add useful access. */
+ if (ref_node->every_access)
+ {
+ /* Collapse everything if there is no useful base and ref. */
+ if (!base && !ref)
+ {
+ collapse ();
+ gcc_checking_assert (changed);
+ }
+ /* Collapse base if there is no useful ref. */
+ else if (!ref)
+ {
+ base_node->collapse ();
+ gcc_checking_assert (changed);
+ }
+ }
}
+ return changed;
}
- /* Merge OTHER into the tree. */
- void merge (modref_tree <T> *other)
+ /* Remove tree branches that are not useful (i.e. they will allways pass). */
+
+ void cleanup ()
+ {
+ size_t i, j;
+ modref_base_node <T> *base_node;
+ modref_ref_node <T> *ref_node;
+
+ if (!bases)
+ return;
+
+ for (i = 0; vec_safe_iterate (bases, i, &base_node);)
+ {
+ if (base_node->refs)
+ for (j = 0; vec_safe_iterate (base_node->refs, j, &ref_node);)
+ {
+ if (!ref_node->every_access
+ && (!ref_node->accesses
+ || !ref_node->accesses->length ()))
+ {
+ base_node->refs->unordered_remove (j);
+ vec_free (ref_node->accesses);
+ ggc_delete (ref_node);
+ }
+ else
+ j++;
+ }
+ if (!base_node->every_ref
+ && (!base_node->refs || !base_node->refs->length ()))
+ {
+ bases->unordered_remove (i);
+ vec_free (base_node->refs);
+ ggc_delete (base_node);
+ }
+ else
+ i++;
+ }
+ if (bases && !bases->length ())
+ {
+ vec_free (bases);
+ bases = NULL;
+ }
+ }
+
+ /* Merge OTHER into the tree.
+ PARM_MAP, if non-NULL, maps parm indexes of callee to caller. -2 is used
+ to signalize that parameter is local and does not need to be tracked.
+ Return true if something has changed. */
+ bool merge (modref_tree <T> *other, vec <modref_parm_map> *parm_map)
{
- if (!other)
- return;
+ if (!other || every_base)
+ return false;
if (other->every_base)
{
collapse ();
- return;
+ return true;
}
- size_t i, j;
+ bool changed = false;
+ size_t i, j, k;
modref_base_node <T> *base_node, *my_base_node;
- modref_ref_node <T> *ref_node, *my_ref_node;
- FOR_EACH_VEC_SAFE_ELT (other->bases, i, base_node)
+ modref_ref_node <T> *ref_node;
+ modref_access_node *access_node;
+ bool release = false;
+
+ /* For self-recursive functions we may end up merging summary into itself;
+ produce copy first so we do not modify summary under our own hands. */
+ if (other == this)
{
- my_base_node = insert_base (base_node->base);
- if (!my_base_node)
- continue;
+ release = true;
+ other = modref_tree<T>::create_ggc (max_bases, max_refs, max_accesses);
+ other->copy_from (this);
+ }
+ FOR_EACH_VEC_SAFE_ELT (other->bases, i, base_node)
+ {
if (base_node->every_ref)
{
- my_base_node->collapse ();
- continue;
- }
-
- FOR_EACH_VEC_SAFE_ELT (base_node->refs, j, ref_node)
- {
- my_ref_node = my_base_node->insert_ref (ref_node->ref, max_refs);
- if (!my_ref_node)
- continue;
+ my_base_node = insert_base (base_node->base, &changed);
+ if (my_base_node && !my_base_node->every_ref)
+ {
+ my_base_node->collapse ();
+ cleanup ();
+ changed = true;
+ }
}
+ else
+ FOR_EACH_VEC_SAFE_ELT (base_node->refs, j, ref_node)
+ {
+ if (ref_node->every_access)
+ {
+ changed |= insert (base_node->base,
+ ref_node->ref,
+ unspecified_modref_access_node);
+ }
+ else
+ FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node)
+ {
+ modref_access_node a = *access_node;
+
+ if (a.parm_index != -1 && parm_map)
+ {
+ if (a.parm_index >= (int)parm_map->length ())
+ a.parm_index = -1;
+ else if ((*parm_map) [a.parm_index].parm_index == -2)
+ continue;
+ else
+ {
+ a.parm_offset
+ += (*parm_map) [a.parm_index].parm_offset;
+ a.parm_offset_known
+ &= (*parm_map)
+ [a.parm_index].parm_offset_known;
+ a.parm_index
+ = (*parm_map) [a.parm_index].parm_index;
+ }
+ }
+ changed |= insert (base_node->base, ref_node->ref, a);
+ }
+ }
}
+ if (release)
+ ggc_delete (other);
+ return changed;
+ }
+
+ /* Copy OTHER to THIS. */
+ void copy_from (modref_tree <T> *other)
+ {
+ merge (other, NULL);
}
/* Search BASE in tree; return NULL if failed. */
@@ -214,12 +510,40 @@ struct GTY((user)) modref_tree
return NULL;
}
+ /* Return ggc allocated instance. We explicitly call destructors via
+ ggc_delete and do not want finalizers to be registered and
+ called at the garbage collection time. */
+ static modref_tree<T> *create_ggc (size_t max_bases, size_t max_refs,
+ size_t max_accesses)
+ {
+ return new (ggc_alloc_no_dtor<modref_tree<T>> ())
+ modref_tree<T> (max_bases, max_refs, max_accesses);
+ }
+
+ /* Remove all records and mark tree to alias with everything. */
void collapse ()
{
- vec_free (bases);
+ size_t i;
+ modref_base_node <T> *n;
+
+ if (bases)
+ {
+ FOR_EACH_VEC_SAFE_ELT (bases, i, n)
+ {
+ n->collapse ();
+ ggc_free (n);
+ }
+ vec_free (bases);
+ }
bases = NULL;
every_base = true;
}
+
+ /* Release memory. */
+ ~modref_tree ()
+ {
+ collapse ();
+ }
};
void modref_c_tests ();
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index af0b710..3a70965 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -20,14 +20,8 @@ along with GCC; see the file COPYING3. If not see
/* Mod/ref pass records summary about loads and stores performed by the
function. This is later used by alias analysis to disambiguate memory
- accesses across function calls. The summary has a form of decision tree and
- contains:
-
- - base alias set
- and for each:
- - ref alias set
-
- In future more information will be tracked.
+ accesses across function calls. The summary has a form of decision tree
+ described in ipa-modref-tree.h.
This file contains a tree pass and an IPA pass. Both performs the same
analys however tree pass is executed during early and late optimization
@@ -35,10 +29,10 @@ along with GCC; see the file COPYING3. If not see
propagates across the callgraph and is able to handle recursion and works on
whole program during link-time analysis.
- LTO mode differs from the local mode by not recroding alias sets but types
+ LTO mode differs from the local mode by not recording alias sets but types
that are translated to alias sets later. This is necessary in order stream
- the information becaue the alias sets are rebuild at stream-in time and may
- not correspond to ones seen during analsis. For this reason part of analysis
+ the information because the alias sets are rebuild at stream-in time and may
+ not correspond to ones seen during analysis. For this reason part of analysis
is duplicated. */
#include "config.h"
@@ -62,6 +56,9 @@ along with GCC; see the file COPYING3. If not see
#include "calls.h"
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
+#include "value-range.h"
+#include "ipa-prop.h"
+#include "ipa-fnsummary.h"
/* Class (from which there is one global instance) that holds modref summaries
for all analyzed functions. */
@@ -76,21 +73,56 @@ public:
cgraph_node *dst_node,
modref_summary *src_data,
modref_summary *dst_data);
- /* This flag controls whether newly inserted functions should be analyzed
- in IPA or normal mode. Functions inserted betweehn IPA analysis and
- ipa-modref pass execution needs to be analyzed in IPA mode while all
- other insertions leads to normal analysis. */
- bool ipa;
+ static modref_summaries *create_ggc (symbol_table *symtab)
+ {
+ return new (ggc_alloc_no_dtor<modref_summaries> ())
+ modref_summaries (symtab);
+ }
+};
+
+class modref_summary_lto;
+
+/* Class (from which there is one global instance) that holds modref summaries
+ for all analyzed functions. */
+class GTY((user)) modref_summaries_lto
+ : public fast_function_summary <modref_summary_lto *, va_gc>
+{
+public:
+ modref_summaries_lto (symbol_table *symtab)
+ : fast_function_summary <modref_summary_lto *, va_gc> (symtab),
+ propagated (false) {}
+ virtual void insert (cgraph_node *, modref_summary_lto *state);
+ virtual void duplicate (cgraph_node *src_node,
+ cgraph_node *dst_node,
+ modref_summary_lto *src_data,
+ modref_summary_lto *dst_data);
+ static modref_summaries_lto *create_ggc (symbol_table *symtab)
+ {
+ return new (ggc_alloc_no_dtor<modref_summaries_lto> ())
+ modref_summaries_lto (symtab);
+ }
+ bool propagated;
};
-/* Global variable holding all modref summaries. */
-static GTY(()) fast_function_summary <modref_summary *, va_gc> *summaries;
+/* Global variable holding all modref summaries
+ (from analysis to IPA propagation time). */
+static GTY(()) fast_function_summary <modref_summary *, va_gc>
+ *summaries;
+
+/* Global variable holding all modref optimizaiton summaries
+ (from IPA propagation time or used by local optimization pass). */
+static GTY(()) fast_function_summary <modref_summary *, va_gc>
+ *optimization_summaries;
+
+/* LTO summaries hold info from analysis to LTO streaming or from LTO
+ stream-in through propagation to LTO stream-out. */
+static GTY(()) fast_function_summary <modref_summary_lto *, va_gc>
+ *summaries_lto;
/* Summary for a single function which this pass produces. */
modref_summary::modref_summary ()
- : loads (NULL), stores (NULL), loads_lto (NULL),
- stores_lto (NULL), finished (0)
+ : loads (NULL), stores (NULL)
{
}
@@ -100,10 +132,95 @@ modref_summary::~modref_summary ()
ggc_delete (loads);
if (stores)
ggc_delete (stores);
- if (loads_lto)
- ggc_delete (loads_lto);
- if (stores_lto)
- ggc_delete (stores_lto);
+}
+
+/* Return true if summary is potentially useful for optimization. */
+
+bool
+modref_summary::useful_p (int ecf_flags)
+{
+ if (ecf_flags & (ECF_CONST | ECF_NOVOPS))
+ return false;
+ if (loads && !loads->every_base)
+ return true;
+ if (ecf_flags & ECF_PURE)
+ return false;
+ return stores && !stores->every_base;
+}
+
+/* Single function summary used for LTO. */
+
+typedef modref_tree <tree> modref_records_lto;
+struct GTY(()) modref_summary_lto
+{
+ /* Load and stores in functions using types rather then alias sets.
+
+ This is necessary to make the information streamable for LTO but is also
+ more verbose and thus more likely to hit the limits. */
+ modref_records_lto *loads;
+ modref_records_lto *stores;
+
+ modref_summary_lto ();
+ ~modref_summary_lto ();
+ void dump (FILE *);
+ bool useful_p (int ecf_flags);
+};
+
+/* Summary for a single function which this pass produces. */
+
+modref_summary_lto::modref_summary_lto ()
+ : loads (NULL), stores (NULL)
+{
+}
+
+modref_summary_lto::~modref_summary_lto ()
+{
+ if (loads)
+ ggc_delete (loads);
+ if (stores)
+ ggc_delete (stores);
+}
+
+
+/* Return true if lto summary is potentially useful for optimization. */
+
+bool
+modref_summary_lto::useful_p (int ecf_flags)
+{
+ if (ecf_flags & (ECF_CONST | ECF_NOVOPS))
+ return false;
+ if (loads && !loads->every_base)
+ return true;
+ if (ecf_flags & ECF_PURE)
+ return false;
+ return stores && !stores->every_base;
+}
+
+/* Dump A to OUT. */
+
+static void
+dump_access (modref_access_node *a, FILE *out)
+{
+ fprintf (out, " access:");
+ if (a->parm_index != -1)
+ {
+ fprintf (out, " Parm %i", a->parm_index);
+ if (a->parm_offset_known)
+ {
+ fprintf (out, " param offset:");
+ print_dec ((poly_int64_pod)a->parm_offset, out, SIGNED);
+ }
+ }
+ if (a->range_info_useful_p ())
+ {
+ fprintf (out, " offset:");
+ print_dec ((poly_int64_pod)a->offset, out, SIGNED);
+ fprintf (out, " size:");
+ print_dec ((poly_int64_pod)a->size, out, SIGNED);
+ fprintf (out, " max_size:");
+ print_dec ((poly_int64_pod)a->max_size, out, SIGNED);
+ }
+ fprintf (out, "\n");
}
/* Dump records TT to OUT. */
@@ -133,6 +250,15 @@ dump_records (modref_records *tt, FILE *out)
FOR_EACH_VEC_SAFE_ELT (n->refs, j, r)
{
fprintf (out, " Ref %i: alias set %i\n", (int)j, r->ref);
+ if (r->every_access)
+ {
+ fprintf (out, " Every access\n");
+ continue;
+ }
+ size_t k;
+ modref_access_node *a;
+ FOR_EACH_VEC_SAFE_ELT (r->accesses, k, a)
+ dump_access (a, out);
}
}
}
@@ -170,6 +296,15 @@ dump_lto_records (modref_records_lto *tt, FILE *out)
print_generic_expr (dump_file, r->ref);
fprintf (out, " (alias set %i)\n",
r->ref ? get_alias_set (r->ref) : 0);
+ if (r->every_access)
+ {
+ fprintf (out, " Every access\n");
+ continue;
+ }
+ size_t k;
+ modref_access_node *a;
+ FOR_EACH_VEC_SAFE_ELT (r->accesses, k, a)
+ dump_access (a, out);
}
}
}
@@ -179,28 +314,22 @@ dump_lto_records (modref_records_lto *tt, FILE *out)
void
modref_summary::dump (FILE *out)
{
- if (loads)
- {
- fprintf (out, " loads:\n");
- dump_records (loads, out);
- }
- if (stores)
- {
- fprintf (out, " stores:\n");
- dump_records (stores, out);
- }
- if (loads_lto)
- {
- fprintf (out, " LTO loads:\n");
- dump_lto_records (loads_lto, out);
- }
- if (stores_lto)
- {
- fprintf (out, " LTO stores:\n");
- dump_lto_records (stores_lto, out);
- }
+ fprintf (out, " loads:\n");
+ dump_records (loads, out);
+ fprintf (out, " stores:\n");
+ dump_records (stores, out);
}
+/* Dump summary. */
+
+void
+modref_summary_lto::dump (FILE *out)
+{
+ fprintf (out, " loads:\n");
+ dump_lto_records (loads, out);
+ fprintf (out, " stores:\n");
+ dump_lto_records (stores, out);
+}
/* Get function summary for FUNC if it exists, return NULL otherwise. */
@@ -208,7 +337,7 @@ modref_summary *
get_modref_function_summary (cgraph_node *func)
{
/* Avoid creation of the summary too early (e.g. when front-end calls us). */
- if (!summaries)
+ if (!optimization_summaries)
return NULL;
/* A single function body may be represented by multiple symbols with
@@ -221,13 +350,53 @@ get_modref_function_summary (cgraph_node *func)
if (avail <= AVAIL_INTERPOSABLE)
return NULL;
- /* Attempt to get summary for FUNC. If analysis of FUNC hasn't finished yet,
- don't return anything. */
- modref_summary *r = summaries->get (func);
- if (r && r->finished)
- return r;
+ modref_summary *r = optimization_summaries->get (func);
+ return r;
+}
+
+/* Construct modref_access_node from REF. */
+static modref_access_node
+get_access (ao_ref *ref)
+{
+ tree base;
- return NULL;
+ base = ao_ref_base (ref);
+ modref_access_node a = {ref->offset, ref->size, ref->max_size,
+ 0, -1, false};
+ if (TREE_CODE (base) == MEM_REF || TREE_CODE (base) == TARGET_MEM_REF)
+ {
+ tree memref = base;
+ base = TREE_OPERAND (base, 0);
+ if (TREE_CODE (base) == SSA_NAME
+ && SSA_NAME_IS_DEFAULT_DEF (base)
+ && TREE_CODE (SSA_NAME_VAR (base)) == PARM_DECL)
+ {
+ a.parm_index = 0;
+ for (tree t = DECL_ARGUMENTS (current_function_decl);
+ t != SSA_NAME_VAR (base); t = DECL_CHAIN (t))
+ {
+ if (!t)
+ {
+ a.parm_index = -1;
+ break;
+ }
+ a.parm_index++;
+ }
+ if (TREE_CODE (memref) == MEM_REF)
+ {
+ a.parm_offset_known
+ = wi::to_poly_wide (TREE_OPERAND
+ (memref, 1)).to_shwi (&a.parm_offset);
+ }
+ else
+ a.parm_offset_known = false;
+ }
+ else
+ a.parm_index = -1;
+ }
+ else
+ a.parm_index = -1;
+ return a;
}
/* Record access into the modref_records data structure. */
@@ -239,12 +408,13 @@ record_access (modref_records *tt, ao_ref *ref)
: ao_ref_base_alias_set (ref);
alias_set_type ref_set = !flag_strict_aliasing ? 0
: (ao_ref_alias_set (ref));
+ modref_access_node a = get_access (ref);
if (dump_file)
{
- fprintf (dump_file, " - Recording base_set=%i ref_set=%i\n",
- base_set, ref_set);
+ fprintf (dump_file, " - Recording base_set=%i ref_set=%i parm=%i\n",
+ base_set, ref_set, a.parm_index);
}
- tt->insert (base_set, ref_set);
+ tt->insert (base_set, ref_set, a);
}
/* IPA version of record_access_tree. */
@@ -297,6 +467,7 @@ record_access_lto (modref_records_lto *tt, ao_ref *ref)
|| variably_modified_type_p (ref_type, NULL_TREE)))
ref_type = NULL_TREE;
}
+ modref_access_node a = get_access (ref);
if (dump_file)
{
fprintf (dump_file, " - Recording base type:");
@@ -304,11 +475,12 @@ record_access_lto (modref_records_lto *tt, ao_ref *ref)
fprintf (dump_file, " (alias set %i) ref type:",
base_type ? get_alias_set (base_type) : 0);
print_generic_expr (dump_file, ref_type);
- fprintf (dump_file, " (alias set %i)\n",
- ref_type ? get_alias_set (ref_type) : 0);
+ fprintf (dump_file, " (alias set %i) parm:%i\n",
+ ref_type ? get_alias_set (ref_type) : 0,
+ a.parm_index);
}
- tt->insert (base_type, ref_type);
+ tt->insert (base_type, ref_type, a);
}
/* Returns true if and only if we should store the access to EXPR.
@@ -317,36 +489,12 @@ record_access_lto (modref_records_lto *tt, ao_ref *ref)
static bool
record_access_p (tree expr)
{
- /* Non-escaping memory is fine */
- tree t = get_base_address (expr);
- if (t && (INDIRECT_REF_P (t)
- || TREE_CODE (t) == MEM_REF
- || TREE_CODE (t) == TARGET_MEM_REF)
- && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
- && !ptr_deref_may_alias_global_p (TREE_OPERAND (t, 0)))
- {
- if (dump_file)
- fprintf (dump_file, " - Non-escaping memory, ignoring.\n");
- return false;
- }
-
- /* Automatic variables are fine. */
- if (DECL_P (t)
- && auto_var_in_fn_p (t, current_function_decl))
- {
- if (dump_file)
- fprintf (dump_file, " - Automatic variable, ignoring.\n");
- return false;
- }
-
- /* Read-only variables are fine. */
- if (DECL_P (t) && TREE_READONLY (t))
+ if (refs_local_or_readonly_memory_p (expr))
{
if (dump_file)
- fprintf (dump_file, " - Read-only variable, ignoring.\n");
+ fprintf (dump_file, " - Read-only or local, ignoring.\n");
return false;
}
-
return true;
}
@@ -363,11 +511,81 @@ ignore_stores_p (tree caller, int flags)
return false;
}
-/* Analyze function call STMT in function F. */
+/* Merge side effects of call STMT to function with CALLEE_SUMMARY
+ int CUR_SUMMARY. Return true if something changed.
+ If IGNORE_STORES is true, do not merge stores. */
+
+bool
+merge_call_side_effects (modref_summary *cur_summary,
+ gimple *stmt, modref_summary *callee_summary,
+ bool ignore_stores, cgraph_node *callee_node)
+{
+ auto_vec <modref_parm_map, 32> parm_map;
+ bool changed = false;
+
+ if (dump_file)
+ fprintf (dump_file, " - Merging side effects of %s with parm map:",
+ callee_node->dump_name ());
+
+ parm_map.safe_grow_cleared (gimple_call_num_args (stmt));
+ for (unsigned i = 0; i < gimple_call_num_args (stmt); i++)
+ {
+ tree op = gimple_call_arg (stmt, i);
+ bool offset_known;
+ poly_int64 offset;
+
+ offset_known = unadjusted_ptr_and_unit_offset (op, &op, &offset);
+ if (TREE_CODE (op) == SSA_NAME
+ && SSA_NAME_IS_DEFAULT_DEF (op)
+ && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL)
+ {
+ int index = 0;
+ for (tree t = DECL_ARGUMENTS (current_function_decl);
+ t != SSA_NAME_VAR (op); t = DECL_CHAIN (t))
+ {
+ if (!t)
+ {
+ index = -1;
+ break;
+ }
+ index++;
+ }
+ parm_map[i].parm_index = index;
+ parm_map[i].parm_offset_known = offset_known;
+ parm_map[i].parm_offset = offset;
+ }
+ else if (points_to_local_or_readonly_memory_p (op))
+ parm_map[i].parm_index = -2;
+ else
+ parm_map[i].parm_index = -1;
+ if (dump_file)
+ {
+ fprintf (dump_file, " %i", parm_map[i].parm_index);
+ if (parm_map[i].parm_offset_known)
+ {
+ fprintf (dump_file, " offset:");
+ print_dec ((poly_int64_pod)parm_map[i].parm_offset,
+ dump_file, SIGNED);
+ }
+ }
+ }
+ if (dump_file)
+ fprintf (dump_file, "\n");
+
+ /* Merge with callee's summary. */
+ changed |= cur_summary->loads->merge (callee_summary->loads, &parm_map);
+ if (!ignore_stores)
+ changed |= cur_summary->stores->merge (callee_summary->stores,
+ &parm_map);
+ return changed;
+}
+
+/* Analyze function call STMT in function F.
+ Remember recursive calls in RECURSIVE_CALLS. */
static bool
analyze_call (modref_summary *cur_summary,
- gimple *stmt)
+ gimple *stmt, vec <gimple *> *recursive_calls)
{
/* Check flags on the function call. In certain cases, analysis can be
simplified. */
@@ -400,10 +618,7 @@ analyze_call (modref_summary *cur_summary,
if (dump_file)
fprintf (dump_file, " - Indirect call which does not write memory, "
"discarding loads.\n");
- if (cur_summary->loads)
- cur_summary->loads->collapse ();
- if (cur_summary->loads_lto)
- cur_summary->loads_lto->collapse ();
+ cur_summary->loads->collapse ();
return true;
}
if (dump_file)
@@ -413,7 +628,7 @@ analyze_call (modref_summary *cur_summary,
struct cgraph_node *callee_node = cgraph_node::get_create (callee);
- /* We can not safely optimize based on summary of calle if it does
+ /* We can not safely optimize based on summary of callee if it does
not always bind to current def: it is possible that memory load
was optimized out earlier which may not happen in the interposed
variant. */
@@ -421,16 +636,14 @@ analyze_call (modref_summary *cur_summary,
{
if (dump_file)
fprintf (dump_file, " - May be interposed: collapsing loads.\n");
- if (cur_summary->loads)
- cur_summary->loads->collapse ();
- if (cur_summary->loads_lto)
- cur_summary->loads_lto->collapse ();
+ cur_summary->loads->collapse ();
}
/* If this is a recursive call, the target summary is the same as ours, so
there's nothing to do. */
if (recursive_call_p (current_function_decl, callee))
{
+ recursive_calls->safe_push (stmt);
if (dump_file)
fprintf (dump_file, " - Skipping recursive call.\n");
return true;
@@ -447,10 +660,7 @@ analyze_call (modref_summary *cur_summary,
symbols. */
if (ignore_stores)
{
- if (cur_summary->loads)
- cur_summary->loads->collapse ();
- if (cur_summary->loads_lto)
- cur_summary->loads_lto->collapse ();
+ cur_summary->loads->collapse ();
return true;
}
if (dump_file)
@@ -460,15 +670,12 @@ analyze_call (modref_summary *cur_summary,
/* Get callee's modref summary. As above, if there's no summary, we either
have to give up or, if stores are ignored, we can just purge loads. */
- modref_summary *callee_summary = summaries->get (callee_node);
+ modref_summary *callee_summary = optimization_summaries->get (callee_node);
if (!callee_summary)
{
if (ignore_stores)
{
- if (cur_summary->loads)
- cur_summary->loads->collapse ();
- if (cur_summary->loads_lto)
- cur_summary->loads_lto->collapse ();
+ cur_summary->loads->collapse ();
return true;
}
if (dump_file)
@@ -476,28 +683,27 @@ analyze_call (modref_summary *cur_summary,
return false;
}
- /* Merge with callee's summary. */
- if (cur_summary->loads)
- cur_summary->loads->merge (callee_summary->loads);
- if (cur_summary->loads_lto)
- cur_summary->loads_lto->merge (callee_summary->loads_lto);
- if (!ignore_stores)
- {
- if (cur_summary->stores)
- cur_summary->stores->merge (callee_summary->stores);
- if (cur_summary->stores_lto)
- cur_summary->stores_lto->merge (callee_summary->stores_lto);
- }
+ merge_call_side_effects (cur_summary, stmt, callee_summary, ignore_stores,
+ callee_node);
return true;
}
+/* Support analyzis in non-lto and lto mode in parallel. */
+
+struct summary_ptrs
+{
+ struct modref_summary *nolto;
+ struct modref_summary_lto *lto;
+};
+
/* Helper for analyze_stmt. */
static bool
analyze_load (gimple *, tree, tree op, void *data)
{
- modref_summary *summary = (modref_summary *)data;
+ modref_summary *summary = ((summary_ptrs *)data)->nolto;
+ modref_summary_lto *summary_lto = ((summary_ptrs *)data)->lto;
if (dump_file)
{
@@ -512,10 +718,10 @@ analyze_load (gimple *, tree, tree op, void *data)
ao_ref r;
ao_ref_init (&r, op);
- if (summary->loads)
+ if (summary)
record_access (summary->loads, &r);
- if (summary->loads_lto)
- record_access_lto (summary->loads_lto, &r);
+ if (summary_lto)
+ record_access_lto (summary_lto->loads, &r);
return false;
}
@@ -524,7 +730,8 @@ analyze_load (gimple *, tree, tree op, void *data)
static bool
analyze_store (gimple *, tree, tree op, void *data)
{
- modref_summary *summary = (modref_summary *)data;
+ modref_summary *summary = ((summary_ptrs *)data)->nolto;
+ modref_summary_lto *summary_lto = ((summary_ptrs *)data)->lto;
if (dump_file)
{
@@ -539,10 +746,10 @@ analyze_store (gimple *, tree, tree op, void *data)
ao_ref r;
ao_ref_init (&r, op);
- if (summary->stores)
- record_access (((modref_summary *)data)->stores, &r);
- if (summary->stores_lto)
- record_access_lto (((modref_summary *)data)->stores_lto, &r);
+ if (summary)
+ record_access (summary->stores, &r);
+ if (summary_lto)
+ record_access_lto (summary_lto->stores, &r);
return false;
}
@@ -550,12 +757,21 @@ analyze_store (gimple *, tree, tree op, void *data)
If IPA is true do not merge in side effects of calls. */
static bool
-analyze_stmt (modref_summary *summary, gimple *stmt, bool ipa)
+analyze_stmt (modref_summary *summary, modref_summary_lto *summary_lto,
+ gimple *stmt, bool ipa, vec <gimple *> *recursive_calls)
{
+ /* In general we can not ignore clobbers because they are barries for code
+ motion, however after inlining it is safe to do becuase local optimization
+ passes do not consider clobbers from other functions.
+ Similar logic is in ipa-pure-consts. */
+ if ((ipa || cfun->after_inlining) && gimple_clobber_p (stmt))
+ return true;
+
+ struct summary_ptrs sums = {summary, summary_lto};
+
/* Analyze all loads and stores in STMT. */
- walk_stmt_load_store_ops (stmt, summary,
+ walk_stmt_load_store_ops (stmt, &sums,
analyze_load, analyze_store);
- /* or call analyze_load_ipa, analyze_store_ipa */
switch (gimple_code (stmt))
{
@@ -570,7 +786,7 @@ analyze_stmt (modref_summary *summary, gimple *stmt, bool ipa)
return false;
case GIMPLE_CALL:
if (!ipa)
- return analyze_call (summary, stmt);
+ return analyze_call (summary, stmt, recursive_calls);
return true;
default:
/* Nothing to do for other types of statements. */
@@ -578,40 +794,103 @@ analyze_stmt (modref_summary *summary, gimple *stmt, bool ipa)
}
}
-/* Analyze function F. IPA indicates whether we're running in tree mode (false)
- or the IPA mode (true). */
+/* Remove summary of current function because during the function body
+ scan we determined it is not useful. LTO, NOLTO and IPA determines the
+ mode of scan. */
+
+static void
+remove_summary (bool lto, bool nolto, bool ipa)
+{
+ cgraph_node *fnode = cgraph_node::get (current_function_decl);
+ if (!ipa)
+ optimization_summaries->remove (fnode);
+ else
+ {
+ if (nolto)
+ summaries->remove (fnode);
+ if (lto)
+ summaries_lto->remove (fnode);
+ }
+ if (dump_file)
+ fprintf (dump_file,
+ " - modref done with result: not tracked.\n");
+}
+
+/* Analyze function F. IPA indicates whether we're running in local mode
+ (false) or the IPA mode (true). */
static void
analyze_function (function *f, bool ipa)
{
if (dump_file)
- fprintf (dump_file, "modref analyzing '%s' (ipa=%i)...\n",
- function_name (f), ipa);
+ fprintf (dump_file, "modref analyzing '%s' (ipa=%i)%s%s\n",
+ function_name (f), ipa,
+ TREE_READONLY (current_function_decl) ? " (const)" : "",
+ DECL_PURE_P (current_function_decl) ? " (pure)" : "");
/* Don't analyze this function if it's compiled with -fno-strict-aliasing. */
if (!flag_ipa_modref)
return;
- /* Initialize the summary. */
- if (!summaries)
- summaries = new (ggc_alloc <modref_summaries> ())
- modref_summaries (symtab);
- else /* Remove existing summary if we are re-running the pass. */
- summaries->remove (cgraph_node::get (f->decl));
-
- ((modref_summaries *)summaries)->ipa = ipa;
-
- modref_summary *summary = summaries->get_create (cgraph_node::get (f->decl));
-
/* Compute no-LTO summaries when local optimization is going to happen. */
bool nolto = (!ipa || ((!flag_lto || flag_fat_lto_objects) && !in_lto_p)
|| (in_lto_p && !flag_wpa
&& flag_incremental_link != INCREMENTAL_LINK_LTO));
-
/* Compute LTO when LTO streaming is going to happen. */
bool lto = ipa && ((flag_lto && !in_lto_p)
|| flag_wpa
|| flag_incremental_link == INCREMENTAL_LINK_LTO);
+ cgraph_node *fnode = cgraph_node::get (current_function_decl);
+
+ modref_summary *summary = NULL;
+ modref_summary_lto *summary_lto = NULL;
+
+ /* Initialize the summary.
+ If we run in local mode there is possibly pre-existing summary from
+ IPA pass. Dump it so it is easy to compare if mod-ref info has
+ improved. */
+ if (!ipa)
+ {
+ if (!optimization_summaries)
+ optimization_summaries = modref_summaries::create_ggc (symtab);
+ else /* Remove existing summary if we are re-running the pass. */
+ {
+ if (dump_file
+ && (summary
+ = optimization_summaries->get (cgraph_node::get (f->decl)))
+ != NULL
+ && summary->loads)
+ {
+ fprintf (dump_file, "Past summary:\n");
+ optimization_summaries->get
+ (cgraph_node::get (f->decl))->dump (dump_file);
+ }
+ optimization_summaries->remove (cgraph_node::get (f->decl));
+ }
+ summary = optimization_summaries->get_create (cgraph_node::get (f->decl));
+ gcc_checking_assert (nolto && !lto);
+ }
+ /* In IPA mode we analyze every function precisely once. Asser that. */
+ else
+ {
+ if (nolto)
+ {
+ if (!summaries)
+ summaries = modref_summaries::create_ggc (symtab);
+ else
+ summaries->remove (cgraph_node::get (f->decl));
+ summary = summaries->get_create (cgraph_node::get (f->decl));
+ }
+ if (lto)
+ {
+ if (!summaries_lto)
+ summaries_lto = modref_summaries_lto::create_ggc (symtab);
+ else
+ summaries_lto->remove (cgraph_node::get (f->decl));
+ summary_lto = summaries_lto->get_create (cgraph_node::get (f->decl));
+ }
+ }
+
/* Create and initialize summary for F.
Note that summaries may be already allocated from previous
@@ -619,30 +898,29 @@ analyze_function (function *f, bool ipa)
if (nolto)
{
gcc_assert (!summary->loads);
- summary->loads
- = new (ggc_alloc <modref_tree<alias_set_type> > ())
- modref_records (param_modref_max_bases,
- param_modref_max_refs);
+ summary->loads = modref_records::create_ggc (param_modref_max_bases,
+ param_modref_max_refs,
+ param_modref_max_accesses);
gcc_assert (!summary->stores);
- summary->stores
- = new (ggc_alloc <modref_tree<alias_set_type> > ())
- modref_records (param_modref_max_bases,
- param_modref_max_refs);
+ summary->stores = modref_records::create_ggc (param_modref_max_bases,
+ param_modref_max_refs,
+ param_modref_max_accesses);
}
if (lto)
{
- gcc_assert (!summary->loads_lto);
- summary->loads_lto
- = new (ggc_alloc <modref_tree<tree> > ())
- modref_records_lto (param_modref_max_bases,
- param_modref_max_refs);
- gcc_assert (!summary->stores_lto);
- summary->stores_lto
- = new (ggc_alloc <modref_tree<tree> > ())
- modref_records_lto (param_modref_max_bases,
- param_modref_max_refs);
+ gcc_assert (!summary_lto->loads);
+ summary_lto->loads = modref_records_lto::create_ggc
+ (param_modref_max_bases,
+ param_modref_max_refs,
+ param_modref_max_accesses);
+ gcc_assert (!summary_lto->stores);
+ summary_lto->stores = modref_records_lto::create_ggc
+ (param_modref_max_bases,
+ param_modref_max_refs,
+ param_modref_max_accesses);
}
- summary->finished = false;
+ int ecf_flags = flags_from_decl_or_type (current_function_decl);
+ auto_vec <gimple *, 32> recursive_calls;
/* Analyze each statement in each basic block of the function. If the
statement cannot be analyzed (for any reason), the entire function cannot
@@ -653,25 +931,62 @@ analyze_function (function *f, bool ipa)
gimple_stmt_iterator si;
for (si = gsi_after_labels (bb); !gsi_end_p (si); gsi_next (&si))
{
- if (!analyze_stmt (summary, gsi_stmt (si), ipa))
+ if (!analyze_stmt (summary, summary_lto,
+ gsi_stmt (si), ipa, &recursive_calls)
+ || ((!summary || !summary->useful_p (ecf_flags))
+ && (!summary_lto || !summary_lto->useful_p (ecf_flags))))
{
- cgraph_node *fnode = cgraph_node::get (current_function_decl);
- summaries->remove (fnode);
- if (dump_file)
- fprintf (dump_file,
- " - modref done with result: not tracked.\n");
+ remove_summary (lto, nolto, ipa);
return;
}
}
}
+ /* In non-IPA mode we need to perform iterative datafow on recursive calls.
+ This needs to be done after all other side effects are computed. */
if (!ipa)
- summary->finished = true;
+ {
+ bool changed = true;
+ while (changed)
+ {
+ changed = false;
+ for (unsigned i = 0; i < recursive_calls.length (); i++)
+ {
+ changed |= merge_call_side_effects
+ (summary, recursive_calls[i], summary,
+ ignore_stores_p (current_function_decl,
+ gimple_call_flags
+ (recursive_calls[i])),
+ fnode);
+ if (!summary->useful_p (ecf_flags))
+ {
+ remove_summary (lto, nolto, ipa);
+ return;
+ }
+ }
+ }
+ }
+ if (summary && !summary->useful_p (ecf_flags))
+ {
+ if (!ipa)
+ optimization_summaries->remove (fnode);
+ else
+ summaries->remove (fnode);
+ summary = NULL;
+ }
+ if (summary_lto && !summary_lto->useful_p (ecf_flags))
+ {
+ summaries_lto->remove (fnode);
+ summary_lto = NULL;
+ }
if (dump_file)
{
fprintf (dump_file, " - modref done with result: tracked.\n");
- summary->dump (dump_file);
+ if (summary)
+ summary->dump (dump_file);
+ if (summary_lto)
+ summary_lto->dump (dump_file);
}
}
@@ -697,53 +1012,84 @@ modref_generate (void)
void
modref_summaries::insert (struct cgraph_node *node, modref_summary *)
{
+ /* Local passes ought to be executed by the pass manager. */
+ if (this == optimization_summaries)
+ {
+ optimization_summaries->remove (node);
+ return;
+ }
if (!DECL_STRUCT_FUNCTION (node->decl))
- return;
+ {
+ summaries->remove (node);
+ return;
+ }
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
- analyze_function (DECL_STRUCT_FUNCTION (node->decl), ipa);
+ analyze_function (DECL_STRUCT_FUNCTION (node->decl), true);
+ pop_cfun ();
+}
+
+/* Called when a new function is inserted to callgraph late. */
+
+void
+modref_summaries_lto::insert (struct cgraph_node *node, modref_summary_lto *)
+{
+ /* We do not support adding new function when IPA information is already
+ propagated. This is done only by SIMD cloning that is not very
+ critical. */
+ if (!DECL_STRUCT_FUNCTION (node->decl)
+ || propagated)
+ {
+ summaries_lto->remove (node);
+ return;
+ }
+ push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ analyze_function (DECL_STRUCT_FUNCTION (node->decl), true);
pop_cfun ();
}
/* Called when new clone is inserted to callgraph late. */
void
-modref_summaries::duplicate (cgraph_node *, cgraph_node *,
+modref_summaries::duplicate (cgraph_node *, cgraph_node *dst,
modref_summary *src_data,
modref_summary *dst_data)
{
- dst_data->finished = src_data->finished;
- if (src_data->stores)
- {
- dst_data->stores = new (ggc_alloc <modref_tree<alias_set_type> > ())
- modref_records
- (src_data->stores->max_bases,
- src_data->stores->max_refs);
- dst_data->stores->merge (src_data->stores);
- }
- if (src_data->loads)
- {
- dst_data->loads = new (ggc_alloc <modref_tree<alias_set_type> > ())
- modref_records
- (src_data->loads->max_bases,
- src_data->loads->max_refs);
- dst_data->loads->merge (src_data->loads);
- }
- if (src_data->stores_lto)
- {
- dst_data->stores_lto = new (ggc_alloc <modref_tree<tree> > ())
- modref_records_lto
- (src_data->stores_lto->max_bases,
- src_data->stores_lto->max_refs);
- dst_data->stores_lto->merge (src_data->stores_lto);
- }
- if (src_data->loads_lto)
+ /* Do not duplicte optimization summaries; we do not handle parameter
+ transforms on them. */
+ if (this == optimization_summaries)
{
- dst_data->loads_lto = new (ggc_alloc <modref_tree<tree> > ())
- modref_records_lto
- (src_data->stores_lto->max_bases,
- src_data->stores_lto->max_refs);
- dst_data->loads_lto->merge (src_data->loads_lto);
+ optimization_summaries->remove (dst);
+ return;
}
+ dst_data->stores = modref_records::create_ggc
+ (src_data->stores->max_bases,
+ src_data->stores->max_refs,
+ src_data->stores->max_accesses);
+ dst_data->stores->copy_from (src_data->stores);
+ dst_data->loads = modref_records::create_ggc
+ (src_data->loads->max_bases,
+ src_data->loads->max_refs,
+ src_data->loads->max_accesses);
+ dst_data->loads->copy_from (src_data->loads);
+}
+
+/* Called when new clone is inserted to callgraph late. */
+
+void
+modref_summaries_lto::duplicate (cgraph_node *, cgraph_node *,
+ modref_summary_lto *src_data,
+ modref_summary_lto *dst_data)
+{
+ dst_data->stores = modref_records_lto::create_ggc
+ (src_data->stores->max_bases,
+ src_data->stores->max_refs,
+ src_data->stores->max_accesses);
+ dst_data->stores->copy_from (src_data->stores);
+ dst_data->loads = modref_records_lto::create_ggc
+ (src_data->loads->max_bases,
+ src_data->loads->max_refs,
+ src_data->loads->max_accesses);
+ dst_data->loads->copy_from (src_data->loads);
}
namespace
@@ -767,12 +1113,6 @@ class pass_modref : public gimple_opt_pass
pass_modref (gcc::context *ctxt)
: gimple_opt_pass (pass_data_modref, ctxt) {}
- ~pass_modref ()
- {
- ggc_delete (summaries);
- summaries = NULL;
- }
-
/* opt_pass methods: */
opt_pass *clone ()
{
@@ -792,6 +1132,7 @@ write_modref_records (modref_records_lto *tt, struct output_block *ob)
{
streamer_write_uhwi (ob, tt->max_bases);
streamer_write_uhwi (ob, tt->max_refs);
+ streamer_write_uhwi (ob, tt->max_accesses);
streamer_write_uhwi (ob, tt->every_base);
streamer_write_uhwi (ob, vec_safe_length (tt->bases));
@@ -803,11 +1144,32 @@ write_modref_records (modref_records_lto *tt, struct output_block *ob)
streamer_write_uhwi (ob, base_node->every_ref);
streamer_write_uhwi (ob, vec_safe_length (base_node->refs));
+
size_t j;
modref_ref_node <tree> *ref_node;
FOR_EACH_VEC_SAFE_ELT (base_node->refs, j, ref_node)
{
stream_write_tree (ob, ref_node->ref, true);
+ streamer_write_uhwi (ob, ref_node->every_access);
+ streamer_write_uhwi (ob, vec_safe_length (ref_node->accesses));
+
+ size_t k;
+ modref_access_node *access_node;
+ FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node)
+ {
+ streamer_write_hwi (ob, access_node->parm_index);
+ if (access_node->parm_index != -1)
+ {
+ streamer_write_uhwi (ob, access_node->parm_offset_known);
+ if (access_node->parm_offset_known)
+ {
+ streamer_write_poly_int64 (ob, access_node->parm_offset);
+ streamer_write_poly_int64 (ob, access_node->offset);
+ streamer_write_poly_int64 (ob, access_node->size);
+ streamer_write_poly_int64 (ob, access_node->max_size);
+ }
+ }
+ }
}
}
}
@@ -815,7 +1177,7 @@ write_modref_records (modref_records_lto *tt, struct output_block *ob)
/* Read a modref_tree from the input block IB using the data from DATA_IN.
This assumes that the tree was encoded using write_modref_tree.
Either nolto_ret or lto_ret is initialized by the tree depending whether
- LTO streaming is expcted or not. */
+ LTO streaming is expected or not. */
void
read_modref_records (lto_input_block *ib, struct data_in *data_in,
@@ -824,15 +1186,15 @@ read_modref_records (lto_input_block *ib, struct data_in *data_in,
{
size_t max_bases = streamer_read_uhwi (ib);
size_t max_refs = streamer_read_uhwi (ib);
+ size_t max_accesses = streamer_read_uhwi (ib);
- /* Decide whether we want to turn LTO data types to non-LTO (i.e. when
- LTO re-streaming is not going to happen). */
- if (flag_wpa || flag_incremental_link == INCREMENTAL_LINK_LTO)
- *lto_ret = new (ggc_alloc <modref_records_lto> ()) modref_records_lto
- (max_bases, max_refs);
- else
- *nolto_ret = new (ggc_alloc <modref_records> ()) modref_records
- (max_bases, max_refs);
+ if (lto_ret)
+ *lto_ret = modref_records_lto::create_ggc (max_bases, max_refs,
+ max_accesses);
+ if (nolto_ret)
+ *nolto_ret = modref_records::create_ggc (max_bases, max_refs,
+ max_accesses);
+ gcc_checking_assert (lto_ret || nolto_ret);
size_t every_base = streamer_read_uhwi (ib);
size_t nbase = streamer_read_uhwi (ib);
@@ -840,9 +1202,9 @@ read_modref_records (lto_input_block *ib, struct data_in *data_in,
gcc_assert (!every_base || nbase == 0);
if (every_base)
{
- if (*nolto_ret)
+ if (nolto_ret)
(*nolto_ret)->collapse ();
- if (*lto_ret)
+ if (lto_ret)
(*lto_ret)->collapse ();
}
for (size_t i = 0; i < nbase; i++)
@@ -866,11 +1228,11 @@ read_modref_records (lto_input_block *ib, struct data_in *data_in,
base_tree = NULL;
}
- if (*nolto_ret)
+ if (nolto_ret)
nolto_base_node = (*nolto_ret)->insert_base (base_tree
? get_alias_set (base_tree)
: 0);
- if (*lto_ret)
+ if (lto_ret)
lto_base_node = (*lto_ret)->insert_base (base_tree);
size_t every_ref = streamer_read_uhwi (ib);
size_t nref = streamer_read_uhwi (ib);
@@ -895,16 +1257,61 @@ read_modref_records (lto_input_block *ib, struct data_in *data_in,
print_generic_expr (dump_file, ref_tree);
fprintf (dump_file, "\n");
}
- base_tree = NULL;
+ ref_tree = NULL;
}
+ modref_ref_node <alias_set_type> *nolto_ref_node = NULL;
+ modref_ref_node <tree> *lto_ref_node = NULL;
+
if (nolto_base_node)
- nolto_base_node->insert_ref (ref_tree ? get_alias_set (ref_tree)
- : 0, max_refs);
+ nolto_ref_node
+ = nolto_base_node->insert_ref (ref_tree
+ ? get_alias_set (ref_tree) : 0,
+ max_refs);
if (lto_base_node)
- lto_base_node->insert_ref (ref_tree, max_refs);
+ lto_ref_node = lto_base_node->insert_ref (ref_tree, max_refs);
+
+ size_t every_access = streamer_read_uhwi (ib);
+ size_t naccesses = streamer_read_uhwi (ib);
+
+ if (nolto_ref_node)
+ nolto_ref_node->every_access = every_access;
+ if (lto_ref_node)
+ lto_ref_node->every_access = every_access;
+
+ for (size_t k = 0; k < naccesses; k++)
+ {
+ int parm_index = streamer_read_hwi (ib);
+ bool parm_offset_known = false;
+ poly_int64 parm_offset = 0;
+ poly_int64 offset = 0;
+ poly_int64 size = -1;
+ poly_int64 max_size = -1;
+
+ if (parm_index != -1)
+ {
+ parm_offset_known = streamer_read_uhwi (ib);
+ if (parm_offset_known)
+ {
+ parm_offset = streamer_read_poly_int64 (ib);
+ offset = streamer_read_poly_int64 (ib);
+ size = streamer_read_poly_int64 (ib);
+ max_size = streamer_read_poly_int64 (ib);
+ }
+ }
+ modref_access_node a = {offset, size, max_size, parm_offset,
+ parm_index, parm_offset_known};
+ if (nolto_ref_node)
+ nolto_ref_node->insert_access (a, max_accesses);
+ if (lto_ref_node)
+ lto_ref_node->insert_access (a, max_accesses);
+ }
}
}
+ if (lto_ret)
+ (*lto_ret)->cleanup ();
+ if (nolto_ret)
+ (*nolto_ret)->cleanup ();
}
/* Callback for write_summary. */
@@ -917,7 +1324,7 @@ modref_write ()
unsigned int count = 0;
int i;
- if (!summaries)
+ if (!summaries_lto)
{
streamer_write_uhwi (ob, 0);
streamer_write_char_stream (ob->main_stream, 0);
@@ -930,9 +1337,11 @@ modref_write ()
{
symtab_node *snode = lto_symtab_encoder_deref (encoder, i);
cgraph_node *cnode = dyn_cast <cgraph_node *> (snode);
+ modref_summary_lto *r;
if (cnode && cnode->definition && !cnode->alias
- && summaries->get (cnode))
+ && (r = summaries_lto->get (cnode))
+ && r->useful_p (flags_from_decl_or_type (cnode->decl)))
count++;
}
streamer_write_uhwi (ob, count);
@@ -945,19 +1354,15 @@ modref_write ()
if (cnode && cnode->definition && !cnode->alias)
{
- modref_summary *r = summaries->get (cnode);
+ modref_summary_lto *r = summaries_lto->get (cnode);
- if (!r)
+ if (!r || !r->useful_p (flags_from_decl_or_type (cnode->decl)))
continue;
streamer_write_uhwi (ob, lto_symtab_encoder_encode (encoder, cnode));
- streamer_write_uhwi (ob, r->loads_lto ? 1 : 0);
- streamer_write_uhwi (ob, r->stores_lto ? 1 : 0);
- if (r->loads_lto)
- write_modref_records (r->loads_lto, ob);
- if (r->stores_lto)
- write_modref_records (r->stores_lto, ob);
+ write_modref_records (r->loads, ob);
+ write_modref_records (r->stores, ob);
}
}
streamer_write_char_stream (ob->main_stream, 0);
@@ -995,30 +1400,34 @@ read_section (struct lto_file_decl_data *file_data, const char *data,
node = dyn_cast <cgraph_node *> (lto_symtab_encoder_deref (encoder,
index));
- modref_summary *modref_sum = summaries->get_create (node);
- modref_sum->finished = false;
- int have_loads = streamer_read_uhwi (&ib);
- int have_stores = streamer_read_uhwi (&ib);
- gcc_assert (!modref_sum->loads_lto
- && !modref_sum->stores_lto
- && !modref_sum->loads
- && !modref_sum->stores);
- if (have_loads)
- read_modref_records (&ib, data_in,
- &modref_sum->loads,
- &modref_sum->loads_lto);
- if (have_stores)
- read_modref_records (&ib, data_in,
- &modref_sum->stores,
- &modref_sum->stores_lto);
+ modref_summary *modref_sum = summaries
+ ? summaries->get_create (node) : NULL;
+ modref_summary_lto *modref_sum_lto = summaries_lto
+ ? summaries_lto->get_create (node)
+ : NULL;
+
+ if (optimization_summaries)
+ modref_sum = optimization_summaries->get_create (node);
+
+ gcc_assert (!modref_sum || (!modref_sum->loads
+ && !modref_sum->stores));
+ gcc_assert (!modref_sum_lto || (!modref_sum_lto->loads
+ && !modref_sum_lto->stores));
+ read_modref_records (&ib, data_in,
+ modref_sum ? &modref_sum->loads : NULL,
+ modref_sum_lto ? &modref_sum_lto->loads : NULL);
+ read_modref_records (&ib, data_in,
+ modref_sum ? &modref_sum->stores : NULL,
+ modref_sum_lto ? &modref_sum_lto->stores : NULL);
if (dump_file)
{
fprintf (dump_file, "Read modref for %s\n",
node->dump_name ());
- modref_sum->dump (dump_file);
+ if (modref_sum)
+ modref_sum->dump (dump_file);
+ if (modref_sum_lto)
+ modref_sum_lto->dump (dump_file);
}
- if (flag_ltrans)
- modref_sum->finished = true;
}
lto_free_section_data (file_data, LTO_section_ipa_modref, NULL, data,
@@ -1035,10 +1444,18 @@ modref_read (void)
struct lto_file_decl_data *file_data;
unsigned int j = 0;
- if (!summaries)
- summaries = new (ggc_alloc <modref_summaries> ())
- modref_summaries (symtab);
- ((modref_summaries *)summaries)->ipa = true;
+ gcc_checking_assert (!optimization_summaries && !summaries && !summaries_lto);
+ if (flag_ltrans)
+ optimization_summaries = modref_summaries::create_ggc (symtab);
+ else
+ {
+ if (flag_wpa || flag_incremental_link == INCREMENTAL_LINK_LTO)
+ summaries_lto = modref_summaries_lto::create_ggc (symtab);
+ if (!flag_wpa
+ || (flag_incremental_link == INCREMENTAL_LINK_LTO
+ && flag_fat_lto_objects))
+ summaries = modref_summaries::create_ggc (symtab);
+ }
while ((file_data = file_data_vec[j++]))
{
@@ -1057,6 +1474,81 @@ modref_read (void)
}
}
+/* Update parameter indexes in TT according to MAP. */
+
+void
+remap_arguments (vec <int> *map, modref_records *tt)
+{
+ size_t i;
+ modref_base_node <alias_set_type> *base_node;
+ FOR_EACH_VEC_SAFE_ELT (tt->bases, i, base_node)
+ {
+ size_t j;
+ modref_ref_node <alias_set_type> *ref_node;
+ FOR_EACH_VEC_SAFE_ELT (base_node->refs, j, ref_node)
+ {
+ size_t k;
+ modref_access_node *access_node;
+ FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node)
+ if (access_node->parm_index > 0)
+ {
+ if (access_node->parm_index < (int)map->length ())
+ access_node->parm_index = (*map)[access_node->parm_index];
+ else
+ access_node->parm_index = -1;
+ }
+ }
+ }
+}
+
+/* If signature changed, update the summary. */
+
+static unsigned int
+modref_transform (struct cgraph_node *node)
+{
+ if (!node->clone.param_adjustments || !optimization_summaries)
+ return 0;
+ modref_summary *r = optimization_summaries->get (node);
+ if (!r)
+ return 0;
+ if (dump_file)
+ {
+ fprintf (dump_file, "Updating summary for %s from:\n",
+ node->dump_name ());
+ r->dump (dump_file);
+ }
+
+ size_t i, max = 0;
+ ipa_adjusted_param *p;
+
+ FOR_EACH_VEC_SAFE_ELT (node->clone.param_adjustments->m_adj_params, i, p)
+ {
+ int idx = node->clone.param_adjustments->get_original_index (i);
+ if (idx > (int)max)
+ max = idx;
+ }
+
+ auto_vec <int, 32> map;
+
+ map.reserve (max + 1);
+ for (i = 0; i <= max; i++)
+ map.quick_push (-1);
+ FOR_EACH_VEC_SAFE_ELT (node->clone.param_adjustments->m_adj_params, i, p)
+ {
+ int idx = node->clone.param_adjustments->get_original_index (i);
+ if (idx >= 0)
+ map[idx] = i;
+ }
+ remap_arguments (&map, r->loads);
+ remap_arguments (&map, r->stores);
+ if (dump_file)
+ {
+ fprintf (dump_file, "to:\n");
+ r->dump (dump_file);
+ }
+ return 0;
+}
+
/* Definition of the modref IPA pass. */
const pass_data pass_data_ipa_modref =
{
@@ -1083,7 +1575,7 @@ public:
modref_read, /* read_optimization_summary */
NULL, /* stmt_fixup */
0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
+ modref_transform,/* function_transform */
NULL) /* variable_transform */
{}
@@ -1101,9 +1593,6 @@ public:
unsigned int pass_modref::execute (function *f)
{
- /* If new function is being added during IPA, we can skip analysis. */
- if (summaries && ((modref_summaries *)summaries)->ipa)
- return 0;
analyze_function (f, false);
return 0;
}
@@ -1126,81 +1615,270 @@ make_pass_ipa_modref (gcc::context *ctxt)
static bool
ignore_edge (struct cgraph_edge *e)
{
+ /* We merge summaries of inline clones into summaries of functions they
+ are inlined to. For that reason the complete function bodies must
+ act as unit. */
+ if (!e->inline_failed)
+ return false;
enum availability avail;
cgraph_node *callee = e->callee->function_or_virtual_thunk_symbol
(&avail, e->caller);
return (avail <= AVAIL_INTERPOSABLE
- || !summaries->get (callee)
+ || ((!optimization_summaries || !optimization_summaries->get (callee))
+ && (!summaries_lto || !summaries_lto->get (callee)))
|| flags_from_decl_or_type (e->callee->decl)
& (ECF_CONST | ECF_NOVOPS));
}
-/* Run the IPA pass. This will take a function's summaries and calls and
- construct new summaries which represent a transitive closure. So that
- summary of an analyzed function contains information about the loads and
- stores that the function or any function that it calls does. */
+/* Compute parm_map for CALLE_EDGE. */
-unsigned int pass_ipa_modref::execute (function *)
+static void
+compute_parm_map (cgraph_edge *callee_edge, vec<modref_parm_map> *parm_map)
{
- if (!summaries)
- return 0;
+ class ipa_edge_args *args;
+ if (ipa_node_params_sum
+ && !callee_edge->call_stmt_cannot_inline_p
+ && (args = IPA_EDGE_REF (callee_edge)) != NULL)
+ {
+ int i, count = ipa_get_cs_argument_count (args);
+ class ipa_node_params *caller_parms_info, *callee_pi;
+ class ipa_call_summary *es
+ = ipa_call_summaries->get (callee_edge);
+ cgraph_node *callee
+ = callee_edge->callee->function_or_virtual_thunk_symbol
+ (NULL, callee_edge->caller);
+
+ caller_parms_info = IPA_NODE_REF (callee_edge->caller->inlined_to
+ ? callee_edge->caller->inlined_to
+ : callee_edge->caller);
+ callee_pi = IPA_NODE_REF (callee);
+
+ (*parm_map).safe_grow_cleared (count);
+
+ for (i = 0; i < count; i++)
+ {
+ if (es && es->param[i].points_to_local_or_readonly_memory)
+ {
+ (*parm_map)[i].parm_index = -2;
+ continue;
+ }
- struct cgraph_node **order = XCNEWVEC (struct cgraph_node *,
- symtab->cgraph_count);
- int order_pos;
- order_pos = ipa_reduced_postorder (order, true, ignore_edge);
- int i;
+ struct ipa_jump_func *jf
+ = ipa_get_ith_jump_func (args, i);
+ if (jf && callee_pi)
+ {
+ tree cst = ipa_value_from_jfunc (caller_parms_info,
+ jf,
+ ipa_get_type
+ (callee_pi, i));
+ if (cst && points_to_local_or_readonly_memory_p (cst))
+ {
+ (*parm_map)[i].parm_index = -2;
+ continue;
+ }
+ }
+ if (jf && jf->type == IPA_JF_PASS_THROUGH)
+ {
+ (*parm_map)[i].parm_index
+ = ipa_get_jf_pass_through_formal_id (jf);
+ if (ipa_get_jf_pass_through_operation (jf) == NOP_EXPR)
+ {
+ (*parm_map)[i].parm_offset_known = true;
+ (*parm_map)[i].parm_offset = 0;
+ }
+ else if (ipa_get_jf_pass_through_operation (jf)
+ == POINTER_PLUS_EXPR
+ && ptrdiff_tree_p (ipa_get_jf_pass_through_operand (jf),
+ &(*parm_map)[i].parm_offset))
+ (*parm_map)[i].parm_offset_known = true;
+ else
+ (*parm_map)[i].parm_offset_known = false;
+ continue;
+ }
+ if (jf && jf->type == IPA_JF_ANCESTOR)
+ {
+ (*parm_map)[i].parm_index = ipa_get_jf_ancestor_formal_id (jf);
+ (*parm_map)[i].parm_offset_known = true;
+ gcc_checking_assert
+ (!(ipa_get_jf_ancestor_offset (jf) & (BITS_PER_UNIT - 1)));
+ (*parm_map)[i].parm_offset
+ = ipa_get_jf_ancestor_offset (jf) >> LOG2_BITS_PER_UNIT;
+ }
+ else
+ (*parm_map)[i].parm_index = -1;
+ }
+ if (dump_file)
+ {
+ fprintf (dump_file, " Parm map: ");
+ for (i = 0; i < count; i++)
+ fprintf (dump_file, " %i", (*parm_map)[i].parm_index);
+ fprintf (dump_file, "\n");
+ }
+ }
+}
- /* Iterate over all strongly connected components in post-order. */
- for (i = 0; i < order_pos; i++)
+/* Call EDGE was inlined; merge summary from callee to the caller. */
+
+void
+ipa_merge_modref_summary_after_inlining (cgraph_edge *edge)
+{
+ if (!summaries && !summaries_lto)
+ return;
+
+ struct cgraph_node *to = (edge->caller->inlined_to
+ ? edge->caller->inlined_to : edge->caller);
+ class modref_summary *to_info = summaries ? summaries->get (to) : NULL;
+ class modref_summary_lto *to_info_lto = summaries_lto
+ ? summaries_lto->get (to) : NULL;
+
+ if (!to_info && !to_info_lto)
{
- bool its_hopeless = false;
- modref_records *loads = NULL;
- modref_records *stores = NULL;
- modref_records_lto *loads_lto = NULL;
- modref_records_lto *stores_lto = NULL;
+ if (summaries)
+ summaries->remove (edge->callee);
+ if (summaries_lto)
+ summaries_lto->remove (edge->callee);
+ return;
+ }
- /* Get the component's representative. That's just any node in the
- component from which we can traverse the entire component. */
- struct cgraph_node *component_node = order[i];
- cgraph_node *first = NULL;
+ class modref_summary *callee_info = summaries ? summaries->get (edge->callee)
+ : NULL;
+ class modref_summary_lto *callee_info_lto
+ = summaries_lto ? summaries_lto->get (edge->callee) : NULL;
+ int flags = flags_from_decl_or_type (edge->callee->decl);
- if (dump_file)
- fprintf (dump_file, "Start of SCC component\n");
+ if (!callee_info && to_info)
+ {
+ if (ignore_stores_p (edge->caller->decl, flags))
+ to_info->loads->collapse ();
+ else
+ {
+ summaries->remove (to);
+ to_info = NULL;
+ }
+ }
+ if (!callee_info_lto && to_info_lto)
+ {
+ if (ignore_stores_p (edge->caller->decl, flags))
+ to_info_lto->loads->collapse ();
+ else
+ {
+ summaries_lto->remove (to);
+ to_info_lto = NULL;
+ }
+ }
+ if (callee_info || callee_info_lto)
+ {
+ auto_vec <modref_parm_map, 32> parm_map;
+
+ compute_parm_map (edge, &parm_map);
+
+ if (!ignore_stores_p (edge->caller->decl, flags))
+ {
+ if (to_info && callee_info)
+ to_info->stores->merge (callee_info->stores, &parm_map);
+ if (to_info_lto && callee_info_lto)
+ to_info_lto->stores->merge (callee_info_lto->stores, &parm_map);
+ }
+ if (to_info && callee_info)
+ to_info->loads->merge (callee_info->loads, &parm_map);
+ if (to_info_lto && callee_info_lto)
+ to_info_lto->loads->merge (callee_info_lto->loads, &parm_map);
+ }
+ if (summaries)
+ {
+ if (to_info && !to_info->useful_p (flags))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Removed mod-ref summary for %s\n",
+ to->dump_name ());
+ summaries->remove (to);
+ }
+ else if (to_info && dump_file)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Updated mod-ref summary for %s\n",
+ to->dump_name ());
+ to_info->dump (dump_file);
+ }
+ if (callee_info)
+ summaries->remove (edge->callee);
+ }
+ if (summaries_lto)
+ {
+ if (to_info_lto && !to_info_lto->useful_p (flags))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Removed mod-ref summary for %s\n",
+ to->dump_name ());
+ summaries_lto->remove (to);
+ }
+ else if (to_info_lto && dump_file)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Updated mod-ref summary for %s\n",
+ to->dump_name ());
+ to_info_lto->dump (dump_file);
+ }
+ if (callee_info_lto)
+ summaries_lto->remove (edge->callee);
+ }
+ return;
+}
- /* Walk the component. CUR is the current node of the component that's
- being processed. */
- for (struct cgraph_node *cur = component_node; cur && !its_hopeless;
+/* Collapse loads and return true if something changed. */
+
+bool
+collapse_loads (modref_summary *cur_summary,
+ modref_summary_lto *cur_summary_lto)
+{
+ bool changed = false;
+
+ if (cur_summary && !cur_summary->loads->every_base)
+ {
+ cur_summary->loads->collapse ();
+ changed = true;
+ }
+ if (cur_summary_lto
+ && !cur_summary_lto->loads->every_base)
+ {
+ cur_summary_lto->loads->collapse ();
+ changed = true;
+ }
+ return changed;
+}
+
+/* Perform iterative dataflow on SCC component starting in COMPONENT_NODE. */
+
+static void
+modref_propagate_in_scc (cgraph_node *component_node)
+{
+ bool changed = true;
+ int iteration = 0;
+
+ while (changed)
+ {
+ changed = false;
+ for (struct cgraph_node *cur = component_node; cur;
cur = ((struct ipa_dfs_info *) cur->aux)->next_cycle)
{
- /* Merge in summaries from CUR. */
- modref_summary *cur_summary = summaries->get (cur);
+ cgraph_node *node = cur->inlined_to ? cur->inlined_to : cur;
+ modref_summary *cur_summary = optimization_summaries
+ ? optimization_summaries->get (node)
+ : NULL;
+ modref_summary_lto *cur_summary_lto = summaries_lto
+ ? summaries_lto->get (node)
+ : NULL;
+
+ if (!cur_summary && !cur_summary_lto)
+ continue;
if (dump_file)
- fprintf (dump_file, " Processing %s\n",
- cur->dump_name ());
-
- /* We don't know anything about CUR, hence we cannot tell anything
- about the entire component. */
- if (!cur_summary)
- {
- if (dump_file)
- fprintf (dump_file, " No summary\n");
- its_hopeless = true;
- break;
- }
+ fprintf (dump_file, " Processing %s%s%s\n",
+ cur->dump_name (),
+ TREE_READONLY (cur->decl) ? " (const)" : "",
+ DECL_PURE_P (cur->decl) ? " (pure)" : "");
- /* Summaries are all going to be same, pick first ones and merge
- everything in. */
- if (!first)
- {
- first = cur;
- loads = cur_summary->loads;
- stores = cur_summary->stores;
- loads_lto = cur_summary->loads_lto;
- stores_lto = cur_summary->stores_lto;
- }
for (cgraph_edge *e = cur->indirect_calls; e; e = e->next_callee)
{
if (e->indirect_info->ecf_flags & (ECF_CONST | ECF_NOVOPS))
@@ -1210,167 +1888,276 @@ unsigned int pass_ipa_modref::execute (function *)
if (dump_file)
fprintf (dump_file, " Indirect call: "
"collapsing loads\n");
- if (loads)
- loads->collapse ();
- if (loads_lto)
- loads_lto->collapse ();
+ changed |= collapse_loads (cur_summary, cur_summary_lto);
}
else
{
if (dump_file)
fprintf (dump_file, " Indirect call: giving up\n");
- its_hopeless = true;
+ if (optimization_summaries)
+ optimization_summaries->remove (node);
+ if (summaries_lto)
+ summaries_lto->remove (node);
+ changed = true;
+ cur_summary = NULL;
+ cur_summary_lto = NULL;
+ break;
}
}
- /* Walk every function that CUR calls and merge its summary. */
+ if (!cur_summary && !cur_summary_lto)
+ continue;
+
for (cgraph_edge *callee_edge = cur->callees; callee_edge;
callee_edge = callee_edge->next_callee)
{
int flags = flags_from_decl_or_type (callee_edge->callee->decl);
- modref_summary *callee_summary;
+ modref_summary *callee_summary = NULL;
+ modref_summary_lto *callee_summary_lto = NULL;
struct cgraph_node *callee;
- if (flags & (ECF_CONST | ECF_NOVOPS))
+ if (flags & (ECF_CONST | ECF_NOVOPS)
+ || !callee_edge->inline_failed)
continue;
- if (dump_file)
- fprintf (dump_file, " Call to %s\n",
- cur->dump_name ());
-
- /* We can not safely optimize based on summary of calle if it
- does not always bind to current def: it is possible that
- memory load was optimized out earlier which may not happen in
- the interposed variant. */
- if (!callee_edge->binds_to_current_def_p ())
- {
- if (loads)
- loads->collapse ();
- if (loads_lto)
- loads_lto->collapse ();
- if (dump_file)
- fprintf (dump_file, " May not bind local;"
- " collapsing loads\n");
- }
-
/* Get the callee and its summary. */
enum availability avail;
callee = callee_edge->callee->function_or_virtual_thunk_symbol
(&avail, cur);
- /* See if we can derive something from ECF flags. Be careful on
- not skipping calls within the SCC component: we must merge
- all their summaries.
- If we switch to iterative dataflow that may be necessary
- for future improvements this may go away. */
- if (callee->aux
- && ((struct ipa_dfs_info *)cur->aux)->scc_no
- == ((struct ipa_dfs_info *)callee->aux)->scc_no)
- flags = 0;
+ /* It is not necessary to re-process calls outside of the
+ SCC component. */
+ if (iteration > 0
+ && (!callee->aux
+ || ((struct ipa_dfs_info *)cur->aux)->scc_no
+ != ((struct ipa_dfs_info *)callee->aux)->scc_no))
+ continue;
+
+ if (dump_file)
+ fprintf (dump_file, " Call to %s\n",
+ callee_edge->callee->dump_name ());
bool ignore_stores = ignore_stores_p (cur->decl, flags);
+ if (avail <= AVAIL_INTERPOSABLE)
+ {
+ if (!ignore_stores)
+ {
+ if (dump_file)
+ fprintf (dump_file, " Call target interposable"
+ " or not available\n");
+
+ if (optimization_summaries)
+ optimization_summaries->remove (node);
+ if (summaries_lto)
+ summaries_lto->remove (node);
+ cur_summary = NULL;
+ cur_summary_lto = NULL;
+ changed = true;
+ break;
+ }
+ else
+ {
+ if (dump_file)
+ fprintf (dump_file, " Call target interposable"
+ " or not available; collapsing loads\n");
+
+ changed |= collapse_loads (cur_summary, cur_summary_lto);
+ continue;
+ }
+ }
+
/* We don't know anything about CALLEE, hence we cannot tell
anything about the entire component. */
- if (avail <= AVAIL_INTERPOSABLE
- || !(callee_summary = summaries->get (callee)))
+ if (cur_summary
+ && !(callee_summary = optimization_summaries->get (callee)))
{
if (!ignore_stores)
{
- its_hopeless = true;
- if (dump_file && avail <= AVAIL_INTERPOSABLE)
- fprintf (dump_file, " Call target interposable"
- "or not available\n");
- else if (dump_file)
+ if (dump_file)
fprintf (dump_file, " No call target summary\n");
- break;
+
+ optimization_summaries->remove (node);
+ cur_summary = NULL;
+ changed = true;
}
else
{
- if (loads)
- loads->collapse ();
- if (loads_lto)
- loads_lto->collapse ();
- if (dump_file && avail <= AVAIL_INTERPOSABLE)
- fprintf (dump_file, " Call target interposable"
- "or not available; collapsing loads\n");
- else if (dump_file)
+ if (dump_file)
fprintf (dump_file, " No call target summary;"
" collapsing loads\n");
- continue;
+
+ if (!cur_summary->loads->every_base)
+ {
+ cur_summary->loads->collapse ();
+ changed = true;
+ }
}
}
+ if (cur_summary_lto
+ && !(callee_summary_lto = summaries_lto->get (callee)))
+ {
+ if (!ignore_stores)
+ {
+ if (dump_file)
+ fprintf (dump_file, " No call target summary\n");
- /* Merge in callee's information. */
- if (callee_summary->loads
- && callee_summary->loads != loads)
- loads->merge (callee_summary->loads);
- if (callee_summary->stores
- && callee_summary->stores != stores)
- stores->merge (callee_summary->stores);
- if (callee_summary->loads_lto
- && callee_summary->loads_lto != loads_lto)
- loads_lto->merge (callee_summary->loads_lto);
- if (callee_summary->stores_lto
- && callee_summary->stores_lto != stores_lto)
- stores_lto->merge (callee_summary->stores_lto);
- }
- }
+ summaries_lto->remove (node);
+ cur_summary_lto = NULL;
+ changed = true;
+ }
+ else
+ {
+ if (dump_file)
+ fprintf (dump_file, " No call target summary;"
+ " collapsing loads\n");
- /* At this time, ipa_loads and ipa_stores contain information
- about all loads and stores done by any of the component's nodes and
- all functions that any of the nodes calls. We will now propagate
- this information to all nodes in the component. Therefore, we will
- walk the component one more time to do it. */
- for (struct cgraph_node *cur = component_node; cur;
- cur = ((struct ipa_dfs_info *) cur->aux)->next_cycle)
- {
- modref_summary *cur_summary = summaries->get (cur);
- if (!cur_summary)
- {
- /* The function doesn't have a summary. We must have noticed
- that during the first pass and the hopeless flag must
- therefore be set. Skip the function. */
- gcc_assert (its_hopeless);
- }
- else if (its_hopeless)
- {
- if (dump_file)
- fprintf (dump_file, "Cleared modref info for %s\n",
- cur->dump_name ());
- summaries->remove (cur);
- }
- else
- {
- if (cur == first)
- ;
- else
+ if (!cur_summary_lto->loads->every_base)
+ {
+ cur_summary_lto->loads->collapse ();
+ changed = true;
+ }
+ }
+ }
+
+ /* We can not safely optimize based on summary of callee if it
+ does not always bind to current def: it is possible that
+ memory load was optimized out earlier which may not happen in
+ the interposed variant. */
+ if (!callee_edge->binds_to_current_def_p ())
{
- if (loads)
- cur_summary->loads->merge (loads);
- if (stores)
- cur_summary->stores->merge (stores);
- if (loads_lto)
- cur_summary->loads_lto->merge (loads_lto);
- if (stores_lto)
- cur_summary->stores_lto->merge (stores_lto);
+ changed |= collapse_loads (cur_summary, cur_summary_lto);
+ if (dump_file)
+ fprintf (dump_file, " May not bind local;"
+ " collapsing loads\n");
}
- cur_summary->finished = true;
- if (dump_file)
+
+
+ auto_vec <modref_parm_map, 32> parm_map;
+
+ compute_parm_map (callee_edge, &parm_map);
+
+ /* Merge in callee's information. */
+ if (callee_summary)
{
- fprintf (dump_file, "Propagated modref for %s%s%s\n",
- cur->dump_name (),
- TREE_READONLY (cur->decl) ? " (const)" : "",
- DECL_PURE_P (cur->decl) ? " (pure)" : "");
- cur_summary->dump (dump_file);
+ changed |= cur_summary->loads->merge
+ (callee_summary->loads, &parm_map);
+ if (!ignore_stores)
+ changed |= cur_summary->stores->merge
+ (callee_summary->stores, &parm_map);
+ }
+ if (callee_summary_lto)
+ {
+ changed |= cur_summary_lto->loads->merge
+ (callee_summary_lto->loads, &parm_map);
+ if (!ignore_stores)
+ changed |= cur_summary_lto->stores->merge
+ (callee_summary_lto->stores, &parm_map);
+ }
+ if (dump_file && changed)
+ {
+ if (cur_summary)
+ cur_summary->dump (dump_file);
+ if (cur_summary_lto)
+ cur_summary_lto->dump (dump_file);
}
}
}
+ iteration++;
+ }
+ if (dump_file)
+ {
+ fprintf (dump_file,
+ "Propagation finished in %i iterations\n", iteration);
+ for (struct cgraph_node *cur = component_node; cur;
+ cur = ((struct ipa_dfs_info *) cur->aux)->next_cycle)
+ if (!cur->inlined_to)
+ {
+ modref_summary *cur_summary = optimization_summaries
+ ? optimization_summaries->get (cur)
+ : NULL;
+ modref_summary_lto *cur_summary_lto = summaries_lto
+ ? summaries_lto->get (cur)
+ : NULL;
+
+ fprintf (dump_file, "Propagated modref for %s%s%s\n",
+ cur->dump_name (),
+ TREE_READONLY (cur->decl) ? " (const)" : "",
+ DECL_PURE_P (cur->decl) ? " (pure)" : "");
+ if (optimization_summaries)
+ {
+ if (cur_summary)
+ cur_summary->dump (dump_file);
+ else
+ fprintf (dump_file, " Not tracked\n");
+ }
+ if (summaries_lto)
+ {
+ if (cur_summary_lto)
+ cur_summary_lto->dump (dump_file);
+ else
+ fprintf (dump_file, " Not tracked (lto)\n");
+ }
+ }
+ }
+}
+
+/* Run the IPA pass. This will take a function's summaries and calls and
+ construct new summaries which represent a transitive closure. So that
+ summary of an analyzed function contains information about the loads and
+ stores that the function or any function that it calls does. */
+
+unsigned int
+pass_ipa_modref::execute (function *)
+{
+ if (!summaries && !summaries_lto)
+ return 0;
+
+ if (optimization_summaries)
+ ggc_delete (optimization_summaries);
+ optimization_summaries = summaries;
+ summaries = NULL;
+
+ struct cgraph_node **order = XCNEWVEC (struct cgraph_node *,
+ symtab->cgraph_count);
+ int order_pos;
+ order_pos = ipa_reduced_postorder (order, true, ignore_edge);
+ int i;
+
+ /* Iterate over all strongly connected components in post-order. */
+ for (i = 0; i < order_pos; i++)
+ {
+ /* Get the component's representative. That's just any node in the
+ component from which we can traverse the entire component. */
+ struct cgraph_node *component_node = order[i];
+
+ if (dump_file)
+ fprintf (dump_file, "\n\nStart of SCC component\n");
+
+ modref_propagate_in_scc (component_node);
}
- ((modref_summaries *)summaries)->ipa = false;
+ if (summaries_lto)
+ ((modref_summaries_lto *)summaries_lto)->propagated = true;
ipa_free_postorder_info ();
+ free (order);
return 0;
}
+/* Summaries must stay alive until end of compilation. */
+
+void
+ipa_modref_c_finalize ()
+{
+ if (optimization_summaries)
+ ggc_delete (optimization_summaries);
+ optimization_summaries = NULL;
+ gcc_checking_assert (!summaries);
+ if (summaries_lto)
+ {
+ ggc_delete (summaries_lto);
+ summaries_lto = NULL;
+ }
+}
+
#include "gt-ipa-modref.h"
diff --git a/gcc/ipa-modref.h b/gcc/ipa-modref.h
index 6f97920..8828104 100644
--- a/gcc/ipa-modref.h
+++ b/gcc/ipa-modref.h
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see
#define IPA_MODREF_H
typedef modref_tree <alias_set_type> modref_records;
-typedef modref_tree <tree> modref_records_lto;
/* Single function summary. */
@@ -31,18 +30,14 @@ struct GTY(()) modref_summary
modref_records *loads;
modref_records *stores;
- /* The same but using tree types rather than alias sets. This is necessary
- to make the information streamable for LTO but is also more verbose
- and thus more likely to hit the limits. */
- modref_records_lto *loads_lto;
- modref_records_lto *stores_lto;
- bool finished;
-
modref_summary ();
~modref_summary ();
void dump (FILE *);
+ bool useful_p (int ecf_flags);
};
modref_summary *get_modref_function_summary (cgraph_node *func);
+void ipa_modref_c_finalize ();
+void ipa_merge_modref_summary_after_inlining (cgraph_edge *e);
#endif
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 5fc0de5..438f4bd 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -783,6 +783,13 @@ ipa_param_adjustments::modify_call (gcall *stmt,
{
vec<tree, va_gc> **debug_args = NULL;
unsigned i = 0;
+ cgraph_node *callee_node = cgraph_node::get (callee_decl);
+
+ /* FIXME: we don't seem to be able to insert debug args before clone
+ is materialized. Materializing them early leads to extra memory
+ use. */
+ if (callee_node->clone_of)
+ callee_node->get_untransformed_body ();
for (tree old_parm = DECL_ARGUMENTS (old_decl);
old_parm && i < old_nargs && ((int) i) < m_always_copy_start;
old_parm = DECL_CHAIN (old_parm), i++)
diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
index 65516b6..326aef7 100644
--- a/gcc/ipa-polymorphic-call.c
+++ b/gcc/ipa-polymorphic-call.c
@@ -38,6 +38,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree-dfa.h"
#include "gimple-pretty-print.h"
#include "tree-into-ssa.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
/* Return true when TYPE contains an polymorphic type and thus is interesting
for devirtualization machinery. */
@@ -1007,8 +1010,9 @@ ipa_polymorphic_call_context::ipa_polymorphic_call_context (tree fndecl,
Because we walked all the way to the beginning of thunk, we now
see pointer &bar-thunk.fixed_offset and need to compensate
for it. */
- if (node->thunk.fixed_offset)
- offset -= node->thunk.fixed_offset * BITS_PER_UNIT;
+ thunk_info *info = thunk_info::get (node);
+ if (info && info->fixed_offset)
+ offset -= info->fixed_offset * BITS_PER_UNIT;
/* Dynamic casting has possibly upcasted the type
in the hierarchy. In this case outer type is less
@@ -1021,7 +1025,7 @@ ipa_polymorphic_call_context::ipa_polymorphic_call_context (tree fndecl,
/* If we compile thunk with virtual offset, the THIS pointer
is adjusted by unknown value. We can't thus use outer info
at all. */
- || node->thunk.virtual_offset_p)
+ || (info && info->virtual_offset_p))
{
outer_type = NULL;
if (instance)
@@ -1047,10 +1051,10 @@ ipa_polymorphic_call_context::ipa_polymorphic_call_context (tree fndecl,
}
if (instance)
{
+ thunk_info *info = thunk_info::get (node);
/* If method is expanded thunk, we need to apply thunk offset
to instance pointer. */
- if (node->thunk.virtual_offset_p
- || node->thunk.fixed_offset)
+ if (info && (info->virtual_offset_p || info->fixed_offset))
*instance = NULL;
else
*instance = base_pointer;
diff --git a/gcc/ipa-predicate.c b/gcc/ipa-predicate.c
index 27dabf2..605da91 100644
--- a/gcc/ipa-predicate.c
+++ b/gcc/ipa-predicate.c
@@ -508,7 +508,7 @@ predicate::remap_after_inlining (class ipa_fn_summary *info,
class ipa_node_params *params_summary,
class ipa_fn_summary *callee_info,
vec<int> operand_map,
- vec<int> offset_map,
+ vec<HOST_WIDE_INT> offset_map,
clause_t possible_truths,
const predicate &toplev_predicate)
{
diff --git a/gcc/ipa-predicate.h b/gcc/ipa-predicate.h
index 9b75ffc..34a0d23 100644
--- a/gcc/ipa-predicate.h
+++ b/gcc/ipa-predicate.h
@@ -76,14 +76,18 @@ struct inline_param_summary
parameters REG_BR_PROB_BASE.
Value 0 is reserved for compile time invariants. */
- int change_prob;
+ short change_prob;
+ unsigned points_to_local_or_readonly_memory : 1;
bool equal_to (const inline_param_summary &other) const
{
- return change_prob == other.change_prob;
+ return change_prob == other.change_prob
+ && points_to_local_or_readonly_memory
+ == other.points_to_local_or_readonly_memory;
}
bool useless_p (void) const
{
- return change_prob == REG_BR_PROB_BASE;
+ return change_prob == REG_BR_PROB_BASE
+ && !points_to_local_or_readonly_memory;
}
};
@@ -239,7 +243,8 @@ public:
predicate remap_after_inlining (class ipa_fn_summary *,
class ipa_node_params *params_summary,
class ipa_fn_summary *,
- vec<int>, vec<int>, clause_t, const predicate &);
+ vec<int>, vec<HOST_WIDE_INT>,
+ clause_t, const predicate &);
void stream_in (class lto_input_block *);
void stream_out (struct output_block *);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index b28c78e..a848f1d 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see
#include "domwalk.h"
#include "builtins.h"
#include "tree-cfgcleanup.h"
+#include "options.h"
/* Function summary where the parameter infos are actually stored. */
ipa_node_params_t *ipa_node_params_sum = NULL;
@@ -122,7 +123,8 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range *>
static bool
equal (const value_range *a, const value_range *b)
{
- return a->equal_p (*b);
+ return (a->equal_p (*b)
+ && types_compatible_p (a->type (), b->type ()));
}
static const bool empty_zero_p = true;
static void
@@ -1222,6 +1224,73 @@ load_from_unmodified_param_or_agg (struct ipa_func_body_info *fbi,
return index;
}
+/* Walk pointer adjustemnts from OP (such as POINTER_PLUS and ADDR_EXPR)
+ to find original pointer. Initialize RET to the pointer which results from
+ the walk.
+ If offset is known return true and initialize OFFSET_RET. */
+
+bool
+unadjusted_ptr_and_unit_offset (tree op, tree *ret, poly_int64 *offset_ret)
+{
+ poly_int64 offset = 0;
+ bool offset_known = true;
+ int i;
+
+ for (i = 0; i < param_ipa_jump_function_lookups; i++)
+ {
+ if (TREE_CODE (op) == ADDR_EXPR)
+ {
+ poly_int64 extra_offset = 0;
+ tree base = get_addr_base_and_unit_offset (TREE_OPERAND (op, 0),
+ &offset);
+ if (!base)
+ {
+ base = get_base_address (TREE_OPERAND (op, 0));
+ if (TREE_CODE (base) != MEM_REF)
+ break;
+ offset_known = false;
+ }
+ else
+ {
+ if (TREE_CODE (base) != MEM_REF)
+ break;
+ offset += extra_offset;
+ }
+ op = TREE_OPERAND (base, 0);
+ if (mem_ref_offset (base).to_shwi (&extra_offset))
+ offset += extra_offset;
+ else
+ offset_known = false;
+ }
+ else if (TREE_CODE (op) == SSA_NAME
+ && !SSA_NAME_IS_DEFAULT_DEF (op))
+ {
+ gimple *pstmt = SSA_NAME_DEF_STMT (op);
+
+ if (gimple_assign_single_p (pstmt))
+ op = gimple_assign_rhs1 (pstmt);
+ else if (is_gimple_assign (pstmt)
+ && gimple_assign_rhs_code (pstmt) == POINTER_PLUS_EXPR)
+ {
+ poly_int64 extra_offset = 0;
+ if (ptrdiff_tree_p (gimple_assign_rhs2 (pstmt),
+ &extra_offset))
+ offset += extra_offset;
+ else
+ offset_known = false;
+ op = gimple_assign_rhs1 (pstmt);
+ }
+ else
+ break;
+ }
+ else
+ break;
+ }
+ *ret = op;
+ *offset_ret = offset;
+ return offset_known;
+}
+
/* Given that an actual argument is an SSA_NAME (given in NAME) and is a result
of an assignment statement STMT, try to determine whether we are actually
handling any of the following cases and construct an appropriate jump
@@ -3787,11 +3856,13 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
param_index = ici->param_index;
jfunc = ipa_get_ith_jump_func (top, param_index);
- cgraph_node *spec_target = NULL;
- /* FIXME: This may need updating for multiple calls. */
+ auto_vec<cgraph_node *, 4> spec_targets;
if (ie->speculative)
- spec_target = ie->first_speculative_call_target ()->callee;
+ for (cgraph_edge *direct = ie->first_speculative_call_target ();
+ direct;
+ direct = direct->next_speculative_call_target ())
+ spec_targets.safe_push (direct->callee);
if (!opt_for_fn (node->decl, flag_indirect_inlining))
new_direct_edge = NULL;
@@ -3814,7 +3885,7 @@ update_indirect_edges_after_inlining (struct cgraph_edge *cs,
/* If speculation was removed, then we need to do nothing. */
if (new_direct_edge && new_direct_edge != ie
- && new_direct_edge->callee == spec_target)
+ && spec_targets.contains (new_direct_edge->callee))
{
new_direct_edge->indirect_inlining_edge = 1;
top = IPA_EDGE_REF (cs);
@@ -4124,7 +4195,8 @@ ipa_free_all_edge_args (void)
void
ipa_free_all_node_params (void)
{
- ggc_delete (ipa_node_params_sum);
+ if (ipa_node_params_sum)
+ ggc_delete (ipa_node_params_sum);
ipa_node_params_sum = NULL;
}
@@ -4368,7 +4440,8 @@ ipa_register_cgraph_hooks (void)
static void
ipa_unregister_cgraph_hooks (void)
{
- symtab->remove_cgraph_insertion_hook (function_insertion_hook_holder);
+ if (function_insertion_hook_holder)
+ symtab->remove_cgraph_insertion_hook (function_insertion_hook_holder);
function_insertion_hook_holder = NULL;
}
@@ -5795,4 +5868,14 @@ ipa_agg_value::equal_to (const ipa_agg_value &other)
return offset == other.offset
&& operand_equal_p (value, other.value, 0);
}
+
+/* Destructor also removing individual aggregate values. */
+
+ipa_auto_call_arg_values::~ipa_auto_call_arg_values ()
+{
+ ipa_release_agg_values (m_known_aggs, false);
+}
+
+
+
#include "gt-ipa-prop.h"
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 23fcf90..0bbbbf9 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -433,6 +433,107 @@ ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
return jfunc->value.ancestor.agg_preserved;
}
+/* Class for allocating a bundle of various potentially known properties about
+ actual arguments of a particular call on stack for the usual case and on
+ heap only if there are unusually many arguments. The data is deallocated
+ when the instance of this class goes out of scope or is otherwise
+ destructed. */
+
+class ipa_auto_call_arg_values
+{
+public:
+ ~ipa_auto_call_arg_values ();
+
+ /* If m_known_vals (vector of known "scalar" values) is sufficiantly long,
+ return its element at INDEX, otherwise return NULL. */
+ tree safe_sval_at (int index)
+ {
+ /* TODO: Assert non-negative index here and test. */
+ if ((unsigned) index < m_known_vals.length ())
+ return m_known_vals[index];
+ return NULL;
+ }
+
+ /* If m_known_aggs is sufficiantly long, return the pointer rto its element
+ at INDEX, otherwise return NULL. */
+ ipa_agg_value_set *safe_aggval_at (int index)
+ {
+ /* TODO: Assert non-negative index here and test. */
+ if ((unsigned) index < m_known_aggs.length ())
+ return &m_known_aggs[index];
+ return NULL;
+ }
+
+ /* Vector describing known values of parameters. */
+ auto_vec<tree, 32> m_known_vals;
+
+ /* Vector describing known polymorphic call contexts. */
+ auto_vec<ipa_polymorphic_call_context, 32> m_known_contexts;
+
+ /* Vector describing known aggregate values. */
+ auto_vec<ipa_agg_value_set, 32> m_known_aggs;
+
+ /* Vector describing known value ranges of arguments. */
+ auto_vec<value_range, 32> m_known_value_ranges;
+};
+
+/* Class bundling the various potentially known properties about actual
+ arguments of a particular call. This variant does not deallocate the
+ bundled data in any way. */
+
+class ipa_call_arg_values
+{
+public:
+ /* Default constructor, setting the vectors to empty ones. */
+ ipa_call_arg_values ()
+ {}
+
+ /* Construct this general variant of the bundle from the variant which uses
+ auto_vecs to hold the vectors. This means that vectors of objects
+ constructed with this constructor should not be changed because if they
+ get reallocated, the member vectors and the underlying auto_vecs would get
+ out of sync. */
+ ipa_call_arg_values (ipa_auto_call_arg_values *aavals)
+ : m_known_vals (aavals->m_known_vals),
+ m_known_contexts (aavals->m_known_contexts),
+ m_known_aggs (aavals->m_known_aggs),
+ m_known_value_ranges (aavals->m_known_value_ranges)
+ {}
+
+ /* If m_known_vals (vector of known "scalar" values) is sufficiantly long,
+ return its element at INDEX, otherwise return NULL. */
+ tree safe_sval_at (int index)
+ {
+ /* TODO: Assert non-negative index here and test. */
+ if ((unsigned) index < m_known_vals.length ())
+ return m_known_vals[index];
+ return NULL;
+ }
+
+ /* If m_known_aggs is sufficiantly long, return the pointer rto its element
+ at INDEX, otherwise return NULL. */
+ ipa_agg_value_set *safe_aggval_at (int index)
+ {
+ /* TODO: Assert non-negative index here and test. */
+ if ((unsigned) index < m_known_aggs.length ())
+ return &m_known_aggs[index];
+ return NULL;
+ }
+
+ /* Vector describing known values of parameters. */
+ vec<tree> m_known_vals = vNULL;
+
+ /* Vector describing known polymorphic call contexts. */
+ vec<ipa_polymorphic_call_context> m_known_contexts = vNULL;
+
+ /* Vector describing known aggregate values. */
+ vec<ipa_agg_value_set> m_known_aggs = vNULL;
+
+ /* Vector describing known value ranges of arguments. */
+ vec<value_range> m_known_value_ranges = vNULL;
+};
+
+
/* Summary describing a single formal parameter. */
struct GTY(()) ipa_param_descriptor
@@ -970,12 +1071,13 @@ void ipa_initialize_node_params (struct cgraph_node *node);
bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs,
vec<cgraph_edge *> *new_edges);
-/* Indirect edge and binfo processing. */
+/* Indirect edge processing and target discovery. */
+tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
+ ipa_call_arg_values *avals,
+ bool *speculative);
tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
- vec<tree>,
- vec<ipa_polymorphic_call_context>,
- vec<ipa_agg_value_set>,
- bool *);
+ ipa_auto_call_arg_values *avals,
+ bool *speculative);
struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree,
bool speculative = false);
tree ipa_impossible_devirt_target (struct cgraph_edge *, tree);
@@ -1042,6 +1144,8 @@ void ipa_dump_param (FILE *, class ipa_node_params *info, int i);
void ipa_release_body_info (struct ipa_func_body_info *);
tree ipa_get_callee_param_type (struct cgraph_edge *e, int i);
bool ipcp_get_parm_bits (tree, tree *, widest_int *);
+bool unadjusted_ptr_and_unit_offset (tree op, tree *ret,
+ poly_int64 *offset_ret);
/* From tree-sra.c: */
tree build_ref_for_offset (location_t, tree, poly_int64, bool, tree,
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 564c662..054f359 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3. If not see
#include "symbol-summary.h"
#include "ipa-prop.h"
#include "ipa-fnsummary.h"
+#include "symtab-thunks.h"
/* Lattice values for const and pure functions. Everything starts out
being const, then may drop to pure and then neither depending on
@@ -381,13 +382,11 @@ check_op (funct_state local, tree t, bool checking_write)
fprintf (dump_file, " Volatile indirect ref is not const/pure\n");
return;
}
- else if (t
- && (INDIRECT_REF_P (t) || TREE_CODE (t) == MEM_REF)
- && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
- && !ptr_deref_may_alias_global_p (TREE_OPERAND (t, 0)))
+ else if (refs_local_or_readonly_memory_p (t))
{
if (dump_file)
- fprintf (dump_file, " Indirect ref to local memory is OK\n");
+ fprintf (dump_file, " Indirect ref to local or readonly "
+ "memory is OK\n");
return;
}
else if (checking_write)
@@ -744,6 +743,8 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
/* Do consider clobber as side effects before IPA, so we rather inline
C++ destructors and keep clobber semantics than eliminate them.
+ Similar logic is in ipa-modref.
+
TODO: We may get smarter during early optimizations on these and let
functions containing only clobbers to be optimized more. This is a common
case of C++ destructors. */
@@ -1025,11 +1026,11 @@ analyze_function (struct cgraph_node *fn, bool ipa)
flags_from_decl_or_type (fn->decl),
fn->cannot_return_p ());
- if (fn->thunk.thunk_p || fn->alias)
+ if (fn->thunk || fn->alias)
{
/* Thunk gets propagated through, so nothing interesting happens. */
gcc_assert (ipa);
- if (fn->thunk.thunk_p && fn->thunk.virtual_offset_p)
+ if (fn->thunk && thunk_info::get (fn)->virtual_offset_p)
l->pure_const_state = IPA_NEITHER;
return l;
}
@@ -1152,6 +1153,9 @@ funct_state_summary_t::insert (cgraph_node *node, funct_state_d *state)
new (state) funct_state_d (*a);
free (a);
}
+ else
+ /* Do not keep stale summaries. */
+ funct_state_summaries->remove (node);
}
/* Called when new clone is inserted to callgraph late. */
diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c
index 03e3fc5..8d4f580 100644
--- a/gcc/ipa-sra.c
+++ b/gcc/ipa-sra.c
@@ -2935,7 +2935,7 @@ check_for_caller_issues (struct cgraph_node *node, void *data)
for (cgraph_edge *cs = node->callers; cs; cs = cs->next_caller)
{
- if (cs->caller->thunk.thunk_p)
+ if (cs->caller->thunk)
{
issues->thunk = true;
/* TODO: We should be able to process at least some types of
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 23e7f71..2945380 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -297,7 +297,7 @@ ipa_reverse_postorder (struct cgraph_node **order)
&& (pass
|| (!node->address_taken
&& !node->inlined_to
- && !node->alias && !node->thunk.thunk_p
+ && !node->alias && !node->thunk
&& !node->only_called_directly_p ())))
{
stack_size = 0;
@@ -460,8 +460,8 @@ ipa_merge_profiles (struct cgraph_node *dst,
}
/* First handle functions with no gimple body. */
- if (dst->thunk.thunk_p || dst->alias
- || src->thunk.thunk_p || src->alias)
+ if (dst->thunk || dst->alias
+ || src->thunk || src->alias)
{
scale_ipa_profile_for_fn (dst, orig_count);
return;
diff --git a/gcc/ipa-visibility.c b/gcc/ipa-visibility.c
index 7c854f4..97d9388 100644
--- a/gcc/ipa-visibility.c
+++ b/gcc/ipa-visibility.c
@@ -95,7 +95,7 @@ non_local_p (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
return !(node->only_called_directly_or_aliased_p ()
/* i386 would need update to output thunk with local calling
conventions. */
- && !node->thunk.thunk_p
+ && !node->thunk
&& node->definition
&& !DECL_EXTERNAL (node->decl)
&& !lookup_attribute ("noipa", DECL_ATTRIBUTES (node->decl))
@@ -112,7 +112,7 @@ cgraph_node::local_p (void)
{
cgraph_node *n = ultimate_alias_target ();
- if (n->thunk.thunk_p)
+ if (n->thunk)
return n->callees->callee->local_p ();
return !n->call_for_symbol_thunks_and_aliases (non_local_p,
NULL, true);
@@ -729,7 +729,7 @@ function_and_variable_visibility (bool whole_program)
&& !DECL_EXTERNAL (node->decl))
localize_node (whole_program, node);
- if (node->thunk.thunk_p
+ if (node->thunk
&& TREE_PUBLIC (node->decl))
{
struct cgraph_node *decl_node = node;
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 288b58c..cd0facf 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -475,7 +475,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
}
}
- else if (cnode->thunk.thunk_p)
+ else if (cnode->thunk)
enqueue_node (cnode->callees->callee, &first, &reachable);
/* If any reachable function has simd clones, mark them as
@@ -525,7 +525,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
/* We keep definitions of thunks and aliases in the boundary so
we can walk to the ultimate alias targets and function symbols
reliably. */
- if (node->alias || node->thunk.thunk_p)
+ if (node->alias || node->thunk)
;
else if (!body_needed_for_clonning.contains (node->decl))
{
@@ -537,7 +537,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
}
else if (!node->clone_of)
gcc_assert (in_lto_p || DECL_RESULT (node->decl));
- if (node->definition && !node->alias && !node->thunk.thunk_p)
+ if (node->definition && !node->alias && !node->thunk)
{
if (file)
fprintf (file, " %s", node->dump_name ());
@@ -547,7 +547,7 @@ symbol_table::remove_unreachable_nodes (FILE *file)
node->cpp_implicit_alias = false;
node->alias = false;
node->transparent_alias = false;
- node->thunk.thunk_p = false;
+ node->thunk = false;
node->weakref = false;
/* After early inlining we drop always_inline attributes on
bodies of functions that are still referenced (have their
@@ -1386,43 +1386,3 @@ make_pass_ipa_single_use (gcc::context *ctxt)
return new pass_ipa_single_use (ctxt);
}
-/* Materialize all clones. */
-
-namespace {
-
-const pass_data pass_data_materialize_all_clones =
-{
- SIMPLE_IPA_PASS, /* type */
- "materialize-all-clones", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- TV_IPA_OPT, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0, /* todo_flags_finish */
-};
-
-class pass_materialize_all_clones : public simple_ipa_opt_pass
-{
-public:
- pass_materialize_all_clones (gcc::context *ctxt)
- : simple_ipa_opt_pass (pass_data_materialize_all_clones, ctxt)
- {}
-
- /* opt_pass methods: */
- virtual unsigned int execute (function *)
- {
- symtab->materialize_all_clones ();
- return 0;
- }
-
-}; // class pass_materialize_all_clones
-
-} // anon namespace
-
-simple_ipa_opt_pass *
-make_pass_materialize_all_clones (gcc::context *ctxt)
-{
- return new pass_materialize_all_clones (ctxt);
-}
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 0bbdb4d..9b35d0e 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -128,7 +128,6 @@ create_loop_tree_nodes (void)
bool skip_p;
edge_iterator ei;
edge e;
- vec<edge> edges;
loop_p loop;
ira_bb_nodes
@@ -173,14 +172,13 @@ create_loop_tree_nodes (void)
}
if (skip_p)
continue;
- edges = get_loop_exit_edges (loop);
+ auto_vec<edge> edges = get_loop_exit_edges (loop);
FOR_EACH_VEC_ELT (edges, j, e)
if ((e->flags & EDGE_ABNORMAL) && EDGE_CRITICAL_P (e))
{
skip_p = true;
break;
}
- edges.release ();
if (skip_p)
continue;
}
@@ -1964,17 +1962,15 @@ create_loop_tree_node_allocnos (ira_loop_tree_node_t loop_node)
int i;
edge_iterator ei;
edge e;
- vec<edge> edges;
ira_assert (current_loops != NULL);
FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds)
if (e->src != loop_node->loop->latch)
create_loop_allocnos (e);
- edges = get_loop_exit_edges (loop_node->loop);
+ auto_vec<edge> edges = get_loop_exit_edges (loop_node->loop);
FOR_EACH_VEC_ELT (edges, i, e)
create_loop_allocnos (e);
- edges.release ();
}
}
@@ -2167,13 +2163,12 @@ loop_with_complex_edge_p (class loop *loop)
int i;
edge_iterator ei;
edge e;
- vec<edge> edges;
bool res;
FOR_EACH_EDGE (e, ei, loop->header->preds)
if (e->flags & EDGE_EH)
return true;
- edges = get_loop_exit_edges (loop);
+ auto_vec<edge> edges = get_loop_exit_edges (loop);
res = false;
FOR_EACH_VEC_ELT (edges, i, e)
if (e->flags & EDGE_COMPLEX)
@@ -2181,7 +2176,6 @@ loop_with_complex_edge_p (class loop *loop)
res = true;
break;
}
- edges.release ();
return res;
}
#endif
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index dbb3b7a..d3f8e23 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -2539,7 +2539,6 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
int freq, i;
edge_iterator ei;
edge e;
- vec<edge> edges;
ira_assert (current_loops != NULL && loop_node->loop != NULL
&& (regno < 0 || regno >= FIRST_PSEUDO_REGISTER));
@@ -2555,13 +2554,12 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
}
else
{
- edges = get_loop_exit_edges (loop_node->loop);
+ auto_vec<edge> edges = get_loop_exit_edges (loop_node->loop);
FOR_EACH_VEC_ELT (edges, i, e)
if (regno < 0
|| (bitmap_bit_p (df_get_live_out (e->src), regno)
&& bitmap_bit_p (df_get_live_in (e->dest), regno)))
freq += EDGE_FREQUENCY (e);
- edges.release ();
}
return REG_FREQ_FROM_EDGE_FREQ (freq);
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 6891156..aeda658 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -781,7 +781,8 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
case CT_SPECIAL_MEMORY:
insn_allows_mem[i] = allows_mem[i] = 1;
- if (MEM_P (op) && constraint_satisfied_p (op, cn))
+ if (MEM_P (extract_mem_from_operand (op))
+ && constraint_satisfied_p (op, cn))
win = 1;
break;
@@ -1397,15 +1398,16 @@ record_operand_costs (rtx_insn *insn, enum reg_class *pref)
commutative. */
for (i = 0; i < recog_data.n_operands; i++)
{
+ rtx op_mem = extract_mem_from_operand (recog_data.operand[i]);
memcpy (op_costs[i], init_cost, struct_costs_size);
if (GET_CODE (recog_data.operand[i]) == SUBREG)
recog_data.operand[i] = SUBREG_REG (recog_data.operand[i]);
- if (MEM_P (recog_data.operand[i]))
- record_address_regs (GET_MODE (recog_data.operand[i]),
- MEM_ADDR_SPACE (recog_data.operand[i]),
- XEXP (recog_data.operand[i], 0),
+ if (MEM_P (op_mem))
+ record_address_regs (GET_MODE (op_mem),
+ MEM_ADDR_SPACE (op_mem),
+ XEXP (op_mem, 0),
0, MEM, SCRATCH, frequency * 2);
else if (constraints[i][0] == 'p'
|| (insn_extra_address_constraint
diff --git a/gcc/ira.c b/gcc/ira.c
index 27d1b3c..a61138c 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1868,7 +1868,7 @@ ira_setup_alts (rtx_insn *insn)
case CT_MEMORY:
case CT_SPECIAL_MEMORY:
- if (MEM_P (op))
+ if (MEM_P (extract_mem_from_operand (op)))
goto op_success;
win_p = true;
break;
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 693c776..e1efe62 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1580,7 +1580,7 @@ analyze_insns_in_loop (class loop *loop)
struct var_to_expand *ves = NULL;
iv_to_split **slot1;
var_to_expand **slot2;
- vec<edge> edges = get_loop_exit_edges (loop);
+ auto_vec<edge> edges = get_loop_exit_edges (loop);
edge exit;
bool can_apply = false;
@@ -1656,7 +1656,6 @@ analyze_insns_in_loop (class loop *loop)
}
}
- edges.release ();
free (body);
return opt_info;
}
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 301c912..b5c010d 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -416,14 +416,34 @@ valid_address_p (rtx op, struct address_info *ad,
return valid_address_p (ad->mode, *ad->outer, ad->as);
}
+/* For special_memory_operand, it could be false for MEM_P (op),
+ i.e. bcst_mem_operand in i386 backend.
+ Extract and return real memory operand or op. */
+rtx
+extract_mem_from_operand (rtx op)
+{
+ for (rtx x = op;; x = XEXP (x, 0))
+ {
+ if (MEM_P (x))
+ return x;
+ if (GET_RTX_LENGTH (GET_CODE (x)) != 1
+ || GET_RTX_FORMAT (GET_CODE (x))[0] != 'e')
+ break;
+ }
+ return op;
+}
+
/* Return true if the eliminated form of memory reference OP satisfies
extra (special) memory constraint CONSTRAINT. */
static bool
satisfies_memory_constraint_p (rtx op, enum constraint_num constraint)
{
struct address_info ad;
+ rtx mem = extract_mem_from_operand (op);
+ if (!MEM_P (mem))
+ return false;
- decompose_mem_address (&ad, op);
+ decompose_mem_address (&ad, mem);
address_eliminator eliminator (&ad);
return constraint_satisfied_p (op, constraint);
}
@@ -1132,8 +1152,13 @@ match_reload (signed char out, signed char *ins, signed char *outs,
narrow_reload_pseudo_class (out_rtx, goal_class);
if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX)
{
+ reg = SUBREG_P (out_rtx) ? SUBREG_REG (out_rtx) : out_rtx;
start_sequence ();
- if (out >= 0 && curr_static_id->operand[out].strict_low)
+ /* If we had strict_low_part, use it also in reload to keep other
+ parts unchanged but do it only for regs as strict_low_part
+ has no sense for memory and probably there is no insn pattern
+ to match the reload insn in memory case. */
+ if (out >= 0 && curr_static_id->operand[out].strict_low && REG_P (reg))
out_rtx = gen_rtx_STRICT_LOW_PART (VOIDmode, out_rtx);
lra_emit_move (out_rtx, copy_rtx (new_out_reg));
emit_insn (*after);
@@ -2401,8 +2426,7 @@ process_alt_operands (int only_alternative)
break;
case CT_MEMORY:
- if (MEM_P (op)
- && satisfies_memory_constraint_p (op, cn))
+ if (satisfies_memory_constraint_p (op, cn))
win = true;
else if (spilled_pseudo_p (op))
win = true;
@@ -2443,8 +2467,7 @@ process_alt_operands (int only_alternative)
break;
case CT_SPECIAL_MEMORY:
- if (MEM_P (op)
- && satisfies_memory_constraint_p (op, cn))
+ if (satisfies_memory_constraint_p (op, cn))
win = true;
else if (spilled_pseudo_p (op))
win = true;
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 93a99f3..19d4ca5 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -39,6 +39,9 @@ along with GCC; see the file COPYING3. If not see
#include "omp-offload.h"
#include "stringpool.h"
#include "attribs.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
/* True when asm nodes has been output. */
bool asm_nodes_output = false;
@@ -261,7 +264,7 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
: gimple_uid (edge->call_stmt) + 1;
bp_pack_enum (&bp, cgraph_inline_failed_t,
CIF_N_REASONS, edge->inline_failed);
- gcc_checking_assert (uid || edge->caller->thunk.thunk_p);
+ gcc_checking_assert (uid || edge->caller->thunk);
bp_pack_var_len_unsigned (&bp, uid);
bp_pack_value (&bp, edge->speculative_id, 16);
bp_pack_value (&bp, edge->indirect_inlining_edge, 1);
@@ -393,7 +396,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node);
if (node->analyzed && (!boundary_p || node->alias
- || (node->thunk.thunk_p && !node->inlined_to)))
+ || (node->thunk && !node->inlined_to)))
tag = LTO_symtab_analyzed_node;
else
tag = LTO_symtab_unavail_node;
@@ -533,10 +536,19 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bp_pack_value (&bp, node->nonfreeing_fn, 1);
bp_pack_value (&bp, node->merged_comdat, 1);
bp_pack_value (&bp, node->merged_extern_inline, 1);
- bp_pack_value (&bp, node->thunk.thunk_p, 1);
+ bp_pack_value (&bp, node->thunk, 1);
bp_pack_value (&bp, node->parallelized_function, 1);
bp_pack_value (&bp, node->declare_variant_alt, 1);
bp_pack_value (&bp, node->calls_declare_variant_alt, 1);
+
+ /* Stream thunk info always because we use it in
+ ipa_polymorphic_call_context::ipa_polymorphic_call_context
+ to properly interpret THIS pointers for thunks that has been converted
+ to Gimple. */
+ struct thunk_info *thunk = node->definition ? thunk_info::get (node) : NULL;
+
+ bp_pack_value (&bp, thunk != NULL, 1);
+
bp_pack_enum (&bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN,
/* When doing incremental link, we will get new resolution
@@ -546,26 +558,15 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
streamer_write_bitpack (&bp);
streamer_write_data_stream (ob->main_stream, section, strlen (section) + 1);
- /* Stream thunk info always because we use it in
- ipa_polymorphic_call_context::ipa_polymorphic_call_context
- to properly interpret THIS pointers for thunks that has been converted
- to Gimple. */
- if (node->definition)
- {
- streamer_write_uhwi_stream
- (ob->main_stream,
- 1 + (node->thunk.this_adjusting != 0) * 2
- + (node->thunk.virtual_offset_p != 0) * 4);
- streamer_write_uhwi_stream (ob->main_stream, node->thunk.fixed_offset);
- streamer_write_uhwi_stream (ob->main_stream, node->thunk.virtual_value);
- streamer_write_uhwi_stream (ob->main_stream, node->thunk.indirect_offset);
- }
streamer_write_hwi_stream (ob->main_stream, node->profile_id);
streamer_write_hwi_stream (ob->main_stream, node->unit_id);
if (DECL_STATIC_CONSTRUCTOR (node->decl))
streamer_write_hwi_stream (ob->main_stream, node->get_init_priority ());
if (DECL_STATIC_DESTRUCTOR (node->decl))
streamer_write_hwi_stream (ob->main_stream, node->get_fini_priority ());
+
+ if (thunk)
+ thunk_info::get (node)->stream_out (ob);
}
/* Output the varpool NODE to OB.
@@ -931,7 +932,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
if (node->alias && node->analyzed)
create_references (encoder, node);
if (cnode
- && cnode->thunk.thunk_p && !cnode->inlined_to)
+ && cnode->thunk && !cnode->inlined_to)
add_node_to (encoder, cnode->callees->callee, false);
while (node->transparent_alias && node->analyzed)
{
@@ -987,7 +988,7 @@ output_symtab (void)
{
node = dyn_cast <cgraph_node *> (lto_symtab_encoder_deref (encoder, i));
if (node
- && ((node->thunk.thunk_p && !node->inlined_to)
+ && ((node->thunk && !node->inlined_to)
|| lto_symtab_encoder_in_partition_p (encoder, node)))
{
output_outgoing_cgraph_edges (node->callees, ob, encoder);
@@ -1139,13 +1140,14 @@ verify_node_partition (symtab_node *node)
NODE or to replace the values in it, for instance because the first
time we saw it, the function body was not available but now it
is. BP is a bitpack with all the bitflags for NODE read from the
- stream. */
+ stream. Initialize HAS_THUNK_INFO to indicate if thunk info should
+ be streamed in. */
static void
input_overwrite_node (struct lto_file_decl_data *file_data,
struct cgraph_node *node,
enum LTO_symtab_tags tag,
- struct bitpack_d *bp)
+ struct bitpack_d *bp, bool *has_thunk_info)
{
node->aux = (void *) tag;
node->lto_file_data = file_data;
@@ -1194,10 +1196,11 @@ input_overwrite_node (struct lto_file_decl_data *file_data,
node->nonfreeing_fn = bp_unpack_value (bp, 1);
node->merged_comdat = bp_unpack_value (bp, 1);
node->merged_extern_inline = bp_unpack_value (bp, 1);
- node->thunk.thunk_p = bp_unpack_value (bp, 1);
+ node->thunk = bp_unpack_value (bp, 1);
node->parallelized_function = bp_unpack_value (bp, 1);
node->declare_variant_alt = bp_unpack_value (bp, 1);
node->calls_declare_variant_alt = bp_unpack_value (bp, 1);
+ *has_thunk_info = bp_unpack_value (bp, 1);
node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
LDPR_NUM_KNOWN);
node->split_part = bp_unpack_value (bp, 1);
@@ -1235,6 +1238,7 @@ input_node (struct lto_file_decl_data *file_data,
const char *section;
order = streamer_read_hwi (ib) + file_data->order_base;
clone_ref = streamer_read_hwi (ib);
+ bool has_thunk_info;
fn_decl = lto_input_fn_decl_ref (ib, file_data);
@@ -1294,7 +1298,7 @@ input_node (struct lto_file_decl_data *file_data,
bp = streamer_read_bitpack (ib);
- input_overwrite_node (file_data, node, tag, &bp);
+ input_overwrite_node (file_data, node, tag, &bp, &has_thunk_info);
/* Store a reference for now, and fix up later to be a pointer. */
node->inlined_to = (cgraph_node *) (intptr_t) ref;
@@ -1311,19 +1315,6 @@ input_node (struct lto_file_decl_data *file_data,
if (section)
node->set_section_for_node (section);
- if (node->definition)
- {
- int type = streamer_read_uhwi (ib);
- HOST_WIDE_INT fixed_offset = streamer_read_uhwi (ib);
- HOST_WIDE_INT virtual_value = streamer_read_uhwi (ib);
- HOST_WIDE_INT indirect_offset = streamer_read_uhwi (ib);
-
- node->thunk.fixed_offset = fixed_offset;
- node->thunk.virtual_value = virtual_value;
- node->thunk.indirect_offset = indirect_offset;
- node->thunk.this_adjusting = (type & 2);
- node->thunk.virtual_offset_p = (type & 4);
- }
if (node->alias && !node->analyzed && node->weakref)
node->alias_target = get_alias_symbol (node->decl);
node->profile_id = streamer_read_hwi (ib);
@@ -1335,6 +1326,9 @@ input_node (struct lto_file_decl_data *file_data,
if (DECL_STATIC_DESTRUCTOR (node->decl))
node->set_fini_priority (streamer_read_hwi (ib));
+ if (has_thunk_info)
+ thunk_info::get_create (node)->stream_in (ib);
+
return node;
}
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index a7837c4..64037f7 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -1232,12 +1232,12 @@ fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts)
orig = orig->clone_of;
fn = DECL_STRUCT_FUNCTION (orig->decl);
- if (!orig->thunk.thunk_p)
+ if (!orig->thunk)
fixup_call_stmt_edges_1 (orig, stmts, fn);
if (orig->clones)
for (node = orig->clones; node != orig;)
{
- if (!node->thunk.thunk_p)
+ if (!node->thunk)
fixup_call_stmt_edges_1 (node, stmts, fn);
if (node->clones)
node = node->clones;
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 82cfa6b..b2af3ca 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -950,7 +950,7 @@ compile_offload_image (const char *target, const char *compiler_path,
obstack_ptr_grow (&argv_obstack, NULL);
argv = XOBFINISH (&argv_obstack, char **);
- fork_execute (argv[0], argv, true);
+ fork_execute (argv[0], argv, true, "offload_args");
obstack_free (&argv_obstack, NULL);
free_array_of_ptrs ((void **) paths, n_paths);
@@ -1026,7 +1026,7 @@ copy_file (const char *dest, const char *src)
the copy to the linker. */
static void
-find_crtoffloadtable (void)
+find_crtoffloadtable (int save_temps, const char *dumppfx)
{
char **paths = NULL;
const char *library_path = getenv ("LIBRARY_PATH");
@@ -1039,7 +1039,11 @@ find_crtoffloadtable (void)
if (access_check (paths[i], R_OK) == 0)
{
/* The linker will delete the filename we give it, so make a copy. */
- char *crtoffloadtable = make_temp_file (".crtoffloadtable.o");
+ char *crtoffloadtable;
+ if (!save_temps)
+ crtoffloadtable = make_temp_file (".crtoffloadtable.o");
+ else
+ crtoffloadtable = concat (dumppfx, "crtoffloadtable.o", NULL);
copy_file (crtoffloadtable, paths[i]);
printf ("%s\n", crtoffloadtable);
XDELETEVEC (crtoffloadtable);
@@ -1330,6 +1334,26 @@ jobserver_active_p (void)
return JS_PREFIX "cannot access %<" JS_NEEDLE "%> file descriptors";
}
+/* Test that a make command is present and working, return true if so. */
+
+static bool
+make_exists (void)
+{
+ const char *make = "make";
+ char **make_argv = buildargv (getenv ("MAKE"));
+ if (make_argv)
+ make = make_argv[0];
+ const char *make_args[] = {make, "--version", NULL};
+
+ int exit_status = 0;
+ int err = 0;
+ const char *errmsg
+ = pex_one (PEX_SEARCH, make_args[0], CONST_CAST (char **, make_args),
+ "make", NULL, NULL, &exit_status, &err);
+ freeargv (make_argv);
+ return errmsg == NULL && exit_status == 0 && err == 0;
+}
+
/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
static void
@@ -1566,6 +1590,10 @@ run_gcc (unsigned argc, char *argv[])
}
}
+ /* We need make working for a parallel execution. */
+ if (parallel && !make_exists ())
+ parallel = 0;
+
if (!dumppfx)
{
if (!linker_output
@@ -1698,7 +1726,7 @@ cont1:
if (offload_names)
{
- find_crtoffloadtable ();
+ find_crtoffloadtable (save_temps, dumppfx);
for (i = 0; offload_names[i]; i++)
printf ("%s\n", offload_names[i]);
free_array_of_ptrs ((void **) offload_names, i);
@@ -1773,7 +1801,8 @@ cont1:
new_argv = XOBFINISH (&argv_obstack, const char **);
argv_ptr = &new_argv[new_head_argc];
- fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true);
+ fork_execute (new_argv[0], CONST_CAST (char **, new_argv), true,
+ "ltrans_args");
/* Copy the early generated debug info from the objects to temporary
files and append those to the partial link commandline. */
@@ -1917,8 +1946,12 @@ cont:
}
else
{
+ char argsuffix[sizeof (DUMPBASE_SUFFIX) + 1];
+ if (save_temps)
+ snprintf (argsuffix, sizeof (DUMPBASE_SUFFIX),
+ "ltrans%u.ltrans_args", i);
fork_execute (new_argv[0], CONST_CAST (char **, new_argv),
- true);
+ true, save_temps ? argsuffix : NULL);
maybe_unlink (input_name);
}
@@ -1969,7 +2002,7 @@ cont:
new_argv = XOBFINISH (&argv_obstack, const char **);
pex = collect_execute (new_argv[0], CONST_CAST (char **, new_argv),
- NULL, NULL, PEX_SEARCH, false);
+ NULL, NULL, PEX_SEARCH, false, NULL);
do_wait (new_argv[0], pex);
freeargv (make_argv);
maybe_unlink (makefile);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 1fe3248..5fbbce8 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-23 Jan Hubicka <hubicka@ucw.cz>
+
+ * lto-partition.c (add_symbol_to_partition_1): Update for new thunk
+ api.
+
2020-08-27 Martin Liska <mliska@suse.cz>
* lto-common.c (lto_file_finalize): Set exact argument of a vector
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 8e0488a..7c15181 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -181,7 +181,7 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
/* Add all thunks associated with the function. */
for (e = cnode->callers; e; e = e->next_caller)
- if (e->caller->thunk.thunk_p && !e->caller->inlined_to)
+ if (e->caller->thunk && !e->caller->inlined_to)
add_symbol_to_partition_1 (part, e->caller);
}
diff --git a/gcc/match.pd b/gcc/match.pd
index 7d63bb9..17ba041 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -607,12 +607,22 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* Optimize TRUNC_MOD_EXPR by a power of two into a BIT_AND_EXPR,
i.e. "X % C" into "X & (C - 1)", if X and C are positive.
Also optimize A % (C << N) where C is a power of 2,
- to A & ((C << N) - 1). */
+ to A & ((C << N) - 1).
+ Also optimize "A shift (B % C)", if C is a power of 2, to
+ "A shift (B & (C - 1))". SHIFT operation include "<<" and ">>"
+ and assume (B % C) is nonnegative as shifts negative values would
+ be UB. */
(match (power_of_two_cand @1)
INTEGER_CST@1)
(match (power_of_two_cand @1)
(lshift INTEGER_CST@1 @2))
(for mod (trunc_mod floor_mod)
+ (for shift (lshift rshift)
+ (simplify
+ (shift @0 (mod @1 (power_of_two_cand@2 @3)))
+ (if (integer_pow2p (@3) && tree_int_cst_sgn (@3) > 0)
+ (shift @0 (bit_and @1 (minus @2 { build_int_cst (TREE_TYPE (@2),
+ 1); }))))))
(simplify
(mod @0 (convert?@3 (power_of_two_cand@1 @2)))
(if ((TYPE_UNSIGNED (type)
@@ -3521,6 +3531,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (optimize_vectors_before_lowering_p () && types_match (@0, @1))
(vec_cond (bit_and (bit_not @0) @1) @2 @3)))
+/* Canonicalize mask ? { 0, ... } : { -1, ...} to ~mask if the mask
+ types are compatible. */
+(simplify
+ (vec_cond @0 VECTOR_CST@1 VECTOR_CST@2)
+ (if (VECTOR_BOOLEAN_TYPE_P (type)
+ && types_match (type, TREE_TYPE (@0)))
+ (if (integer_zerop (@1) && integer_all_onesp (@2))
+ (bit_not @0)
+ (if (integer_all_onesp (@1) && integer_zerop (@2))
+ @0))))
+
/* Simplification moved from fold_cond_expr_with_comparison. It may also
be extended. */
/* This pattern implements two kinds simplification:
@@ -5174,7 +5195,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(with {
const REAL_VALUE_TYPE *const value = TREE_REAL_CST_PTR (@0);
bool use_exp2 = false;
- if (targetm.libc_has_function (function_c99_misc)
+ if (targetm.libc_has_function (function_c99_misc, TREE_TYPE (@0))
&& value->cl == rvc_normal)
{
REAL_VALUE_TYPE frac_rvt = *value;
@@ -5473,7 +5494,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
cexpis (CEXPI)
(simplify
(cexps compositional_complex@0)
- (if (targetm.libc_has_function (function_c99_math_complex))
+ (if (targetm.libc_has_function (function_c99_math_complex, TREE_TYPE (@0)))
(complex
(mult (exps@1 (realpart @0)) (realpart (cexpis:type@2 (imagpart @0))))
(mult @1 (imagpart @2)))))))
@@ -5525,7 +5546,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* truncl(extend(x)) and trunc(extend(x)) -> extend(truncf(x)), etc.,
if x is a float. */
(if (optimize && canonicalize_math_p ()
- && targetm.libc_has_function (function_c99_misc))
+ && targetm.libc_has_function (function_c99_misc, NULL_TREE))
(simplify
(froms (convert float_value_p@0))
(convert (tos @0)))))
@@ -6185,7 +6206,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
&& direct_internal_fn_supported_p (IFN_CTZ, TREE_TYPE (@0),
OPTIMIZE_FOR_SPEED))
- (plus (CTZ:type @0) { build_one_cst (type); })))
+ (with { tree utype = unsigned_type_for (TREE_TYPE (@0)); }
+ (plus (CTZ:type (convert:utype @0)) { build_one_cst (type); }))))
#endif
(for ffs (BUILT_IN_FFS BUILT_IN_FFSL BUILT_IN_FFSLL
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index fd36c3d..f69d2d7 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,97 @@
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c
+ (create_global_decl): Update to allow the caller to
+ specify declaration or definition.
+ (create_hidden_decl): Likewise.
+ (next_runtime_abi_02_protocol_decl): Make the symbol
+ weak and hidden for later OS runtime versions.
+ (build_v2_protocol_list_address_table): Likewise.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c (objc_v2_build_ivar_ref): Test
+ DECL_C_BIT_FIELD to detect that an ivar is a bitfield.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c (FIXUP_NEEDED): Rename ...
+ (USE_FIXUP_BEFORE): ... to this.
+ (next_runtime_02_initialize): Likewise.
+ (next_runtime_abi_02_get_arg_type_list_base): Likewise.
+ (next_runtime_abi_02_build_objc_method_call): Likewise.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c (TAG_MSGSENDSUPER): Revised
+ spelling.
+ (TAG_MSGSENDID): Likewise.
+ (TAG_MSGSENDSUPER_STRET): Likewise.
+ (TAG_MSGSENDID_STRET): Likewise.
+ (FIXUP_NEEDED): Likewise.
+ (TAG_FIXUP): New.
+ (next_runtime_02_initialize): Adjust message calls to use
+ fixup variants only when required.
+ (next_runtime_abi_02_get_arg_type_list_base): Correct
+ indent.
+ (build_v2_build_objc_method_call): New.
+ (build_v2_objc_method_fixup_call): Split out from ...
+ (next_runtime_abi_02_build_objc_method_call): ... here.
+ Arrange to adjust the call on the basis of the target
+ runtime.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-runtime-shared-support.c (start_var_decl): Make the
+ decl_assembler_name follow the metadata name for C++ on NeXT
+ runtime platforms.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c
+ (next_runtime_abi_02_category_decl): Adjust category
+ superclass name ordering.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c (build_v2_super_template): Add new
+ fields to the template.
+ (build_v2_protocol_template): Build new field entries.
+ (generate_v2_meth_descriptor_table): Adjust to allow recording all
+ method types.
+ (generate_v2_meth_type_list): New.
+ (build_v2_protocol_initializer): Initialize the additional fields.
+ (generate_v2_protocols): Record method types for all entries and
+ generate the additional method type table.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c
+ (objc_get_superclass_ref_decl): Split this code out.
+ (next_runtime_abi_02_get_class_super_ref): Compute
+ super refs using the objc_get_superclass_ref_decl().
+ (next_runtime_abi_02_get_category_super_ref): Likewise.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c
+ (next_runtime_abi_02_init_metadata_attributes): Make protocol
+ refs a distinct section.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-next-runtime-abi-02.c
+ (next_runtime_abi_02_init_metadata_attributes): Attach metadata
+ for the special string sections to class, method and method type
+ string sections.
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-gnu-runtime-abi-01.c
+ (build_shared_structure_initializer): Remove references to
+ the NeXT runtime.
+ (generate_static_references): Likewise.
+
2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
* objc-act.c (objc_start_method_definition): Update to reflect
diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c
index c9959a7..25c0e01 100644
--- a/gcc/objc/objc-gnu-runtime-abi-01.c
+++ b/gcc/objc/objc-gnu-runtime-abi-01.c
@@ -1540,25 +1540,14 @@ build_shared_structure_initializer (tree type, tree isa, tree super,
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
}
- /* FIXME: Remove NeXT runtime code. */
- if (flag_next_runtime)
- {
- ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
- get_identifier ("objc_cache")));
- /* method_cache = */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, convert (ltyp, null_pointer_node));
- }
- else
- {
- /* dtable = */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
+ /* dtable = */
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
- /* subclass_list = */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
+ /* subclass_list = */
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
- /* sibling_class = */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
- }
+ /* sibling_class = */
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
/* protocol_list = */
ltyp = build_pointer_type (build_pointer_type (objc_protocol_template));
@@ -1572,11 +1561,6 @@ build_shared_structure_initializer (tree type, tree isa, tree super,
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
}
- /* FIXME: Remove NeXT runtime code. */
- if (flag_next_runtime)
- /* sel_id = NULL */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
-
/* gc_object_type = NULL */
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
@@ -1864,10 +1848,6 @@ generate_static_references (void)
char buf[BUFSIZE];
vec<constructor_elt, va_gc> *decls = NULL;
- /* FIXME: Remove NeXT runtime code. */
- if (flag_next_runtime)
- gcc_unreachable ();
-
for (cl_chain = objc_static_instances, num_class = 0;
cl_chain; cl_chain = TREE_CHAIN (cl_chain), num_class++)
{
diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index e401906..d7812ff 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -63,9 +63,15 @@ along with GCC; see the file COPYING3. If not see
#define TAG_GETMETACLASS "objc_getMetaClass"
#define TAG_MSGSEND "objc_msgSend"
-#define TAG_MSGSENDSUPER "objc_msgSendSuper"
+#define TAG_MSGSENDID "objc_msgSendId"
+#define TAG_MSGSENDSUPER "objc_msgSendSuper2"
#define TAG_MSGSEND_STRET "objc_msgSend_stret"
-#define TAG_MSGSENDSUPER_STRET "objc_msgSendSuper_stret"
+#define TAG_MSGSENDID_STRET "objc_msgSendId_stret"
+#define TAG_MSGSENDSUPER_STRET "objc_msgSendSuper2_stret"
+
+#define USE_FIXUP_BEFORE 100600
+#define TAG_FIXUP "_fixup"
+
#define TAG_NEXT_EHVTABLE_NAME "objc_ehtype_vtable"
#define TAG_V2_EH_TYPE "objc_ehtype_t"
@@ -305,8 +311,8 @@ next_runtime_abi_02_init_metadata_attributes (void)
meta_class = get_identifier ("G2_CLAS");
meta_metaclass = get_identifier ("G2_META");
- meta_category =
- meta_protocol = meta_base;
+ meta_category = meta_base;
+ meta_protocol = get_identifier ("V2_PCOL");
meta_clac_vars =
meta_clai_vars = meta_base;
@@ -323,9 +329,10 @@ next_runtime_abi_02_init_metadata_attributes (void)
meta_sel_refs = get_identifier ("V2_SRFS");
- meta_class_name =
- meta_meth_name =
- meta_meth_type =
+ meta_class_name = get_identifier ("V2_CNAM");
+ meta_meth_name = get_identifier ("V2_MNAM");
+
+ meta_meth_type = get_identifier ("V2_MTYP");
meta_prop_name_attr = get_identifier ("V2_STRG");
meta_mref = get_identifier ("V2_MREF");
@@ -385,32 +392,43 @@ static void next_runtime_02_initialize (void)
build_v2_protocol_template ();
build_v2_category_template ();
- /* id objc_msgSend_fixup_rtp (id, struct message_ref_t*, ...); */
- type = build_varargs_function_type_list (objc_object_type,
- objc_object_type,
- objc_v2_selector_type,
- NULL_TREE);
- umsg_fixup_decl = add_builtin_function ("objc_msgSend_fixup",
- type, 0, NOT_BUILT_IN,
+ bool fixup_p = flag_next_runtime < USE_FIXUP_BEFORE;
+ if (fixup_p)
+ {
+ /* id objc_msgSend_fixup_rtp (id, struct message_ref_t*, ...); */
+ type = build_varargs_function_type_list (objc_object_type,
+ objc_object_type,
+ objc_v2_selector_type,
+ NULL_TREE);
+ }
+ else
+ {
+ /* id objc_msgSendXXXX (id, SEL, ...); */
+ type = build_varargs_function_type_list (objc_object_type,
+ objc_object_type,
+ objc_selector_type,
+ NULL_TREE);
+ }
+ const char *fnam = fixup_p ? TAG_MSGSEND TAG_FIXUP : TAG_MSGSEND;
+ umsg_fixup_decl = add_builtin_function (fnam, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_fixup_decl) = 0;
/* id objc_msgSend_stret_fixup_rtp (id, struct message_ref_t*, ...); */
- umsg_stret_fixup_decl = add_builtin_function ("objc_msgSend_stret_fixup",
- type, 0, NOT_BUILT_IN,
+ fnam = fixup_p ? TAG_MSGSEND_STRET TAG_FIXUP : TAG_MSGSEND_STRET;
+ umsg_stret_fixup_decl = add_builtin_function (fnam, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_stret_fixup_decl) = 0;
/* id objc_msgSendId_fixup_rtp (id, struct message_ref_t*, ...); */
- umsg_id_fixup_decl = add_builtin_function ("objc_msgSendId_fixup",
- type, 0, NOT_BUILT_IN,
+ fnam = fixup_p ? TAG_MSGSENDID TAG_FIXUP : TAG_MSGSENDID;
+ umsg_id_fixup_decl = add_builtin_function (fnam, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_fixup_decl) = 0;
- /* id objc_msgSendId_stret_fixup_rtp
- (id, struct message_ref_t*, ...); */
- umsg_id_stret_fixup_decl = add_builtin_function ("objc_msgSendId_stret_fixup",
- type, 0, NOT_BUILT_IN,
+ /* id objc_msgSendId_stret_fixup_rtp (id, struct message_ref_t*, ...); */
+ fnam = fixup_p ? TAG_MSGSENDID_STRET TAG_FIXUP : TAG_MSGSENDID_STRET;
+ umsg_id_stret_fixup_decl = add_builtin_function (fnam, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_stret_fixup_decl) = 0;
@@ -420,17 +438,17 @@ static void next_runtime_02_initialize (void)
objc_super_type,
objc_v2_super_selector_type,
NULL_TREE);
- umsg_id_super2_fixup_decl = add_builtin_function ("objc_msgSendSuper2_fixup",
- type, 0, NOT_BUILT_IN,
+ fnam = fixup_p ? TAG_MSGSENDSUPER TAG_FIXUP : TAG_MSGSENDSUPER;
+ umsg_id_super2_fixup_decl = add_builtin_function (fnam, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_super2_fixup_decl) = 0;
/* id objc_msgSendSuper2_stret_fixup_rtp
(struct objc_super *, struct message_ref_t*, ...); */
- umsg_id_super2_stret_fixup_decl =
- add_builtin_function ("objc_msgSendSuper2_stret_fixup",
- type, 0, NOT_BUILT_IN,
- NULL, NULL_TREE);
+ fnam = fixup_p ? TAG_MSGSENDSUPER_STRET TAG_FIXUP : TAG_MSGSENDSUPER_STRET;
+ umsg_id_super2_stret_fixup_decl = add_builtin_function (fnam, type, 0,
+ NOT_BUILT_IN, NULL,
+ NULL_TREE);
TREE_NOTHROW (umsg_id_super2_stret_fixup_decl) = 0;
/* Present in the library, but unused by the FE. */
@@ -742,6 +760,9 @@ build_v2_super_template (void)
const struct _prop_list_t * const properties;
const uint32_t size;
const uint32_t flags;
+ const char ** extended_method_types;
+ const char * demangled_name;
+ const struct _prop_list_t * class_properties;
}
*/
static void
@@ -783,6 +804,16 @@ build_v2_protocol_template (void)
/* const uint32_t flags; */
add_field_decl (integer_type_node, "flags", &chain);
+ /* const char **extendedMethodTypes; */
+ tree ptr_to_ptr_to_char = build_pointer_type (string_type_node);
+ add_field_decl (ptr_to_ptr_to_char, "extended_method_types", &chain);
+
+ /* const char *demangledName; */
+ add_field_decl (string_type_node, "demangled_name", &chain);
+
+ /* const struct _prop_list_t *class_properties; */
+ add_field_decl (objc_prop_list_ptr, "class_properties", &chain);
+
objc_finish_struct (objc_v2_protocol_template, decls);
}
@@ -889,33 +920,39 @@ create_extern_decl (tree type, const char *name)
/* Create a globally visible definition for variable NAME of a given TYPE. The
finish_var_decl() routine will need to be called on it afterwards. */
+static tree
+create_global_decl (tree type, const char *name, bool is_def = false);
static tree
-create_global_decl (tree type, const char *name)
+create_global_decl (tree type, const char *name, bool is_def)
{
tree id = get_identifier (name);
tree var = hash_name_lookup (extern_names, id);
if (var)
- {
- DECL_EXTERNAL (var) = 0;
- TREE_STATIC (var) = 1;
- }
+ is_def = true;
else
{
var = start_var_decl (type, name);
hash_name_enter (extern_names, var);
}
+ if (is_def)
+ {
+ DECL_EXTERNAL (var) = 0;
+ TREE_STATIC (var) = 1;
+ }
TREE_PUBLIC (var) = 1;
return var;
}
/* Create a symbol with __attribute__ ((visibility ("hidden")))
attribute (private extern). */
+static tree
+create_hidden_decl (tree type, const char *name, bool is_def = false);
static tree
-create_hidden_decl (tree type, const char *name)
+create_hidden_decl (tree type, const char *name, bool is_def)
{
- tree decl = create_global_decl (type, name);
+ tree decl = create_global_decl (type, name, is_def);
DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
DECL_VISIBILITY_SPECIFIED (decl) = 1;
return decl;
@@ -966,9 +1003,9 @@ next_runtime_abi_02_category_decl (tree klass)
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
- IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)),
- IDENTIFIER_POINTER (CLASS_NAME (klass)));
+ snprintf (buf, BUFSIZE, "_OBJC_Category_%s_%s",
+ IDENTIFIER_POINTER (CLASS_NAME (klass)),
+ IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)));
decl = start_var_decl (objc_v2_category_template, buf);
OBJCMETA (decl, objc_meta, meta_category);
return decl;
@@ -983,7 +1020,13 @@ next_runtime_abi_02_protocol_decl (tree p)
/* static struct _objc_protocol _OBJC_Protocol_<mumble>; */
snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
- decl = start_var_decl (objc_v2_protocol_template, buf);
+ if (flag_next_runtime >= USE_FIXUP_BEFORE)
+ {
+ decl = create_hidden_decl (objc_v2_protocol_template, buf);
+ DECL_WEAK (decl) = true;
+ }
+ else
+ decl = start_var_decl (objc_v2_protocol_template, buf);
OBJCMETA (decl, objc_meta, meta_protocol);
return decl;
}
@@ -1120,10 +1163,12 @@ next_runtime_abi_02_get_arg_type_list_base (vec<tree, va_gc> **argtypes,
receiver_type = objc_object_type;
vec_safe_push (*argtypes, receiver_type);
- /* Selector type - will eventually change to `int'. */
- vec_safe_push (*argtypes,
- superflag ? objc_v2_super_selector_type
- : objc_v2_selector_type);
+ if (flag_next_runtime < USE_FIXUP_BEFORE)
+ /* Selector type - will eventually change to `int'. */
+ vec_safe_push (*argtypes, superflag ? objc_v2_super_selector_type
+ : objc_v2_selector_type);
+ else
+ vec_safe_push (*argtypes, objc_selector_type);
}
/* TODO: Merge this with the message refs. */
@@ -1362,12 +1407,7 @@ objc_v2_build_ivar_ref (tree datum, tree component)
return NULL_TREE;
/* This routine only handles non-bitfield fields */
- /* DECL_INITIAL macro is set to width of bitfield and can be relied
- on to check for bitfield ivars. Note that I cannot rely on
- DECL_BIT_FIELD macro because it is only set when the whole struct
- is seen (at finish_struct) and not when the ivar chain is
- built. */
- if (DECL_INITIAL (field))
+ if (DECL_C_BIT_FIELD (field))
return NULL_TREE;
create_ivar_offset_name (var_offset_name, CLASS_NAME (class_name), field);
@@ -1438,13 +1478,12 @@ build_v2_superclass_ref_decl (tree ident, bool inst)
static GTY (()) vec<ident_data_tuple, va_gc> *class_super_refs;
static GTY (()) vec<ident_data_tuple, va_gc> *metaclass_super_refs;
+/* Find or build a superclass reference decl for class NAME. */
+
static tree
-next_runtime_abi_02_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
- struct imp_entry *imp, bool inst_meth)
+objc_get_superclass_ref_decl (tree name, bool inst_meth)
{
tree decl;
- ident_data_tuple e;
- tree id = CLASS_NAME (imp->imp_context);
vec<ident_data_tuple, va_gc> *list = inst_meth ? class_super_refs
: metaclass_super_refs;
@@ -1454,10 +1493,10 @@ next_runtime_abi_02_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
ident_data_tuple *ref;
FOR_EACH_VEC_ELT (*list, count, ref)
{
- if (ref->ident == id)
+ if (ref->ident == name)
{
if (!ref->data)
- ref->data = build_v2_superclass_ref_decl (id, inst_meth);
+ ref->data = build_v2_superclass_ref_decl (name, inst_meth);
return ref->data;
}
}
@@ -1478,48 +1517,49 @@ next_runtime_abi_02_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
}
/* We come here if we don't find the entry - or if the table was yet
to be created. */
- decl = build_v2_superclass_ref_decl (id, inst_meth);
- e.ident = id;
+ decl = build_v2_superclass_ref_decl (name, inst_meth);
+ ident_data_tuple e;
+ e.ident = name;
e.data = decl;
vec_safe_push (list, e);
return decl;
}
+/* Get a reference to the superclass for IMP. */
+
+static tree
+next_runtime_abi_02_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
+ struct imp_entry *imp, bool inst_meth)
+{
+ tree name = CLASS_NAME (imp->imp_context);
+ return objc_get_superclass_ref_decl (name, inst_meth);
+}
+
+/* Get a reference to the superclass for category IMP. */
+
static tree
next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
- struct imp_entry *imp, bool inst_meth)
+ struct imp_entry *imp,
+ bool inst_meth)
{
- /* ??? is this OK when zero-link = true? */
- tree super_name = CLASS_SUPER_NAME (imp->imp_template);
- tree super_class;
-
- if (!flag_zero_link)
+ if (flag_zero_link)
{
- super_class = objc_get_class_reference (CLASS_NAME (imp->imp_template));
-
- if (!inst_meth)
-
- /* If we are in a class method, we must retrieve the
- _metaclass_ for the current class, pointed at by the
- class's "isa" pointer. The following assumes that "isa" is
- the first ivar in a class (which it must be). */
- super_class =
- build_indirect_ref (input_location,
- build_c_cast (input_location,
- build_pointer_type (objc_class_type),
- super_class),
- RO_UNARY_STAR);
- return super_class;
- }
- /* ??? Do we need to add the class ref anway for zero-link? */
- /* else do it the slow way. */
- super_class = (inst_meth ? objc_get_class_decl : objc_get_meta_class_decl);
- super_name = my_build_string_pointer (IDENTIFIER_LENGTH (super_name) + 1,
- IDENTIFIER_POINTER (super_name));
- /* super_class = objc_get{Meta}Class("CLASS_SUPER_NAME"); */
- return build_function_call (input_location,
- super_class,
- build_tree_list (NULL_TREE, super_name));
+ /* Do it the slow way. */
+ tree get_cl_fn = inst_meth ? objc_get_class_decl
+ : objc_get_meta_class_decl;
+ tree super_name = CLASS_SUPER_NAME (imp->imp_template);
+ super_name = my_build_string_pointer (IDENTIFIER_LENGTH (super_name) + 1,
+ IDENTIFIER_POINTER (super_name));
+ /* super_class = objc_get{Meta}Class("CLASS_SUPER_NAME"); */
+ return build_function_call (input_location, get_cl_fn,
+ build_tree_list (NULL_TREE, super_name));
+ }
+
+ /* This is the 'usual' path. */
+ tree cls_name = CLASS_NAME (imp->imp_template);
+ if (!inst_meth)
+ return objc_get_superclass_ref_decl (cls_name, inst_meth);
+ return objc_get_class_reference (cls_name);
}
static tree
@@ -1575,10 +1615,9 @@ objc_copy_to_temp_side_effect_params (tree fntype, tree values)
(*_msg.messenger) (receiver, &_msg, ...) */
static tree
-build_v2_build_objc_method_call (int super_flag, tree method_prototype,
- tree lookup_object, tree selector,
- tree method_params,
- bool check_for_nil)
+build_v2_objc_method_fixup_call (int super_flag, tree method_prototype,
+ tree lookup_object, tree selector,
+ tree method_params, bool check_for_nil)
{
tree ret_val;
tree sender, rcv_p, t;
@@ -1659,6 +1698,118 @@ build_v2_build_objc_method_call (int super_flag, tree method_prototype,
}
static tree
+build_v2_build_objc_method_call (int super, tree method_prototype,
+ tree lookup_object, tree selector,
+ tree method_params, location_t loc,
+ bool check_for_nil, bool rx_is_id)
+{
+ tree sender, sender_cast, method, t;
+ tree rcv_p = (super ? objc_super_type : objc_object_type);
+ vec<tree, va_gc> *parms;
+ unsigned nparm = (method_params ? list_length (method_params) : 0);
+
+ /* If a prototype for the method to be called exists, then cast
+ the sender's return type and arguments to match that of the method.
+ Otherwise, leave sender as is. */
+ tree ret_type
+ = (method_prototype
+ ? TREE_VALUE (TREE_TYPE (method_prototype))
+ : objc_object_type);
+ tree ftype = build_function_type_for_method (ret_type, method_prototype,
+ METHOD_REF, super);
+
+ if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype))
+ ftype = build_type_attribute_variant (ftype,
+ METHOD_TYPE_ATTRIBUTES
+ (method_prototype));
+
+ sender_cast = build_pointer_type (ftype);
+
+ lookup_object = build_c_cast (loc, rcv_p, lookup_object);
+
+ /* Use SAVE_EXPR to avoid evaluating the receiver twice. */
+ lookup_object = save_expr (lookup_object);
+
+ /* Param list + 2 slots for object and selector. */
+ vec_alloc (parms, nparm + 2);
+
+ /* If we are returning a struct in memory, and the address
+ of that memory location is passed as a hidden first
+ argument, then change which messenger entry point this
+ expr will call. NB: Note that sender_cast remains
+ unchanged (it already has a struct return type). */
+ if (!targetm.calls.struct_value_rtx (0, 0)
+ && (TREE_CODE (ret_type) == RECORD_TYPE
+ || TREE_CODE (ret_type) == UNION_TYPE)
+ && targetm.calls.return_in_memory (ret_type, 0))
+ {
+ if (super)
+ sender = umsg_id_super2_stret_fixup_decl;
+ else
+ sender = rx_is_id ? umsg_id_stret_fixup_decl
+ : umsg_stret_fixup_decl;
+ }
+ else
+ {
+ if (super)
+ sender = umsg_id_super2_fixup_decl;
+ else
+ sender = rx_is_id ? umsg_id_fixup_decl
+ : umsg_fixup_decl;
+ }
+
+ method = build_fold_addr_expr_loc (loc, sender);
+
+ /* Pass the object to the method. */
+ parms->quick_push (lookup_object);
+ /* Pass the selector to the method. */
+ parms->quick_push (selector);
+ /* Now append the remainder of the parms. */
+ if (nparm)
+ for (; method_params; method_params = TREE_CHAIN (method_params))
+ parms->quick_push (TREE_VALUE (method_params));
+
+ /* Build an obj_type_ref, with the correct cast for the method call. */
+ t = build3 (OBJ_TYPE_REF, sender_cast, method,
+ lookup_object, size_zero_node);
+ tree ret_val = build_function_call_vec (loc, vNULL, t, parms, NULL);
+ vec_free (parms);
+ if (check_for_nil)
+ {
+ /* receiver != nil ? ret_val : 0 */
+ tree ftree;
+ tree ifexp;
+
+ if (TREE_CODE (ret_type) == RECORD_TYPE
+ || TREE_CODE (ret_type) == UNION_TYPE)
+ {
+ vec<constructor_elt, va_gc> *rtt = NULL;
+ /* ??? CHECKME. hmmm..... think we need something more
+ here. */
+ CONSTRUCTOR_APPEND_ELT (rtt, NULL_TREE, NULL_TREE);
+ ftree = objc_build_constructor (ret_type, rtt);
+ }
+ else
+ ftree = fold_convert (ret_type, integer_zero_node);
+
+ ifexp = build_binary_op (loc, NE_EXPR,
+ lookup_object,
+ fold_convert (rcv_p, integer_zero_node), 1);
+
+#ifdef OBJCPLUS
+ ret_val = build_conditional_expr (loc, ifexp, ret_val, ftree,
+ tf_warning_or_error);
+#else
+ /* ??? CHECKME. */
+ ret_val = build_conditional_expr (loc, ifexp, 1,
+ ret_val, NULL_TREE, loc,
+ ftree, NULL_TREE, loc);
+#endif
+ }
+ return ret_val;
+}
+
+static tree
next_runtime_abi_02_build_objc_method_call (location_t loc,
tree method_prototype,
tree receiver,
@@ -1667,27 +1818,38 @@ next_runtime_abi_02_build_objc_method_call (location_t loc,
tree method_params,
int super)
{
- tree ret_type, selector;
- tree message_func_decl;
- bool check_for_nil = flag_objc_nilcheck;
-
- ret_type = method_prototype
- ? TREE_VALUE (TREE_TYPE (method_prototype))
- : objc_object_type;
-
/* Do we need to check for nil receivers ? */
/* For now, message sent to classes need no nil check. In the
future, class declaration marked as weak_import must be nil
checked. */
+ bool check_for_nil = flag_objc_nilcheck;
if (super
|| (TREE_CODE (receiver) == VAR_DECL
&& TREE_TYPE (receiver) == objc_class_type))
check_for_nil = false;
+ if (flag_next_runtime >= USE_FIXUP_BEFORE)
+ {
+ tree selector
+ = next_runtime_abi_02_build_selector_reference (loc, sel_name,
+ method_prototype);
+ return build_v2_build_objc_method_call (super, method_prototype,
+ receiver, selector,
+ method_params, loc,
+ check_for_nil,
+ objc_is_id (rtype));
+ }
+
+ /* else we have to build a pair of the function and selector. */
+ tree message_func_decl;
+ tree ret_type = method_prototype
+ ? TREE_VALUE (TREE_TYPE (method_prototype))
+ : objc_object_type;
+
if (!targetm.calls.struct_value_rtx (0, 0)
- && (TREE_CODE (ret_type) == RECORD_TYPE
- || TREE_CODE (ret_type) == UNION_TYPE)
- && targetm.calls.return_in_memory (ret_type, 0))
+ && (TREE_CODE (ret_type) == RECORD_TYPE
+ || TREE_CODE (ret_type) == UNION_TYPE)
+ && targetm.calls.return_in_memory (ret_type, 0))
{
if (super)
message_func_decl = umsg_id_super2_stret_fixup_decl;
@@ -1706,7 +1868,7 @@ next_runtime_abi_02_build_objc_method_call (location_t loc,
: umsg_fixup_decl;
}
- selector = build_v2_selector_messenger_reference (sel_name,
+ tree selector = build_v2_selector_messenger_reference (sel_name,
message_func_decl);
/* selector = &_msg; */
@@ -1717,9 +1879,9 @@ next_runtime_abi_02_build_objc_method_call (location_t loc,
selector);
/* (*_msg.messenger) (receiver, &_msg, ...); */
- return build_v2_build_objc_method_call (super, method_prototype,
- receiver, selector,
- method_params, check_for_nil);
+ return build_v2_objc_method_fixup_call (super, method_prototype, receiver,
+ selector, method_params,
+ check_for_nil);
}
/* NOTE --- Constant String Class Stuff --- */
@@ -2145,7 +2307,13 @@ build_v2_protocol_list_address_table (void)
gcc_assert (ref->id && TREE_CODE (ref->id) == PROTOCOL_INTERFACE_TYPE);
snprintf (buf, BUFSIZE, "_OBJC_LabelProtocol_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (ref->id)));
- decl = create_global_decl (objc_protocol_type, buf);
+ if (flag_next_runtime >= USE_FIXUP_BEFORE)
+ {
+ decl = create_hidden_decl (objc_protocol_type, buf, /*is def=*/true);
+ DECL_WEAK (decl) = true;
+ }
+ else
+ decl = create_global_decl (objc_protocol_type, buf, /*is def=*/true);
expr = convert (objc_protocol_type, build_fold_addr_expr (ref->refdecl));
OBJCMETA (decl, objc_meta, meta_label_protocollist);
finish_var_decl (decl, expr);
@@ -2295,9 +2463,10 @@ build_v2_method_list_template (tree list_type, int size)
objc_method_prototype_template which is missing this field. */
static tree
generate_v2_meth_descriptor_table (tree chain, tree protocol,
- const char *prefix, tree attr)
+ const char *prefix, tree attr,
+ vec<tree>& all_meths)
{
- tree method_list_template, initlist, decl, methods;
+ tree method_list_template, initlist, decl;
int size, entsize;
vec<constructor_elt, va_gc> *v = NULL;
char buf[BUFSIZE];
@@ -2305,13 +2474,14 @@ generate_v2_meth_descriptor_table (tree chain, tree protocol,
if (!chain || !prefix)
return NULL_TREE;
- methods = chain;
+ tree method = chain;
size = 0;
- while (methods)
+ while (method)
{
- if (! METHOD_ENCODING (methods))
- METHOD_ENCODING (methods) = encode_method_prototype (methods);
- methods = TREE_CHAIN (methods);
+ if (! METHOD_ENCODING (method))
+ METHOD_ENCODING (method) = encode_method_prototype (method);
+ all_meths.safe_push (method);
+ method = TREE_CHAIN (method);
size++;
}
@@ -2336,6 +2506,31 @@ generate_v2_meth_descriptor_table (tree chain, tree protocol,
return decl;
}
+static tree
+generate_v2_meth_type_list (vec<tree>& all_meths, tree protocol,
+ const char *prefix)
+{
+ if (all_meths.is_empty () || !prefix)
+ return NULL_TREE;
+
+ unsigned size = all_meths.length ();
+ tree list_type = build_sized_array_type (string_type_node, size);
+ char *nam;
+ asprintf (&nam, "%s_%s", prefix,
+ IDENTIFIER_POINTER (PROTOCOL_NAME (protocol)));
+ tree decl = start_var_decl (list_type, nam);
+ free (nam);
+ OBJCMETA (decl, objc_meta, meta_base);
+ vec<constructor_elt, va_gc> *v = NULL;
+
+ for (unsigned i = 0; i < size; ++i)
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ add_objc_string (METHOD_ENCODING (all_meths[i]),
+ meth_var_types));
+ finish_var_decl (decl, objc_build_constructor (list_type, v));
+ return decl;
+}
+
/* This routine builds the initializer list to initialize the 'struct
_prop_t prop_list[]' field of 'struct _prop_list_t' meta-data. */
@@ -2462,7 +2657,8 @@ static tree
build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list,
tree inst_methods, tree class_methods,
tree opt_ins_meth, tree opt_cls_meth,
- tree property_list)
+ tree property_list, tree ext_meth_types,
+ tree demangled_name, tree class_prop_list)
{
tree expr, ttyp;
location_t loc;
@@ -2517,7 +2713,28 @@ build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list
/* const uint32_t flags; = 0 */
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, integer_zero_node);
- return objc_build_constructor (type, inits);
+ ttyp = build_pointer_type (string_type_node);
+ if (ext_meth_types)
+ expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, ext_meth_types, 0));
+ else
+ expr = convert (ttyp, null_pointer_node);
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr);
+
+ ttyp = string_type_node;
+ if (demangled_name)
+ expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, demangled_name, 0));
+ else
+ expr = convert (ttyp, null_pointer_node);
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr);
+
+ ttyp = objc_prop_list_ptr;
+ if (class_prop_list)
+ expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, class_prop_list, 0));
+ else
+ expr = convert (ttyp, null_pointer_node);
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr);
+
+ return objc_build_constructor (type, inits);
}
/* Main routine to build all meta data for all protocols used in a
@@ -2553,25 +2770,26 @@ generate_v2_protocols (void)
loc = DECL_SOURCE_LOCATION (decl);
some = true;
+ vec<tree> all_meths = vNULL;
inst_meth =
generate_v2_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p,
"_OBJC_ProtocolInstanceMethods",
- meta_proto_nst_meth);
+ meta_proto_nst_meth, all_meths);
class_meth =
generate_v2_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p,
"_OBJC_ProtocolClassMethods",
- meta_proto_cls_meth);
+ meta_proto_cls_meth, all_meths);
opt_inst_meth =
generate_v2_meth_descriptor_table (PROTOCOL_OPTIONAL_NST_METHODS (p), p,
- "_OBJC_OptProtocolInstMethods",
- meta_proto_nst_meth);
+ "_OBJC_ProtocolOptInstMethods",
+ meta_proto_nst_meth, all_meths);
opt_class_meth =
generate_v2_meth_descriptor_table (PROTOCOL_OPTIONAL_CLS_METHODS (p), p,
- "_OBJC_OptProtocolClassMethods",
- meta_proto_cls_meth);
+ "_OBJC_ProtocolOptClassMethods",
+ meta_proto_cls_meth, all_meths);
if (PROTOCOL_LIST (p))
refs_decl = generate_v2_protocol_list (p, NULL_TREE);
@@ -2589,13 +2807,21 @@ generate_v2_protocols (void)
props = generate_v2_property_table (p, NULL_TREE);
+ tree ext_meth_types
+ = generate_v2_meth_type_list (all_meths, p,
+ "_OBJC_ProtocolMethodTypes");
+ tree demangled_name = NULL_TREE;
+ tree class_prop_list = NULL_TREE;
+
initlist = build_v2_protocol_initializer (TREE_TYPE (decl),
protocol_name_expr, refs_expr,
inst_meth, class_meth,
opt_inst_meth, opt_class_meth,
- props);
+ props, ext_meth_types,
+ demangled_name,class_prop_list);
finish_var_decl (decl, initlist);
objc_add_to_protocol_list (p, decl);
+ all_meths.truncate (0);
}
if (some)
diff --git a/gcc/objc/objc-runtime-shared-support.c b/gcc/objc/objc-runtime-shared-support.c
index 4aecc7f..16d4d63 100644
--- a/gcc/objc/objc-runtime-shared-support.c
+++ b/gcc/objc/objc-runtime-shared-support.c
@@ -117,14 +117,17 @@ add_field_decl (tree type, const char *name, tree **chain)
tree
start_var_decl (tree type, const char *name)
{
- tree var = build_decl (input_location,
- VAR_DECL, get_identifier (name), type);
- TREE_STATIC (var) = 1;
+ tree name_id = get_identifier (name);
+ tree var = build_decl (input_location, VAR_DECL, name_id, type);
DECL_INITIAL (var) = error_mark_node; /* A real initializer is coming... */
+ TREE_STATIC (var) = 1;
DECL_IGNORED_P (var) = 1;
DECL_ARTIFICIAL (var) = 1;
DECL_CONTEXT (var) = NULL_TREE;
#ifdef OBJCPLUS
+ /* Meta-data for the NeXT runtime is expected to be 'extern "C"'. */
+ if (flag_next_runtime)
+ SET_DECL_ASSEMBLER_NAME (var, name_id);
DECL_THIS_STATIC (var) = 1; /* squash redeclaration errors */
#endif
return var;
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index c8d5075..64a0deb 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,14 @@
+2020-09-25 Nathan Sidwell <nathan@acm.org>
+
+ * objcp-decl.c (objcp_start_struct): Use TAG_how not tag_scope.
+ (objcp_xref_tag): Likewise.
+
+2020-09-24 Nathan Sidwell <nathan@acm.org>
+
+ * objcp-decl.c (objcp_start_struct): Drop default args to
+ xref_tag.
+ (objcp_xref_tag): Likewise.
+
2020-01-01 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
diff --git a/gcc/objcp/objcp-decl.c b/gcc/objcp/objcp-decl.c
index 9ae7f23..c6c4ee5 100644
--- a/gcc/objcp/objcp-decl.c
+++ b/gcc/objcp/objcp-decl.c
@@ -41,7 +41,7 @@ objcp_start_struct (location_t loc ATTRIBUTE_UNUSED,
if (!name)
name = make_anon_name ();
- s = xref_tag (record_type, name, ts_global, 0);
+ s = xref_tag (record_type, name, TAG_how::GLOBAL);
CLASSTYPE_DECLARED_CLASS (s) = 0; /* this is a 'struct', not a 'class'. */
xref_basetypes (s, NULL_TREE); /* no base classes here! */
@@ -84,7 +84,7 @@ objcp_finish_function (void)
tree
objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
{
- return xref_tag (record_type, name, ts_global, false);
+ return xref_tag (record_type, name, TAG_how::GLOBAL);
}
int
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 8f1286e..6583c88 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -1700,8 +1700,8 @@ expand_oacc_collapse_vars (const struct omp_for_data *fd, bool inner,
loops, do this only for the rectangular loops. Then pick
the loops which reference outer vars in their bound expressions
and the loops which they refer to and for this sub-nest compute
- number of iterations. For triangular loops use Faulhaber's formula
- (TBD.), otherwise as a fallback, compute by iterating the loops.
+ number of iterations. For triangular loops use Faulhaber's formula,
+ otherwise as a fallback, compute by iterating the loops.
If e.g. the sub-nest is
for (I = N11; I COND1 N12; I += STEP1)
for (J = M21 * I + N21; J COND2 M22 * I + N22; J += STEP2)
@@ -1790,6 +1790,23 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
else
counts[0] = NULL_TREE;
}
+ if (fd->non_rect
+ && fd->last_nonrect == fd->first_nonrect + 1
+ && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v)))
+ {
+ tree c[4];
+ for (i = 0; i < 4; i++)
+ {
+ innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
+ OMP_CLAUSE__LOOPTEMP_);
+ gcc_assert (innerc);
+ c[i] = OMP_CLAUSE_DECL (innerc);
+ }
+ counts[0] = c[0];
+ fd->first_inner_iterations = c[1];
+ fd->factor = c[2];
+ fd->adjn1 = c[3];
+ }
return;
}
@@ -2383,7 +2400,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
into its _looptemp_ temporaries instead.
For non-rectangular loops (between fd->first_nonrect and fd->last_nonrect
inclusive), use the count of all those loops together, and either
- find quadratic etc. equation roots (TBD), or as a fallback, do:
+ find quadratic etc. equation roots, or as a fallback, do:
COUNT = 0;
for (tmpi = N11; tmpi COND1 N12; tmpi += STEP1)
for (tmpj = M21 * tmpi + N21;
@@ -2434,7 +2451,12 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
use it. */
tree innerc = omp_find_clause (clauses, OMP_CLAUSE__LOOPTEMP_);
gcc_assert (innerc);
- for (i = 0; i < fd->collapse; i++)
+ int count = 0;
+ if (fd->non_rect
+ && fd->last_nonrect == fd->first_nonrect + 1
+ && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v)))
+ count = 4;
+ for (i = 0; i < fd->collapse + count; i++)
{
innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
OMP_CLAUSE__LOOPTEMP_);
@@ -2442,7 +2464,19 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
if (i)
{
tree tem = OMP_CLAUSE_DECL (innerc);
- tree t = fold_convert (TREE_TYPE (tem), counts[i]);
+ tree t;
+ if (i < fd->collapse)
+ t = counts[i];
+ else
+ switch (i - fd->collapse)
+ {
+ case 0: t = counts[0]; break;
+ case 1: t = fd->first_inner_iterations; break;
+ case 2: t = fd->factor; break;
+ case 3: t = fd->adjn1; break;
+ default: gcc_unreachable ();
+ }
+ t = fold_convert (TREE_TYPE (tem), t);
t = force_gimple_operand_gsi (gsi, t, false, NULL_TREE,
false, GSI_CONTINUE_LINKING);
gassign *stmt = gimple_build_assign (tem, t);
@@ -2478,10 +2512,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
basic_block bb_triang = NULL, bb_triang_dom = NULL;
if (fd->first_nonrect + 1 == fd->last_nonrect
&& (TREE_CODE (fd->loop.n2) == INTEGER_CST
- || (fd->first_inner_iterations
- /* For now. Later add clauses to propagate the
- values. */
- && !gimple_omp_for_combined_into_p (fd->for_stmt)))
+ || fd->first_inner_iterations)
&& (optab_handler (sqrt_optab, TYPE_MODE (double_type_node))
!= CODE_FOR_nothing))
{
@@ -4641,6 +4672,35 @@ expand_omp_scantemp_alloc (tree clauses, tree ptr, unsigned HOST_WIDE_INT sz,
return ptr;
}
+/* Return the last _looptemp_ clause if one has been created for
+ lastprivate on distribute parallel for{, simd} or taskloop.
+ FD is the loop data and INNERC should be the second _looptemp_
+ clause (the one holding the end of the range).
+ This is followed by collapse - 1 _looptemp_ clauses for the
+ counts[1] and up, and for triangular loops followed by 4
+ further _looptemp_ clauses (one for counts[0], one first_inner_iterations,
+ one factor and one adjn1). After this there is optionally one
+ _looptemp_ clause that this function returns. */
+
+static tree
+find_lastprivate_looptemp (struct omp_for_data *fd, tree innerc)
+{
+ gcc_assert (innerc);
+ int count = fd->collapse - 1;
+ if (fd->non_rect
+ && fd->last_nonrect == fd->first_nonrect + 1
+ && !TYPE_UNSIGNED (TREE_TYPE (fd->loops[fd->last_nonrect].v)))
+ count += 4;
+ for (int i = 0; i < count; i++)
+ {
+ innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
+ OMP_CLAUSE__LOOPTEMP_);
+ gcc_assert (innerc);
+ }
+ return omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
+ OMP_CLAUSE__LOOPTEMP_);
+}
+
/* A subroutine of expand_omp_for. Generate code for a parallel
loop with static schedule and no specified chunk size. Given
parameters:
@@ -5065,15 +5125,7 @@ expand_omp_for_static_nochunk (struct omp_region *region,
if (fd->collapse > 1 && TREE_CODE (fd->loop.n2) != INTEGER_CST
&& gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_DISTRIBUTE)
{
- int i;
- for (i = 1; i < fd->collapse; i++)
- {
- innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
- OMP_CLAUSE__LOOPTEMP_);
- gcc_assert (innerc);
- }
- innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
- OMP_CLAUSE__LOOPTEMP_);
+ innerc = find_lastprivate_looptemp (fd, innerc);
if (innerc)
{
/* If needed (distribute parallel for with lastprivate),
@@ -5790,15 +5842,7 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (fd->collapse > 1 && TREE_CODE (fd->loop.n2) != INTEGER_CST
&& gimple_omp_for_kind (fd->for_stmt) == GF_OMP_FOR_KIND_DISTRIBUTE)
{
- int i;
- for (i = 1; i < fd->collapse; i++)
- {
- innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
- OMP_CLAUSE__LOOPTEMP_);
- gcc_assert (innerc);
- }
- innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
- OMP_CLAUSE__LOOPTEMP_);
+ innerc = find_lastprivate_looptemp (fd, innerc);
if (innerc)
{
/* If needed (distribute parallel for with lastprivate),
@@ -6203,49 +6247,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
if (V cond N2) goto L0; else goto L2;
L2:
- For collapsed loops, given parameters:
- collapse(3)
- for (V1 = N11; V1 cond1 N12; V1 += STEP1)
- for (V2 = N21; V2 cond2 N22; V2 += STEP2)
- for (V3 = N31; V3 cond3 N32; V3 += STEP3)
- BODY;
-
- we generate pseudocode
-
- if (cond3 is <)
- adj = STEP3 - 1;
- else
- adj = STEP3 + 1;
- count3 = (adj + N32 - N31) / STEP3;
- if (cond2 is <)
- adj = STEP2 - 1;
- else
- adj = STEP2 + 1;
- count2 = (adj + N22 - N21) / STEP2;
- if (cond1 is <)
- adj = STEP1 - 1;
- else
- adj = STEP1 + 1;
- count1 = (adj + N12 - N11) / STEP1;
- count = count1 * count2 * count3;
- V = 0;
- V1 = N11;
- V2 = N21;
- V3 = N31;
- goto L1;
- L0:
- BODY;
- V += 1;
- V3 += STEP3;
- V2 += (V3 cond3 N32) ? 0 : STEP2;
- V3 = (V3 cond3 N32) ? V3 : N31;
- V1 += (V2 cond2 N22) ? 0 : STEP1;
- V2 = (V2 cond2 N22) ? V2 : N21;
- L1:
- if (V < count) goto L0; else goto L2;
- L2:
-
- */
+ For collapsed loops, emit the outer loops as scalar
+ and only try to vectorize the innermost loop. */
static void
expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
@@ -6319,7 +6322,9 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
/* Not needed in SSA form right now. */
gcc_assert (!gimple_in_ssa_p (cfun));
- if (fd->collapse > 1)
+ if (fd->collapse > 1
+ && (gimple_omp_for_combined_into_p (fd->for_stmt)
+ || broken_loop))
{
int first_zero_iter = -1, dummy = -1;
basic_block zero_iter_bb = l2_bb, dummy_bb = NULL;
@@ -6383,24 +6388,165 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
step = fold_build2 (MULT_EXPR, TREE_TYPE (step), step, vf);
}
- expand_omp_build_assign (&gsi, fd->loop.v, fold_convert (type, n1));
+ tree n2var = NULL_TREE;
+ tree n2v = NULL_TREE;
+ tree *nonrect_bounds = NULL;
+ tree min_arg1 = NULL_TREE, min_arg2 = NULL_TREE;
if (fd->collapse > 1)
{
- if (gimple_omp_for_combined_into_p (fd->for_stmt))
+ if (broken_loop || gimple_omp_for_combined_into_p (fd->for_stmt))
{
+ if (fd->non_rect)
+ {
+ nonrect_bounds = XALLOCAVEC (tree, fd->last_nonrect + 1);
+ memset (nonrect_bounds, 0,
+ sizeof (tree) * (fd->last_nonrect + 1));
+ }
+ expand_omp_build_assign (&gsi, fd->loop.v, fold_convert (type, n1));
+ gcc_assert (entry_bb == gsi_bb (gsi));
+ gcc_assert (fd->for_stmt == gsi_stmt (gsi));
gsi_prev (&gsi);
- expand_omp_for_init_vars (fd, &gsi, counts, NULL, NULL, n1);
- gsi_next (&gsi);
+ entry_bb = split_block (entry_bb, gsi_stmt (gsi))->dest;
+ expand_omp_for_init_vars (fd, &gsi, counts, nonrect_bounds,
+ NULL, n1);
+ gsi = gsi_for_stmt (fd->for_stmt);
+ }
+ if (broken_loop)
+ ;
+ else if (gimple_omp_for_combined_into_p (fd->for_stmt))
+ {
+ /* Compute in n2var the limit for the first innermost loop,
+ i.e. fd->loop.v + MIN (n2 - fd->loop.v, cnt)
+ where cnt is how many iterations would the loop have if
+ all further iterations were assigned to the current task. */
+ n2var = create_tmp_var (type);
+ i = fd->collapse - 1;
+ tree itype = TREE_TYPE (fd->loops[i].v);
+ if (POINTER_TYPE_P (itype))
+ itype = signed_type_for (itype);
+ t = build_int_cst (itype, (fd->loops[i].cond_code == LT_EXPR
+ ? -1 : 1));
+ t = fold_build2 (PLUS_EXPR, itype,
+ fold_convert (itype, fd->loops[i].step), t);
+ t = fold_build2 (PLUS_EXPR, itype, t,
+ fold_convert (itype, fd->loops[i].n2));
+ if (fd->loops[i].m2)
+ {
+ tree t2 = fold_convert (itype,
+ fd->loops[i - fd->loops[i].outer].v);
+ tree t3 = fold_convert (itype, fd->loops[i].m2);
+ t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
+ t = fold_build2 (PLUS_EXPR, itype, t, t2);
+ }
+ t = fold_build2 (MINUS_EXPR, itype, t,
+ fold_convert (itype, fd->loops[i].v));
+ if (TYPE_UNSIGNED (itype) && fd->loops[i].cond_code == GT_EXPR)
+ t = fold_build2 (TRUNC_DIV_EXPR, itype,
+ fold_build1 (NEGATE_EXPR, itype, t),
+ fold_build1 (NEGATE_EXPR, itype,
+ fold_convert (itype,
+ fd->loops[i].step)));
+ else
+ t = fold_build2 (TRUNC_DIV_EXPR, itype, t,
+ fold_convert (itype, fd->loops[i].step));
+ t = fold_convert (type, t);
+ tree t2 = fold_build2 (MINUS_EXPR, type, n2, n1);
+ min_arg1 = create_tmp_var (type);
+ expand_omp_build_assign (&gsi, min_arg1, t2);
+ min_arg2 = create_tmp_var (type);
+ expand_omp_build_assign (&gsi, min_arg2, t);
}
else
- for (i = 0; i < fd->collapse; i++)
- {
- tree itype = TREE_TYPE (fd->loops[i].v);
- if (POINTER_TYPE_P (itype))
- itype = signed_type_for (itype);
- t = fold_convert (TREE_TYPE (fd->loops[i].v), fd->loops[i].n1);
- expand_omp_build_assign (&gsi, fd->loops[i].v, t);
- }
+ {
+ if (TREE_CODE (n2) == INTEGER_CST)
+ {
+ /* Indicate for lastprivate handling that at least one iteration
+ has been performed, without wasting runtime. */
+ if (integer_nonzerop (n2))
+ expand_omp_build_assign (&gsi, fd->loop.v,
+ fold_convert (type, n2));
+ else
+ /* Indicate that no iteration has been performed. */
+ expand_omp_build_assign (&gsi, fd->loop.v,
+ build_one_cst (type));
+ }
+ else
+ {
+ expand_omp_build_assign (&gsi, fd->loop.v,
+ build_zero_cst (type));
+ expand_omp_build_assign (&gsi, n2, build_one_cst (type));
+ }
+ for (i = 0; i < fd->collapse; i++)
+ {
+ t = fold_convert (TREE_TYPE (fd->loops[i].v), fd->loops[i].n1);
+ if (fd->loops[i].m1)
+ {
+ tree t2
+ = fold_convert (TREE_TYPE (t),
+ fd->loops[i - fd->loops[i].outer].v);
+ tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i].m1);
+ t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ }
+ expand_omp_build_assign (&gsi, fd->loops[i].v, t);
+ /* For normal non-combined collapsed loops just initialize
+ the outermost iterator in the entry_bb. */
+ if (!broken_loop)
+ break;
+ }
+ }
+ }
+ else
+ expand_omp_build_assign (&gsi, fd->loop.v, fold_convert (type, n1));
+ tree altv = NULL_TREE, altn2 = NULL_TREE;
+ if (fd->collapse == 1
+ && !broken_loop
+ && TREE_CODE (fd->loops[0].step) != INTEGER_CST)
+ {
+ /* The vectorizer currently punts on loops with non-constant steps
+ for the main IV (can't compute number of iterations and gives up
+ because of that). As for OpenMP loops it is always possible to
+ compute the number of iterations upfront, use an alternate IV
+ as the loop iterator:
+ altn2 = n1 < n2 ? (n2 - n1 + step - 1) / step : 0;
+ for (i = n1, altv = 0; altv < altn2; altv++, i += step) */
+ altv = create_tmp_var (unsigned_type_for (TREE_TYPE (fd->loops[0].v)));
+ expand_omp_build_assign (&gsi, altv, build_zero_cst (TREE_TYPE (altv)));
+ tree itype = TREE_TYPE (fd->loop.v);
+ if (POINTER_TYPE_P (itype))
+ itype = signed_type_for (itype);
+ t = build_int_cst (itype, (fd->loop.cond_code == LT_EXPR ? -1 : 1));
+ t = fold_build2 (PLUS_EXPR, itype,
+ fold_convert (itype, fd->loop.step), t);
+ t = fold_build2 (PLUS_EXPR, itype, t, fold_convert (itype, n2));
+ t = fold_build2 (MINUS_EXPR, itype, t,
+ fold_convert (itype, fd->loop.v));
+ if (TYPE_UNSIGNED (itype) && fd->loop.cond_code == GT_EXPR)
+ t = fold_build2 (TRUNC_DIV_EXPR, itype,
+ fold_build1 (NEGATE_EXPR, itype, t),
+ fold_build1 (NEGATE_EXPR, itype,
+ fold_convert (itype, fd->loop.step)));
+ else
+ t = fold_build2 (TRUNC_DIV_EXPR, itype, t,
+ fold_convert (itype, fd->loop.step));
+ t = fold_convert (TREE_TYPE (altv), t);
+ altn2 = create_tmp_var (TREE_TYPE (altv));
+ expand_omp_build_assign (&gsi, altn2, t);
+ tree t2 = fold_convert (TREE_TYPE (fd->loop.v), n2);
+ t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ t2 = fold_build2 (fd->loop.cond_code, boolean_type_node, fd->loop.v, t2);
+ gassign *g = gimple_build_assign (altn2, COND_EXPR, t2, altn2,
+ build_zero_cst (TREE_TYPE (altv)));
+ gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+ }
+ else if (fd->collapse > 1
+ && !broken_loop
+ && !gimple_omp_for_combined_into_p (fd->for_stmt)
+ && TREE_CODE (fd->loops[fd->collapse - 1].step) != INTEGER_CST)
+ {
+ altv = create_tmp_var (unsigned_type_for (TREE_TYPE (fd->loops[0].v)));
+ altn2 = create_tmp_var (TREE_TYPE (altv));
}
if (cond_var)
{
@@ -6425,11 +6571,23 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
stmt = gsi_stmt (gsi);
gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
- if (POINTER_TYPE_P (type))
- t = fold_build_pointer_plus (fd->loop.v, step);
- else
- t = fold_build2 (PLUS_EXPR, type, fd->loop.v, step);
- expand_omp_build_assign (&gsi, fd->loop.v, t);
+ if (fd->collapse == 1
+ || gimple_omp_for_combined_into_p (fd->for_stmt))
+ {
+ if (POINTER_TYPE_P (type))
+ t = fold_build_pointer_plus (fd->loop.v, step);
+ else
+ t = fold_build2 (PLUS_EXPR, type, fd->loop.v, step);
+ expand_omp_build_assign (&gsi, fd->loop.v, t);
+ }
+ else if (TREE_CODE (n2) != INTEGER_CST)
+ expand_omp_build_assign (&gsi, fd->loop.v, build_one_cst (type));
+ if (altv)
+ {
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (altv), altv,
+ build_one_cst (TREE_TYPE (altv)));
+ expand_omp_build_assign (&gsi, altv, t);
+ }
if (fd->collapse > 1)
{
@@ -6447,37 +6605,6 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
fd->loops[i].v, t);
}
expand_omp_build_assign (&gsi, fd->loops[i].v, t);
-
- for (i = fd->collapse - 1; i > 0; i--)
- {
- tree itype = TREE_TYPE (fd->loops[i].v);
- tree itype2 = TREE_TYPE (fd->loops[i - 1].v);
- if (POINTER_TYPE_P (itype2))
- itype2 = signed_type_for (itype2);
- t = fold_convert (itype2, fd->loops[i - 1].step);
- t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,
- GSI_SAME_STMT);
- t = build3 (COND_EXPR, itype2,
- build2 (fd->loops[i].cond_code, boolean_type_node,
- fd->loops[i].v,
- fold_convert (itype, fd->loops[i].n2)),
- build_int_cst (itype2, 0), t);
- if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i - 1].v)))
- t = fold_build_pointer_plus (fd->loops[i - 1].v, t);
- else
- t = fold_build2 (PLUS_EXPR, itype2, fd->loops[i - 1].v, t);
- expand_omp_build_assign (&gsi, fd->loops[i - 1].v, t);
-
- t = fold_convert (itype, fd->loops[i].n1);
- t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,
- GSI_SAME_STMT);
- t = build3 (COND_EXPR, itype,
- build2 (fd->loops[i].cond_code, boolean_type_node,
- fd->loops[i].v,
- fold_convert (itype, fd->loops[i].n2)),
- fd->loops[i].v, t);
- expand_omp_build_assign (&gsi, fd->loops[i].v, t);
- }
}
if (cond_var)
{
@@ -6500,14 +6627,40 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
/* Emit the condition in L1_BB. */
gsi = gsi_start_bb (l1_bb);
- t = fold_convert (type, n2);
- t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
- false, GSI_CONTINUE_LINKING);
- tree v = fd->loop.v;
- if (DECL_P (v) && TREE_ADDRESSABLE (v))
- v = force_gimple_operand_gsi (&gsi, v, true, NULL_TREE,
- false, GSI_CONTINUE_LINKING);
- t = build2 (fd->loop.cond_code, boolean_type_node, v, t);
+ if (altv)
+ t = build2 (LT_EXPR, boolean_type_node, altv, altn2);
+ else if (fd->collapse > 1
+ && !gimple_omp_for_combined_into_p (fd->for_stmt)
+ && !broken_loop)
+ {
+ i = fd->collapse - 1;
+ tree itype = TREE_TYPE (fd->loops[i].v);
+ if (fd->loops[i].m2)
+ t = n2v = create_tmp_var (itype);
+ else
+ t = fold_convert (itype, fd->loops[i].n2);
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ tree v = fd->loops[i].v;
+ if (DECL_P (v) && TREE_ADDRESSABLE (v))
+ v = force_gimple_operand_gsi (&gsi, v, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ t = build2 (fd->loops[i].cond_code, boolean_type_node, v, t);
+ }
+ else
+ {
+ if (fd->collapse > 1 && !broken_loop)
+ t = n2var;
+ else
+ t = fold_convert (type, n2);
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ tree v = fd->loop.v;
+ if (DECL_P (v) && TREE_ADDRESSABLE (v))
+ v = force_gimple_operand_gsi (&gsi, v, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ t = build2 (fd->loop.cond_code, boolean_type_node, v, t);
+ }
cond_stmt = gimple_build_cond_empty (t);
gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING);
if (walk_tree (gimple_cond_lhs_ptr (cond_stmt), expand_omp_regimplify_p,
@@ -6572,12 +6725,213 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
FALLTHRU_EDGE (entry_bb)->flags = EDGE_TRUE_VALUE;
FALLTHRU_EDGE (entry_bb)->probability
= profile_probability::guessed_always ().apply_scale (7, 8);
- BRANCH_EDGE (entry_bb)->probability
+ BRANCH_EDGE (entry_bb)->probability
= FALLTHRU_EDGE (entry_bb)->probability.invert ();
l2_dom_bb = entry_bb;
}
set_immediate_dominator (CDI_DOMINATORS, l2_bb, l2_dom_bb);
+ if (!broken_loop && fd->collapse > 1)
+ {
+ basic_block last_bb = l1_bb;
+ basic_block init_bb = NULL;
+ for (i = fd->collapse - 2; i >= 0; i--)
+ {
+ tree nextn2v = NULL_TREE;
+ if (EDGE_SUCC (last_bb, 0)->flags & EDGE_FALSE_VALUE)
+ e = EDGE_SUCC (last_bb, 0);
+ else
+ e = EDGE_SUCC (last_bb, 1);
+ basic_block bb = split_edge (e);
+ if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v)))
+ {
+ t = fold_convert (sizetype, fd->loops[i].step);
+ t = fold_build_pointer_plus (fd->loops[i].v, t);
+ }
+ else
+ {
+ t = fold_convert (TREE_TYPE (fd->loops[i].v),
+ fd->loops[i].step);
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (fd->loops[i].v),
+ fd->loops[i].v, t);
+ }
+ gsi = gsi_after_labels (bb);
+ expand_omp_build_assign (&gsi, fd->loops[i].v, t);
+
+ bb = split_block (bb, last_stmt (bb))->dest;
+ gsi = gsi_start_bb (bb);
+ tree itype = TREE_TYPE (fd->loops[i].v);
+ if (fd->loops[i].m2)
+ t = nextn2v = create_tmp_var (itype);
+ else
+ t = fold_convert (itype, fd->loops[i].n2);
+ t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ tree v = fd->loops[i].v;
+ if (DECL_P (v) && TREE_ADDRESSABLE (v))
+ v = force_gimple_operand_gsi (&gsi, v, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ t = build2 (fd->loops[i].cond_code, boolean_type_node, v, t);
+ cond_stmt = gimple_build_cond_empty (t);
+ gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING);
+ if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
+ expand_omp_regimplify_p, NULL, NULL)
+ || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
+ expand_omp_regimplify_p, NULL, NULL))
+ {
+ gsi = gsi_for_stmt (cond_stmt);
+ gimple_regimplify_operands (cond_stmt, &gsi);
+ }
+ ne = single_succ_edge (bb);
+ ne->flags = EDGE_FALSE_VALUE;
+
+ init_bb = create_empty_bb (bb);
+ set_immediate_dominator (CDI_DOMINATORS, init_bb, bb);
+ add_bb_to_loop (init_bb, bb->loop_father);
+ e = make_edge (bb, init_bb, EDGE_TRUE_VALUE);
+ e->probability
+ = profile_probability::guessed_always ().apply_scale (7, 8);
+ ne->probability = e->probability.invert ();
+
+ gsi = gsi_after_labels (init_bb);
+ t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
+ fd->loops[i + 1].n1);
+ if (fd->loops[i + 1].m1)
+ {
+ tree t2 = fold_convert (TREE_TYPE (t),
+ fd->loops[i + 1
+ - fd->loops[i + 1].outer].v);
+ tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i + 1].m1);
+ t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ }
+ expand_omp_build_assign (&gsi, fd->loops[i + 1].v, t);
+ if (fd->loops[i + 1].m2)
+ {
+ if (i + 2 == fd->collapse && (n2var || altv))
+ {
+ gcc_assert (n2v == NULL_TREE);
+ n2v = create_tmp_var (TREE_TYPE (fd->loops[i + 1].v));
+ }
+ t = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
+ fd->loops[i + 1].n2);
+ tree t2 = fold_convert (TREE_TYPE (t),
+ fd->loops[i + 1
+ - fd->loops[i + 1].outer].v);
+ tree t3 = fold_convert (TREE_TYPE (t), fd->loops[i + 1].m2);
+ t2 = fold_build2 (MULT_EXPR, TREE_TYPE (t), t2, t3);
+ t = fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);
+ expand_omp_build_assign (&gsi, n2v, t);
+ }
+ if (i + 2 == fd->collapse && n2var)
+ {
+ /* For composite simd, n2 is the first iteration the current
+ task shouldn't already handle, so we effectively want to use
+ for (V3 = N31; V < N2 && V3 < N32; V++, V3 += STEP3)
+ as the vectorized loop. Except the vectorizer will not
+ vectorize that, so instead compute N2VAR as
+ N2VAR = V + MIN (N2 - V, COUNTS3) and use
+ for (V3 = N31; V < N2VAR; V++, V3 += STEP3)
+ as the loop to vectorize. */
+ tree t2 = fold_build2 (MINUS_EXPR, type, n2, fd->loop.v);
+ if (fd->loops[i + 1].m1 || fd->loops[i + 1].m2)
+ {
+ t = build_int_cst (itype, (fd->loops[i + 1].cond_code
+ == LT_EXPR ? -1 : 1));
+ t = fold_build2 (PLUS_EXPR, itype,
+ fold_convert (itype,
+ fd->loops[i + 1].step), t);
+ if (fd->loops[i + 1].m2)
+ t = fold_build2 (PLUS_EXPR, itype, t, n2v);
+ else
+ t = fold_build2 (PLUS_EXPR, itype, t,
+ fold_convert (itype,
+ fd->loops[i + 1].n2));
+ t = fold_build2 (MINUS_EXPR, itype, t,
+ fold_convert (itype, fd->loops[i + 1].v));
+ tree step = fold_convert (itype, fd->loops[i + 1].step);
+ if (TYPE_UNSIGNED (itype)
+ && fd->loops[i + 1].cond_code == GT_EXPR)
+ t = fold_build2 (TRUNC_DIV_EXPR, itype,
+ fold_build1 (NEGATE_EXPR, itype, t),
+ fold_build1 (NEGATE_EXPR, itype, step));
+ else
+ t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step);
+ t = fold_convert (type, t);
+ }
+ else
+ t = counts[i + 1];
+ expand_omp_build_assign (&gsi, min_arg1, t2);
+ expand_omp_build_assign (&gsi, min_arg2, t);
+ e = split_block (init_bb, last_stmt (init_bb));
+ gsi = gsi_after_labels (e->dest);
+ init_bb = e->dest;
+ remove_edge (FALLTHRU_EDGE (entry_bb));
+ make_edge (entry_bb, init_bb, EDGE_FALLTHRU);
+ set_immediate_dominator (CDI_DOMINATORS, init_bb, entry_bb);
+ set_immediate_dominator (CDI_DOMINATORS, l1_bb, init_bb);
+ t = fold_build2 (MIN_EXPR, type, min_arg1, min_arg2);
+ t = fold_build2 (PLUS_EXPR, type, fd->loop.v, t);
+ expand_omp_build_assign (&gsi, n2var, t);
+ }
+ if (i + 2 == fd->collapse && altv)
+ {
+ /* The vectorizer currently punts on loops with non-constant
+ steps for the main IV (can't compute number of iterations
+ and gives up because of that). As for OpenMP loops it is
+ always possible to compute the number of iterations upfront,
+ use an alternate IV as the loop iterator. */
+ expand_omp_build_assign (&gsi, altv,
+ build_zero_cst (TREE_TYPE (altv)));
+ tree itype = TREE_TYPE (fd->loops[i + 1].v);
+ if (POINTER_TYPE_P (itype))
+ itype = signed_type_for (itype);
+ t = build_int_cst (itype, (fd->loops[i + 1].cond_code == LT_EXPR
+ ? -1 : 1));
+ t = fold_build2 (PLUS_EXPR, itype,
+ fold_convert (itype, fd->loops[i + 1].step), t);
+ t = fold_build2 (PLUS_EXPR, itype, t,
+ fold_convert (itype,
+ fd->loops[i + 1].m2
+ ? n2v : fd->loops[i + 1].n2));
+ t = fold_build2 (MINUS_EXPR, itype, t,
+ fold_convert (itype, fd->loops[i + 1].v));
+ tree step = fold_convert (itype, fd->loops[i + 1].step);
+ if (TYPE_UNSIGNED (itype)
+ && fd->loops[i + 1].cond_code == GT_EXPR)
+ t = fold_build2 (TRUNC_DIV_EXPR, itype,
+ fold_build1 (NEGATE_EXPR, itype, t),
+ fold_build1 (NEGATE_EXPR, itype, step));
+ else
+ t = fold_build2 (TRUNC_DIV_EXPR, itype, t, step);
+ t = fold_convert (TREE_TYPE (altv), t);
+ expand_omp_build_assign (&gsi, altn2, t);
+ tree t2 = fold_convert (TREE_TYPE (fd->loops[i + 1].v),
+ fd->loops[i + 1].m2
+ ? n2v : fd->loops[i + 1].n2);
+ t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ t2 = fold_build2 (fd->loops[i + 1].cond_code, boolean_type_node,
+ fd->loops[i + 1].v, t2);
+ gassign *g
+ = gimple_build_assign (altn2, COND_EXPR, t2, altn2,
+ build_zero_cst (TREE_TYPE (altv)));
+ gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+ }
+ n2v = nextn2v;
+
+ make_edge (init_bb, last_bb, EDGE_FALLTHRU);
+ if (!gimple_omp_for_combined_into_p (fd->for_stmt))
+ {
+ e = find_edge (entry_bb, last_bb);
+ redirect_edge_succ (e, bb);
+ set_immediate_dominator (CDI_DOMINATORS, bb, entry_bb);
+ set_immediate_dominator (CDI_DOMINATORS, last_bb, init_bb);
+ }
+
+ last_bb = bb;
+ }
+ }
if (!broken_loop)
{
class loop *loop = alloc_loop ();
@@ -6731,15 +7085,7 @@ expand_omp_taskloop_for_outer (struct omp_region *region,
tree endvar = OMP_CLAUSE_DECL (innerc);
if (fd->collapse > 1 && TREE_CODE (fd->loop.n2) != INTEGER_CST)
{
- gcc_assert (innerc);
- for (i = 1; i < fd->collapse; i++)
- {
- innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
- OMP_CLAUSE__LOOPTEMP_);
- gcc_assert (innerc);
- }
- innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
- OMP_CLAUSE__LOOPTEMP_);
+ innerc = find_lastprivate_looptemp (fd, innerc);
if (innerc)
{
/* If needed (inner taskloop has lastprivate clause), propagate
@@ -7643,12 +7989,7 @@ expand_omp_for (struct omp_region *region, gimple *inner_stmt)
loops_state_set (LOOPS_NEED_FIXUP);
if (gimple_omp_for_kind (fd.for_stmt) == GF_OMP_FOR_KIND_SIMD)
- {
- if (fd.non_rect)
- sorry_at (gimple_location (fd.for_stmt),
- "non-rectangular %<simd%> not supported yet");
- expand_omp_simd (region, &fd);
- }
+ expand_omp_simd (region, &fd);
else if (gimple_omp_for_kind (fd.for_stmt) == GF_OMP_FOR_KIND_OACC_LOOP)
{
gcc_assert (!inner_stmt && !fd.non_rect);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 3d2a9d7..6d0aa8d 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1919,12 +1919,38 @@ add_taskreg_looptemp_clauses (enum gf_mask msk, gimple *stmt,
GIMPLE_OMP_FOR, add one more temporaries for the total number
of iterations (product of count1 ... countN-1). */
if (omp_find_clause (gimple_omp_for_clauses (for_stmt),
- OMP_CLAUSE_LASTPRIVATE))
- count++;
- else if (msk == GF_OMP_FOR_KIND_FOR
- && omp_find_clause (gimple_omp_parallel_clauses (stmt),
- OMP_CLAUSE_LASTPRIVATE))
- count++;
+ OMP_CLAUSE_LASTPRIVATE)
+ || (msk == GF_OMP_FOR_KIND_FOR
+ && omp_find_clause (gimple_omp_parallel_clauses (stmt),
+ OMP_CLAUSE_LASTPRIVATE)))
+ {
+ tree temp = create_tmp_var (type);
+ tree c = build_omp_clause (UNKNOWN_LOCATION,
+ OMP_CLAUSE__LOOPTEMP_);
+ insert_decl_map (&outer_ctx->cb, temp, temp);
+ OMP_CLAUSE_DECL (c) = temp;
+ OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
+ gimple_omp_taskreg_set_clauses (stmt, c);
+ }
+ if (fd.non_rect
+ && fd.last_nonrect == fd.first_nonrect + 1)
+ if (tree v = gimple_omp_for_index (for_stmt, fd.last_nonrect))
+ if (!TYPE_UNSIGNED (TREE_TYPE (v)))
+ {
+ v = gimple_omp_for_index (for_stmt, fd.first_nonrect);
+ tree type2 = TREE_TYPE (v);
+ count++;
+ for (i = 0; i < 3; i++)
+ {
+ tree temp = create_tmp_var (type2);
+ tree c = build_omp_clause (UNKNOWN_LOCATION,
+ OMP_CLAUSE__LOOPTEMP_);
+ insert_decl_map (&outer_ctx->cb, temp, temp);
+ OMP_CLAUSE_DECL (c) = temp;
+ OMP_CLAUSE_CHAIN (c) = gimple_omp_taskreg_clauses (stmt);
+ gimple_omp_taskreg_set_clauses (stmt, c);
+ }
+ }
}
for (i = 0; i < count; i++)
{
@@ -3729,7 +3755,8 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
if ((gimple_omp_for_kind (as_a <gomp_for *> (stmt))
== GF_OMP_FOR_KIND_SIMD)
&& omp_maybe_offloaded_ctx (ctx)
- && omp_max_simt_vf ())
+ && omp_max_simt_vf ()
+ && gimple_omp_for_collapse (stmt) == 1)
scan_omp_simd (gsi, as_a <gomp_for *> (stmt), ctx);
else
scan_omp_for (as_a <gomp_for *> (stmt), ctx);
@@ -5111,6 +5138,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
atmp = builtin_decl_explicit (BUILT_IN_ALLOCA_WITH_ALIGN);
stmt = gimple_build_call (atmp, 2, x,
size_int (DECL_ALIGN (var)));
+ cfun->calls_alloca = 1;
tmp = create_tmp_var_raw (ptr_type_node);
gimple_add_tmp_var (tmp);
gimple_call_set_lhs (stmt, tmp);
@@ -9528,7 +9556,13 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, gimple_seq *body_p,
tree innerc = omp_find_clause (taskreg_clauses,
OMP_CLAUSE__LOOPTEMP_);
gcc_assert (innerc);
- for (i = 0; i < fd->collapse; i++)
+ int count = fd->collapse;
+ if (fd->non_rect
+ && fd->last_nonrect == fd->first_nonrect + 1)
+ if (tree v = gimple_omp_for_index (fd->for_stmt, fd->last_nonrect))
+ if (!TYPE_UNSIGNED (TREE_TYPE (v)))
+ count += 4;
+ for (i = 0; i < count; i++)
{
innerc = omp_find_clause (OMP_CLAUSE_CHAIN (innerc),
OMP_CLAUSE__LOOPTEMP_);
@@ -10451,12 +10485,26 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (fd.collapse > 1
&& TREE_CODE (fd.loop.n2) != INTEGER_CST)
count += fd.collapse - 1;
+ size_t count2 = 0;
+ tree type2 = NULL_TREE;
bool taskreg_for
= (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_FOR
|| gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_TASKLOOP);
tree outerc = NULL, *pc = gimple_omp_for_clauses_ptr (stmt);
tree simtc = NULL;
tree clauses = *pc;
+ if (fd.collapse > 1
+ && fd.non_rect
+ && fd.last_nonrect == fd.first_nonrect + 1
+ && TREE_CODE (fd.loop.n2) != INTEGER_CST)
+ if (tree v = gimple_omp_for_index (stmt, fd.last_nonrect))
+ if (!TYPE_UNSIGNED (TREE_TYPE (v)))
+ {
+ v = gimple_omp_for_index (stmt, fd.first_nonrect);
+ type2 = TREE_TYPE (v);
+ count++;
+ count2 = 3;
+ }
if (taskreg_for)
outerc
= omp_find_clause (gimple_omp_taskreg_clauses (ctx->outer->stmt),
@@ -10464,7 +10512,7 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (ctx->simt_stmt)
simtc = omp_find_clause (gimple_omp_for_clauses (ctx->simt_stmt),
OMP_CLAUSE__LOOPTEMP_);
- for (i = 0; i < count; i++)
+ for (i = 0; i < count + count2; i++)
{
tree temp;
if (taskreg_for)
@@ -10483,7 +10531,7 @@ lower_omp_for (gimple_stmt_iterator *gsi_p, omp_context *ctx)
if (ctx->simt_stmt)
temp = OMP_CLAUSE_DECL (simtc);
else
- temp = create_tmp_var (type);
+ temp = create_tmp_var (i >= count ? type2 : type);
insert_decl_map (&ctx->outer->cb, temp, temp);
}
*pc = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE__LOOPTEMP_);
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index 32c2485..3e9c31d 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -196,21 +196,54 @@ omp_declare_target_var_p (tree decl)
static tree
omp_discover_declare_target_tgt_fn_r (tree *tp, int *walk_subtrees, void *data)
{
- if (TREE_CODE (*tp) == FUNCTION_DECL
- && !omp_declare_target_fn_p (*tp)
- && !lookup_attribute ("omp declare target host", DECL_ATTRIBUTES (*tp)))
+ if (TREE_CODE (*tp) == FUNCTION_DECL)
{
+ tree decl = *tp;
tree id = get_identifier ("omp declare target");
- if (!DECL_EXTERNAL (*tp) && DECL_SAVED_TREE (*tp))
- ((vec<tree> *) data)->safe_push (*tp);
- DECL_ATTRIBUTES (*tp) = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (*tp));
symtab_node *node = symtab_node::get (*tp);
if (node != NULL)
{
+ while (node->alias_target
+ && TREE_CODE (node->alias_target) == FUNCTION_DECL)
+ {
+ if (!omp_declare_target_fn_p (node->decl)
+ && !lookup_attribute ("omp declare target host",
+ DECL_ATTRIBUTES (node->decl)))
+ {
+ node->offloadable = 1;
+ DECL_ATTRIBUTES (node->decl)
+ = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (node->decl));
+ }
+ node = symtab_node::get (node->alias_target);
+ }
+ symtab_node *new_node = node->ultimate_alias_target ();
+ decl = new_node->decl;
+ while (node != new_node)
+ {
+ if (!omp_declare_target_fn_p (node->decl)
+ && !lookup_attribute ("omp declare target host",
+ DECL_ATTRIBUTES (node->decl)))
+ {
+ node->offloadable = 1;
+ DECL_ATTRIBUTES (node->decl)
+ = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (node->decl));
+ }
+ gcc_assert (node->alias && node->analyzed);
+ node = node->get_alias_target ();
+ }
node->offloadable = 1;
if (ENABLE_OFFLOADING)
g->have_offload = true;
}
+ if (omp_declare_target_fn_p (decl)
+ || lookup_attribute ("omp declare target host",
+ DECL_ATTRIBUTES (decl)))
+ return NULL_TREE;
+
+ if (!DECL_EXTERNAL (decl) && DECL_SAVED_TREE (decl))
+ ((vec<tree> *) data)->safe_push (decl);
+ DECL_ATTRIBUTES (decl) = tree_cons (id, NULL_TREE,
+ DECL_ATTRIBUTES (decl));
}
else if (TYPE_P (*tp))
*walk_subtrees = 0;
@@ -295,11 +328,19 @@ omp_discover_implicit_declare_target (void)
FOR_EACH_DEFINED_FUNCTION (node)
if (DECL_SAVED_TREE (node->decl))
{
+ struct cgraph_node *cgn;
if (omp_declare_target_fn_p (node->decl))
worklist.safe_push (node->decl);
else if (DECL_STRUCT_FUNCTION (node->decl)
&& DECL_STRUCT_FUNCTION (node->decl)->has_omp_target)
worklist.safe_push (node->decl);
+ for (cgn = first_nested_function (node);
+ cgn; cgn = next_nested_function (cgn))
+ if (omp_declare_target_fn_p (cgn->decl))
+ worklist.safe_push (cgn->decl);
+ else if (DECL_STRUCT_FUNCTION (cgn->decl)
+ && DECL_STRUCT_FUNCTION (cgn->decl)->has_omp_target)
+ worklist.safe_push (cgn->decl);
}
FOR_EACH_STATIC_INITIALIZER (vnode)
if (omp_declare_target_var_p (vnode->decl))
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 184827f..8ad7f4b 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1395,6 +1395,8 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (target == 0
|| target == op0
|| target == op1
+ || reg_overlap_mentioned_p (target, op0)
+ || reg_overlap_mentioned_p (target, op1)
|| !valid_multiword_target_p (target))
target = gen_reg_rtx (int_mode);
@@ -1475,6 +1477,8 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (target == 0
|| target == op0
|| target == op1
+ || reg_overlap_mentioned_p (target, op0)
+ || reg_overlap_mentioned_p (target, op1)
|| !valid_multiword_target_p (target))
target = gen_reg_rtx (int_mode);
@@ -1533,6 +1537,8 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
|| target == op0
|| target == op1
|| !REG_P (target)
+ || reg_overlap_mentioned_p (target, op0)
+ || reg_overlap_mentioned_p (target, op1)
|| !valid_multiword_target_p (target))
target = gen_reg_rtx (int_mode);
@@ -2670,6 +2676,7 @@ expand_absneg_bit (enum rtx_code code, scalar_float_mode mode,
if (target == 0
|| target == op0
+ || reg_overlap_mentioned_p (target, op0)
|| (nwords > 1 && !valid_multiword_target_p (target)))
target = gen_reg_rtx (mode);
@@ -2951,7 +2958,10 @@ expand_unop (machine_mode mode, optab unoptab, rtx op0, rtx target,
int i;
rtx_insn *insns;
- if (target == 0 || target == op0 || !valid_multiword_target_p (target))
+ if (target == 0
+ || target == op0
+ || reg_overlap_mentioned_p (target, op0)
+ || !valid_multiword_target_p (target))
target = gen_reg_rtx (int_mode);
start_sequence ();
@@ -3472,6 +3482,8 @@ expand_copysign_bit (scalar_float_mode mode, rtx op0, rtx op1, rtx target,
if (target == 0
|| target == op0
|| target == op1
+ || reg_overlap_mentioned_p (target, op0)
+ || reg_overlap_mentioned_p (target, op1)
|| (nwords > 1 && !valid_multiword_target_p (target)))
target = gen_reg_rtx (mode);
@@ -3841,6 +3853,27 @@ can_vcond_compare_p (enum rtx_code code, machine_mode value_mode,
&& insn_operand_matches (icode, 3, test);
}
+/* Return whether the backend can emit vector set instructions for inserting
+ element into vector at variable index position. */
+
+bool
+can_vec_set_var_idx_p (machine_mode vec_mode)
+{
+ if (!VECTOR_MODE_P (vec_mode))
+ return false;
+
+ machine_mode inner_mode = GET_MODE_INNER (vec_mode);
+ rtx reg1 = alloca_raw_REG (vec_mode, LAST_VIRTUAL_REGISTER + 1);
+ rtx reg2 = alloca_raw_REG (inner_mode, LAST_VIRTUAL_REGISTER + 2);
+ rtx reg3 = alloca_raw_REG (VOIDmode, LAST_VIRTUAL_REGISTER + 3);
+
+ enum insn_code icode = optab_handler (vec_set_optab, vec_mode);
+
+ return icode != CODE_FOR_nothing && insn_operand_matches (icode, 0, reg1)
+ && insn_operand_matches (icode, 1, reg2)
+ && insn_operand_matches (icode, 2, reg3);
+}
+
/* This function is called when we are going to emit a compare instruction that
compares the values found in X and Y, using the rtl operator COMPARISON.
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 7c2ec25..0b14700 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -249,6 +249,10 @@ extern int can_compare_p (enum rtx_code, machine_mode,
VALUE_MODE. */
extern bool can_vcond_compare_p (enum rtx_code, machine_mode, machine_mode);
+/* Return whether the backend can emit vector set instructions for inserting
+ element into vector at variable index position. */
+extern bool can_vec_set_var_idx_p (machine_mode);
+
extern rtx prepare_operand (enum insn_code, rtx, int, machine_mode,
machine_mode, int);
/* Emit a pair of rtl insns to compare two rtx's and to jump
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index b5c27f7..a756835 100644
--- a/gcc/optc-save-gen.awk
+++ b/gcc/optc-save-gen.awk
@@ -516,6 +516,10 @@ if (have_save) {
var_save_seen[name]++;
otype = var_type_struct(flags[i])
+ if (opt_args("Mask", flags[i]) != "" \
+ || opt_args("InverseMask", flags[i]))
+ var_target_explicit_mask[name] = 1;
+
if (otype ~ "^((un)?signed +)?int *$")
var_target_int[n_target_int++] = name;
@@ -545,6 +549,7 @@ if (have_save) {
}
} else {
var_target_int[n_target_int++] = "target_flags";
+ var_target_explicit_mask["target_flags"] = 1;
}
have_assert = 0;
@@ -592,11 +597,13 @@ for (i = 0; i < n_target_string; i++) {
}
print "";
-print " unsigned HOST_WIDE_INT mask = 0;";
j = 0;
k = 0;
for (i = 0; i < n_extra_target_vars; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" extra_target_vars[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -608,6 +615,13 @@ for (i = 0; i < n_extra_target_vars; i++) {
}
for (i = 0; i < n_target_other; i++) {
+ if (var_target_other[i] in var_target_explicit_mask) {
+ print " ptr->explicit_mask_" var_target_other[i] " = opts_set->x_" var_target_other[i] ";";
+ continue;
+ }
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_other[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -619,6 +633,9 @@ for (i = 0; i < n_target_other; i++) {
}
for (i = 0; i < n_target_enum; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_enum[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -630,6 +647,13 @@ for (i = 0; i < n_target_enum; i++) {
}
for (i = 0; i < n_target_int; i++) {
+ if (var_target_int[i] in var_target_explicit_mask) {
+ print " ptr->explicit_mask_" var_target_int[i] " = opts_set->x_" var_target_int[i] ";";
+ continue;
+ }
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_int[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -641,6 +665,9 @@ for (i = 0; i < n_target_int; i++) {
}
for (i = 0; i < n_target_short; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_short[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -652,6 +679,9 @@ for (i = 0; i < n_target_short; i++) {
}
for (i = 0; i < n_target_char; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_char[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -663,6 +693,9 @@ for (i = 0; i < n_target_char; i++) {
}
for (i = 0; i < n_target_string; i++) {
+ if (j == 0 && k == 0) {
+ print " unsigned HOST_WIDE_INT mask = 0;";
+ }
print " if (opts_set->x_" var_target_string[i] ") mask |= HOST_WIDE_INT_1U << " j ";";
j++;
if (j == 64) {
@@ -676,6 +709,10 @@ for (i = 0; i < n_target_string; i++) {
if (j != 0) {
print " ptr->explicit_mask[" k "] = mask;";
}
+has_target_explicit_mask = 0;
+if (j != 0 || k != 0) {
+ has_target_explicit_mask = 1;
+}
print "}";
@@ -715,7 +752,9 @@ for (i = 0; i < n_target_string; i++) {
}
print "";
-print " unsigned HOST_WIDE_INT mask;";
+if (has_target_explicit_mask) {
+ print " unsigned HOST_WIDE_INT mask;";
+}
j = 64;
k = 0;
@@ -739,6 +778,10 @@ for (i = 0; i < n_extra_target_vars; i++) {
}
for (i = 0; i < n_target_other; i++) {
+ if (var_target_other[i] in var_target_explicit_mask) {
+ print " opts_set->x_" var_target_other[i] " = ptr->explicit_mask_" var_target_other[i] ";";
+ continue;
+ }
if (j == 64) {
print " mask = ptr->explicit_mask[" k "];";
k++;
@@ -761,6 +804,10 @@ for (i = 0; i < n_target_enum; i++) {
}
for (i = 0; i < n_target_int; i++) {
+ if (var_target_int[i] in var_target_explicit_mask) {
+ print " opts_set->x_" var_target_int[i] " = ptr->explicit_mask_" var_target_int[i] ";";
+ continue;
+ }
if (j == 64) {
print " mask = ptr->explicit_mask[" k "];";
k++;
@@ -1054,9 +1101,25 @@ for (i = 0; i < n_target_val; i++) {
print " return false;";
}
-print " for (size_t i = 0; i < sizeof (ptr1->explicit_mask) / sizeof (ptr1->explicit_mask[0]); i++)";
-print " if (ptr1->explicit_mask[i] != ptr2->explicit_mask[i])";
-print " return false;"
+if (has_target_explicit_mask) {
+ print " for (size_t i = 0; i < sizeof (ptr1->explicit_mask) / sizeof (ptr1->explicit_mask[0]); i++)";
+ print " if (ptr1->explicit_mask[i] != ptr2->explicit_mask[i])";
+ print " return false;"
+}
+
+for (i = 0; i < n_target_other; i++) {
+ if (var_target_other[i] in var_target_explicit_mask) {
+ print " if (ptr1->explicit_mask_" var_target_other[i] " != ptr2->explicit_mask_" var_target_other[i] ")";
+ print " return false;";
+ }
+}
+
+for (i = 0; i < n_target_int; i++) {
+ if (var_target_int[i] in var_target_explicit_mask) {
+ print " if (ptr1->explicit_mask_" var_target_int[i] " != ptr2->explicit_mask_" var_target_int[i] ")";
+ print " return false;";
+ }
+}
print " return true;";
@@ -1086,8 +1149,21 @@ for (i = 0; i < n_target_val; i++) {
name = var_target_val[i]
print " hstate.add_hwi (ptr->" name");";
}
-print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
-print " hstate.add_hwi (ptr->explicit_mask[i]);";
+if (has_target_explicit_mask) {
+ print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
+ print " hstate.add_hwi (ptr->explicit_mask[i]);";
+}
+
+for (i = 0; i < n_target_other; i++) {
+ if (var_target_other[i] in var_target_explicit_mask)
+ print " hstate.add_hwi (ptr->explicit_mask_" var_target_other[i] ");";
+}
+
+for (i = 0; i < n_target_int; i++) {
+ if (var_target_int[i] in var_target_explicit_mask)
+ print " hstate.add_hwi (ptr->explicit_mask_" var_target_int[i] ");";
+}
+
print " return hstate.end ();";
print "}";
@@ -1113,8 +1189,22 @@ for (i = 0; i < n_target_val; i++) {
print " bp_pack_value (bp, ptr->" name", 64);";
}
-print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
-print " bp_pack_value (bp, ptr->explicit_mask[i], 64);";
+if (has_target_explicit_mask) {
+ print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
+ print " bp_pack_value (bp, ptr->explicit_mask[i], 64);";
+}
+
+for (i = 0; i < n_target_other; i++) {
+ if (var_target_other[i] in var_target_explicit_mask) {
+ print " bp_pack_value (bp, ptr->explicit_mask_" var_target_other[i] ", 64);";
+ }
+}
+
+for (i = 0; i < n_target_int; i++) {
+ if (var_target_int[i] in var_target_explicit_mask) {
+ print " bp_pack_value (bp, ptr->explicit_mask_" var_target_int[i] ", 64);";
+ }
+}
print "}";
@@ -1142,8 +1232,22 @@ for (i = 0; i < n_target_val; i++) {
print " ptr->" name" = (" var_target_val_type[i] ") bp_unpack_value (bp, 64);";
}
-print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
-print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);";
+if (has_target_explicit_mask) {
+ print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
+ print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);";
+}
+
+for (i = 0; i < n_target_other; i++) {
+ if (var_target_other[i] in var_target_explicit_mask) {
+ print " ptr->explicit_mask_" var_target_other[i] " = bp_unpack_value (bp, 64);";
+ }
+}
+
+for (i = 0; i < n_target_int; i++) {
+ if (var_target_int[i] in var_target_explicit_mask) {
+ print " ptr->explicit_mask_" var_target_int[i] " = bp_unpack_value (bp, 64);";
+ }
+}
print "}";
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 8fec607..a456b51 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -209,6 +209,7 @@ n_target_int = 0;
n_target_enum = 0;
n_target_other = 0;
n_target_explicit = n_extra_target_vars;
+n_target_explicit_mask = 0;
for (i = 0; i < n_target_save; i++) {
if (target_save_decl[i] ~ "^((un)?signed +)?int +[_" alnum "]+$")
@@ -240,6 +241,12 @@ if (have_save) {
var_save_seen[name]++;
n_target_explicit++;
otype = var_type_struct(flags[i])
+
+ if (opt_args("Mask", flags[i]) != "" \
+ || opt_args("InverseMask", flags[i]))
+ var_target_explicit_mask[n_target_explicit_mask++] \
+ = otype "explicit_mask_" name;
+
if (otype ~ "^((un)?signed +)?int *$")
var_target_int[n_target_int++] = otype "x_" name;
@@ -259,6 +266,8 @@ if (have_save) {
} else {
var_target_int[n_target_int++] = "int x_target_flags";
n_target_explicit++;
+ var_target_explicit_mask[n_target_explicit_mask++] \
+ = "int explicit_mask_target_flags";
}
for (i = 0; i < n_target_other; i++) {
@@ -281,8 +290,15 @@ for (i = 0; i < n_target_char; i++) {
print " " var_target_char[i] ";";
}
-print " /* " n_target_explicit " members */";
-print " unsigned HOST_WIDE_INT explicit_mask[" int ((n_target_explicit + 63) / 64) "];";
+print " /* " n_target_explicit - n_target_explicit_mask " members */";
+if (n_target_explicit > n_target_explicit_mask) {
+ print " unsigned HOST_WIDE_INT explicit_mask[" \
+ int ((n_target_explicit - n_target_explicit_mask + 63) / 64) "];";
+}
+
+for (i = 0; i < n_target_explicit_mask; i++) {
+ print " " var_target_explicit_mask[i] ";";
+}
print "};";
print "";
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 237e4ce..8ec8c1e 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1000,6 +1000,7 @@ decode_cmdline_options_to_array (unsigned int argc, const char **argv,
"-fno-diagnostics-show-line-numbers",
"-fdiagnostics-color=never",
"-fdiagnostics-urls=never",
+ "-fdiagnostics-path-format=separate-events",
};
const int num_expanded = ARRAY_SIZE (expanded_args);
opt_array_len += num_expanded - 1;
diff --git a/gcc/opts-global.c b/gcc/opts-global.c
index b024ab8..1816acf 100644
--- a/gcc/opts-global.c
+++ b/gcc/opts-global.c
@@ -378,10 +378,6 @@ handle_common_deferred_options (void)
dbg_cnt_process_opt (opt->arg);
break;
- case OPT_fdbg_cnt_list:
- dbg_cnt_list_all_counters ();
- break;
-
case OPT_fdebug_prefix_map_:
add_debug_prefix_map (opt->arg);
break;
diff --git a/gcc/opts.c b/gcc/opts.c
index 3c4a0b5..da503c3 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -792,6 +792,13 @@ control_options_for_live_patching (struct gcc_options *opts,
else
opts->x_flag_ipa_pure_const = 0;
+ if (opts_set->x_flag_ipa_modref && opts->x_flag_ipa_modref)
+ error_at (loc,
+ "%<-fipa-modref%> is incompatible with "
+ "%<-flive-patching=inline-only-static|inline-clone%>");
+ else
+ opts->x_flag_ipa_modref = 0;
+
/* FIXME: disable unreachable code removal. */
/* discovery of functions/variables with no address taken. */
@@ -2354,11 +2361,6 @@ common_handle_option (struct gcc_options *opts,
/* Deferred. */
break;
- case OPT_fdbg_cnt_list:
- /* Deferred. */
- opts->x_exit_after_options = true;
- break;
-
case OPT_fdebug_prefix_map_:
case OPT_ffile_prefix_map_:
/* Deferred. */
diff --git a/gcc/params.opt b/gcc/params.opt
index 1d86404..e05f7ff 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -102,6 +102,37 @@ Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
Common Joined UInteger Var(param_early_inlining_insns) Init(6) Optimization Param
Maximal estimated growth of function body caused by early inlining of single call.
+-param=evrp-mode=
+Common Joined Var(param_evrp_mode) Enum(evrp_mode) Init(EVRP_MODE_EVRP_FIRST) Param Optimization
+--param=evrp-mode=[legacy|ranger|legacy-first|ranger-first|ranger-trace|ranger-debug|trace|debug] Specifies the mode Early VRP should operate in.
+
+Enum
+Name(evrp_mode) Type(enum evrp_mode) UnknownError(unknown evrp mode %qs)
+
+EnumValue
+Enum(evrp_mode) String(legacy) Value(EVRP_MODE_EVRP_ONLY)
+
+EnumValue
+Enum(evrp_mode) String(ranger) Value(EVRP_MODE_RVRP_ONLY)
+
+EnumValue
+Enum(evrp_mode) String(legacy-first) Value(EVRP_MODE_EVRP_FIRST)
+
+EnumValue
+Enum(evrp_mode) String(ranger-first) Value(EVRP_MODE_RVRP_FIRST)
+
+EnumValue
+Enum(evrp_mode) String(ranger-trace) Value(EVRP_MODE_RVRP_TRACE)
+
+EnumValue
+Enum(evrp_mode) String(ranger-debug) Value(EVRP_MODE_RVRP_DEBUG)
+
+EnumValue
+Enum(evrp_mode) String(trace) Value(EVRP_MODE_TRACE)
+
+EnumValue
+Enum(evrp_mode) String(debug) Value(EVRP_MODE_DEBUG)
+
-param=fsm-maximum-phi-arguments=
Common Joined UInteger Var(param_fsm_maximum_phi_arguments) Init(100) IntegerRange(1, 999999) Param Optimization
Maximum number of arguments a PHI may have before the FSM threader will not try to thread through its block.
@@ -214,10 +245,18 @@ Percentage penalty functions containing a single call to another function will r
Common Joined UInteger Var(param_ipa_cp_unit_growth) Init(10) Param Optimization
How much can given compilation unit grow because of the interprocedural constant propagation (in percent).
+-param=ipa-cp-large-unit-insns=
+Common Joined UInteger Var(param_ipa_cp_large_unit_insns) Optimization Init(16000) Param
+The size of translation unit that IPA-CP pass considers large.
+
-param=ipa-cp-value-list-size=
Common Joined UInteger Var(param_ipa_cp_value_list_size) Init(8) Param Optimization
Maximum size of a list of values associated with each parameter for interprocedural constant propagation.
+-param-ipa-jump-function-lookups=
+Common Joined UInteger Var(param_ipa_jump_function_lookups) Init(8) Param Optimization
+Maximum number of statements visited during jump function offset discovery.
+
-param=ipa-max-aa-steps=
Common Joined UInteger Var(param_ipa_max_aa_steps) Init(25000) Param Optimization
Maximum number of statements that will be visited by IPA formal parameter analysis based on alias analysis in any given function.
@@ -230,6 +269,10 @@ Maximum number of aggregate content items for a parameter in jump functions and
Common Joined UInteger Var(param_ipa_max_param_expr_ops) Init(10) Param Optimization
Maximum number of operations in a parameter expression that can be handled by IPA analysis.
+-param=ipa-max-loop-predicates=
+Common Joined UInteger Var(param_ipa_max_loop_predicates) Init(16) Param Optimization
+Maximum number of different predicates used to track properties of loops in IPA analysis.
+
-param=ipa-max-switch-predicate-bounds=
Common Joined UInteger Var(param_ipa_max_switch_predicate_bounds) Init(5) Param Optimization
Maximal number of boundary endpoints of case ranges of switch statement used during IPA function summary generation.
@@ -878,11 +921,15 @@ Maximum number of bases stored in each modref tree.
-param=modref-max-refs=
Common Joined UInteger Var(param_modref_max_refs) Init(16)
-Maximum number of refs stored in each modref tree.
+Maximum number of references stored in each modref base.
+
+-param=modref-max-accesses=
+Common Joined UInteger Var(param_modref_max_accesses) Init(16)
+Maximum number of accesse stored in each modref reference.
-param=modref-max-tests=
Common Joined UInteger Var(param_modref_max_tests) Init(64)
-Maximum number of tests perofmed by modref query
+Maximum number of tests performed by modref query.
-param=tm-max-aggregate-size=
Common Joined UInteger Var(param_tm_max_aggregate_size) Init(9) Param Optimization
diff --git a/gcc/passes.c b/gcc/passes.c
index 6ff31ec..1942b7c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -2271,6 +2271,14 @@ execute_all_ipa_transforms (bool do_not_collect)
return;
node = cgraph_node::get (current_function_decl);
+ cgraph_node *next_clone;
+ for (cgraph_node *n = node->clones; n; n = next_clone)
+ {
+ next_clone = n->next_sibling_clone;
+ if (n->decl != node->decl)
+ n->materialize_clone ();
+ }
+
if (node->ipa_transforms_to_apply.exists ())
{
unsigned int i;
diff --git a/gcc/passes.def b/gcc/passes.def
index f865bdc..cf15d8e 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -172,7 +172,6 @@ along with GCC; see the file COPYING3. If not see
passes are executed after partitioning and thus see just parts of the
compiled unit. */
INSERT_PASSES_AFTER (all_late_ipa_passes)
- NEXT_PASS (pass_materialize_all_clones);
NEXT_PASS (pass_ipa_pta);
NEXT_PASS (pass_omp_simd_clone);
TERMINATE_PASS_LIST (all_late_ipa_passes)
diff --git a/gcc/predict.c b/gcc/predict.c
index 3c7b46f..5983889 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1916,7 +1916,6 @@ predict_loops (void)
{
basic_block bb, *bbs;
unsigned j, n_exits = 0;
- vec<edge> exits;
class tree_niter_desc niter_desc;
edge ex;
class nb_iter_bound *nb_iter;
@@ -1927,15 +1926,12 @@ predict_loops (void)
gcond *stmt = NULL;
bool recursion = with_recursion.contains (loop);
- exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
FOR_EACH_VEC_ELT (exits, j, ex)
if (!unlikely_executed_edge_p (ex) && !(ex->flags & EDGE_ABNORMAL_CALL))
n_exits ++;
if (!n_exits)
- {
- exits.release ();
- continue;
- }
+ continue;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Predicting loop %i%s with %i exits.\n",
@@ -2049,7 +2045,6 @@ predict_loops (void)
probability = RDIV (REG_BR_PROB_BASE, nitercst);
predict_edge (ex, predictor, probability);
}
- exits.release ();
/* Find information about loop bound variables. */
for (nb_iter = loop->bounds; nb_iter;
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 2a9c98e..d1150e4 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -851,7 +851,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
char buf[10];
for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
{
- snprintf (buf, sizeof (buf), "elt%u: ", i);
+ snprintf (buf, sizeof (buf), "elt%u:", i);
print_node (file, buf, POLY_INT_CST_COEFF (node, i),
indent + 4);
}
diff --git a/gcc/profile-count.c b/gcc/profile-count.c
index c89914f..aaefc11 100644
--- a/gcc/profile-count.c
+++ b/gcc/profile-count.c
@@ -270,8 +270,8 @@ profile_count::to_frequency (struct function *fun) const
return BB_FREQ_MAX;
if (*this == zero ())
return 0;
- gcc_assert (REG_BR_PROB_BASE == BB_FREQ_MAX
- && fun->cfg->count_max.initialized_p ());
+ STATIC_ASSERT (REG_BR_PROB_BASE == BB_FREQ_MAX);
+ gcc_assert (fun->cfg->count_max.initialized_p ());
profile_probability prob = probability_in (fun->cfg->count_max);
if (!prob.initialized_p ())
return REG_BR_PROB_BASE;
diff --git a/gcc/profile.c b/gcc/profile.c
index fe8963c..4540959 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1375,7 +1375,7 @@ branch_prob (bool thunk)
seen_locations.add (loc);
expanded_location curr_location = expand_location (loc);
output_location (&streamed_locations, curr_location.file,
- curr_location.line, &offset, bb);
+ MAX (1, curr_location.line), &offset, bb);
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1386,7 +1386,7 @@ branch_prob (bool thunk)
{
seen_locations.add (loc);
output_location (&streamed_locations, gimple_filename (stmt),
- gimple_lineno (stmt), &offset, bb);
+ MAX (1, gimple_lineno (stmt)), &offset, bb);
}
}
@@ -1401,7 +1401,7 @@ branch_prob (bool thunk)
{
expanded_location curr_location = expand_location (loc);
output_location (&streamed_locations, curr_location.file,
- curr_location.line, &offset, bb);
+ MAX (1, curr_location.line), &offset, bb);
}
if (offset)
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 3ab268f..ee62f10 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -287,6 +287,15 @@ value_range_with_overflow (irange &r, tree type,
}
else
{
+ // If both bounds either underflowed or overflowed, then the result
+ // is undefined.
+ if ((min_ovf == wi::OVF_OVERFLOW && max_ovf == wi::OVF_OVERFLOW)
+ || (min_ovf == wi::OVF_UNDERFLOW && max_ovf == wi::OVF_UNDERFLOW))
+ {
+ r.set_undefined ();
+ return;
+ }
+
// If overflow does not wrap, saturate to [MIN, MAX].
wide_int new_lb, new_ub;
if (min_ovf == wi::OVF_UNDERFLOW)
@@ -1317,10 +1326,10 @@ operator_div::wi_fold (irange &r, tree type,
const wide_int &lh_lb, const wide_int &lh_ub,
const wide_int &rh_lb, const wide_int &rh_ub) const
{
- // If we know we will divide by zero, return undefined.
+ // If we know we will divide by zero...
if (rh_lb == 0 && rh_ub == 0)
{
- r.set_undefined ();
+ r.set_varying (type);
return;
}
@@ -1350,7 +1359,7 @@ operator_div::wi_fold (irange &r, tree type,
// If we're definitely dividing by zero, there's nothing to do.
if (wi_zero_p (type, divisor_min, divisor_max))
{
- r.set_undefined ();
+ r.set_varying (type);
return;
}
@@ -1430,6 +1439,27 @@ public:
const wide_int &) const;
} op_lshift;
+class operator_rshift : public cross_product_operator
+{
+public:
+ virtual bool fold_range (irange &r, tree type,
+ const irange &op1,
+ const irange &op2) const;
+ virtual void wi_fold (irange &r, tree type,
+ const wide_int &lh_lb,
+ const wide_int &lh_ub,
+ const wide_int &rh_lb,
+ const wide_int &rh_ub) const;
+ virtual bool wi_op_overflows (wide_int &res,
+ tree type,
+ const wide_int &w0,
+ const wide_int &w1) const;
+ virtual bool op1_range (irange &, tree type,
+ const irange &lhs,
+ const irange &op2) const;
+} op_rshift;
+
+
bool
operator_lshift::fold_range (irange &r, tree type,
const irange &op1,
@@ -1546,60 +1576,57 @@ operator_lshift::op1_range (irange &r,
tree shift_amount;
if (op2.singleton_p (&shift_amount))
{
- int_range<1> shifted (shift_amount, shift_amount), ub, lb;
- const range_operator *rshift_op = range_op_handler (RSHIFT_EXPR, type);
- rshift_op->fold_range (ub, type, lhs, shifted);
- if (TYPE_UNSIGNED (type))
+ wide_int shift = wi::to_wide (shift_amount);
+ if (wi::lt_p (shift, 0, SIGNED))
+ return false;
+ if (wi::ge_p (shift, wi::uhwi (TYPE_PRECISION (type),
+ TYPE_PRECISION (op2.type ())),
+ UNSIGNED))
+ return false;
+ if (shift == 0)
{
- r = ub;
+ r = lhs;
return true;
}
- // For signed types, we can't just do an arithmetic rshift,
- // because that will propagate the sign bit.
- //
- // LHS
- // 1110 = OP1 << 1
- //
- // Assuming a 4-bit signed integer, a right shift will result in
- // OP1=1111, but OP1 could have also been 0111. What we want is
- // a range from 0111 to 1111. That is, a range from the logical
- // rshift (0111) to the arithmetic rshift (1111).
- //
- // Perform a logical rshift by doing the rshift as unsigned.
- tree unsigned_type = unsigned_type_for (type);
- int_range_max unsigned_lhs = lhs;
- range_cast (unsigned_lhs, unsigned_type);
- rshift_op = range_op_handler (RSHIFT_EXPR, unsigned_type);
- rshift_op->fold_range (lb, unsigned_type, unsigned_lhs, shifted);
- range_cast (lb, type);
- r = lb;
- r.union_ (ub);
+
+ // Work completely in unsigned mode to start.
+ tree utype = type;
+ if (TYPE_SIGN (type) == SIGNED)
+ {
+ int_range_max tmp = lhs;
+ utype = unsigned_type_for (type);
+ range_cast (tmp, utype);
+ op_rshift.fold_range (r, utype, tmp, op2);
+ }
+ else
+ op_rshift.fold_range (r, utype, lhs, op2);
+
+ // Start with ranges which can produce the LHS by right shifting the
+ // result by the shift amount.
+ // ie [0x08, 0xF0] = op1 << 2 will start with
+ // [00001000, 11110000] = op1 << 2
+ // [0x02, 0x4C] aka [00000010, 00111100]
+
+ // Then create a range from the LB with the least significant upper bit
+ // set, to the upper bound with all the bits set.
+ // This would be [0x42, 0xFC] aka [01000010, 11111100].
+
+ // Ideally we do this for each subrange, but just lump them all for now.
+ unsigned low_bits = TYPE_PRECISION (utype)
+ - TREE_INT_CST_LOW (shift_amount);
+ wide_int up_mask = wi::mask (low_bits, true, TYPE_PRECISION (utype));
+ wide_int new_ub = wi::bit_or (up_mask, r.upper_bound ());
+ wide_int new_lb = wi::set_bit (r.lower_bound (), low_bits);
+ int_range<2> fill_range (utype, new_lb, new_ub);
+ r.union_ (fill_range);
+
+ if (utype != type)
+ range_cast (r, type);
return true;
}
return false;
}
-
-class operator_rshift : public cross_product_operator
-{
-public:
- virtual bool fold_range (irange &r, tree type,
- const irange &op1,
- const irange &op2) const;
- virtual void wi_fold (irange &r, tree type,
- const wide_int &lh_lb,
- const wide_int &lh_ub,
- const wide_int &rh_lb,
- const wide_int &rh_ub) const;
- virtual bool wi_op_overflows (wide_int &res,
- tree type,
- const wide_int &w0,
- const wide_int &w1) const;
- virtual bool op1_range (irange &, tree type,
- const irange &lhs,
- const irange &op2) const;
-} op_rshift;
-
bool
operator_rshift::op1_range (irange &r,
tree type,
@@ -1609,6 +1636,18 @@ operator_rshift::op1_range (irange &r,
tree shift;
if (op2.singleton_p (&shift))
{
+ // Ignore nonsensical shifts.
+ unsigned prec = TYPE_PRECISION (type);
+ if (wi::ge_p (wi::to_wide (shift),
+ wi::uhwi (prec, TYPE_PRECISION (TREE_TYPE (shift))),
+ UNSIGNED))
+ return false;
+ if (wi::to_wide (shift) == 0)
+ {
+ r = lhs;
+ return true;
+ }
+
// Folding the original operation may discard some impossible
// ranges from the LHS.
int_range_max lhs_refined;
@@ -1832,14 +1871,25 @@ operator_cast::op1_range (irange &r, tree type,
type,
converted_lhs,
lim_range);
- // And union this with the entire outer types negative range.
- int_range_max neg (type,
- wi::min_value (TYPE_PRECISION (type),
- SIGNED),
- lim - 1);
- neg.union_ (lhs_neg);
+ // lhs_neg now has all the negative versions of the LHS.
+ // Now union in all the values from SIGNED MIN (0x80000) to
+ // lim-1 in order to fill in all the ranges with the upper
+ // bits set.
+
+ // PR 97317. If the lhs has only 1 bit less precision than the rhs,
+ // we don't need to create a range from min to lim-1
+ // calculate neg range traps trying to create [lim, lim - 1].
+ wide_int min_val = wi::min_value (TYPE_PRECISION (type), SIGNED);
+ if (lim != min_val)
+ {
+ int_range_max neg (type,
+ wi::min_value (TYPE_PRECISION (type),
+ SIGNED),
+ lim - 1);
+ lhs_neg.union_ (neg);
+ }
// And finally, munge the signed and unsigned portions.
- r.union_ (neg);
+ r.union_ (lhs_neg);
}
// And intersect with any known value passed in the extra operand.
r.intersect (op2);
@@ -2589,10 +2639,10 @@ operator_trunc_mod::wi_fold (irange &r, tree type,
signop sign = TYPE_SIGN (type);
unsigned prec = TYPE_PRECISION (type);
- // Mod 0 is undefined. Return undefined.
+ // Mod 0 is undefined.
if (wi_zero_p (type, rh_lb, rh_ub))
{
- r.set_undefined ();
+ r.set_varying (type);
return;
}
@@ -2825,9 +2875,19 @@ operator_abs::wi_fold (irange &r, tree type,
// ABS_EXPR may flip the range around, if the original range
// included negative values.
if (wi::eq_p (lh_lb, min_value))
- min = max_value;
+ {
+ // ABS ([-MIN, -MIN]) isn't representable, but we have traditionally
+ // returned [-MIN,-MIN] so this preserves that behaviour. PR37078
+ if (wi::eq_p (lh_ub, min_value))
+ {
+ r = int_range<1> (type, min_value, min_value);
+ return;
+ }
+ min = max_value;
+ }
else
min = wi::abs (lh_lb);
+
if (wi::eq_p (lh_ub, min_value))
max = max_value;
else
@@ -3018,6 +3078,14 @@ pointer_plus_operator::wi_fold (irange &r, tree type,
const wide_int &rh_lb,
const wide_int &rh_ub) const
{
+ // Check for [0,0] + const, and simply return the const.
+ if (lh_lb == 0 && lh_ub == 0 && rh_lb == rh_ub)
+ {
+ tree val = wide_int_to_tree (type, rh_lb);
+ r.set (val, val);
+ return;
+ }
+
// For pointer types, we are really only interested in asserting
// whether the expression evaluates to non-NULL.
//
@@ -3552,6 +3620,52 @@ operator_tests ()
negatives.intersect (op1);
ASSERT_TRUE (negatives.undefined_p ());
}
+
+ if (TYPE_PRECISION (unsigned_type_node) > 31)
+ {
+ // unsigned VARYING = op1 << 1 should be VARYING.
+ int_range<2> lhs (unsigned_type_node);
+ int_range<2> shift (INT (1), INT (1));
+ int_range_max op1;
+ op_lshift.op1_range (op1, unsigned_type_node, lhs, shift);
+ ASSERT_TRUE (op1.varying_p ());
+
+ // 0 = op1 << 1 should be [0,0], [0x8000000, 0x8000000].
+ int_range<2> zero (UINT (0), UINT (0));
+ op_lshift.op1_range (op1, unsigned_type_node, zero, shift);
+ ASSERT_TRUE (op1.num_pairs () == 2);
+ // Remove the [0,0] range.
+ op1.intersect (zero);
+ ASSERT_TRUE (op1.num_pairs () == 1);
+ // op1 << 1 should be [0x8000,0x8000] << 1,
+ // which should result in [0,0].
+ int_range_max result;
+ op_lshift.fold_range (result, unsigned_type_node, op1, shift);
+ ASSERT_TRUE (result == zero);
+ }
+ // signed VARYING = op1 << 1 should be VARYING.
+ if (TYPE_PRECISION (integer_type_node) > 31)
+ {
+ // unsigned VARYING = op1 << 1 hould be VARYING.
+ int_range<2> lhs (integer_type_node);
+ int_range<2> shift (INT (1), INT (1));
+ int_range_max op1;
+ op_lshift.op1_range (op1, integer_type_node, lhs, shift);
+ ASSERT_TRUE (op1.varying_p ());
+
+ // 0 = op1 << 1 should be [0,0], [0x8000000, 0x8000000].
+ int_range<2> zero (INT (0), INT (0));
+ op_lshift.op1_range (op1, integer_type_node, zero, shift);
+ ASSERT_TRUE (op1.num_pairs () == 2);
+ // Remove the [0,0] range.
+ op1.intersect (zero);
+ ASSERT_TRUE (op1.num_pairs () == 1);
+ // op1 << 1 shuould be [0x8000,0x8000] << 1,
+ // which should result in [0,0].
+ int_range_max result;
+ op_lshift.fold_range (result, unsigned_type_node, op1, shift);
+ ASSERT_TRUE (result == zero);
+ }
}
// Run all of the selftests within this file.
@@ -3837,6 +3951,27 @@ range_tests ()
r0.invert ();
ASSERT_TRUE (r0.nonzero_p ());
+ // test legacy interaction
+ // r0 = ~[1,1]
+ r0 = int_range<1> (UINT (1), UINT (1), VR_ANTI_RANGE);
+ // r1 = ~[3,3]
+ r1 = int_range<1> (UINT (3), UINT (3), VR_ANTI_RANGE);
+
+ // vv = [0,0][2,2][4, MAX]
+ int_range<3> vv = r0;
+ vv.intersect (r1);
+
+ ASSERT_TRUE (vv.contains_p (UINT (2)));
+ ASSERT_TRUE (vv.num_pairs () == 3);
+
+ // create r0 as legacy [1,1]
+ r0 = int_range<1> (UINT (1), UINT (1));
+ // And union it with [0,0][2,2][4,MAX] multi range
+ r0.union_ (vv);
+ // The result should be [0,2][4,MAX], or ~[3,3] but it must contain 2
+ ASSERT_TRUE (r0.contains_p (UINT (2)));
+
+
multi_precision_range_tests ();
int_range_max_tests ();
operator_tests ();
diff --git a/gcc/recog.c b/gcc/recog.c
index ce83b7f..d3552ec 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -1798,7 +1798,8 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
case CT_MEMORY:
case CT_SPECIAL_MEMORY:
/* Every memory operand can be reloaded to fit. */
- result = result || memory_operand (op, VOIDmode);
+ result = result || memory_operand (extract_mem_from_operand (op),
+ VOIDmode);
break;
case CT_ADDRESS:
@@ -2584,7 +2585,9 @@ constrain_operands (int strict, alternative_mask alternatives)
/* A unary operator may be accepted by the predicate, but it
is irrelevant for matching constraints. */
- if (UNARY_P (op))
+ /* For special_memory_operand, there could be a memory operand inside,
+ and it would cause a mismatch for constraint_satisfied_p. */
+ if (UNARY_P (op) && op == extract_mem_from_operand (op))
op = XEXP (op, 0);
if (GET_CODE (op) == SUBREG)
diff --git a/gcc/regs.h b/gcc/regs.h
index 1decd2c2..11416c4 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -128,7 +128,8 @@ extern size_t reg_info_p_size;
or profile driven feedback is available and the function is never executed,
frequency is always equivalent. Otherwise rescale the basic block
frequency. */
-#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \
+#define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun) \
+ || !cfun->cfg->count_max.initialized_p ()) \
? REG_FREQ_MAX \
: ((bb)->count.to_frequency (cfun) \
* REG_FREQ_MAX / BB_FREQ_MAX) \
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0872cc4..fcec9dc 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -4324,6 +4324,7 @@ extern rtx gen_hard_reg_clobber (machine_mode, unsigned int);
extern rtx get_reg_known_value (unsigned int);
extern bool get_reg_known_equiv_p (unsigned int);
extern rtx get_reg_base_value (unsigned int);
+extern rtx extract_mem_from_operand (rtx);
#ifdef STACK_REGS
extern int stack_regs_mentioned (const_rtx insn);
diff --git a/gcc/selftest-run-tests.c b/gcc/selftest-run-tests.c
index f0a81d4..7a89b2d 100644
--- a/gcc/selftest-run-tests.c
+++ b/gcc/selftest-run-tests.c
@@ -90,6 +90,7 @@ selftest::run_tests ()
read_rtl_function_c_tests ();
digraph_cc_tests ();
tristate_cc_tests ();
+ ipa_modref_tree_c_tests ();
/* Higher-level tests, or for components that other selftests don't
rely on. */
diff --git a/gcc/selftest.h b/gcc/selftest.h
index 5cffa13..6c6c7f2 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -268,6 +268,7 @@ extern void vec_perm_indices_c_tests ();
extern void wide_int_cc_tests ();
extern void opt_proposer_c_tests ();
extern void dbgcnt_c_tests ();
+extern void ipa_modref_tree_c_tests ();
extern int num_passes;
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 869f0d1..47e7aeb 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -4170,6 +4170,47 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
return subop1;
}
}
+
+ /* Simplify vec_select of a subreg of X to just a vec_select of X
+ when X has same component mode as vec_select. */
+ unsigned HOST_WIDE_INT subreg_offset = 0;
+ if (GET_CODE (trueop0) == SUBREG
+ && GET_MODE_INNER (mode)
+ == GET_MODE_INNER (GET_MODE (SUBREG_REG (trueop0)))
+ && GET_MODE_NUNITS (mode).is_constant (&l1)
+ && constant_multiple_p (subreg_memory_offset (trueop0),
+ GET_MODE_UNIT_BITSIZE (mode),
+ &subreg_offset))
+ {
+ poly_uint64 nunits
+ = GET_MODE_NUNITS (GET_MODE (SUBREG_REG (trueop0)));
+ bool success = true;
+ for (int i = 0; i != l1; i++)
+ {
+ rtx idx = XVECEXP (trueop1, 0, i);
+ if (!CONST_INT_P (idx)
+ || maybe_ge (UINTVAL (idx) + subreg_offset, nunits))
+ {
+ success = false;
+ break;
+ }
+ }
+
+ if (success)
+ {
+ rtx par = trueop1;
+ if (subreg_offset)
+ {
+ rtvec vec = rtvec_alloc (l1);
+ for (int i = 0; i < l1; i++)
+ RTVEC_ELT (vec, i)
+ = GEN_INT (INTVAL (XVECEXP (trueop1, 0, i))
+ + subreg_offset);
+ par = gen_rtx_PARALLEL (VOIDmode, vec);
+ }
+ return gen_rtx_VEC_SELECT (mode, SUBREG_REG (trueop0), par);
+ }
+ }
}
if (XVECLEN (trueop1, 0) == 1
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index bde6fa2..dff81d1 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2579,10 +2579,19 @@ layout_type (tree type)
/* If TYPE_SIZE_UNIT overflowed, then it is certainly larger than
TYPE_ALIGN_UNIT. */
&& !TREE_OVERFLOW (TYPE_SIZE_UNIT (element))
- && !integer_zerop (TYPE_SIZE_UNIT (element))
- && compare_tree_int (TYPE_SIZE_UNIT (element),
- TYPE_ALIGN_UNIT (element)) < 0)
- error ("alignment of array elements is greater than element size");
+ && !integer_zerop (TYPE_SIZE_UNIT (element)))
+ {
+ if (compare_tree_int (TYPE_SIZE_UNIT (element),
+ TYPE_ALIGN_UNIT (element)) < 0)
+ error ("alignment of array elements is greater than "
+ "element size");
+ else if (TYPE_ALIGN_UNIT (element) > 1
+ && (wi::zext (wi::to_wide (TYPE_SIZE_UNIT (element)),
+ ffs_hwi (TYPE_ALIGN_UNIT (element)) - 1)
+ != 0))
+ error ("size of array element is not a multiple of its "
+ "alignment");
+ }
break;
}
diff --git a/gcc/symtab-thunks.cc b/gcc/symtab-thunks.cc
new file mode 100644
index 0000000..1a4aaa2
--- /dev/null
+++ b/gcc/symtab-thunks.cc
@@ -0,0 +1,639 @@
+/* Support for thunks in symbol table.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
+ Contributed by Jan Hubicka
+
+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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "predict.h"
+#include "target.h"
+#include "rtl.h"
+#include "alloc-pool.h"
+#include "cgraph.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
+#include "lto-streamer.h"
+#include "fold-const.h"
+#include "gimple-iterator.h"
+#include "stor-layout.h"
+#include "gimplify-me.h"
+#include "varasm.h"
+#include "output.h"
+#include "cfg.h"
+#include "cfghooks.h"
+#include "gimple-ssa.h"
+#include "gimple-fold.h"
+#include "cfgloop.h"
+#include "tree-into-ssa.h"
+#include "tree-cfg.h"
+#include "cfgcleanup.h"
+#include "tree-pass.h"
+#include "data-streamer.h"
+#include "langhooks.h"
+
+/* Used for vtable lookup in thunk adjusting. */
+static GTY (()) tree vtable_entry_type;
+
+namespace {
+
+/* Function summary for thunk_infos. */
+class GTY((user)) thunk_infos_t: public function_summary <thunk_info *>
+{
+public:
+ thunk_infos_t (symbol_table *table, bool ggc):
+ function_summary<thunk_info *> (table, ggc) { }
+
+ /* Hook that is called by summary when a node is duplicated. */
+ virtual void duplicate (cgraph_node *node,
+ cgraph_node *node2,
+ thunk_info *data,
+ thunk_info *data2);
+};
+
+/* Duplication hook. */
+void
+thunk_infos_t::duplicate (cgraph_node *, cgraph_node *,
+ thunk_info *src, thunk_info *dst)
+{
+ *dst = *src;
+}
+
+} /* anon namespace */
+
+/* Return thunk_info possibly creating new one. */
+thunk_info *
+thunk_info::get_create (cgraph_node *node)
+{
+ if (!symtab->m_thunks)
+ {
+ symtab->m_thunks
+ = new (ggc_alloc_no_dtor <thunk_infos_t> ())
+ thunk_infos_t (symtab, true);
+ symtab->m_thunks->disable_insertion_hook ();
+ }
+ return symtab->m_thunks->get_create (node);
+}
+
+/* Stream out THIS to OB. */
+void
+thunk_info::stream_out (lto_simple_output_block *ob)
+{
+ streamer_write_uhwi_stream
+ (ob->main_stream,
+ 1 + (this_adjusting != 0) * 2
+ + (virtual_offset_p != 0) * 4);
+ streamer_write_uhwi_stream (ob->main_stream, fixed_offset);
+ streamer_write_uhwi_stream (ob->main_stream, virtual_value);
+ streamer_write_uhwi_stream (ob->main_stream, indirect_offset);
+}
+
+/* Stream in THIS from IB. */
+void
+thunk_info::stream_in (class lto_input_block *ib)
+{
+ int type = streamer_read_uhwi (ib);
+ fixed_offset = streamer_read_uhwi (ib);
+ virtual_value = streamer_read_uhwi (ib);
+ indirect_offset = streamer_read_uhwi (ib);
+
+ this_adjusting = (type & 2);
+ virtual_offset_p = (type & 4);
+}
+
+/* Dump THIS to F. */
+void
+thunk_info::dump (FILE *f)
+{
+ if (alias)
+ fprintf (f, " of %s (asm:%s)",
+ lang_hooks.decl_printable_name (alias, 2),
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (alias)));
+ fprintf (f, " fixed offset %i virtual value %i indirect_offset %i "
+ "has virtual offset %i\n",
+ (int)fixed_offset,
+ (int)virtual_value,
+ (int)indirect_offset,
+ (int)virtual_offset_p);
+}
+
+/* Hash THIS. */
+hashval_t
+thunk_info::hash ()
+{
+ inchash::hash hstate;
+ hstate.add_hwi (fixed_offset);
+ hstate.add_hwi (virtual_value);
+ hstate.add_flag (this_adjusting);
+ hstate.add_flag (virtual_offset_p);
+ return hstate.end ();
+}
+
+/* Adjust PTR by the constant FIXED_OFFSET, by the vtable offset indicated by
+ VIRTUAL_OFFSET, and by the indirect offset indicated by INDIRECT_OFFSET, if
+ it is non-null. THIS_ADJUSTING is nonzero for a this adjusting thunk and zero
+ for a result adjusting thunk. */
+tree
+thunk_adjust (gimple_stmt_iterator * bsi,
+ tree ptr, bool this_adjusting,
+ HOST_WIDE_INT fixed_offset, tree virtual_offset,
+ HOST_WIDE_INT indirect_offset)
+{
+ gassign *stmt;
+ tree ret;
+
+ if (this_adjusting
+ && fixed_offset != 0)
+ {
+ stmt = gimple_build_assign
+ (ptr, fold_build_pointer_plus_hwi_loc (input_location,
+ ptr,
+ fixed_offset));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+ }
+
+ if (!vtable_entry_type && (virtual_offset || indirect_offset != 0))
+ {
+ tree vfunc_type = make_node (FUNCTION_TYPE);
+ TREE_TYPE (vfunc_type) = integer_type_node;
+ TYPE_ARG_TYPES (vfunc_type) = NULL_TREE;
+ layout_type (vfunc_type);
+
+ vtable_entry_type = build_pointer_type (vfunc_type);
+ }
+
+ /* If there's a virtual offset, look up that value in the vtable and
+ adjust the pointer again. */
+ if (virtual_offset)
+ {
+ tree vtabletmp;
+ tree vtabletmp2;
+ tree vtabletmp3;
+
+ vtabletmp = create_tmp_reg
+ (build_pointer_type
+ (build_pointer_type (vtable_entry_type)), "vptr");
+
+ /* The vptr is always at offset zero in the object. */
+ stmt = gimple_build_assign (vtabletmp,
+ build1 (NOP_EXPR, TREE_TYPE (vtabletmp),
+ ptr));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ /* Form the vtable address. */
+ vtabletmp2 = create_tmp_reg (TREE_TYPE (TREE_TYPE (vtabletmp)),
+ "vtableaddr");
+ stmt = gimple_build_assign (vtabletmp2,
+ build_simple_mem_ref (vtabletmp));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ /* Find the entry with the vcall offset. */
+ stmt = gimple_build_assign (vtabletmp2,
+ fold_build_pointer_plus_loc (input_location,
+ vtabletmp2,
+ virtual_offset));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ /* Get the offset itself. */
+ vtabletmp3 = create_tmp_reg (TREE_TYPE (TREE_TYPE (vtabletmp2)),
+ "vcalloffset");
+ stmt = gimple_build_assign (vtabletmp3,
+ build_simple_mem_ref (vtabletmp2));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ /* Adjust the `this' pointer. */
+ ptr = fold_build_pointer_plus_loc (input_location, ptr, vtabletmp3);
+ ptr = force_gimple_operand_gsi (bsi, ptr, true, NULL_TREE, false,
+ GSI_CONTINUE_LINKING);
+ }
+
+ /* Likewise for an offset that is stored in the object that contains the
+ vtable. */
+ if (indirect_offset != 0)
+ {
+ tree offset_ptr, offset_tree;
+
+ /* Get the address of the offset. */
+ offset_ptr
+ = create_tmp_reg (build_pointer_type
+ (build_pointer_type (vtable_entry_type)),
+ "offset_ptr");
+ stmt = gimple_build_assign (offset_ptr,
+ build1 (NOP_EXPR, TREE_TYPE (offset_ptr),
+ ptr));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ stmt = gimple_build_assign
+ (offset_ptr,
+ fold_build_pointer_plus_hwi_loc (input_location, offset_ptr,
+ indirect_offset));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ /* Get the offset itself. */
+ offset_tree = create_tmp_reg (TREE_TYPE (TREE_TYPE (offset_ptr)),
+ "offset");
+ stmt = gimple_build_assign (offset_tree,
+ build_simple_mem_ref (offset_ptr));
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ /* Adjust the `this' pointer. */
+ ptr = fold_build_pointer_plus_loc (input_location, ptr, offset_tree);
+ ptr = force_gimple_operand_gsi (bsi, ptr, true, NULL_TREE, false,
+ GSI_CONTINUE_LINKING);
+ }
+
+ if (!this_adjusting
+ && fixed_offset != 0)
+ /* Adjust the pointer by the constant. */
+ {
+ tree ptrtmp;
+
+ if (VAR_P (ptr))
+ ptrtmp = ptr;
+ else
+ {
+ ptrtmp = create_tmp_reg (TREE_TYPE (ptr), "ptr");
+ stmt = gimple_build_assign (ptrtmp, ptr);
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+ }
+ ptr = fold_build_pointer_plus_hwi_loc (input_location,
+ ptrtmp, fixed_offset);
+ }
+
+ /* Emit the statement and gimplify the adjustment expression. */
+ ret = create_tmp_reg (TREE_TYPE (ptr), "adjusted_this");
+ stmt = gimple_build_assign (ret, ptr);
+ gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
+
+ return ret;
+}
+
+/* Expand thunk NODE to gimple if possible.
+ When FORCE_GIMPLE_THUNK is true, gimple thunk is created and
+ no assembler is produced.
+ When OUTPUT_ASM_THUNK is true, also produce assembler for
+ thunks that are not lowered. */
+bool
+expand_thunk (cgraph_node *node, bool output_asm_thunks,
+ bool force_gimple_thunk)
+{
+ thunk_info *info = thunk_info::get (node);
+ bool this_adjusting = info->this_adjusting;
+ HOST_WIDE_INT fixed_offset = info->fixed_offset;
+ HOST_WIDE_INT virtual_value = info->virtual_value;
+ HOST_WIDE_INT indirect_offset = info->indirect_offset;
+ tree virtual_offset = NULL;
+ tree alias = node->callees->callee->decl;
+ tree thunk_fndecl = node->decl;
+ tree a;
+
+ if (!force_gimple_thunk
+ && this_adjusting
+ && indirect_offset == 0
+ && !DECL_EXTERNAL (alias)
+ && !DECL_STATIC_CHAIN (alias)
+ && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
+ virtual_value, alias))
+ {
+ tree fn_block;
+ tree restype = TREE_TYPE (TREE_TYPE (thunk_fndecl));
+
+ if (!output_asm_thunks)
+ {
+ node->analyzed = true;
+ return false;
+ }
+
+ if (in_lto_p)
+ node->get_untransformed_body ();
+ a = DECL_ARGUMENTS (thunk_fndecl);
+
+ current_function_decl = thunk_fndecl;
+
+ /* Ensure thunks are emitted in their correct sections. */
+ resolve_unique_section (thunk_fndecl, 0,
+ flag_function_sections);
+
+ DECL_RESULT (thunk_fndecl)
+ = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
+ RESULT_DECL, 0, restype);
+ DECL_CONTEXT (DECL_RESULT (thunk_fndecl)) = thunk_fndecl;
+
+ /* The back end expects DECL_INITIAL to contain a BLOCK, so we
+ create one. */
+ fn_block = make_node (BLOCK);
+ BLOCK_VARS (fn_block) = a;
+ DECL_INITIAL (thunk_fndecl) = fn_block;
+ BLOCK_SUPERCONTEXT (fn_block) = thunk_fndecl;
+ allocate_struct_function (thunk_fndecl, false);
+ init_function_start (thunk_fndecl);
+ cfun->is_thunk = 1;
+ insn_locations_init ();
+ set_curr_insn_location (DECL_SOURCE_LOCATION (thunk_fndecl));
+ prologue_location = curr_insn_location ();
+
+ targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl,
+ fixed_offset, virtual_value, alias);
+
+ insn_locations_finalize ();
+ init_insn_lengths ();
+ free_after_compilation (cfun);
+ TREE_ASM_WRITTEN (thunk_fndecl) = 1;
+ node->thunk = false;
+ node->analyzed = false;
+ }
+ else if (stdarg_p (TREE_TYPE (thunk_fndecl)))
+ {
+ error ("generic thunk code fails for method %qD which uses %<...%>",
+ thunk_fndecl);
+ TREE_ASM_WRITTEN (thunk_fndecl) = 1;
+ node->analyzed = true;
+ return false;
+ }
+ else
+ {
+ tree restype;
+ basic_block bb, then_bb, else_bb, return_bb;
+ gimple_stmt_iterator bsi;
+ int nargs = 0;
+ tree arg;
+ int i;
+ tree resdecl;
+ tree restmp = NULL;
+
+ gcall *call;
+ greturn *ret;
+ bool alias_is_noreturn = TREE_THIS_VOLATILE (alias);
+
+ /* We may be called from expand_thunk that releases body except for
+ DECL_ARGUMENTS. In this case force_gimple_thunk is true. */
+ if (in_lto_p && !force_gimple_thunk)
+ node->get_untransformed_body ();
+
+ /* We need to force DECL_IGNORED_P when the thunk is created
+ after early debug was run. */
+ if (force_gimple_thunk)
+ DECL_IGNORED_P (thunk_fndecl) = 1;
+
+ a = DECL_ARGUMENTS (thunk_fndecl);
+
+ current_function_decl = thunk_fndecl;
+
+ /* Ensure thunks are emitted in their correct sections. */
+ resolve_unique_section (thunk_fndecl, 0,
+ flag_function_sections);
+
+ bitmap_obstack_initialize (NULL);
+
+ if (info->virtual_offset_p)
+ virtual_offset = size_int (virtual_value);
+
+ /* Build the return declaration for the function. */
+ restype = TREE_TYPE (TREE_TYPE (thunk_fndecl));
+ if (DECL_RESULT (thunk_fndecl) == NULL_TREE)
+ {
+ resdecl = build_decl (input_location, RESULT_DECL, 0, restype);
+ DECL_ARTIFICIAL (resdecl) = 1;
+ DECL_IGNORED_P (resdecl) = 1;
+ DECL_CONTEXT (resdecl) = thunk_fndecl;
+ DECL_RESULT (thunk_fndecl) = resdecl;
+ }
+ else
+ resdecl = DECL_RESULT (thunk_fndecl);
+
+ profile_count cfg_count = node->count;
+ if (!cfg_count.initialized_p ())
+ cfg_count = profile_count::from_gcov_type
+ (BB_FREQ_MAX).guessed_local ();
+
+ bb = then_bb = else_bb = return_bb
+ = init_lowered_empty_function (thunk_fndecl, true, cfg_count);
+
+ bsi = gsi_start_bb (bb);
+
+ /* Build call to the function being thunked. */
+ if (!VOID_TYPE_P (restype)
+ && (!alias_is_noreturn
+ || TREE_ADDRESSABLE (restype)
+ || TREE_CODE (TYPE_SIZE_UNIT (restype)) != INTEGER_CST))
+ {
+ if (DECL_BY_REFERENCE (resdecl))
+ {
+ restmp = gimple_fold_indirect_ref (resdecl);
+ if (!restmp)
+ restmp = build2 (MEM_REF,
+ TREE_TYPE (TREE_TYPE (resdecl)),
+ resdecl,
+ build_int_cst (TREE_TYPE (resdecl), 0));
+ }
+ else if (!is_gimple_reg_type (restype))
+ {
+ if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)))
+ {
+ restmp = resdecl;
+
+ if (VAR_P (restmp))
+ {
+ add_local_decl (cfun, restmp);
+ BLOCK_VARS (DECL_INITIAL (current_function_decl))
+ = restmp;
+ }
+ }
+ else
+ restmp = create_tmp_var (restype, "retval");
+ }
+ else
+ restmp = create_tmp_reg (restype, "retval");
+ }
+
+ for (arg = a; arg; arg = DECL_CHAIN (arg))
+ nargs++;
+ auto_vec<tree> vargs (nargs);
+ i = 0;
+ arg = a;
+ if (this_adjusting)
+ {
+ vargs.quick_push (thunk_adjust (&bsi, a, 1, fixed_offset,
+ virtual_offset, indirect_offset));
+ arg = DECL_CHAIN (a);
+ i = 1;
+ }
+
+ if (nargs)
+ for (; i < nargs; i++, arg = DECL_CHAIN (arg))
+ {
+ tree tmp = arg;
+ DECL_NOT_GIMPLE_REG_P (arg) = 0;
+ if (!is_gimple_val (arg))
+ {
+ tmp = create_tmp_reg (TYPE_MAIN_VARIANT
+ (TREE_TYPE (arg)), "arg");
+ gimple *stmt = gimple_build_assign (tmp, arg);
+ gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
+ }
+ vargs.quick_push (tmp);
+ }
+ call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
+ node->callees->call_stmt = call;
+ gimple_call_set_from_thunk (call, true);
+ if (DECL_STATIC_CHAIN (alias))
+ {
+ tree p = DECL_STRUCT_FUNCTION (alias)->static_chain_decl;
+ tree type = TREE_TYPE (p);
+ tree decl = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
+ PARM_DECL, create_tmp_var_name ("CHAIN"),
+ type);
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_IGNORED_P (decl) = 1;
+ TREE_USED (decl) = 1;
+ DECL_CONTEXT (decl) = thunk_fndecl;
+ DECL_ARG_TYPE (decl) = type;
+ TREE_READONLY (decl) = 1;
+
+ struct function *sf = DECL_STRUCT_FUNCTION (thunk_fndecl);
+ sf->static_chain_decl = decl;
+
+ gimple_call_set_chain (call, decl);
+ }
+
+ /* Return slot optimization is always possible and in fact required to
+ return values with DECL_BY_REFERENCE. */
+ if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))
+ && (!is_gimple_reg_type (TREE_TYPE (resdecl))
+ || DECL_BY_REFERENCE (resdecl)))
+ gimple_call_set_return_slot_opt (call, true);
+
+ if (restmp)
+ {
+ gimple_call_set_lhs (call, restmp);
+ gcc_assert (useless_type_conversion_p (TREE_TYPE (restmp),
+ TREE_TYPE (TREE_TYPE (alias))));
+ }
+ gsi_insert_after (&bsi, call, GSI_NEW_STMT);
+ if (!alias_is_noreturn)
+ {
+ if (restmp && !this_adjusting
+ && (fixed_offset || virtual_offset))
+ {
+ tree true_label = NULL_TREE;
+
+ if (TREE_CODE (TREE_TYPE (restmp)) == POINTER_TYPE)
+ {
+ gimple *stmt;
+ edge e;
+ /* If the return type is a pointer, we need to
+ protect against NULL. We know there will be an
+ adjustment, because that's why we're emitting a
+ thunk. */
+ then_bb = create_basic_block (NULL, bb);
+ then_bb->count = cfg_count - cfg_count.apply_scale (1, 16);
+ return_bb = create_basic_block (NULL, then_bb);
+ return_bb->count = cfg_count;
+ else_bb = create_basic_block (NULL, else_bb);
+ else_bb->count = cfg_count.apply_scale (1, 16);
+ add_bb_to_loop (then_bb, bb->loop_father);
+ add_bb_to_loop (return_bb, bb->loop_father);
+ add_bb_to_loop (else_bb, bb->loop_father);
+ remove_edge (single_succ_edge (bb));
+ true_label = gimple_block_label (then_bb);
+ stmt = gimple_build_cond (NE_EXPR, restmp,
+ build_zero_cst (TREE_TYPE (restmp)),
+ NULL_TREE, NULL_TREE);
+ gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
+ e = make_edge (bb, then_bb, EDGE_TRUE_VALUE);
+ e->probability = profile_probability::guessed_always ()
+ .apply_scale (1, 16);
+ e = make_edge (bb, else_bb, EDGE_FALSE_VALUE);
+ e->probability = profile_probability::guessed_always ()
+ .apply_scale (1, 16);
+ make_single_succ_edge (return_bb,
+ EXIT_BLOCK_PTR_FOR_FN (cfun), 0);
+ make_single_succ_edge (then_bb, return_bb, EDGE_FALLTHRU);
+ e = make_edge (else_bb, return_bb, EDGE_FALLTHRU);
+ e->probability = profile_probability::always ();
+ bsi = gsi_last_bb (then_bb);
+ }
+
+ restmp = thunk_adjust (&bsi, restmp, /*this_adjusting=*/0,
+ fixed_offset, virtual_offset,
+ indirect_offset);
+ if (true_label)
+ {
+ gimple *stmt;
+ bsi = gsi_last_bb (else_bb);
+ stmt = gimple_build_assign (restmp,
+ build_zero_cst
+ (TREE_TYPE (restmp)));
+ gsi_insert_after (&bsi, stmt, GSI_NEW_STMT);
+ bsi = gsi_last_bb (return_bb);
+ }
+ }
+ else
+ {
+ gimple_call_set_tail (call, true);
+ cfun->tail_call_marked = true;
+ }
+
+ /* Build return value. */
+ if (!DECL_BY_REFERENCE (resdecl))
+ ret = gimple_build_return (restmp);
+ else
+ ret = gimple_build_return (resdecl);
+
+ gsi_insert_after (&bsi, ret, GSI_NEW_STMT);
+ }
+ else
+ {
+ gimple_call_set_tail (call, true);
+ cfun->tail_call_marked = true;
+ remove_edge (single_succ_edge (bb));
+ }
+
+ cfun->gimple_df->in_ssa_p = true;
+ update_max_bb_count ();
+ profile_status_for_fn (cfun)
+ = cfg_count.initialized_p () && cfg_count.ipa_p ()
+ ? PROFILE_READ : PROFILE_GUESSED;
+ /* FIXME: C++ FE should stop setting TREE_ASM_WRITTEN on thunks. */
+ TREE_ASM_WRITTEN (thunk_fndecl) = false;
+ delete_unreachable_blocks ();
+ update_ssa (TODO_update_ssa);
+ checking_verify_flow_info ();
+ free_dominance_info (CDI_DOMINATORS);
+
+ /* Since we want to emit the thunk, we explicitly mark its name as
+ referenced. */
+ node->thunk = false;
+ node->lowered = true;
+ bitmap_obstack_release (NULL);
+ }
+ current_function_decl = NULL;
+ set_cfun (NULL);
+ return true;
+}
+
+void
+symtab_thunks_cc_finalize (void)
+{
+ vtable_entry_type = NULL;
+}
+
+#include "gt-symtab-thunks.h"
diff --git a/gcc/symtab-thunks.h b/gcc/symtab-thunks.h
new file mode 100644
index 0000000..a23fc55
--- /dev/null
+++ b/gcc/symtab-thunks.h
@@ -0,0 +1,166 @@
+/* Representation of thunks inside symbol table.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
+ Contributed by Jan Hubicka
+
+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/>. */
+
+#ifndef GCC_SYMTAB_THUNKS_H
+#define GCC_SYMTAB_THUNKS_H
+
+/* This symbol annotation holds information about thunk.
+
+ Thunks are basically wrappers around methods which are introduced in case
+ of multiple inheritance in order to adjust the value of the "this" pointer
+ or of the returned value.
+
+ In the case of this-adjusting thunks, each back-end can override the
+ can_output_mi_thunk/output_mi_thunk target hooks to generate a minimal thunk
+ (with a tail call for instance) directly as assembly. For the default hook
+ or for the case where the can_output_mi_thunk hooks return false, the thunk
+ is gimplified and lowered using the regular machinery. */
+
+struct GTY(()) thunk_info {
+ /* Constructor. */
+ thunk_info ()
+ : fixed_offset (0),
+ virtual_value (0),
+ indirect_offset (0),
+ alias (NULL),
+ this_adjusting (false),
+ virtual_offset_p (false)
+ {
+ }
+ /* Copy constructor. */
+ thunk_info (const thunk_info &t)
+ : fixed_offset (t.fixed_offset),
+ virtual_value (t.virtual_value),
+ indirect_offset (t.indirect_offset),
+ alias (t.alias),
+ this_adjusting (t.this_adjusting),
+ virtual_offset_p (t.virtual_offset_p)
+ {
+ }
+
+ /* Compare for equiality. */
+ bool
+ operator==(const thunk_info &other) const
+ {
+ return fixed_offset == other.fixed_offset
+ && virtual_value == other.virtual_value
+ && indirect_offset == other.indirect_offset
+ && this_adjusting == other.this_adjusting
+ && virtual_offset_p == other.virtual_offset_p;
+ }
+ bool
+ operator!=(const thunk_info &other) const
+ {
+ return !(*this == other);
+ }
+ /* Copy operator. */
+ thunk_info &
+ operator=(const thunk_info &other)
+ {
+ fixed_offset = other.fixed_offset;
+ virtual_value = other.virtual_value;
+ indirect_offset = other.indirect_offset;
+ this_adjusting = other.this_adjusting;
+ virtual_offset_p = other.virtual_offset_p;
+ return *this;
+ }
+
+ /* Offset used to adjust "this". */
+ HOST_WIDE_INT fixed_offset;
+
+ /* Offset in the virtual table to get the offset to adjust "this". Valid iff
+ VIRTUAL_OFFSET_P is true. */
+ HOST_WIDE_INT virtual_value;
+
+ /* Offset from "this" to get the offset to adjust "this". Zero means: this
+ offset is to be ignored. */
+ HOST_WIDE_INT indirect_offset;
+
+ /* Thunk target, i.e. the method that this thunk wraps. Depending on the
+ TARGET_USE_LOCAL_THUNK_ALIAS_P macro, this may have to be a new alias. */
+ tree alias;
+
+ /* Nonzero for a "this" adjusting thunk and zero for a result adjusting
+ thunk. */
+ bool this_adjusting;
+
+ /* If true, this thunk is what we call a virtual thunk. In this case:
+ * for this-adjusting thunks, after the FIXED_OFFSET based adjustment is
+ done, add to the result the offset found in the vtable at:
+ vptr + VIRTUAL_VALUE
+ * for result-adjusting thunks, the FIXED_OFFSET adjustment is done after
+ the virtual one. */
+ bool virtual_offset_p;
+
+
+
+ /* Dump thunk_info. */
+ void dump (FILE *);
+
+ /* Stream out thunk_info. */
+ void stream_out (class lto_simple_output_block *);
+
+ /* Stream in trunk_info. */
+ void stream_in (class lto_input_block *);
+
+ hashval_t hash ();
+
+
+
+ /* Return thunk_info, if available. */
+ static thunk_info *get (cgraph_node *node);
+
+ /* Return thunk_info possibly creating new one. */
+ static thunk_info *get_create (cgraph_node *node);
+
+ /* Remove thunk_info. */
+ static void remove (cgraph_node *node);
+
+ /* Release all thunk_infos. */
+ static void release (void);
+};
+
+bool expand_thunk (cgraph_node *, bool, bool);
+
+/* Return thunk_info, if available. */
+inline thunk_info *
+thunk_info::get (cgraph_node *node)
+{
+ if (!symtab->m_thunks)
+ return NULL;
+ return symtab->m_thunks->get (node);
+}
+
+/* Remove thunk_info association for NODE. */
+inline void
+thunk_info::remove (cgraph_node *node)
+{
+ symtab->m_thunks->remove (node);
+}
+
+/* Free thunk info summaries. */
+inline void
+thunk_info::release ()
+{
+ if (symtab->m_thunks)
+ delete (symtab->m_thunks);
+ symtab->m_thunks = NULL;
+}
+#endif /* GCC_SYMTAB_THUNKS_H */
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 207c9e7..bc2865f 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -2391,7 +2391,7 @@ symbol_table::symbol_suffix_separator ()
bool
symtab_node::binds_to_current_def_p (symtab_node *ref)
{
- if (!definition)
+ if (!definition && !in_other_partition)
return false;
if (transparent_alias)
return definition
diff --git a/gcc/system.h b/gcc/system.h
index 3c543a0..b0f3f1d 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -732,7 +732,7 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
#endif
#ifdef INCLUDE_MALLOC_H
-#ifdef HAVE_MALLINFO
+#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
#include <malloc.h>
#endif
#endif
@@ -1237,6 +1237,7 @@ void gcc_stablesort (void *, size_t, size_t,
#define ONE_K 1024
#define ONE_M (ONE_K * ONE_K)
+#define ONE_G (ONE_K * ONE_M)
/* Display a number as an integer multiple of either:
- 1024, if said integer is >= to 10 K (in base 2)
diff --git a/gcc/target.def b/gcc/target.def
index fc4563d..ed2da15 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -2618,8 +2618,11 @@ set via @code{__attribute__}.",
DEFHOOK
(libc_has_function,
"This hook determines whether a function from a class of functions\n\
-@var{fn_class} is present in the target C library.",
- bool, (enum function_class fn_class),
+@var{fn_class} is present in the target C library. If @var{type} is NULL,\n\
+the caller asks for support for all standard (float, double, long double)\n\
+types. If @var{type} is non-NULL, the caller asks for support for a\n\
+specific type.",
+ bool, (enum function_class fn_class, tree type),
default_libc_has_function)
DEFHOOK
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index da4805d..5d94fce 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1641,7 +1641,8 @@ default_have_conditional_execution (void)
/* By default we assume that c99 functions are present at the runtime,
but sincos is not. */
bool
-default_libc_has_function (enum function_class fn_class)
+default_libc_has_function (enum function_class fn_class,
+ tree type ATTRIBUTE_UNUSED)
{
if (fn_class == function_c94
|| fn_class == function_c99_misc
@@ -1660,13 +1661,15 @@ default_libc_has_fast_function (int fcode ATTRIBUTE_UNUSED)
}
bool
-gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
+gnu_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED,
+ tree type ATTRIBUTE_UNUSED)
{
return true;
}
bool
-no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED)
+no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED,
+ tree type ATTRIBUTE_UNUSED)
{
return false;
}
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index b572a36..44ab926 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -208,10 +208,10 @@ extern rtx default_addr_space_convert (rtx, tree, tree);
extern unsigned int default_case_values_threshold (void);
extern bool default_have_conditional_execution (void);
-extern bool default_libc_has_function (enum function_class);
+extern bool default_libc_has_function (enum function_class, tree);
extern bool default_libc_has_fast_function (int fcode);
-extern bool no_c99_libc_has_function (enum function_class);
-extern bool gnu_libc_has_function (enum function_class);
+extern bool no_c99_libc_has_function (enum function_class, tree);
+extern bool gnu_libc_has_function (enum function_class, tree);
extern tree default_builtin_tm_load_store (tree);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 716f644..cc13418 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,2341 @@
+2020-10-24 Marek Polacek <polacek@redhat.com>
+
+ PR c++/96241
+ * g++.dg/cpp0x/constexpr-96241.C: New test.
+ * g++.dg/cpp1y/constexpr-96241.C: New test.
+
+2020-10-24 Aldy Hernandez <aldyh@redhat.com>
+
+ * g++.dg/pr97538.C: New test.
+
+2020-10-23 Marek Polacek <polacek@redhat.com>
+
+ * c-c++-common/Wsizeof-array-div1.c: Expect certain warnings on
+ lp64 targets only.
+ * g++.dg/warn/Wsizeof-array-div2.C: Only run on lp64 targets.
+
+2020-10-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91741
+ * c-c++-common/Wsizeof-pointer-div.c: Add dg-warning.
+ * c-c++-common/Wsizeof-array-div1.c: New test.
+ * g++.dg/warn/Wsizeof-array-div1.C: New test.
+ * g++.dg/warn/Wsizeof-array-div2.C: New test.
+
+2020-10-23 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97552
+ * gcc.dg/Wvla-parameter-2.c: Adjust text of expected warning.
+ * gcc.dg/Wnonnull-5.c: New test.
+
+2020-10-23 Martin Sebor <msebor@redhat.com>
+
+ PR c/97463
+ * gcc.dg/pr97463.c: New test.
+
+2020-10-23 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/vec-rlmi-rlnm.c: Update xxlor expect.
+
+2020-10-23 Jonathan Wakely <jwakely@redhat.com>
+
+ * g++.dg/compat/eh/filter2_y.C: Add noexcept(false) to
+ destructor.
+
+2020-10-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97164
+ * c-c++-common/pr97164.c: New test.
+ * gcc.c-torture/execute/pr36093.c: Move ...
+ * gcc.dg/pr36093.c: ... here. Add dg-do compile and dg-error
+ directives.
+ * gcc.c-torture/execute/pr43783.c: Move ...
+ * gcc.dg/pr43783.c: ... here. Add dg-do compile, dg-options and
+ dg-error directives.
+
+2020-10-23 Dennis Zhang <dennis.zh@live.com>
+
+ * gcc.target/arm/simd/mve-vsub_1.c: New test.
+
+2020-10-23 Richard Biener <rguenther@suse.de>
+
+ Revert:
+ 2020-10-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97521
+ * gcc.target/i386/pr97521.c: New testcase.
+
+2020-10-23 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/arm/simd/mve-vsub_1.c: New test.
+
+2020-10-22 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/vec-splati-runnable.c: Don't abort on
+ undefined output.
+
+2020-10-22 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/rlwimi-2.c: Adjust expected results for lp64.
+ * gcc.target/powerpc/vec-rlmi-rlnm.c: Remove target and LP64.
+ Adjust xxlor expected results.
+
+2020-10-22 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/flush-1.f90: New test.
+ * gfortran.dg/gomp/flush-2.f90: New test.
+
+2020-10-22 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * gcc.target/powerpc/vsx-load-element-extend-char.c: New test.
+ * gcc.target/powerpc/vsx-load-element-extend-int.c: New test.
+ * gcc.target/powerpc/vsx-load-element-extend-longlong.c: New test.
+ * gcc.target/powerpc/vsx-load-element-extend-short.c: New test.
+ * gcc.target/powerpc/vsx-store-element-truncate-char.c: New test.
+ * gcc.target/powerpc/vsx-store-element-truncate-int.c: New test.
+ * gcc.target/powerpc/vsx-store-element-truncate-longlong.c: New test.
+ * gcc.target/powerpc/vsx-store-element-truncate-short.c: New test.
+
+2020-10-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * ada/acats/run_all.sh: Define and substitute target_{max,min}_int.
+ * ada/acats/support/macro.dfs: Parameterize {MAX,MIN}_INT.
+ * gnat.dg/assert1.adb: Adjust conditionally to 128-bit integer types.
+ * gnat.dg/size_clause1.adb: Do not expect a warning for LP64 targets.
+ * gnat.dg/warn11.adb: Likewise.
+ * gnat.dg/specs/rep_clause5.ads (Array_2_Type): Add alignment clause.
+
+2020-10-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97328
+ * g++.dg/cpp2a/constexpr-init19.C: New test.
+ * g++.dg/cpp2a/constexpr-init20.C: New test.
+
+2020-10-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96575
+ * g++.dg/cpp1z/constexpr-96575.C: New test.
+
+2020-10-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97511
+ * g++.dg/template/shadow3.C: New test.
+
+2020-10-22 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97521
+ * gcc.target/i386/pr97521.c: New testcase.
+
+2020-10-22 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.dg/pr97502.c: New test.
+
+2020-10-22 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.dg/dfp/pr97439.c: New test.
+
+2020-10-22 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97514
+ * gcc.dg/analyzer/pr97514.c: New test.
+
+2020-10-22 David Malcolm <dmalcolm@redhat.com>
+
+ * g++.dg/analyzer/ctor-dtor-1.C: New test.
+ * g++.dg/analyzer/dyncast-1.C: New test.
+ * g++.dg/analyzer/vfunc-1.C: New test.
+
+2020-10-22 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97489
+ * g++.dg/analyzer/pr97489.C: New test.
+
+2020-10-22 Martin Liska <mliska@suse.cz>
+
+ PR c/94722
+ * g++.dg/no-stack-protector-attr-2.C: New test.
+ * g++.dg/no-stack-protector-attr-3.C: New test.
+ * g++.dg/no-stack-protector-attr.C: New test.
+
+2020-10-22 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr97249-1.c: New test.
+
+2020-10-22 Dennis Zhang <dennis.zh@live.com>
+
+ * gcc.target/arm/simd/mve-vminmax_1.c: New test.
+
+2020-10-22 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97520.c: New.
+
+2020-10-22 Dennis Zhang <dennis.zh@live.com>
+
+ * gcc.target/arm/simd/mve-vmul_1.c: New test.
+
+2020-10-22 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97515
+ * gcc.dg/pr97515.c: New file.
+
+2020-10-21 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/fold-vec-extract-float.p9.c: rldicl and
+ subfic only for target LE.
+ * gcc.target/powerpc/fold-vec-extract-longlong.p9.c: xori only
+ for target LE. Adjust mfvsrd and add mfvsrld for BE.
+ * gcc.target/powerpc/fold-vec-extract-short.p9.c: vextuhrx for LE.
+ vextuhlx for BE.
+ * gcc.target/powerpc/p9-lxvx-stxvx-1.c: Remove target.
+ * gcc.target/powerpc/p9-lxvx-stxvx-2.c: Remove target.
+ * gcc.target/powerpc/p9-lxvx-stxvx-3.c: Remove target. Require
+ float128
+
+2020-10-21 Martin Liska <mliska@suse.cz>
+ Andrew MacLeod <amacleod@redhat.com>
+
+ PR target/97360
+ * gcc.target/powerpc/pr97360.c: New test.
+
+2020-10-21 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97445
+ * gcc.dg/ipa/inlinehint-5.c: New test.
+
+2020-10-21 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/p9-extract-1.c: Require lp64.
+ * gcc.target/powerpc/p9-extract-2.c: Require lp64.
+ * gcc.target/powerpc/p9-extract-3.c: Require lp64.
+ * gcc.target/powerpc/p9-permute.c: Remove target.
+ * gcc.target/powerpc/pr63335.c: Remove target.
+ * gcc.target/powerpc/pr87507.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-1.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-10.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-11.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-12.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-13.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-14.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-15.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-16.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-17.c: Require P8.
+ * gcc.target/powerpc/swaps-p8-18.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-19.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-2.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-20.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-21.c: Remove target. Require Altivec.
+ * gcc.target/powerpc/swaps-p8-22.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-23.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-24.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-25.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-26.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-27.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-28.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-29.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-3.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-30.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-31.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-32.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-33.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-34.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-35.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-36.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-37.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-38.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-39.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-4.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-40.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-41.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-42.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-43.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-44.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-45.c: Remove target.
+ * gcc.target/powerpc/swaps-p8-46.c: Require LE.
+ * gcc.target/powerpc/swaps-p8-5.c: Require LE and P8.
+ * gcc.target/powerpc/swaps-p8-6.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-7.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-8.c: Remove target. Require P8.
+ * gcc.target/powerpc/swaps-p8-9.c: Remove target. Require P8.
+ * gcc.target/powerpc/vec-cmp.c: Require LP64.
+ * gcc.target/powerpc/vec-cmpne.c: Remove target.
+ * gcc.target/powerpc/vec-mul.c: Remove target.
+ * gcc.target/powerpc/vec-set-char.c: Require LP64.
+ * gcc.target/powerpc/vec-set-int.c: Require LP64.
+ * gcc.target/powerpc/vec-set-short.c: Require LP64.
+ * gcc.target/powerpc/vec-xxpermdi.c: Remove target. Require VSX.
+ * gcc.target/powerpc/vsxcopy.c: Remove target. Require VSX.
+
+2020-10-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97500
+ * gfortran.dg/pr97500.f90: New testcase.
+
+2020-10-21 liuhongt <hongtao.liu@intel.com>
+
+ PR target/97506
+ * gcc.target/i386/pr97506.c: New test.
+
+2020-10-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97503
+ * gcc.dg/tree-ssa/pr97503.c: New test.
+
+2020-10-21 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/97414
+ * g++.dg/asan/pr97414.C: New test.
+
+2020-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/multfixed.adb: Update expected exception message.
+
+2020-10-21 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c (CMT):
+ Adopt the same style used in the rest of the file.
+
+2020-10-21 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Walloca-1.c: Adjust for 32-bits.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/arm/simd/mve-vminmax_1.c: New test.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/arm/simd/mve-vmul_1.c: New test.
+
+2020-10-20 Jeff Law <law@redhat.com>
+
+ * gcc.dg/Wbuiltin-declaration-mismatch-9.c: Improve pruning of
+ invalid scanf call messages.
+
+2020-10-20 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97505
+ * gfortran.dg/pr97505.f90: New file.
+
+2020-10-20 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/lookup/local-extern.C: New.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Wrestrict-22.c: New test.
+ * g++.dg/torture/pr92421.C: Adjust for ranger.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/Walloca-1.c: Adjust for ranger.
+ * gcc.dg/Walloca-12.c: Same.
+ * gcc.dg/Walloca-13.c: Same.
+ * gcc.dg/Walloca-2.c: Same.
+ * gcc.dg/Walloca-3.c: Same.
+ * gcc.dg/Walloca-6.c: Same.
+ * gcc.dg/Wvla-larger-than-2.c: Same.
+
+2020-10-20 Tobias Burnus <tobias@codesourcery.com>
+
+ * gcc.misc-tests/outputs.exp: Add ltrans_args dump files
+ for 'lto save-temps'.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97501.c: New test.
+
+2020-10-20 Nathan Sidwell <nathan@acm.org>
+
+ * gcc.dg/cpp/endif.c: Move to ...
+ * c-c++-common/cpp/endif.c: ... here.
+ * gcc.dg/cpp/endif.h: Move to ...
+ * c-c++-common/cpp/endif.h: ... here.
+ * c-c++-common/cpp/eof-2.c: Adjust diagnostic.
+ * c-c++-common/cpp/eof-3.c: Adjust diagnostic.
+
+2020-10-20 Marek Polacek <polacek@redhat.com>
+
+ PR c++/82239
+ * g++.dg/cpp0x/static_assert16.C: New test.
+
+2020-10-20 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/opt11.adb: Add new expected warning.
+
+2020-10-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97496
+ * gcc.dg/vect/bb-slp-pr97496.c: New testcase.
+
+2020-10-20 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97488.c: Add target int128 predicate.
+
+2020-10-19 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97360-2.c: New test.
+
+2020-10-19 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/sad-vectorize-1.c: Remove target.
+ * gcc.target/powerpc/sad-vectorize-2.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v16qi-df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v16qi.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v16qiu-df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v16qiu.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v2df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v2di.c: Require lp64.
+ * gcc.target/powerpc/vec-extract-v4sf.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v4si-df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v4si.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v4siu-df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v4siu.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v8hi-df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v8hi.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v8hiu-df.c: Remove target.
+ * gcc.target/powerpc/vec-extract-v8hiu.c: Remove target.
+ * gcc.target/powerpc/vec-init-1.c: Remove target.
+ * gcc.target/powerpc/vec-init-2.c: Require lp64.
+ * gcc.target/powerpc/vec-init-3.c: Require lp64.
+ * gcc.target/powerpc/vec-init-4.c: Remove target.
+ * gcc.target/powerpc/vec-init-5.c: Remove target.
+ * gcc.target/powerpc/vec-init-6.c: Require lp64.
+ * gcc.target/powerpc/vec-init-7.c: Require lp64.
+ * gcc.target/powerpc/vec-init-8.c: Remove target.
+ * gcc.target/powerpc/vec-init-9.c: Require lp64.
+ * gcc.target/powerpc/vec-setup-double.c: Remove target.
+ * gcc.target/powerpc/vec-setup-long.c: Remove target.
+ * gcc.target/powerpc/vsu/vec-xl-len-13.c: Correct expected warnings.
+ * gcc.target/powerpc/vsu/vsu.exp: Enable on AIX.
+
+2020-10-19 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/fold-vec-extract-char.p7.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-char.p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-char.p9.c: Remove target.
+ Expect 3 addi for ilp32.
+ * gcc.target/powerpc/fold-vec-extract-double.p7.c: Remove target.
+ Add -mbig-endian for Linux.
+ * gcc.target/powerpc/fold-vec-extract-double.p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-float.p7.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-float.p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-float.p9.c: Require lp64.
+ * gcc.target/powerpc/fold-vec-extract-int.p7.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-int.p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-int.p9.c: Remove target.
+ Expect 3 addi for ilp32.
+ * gcc.target/powerpc/fold-vec-extract-longlong.p7.c: Remove target.
+ Expect 4 addi for ilp32.
+ * gcc.target/powerpc/fold-vec-extract-longlong.p8.c: Remove target.
+ Expect 4 addi for ilp32.
+ * gcc.target/powerpc/fold-vec-extract-longlong.p9.c: Require lp64.
+ * gcc.target/powerpc/fold-vec-extract-short.p7.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-short.p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-extract-short.p9.c: Require lp64.
+ * gcc.target/powerpc/fold-vec-insert-char-p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-char-p9.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-double.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-float-p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-float-p9.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-int-p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-int-p9.c: Remove target.
+ Require 8 addi for ilp32.
+ * gcc.target/powerpc/fold-vec-insert-longlong.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-short-p8.c: Remove target.
+ * gcc.target/powerpc/fold-vec-insert-short-p9.c: Remove target.
+ * gcc.target/powerpc/fold-vec-select-double.c: Remove target.
+ * gcc.target/powerpc/fold-vec-select-float.c: Remove target.
+ * gcc.target/powerpc/fold-vec-splats-int.c: Require lp64.
+ * gcc.target/powerpc/fold-vec-splats-longlong.c: Require lp64.
+
+2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ PR c++/97438
+ * g++.dg/coroutines/pr97438.C: New test.
+
+2020-10-19 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/97456
+ * gcc.dg/tree-ssa/pr97456.c: New test.
+
+2020-10-19 Nathan Sidwell <nathan@acm.org>
+
+ * c-c++-common/cpp/pr97471.c: New.
+
+2020-10-19 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97488.c: New test.
+
+2020-10-19 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97486
+ * gcc.dg/vect/bb-slp-pr97486.c: New testcase.
+
+2020-10-19 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97467.c: New test.
+
+2020-10-19 Li Jia He <helijia@gcc.gnu.org>
+
+ PR tree-optimization/66552
+ * gcc.dg/pr66552.c: New testcase.
+
+2020-10-18 Harald Anlauf <anlauf@gmx.de>
+
+ * gfortran.dg/matmul_20.f90: New test.
+
+2020-10-17 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/p9-dimode1.c: Remove target.
+ * gcc.target/powerpc/p9-dimode2.c: Remove target.
+ * gcc.target/powerpc/p9-fpcvt-1.c: Remove target.
+ * gcc.target/powerpc/p9-fpcvt-2.c: Require lp64.
+ * gcc.target/powerpc/p9-minmax-1.c: Remove target.
+ * gcc.target/powerpc/p9-minmax-2.c: Remove target.
+ * gcc.target/powerpc/p9-minmax-3.c: Remove target.
+ * gcc.target/powerpc/p9-splat-1.c: Require lp64.
+ * gcc.target/powerpc/p9-splat-2.c: Remove target.
+ * gcc.target/powerpc/p9-splat-3.c: Remove target.
+ * gcc.target/powerpc/p9-splat-4.c: Require lp64.
+ * gcc.target/powerpc/p9-vbpermd.c: Require lp64.
+ * gcc.target/powerpc/p9-vneg.c: Require lp64.
+ * gcc.target/powerpc/p9-vparity.c: Require lp64.
+ * gcc.target/powerpc/p9-vpermr.c: Require LE.
+ * gcc.target/powerpc/p9-xxbr-1.c: Remove target.
+ * gcc.target/powerpc/p9-xxbr-2.c: Require lp64.
+ * gcc.target/powerpc/p9-xxbr-3.c: Require lp64.
+
+2020-10-17 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/builtins-3-p9.c: Remove le.
+
+2020-10-17 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/pr96139-a.c: Remove -m32.
+ * gcc.target/powerpc/pr96139-b.c: Remove -m64.
+
+2020-10-16 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/95979
+ * gfortran.dg/index_4.f90: New test.
+
+2020-10-16 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97462
+ * gcc.dg/pr97462.c: New file.
+
+2020-10-16 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/97460
+ * g++.dg/template/pr97460.C: New.
+
+2020-10-16 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/96258
+ * g++.dg/parse/pr96258.C: New.
+
+2020-10-16 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/97327
+ * gcc.target/arm/mve/intrinsics/pr97327.c: New test.
+
+2020-10-16 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-53.c: New testcase.
+
+2020-10-16 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/97291
+ * gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c: Modify.
+ * gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c:
+ Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c: Likewise.
+
+2020-10-16 Jan Hubicka <jh@suse.cz>
+
+ PR testsuite/97426
+ * gcc.dg/tree-ssa/modref-4.c: Fix return test.
+
+2020-10-16 Martin Liska <mliska@suse.cz>
+
+ PR ipa/97404
+ * gcc.c-torture/execute/pr97404.c: New test.
+
+2020-10-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97428
+ * gcc.dg/vect/vect-complex-5.c: Expect to SLP.
+ * gcc.dg/vect/pr97428.c: Likewise.
+
+2020-10-15 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/builtins-1-p9-runnable.c: Adjust for big endian.
+ * gcc.target/powerpc/builtins-7-p9-runnable.c: Same.
+
+2020-10-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/95844
+ * g++.dg/cpp2a/spaceship-eq10.C: New test.
+
+2020-10-15 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/builtins-5-p9-runnable.c: Require lp64.
+ * gcc.target/powerpc/builtins-msum-runnable.c: Require int128.
+ * gcc.target/powerpc/float128-cmp2-runnable.c: Require float128.
+ * gcc.target/powerpc/fold-vec-extract-double.p9.c: Require lp64.
+
+2020-10-15 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97406
+ PR c++/85901
+ * g++.dg/diagnostic/ptrtomem1.C: New test.
+ * g++.dg/diagnostic/ptrtomem2.C: New test.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/atomic/c11-atomic-exec-6.c: Xfail execution for nvptx.
+ * gcc.dg/atomic/c11-atomic-exec-7.c: Same.
+ * gcc.dg/atomic/stdatomic-op-5.c: Same.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ PR target/97436
+ * gcc.target/nvptx/atomic_fetch-3.c: Remove.
+
+2020-10-15 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-52.c: New testcase.
+
+2020-10-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97482
+ * gcc.dg/vect/pr97428.c: New testcase.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/tree-ssa/pr84512.c: Remove xfail for nvptx.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * c-c++-common/ident-0b.c: Require effective target ident_directive.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.c-torture/compile/limits-externdecl.c: Remove dg-skip-if for
+ nvptx.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/attr-alloc_size-11.c: Don't xfail for nvptx.
+ * gcc.dg/tree-ssa/20040204-1.c: Same.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.c-torture/execute/pr68185.c: Remove dg-skip-if for nvptx.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.c-torture/execute/981019-1.c: Remove dg-skip-if for nvptx.
+
+2020-10-15 Tom de Vries <tdevries@suse.de>
+
+ * gcc.c-torture/compile/pr42717.c: Remove nvptx xfail.
+ * gcc.c-torture/compile/pr61684.c: Same.
+ * gcc.c-torture/execute/pr20601-1.c: Same.
+ * gcc.c-torture/execute/pr52129.c: Same.
+ * gcc.c-torture/execute/pr59221.c: Same.
+ * gcc.dg/pr68671.c: Same.
+
+2020-10-15 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/ipa/modref-1.c: Remove space between param offset: and number
+ in scan-ipa-dump.
+ (b): Declare return type to void.
+ (main): Declare return type to int. Change c to array of 3 chars.
+ * gcc.dg/tree-ssa/modref-4.c: Remove space between param offset: and
+ number in scan-ipa-dump. Use modref1 instead of modref2.
+ (b): Declare return type to void.
+ (main): Declare return type to int. Change c to array of 3 chars.
+
+2020-10-15 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/mcpu-1.c: New.
+ * gcc.target/riscv/mcpu-2.c: Ditto.
+ * gcc.target/riscv/mcpu-3.c: Ditto.
+ * gcc.target/riscv/mcpu-4.c: Ditto.
+ * gcc.target/riscv/mcpu-5.c: Ditto.
+ * gcc.target/riscv/mcpu-6.c: Ditto.
+ * gcc.target/riscv/mcpu-7.c: Ditto.
+
+2020-10-15 Hongyu Wang <hongyu.wang@intel.com>
+
+ * gcc.target/i386/hreset-1.c: New test.
+ * gcc.target/i386/funcspec-56.inc: Add new target attribute.
+ * gcc.target/i386/x86gprintrin-1.c: Add -mhreset.
+ * gcc.target/i386/x86gprintrin-2.c: Ditto.
+ * gcc.target/i386/x86gprintrin-3.c: Ditto.
+ * gcc.target/i386/x86gprintrin-4.c: Add mhreset.
+ * gcc.target/i386/x86gprintrin-5.c: Ditto.
+
+2020-10-15 Hongtao Liu <hongtao.liu@intel.com>
+
+ * gcc.target/i386/funcspec-56.inc: Add new target attribute.
+ * gcc.target/i386/uintr-1.c: New test.
+ * gcc.target/i386/uintr-2.c: Ditto.
+ * gcc.target/i386/uintr-3.c: Ditto.
+ * gcc.target/i386/uintr-4.c: Ditto.
+ * gcc.target/i386/uintr-5.c: Ditto.
+ * gcc.target/i386/x86gprintrin-1.c: Add -muintr for 64bit target.
+ * gcc.target/i386/x86gprintrin-2.c: Ditto.
+ * gcc.target/i386/x86gprintrin-3.c: Ditto.
+ * gcc.target/i386/x86gprintrin-4.c: Add muintr for 64bit target.
+ * gcc.target/i386/x86gprintrin-5.c: Ditto.
+
+2020-10-14 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97391
+ * gcc.dg/Warray-bounds-68.c: New test.
+
+2020-10-14 Martin Sebor <msebor@redhat.com>
+
+ PR c/97413
+ * gcc.dg/Wvla-parameter-8.c: New test.
+
+2020-10-14 Tom de Vries <tdevries@suse.de>
+
+ * lib/target-supports.exp (check_compile): Save and restore
+ $compiler_flags when calling ${tool}_target_compile.
+
+2020-10-14 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93388
+ * gcc.dg/analyzer/data-model-21.c: New test.
+
+2020-10-14 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97394
+ * gcc.dg/analyzer/setjmp-pr93378.c: Use test-setjmp.h rather than
+ <setjmp.h>.
+ * gcc.dg/analyzer/sigsetjmp-5.c: Likewise.
+ * gcc.dg/analyzer/sigsetjmp-6.c: Likewise.
+ * gcc.dg/analyzer/test-setjmp.h: Don't include <setjmp.h>.
+ Provide decls of jmp_buf, sigjmp_buf, setjmp, sigsetjmp,
+ longjmp, and siglongjmp.
+
+2020-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/97358
+ * g++.dg/cpp0x/lambda/lambda-variadic11.C: New test.
+
+2020-10-14 Sunil K Pandey <skpgkp2@gmail.com>
+
+ PR target/95483
+ * gcc.target/i386/avx-1.c: Add test.
+ * gcc.target/i386/avx2-vbroadcastsi128-1.c: Ditto.
+ * gcc.target/i386/avx2-vbroadcastsi128-2.c: Ditto.
+ * gcc.target/i386/avx512bw-vmovdqu16-1.c: Ditto.
+ * gcc.target/i386/avx512bw-vmovdqu8-1.c: Ditto.
+ * gcc.target/i386/avx512dq-vreducesd-1.c: Ditto.
+ * gcc.target/i386/avx512dq-vreducesd-2.c: Ditto.
+ * gcc.target/i386/avx512dq-vreducess-1.c: Ditto.
+ * gcc.target/i386/avx512dq-vreducess-2.c: Ditto.
+ * gcc.target/i386/avx512er-vrcp28sd-1.c: Ditto.
+ * gcc.target/i386/avx512er-vrcp28sd-2.c: Ditto.
+ * gcc.target/i386/avx512er-vrcp28ss-1.c: Ditto.
+ * gcc.target/i386/avx512er-vrcp28ss-2.c: Ditto.
+ * gcc.target/i386/avx512er-vrsqrt28sd-1.c: Ditto.
+ * gcc.target/i386/avx512er-vrsqrt28sd-2.c: Ditto.
+ * gcc.target/i386/avx512er-vrsqrt28ss-1.c: Ditto.
+ * gcc.target/i386/avx512er-vrsqrt28ss-2.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtsd2si-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtsd2si64-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtsd2ss-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtsi2sd64-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtsi2ss-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtsi2ss64-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtss2sd-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtss2si-1.c: Ditto.
+ * gcc.target/i386/avx512f-vcvtss2si64-1.c: Ditto.
+ * gcc.target/i386/avx512f-vscalefsd-1.c: Ditto.
+ * gcc.target/i386/avx512f-vscalefsd-2.c: Ditto.
+ * gcc.target/i386/avx512f-vscalefss-1.c: Ditto.
+ * gcc.target/i386/avx512f-vscalefss-2.c: Ditto.
+ * gcc.target/i386/avx512f-vsqrtsd-1.c: Ditto.
+ * gcc.target/i386/avx512f-vsqrtsd-2.c: Ditto.
+ * gcc.target/i386/avx512f-vsqrtss-1.c: Ditto.
+ * gcc.target/i386/avx512f-vsqrtss-2.c: Ditto.
+ * gcc.target/i386/avx512vl-vmovdqa32-1.c: Ditto.
+ * gcc.target/i386/avx512vl-vmovdqa64-1.c: Ditto.
+ * gcc.target/i386/sse-13.c: Ditto.
+ * gcc.target/i386/sse-23.c: Ditto.
+ * gcc.target/i386/avx512dq-vreducepd-3.c: New test.
+ * gcc.target/i386/avx512dq-vreducepd-4.c: New test.
+ * gcc.target/i386/avx512dq-vreduceps-3.c: New test.
+ * gcc.target/i386/avx512dq-vreduceps-4.c: New test.
+ * gcc.target/i386/avx512f-vcvtsi2sd-1.c: New test.
+ * gcc.target/i386/pr95483-1.c: New test.
+ * gcc.target/i386/pr95483-2.c: New test.
+ * gcc.target/i386/pr95483-3.c: New test.
+ * gcc.target/i386/pr95483-4.c: New test.
+ * gcc.target/i386/pr95483-5.c: New test.
+ * gcc.target/i386/pr95483-6.c: New test.
+ * gcc.target/i386/pr95483-7.c: New test.
+
+2020-10-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/97387
+ * gcc.target/i386/pr97387-1.c: New test.
+ * gcc.target/i386/pr97387-2.c: New test.
+
+2020-10-14 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97396.c: New test.
+
+2020-10-14 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/ipa/modref-1.c: New test.
+ * gcc.dg/tree-ssa/modref-4.c: New test.
+
+2020-10-14 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97390
+ * gfortran.dg/goacc/warn_truncated.f90: New test.
+
+2020-10-14 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/lookup/extern-redecl2.C: New.
+
+2020-10-14 Steven G. Kargl <kargl@gcc.gnu.org>
+ Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/95614
+ * gfortran.dg/pr95614_1.f90: New test.
+ * gfortran.dg/pr95614_2.f90: New test.
+ * gfortran.dg/pr95614_3.f90: New test.
+ * gfortran.dg/pr95614_4.f90: New test.
+
+2020-10-14 Kito Cheng <kito.cheng@sifive.com>
+
+ PR target/96759
+ * g++.target/riscv/pr96759.C: New.
+ * gcc.target/riscv/pr96759.c: New.
+
+2020-10-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/97386
+ * gcc.c-torture/execute/pr97386-1.c: New test.
+ * gcc.c-torture/execute/pr97386-2.c: New test.
+
+2020-10-13 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/arm/stack-protector-5.c: Use -Os rather than -O2.
+ * gcc.target/arm/stack-protector-6.c: Likewise.
+
+2020-10-13 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97382
+ * gcc.dg/vect/no-vfa-vect-dv-2.c: Remove same align dump
+ scanning.
+ * gcc.dg/vect/vect-103.c: Likewise.
+ * gcc.dg/vect/vect-91.c: Likewise.
+ * gfortran.dg/vect/vect-4.f90: Likewise.
+
+2020-10-13 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/97392
+ * g++.dg/asan/asan_test.C: Disable -Wstringop-overflow.
+ * gcc.dg/asan/pr80166.c: Likewise.
+
+2020-10-12 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97258
+ * gcc.dg/analyzer/callbacks-1.c: New test.
+ * gcc.dg/analyzer/callbacks-2.c: New test.
+ * gcc.dg/analyzer/callbacks-3.c: New test.
+
+2020-10-12 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97381.c: New test.
+
+2020-10-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97378.c: New test.
+
+2020-10-12 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/83347
+ PR middle-end/90404
+ PR analyzer/95007
+ * gcc.dg/analyzer/write-to-const-1.c: New test.
+ * gcc.dg/analyzer/write-to-string-literal-1.c: New test.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR c++/97201
+ * g++.dg/warn/Wplacement-new-size-8.C: Adjust expected message.
+ * g++.dg/warn/Warray-bounds-10.C: New test.
+ * g++.dg/warn/Warray-bounds-11.C: New test.
+ * g++.dg/warn/Warray-bounds-12.C: New test.
+ * g++.dg/warn/Warray-bounds-13.C: New test.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97342
+ PR middle-end/97023
+ PR middle-end/96384
+ * c-c++-common/Wrestrict.c: Adjust comment.
+ * gcc.dg/Wstringop-overflow-34.c: Remove xfail.
+ * gcc.dg/Wstringop-overflow-43.c: Remove xfails. Adjust regex patterns.
+ * gcc.dg/pr51683.c: Prune out expected warning.
+ * gcc.target/i386/pr60693.c: Same.
+ * g++.dg/warn/Wplacement-new-size-8.C: New test.
+ * gcc.dg/Wstringop-overflow-41.c: New test.
+ * gcc.dg/Wstringop-overflow-44.s: New test.
+ * gcc.dg/Wstringop-overflow-45.c: New test.
+ * gcc.dg/Wstringop-overflow-46.c: New test.
+ * gcc.dg/Wstringop-overflow-47.c: New test.
+ * gcc.dg/Wstringop-overflow-49.c: New test.
+ * gcc.dg/Wstringop-overflow-50.c: New test.
+ * gcc.dg/Wstringop-overflow-51.c: New test.
+ * gcc.dg/Wstringop-overflow-52.c: New test.
+ * gcc.dg/Wstringop-overflow-53.c: New test.
+ * gcc.dg/Wstringop-overflow-54.c: New test.
+ * gcc.dg/Wstringop-overflow-55.c: New test.
+ * gcc.dg/Wstringop-overread-5.c: New test.
+
+2020-10-12 Martin Sebor <msebor@redhat.com>
+
+ PR c++/96511
+ PR middle-end/96384
+ * g++.dg/init/strlen.C: Add expected warning.
+ * g++.dg/warn/Wplacement-new-size-1.C: Relax warnings.
+ * g++.dg/warn/Wplacement-new-size-2.C: Same.
+ * g++.dg/warn/Wplacement-new-size-6.C: Same.
+ * gcc.dg/Warray-bounds-58.c: Adjust
+ * gcc.dg/Wstringop-overflow-37.c: Same.
+ * g++.dg/warn/Wplacement-new-size-7.C: New test.
+
+2020-10-12 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR tree-optimization/97357
+ * gcc.dg/pr97357.c: Call setjmp instead of _setjmp.
+
+2020-10-12 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-50.c: New testcase.
+ * gcc.dg/vect/bb-slp-51.c: Likewise.
+
+2020-10-12 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/97079
+ * gcc.target/aarch64/sve/pr97079.c: New test.
+
+2020-10-12 Duan bo <duanbo3@huawei.com>
+
+ PR target/96757
+ * gcc.target/aarch64/pr96757.c: New test.
+
+2020-10-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/97349
+ * gcc.target/aarch64/simd/pr97349.c: New test.
+
+2020-10-12 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97371.c: New test.
+
+2020-10-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97357
+ * gcc.dg/pr97357.c: New testcase.
+
+2020-10-12 Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/96099
+ * gfortran.dg/pr96099_1.f90: New test.
+ * gfortran.dg/pr96099_2.f90: New test.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/plugin/diagnostic-test-expressions-1.mm:
+ Adjust testcase to include expressions for @selector and
+ @protocol. XFAIL where this is still not sufficient to obtain
+ a disgnostic range.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-obj-c++-shared/TestsuiteObject.h: Add dummy retain and
+ release method declarations.
+ * objc-obj-c++-shared/TestsuiteObject.m: Add dummy retain and
+ release implementations.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/objc-gc-3.mm:i Skip for Darwin >= 16.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/cxx-ivars-3.mm: Skip for macOS >= 10.7.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/gnu-api-2-class-meta.mm: Add a flag to cause NeXT
+ headers to expose prototypes for messaging.
+ * obj-c++.dg/gnu-api-2-class.mm: Likewise.
+ * obj-c++.dg/gnu-api-2-objc.mm: Skip this because of the extra
+ protocols pulled in by system headers.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc.dg/plugin/diagnostic-test-expressions-1.m: Use assignment
+ expressions for @selector and @protocol to obtain a useful
+ diagnostic range.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc.dg/call-super-2.m: Remove inclusion of runtime.h.
+ Add a FIXME about the test portability.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc.dg/torture/forward-1.m: Implement forwarding using the
+ native NeXT (NSInvocation) method for Darwin.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc.dg/ivar-scope-4.m: Add inititialize method to the
+ root class.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc.dg/gnu-api-2-class-meta.m: Add a flag to cause NeXT
+ headers to expose prototypes for messaging. Mark the root
+ class if the objc_root_class attribute is available. Use
+ char ** as the second arg to main.
+ * objc.dg/gnu-api-2-class.m: Use dispatch prototype.
+ * objc.dg/gnu-api-2-objc.m: Skip on NeXT because of extra
+ prototypes pulled in by headers.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc.dg/objc-gc-4.m: Disable for macOS 10.15 and 11.x.
+
+2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-obj-c++-shared/TestsuiteObject.h: If the compiler
+ supports objc_root_object attributes, then mark the testsuite
+ object accordingly.
+ * objc-obj-c++-shared/TestsuiteObject.m: Avoid direct access
+ to isa, which is an error for modern Objective-C.
+ * objc/execute/class-tests-1.h: Declare a string function we
+ use locally (avoid pulling in the whole of string.h).
+
+2020-10-10 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.dg/darwin-sections.c: Adjust test for renamed BSS and common
+ sections. Cater for 64 and 128 bit long doubles.
+
+2020-10-10 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97250
+ * gcc.target/i386/x86-64-v2.c: Verify that
+ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 is defined.
+ * gcc.target/i386/x86-64-v3.c: Likewise.
+ * gcc.target/i386/x86-64-v4.c: Likewise.
+
+2020-10-10 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97359.c: New test.
+
+2020-10-09 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/97313
+ * gcc.target/i386/pr97313.c: New.
+
+2020-10-09 H.J. Lu <hjl.tools@gmail.com>
+
+ * gcc.target/i386/avx-1.c (__builtin_ia32_lwpval32): New to
+ support <lwpintrin.h> included in <x86gprintrin.h>.
+ (__builtin_ia32_lwpval64): Likewise.
+ (__builtin_ia32_lwpins32): Likewise.
+ (__builtin_ia32_lwpins64): Likewise.
+ (__builtin_ia32_bextri_u32): New to support <tbmintrin.h>
+ included in <x86gprintrin.h>.
+ (__builtin_ia32_bextri_u64): Likewise.
+ * gcc.target/i386/x86gprintrin-1.c: New test.
+ * gcc.target/i386/x86gprintrin-2.c: Likewise.
+ * gcc.target/i386/x86gprintrin-3.c: Likewise.
+ * gcc.target/i386/x86gprintrin-4.c: Likewise.
+ * gcc.target/i386/x86gprintrin-4a.c: Likewise.
+ * gcc.target/i386/x86gprintrin-5.c: Likewise.
+ * gcc.target/i386/x86gprintrin-5a.c: Likewise.
+ * gcc.target/i386/x86gprintrin-5b.c: Likewise.
+ * gcc.target/i386/x86gprintrin-6.c: Likewise.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ * lib/target-supports.exp (check_effective_target_vect_masked_load):
+ New effective target.
+ * gcc.dg/vect/pr65947-3.c: Update.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97334
+ * gcc.dg/vect/bb-slp-pr65935.c: Amend.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97347
+ * g++.dg/vect/pr97347.cc: New testcase.
+
+2020-10-09 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97317.c: New test.
+
+2020-10-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/94801
+ PR target/97312
+ * gcc.dg/tree-ssa/pr94801.c: New test.
+
+2020-10-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97325
+ * gcc.c-torture/execute/pr97325.c: New test.
+
+2020-10-09 Aldy Hernandez <aldyh@redhat.com>
+
+ PR testsuite/97337
+ * gcc.dg/pr97315-1.c: Moved to...
+ * g++.dg/opt/pr97315-1.C: ...here.
+
+2020-10-09 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-phis-1.c: New testcase.
+
+2020-10-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/96805
+ * g++.dg/cpp0x/alias-decl-pr96805.C: New test.
+
+2020-10-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96914
+ * gcc.target/arm/mve/intrinsics/vcvtnq_u32_f32.c: New test.
+
+2020-10-08 Martin Liska <mliska@suse.cz>
+ Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-22.c: Adjust.
+ * gfortran.dg/pr68627.f: Likewise.
+
+2020-10-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97330
+ * gcc.dg/torture/pr97330-1.c: New testcase.
+ * gcc.dg/torture/pr97330-2.c: Likewise.
+
+2020-10-08 Richard Biener <rguenther@suse.de>
+
+ * g++.dg/vect/slp-pr50819.cc: Adjust.
+ * gcc.dg/vect/bb-slp-1.c: Adjust.
+ * gcc.dg/vect/bb-slp-10.c: Adjust.
+ * gcc.dg/vect/bb-slp-11.c: Adjust.
+ * gcc.dg/vect/bb-slp-13.c: Adjust.
+ * gcc.dg/vect/bb-slp-14.c: Adjust.
+ * gcc.dg/vect/bb-slp-15.c: Adjust.
+ * gcc.dg/vect/bb-slp-16.c: Adjust.
+ * gcc.dg/vect/bb-slp-17.c: Adjust.
+ * gcc.dg/vect/bb-slp-18.c: Adjust.
+ * gcc.dg/vect/bb-slp-19.c: Adjust.
+ * gcc.dg/vect/bb-slp-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-20.c: Adjust.
+ * gcc.dg/vect/bb-slp-21.c: Adjust.
+ * gcc.dg/vect/bb-slp-22.c: Adjust.
+ * gcc.dg/vect/bb-slp-23.c: Adjust.
+ * gcc.dg/vect/bb-slp-24.c: Adjust.
+ * gcc.dg/vect/bb-slp-25.c: Adjust.
+ * gcc.dg/vect/bb-slp-26.c: Adjust.
+ * gcc.dg/vect/bb-slp-27.c: Adjust.
+ * gcc.dg/vect/bb-slp-28.c: Adjust.
+ * gcc.dg/vect/bb-slp-29.c: Adjust.
+ * gcc.dg/vect/bb-slp-3.c: Adjust.
+ * gcc.dg/vect/bb-slp-30.c: Adjust.
+ * gcc.dg/vect/bb-slp-31.c: Adjust.
+ * gcc.dg/vect/bb-slp-34.c: Adjust.
+ * gcc.dg/vect/bb-slp-35.c: Adjust.
+ * gcc.dg/vect/bb-slp-36.c: Adjust.
+ * gcc.dg/vect/bb-slp-38.c: Adjust.
+ * gcc.dg/vect/bb-slp-4.c: Adjust.
+ * gcc.dg/vect/bb-slp-45.c: Adjust.
+ * gcc.dg/vect/bb-slp-46.c: Adjust.
+ * gcc.dg/vect/bb-slp-48.c: Adjust.
+ * gcc.dg/vect/bb-slp-5.c: Adjust.
+ * gcc.dg/vect/bb-slp-6.c: Adjust.
+ * gcc.dg/vect/bb-slp-7.c: Adjust.
+ * gcc.dg/vect/bb-slp-8.c: Adjust.
+ * gcc.dg/vect/bb-slp-8a.c: Adjust.
+ * gcc.dg/vect/bb-slp-8b.c: Adjust.
+ * gcc.dg/vect/bb-slp-9.c: Adjust.
+ * gcc.dg/vect/bb-slp-div-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-over-widen-1.c: Adjust.
+ * gcc.dg/vect/bb-slp-over-widen-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-pattern-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-pow-1.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr58135.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr65935.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr78205.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr81635-1.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr81635-3.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr95839-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr95839.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr95866.c: Adjust.
+ * gcc.dg/vect/bb-slp-subgroups-1.c: Adjust.
+ * gcc.dg/vect/bb-slp-subgroups-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-subgroups-3.c: Adjust.
+ * gcc.dg/vect/fast-math-bb-slp-call-1.c: Adjust.
+ * gcc.dg/vect/no-tree-reassoc-bb-slp-12.c: Adjust.
+ * gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c: Adjust.
+ * gfortran.dg/vect/pr62283-2.f: Adjust.
+ * gcc.target/i386/pr68961.c: Adjust.
+ * gcc.target/i386/pr84101.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr81635-2.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr81635-4.c: Adjust.
+ * gcc.dg/vect/fast-math-bb-slp-call-2.c: Adjust.
+ * gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c: Adjust.
+ * gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c: Adjust.
+ * gcc.dg/vect/bb-slp-div-1.c: Adjust.
+ * gcc.dg/vect/bb-slp-pr90006.c: Adjust.
+ * g++.dg/vect/slp-pr50413.cc: Adjust.
+
+2020-10-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96914
+ * gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u16.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u32.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqdmlahq_n_u16.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqdmlahq_n_u32.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqdmlahq_n_u8.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u16.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u32.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u8.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u16.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u32.c: Remove.
+ * gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u8.c: Remove.
+
+2020-10-08 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96914
+ * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c: New test.
+ * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c: New test.
+ * gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c: New test.
+ * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c: New test.
+ * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c: New test.
+ * gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c: New test.
+
+2020-10-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/97322
+ * gcc.dg/pr97322.c: New test.
+
+2020-10-08 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97315-2.c: New test.
+
+2020-10-08 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97315-1.c: New test.
+
+2020-10-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/97294
+ * gcc.dg/asan/pr97294.c: New test.
+
+2020-10-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97052
+ * g++.dg/cpp2a/concepts-defarg2.C: New test.
+
+2020-10-08 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96229
+ * g++.dg/cpp2a/concepts-class2.C: New test.
+
+2020-10-07 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97010
+ * g++.dg/cpp2a/fn-template21.C: New test.
+ * g++.dg/cpp2a/fn-template22.C: New test.
+
+2020-10-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97307
+ * gcc.dg/tree-ssa/ssa-sink-17.c: New testcase.
+ * gcc.dg/vect/pr65947-3.c: XFAIL.
+
+2020-10-07 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/88115
+ PR libstdc++/97273
+ * g++.dg/template/alignof3.C: New test.
+
+2020-10-07 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97116
+ * g++.dg/analyzer/pr97116.C: New test.
+
+2020-10-07 David Malcolm <dmalcolm@redhat.com>
+
+ * g++.dg/analyzer/analyzer.exp (DEFAULT_CXXFLAGS): Remove
+ -fdiagnostics-path-format=separate-events.
+ * gcc.dg/analyzer/analyzer.exp (DEFAULT_CFLAGS): Likewise.
+ * gcc.dg/plugin/diagnostic-path-format-default.c: Rename to...
+ * gcc.dg/plugin/diagnostic-path-format-plain.c: ...this. Remove
+ dg-options directive. Copy remainder of test from
+ diagnostic-path-format-separate-events.c.
+ * gcc.dg/plugin/diagnostic-test-paths-2.c: Add
+ -fdiagnostics-path-format=inline-events to options.
+ Fix expected output for location of conditional within "for" loop.
+ * gcc.dg/plugin/plugin.exp (plugin_test_list): Update for
+ renaming.
+ * gfortran.dg/analyzer/analyzer.exp (DEFAULT_FFLAGS): Remove
+ -fdiagnostics-path-format=separate-events.
+
+2020-10-07 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/cpp0x/lambda/lambda-sfinae1.C: Avoid ill-formed local extern
+ * g++.dg/init/pr42844.C: Add expected error.
+ * g++.dg/lookup/extern-redecl1.C: Likewise.
+ * g++.dg/lookup/koenig15.C: Avoid ill-formed.
+ * g++.dg/lto/pr95677.C: New.
+ * g++.dg/other/nested-extern-1.C: Correct expected behabviour.
+ * g++.dg/other/nested-extern-2.C: Likewise.
+ * g++.dg/other/nested-extern.cc: Split ...
+ * g++.dg/other/nested-extern-1.cc: ... here ...
+ * g++.dg/other/nested-extern-2.cc: ... here.
+ * g++.dg/template/scope5.C: Avoid ill-formed
+ * g++.old-deja/g++.law/missed-error2.C: Allow extension.
+ * g++.old-deja/g++.pt/crash3.C: Add expected error.
+
+2020-10-07 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/96394
+ * gcc.dg/tree-prof/pr96394.c: New test.
+
+2020-10-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/gomp/simd-2.c: New test.
+ * gcc.dg/gomp/simd-3.c: New test.
+
+2020-10-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97297
+ * g++.dg/cpp2a/typename18.C: New test.
+
+2020-10-06 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/90861
+ * c-c++-common/goacc/declare-pr90861.c: Remove xfail.
+
+2020-10-06 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr81192.c: Disable EVRP pass.
+ * gcc.dg/tree-ssa/pr77445-2.c: Ditto.
+ * gcc.dg/tree-ssa/ssa-dom-thread-6.c: Adjust.
+ * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Ditto.
+
+2020-10-06 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c: Use additional
+ option -fno-ipa-icf and change the instruction count from 8 to 16.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c: Likewise.
+
+2020-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/97282
+ * gcc.target/i386/pr97282.c: New test.
+
+2020-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/97289
+ * c-c++-common/gomp/pr97289.c: New test.
+
+2020-10-06 Joe Ramsay <Joe.Ramsay@arm.com>
+
+ * gcc.target/arm/cortex-m55-nodsp-flag-hard.c: New test.
+ * gcc.target/arm/cortex-m55-nodsp-flag-softfp.c: New test.
+ * gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c: New test.
+ * gcc.target/arm/cortex-m55-nofp-flag-hard.c: New test.
+ * gcc.target/arm/cortex-m55-nofp-flag-softfp.c: New test.
+ * gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c: New test.
+ * gcc.target/arm/cortex-m55-nomve-flag-hard.c: New test.
+ * gcc.target/arm/cortex-m55-nomve-flag-softfp.c: New test.
+ * gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c: New test.
+ * gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c: New test.
+ * gcc.target/arm/multilib.exp: Add tests for -mcpu=cortex-m55.
+
+2020-10-05 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c: Use additional
+ option -fno-ipa-icf and change the instruction count from 8 to 16.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c: Likewise.
+
+2020-10-05 Nathan Sidwell <nathan@acm.org>
+
+ * c-c++-common/spellcheck-reserved.c: Restore diagnostic.
+
+2020-10-04 Harald Anlauf <anlauf@gmx.de>
+
+ PR fortran/97272
+ * gfortran.dg/pr97272.f90: New test.
+
+2020-10-03 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/modref-3.c: New test.
+
+2020-10-02 Nathan Sidwell <nathan@acm.org>
+
+ * c-c++-common/spellcheck-reserved.c: Adjust diagnostic.
+ * g++.dg/spellcheck-typenames.C: Adjust diagnostic.
+
+2020-10-02 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/inherit/pr97268.C: New.
+
+2020-10-02 Martin Jambor <mjambor@suse.cz>
+
+ * gcc.dg/ipa/ipcp-loophint-1.c: New test.
+
+2020-10-02 Joe Ramsay <Joe.Ramsay@arm.com>
+
+ * gcc.target/arm/mve/intrinsics/vmaxavq_p_s16.c: Add test for mismatched
+ width of scalar argument.
+ * gcc.target/arm/mve/intrinsics/vmaxavq_p_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxavq_p_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxavq_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxavq_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxavq_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_p_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_p_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_p_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_p_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_p_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_p_u8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxvq_u8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminavq_p_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminavq_p_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminavq_p_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminavq_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminavq_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminavq_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_p_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_p_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_p_f16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_p_f32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_p_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_p_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_p_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_p_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_p_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_p_u8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_s16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_s32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_s8.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_u16.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_u32.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminvq_u8.c: Likewise.
+
+2020-10-02 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/arm/armv8_2-fp16-arith-2.c (float16_t): Use _Float16_t
+ rather than __fp16.
+ (float16x4_t, float16x4_t): Likewise.
+ (fp16_abs): Use __builtin_fabsf16.
+
+2020-10-02 Alex Coplan <alex.coplan@arm.com>
+
+ * gcc.target/aarch64/extend-syntax.c: Fix assembler checks for
+ ilp32, disable check-function-bodies on ilp32.
+ * gcc.target/aarch64/subsp.c: Only check second scan-assembler
+ on lp64 since the code on ilp32 is missing the optimization
+ needed for this test to pass.
+
+2020-10-02 Jason Merril <jason@redhat.com>
+
+ * g++.dg/pr94314.C: new/delete no longer omitted.
+
+2020-10-02 Richard Biener <rguenther@suse.de>
+
+ * g++.dg/tree-ssa/pta-delete-1.C: New testcase.
+
+2020-10-01 Richard Sandiford <richard.sandiford@arm.com>
+
+ * lib/target-supports.exp (check_effective_target_vect_cond_mixed): Add
+ arm neon targets.
+ * gcc.target/arm/neon-compare-1.c: New test.
+ * gcc.target/arm/neon-compare-2.c: Likewise.
+ * gcc.target/arm/neon-compare-3.c: Likewise.
+ * gcc.target/arm/neon-compare-4.c: Likewise.
+ * gcc.target/arm/neon-compare-5.c: Likewise.
+ * gcc.target/arm/neon-vcond-gt.c: Expect comparisons with zero.
+ * gcc.target/arm/neon-vcond-ltgt.c: Likewise.
+ * gcc.target/arm/neon-vcond-unordered.c: Likewise.
+
+2020-10-01 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/movtf_1.c: Restrict the asm matching to lp64.
+ * gcc.target/aarch64/movti_1.c: Likewise.
+
+2020-10-01 Andrea Corallo <andrea.corallo@arm.com>
+
+ PR target/96375
+ * gcc.target/arm/lob1.c: Fix missing flag.
+ * gcc.target/arm/lob2.c: Likewise.
+ * gcc.target/arm/lob3.c: Likewise.
+ * gcc.target/arm/lob4.c: Likewise.
+ * gcc.target/arm/lob5.c: Likewise.
+ * gcc.target/arm/lob6.c: Likewise.
+ * lib/target-supports.exp
+ (check_effective_target_arm_v8_1_lob_ok): Return 1 only for
+ cortex-m targets, add '-mthumb' flag.
+
+2020-10-01 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97236
+ * gcc.dg/vect/pr97236.c: New testcase.
+
+2020-10-01 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97243
+ * gcc.c-torture/compile/pr97243.c: New test.
+
+2020-10-01 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97244
+ * gcc.dg/ipa/remref-2a.c: Add -fno-ipa-modref
+
+2020-10-01 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/pr94600-1.c: Force 32-bit alignment for a0 for !non_strict_align
+ targets. Remove target clauses from scan tests.
+ * gcc.dg/pr94600-3.c: Same.
+
+2020-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/96994
+ * g++.dg/cpp2a/consteval18.C: New test.
+
+2020-10-01 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97195
+ * g++.dg/cpp2a/constexpr-new14.C: New test.
+
+2020-10-01 Richard Biener <rguenther@suse.de>
+
+ * g++.dg/vect/pr97255.cc: New testcase.
+
+2020-10-01 Florian Weimer <fweimer@redhat.com>
+
+ PR target/97250
+ * gcc.target/i386/x86-64-v2.c: New test.
+ * gcc.target/i386/x86-64-v3.c: New test.
+ * gcc.target/i386/x86-64-v3-haswell.c: New test.
+ * gcc.target/i386/x86-64-v3-skylake.c: New test.
+ * gcc.target/i386/x86-64-v4.c: New test.
+
+2020-10-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90210
+ * g++.dg/cpp1z/class-deduction73.C: New test.
+
+2020-09-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97189
+ * gcc.dg/attr-access-2.c: Adjust caret location.
+ * gcc.dg/Wvla-parameter-6.c: New test.
+ * gcc.dg/Wvla-parameter-7.c: New test.
+
+2020-09-30 Martin Sebor <msebor@redhat.com>
+
+ PR c/97206
+ * gcc.dg/Warray-parameter-7.c: New test.
+ * gcc.dg/Warray-parameter-8.c: New test.
+ * gcc.dg/Wvla-parameter-5.c: New test.
+
+2020-09-30 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/96827
+ * gcc.target/i386/pr96827.c: New test.
+
+2020-09-30 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/94595
+ * gcc.target/arm/thumb2-cond-cmp-1.c: Skip if arm_cortex_m.
+ * gcc.target/arm/thumb2-cond-cmp-2.c: Skip if arm_cortex_m.
+ * gcc.target/arm/thumb2-cond-cmp-3.c: Skip if arm_cortex_m.
+ * gcc.target/arm/thumb2-cond-cmp-4.c: Skip if arm_cortex_m.
+
+2020-09-30 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/pr37027.c: Amend.
+ * gcc.dg/vect/pr67790.c: Likewise.
+ * gcc.dg/vect/pr92324-4.c: Likewise.
+ * gcc.dg/vect/pr92558.c: Likewise.
+ * gcc.dg/vect/pr95495.c: Likewise.
+ * gcc.dg/vect/slp-reduc-1.c: Likewise.
+ * gcc.dg/vect/slp-reduc-2.c: Likewise.
+ * gcc.dg/vect/slp-reduc-3.c: Likewise.
+ * gcc.dg/vect/slp-reduc-4.c: Likewise.
+ * gcc.dg/vect/slp-reduc-5.c: Likewise.
+ * gcc.dg/vect/slp-reduc-7.c: Likewise.
+ * gcc.dg/vect/vect-reduc-in-order-4.c: Likewise.
+
+2020-09-30 Srinath Parvathaneni <srinath.parvathaneni@arm.com>
+
+ PR target/96795
+ * gcc.target/arm/mve/intrinsics/mve_fp_vaddq_n.c: New Test.
+ * gcc.target/arm/mve/intrinsics/mve_vaddq_n.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vaddq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vaddq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vaddq_x_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vaddq_x_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpeqq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgeq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgeq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgtq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpgtq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpleq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpleq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpltq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpltq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpneq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vcmpneq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmaq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmaq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmaq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmaq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmasq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmasq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmasq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vfmasq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_p_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmavq_p_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_p_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vminnmvq_p_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmulq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmulq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmulq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmulq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmulq_x_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vmulq_x_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsetq_lane_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsetq_lane_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsubq_m_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsubq_m_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsubq_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsubq_n_f32-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsubq_x_n_f16-1.c: Likewise.
+ * gcc.target/arm/mve/intrinsics/vsubq_x_n_f32-1.c: Likewise.
+
+2020-09-30 Joel Hutton <joel.hutton@arm.com>
+
+ PR target/96837
+ * gcc.dg/vect/bb-slp-49.c: New test.
+
+2020-09-30 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97242
+ * gfortran.dg/contiguous_11.f90: New test.
+ * gfortran.dg/contiguous_4.f90: Update.
+ * gfortran.dg/contiguous_7.f90: Update.
+
+2020-09-30 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/97045
+ * gfortran.dg/select_type_50.f90 : New test.
+
+2020-09-30 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97184
+ * gcc.target/i386/movdir64b.c: New test.
+ * gcc.target/i386/movdiri32.c: Likewise.
+ * gcc.target/i386/movdiri64.c: Likewise.
+ * lib/target-supports.exp (check_effective_target_movdir): New.
+
+2020-09-30 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/pr94600-1.c: Use effective target
+ (non_strict_align || pcc_bitfield_type_matters).
+ * gcc.dg/pr94600-3.c: Same.
+
+2020-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.target/i386/amxint8-dpbssd-2.c: Require effective targets
+ amx_tile and amx_int8.
+ * gcc.target/i386/amxint8-dpbsud-2.c: Likewise.
+ * gcc.target/i386/amxint8-dpbusd-2.c: Likewise.
+ * gcc.target/i386/amxint8-dpbuud-2.c: Likewise.
+ * gcc.target/i386/amxbf16-dpbf16ps-2.c: Require effective targets
+ amx_tile and amx_bf16.
+ * gcc.target/i386/amxtile-2.c: Require effective target amx_tile.
+
+2020-09-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/97150
+ * gcc.target/aarch64/pr97150.c: New test.
+
+2020-09-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/96313
+ * gcc.target/aarch64/pr96313.c: New test.
+ * gcc.target/aarch64/scalar_intrinsics.c (test_vqmovunh_s16):
+ Adjust return type.
+ (test_vqmovuns_s32): Likewise.
+ (test_vqmovund_s64): Likewise.
+
+2020-09-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/movtf_1.c: New test.
+ * gcc.target/aarch64/movti_1.c: Likewise.
+
+2020-09-29 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97188
+ * gcc.dg/Wstringop-overflow-23.c: Adjust text of expected warnings.
+ * gcc.dg/Wnonnull-4.c: New test.
+
+2020-09-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94695
+ * g++.dg/warn/Wrange-loop-construct.C: New test.
+
+2020-09-29 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/debug/dwarf2/align-1.C: Remove AIX XFAIL.
+ * g++.dg/debug/dwarf2/align-2.C: Same.
+ * g++.dg/debug/dwarf2/align-3.C: Same.
+ * g++.dg/debug/dwarf2/align-4.C: Same.
+ * g++.dg/debug/dwarf2/align-5.C: Same.
+ * g++.dg/debug/dwarf2/align-6.C: Same.
+ * g++.dg/debug/dwarf2/defaulted-member-function-1.C: Same.
+ * g++.dg/debug/dwarf2/defaulted-member-function-2.C: Same.
+ * g++.dg/debug/dwarf2/defaulted-member-function-3.C: Same.
+ * g++.dg/debug/dwarf2/inline-var-1.C: Same.
+ * g++.dg/debug/dwarf2/inline-var-2.C: Same.
+ * g++.dg/debug/dwarf2/inline-var-3.C: Same.
+ * g++.dg/debug/dwarf2/noreturn-function.C: Same.
+ * g++.dg/debug/dwarf2/ptrdmem-1.C: Same.
+ * g++.dg/debug/dwarf2/ref-2.C: Same.
+ * g++.dg/debug/dwarf2/ref-3.C: Same.
+ * g++.dg/debug/dwarf2/ref-4.C: Same.
+ * g++.dg/debug/dwarf2/refqual-1.C: Same.
+ * g++.dg/debug/dwarf2/refqual-2.C: Same.
+ * gcc.dg/debug/dwarf2/align-1.c: Same.
+ * gcc.dg/debug/dwarf2/align-2.c: Same.
+ * gcc.dg/debug/dwarf2/align-3.c: Same.
+ * gcc.dg/debug/dwarf2/align-4.c: Same.
+ * gcc.dg/debug/dwarf2/align-5.c: Same.
+ * gcc.dg/debug/dwarf2/align-6.c: Same.
+ * gcc.dg/debug/dwarf2/align-as-1.c: Same.
+ * gcc.dg/debug/dwarf2/dwarf2-macro.c: Same.
+ * gcc.dg/debug/dwarf2/dwarf2-macro2.c: Same.
+ * gcc.dg/debug/dwarf2/lang-c89.c: Same.
+ * gcc.dg/debug/dwarf2/noreturn-function-attribute.c: Same.
+ * gcc.dg/debug/dwarf2/noreturn-function-keyword.c: Same.
+ * gcc.dg/debug/dwarf2/pr71855.c: Same.
+ * gcc.dg/debug/dwarf2/inline5.c: Add XFAIL on AIX.
+
+2020-09-29 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/95188
+ * gcc.dg/analyzer/signal-registration-loc.c: New test.
+
+2020-09-29 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/spellcheck-inttypes.C: Define _STD_TYPES_T on AIX.
+ * gcc.dg/spellcheck-inttypes.c: Same.
+
+2020-09-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97241
+ * gcc.dg/vect/pr97241.c: New testcase.
+
+2020-09-29 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97238
+ * gcc.dg/pr97238.c: New testcase.
+
+2020-09-29 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/arm/armv8_2-fp16-arith-2.c: Expect FP16 vectorization
+ even without -ffast-math.
+
+2020-09-29 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/predef-3.c: Update testcase.
+ * gcc.target/riscv/predef-6.c: Ditto.
+
+2020-09-29 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96979
+ * g++.dg/tree-ssa/pr96979.C: New test.
+
+2020-09-29 Martin Liska <mliska@suse.cz>
+
+ Revert:
+ 2020-09-29 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96979
+ * g++.dg/tree-ssa/pr96979.C: New test.
+
+2020-09-29 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.dg/ipa/symver1.c: Skip on AIX.
+
+2020-09-28 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97233
+ * gcc.dg/analyzer/pr97233.c: New test.
+
+2020-09-28 Paul A. Clarke <pc@us.ibm.com>
+
+ * gcc.target/powerpc/sse4_1-pinsrb.c: New test.
+ * gcc.target/powerpc/sse4_1-pinsrd.c: New test.
+ * gcc.target/powerpc/sse4_1-pinsrq.c: New test.
+
+2020-09-28 liuhongt <hongtao.liu@intel.com>
+
+ * lib/target-supports.exp (check_effective_target_amx_tile,
+ check_effective_target_amx_int8,
+ check_effective_target_amx_bf16): New proc.
+ * g++.dg/other/i386-2.C: Add -mamx-tile, -mamx-int8, -mamx-bf16.
+ * g++.dg/other/i386-3.C: Ditto.
+ * gcc.target/i386/sse-12.c: Ditto.
+ * 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.
+ * gcc.target/i386/funcspec-56.inc: Add new target attribute.
+ * gcc.target/i386/amx-check.h: New header file.
+ * gcc.target/i386/amxbf16-asmatt-1.c: New test.
+ * gcc.target/i386/amxint8-asmatt-1.c: New test.
+ * gcc.target/i386/amxtile-asmatt-1.c: Ditto.
+ * gcc.target/i386/amxbf16-asmintel-1.c: Ditto.
+ * gcc.target/i386/amxint8-asmintel-1.c: Ditto.
+ * gcc.target/i386/amxtile-asmintel-1.c: Ditto.
+ * gcc.target/i386/amxbf16-dpbf16ps-2.c: Ditto.
+ * gcc.target/i386/amxint8-dpbssd-2.c: Ditto.
+ * gcc.target/i386/amxint8-dpbsud-2.c: Ditto.
+ * gcc.target/i386/amxint8-dpbusd-2.c: Ditto.
+ * gcc.target/i386/amxint8-dpbuud-2.c: Ditto.
+ * gcc.target/i386/amxtile-2.c: Ditto.
+
+2020-09-28 Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ Revert:
+ 2020-09-28 Steven G. Kargl <kargl@gcc.gnu.org>
+ Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/95614
+ * gfortran.dg/pr95614_1.f90: New test.
+ * gfortran.dg/pr95614_2.f90: New test.
+
+2020-09-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/addr16.adb: New test.
+ * gnat.dg/addr16_pkg.ads: New helper.
+
+2020-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/97073
+ * gcc.c-torture/execute/pr97073.c: New test.
+
+2020-09-27 Steven G. Kargl <kargl@gcc.gnu.org>
+ Mark Eggleston <markeggleston@gcc.gnu.org>
+
+ PR fortran/95614
+ * gfortran.dg/pr95614_1.f90: New test.
+ * gfortran.dg/pr95614_2.f90: New test.
+
+2020-09-26 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/96495
+ * gfortran.dg/alloc_comp_result_2.f90 : Restore original.
+ * gfortran.dg/alloc_comp_result_3.f90 : New test.
+
+2020-09-26 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/lto/modref-1_0.c: New test.
+ * gcc.dg/lto/modref-1_1.c: New test.
+ * gcc.dg/tree-ssa/modref-2.c: New test.
+
+2020-09-26 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/vect/vect-simd-17.c: Expect 11 or more vectorized loops.
+ * gcc.dg/vect/vect-simd-18.c: New test.
+ * gcc.dg/vect/vect-simd-19.c: New test.
+ * gcc.dg/vect/vect-simd-20.c: New test.
+
+2020-09-26 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/ipa/ipa-pta-13.c: Disable modref.
+
+2020-09-26 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/94355
+ * g++.dg/analyzer/placement-new.C: New test.
+
+2020-09-26 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/96646
+ PR analyzer/96841
+ * gcc.dg/analyzer/pr96646.c: New test.
+ * gcc.dg/analyzer/pr96841.c: New test.
+
+2020-09-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/96814
+ * gcc.target/i386/pr96814.c: New testcase.
+
+2020-09-25 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c: Allow
+ the store to use GPRs instead of FPRs. Add scan-assembler-nots
+ for writeback.
+ * gcc.target/arm/armv8_1m-fp16-move-1.c: New test.
+ * gcc.target/arm/armv8_1m-fp32-move-1.c: Likewise.
+ * gcc.target/arm/armv8_1m-fp64-move-1.c: Likewise.
+
+2020-09-25 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/71233
+ * gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c: Remove
+ declarations of vector, vector2, vector_res for float64x2 type.
+ * gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c: Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vzip_half.c: Likewise.
+
+2020-09-25 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/97204
+ * gcc.target/i386/sse2-mmx-pinsrw.c: Fix.
+
+2020-09-25 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/vect/vect-simd-17.c: New test.
+
+2020-09-25 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/analyzer/pr93355-localealias.c: Require effective target
+ alloca.
+
+2020-09-25 Tom de Vries <tdevries@suse.de>
+
+ * lib/target-supports.exp (check_effective_target_ident_directive): New proc.
+ * c-c++-common/ident-1b.c: Require effective target ident_directive.
+ * c-c++-common/ident-2b.c: Same.
+
+2020-09-24 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/template/local-var1.C: New.
+
+2020-09-24 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/template/local-fn4.C: Add target c++11
+
+2020-09-24 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/97186
+ * g++.dg/template/local10.C: Rename ...
+ * g++.dg/template/local-fn3.C: .. here. Require lto.
+ * g++.dg/template/local-fn4.C: New.
+
+2020-09-24 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/modref-1.c: New test.
+
+2020-09-24 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/tls/thr-cse-1.c: Scan final dump instead of assembly for
+ nvptx.
+
+2020-09-24 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/independent-cloneids-1.c: Use scan-rtl-dump instead of
+ scan-assembler.
+
+2020-09-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97085
+ * gcc.dg/pr97192.c: New testcase.
+
+2020-09-24 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/96495
+ * gfortran.dg/alloc_comp_result_2.f90 : New test.
+
+2020-09-24 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/pr87314-1.c: Add nvptx-specific scan-assembler directive.
+
+2020-09-24 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/arm/stack-protector-5.c: New test.
+ * gcc.target/arm/stack-protector-6.c: Likewise.
+
+2020-09-24 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/arm/stack-protector-3.c: New test.
+ * gcc.target/arm/stack-protector-4.c: Likewise.
+
+2020-09-24 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97085
+ * gcc.dg/vect/pr97085.c: New testcase.
+
+2020-09-24 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/pr94600-1.c: Require effective target non_strict_align for
+ scan-rtl-dump-times.
+ * gcc.dg/pr94600-3.c: Same.
+
+2020-09-24 Tom de Vries <tdevries@suse.de>
+
+ * c-c++-common/builtin-has-attribute-3.c: Compile with -DSKIP_ALIAS
+ for effective target ! alias.
+
+2020-09-24 Kewen Lin <linkw@linux.ibm.com>
+
+ PR tree-optimization/97075
+ * gcc.target/powerpc/p9-vec-length-full-6.c: Adjust.
+
+2020-09-24 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/93355
+ * gcc.dg/analyzer/pr93355-localealias-feasibility.c: New test.
+ * gcc.dg/analyzer/pr93355-localealias-simplified.c: New test.
+ * gcc.dg/analyzer/pr93355-localealias.c: New test.
+
+2020-09-24 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/feasibility-2.c: New test.
+
+2020-09-23 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97175
+ * gcc.dg/Wstringop-overflow-44.c: New test.
+
+2020-09-23 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/tree-ssa/local-pure-const.c: Update template.
+
+2020-09-23 Martin Sebor <msebor@redhat.com>
+
+ PR c/97131
+ * gcc.dg/Warray-parameter-6.c: New test.
+
+2020-09-23 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/stack-protector-5.c: New test.
+ * gcc.target/aarch64/stack-protector-6.c: Likewise.
+ * gcc.target/aarch64/stack-protector-7.c: Likewise.
+
+2020-09-23 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/stack-protector-3.c: New test.
+ * gcc.target/aarch64/stack-protector-4.c: Likewise.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
+ (clean_results): Add float64x2_t cleanup.
+ (DECL_VARIABLE_128BITS_VARIANTS): Add float64x2_t variable.
+ * gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c: Add
+ testing of vreinterpretq_f64_p128, vreinterpretq_p128_f64.
+
+2020-09-23 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/97171
+ * g++.dg/template/local10.C: New.
+
+2020-09-23 Marek Polacek <polacek@redhat.com>
+
+ PR c/97125
+ * c-c++-common/Wduplicated-branches-15.c: New test.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/96453
+ * gcc.dg/pr96453.c: New testcase.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/96466
+ * gcc.dg/pr96466.c: New testcase.
+
+2020-09-23 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/powerpc/p9-vec-length-epil-1.c: Do not expect the
+ single-iteration epilogues of the 64-bit loops to be vectorized.
+ * gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise.
+ * gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/vrndns_f32_1.c: New test.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97173
+ * gcc.dg/vect/pr97173.c: New testcase.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/trn_zip_p64_1.c: New test.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/vldrq_p128_1.c: New test.
+
+2020-09-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/vstrq_p128_1.c: New test.
+
+2020-09-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97151
+ * g++.dg/cpp1y/new1.C: Adjust for two more handled transforms.
+
+2020-09-23 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/97069
+ * g++.dg/gcov/pr97069.C: New test.
+
+2020-09-23 Tom de Vries <tdevries@suse.de>
+
+ * gcc.dg/Warray-bounds-63.c: Add require-effective-target alloca.
+ * gcc.dg/Warray-bounds-66.c: Same.
+ * gcc.dg/atomic/stdatomic-vm.c: Same.
+
+2020-09-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/95310
+ * g++.dg/concepts/diagnostic15.C: New test.
+
+2020-09-22 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/96652
+ * g++.dg/cpp0x/decltype-96652.C: New test.
+
+2020-09-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97145
+ * g++.dg/asan/pr97145.C: New test.
+
+2020-09-22 David Faust <david.faust@oracle.com>
+
+ * gcc.target/bpf/diag-sdiv.c: New test.
+ * gcc.target/bpf/diag-smod.c: New test.
+ * gcc.target/bpf/xbpf-sdiv-1.c: New test.
+ * gcc.target/bpf/xbpf-smod-1.c: New test.
+
+2020-09-22 Nathan Sidwell <nathan@acm.org>
+
+ * g++.old-deja/g++.pt/friend34.C: Check injected friend is still
+ invisible.
+
+2020-09-22 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/ext/timevar1.C: Also prune N%.
+
+2020-09-22 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/ext/timevar2.C: Also prune N%.
+
+2020-09-22 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96979
+ * g++.dg/tree-ssa/pr96979.C: New test.
+
+2020-09-22 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
+
+ * gcc.target/s390/load-and-test-fp-1.c: Change test to include all
+ possible combinations of dead/live registers and comparisons (equality,
+ relational).
+ * gcc.target/s390/load-and-test-fp-2.c: Same as load-and-test-fp-1.c
+ but for fast math.
+ * gcc.target/s390/load-and-test-fp.h: New test included by
+ load-and-test-fp-{1,2}.c.
+
+2020-09-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/vcls_unsigned_1.c: New test.
+
+2020-09-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/vceq_poly_1.c: New test.
+
+2020-09-22 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/71233
+ * gcc.target/aarch64/simd/vadd_poly_1.c: New test.
+
+2020-09-22 Jan Hubicka <jh@suse.cz>
+
+ * gcc.target/i386/m128-check.h: Add no-strict-aliasing
+
+2020-09-21 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97130
+ * gcc.dg/analyzer/pr97130.c: New test.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90583
+ DR 1722
+ * g++.dg/cpp0x/lambda/lambda-conv14.C: New test.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/warn/Wctad-maybe-unsupported.C: New test.
+ * g++.dg/warn/Wctad-maybe-unsupported2.C: New test.
+ * g++.dg/warn/Wctad-maybe-unsupported3.C: New test.
+ * g++.dg/warn/Wctad-maybe-unsupported.h: New file.
+
+2020-09-21 Martin Sebor <msebor@redhat.com>
+
+ PR c/50584
+ * gcc.dg/ipa/ipa-sra-1.c: Use a plain pointer for argv instead of array.
+ * gcc.dg/ipa/ipa-sra-12.c: Same.
+ * gcc.dg/ipa/ipa-sra-13.c: Same.
+ * gcc.dg/ipa/ipa-sra-14.c: Same.
+ * gcc.dg/ipa/ipa-sra-15.c: Same.
+
+2020-09-21 Harald Anlauf <anlauf@gmx.de>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ * gfortran.dg/check_bits_2.f90: New test.
+
+2020-09-21 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.dg/ipa/symver1.c: Skip for Darwin.
+
+2020-09-21 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/csinc-1.c: Use dg-add-options
+ arm_arch_v8_1m_main.
+ * gcc.target/arm/csinv-1.c: Likewise.
+ * gcc.target/arm/csneg.c: Likewise.
+
+2020-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97139
+ * gcc.dg/vect/pr97139.c: New testcase.
+
+2020-09-21 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97099
+ * g++.dg/cpp1z/class-deduction74.C: New test.
+
+2020-09-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97135
+ * gcc.dg/torture/pr97135.c: New testcase.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/96915
+ * gcc.target/aarch64/sve/pr96915.c: New test.
+
+2020-09-21 Andrea Corallo <andrea.corallo@arm.com>
+
+ PR target/96968
+ * gcc.target/aarch64/pr96968.c: New test.
+
+2020-09-21 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/ext/timevar1.C: Prune more possible number values.
+ * g++.dg/ext/timevar2.C: Likewise.
+
+2020-09-20 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90199
+ * g++.dg/cpp1y/constexpr-90199.C: New test.
+
2020-09-19 Martin Sebor <msebor@redhat.com>
PR middle-end/82608
diff --git a/gcc/testsuite/ada/acats/run_all.sh b/gcc/testsuite/ada/acats/run_all.sh
index 7645983..ac2a86b 100755
--- a/gcc/testsuite/ada/acats/run_all.sh
+++ b/gcc/testsuite/ada/acats/run_all.sh
@@ -133,6 +133,23 @@ target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
target_bit=`cat $dir/support/impbit.out`
echo target_bit="$target_bit" >> $dir/acats.log
+case "$target_bit" in
+ *32*)
+ target_max_int="9223372036854775807"
+ target_min_int="-9223372036854775808"
+ ;;
+ *64*)
+ target_max_int="170141183460469231731687303715884105727"
+ target_min_int="-170141183460469231731687303715884105728"
+ ;;
+ *)
+ display "**** Unsupported bits per word"
+ exit 1
+esac
+
+echo target_max_insn="$target_max_int" >> $dir/acats.log
+echo target_min_insn="$target_min_int" >> $dir/acats.log
+
# Find out a suitable asm statement
# Adapted from configure.ac gcc_cv_as_dwarf2_debug_line
case "$target" in
@@ -153,6 +170,8 @@ sed -e "s,ACATS4GNATDIR,$dir,g" \
sed -e "s,ACATS4GNATDIR,$dir,g" \
-e "s,ACATS4GNATBIT,$target_bit,g" \
-e "s,ACATS4GNATINSN,$target_insn,g" \
+ -e "s,ACATS4GNATMAXINT,$target_max_int,g" \
+ -e "s,ACATS4GNATMININT,$target_min_int,g" \
< $testdir/support/macro.dfs > $dir/support/MACRO.DFS
sed -e "s,ACATS4GNATDIR,$dir,g" \
< $testdir/support/tsttests.dat > $dir/support/TSTTESTS.DAT
diff --git a/gcc/testsuite/ada/acats/support/macro.dfs b/gcc/testsuite/ada/acats/support/macro.dfs
index 8c37233..e3c5559 100644
--- a/gcc/testsuite/ada/acats/support/macro.dfs
+++ b/gcc/testsuite/ada/acats/support/macro.dfs
@@ -227,7 +227,7 @@ MACHINE_CODE_STATEMENT Asm_Insn'(Asm ("ACATS4GNATINSN"));
-- THE LITERAL MUST NOT INCLUDE UNDERSCORES OR LEADING OR TRAILING
-- BLANKS.
-- USED IN: C35503D C35503F C4A007A
-MAX_INT 9223372036854775807
+MAX_INT ACATS4GNATMAXINT
-- $MIN_INT
@@ -235,7 +235,7 @@ MAX_INT 9223372036854775807
-- THE LITERAL MUST NOT CONTAIN UNDERSCORES OR LEADING OR TRAILING
-- BLANKS.
-- USED IN: C35503D C35503F
-MIN_INT -9223372036854775808
+MIN_INT ACATS4GNATMININT
-- $NAME
-- THE NAME OF A PREDEFINED INTEGER TYPE OTHER THAN INTEGER,
diff --git a/gcc/testsuite/c-c++-common/Wduplicated-branches-15.c b/gcc/testsuite/c-c++-common/Wduplicated-branches-15.c
new file mode 100644
index 0000000..d494360
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wduplicated-branches-15.c
@@ -0,0 +1,32 @@
+/* PR c/97125 */
+/* { dg-do compile } */
+/* { dg-options "-Wduplicated-branches" } */
+
+void foo (void);
+
+void
+fn1 (void)
+{
+ if (0)
+ foo ();
+ else
+ switch (0);
+}
+
+void
+fn2 (void)
+{
+ if (0)
+ foo ();
+ else
+ while (0);
+}
+
+void
+fn3 (void)
+{
+ if (0)
+ foo ();
+ else
+ for (;;);
+}
diff --git a/gcc/testsuite/c-c++-common/Wrestrict.c b/gcc/testsuite/c-c++-common/Wrestrict.c
index 3b019c8..9eb02bd 100644
--- a/gcc/testsuite/c-c++-common/Wrestrict.c
+++ b/gcc/testsuite/c-c++-common/Wrestrict.c
@@ -320,14 +320,17 @@ void test_memcpy_anti_range (char *d, const char *s)
T (d, d + SAR (0, 3), UR (DIFF_MAX - 2, DIFF_MAX)); /* { dg-warning "accessing \[0-9\]+ or more bytes at offsets 0 and \\\[-?\[0-9\]+, -?\[0-9\]+] overlaps \[0-9\]+ bytes at offset 2" "memcpy" } */
- /* Verify that a size in an anti-range ~[0, N] where N >= PTRDIFF_MAX
- doesn't trigger a warning. */
+ /* Verify that a size in an anti-range ~[1, N] where N >= PTRDIFF_MAX - 2
+ doesn't trigger a warning.
+ With ~[1, PTRDIFF_MAX - 1] the difference between the just-past-the-end
+ pointer to A and A for char A[PTRDIFF_MAX] wouldn't be representable in
+ ptrdiff_t. Since such a large object cannot exist, so the size of
+ the region must be zero. */
+ T (d, s, UAR (1, DIFF_MAX / 2 - 1));
T (d, s, UAR (1, DIFF_MAX - 1));
T (d, s, UAR (1, DIFF_MAX));
T (d, s, UAR (1, SIZE_MAX - 1));
-
- /* This causes the last dg-warning test to fail for some reason.
- T (d, s, UAR (1, SIZE_MAX)); */
+ T (d, s, UAR (1, SIZE_MAX));
}
/* Verify calls to memcpy() where the combination of offsets in some
diff --git a/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c b/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c
new file mode 100644
index 0000000..6e01d6c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wsizeof-array-div1.c
@@ -0,0 +1,56 @@
+/* PR c++/91741 */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+typedef int T;
+
+int
+fn (int ap[])
+{
+ int arr[10];
+ int *arr2[10];
+ int *p = &arr[0];
+ int r = 0;
+
+ r += sizeof (arr) / sizeof (*arr);
+ r += sizeof (arr) / sizeof (p); /* { dg-warning "expression does not compute" "" { target { lp64 } } } */
+ r += sizeof (arr) / sizeof p; /* { dg-warning "expression does not compute" "" { target { lp64 } } } */
+ r += sizeof (arr) / (sizeof p);
+ r += sizeof (arr) / (sizeof (p));
+ r += sizeof (arr2) / sizeof p;
+ r += sizeof (arr2) / sizeof (int); /* { dg-warning "expression does not compute" "" { target { lp64 } } } */
+ r += sizeof (arr2) / sizeof (int *);
+ r += sizeof (arr2) / sizeof (short *);
+ r += sizeof (arr) / sizeof (int);
+ r += sizeof (arr) / sizeof (unsigned int);
+ r += sizeof (arr) / sizeof (T);
+ r += sizeof (arr) / sizeof (short); /* { dg-warning "expression does not compute" } */
+ r += sizeof (arr) / (sizeof (short));
+
+ r += sizeof (ap) / sizeof (char); /* { dg-warning ".sizeof. on array function parameter" } */
+
+ const char arr3[] = "foo";
+ r += sizeof (arr3) / sizeof(char);
+ r += sizeof (arr3) / sizeof(int);
+ r += sizeof (arr3) / sizeof (*arr3);
+
+ int arr4[5][5];
+ r += sizeof (arr4) / sizeof (arr4[0]);
+ r += sizeof (arr4) / sizeof (*arr4);
+ r += sizeof (arr4) / sizeof (**arr4);
+ r += sizeof (arr4) / sizeof (int *);
+ r += sizeof (arr4) / sizeof (int);
+ r += sizeof (arr4) / sizeof (short int);
+
+ T arr5[10];
+ r += sizeof (arr5) / sizeof (T);
+ r += sizeof (arr5) / sizeof (int);
+ r += sizeof (arr5) / sizeof (short); /* { dg-warning "expression does not compute" } */
+
+ double arr6[10];
+ r += sizeof (arr6) / sizeof (double);
+ r += sizeof (arr6) / sizeof (float); /* { dg-warning "expression does not compute" } */
+ r += sizeof (arr6) / sizeof (*arr6);
+
+ return r;
+}
diff --git a/gcc/testsuite/c-c++-common/Wsizeof-pointer-div.c b/gcc/testsuite/c-c++-common/Wsizeof-pointer-div.c
index 8311618..e9bad1f 100644
--- a/gcc/testsuite/c-c++-common/Wsizeof-pointer-div.c
+++ b/gcc/testsuite/c-c++-common/Wsizeof-pointer-div.c
@@ -29,7 +29,7 @@ f2 (void)
i += sizeof(array) / sizeof(array[0]);
i += (sizeof(array)) / (sizeof(array[0]));
i += sizeof(array) / sizeof(int);
- i += sizeof(array) / sizeof(char);
+ i += sizeof(array) / sizeof(char); /* { dg-warning "expression does not compute" } */
i += sizeof(*array) / sizeof(char);
i += sizeof(array[0]) / sizeof(char);
return i;
diff --git a/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c b/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
index 5736bab..45806d5 100644
--- a/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
+++ b/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
@@ -2,7 +2,7 @@
{ dg-do compile }
{ dg-options "-Wall -ftrack-macro-expansion=0" }
{ dg-options "-Wall -Wno-narrowing -Wno-unused-local-typedefs -ftrack-macro-expansion=0" { target c++ } }
- { dg-additional-options "-DSKIP_ALIAS" { target *-*-darwin* hppa*-*-hpux* } }
+ { dg-additional-options "-DSKIP_ALIAS" { target { { *-*-darwin* hppa*-*-hpux } || { ! alias } } } }
*/
#define ATTR(...) __attribute__ ((__VA_ARGS__))
diff --git a/gcc/testsuite/gcc.dg/cpp/endif.c b/gcc/testsuite/c-c++-common/cpp/endif.c
index efea52c..efea52c 100644
--- a/gcc/testsuite/gcc.dg/cpp/endif.c
+++ b/gcc/testsuite/c-c++-common/cpp/endif.c
diff --git a/gcc/testsuite/gcc.dg/cpp/endif.h b/gcc/testsuite/c-c++-common/cpp/endif.h
index 3762249..3762249 100644
--- a/gcc/testsuite/gcc.dg/cpp/endif.h
+++ b/gcc/testsuite/c-c++-common/cpp/endif.h
diff --git a/gcc/testsuite/c-c++-common/cpp/eof-2.c b/gcc/testsuite/c-c++-common/cpp/eof-2.c
index 3a4af7f..9cc4fed 100644
--- a/gcc/testsuite/c-c++-common/cpp/eof-2.c
+++ b/gcc/testsuite/c-c++-common/cpp/eof-2.c
@@ -5,4 +5,4 @@
#define f(x) x
#include "eof-2.h"
- /* { dg-regexp {[^\n]*eof-2.h:4: error: unterminated argument list invoking macro "f"\n} } */
+ /* { dg-regexp {[^\n]*eof-2.h:4:21: error: unterminated argument list invoking macro "f"\n} } */
diff --git a/gcc/testsuite/c-c++-common/cpp/eof-3.c b/gcc/testsuite/c-c++-common/cpp/eof-3.c
index 316918e..e309a54 100644
--- a/gcc/testsuite/c-c++-common/cpp/eof-3.c
+++ b/gcc/testsuite/c-c++-common/cpp/eof-3.c
@@ -3,6 +3,6 @@
/* { dg-do preprocess } */
/* { dg-additional-options "-include $srcdir/c-c++-common/cpp/eof-2.h" } */
- /* { dg-regexp {[^\n]*eof-2.h:4: error: unterminated argument list invoking macro "f"\n} } */
+ /* { dg-regexp {[^\n]*eof-2.h:4:21: error: unterminated argument list invoking macro "f"\n} } */
token )
diff --git a/gcc/testsuite/c-c++-common/cpp/pr97471.c b/gcc/testsuite/c-c++-common/cpp/pr97471.c
new file mode 100644
index 0000000..f1e512e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pr97471.c
@@ -0,0 +1,10 @@
+/* PR preprocessor/97471 */
+/* { dg-do compile } */
+
+/* ICE with non-fn use of fn-like macro at EOF */
+
+#define a() b
+
+/* { dg-error "expected" "" { target c } .+2 } */
+/* { dg-error "does not name" "" { target c++ } .+1 } */
+a
diff --git a/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c b/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c
index 7c90562..c5487bd 100644
--- a/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c
+++ b/gcc/testsuite/c-c++-common/goacc/declare-pr90861.c
@@ -17,5 +17,5 @@ void f2 (void)
int A_f2[N_f2];
#pragma acc declare copy(A_f2)
/* { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(to:\(\*A_f2} 1 gimple } }
- { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(from:\(\*A_f2} 1 gimple { xfail *-*-* } } } TODO PR90861 */
+ { dg-final { scan-tree-dump-times {#pragma omp target oacc_declare map\(from:\(\*A_f2} 1 gimple } } */
}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr97289.c b/gcc/testsuite/c-c++-common/gomp/pr97289.c
new file mode 100644
index 0000000..8331b95
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr97289.c
@@ -0,0 +1,14 @@
+/* PR middle-end/97289 */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-skip-if "" { "hppa*-*-hpux*" "*-*-aix*" "nvptx-*-*" } } */
+
+void foo (void);
+static void bar (void) __attribute__ ((__weakref__ ("foo")));
+
+void
+baz (void)
+{
+#pragma omp target
+ bar ();
+}
diff --git a/gcc/testsuite/c-c++-common/ident-0b.c b/gcc/testsuite/c-c++-common/ident-0b.c
index 67b593c..b46d850 100644
--- a/gcc/testsuite/c-c++-common/ident-0b.c
+++ b/gcc/testsuite/c-c++-common/ident-0b.c
@@ -2,6 +2,7 @@
* Make sure scan-assembler-not turns off .ident unless -fident in testcase */
/* { dg-do compile } */
/* { dg-options "-fident" } */
+/* { dg-require-effective-target ident_directive }*/
/* { dg-skip-if "no assembler .ident support" { { hppa*-*-hpux* && { ! lp64 } } || powerpc*-*-darwin* } } */
int i;
diff --git a/gcc/testsuite/c-c++-common/ident-1b.c b/gcc/testsuite/c-c++-common/ident-1b.c
index 6956744..b8b83e6 100644
--- a/gcc/testsuite/c-c++-common/ident-1b.c
+++ b/gcc/testsuite/c-c++-common/ident-1b.c
@@ -2,6 +2,7 @@
* Make sure scan-assembler turns off .ident unless -fident in testcase */
/* { dg-do compile } */
/* { dg-options "-fident" } */
+/* { dg-require-effective-target ident_directive }*/
int i;
/* { dg-final { scan-assembler "GCC: " { xfail { { hppa*-*-hpux* && { ! lp64 } } || { powerpc-ibm-aix* || powerpc*-*-darwin* } } } } } */
diff --git a/gcc/testsuite/c-c++-common/ident-2b.c b/gcc/testsuite/c-c++-common/ident-2b.c
index fae6a03..52f0693 100644
--- a/gcc/testsuite/c-c++-common/ident-2b.c
+++ b/gcc/testsuite/c-c++-common/ident-2b.c
@@ -2,6 +2,7 @@
* Make sure scan-assembler-times turns off .ident unless -fident in testcase */
/* { dg-do compile } */
/* { dg-options "-fident" } */
+/* { dg-require-effective-target ident_directive }*/
int ident;
/* { dg-final { scan-assembler "GCC: " { xfail { { hppa*-*-hpux* && { ! lp64 } } || { powerpc-ibm-aix* || powerpc*-*-darwin* } } } } } */
diff --git a/gcc/testsuite/c-c++-common/pr97164.c b/gcc/testsuite/c-c++-common/pr97164.c
new file mode 100644
index 0000000..8ffb928
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr97164.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/97164 */
+/* { dg-do compile } */
+
+typedef struct { int *a; char b[64]; } A __attribute__((aligned (64)));
+struct B { A d[4]; } b; /* { dg-error "size of array element is not a multiple of its alignment" } */
+void foo (void);
+
+int *
+bar (void)
+{
+ struct B *h = &b;
+ if (h->d[1].a)
+ foo ();
+ return h->d[1].a;
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/analyzer.exp b/gcc/testsuite/g++.dg/analyzer/analyzer.exp
index 60262f6..78edff2 100644
--- a/gcc/testsuite/g++.dg/analyzer/analyzer.exp
+++ b/gcc/testsuite/g++.dg/analyzer/analyzer.exp
@@ -29,7 +29,7 @@ if [info exists DEFAULT_CXXFLAGS] then {
}
# If a testcase doesn't have special options, use these.
-set DEFAULT_CXXFLAGS " -fanalyzer -fdiagnostics-path-format=separate-events -Wanalyzer-too-complex -fanalyzer-call-summaries"
+set DEFAULT_CXXFLAGS " -fanalyzer -Wanalyzer-too-complex -fanalyzer-call-summaries"
# Initialize `dg'.
dg-init
diff --git a/gcc/testsuite/g++.dg/analyzer/ctor-dtor-1.C b/gcc/testsuite/g++.dg/analyzer/ctor-dtor-1.C
new file mode 100644
index 0000000..440ac4d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/ctor-dtor-1.C
@@ -0,0 +1,26 @@
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+
+int foo_count;
+
+struct foo
+{
+ foo () __attribute__((noinline))
+ {
+ foo_count++;
+ }
+ ~foo () __attribute__((noinline))
+ {
+ foo_count--;
+ }
+};
+
+int main ()
+{
+ __analyzer_eval (foo_count == 0); // { dg-warning "TRUE" }
+ {
+ foo f;
+ __analyzer_eval (foo_count == 1); // { dg-warning "TRUE" }
+ }
+ __analyzer_eval (foo_count == 0); // { dg-warning "TRUE" }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/dyncast-1.C b/gcc/testsuite/g++.dg/analyzer/dyncast-1.C
new file mode 100644
index 0000000..14acb91
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/dyncast-1.C
@@ -0,0 +1,21 @@
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+
+struct base
+{
+ virtual ~base () {}
+};
+struct sub : public base
+{
+ int m_field;
+};
+
+int
+test_1 (base *p)
+{
+ if (sub *q = dynamic_cast <sub*> (p))
+ {
+ __analyzer_dump_path (); // { dg-message "path" }
+ return q->m_field;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/placement-new.C b/gcc/testsuite/g++.dg/analyzer/placement-new.C
new file mode 100644
index 0000000..8250f45
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/placement-new.C
@@ -0,0 +1,26 @@
+#include <new>
+
+/* Placement new. */
+
+void test_1 (void)
+{
+ char buf[sizeof(int)];
+ int *p = new(buf) int (42);
+}
+
+/* Placement new[]. */
+
+void test_2 (void)
+{
+ char buf[sizeof(int) * 10];
+ int *p = new(buf) int[10];
+}
+
+/* Delete of placement new. */
+
+void test_3 (void)
+{
+ char buf[sizeof(int)];
+ int *p = new(buf) int (42);
+ delete p; // { dg-warning "memory not on the heap" }
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/pr97116.C b/gcc/testsuite/g++.dg/analyzer/pr97116.C
new file mode 100644
index 0000000..d8e08a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/pr97116.C
@@ -0,0 +1,39 @@
+#include <new>
+#include <cstddef>
+
+struct foo
+{
+ foo (int i) : m_i (i) {} // { dg-message "argument 'this' of 'foo::foo\\(int\\)' must be non-null" "note" }
+
+ int get () const { return m_i; } // { dg-message "argument 'this' of '\[^\n\]*' must be non-null" "note" }
+
+ int meth_1 (int, void *ptr) __attribute__((nonnull)); // { dg-message "argument 2 of '\[^\n\]*' must be non-null" "note" }
+ int meth_2 (int, void *ptr) __attribute__((nonnull(3))); // { dg-message "argument 2 of '\[^\n\]*' must be non-null" "note" }
+
+ int m_i;
+};
+
+void test_1 (void)
+{
+ foo *p = new(NULL) foo (42); // { dg-warning "non-null expected" "warning" }
+ // { dg-message "argument 'this' \\(\[^\n\]*\\) NULL where non-null expected" "final event" { target *-*-* } .-1 }
+}
+
+int test_2 (void)
+{
+ foo *p = NULL;
+ return p->get (); // { dg-warning "non-null expected" "warning" }
+ // { dg-message "argument 'this' \\('p'\\) NULL where non-null expected" "final event" { target *-*-* } .-1 }
+}
+
+int test_meth_1 (foo *f)
+{
+ return f->meth_1 (42, NULL); // { dg-warning "non-null expected" "warning" }
+ // { dg-message "argument 2 NULL where non-null expected" "final event" { target *-*-* } .-1 }
+}
+
+int test_meth_2 (foo *f)
+{
+ return f->meth_2 (42, NULL); // { dg-warning "non-null expected" "warning" }
+ // { dg-message "argument 2 NULL where non-null expected" "final event" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/g++.dg/analyzer/pr97489.C b/gcc/testsuite/g++.dg/analyzer/pr97489.C
new file mode 100644
index 0000000..9322e72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/pr97489.C
@@ -0,0 +1,6 @@
+struct X {
+ virtual ~X() {}
+ virtual void key_function();
+};
+
+void X::key_function() {}
diff --git a/gcc/testsuite/g++.dg/analyzer/vfunc-1.C b/gcc/testsuite/g++.dg/analyzer/vfunc-1.C
new file mode 100644
index 0000000..349ab33
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/vfunc-1.C
@@ -0,0 +1,14 @@
+struct base
+{
+ virtual int fn () const;
+};
+struct sub : public base
+{
+ int fn () const;
+};
+
+int
+test_1 (base *p)
+{
+ return p->fn ();
+}
diff --git a/gcc/testsuite/g++.dg/asan/asan_test.C b/gcc/testsuite/g++.dg/asan/asan_test.C
index ca989a3..c62568f 100644
--- a/gcc/testsuite/g++.dg/asan/asan_test.C
+++ b/gcc/testsuite/g++.dg/asan/asan_test.C
@@ -2,7 +2,7 @@
// { dg-skip-if "" { *-*-* } { "*" } { "-O2" } }
// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
// { dg-additional-sources "asan_globals_test-wrapper.cc" }
-// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror -Wno-alloc-size-larger-than -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread" }
+// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror -Wno-alloc-size-larger-than -Wno-stringop-overflow -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread" }
// { dg-additional-options "-ldl" { target { ! *-*-freebsd* } } }
// { dg-additional-options "-DASAN_NEEDS_SEGV=1" { target { ! arm*-*-* } } }
// { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target arm*-*-* } }
diff --git a/gcc/testsuite/g++.dg/asan/pr97145.C b/gcc/testsuite/g++.dg/asan/pr97145.C
new file mode 100644
index 0000000..993c8a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr97145.C
@@ -0,0 +1,7 @@
+// PR c++/97145
+// { dg-do compile { target c++11 } }
+// { dg-options "-fsanitize=address,pointer-subtract,pointer-compare" }
+
+constexpr char *a = nullptr;
+constexpr auto b = a - a;
+constexpr auto c = a < a;
diff --git a/gcc/testsuite/g++.dg/asan/pr97414.C b/gcc/testsuite/g++.dg/asan/pr97414.C
new file mode 100644
index 0000000..6ea0390
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr97414.C
@@ -0,0 +1,19 @@
+/* PR sanitizer/97414 */
+/* { dg-do run } */
+/* { dg-set-target-env-var ASAN_OPTIONS "detect_invalid_pointer_pairs=1:halt_on_error=1,detect_stack_use_after_return=1" } */
+/* { dg-options "-fsanitize=address,pointer-compare,pointer-subtract" } */
+
+[[gnu::noinline]] auto pointer_diff(const int *begin, const int *end) {
+ return end - begin;
+}
+
+int main() {
+ constexpr auto size = (2048 / sizeof(int)) + 1;
+
+ auto buf = new int[size];
+ auto end = buf + size;
+ pointer_diff(end, buf);
+ delete[] buf;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/compat/eh/filter2_y.C b/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
index 87c6fea..67a4ffe 100644
--- a/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
+++ b/gcc/testsuite/g++.dg/compat/eh/filter2_y.C
@@ -9,6 +9,12 @@ struct a
a () { }
~a ()
+#if __cplusplus >= 201103L
+ // Give this destructor a potentially-throwing exception specification so
+ // that we verify std::terminate gets called due to an exception during
+ // unwinding, not just because the destructor is noexcept.
+ noexcept(false)
+#endif
{
try
{
diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic15.C b/gcc/testsuite/g++.dg/concepts/diagnostic15.C
new file mode 100644
index 0000000..3acd9f6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/diagnostic15.C
@@ -0,0 +1,16 @@
+// PR c++/95310
+// { dg-do compile { target concepts } }
+
+template <class T>
+using iter_reference_t = decltype(*T{});
+
+template <typename F>
+struct result { using type = iter_reference_t<F>; };
+
+template <class Out, const int& N>
+concept indirectly_writable = requires(Out o) { // { dg-bogus "F =" }
+ iter_reference_t<Out>(*o) = N;
+};
+
+const int a = 0;
+static_assert(indirectly_writable<const int*, a>); // { dg-error "assert" }
diff --git a/gcc/testsuite/g++.dg/coroutines/pr97438.C b/gcc/testsuite/g++.dg/coroutines/pr97438.C
new file mode 100644
index 0000000..9537664
--- /dev/null
+++ b/gcc/testsuite/g++.dg/coroutines/pr97438.C
@@ -0,0 +1,30 @@
+#if __has_include(<coroutine>)
+#include <coroutine>
+#else
+#include <experimental/coroutine>
+namespace std { using namespace experimental; }
+#endif
+
+struct dummy_coroutine {};
+
+namespace std {
+
+template<>
+class coroutine_traits<::dummy_coroutine> {
+public:
+ struct promise_type {
+ void return_value(int x) { }
+ void return_void() {}
+ std::suspend_never initial_suspend() noexcept { return {}; }
+ std::suspend_never final_suspend() noexcept { return {}; }
+ dummy_coroutine get_return_object() { return {}; }
+ void unhandled_exception() {}
+ };
+};
+
+}
+
+dummy_coroutine
+foo() { // { dg-error {the coroutine promise type 'std::__n4861::coroutine_traits<dummy_coroutine>::promise_type' declares both 'return_value' and 'return_void'} }
+ co_return 17;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr96805.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr96805.C
new file mode 100644
index 0000000..c784f27
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pr96805.C
@@ -0,0 +1,9 @@
+// PR c++/96805
+// { dg-do compile { target c++11 } }
+
+template <typename T> class a {
+ template <int N> struct c {
+ template <bool B> using t = int;
+ t<N> m;
+ };
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-96241.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-96241.C
new file mode 100644
index 0000000..5994053
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-96241.C
@@ -0,0 +1,18 @@
+// PR c++/96241
+// { dg-do compile { target c++11 } }
+
+template <typename T, T...> struct S {};
+template <typename T, T t> using U = S<T, __integer_pack(t)...>;
+template <long... N> using f = S<unsigned long, N...>;
+template <long N> using V = U<unsigned long, N>;
+template <int N> struct A { typedef int type[N]; };
+template <int N> struct B { typename A<N>::type k; };
+template <typename T, int N, unsigned long... P>
+constexpr B<N> bar(T (&arr)[N], f<P...>) {
+ return {arr[P]...};
+}
+template <typename T, int N> constexpr B<N> foo(T (&arr)[N]) {
+ return bar(arr, V<N>{});
+}
+constexpr char arr[2]{};
+B<2> b = foo(arr);
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-96652.C b/gcc/testsuite/g++.dg/cpp0x/decltype-96652.C
new file mode 100644
index 0000000..249cce2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-96652.C
@@ -0,0 +1,14 @@
+// PR c++/96652
+// { dg-do compile { target c++11 } }
+
+struct A {};
+
+template <typename T>
+struct B
+{
+ A m;
+ friend decltype(m);
+};
+
+A a;
+B<int> b;
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv14.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv14.C
new file mode 100644
index 0000000..869e0d5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv14.C
@@ -0,0 +1,10 @@
+// PR c++/90583
+// DR 1722: Lambda to function pointer conversion should be noexcept.
+// { dg-do compile { target c++11 } }
+
+void
+foo ()
+{
+ auto l = [](int){ return 42; };
+ static_assert(noexcept((int (*)(int))(l)), "");
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C
index 5928894..a9acc20 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C
@@ -9,7 +9,7 @@ struct AddRvalueReferenceImpl { typedef T type; };
template <typename T>
struct AddRvalueReferenceImpl<T, typename BoolSink<false &&
[] { // { dg-error "lambda" "" { target c++17_down } }
- extern T &&tref;
+ extern void tref(T&&);
}>::type> {
typedef T &&type;
};
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic11.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic11.C
new file mode 100644
index 0000000..aa4ffd7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic11.C
@@ -0,0 +1,20 @@
+// PR c++/97358
+// { dg-do compile { target c++11 } }
+
+template <typename... T> void foo (T... x) {}
+
+template <typename... T> void bar (T... x)
+{
+ foo ([x...] { return x; }...); // { dg-error "not expanded|no parameter packs" }
+#if __cpp_init_captures >= 201803L
+ foo ([...y = x] { return y; }...); // { dg-error "not expanded|no parameter packs" "" { target c++20 } }
+#endif
+}
+
+void
+test ()
+{
+ bar ();
+ bar (1);
+ bar (2.0, 3LL, 4);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert16.C b/gcc/testsuite/g++.dg/cpp0x/static_assert16.C
new file mode 100644
index 0000000..5b40b77
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert16.C
@@ -0,0 +1,14 @@
+// PR c++/82239
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct C {
+ static constexpr int x = 5;
+ void f()
+ {
+ static_assert(0 < x, "");
+ static_assert(0 < (x), "");
+ static_assert(true || (0 < x), "");
+ static_assert(true || (0 < (x)), "");
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C
new file mode 100644
index 0000000..0e3f2be
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-90199.C
@@ -0,0 +1,28 @@
+// PR c++/90199
+// { dg-do compile { target c++14 } }
+// { dg-additional-options "-frounding-math" }
+
+template <typename>
+class complex;
+
+template <typename D7> constexpr complex<D7>
+operator+ (complex<D7> hd, complex<D7> qc)
+{
+ hd += qc;
+ return hd;
+}
+
+template <>
+class complex<float> {
+public:
+ constexpr complex
+ operator+= (complex rm)
+ {
+ jp += rm.jp;
+ return *this;
+ }
+
+ _Complex float jp;
+};
+
+constexpr complex<float> fl{3.3}, ka{1.1}, r0 = fl + ka;
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-96241.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-96241.C
new file mode 100644
index 0000000..107f2b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-96241.C
@@ -0,0 +1,47 @@
+// PR c++/96241
+// { dg-do compile { target c++14 } }
+
+#define assert(expr) static_assert (expr, #expr)
+
+enum E { o };
+
+struct S {
+ int e = o;
+};
+
+using T = S[3];
+
+constexpr struct S s[1][1][1] = { };
+assert (0 == s[0][0][0].e);
+
+constexpr int
+fn0 ()
+{
+ return T{}[0].e;
+}
+assert(fn0 () == 0);
+
+constexpr int
+fn1 ()
+{
+ S d[1];
+ int x = d[0].e;
+ return x;
+}
+assert(fn1 () == 0);
+
+constexpr int
+fn2 ()
+{
+ S d[1];
+ return d[0].e;
+}
+assert(fn2 () == 0);
+
+constexpr int
+fn3 ()
+{
+ struct X { int e = o; } d[1]{};
+ return d[0].e;
+}
+assert(fn3 () == 0);
diff --git a/gcc/testsuite/g++.dg/cpp1y/new1.C b/gcc/testsuite/g++.dg/cpp1y/new1.C
index aa5f647..fec0088 100644
--- a/gcc/testsuite/g++.dg/cpp1y/new1.C
+++ b/gcc/testsuite/g++.dg/cpp1y/new1.C
@@ -69,5 +69,5 @@ test_unused() {
delete p;
}
-/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 5 "cddce1"} } */
-/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 7 "cddce1"} } */
+/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 6 "cddce1"} } */
+/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ = operator new" 8 "cddce1"} } */
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction73.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction73.C
new file mode 100644
index 0000000..b37dded
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction73.C
@@ -0,0 +1,41 @@
+// PR c++/90210
+// { dg-do compile { target c++17 } }
+
+template<typename T> struct tuple { tuple(T); };
+template<typename T> explicit tuple(T t) -> tuple<T>;
+tuple t = { 1 }; // { dg-error "explicit deduction guide selected" }
+tuple t1 = tuple{ 1 };
+tuple t2{ 1 };
+
+template<typename T> struct A { A(T, T); };
+template<typename T> explicit A(T, T) -> A<int>;
+A a = {1, 1}; // { dg-error "explicit deduction guide selected" }
+A a1 = A{1, 1};
+A a2{1, 1};
+
+template<typename T, typename U>
+struct B {
+ B(T, U);
+};
+template<typename T, typename U>
+B(T, U) -> B<T, typename U::type>; // SFINAEd-out
+B b = { 1, 2 }; // OK
+B b1 = B{ 1, 2 }; // OK
+B b2{ 1, 2 }; // OK
+
+// Overriden implicit default constructor deduction guide:
+template<typename T>
+struct C { };
+explicit C() -> C<int>;
+C c = {}; // { dg-error "explicit deduction guide selected" }
+C c1 = C{};
+C c2{};
+
+// Overriden copy guide:
+template<typename T>
+struct D { };
+template<typename T> explicit D(D<T>) -> D<T>;
+D<int> d;
+D d1 = {d}; // { dg-error "explicit deduction guide selected" }
+D d2 = D{d};
+D d3{d};
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction74.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction74.C
new file mode 100644
index 0000000..fe11381
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction74.C
@@ -0,0 +1,31 @@
+// PR c++/97099
+// { dg-do compile { target c++17 } }
+// [temp.deduct.guide]p3: Two deduction guide declarations in the same
+// translation unit for the same class template shall not have equivalent
+// parameter-declaration-clauses.
+
+template<typename> struct S { };
+template<typename> struct X { };
+
+S() -> S<int>; // { dg-message "previously declared here|old declaration" }
+S() -> S<int>; // { dg-error "redeclared" }
+X() -> X<int>;
+S() -> S<float>; // { dg-error "ambiguating new declaration of" }
+
+S(bool) -> S<int>; // { dg-message "previously declared here" }
+explicit S(bool) -> S<int>; // { dg-error "redeclared" }
+
+explicit S(char) -> S<int>; // { dg-message "previously declared here" }
+S(char) -> S<int>; // { dg-error "redeclared" }
+
+template<typename T> S(T, T) -> S<int>; // { dg-message "previously declared here" }
+template<typename T> X(T, T) -> X<int>;
+template<typename T> S(T, T) -> S<int>; // { dg-error "redeclared" }
+
+// OK: Use SFINAE.
+template<typename T> S(T) -> S<typename T::foo>;
+template<typename T> S(T) -> S<typename T::bar>;
+
+// OK: Non-template wins.
+S(int) -> S<int>;
+template<typename T = int> S(int) -> S<char>;
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-96575.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-96575.C
new file mode 100644
index 0000000..5820c18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-96575.C
@@ -0,0 +1,19 @@
+// PR c++/96575
+// { dg-do compile { target c++17 } }
+
+struct S { };
+
+constexpr auto g = [] (S s) {
+ if (__builtin_is_constant_evaluated())
+ return s;
+};
+
+template <class T>
+constexpr auto f (T cb) {
+ return [=] {
+ auto ret = cb({});
+ return ret;
+ }();
+}
+
+constexpr auto x = f(g);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-class2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-class2.C
new file mode 100644
index 0000000..0ed9eb0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-class2.C
@@ -0,0 +1,11 @@
+// PR c++/96229
+// { dg-do compile { target c++20 } }
+
+template <class T> concept Int = requires { T{0}; };
+template <template <Int> class P> struct X { };
+template <Int> struct Y : X<Y> { };
+ struct Z { };
+ struct W { int i; };
+
+Y<Z> z; // { dg-error "constraint" }
+Y<W> w;
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-defarg2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-defarg2.C
new file mode 100644
index 0000000..a63ca4e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-defarg2.C
@@ -0,0 +1,13 @@
+// PR c++/97052
+// { dg-do compile { target c++20 } }
+
+template<typename T, typename U = typename T::type>
+concept C = true;
+
+constexpr bool f(C auto) {
+ return true;
+}
+
+static_assert(f(0));
+
+C auto x = 0;
diff --git a/gcc/testsuite/g++.dg/cpp2a/consteval18.C b/gcc/testsuite/g++.dg/cpp2a/consteval18.C
new file mode 100644
index 0000000..586fede
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/consteval18.C
@@ -0,0 +1,26 @@
+// PR c++/96994
+// { dg-do run { target c++20 } }
+
+struct A { consteval A () { i = 1; } consteval A (int x) : i (x) {} int i = 0; };
+struct B { constexpr B () { i = 1; } constexpr B (int x) : i (x) {} int i = 0; };
+A const a;
+constexpr A b;
+B const c;
+A const constinit d;
+A const e = 2;
+constexpr A f = 3;
+B const g = 4;
+A const constinit h = 5;
+A i;
+B j;
+A k = 6;
+B l = 7;
+static_assert (b.i == 1 && f.i == 3);
+
+int
+main()
+{
+ if (a.i != 1 || c.i != 1 || d.i != 1 || e.i != 2 || g.i != 4 || h.i != 5
+ || i.i != 1 || j.i != 1 || k.i != 6 || l.i != 7)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-init19.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-init19.C
new file mode 100644
index 0000000..d354c5a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-init19.C
@@ -0,0 +1,15 @@
+// PR c++/97328
+// { dg-do compile { target c++20 } }
+
+struct vector {
+ struct storage {
+ int t;
+ constexpr storage() {}
+ } data[8];
+};
+
+constexpr auto foo() {
+ vector i;
+ return i;
+}
+auto val = foo();
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-init20.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-init20.C
new file mode 100644
index 0000000..1a6ed8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-init20.C
@@ -0,0 +1,15 @@
+// PR c++/97328
+// { dg-do compile { target c++20 } }
+
+struct vector {
+ union storage {
+ int t;
+ constexpr storage() {}
+ } data[8];
+};
+
+constexpr auto foo() {
+ vector i;
+ return i;
+}
+auto val = foo();
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C
new file mode 100644
index 0000000..fd6f607
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new14.C
@@ -0,0 +1,73 @@
+// PR c++/97195
+// { dg-do compile { target c++20 } }
+
+namespace std
+{
+ typedef __SIZE_TYPE__ size_t;
+
+ template <typename T>
+ struct allocator
+ {
+ constexpr allocator () noexcept {}
+
+ constexpr T *allocate (size_t n)
+ { return static_cast<T *> (::operator new (n * sizeof(T))); }
+
+ constexpr void
+ deallocate (T *p, size_t n)
+ { ::operator delete (p); }
+ };
+
+ template <typename T, typename U = T &&>
+ U __declval (int);
+ template <typename T>
+ T __declval (long);
+ template <typename T>
+ auto declval () noexcept -> decltype (__declval<T> (0));
+
+ template <typename T>
+ struct remove_reference
+ { typedef T type; };
+ template <typename T>
+ struct remove_reference<T &>
+ { typedef T type; };
+ template <typename T>
+ struct remove_reference<T &&>
+ { typedef T type; };
+
+ template <typename T>
+ constexpr T &&
+ forward (typename std::remove_reference<T>::type &t) noexcept
+ { return static_cast<T&&> (t); }
+
+ template<typename T>
+ constexpr T &&
+ forward (typename std::remove_reference<T>::type &&t) noexcept
+ { return static_cast<T&&> (t); }
+
+ template <typename T, typename... A>
+ constexpr auto
+ construct_at (T *l, A &&... a)
+ noexcept (noexcept (::new ((void *) 0) T (std::declval<A> ()...)))
+ -> decltype (::new ((void *) 0) T (std::declval<A> ()...))
+ { return ::new ((void *) l) T (std::forward<A> (a)...); }
+
+ template <typename T>
+ constexpr inline void
+ destroy_at (T *l)
+ { l->~T (); }
+}
+
+inline void *operator new (std::size_t, void *p) noexcept
+{ return p; }
+
+constexpr bool
+foo ()
+{
+ int a = 5;
+ int *p = std::construct_at (&a, -1);
+ if (p[0] != -1)
+ throw 1;
+ return true;
+}
+constexpr bool b = foo ();
diff --git a/gcc/testsuite/g++.dg/cpp2a/fn-template21.C b/gcc/testsuite/g++.dg/cpp2a/fn-template21.C
new file mode 100644
index 0000000..7b3f26b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/fn-template21.C
@@ -0,0 +1,24 @@
+// PR c++/97010
+// { dg-do compile { target c++20 } }
+
+namespace M {
+ struct S { int x; };
+ S foo ();
+
+ template<typename>
+ void get (S);
+}
+
+template<typename T>
+void bar (const T& t)
+{
+ get<int>(t);
+}
+
+int
+main ()
+{
+ auto a = M::foo ();
+ get<int>(a);
+ bar (a);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/fn-template22.C b/gcc/testsuite/g++.dg/cpp2a/fn-template22.C
new file mode 100644
index 0000000..62cc81d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/fn-template22.C
@@ -0,0 +1,25 @@
+// PR c++/97010
+// { dg-do compile { target c++20 } }
+
+namespace M {
+ struct S { int x; };
+ S foo ();
+
+// Test not-found-by-ADL scenario.
+// template<typename>
+// void get (S);
+}
+
+template<typename T>
+void bar (const T& t)
+{
+ get<int>(t); // { dg-error ".get. was not declared in this scope" }
+}
+
+int
+main ()
+{
+ auto a = M::foo ();
+ get<int>(a); // { dg-error ".get. was not declared in this scope" }
+ bar (a);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C
new file mode 100644
index 0000000..93f5e25
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C
@@ -0,0 +1,11 @@
+// PR c++/95844
+// { dg-do compile { target c++20 } }
+
+#include <compare>
+
+struct F {
+ [[deprecated("oh no")]] std::strong_ordering operator<=>(const F&) const = default; // { dg-message "" }
+};
+void use_f(F f) {
+ void(f == f); // { dg-warning "deprecated" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/typename18.C b/gcc/testsuite/g++.dg/cpp2a/typename18.C
new file mode 100644
index 0000000..9946866
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/typename18.C
@@ -0,0 +1,21 @@
+// PR c++/97297
+// { dg-do compile { target c++20 } }
+
+template <typename T>
+struct S {
+ int simple(T::type);
+
+ template <typename U>
+ int member(U::type);
+};
+
+template <typename T>
+int S<T>::simple(T::type) {
+ return 1;
+}
+
+template <typename T>
+template <typename U>
+int S<T>::member(U::type) {
+ return 2;
+}
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/align-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/align-1.C
index fec0fec..c87a998 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/align-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/align-1.C
@@ -1,5 +1,5 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
int __attribute__((__aligned__(64))) i;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/align-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/align-2.C
index c5b74db..3b0f462 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/align-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/align-2.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
typedef int __attribute__((__aligned__(64))) i_t;
i_t i;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/align-3.C b/gcc/testsuite/g++.dg/debug/dwarf2/align-3.C
index eceee07..32cb390 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/align-3.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/align-3.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
typedef int int_t;
typedef int_t __attribute__((__aligned__(64))) i_t;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/align-4.C b/gcc/testsuite/g++.dg/debug/dwarf2/align-4.C
index 851a58c..a2905d0 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/align-4.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/align-4.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 2 } }
struct tt {
int __attribute__((__aligned__(64))) i;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/align-5.C b/gcc/testsuite/g++.dg/debug/dwarf2/align-5.C
index e74146ce..5e883b5 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/align-5.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/align-5.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
struct tt {
int i;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/align-6.C b/gcc/testsuite/g++.dg/debug/dwarf2/align-6.C
index ff118e4..3384ce7 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/align-6.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/align-6.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
struct tt {
int i;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-1.C
index e798b49..6127dcd 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-1.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times "0x1\[ \t\]\[^\n\]* DW_AT_defaulted" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "0x1\[ \t\]\[^\n\]* DW_AT_defaulted" 1 } }
struct Foo
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-2.C
index 5b56949..73c37b0 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-2.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times "0x2\[ \t\]\[^\n\]* DW_AT_defaulted" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "0x2\[ \t\]\[^\n\]* DW_AT_defaulted" 1 } }
struct Foo
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-3.C b/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-3.C
index 190fe50..5537edd 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-3.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/defaulted-member-function-3.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-not " DW_AT_defaulted" { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-not " DW_AT_defaulted" } }
struct Foo
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
index 9a88e28..85f74a9 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-1.C
@@ -1,11 +1,11 @@
// { dg-do compile { target c++17 } }
// { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
// { dg-require-weak "" }
-// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_declaration" 6 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_specification" 6 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 6 } }
+// { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 } }
+// { dg-final { scan-assembler-times " DW_AT_declaration" 6 } }
+// { dg-final { scan-assembler-times " DW_AT_specification" 6 } }
+// { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 } }
inline int a;
struct S
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-2.C
index cdb2696..63052d6 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-2.C
@@ -1,7 +1,7 @@
// { dg-do compile { target c++17 } }
// { dg-options "-O -gdwarf-5 -dA -gno-strict-dwarf" }
// { dg-require-weak "" }
-// { dg-final { scan-assembler-not "DW_TAG_member" { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-not "DW_TAG_member" } }
inline int a;
struct S
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
index 52ed5b6..7225258 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-var-3.C
@@ -2,12 +2,12 @@
// { dg-do compile { target c++17 } }
// { dg-options "-O -gdwarf-5 -dA -gno-strict-dwarf -fno-eliminate-unused-debug-symbols" }
// { dg-require-weak "" }
-// { dg-final { scan-assembler-times " DW_AT_inline \\(0x3\\)" 2 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 4 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_declaration" 6 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_specification" 6 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times " DW_AT_inline \\(0x3\\)" 2 } }
+// { dg-final { scan-assembler-times "0x3\[^\n\r]* DW_AT_inline" 4 } }
+// { dg-final { scan-assembler-times "0x1\[^\n\r]* DW_AT_inline" 2 } }
+// { dg-final { scan-assembler-times " DW_AT_declaration" 6 } }
+// { dg-final { scan-assembler-times " DW_AT_specification" 6 } }
+// { dg-final { scan-assembler-times " DW_AT_\[^\n\r]*linkage_name" 7 } }
inline int a;
struct S
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/noreturn-function.C b/gcc/testsuite/g++.dg/debug/dwarf2/noreturn-function.C
index 722ee13..73a0af4 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/noreturn-function.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/noreturn-function.C
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
// Expect DW_AT_noreturn once in .debug_info and once in .debug_abbrev
-// { dg-final { scan-assembler-times "DW_AT_noreturn" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DW_AT_noreturn" 2 } }
class Foo
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C
index bebf7fb..79c7baa 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 { xfail { powerpc-ibm-aix* } } } }
-// { dg-final { scan-assembler-times " DW_AT_use_location" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 } }
+// { dg-final { scan-assembler-times " DW_AT_use_location" 1 } }
// { dg-final { scan-assembler-not " DW_AT_reference" } }
struct S;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C
index 43939c9..dd1f457 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C
@@ -1,7 +1,7 @@
// { dg-do compile { target c++11 } }
// { dg-options "-g -gno-strict-dwarf -dA" }
-// { dg-final { scan-assembler-times " DW_AT_reference" 1 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 1 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times " DW_AT_reference" 1 } }
+// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 1 } }
struct S
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ref-3.C b/gcc/testsuite/g++.dg/debug/dwarf2/ref-3.C
index d7932d8..6294d02 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/ref-3.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/ref-3.C
@@ -1,10 +1,10 @@
// { dg-do compile { target c++11 } }
// { dg-options "-g -gno-strict-dwarf -dA" }
-// { dg-final { scan-assembler-times " DW_AT_reference" 5 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 5 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_subroutine_type" 6 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 7 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times " DW_AT_use_location" 1 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times " DW_AT_reference" 5 } }
+// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 5 } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_subroutine_type" 6 } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 7 } }
+// { dg-final { scan-assembler-times " DW_AT_use_location" 1 } }
struct S
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ref-4.C b/gcc/testsuite/g++.dg/debug/dwarf2/ref-4.C
index 00cf81f..b1fe0e4 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/ref-4.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/ref-4.C
@@ -1,8 +1,8 @@
// { dg-do compile { target c++11 } }
// { dg-options "-g -gno-strict-dwarf -dA" }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_typedef" 2 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 2 { xfail *-*-aix* } } }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_subroutine_type" 1 { xfail *-*-aix* } } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_typedef" 2 } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 2 } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_subroutine_type" 1 } }
struct A { void foo (); int a; };
typedef void (A::*PMF) ();
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C
index aba02b0..046e401 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 { xfail { powerpc-ibm-aix* } } } }
-// { dg-final { scan-assembler-times " DW_AT_reference" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 } }
+// { dg-final { scan-assembler-times " DW_AT_reference" 2 } }
// { dg-final { scan-assembler-not " DW_AT_use_location" } }
/* It is not clear what if anything we should output for
DW_AT_use_location in a pointer to member function, so we don't
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C
index 3cd424e..f77af63 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 { xfail { powerpc-ibm-aix* } } } }
-// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 } }
+// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 2 } }
// { dg-final { scan-assembler-not " DW_AT_use_location" } }
/* It is not clear what if anything we should output for
DW_AT_use_location in a pointer to member function, so we don't
diff --git a/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C b/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C
new file mode 100644
index 0000000..bb1327f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/ptrtomem1.C
@@ -0,0 +1,31 @@
+// PR c++/97406
+// { dg-do compile { target c++20 } }
+
+struct X {
+ void f() { }
+ int a;
+ int arr[5];
+};
+
+// Duplicated so that I can check dg-message.
+template<typename T>
+requires (sizeof(T)==1) // { dg-message {\[with T = void \(X::\*\)\(\)\]} }
+void f1(T)
+{ }
+
+template<typename T>
+requires (sizeof(T)==1) // { dg-message {\[with T = int X::\*\]} }
+void f2(T)
+{ }
+
+template<typename T>
+requires (sizeof(T)==1) // dg-message {\[with T = int \(X::\*\)\[5\]\]} }
+void f3(T)
+{ }
+
+int main()
+{
+ f1(&X::f); // { dg-error "no matching function for call" }
+ f2(&X::a); // { dg-error "no matching function for call" }
+ f3(&X::arr); // { dg-error "no matching function for call" }
+}
diff --git a/gcc/testsuite/g++.dg/diagnostic/ptrtomem2.C b/gcc/testsuite/g++.dg/diagnostic/ptrtomem2.C
new file mode 100644
index 0000000..f3b29a0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/ptrtomem2.C
@@ -0,0 +1,14 @@
+// PR c++/85901
+// { dg-do compile { target c++11 } }
+
+template<class> struct A;
+
+template<class U>
+struct A<int U::*> {
+ template<class TT>
+ static auto c(int U::*p, TT o) -> decltype(o.*p); // { dg-message {A<int U::\*>} }
+};
+
+struct X {};
+
+int x = A<int X::*>::c(); // { dg-error "no matching function for call" }
diff --git a/gcc/testsuite/g++.dg/ext/timevar1.C b/gcc/testsuite/g++.dg/ext/timevar1.C
index 3f891a5..d68a8b7 100644
--- a/gcc/testsuite/g++.dg/ext/timevar1.C
+++ b/gcc/testsuite/g++.dg/ext/timevar1.C
@@ -2,8 +2,10 @@
// { dg-options "-ftime-report" }
// { dg-allow-blank-lines-in-output 1 }
// { dg-prune-output "Time variable" }
-// { dg-prune-output " kB" }
+// { dg-prune-output "k" }
+// { dg-prune-output " 0 " }
// { dg-prune-output "checks" }
+// { dg-prune-output "\[0-9\]+%" }
void
foo ()
diff --git a/gcc/testsuite/g++.dg/ext/timevar2.C b/gcc/testsuite/g++.dg/ext/timevar2.C
index dd96d45..7d3f121 100644
--- a/gcc/testsuite/g++.dg/ext/timevar2.C
+++ b/gcc/testsuite/g++.dg/ext/timevar2.C
@@ -1,8 +1,10 @@
// PR c++/57524
// { dg-options "-ftime-report" }
// { dg-prune-output "Time variable" }
-// { dg-prune-output " kB" }
+// { dg-prune-output "k" }
+// { dg-prune-output " 0 " }
// { dg-prune-output "checks" }
+// { dg-prune-output "\[0-9\]+%" }
namespace detail {
namespace indirect_traits {}
diff --git a/gcc/testsuite/g++.dg/gcov/pr97069.C b/gcc/testsuite/g++.dg/gcov/pr97069.C
new file mode 100644
index 0000000..040e336
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/pr97069.C
@@ -0,0 +1,20 @@
+// PR gcov-profile/97069
+// { dg-options "--coverage" }
+// { dg-do run { target native } }
+
+# 0 "pr97069.C"
+# 0 "<built-in>"
+# 0 "<command-line>"
+# 1 "/usr/include/stdc-predef.h" 1 3 4
+# 0 "<command-line>" 2
+# 1 "pr97069.C"
+int main()
+{
+ return 0;
+}
+# 0 "pr97069.C"
+void zero_line_directive()
+{
+}
+
+// { dg-final { run-gcov pr97069.C } }
diff --git a/gcc/testsuite/g++.dg/inherit/pr97268.C b/gcc/testsuite/g++.dg/inherit/pr97268.C
new file mode 100644
index 0000000..79a809c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/pr97268.C
@@ -0,0 +1,60 @@
+// { dg-do compile { target c++11 } }
+// { dg-additional-options -Wall }
+// PR 97268, ICE due to broken inherited-from-virtual base-ctor
+class Handle {
+public:
+ explicit Handle(char const *const &) { }
+ ~Handle() {}
+ Handle(const Handle &) = delete;
+ Handle &operator=(const Handle &) = delete;
+
+protected:
+ int lasterr = 0;
+
+};
+
+struct ObjectBase {
+ ~ObjectBase() {}
+
+protected:
+ explicit ObjectBase(const char *lc_, int ln_, Handle &h, unsigned)
+ : handle(h) { }
+
+protected:
+
+ Handle &handle;
+};
+
+template <bool CACHED>
+struct Object : virtual public ObjectBase {
+ explicit Object(const char *lc_, int ln_, Handle &env);
+
+protected:
+ using ObjectBase::ObjectBase;
+
+};
+
+class BetterObjectBase : virtual public ObjectBase {
+protected:
+ BetterObjectBase(const char *lc_, int ln_, Handle &env)
+ : ObjectBase("", 0, env, 0) {}
+
+};
+
+template <bool CACHED>
+class BetterObject : public Object<CACHED>, public BetterObjectBase {
+public:
+ BetterObject(Handle &env)
+ : ObjectBase("", 0, env, 0)
+ , Object<CACHED>("", 0, env, 0)
+ , BetterObjectBase("", 0, env) {} // { dg-error "use of deleted function" }
+
+};
+
+int main() {
+ Handle h("handle");
+
+ BetterObject<true> B(h);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/init/pr42844.C b/gcc/testsuite/g++.dg/init/pr42844.C
index 9b7ed05..d616f45 100644
--- a/gcc/testsuite/g++.dg/init/pr42844.C
+++ b/gcc/testsuite/g++.dg/init/pr42844.C
@@ -49,7 +49,7 @@ template <class T>
void g ()
{
T const t; // { dg-error "uninitialized 'const" }
- extern T const text;
+ extern T const text; // { dg-error "conflicting declaration" }
}
template void g<H> ();
diff --git a/gcc/testsuite/g++.dg/init/strlen.C b/gcc/testsuite/g++.dg/init/strlen.C
index aa8950e..cc650d6 100644
--- a/gcc/testsuite/g++.dg/init/strlen.C
+++ b/gcc/testsuite/g++.dg/init/strlen.C
@@ -29,7 +29,7 @@ test_dynamic_type (S *p)
// distinguish invalid cases from ones like it that might be valid.
// If/when GIMPLE changes to make this possible this test can be
// removed.
- char *q = new (p->a) char [16];
+ char *q = new (p->a) char [16]; // { dg-warning "\\\[-Wplacement-new" }
init (q);
diff --git a/gcc/testsuite/g++.dg/lookup/extern-redecl1.C b/gcc/testsuite/g++.dg/lookup/extern-redecl1.C
index 18e675b..f3e9b69 100644
--- a/gcc/testsuite/g++.dg/lookup/extern-redecl1.C
+++ b/gcc/testsuite/g++.dg/lookup/extern-redecl1.C
@@ -1,18 +1,18 @@
extern int X; // { dg-message "previous declaration" }
-extern int Y (int); // { dg-message "previous declaration" }
+extern int Y (int); // { dg-message "old declaration" }
extern int Y (float);
-static int Z (int s)
+static int Z (int s) // { dg-message "old declaration" }
{
return s;
}
void Foo ()
{
- extern char X; // { dg-error "local external declaration" }
- extern char Y (int); // { dg-error "local external declaration" }
+ extern char X; // { dg-error "conflicting declaration" }
+ extern char Y (int); // { dg-error "ambiguating new declaration" }
extern int Y (float);
extern void Y (double);
- extern char Z (int);
+ extern char Z (int); // { dg-error "ambiguating new declaration" }
}
diff --git a/gcc/testsuite/g++.dg/lookup/extern-redecl2.C b/gcc/testsuite/g++.dg/lookup/extern-redecl2.C
new file mode 100644
index 0000000..9c5caa6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/extern-redecl2.C
@@ -0,0 +1,18 @@
+// PR 97395
+// ICE injecting hidden decl in wrong namespace
+
+namespace pr {
+ template<typename WW>
+ void
+ kp ()
+ {
+ extern WW hz;
+ }
+
+ void
+ n5 ()
+ {
+ kp<int[]> ();
+ kp<int[1]> ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lookup/koenig15.C b/gcc/testsuite/g++.dg/lookup/koenig15.C
index f317c01..6bf916a 100644
--- a/gcc/testsuite/g++.dg/lookup/koenig15.C
+++ b/gcc/testsuite/g++.dg/lookup/koenig15.C
@@ -4,10 +4,12 @@
namespace N {
struct S { };
void f(S);
+ void g(S);
}
namespace M {
void f(int);
+ void g(int);
}
void
@@ -40,6 +42,6 @@ void
fn3 ()
{
N::S s;
- extern void (*f)(char);
- f (s); // { dg-error "cannot convert" }
+ extern void (*g)(char);
+ g (s); // { dg-error "cannot convert" }
}
diff --git a/gcc/testsuite/g++.dg/lookup/local-extern.C b/gcc/testsuite/g++.dg/lookup/local-extern.C
new file mode 100644
index 0000000..1d6d861
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/local-extern.C
@@ -0,0 +1,13 @@
+int foo ()
+{
+ extern int baz (int i = 5);
+ return baz ();
+}
+
+int baz (int i = 0);
+
+int bar ()
+{
+ extern int baz (int i = 6);
+ return baz ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr95677.C b/gcc/testsuite/g++.dg/lto/pr95677.C
new file mode 100644
index 0000000..520ef04
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr95677.C
@@ -0,0 +1,19 @@
+// PR c++/95677
+
+// { dg-do link }
+// { dg-require-effective-target lto }
+// { dg-options "-flto" }
+
+
+
+namespace {
+ void foo() {
+ extern int xx; // injects a *static*
+ xx = 0;
+ }
+ int xx = 1;
+}
+
+int main() {
+ xx = 2;
+}
diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr-2.C b/gcc/testsuite/g++.dg/no-stack-protector-attr-2.C
new file mode 100644
index 0000000..6db6fef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/no-stack-protector-attr-2.C
@@ -0,0 +1,7 @@
+/* PR c/94722 */
+/* { dg-do compile } */
+
+int __attribute__((no_stack_protector, stack_protect)) c() /* { dg-warning "ignoring attribute 'stack_protect' because it conflicts with attribute 'no_stack_protector'" } */
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
new file mode 100644
index 0000000..dd9cd49
--- /dev/null
+++ b/gcc/testsuite/g++.dg/no-stack-protector-attr-3.C
@@ -0,0 +1,23 @@
+/* PR c/94722 */
+/* Test that stack protection is disabled via no_stack_protector attribute. */
+
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fstack-protector-explicit" } */
+
+/* { dg-do compile } */
+
+int __attribute__((no_stack_protector)) foo()
+{
+ int a;
+ char b[34];
+ return 0;
+}
+
+int __attribute__((stack_protect)) bar()
+{
+ int a;
+ char b[34];
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times "stack_chk_fail" 1 } } */
diff --git a/gcc/testsuite/g++.dg/no-stack-protector-attr.C b/gcc/testsuite/g++.dg/no-stack-protector-attr.C
new file mode 100644
index 0000000..e5105bf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/no-stack-protector-attr.C
@@ -0,0 +1,16 @@
+/* PR c/94722 */
+/* Test that stack protection is disabled via no_stack_protector attribute. */
+
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fstack-protector-all" } */
+
+/* { dg-do compile } */
+
+int __attribute__((no_stack_protector)) c()
+{
+ int a;
+ char b[34];
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "stack_chk_fail" } } */
diff --git a/gcc/testsuite/g++.dg/opt/pr97315-1.C b/gcc/testsuite/g++.dg/opt/pr97315-1.C
new file mode 100644
index 0000000..5a618d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr97315-1.C
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-exceptions" } */
+
+typedef struct tree_node *tree;
+enum tree_code { RECORD_TYPE, QUAL_UNION_TYPE };
+enum tree_code_class {};
+struct tree_base {
+ tree_code code : 16;
+};
+struct tree_node {
+ tree_base base;
+};
+extern tree_code_class tree_code_type[];
+void tree_check_failed() __attribute__((__noreturn__));
+tree tree_check3(tree __t, tree_code __c1, tree_code __c3) {
+ if (__t->base.code != __c1 && __t->base.code != __c3)
+ tree_check_failed();
+ return __t;
+}
+tree add_type_duplicate_type;
+void add_type_duplicate() {
+ if (tree_code_type[add_type_duplicate_type->base.code])
+ if (add_type_duplicate_type->base.code == RECORD_TYPE)
+ for (;
+ tree_check3(add_type_duplicate_type, RECORD_TYPE, QUAL_UNION_TYPE);)
+ tree_check3(add_type_duplicate_type, RECORD_TYPE, QUAL_UNION_TYPE);
+}
diff --git a/gcc/testsuite/g++.dg/other/i386-2.C b/gcc/testsuite/g++.dg/other/i386-2.C
index 04d5fec..449f30d 100644
--- a/gcc/testsuite/g++.dg/other/i386-2.C
+++ b/gcc/testsuite/g++.dg/other/i386-2.C
@@ -1,11 +1,12 @@
/* { 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" } */
+/* { 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" } */
/* 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,
popcntintrin.h, fmaintrin.h, pkuintrin.h, avx5124fmapsintrin.h,
avx5124vnniwintrin.h, avx512vpopcntdqintrin.h gfniintrin.h
avx512bitalgintrin.h, avx512vp2intersectintrin.h, tsxldtrkintrin.h,
+ amxtileintrin.h, amxint8intrin.h, amxbf16intrin.h,
avx512vp2intersectvlintrin.h and mm_malloc.h.h are usable
with -O -pedantic-errors. */
diff --git a/gcc/testsuite/g++.dg/other/i386-3.C b/gcc/testsuite/g++.dg/other/i386-3.C
index f40172e..29e9891 100644
--- a/gcc/testsuite/g++.dg/other/i386-3.C
+++ b/gcc/testsuite/g++.dg/other/i386-3.C
@@ -1,11 +1,12 @@
/* { 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" } */
+/* { 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" } */
/* 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,
popcntintrin.h, fmaintrin.h, pkuintrin.h, avx5124fmapsintrin.h,
avx5124vnniwintrin.h, avx512vpopcntdqintrin.h gfniintrin.h
avx512bitalgintrin.h, avx512vp2intersectintrin.h, tsxldtrkintrin.h,
+ amxtileintrin.h, amxint8intrin.h, amxbf16intrin.h,
avx512vp2intersectvlintrin.h and mm_malloc.h are usable
with -O -fkeep-inline-functions. */
diff --git a/gcc/testsuite/g++.dg/other/nested-extern-1.C b/gcc/testsuite/g++.dg/other/nested-extern-1.C
index 6533a2a..6c879e5 100644
--- a/gcc/testsuite/g++.dg/other/nested-extern-1.C
+++ b/gcc/testsuite/g++.dg/other/nested-extern-1.C
@@ -1,17 +1,21 @@
/* { dg-do run } */
-// { dg-additional-sources "nested-extern.cc" }
+// { dg-additional-options "-fpermissive" }
+// { dg-additional-sources "nested-extern-1.cc" }
/* PR 31775 */
-extern "C" void abort();
+extern int *p_otheri;
extern int *p;
int main()
{
- extern int i;
+ extern int i; // { dg-message "previous declaration" }
i = 1;
*p = 2;
- if (i == 2)
- abort ();
+ if (i != 2)
+ return 1;
+ if (p_otheri != p)
+ return 2;
return 0;
}
-static int i;
+// This is extern because of the injection above.
+static int i; // { dg-warning ".extern. and later .static" }
int *p = &i;
diff --git a/gcc/testsuite/g++.dg/other/nested-extern-1.cc b/gcc/testsuite/g++.dg/other/nested-extern-1.cc
new file mode 100644
index 0000000..7d70072
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/nested-extern-1.cc
@@ -0,0 +1,3 @@
+extern int i;
+
+int *p_otheri = &i;
diff --git a/gcc/testsuite/g++.dg/other/nested-extern-2.C b/gcc/testsuite/g++.dg/other/nested-extern-2.C
index 58f53e0..acd78ff 100644
--- a/gcc/testsuite/g++.dg/other/nested-extern-2.C
+++ b/gcc/testsuite/g++.dg/other/nested-extern-2.C
@@ -1,18 +1,27 @@
/* { dg-do run } */
-// { dg-additional-sources "nested-extern.cc" }
/* PR 31775 */
-extern "C" void abort();
-static int i;
-int *p = &i;
+// { dg-additional-sources "nested-extern-2.cc" }
+extern int *p_otheri;
+static int i; // #1
+int *p_si = &i;
int main()
{
int i;
- {
+ int *p_ai = &i;
+ {
+ // This is an alias of #1, not a different object
extern int i;
- i = 1;
- *p = 2;
- if (i == 2)
- abort ();
+ int *p_ei = &i;
+
+ *p_si = 1;
+ *p_ai = 2;
+ *p_ei = 3;
+ if (*p_si != 3)
+ return 1;
+ if (*p_ai != 2)
+ return 2;
+ if (*p_otheri != 17)
+ return 3;
}
return 0;
}
diff --git a/gcc/testsuite/g++.dg/other/nested-extern-2.cc b/gcc/testsuite/g++.dg/other/nested-extern-2.cc
new file mode 100644
index 0000000..da43380
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/nested-extern-2.cc
@@ -0,0 +1,3 @@
+int i = 17; // never touched
+
+int *p_otheri = &i;
diff --git a/gcc/testsuite/g++.dg/other/nested-extern.cc b/gcc/testsuite/g++.dg/other/nested-extern.cc
deleted file mode 100644
index 048f715..0000000
--- a/gcc/testsuite/g++.dg/other/nested-extern.cc
+++ /dev/null
@@ -1 +0,0 @@
-int i;
diff --git a/gcc/testsuite/g++.dg/parse/pr96258.C b/gcc/testsuite/g++.dg/parse/pr96258.C
new file mode 100644
index 0000000..1b642e1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr96258.C
@@ -0,0 +1,5 @@
+// { dg-additional-options -fopenmp }
+// { dg-require-effective-target fopenmp }
+#pragma omp declare simd // { dg-error "not immediately followed by" }
+
+// { dg-error "-:expected unqualified-id" "" { target *-*-* } .+1 }
diff --git a/gcc/testsuite/g++.dg/pr94314.C b/gcc/testsuite/g++.dg/pr94314.C
index 4e5ae12..7246712 100644
--- a/gcc/testsuite/g++.dg/pr94314.C
+++ b/gcc/testsuite/g++.dg/pr94314.C
@@ -78,5 +78,5 @@ int main(){
return 0;
}
-/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 1 "cddce1"} } */
+/* { dg-final { scan-tree-dump-not "Deleting : operator delete" "cddce1"} } */
/* { dg-final { scan-tree-dump-not "Deleting : B::operator delete" "cddce1"} } */
diff --git a/gcc/testsuite/g++.dg/pr97538.C b/gcc/testsuite/g++.dg/pr97538.C
new file mode 100644
index 0000000..b29b1e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr97538.C
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-fno-guess-branch-probability -fno-tree-pta -O1" }
+
+void *b, *c;
+struct H {
+ virtual bool accept(const char *, unsigned long, int *, bool);
+};
+char accept_bt[1], accept_cd[1];
+int accept_cb;
+bool accept_cb_0;
+class t : H {
+ bool accept(const char *, unsigned long bd, int *bg, bool) {
+ long bu = sizeof(int) + bd;
+ char *bw = bu > sizeof(accept_bt) ? new char : accept_bt,
+ *cf = bd ? new char : accept_cd;
+ __builtin___memcpy_chk(b, c, bd, 0);
+ if (bw != accept_bt)
+ delete bw;
+ bool ci = cj((int *)cf, bg), atran = bp && accept_cb_0;
+ atran &&ci &&cm(&accept_cb);
+ return ci;
+ }
+ bool cj(int *, int *);
+ bool cm(int *);
+ bool bp;
+};
+void bj() { new t; }
diff --git a/gcc/testsuite/g++.dg/spellcheck-inttypes.C b/gcc/testsuite/g++.dg/spellcheck-inttypes.C
index 84bfc12..fea3096 100644
--- a/gcc/testsuite/g++.dg/spellcheck-inttypes.C
+++ b/gcc/testsuite/g++.dg/spellcheck-inttypes.C
@@ -1,4 +1,7 @@
/* { dg-options "-std=c++11" } */
+#ifdef _AIX
+#define _STD_TYPES_T
+#endif
#include <cstdio>
#include <cstdint>
/* Missing <cinttypes>. */
diff --git a/gcc/testsuite/g++.dg/spellcheck-typenames.C b/gcc/testsuite/g++.dg/spellcheck-typenames.C
index 6adf724..ff53ecc 100644
--- a/gcc/testsuite/g++.dg/spellcheck-typenames.C
+++ b/gcc/testsuite/g++.dg/spellcheck-typenames.C
@@ -54,11 +54,11 @@ struct some_thing test_6; // { dg-error "aggregate 'some_thing test_6' has incom
{ dg-end-multiline-output "" } */
typedef long int64_t;
-int64 i; // { dg-error "1: 'int64' does not name a type; did you mean 'int64_t'?" }
+int64 i; // { dg-error "1: 'int64' does not name a type; did you mean 'int'?" }
/* { dg-begin-multiline-output "" }
int64 i;
^~~~~
- int64_t
+ int
{ dg-end-multiline-output "" } */
/* Verify that gcc doesn't offer nonsensical suggestions. */
diff --git a/gcc/testsuite/g++.dg/template/alignof3.C b/gcc/testsuite/g++.dg/template/alignof3.C
new file mode 100644
index 0000000..e573727
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/alignof3.C
@@ -0,0 +1,13 @@
+// PR c++/88115
+// { dg-do compile { target c++11 } }
+
+template<int __v>
+struct integral_constant {
+ static constexpr int value = __v;
+};
+
+template <class T> using StdAlignOf = integral_constant<alignof(T)>;
+template <class T> using GCCAlignOf = integral_constant<__alignof__(T)>;
+
+static_assert(StdAlignOf<double>::value == alignof(double), "");
+static_assert(GCCAlignOf<double>::value == __alignof__(double), "");
diff --git a/gcc/testsuite/g++.dg/template/local-fn3.C b/gcc/testsuite/g++.dg/template/local-fn3.C
new file mode 100644
index 0000000..2affe23
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/local-fn3.C
@@ -0,0 +1,17 @@
+// PR c++/97171
+
+// { dg-require-effective-target lto }
+// { dg-additional-options -flto }
+
+template <typename _UnaryOperation>
+void transform(_UnaryOperation);
+
+template <typename T>
+void Apply ()
+{
+ extern T Maker (void); // block-scope extern with dependent type
+
+ transform (Maker);
+}
+
+template void Apply<int> ();
diff --git a/gcc/testsuite/g++.dg/template/local-fn4.C b/gcc/testsuite/g++.dg/template/local-fn4.C
new file mode 100644
index 0000000..f8522dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/local-fn4.C
@@ -0,0 +1,21 @@
+// PR c++/97186
+// ICE in exception spec substitution
+// { dg-do compile { target c++11 } }
+
+template <class GG>
+struct no {
+ static void
+ tg ()
+ {
+ void
+ hk () noexcept (tg); // { dg-error "convert" }
+
+ hk ();
+ }
+};
+
+void
+os ()
+{
+ no<int> ().tg ();
+}
diff --git a/gcc/testsuite/g++.dg/template/local-var1.C b/gcc/testsuite/g++.dg/template/local-var1.C
new file mode 100644
index 0000000..4b3854b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/local-var1.C
@@ -0,0 +1,20 @@
+// PR c++/97186, related to c++/97171 but with a variable
+// { dg-do compile { target c++11 } }
+
+namespace
+{
+ template <typename WF>
+ void
+ ml ()
+ {
+ extern WF cr;
+
+ static_assert (sizeof (cr) == 12, "");
+ }
+
+ void
+ qc ()
+ {
+ ml<int[3]> ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/template/pr97460.C b/gcc/testsuite/g++.dg/template/pr97460.C
new file mode 100644
index 0000000..6dea489
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pr97460.C
@@ -0,0 +1,9 @@
+// PR 97460
+// ICE, null dereference
+
+class io_context {
+ template <int> class basic_executor_type;
+};
+template <int> class io_context::basic_executor_type {
+ template <int> friend class basic_executor_type;
+};
diff --git a/gcc/testsuite/g++.dg/template/scope5.C b/gcc/testsuite/g++.dg/template/scope5.C
index 629225c..cf23a08 100644
--- a/gcc/testsuite/g++.dg/template/scope5.C
+++ b/gcc/testsuite/g++.dg/template/scope5.C
@@ -57,10 +57,12 @@ enum { a = b::e<0>::f };
template <typename> class au;
template <typename av> struct ac : ao<av> { typedef c::e<am::an> aq; };
template <typename aw, typename i, typename ax> void ay(aw, i, ax) {
- au<c::e<ap<typename ak<i>::o>::f> > az();
+ // Not sure if this has been creduced from an initialization of a
+ // variable to a block-scope extern function decl
+ au<c::e<ap<typename ak<i>::o>::f> > az2();
}
void v() {
ad a;
- void az();
- ay(az, a, v);
+ void az1();
+ ay(az1, a, v);
}
diff --git a/gcc/testsuite/g++.dg/template/shadow3.C b/gcc/testsuite/g++.dg/template/shadow3.C
new file mode 100644
index 0000000..a5f2563
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/shadow3.C
@@ -0,0 +1,4 @@
+// PR c++/97511
+// { dg-do compile { target c++11 } }
+
+template <class Z> using Z = Z; // { dg-error "shadow|declaration" }
diff --git a/gcc/testsuite/g++.dg/torture/pr92421.C b/gcc/testsuite/g++.dg/torture/pr92421.C
index 2146e94..0489eb7 100644
--- a/gcc/testsuite/g++.dg/torture/pr92421.C
+++ b/gcc/testsuite/g++.dg/torture/pr92421.C
@@ -2,6 +2,10 @@
// { dg-do compile }
// { dg-additional-options "-Wno-return-type" }
+// VRP jump threading will create additional __builtin___memcpy_chk calls that
+// may be out of bounds.
+// { dg-additional-options "-Wno-stringop-overflow" }
+
typedef long a;
void *b, *c;
template <typename, typename> class d {};
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr96979.C b/gcc/testsuite/g++.dg/tree-ssa/pr96979.C
new file mode 100644
index 0000000..ec0f57a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr96979.C
@@ -0,0 +1,48 @@
+/* PR tree-optimization/96979 */
+/* { dg-do compile } */
+/* { dg-options "-std=c++17 -O2" } */
+
+using u64 = unsigned long long;
+
+constexpr inline u64
+foo (const char *str) noexcept
+{
+ u64 value = 0xcbf29ce484222325ULL;
+ for (u64 i = 0; str[i]; i++)
+ value = (value ^ u64(str[i])) * 0x100000001b3ULL;
+ return value;
+}
+
+struct V
+{
+ enum W
+ {
+#define A(n) n,
+#define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
+#define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
+#define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9)
+#define E D(foo1) D(foo2) D(foo3)
+ E
+ last
+ };
+
+ constexpr static W
+ bar (const u64 h) noexcept
+ {
+ switch (h)
+ {
+#undef A
+#define F(n) #n
+#define A(n) case foo (F(n)): return n;
+ E
+ }
+ return last;
+ }
+};
+
+int
+baz (const char *s)
+{
+ const u64 h = foo (s);
+ return V::bar (h);
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pta-delete-1.C b/gcc/testsuite/g++.dg/tree-ssa/pta-delete-1.C
new file mode 100644
index 0000000..5e1e322
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pta-delete-1.C
@@ -0,0 +1,24 @@
+// { dg-do run }
+// { dg-options "-O2" }
+
+struct X {
+ static struct X saved;
+ int *p;
+ X() { __builtin_memcpy (this, &saved, sizeof (X)); }
+};
+X X::saved;
+void __attribute__((noinline)) operator delete (void *p)
+{
+ __builtin_memcpy (&X::saved, p, sizeof (X));
+}
+int main()
+{
+ int y = 1;
+ X *p = new X;
+ p->p = &y;
+ ::operator delete (p);
+ X *q = new X;
+ *(q->p) = 2;
+ if (y != 2)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr97255.cc b/gcc/testsuite/g++.dg/vect/pr97255.cc
new file mode 100644
index 0000000..efb7f53
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr97255.cc
@@ -0,0 +1,44 @@
+// { dg-require-effective-target c++11 }
+// { dg-additional-options "-O3" }
+
+template<class T, unsigned N>
+class Array{
+public:
+ T& operator[](unsigned x) {return m_arr[x];}
+private:
+ T m_arr[N];
+};
+
+int
+__attribute__((noipa))
+logicalOr(Array< char, 4 > in1[60],
+ Array< bool, 4 > out[60])
+{
+ for (unsigned k0 = 0u; k0 < 60u; ++k0) {
+ Array< char, 4 > in1m = in1[k0];
+ Array< bool, 4 > x;
+ for (unsigned k1 = 0u; k1 < 4u; ++k1) {
+ char in1s = in1m[k1];
+ x[k1] = in1s != char(0) || in1s != char(0);
+ }
+ out[k0] = x;
+ }
+ return out[0][0];
+}
+
+
+int main()
+{
+ Array< char, 4 > In1[60]{};
+ Array< bool, 4 > Out7[60]{};
+
+ for( int i = 0; i < 60; ++i){
+ for( int j = 0; j < 4; ++j){
+ In1[i][j] = 240 - i*4 - j;
+ }
+ }
+
+ if (logicalOr(In1, Out7) != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr97347.cc b/gcc/testsuite/g++.dg/vect/pr97347.cc
new file mode 100644
index 0000000..6a9116c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr97347.cc
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+
+inline namespace __cxx11 {}
+typedef int size_t;
+class MessageAuthenticationCode;
+class __uniq_ptr_impl {
+ struct _Ptr {
+ using type = MessageAuthenticationCode *;
+ };
+public:
+ using pointer = _Ptr::type;
+};
+class unique_ptr {
+public:
+ using pointer = __uniq_ptr_impl::pointer;
+ unique_ptr(pointer);
+};
+namespace __cxx11 {
+class basic_string {
+public:
+ basic_string(char *);
+ ~basic_string();
+};
+} // namespace __cxx11
+class MessageAuthenticationCode {};
+class SCAN_Name {
+public:
+ SCAN_Name(basic_string);
+ size_t arg_as_integer();
+};
+class SipHash : public MessageAuthenticationCode {
+public:
+ SipHash(size_t c, size_t d) : m_C(c), m_D(d) {}
+ size_t m_C, m_D;
+};
+void create(basic_string algo_spec, char *s) {
+ basic_string provider = s;
+ SCAN_Name req(algo_spec);
+ unique_ptr(new SipHash(req.arg_as_integer(), req.arg_as_integer()));
+}
diff --git a/gcc/testsuite/g++.dg/vect/slp-pr50413.cc b/gcc/testsuite/g++.dg/vect/slp-pr50413.cc
index 12f92fc..3e11c34 100644
--- a/gcc/testsuite/g++.dg/vect/slp-pr50413.cc
+++ b/gcc/testsuite/g++.dg/vect/slp-pr50413.cc
@@ -160,5 +160,4 @@ void shift(unsigned char t)
V.bitmap.b96 = t;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 0 "slp2" } } */
-
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 0 "slp2" } } */
diff --git a/gcc/testsuite/g++.dg/vect/slp-pr50819.cc b/gcc/testsuite/g++.dg/vect/slp-pr50819.cc
index ce5c20f..b15c34a 100644
--- a/gcc/testsuite/g++.dg/vect/slp-pr50819.cc
+++ b/gcc/testsuite/g++.dg/vect/slp-pr50819.cc
@@ -49,4 +49,4 @@ const & v2) {
res = res + s*(v1+v2);
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" } } */
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C
new file mode 100644
index 0000000..2246697
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-10.C
@@ -0,0 +1,64 @@
+/* PR c++/97201 - ICE in -Warray-bounds writing to result of operator new(0)
+ Verify that out-of-bounds accesses to memory returned by default operator
+ new() are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
+
+typedef __INT32_TYPE__ int32_t;
+
+void sink (void*);
+
+#define OP_NEW(n) operator new (n)
+#define T(T, n, i) do { \
+ T *p = (T*) OP_NEW (n); \
+ p[i] = 0; \
+ sink (p); \
+ } while (0)
+
+void warn_op_new ()
+{
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
+
+
+void warn_op_array_new ()
+{
+#undef OP_NEW
+#define OP_NEW(n) operator new[] (n)
+
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
new file mode 100644
index 0000000..9875e29
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-11.C
@@ -0,0 +1,66 @@
+/* PR c++/97201 - ICE in -Warray-bounds writing to result of operator new(0)
+ Verify that out-of-bounds accesses to memory returned by nothrow operator
+ new() are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
+
+#include <new>
+
+typedef __INT32_TYPE__ int32_t;
+
+void sink (void*);
+
+#define OP_NEW(n) operator new (n, std::nothrow)
+#define T(T, n, i) do { \
+ T *p = (T*) OP_NEW (n); \
+ p[i] = 0; \
+ sink (p); \
+ } while (0)
+
+void warn_op_new ()
+{
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(std::size_t, const std::nothrow_t.\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
+
+
+void warn_op_array_new ()
+{
+#undef OP_NEW
+#define OP_NEW(n) operator new[] (n, std::nothrow)
+
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(std::size_t, const std::nothrow_t&\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C
new file mode 100644
index 0000000..9e8b604
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-12.C
@@ -0,0 +1,66 @@
+/* PR c++/97201 - ICE in -Warray-bounds writing to result of operator new(0)
+ Verify that out-of-bounds accesses to memory returned by the new expression
+ are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
+
+typedef __INT32_TYPE__ int32_t;
+
+template <int N> struct S { char a[N]; };
+
+void sink (void*);
+
+#define NEW(n) new S<n>
+#define T(T, n, i) do { \
+ T *p = (T*)NEW (n); \
+ p[i] = 0; \
+ sink (p); \
+ } while (0)
+
+void warn_new ()
+{
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
+
+
+void warn_array_new ()
+{
+#undef NEW
+#define NEW(n) new char [n]
+
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(\(long \)?unsigned int\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
new file mode 100644
index 0000000..42fb809
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-13.C
@@ -0,0 +1,70 @@
+/* PR c++/97201 - ICE in -Warray-bounds writing to result of operator new(0)
+ Verify that out-of-bounds accesses to memory returned by the nothrow form
+ of the new expression are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -Warray-bounds -ftrack-macro-expansion=0" } */
+
+#include <new>
+
+typedef __INT32_TYPE__ int32_t;
+
+void sink (void*);
+
+template <int N> struct S { char a[N]; };
+
+void sink (void*);
+
+#define NEW(n) new (std::nothrow) S<n>
+#define T(T, n, i) do { \
+ T *p = (T*)NEW (n); \
+ p[i] = 0; \
+ sink (p); \
+ } while (0)
+
+void warn_nothrow_new ()
+{
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new\\\(std::size_t, const std::nothrow_t.\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
+
+
+void warn_nothrow_array_new ()
+{
+#undef NEW
+#define NEW(n) new (std::nothrow) char [n]
+
+ T (int32_t, 0, 0); // { dg-warning "array subscript 0 is outside array bounds of 'int32_t \\\[0]'" }
+ // { dg-message "referencing an object of size \\d allocated by 'void\\\* operator new \\\[]\\\(std::size_t, const std::nothrow_t&\\\)'" "note" { target *-*-* } .-1 }
+ T (int32_t, 1, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[1]'" }
+ T (int32_t, 2, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[2]'" }
+ T (int32_t, 3, 0); // { dg-warning "array subscript 'int32_t {aka int}\\\[0]' is partly outside array bounds of 'unsigned char \\\[3]'" }
+
+ T (int32_t, 4, 0);
+
+ T (int32_t, 0, 1); // { dg-warning "array subscript 1 is outside array bounds of 'int32_t \\\[0]'" }
+ T (int32_t, 1, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 2, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 3, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 4, 1); // { dg-warning "array subscript 1 is outside array bounds " }
+ T (int32_t, 5, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[5]" }
+ T (int32_t, 6, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[6]" }
+ T (int32_t, 7, 1); // { dg-warning "array subscript 'int32_t {aka int}\\\[1]' is partly outside array bounds of 'unsigned char \\\[7]" }
+
+ T (int32_t, 8, 1);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.C b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.C
new file mode 100644
index 0000000..903e6f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.C
@@ -0,0 +1,88 @@
+// Test -Wctad-maybe-unsupported.
+// { dg-do compile { target c++17 } }
+// { dg-options "-Wctad-maybe-unsupported" }
+
+template <typename T> struct Empty { };
+
+template <typename T>
+struct A {
+ A(T); // generates 'template<class T> A(T)-> A<T>'
+ A(T, int); // generates 'template<class T> A(T, int)-> A<T>'
+};
+
+// These only succeed because of the implicit guide. That may be
+// undesired.
+A a1(42); // { dg-warning "may not intend to support class template argument deduction" }
+A a2{42}; // { dg-warning "may not intend to support class template argument deduction" }
+A a3 = {42}; // { dg-warning "may not intend to support class template argument deduction" }
+
+template <typename T>
+struct B {
+ B(T);
+ B(T, int);
+};
+template <typename T> B(T, int) -> B<Empty<T>>;
+
+B b1(42);
+B b2{42};
+B b3 = {42};
+
+// Motivating examples from Stephan Lavavej's 2018 CppCon talk.
+template <class T, class U>
+struct Pair {
+ T first;
+ U second;
+ explicit Pair(const T &t, const U &u) {}
+};
+// deduces to Pair<int, char[12]>
+Pair p1(42, "hello world"); // { dg-warning "may not intend to support class template argument deduction" }
+Pair p1b{42, "hello world"}; // { dg-warning "may not intend to support class template argument deduction" }
+
+template <class T, class U>
+struct Pair2 {
+ T first;
+ U second;
+ explicit Pair2(T t, U u) {}
+};
+// deduces to Pair2<int, const char*>
+Pair2 p2(42, "hello world"); // { dg-warning "may not intend to support class template argument deduction" }
+Pair2 p2b{42, "hello world"}; // { dg-warning "may not intend to support class template argument deduction" }
+
+template <class T, class U>
+struct Pair3 {
+ T first;
+ U second;
+ explicit Pair3(T const& t, U const& u) {}
+};
+template<class T1, class T2>
+Pair3(T1, T2) -> Pair3<T1, T2>;
+ // deduces to Pair3<int, const char*>
+Pair3 p3(42, "hello world");
+static_assert(__is_same(decltype(p3), Pair3<int, const char*>));
+
+// Test that explicit guides suppress the warning even if they
+// aren't used as candidates.
+template <typename T>
+struct C {
+ C(T) { }
+};
+template <typename T>
+explicit C(C<T> const&) -> C<void>;
+C<int> c{42};
+C c2 = c;
+static_assert(__is_same(decltype(c2), C<int>));
+
+// Clang's suppression test.
+struct allow_ctad_t {
+ allow_ctad_t() = delete;
+};
+
+template <typename T>
+struct S {
+ S(T) {}
+};
+S(allow_ctad_t) -> S<void>;
+S s("abc");
+S s2{"abc"};
+static_assert(__is_same(decltype(s), S<const char *>));
+static_assert(__is_same(decltype(s2), S<const char *>));
diff --git a/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.h b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.h
new file mode 100644
index 0000000..9bb3154
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported.h
@@ -0,0 +1,4 @@
+#pragma GCC system_header
+
+template <typename T>
+struct A { A(T); };
diff --git a/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported2.C b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported2.C
new file mode 100644
index 0000000..ce664bd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported2.C
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++17 } }
+// { dg-options "-Wctad-maybe-unsupported" }
+
+#include "Wctad-maybe-unsupported.h"
+
+A a{42}; // { dg-bogus "may not intend to support class template argument deduction" }
diff --git a/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported3.C b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported3.C
new file mode 100644
index 0000000..c0ae633
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wctad-maybe-unsupported3.C
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++17 } }
+// { dg-options "-Wctad-maybe-unsupported -Wsystem-headers" }
+
+#include "Wctad-maybe-unsupported.h"
+
+A a{42}; // { dg-warning "may not intend to support class template argument deduction" }
diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-1.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-1.C
index d2ec608..cec8316 100644
--- a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-1.C
@@ -66,8 +66,9 @@ struct BA2 { int i; A2 a2; };
void fBx (BAx *pbx, BAx &rbx)
{
BAx bax;
- new (bax.ax.a) char; // { dg-warning "placement" }
- new (bax.ax.a) Int16; // { dg-warning "placement" }
+ // The uninitialized flexible array takes up the bytes of padding.
+ new (bax.ax.a) char;
+ new (bax.ax.a) Int16;
new (bax.ax.a) Int32; // { dg-warning "placement" }
new (pbx->ax.a) char;
@@ -84,9 +85,12 @@ void fBx1 ()
{
static BAx bax1 = { 1, /* Ax = */ { 2, /* a[] = */ {} } };
- new (bax1.ax.a) char; // { dg-warning "placement" }
- new (bax1.ax.a) char[2]; // { dg-warning "placement" }
- new (bax1.ax.a) Int16; // { dg-warning "placement" }
+ // The empty flexible array takes up the bytes of padding.
+ new (bax1.ax.a) char;
+ new (bax1.ax.a) char[2];
+ new (bax1.ax.a) Int16;
+ new (bax1.ax.a) char[3];
+ new (bax1.ax.a) char[4]; // { dg-warning "placement" }
new (bax1.ax.a) Int32; // { dg-warning "placement" }
}
diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-2.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-2.C
index e00515e..e5fdfe1 100644
--- a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-2.C
@@ -124,9 +124,13 @@ struct BA2 { int i; A2 a2; };
void fBx (BAx *pbx, BAx &rbx)
{
BAx bax;
- new (bax.ax.a) char; // { dg-warning "placement" }
- new (bax.ax.a) Int16; // { dg-warning "placement" }
+ // The uninitialized flexible array takes up the bytes of padding.
+ new (bax.ax.a) char;
+ new (bax.ax.a) Int16;
+ new (bax.ax.a) char[3];
new (bax.ax.a) Int32; // { dg-warning "placement" }
+ new (bax.ax.a) char[4]; // { dg-warning "placement" }
+ new (bax.ax.a) char[5]; // { dg-warning "placement" }
new (pbx->ax.a) char;
new (rbx.ax.a) char;
@@ -142,10 +146,14 @@ void fBx1 ()
{
static BAx bax1 = { 1, /* Ax = */ { 2, /* a[] = */ {} } };
- new (bax1.ax.a) char; // { dg-warning "placement" }
- new (bax1.ax.a) char[2]; // { dg-warning "placement" }
- new (bax1.ax.a) Int16; // { dg-warning "placement" }
+ // The empty flexible array takes up the bytes of padding.
+ new (bax1.ax.a) char;
+ new (bax1.ax.a) char[2];
+ new (bax1.ax.a) Int16;
+ new (bax1.ax.a) char[3];
new (bax1.ax.a) Int32; // { dg-warning "placement" }
+ new (bax1.ax.a) char[4]; // { dg-warning "placement" }
+ new (bax1.ax.a) char[5]; // { dg-warning "placement" }
}
void fB0 (BA0 *pb0, BA0 &rb0)
diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-6.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-6.C
index b6a72b1..5eb63d2 100644
--- a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-6.C
@@ -17,9 +17,10 @@ void fBx1 ()
{
static BAx bax1 = { 1, /* Ax = */ { 2, /* a[] = */ { 3 } } }; // { dg-error "initialization of flexible array member in a nested context" }
- new (bax1.ax.a) char; // { dg-warning "placement" }
- new (bax1.ax.a) char[2]; // { dg-warning "placement" }
- new (bax1.ax.a) Int16; // { dg-warning "placement" }
+ // The first three bytes of the flexible array member live in the padding.
+ new (bax1.ax.a) char;
+ new (bax1.ax.a) char[2];
+ new (bax1.ax.a) Int16;
new (bax1.ax.a) Int32; // { dg-warning "placement" }
}
@@ -27,10 +28,11 @@ void fBx2 ()
{
static BAx bax2 = { 1, /* Ax = */ { 2, /* a[] = */ { 3, 4 } } }; // { dg-error "initialization of flexible array member in a nested context" }
- new (bax2.ax.a) char; // { dg-warning "placement" }
- new (bax2.ax.a) char[2]; // { dg-warning "placement" }
- new (bax2.ax.a) char[3]; // { dg-warning "placement" }
- new (bax2.ax.a) Int16; // { dg-warning "placement" }
+ // The first three bytes of the flexible array member live in the padding.
+ new (bax2.ax.a) char;
+ new (bax2.ax.a) char[2];
+ new (bax2.ax.a) char[3];
+ new (bax2.ax.a) Int16;
new (bax2.ax.a) char[4]; // { dg-warning "placement" }
new (bax2.ax.a) Int32; // { dg-warning "placement" }
}
@@ -39,10 +41,11 @@ void fBx3 ()
{
static BAx bax2 = { 1, /* Ax = */ { 3, /* a[] = */ { 4, 5, 6 } } }; // { dg-error "initialization of flexible array member in a nested context" }
- new (bax2.ax.a) char; // { dg-warning "placement" }
- new (bax2.ax.a) char[2]; // { dg-warning "placement" }
- new (bax2.ax.a) Int16; // { dg-warning "placement" }
- new (bax2.ax.a) char[3]; // { dg-warning "placement" }
+ // The first three bytes of the flexible array member live in the padding.
+ new (bax2.ax.a) char;
+ new (bax2.ax.a) char[2];
+ new (bax2.ax.a) Int16;
+ new (bax2.ax.a) char[3];
new (bax2.ax.a) char[4]; // { dg-warning "placement" }
new (bax2.ax.a) Int32; // { dg-warning "placement" }
}
diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-7.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-7.C
new file mode 100644
index 0000000..82f298d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-7.C
@@ -0,0 +1,82 @@
+/* PR c++/96511 - Incorrect -Wplacement-new on POINTER_PLUS into an array
+ with 4-byte elements
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+typedef __INT16_TYPE__ int16_t;
+typedef __INT32_TYPE__ int32_t;
+typedef __SIZE_TYPE__ size_t;
+
+void* operator new (size_t, void *p) { return p; }
+
+void test_a1_int16 ()
+{
+ int16_t a3[3]; // { dg-message "declared here" }
+
+ new (a3) int16_t;
+ new (a3 + 1) int16_t;
+ new (a3 + 2) int16_t; // { dg-bogus "\\\[-Wplacement-new" }
+ new (&a3[1]) int16_t;
+ new (&a3[0] + 1) int16_t;
+ new (&a3[0] + 2) int16_t; // { dg-bogus "\\\[-Wplacement-new" }
+ new (&a3[0] + 3) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+}
+
+void test_a1_int32 ()
+{
+ int16_t a3[3];
+
+ new (a3 + 1) int32_t; // { dg-bogus "\\\[-Wplacement-new" }
+ new (&a3[1]) int32_t;
+ new (&a3[0] + 1) int32_t; // { dg-bogus "\\\[-Wplacement-new" }
+ new (&a3[0] + 2) int32_t; // { dg-warning "\\\[-Wplacement-new" }
+}
+
+
+void test_a2 ()
+{
+ int16_t a23[2][3];
+
+ new (a23 + 1) int16_t; // { dg-bogus "\\\[-Wplacement-new" }
+ new (&a23[1]) int16_t;
+ new (&a23[2]) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+
+ new (&a23[0][0] + 1) int16_t;
+ new (&a23[0][0] + 2) int16_t;
+ // Deriving a pointer to the next array from one to an element of
+ // the prior array isn't valid even if the resulting pointer points
+ // to an element of the larger array. Verify it's diagnosed.
+ new (&a23[0][0] + 3) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][0] + 4) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][0] + 5) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][0] + 6) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+
+ new (&a23[0][1] + 1) int16_t;
+ new (&a23[0][1] + 2) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][1] + 3) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][1] + 4) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][1] + 5) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][1] + 6) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+
+ new (&a23[0][2] + 1) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][2] + 2) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][2] + 3) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][2] + 4) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][2] + 5) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[0][2] + 6) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+
+ new (&a23[1][0]) int16_t;
+ new (&a23[1][0] + 1) int16_t;
+ new (&a23[1][0] + 2) int16_t;
+ new (&a23[1][0] + 3) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[1][0] + 4) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+
+ new (&a23[1][1]) int16_t;
+ new (&a23[1][2]) int16_t;
+ new (&a23[1][2] + 1) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[1][3]) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[1][3] + 1) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+
+ new (&a23[2][0]) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+ new (&a23[2][0] + 1) int16_t; // { dg-warning "\\\[-Wplacement-new" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wplacement-new-size-8.C b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-8.C
new file mode 100644
index 0000000..77bd331
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wplacement-new-size-8.C
@@ -0,0 +1,147 @@
+/* Verify informational notes following the warning.
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+#define DISS_MAX __PTRDIFF_MAX__
+#define SIZE_MAX __SIZE_MAX__
+
+typedef __SIZE_TYPE__ size_t;
+
+template <int N> struct S { char a[N]; };
+
+void* operator new (size_t, void *p) { return p; }
+void* operator new[] (size_t, void *p) { return p; }
+
+
+void test_cst_off ()
+{
+ {
+ char ca0[0]; // { dg-message "'ca0' declared here" "note" }
+ new (ca0 + 0) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[0]' and size '0'" }
+ }
+ {
+ char ca1[1];
+ new (ca1 + 0) S<1>;
+ }
+ {
+ char ca1[1]; // { dg-message "'ca1' declared here" "note" }
+ new (ca1 + 0) S<2>; // { dg-warning "constructing an object of type 'S<2>' and size '2' in a region of type 'char \\\[1]' and size '1'" }
+ }
+ {
+ char ca1[1]; // { dg-message "at offset 1 from 'ca1' declared here" "note" }
+ new (ca1 + 1) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[1]' and size '0'" }
+ }
+ {
+ char ca1[1]; // { dg-message "at offset 2 from 'ca1' declared here" "note" }
+ new (ca1 + 2) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[1]' and size '0'" }
+ }
+ {
+ char ca1[1]; // { dg-message "at offset -1 from 'ca1' declared here" "note" }
+ new (ca1 - 1) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[1]' and size '0'" }
+ }
+ {
+ /* Offsets are treated as signed so SIZE_MAX is indistinguishable
+ from -1. */
+ char ca1[1]; // { dg-message "at offset \\d+ from 'ca1' declared here" "note" { xfail *-*-* } }
+ // { dg-message "at offset -1 from 'ca1' declared here" "note" { target *-*-* } .-1 }
+ new (ca1 + SIZE_MAX) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[1]' and size '0'" }
+ }
+}
+
+
+/* Verify that the range of the offset included in the note corresponds
+ to the range of its type (plus the optional constant). */
+
+void test_var_off_uchar (unsigned char i)
+{
+ {
+ // Verify that the nore doesn't mention an offset.
+ char ca0[0]; // { dg-message ": 'ca0' declared here" "note" }
+ new (ca0 + i) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[0]' and size '0'" }
+ }
+ {
+ char ca1[1];
+ new (ca1 + i) S<1>;
+ }
+ {
+ // Verify that the nore doesn't mention an offset.
+ char ca1[1]; // { dg-message ": 'ca1' declared here" "note" }
+ new (ca1 + i) S<2>; // { dg-warning "constructing an object of type 'S<2>' and size '2' in a region of type 'char \\\[1]' and size at most '1'" }
+ }
+ {
+ char ca2[2];
+ new (ca2 + i) S<2>;
+ new (ca2 + 1 - i) S<2>;
+ new (ca2 - i + 1) S<2>;
+ new (ca2 - 2 + i) S<2>;
+ new (ca2 - i + 2) S<2>;
+ new (ca2 - i + i) S<2>;
+ new (ca2 + i + i) S<2>;
+ }
+ {
+ char ca2[2]; // { dg-message "at offset \\\[1, 2] from 'ca2' declared here" "note" }
+ new (ca2 + i + 1) S<2>; // { dg-warning "constructing an object of type 'S<2>' and size '2' in a region of type 'char \\\[2]' and size at most '1'" }
+ }
+
+ {
+ char a[65281];
+ new (a + i + 65280) S<1>;
+ }
+ {
+ char a[65281]; // { dg-message "at offset 65281 from 'a' declared here" "note" }
+ new (a + i + 65281) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[65281]' and size '0'" }
+ }
+ {
+ char a[65281]; // { dg-message "at offset \\\[65154, 65281] from 'a' declared here" "note" }
+ new (a + i + 65154) S<128>; // { dg-warning "constructing an object of type 'S<128>' and size '128' in a region of type 'char \\\[65281]' and size at most '127'" }
+ }
+}
+
+
+/* Same as above but also verify that the signedness of the offset is
+ considered in the issuing the warning. */
+
+void test_var_off_schar (signed char i)
+{
+ {
+ // Verify that the nore doesn't mention an offset.
+ char ca0[0]; // { dg-message ": 'ca0' declared here" "note" }
+ new (ca0 + i) S<1>; // { dg-warning "constructing an object of type 'S<1>' and size '1' in a region of type 'char \\\[0]' and size '0'" }
+ }
+ {
+ char ca1[1];
+ new (ca1 + i) S<1>;
+ new (ca1 - i) S<1>;
+ new (ca1 + i + 1) S<1>;
+ new (ca1 - i + 1) S<1>;
+ new (ca1 + i + i) S<1>;
+ new (ca1 - i - i) S<1>;
+ }
+ {
+ // Verify that the nore doesn't mention an offset.
+ char ca1[1]; // { dg-message ": 'ca1' declared here" "note" }
+ new (ca1 + i) S<2>; // { dg-warning "constructing an object of type 'S<2>' and size '2' in a region of type 'char \\\[1]' and size at most '1'" }
+ }
+ {
+ char ca2[2];
+ new (ca2 + i) S<2>;
+ new (ca2 + 1 - i) S<2>;
+ new (ca2 - i + 1) S<2>;
+ new (ca2 - 2 + i) S<2>;
+ new (ca2 - i + 2) S<2>;
+ new (ca2 - i + i) S<2>;
+ new (ca2 + i + i) S<2>;
+ }
+ {
+ char ca2[2];
+ new (ca2 + i + 1) S<2>;
+ }
+
+ {
+ char a[65281]; // { dg-message "at offset \\\[65153, 65281] from 'a'" "note" }
+ new (a + i + 65280) S<1>;
+ new (a + i + 65281) S<1>;
+ new (a + i + 65281) S<128>;
+ new (a + i + 65281) S<129>; // { dg-warning "constructing an object of type 'S<129>' and size '129' in a region of type 'char \\\[65281]' and size at most '128'" }
+ }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wrange-loop-construct.C b/gcc/testsuite/g++.dg/warn/Wrange-loop-construct.C
new file mode 100644
index 0000000..3caf00d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wrange-loop-construct.C
@@ -0,0 +1,207 @@
+// PR c++/94695
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wrange-loop-construct" }
+
+#include <initializer_list>
+
+struct Small {
+ char arr[64];
+};
+
+struct Big_aggr {
+ char arr[65];
+};
+
+struct Big_triv_copy {
+ char arr[65];
+ Big_triv_copy() { }
+};
+
+struct Big {
+ char arr[65];
+ Big () = default;
+ Big(const Big&);
+};
+
+struct Foo { };
+struct Bar {
+ char arr[100];
+ Bar(Foo);
+ Bar(int);
+ operator int();
+};
+
+template<typename T>
+struct It {
+ T operator*();
+ It operator++();
+ bool operator!=(const It);
+};
+
+template<typename T>
+struct Cont {
+ using I = It<T>;
+ I begin();
+ I end();
+};
+
+#define TEST \
+ void fn_macro() \
+ { \
+ Cont<Bar &> cont_bar_ref; \
+ for (const Bar x : cont_bar_ref) { (void) x; } \
+ }
+
+TEST
+
+Cont<Bar &>& foo ();
+Cont<Bar &> foo2 ();
+
+void
+fn1 ()
+{
+ for (const auto x : foo () ) { (void) x; } // { dg-warning "creates a copy" }
+ for (const auto x : foo2 () ) { (void) x; } // { dg-warning "creates a copy" }
+
+ Small s{};
+ Small sa[5] = { };
+ for (const auto x : sa) { (void) x; }
+ for (const auto x : { s, s, s }) { (void) x; }
+
+ Big_aggr b{};
+ Big_aggr ba[5] = { };
+ for (const auto x : ba) { (void) x; } // { dg-warning "creates a copy" }
+ for (const auto x : { b, b, b }) { (void) x; } // { dg-warning "creates a copy" }
+
+ Big_triv_copy bt{};
+ Big_triv_copy bta[5];
+ for (const auto x : bta) { (void) x; } // { dg-warning "creates a copy" }
+ for (const auto x : { bt, bt, bt }) { (void) x; } // { dg-warning "creates a copy" }
+
+ Big b2;
+ Big ba2[5];
+ for (const auto x : ba2) { (void) x; } // { dg-warning "creates a copy" }
+ for (const auto x : { b2, b2, b2 }) { (void) x; } // { dg-warning "creates a copy" }
+}
+
+void
+fn2 ()
+{
+ Cont<int> cont_int;
+ for (const auto x : cont_int) { (void) x; }
+ for (const int x : cont_int) { (void) x; }
+ for (int x : cont_int) { (void) x; }
+ for (const auto &x : cont_int) { (void) x; }
+ for (double x : cont_int) { (void) x; }
+ for (const double x : cont_int) { (void) x; }
+ for (const Bar x : cont_int) { (void) x; }
+ for (Bar x : cont_int) { (void) x; }
+}
+
+void
+fn3 ()
+{
+ Cont<int &> cont_int_ref;
+ for (const int x : cont_int_ref) { (void) x; }
+ for (int x : cont_int_ref) { (void) x; }
+ for (const double x : cont_int_ref) { (void) x; }
+ for (double x : cont_int_ref) { (void) x; }
+ for (const Bar x : cont_int_ref) { (void) x; }
+ for (Bar x : cont_int_ref) { (void) x; }
+}
+
+void
+fn4 ()
+{
+ Cont<Bar> cont_bar;
+ for (const Bar x : cont_bar) { (void) x; }
+ for (Bar x : cont_bar) { (void) x; }
+ for (const int x : cont_bar) { (void) x; }
+ for (int x : cont_bar) { (void) x; }
+}
+
+void
+fn5 ()
+{
+ Cont<Bar&> cont_bar_ref;
+ for (const Bar x : cont_bar_ref) { (void) x; } // { dg-warning "creates a copy" }
+ for (Bar x : cont_bar_ref) { (void) x; }
+ for (const int x : cont_bar_ref) { (void) x; }
+ for (int x : cont_bar_ref) { (void) x; }
+}
+
+void
+fn6 ()
+{
+ Cont<Foo> cont_foo;
+ for (const Bar x : cont_foo) { (void) x; }
+ for (Bar x : cont_foo) { (void) x; }
+}
+
+void
+fn7 ()
+{
+ Cont<Foo &> cont_foo_ref;
+ for (const Bar x : cont_foo_ref) { (void) x; }
+ for (Bar x : cont_foo_ref) { (void) x; }
+}
+
+void
+fn8 ()
+{
+ double arr[2];
+ for (const double x : arr) { (void) x; }
+ for (double x : arr) { (void) x; }
+ for (const int x : arr) { (void) x; }
+ for (int x : arr) { (void) x; }
+ for (const Bar x : arr) { (void) x; }
+ for (Bar x : arr) { (void) x; }
+}
+
+void
+fn9 ()
+{
+ Foo foo[2];
+ for (const Foo x : foo) { (void) x; }
+ for (Foo x : foo) { (void) x; }
+ for (const Bar x : foo) { (void) x; }
+ for (Bar x : foo) { (void) x; }
+}
+
+void
+fn10 ()
+{
+ Bar bar[2] = { 1, 2 };
+ for (const Bar x : bar) { (void) x; } // { dg-warning "creates a copy" }
+ for (Bar x : bar) { (void) x; }
+ for (const int x : bar) { (void) x; }
+ for (int x : bar) { (void) x; }
+}
+
+template<typename T>
+void
+fn11 ()
+{
+ Cont<Bar> cont_bar;
+ for (const Bar x : cont_bar) { (void) x; }
+
+ Cont<Bar&> cont_bar_ref;
+ for (const Bar x : cont_bar_ref) { (void) x; } // { dg-warning "creates a copy" }
+
+ Cont<T> cont_dep;
+ for (const T x : cont_dep) { (void) x; }
+}
+
+template<typename T>
+void
+fn12 ()
+{
+ for (const auto x : { T{} }) { (void) x; } // { dg-warning "creates a copy" }
+}
+
+void
+invoke ()
+{
+ fn11<int> ();
+ fn12<Big> ();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wsizeof-array-div1.C b/gcc/testsuite/g++.dg/warn/Wsizeof-array-div1.C
new file mode 100644
index 0000000..da220cd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wsizeof-array-div1.C
@@ -0,0 +1,37 @@
+// PR c++/91741
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
+
+int
+fn1 ()
+{
+ int arr[10];
+ return sizeof (arr) / sizeof (decltype(arr[0]));
+}
+
+template<typename T, int N>
+int fn2 (T (&arr)[N])
+{
+ return sizeof (arr) / sizeof (T);
+}
+
+template<typename T, int N>
+int fn3 (T (&arr)[N])
+{
+ return sizeof (arr) / sizeof (bool); // { dg-warning "expression does not compute" }
+}
+
+template<typename U, int N, typename T>
+int fn4 (T (&arr)[N])
+{
+ return sizeof (arr) / sizeof (U); // { dg-warning "expression does not compute" }
+}
+
+void
+fn ()
+{
+ int arr[10];
+ fn2 (arr);
+ fn3 (arr);
+ fn4<short> (arr);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C b/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C
new file mode 100644
index 0000000..66fe72a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wsizeof-array-div2.C
@@ -0,0 +1,15 @@
+// PR c++/91741
+// { dg-do compile { target { lp64 } } }
+// { dg-options "-Wall" }
+// From <https://www.viva64.com/en/examples/v706/>.
+
+const int kBaudrates[] = { 50, 75, 110 };
+
+void
+foo ()
+{
+ for(int i = sizeof(kBaudrates) / sizeof(char*); // { dg-warning "expression does not compute" }
+ --i >= 0;)
+ {
+ }
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C b/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C
index eaf8c01..7ae494b 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/missed-error2.C
@@ -1,4 +1,5 @@
// { dg-do assemble }
+// { dg-additional-options -fpermissive }
// GROUPS passed missed-error
// missed-error file
// From: ndc!don@csvax.cs.caltech.edu (Don Erway)
@@ -20,14 +21,14 @@ inline double max(double a, double b) {return a > b ? a : b;}; // { dg-message "
// { dg-error "extra ';'" "extra ;" { target c++98_only } .-1 }
int main() {
+ // we treat this as-if extern
static void foo(int i, int j, double x, double y) ;// { dg-error "" } .*
foo(4, -37, 14.39, 14.38);
}
-// 971006 we no longer give an error for this since we emit a hard error
-// about the declaration above
-static void foo(int i, int j, double x, double y) {
+static void foo(int i, int j, double x, double y) // { dg-warning ".extern." }
+{
std::cout << "Max(int): " << max(i,j) << " Max(double): " <<
max(x,y) << '\n';
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash3.C b/gcc/testsuite/g++.old-deja/g++.pt/crash3.C
index e5b3f25..52701b7 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash3.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash3.C
@@ -5,12 +5,13 @@ class CVector {
public:
CVector<int> f() const
{
- CVector<int> v();
+ // local-extern :)
+ CVector<int> v(); // { dg-message "old declaration" }
return v; // { dg-error "convert" }
}
CVector<long> g() const
{
- CVector<long> v();
+ CVector<long> v(); // { dg-error "ambiguating new" }
return v; // { dg-error "convert" }
}
};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend34.C b/gcc/testsuite/g++.old-deja/g++.pt/friend34.C
index 5e80ab9..dcd6df0 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/friend34.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend34.C
@@ -6,9 +6,12 @@
template <typename T = void>
class bar {
public:
- friend class foo; // this is not bar::foo, it forward-declares ::foo
+ friend class foo; // this is not bar::foo, it injects hidden ::foo
class foo {};
bar() { foo(); } // but this should refer to bar::foo
};
bar<> baz;
+
+// We still have not made foo visible.
+foo *b; // { dg-error "does not name a type" }
diff --git a/gcc/testsuite/g++.target/riscv/pr96759.C b/gcc/testsuite/g++.target/riscv/pr96759.C
new file mode 100644
index 0000000..673999a
--- /dev/null
+++ b/gcc/testsuite/g++.target/riscv/pr96759.C
@@ -0,0 +1,8 @@
+/* { dg-options "-mno-strict-align -std=gnu++17" } */
+/* { dg-do compile } */
+struct S {
+ int a;
+ double b;
+};
+S GetNumbers();
+auto [globalC, globalD] = GetNumbers();
diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c b/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c
index d382801..3a2e5ac 100644
--- a/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c
+++ b/gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c
@@ -1,4 +1,3 @@
-/* { dg-skip-if "ptxas runs out of memory" { nvptx-*-* } } */
/* { dg-skip-if "Array too big" { "pdp11-*-*" } { "-mint32" } } */
/* { dg-require-effective-target int32plus } */
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42717.c b/gcc/testsuite/gcc.c-torture/compile/pr42717.c
index 7f6fb9d..4fe6f93 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr42717.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr42717.c
@@ -1,4 +1,3 @@
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } { "-O0" } { "" } } */
static signed char
foo (signed char si1, unsigned char si2)
{
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61684.c b/gcc/testsuite/gcc.c-torture/compile/pr61684.c
index 9a7b52f..f5b53b7 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr61684.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr61684.c
@@ -1,5 +1,4 @@
/* PR tree-optimization/61684 */
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } { "*" } { "-O0" "-O1" "-Os" } } */
int a, c;
static int *b = 0;
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97243.c b/gcc/testsuite/gcc.c-torture/compile/pr97243.c
new file mode 100644
index 0000000..4d10a22
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr97243.c
@@ -0,0 +1,10 @@
+/* { dg-options "-fipa-modref -fipa-icf" } */
+float fma_test1(float a, float b, float c) {
+ float x = a * b + c;
+ return x;
+}
+float fma_test2(float a, float b, float c) {
+ float x = a * b + c;
+ return x;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/981019-1.c b/gcc/testsuite/gcc.c-torture/execute/981019-1.c
index 1cf3741..5d1f009 100644
--- a/gcc/testsuite/gcc.c-torture/execute/981019-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/981019-1.c
@@ -1,5 +1,3 @@
-/* { dg-skip-if "ptxas seg faults" { nvptx-*-* } { "-O3*" } { "" } } */
-
extern int f2(void);
extern int f3(void);
extern void f1(void);
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c
index 6eab1ef..7c13c91 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr20601-1.c
@@ -1,5 +1,4 @@
/* PR tree-optimization/20601 */
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } { "-O1" } { "" } } */
extern void abort (void);
extern void exit (int);
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr52129.c b/gcc/testsuite/gcc.c-torture/execute/pr52129.c
index ab43ca6..a60bfa8 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr52129.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr52129.c
@@ -1,5 +1,4 @@
/* PR target/52129 */
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } { "-O1" } { "" } } */
extern void abort (void);
struct S { void *p; unsigned int q; };
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr59221.c b/gcc/testsuite/gcc.c-torture/execute/pr59221.c
index b307227..0cd4259 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr59221.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr59221.c
@@ -1,4 +1,3 @@
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } { "*" } { "-O0" "-Os" } } */
int a = 1, b, d;
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr68185.c b/gcc/testsuite/gcc.c-torture/execute/pr68185.c
index a41a557..d82fd0a 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr68185.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr68185.c
@@ -1,4 +1,3 @@
-/* { dg-skip-if "ptxas crashes or executes incorrectly" { nvptx-*-* } { "-O0" "-Os" } { "" } } Reported 2015-11-20 */
int a, b, d = 1, e, f, o, u, w = 1, z;
short c, q, t;
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97073.c b/gcc/testsuite/gcc.c-torture/execute/pr97073.c
new file mode 100644
index 0000000..1955e6b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97073.c
@@ -0,0 +1,21 @@
+/* PR middle-end/97073 */
+/* { dg-additional-options "-mno-stv" { target i?86-*-* x86_64-*-* } } */
+
+typedef unsigned long long L;
+union U { L i; struct T { unsigned k; L l; } j; } u;
+
+__attribute__((noinline,noclone)) void
+foo (L x)
+{
+ u.j.l = u.i & x;
+}
+
+int
+main ()
+{
+ u.i = 5;
+ foo (-1ULL);
+ if (u.j.l != 5)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97325.c b/gcc/testsuite/gcc.c-torture/execute/pr97325.c
new file mode 100644
index 0000000..f734c85
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97325.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/97325 */
+
+unsigned long long
+foo (unsigned long long c)
+{
+ return c ? __builtin_ffs (-(unsigned short) c) : 0;
+}
+
+int
+main ()
+{
+ if (foo (2) != 2)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97386-1.c b/gcc/testsuite/gcc.c-torture/execute/pr97386-1.c
new file mode 100644
index 0000000..c50e038
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97386-1.c
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/97386 */
+
+__attribute__((noipa)) unsigned char
+foo (unsigned int c)
+{
+ return __builtin_bswap16 ((unsigned long long) (0xccccLLU << c | 0xccccLLU >> ((-c) & 63)));
+}
+
+int
+main ()
+{
+ unsigned char x = foo (0);
+ if (__CHAR_BIT__ == 8 && __SIZEOF_SHORT__ == 2 && x != 0xcc)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97386-2.c b/gcc/testsuite/gcc.c-torture/execute/pr97386-2.c
new file mode 100644
index 0000000..e61829d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97386-2.c
@@ -0,0 +1,20 @@
+/* PR rtl-optimization/97386 */
+
+__attribute__((noipa)) unsigned
+foo (int x)
+{
+ unsigned long long a = (0x800000000000ccccULL << x) | (0x800000000000ccccULL >> (64 - x));
+ unsigned int b = a;
+ return (b << 24) | (b >> 8);
+}
+
+int
+main ()
+{
+ if (__CHAR_BIT__ == 8
+ && __SIZEOF_INT__ == 4
+ && __SIZEOF_LONG_LONG__ == 8
+ && foo (1) != 0x99000199U)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97404.c b/gcc/testsuite/gcc.c-torture/execute/pr97404.c
new file mode 100644
index 0000000..7e5ce23
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97404.c
@@ -0,0 +1,28 @@
+/* PR ipa/97404 */
+/* { dg-additional-options "-fno-inline" } */
+
+char a, b;
+long c;
+short d, e;
+long *f = &c;
+int g;
+char h(signed char i) { return 0; }
+static short j(short i, int k) { return i < 0 ? 0 : i >> k; }
+void l(void);
+void m(void)
+{
+ e = j(d | 9766, 11);
+ *f = e;
+}
+void l(void)
+{
+ a = 5 | g;
+ b = h(a);
+}
+int main()
+{
+ m();
+ if (c != 4)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/Walloca-1.c b/gcc/testsuite/gcc.dg/Walloca-1.c
index 85e9160..37ee191 100644
--- a/gcc/testsuite/gcc.dg/Walloca-1.c
+++ b/gcc/testsuite/gcc.dg/Walloca-1.c
@@ -24,8 +24,7 @@ void foo1 (size_t len, size_t len2, size_t len3)
char *s = alloca (123);
useit (s); // OK, constant argument to alloca
- s = alloca (num); // { dg-warning "large due to conversion" "" { target lp64 } }
- // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-1 }
+ s = alloca (num); // { dg-warning "\(may be too large|unbounded use\)" }
useit (s);
s = alloca (30000); /* { dg-warning "is too large" } */
diff --git a/gcc/testsuite/gcc.dg/Walloca-12.c b/gcc/testsuite/gcc.dg/Walloca-12.c
index 059c5f3..d2d9413 100644
--- a/gcc/testsuite/gcc.dg/Walloca-12.c
+++ b/gcc/testsuite/gcc.dg/Walloca-12.c
@@ -8,5 +8,5 @@ void g (unsigned int n)
{
if (n == 7)
n = 11;
- f (__builtin_alloca (n)); /* { dg-warning "unbounded use of 'alloca'" } */
+ f (__builtin_alloca (n)); /* { dg-warning "may be too large" } */
}
diff --git a/gcc/testsuite/gcc.dg/Walloca-13.c b/gcc/testsuite/gcc.dg/Walloca-13.c
index 12e9f6c..99d6206 100644
--- a/gcc/testsuite/gcc.dg/Walloca-13.c
+++ b/gcc/testsuite/gcc.dg/Walloca-13.c
@@ -8,5 +8,5 @@ void g (int *p, int *q)
{
__SIZE_TYPE__ n = (__SIZE_TYPE__)(p - q);
if (n < 100)
- f (__builtin_alloca (n)); // { dg-bogus "may be too large due to conversion" "" { xfail { *-*-* } } }
+ f (__builtin_alloca (n)); // { dg-bogus "may be too large" "" { xfail { *-*-* } } }
}
diff --git a/gcc/testsuite/gcc.dg/Walloca-2.c b/gcc/testsuite/gcc.dg/Walloca-2.c
index 766ff8d..1cf9165 100644
--- a/gcc/testsuite/gcc.dg/Walloca-2.c
+++ b/gcc/testsuite/gcc.dg/Walloca-2.c
@@ -24,7 +24,7 @@ g2 (int n)
{
void *p;
if (n < 2000)
- p = __builtin_alloca (n); // { dg-warning "large due to conversion" }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
else
p = __builtin_malloc (n);
f (p);
@@ -36,9 +36,7 @@ g3 (int n)
void *p;
if (n > 0 && n < 3000)
{
- p = __builtin_alloca (n); // { dg-warning "'alloca' may be too large" "" { target lp64} }
- // { dg-message "note:.*argument may be as large as 2999" "note" { target lp64 } .-1 }
- // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-2 }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
}
else
p = __builtin_malloc (n);
diff --git a/gcc/testsuite/gcc.dg/Walloca-3.c b/gcc/testsuite/gcc.dg/Walloca-3.c
index f5840673..b8000ff 100644
--- a/gcc/testsuite/gcc.dg/Walloca-3.c
+++ b/gcc/testsuite/gcc.dg/Walloca-3.c
@@ -13,7 +13,7 @@ g1 (__SIZE_TYPE__ n)
{
void *p;
if (n < LIMIT)
- p = __builtin_alloca (n); // { dg-warning "'alloca' bound is unknown" }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
else
p = __builtin_malloc (n);
f (p);
@@ -27,7 +27,7 @@ g2 (unsigned short n)
{
void *p;
if (n < SHORT_LIMIT)
- p = __builtin_alloca (n); // { dg-warning "'alloca' bound is unknown" }
+ p = __builtin_alloca (n); // { dg-warning "may be too large" }
else
p = __builtin_malloc (n);
f (p);
diff --git a/gcc/testsuite/gcc.dg/Walloca-6.c b/gcc/testsuite/gcc.dg/Walloca-6.c
index 16b5d6f..ebe08ae 100644
--- a/gcc/testsuite/gcc.dg/Walloca-6.c
+++ b/gcc/testsuite/gcc.dg/Walloca-6.c
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target alloca } */
/* { dg-options "-Walloca-larger-than=256 -O2" } */
-/* { dg-xfail-if "Currently broken but Andrew's work should fix this" { *-*-* } } */
void f (void*);
void g (__SIZE_TYPE__ n)
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-58.c b/gcc/testsuite/gcc.dg/Warray-bounds-58.c
index 7c469e2..849457e5 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-58.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-58.c
@@ -1,5 +1,5 @@
/* { dg-do compile }
- { dg-options "-O2 -Wall" } */
+ { dg-options "-O2 -Wall -Wno-stringop-overread" } */
typedef __SIZE_TYPE__ size_t;
@@ -15,7 +15,7 @@ void fa0_extern (void)
{
sink (strlen (ea0.a - 2)); // { dg-warning "\\\[-Warray-bounds" }
sink (strlen (ea0.a - 1)); // { dg-warning "\\\[-Warray-bounds" "pr93514" { xfail *-*-* } }
- sink (strlen (ea0.a)); // { dg-warning "\\\[-Wstringop-overread" "pr93514" }
+ sink (strlen (ea0.a)); // valid just-past-the-end offset
sink (strlen (ea0.a + 1)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" }
}
@@ -25,7 +25,7 @@ void fa0_static (void)
{
sink (strlen (sa0.a - 2)); // { dg-warning "\\\[-Warray-bounds" }
sink (strlen (sa0.a - 1)); // { dg-warning "\\\[-Warray-bounds" "pr93514" { xfail *-*-* } }
- sink (strlen (sa0.a)); // { dg-warning "\\\[-Wstringop-overread" "pr93514" }
+ sink (strlen (sa0.a)); // valid just-past-the-end offset
sink (strlen (sa0.a + 1)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" }
}
@@ -52,14 +52,14 @@ void fax_static (void)
sink (strlen (ax0.a - 2)); // { dg-warning "\\\[-Warray-bounds" }
sink (strlen (ax0.a - 1)); // { dg-warning "\\\[-Warray-bounds" "pr93514" { xfail *-*-* } }
sink (strlen (ax0.a));
- sink (strlen (ax0.a + 1)); // { dg-warning "\\\[-Wstringop-overread" "pr93514" }
+ sink (strlen (ax0.a + 1)); // valid just-past-the-end offset
sink (strlen (ax0.a + 2)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" }
sink (strlen (ax1.a - 2)); // { dg-warning "\\\[-Warray-bounds" }
sink (strlen (ax1.a - 1)); // { dg-warning "\\\[-Warray-bounds" "pr93514" { xfail *-*-* } }
sink (strlen (ax1.a));
sink (strlen (ax1.a + 1));
- sink (strlen (ax1.a + 2)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" "pr93514" }
+ sink (strlen (ax1.a + 2)); // valid just-past-the-end offset
sink (strlen (ax1.a + 3)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" }
sink (strlen (ax2.a - 2)); // { dg-warning "\\\[-Warray-bounds" }
@@ -67,7 +67,7 @@ void fax_static (void)
sink (strlen (ax2.a));
sink (strlen (ax2.a + 1));
sink (strlen (ax2.a + 2));
- sink (strlen (ax2.a + 3)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" "pr93514" }
+ sink (strlen (ax2.a + 3)); // valid just-past-the-end offset
sink (strlen (ax2.a + 4)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" }
sink (strlen (ax3.a - 2)); // { dg-warning "\\\[-Warray-bounds" }
@@ -76,6 +76,6 @@ void fax_static (void)
sink (strlen (ax3.a + 1));
sink (strlen (ax3.a + 2));
sink (strlen (ax3.a + 3));
- sink (strlen (ax3.a + 4)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" "pr93514" }
+ sink (strlen (ax3.a + 4)); // valid just-past-the-end offset
sink (strlen (ax3.a + 5)); // { dg-warning "\\\[-Warray-bounds|-Wstringop-overread" }
}
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-63.c b/gcc/testsuite/gcc.dg/Warray-bounds-63.c
index 0583d23..a3fc918 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-63.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-63.c
@@ -1,7 +1,8 @@
/* PR middle-end/94195 - missing warning reading a smaller object via
an lvalue of a larger type
{ dg-do compile }
- { dg-options "-O2 -Wall" } */
+ { dg-options "-O2 -Wall" }
+ { dg-require-effective-target alloca } */
typedef __INT16_TYPE__ int16_t;
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-66.c b/gcc/testsuite/gcc.dg/Warray-bounds-66.c
index d9bb2a2..c61891f 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-66.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-66.c
@@ -1,6 +1,7 @@
/* PR middle-end/82608 - missing -Warray-bounds on an out-of-bounds VLA index
{ dg-do compile }
- { dg-options "-O2 -Wall -Wno-uninitialized -ftrack-macro-expansion=0" } */
+ { dg-options "-O2 -Wall -Wno-uninitialized -ftrack-macro-expansion=0" }
+ { dg-require-effective-target alloca } */
#include "range.h"
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-68.c b/gcc/testsuite/gcc.dg/Warray-bounds-68.c
new file mode 100644
index 0000000..d661669
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-68.c
@@ -0,0 +1,118 @@
+/* PR middle-end/97391 - bogus -Warray-bounds accessing a multidimensional
+ array parameter
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+
+void nowarn_access_loop_idx (char a[3][5])
+{
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 5; j++)
+ a[i][j] = 0;
+}
+
+void warn_access_loop_idx (char a[3][5])
+{
+ for (int i = 0; i < 3; i++)
+ for (int j = 0; j < 5; j++)
+ a[j][i] = 0; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+
+void nowarn_access_cst_idx (int a[5][7][9])
+{
+ a[0][0][0] = __LINE__;
+ a[0][0][8] = __LINE__;
+
+ a[0][6][0] = __LINE__;
+ a[0][6][8] = __LINE__;
+
+ a[4][0][0] = __LINE__;
+ a[4][0][8] = __LINE__;
+ a[4][6][8] = __LINE__;
+}
+
+
+void test_ptr_access_cst_idx (int a[5][7][9])
+{
+ int *p = &a[0][0][0];
+
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ /* The following access should trigger a warning but it's represented
+ the same as the valid access in
+ p = a[0][1][0];
+ p[1] = __LINE__;
+ both as
+ MEM[(int *)a_1(D) + 36B] = __LINE__; */
+
+ p[9] = __LINE__; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ p[315] = __LINE__;
+ // { dg-warning "subscript 315 is outside array bounds of 'int\\\[5]\\\[7]\\\[9]'" "pr97425" { xfail *-*-* } .-1 }
+ // { dg-warning "subscript 315 is outside array bounds " "" { target *-*-* } .-2 }
+
+ p = &a[0][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ p = &a[4][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+}
+
+
+void warn_access_cst_idx (int a[5][7][9])
+{
+ a[0][0][9] = __LINE__; // { dg-warning "subscript 9 is above array bounds of 'int\\\[9]'" }
+ a[0][7][0] = __LINE__; // { dg-warning "subscript 7 is above array bounds of 'int\\\[7]\\\[9]'" }
+ a[5][0][0] = __LINE__;
+ // { dg-warning "subscript 5 is outside array bounds of 'int\\\[5]\\\[7]\\\[9]'" "pr97425" { xfail *-*-* } .-1 }
+ // { dg-warning "subscript \\d+ is outside array bounds" "" { target *-*-* } .-2 }
+}
+
+
+void test_ptrarray_access_cst_idx (int (*pa)[5][7][9])
+{
+ (*pa)[0][0][0] = __LINE__;
+ (*pa)[0][0][8] = __LINE__;
+ (*pa)[0][0][9] = __LINE__; // { dg-warning "subscript 9 is above array bounds of 'int\\\[9]'" }
+
+ (*pa)[0][6][0] = __LINE__;
+ (*pa)[0][7][0] = __LINE__; // { dg-warning "subscript 7 is above array bounds of 'int\\\[7]\\\[9]'" }
+ (*pa)[0][8][0] = __LINE__; // { dg-warning "subscript 8 is above array bounds of 'int\\\[7]\\\[9]'" }
+
+ (*pa)[4][6][8] = __LINE__;
+ (*pa)[5][0][0] = __LINE__; // { dg-warning "subscript 5 is above array bounds of 'int\\\[5]\\\[7]\\\[9]'" }
+}
+
+
+void test_ptr_ptrarray_access_cst_idx (int (*pa)[5][7][9])
+{
+ int *p = &(*pa)[0][0][0];
+
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ /* The following access should trigger a warning but it's represented
+ the same as the valid access in
+ p = a[0][1][0];
+ p[1] = __LINE__;
+ both as
+ MEM[(int *)a_1(D) + 36B] = __LINE__; */
+
+ p[9] = __LINE__; // { dg-warning "\\\[-Warray-bounds" "pr?????" { xfail *-*-* } }
+
+ p[315] = __LINE__; // { dg-warning "\\\[-Warray-bounds" "pr97429" { xfail *-*-* } }
+
+ p = &(*pa)[0][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+
+ p = &(*pa)[4][6][0];
+ p[0] = __LINE__;
+ p[8] = __LINE__;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-6.c b/gcc/testsuite/gcc.dg/Warray-parameter-6.c
new file mode 100644
index 0000000..609dac9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-6.c
@@ -0,0 +1,9 @@
+/* PR c/97131 - ICE: Segmentation fault in warn_parm_ptrarray_mismatch
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+struct bm { };
+
+void ms (struct bm (*at)[1]) { }
+
+void ms (int f1) { } // { dg-error "conflicting types for 'ms'" }
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-7.c b/gcc/testsuite/gcc.dg/Warray-parameter-7.c
new file mode 100644
index 0000000..4863045
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-7.c
@@ -0,0 +1,25 @@
+/* PR c/97206 - ICE in composite_type on declarations of a similar array types
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+__attribute__((__access__(__write_only__, 1))) void
+f1 (char* restrict);
+
+void f1 (char*);
+
+char a1[];
+char a1[] = { };
+
+
+void f2 (char[restrict]);
+void f2 (char*);
+
+char a2[];
+char a2[] = { };
+
+
+void f3 (char*);
+void f3 (char[const]);
+
+extern const char a3[];
+extern const char a3[1];
diff --git a/gcc/testsuite/gcc.dg/Warray-parameter-8.c b/gcc/testsuite/gcc.dg/Warray-parameter-8.c
new file mode 100644
index 0000000..b152702
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-parameter-8.c
@@ -0,0 +1,36 @@
+/* Verify that combinations of array type qualifiers render correctly.
+ { dg-do compile }
+ { dg-options "-Warray-parameter" } */
+
+void fatm (int[_Atomic 1]); // { dg-message "previously declared as 'int\\\[_Atomic 1]" }
+void fatm (int[_Atomic 2]); // { dg-warning "argument 1 of type 'int\\\[_Atomic 2]' with mismatched bound" }
+
+
+void fcst (int[const 2]); // { dg-message "previously declared as 'int\\\[const 2]" }
+void fcst (int[const 3]); // { dg-warning "argument 1 of type 'int\\\[const 3]' with mismatched bound" }
+
+
+void frst (int[restrict 3]); // { dg-message "previously declared as 'int\\\[restrict 3]" }
+void frst (int[restrict 4]); // { dg-warning "argument 1 of type 'int\\\[restrict 4]' with mismatched bound" }
+
+void fvol (int[volatile 4]); // { dg-message "previously declared as 'int\\\[volatile 4]" }
+void fvol (int[volatile 5]); // { dg-warning "argument 1 of type 'int\\\[volatile 5]' with mismatched bound" }
+
+
+void fcr (int[const restrict 1]); // { dg-message "previously declared as 'int\\\[\(const restrict|restrict const\) 1]" }
+void fcr (int[restrict volatile 2]); // { dg-warning "argument 1 of type 'int\\\[\(restrict volatile|volatile restrict\) 2]' with mismatched bound" }
+void fcr (int[const restrict volatile 3]); // { dg-warning "argument 1 of type 'int\\\[const volatile restrict 3]' with mismatched bound" }
+
+
+extern int n;
+
+void fcx_n (int [const 1][n]); // { dg-message "previously declared as 'int\\\[const 1]\\\[n]'" "note" }
+void fcx_n (int [restrict 2][n]); // { dg-warning "argument 1 of type 'int\\\[restrict 2]\\\[n]' with mismatched bound" }
+
+
+extern int n1, n2;
+
+/* The mismatch in the array bound should be diagnosed but the mismatch
+ in the VLA should not be without -Wvla-parameter. */
+void fc3_n1 (int [const 3][n1]); // { dg-message "previously declared as 'int\\\[const 3]\\\[n1]'" "note" }
+void fc3_n1 (int [const 5][n2]); // { dg-warning "argument 1 of type 'int\\\[const 5]\\\[n2]' with mismatched bound" }
diff --git a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c
index 56a827a..82db8fe 100644
--- a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c
+++ b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c
@@ -12,4 +12,5 @@ void a (void)
}
/* The invalid scanf call may also trigger:
- { dg-prune-output "accessing 4 bytes in a region of size 1" } */
+ { dg-prune-output "accessing 4 bytes in a region of size 1" }
+ { dg-prune-output "accessing 2 bytes in a region of size 1" } */
diff --git a/gcc/testsuite/gcc.dg/Wnonnull-4.c b/gcc/testsuite/gcc.dg/Wnonnull-4.c
new file mode 100644
index 0000000..180a40d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wnonnull-4.c
@@ -0,0 +1,173 @@
+/* PR middle-end/97188 - ICE passing a null VLA to a function expecting
+ at least one element
+ { dg-do compile }
+ { dg-options "-O -Wall -ftrack-macro-expansion=0" } */
+
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-INT_MAX - 1)
+
+/* Exercise passing nul to a one-dimensional VLA argument. */
+
+void test_fca_n (int r_m1)
+{
+ extern void fca_n (int n, char[n]); // { dg-message "in a call to function 'fca_n'" "note" }
+
+#define T(n) fca_n (n, 0)
+
+ int min = INT_MIN;
+ int max = INT_MAX;
+ if (r_m1 >= 0)
+ r_m1 = -1;
+
+ // Verify negative bounds.
+ T (min); // { dg-warning "bound argument 1 value -\\d+ is negative for a variable length array argument 2 of type 'char\\\[n]'" }
+ T (r_m1); // { dg-warning "bound argument 1 value \\\[-\\d+, -1] is negative for a variable length array argument 2 of type 'char\\\[n]" }
+ T ( -1); // { dg-warning "bound argument 1 value -1 is negative for a variable length array argument 2 of type 'char\\\[n]" }
+
+ T ( 0);
+
+ // Verify positive bounds.
+ T ( 1); // { dg-warning "argument 1 of variable length array 'char\\\[n]' is null but the corresponding bound argument 2 value is 1" }
+ T ( 9); // { dg-warning "argument 1 of variable length array 'char\\\[n]' is null but the corresponding bound argument 2 value is 9" }
+ T (max); // { dg-warning "argument 1 of variable length array 'char\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+}
+
+
+/* Exercise passing nul to an array with unspecified bound of VLAs. */
+
+void test_fsa_x_n (int r_m1)
+{
+ extern void fsa_x_n (int n, short[][n]); // { dg-message "in a call to function 'fsa_x_n'" "note" }
+
+#undef T
+#define T(n) fsa_x_n (n, 0)
+
+ int min = INT_MIN;
+ int max = INT_MAX;
+ if (r_m1 >= 0)
+ r_m1 = -1;
+
+ // Verify negative bounds.
+ T (min); // { dg-warning "bound argument 1 value -\\d+ is negative for a variable length array argument 2 of type 'short int\\\[]\\\[n]'" }
+ T (r_m1); // { dg-warning "bound argument 1 value \\\[-\\d+, -1] is negative for a variable length array argument 2 of type 'short int\\\[]\\\[n]" }
+ T ( -1); // { dg-warning "bound argument 1 value -1 is negative for a variable length array argument 2 of type 'short int\\\[]\\\[n]" }
+
+ T ( 0);
+
+ // Verify positive bounds.
+ T ( 1); // { dg-warning "argument 1 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
+ T ( 9); // { dg-warning "argument 1 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
+ T (max); // { dg-warning "argument 1 of variable length array 'short int\\\[]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+}
+
+
+/* Exercise passing nul to an array of a single VLA. */
+
+void test_fia_1_n (int r_m1)
+{
+ extern void fia_1_n (int n, int[1][n]); // { dg-message "in a call to function 'fia_1_n'" "note" }
+
+#undef T
+#define T(n) fia_1_n (n, 0)
+
+ int min = INT_MIN;
+ int max = INT_MAX;
+ if (r_m1 >= 0)
+ r_m1 = -1;
+
+ // Verify negative bounds.
+ T (min); // { dg-warning "bound argument 1 value -\\d+ is negative for a variable length array argument 2 of type 'int\\\[1]\\\[n]'" }
+ T (r_m1); // { dg-warning "bound argument 1 value \\\[-\\d+, -1] is negative for a variable length array argument 2 of type 'int\\\[1]\\\[n]" }
+ T ( -1); // { dg-warning "bound argument 1 value -1 is negative for a variable length array argument 2 of type 'int\\\[1]\\\[n]" }
+
+ T ( 0);
+
+ // Verify positive bounds.
+ T ( 1); // { dg-warning "argument 1 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
+ T ( 9); // { dg-warning "argument 1 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
+ T (max); // { dg-warning "argument 1 of variable length array 'int\\\[1]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+}
+
+
+/* Exercise passing nul to an array of three VLAs. */
+
+void test_fla_3_n (int r_m1)
+{
+ extern void fla_3_n (int n, long[3][n]); // { dg-message "in a call to function 'fla_3_n'" "note" }
+
+#undef T
+#define T(n) fla_3_n (n, 0)
+
+ int min = INT_MIN;
+ int max = INT_MAX;
+ if (r_m1 >= 0)
+ r_m1 = -1;
+
+ // Verify negative bounds.
+ T (min); // { dg-warning "bound argument 1 value -\\d+ is negative for a variable length array argument 2 of type 'long int\\\[3]\\\[n]'" }
+ T (r_m1); // { dg-warning "bound argument 1 value \\\[-\\d+, -1] is negative for a variable length array argument 2 of type 'long int\\\[3]\\\[n]" }
+ T ( -1); // { dg-warning "bound argument 1 value -1 is negative for a variable length array argument 2 of type 'long int\\\[3]\\\[n]" }
+
+ T ( 0);
+
+ // Verify positive bounds.
+ T ( 1); // { dg-warning "argument 1 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
+ T ( 9); // { dg-warning "argument 1 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
+ T (max); // { dg-warning "argument 1 of variable length array 'long int\\\[3]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+}
+
+
+/* Exercise passing nul to a VLA of five-element arrays. */
+
+void test_fda_n_5 (int r_m1)
+{
+ extern void fda_n_5 (int n, double[n][5]);// { dg-message "in a call to function 'fda_n_5'" "note" }
+
+#undef T
+#define T(n) fda_n_5 (n, 0)
+
+ int min = INT_MIN;
+ int max = INT_MAX;
+ if (r_m1 >= 0)
+ r_m1 = -1;
+
+ // Verify negative bounds.
+ T (min); // { dg-warning "bound argument 1 value -\\d+ is negative for a variable length array argument 2 of type 'double\\\[n]\\\[5]'" }
+ T (r_m1); // { dg-warning "bound argument 1 value \\\[-\\d+, -1] is negative for a variable length array argument 2 of type 'double\\\[n]\\\[5]" }
+ T ( -1); // { dg-warning "bound argument 1 value -1 is negative for a variable length array argument 2 of type 'double\\\[n]\\\[5]" }
+
+ T ( 0);
+
+ // Verify positive bounds.
+ T ( 1); // { dg-warning "argument 1 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 2 value is 1" }
+ T ( 9); // { dg-warning "argument 1 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 2 value is 9" }
+ T (max); // { dg-warning "argument 1 of variable length array 'double\\\[n]\\\[5]' is null but the corresponding bound argument 2 value is \\d+" }
+}
+
+
+/* Exercise passing nul to a two-dimensional VLA. */
+
+void test_fca_n_n (int r_m1)
+{
+ extern void fca_n_n (int n, char[n][n]); // { dg-message "in a call to function 'fca_n_n'" "note" }
+
+#undef T
+#define T(n) fca_n_n (n, 0)
+
+ int min = INT_MIN;
+ int max = INT_MAX;
+ if (r_m1 >= 0)
+ r_m1 = -1;
+
+ // Verify negative bounds.
+ T (min); // { dg-warning "bound argument 1 value -\\d+ is negative for a variable length array argument 2 of type 'char\\\[n]\\\[n]'" }
+ T (r_m1); // { dg-warning "bound argument 1 value \\\[-\\d+, -1] is negative for a variable length array argument 2 of type 'char\\\[n]\\\[n]" }
+ T ( -1); // { dg-warning "bound argument 1 value -1 is negative for a variable length array argument 2 of type 'char\\\[n]\\\[n]" }
+
+ T ( 0);
+
+ // Verify positive bounds.
+ T ( 1); // { dg-warning "argument 1 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 2 value is 1" }
+ T ( 9); // { dg-warning "argument 1 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 2 value is 9" }
+ T (max); // { dg-warning "argument 1 of variable length array 'char\\\[n]\\\[n]' is null but the corresponding bound argument 2 value is \\d+" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wnonnull-5.c b/gcc/testsuite/gcc.dg/Wnonnull-5.c
new file mode 100644
index 0000000..ef6ed54
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wnonnull-5.c
@@ -0,0 +1,53 @@
+/* PR middle-end/97552 - missing waning passing null to a VLA argument
+ declared [static]
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+#define A(...) __attribute__ ((__VA_ARGS__))
+
+void fptr_array (int(*)[0]);
+
+void fstatic_array (int[static 0]);
+void A (nonnull) fnonnull_static_array (int [static 0]);
+
+void fvla (int n, int [n]);
+void A (nonnull) fnonnull_vla (int n, int [n]);
+
+void fstatic_vla (int n, int [static n]);
+void A (nonnull) fnonnull_static_vla (int n, int [static n]);
+
+
+void test_null (void)
+{
+ fptr_array (0);
+ fptr_array (&(int[0]){ });
+
+ fstatic_array (0); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_array (0); // { dg-warning "\\\[-Wnonnull" }
+
+ fvla (0, 0);
+ fnonnull_vla (0, 0); // { dg-warning "\\\[-Wnonnull" }
+
+ fstatic_vla (0, 0); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_vla (0, 0); // { dg-warning "\\\[-Wnonnull" }
+}
+
+
+#pragma GCC optimize ("1")
+
+void test_null_optimized (void)
+{
+ int (*pa)[0] = 0;
+ fptr_array (pa);
+
+ int *p = 0;
+
+ fstatic_array (p); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_array (p); // { dg-warning "\\\[-Wnonnull" }
+
+ fvla (0, p);
+ fnonnull_vla (0, p); // { dg-warning "\\\[-Wnonnull" }
+
+ fstatic_vla (0, p); // { dg-warning "\\\[-Wnonnull" }
+ fnonnull_static_vla (0, p); // { dg-warning "\\\[-Wnonnull" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wrestrict-22.c b/gcc/testsuite/gcc.dg/Wrestrict-22.c
new file mode 100644
index 0000000..46f507b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wrestrict-22.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wrestrict" } */
+
+void test_memcpy_warn (char *d, unsigned n)
+{
+ for (unsigned i = n; i < 30; ++i)
+ if (i > 10)
+ __builtin_memcpy (d, d + 2, i); /* { dg-warning "overlaps" } */
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-23.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-23.c
index bbc1210..0da916a 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-23.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-23.c
@@ -40,7 +40,11 @@ void test_rd2_1 (void)
{
void *null = 0;
- rd2_1 (SR (1, 2), null); // { dg-warning "argument 2 is null but the corresponding size argument 1 range is \\\[1, 2]" }
+ /* Ideally the message would say "range" for a range and "value"
+ for a singular value but using the same reduces the complexity
+ of the code and keeps down the number of messages that need to
+ be translated, withot sacrificing (too much) clarity. */
+ rd2_1 (SR (1, 2), null); // { dg-warning "argument 2 is null but the corresponding size argument 1 range|value is \\\[1, 2]" }
}
}
@@ -59,7 +63,7 @@ void test_wr3_1 (void)
void *null = 0;
- wr3_1 (SR (1, 2), 1, null); // { dg-warning "argument 3 is null but the corresponding size argument 1 range is \\\[1, 2]" }
+ wr3_1 (SR (1, 2), 1, null); // { dg-warning "argument 3 is null but the corresponding size argument 1 range|value is \\\[1, 2]" }
}
@@ -71,7 +75,7 @@ void test_wrd2_1 (int n)
wr2_1 (0, 0);
wr2_1 (SR (-1, 1), 0);
wr2_1 (SR (0, 1), 0);
- wr2_1 (SR (1, 2), 0); // { dg-warning "argument 2 is null but the corresponding size argument 1 range is \\\[1, 2]" }
+ wr2_1 (SR (1, 2), 0); // { dg-warning "argument 2 is null but the corresponding size argument 1 range|value is \\\[1, 2]" }
/* This should probably be diagnosed but to avoid false positives
caused by jump threading and such it would have to be done
@@ -127,7 +131,7 @@ void test_rd1_3_wr2_4 (const void *s, void *d, int n1, int n2)
rd1_3_wr2_4 (s, d, -1, 2); // { dg-warning "argument 3 value -1 is negative" }
const int ir_min_m1 = SR (INT_MIN, -1);
- rd1_3_wr2_4 (s, d, ir_min_m1, 2); // { dg-warning "argument 3 range \\\[-\[0-9\]+, -1] is negative" }
+ rd1_3_wr2_4 (s, d, ir_min_m1, 2); // { dg-warning "argument 3 range|value \\\[-\[0-9\]+, -1] is negative" }
rd1_3_wr2_4 (s, d, SR (-1, 0), 2);
rd1_3_wr2_4 (s, d, SR (INT_MIN, INT_MAX), 2);
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c
index fd43f3a..a1b1039 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-34.c
@@ -112,7 +112,7 @@ void s2_warn_cstoff_cstidx (struct S2 *p)
void s2_warn_varoff_cstdix (struct S2 *p, int i)
{
char *q = p->a + i;
- q[2] = __LINE__; // { dg-warning "\\\[-Wstringop-overflow" "pr?????" { xfail *-*-* } }
+ q[2] = __LINE__; // { dg-warning "\\\[-Wstringop-overflow" }
}
void s2_warn_cstoff_varidx (struct S2 *p, int i)
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-37.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-37.c
index 339f904..46f8fed 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-37.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-37.c
@@ -185,6 +185,18 @@ void test_note (const char *s)
}
{
+ char a[1][1][2]; // { dg-message "at offset 2 into " }
+ strncpy (a[0][1], s, 3); // { dg-warning "writing 3 bytes into a region of size 0 " }
+ sink (a);
+ }
+
+ {
+ char a[1][2][2]; // { dg-message "destination object" }
+ strncpy (a[0][0], s, 3); // { dg-warning "writing 3 bytes into a region of size 2 " }
+ sink (a);
+ }
+
+ {
char a[1][2][2]; // { dg-message "at offset 2 into " }
strncpy (a[0][1], s, 3); // { dg-warning "writing 3 bytes into a region of size 2 " }
sink (a);
@@ -192,7 +204,13 @@ void test_note (const char *s)
{
char a[1][2][2]; // { dg-message "at offset 4 into " }
- strncpy (a[1][0], s, 3); // { dg-warning "writing 3 bytes into a region of size 2 " }
+ strncpy (a[1][0], s, 3); // { dg-warning "writing 3 bytes into a region of size 0 " }
+ sink (a);
+ }
+
+ {
+ char a[2][1][2]; // { dg-message "at offset 2 into " }
+ strncpy (a[0][1], s, 3); // { dg-warning "writing 3 bytes into a region of size 0 " }
sink (a);
}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c
new file mode 100644
index 0000000..9b2d2cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-41.c
@@ -0,0 +1,120 @@
+/* Verify that writes at excessive offsets into declared or allocated
+ objects of unknown size are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#define DIFF_MAX __PTRDIFF_MAX__
+
+typedef __SIZE_TYPE__ size_t;
+
+void* malloc (size_t);
+void* memcpy (void*, const void*, size_t);
+void* memset (void*, int, size_t);
+
+void sink (void*);
+
+
+void char_array_cst_off_cst_size (void)
+{
+ extern char caxcc[]; // { dg-message "at offset \\d+ into destination object 'caxcc'" }
+
+ char *p = caxcc;
+ size_t idx = DIFF_MAX - 3;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 2" }
+ sink (p);
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 1" "pr?????" { xfail ilp32 } }
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 0" }
+ sink (p);
+}
+
+
+void char_array_var_off_cst_size (size_t idx)
+{
+ /* The offset is a range with a very large lower bound and an upper
+ bound of DIFF_MAX. There's not point in also mentioning the latter
+ (it wouldn't make the note any more meaningful) so verify it only
+ mentions the lower bound. */
+ extern char caxvc[]; // { dg-message "at offset \\d+ into destination object 'caxvc'" "note" }
+
+ char *p = caxvc;
+
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+ sink (p);
+}
+
+
+void char_array_var_off_var_size (size_t idx, size_t n)
+{
+ extern char caxvv[]; // { dg-message "at offset \\d+ into destination object 'caxvv'" "note" }
+
+ char *p = caxvv;
+
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ if (n < 3 || 7 < n)
+ n = 3;
+
+ memset (p + idx, 0, n);
+ sink (p);
+
+ ++n;
+ memset (p + idx, 0, n); // { dg-warning "writing between 4 and 8 bytes into a region of size 3" }
+ sink (p);
+}
+
+
+void alloc_array_var_off_cst_size (size_t n, size_t idx)
+{
+ char *p = malloc (n); // { dg-message "at offset \\d+ into destination object" "note" }
+
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+ sink (p);
+}
+
+
+void int_array_cst_off_cst_size (void)
+{
+ extern int iaxc[]; // { dg-message "at offset \[1-9\]\[0-9\]+ into destination object 'iaxc'" }
+
+ int *p = iaxc;
+ size_t idx = DIFF_MAX / sizeof *iaxc;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+ sink (p);
+}
+
+
+void* nowarn_anti_range_1 (char *p, char *q)
+{
+ size_t n = q - p;
+ if (!n) return 0;
+
+ char *d = __builtin_malloc (n + 1);
+ memcpy (d, p, n + 1); // { dg-bogus "-Wstringop-overflow" }
+ return d;
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c
index 3ac5a88..14ab925 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-43.c
@@ -159,9 +159,10 @@ void warn_memset_reversed_range (void)
char *p = &a11[11];
- /* The below is represented as a true anti-range as opposed to a range
- with reversed bounds and the former aren't handled. */
- T1 (p, SAR (INT_MIN, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" "pr?????" { xfail *-*-* } }
+ /* Since the offset is excessive, either starting before &a11[0]
+ ot just past &a[11], the region size in the warning should
+ probably be zero, but accept other sizes too. */
+ T1 (p, SAR (INT_MIN, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size \\d+" }
/* The following are represented as ordinary ranges with reversed bounds
and those are handled. */
@@ -171,7 +172,7 @@ void warn_memset_reversed_range (void)
T1 (p, SAR (INT_MIN, 1), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" "pr?????" { xfail ilp32 } }
T1 (p, SAR (INT_MIN, 0), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
/* Also represented as a true anti-range. */
- T1 (p, SAR ( -12, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" "pr?????" { xfail *-*-* } }
+ T1 (p, SAR ( -12, -11), n11); // { dg-warning "writing 11 or more bytes into a region of size \\d+" }
T1 (p, SAR ( -12, -1), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
T1 (p, SAR ( -11, 0), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
T1 (p, SAR ( -11, 11), n11); // { dg-warning "writing 11 or more bytes into a region of size 0" }
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-44.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-44.c
new file mode 100644
index 0000000..9e292a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-44.c
@@ -0,0 +1,129 @@
+/* PR middle-end/97175 - ICE on an excessive strncpy bound
+ { dg-do compile }
+ { dg-options "-O -Wall" } */
+
+int n;
+
+char *d;
+
+void sink (void*);
+
+/* Exercise calls with a destination of unknown size. */
+
+void f0 (const void *s)
+{
+ if (n > 0) return;
+ __builtin_memcpy (d, s, n); // eliminated
+}
+
+void f1 (const void *s)
+{
+ if (n > 0) return;
+ __builtin_memmove (d, s, n); // eliminated
+}
+
+void f2 (void)
+{
+ if (n > 0) return;
+ __builtin_memset (d, 0, n); // eliminated
+}
+
+void f3 (const char *s)
+{
+ if (n > 0) return;
+ __builtin_strncpy (d, s, n); // can be eliminated but isn't
+}
+
+void f4 (const char *s)
+{
+ if (n > 0) return;
+ *d = 0;
+ __builtin_strncat (d, s, n); // can be eliminated but isn't
+}
+
+
+/* Exercise the same calls but with a declared destination object. */
+
+void g0 (const void *s)
+{
+ if (n > 0) return;
+ char a[1];
+ __builtin_memcpy (a, s, n); // eliminated
+ sink (a);
+}
+
+void g1 (const void *s)
+{
+ if (n > 0) return;
+ char a[1];
+ __builtin_memmove (a, s, n); // eliminated
+ sink (a);
+}
+
+void g2 (void)
+{
+ if (n > 0) return;
+ char a[1];
+ __builtin_memset (a, 0, n); // eliminated
+ sink (a);
+}
+
+void g3 (const char *s)
+{
+ if (n > 0) return;
+ char a[1];
+ __builtin_strncpy (a, s, n); // can be eliminated but isn't
+ sink (a);
+}
+
+void g4 (const char *s)
+{
+ if (n > 0) return;
+ char a[1];
+ *a = 0;
+ __builtin_strncat (a, s, n); // can be eliminated but isn't
+ sink (a);
+}
+
+
+void h0 (const void *s)
+{
+ if (n > 0) return;
+ d = __builtin_malloc (1);
+ __builtin_memcpy (d, s, n); // eliminated
+}
+
+void h1 (const void *s)
+{
+ if (n > 0) return;
+ d = __builtin_malloc (1);
+ __builtin_memmove (d, s, n); // eliminated
+}
+
+void h2 (void)
+{
+ if (n > 0) return;
+ d = __builtin_malloc (1);
+ __builtin_memset (d, 0, n); // eliminated
+}
+
+void h3 (const char *s)
+{
+ if (n > 0) return;
+ d = __builtin_malloc (1);
+ __builtin_strncpy (d, s, n); // can be eliminated but isn't
+}
+
+void h4 (const char *s)
+{
+ if (n > 0) return;
+ d = __builtin_malloc (1);
+ *d = 0;
+ __builtin_strncat (d, s, n); // can be eliminated but isn't
+}
+
+/* The calls above that aren't eliminated trigger
+ warning: specified size between INT_MAX and SIZE_MAX exceed maximum
+ object size PTRDIFF_MAX
+ { dg-prune-output "-Wstringop-overflow" }
+ { dg-prune-output "-Wstringop-overread" } */
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s b/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s
new file mode 100644
index 0000000..0fc73a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s
@@ -0,0 +1,271 @@
+ .file "Wstringop-overflow-44.c"
+ .text
+ .p2align 4
+ .globl f0
+ .type f0, @function
+f0:
+.LFB0:
+ .cfi_startproc
+ ret
+ .cfi_endproc
+.LFE0:
+ .size f0, .-f0
+ .p2align 4
+ .globl f1
+ .type f1, @function
+f1:
+.LFB1:
+ .cfi_startproc
+ ret
+ .cfi_endproc
+.LFE1:
+ .size f1, .-f1
+ .p2align 4
+ .globl f2
+ .type f2, @function
+f2:
+.LFB2:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L12
+.L4:
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L12:
+ movslq %eax, %rdx
+ movq d(%rip), %rcx
+ testq %rdx, %rdx
+ je .L4
+ xorl %eax, %eax
+.L6:
+ movb $0, (%rcx,%rax)
+ addq $1, %rax
+ cmpq %rdx, %rax
+ jb .L6
+ ret
+ .cfi_endproc
+.LFE2:
+ .size f2, .-f2
+ .p2align 4
+ .globl f3
+ .type f3, @function
+f3:
+.LFB3:
+ .cfi_startproc
+ movslq n(%rip), %rdx
+ testl %edx, %edx
+ jle .L15
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L15:
+ movq %rdi, %rsi
+ movq d(%rip), %rdi
+ jmp strncpy
+ .cfi_endproc
+.LFE3:
+ .size f3, .-f3
+ .p2align 4
+ .globl f4
+ .type f4, @function
+f4:
+.LFB4:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L18
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L18:
+ movq d(%rip), %rax
+ movq %rdi, %rsi
+ movb $0, (%rax)
+ movslq n(%rip), %rdx
+ movq d(%rip), %rdi
+ jmp strncat
+ .cfi_endproc
+.LFE4:
+ .size f4, .-f4
+ .p2align 4
+ .globl g0
+ .type g0, @function
+g0:
+.LFB5:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L25
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L25:
+ subq $24, %rsp
+ .cfi_def_cfa_offset 32
+ leaq 15(%rsp), %rdi
+ call sink
+ addq $24, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE5:
+ .size g0, .-g0
+ .p2align 4
+ .globl g1
+ .type g1, @function
+g1:
+.LFB6:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L32
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L32:
+ subq $24, %rsp
+ .cfi_def_cfa_offset 32
+ leaq 15(%rsp), %rdi
+ call sink
+ addq $24, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE6:
+ .size g1, .-g1
+ .p2align 4
+ .globl g2
+ .type g2, @function
+g2:
+.LFB7:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L45
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L45:
+ movslq %eax, %rdx
+ subq $24, %rsp
+ .cfi_def_cfa_offset 32
+ testq %rdx, %rdx
+ je .L36
+ xorl %eax, %eax
+.L35:
+ movb $0, 15(%rsp,%rax)
+ addq $1, %rax
+ cmpq %rdx, %rax
+ jb .L35
+.L36:
+ leaq 15(%rsp), %rdi
+ call sink
+ addq $24, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE7:
+ .size g2, .-g2
+ .p2align 4
+ .globl g3
+ .type g3, @function
+g3:
+.LFB8:
+ .cfi_startproc
+ movslq n(%rip), %rdx
+ testl %edx, %edx
+ jle .L52
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L52:
+ subq $24, %rsp
+ .cfi_def_cfa_offset 32
+ movq %rdi, %rsi
+ leaq 15(%rsp), %rdi
+ call strncpy
+ leaq 15(%rsp), %rdi
+ call sink
+ addq $24, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE8:
+ .size g3, .-g3
+ .p2align 4
+ .globl g4
+ .type g4, @function
+g4:
+.LFB9:
+ .cfi_startproc
+ movslq n(%rip), %rdx
+ testl %edx, %edx
+ jle .L59
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L59:
+ subq $24, %rsp
+ .cfi_def_cfa_offset 32
+ movq %rdi, %rsi
+ leaq 15(%rsp), %rdi
+ movb $0, 15(%rsp)
+ call strncat
+ leaq 15(%rsp), %rdi
+ call sink
+ addq $24, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE9:
+ .size g4, .-g4
+ .p2align 4
+ .globl h0
+ .type h0, @function
+h0:
+.LFB10:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L66
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L66:
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ movl $1, %edi
+ call malloc
+ movq %rax, d(%rip)
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE10:
+ .size h0, .-h0
+ .p2align 4
+ .globl h1
+ .type h1, @function
+h1:
+.LFB16:
+ .cfi_startproc
+ movl n(%rip), %eax
+ testl %eax, %eax
+ jle .L73
+ ret
+ .p2align 4,,10
+ .p2align 3
+.L73:
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ movl $1, %edi
+ call malloc
+ movq %rax, d(%rip)
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ ret
+ .cfi_endproc
+.LFE16:
+ .size h1, .-h1
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-45.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-45.c
new file mode 100644
index 0000000..112d79a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-45.c
@@ -0,0 +1,255 @@
+/* PR middle-end/97023 - missing warning on buffer overflow in chained mempcpy
+ Verify that out of bounds writes by built-ins to objects through pointers
+ returned by other built-ins are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#include "range.h"
+
+void* malloc (size_t);
+void* memcpy (void*, const void*, size_t);
+void* memmove (void*, const void*, size_t);
+void* mempcpy (void*, const void*, size_t);
+
+void sink (void*, ...);
+
+
+void nowarn_memcpy (const void *s)
+{
+ extern char cpy_a4[4];
+ unsigned n = sizeof cpy_a4;
+
+ void *p = cpy_a4;
+ p = memcpy (p, s, n);
+ sink (p);
+ memcpy (p, s, n);
+ sink (p);
+
+ p = cpy_a4 + 1;
+ p = memcpy (p, s, n - 1);
+ sink (p);
+ memcpy (p, s, n - 1);
+ sink (p);
+
+ p = cpy_a4 + 2;
+ p = memcpy (p, s, n - 2);
+ sink (p);
+ memcpy (p, s, n - 2);
+ sink (p);
+
+ p = cpy_a4 + 3;
+ p = memcpy (p, s, n - 3);
+ sink (p);
+ memcpy (p, s, n - 3);
+ sink (p);
+
+ p = cpy_a4 + 4;
+ p = memcpy (p, s, n - 4);
+ sink (p);
+ memcpy (p, s, n - 4);
+ sink (p);
+}
+
+
+void nowarn_memcpy_chain (const void *s)
+{
+ extern char cpy_a8[8];
+
+ char *p = cpy_a8;
+
+ p = memcpy (p + 1, s, 7);
+ sink (p);
+
+ p = memcpy (p + 2 , s, 5);
+ sink (p);
+
+ p = memcpy (p + 3 , s, 2);
+ sink (p);
+
+ p = memcpy (p + 1 , s, 1);
+ sink (p);
+
+ p = memcpy (p - 7 , s, 8);
+ sink (p);
+
+ memcpy (p + 1, s, 7);
+}
+
+
+void warn_memcpy (const void *s)
+{
+ extern char cpy_a5[5]; // { dg-message "destination object 'cpy_a5'" "note" }
+
+ unsigned n = sizeof cpy_a5;
+ void *p = cpy_a5;
+
+ p = memcpy (p, s, n);
+ sink (p);
+ memcpy (p, s, n + 1); // { dg-warning "writing 6 bytes into a region of size 5" }
+ sink (p);
+
+ p = cpy_a5;
+ p = memcpy (p, s, n);
+ sink (p);
+ memcpy (p, s, n + 1); // { dg-warning "writing 6 bytes into a region of size 5" }
+ sink (p);
+
+ p = cpy_a5 + 1;
+ p = memcpy (p, s, n - 1);
+ sink (p);
+ memcpy (p, s, n); // { dg-warning "writing 5 bytes into a region of size 4" }
+ sink (p);
+}
+
+
+void warn_memcpy_chain (const void *s)
+{
+ extern char cpy_a8[8]; // { dg-message "destination object 'cpy_a8'" "note" }
+
+ char *p = cpy_a8;
+
+ p = memcpy (p, s, 9); // { dg-warning "writing 9 bytes into a region of size 8" }
+ sink (p);
+
+ p = memcpy (p + 2, s, 7); // { dg-warning "writing 7 bytes into a region of size 6" }
+ sink (p);
+
+ p = memcpy (p + 3, s, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+ sink (p);
+
+ p = memcpy (p + 3, s, 3); // { dg-warning "writing 3 bytes into a region of size 0" }
+ sink (p);
+}
+
+
+void nowarn_mempcpy (const void *s)
+{
+ extern char a4[4];
+ unsigned n = sizeof a4;
+
+ char *p = mempcpy (a4, s, n);
+ sink (p);
+ mempcpy (p - 4, s, n);
+ sink (p);
+
+ p = mempcpy (a4 + 1, s, n - 1);
+ sink (p);
+ mempcpy (p - 4, s, n);
+ sink (p);
+
+ p = mempcpy (a4 + 2, s, n - 2);
+ sink (p);
+ mempcpy (p - 4, s, n);
+ sink (p);
+
+ p = mempcpy (a4 + 3, s, n - 3);
+ sink (p);
+ mempcpy (p - 4, s, n);
+ sink (p);
+
+ p = mempcpy (a4 + 4, s, n - 4);
+ sink (p);
+ mempcpy (p - 4, s, n);
+ sink (p);
+}
+
+
+void nowarn_mempcpy_chain (const void *s)
+{
+ extern char pcpy_a8[8];
+
+ char *p = pcpy_a8;
+
+ p = mempcpy (p + 1, s, 7);
+ sink (p);
+
+ p = mempcpy (p - 7 , s, 7);
+ sink (p);
+
+ p = mempcpy (p - 5 , s, 5);
+ sink (p);
+
+ p = mempcpy (p - 3 , s, 3);
+ sink (p);
+
+ p = mempcpy (p - 2 , s, 2);
+ sink (p);
+
+ mempcpy (p - 1, s, 1);
+ sink (p);
+
+ mempcpy (p - 8, s, 8);
+}
+
+
+void warn_mempcpy (const void *s)
+{
+ extern char pcpy_a5[5]; // { dg-message "destination object 'pcpy_a5'" "note" }
+
+ char *p = pcpy_a5;
+
+ p = mempcpy (p, s, 5);
+ sink (p);
+ mempcpy (p - 5, s, 6); // { dg-warning "writing 6 bytes into a region of size 5 " }
+ sink (p);
+
+ p = pcpy_a5;
+ p = mempcpy (p, s, 3);
+ sink (p);
+ mempcpy (p, s, 3); // { dg-warning "writing 3 bytes into a region of size 2 " }
+ sink (p);
+
+ p = pcpy_a5 + 1;
+ p = mempcpy (p, s, 3);
+ sink (p);
+ mempcpy (p - 1, s, 5); // { dg-warning "writing 5 bytes into a region of size 2 " }
+ sink (p);
+}
+
+
+void warn_mempcpy_chain_3 (const void *s)
+{
+ char *p = malloc (5); // { dg-message "at offset \\\[3, 5] into destination object of size 5" "note" }
+ p = mempcpy (p, s, UR (1, 2));
+ p = mempcpy (p, s, UR (2, 3));
+ p = mempcpy (p, s, UR (3, 4)); // { dg-warning "writing between 3 and 4 bytes into a region of size 2 " }
+
+ sink (p);
+}
+
+void warn_mempcpy_offrng_chain_3 (const void *s)
+{
+ char *p = malloc (11); // { dg-message "at offset \\\[9, 11] into destination object of size 11 " "note" }
+ size_t r1_2 = UR (1, 2);
+ size_t r2_3 = r1_2 + 1;
+ size_t r3_4 = r2_3 + 1;
+
+ p = mempcpy (p + r1_2, s, r1_2);
+ p = mempcpy (p + r2_3, s, r2_3);
+ p = mempcpy (p + r3_4, s, r3_4); // { dg-warning "writing between 3 and 4 bytes into a region of size 2 " }
+
+ sink (p);
+}
+
+void warn_mempcpy_chain_4 (const void *s)
+{
+ char *p = malloc (9); // { dg-message "at offset \\\[6, 9] into destination object of size 9 " "note" }
+ p = mempcpy (p, s, UR (1, 2));
+ p = mempcpy (p, s, UR (2, 3));
+ p = mempcpy (p, s, UR (3, 4));
+ p = mempcpy (p, s, UR (4, 5)); // { dg-warning "writing between 4 and 5 bytes into a region of size 3 " }
+
+ sink (p);
+}
+
+void warn_mempcpy_chain_5 (const void *s)
+{
+ char *p = malloc (14); // { dg-message "at offset \\\[10, 14] into destination object of size 14 " "note" }
+ p = mempcpy (p, s, UR (1, 2));
+ p = mempcpy (p, s, UR (2, 3));
+ p = mempcpy (p, s, UR (3, 4));
+ p = mempcpy (p, s, UR (4, 5));
+ p = mempcpy (p, s, UR (5, 6)); // { dg-warning "writing between 5 and 6 bytes into a region of size 4 " }
+
+ sink (p);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
new file mode 100644
index 0000000..a4d78b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-46.c
@@ -0,0 +1,97 @@
+/* PR middle-end/97023 - missing warning on buffer overflow in chained mempcpy
+ Verify that out of bounds writes by built-ins to objects through pointers
+ returned by memchr() are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#include "range.h"
+
+void* malloc (size_t);
+void* memchr (void*, int, size_t);
+void* memset (void*, int, size_t);
+
+void sink (void*, ...);
+
+void nowarn_memchr_cst_memset_cst (const void *s)
+{
+ char *p = malloc (4);
+ sink (p);
+
+ p = memchr (p, '1', 4);
+ memset (p, 0, 4);
+}
+
+void nowarn_memchr_uint_memset_cst (const void *s, unsigned n)
+{
+ char *p = malloc (4);
+ sink (p);
+
+ p = memchr (p, '1', n);
+ memset (p, 0, 4);
+}
+
+void nowarn_memchr_sz_memset_cst (const void *s, size_t n)
+{
+ char *p = malloc (4);
+ sink (p);
+
+ p = memchr (p, '1', n);
+ memset (p, 0, 4);
+}
+
+void nowarn_memchr_anti_range_memset_cst (const void *s, size_t n)
+{
+ char *p = malloc (4);
+ sink (p);
+
+ if (n == 0)
+ n = 1;
+
+ p = memchr (p, '1', n);
+ memset (p, 0, 4);
+}
+
+void warn_memchr_cst_memset_cst (const void *s)
+{
+ char *p = malloc (4); // { dg-message "at offset \\\[0, 4] into destination object of size 4 " "note" }
+ sink (p);
+
+ p = memchr (p, '1', 4);
+ memset (p, 0, 5); // { dg-warning "writing 5 bytes into a region of size 4 " }
+}
+
+void warn_memchr_var_memset_cst (const void *s, unsigned n)
+{
+ char *p = malloc (4); // { dg-message "at offset \\\[0, 4] into destination object of size 4 " "note" }
+ sink (p);
+
+ p = memchr (p, '1', n);
+ memset (p, 0, 5); // { dg-warning "writing 5 bytes into a region of size 4 " }
+}
+
+void warn_memchr_var_memset_range (const void *s, unsigned n)
+{
+ /* The offsets in the first two notes are bounded by the size of
+ the allocated object. The real upper bound of the offset in
+ the last note includes the upper bound f the offset of the pointer
+ returned from the previous memchr() call, but it ends up getting
+ constrained to the bounds of the allocated object so it's the same
+ as in the first two notes. The exact value probably isn't too
+ important. */
+ char *p0 = malloc (UR (5, 7));
+ // { dg-message "at offset \\\[0, 7] into destination object of size \\\[5, 7]" "note" { target *-*-* } .-1 }
+ // { dg-message "at offset \\\[1, 7] into destination object of size \\\[5, 7]" "note" { target *-*-* } .-2 }
+ // { dg-message "at offset \\\[2, 7] into destination object of size \\\[5, 7]" "note" { target *-*-* } .-3 }
+
+ sink (p0);
+ char *p1 = memchr (p0, '1', n);
+ memset (p1, 0, UR (8, 9)); // { dg-warning "writing between 8 and 9 bytes into a region of size 7 " }
+
+ sink (p0);
+ p1 = memchr (p0 + 1, '2', n);
+ memset (p1, 0, UR (7, 9)); // { dg-warning "writing between 7 and 9 bytes into a region of size 6 " }
+
+ sink (p0);
+ char *p2 = memchr (p1 + 1, '3', n);
+ memset (p2, 0, UR (6, 9)); // { dg-warning "writing between 6 and 9 bytes into a region of size 5 " }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c
new file mode 100644
index 0000000..02b14ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-47.c
@@ -0,0 +1,69 @@
+/* Verify that storing a bigger vector into smaller space is diagnosed.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+typedef __INT16_TYPE__ int16_t;
+typedef __attribute__ ((__vector_size__ (32))) char C32;
+
+typedef __attribute__ ((__vector_size__ (64))) int16_t I16_64;
+
+void sink (void*);
+
+
+void nowarn_c32 (char c)
+{
+ extern char nowarn_a32[32];
+
+ void *p = nowarn_a32;
+ *(C32*)p = (C32){ c };
+ sink (p);
+
+ char a32[32];
+ p = a32;
+ *(C32*)p = (C32){ c };
+ sink (p);
+}
+
+void warn_c32 (char c)
+{
+ extern char warn_a32[32]; // { dg-message "at offset 32 to object 'warn_a32' with size 32" }
+
+ void *p = warn_a32 + 1;
+ *(C32*)p = (C32){ c }; // { dg-warning "writing 1 byte into a region of size 0" }
+
+ /* Verify a local variable too. */
+ char a32[32];
+ p = a32 + 1;
+ *(C32*)p = (C32){ c }; // { dg-warning "writing 1 byte into a region of size 0" }
+ sink (p);
+}
+
+
+void nowarn_i16_64 (int16_t i)
+{
+ extern char nowarn_a64[64];
+
+ void *p = nowarn_a64;
+ I16_64 *q = (I16_64*)p;
+ *q = (I16_64){ i };
+
+ char a64[64];
+ q = (I16_64*)a64;
+ *q = (I16_64){ i };
+ sink (q);
+}
+
+void warn_i16_64 (int16_t i)
+{
+ extern char warn_a64[64]; // { dg-message "at offset 128 to object 'warn_a64' with size 64" "pr97027" { xfail *-*-* } }
+
+ void *p = warn_a64 + 1;
+ I16_64 *q = (I16_64*)p;
+ *q = (I16_64){ i }; // { dg-warning "writing 1 byte into a region of size 0" "pr97027" { xfail *-*-* } }
+
+ char a64[64];
+ p = a64 + 1;
+ q = (I16_64*)p;
+ *q = (I16_64){ i }; // { dg-warning "writing 1 byte into a region of size 0" "pr97027" { xfail *-*-* } }
+ sink (p);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-49.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-49.c
new file mode 100644
index 0000000..84b6c94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-49.c
@@ -0,0 +1,146 @@
+/* Verify the handling of anti-ranges/multi-ranges by allocation functions
+ and subsequent accesses.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+void* malloc (size_t);
+void bzero (void*, size_t);
+void* memset (void*, int, size_t);
+
+
+/* Exercise size_t (via malloc and memset) and unsigned/signed int. */
+
+__attribute__ ((alloc_size (1))) void*
+alloc_int (int);
+
+__attribute__ ((access (write_only, 1, 2))) void
+access_int (void*, int);
+
+__attribute__ ((alloc_size (1))) void*
+alloc_uint (unsigned);
+
+__attribute__ ((access (write_only, 1, 2))) void
+access_uint (void*, unsigned);
+
+
+void* nowarn_malloc_memset_same_anti_range (size_t n)
+{
+ /* Set N to the anti-range ~[3, 3]. */
+ if (n == 3)
+ n = 4;
+ void *p = malloc (n);
+
+ /* Verify there is no warning for an access to N bytes at P.
+ This means the warning has to assume the value of N in the call
+ to alloc() is in the larger subrange [4, UINT_MAX], while in
+ the call to access() in [0, 3]. */
+ return memset (p, 0, n);
+}
+
+/* Same as above but with two valid ranges. */
+
+void* nowarn_malloc_memset_anti_range (size_t n1, size_t n2)
+{
+ /* Set N1 to the anti-range ~[3, 3]. */
+ if (n1 == 3)
+ n1 = 4;
+ void *p = malloc (n1);
+
+ /* Set N2 to the anti-range ~[7, 7]. */
+ if (n2 == 7)
+ n2 = 8;
+
+ return memset (p, 0, n2);
+}
+
+
+void nowarn_alloc_access_same_anti_range_int (int n)
+{
+ /* Set N to the anti-range ~[3, 3]. */
+ if (n == 3)
+ n = 4;
+ void *p = alloc_int (n);
+
+ /* Verify there is no warning for an access to N bytes at P.
+ This means the warning has to assume the value of N in the call
+ to alloc() is in the larger subrange [4, UINT_MAX], while in
+ the call to access() in [0, 3]. */
+ access_int (p, n);
+}
+
+/* Same as above but with two valid ranges. */
+
+void nowarn_alloc_access_anti_range_int (int n1, int n2)
+{
+ /* Set N1 to the anti-range ~[3, 3]. */
+ if (n1 == 3)
+ n1 = 4;
+ void *p = alloc_int (n1);
+
+ /* Set N2 to the anti-range ~[7, 7]. */
+ if (n2 == 7)
+ n2 = 8;
+
+ access_int (p, n2);
+}
+
+
+void nowarn_alloc_access_same_anti_range_uint (unsigned n)
+{
+ /* Set N to the anti-range ~[3, 3]. */
+ if (n == 3)
+ n = 4;
+ void *p = alloc_uint (n);
+
+ /* Verify there is no warning for an access to N bytes at P.
+ This means the warning has to assume the value of N in the call
+ to alloc() is in the larger subrange [4, UINT_MAX], while in
+ the call to access() in [0, 3]. */
+ access_uint (p, n);
+}
+
+/* Same as above but with two valid ranges. */
+
+void nowarn_alloc_access_anti_range_uint (unsigned n1, unsigned n2)
+{
+ /* Set N1 to the anti-range ~[3, 3]. */
+ if (n1 == 3)
+ n1 = 4;
+ void *p = alloc_uint (n1);
+
+ /* Set N2 to the anti-range ~[7, 7]. */
+ if (n2 == 7)
+ n2 = 8;
+
+ access_uint (p, n2);
+}
+
+
+void* nowarn_malloc_anti_range_memset_range (size_t n1, size_t n2)
+{
+ /* Set N1 to the anti-range ~[3, 3]. */
+ if (n1 == 3)
+ n1 = 4;
+ void *p = malloc (n1);
+
+ /* Set N2 to the range [5, MAX]. */
+ if (n2 < 5)
+ n2 = 5;
+ return memset (p, 0, n2);
+}
+
+void* nowarn_malloc_range_bzero_anti_range (size_t n1, size_t n2)
+{
+ /* Set N1 to the anti-range ~[3, 3]. */
+ if (n1 > 4)
+ n1 = 4;
+ void *p = malloc (n1);
+
+ /* Set N2 to the range [5, MAX]. */
+ if (n2 <= 3 || 5 <= n2)
+ n2 = 4;
+ bzero (p, n2);
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-50.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-50.c
new file mode 100644
index 0000000..7df58e5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-50.c
@@ -0,0 +1,125 @@
+/* Verify that writes at excessive offsets into objects of unknown size
+ pointed to by function arguments are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#define DIFF_MAX __PTRDIFF_MAX__
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __SIZE_TYPE__ size_t;
+
+void* memset (void*, int, size_t);
+
+void sink (void*);
+
+char* fcall (void);
+
+void char_ptr_cst_off_cst_size (char *p)
+ // { dg-message "at offset \[1-9\]\[0-9\]+ into destination object 'p'" "note" { target *-*-* } .-1 }
+{
+ size_t idx = DIFF_MAX - 3;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 2" }
+ sink (p);
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 1" }
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 0" }
+}
+
+
+void char_ptr_var_difoff_cst_size (ptrdiff_t idx)
+{
+ char *p = fcall ();
+ /* The offset is a range with a very large lower bound and an upper
+ bound of DIFF_MAX. There's not point in also mentioning the latter
+ (it wouldn't make the note any more meaningful) so verify it only
+ mentions the lower bound.
+ { dg-message "at offset \\d+ into destination object of size \\\[0, \\d+] (allocated|returned) by 'fcall'" "note" { target *-*-* } .-5 } */
+
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+}
+
+
+void char_ptr_var_szoff_cst_size (size_t idx)
+{
+ extern char* gptr;
+ // { dg-message "at offset \\d+ into destination object 'gptr'" "note" { target *-*-* } .-1 }
+
+ char *p = gptr;
+
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" "" { xfail *-*-* } }
+
+ if (idx > DIFF_MAX)
+ idx = DIFF_MAX;
+
+ memset (p + idx, 0, 7); // { dg-warning "writing 7 bytes into a region of size 3" }
+}
+
+
+void char_ptr_var_difoff_var_size (char *p, ptrdiff_t idx, size_t n)
+ // { dg-message "at offset \\d+ into destination object 'p'" "note" { target *-*-* } .-1 }
+{
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ if (n < 3 || 7 < n)
+ n = 3;
+
+ memset (p + idx, 0, n);
+ sink (p);
+
+ ++n;
+ memset (p + idx, 0, n); // { dg-warning "writing between 4 and 8 bytes into a region of size 3" }
+}
+
+
+void char_ptr_var_szoff_var_size (char *p, size_t idx, size_t n)
+ // { dg-message "at offset \\\[\[1-9\]\[0-9\]+, \[1-9\]\[0-9\]+] into destination object 'p'" "note" { xfail *-*-* } .-1 }
+{
+ if (idx < DIFF_MAX - 3)
+ idx = DIFF_MAX - 3;
+
+ if (n < 3 || 7 < n)
+ n = 3;
+
+ memset (p + idx, 0, n);
+ sink (p);
+
+ ++n;
+ /* With an unsigned offset large values are interpreted as negative
+ so the addition (p + idx) is effectively treated as subtraction,
+ making an overflow indistinguishable from a valid (if unlikely)
+ store. */
+ memset (p + idx, 0, n); // { dg-warning "writing between 4 and 8 bytes into a region of size 3" "pr?????" { xfail *-*-* } }
+}
+
+
+void int_ptr_cst_off_cst_size (int *p)
+ // { dg-message "at offset \[1-9\]\[0-9\]+ into destination object 'p'" "note" { target *-*-* } .-1 }
+{
+ size_t idx = DIFF_MAX / sizeof *p;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-51.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-51.c
new file mode 100644
index 0000000..6f36643
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-51.c
@@ -0,0 +1,34 @@
+/* Test case derived from Binutils/GDB's readline/readline/histexpand.c.
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+char *
+get_subst_pattern (char *str, int *iptr, int delimiter, int is_rhs, int *lenptr)
+{
+ int si, i, j, k;
+ char *s;
+
+ s = 0;
+ i = *iptr;
+
+ for (si = i; str[si] && str[si] != delimiter; si++)
+ if (str[si] == '\\' && str[si + 1] == delimiter)
+ si++;
+
+ if (si > i || is_rhs)
+ {
+ s = (char *)__builtin_malloc (si - i + 1);
+ for (j = 0, k = i; k < si; j++, k++)
+ {
+ /* Remove a backslash quoting the search string delimiter. */
+ if (str[k] == '\\' && str[k + 1] == delimiter)
+ k++;
+ s[j] = str[k]; // { dg-bogus "-Wstringop-overflow" }
+ }
+ s[j] = '\0';
+ if (lenptr)
+ *lenptr = j;
+ }
+
+ return s;
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-52.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-52.c
new file mode 100644
index 0000000..a289655
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-52.c
@@ -0,0 +1,62 @@
+
+/* PR middle-end/97023 - missing warning on buffer overflow in chained mempcpy
+ Verify that writes by built-in functions to objects through pointers
+ returned by ordinary (non-built-int) function are assumed to point to
+ the beginning of objects.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#include "range.h"
+
+void* memcpy (void*, const void*, size_t);
+void* memset (void*, int, size_t);
+
+void sink (void*, ...);
+
+extern char* arrptr[];
+extern char* ptr;
+extern char* retptr (void);
+struct S { char *p; };
+extern struct S retstruct (void);
+
+void nowarn_ptr (void)
+{
+ {
+ void *p = arrptr;
+ memset (p - 1, 0, 12345); // { dg-warning "\\\[-Wstringop-overflow" }
+ memset (p,0, 12345);
+ memset (p,0, DIFF_MAX - 1);
+ }
+
+ {
+ char *p = arrptr[0];
+ memset (p - 1, 0, 12345);
+ memset (p - 12345, 0, 12345);
+ memset (p - 1234, 0, DIFF_MAX - 1);
+ memset (p - DIFF_MAX + 1, 0, 12345);
+ }
+
+ {
+ char *p = ptr;
+ memset (p - 1, 0, 12345);
+ memset (p - 12345, 0, 12345);
+ memset (p - 1234, 0, DIFF_MAX - 1);
+ memset (p - DIFF_MAX + 1, 0, 12345);
+ }
+
+ {
+ char *p = retptr ();
+ memset (p - 1, 0, 12345);
+ memset (p - 12345, 0, 12345);
+ memset (p - 1234, 0, DIFF_MAX - 1);
+ memset (p - DIFF_MAX + 1, 0, 12345);
+ }
+
+ {
+ char *p = retstruct ().p;
+ memset (p - 1, 0, 12345);
+ memset (p - 12345, 0, 12345);
+ memset (p - 1234, 0, DIFF_MAX - 1);
+ memset (p - DIFF_MAX + 1, 0, 12345);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-53.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-53.c
new file mode 100644
index 0000000..cd8fa32
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-53.c
@@ -0,0 +1,116 @@
+/* PR middle-end/96384 - bogus -Wstringop-overflow= storing into
+ multidimensional array with index in range
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define SHRT_MAX __SHRT_MAX__
+#define SHRT_MIN (-SHRT_MAX - 1)
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-INT_MAX - 1)
+#define LONG_MAX __LONG_MAX__
+#define LONG_MIN (-LONG_MAX - 1)
+
+#define USHRT_MAX (SHRT_MAX * 2 + 1)
+#define UINT_MAX ~0U
+#define ULONG_MAX ~0LU
+
+char ca3_5_7[3][5][7];
+
+void nowarn_ca_3_5_ssi (short i)
+{
+ if (i > SHRT_MAX - 1)
+ i = SHRT_MAX - 1;
+
+ ca3_5_7[i][0][0] = __LINE__;
+ ca3_5_7[i][0][1] = __LINE__;
+ ca3_5_7[i][0][2] = __LINE__;
+ ca3_5_7[i][0][3] = __LINE__;
+ ca3_5_7[i][0][4] = __LINE__;
+ ca3_5_7[i][0][5] = __LINE__;
+ ca3_5_7[i][0][6] = __LINE__;
+
+ ca3_5_7[i][1][0] = __LINE__;
+ ca3_5_7[i][1][1] = __LINE__;
+ ca3_5_7[i][1][2] = __LINE__;
+ ca3_5_7[i][1][3] = __LINE__;
+ ca3_5_7[i][1][4] = __LINE__;
+ ca3_5_7[i][1][5] = __LINE__;
+ ca3_5_7[i][1][6] = __LINE__;
+
+ ca3_5_7[i][2][0] = __LINE__;
+ ca3_5_7[i][2][1] = __LINE__;
+ ca3_5_7[i][2][2] = __LINE__;
+ ca3_5_7[i][2][3] = __LINE__;
+ ca3_5_7[i][2][4] = __LINE__;
+ ca3_5_7[i][2][5] = __LINE__;
+ ca3_5_7[i][2][6] = __LINE__;
+
+ ca3_5_7[i][3][0] = __LINE__;
+ ca3_5_7[i][3][1] = __LINE__;
+ ca3_5_7[i][3][2] = __LINE__;
+ ca3_5_7[i][3][3] = __LINE__;
+ ca3_5_7[i][3][4] = __LINE__;
+ ca3_5_7[i][3][5] = __LINE__;
+ ca3_5_7[i][3][6] = __LINE__;
+
+ ca3_5_7[i][4][0] = __LINE__;
+ ca3_5_7[i][4][1] = __LINE__;
+ ca3_5_7[i][4][2] = __LINE__;
+ ca3_5_7[i][4][3] = __LINE__;
+ ca3_5_7[i][4][4] = __LINE__;
+ ca3_5_7[i][4][5] = __LINE__;
+ ca3_5_7[i][4][6] = __LINE__;
+
+ ca3_5_7[1][i][5] = __LINE__;
+ ca3_5_7[2][3][i] = __LINE__;
+}
+
+void nowarn_ca_3_5_usi (unsigned short i)
+{
+ if (i > USHRT_MAX - 1)
+ i = USHRT_MAX - 1;
+
+ ca3_5_7[i][3][5] = __LINE__;
+ ca3_5_7[1][i][5] = __LINE__;
+ ca3_5_7[2][3][i] = __LINE__;
+}
+
+void nowarn_ca_3_5_si (int i)
+{
+ if (i > INT_MAX - 1)
+ i = INT_MAX - 1;
+
+ ca3_5_7[i][3][5] = __LINE__;
+ ca3_5_7[1][i][5] = __LINE__;
+ ca3_5_7[2][3][i] = __LINE__;
+}
+
+void nowarn_ca_3_5_ui (unsigned i)
+{
+ if (i > UINT_MAX - 1)
+ i = UINT_MAX - 1;
+
+ ca3_5_7[i][3][5] = __LINE__;
+ ca3_5_7[1][i][5] = __LINE__;
+ ca3_5_7[2][3][i] = __LINE__;
+}
+
+void nowarn_ca_3_5_li (long i)
+{
+ if (i > LONG_MAX - 1)
+ i = LONG_MAX - 1;
+
+ ca3_5_7[i][3][5] = __LINE__;
+ ca3_5_7[1][i][5] = __LINE__;
+ ca3_5_7[2][3][i] = __LINE__;
+}
+
+void nowarn_ca_3_5_uli (unsigned long i)
+{
+ if (i > ULONG_MAX - 1)
+ i = ULONG_MAX - 1;
+
+ ca3_5_7[i][3][5] = __LINE__;
+ ca3_5_7[1][i][5] = __LINE__;
+ ca3_5_7[2][3][i] = __LINE__;
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-54.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-54.c
new file mode 100644
index 0000000..26568f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-54.c
@@ -0,0 +1,103 @@
+/* Verify that writes at excessive offsets into flexible array members
+ of extern or allocated objects of unknow size are diagnosed.
+ { dg-do compile }
+ { dg-options "-O2" } */
+
+#define DIFF_MAX __PTRDIFF_MAX__
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __SIZE_TYPE__ size_t;
+
+void* memset (void*, int, size_t);
+
+void sink (void*);
+
+void char_flexarray_cst_off_cst_size (void)
+{
+ extern struct { char n, a[]; }
+ caxcc; // { dg-message "at offset \[1-9\]\[0-9\]+ into destination object 'caxcc'" }
+
+ char *p = caxcc.a;
+ size_t idx = DIFF_MAX - 4;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 2" }
+ sink (p);
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 1" }
+
+ ++idx;
+ memset (p + idx, 0, 3); // { dg-warning "writing 3 bytes into a region of size 0" }
+}
+
+
+void char_flexarray_var_off_cst_size (ptrdiff_t idx)
+{
+ extern struct { char n, a[]; }
+ caxvc; // { dg-message "destination object 'caxvc'" }
+
+ char *p = caxvc.a;
+
+ if (idx < DIFF_MAX - 4)
+ idx = DIFF_MAX - 4;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+}
+
+
+void char_flexarray_var_off_var_size (size_t n, ptrdiff_t idx)
+{
+ extern struct { char n, a[]; }
+ caxvv; // { dg-message "destination object 'caxvv'" }
+
+ char *p = caxvv.a;
+
+ if (idx < DIFF_MAX - 4)
+ idx = DIFF_MAX - 4;
+
+ if (n < 3 || 7 < n)
+ n = 3;
+
+ memset (p + idx, 0, n);
+ sink (p);
+
+ ++n;
+ memset (p + idx, 0, n); // { dg-warning "writing between 4 and 8 bytes into a region of size 3" }
+}
+
+
+void alloc_array_var_off_cst_size (size_t n, ptrdiff_t idx)
+{
+ struct { char n, a[]; }
+ *p = __builtin_malloc (n); // { dg-message "at offset \\d+ into destination object" }
+
+ if (idx < DIFF_MAX - 4)
+ idx = DIFF_MAX - 4;
+
+ memset (p->a + idx, 0, 3);
+ sink (p);
+
+ memset (p->a + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+}
+
+
+void int_array_cst_off_cst_size (void)
+{
+ extern struct { int n, a[]; }
+ iaxc; // { dg-message "at offset \[1-9\]\[0-9\]+ into destination object 'iaxc'" }
+
+ int *p = iaxc.a;
+ size_t idx = DIFF_MAX / sizeof *p - 1;
+
+ memset (p + idx, 0, 3);
+ sink (p);
+
+ memset (p + idx, 0, 5); // { dg-warning "writing 5 bytes into a region of size 3" }
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
new file mode 100644
index 0000000..25f5b82
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
@@ -0,0 +1,97 @@
+/* Verify that offsets in "anti-ranges" are handled correctly.
+ { dg-do compile }
+ { dg-options "-O2 -Wall -ftrack-macro-expansion=0" } */
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __SIZE_TYPE__ size_t;
+
+void* memset (void*, int, size_t);
+
+void sink (void*, ...);
+#define T(x) sink (x)
+
+
+void int_range_add_sub_ (int i, int j)
+{
+ if (i < 1) i = 1;
+ if (j > -1) j = -1;
+
+ char ca5[5]; // { dg-message "at offset \\\[1, 5]" "note" }
+ char *p0 = ca5; // offset
+ char *p1 = p0 + i; // 1-5
+ char *p2 = p1 + i; // 2-5
+ char *p3 = p2 + j; // 0-4
+ char *p4 = p3 + j; // 0-3
+ char *p5 = p4 + j; // 0-2
+ char *p6 = p5 + j; // 0-1
+ char *p7 = p6 + i; // 1-2
+
+ memset (p7, 0, 5); // { dg-warning "writing 5 bytes into a region of size 4" }
+
+ sink (p0, p1, p2, p3, p4, p5, p6, p7);
+}
+
+
+void ruint_arint_add (unsigned i, int j)
+{
+ i |= 1; // [1, UINT_MAX]
+ j |= 1; // [INT_MIN + 1, -1] U [1, INT_MAX]
+
+ char a[5]; // { dg-message "at offset \\\[1, 5]" "note" }
+ char *p0 = a; // offset
+ char *p1 = p0 + i; // 1-5
+ T (memset (p1, 0, 4));
+
+ char *p2 = p1 + j; // 0-5
+ T (memset (p2, 0, 5));
+
+ char *p3 = p2 + i; // 1-5
+ T (memset (p3, 0, 4));
+
+ char *p4 = p3 + j; // 0-5
+ T (memset (p4, 0, 5));
+
+ char *p5 = p4 + i; // 1-5
+ T (memset (p5, 0, 4));
+
+ char *p6 = p5 + j; // 0-5
+ T (memset (p6, 0, 5));
+
+ char *p7 = p6 + i; // 1-5
+ T (memset (p7, 0, 5)); // { dg-warning "writing 5 bytes into a region of size 4" "" }
+}
+
+
+void warn_ptrdiff_anti_range_add (ptrdiff_t i)
+{
+ i |= 1;
+
+ char ca5[5]; // { dg-message "at offset \\\[1, 5]" "pr?????" { xfail *-*-* } }
+ char *p0 = ca5; // offset
+ char *p1 = p0 + i; // 1-5
+ char *p2 = p1 + i; // 2-5
+ char *p3 = p2 + i; // 3-5
+ char *p4 = p3 + i; // 4-5
+ char *p5 = p4 + i; // 5
+
+ memset (p5, 0, 5); // { dg-warning "writing 5 bytes into a region of size 0" "pr?????" { xfail *-*-* } }
+
+ sink (p0, p1, p2, p3, p4, p5);
+}
+
+void warn_int_anti_range (int i)
+{
+ i |= 1;
+
+ char ca5[5]; // { dg-message "at offset \\\[1, 5]" "pr?????" { xfail *-*-* } }
+ char *p0 = ca5; // offset
+ char *p1 = p0 + i; // 1-5
+ char *p2 = p1 + i; // 2-5
+ char *p3 = p2 + i; // 3-5
+ char *p4 = p3 + i; // 4-5
+ char *p5 = p4 + i; // 5
+
+ memset (p5, 0, 5); // { dg-warning "writing 5 bytes into a region of size 0" "pr?????" { xfail *-*-* } }
+
+ sink (p0, p1, p2, p3, p4, p5);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overread-5.c b/gcc/testsuite/gcc.dg/Wstringop-overread-5.c
new file mode 100644
index 0000000..b75002b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overread-5.c
@@ -0,0 +1,76 @@
+/* Verify -Wstringop-overread with a source pointer pointing either
+ before the beginning or past the end of an object.
+ { dg-do compile }
+ { dg-options "-O -Wall -Wno-array-bounds" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+size_t strlen (const char *);
+
+void sink (void*, ...);
+
+void off_sz_or_1 (size_t i)
+{
+ i |= 1;
+
+ /* Verify the offset in the notes only mentions the meaningful lower
+ bound and not a range with the excessive (and meaningless) upper
+ bound like [2, 9223372036854775807]. */
+ extern char a[1];
+ // { dg-message "at offset 1 into source object 'a'" "note" { target *-*-* } .-1 }
+ // { dg-message "at offset 2 " "note" { target *-*-* } .-2 }
+
+ char *p1 = a + i;
+ char *p2 = p1 + 1;
+ char *p3 = p1 - 1;
+
+ size_t n = 0;
+ n += strlen (p1); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+ n += strlen (p2); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+ n += strlen (p3);
+
+ sink (p1, p2, p3, n);
+}
+
+
+void off_sz_or_2 (size_t i)
+{
+ i |= 2;
+
+ extern char b[2];
+ // { dg-message "at offset 2 " "note" { target *-*-* } .-1 }
+ // { dg-message "at offset 3 " "note" { target *-*-* } .-2 }
+
+ char *p1 = b + i;
+ char *p2 = p1 + 1;
+ char *p3 = p1 - 1;
+
+ size_t n = 0;
+ n += strlen (p1); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+ n += strlen (p2); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+ n += strlen (p3);
+
+ sink (p1, p2, p3, n);
+}
+
+
+void off_sz_or_4 (size_t i)
+{
+ i |= 4;
+
+ extern char c[3];
+ // { dg-message "at offset 4 " "note" { target *-*-* } .-1 }
+ // { dg-message "at offset 5 " "note" { target *-*-* } .-2 }
+ // { dg-message "at offset 3 " "note" { target *-*-* } .-3 }
+
+ char *p1 = c + i;
+ char *p2 = p1 + 1;
+ char *p3 = p1 - 1;
+
+ size_t n = 0;
+ n += strlen (p1); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+ n += strlen (p2); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+ n += strlen (p3); // { dg-warning "reading 1 or more bytes from a region of size 0" }
+
+ sink (p1, p2, p3, n);
+}
diff --git a/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c b/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c
index 5c0ba51..a3a0534 100644
--- a/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c
+++ b/gcc/testsuite/gcc.dg/Wvla-larger-than-2.c
@@ -24,7 +24,6 @@ f2 (__SIZE_TYPE__ a)
{
// 11 * 4 bytes = 44: Not OK.
uint32_t x[a]; // { dg-warning "array may be too large" }
- // { dg-message "note:.*argument may be as large as 44" "note" { target *-*-* } .-1 }
f0 (x);
}
}
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
index ba93241..01728e7 100644
--- a/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-2.c
@@ -67,9 +67,9 @@ void a2pampan (int (*(*(*[2])[n1])[n2]));
int f2ia1_1 (int n, int [n][n]); // { sg-message "previously declared as 'int\\\[n]\\\[n]' with bound argument 1" }
int f2ia1_1 (int n, int[static n][n]);
int f2ia1_1 (int n, int a[static n][n]) { return sizeof *a; }
-int f2ia1_1 (int n, int[static n + 1][n]); // { dg-warning "argument 2 of type 'int\\\[n \\\+ 1]\\\[n]' declared with mismatched bound 'n \\\+ 1'" }
+int f2ia1_1 (int n, int[static n + 1][n]); // { dg-warning "argument 2 of type 'int\\\[static *n \\\+ 1]\\\[n]' declared with mismatched bound 'n \\\+ 1'" }
-int f2ias1_1 (int n, int [static n][n]); // { dg-message "previously declared as 'int\\\[n]\\\[n]' with bound argument 1" }
+int f2ias1_1 (int n, int [static n][n]); // { dg-message "previously declared as 'int\\\[static +n]\\\[n]' with bound argument 1" }
int f2ias1_1 (int n, int[n][n]);
int f2ias1_1 (int n, int a[++n][n]) // { dg-warning "argument 2 of type 'int\\\[\\\+\\\+n]\\\[n]' declared with mismatched bound ' ?\\+\\+n'" }
{ return sizeof *a; }
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-5.c b/gcc/testsuite/gcc.dg/Wvla-parameter-5.c
new file mode 100644
index 0000000..16b40d9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-5.c
@@ -0,0 +1,22 @@
+/* Verify that combinations of array type qualifiers render correctly.
+ { dg-do compile }
+ { dg-options "-Wvla-parameter" } */
+
+extern int n1, n2;
+
+void fcx_n1 (int [const][n1]); // { dg-message "previously declared as 'int\\\[const]\\\[n1]' with bound 'n1'" "note" }
+void fcx_n1 (int [const][n2]); // { dg-warning "argument 1 of type 'int\\\[const]\\\[n2]' declared with mismatched bound 'n2'" }
+
+/* The mismatch in the array bound should not be diagnosed without
+ -Warray-parameter but the mismatch in the VLA should still be
+ diagnosed. */
+void fc3_n1 (int [const 3][n1]); // { dg-message "previously declared as 'int\\\[const 3]\\\[n1]' with bound 'n1'" "note" }
+void fc3_n1 (int [const 5][n2]); // { dg-warning "argument 1 of type 'int\\\[const 5]\\\[n2]' declared with mismatched bound 'n2'" }
+
+
+void frx_n1 (int [restrict][n1]); // { dg-message "previously declared as 'int\\\[restrict]\\\[n1]' with bound 'n1'" "note" }
+void frx_n1 (int [restrict][n2]); // { dg-warning "argument 1 of type 'int\\\[restrict]\\\[n2]' declared with mismatched bound 'n2'" }
+
+
+void fvx_n2 (int [volatile][n2]); // { dg-message "previously declared as 'int\\\[volatile]\\\[n2]' with bound 'n2'" "note" }
+void fvx_n2 (int [volatile][n1]); // { dg-warning "argument 1 of type 'int\\\[volatile]\\\[n1]' declared with mismatched bound 'n1'" }
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-6.c b/gcc/testsuite/gcc.dg/Wvla-parameter-6.c
new file mode 100644
index 0000000..268aeec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-6.c
@@ -0,0 +1,34 @@
+/* PR middle-end/97189 - ICE on redeclaration of a function with VLA argument
+ and attribute access
+ Also verify the right arguments are underlined in the notes.
+ { dg-do compile }
+ { dg-options "-Wall -fdiagnostics-show-caret" } */
+
+#define RW(...) __attribute__ ((access (read_write, __VA_ARGS__)))
+
+RW (2, 3) void f1 (int n, int[n], int);
+/* { dg-warning "attribute 'access \\(read_write, 2, 3\\)' positional argument 2 conflicts with previous designation by argument 3" "warning" { target *-*-* } .-1 }
+ { dg-begin-multiline-output "" }
+ RW (2, 3) void f1 (int n, int[n], int);
+ ^~
+ { dg-end-multiline-output "" }
+ { dg-message "designating the bound of variable length array argument 2" "note" { target *-*-* } .-6 }
+ { dg-begin-multiline-output "" }
+ RW (2, 3) void f1 (int n, int[n], int);
+ ~~~~^ ~~~~~~
+ { dg-end-multiline-output "" } */
+
+
+RW (2) void f2 (int, int[*], int);
+/* { dg-message "previously declared as a variable length array 'int\\\[\\\*]'" "note" { target *-*-* } .-1 }
+ { dg-begin-multiline-output "" }
+ RW (2, 3) void f2 (int, int[], int);
+ ^~~~~
+ { dg-end-multiline-output "" } */
+
+RW (2, 3) void f2 (int, int[], int);
+/* { dg-warning "argument 2 of type 'int\\\[]' declared as an ordinary array" "warning" { target *-*-* } .-1 }
+ { dg-begin-multiline-output "" }
+ RW (2) void f2 (int, int[*], int);
+ ^~~~~~
+ { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-7.c b/gcc/testsuite/gcc.dg/Wvla-parameter-7.c
new file mode 100644
index 0000000..14ce75f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-7.c
@@ -0,0 +1,36 @@
+/* PR middle-end/97189 - ICE on redeclaration of a function with VLA argument
+ and attribute access
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+#define RW(...) __attribute__ ((access (read_write, __VA_ARGS__)))
+
+RW (2, 3) void f1 (int n, int[n], int);
+/* { dg-warning "attribute 'access \\(read_write, 2, 3\\)' positional argument 2 conflicts with previous designation by argument 3" "warning" { target *-*-* } .-1 }
+ { dg-message "designating the bound of variable length array argument 2" "note" { target *-*-* } .-2 } */
+
+void call_f1 (int *p)
+{
+ /* Verify that a warning is issued. Ideally, it seems the VLA bound
+ should take precedence over the attribute and the warning would
+ reference argument 1 but since the conflict in the redeclarations
+ of the function is already diagnosed don't test that (and let it
+ be acceptable for this warning to reference argument 3). */
+ f1 (-1, p, -1);
+ // { dg-warning "argument \\d value -1 is negative" "warning" { target *-*-* } .-1 }
+}
+
+RW (2) void f2 (int, int[*], int);
+// { dg-message "previously declared as a variable length array 'int\\\[\\\*]'" "note" { target *-*-* } .-1 }
+RW (2, 3) void f2 (int, int[], int);
+// { dg-warning "argument 2 of type 'int\\\[]' declared as an ordinary array" "warning" { target *-*-* } .-1 }
+
+void call_f2 (int *p)
+{
+ f2 (-1, p, 0);
+
+ /* Verify that the attribute access on the redeclaration of f2() takes
+ precedence over the one on the first declaration. */
+ f2 (0, p, -1);
+ // { dg-warning "argument 3 value -1 is negative" "warning" { target *-*-* } .-1 }
+}
diff --git a/gcc/testsuite/gcc.dg/Wvla-parameter-8.c b/gcc/testsuite/gcc.dg/Wvla-parameter-8.c
new file mode 100644
index 0000000..69e10f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wvla-parameter-8.c
@@ -0,0 +1,86 @@
+/* PR c/97413 - bogus error on function declaration with many VLA arguments:
+ wrong number of arguments specified for 'access' attribute
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+extern int n;
+
+void f1 (int[n]);
+void f2 (int[n], int[n]);
+void f3 (int[n], int[n], int[n]);
+void f4 (int[n], int[n], int[n], int[n]);
+void f5 (int[n], int[n], int[n], int[n], int[n]);
+void f6 (int[n], int[n], int[n], int[n], int[n], int[n]);
+void f7 (int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f8 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f9 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n]);
+void f10 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n], int[n]);
+
+
+void f1 (int[n]);
+void f2 (int[n], int[n]);
+void f3 (int[n], int[n], int[n]);
+void f4 (int[n], int[n], int[n], int[n]);
+void f5 (int[n], int[n], int[n], int[n], int[n]);
+void f6 (int[n], int[n], int[n], int[n], int[n], int[n]);
+void f7 (int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f8 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
+void f9 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n]);
+void f10 (int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n],
+ int[n], int[n]);
+
+
+void g (int n)
+{
+ typedef int A[n];
+
+ void g1 (A);
+ void g2 (A, A);
+ void g3 (A, A, A);
+ void g4 (A, A, A, A);
+ void g5 (A, A, A, A, A);
+ void g6 (A, A, A, A, A, A);
+ void g7 (A, A, A, A, A, A, A);
+ void g8 (A, A, A, A, A, A, A, A);
+ void g9 (A, A, A, A, A, A, A, A, A);
+ void g10 (A, A, A, A, A, A, A, A, A, A);
+
+ void g1 (A);
+ void g2 (A, A);
+ void g3 (A, A, A);
+ void g4 (A, A, A, A);
+ void g5 (A, A, A, A, A);
+ void g6 (A, A, A, A, A, A);
+ void g7 (A, A, A, A, A, A, A);
+ void g8 (A, A, A, A, A, A, A, A);
+ void g9 (A, A, A, A, A, A, A, A, A);
+ void g10 (A, A, A, A, A, A, A, A, A, A);
+
+
+ typedef int B[n][n + 1][n + 2][n + 3][n + 4][n + 5][n + 7];
+
+ void h1 (B);
+ void h2 (B, B);
+ void h3 (B, B, B);
+ void h4 (B, B, B, B);
+ void h5 (B, B, B, B, B);
+ void h6 (B, B, B, B, B, B);
+ void h7 (B, B, B, B, B, B, B);
+ void h8 (B, B, B, B, B, B, B, B);
+ void h9 (B, B, B, B, B, B, B, B, B);
+ void h10 (B, B, B, B, B, B, B, B, B, B);
+
+ void h1 (B);
+ void h2 (B, B);
+ void h3 (B, B, B);
+ void h4 (B, B, B, B);
+ void h5 (B, B, B, B, B);
+ void h6 (B, B, B, B, B, B);
+ void h7 (B, B, B, B, B, B, B);
+ void h8 (B, B, B, B, B, B, B, B);
+ void h9 (B, B, B, B, B, B, B, B, B);
+ void h10 (B, B, B, B, B, B, B, B, B, B);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/analyzer.exp b/gcc/testsuite/gcc.dg/analyzer/analyzer.exp
index ac9c495..d72fef3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/analyzer.exp
+++ b/gcc/testsuite/gcc.dg/analyzer/analyzer.exp
@@ -30,7 +30,7 @@ if [info exists DEFAULT_CFLAGS] then {
}
# If a testcase doesn't have special options, use these.
-set DEFAULT_CFLAGS "-fanalyzer -fdiagnostics-path-format=separate-events -Wanalyzer-too-complex -fanalyzer-call-summaries"
+set DEFAULT_CFLAGS "-fanalyzer -Wanalyzer-too-complex -fanalyzer-call-summaries"
# Initialize `dg'.
dg-init
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c b/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c
new file mode 100644
index 0000000..52c8fde
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c
@@ -0,0 +1,25 @@
+/* Reproducer for PR analyzer/97258: we should report the double-free
+ inside a static callback if the callback escapes. */
+
+#include <stdlib.h>
+
+static void callback_1 (void *p)
+{
+ free (p);
+ free (p); /* { dg-warning "double-'free' of 'p'" } */
+}
+
+struct ops {
+ void (*cb) (void *);
+};
+
+static const struct ops ops_1 = {
+ .cb = callback_1
+};
+
+extern void registration (const void *);
+
+void register_1 (void)
+{
+ registration (&ops_1);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c b/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c
new file mode 100644
index 0000000..98915ee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c
@@ -0,0 +1,22 @@
+/* Reproducer for PR analyzer/97258: we should report the double-free
+ inside a static callback if the callback is accessible via a global
+ initializer. */
+
+#include <stdlib.h>
+
+static void callback_1 (void *p)
+{
+ free (p);
+ free (p); /* { dg-warning "double-'free' of 'p'" } */
+}
+
+struct ops {
+ void (*cb) (void *);
+};
+
+/* Callback struct is not static, and so could be accessed via
+ another TU. */
+
+const struct ops ops_1 = {
+ .cb = callback_1
+};
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c b/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c
new file mode 100644
index 0000000..5f12c2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c
@@ -0,0 +1,19 @@
+#include "analyzer-decls.h"
+
+typedef __SIZE_TYPE__ size_t;
+typedef int (*__compar_fn_t)(const void *, const void *);
+extern void qsort(void *__base, size_t __nmemb, size_t __size,
+ __compar_fn_t __compar)
+ __attribute__((__nonnull__(1, 4)));
+
+static int
+test_1_callback (const void *p1, const void *p2)
+{
+ __analyzer_dump_path (); /* { dg-message "here" } */
+ return 0;
+}
+
+void test_1_caller (int *arr, size_t n)
+{
+ qsort (arr, n, sizeof (int), test_1_callback);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-21.c b/gcc/testsuite/gcc.dg/analyzer/data-model-21.c
new file mode 100644
index 0000000..b952bcb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-21.c
@@ -0,0 +1,8 @@
+extern const char XtStrings[];
+
+void unknown_fn (void *);
+
+void test (void)
+{
+ unknown_fn ((char*)&XtStrings[429]);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-2.c b/gcc/testsuite/gcc.dg/analyzer/feasibility-2.c
new file mode 100644
index 0000000..9fe62d2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/feasibility-2.c
@@ -0,0 +1,20 @@
+/* Verify that -fno-analyzer-feasibility works. */
+/* { dg-additional-options "-fno-analyzer-feasibility" } */
+
+#include "analyzer-decls.h"
+
+void test_1 (int flag)
+{
+ int a;
+ if (flag)
+ a = 1;
+ else
+ a = 2;
+
+ if (a == 1) /* (can only be the case when "flag" was true above). */
+ if (!flag)
+ {
+ __analyzer_dump_path (); /* { dg-message "note: path" "path diag" } */
+ /* { dg-message "infeasible" "infeasibility event" { target *-*-* } .-1 } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c
new file mode 100644
index 0000000..0d470d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility.c
@@ -0,0 +1,79 @@
+/* Simplified version of test to ensure we issue a FILE * leak diagnostic,
+ reproducing a feasibility issue.
+ Adapted from intl/localealias.c, with all #includes removed. */
+
+/* { dg-do "compile" } */
+/* { dg-additional-options "-fno-analyzer-feasibility" } */
+/* TODO: remove the need for this option. */
+
+/* Handle aliases for locale names.
+ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+/* Minimal version of system headers. */
+
+typedef __SIZE_TYPE__ size_t;
+#define NULL ((void *)0)
+
+typedef struct _IO_FILE FILE;
+extern FILE *fopen (const char *__restrict __filename,
+ const char *__restrict __modes);
+extern int fclose (FILE *__stream);
+
+extern int isspace (int) __attribute__((__nothrow__, __leaf__));
+
+/* Cleaned-up body of localealias.c follows. */
+
+size_t
+read_alias_file (const char *fname, int fname_len)
+{
+ FILE *fp;
+ size_t added;
+ char buf[400];
+ char *alias;
+ char *value;
+ char *cp;
+
+ fp = fopen (fname, "r"); /* { dg-message "opened here" } */
+ if (fp == NULL)
+ return 0;
+
+ cp = buf;
+
+ /* Ignore leading white space. */
+ while (isspace ((unsigned char)cp[0]))
+ ++cp;
+
+ if (cp[0] != '\0' && cp[0] != '#')
+ {
+ alias = cp++;
+ while (cp[0] != '\0' && !isspace ((unsigned char)cp[0]))
+ ++cp;
+ if (cp[0] != '\0')
+ *cp++ = '\0';
+
+ while (isspace ((unsigned char)cp[0]))
+ ++cp;
+
+ if (cp[0] != '\0')
+ return 42; /* { dg-warning "leak of FILE 'fp'" } */
+ }
+
+ fclose(fp);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c
new file mode 100644
index 0000000..6f65add
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c
@@ -0,0 +1,45 @@
+/* Simplified version of test for ensuring we issue a FILE * leak diagnostic,
+ made trivial.
+ Adapted from intl/localealias.c, with all #includes removed. */
+
+/* { dg-do "compile" } */
+
+/* Handle aliases for locale names.
+ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+/* Minimal version of system headers. */
+#define NULL ((void *) 0)
+typedef struct _IO_FILE FILE;
+extern FILE *fopen(const char *__restrict __filename,
+ const char *__restrict __modes);
+extern int fclose(FILE *__stream);
+
+void
+read_alias_file (int flag)
+{
+ FILE *fp;
+
+ fp = fopen ("name", "r"); /* { dg-message "opened here" } */
+ if (fp == NULL)
+ return;
+
+ if (flag)
+ return; /* { dg-warning "leak of FILE 'fp'" } */
+
+ fclose (fp);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c
new file mode 100644
index 0000000..043e45f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c
@@ -0,0 +1,391 @@
+/* Integration test to ensure we issue a FILE * leak diagnostic for
+ this particular non-trivial case.
+ Adapted from intl/localealias.c, with all #includes removed. */
+
+/* { dg-do "compile" } */
+/* { dg-additional-options "-Wno-analyzer-too-complex -fno-analyzer-feasibility" } */
+/* TODO: remove the need for these options. */
+/* { dg-require-effective-target alloca } */
+
+/* Handle aliases for locale names.
+ Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
+
+/* Minimal version of system headers. */
+
+typedef __SIZE_TYPE__ size_t;
+#define NULL ((void *) 0)
+
+#define PATH_SEPARATOR ':'
+typedef struct _IO_FILE FILE;
+extern FILE *fopen(const char *__restrict __filename,
+ const char *__restrict __modes);
+extern int feof_unlocked(FILE *__stream) __attribute__((__nothrow__, __leaf__));
+extern char *fgets_unlocked(char *__restrict __s, int __n,
+ FILE *__restrict __stream);
+extern int fclose(FILE *__stream);
+
+#define alloca __builtin_alloca
+
+extern char *strchr(const char *__s, int __c)
+ __attribute__((__nothrow__, __leaf__)) __attribute__((__pure__))
+ __attribute__((__nonnull__(1)));
+extern void *memcpy(void *__restrict __dest, const void *__restrict __src,
+ size_t __n) __attribute__((__nothrow__, __leaf__))
+ __attribute__((__nonnull__(1, 2)));
+extern void *mempcpy(void *__restrict __dest, const void *__restrict __src,
+ size_t __n) __attribute__((__nothrow__, __leaf__))
+ __attribute__((__nonnull__(1, 2)));
+#define HAVE_MEMPCPY 1
+extern size_t strlen(const char *__s) __attribute__((__nothrow__, __leaf__))
+ __attribute__((__pure__)) __attribute__((__nonnull__(1)));
+
+extern int strcasecmp(const char *__s1, const char *__s2)
+ __attribute__((__nothrow__, __leaf__)) __attribute__((__pure__))
+ __attribute__((__nonnull__(1, 2)));
+
+extern int isspace(int) __attribute__((__nothrow__, __leaf__));
+
+extern void *realloc(void *__ptr, size_t __size)
+ __attribute__((__nothrow__, __leaf__))
+ __attribute__((__warn_unused_result__));
+
+typedef int (*__compar_fn_t)(const void *, const void *);
+extern void *bsearch(const void *__key, const void *__base, size_t __nmemb,
+ size_t __size, __compar_fn_t __compar)
+ __attribute__((__nonnull__(1, 2, 5)));
+
+extern __inline __attribute__((__gnu_inline__)) void *
+bsearch(const void *__key, const void *__base, size_t __nmemb, size_t __size,
+ __compar_fn_t __compar) {
+ size_t __l, __u, __idx;
+ const void *__p;
+ int __comparison;
+
+ __l = 0;
+ __u = __nmemb;
+ while (__l < __u) {
+ __idx = (__l + __u) / 2;
+ __p = (void *)(((const char *)__base) + (__idx * __size));
+ __comparison = (*__compar)(__key, __p);
+ if (__comparison < 0)
+ __u = __idx;
+ else if (__comparison > 0)
+ __l = __idx + 1;
+ else
+ return (void *)__p;
+ }
+
+ return ((void *)0);
+}
+
+extern void qsort(void *__base, size_t __nmemb, size_t __size,
+ __compar_fn_t __compar) __attribute__((__nonnull__(1, 4)));
+
+/* Minimal version of intl headers. */
+
+#define PARAMS(args) args
+
+#define relocate libintl_relocate
+extern const char *libintl_relocate(const char *pathname);
+
+#define LOCALE_ALIAS_PATH "value for LOCALE_ALIAS_PATH"
+
+/* Cleaned-up body of localealias.c follows. */
+
+#ifndef internal_function
+# define internal_function
+#endif
+
+/* Some optimizations for glibc. */
+# define FEOF(fp) feof_unlocked (fp)
+# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp)
+
+/* For those losing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+# define freea(p) /* nothing */
+
+struct alias_map
+{
+ const char *alias;
+ const char *value;
+};
+
+# define libc_freeres_ptr(decl) decl
+
+libc_freeres_ptr (static char *string_space);
+static size_t string_space_act;
+static size_t string_space_max;
+libc_freeres_ptr (static struct alias_map *map);
+static size_t nmap;
+static size_t maxmap;
+
+
+/* Prototypes for local functions. */
+static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
+ internal_function;
+static int extend_alias_table PARAMS ((void));
+static int alias_compare PARAMS ((const struct alias_map *map1,
+ const struct alias_map *map2));
+
+
+const char *
+_nl_expand_alias (name)
+ const char *name;
+{
+ static const char *locale_alias_path;
+ struct alias_map *retval;
+ const char *result = NULL;
+ size_t added;
+
+#ifdef _LIBC
+ __libc_lock_lock (lock);
+#endif
+
+ if (locale_alias_path == NULL)
+ locale_alias_path = LOCALE_ALIAS_PATH;
+
+ do
+ {
+ struct alias_map item;
+
+ item.alias = name;
+
+ if (nmap > 0)
+ retval = (struct alias_map *) bsearch (&item, map, nmap,
+ sizeof (struct alias_map),
+ (int (*) PARAMS ((const void *,
+ const void *))
+ ) alias_compare);
+ else
+ retval = NULL;
+
+ /* We really found an alias. Return the value. */
+ if (retval != NULL)
+ {
+ result = retval->value;
+ break;
+ }
+
+ /* Perhaps we can find another alias file. */
+ added = 0;
+ while (added == 0 && locale_alias_path[0] != '\0')
+ {
+ const char *start;
+
+ while (locale_alias_path[0] == PATH_SEPARATOR)
+ ++locale_alias_path;
+ start = locale_alias_path;
+
+ while (locale_alias_path[0] != '\0'
+ && locale_alias_path[0] != PATH_SEPARATOR)
+ ++locale_alias_path;
+
+ if (start < locale_alias_path)
+ added = read_alias_file (start, locale_alias_path - start);
+ }
+ }
+ while (added != 0);
+
+#ifdef _LIBC
+ __libc_lock_unlock (lock);
+#endif
+
+ return result;
+}
+
+
+static size_t
+internal_function
+read_alias_file (fname, fname_len)
+ const char *fname;
+ int fname_len;
+{
+ FILE *fp;
+ char *full_fname;
+ size_t added;
+ static const char aliasfile[] = "/locale.alias";
+
+ full_fname = (char *) alloca (fname_len + sizeof aliasfile);
+#ifdef HAVE_MEMPCPY
+ mempcpy (mempcpy (full_fname, fname, fname_len),
+ aliasfile, sizeof aliasfile);
+#else
+ memcpy (full_fname, fname, fname_len);
+ memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
+#endif
+
+ fp = fopen (relocate (full_fname), "r"); /* { dg-message "opened here" } */
+ freea (full_fname);
+ if (fp == NULL)
+ return 0;
+
+#ifdef HAVE___FSETLOCKING
+ /* No threads present. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+#endif
+
+ added = 0;
+ while (!FEOF (fp))
+ {
+ /* It is a reasonable approach to use a fix buffer here because
+ a) we are only interested in the first two fields
+ b) these fields must be usable as file names and so must not
+ be that long
+ We avoid a multi-kilobyte buffer here since this would use up
+ stack space which we might not have if the program ran out of
+ memory. */
+ char buf[400];
+ char *alias;
+ char *value;
+ char *cp;
+
+ if (FGETS (buf, sizeof buf, fp) == NULL)
+ /* EOF reached. */
+ break;
+
+ cp = buf;
+ /* Ignore leading white space. */
+ while (isspace ((unsigned char) cp[0]))
+ ++cp;
+
+ /* A leading '#' signals a comment line. */
+ if (cp[0] != '\0' && cp[0] != '#')
+ {
+ alias = cp++;
+ while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
+ ++cp;
+ /* Terminate alias name. */
+ if (cp[0] != '\0')
+ *cp++ = '\0';
+
+ /* Now look for the beginning of the value. */
+ while (isspace ((unsigned char) cp[0]))
+ ++cp;
+
+ if (cp[0] != '\0')
+ {
+ size_t alias_len;
+ size_t value_len;
+
+ value = cp++;
+ while (cp[0] != '\0' && !isspace ((unsigned char) cp[0]))
+ ++cp;
+ /* Terminate value. */
+ if (cp[0] == '\n')
+ {
+ /* This has to be done to make the following test
+ for the end of line possible. We are looking for
+ the terminating '\n' which do not overwrite here. */
+ *cp++ = '\0';
+ *cp = '\n';
+ }
+ else if (cp[0] != '\0')
+ *cp++ = '\0';
+
+ if (nmap >= maxmap)
+ if (__builtin_expect (extend_alias_table (), 0))
+ return added; /* { dg-warning "leak of FILE 'fp'" } */
+
+ alias_len = strlen (alias) + 1;
+ value_len = strlen (value) + 1;
+
+ if (string_space_act + alias_len + value_len > string_space_max)
+ {
+ /* Increase size of memory pool. */
+ size_t new_size = (string_space_max
+ + (alias_len + value_len > 1024
+ ? alias_len + value_len : 1024));
+ char *new_pool = (char *) realloc (string_space, new_size);
+ if (new_pool == NULL)
+ return added;
+
+ if (__builtin_expect (string_space != new_pool, 0))
+ {
+ size_t i;
+
+ for (i = 0; i < nmap; i++)
+ {
+ map[i].alias += new_pool - string_space;
+ map[i].value += new_pool - string_space;
+ }
+ }
+
+ string_space = new_pool;
+ string_space_max = new_size;
+ }
+
+ map[nmap].alias = memcpy (&string_space[string_space_act],
+ alias, alias_len);
+ string_space_act += alias_len;
+
+ map[nmap].value = memcpy (&string_space[string_space_act],
+ value, value_len);
+ string_space_act += value_len;
+
+ ++nmap;
+ ++added;
+ }
+ }
+
+ /* Possibly not the whole line fits into the buffer. Ignore
+ the rest of the line. */
+ while (strchr (buf, '\n') == NULL)
+ if (FGETS (buf, sizeof buf, fp) == NULL)
+ /* Make sure the inner loop will be left. The outer loop
+ will exit at the `feof' test. */
+ break;
+ }
+
+ /* Should we test for ferror()? I think we have to silently ignore
+ errors. --drepper */
+ fclose (fp);
+
+ if (added > 0)
+ qsort (map, nmap, sizeof (struct alias_map),
+ (int (*) PARAMS ((const void *, const void *))) alias_compare);
+
+ return added;
+}
+
+
+static int
+extend_alias_table ()
+{
+ size_t new_size;
+ struct alias_map *new_map;
+
+ new_size = maxmap == 0 ? 100 : 2 * maxmap;
+ new_map = (struct alias_map *) realloc (map, (new_size
+ * sizeof (struct alias_map)));
+ if (new_map == NULL)
+ /* Simply don't extend: we don't have any more core. */
+ return -1;
+
+ map = new_map;
+ maxmap = new_size;
+ return 0;
+}
+
+
+static int
+alias_compare (map1, map2)
+ const struct alias_map *map1;
+ const struct alias_map *map2;
+{
+ return strcasecmp (map1->alias, map2->alias);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96646.c b/gcc/testsuite/gcc.dg/analyzer/pr96646.c
new file mode 100644
index 0000000..2ac5a03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr96646.c
@@ -0,0 +1,24 @@
+/* { dg-additional-options "-O1" } */
+
+struct zx {
+ struct zx *b4, *g0;
+};
+
+struct oo {
+ void *ph;
+ struct zx el;
+};
+
+inline void
+k7 (struct zx *xj)
+{
+ xj->b4->g0 = 0; /* { dg-warning "dereference of NULL" } */
+ xj->b4 = 0;
+}
+
+void
+n8 (struct oo *yx)
+{
+ k7 (&yx->el);
+ n8 (yx);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96841.c b/gcc/testsuite/gcc.dg/analyzer/pr96841.c
new file mode 100644
index 0000000..d9d35f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr96841.c
@@ -0,0 +1,23 @@
+/* { dg-additional-options "-O1 -Wno-builtin-declaration-mismatch" } */
+
+int
+l8 (void);
+
+__SIZE_TYPE__
+malloc (__SIZE_TYPE__);
+
+void
+th (int *);
+
+void
+bv (__SIZE_TYPE__ ny)
+{
+ int ***mf;
+
+ while (l8 ())
+ {
+ *mf = 0;
+ (*mf)[ny] = (int *) malloc (sizeof (int));
+ th ((*mf)[ny]); /* { dg-warning "leak" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97130.c b/gcc/testsuite/gcc.dg/analyzer/pr97130.c
new file mode 100644
index 0000000..f437b76
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97130.c
@@ -0,0 +1,10 @@
+/* { dg-additional-options "-Wno-builtin-declaration-mismatch" } */
+
+void *
+memset (int, int, __SIZE_TYPE__);
+
+void
+mp (int xl)
+{
+ memset (xl, 0, sizeof xl);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97233.c b/gcc/testsuite/gcc.dg/analyzer/pr97233.c
new file mode 100644
index 0000000..86930aa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97233.c
@@ -0,0 +1,8 @@
+void
+longjmp (__SIZE_TYPE__, int);
+
+void
+e7 (__SIZE_TYPE__ gr)
+{
+ longjmp (gr, 1);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97514.c b/gcc/testsuite/gcc.dg/analyzer/pr97514.c
new file mode 100644
index 0000000..27245f4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97514.c
@@ -0,0 +1,18 @@
+/* { dg-additional-options "--param analyzer-max-enodes-per-program-point=0 -Wno-analyzer-too-complex" } */
+
+typedef void (*sighandler_t) (int);
+
+void
+signal (int, sighandler_t);
+
+static void
+kw (int signum)
+{
+ (void) signum;
+}
+
+void
+gk (int ot)
+{
+ signal (ot, kw);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c b/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c
index 6e2468e..e31e127 100644
--- a/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c
+++ b/gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c
@@ -1,7 +1,7 @@
/* { dg-additional-options "-O1 -g" } */
/* { dg-require-effective-target indirect_jumps } */
-#include <setjmp.h>
+#include "test-setjmp.h"
jmp_buf buf;
diff --git a/gcc/testsuite/gcc.dg/analyzer/signal-registration-loc.c b/gcc/testsuite/gcc.dg/analyzer/signal-registration-loc.c
new file mode 100644
index 0000000..4bac126
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/signal-registration-loc.c
@@ -0,0 +1,23 @@
+/* Ensure we use the correct location when reporting where the
+ signal handler was registered (PR analyzer/95188). */
+
+/* { dg-require-effective-target signal } */
+
+#include <stdio.h>
+#include <signal.h>
+
+int g;
+extern int foo (void);
+
+static void
+handler (int n)
+{
+ fprintf (stderr, "got here: %i\n", g); /* { dg-warning "call to 'fprintf' from within signal handler" } */
+}
+
+int main (int argc, char *argv[])
+{
+ g = foo (); /* { dg-bogus "registering" } */
+ signal (SIGSEGV, handler); /* { dg-message "registering 'handler' as signal handler" } */
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
index 2bc73e8..d6a9910 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-5.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target sigsetjmp } */
-#include <setjmp.h>
+#include "test-setjmp.h"
#include <stddef.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
index d45804b..f89277e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sigsetjmp-6.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target sigsetjmp } */
-#include <setjmp.h>
+#include "test-setjmp.h"
#include <stddef.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h b/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
index ee0e1ec..db24227 100644
--- a/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
+++ b/gcc/testsuite/gcc.dg/analyzer/test-setjmp.h
@@ -7,10 +7,19 @@
setjmp is a function on some systems and a macro on others.
This header provides a SETJMP macro in a (fake) system header,
- for consistency of output across such systems. */
-
-#include <setjmp.h>
+ along with precanned decls of setjmp, for consistency of output across
+ different systems. */
#pragma GCC system_header
+struct __jmp_buf_tag {};
+typedef struct __jmp_buf_tag jmp_buf[1];
+typedef struct __jmp_buf_tag sigjmp_buf[1];
+
+extern int setjmp(jmp_buf env);
+extern int sigsetjmp(sigjmp_buf env, int savesigs);
+
+extern void longjmp(jmp_buf env, int val);
+extern void siglongjmp(sigjmp_buf env, int val);
+
#define SETJMP(E) setjmp(E)
diff --git a/gcc/testsuite/gcc.dg/analyzer/write-to-const-1.c b/gcc/testsuite/gcc.dg/analyzer/write-to-const-1.c
new file mode 100644
index 0000000..dc724e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/write-to-const-1.c
@@ -0,0 +1,29 @@
+/* PR middle-end/90404 */
+
+const int c1 = 20; /* { dg-message "declared here" } */
+int test_1 (void)
+{
+ *((int*) &c1) = 10; /* { dg-warning "write to 'const' object 'c1'" } */
+ return c1;
+}
+
+/* Example of writing to a subregion (an element within a const array). */
+
+const int c2[10]; /* { dg-message "declared here" } */
+int test_2 (void)
+{
+ ((int*) &c2)[5] = 10; /* { dg-warning "write to 'const' object 'c2'" } */
+ return c2[5];
+}
+
+const char s3[] = "012.45"; /* { dg-message "declared here" } */
+int test_3 (void)
+{
+ char *p = __builtin_strchr (s3, '.');
+ *p = 0; /* { dg-warning "write to 'const' object 's3'" } */
+
+ if (__builtin_strlen (p) != 3)
+ __builtin_abort ();
+
+ return s3[3] == 0;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-1.c b/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-1.c
new file mode 100644
index 0000000..092500e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/write-to-string-literal-1.c
@@ -0,0 +1,58 @@
+#include <string.h>
+
+/* PR analyzer/95007. */
+
+void test_1 (void)
+{
+ char *s = "foo";
+ s[0] = 'g'; /* { dg-warning "write to string literal" } */
+}
+
+/* PR c/83347. */
+
+void test_2 (void)
+{
+ memcpy ("abc", "def", 3); /* { dg-warning "write to string literal" } */
+}
+
+static char * __attribute__((noinline))
+called_by_test_3 (void)
+{
+ return (char *)"foo";
+}
+
+void test_3 (void)
+{
+ char *s = called_by_test_3 ();
+ s[1] = 'a'; /* { dg-warning "write to string literal" } */
+}
+
+static char * __attribute__((noinline))
+called_by_test_4 (int flag)
+{
+ if (flag)
+ return (char *)"foo";
+ else
+ return (char *)"bar";
+}
+
+void test_4 (void)
+{
+ char *s = called_by_test_4 (0);
+ s[1] = 'z'; /* { dg-warning "write to string literal" } */
+}
+
+static char * __attribute__((noinline))
+called_by_test_5 (int flag)
+{
+ if (flag)
+ return (char *)"foo";
+ else
+ return (char *)"bar";
+}
+
+void test_5 (int flag)
+{
+ char *s = called_by_test_5 (flag);
+ s[1] = 'z'; /* We miss this one, unless we disable state merging. */
+}
diff --git a/gcc/testsuite/gcc.dg/asan/pr80166.c b/gcc/testsuite/gcc.dg/asan/pr80166.c
index 629dd23..5e153b2 100644
--- a/gcc/testsuite/gcc.dg/asan/pr80166.c
+++ b/gcc/testsuite/gcc.dg/asan/pr80166.c
@@ -1,5 +1,6 @@
/* PR sanitizer/80166 */
/* { dg-do run } */
+/* { dg-additional-options "-Wno-stringop-overflow" } */
#include <sys/types.h>
#include <unistd.h>
diff --git a/gcc/testsuite/gcc.dg/asan/pr97294.c b/gcc/testsuite/gcc.dg/asan/pr97294.c
new file mode 100644
index 0000000..6de6c3e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr97294.c
@@ -0,0 +1,41 @@
+/* PR sanitizer/97294 */
+/* { dg-do compile { target fopenmp } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+/* { dg-options "-O0 -fsanitize=address -fopenmp" } */
+/* { dg-final { scan-assembler "foo._omp_fn.\[0-9]\[1-9]*:.*call\[ \t]\*__*asan_allocas_unpoison.*\.size\[ \t]\*foo._omp_fn.\[0-9]\[1-9]*," { target x86_64-*-linux* i?86-*-linux* } } } */
+
+__attribute__((noipa)) void
+foo (int *p, int n)
+{
+ int i;
+ #pragma omp parallel for num_threads(2) reduction(+:p[:n])
+ for (i = 0; i < 10; i++)
+ {
+ p[0]++;
+ p[n - 1] += 2;
+ }
+}
+
+__attribute__((noipa)) void
+bar (void)
+{
+ unsigned char buf[1024];
+ int i;
+ asm volatile ("" : : "r" (&buf[0]) : "memory");
+ for (i = 0; i < 1024; i++)
+ buf[i] = i;
+ asm volatile ("" : : "r" (&buf[0]) : "memory");
+}
+
+int
+main ()
+{
+ int p[50], i;
+ for (i = 0; i < 50; i++)
+ p[i] = 0;
+ foo (p, 50);
+ bar ();
+ if (p[0] != 10 || p[49] != 20)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c
index 2dc91c5..900559b 100644
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-6.c
@@ -3,6 +3,7 @@
still occurs. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-xfail-run-if "PR97444: stack atomics" { nvptx*-*-* } }*/
#define TEST_POINTER_ADD_SUB(TYPE) \
do \
diff --git a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c
index eb7082d..d000083 100644
--- a/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c
+++ b/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-7.c
@@ -2,6 +2,7 @@
we generate correct code. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors -fdump-tree-original" } */
+/* { dg-xfail-run-if "PR97444: stack atomics" { nvptx*-*-* } }*/
#include <stdatomic.h>
#include <limits.h>
diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c
index daba8ec..f0e8581 100644
--- a/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c
+++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-op-5.c
@@ -2,6 +2,7 @@
we generate correct code. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors -fdump-tree-original" } */
+/* { dg-xfail-run-if "PR97444: stack atomics" { nvptx*-*-* } }*/
#include <stdatomic.h>
diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-vm.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-vm.c
index f43fa49..cdfb701 100644
--- a/gcc/testsuite/gcc.dg/atomic/stdatomic-vm.c
+++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-vm.c
@@ -2,6 +2,7 @@
with side effects. */
/* { dg-do run } */
/* { dg-options "-std=c11 -pedantic-errors" } */
+/* { dg-require-effective-target alloca } */
#include <stdatomic.h>
diff --git a/gcc/testsuite/gcc.dg/attr-access-2.c b/gcc/testsuite/gcc.dg/attr-access-2.c
index 7476261..76baddf 100644
--- a/gcc/testsuite/gcc.dg/attr-access-2.c
+++ b/gcc/testsuite/gcc.dg/attr-access-2.c
@@ -112,5 +112,11 @@ typedef void G1 (int n, int[n], int);
G1 g1;
-RW (2, 3) void g1 (int n, int[n], int); // { dg-warning "24: attribute 'access *\\\(read_write, 2, 3\\\)' positional argument 2 conflicts with previous designation by argument 3" }
-// { dg-message "designating the bound of variable length array argument 2" "note" { target *-*-* } .-1 }
+/* The warning is about the attribute positional argument 2 which refers
+ to the last function argument. Ideally, the caret would be under
+ the corresponding function argument, i.e., the last one here) but
+ that location isn't available yet. Verify that the caret doesn't
+ point to function argument 1 which is the VLA bound (that's what
+ the caret in the note points to). */
+RW (2, 3) void g1 (int n, int[n], int); // { dg-warning "16: attribute 'access *\\\(read_write, 2, 3\\\)' positional argument 2 conflicts with previous designation by argument 3" }
+// { dg-message "24:designating the bound of variable length array argument 2" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-11.c b/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
index a3d95c4..8332b39 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
@@ -47,8 +47,8 @@ typedef __SIZE_TYPE__ size_t;
/* The following tests fail because of missing range information. The xfail
exclusions are PR79356. */
-TEST (signed char, SCHAR_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for signed char" { xfail { ! { aarch64*-*-* arm*-*-* avr-*-* alpha*-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390*-*-* visium-*-* msp430-*-* } } } } */
-TEST (short, SHRT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for short" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* avr-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390x-*-* visium-*-* msp430-*-* } } } } */
+TEST (signed char, SCHAR_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for signed char" { xfail { ! { aarch64*-*-* arm*-*-* avr-*-* alpha*-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390*-*-* visium-*-* msp430-*-* nvptx*-*-*} } } } */
+TEST (short, SHRT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" "missing range info for short" { xfail { ! { aarch64*-*-* arm*-*-* alpha*-*-* avr-*-* ia64-*-* mips*-*-* or1k*-*-* pdp11*-*-* powerpc*-*-* sparc*-*-* s390x-*-* visium-*-* msp430-*-* nvptx*-*-* } } } } */
TEST (int, INT_MIN + 2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
TEST (int, -3, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
TEST (int, -2, ALLOC_MAX); /* { dg-warning "argument 1 range \\\[13, \[0-9\]+\\\] exceeds maximum object size 12" } */
diff --git a/gcc/testsuite/gcc.dg/darwin-sections.c b/gcc/testsuite/gcc.dg/darwin-sections.c
index 276ffa3..dbe3702 100644
--- a/gcc/testsuite/gcc.dg/darwin-sections.c
+++ b/gcc/testsuite/gcc.dg/darwin-sections.c
@@ -13,45 +13,41 @@ e_s ea;
/* { dg-final { scan-assembler ".comm\[\t \]_ub,1" } } */
/* { dg-final { scan-assembler ".comm\[\t \]_ea,1" } } */
-/* These should go into .data */
+/* These should go into __DATA,__common */
char a = 0;
short b = 0;
-/* { dg-final { scan-assembler ".globl _a.*.data.*.space\[\t \]1" } } */
-/* { dg-final { scan-assembler ".globl _b.*.data.*.space\[\t \]2" } } */
-
-/* These should go into __pu_bssN */
long long d = 0;
float e = 0;
double f = 0;
long double g = 0.L;
long long al_256 __attribute__((aligned (256))) = 0;
-/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss3,_d,8,3" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss2,_e,4,2" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss3,_f,8,3" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss4,_g,16,4" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__pu_bss8,_al_256,8,8" } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_a,1,0} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_b,2,1} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_d,8,3} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_e,4,2} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_f,8,3} } } */
+/* long double can be 64 or 128 bits depending on the Darwin subtarget. */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_g,(16,4|8,3)} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__common,_al_256,8,8} } } */
-/* This should go into __zo_bss0 */
+/* These should go into __DATA,__bss */
static e_s sea;
-/* { dg-final { scan-assembler ".zerofill __DATA,__zo_bss0,_sea,1" } } */
-
-/* These should go into .static_data */
static char sa ;
static short sb ;
-/* { dg-final { scan-assembler ".static_data.*_sa:.*.space\[\t \]1" } } */
-/* { dg-final { scan-assembler ".static_data.*_sb:.*.space\[\t \]2" } } */
-
-/* These should go into _bssN */
static long long sd;
static float se ;
static double sf ;
static long double sg;
static long long sal_256 __attribute__((aligned (2048)));
-/* { dg-final { scan-assembler ".zerofill __DATA,__bss3,_sd,8,3" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__bss2,_se,4,2" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__bss3,_sf,8,3" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__bss4,_sg,16,4" } } */
-/* { dg-final { scan-assembler ".zerofill __DATA,__bss11,_sal_256,8,11" } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sea,1,0} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sa,1,0} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sb,2,1} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sd,8,3} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_se,4,2} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sf,8,3} } } */
+/* long double can be 64 or 128 bits depending on the Darwin subtarget. */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sg,(16,4|8,3)} } } */
+/* { dg-final { scan-assembler {.zerofill __DATA,__bss,_sal_256,8,11} } } */
long long foo (int x)
{
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-1.c
index a004042..8802bd1 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-1.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-1.c
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
int __attribute__((__aligned__(64))) i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-2.c
index 439a7da..0de960e 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-2.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
typedef int __attribute__((__aligned__(64))) i_t;
i_t i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-3.c
index 01c19cd..94db588 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-3.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-3.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
typedef int int_t;
typedef int_t __attribute__((__aligned__(64))) i_t;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-4.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-4.c
index 8418274..bc3c516 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-4.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-4.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 2 } }
struct tt {
int __attribute__((__aligned__(64))) i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-5.c
index 322ac50..86cd3a9 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-5.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
struct tt {
int i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-6.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-6.c
index 784f213..bb1895f 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-6.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-6.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
struct tt {
int i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/align-as-1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/align-as-1.c
index 5ef02c3..0b23580 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/align-as-1.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/align-as-1.c
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
// { dg-additional-options "-fno-common" { target hppa*-*-hpux* } }
-// { dg-final { scan-assembler-times " DW_AT_alignment" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times " DW_AT_alignment" 1 } }
int _Alignas(64) i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c
index 24b598e..fd61296 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c
@@ -1,7 +1,7 @@
/* Test to make sure the mcaro info includes a start file command for the main source */
/* { dg-do compile } */
/* { dg-options "-g3 -gdwarf -dA -fverbose-asm" } */
-/* { dg-final { scan-assembler "Start new file" { xfail { powerpc-ibm-aix* } } } } */
+/* { dg-final { scan-assembler "Start new file" } } */
#define ADD(x) (M + x)
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c
index 5204342..3dfa290 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c
@@ -1,7 +1,7 @@
/* Test to make sure the macro info includes the predefined macros with line number 0. */
/* { dg-do compile } */
/* { dg-options "-g3 -gdwarf -dA -fverbose-asm" } */
-/* { dg-final { scan-assembler "At line number 0" { xfail { powerpc-ibm-aix* } } } } */
+/* { dg-final { scan-assembler "At line number 0" } } */
#define FOO 1
int i;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
index 7587a28..bd34f0d 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline5.c
@@ -9,7 +9,7 @@
/* We do not know which is output first so look for both invalid abstract
origins on the lexical blocks (knowing that the abstract instance has
no attribute following the DW_TAG_lexical_block. */
-/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +\[^(\].*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { *-*-solaris2.* && { ! gas } } } } } */
+/* { dg-final { scan-assembler-not "\\(DIE \\(0x(\[0-9a-f\]*)\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +\[^(\].*DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x\\1\[^#/!@;\\|\]*\[#/!@;\\|\] +DW_AT_abstract_origin" { xfail { { *-*-aix* || *-*-solaris2.* } && { ! gas } } } } } */
/* { dg-final { scan-assembler-not "DW_TAG_lexical_block\\)\[^#/!@;\\|x\]*x(\[0-9a-f\]*)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT_abstract_origin.*\\(DIE \\(0x\\1\\) DW_TAG_lexical_block\\)\[^#/!@;\\|\]*\[#/!@;\\|\]+ +DW_AT" } } */
int foo (int i)
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c89.c b/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c89.c
index b6b4a89..6292cf8 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c89.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/lang-c89.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O -std=c89 -g -dA" } */
/* DW_LANG_C89 = 0x0001 */
-/* { dg-final { scan-assembler "0x1.*DW_AT_language" { xfail { powerpc-ibm-aix* } } } } */
+/* { dg-final { scan-assembler "0x1.*DW_AT_language" } } */
int version;
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-attribute.c b/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-attribute.c
index bc2cfa5..7c8924a6 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-attribute.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-attribute.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -std=c99 -g -dA -gno-strict-dwarf" }
// Expect DW_AT_noreturn once in .debug_info and once in .debug_abbrev
-// { dg-final { scan-assembler-times "DW_AT_noreturn" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DW_AT_noreturn" 2 } }
void __attribute__ ((noreturn))
baz (void)
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-keyword.c b/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-keyword.c
index 0105e6c..ced96d1 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-keyword.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/noreturn-function-keyword.c
@@ -1,7 +1,7 @@
// { dg-do compile }
// { dg-options "-O -std=c11 -g -dA -gno-strict-dwarf" }
// Expect DW_AT_noreturn once in .debug_info and once in .debug_abbrev
-// { dg-final { scan-assembler-times "DW_AT_noreturn" 2 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DW_AT_noreturn" 2 } }
_Noreturn void exit (int);
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c
index 3842dbc..4fd8b74 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c
@@ -8,4 +8,4 @@ foo (const char *format, ...)
{
}
-// { dg-final { scan-assembler-times "DIE.*DW_TAG_unspecified_parameters" 1 { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-times "DIE.*DW_TAG_unspecified_parameters" 1 } }
diff --git a/gcc/testsuite/gcc.dg/dfp/pr97439.c b/gcc/testsuite/gcc.dg/dfp/pr97439.c
new file mode 100644
index 0000000..7fcf834
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr97439.c
@@ -0,0 +1,27 @@
+// { dg-do run }
+// { dg-options "-O1" }
+
+static int
+foo(_Decimal128 x, _Decimal128 y)
+{
+ if (x > y)
+ return 1;
+
+ return 0;
+}
+
+int __attribute__((noinline))
+bar(_Decimal128 x)
+{
+ return foo (x, -1.0DL * __builtin_infd32());
+}
+
+int
+main (void)
+{
+ int res = bar (0.0DL);
+ if (res != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-2.c b/gcc/testsuite/gcc.dg/gomp/simd-2.c
new file mode 100644
index 0000000..7ac3eb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/simd-2.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-mavx" { target avx } } */
+/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" } } */
+
+int a[10000][128];
+
+void
+foo (void)
+{
+ #pragma omp for simd schedule (simd: dynamic, 32) collapse(2)
+ for (int i = 0; i < 10000; i++)
+ for (int j = 0; j < 128; j++)
+ a[i][j] += 3;
+}
+
+void
+bar (void)
+{
+ #pragma omp parallel for simd schedule (simd: dynamic, 32) collapse(2)
+ for (int i = 0; i < 10000; i++)
+ for (int j = 0; j < 128; j++)
+ a[i][j] += 3;
+}
+
+void
+baz (void)
+{
+ #pragma omp distribute parallel for simd schedule (simd: dynamic, 32) collapse(2)
+ for (int i = 0; i < 10000; i++)
+ for (int j = 0; j < 128; j++)
+ a[i][j] += 3;
+}
+
+void
+qux (void)
+{
+ #pragma omp distribute simd dist_schedule (static, 128) collapse(2)
+ for (int i = 0; i < 10000; i++)
+ for (int j = 0; j < 128; j++)
+ a[i][j] += 3;
+}
+
+void
+corge (void)
+{
+ #pragma omp taskloop simd collapse(2)
+ for (int i = 0; i < 10000; i++)
+ for (int j = 0; j < 128; j++)
+ a[i][j] += 3;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-3.c b/gcc/testsuite/gcc.dg/gomp/simd-3.c
new file mode 100644
index 0000000..13e1346
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/simd-3.c
@@ -0,0 +1,51 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */
+/* { dg-additional-options "-mavx" { target avx } } */
+/* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" } } */
+
+int a[1024][1024];
+
+void
+foo (void)
+{
+ #pragma omp for simd collapse(2)
+ for (int i = 0; i < 1024; i++)
+ for (int j = 0; j < i; j++)
+ a[i][j] += 3;
+}
+
+void
+bar (void)
+{
+ #pragma omp parallel for simd collapse(2)
+ for (int i = 0; i < 1024; i++)
+ for (int j = 0; j < i; j++)
+ a[i][j] += 3;
+}
+
+void
+baz (void)
+{
+ #pragma omp distribute parallel for simd collapse(2)
+ for (int i = 0; i < 1024; i++)
+ for (int j = 0; j < i; j++)
+ a[i][j] += 3;
+}
+
+void
+qux (void)
+{
+ #pragma omp distribute simd collapse(2)
+ for (int i = 0; i < 1024; i++)
+ for (int j = 0; j < i; j++)
+ a[i][j] += 3;
+}
+
+void
+corge (void)
+{
+ #pragma omp taskloop simd collapse(2)
+ for (int i = 0; i < 1024; i++)
+ for (int j = 0; j < i; j++)
+ a[i][j] += 3;
+}
diff --git a/gcc/testsuite/gcc.dg/independent-cloneids-1.c b/gcc/testsuite/gcc.dg/independent-cloneids-1.c
index 516211a..efbc1c5 100644
--- a/gcc/testsuite/gcc.dg/independent-cloneids-1.c
+++ b/gcc/testsuite/gcc.dg/independent-cloneids-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -fipa-cp -fipa-cp-clone" } */
+/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-rtl-final" } */
/* { dg-skip-if "Odd label definition syntax" { mmix-*-* } } */
extern int printf (const char *, ...);
@@ -29,11 +29,11 @@ baz (int arg)
return foo (8);
}
-/* { dg-final { scan-assembler-times {(?n)^_*bar[.$_]constprop[.$_]0:} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^_*bar[.$_]constprop[.$_]1:} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^_*bar[.$_]constprop[.$_]2:} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^_*foo[.$_]constprop[.$_]0:} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^_*foo[.$_]constprop[.$_]1:} 1 } } */
-/* { dg-final { scan-assembler-times {(?n)^_*foo[.$_]constprop[.$_]2:} 1 } } */
-/* { dg-final { scan-assembler-not {(?n)^_*foo[.$_]constprop[.$_]3:} } } */
-/* { dg-final { scan-assembler-not {(?n)^_*foo[.$_]constprop[.$_]4:} } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function bar.constprop \(bar[.$_]constprop[.$_]0,} 1 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function bar.constprop \(bar[.$_]constprop[.$_]1,} 1 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function bar.constprop \(bar[.$_]constprop[.$_]2,} 1 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function foo.constprop \(foo[.$_]constprop[.$_]0,} 1 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function foo.constprop \(foo[.$_]constprop[.$_]1,} 1 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function foo.constprop \(foo[.$_]constprop[.$_]2,} 1 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function foo.constprop \(foo[.$_]constprop[.$_]3,} 0 "final" } } */
+/* { dg-final { scan-rtl-dump-times {(?n)^;; Function foo.constprop \(foo[.$_]constprop[.$_]4,} 0 "final" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-5.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-5.c
new file mode 100644
index 0000000..218f805
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-5.c
@@ -0,0 +1,36 @@
+/* { dg-options "-O2 -fdump-ipa-inline-details -fno-early-inlining " } */
+/* { dg-add-options bind_pic_locally } */
+int j,k,l;
+int test3(int);
+int test4(int);
+
+static inline int
+test2(int i)
+{
+ if (__builtin_constant_p (i))
+ {
+ switch (i)
+ {
+ case 1: return j;
+ case 2: return k;
+ case 3: return l;
+ }
+ }
+ else return test3(i)+test4(i);
+}
+
+static inline int
+test (int i)
+{
+ return test2(i) + test2(i+1) + test3 (i) + test3(i) + test3(i) + test3 (i);
+}
+
+int
+run (int i)
+{
+ return test (i) + test (i);
+}
+/* The test should work by first inlining test2->test and then test to run
+ Both are called twice, so 4 hints (the second make sure that we propagate
+ to callers. */
+/* { dg-final { scan-ipa-dump-times "hints: declared_inline builtin_constant_p" 4 "inline" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
index 93dd871..e7bf6d4 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-13.c
@@ -1,5 +1,5 @@
/* { dg-do link } */
-/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3 -fno-ipa-icf" } */
+/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3 -fno-ipa-icf -fno-ipa-modref" } */
static int x, y;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
index 4a22e39..df7e356 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c
@@ -24,7 +24,7 @@ ox (struct bovid cow)
}
int
-main (int argc, char *argv[])
+main (int argc, char **argv)
{
struct bovid cow;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-12.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-12.c
index 4d9057e..0cc76bd 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-12.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-12.c
@@ -34,7 +34,7 @@ bar (struct S s)
}
int
-main (int argc, char *argv[])
+main (int argc, char **argv)
{
struct S s;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c
index 4d4ed74..e8751da 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-13.c
@@ -33,7 +33,7 @@ bar (struct S *s)
}
int
-main (int argc, char *argv[])
+main (int argc, char **argv)
{
struct S s;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-14.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-14.c
index 3ca302c..75619c6 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-14.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-14.c
@@ -43,7 +43,7 @@ bar (struct S s)
}
int
-main (int argc, char *argv[])
+main (int argc, char **argv)
{
struct S s;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-15.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-15.c
index 6c57c7b..aa13a94 100644
--- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-15.c
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-15.c
@@ -45,7 +45,7 @@ bar (struct S *s, int rec)
volatile int g;
int
-main (int argc, char *argv[])
+main (int argc, char **argv)
{
struct S s;
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-loophint-1.c b/gcc/testsuite/gcc.dg/ipa/ipcp-loophint-1.c
new file mode 100644
index 0000000..6d049af
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-loophint-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-ipa-cp-details" } */
+
+extern int *o, *p, *q, *r;
+
+#define FUNCTIONS fa(), fb(), fc(), fd(), fe(), ff(), fg()
+
+extern void FUNCTIONS;
+
+void foo (int c)
+{
+ FUNCTIONS;
+ FUNCTIONS;
+ for (int i = 0; i < 100; i++)
+ {
+ for (int j = 0; j < c; j++)
+ o[i] = p[i] + q[i] * r[i];
+ }
+ FUNCTIONS;
+ FUNCTIONS;
+}
+
+void bar()
+{
+ foo (8);
+ p[4]++;
+}
+
+/* { dg-final { scan-ipa-dump {with known iterations:[1-9]} "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/modref-1.c b/gcc/testsuite/gcc.dg/ipa/modref-1.c
new file mode 100644
index 0000000..858567d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/modref-1.c
@@ -0,0 +1,24 @@
+/* { dg-options "-O2 -fdump-ipa-modref" } */
+/* { dg-do compile } */
+__attribute__((noinline))
+void a(char *ptr, char *ptr2)
+{
+ (*ptr)++;
+ (*ptr2)++;
+}
+
+__attribute__((noinline))
+void b(char *ptr)
+{
+ a(ptr+1,&ptr[2]);
+}
+
+int main()
+{
+ char c[3]={0,1,0};
+ b(c);
+ return c[0]+c[2];
+}
+/* Check that both param offsets are determined correctly. */
+/* { dg-final { scan-ipa-dump "param offset:1" "modref" } } */
+/* { dg-final { scan-ipa-dump "param offset:2" "modref" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/remref-2a.c b/gcc/testsuite/gcc.dg/ipa/remref-2a.c
index 34a6188..c2f3eac 100644
--- a/gcc/testsuite/gcc.dg/ipa/remref-2a.c
+++ b/gcc/testsuite/gcc.dg/ipa/remref-2a.c
@@ -1,7 +1,7 @@
/* Verify that indirect inlining can also remove references of the functions it
discovers calls for. */
/* { dg-do compile } */
-/* { dg-options "-O3 -fno-early-inlining -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized -fno-ipa-icf" } */
+/* { dg-options "-O3 -fno-early-inlining -fno-ipa-cp -fdump-ipa-inline -fdump-tree-optimized -fno-ipa-icf -fno-ipa-modref" } */
int global;
diff --git a/gcc/testsuite/gcc.dg/ipa/symver1.c b/gcc/testsuite/gcc.dg/ipa/symver1.c
index 645de7e..2cd0258 100644
--- a/gcc/testsuite/gcc.dg/ipa/symver1.c
+++ b/gcc/testsuite/gcc.dg/ipa/symver1.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-skip-if "only works for ELF targets" { *-*-darwin* *-*-aix* } } */
__attribute__ ((__symver__ ("foo@VER_2")))
__attribute__ ((__symver__ ("foo@VER_3")))
diff --git a/gcc/testsuite/gcc.dg/lto/modref-1_0.c b/gcc/testsuite/gcc.dg/lto/modref-1_0.c
new file mode 100644
index 0000000..8fcb9ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/modref-1_0.c
@@ -0,0 +1,14 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options {"-O2 -flto-partition=max -flto"} } */
+extern void recursive (int *a, int *b, int *c, int level);
+int
+main()
+{
+ int x = 123, y=124, z=125;
+ recursive (&x,&y,&z,1);
+ if (y)
+ __builtin_abort ();
+ if (!__builtin_constant_p (z))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/modref-1_1.c b/gcc/testsuite/gcc.dg/lto/modref-1_1.c
new file mode 100644
index 0000000..c7c0eae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/modref-1_1.c
@@ -0,0 +1,13 @@
+short aa;
+void
+__attribute__ ((noinline, noclone))
+recursive (int *a, int *b, int *c, int level)
+{
+ if (level && c)
+ {
+ recursive (b,a,c,0);
+ aa++;
+ }
+ else
+ *a=0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-default.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-default.c
deleted file mode 100644
index 5712dbd..0000000
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-default.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-show-caret" } */
-
-#include <stdlib.h>
-
-void *wrapped_malloc (size_t size)
-{
- return malloc (size);
-}
-
-void wrapped_free (void *ptr)
-{
- free (ptr); /* { dg-warning "double-free of 'ptr' \\\[CWE-415\\]" } */
- /* { dg-begin-multiline-output "" }
- free (ptr);
- ^~~~~~~~~~
- 'test': events 1-2
- |
- | {
- | ^
- | |
- | (1) entering 'test'
- | boxed_int *obj = make_boxed_int (i);
- | ~~~~~~~~~~~~~~~~~~
- | |
- | (2) calling 'make_boxed_int'
- |
- +--> 'make_boxed_int': events 3-4
- |
- | {
- | ^
- | |
- | (3) entering 'make_boxed_int'
- | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
- | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- | |
- | (4) calling 'wrapped_malloc'
- |
- +--> 'wrapped_malloc': events 5-6
- |
- | {
- | ^
- | |
- | (5) entering 'wrapped_malloc'
- | return malloc (size);
- | ~~~~~~~~~~~~~
- | |
- | (6) calling 'malloc'
- |
- <-------------+
- |
- 'test': event 7
- |
- | free_boxed_int (obj);
- | ^~~~~~~~~~~~~~~~~~~~
- | |
- | (7) calling 'free_boxed_int'
- |
- +--> 'free_boxed_int': events 8-9
- |
- | {
- | ^
- | |
- | (8) entering 'free_boxed_int'
- | wrapped_free (bi);
- | ~~~~~~~~~~~~~~~~~
- | |
- | (9) calling 'wrapped_free'
- |
- +--> 'wrapped_free': events 10-11
- |
- | {
- | ^
- | |
- | (10) entering 'wrapped_free'
- | free (ptr);
- | ~~~~~~~~~~
- | |
- | (11) calling 'free'
- |
- <-------------+
- |
- 'test': event 12
- |
- | free_boxed_int (obj);
- | ^~~~~~~~~~~~~~~~~~~~
- | |
- | (12) calling 'free_boxed_int'
- |
- +--> 'free_boxed_int': events 13-14
- |
- | {
- | ^
- | |
- | (13) entering 'free_boxed_int'
- | wrapped_free (bi);
- | ~~~~~~~~~~~~~~~~~
- | |
- | (14) calling 'wrapped_free'
- |
- +--> 'wrapped_free': events 15-16
- |
- | {
- | ^
- | |
- | (15) entering 'wrapped_free'
- | free (ptr);
- | ~~~~~~~~~~
- | |
- | (16) calling 'free'
- |
- { dg-end-multiline-output "" } */
-}
-
-typedef struct boxed_int
-{
- int i;
-} boxed_int;
-
-boxed_int *
-make_boxed_int (int i)
-{
- boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
- result->i = i;
- return result;
-}
-
-void
-free_boxed_int (boxed_int *bi)
-{
- wrapped_free (bi);
-}
-
-void test (int i)
-{
- boxed_int *obj = make_boxed_int (i);
-
- free_boxed_int (obj);
-
- free_boxed_int (obj);
-}
-
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-plain.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-plain.c
new file mode 100644
index 0000000..75acd25
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-path-format-plain.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+
+#include <stdlib.h>
+
+void *wrapped_malloc (size_t size)
+{
+ return malloc (size);
+}
+
+void wrapped_free (void *ptr)
+{
+ free (ptr); /* { dg-warning "double-free of 'ptr' \\\[CWE-415\\]" } */
+}
+
+typedef struct boxed_int
+{
+ int i;
+} boxed_int;
+
+boxed_int *
+make_boxed_int (int i)
+{
+ boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
+ result->i = i;
+ return result;
+}
+
+void
+free_boxed_int (boxed_int *bi)
+{
+ wrapped_free (bi);
+}
+
+void test (int i)
+{ /* { dg-message "\\(1\\) entering 'test'" } */
+ boxed_int *obj = make_boxed_int (i); /* { dg-message "\\(2\\) calling 'make_boxed_int'" } */
+ /* etc */
+
+ free_boxed_int (obj);
+
+ free_boxed_int (obj);
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
index 946a234..b2b269a 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
+/* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events" } */
#include <stddef.h>
#include <stdlib.h>
@@ -43,9 +43,9 @@ make_a_list_of_random_ints_badly(PyObject *self,
| | (1) when 'PyList_New' fails, returning NULL
| 26 |
| 27 | for (i = 0; i < count; i++) {
- | | ~~~
- | | |
- | | (2) when 'i < count'
+ | | ~~~~~~~~~
+ | | |
+ | | (2) when 'i < count'
| 28 | item = PyLong_FromLong(random());
| 29 | PyList_Append(list, item);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
index c02b008..5dd102a 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -100,7 +100,7 @@ set plugin_test_list [list \
diagnostic-test-paths-2.c \
diagnostic-test-paths-3.c \
diagnostic-test-paths-4.c \
- diagnostic-path-format-default.c \
+ diagnostic-path-format-plain.c \
diagnostic-path-format-none.c \
diagnostic-path-format-separate-events.c \
diagnostic-path-format-inline-events-1.c \
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36093.c b/gcc/testsuite/gcc.dg/pr36093.c
index dac5720..8474641 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr36093.c
+++ b/gcc/testsuite/gcc.dg/pr36093.c
@@ -1,3 +1,4 @@
+/* { dg-do compile } */
/* { dg-skip-if "small alignment" { pdp11-*-* } } */
extern void abort (void);
@@ -7,7 +8,7 @@ typedef struct Bar {
} Bar __attribute__((__aligned__(128)));
typedef struct Foo {
- Bar bar[4];
+ Bar bar[4]; /* { dg-error "size of array element is not a multiple of its alignment" } */
} Foo;
Foo foo[4];
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr43783.c b/gcc/testsuite/gcc.dg/pr43783.c
index 1eff2b9..196735b 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr43783.c
+++ b/gcc/testsuite/gcc.dg/pr43783.c
@@ -1,3 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
/* { dg-skip-if "small alignment" { pdp11-*-* } } */
typedef __attribute__((aligned(16)))
@@ -5,7 +7,7 @@ struct {
unsigned long long w[3];
} UINT192;
-UINT192 bid_Kx192[32];
+UINT192 bid_Kx192[32]; /* { dg-error "size of array element is not a multiple of its alignment" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/pr51683.c b/gcc/testsuite/gcc.dg/pr51683.c
index c477cd8..7a624e4 100644
--- a/gcc/testsuite/gcc.dg/pr51683.c
+++ b/gcc/testsuite/gcc.dg/pr51683.c
@@ -12,6 +12,9 @@ void *
foo (void *p)
{
return bar ((void *) 0x12345000, p, 256);
+ /* Integers converted to pointers are assumed to be the result of
+ (invalid) arithmetic on null pointers.
+ { dg-prune-output "writing 256 bytes into a region of size 0" } */
}
/* { dg-final { scan-tree-dump "memcpy" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pr66552.c b/gcc/testsuite/gcc.dg/pr66552.c
new file mode 100644
index 0000000..7583c9a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr66552.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lower" } */
+
+unsigned a(unsigned x, int n)
+{
+ return x >> (n % 32);
+}
+
+unsigned b(unsigned x, int n)
+{
+ return x << (n % 32);
+}
+
+/* { dg-final { scan-tree-dump-not " % " "lower" } } */
diff --git a/gcc/testsuite/gcc.dg/pr68671.c b/gcc/testsuite/gcc.dg/pr68671.c
index 9b473ca..bec4639 100644
--- a/gcc/testsuite/gcc.dg/pr68671.c
+++ b/gcc/testsuite/gcc.dg/pr68671.c
@@ -1,7 +1,6 @@
/* PR tree-optimization/68671 */
/* { dg-do run } */
/* { dg-options " -O2 -fno-tree-dce" } */
-/* { dg-xfail-if "ptxas crashes" { nvptx-*-* } } */
volatile int a = -1;
volatile int b;
diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c
index 0049f37..71bbc13 100644
--- a/gcc/testsuite/gcc.dg/pr81192.c
+++ b/gcc/testsuite/gcc.dg/pr81192.c
@@ -1,4 +1,20 @@
-/* { dg-options "-Os -fdump-tree-pre-details" } */
+/* { dg-options "-Os -fdump-tree-pre-details -fdisable-tree-evrp" } */
+
+/* Disable tree-evrp because the new version of evrp sees
+<bb 3> :
+ if (j_8(D) != 2147483647)
+ goto <bb 4>; [50.00%]
+ else
+ goto <bb 5>; [50.00%]
+<bb 4> :
+ iftmp.2_11 = j_8(D) + 1;
+<bb 5> :
+ # iftmp.2_12 = PHI <j_8(D)(3), iftmp.2_11(4)>
+
+EVRP now recognizes a constant can be propagated into the 3->5 edge and
+produces
+ # iftmp.2_12 = PHI <2147483647(3), iftmp.2_11(4)>
+which causes the situation being tested to dissapear before we get to PRE. */
#if __SIZEOF_INT__ == 2
#define unsigned __UINT32_TYPE__
diff --git a/gcc/testsuite/gcc.dg/pr87314-1.c b/gcc/testsuite/gcc.dg/pr87314-1.c
index 9bc9056..0cb9c07 100644
--- a/gcc/testsuite/gcc.dg/pr87314-1.c
+++ b/gcc/testsuite/gcc.dg/pr87314-1.c
@@ -8,4 +8,6 @@ int h() { return "bye"=="helloooobye"+8; }
/* { dg-final { scan-tree-dump-times "hello" 1 "original" } } */
/* The test in h() should be retained because the result depends on
string merging. */
-/* { dg-final { scan-assembler "hellooo" } } */
+/* { dg-final { scan-assembler "hellooo" { target { ! nvptx*-*-* } } } } */
+/* { dg-final { scan-assembler "104, 101, 108, 108, 111, 111, 111" { target { nvptx*-*-* } } } } */
+
diff --git a/gcc/testsuite/gcc.dg/pr94600-1.c b/gcc/testsuite/gcc.dg/pr94600-1.c
index b5913a0..149e4f3 100644
--- a/gcc/testsuite/gcc.dg/pr94600-1.c
+++ b/gcc/testsuite/gcc.dg/pr94600-1.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target size32plus } */
/* { dg-options "-fdump-rtl-final -O2" } */
+/* { dg-additional-options "-DALIGN_VAR" { target { ! non_strict_align } } } */
/* Assignments to a whole struct of suitable size (32 bytes) must not be
picked apart into field accesses. */
@@ -12,7 +13,11 @@ typedef struct {
unsigned int f3 : 7;
} t0;
-static t0 a0[] = {
+static t0 a0[]
+#ifdef ALIGN_VAR
+__attribute__((aligned (4)))
+#endif
+ = {
{ .f0 = 7, .f1 = 99, .f3 = 1, },
{ .f0 = 7, .f1 = 251, .f3 = 1, },
{ .f0 = 8, .f1 = 127, .f3 = 5, },
diff --git a/gcc/testsuite/gcc.dg/pr94600-3.c b/gcc/testsuite/gcc.dg/pr94600-3.c
index 7537f6c..2fce9f1 100644
--- a/gcc/testsuite/gcc.dg/pr94600-3.c
+++ b/gcc/testsuite/gcc.dg/pr94600-3.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target size32plus } */
/* { dg-options "-fdump-rtl-final -O2 -fno-unroll-loops" } */
+/* { dg-additional-options "-DALIGN_VAR" { target { ! non_strict_align } } } */
/* Same-address version of pr94600-1.c. */
@@ -11,7 +12,11 @@ typedef struct {
unsigned int f3 : 7;
} t0;
-static t0 a0[] = {
+static t0 a0[]
+#ifdef ALIGN_VAR
+__attribute__((aligned (4)))
+#endif
+ = {
{ .f0 = 7, .f1 = 99, .f3 = 1, },
{ .f0 = 7, .f1 = 251, .f3 = 1, },
{ .f0 = 8, .f1 = 127, .f3 = 5, },
diff --git a/gcc/testsuite/gcc.dg/pr96453.c b/gcc/testsuite/gcc.dg/pr96453.c
new file mode 100644
index 0000000..f758e7e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96453.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-Og -fno-early-inlining -fno-tree-ccp -fno-tree-dce" } */
+/* { dg-additional-options "-mavx -mno-sse4.2" { target x86_64-*-* i?86-*-* } } */
+
+typedef int __attribute__ ((__vector_size__ (16))) U;
+typedef unsigned long __attribute__ ((__vector_size__ (16))) V;
+
+static inline int
+bar (unsigned long e, V f)
+{
+ V g = f != e;
+ (union {U b;}){(U) g};
+}
+
+void
+foo (void)
+{
+ int j = bar (8, (V) { });
+ for (unsigned i;; i[&j])
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/pr96466.c b/gcc/testsuite/gcc.dg/pr96466.c
new file mode 100644
index 0000000..a8840f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96466.c
@@ -0,0 +1,19 @@
+/* PR tree-optimization/96466 */
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-Og -finline-functions-called-once -fno-tree-ccp" } */
+
+typedef unsigned long __attribute__ ((__vector_size__ (8))) V;
+
+V
+bar (unsigned long x, V v)
+{
+ v &= x >= v;
+ return (V) v;
+}
+
+V
+foo (void)
+{
+ return bar (5, (V) 4441221375);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97192.c b/gcc/testsuite/gcc.dg/pr97192.c
new file mode 100644
index 0000000..16647ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97192.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftracer" } */
+/* { dg-additional-options "-mavx512vl" { target x86_64-*-* i?86-*-* } } */
+
+typedef int __attribute__ ((__vector_size__ (32))) V;
+
+int a, b;
+V v;
+
+int
+foo (void)
+{
+ b -= 4 - !a;
+ V u = 0 != v == a;
+ return u[0];
+}
diff --git a/gcc/testsuite/gcc.dg/pr97238.c b/gcc/testsuite/gcc.dg/pr97238.c
new file mode 100644
index 0000000..746e93a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97238.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wno-psabi -w" } */
+
+typedef int __attribute__ ((__vector_size__ (8))) V;
+int b, c, e;
+V d;
+
+V
+foo (void)
+{
+ return (b || e) | c > d | ((b || e) | c > d);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97315-2.c b/gcc/testsuite/gcc.dg/pr97315-2.c
new file mode 100644
index 0000000..5dd1b6a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97315-2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void c(int);
+
+int a;
+void b()
+{
+ if (a >= 2147483647)
+ c(a + 1);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97317.c b/gcc/testsuite/gcc.dg/pr97317.c
new file mode 100644
index 0000000..f07327a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97317.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct a {
+ unsigned c : 17;
+};
+struct a b;
+int d(void) {
+ short e = b.c;
+ return e ? 0 : b.c;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97322.c b/gcc/testsuite/gcc.dg/pr97322.c
new file mode 100644
index 0000000..f253c0d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97322.c
@@ -0,0 +1,17 @@
+/* PR target/97322 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (unsigned long long x, unsigned long long *y)
+{
+ y[0] = x / 10;
+ y[1] = x % 10;
+}
+
+void
+bar (unsigned int x, unsigned int *y)
+{
+ y[0] = x / 10;
+ y[1] = x % 10;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97357.c b/gcc/testsuite/gcc.dg/pr97357.c
new file mode 100644
index 0000000..6b391b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97357.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-require-effective-target indirect_jumps } */
+
+#include <setjmp.h>
+#include <stdlib.h>
+
+void * my_malloc (size_t size);
+
+typedef struct glk {
+ struct glk *nxt;
+} glk;
+
+typedef struct Lock
+{
+ glk ByteLock;
+} Lock;
+
+static Lock *l, *lk;
+
+void bytelocks(glk *rethead, jmp_buf jb)
+{
+ glk *cur, *cur_lk;
+
+ if (( setjmp (jb)) == 0)
+ for (cur = &l->ByteLock; cur != ((glk *)0) ; cur = (cur)->nxt)
+ for (cur_lk = &lk->ByteLock; cur_lk != ((glk *)0); cur_lk = cur_lk->nxt)
+ {
+ glk *retrng;
+
+ if(!rethead)
+ rethead = (glk *) my_malloc (sizeof(glk));
+ retrng = (glk *) my_malloc (sizeof(glk));
+
+ retrng->nxt = rethead;
+ }
+
+ return;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97359.c b/gcc/testsuite/gcc.dg/pr97359.c
new file mode 100644
index 0000000..142542e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97359.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+
+typedef unsigned int uint32_t;
+int a;
+void b(uint32_t c) {
+ uint32_t *d = &c;
+ for (; a;)
+ for (;; (*d %= a) / (*d > 1 > (c > 0)) ?: d)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97360-2.c b/gcc/testsuite/gcc.dg/pr97360-2.c
new file mode 100644
index 0000000..48aebf1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97360-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 " } */
+
+void *a;
+void *b(void);
+void *e(void);
+
+void *
+c() {
+ void *d;
+ if (d == b && e())
+ d = a;
+ return d;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97371.c b/gcc/testsuite/gcc.dg/pr97371.c
new file mode 100644
index 0000000..ffefad0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97371.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+
+int a, b;
+void c() {
+ if (b >> 38)
+ a = b;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97378.c b/gcc/testsuite/gcc.dg/pr97378.c
new file mode 100644
index 0000000..27e4a1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97378.c
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+int a, b, c;
+void d() {
+e : {
+ long f;
+ long *g = &f;
+ if ((a != 0) - (b = 0))
+ ;
+ else
+ a &= (*g %= a *= c) >= (*g || f);
+ goto e;
+}
+}
diff --git a/gcc/testsuite/gcc.dg/pr97381.c b/gcc/testsuite/gcc.dg/pr97381.c
new file mode 100644
index 0000000..947692c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97381.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+int a;
+void b() {
+ char c = 27;
+ for (; c <= 85; c += 1) {
+ a /= 148372120 * c;
+ if (a)
+ for (;;)
+ ;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr97396.c b/gcc/testsuite/gcc.dg/pr97396.c
new file mode 100644
index 0000000..d992c11
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97396.c
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-O1 -ftree-vrp" }
+// { dg-additional-options "-m32" { target { i?86-*-* x86_64-*-* } } }
+
+unsigned int
+po (char *os, unsigned int al)
+{
+ for (;;)
+ {
+ int qx = 0;
+
+ while (al < 1)
+ {
+ char *cw;
+
+ cw = os + qx;
+ if (cw)
+ return al + qx;
+
+ qx += sizeof *cw;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr97462.c b/gcc/testsuite/gcc.dg/pr97462.c
new file mode 100644
index 0000000..52c0533
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97462.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -w" } */
+
+int a, b;
+
+void d ()
+{
+ a << ~0 && b;
+ b = a;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97463.c b/gcc/testsuite/gcc.dg/pr97463.c
new file mode 100644
index 0000000..f93b07c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97463.c
@@ -0,0 +1,7 @@
+/* PR c/97463 - ICE in warn_parm_ptrarray_mismatch on an incompatible
+ function redeclaration
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+void f (void**);
+void f (int n) { } // { dg-error "conflicting types" }
diff --git a/gcc/testsuite/gcc.dg/pr97467.c b/gcc/testsuite/gcc.dg/pr97467.c
new file mode 100644
index 0000000..dcbd218
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97467.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+int a;
+long b;
+unsigned int c = 1;
+
+int main () {
+ int e;
+ for (; c <= 0; c++) {
+ int f = 0;
+ b = e;
+ a = f || b << c;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97488.c b/gcc/testsuite/gcc.dg/pr97488.c
new file mode 100644
index 0000000..de7396c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97488.c
@@ -0,0 +1,11 @@
+// { dg-do compile { target int128 } }
+// { dg-options "-O1 -ftree-vrp" }
+
+__int128
+ef (__int128 ms)
+{
+ int dh = 129;
+ int *hj = &dh;
+
+ return ms << *hj ? ms : 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97501.c b/gcc/testsuite/gcc.dg/pr97501.c
new file mode 100644
index 0000000..aedac83
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97501.c
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// { dg-options "-O2" }
+
+static int c = 0;
+
+int main() {
+ int b = 0;
+ if (c) {
+ for (;; b--)
+ do
+ b++;
+ while (b);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr97502.c b/gcc/testsuite/gcc.dg/pr97502.c
new file mode 100644
index 0000000..d87af9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97502.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+extern char v[54];
+void bar (char *);
+void
+foo (void)
+{
+ int i;
+ char c[32];
+ bar (c);
+ for (i = 0; i < 32; i++)
+ c[i] = c[i] && !v[i];
+ bar (c);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97515.c b/gcc/testsuite/gcc.dg/pr97515.c
new file mode 100644
index 0000000..2b6185e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97515.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int
+e7 (int gg)
+{
+ int xe = 0;
+
+ while (xe < 1)
+ {
+ int ui;
+
+ ui = ~xe;
+ if (ui == 0)
+ ui = xe >> gg;
+
+ xe %= !ui;
+ }
+
+ return xe;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97520.c b/gcc/testsuite/gcc.dg/pr97520.c
new file mode 100644
index 0000000..9f66595
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97520.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-fre" } */
+
+char a;
+void b() {
+ char *c[5];
+ char *d = &a;
+ &d;
+ *(c[4] = d);
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/gcc.dg/spellcheck-inttypes.c b/gcc/testsuite/gcc.dg/spellcheck-inttypes.c
index 1146a7c..611d7f0 100644
--- a/gcc/testsuite/gcc.dg/spellcheck-inttypes.c
+++ b/gcc/testsuite/gcc.dg/spellcheck-inttypes.c
@@ -1,7 +1,7 @@
/* { dg-options "-std=c99" } */
/* Prevent AIX from implicitly including inttypes.h. */
#ifdef _AIX
-#define _H_INTTYPES_TYPE_TS
+#define _STD_TYPES_T
#endif
#include <stdio.h>
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.dg/tls/thr-cse-1.c b/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
index 84eedfd..7145671 100644
--- a/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
+++ b/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
@@ -4,6 +4,7 @@
registers and thus getting the counts wrong. */
/* { dg-additional-options "-mshort-calls" { target epiphany-*-* } } */
/* { dg-require-effective-target tls_emulated } */
+/* { dg-additional-options "-fdump-rtl-final-slim" { target nvptx-*-* } }*/
/* Test that we only get one call to emutls_get_address when CSE is
active. Note that the var _must_ be initialized for the scan asm
@@ -18,10 +19,12 @@ int foo (int b, int c, int d)
return a;
}
-/* { dg-final { scan-assembler-not "emutls_get_address.*emutls_get_address.*" { target { ! { "*-wrs-vxworks" "*-*-darwin8" "hppa*-*-hpux*" "i?86-*-mingw*" "x86_64-*-mingw*" visium-*-* } } } } } */
+/* { dg-final { scan-assembler-not "emutls_get_address.*emutls_get_address.*" { target { ! { "*-wrs-vxworks" "*-*-darwin8" "hppa*-*-hpux*" "i?86-*-mingw*" "x86_64-*-mingw*" visium-*-* nvptx-*-* } } } } } */
/* { dg-final { scan-assembler-not "call\tL___emutls_get_address.stub.*call\tL___emutls_get_address.stub.*" { target "*-*-darwin8" } } } */
/* { dg-final { scan-assembler-not "(b,l|bl) __emutls_get_address.*(b,l|bl) __emutls_get_address.*" { target "hppa*-*-hpux*" } } } */
/* { dg-final { scan-assembler-not "tls_lookup.*tls_lookup.*" { target *-wrs-vxworks } } } */
/* { dg-final { scan-assembler-not "call\t___emutls_get_address.*call\t___emutls_get_address" { target "i?86-*-mingw*" } } } */
/* { dg-final { scan-assembler-not "call\t__emutls_get_address.*call\t__emutls_get_address" { target "x86_64-*-mingw*" } } } */
/* { dg-final { scan-assembler-not "%l __emutls_get_address.*%l __emutls_get_address" { target visium-*-* } } } */
+
+/* { dg-final { scan-rtl-dump-times "emutls_get_address" 1 "final" { target nvptx-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr97135.c b/gcc/testsuite/gcc.dg/torture/pr97135.c
new file mode 100644
index 0000000..223f4d0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr97135.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+long long e, *d = &e;
+int a, b, c;
+
+int
+main ()
+{
+ for (; c <= 5; c++)
+ for (b = 0; b <= 5; b++)
+ {
+ for (a = 1; a <= 5; a++)
+ ;
+ *d = 0;
+ if (c)
+ break;
+ }
+ if (a != 6)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr97330-1.c b/gcc/testsuite/gcc.dg/torture/pr97330-1.c
new file mode 100644
index 0000000..7dce5bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr97330-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+typedef int a;
+typedef char b;
+int c;
+void d(e, f, dst, g, avail, h) int e;
+b *f, *dst;
+a g, avail;
+int h;
+{
+ b i = *f;
+ if (e)
+ goto j;
+ while (avail) {
+ *dst = i;
+ j:
+ avail -= c;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr97330-2.c b/gcc/testsuite/gcc.dg/torture/pr97330-2.c
new file mode 100644
index 0000000..a064483
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr97330-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int a, b, d;
+char c, e;
+void f(void) {
+ char g = c;
+ if (b)
+ goto h;
+ while (d) {
+ e = c;
+ h:
+ d -= a;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr96394.c b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c
new file mode 100644
index 0000000..4280182
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr96394.c
@@ -0,0 +1,64 @@
+/* PR ipa/96394 */
+/* { dg-options "-O2" } */
+
+typedef struct _entry {
+ int has_next;
+ int next_ix;
+ int count;
+} entry;
+
+extern entry table[];
+
+void *
+__attribute__((noipa))
+PyErr_Format(entry * e){ return 0; }
+
+void ae(entry *);
+int h(entry *);
+int ap(entry *);
+int ag(entry *);
+
+int ag(entry *j) {
+ if (j->has_next)
+ h(&table[j->next_ix]);
+ return 0;
+}
+static int ai(entry *j, int k(entry *), int l, int m) {
+ int am = 1;
+ int ab;
+
+ /* k is either 'h' or 'ap': 50%/50% */
+ ab = k(j);
+
+ /* loop never gets executed on real data */
+ for (; j->count >= 2; am += 2)
+ if (l) {
+ entry *i = &table[am + m];
+ PyErr_Format(i);
+ }
+ return ab;
+}
+void
+__attribute__((noipa))
+bug() {
+ h(table);
+ h(table);
+}
+int h(entry *j) { return ai(j, ap, 4, 5); }
+int ap(entry *j) { return ai(j, ag, 14, 4); }
+
+int main(void)
+{
+ bug();
+}
+
+entry table[2] = {
+ { .has_next = 1
+ , .next_ix = 1
+ , .count = 0
+ },
+ { .has_next = 0
+ , .next_ix = 0
+ , .count = 0
+ },
+};
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c
index b7d50ec..b9f8fd2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c
@@ -33,4 +33,4 @@ void test55 (int x, int y)
that the && should be emitted (based on BRANCH_COST). Fix this
by teaching dom to look through && and register all components
as true. */
-/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* aarch64*-*-* powerpc*-*-* cris-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* nds32*-*-* s390*-*-* sh*-*-* sparc*-*-* visium-*-* x86_64-*-* riscv*-*-* or1k*-*-* msp430-*-* pru*-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* aarch64*-*-* powerpc*-*-* cris-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* nds32*-*-* s390*-*-* sh*-*-* sparc*-*-* visium-*-* x86_64-*-* riscv*-*-* or1k*-*-* msp430-*-* pru*-*-* nvptx*-*-*" } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c b/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c
index 3c358e0..6746758 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/local-pure-const.c
@@ -12,5 +12,5 @@ t(int a, int b, int c)
p = &c;
return *p;
}
-/* { dg-final { scan-tree-dump-times "local memory is OK" 1 "local-pure-const1"} } */
+/* { dg-final { scan-tree-dump-times "local or readonly memory is OK" 1 "local-pure-const1"} } */
/* { dg-final { scan-tree-dump-times "found to be const" 1 "local-pure-const1"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-1.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-1.c
new file mode 100644
index 0000000..a80ca6b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-1.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+int p,q,r,s,*ptr=&q, *ptr2=&p;
+__attribute__ ((noinline))
+int
+test (int *p)
+{
+ *p = 1;
+}
+int
+test1()
+{
+ q = 123;
+ test(&p);
+ return q;
+}
+int
+test2()
+{
+ int *ptr = p ? &q : &s;
+ *ptr = 124;
+ test(&p);
+ return *ptr;
+}
+int
+test3()
+{
+ int *ptr = p ? &p : &s;
+ q = 125;
+ test(ptr);
+ return q;
+}
+int
+test4()
+{
+ int *ptr1 = p ? &q : &s;
+ int *ptr = p ? &r : &p;
+ *ptr1 = 126;
+ test(ptr);
+ return *ptr1;
+}
+/* { dg-final { scan-tree-dump "return 123" "optimized"} } */
+/* { dg-final { scan-tree-dump "return 124" "optimized"} } */
+/* { dg-final { scan-tree-dump "return 125" "optimized"} } */
+/* { dg-final { scan-tree-dump "return 126" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-2.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-2.c
new file mode 100644
index 0000000..9999d37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-2.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+short aa;
+void
+__attribute__ ((noinline, noclone))
+recursive (int *a, int *b, int *c, int level)
+{
+ if (level && c)
+ {
+ recursive (b,a,c,0);
+ aa++;
+ }
+ else
+ *a=0;
+}
+int
+main()
+{
+ int x = 123, y=124, z=125;
+ recursive (&x,&y,&z,1);
+ if (y)
+ __builtin_abort ();
+ if (!__builtin_constant_p (z))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-3.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-3.c
new file mode 100644
index 0000000..668c6c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-3.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+struct a
+{
+ int b;
+ int c;
+};
+
+__attribute__ ((noclone, noinline))
+void
+test (struct a *a)
+{
+ a->b = 2;
+}
+int
+foo ()
+{
+ struct a a = {113,114};
+ test (&a);
+ return a.c;
+}
+int
+foo2 (struct a *a)
+{
+ a->b = 123;
+ a->c = 124;
+ test (a);
+ return a->c;
+}
+/* { dg-final { scan-tree-dump "return 114" "optimized"} } */
+/* { dg-final { scan-tree-dump "return 124" "optimized"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
new file mode 100644
index 0000000..3ac217b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fdump-tree-modref1" } */
+/* { dg-do compile } */
+__attribute__((noinline))
+void a(char *ptr, char *ptr2)
+{
+ (*ptr)++;
+ (*ptr2)++;
+}
+
+__attribute__((noinline))
+void b(char *ptr)
+{
+ a(ptr+1,&ptr[2]);
+}
+
+int main()
+{
+ char c[4]={0,1,2,0};
+ b(c);
+ return c[0]+c[3];
+}
+/* Check that both param offsets are determined correctly and the computation
+ is optimized out. */
+/* { dg-final { scan-tree-dump "param offset:1" "modref1" } } */
+/* { dg-final { scan-tree-dump "param offset:2" "modref1" } } */
+/* { dg-final { scan-tree-dump "return 0" "modref1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
index 9c22c53..cf74e15 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-thread-details-blocks-stats" } */
+/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-thread-details-blocks-stats" } */
typedef enum STATES {
START=0,
INVALID,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
index 48d829a..3c02701 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr84512.c
@@ -13,4 +13,4 @@ int foo()
}
/* Listed targets xfailed due to PR84958. */
-/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* nvptx*-*-* } } } } */
+/* { dg-final { scan-tree-dump "return 285;" "optimized" { xfail { amdgcn*-*-* } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr94801.c b/gcc/testsuite/gcc.dg/tree-ssa/pr94801.c
new file mode 100644
index 0000000..5382e5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr94801.c
@@ -0,0 +1,16 @@
+/* PR tree-optimization/94801 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-final { scan-tree-dump-times "return 0;" 2 "optimized" } } */
+
+int
+foo (int a)
+{
+ return __builtin_clz (a) >> 5;
+}
+
+int
+bar (int a)
+{
+ return __builtin_ctz (a) >> 5;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c
new file mode 100644
index 0000000..5171c9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fwhole-program" } */
+
+
+float val2 = 1.710780f;
+float val3;
+volatile float vf;
+
+int __attribute__((noipa))
+get_bool (void)
+{
+ return 1;
+}
+
+int __attribute__((noinline))
+wrong (float *pos)
+{
+ _Complex float a;
+
+ __real__ a = *pos;
+ __imag__ a = *pos;
+
+ _Complex float b = 0 + 0i;
+
+ b = b + a;
+
+ if (b == 0.0f)
+ return 1;
+
+ vf = __imag__ b;
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ float val = get_bool () == 1 ? val2 : val3;
+
+ if ((wrong(&val), wrong(&val)))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c
new file mode 100644
index 0000000..3a3dae6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97503.c
@@ -0,0 +1,19 @@
+/* PR tree-optimization/97503 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-additional-options "-mbmi -mlzcnt" { target i?86-*-* x86_64-*-* } } */
+/* { dg-final { scan-tree-dump-times "\.CLZ" 2 "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-* } && lp64 } } } } */
+/* { dg-final { scan-tree-dump-not "__builtin_clz" "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-*} && lp64 } } } } */
+/* { dg-final { scan-tree-dump-not "PHI <" "optimized" { target { { i?86-*-* x86_64-*-* aarch64-*-* powerpc*-*-*} && lp64 } } } } */
+
+int
+foo (int x)
+{
+ return x ? __builtin_clz (x) : 32;
+}
+
+int
+bar (unsigned long long x)
+{
+ return x ? __builtin_clzll (x) : 64;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
index 551fbac..16a9ef4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-6.c
@@ -1,7 +1,41 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-thread1-details -fdump-tree-thread2-details" } */
-/* { dg-final { scan-tree-dump-times "FSM" 3 "thread1" } } */
-/* { dg-final { scan-tree-dump-times "FSM" 5 "thread2" } } */
+
+/* All the threads in the thread1 dump start on a X->BB12 edge, as can
+ be seen in the dump:
+
+ Registering FSM jump thread: (x, 12) incoming edge; ...
+ etc
+ etc
+
+ Before the new evrp, we were threading paths that started at the
+ following edges:
+
+ Registering FSM jump thread: (10, 12) incoming edge
+ Registering FSM jump thread: (6, 12) incoming edge
+ Registering FSM jump thread: (9, 12) incoming edge
+
+ This was because the PHI at BB12 had constant values coming in from
+ BB10, BB6, and BB9:
+
+ # state_10 = PHI <state_11(7), 0(10), state_11(5), 1(6), state_11(8), 2(9), state_11(11)>
+
+ Now with the new evrp, we get:
+
+ # state_10 = PHI <0(7), 0(10), state_11(5), 1(6), 0(8), 2(9), 1(11)>
+
+ Thus, we have 3 more paths that are known to be constant and can be
+ threaded. Which means that by the second threading pass, we can
+ only find one profitable path.
+
+ For the record, all these extra constants are better paths coming
+ out of switches. For example:
+
+ SWITCH_BB -> BBx -> BBy -> BBz -> PHI
+
+ We now know the value of the switch index at PHI. */
+/* { dg-final { scan-tree-dump-times "FSM" 6 "thread1" } } */
+/* { dg-final { scan-tree-dump-times "FSM" 1 "thread2" } } */
int sum0, sum1, sum2, sum3;
int foo (char *s, char **ret)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
index a339557..bad5bc1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
@@ -1,20 +1,31 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-thread1-stats -fdump-tree-thread2-stats -fdump-tree-dom2-stats -fdump-tree-thread3-stats -fdump-tree-dom3-stats -fdump-tree-vrp2-stats -fno-guess-branch-probability" } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 16" "thread1" } } */
-/* { dg-final { scan-tree-dump "Jumps threaded: 9" "thread2" } } */
+
+/* Here we have the same issue as was commented in ssa-dom-thread-6.c.
+ The PHI coming into the threader has a lot more constants, so the
+ threader can thread more paths.
+
+$ diff clean/a.c.105t.mergephi2 a.c.105t.mergephi2
+252c252
+< # s_50 = PHI <s_49(10), 5(14), s_51(18), s_51(22), 1(26), 1(29), 1(31), s_51(5), 4(12), 1(15), 5(17), 1(19), 3(21), 1(23), 6(25), 7(28), s_51(30)>
+---
+> # s_50 = PHI <s_49(10), 5(14), 4(18), 5(22), 1(26), 1(29), 1(31), s_51(5), 4(12), 1(15), 5(17), 1(19), 3(21), 1(23), 6(25), 7(28), 7(30)>
+272a273
+
+ I spot checked a few and they all have the same pattern. We are
+ basically tracking the switch index better through multiple
+ paths. */
+
+/* { dg-final { scan-tree-dump "Jumps threaded: 19" "thread1" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 8" "thread2" } } */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom2" } } */
+
/* aarch64 has the highest CASE_VALUES_THRESHOLD in GCC. It's high enough
to change decisions in switch expansion which in turn can expose new
jump threading opportunities. Skip the later tests on aarch64. */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "dom3" { target { ! aarch64*-*-* } } } } */
/* { dg-final { scan-tree-dump-not "Jumps threaded" "vrp2" { target { ! aarch64*-*-* } } } } */
-/* Most architectures get 3 threadable paths here, whereas aarch64 and
- possibly others get 5. We really should rewrite threading tests to
- test a specific IL sequence, not gobs of code whose IL can vary
- from architecture to architecture. */
-/* { dg-final { scan-tree-dump "Jumps threaded: \[35\]" "thread3" } } */
-
enum STATE {
S0=0,
SI,
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c
new file mode 100644
index 0000000..cf2e2a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-17.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/97307 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-sink-details" } */
+
+int pure_f(int a, int b) __attribute__((pure));
+int my_f(int a, int b)
+{
+ int x = pure_f(a, b);
+ if (a > 0)
+ return x;
+ return a;
+}
+
+/* We should sink the call to pure_f to the if block. */
+/* { dg-final { scan-tree-dump "Sinking # VUSE" "sink" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-1.c
index e6818cb..793c41f 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-1.c
@@ -55,4 +55,4 @@ int main (void)
}
/* { dg-final { scan-tree-dump-not "can't force alignment" "slp1" } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c
index ad6f878..697dc4e 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c
@@ -50,5 +50,5 @@ int main (void)
}
/* { dg-final { scan-tree-dump "unsupported unaligned access" "slp2" { target { ! vect_element_align } } } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_element_align } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_element_align } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-11.c b/gcc/testsuite/gcc.dg/vect/bb-slp-11.c
index cb8bddd..ff43253 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-11.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-11.c
@@ -49,5 +49,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect64 } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect64 } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-13.c b/gcc/testsuite/gcc.dg/vect/bb-slp-13.c
index 302e20f..fdff76e 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-13.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-13.c
@@ -46,5 +46,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-14.c b/gcc/testsuite/gcc.dg/vect/bb-slp-14.c
index e7d4e6c..62ee757 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-14.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-14.c
@@ -48,5 +48,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-15.c b/gcc/testsuite/gcc.dg/vect/bb-slp-15.c
index a749041..efe7d6a 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-15.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-15.c
@@ -51,5 +51,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
index 42abd64..e68a9b6 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-16.c
@@ -65,5 +65,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c
index c20e0ff..f8bfb4b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-17.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-17.c
@@ -57,5 +57,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-18.c b/gcc/testsuite/gcc.dg/vect/bb-slp-18.c
index 9476653..db3f0ba 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-18.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-18.c
@@ -46,5 +46,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-19.c b/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
index db446be..7e3ccb4 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
@@ -52,5 +52,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-2.c
index cee9db5..fcf1cd3 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-2.c
@@ -53,5 +53,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c
index f6dfaa7..134858c 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-20.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-20.c
@@ -63,6 +63,6 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c
index 5464d09..d4c98d6 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-21.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-21.c
@@ -63,6 +63,6 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c
index b531651..92cc2a5 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-22.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-22.c
@@ -63,5 +63,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
/* { dg-final { scan-tree-dump "vectorizing SLP node starting from: _\[0-9\]+ = _\[0-9\]+ \\\* a0" "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-23.c b/gcc/testsuite/gcc.dg/vect/bb-slp-23.c
index e57ca41..ed4a595 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-23.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-23.c
@@ -51,5 +51,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-24.c b/gcc/testsuite/gcc.dg/vect/bb-slp-24.c
index d5b6bfb..ca049c8 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-24.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-24.c
@@ -55,5 +55,5 @@ int main (void)
/* Exclude POWER8 (only POWER cpu for which vect_element_align is true)
because loops have vectorized before SLP gets a shot. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { target { vect_element_align && { ! powerpc*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { vect_element_align && { ! powerpc*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-25.c b/gcc/testsuite/gcc.dg/vect/bb-slp-25.c
index ec31329..7a9cf95 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-25.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-25.c
@@ -56,5 +56,5 @@ int main (void)
/* Exclude POWER8 (only POWER cpu for which vect_element_align is true)
because loops have vectorized before SLP gets a shot. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { target { vect_element_align && { ! powerpc*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { vect_element_align && { ! powerpc*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-26.c b/gcc/testsuite/gcc.dg/vect/bb-slp-26.c
index 91b6cac..df52967 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-26.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-26.c
@@ -54,5 +54,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { target { vect64 && vect_hw_misalign } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { vect64 && vect_hw_misalign } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-27.c b/gcc/testsuite/gcc.dg/vect/bb-slp-27.c
index 8ef8bb0..bc27f2f 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-27.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-27.c
@@ -44,5 +44,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target { vect_int_mult && { vect_unpack && vect_pack_trunc } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target { vect_int_mult && { vect_unpack && vect_pack_trunc } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-28.c b/gcc/testsuite/gcc.dg/vect/bb-slp-28.c
index a4c01b9..8749a1f 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-28.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-28.c
@@ -66,5 +66,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target { vect_int_mult && { vect_pack_trunc && vect_unpack } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target { vect_int_mult && { vect_pack_trunc && vect_unpack } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-29.c b/gcc/testsuite/gcc.dg/vect/bb-slp-29.c
index 747896b..b531350 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-29.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-29.c
@@ -56,5 +56,5 @@ int main (void)
/* Exclude POWER8 (only POWER cpu for which vect_element_align is true)
because loops have vectorized before SLP gets a shot. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { target { { vect_int_mult && vect_element_align } && { ! powerpc*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { { vect_int_mult && vect_element_align } && { ! powerpc*-*-* } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-3.c b/gcc/testsuite/gcc.dg/vect/bb-slp-3.c
index 4f47738..2636670 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-3.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-3.c
@@ -42,5 +42,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-30.c b/gcc/testsuite/gcc.dg/vect/bb-slp-30.c
index 224f9de..c3d7ae1 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-30.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-30.c
@@ -50,4 +50,4 @@ int main()
return a[21];
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-31.c b/gcc/testsuite/gcc.dg/vect/bb-slp-31.c
index 8e4e2d4..6a131e7 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-31.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-31.c
@@ -9,4 +9,4 @@ void f(){
a[1]=1+2*a[1]*a[1];
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-34.c b/gcc/testsuite/gcc.dg/vect/bb-slp-34.c
index c51c770..a625c45 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-34.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-34.c
@@ -32,4 +32,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { target vect_perm } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-35.c b/gcc/testsuite/gcc.dg/vect/bb-slp-35.c
index 5803f8e..81b228b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-35.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-35.c
@@ -9,4 +9,4 @@ void foo (int * __restrict__ p, short * __restrict__ q)
p[3] = q[3] + 1;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { target vect_hw_misalign } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-36.c b/gcc/testsuite/gcc.dg/vect/bb-slp-36.c
index f424d12..fbcedd0 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-36.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-36.c
@@ -32,4 +32,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { target vect_perm } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-38.c b/gcc/testsuite/gcc.dg/vect/bb-slp-38.c
index 9c57ea3..a7bc032 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-38.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-38.c
@@ -40,5 +40,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_perm } } } */
-/* { dg-final { scan-tree-dump "basic block part vectorized" "slp2" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { target vect_perm } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-4.c b/gcc/testsuite/gcc.dg/vect/bb-slp-4.c
index 293b0e3..9e36963 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-4.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-4.c
@@ -38,4 +38,4 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-45.c b/gcc/testsuite/gcc.dg/vect/bb-slp-45.c
index 4107a34..d24ef2a 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-45.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-45.c
@@ -33,4 +33,4 @@ int main()
return 0;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-46.c b/gcc/testsuite/gcc.dg/vect/bb-slp-46.c
index 4e4571e..8daa5c1 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-46.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-46.c
@@ -21,7 +21,7 @@ int foo ()
/* We should extract the live lane from the vectorized add rather than
keeping the original scalar add.
??? Because of a too conservative check we fail for temx here. */
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
/* { dg-final { scan-tree-dump "extracting lane for live stmt" "slp2" } } */
/* { dg-final { scan-tree-dump-times "extracting lane for live stmt" 2 "slp2" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times " \\+ " 3 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-48.c b/gcc/testsuite/gcc.dg/vect/bb-slp-48.c
index cd22932..dfae617 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-48.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-48.c
@@ -49,7 +49,7 @@ bar (double x)
return;
}
-/* { dg-final { scan-tree-dump-times "basic block part vectorized" 2 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" } } */
/* We want to vectorize as { a[0], a[1] } + { x*3, x+1 } and thus
elide one add in each function. */
/* { dg-final { scan-tree-dump-times " \\+ " 4 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-49.c b/gcc/testsuite/gcc.dg/vect/bb-slp-49.c
new file mode 100644
index 0000000..e7101fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-49.c
@@ -0,0 +1,28 @@
+/* This checks that vectorized constructors have the correct ordering. */
+/* { dg-require-effective-target vect_int } */
+
+typedef int V __attribute__((__vector_size__(16)));
+
+__attribute__((__noipa__)) void
+foo (unsigned int x, V *y)
+{
+ unsigned int a[4] = { x + 0, x + 2, x + 4, x + 6 };
+ for (unsigned int i = 0; i < 3; ++i)
+ if (a[i] == 1234)
+ a[i]--;
+ *y = (V) { a[3], a[2], a[1], a[0] };
+}
+
+int
+main ()
+{
+ V b;
+ foo (0, &b);
+ if (b[0] != 6 || b[1] != 4 || b[2] != 2 || b[3] != 0)
+ __builtin_abort ();
+ return 0;
+}
+
+/* See that we vectorize an SLP instance. */
+/* { dg-final { scan-tree-dump "Analyzing vectorizable constructor" "slp1" } } */
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-5.c b/gcc/testsuite/gcc.dg/vect/bb-slp-5.c
index 192b7dc..bb78e1b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-5.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-5.c
@@ -47,5 +47,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-50.c b/gcc/testsuite/gcc.dg/vect/bb-slp-50.c
new file mode 100644
index 0000000..80216be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-50.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double a[2];
+double b[2];
+double c[2];
+double d[2];
+double e[2];
+void foo(double x)
+{
+ double tembc0 = b[1] + c[1];
+ double tembc1 = b[0] + c[0];
+ double temde0 = d[0] + e[1];
+ double temde1 = d[1] + e[0];
+ a[0] = tembc0 + temde0;
+ a[1] = tembc1 + temde1;
+}
+
+/* We should common the permutation on the tembc{0,1} operands. */
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\n\\r\]* = VEC_PERM_EXPR" 2 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-51.c b/gcc/testsuite/gcc.dg/vect/bb-slp-51.c
new file mode 100644
index 0000000..1481018
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-51.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double a[2];
+double b[2];
+double c[2];
+double e[2];
+void foo(double x)
+{
+ double tembc0 = b[1] + c[1];
+ double tembc1 = b[0] + c[0];
+ double temde0 = 5 + e[1];
+ double temde1 = 11 + e[0];
+ a[0] = tembc0 + temde0;
+ a[1] = tembc1 + temde1;
+}
+
+/* We should common the permutations on the tembc{0,1} and temde{0,1}
+ operands. */
+/* { dg-final { scan-tree-dump-times "add new stmt: \[^\\r\\n\]* VEC_PERM_EXPR" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-52.c b/gcc/testsuite/gcc.dg/vect/bb-slp-52.c
new file mode 100644
index 0000000..5194af8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-52.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+int a, e;
+void g(float);
+typedef struct {
+ float b, c;
+} d;
+d f;
+void h(double i, double j) {
+ if (a && e)
+ return;
+ f.b = j;
+ f.c = i;
+ g(i);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-53.c b/gcc/testsuite/gcc.dg/vect/bb-slp-53.c
new file mode 100644
index 0000000..f3b5f31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-53.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double a[2], b[2];
+
+void foo(double x, double y)
+{
+ double breakme1 = y + 3.;
+ double a1 = b[1] + 2.;
+ double breakme0 = x;
+ double a0 = b[0] + 1.;
+ a[0] = a0 * breakme0;
+ a[1] = a1 * breakme1;
+}
+
+/* We should vectorize the SLP opportunity starting from the
+ grouped store to a[] including the load from b[] at the
+ leaf even though the multiplication requires another
+ vector invariant to be built. */
+/* { dg-final { scan-tree-dump "transform load" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-6.c b/gcc/testsuite/gcc.dg/vect/bb-slp-6.c
index 98fe5ea..fa3e76d 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-6.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-6.c
@@ -45,5 +45,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-7.c b/gcc/testsuite/gcc.dg/vect/bb-slp-7.c
index f12dc27..ebe8189 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-7.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-7.c
@@ -47,5 +47,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-8.c b/gcc/testsuite/gcc.dg/vect/bb-slp-8.c
index 750d713..b653469 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-8.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-8.c
@@ -48,5 +48,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_hw_misalign } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-8a.c b/gcc/testsuite/gcc.dg/vect/bb-slp-8a.c
index cf355ef..381593b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-8a.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-8a.c
@@ -47,5 +47,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 0 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 0 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-8b.c b/gcc/testsuite/gcc.dg/vect/bb-slp-8b.c
index a5b643b..03a47fd 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-8b.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-8b.c
@@ -49,5 +49,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_hw_misalign } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-9.c b/gcc/testsuite/gcc.dg/vect/bb-slp-9.c
index d022d5f..b4cc101 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-9.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-9.c
@@ -46,5 +46,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c
index 65d83a4..87ffc9b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c
@@ -16,4 +16,4 @@ f (void)
x[7] /= 9;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { xfail *-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-div-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-div-2.c
index 715c22a..dd17e8c 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-div-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-div-2.c
@@ -11,4 +11,4 @@ f (void)
x[3] += y[3] / z[3] * 2;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target vect_int } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { target vect_int } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-1.c
index 0082b83..5a9fe42 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-1.c
@@ -64,4 +64,4 @@ main (void)
/* { dg-final { scan-tree-dump "demoting int to signed short" "slp2" { target { ! vect_widen_shift } } } } */
/* { dg-final { scan-tree-dump "demoting int to unsigned short" "slp2" { target { ! vect_widen_shift } } } } */
/* { dg-final { scan-tree-dump {\.AVG_FLOOR} "slp2" { target vect_avg_qi } } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target vect_hw_misalign } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-2.c
index 042b7e9..15a94e6 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-over-widen-2.c
@@ -63,4 +63,4 @@ main (void)
/* { dg-final { scan-tree-dump "demoting int to signed short" "slp2" { target { ! vect_widen_shift } } } } */
/* { dg-final { scan-tree-dump "demoting int to unsigned short" "slp2" { target { ! vect_widen_shift } } } } */
/* { dg-final { scan-tree-dump {\.AVG_FLOOR} "slp2" { target vect_avg_qi } } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" { target vect_hw_misalign } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target vect_hw_misalign } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
index d32cb75..f6b99ea 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
@@ -49,4 +49,4 @@ int main ()
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" { target { vect_element_align && vect_pack_trunc } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" { target { vect_element_align && vect_pack_trunc } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-phis-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-phis-1.c
new file mode 100644
index 0000000..014c13b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-phis-1.c
@@ -0,0 +1,20 @@
+/* From gcc.c-torture/execute/loop-13.c */
+/* { dg-do compile } */
+/* { dg-additional-options "-march=cascadelake" { target x86_64-*-* i?86-*-* } } */
+#define TYPE long
+
+void
+scale (TYPE *alpha, TYPE *x, int n)
+{
+ int i, ix;
+
+ if (*alpha != 1)
+ for (i = 0, ix = 0; i < n; i++, ix += 2)
+ {
+ TYPE tmpr, tmpi;
+ tmpr = *alpha * x[ix];
+ tmpi = *alpha * x[ix + 1];
+ x[ix] = tmpr;
+ x[ix + 1] = tmpi;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pow-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pow-1.c
index cfe654e..fc76700 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pow-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pow-1.c
@@ -29,4 +29,4 @@ main (void)
-mno-allow-movmisalign prevents vectorization. On POWER8 and later,
when vect_hw_misalign is true, vectorization occurs. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target {{ ! powerpc*-*-* } || { powerpc*-*-* && vect_hw_misalign }} } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target {{ ! powerpc*-*-* } || { powerpc*-*-* && vect_hw_misalign }} } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr58135.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr58135.c
index ca25000..d3ac0de 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr58135.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr58135.c
@@ -7,4 +7,4 @@ void foo ()
a[0] = a[1] = a[2] = a[3] = a[4]= 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
index 0e4f1a7..ea37e4e 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
@@ -59,4 +59,7 @@ int main()
/* We should also be able to use 2-lane SLP to initialize the real and
imaginary components in the first loop of main. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 10 "slp1" } } */
+/* We should see the s->phase[dir] operand and only that operand built
+ from scalars. See PR97334. */
+/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c
index f5dc534..27cba9b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c
@@ -22,6 +22,6 @@ void foo ()
but we do want to vectorize the other two store groups. But we may
end up using scalar loads to vectorize the last group. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 3 "slp2" } } */
/* { dg-final { scan-tree-dump-times "BB vectorization with gaps at the end of a load is not supported" 1 "slp2" } } */
/* { dg-final { scan-tree-dump-times " = c\\\[4\\\];" 1 "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-1.c
index f024dc7..dcba9a0 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-1.c
@@ -89,4 +89,4 @@ f6 (int n)
}
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 6 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 6 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-2.c
index 11e8f0f..6b213d4 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-2.c
@@ -61,4 +61,4 @@ f4 (double *p, double *q)
}
}
-/* { dg-final { scan-tree-dump-not "basic block vectorized" "slp1" } } */
+/* { dg-final { scan-tree-dump-not "optimized: basic block" "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-3.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-3.c
index 1cca1d0..793f185 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-3.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-3.c
@@ -59,4 +59,4 @@ f4 (double *p, double *q, unsigned int start, unsigned int n)
}
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 4 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 4 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-4.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-4.c
index 1aa3c8d..599f718 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-4.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr81635-4.c
@@ -44,4 +44,4 @@ f3 (double *p, double *q, unsigned int start, unsigned int n)
}
}
-/* { dg-final { scan-tree-dump-not "basic block vectorized" "slp1" } } */
+/* { dg-final { scan-tree-dump-not "optimized: basic block" "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c
index 104d3fb..7d82e94 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr90006.c
@@ -28,4 +28,4 @@ int e()
return 0;
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { target { { x86_64-*-* i?86-*-* } && ilp32 } } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" { target { { x86_64-*-* i?86-*-* } && ilp32 } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839-2.c
index 49e75d8..5a831ae 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839-2.c
@@ -16,5 +16,5 @@ v2df g(v2df a, v2df b)
/* Verify we manage to vectorize this with using the original vectors
and do not end up with any vector CTORs. */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" } } */
/* { dg-final { scan-tree-dump-not "vect_cst" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839.c
index 0bfba01..931fd46 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95839.c
@@ -10,4 +10,4 @@ v4f32 f(v4f32 a, v4f32 b)
return (v4f32){a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]};
}
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95866.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95866.c
index 5de4671..edcaf17 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr95866.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr95866.c
@@ -14,4 +14,4 @@ void foo()
/* The scalar shift argument should be extracted from the available vector. */
/* { dg-final { scan-tree-dump "BIT_FIELD_REF" "slp2" } } */
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c
new file mode 100644
index 0000000..17d48a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+struct {
+ int *end_info;
+ int *fp;
+} png_load_body_c;
+
+int *png_set_longjmp_fn();
+
+void setjmp();
+
+void png_load_body()
+{
+ int *fp;
+ int png_ptr, info_ptr, *end_info;
+ if (!fp)
+ return;
+ if (png_ptr) {
+ info_ptr = 0;
+ end_info = png_set_longjmp_fn();
+ }
+ png_load_body_c.end_info = end_info;
+ png_load_body_c.fp = fp;
+ if (png_ptr)
+ png_set_longjmp_fn();
+ setjmp(info_ptr);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c
new file mode 100644
index 0000000..fa9e980
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97496.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+int a;
+int b[1024];
+void c(unsigned g) {
+ if (a) {
+ long e = g, d = e;
+ int f = 0;
+ for (; f < 4; f++) {
+ b[f] = d;
+ d >>= 8;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-1.c
index 39c23c3..40a02ed 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-1.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-1.c
@@ -41,4 +41,4 @@ main (int argc, char **argv)
}
/* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c
index 36938d0..968cdf1 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-2.c
@@ -39,4 +39,4 @@ main (int argc, char **argv)
}
/* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-3.c b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-3.c
index 6ae9a89..fe36f90 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-3.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-subgroups-3.c
@@ -38,4 +38,4 @@ main (int argc, char **argv)
}
/* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" } } */
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c
index 915a962..df01918 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c
@@ -38,4 +38,4 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c
index 5121a88..819c4f6 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c
@@ -25,4 +25,4 @@ foo ()
}
/* { dg-final { scan-tree-dump-not "vectorization is not profitable" "slp2" } } */
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-1.c b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-1.c
index 1c75c87..cfea872 100644
--- a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-1.c
+++ b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-1.c
@@ -45,4 +45,4 @@ main ()
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target { vect_call_copysignf && vect_call_sqrtf } } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target { vect_call_copysignf && vect_call_sqrtf } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c
index 49a7c05..6d67d12 100644
--- a/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c
+++ b/gcc/testsuite/gcc.dg/vect/fast-math-bb-slp-call-2.c
@@ -63,4 +63,4 @@ main ()
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp2" { target vect_call_lrint } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target vect_call_lrint } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c b/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c
index c7f9cd3..2202362 100644
--- a/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c
+++ b/gcc/testsuite/gcc.dg/vect/no-tree-reassoc-bb-slp-12.c
@@ -47,5 +47,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_int_mult } } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target vect_int_mult } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c b/gcc/testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c
index 8fe67f4..e837418 100644
--- a/gcc/testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c
+++ b/gcc/testsuite/gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c
@@ -13,4 +13,4 @@ A sum(A a,A b)
return a;
}
-/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c
index dcb5370..8cc69ab 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c
@@ -75,5 +75,3 @@ int main ()
/* The initialization induction loop (with aligned access) is also vectorized. */
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr37027.c b/gcc/testsuite/gcc.dg/vect/pr37027.c
index ef6760e..69f5826 100644
--- a/gcc/testsuite/gcc.dg/vect/pr37027.c
+++ b/gcc/testsuite/gcc.dg/vect/pr37027.c
@@ -33,4 +33,4 @@ foo (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_add } } } */
-
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-3.c b/gcc/testsuite/gcc.dg/vect/pr65947-3.c
index 6b4077e..f1bfad6 100644
--- a/gcc/testsuite/gcc.dg/vect/pr65947-3.c
+++ b/gcc/testsuite/gcc.dg/vect/pr65947-3.c
@@ -51,6 +51,10 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
+/* Since the fix for PR97307 which sinks the load of a[i], preventing
+ if-conversion to happen, targets that cannot do masked loads only
+ vectorize the inline copy. */
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" { target vect_masked_load } } } */
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" { target { ! vect_masked_load } } } } */
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 2 "vect" { target vect_fold_extract_last } } } */
/* { dg-final { scan-tree-dump-not "condition expression based on integer induction." "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr67790.c b/gcc/testsuite/gcc.dg/vect/pr67790.c
index 5e2d506..32eacd9 100644
--- a/gcc/testsuite/gcc.dg/vect/pr67790.c
+++ b/gcc/testsuite/gcc.dg/vect/pr67790.c
@@ -38,3 +38,4 @@ int main()
}
/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr92324-4.c b/gcc/testsuite/gcc.dg/vect/pr92324-4.c
index 8347985..57e117c 100644
--- a/gcc/testsuite/gcc.dg/vect/pr92324-4.c
+++ b/gcc/testsuite/gcc.dg/vect/pr92324-4.c
@@ -28,3 +28,5 @@ int main ()
__builtin_abort ();
return 0;
}
+
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr92558.c b/gcc/testsuite/gcc.dg/vect/pr92558.c
index 1d24fa0..11f4132 100644
--- a/gcc/testsuite/gcc.dg/vect/pr92558.c
+++ b/gcc/testsuite/gcc.dg/vect/pr92558.c
@@ -21,3 +21,5 @@ int main()
__builtin_abort ();
return 0;
}
+
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr95495.c b/gcc/testsuite/gcc.dg/vect/pr95495.c
index a961aef..683f0f2 100644
--- a/gcc/testsuite/gcc.dg/vect/pr95495.c
+++ b/gcc/testsuite/gcc.dg/vect/pr95495.c
@@ -14,3 +14,5 @@ h()
d += e[f].b >> 1 | e[f].b & 1;
}
}
+
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97085.c b/gcc/testsuite/gcc.dg/vect/pr97085.c
new file mode 100644
index 0000000..ffde9f1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97085.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.2-a+sve" { target aarch64-*-* } } */
+
+int a, b, c, d;
+short e, g;
+unsigned short f;
+void h() {
+ for (; d; d++) {
+ g = d;
+ e = b == 0 ? 1 : a % b;
+ c ^= (f = e) > (g == 5);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97139.c b/gcc/testsuite/gcc.dg/vect/pr97139.c
new file mode 100644
index 0000000..1b9f31c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97139.c
@@ -0,0 +1,27 @@
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+int pix[4];
+
+int __attribute__((noipa)) foo (void)
+{
+ pix[0] = pix[0] / 4;
+ pix[1] = pix[1] / 4;
+ pix[2] = pix[2] / 4;
+ pix[3] = pix[3] / 4;
+ return pix[0] + pix[1] + pix[2] + pix[3];
+}
+
+int main ()
+{
+ check_vect ();
+
+ pix[0] = 8;
+ pix[1] = 16;
+ pix[2] = 32;
+ pix[3] = 64;
+ if (foo () != 30)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97173.c b/gcc/testsuite/gcc.dg/vect/pr97173.c
new file mode 100644
index 0000000..fd4a889
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97173.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+
+typedef struct {
+ char *track;
+ char *clocks;
+ char *fm;
+ char *weak;
+} disk_t;
+
+disk_t disk_update_tlens_d;
+int disk_update_tlens_d_0;
+
+void disk_update_tlens() {
+ disk_update_tlens_d.track = disk_update_tlens_d.clocks =
+ disk_update_tlens_d.track + disk_update_tlens_d_0;
+ disk_update_tlens_d.fm = disk_update_tlens_d.clocks + disk_update_tlens_d_0;
+ disk_update_tlens_d.weak = disk_update_tlens_d.fm;
+ disk_update_tlens_d.track[2] = 5;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97236.c b/gcc/testsuite/gcc.dg/vect/pr97236.c
new file mode 100644
index 0000000..9d3dc20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97236.c
@@ -0,0 +1,43 @@
+typedef unsigned char __uint8_t;
+typedef __uint8_t uint8_t;
+typedef struct plane_t {
+ uint8_t *p_pixels;
+ int i_lines;
+ int i_pitch;
+} plane_t;
+
+typedef struct {
+ plane_t p[5];
+} picture_t;
+
+#define N 4
+
+void __attribute__((noipa))
+picture_Clone(picture_t *picture, picture_t *res)
+{
+ for (int i = 0; i < N; i++) {
+ res->p[i].p_pixels = picture->p[i].p_pixels;
+ res->p[i].i_lines = picture->p[i].i_lines;
+ res->p[i].i_pitch = picture->p[i].i_pitch;
+ }
+}
+
+int
+main()
+{
+ picture_t aaa, bbb;
+ uint8_t pixels[10] = {1, 1, 1, 1, 1, 1, 1, 1};
+
+ for (unsigned i = 0; i < N; i++)
+ aaa.p[i].p_pixels = pixels;
+
+ picture_Clone (&aaa, &bbb);
+
+ uint8_t c = 0;
+ for (unsigned i = 0; i < N; i++)
+ c += bbb.p[i].p_pixels[0];
+
+ if (c != N)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97241.c b/gcc/testsuite/gcc.dg/vect/pr97241.c
new file mode 100644
index 0000000..d4be8f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97241.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 --param max-loop-header-insns=2" } */
+
+short int *ev;
+int l4;
+
+short int
+a7 (void)
+{
+ short int uo = ev[0], ie = uo;
+
+ for (int kp = 0; kp < l4; kp += 4)
+ {
+ uo += ev[kp + 1];
+ ie += ev[kp];
+ }
+
+ return uo + ie;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97428.c b/gcc/testsuite/gcc.dg/vect/pr97428.c
new file mode 100644
index 0000000..49d5373
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97428.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+
+typedef struct { double re, im; } dcmlx_t;
+typedef struct { double re[4], im[4]; } dcmlx4_t;
+
+void foo_i2(dcmlx4_t dst[], const dcmlx_t src[], int n)
+{
+ for (int i = 0; i < n; ++i) {
+ dcmlx_t s00 = src[i*4+0];
+ dcmlx_t s01 = src[i*4+1];
+ dcmlx_t s02 = src[i*4+2];
+ dcmlx_t s03 = src[i*4+3];
+
+ dcmlx_t s10 = src[i*4+0+n];
+ dcmlx_t s11 = src[i*4+1+n];
+ dcmlx_t s12 = src[i*4+2+n];
+ dcmlx_t s13 = src[i*4+3+n];
+
+ dst[i*2+0].re[0] = s00.re;
+ dst[i*2+0].re[1] = s01.re;
+ dst[i*2+0].re[2] = s02.re;
+ dst[i*2+0].re[3] = s03.re;
+ dst[i*2+0].im[0] = s00.im;
+ dst[i*2+0].im[1] = s01.im;
+ dst[i*2+0].im[2] = s02.im;
+ dst[i*2+0].im[3] = s03.im;
+
+ dst[i*2+1].re[0] = s10.re;
+ dst[i*2+1].re[1] = s11.re;
+ dst[i*2+1].re[2] = s12.re;
+ dst[i*2+1].re[3] = s13.re;
+ dst[i*2+1].im[0] = s10.im;
+ dst[i*2+1].im[1] = s11.im;
+ dst[i*2+1].im[2] = s12.im;
+ dst[i*2+1].im[3] = s13.im;
+ }
+}
+
+/* The first step to produce optimal code is to appropriately detect the
+ load and store groups. */
+/* { dg-final { scan-tree-dump "Detected interleaving load of size 8" "vect" } } */
+/* { dg-final { scan-tree-dump "Detected interleaving store of size 16" "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-not "gap of 6 elements" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-1.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-1.c
index b353dd7..b9bddb8 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-1.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-1.c
@@ -44,4 +44,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_add } } } */
-
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-2.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-2.c
index 15dd599..aa09d01 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-2.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-2.c
@@ -41,4 +41,5 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_add } } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-3.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-3.c
index 7358275..4969fe8 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-3.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-3.c
@@ -60,3 +60,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 1 "vect" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { vect_short_mult && { vect_widen_sum_hi_to_si && vect_unpack } } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail { vect_widen_sum_hi_to_si_pattern || { ! vect_unpack } } } } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-4.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-4.c
index d58e5b0..266b439 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-4.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-4.c
@@ -58,4 +58,5 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_min_max } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail { vect_no_int_min_max || vect_variable_length } } } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-5.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-5.c
index f457c11..11f5a741 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-5.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-5.c
@@ -46,4 +46,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail vect_no_int_min_max } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_min_max } } } */
-
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c
index 43d1cee..05cc9ed 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c
@@ -56,4 +56,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail { vect_no_int_add || vect_variable_length } } } } */
-
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-103.c b/gcc/testsuite/gcc.dg/vect/vect-103.c
index 2a45104..d03562f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-103.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-103.c
@@ -58,5 +58,3 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment" 1 "vect" } } */
-
diff --git a/gcc/testsuite/gcc.dg/vect/vect-91.c b/gcc/testsuite/gcc.dg/vect/vect-91.c
index 91264d9..8983c7da 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-91.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-91.c
@@ -68,6 +68,4 @@ main3 ()
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
-/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
index a2e3590..0648637 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
@@ -40,4 +40,4 @@ main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-in-order-4.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-in-order-4.c
index 1cc046e..7706a2d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-in-order-4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-in-order-4.c
@@ -43,3 +43,4 @@ main ()
/* { dg-final { scan-tree-dump {in-order unchained SLP reductions not supported} "vect" } } */
/* { dg-final { scan-tree-dump-not {vectorizing stmts using SLP} "vect" } } */
+/* { dg-final { scan-tree-dump-times "VECT_PERM_EXPR" 0 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-17.c b/gcc/testsuite/gcc.dg/vect/vect-simd-17.c
new file mode 100644
index 0000000..951ba3a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-17.c
@@ -0,0 +1,304 @@
+/* { dg-additional-options "-fopenmp-simd -fno-tree-vectorize" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+/* { dg-final { scan-tree-dump "vectorized 1\[1-2] loops" "vect" { target i?86-*-* x86_64-*-* } } } */
+
+#include "tree-vect.h"
+
+int x, i, j;
+volatile int a, b, c, d, e, f, g, h;
+int k[11][101];
+
+__attribute__((noipa)) void
+doit (void)
+{
+ int niters, err = 0;
+ for (i = 1; i <= 10; i++)
+ for (j = 1; j <= 10 * i; j++)
+ {
+ k[i][j] = 1;
+ asm volatile ("" : : : "memory");
+ }
+ a = 1; b = 11; c = 1; d = 0; e = 1; f = 10; g = 1; h = 1;
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = 1; i <= 10; i++)
+ for (j = 1; j <= 10 * i; j++)
+ {
+ err |= (i < 1);
+ err |= (i > 10);
+ err |= (j < 1);
+ err |= (j > 10 * i);
+ err |= (k[i][j] != 1);
+ k[i][j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 11 || j != 101 || x != 10340 || niters != 550 || err)
+ abort ();
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = a; i < b; i += c)
+ for (j = d * i + e; j < g + i * f; j += h)
+ {
+ err |= (i < 1);
+ err |= (i > 10);
+ err |= (j < 1);
+ err |= (j > 10 * i);
+ err |= (k[i][j] != 2);
+ k[i][j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 11 || j != 101 || x != 10340 || niters != 550 || err)
+ abort ();
+ for (i = 1; i <= 10; i++)
+ for (j = 1; j <= 10 * i; j++)
+ if (k[i][j] == 3)
+ k[i][j] = 0;
+ else
+ abort ();
+ for (i = 0; i < 11; i++)
+ for (j = 0; j < 101; j++)
+ if (k[i][j] != 0)
+ abort ();
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10 * i; j++)
+ {
+ k[i][j] = 1;
+ asm volatile ("" : : : "memory");
+ }
+ a = 0; b = 10; c = 1; d = 0; e = 0; f = 10; g = 0; h = 1;
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10 * i; j++)
+ {
+ err |= (i < 0);
+ err |= (i >= 10);
+ err |= (j < 0);
+ err |= (j >= 10 * i);
+ err |= (k[i][j] != 1);
+ k[i][j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 10 || j != 90 || x != 9305 || niters != 450 || err)
+ abort ();
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = a; i < b; i += c)
+ for (j = d * i + e; j < g + i * f; j += h)
+ {
+ err |= (i < 0);
+ err |= (i >= 10);
+ err |= (j < 0);
+ err |= (j >= 10 * i);
+ err |= (k[i][j] != 2);
+ k[i][j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 10 || j != 90 || x != 9305 || niters != 450 || err)
+ abort ();
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10 * i; j++)
+ if (k[i][j] == 3)
+ k[i][j] = 0;
+ else
+ abort ();
+ for (i = 0; i < 11; i++)
+ for (j = 0; j < 101; j++)
+ if (k[i][j] != 0)
+ abort ();
+ for (i = 4; i < 10; i++)
+ for (j = -9 + 2 * i; j < i; j++)
+ {
+ k[i][j + 1] = 1;
+ asm volatile ("" : : : "memory");
+ }
+ a = 4; b = 10; c = 1; d = 2; e = -9; f = 1; g = 0; h = 1;
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = 4; i < 10; i++)
+ for (j = -9 + 2 * i; j < i; j++)
+ {
+ err |= (i < 4);
+ err |= (i >= 10);
+ err |= (j < -9 + 2 * i);
+ err |= (j >= i);
+ err |= (k[i][j + 1] != 1);
+ k[i][j + 1]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (/*i != 10 || j != 9 || */x != 8199 || niters != 15 || err)
+ abort ();
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = a; i < b; i += c)
+ for (j = d * i + e; j < g + i * f; j += h)
+ {
+ err |= (i < 4);
+ err |= (i >= 10);
+ err |= (j < -9 + 2 * i);
+ err |= (j >= i);
+ err |= (k[i][j + 1] != 2);
+ k[i][j + 1]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (/*i != 10 || j != 9 || */x != 8199 || niters != 15 || err)
+ abort ();
+ for (i = 4; i < 10; i++)
+ for (j = -9 + 2 * i; j < i; j++)
+ if (k[i][j + 1] == 3)
+ k[i][j + 1] = 0;
+ else
+ abort ();
+ for (i = 0; i < 11; i++)
+ for (j = 0; j < 101; j++)
+ if (k[i][j] != 0)
+ abort ();
+ for (i = 1; i < 10; i += 2)
+ for (j = 1; j < i + 1; j++)
+ {
+ k[i][j] = 1;
+ asm volatile ("" : : : "memory");
+ }
+ a = 1; b = 10; c = 2; d = 0; e = 1; f = 1; g = 1; h = 1;
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = 1; i < 10; i += 2)
+ for (j = 1; j < i + 1; j++)
+ {
+ err |= (i < 1);
+ err |= (i >= 10);
+ err |= (j < 1);
+ err |= (j >= i + 1);
+ err |= (k[i][j] != 1);
+ k[i][j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 11 || j != 10 || x != 9225 || niters != 25 || err)
+ abort ();
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = a; i < b; i += c)
+ for (j = d * i + e; j < g + i * f; j += h)
+ {
+ err |= (i < 1);
+ err |= (i >= 10);
+ err |= (j < 1);
+ err |= (j >= i + 1);
+ err |= (k[i][j] != 2);
+ k[i][j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 11 || j != 10 || x != 9225 || niters != 25 || err)
+ abort ();
+ for (i = 1; i < 10; i += 2)
+ for (j = 1; j < i + 1; j++)
+ if (k[i][j] == 3)
+ k[i][j] = 0;
+ else
+ abort ();
+ for (i = 0; i < 11; i++)
+ for (j = 0; j < 101; j++)
+ if (k[i][j] != 0)
+ abort ();
+ for (j = -11; j >= -41; j -= 15)
+ {
+ k[0][-j] = 1;
+ asm volatile ("" : : : "memory");
+ }
+ a = 4; b = 8; c = 12; d = -8; e = -9; f = -3; g = 6; h = 15;
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = 4; i < 8; i += 12)
+ for (j = -8 * i - 9; j < i * -3 + 6; j += 15)
+ {
+ err |= (i != 4);
+ err |= (j < -41);
+ err |= (j > -11);
+ err |= (k[0][-j] != 1);
+ k[0][-j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 16 || j != 4 || x != 5109 || niters != 3 || err)
+ abort ();
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = a; i < b; i += c)
+ for (j = d * i + e; j < g + i * f; j += h)
+ {
+ err |= (i != 4);
+ err |= (j < -41);
+ err |= (j > -11);
+ err |= (k[0][-j] != 2);
+ k[0][-j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (i != 16 || j != 4 || x != 5109 || niters != 3 || err)
+ abort ();
+ for (j = -11; j >= -41; j -= 15)
+ if (k[0][-j] == 3)
+ k[0][-j] = 0;
+ else
+ abort ();
+ for (j = -11; j >= -41; j--)
+ if (k[0][-j] != 0)
+ abort ();
+ for (j = -34; j <= -7; j++)
+ {
+ k[0][-j] = 1;
+ asm volatile ("" : : : "memory");
+ }
+ a = -13; b = 7; c = 12; d = 3; e = 5; f = 0; g = -6; h = 1;
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = -13; i < 7; i += 12)
+ for (j = 3 * i + 5; j < -6; j++)
+ {
+ err |= (i != -13);
+ err |= (j < -34);
+ err |= (j > -7);
+ err |= (k[0][-j] != 1);
+ k[0][-j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (/*i != 11 || j != 2 || */x != -12295 || niters != 28 || err)
+ abort ();
+ niters = 0; i = -100; j = -100; x = -100;
+ #pragma omp simd collapse(2) lastprivate (i, j, x) reduction(+:niters) reduction(|:err)
+ for (i = a; i < b; i += c)
+ for (j = d * i + e; j < g + i * f; j += h)
+ {
+ err |= (i != -13);
+ err |= (j < -34);
+ err |= (j > -7);
+ err |= (k[0][-j] != 2);
+ k[0][-j]++;
+ x = i * 1024 + (j & 1023);
+ niters++;
+ }
+ if (/*i != 11 || j != 2 || */x != -12295 || niters != 28 || err)
+ abort ();
+ for (j = -34; j <= -7; j++)
+ if (k[0][-j] == 3)
+ k[0][-j] = 0;
+ else
+ abort ();
+}
+
+int
+main ()
+{
+ check_vect ();
+ doit ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-18.c b/gcc/testsuite/gcc.dg/vect/vect-simd-18.c
new file mode 100644
index 0000000..b25f5a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-18.c
@@ -0,0 +1,40 @@
+/* { dg-additional-options "-fopenmp-simd -fno-tree-vectorize" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { target i?86-*-* x86_64-*-* } } } */
+
+#include "tree-vect.h"
+
+__attribute__((noipa)) int
+foo (int s, int *p)
+{
+ int r = 0, l = 0, i;
+ #pragma omp simd reduction (+:r) linear(l)
+ for (i = 0; i < 10000; i += s)
+ {
+ p[l++] = i;
+ r += i * 3;
+ }
+ return r;
+}
+
+int p[10000 / 78];
+
+int
+main ()
+{
+ int i, r;
+ check_vect ();
+ r = foo (78, p);
+ for (i = 0; i < 10000 / 78; i++)
+ if (p[i] != 78 * i)
+ abort ();
+ if (r != (10000 / 78) * (10000 / 78 + 1) / 2 * 78 * 3)
+ abort ();
+ r = foo (87, p);
+ for (i = 0; i < 10000 / 87; i++)
+ if (p[i] != 87 * i)
+ abort ();
+ if (r != (10000 / 87) * (10000 / 87 + 1) / 2 * 87 * 3)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-19.c b/gcc/testsuite/gcc.dg/vect/vect-simd-19.c
new file mode 100644
index 0000000..a71dfa6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-19.c
@@ -0,0 +1,40 @@
+/* { dg-additional-options "-fopenmp-simd -fno-tree-vectorize" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { target i?86-*-* x86_64-*-* } } } */
+
+#include "tree-vect.h"
+
+__attribute__((noipa)) int
+foo (int s, int m, int n, int *p)
+{
+ int r = 0, l = 0, i;
+ #pragma omp simd reduction (+:r) linear(l)
+ for (i = m; i < n; i += s)
+ {
+ p[l++] = i;
+ r += i * 3;
+ }
+ return r;
+}
+
+int p[10000 / 78];
+
+int
+main ()
+{
+ int i, r;
+ check_vect ();
+ r = foo (78, 0, 10000, p);
+ for (i = 0; i < 10000 / 78; i++)
+ if (p[i] != 78 * i)
+ abort ();
+ if (r != (10000 / 78) * (10000 / 78 + 1) / 2 * 78 * 3)
+ abort ();
+ r = foo (87, 0, 10000, p);
+ for (i = 0; i < 10000 / 87; i++)
+ if (p[i] != 87 * i)
+ abort ();
+ if (r != (10000 / 87) * (10000 / 87 + 1) / 2 * 87 * 3)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-20.c b/gcc/testsuite/gcc.dg/vect/vect-simd-20.c
new file mode 100644
index 0000000..c85f05f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-20.c
@@ -0,0 +1,43 @@
+/* { dg-additional-options "-fopenmp-simd -fno-tree-vectorize" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { target i?86-*-* x86_64-*-* } } } */
+
+#include "tree-vect.h"
+
+__attribute__((noipa)) int
+foo (int s, int m, int n, int *p)
+{
+ int r = 0, l = 0, i, j;
+ #pragma omp simd reduction (+:r) linear(l) collapse(2)
+ for (j = 0; j < 7; j++)
+ for (i = m; i < n; i += s)
+ {
+ p[l++] = i;
+ r += i * 3;
+ }
+ return r;
+}
+
+int p[10000 / 78 * 7];
+
+int
+main ()
+{
+ int i, j, r;
+ check_vect ();
+ r = foo (78, 0, 10000, p);
+ for (j = 0; j < 7; j++)
+ for (i = 0; i < 10000 / 78; i++)
+ if (p[j * (10000 / 78 + 1) + i] != 78 * i)
+ abort ();
+ if (r != (10000 / 78) * (10000 / 78 + 1) / 2 * 78 * 3 * 7)
+ abort ();
+ r = foo (87, 0, 10000, p);
+ for (j = 0; j < 7; j++)
+ for (i = 0; i < 10000 / 87; i++)
+ if (p[j * (10000 / 87 + 1) + i] != 87 * i)
+ abort ();
+ if (r != (10000 / 87) * (10000 / 87 + 1) / 2 * 87 * 3 * 7)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp
index 1e3cd41..1fdd61a 100644
--- a/gcc/testsuite/gcc.misc-tests/outputs.exp
+++ b/gcc/testsuite/gcc.misc-tests/outputs.exp
@@ -703,20 +703,20 @@ outest "$b lto sing empty dumpdir empty dumpbase namedb" $sing "-dumpdir \"\" -d
outest "$b lto mult empty dumpdir empty dumpbase namedb" $mult "-dumpdir \"\" -dumpbase \"\" -o dir/$b.exe -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{.exe} {-1.c.???i.icf !$ltop -1.c.???r.final !0 -2.c.???i.icf !$ltop -2.c.???r.final !0 .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su}}
# Now -flto with -save-temps, not exhaustive.
-outest "$b lto st sing empty dumpbase unnamed" $sing "-dumpbase \"\" -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{-0.i -0.s -0.o -0.c.???i.icf !$ltop -0.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o $aout}}
-outest "$b lto st mult empty dumpbase unnamed" $mult "-dumpbase \"\" -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{-1.i -1.s -1.o -1.c.???i.icf !$ltop -1.c.???r.final !0 -2.i -2.s -2.o -2.c.???i.icf !$ltop -2.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o $aout}}
-outest "$b lto st sing dumpdir empty dumpbase named" $sing "-dumpdir dir/ -dumpbase \"\" -o $b-0.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.i -0.s -0.o -0.c.???i.icf !$ltop -0.c.???r.final !!$ltop -0.lto_wrapper_args !0 -0.wpa.???i.icf -0.ltrans.out !!$ltop -0.res !0 -0.ltrans0.o -0.ltrans0.ltrans.???r.final -0.ltrans0.ltrans.su -0.ltrans0.ltrans.s -0.ltrans0.ltrans.o} {-0.exe}}
-outest "$b lto st mult dumpdir empty dumpbase named" $mult "-dumpdir dir/ -dumpbase \"\" -o $b-1.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.i -1.s -1.o -1.c.???i.icf !$ltop -1.c.???r.final !0 -2.i -2.s -2.o -2.c.???i.icf !$ltop -2.c.???r.final !!$ltop -1.lto_wrapper_args !0 -1.wpa.???i.icf -1.ltrans.out !!$ltop -1.res !0 -1.ltrans0.o -1.ltrans0.ltrans.???r.final -1.ltrans0.ltrans.su -1.ltrans0.ltrans.s -1.ltrans0.ltrans.o} {-1.exe}}
-outest "$b lto st sing empty dumpbase namedb" $sing "-dumpbase \"\" -o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.i -0.s -0.o -0.c.???i.icf !$ltop -0.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
-outest "$b lto st mult empty dumpbase namedb" $mult "-dumpbase \"\" -o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.i -1.s -1.o -1.c.???i.icf !$ltop -1.c.???r.final !0 -2.i -2.s -2.o -2.c.???i.icf !$ltop -2.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
+outest "$b lto st sing empty dumpbase unnamed" $sing "-dumpbase \"\" -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{-0.i -0.s -0.o -0.c.???i.icf !$ltop -0.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out a.ltrans_args !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.ltrans0.ltrans_args $aout}}
+outest "$b lto st mult empty dumpbase unnamed" $mult "-dumpbase \"\" -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{-1.i -1.s -1.o -1.c.???i.icf !$ltop -1.c.???r.final !0 -2.i -2.s -2.o -2.c.???i.icf !$ltop -2.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out a.ltrans_args !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.ltrans0.ltrans_args $aout}}
+outest "$b lto st sing dumpdir empty dumpbase named" $sing "-dumpdir dir/ -dumpbase \"\" -o $b-0.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.i -0.s -0.o -0.c.???i.icf !$ltop -0.c.???r.final !!$ltop -0.lto_wrapper_args !0 -0.wpa.???i.icf -0.ltrans.out -0.ltrans_args !!$ltop -0.res !0 -0.ltrans0.o -0.ltrans0.ltrans.???r.final -0.ltrans0.ltrans.su -0.ltrans0.ltrans.s -0.ltrans0.ltrans.o -0.ltrans0.ltrans_args} {-0.exe}}
+outest "$b lto st mult dumpdir empty dumpbase named" $mult "-dumpdir dir/ -dumpbase \"\" -o $b-1.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.i -1.s -1.o -1.c.???i.icf !$ltop -1.c.???r.final !0 -2.i -2.s -2.o -2.c.???i.icf !$ltop -2.c.???r.final !!$ltop -1.lto_wrapper_args !0 -1.wpa.???i.icf -1.ltrans.out -1.ltrans_args !!$ltop -1.res !0 -1.ltrans0.o -1.ltrans0.ltrans.???r.final -1.ltrans0.ltrans.su -1.ltrans0.ltrans.s -1.ltrans0.ltrans.o -1.ltrans0.ltrans_args} {-1.exe}}
+outest "$b lto st sing empty dumpbase namedb" $sing "-dumpbase \"\" -o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-0.i -0.s -0.o -0.c.???i.icf !$ltop -0.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out .ltrans_args !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .ltrans0.ltrans_args .exe} {}}
+outest "$b lto st mult empty dumpbase namedb" $mult "-dumpbase \"\" -o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{-1.i -1.s -1.o -1.c.???i.icf !$ltop -1.c.???r.final !0 -2.i -2.s -2.o -2.c.???i.icf !$ltop -2.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out .ltrans_args !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .ltrans0.ltrans_args .exe} {}}
# lto save-temps without -dumpbase.
-outest "$b lto st sing unnamed" $sing "-save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{a--0.i a--0.s a--0.o a--0.c.???i.icf !$ltop a--0.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o $aout}}
-outest "$b lto st mult unnamed" $mult "-save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{a--1.i a--1.s a--1.o a--1.c.???i.icf !$ltop a--1.c.???r.final !0 a--2.i a--2.s a--2.o a--2.c.???i.icf !$ltop a--2.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o $aout}}
-outest "$b lto st sing dumpdir named" $sing "-dumpdir dir/$b- -o $b-0.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.i --0.s --0.o --0.c.???i.icf !$ltop --0.c.???r.final !!$ltop -lto_wrapper_args !0 -wpa.???i.icf -ltrans.out !!$ltop -res !0 -ltrans0.o -ltrans0.ltrans.???r.final -ltrans0.ltrans.su -ltrans0.ltrans.s -ltrans0.ltrans.o} {-0.exe}}
-outest "$b lto st mult dumpdir named" $mult "-dumpdir dir/$b- -o $b-1.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.i --1.s --1.o --1.c.???i.icf !$ltop --1.c.???r.final !0 --2.i --2.s --2.o --2.c.???i.icf !$ltop --2.c.???r.final !!$ltop -lto_wrapper_args !0 -wpa.???i.icf -ltrans.out !!$ltop -res !0 -ltrans0.o -ltrans0.ltrans.???r.final -ltrans0.ltrans.su -ltrans0.ltrans.s -ltrans0.ltrans.o} {-1.exe}}
-outest "$b lto st sing namedb" $sing "-o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.i --0.s --0.o --0.c.???i.icf !$ltop --0.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
-outest "$b lto st mult namedb" $mult "-o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.i --1.s --1.o --1.c.???i.icf !$ltop --1.c.???r.final !0 --2.i --2.s --2.o --2.c.???i.icf !$ltop --2.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .exe} {}}
+outest "$b lto st sing unnamed" $sing "-save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{a--0.i a--0.s a--0.o a--0.c.???i.icf !$ltop a--0.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out a.ltrans_args !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.ltrans0.ltrans_args $aout}}
+outest "$b lto st mult unnamed" $mult "-save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage $oaout" {} {{a--1.i a--1.s a--1.o a--1.c.???i.icf !$ltop a--1.c.???r.final !0 a--2.i a--2.s a--2.o a--2.c.???i.icf !$ltop a--2.c.???r.final !!$ltop a.lto_wrapper_args !0 a.wpa.???i.icf a.ltrans.out a.ltrans_args !!$ltop a.res !0 a.ltrans0.o a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a.ltrans0.ltrans.s a.ltrans0.ltrans.o a.ltrans0.ltrans_args $aout}}
+outest "$b lto st sing dumpdir named" $sing "-dumpdir dir/$b- -o $b-0.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.i --0.s --0.o --0.c.???i.icf !$ltop --0.c.???r.final !!$ltop -lto_wrapper_args !0 -wpa.???i.icf -ltrans.out -ltrans_args !!$ltop -res !0 -ltrans0.o -ltrans0.ltrans.???r.final -ltrans0.ltrans.su -ltrans0.ltrans.s -ltrans0.ltrans.o -ltrans0.ltrans_args} {-0.exe}}
+outest "$b lto st mult dumpdir named" $mult "-dumpdir dir/$b- -o $b-1.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.i --1.s --1.o --1.c.???i.icf !$ltop --1.c.???r.final !0 --2.i --2.s --2.o --2.c.???i.icf !$ltop --2.c.???r.final !!$ltop -lto_wrapper_args !0 -wpa.???i.icf -ltrans.out -ltrans_args !!$ltop -res !0 -ltrans0.o -ltrans0.ltrans.???r.final -ltrans0.ltrans.su -ltrans0.ltrans.s -ltrans0.ltrans.o -ltrans0.ltrans_args} {-1.exe}}
+outest "$b lto st sing namedb" $sing "-o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.i --0.s --0.o --0.c.???i.icf !$ltop --0.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out .ltrans_args !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .ltrans0.ltrans_args .exe} {}}
+outest "$b lto st mult namedb" $mult "-o dir/$b.exe -save-temps -O2 -flto -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.i --1.s --1.o --1.c.???i.icf !$ltop --1.c.???r.final !0 --2.i --2.s --2.o --2.c.???i.icf !$ltop --2.c.???r.final !!$ltop .lto_wrapper_args !0 .wpa.???i.icf .ltrans.out .ltrans_args !!$ltop .res !0 .ltrans0.o .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .ltrans0.ltrans.s .ltrans0.ltrans.o .ltrans0.ltrans_args .exe} {}}
# !$skip_lto
}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
index fde6029..791972c 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
@@ -460,6 +460,8 @@ static void clean_results (void)
#endif
CLEAN(result, float, 32, 4);
+ AARCH64_ONLY(CLEAN(result, float, 64, 2));
+
#if defined(__aarch64__)
/* On AArch64, make sure to return DefaultNaN to have the same
results as on AArch32. */
@@ -544,7 +546,8 @@ static void clean_results (void)
DECL_VARIABLE(VAR, poly, 16, 8); \
DECL_VARIABLE_CRYPTO(VAR, poly, 64, 2); \
DECL_VARIABLE(VAR, float, 16, 8); \
- DECL_VARIABLE(VAR, float, 32, 4)
+ DECL_VARIABLE(VAR, float, 32, 4); \
+ AARCH64_ONLY(DECL_VARIABLE(VAR, float, 64, 2))
#else
#define DECL_VARIABLE_128BITS_VARIANTS(VAR) \
DECL_VARIABLE_128BITS_SIGNED_VARIANTS(VAR); \
@@ -552,7 +555,8 @@ static void clean_results (void)
DECL_VARIABLE(VAR, poly, 8, 16); \
DECL_VARIABLE(VAR, poly, 16, 8); \
DECL_VARIABLE_CRYPTO(VAR, poly, 64, 2); \
- DECL_VARIABLE(VAR, float, 32, 4)
+ DECL_VARIABLE(VAR, float, 32, 4); \
+ AARCH64_ONLY(DECL_VARIABLE(VAR, float, 64, 2))
#endif
/* Declare all variants. */
#define DECL_VARIABLE_ALL_VARIANTS(VAR) \
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c
index 25b3482..67f809c 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vreinterpret_p128.c
@@ -33,6 +33,10 @@ VECT_VAR_DECL(vreint_expected_q_p128_f32,poly,64,2) [] = { 0xc1700000c1800000,
0xc1500000c1600000 };
VECT_VAR_DECL(vreint_expected_q_p128_f16,poly,64,2) [] = { 0xca80cb00cb80cc00,
0xc880c900c980ca00 };
+#ifdef __aarch64__
+VECT_VAR_DECL(vreint_expected_q_p128_f64,poly,64,2) [] = { 0xc030000000000000,
+ 0xc02e000000000000 };
+#endif
/* Expected results: vreinterpretq_*_p128. */
VECT_VAR_DECL(vreint_expected_q_s8_p128,int,8,16) [] = { 0xf0, 0xff, 0xff, 0xff,
@@ -75,6 +79,10 @@ VECT_VAR_DECL(vreint_expected_q_f16_p128,hfloat,16,8) [] = { 0xfff0, 0xffff,
0xffff, 0xffff,
0xfff1, 0xffff,
0xffff, 0xffff };
+#ifdef __aarch64__
+VECT_VAR_DECL(vreint_expected_q_f64_p128,hfloat,64,2) [] = { 0xfffffffffffffff0,
+ 0xfffffffffffffff1 };
+#endif
int main (void)
{
@@ -90,6 +98,10 @@ int main (void)
#endif
VLOAD(vreint_vector, buffer, q, float, f, 32, 4);
+#ifdef __aarch64__
+ VLOAD(vreint_vector, buffer, q, float, f, 64, 2);
+#endif
+
/* vreinterpretq_p128_* tests. */
#undef TEST_MSG
#define TEST_MSG "VREINTERPRETQ_P128_*"
@@ -121,6 +133,10 @@ int main (void)
#endif
TEST_VREINTERPRET128(q, poly, p, 128, 1, float, f, 32, 4, vreint_expected_q_p128_f32);
+#ifdef __aarch64__
+ TEST_VREINTERPRET128(q, poly, p, 128, 1, float, f, 64, 2, vreint_expected_q_p128_f64);
+#endif
+
/* vreinterpretq_*_p128 tests. */
#undef TEST_MSG
#define TEST_MSG "VREINTERPRETQ_*_P128"
@@ -161,5 +177,8 @@ int main (void)
#endif
TEST_VREINTERPRET_FP_FROM_P128(q, float, f, 32, 4, poly, p, 128, 1, vreint_expected_q_f32_p128);
+#ifdef __aarch64__
+ TEST_VREINTERPRET_FP_FROM_P128(q, float, f, 64, 2, poly, p, 128, 1, vreint_expected_q_f64_p128);
+#endif
return 0;
}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c
index 3329e6b..45062d9 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c
@@ -476,7 +476,7 @@ void exec_vstX_lane (void)
TEST_ALL_EXTRA_CHUNKS(2, 1);
#undef CMT
-#define CMT " chunk 1"
+#define CMT " (chunk 1)"
CHECK(TEST_MSG, int, 8, 8, PRIx8, expected_st2_1, CMT);
CHECK(TEST_MSG, int, 16, 4, PRIx16, expected_st2_1, CMT);
CHECK(TEST_MSG, int, 32, 2, PRIx32, expected_st2_1, CMT);
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c
index 63f820f..25a0f19 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vtrn_half.c
@@ -73,11 +73,8 @@ void exec_vtrn_half (void)
/* Input vector can only have 64 bits. */
DECL_VARIABLE_ALL_VARIANTS(vector);
DECL_VARIABLE_ALL_VARIANTS(vector2);
- DECL_VARIABLE(vector, float, 64, 2);
- DECL_VARIABLE(vector2, float, 64, 2);
DECL_VARIABLE_ALL_VARIANTS(vector_res);
- DECL_VARIABLE(vector_res, float, 64, 2);
clean_results ();
/* We don't have vtrn1_T64x1, so set expected to the clean value. */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c
index 8706f24..2e6b666 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vuzp_half.c
@@ -70,11 +70,8 @@ void exec_vuzp_half (void)
/* Input vector can only have 64 bits. */
DECL_VARIABLE_ALL_VARIANTS(vector);
DECL_VARIABLE_ALL_VARIANTS(vector2);
- DECL_VARIABLE(vector, float, 64, 2);
- DECL_VARIABLE(vector2, float, 64, 2);
DECL_VARIABLE_ALL_VARIANTS(vector_res);
- DECL_VARIABLE(vector_res, float, 64, 2);
clean_results ();
/* We don't have vuzp1_T64x1, so set expected to the clean value. */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c
index 619d6b2..ef42451 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vzip_half.c
@@ -73,11 +73,8 @@ void exec_vzip_half (void)
/* Input vector can only have 64 bits. */
DECL_VARIABLE_ALL_VARIANTS(vector);
DECL_VARIABLE_ALL_VARIANTS(vector2);
- DECL_VARIABLE(vector, float, 64, 2);
- DECL_VARIABLE(vector2, float, 64, 2);
DECL_VARIABLE_ALL_VARIANTS(vector_res);
- DECL_VARIABLE(vector_res, float, 64, 2);
clean_results ();
/* We don't have vzip1_T64x1, so set expected to the clean value. */
diff --git a/gcc/testsuite/gcc.target/aarch64/extend-syntax.c b/gcc/testsuite/gcc.target/aarch64/extend-syntax.c
index 23fa9f4..1bfcdb5 100644
--- a/gcc/testsuite/gcc.target/aarch64/extend-syntax.c
+++ b/gcc/testsuite/gcc.target/aarch64/extend-syntax.c
@@ -20,6 +20,7 @@ unsigned long long *add1(unsigned long long *p, unsigned x)
*/
unsigned long long add2(unsigned long long x, unsigned y)
{
+ /* { dg-final { scan-assembler-times "add\tx0, x0, w1, uxtw" 1 { target ilp32 } } } */
return x + y;
}
@@ -34,6 +35,9 @@ double *add3(double *p, int x)
return p + x;
}
+// add1 and add3 should both generate this on ILP32:
+/* { dg-final { scan-assembler-times "add\tw0, w0, w1, lsl 3" 2 { target ilp32 } } } */
+
// Hits *sub_zero_extendsi_di (*sub_<optab><ALLX:mode>_<GPI:mode>).
/*
** sub1:
@@ -42,6 +46,7 @@ double *add3(double *p, int x)
*/
unsigned long long sub1(unsigned long long x, unsigned n)
{
+ /* { dg-final { scan-assembler-times "sub\tx0, x0, w1, uxtw" 1 { target ilp32 } } } */
return x - n;
}
@@ -67,6 +72,9 @@ double *sub3(double *p, int n)
return p - n;
}
+// sub2 and sub3 should both generate this on ILP32:
+/* { dg-final { scan-assembler-times "sub\tw0, w0, w1, lsl 3" 2 { target ilp32 } } } */
+
// Hits *adds_zero_extendsi_di (*adds_<optab><ALLX:mode>_<GPI:mode>).
int adds1(unsigned long long x, unsigned y)
{
@@ -97,7 +105,8 @@ int subs1(unsigned long long x, unsigned y)
unsigned long long *w;
int subs2(unsigned long long *x, int y)
{
- /* { dg-final { scan-assembler-times "subs\tx\[0-9\]+, x\[0-9\]+, w\[0-9\]+, sxtw 3" 1 } } */
+ /* { dg-final { scan-assembler-times "subs\tx\[0-9\]+, x\[0-9\]+, w\[0-9\]+, sxtw 3" 1 { target lp64 } } } */
+ /* { dg-final { scan-assembler-times "subs\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" 1 { target ilp32 } } } */
unsigned long long *t = x - y;
w = t;
return !!t;
@@ -117,4 +126,4 @@ int cmp2(unsigned long long x, int y)
return x == ((unsigned long long)y << 3);
}
-/* { dg-final { check-function-bodies "**" "" "" } } */
+/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/movtf_1.c b/gcc/testsuite/gcc.target/aarch64/movtf_1.c
new file mode 100644
index 0000000..b975b20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movtf_1.c
@@ -0,0 +1,87 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */
+
+/*
+** zero_q:
+** movi v0.2d, #0
+** ret
+*/
+void
+zero_q ()
+{
+ register _Float128 q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** load_q:
+** ldr q0, \[x0\]
+** ret
+*/
+void
+load_q (_Float128 *ptr)
+{
+ register _Float128 q0 asm ("q0");
+ q0 = *ptr;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** store_q:
+** str q0, \[x0\]
+** ret
+*/
+void
+store_q (_Float128 *ptr)
+{
+ register _Float128 q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ *ptr = q0;
+}
+
+/*
+** zero_x:
+** (
+** mov x0, #?0
+** mov x1, #?0
+** |
+** mov x1, #?0
+** mov x0, #?0
+** )
+** ret
+*/
+void
+zero_x ()
+{
+ register _Float128 x0 asm ("x0");
+ x0 = 0;
+ asm volatile ("" :: "r" (x0));
+}
+
+/*
+** load_x:
+** ldp x2, x3, \[x0\]
+** ret
+*/
+void
+load_x (_Float128 *ptr)
+{
+ register _Float128 x2 asm ("x2");
+ x2 = *ptr;
+ asm volatile ("" :: "r" (x2));
+}
+
+/*
+** store_x:
+** stp x2, x3, \[x0\]
+** ret
+*/
+void
+store_x (_Float128 *ptr)
+{
+ register _Float128 x2 asm ("x2");
+ asm volatile ("" : "=r" (x2));
+ *ptr = x2;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/movti_1.c b/gcc/testsuite/gcc.target/aarch64/movti_1.c
new file mode 100644
index 0000000..5595b3e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/movti_1.c
@@ -0,0 +1,87 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */
+
+/*
+** zero_q:
+** movi v0.2d, #0
+** ret
+*/
+void
+zero_q ()
+{
+ register __int128_t q0 asm ("q0");
+ q0 = 0;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** load_q:
+** ldr q0, \[x0\]
+** ret
+*/
+void
+load_q (__int128_t *ptr)
+{
+ register __int128_t q0 asm ("q0");
+ q0 = *ptr;
+ asm volatile ("" :: "w" (q0));
+}
+
+/*
+** store_q:
+** str q0, \[x0\]
+** ret
+*/
+void
+store_q (__int128_t *ptr)
+{
+ register __int128_t q0 asm ("q0");
+ asm volatile ("" : "=w" (q0));
+ *ptr = q0;
+}
+
+/*
+** zero_x:
+** (
+** mov x0, #?0
+** mov x1, #?0
+** |
+** mov x1, #?0
+** mov x0, #?0
+** )
+** ret
+*/
+void
+zero_x ()
+{
+ register __int128_t x0 asm ("x0");
+ x0 = 0;
+ asm volatile ("" :: "r" (x0));
+}
+
+/*
+** load_x:
+** ldp x2, x3, \[x0\]
+** ret
+*/
+void
+load_x (__int128_t *ptr)
+{
+ register __int128_t x2 asm ("x2");
+ x2 = *ptr;
+ asm volatile ("" :: "r" (x2));
+}
+
+/*
+** store_x:
+** stp x2, x3, \[x0\]
+** ret
+*/
+void
+store_x (__int128_t *ptr)
+{
+ register __int128_t x2 asm ("x2");
+ asm volatile ("" : "=r" (x2));
+ *ptr = x2;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr96313.c b/gcc/testsuite/gcc.target/aarch64/pr96313.c
new file mode 100644
index 0000000..0bf7604
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr96313.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+#include <arm_neon.h>
+
+uint32_t (*fp3)(int64_t) = vqmovund_s64;
+uint8_t (*fp4)(int16_t) = vqmovunh_s16;
+uint16_t (*fp5)(int32_t) = vqmovuns_s32;
+
diff --git a/gcc/testsuite/gcc.target/aarch64/pr96757.c b/gcc/testsuite/gcc.target/aarch64/pr96757.c
new file mode 100644
index 0000000..122e39d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr96757.c
@@ -0,0 +1,23 @@
+/* PR target/96757 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+short
+fun1(short i, short j)
+{
+ return i * j;
+}
+
+int
+fun(int a, int b, int c)
+{
+ int *v, z, k, m;
+ short f, d;
+ for (int i=0; i<c; i++)
+ {
+ f= 4 <= d;
+ k= a > m;
+ z = f > k;
+ *v += fun1(z,b);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/pr96968.c b/gcc/testsuite/gcc.target/aarch64/pr96968.c
new file mode 100644
index 0000000..21ffd95
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr96968.c
@@ -0,0 +1,28 @@
+/* { dg-options "-O1" } */
+
+void
+fpsr_getter (void)
+{
+ unsigned int fpsr = __builtin_aarch64_get_fpsr ();
+}
+
+void
+fpsr64_getter (void)
+{
+ unsigned long fpsr = __builtin_aarch64_get_fpsr64 ();
+}
+
+void
+fpcr_getter (void)
+{
+ unsigned int fpcr = __builtin_aarch64_get_fpcr ();
+}
+
+void
+fpcr64_getter (void)
+{
+ unsigned long fpcr = __builtin_aarch64_get_fpcr64 ();
+}
+
+/* { dg-final { scan-assembler-times {\tmrs\tx0, fpsr\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tmrs\tx0, fpcr\n} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr97150.c b/gcc/testsuite/gcc.target/aarch64/pr97150.c
new file mode 100644
index 0000000..7abdd8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr97150.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+#include <arm_neon.h>
+
+uint8_t (*fp0)(uint8_t, int8_t) = vqshlb_u8;
+uint16_t (*fp1)(uint16_t, int16_t) = vqshlh_u16;
+uint32_t (*fp2)(uint32_t, int32_t) = vqshls_u32;
+uint64_t (*fp3)(uint64_t, int64_t) = vqshld_u64;
+uint8_t (*fp4)(uint8_t, int8_t) = vqrshlb_u8;
+uint16_t (*fp5)(uint16_t, int16_t) = vqrshlh_u16;
+uint32_t (*fp6)(uint32_t, int32_t) = vqrshls_u32;
+uint64_t (*fp7)(uint64_t, int64_t) = vqrshld_u64;
+uint64_t (*fp8)(uint64_t, int64_t) = vshld_u64;
+
diff --git a/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c b/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c
index d943989..c2e13b6 100644
--- a/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c
+++ b/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c
@@ -661,7 +661,7 @@ test_vqnegs_s32 (int32_t a)
/* { dg-final { scan-assembler-times "\\tsqxtun\\tb\[0-9\]+" 1 } } */
-int8_t
+uint8_t
test_vqmovunh_s16 (int16_t a)
{
return vqmovunh_s16 (a);
@@ -669,7 +669,7 @@ test_vqmovunh_s16 (int16_t a)
/* { dg-final { scan-assembler-times "\\tsqxtun\\th\[0-9\]+" 1 } } */
-int16_t
+uint16_t
test_vqmovuns_s32 (int32_t a)
{
return vqmovuns_s32 (a);
@@ -677,7 +677,7 @@ test_vqmovuns_s32 (int32_t a)
/* { dg-final { scan-assembler-times "\\tsqxtun\\ts\[0-9\]+" 1 } } */
-int32_t
+uint32_t
test_vqmovund_s64 (int64_t a)
{
return vqmovund_s64 (a);
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/pr97349.c b/gcc/testsuite/gcc.target/aarch64/simd/pr97349.c
new file mode 100644
index 0000000..026767a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/pr97349.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+#include <arm_neon.h>
+
+poly16x8_t (*fp0)(poly16_t) = vdupq_n_p16;
+poly64x2_t (*fp1)(poly64_t) = vdupq_n_p64;
+poly8x16_t (*fp2)(poly8_t) = vdupq_n_p8;
+int16x8_t (*fp3)(int16_t) = vdupq_n_s16;
+int8x16_t (*fp4)(int8_t) = vdupq_n_s8;
+uint16x8_t (*fp5)(uint16_t) = vdupq_n_u16;
+uint8x16_t (*fp6)(uint8_t) = vdupq_n_u8;
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c b/gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c
new file mode 100644
index 0000000..a47321d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/trn_zip_p64_1.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+poly64x2_t
+foo (poly64x2_t a, poly64x2_t b)
+{
+ return vtrn1q_p64 (a, b);
+}
+
+poly64x2_t
+foo1 (poly64x2_t a, poly64x2_t b)
+{
+ return vtrn2q_p64 (a, b);
+}
+
+poly64x2_t
+foo2 (poly64x2_t a, poly64x2_t b)
+{
+ return vuzp1q_p64 (a, b);
+}
+
+poly64x2_t
+foo3 (poly64x2_t a, poly64x2_t b)
+{
+ return vuzp2q_p64 (a, b);
+}
+
+poly64x2_t
+foo4 (poly64x2_t a, poly64x2_t b)
+{
+ return vzip1q_p64 (a, b);
+}
+
+poly64x2_t
+foo5 (poly64x2_t a, poly64x2_t b)
+{
+ return vzip2q_p64 (a, b);
+}
+
+/* { dg-final { scan-assembler-times {zip1\tv0.2d, v0.2d, v1.2d} 3 } } */
+/* { dg-final { scan-assembler-times {zip2\tv0.2d, v0.2d, v1.2d} 3 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c
new file mode 100644
index 0000000..a5cdf29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vadd_poly_1.c
@@ -0,0 +1,50 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+poly8x8_t
+foo (poly8x8_t a, poly8x8_t b)
+{
+ return vadd_p8 (a, b);
+}
+
+poly16x4_t
+foo16 (poly16x4_t a, poly16x4_t b)
+{
+ return vadd_p16 (a, b);
+}
+
+poly64x1_t
+foo64 (poly64x1_t a, poly64x1_t b)
+{
+ return vadd_p64 (a, b);
+}
+
+poly8x16_t
+fooq (poly8x16_t a, poly8x16_t b)
+{
+ return vaddq_p8 (a, b);
+}
+
+poly16x8_t
+fooq16 (poly16x8_t a, poly16x8_t b)
+{
+ return vaddq_p16 (a, b);
+}
+
+poly64x2_t
+fooq64 (poly64x2_t a, poly64x2_t b)
+{
+ return vaddq_p64 (a, b);
+}
+
+poly128_t
+fooq128 (poly128_t a, poly128_t b)
+{
+ return vaddq_p128 (a, b);
+}
+
+/* { dg-final { scan-assembler-times "eor\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b, v\[0-9\]+\.8b" 3 } } */
+/* { dg-final { scan-assembler-times "eor\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b, v\[0-9\]+\.16b" 3 } } */
+/* { dg-final { scan-assembler-times "eor\\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c
new file mode 100644
index 0000000..7d43352
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vceq_poly_1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+uint64x2_t
+foo (poly64x2_t a, poly64x2_t b)
+{
+ return vceqq_p64 (a, b);
+}
+
+/* { dg-final { scan-assembler-times "cmeq\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, v\[0-9\]+\.2d" 1 } } */
+
+uint64x1_t
+fooz (poly64x1_t a)
+{
+ return vceqz_p64 (a);
+}
+
+/* { dg-final { scan-assembler-times "cmeq\\td\[0-9\]+, d\[0-9\]+, #0" 1 } } */
+
+uint64x2_t
+fooqz (poly64x2_t a)
+{
+ return vceqzq_p64 (a);
+}
+
+/* { dg-final { scan-assembler-times "cmeq\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, #0" 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c
new file mode 100644
index 0000000..f7078d1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vcls_unsigned_1.c
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+int16x8_t
+test_16x8 (uint16x8_t a)
+{
+ return vclsq_u16 (a);
+}
+
+/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h" 1 } } */
+
+
+int8x16_t
+test_8x16 (uint8x16_t a)
+{
+ return vclsq_u8 (a);
+}
+
+/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.16b, v\[0-9\]+\.16b" 1 } } */
+
+int32x4_t
+test_32x4 (uint32x4_t a)
+{
+ return vclsq_u32 (a);
+}
+
+/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s" 1 } } */
+
+int16x4_t
+test_16x4 (uint16x4_t a)
+{
+ return vcls_u16 (a);
+}
+
+/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.4h, v\[0-9\]+\.4h" 1 } } */
+
+int8x8_t
+test_8x8 (uint8x8_t a)
+{
+ return vcls_u8 (a);
+}
+
+/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.8b, v\[0-9\]+\.8b" 1 } } */
+
+int32x2_t
+test32x2 (uint32x2_t a)
+{
+ return vcls_u32 (a);
+}
+
+/* { dg-final { scan-assembler-times "cls\\tv\[0-9\]+\.2s, v\[0-9\]+\.2s" 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c
new file mode 100644
index 0000000..9c7e01b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vldrq_p128_1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+poly128_t
+test (poly128_t * p)
+{
+ return vldrq_p128 (p);
+}
+
+/* { dg-final { scan-assembler-times {ldp.*x0,.*x1,.*[x0]} 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c
new file mode 100644
index 0000000..960e4f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+float32_t
+test (float32_t a)
+{
+ return vrndns_f32 (a);
+}
+
+/* { dg-final { scan-assembler-times "frintn\\ts\[0-9\]+, s\[0-9\]+" 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c
new file mode 100644
index 0000000..8d036fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/vstrq_p128_1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+void
+test (poly128_t *ptr, poly128_t a)
+{
+ vstrq_p128 (ptr, a);
+}
+
+/* { dg-final { scan-assembler-times {stp.*x2,.*x3,.*[x0]} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-3.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-3.c
new file mode 100644
index 0000000..909e26c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-3.c
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fstack_protector } */
+/* { dg-options "-fstack-protector-all -O2" } */
+
+extern volatile long *stack_chk_guard_ptr;
+
+void __attribute__ ((noipa))
+f (void)
+{
+ volatile int x;
+ /* Munging the contents of __stack_chk_guard should trigger a
+ stack-smashing failure for this function. */
+ *stack_chk_guard_ptr += 1;
+}
+
+#define CHECK(REG) "\tcmp\tx0, " #REG "\n\tbeq\t1f\n"
+
+asm (
+" .pushsection .data\n"
+" .align 3\n"
+"stack_chk_guard_ptr:\n"
+#if __ILP32__
+" .word __stack_chk_guard\n"
+#else
+" .xword __stack_chk_guard\n"
+#endif
+" .weak __stack_chk_guard\n"
+"__stack_chk_guard:\n"
+" .word 0xdead4321\n"
+" .word 0xbeef8765\n"
+" .text\n"
+" .type __stack_chk_fail, %function\n"
+"__stack_chk_fail:\n"
+" mov x0, #0\n"
+" b exit\n"
+" .size __stack_chk_fail, .-__stack_chk_fail\n"
+" .popsection"
+);
+
+int
+main (void)
+{
+ f ();
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-4.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-4.c
new file mode 100644
index 0000000..6334dd0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-4.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fstack_protector } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-fstack-protector-all -O2 -fpic" } */
+
+#include "stack-protector-3.c"
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-5.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-5.c
new file mode 100644
index 0000000..a9cd53b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-5.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-fstack-protector-all -O2" } */
+
+void __attribute__ ((noipa))
+f (void)
+{
+ volatile int x;
+ asm volatile ("" :::
+ "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
+ "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
+ "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
+ "x24", "x25", "x26", "x27", "x28", "x30");
+}
+
+/* The register clobbers above should not generate any single LDRs or STRs;
+ all registers should be saved and restored in pairs. The only STRs
+ should be therefore be those associated with the stack protector
+ tests themselves.
+
+ Make sure the address of the canary value is not spilled and reloaded,
+ since that would give the attacker an opportunity to change the
+ canary value. */
+/* { dg-final { scan-assembler-times {\tstr\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-6.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-6.c
new file mode 100644
index 0000000..e2ac088
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-6.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-fstack-protector-all -O2 -fpic" } */
+
+#include "stack-protector-5.c"
+
+/* See the comment in stack-protector-5.c. */
+/* { dg-final { scan-assembler-times {\tldr\t[^\n]*__stack_chk_guard} 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-7.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-7.c
new file mode 100644
index 0000000..e644768
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-7.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-fstack-protector-all -mstack-protector-guard=sysreg -mstack-protector-guard-offset=16 -mstack-protector-guard-reg=tpidr_el0 -O2" } */
+
+void __attribute__ ((noipa))
+f (void)
+{
+ volatile int x;
+ asm volatile ("" :::
+ "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
+ "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
+ "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
+ "x24", "x25", "x26", "x27", "x28", "x30");
+}
+
+/* The register clobbers above should not generate any single LDRs or STRs;
+ all registers should be saved and restored in pairs. The only LDRs and
+ STRs should be therefore be those associated with the stack protector
+ tests themselves.
+
+ Make sure the address of the canary value (tpidr_el0 + 16) is not
+ spilled and reloaded, since that would give the attacker an opportunity
+ to change the canary value. */
+/* { dg-final { scan-assembler-times {\tmrs\t} 2 } } */
+/* { dg-final { scan-assembler-times {\tstr\t} 1 } } */
+/* { dg-final { scan-assembler-times {\tldr\t} 3 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/subsp.c b/gcc/testsuite/gcc.target/aarch64/subsp.c
index 341b83d..e7f61e0 100644
--- a/gcc/testsuite/gcc.target/aarch64/subsp.c
+++ b/gcc/testsuite/gcc.target/aarch64/subsp.c
@@ -16,4 +16,4 @@ f2 (int *x, int y)
}
/* { dg-final { scan-assembler "sub\tsp, sp, x\[0-9\]*\n" } } */
-/* { dg-final { scan-assembler "sub\tsp, sp, w\[0-9\]*, sxtw 4\n" } } */
+/* { dg-final { scan-assembler "sub\tsp, sp, w\[0-9\]*, sxtw 4\n" { target lp64 } } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr96915.c b/gcc/testsuite/gcc.target/aarch64/sve/pr96915.c
new file mode 100644
index 0000000..fae4cd4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr96915.c
@@ -0,0 +1,11 @@
+/* PR tree-optimization/96915 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a+sve" } */
+
+#pragma GCC aarch64 "arm_sve.h"
+void b() {
+ switch (svcntd())
+ case 2:
+ case 4:
+ b();
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr97079.c b/gcc/testsuite/gcc.target/aarch64/sve/pr97079.c
new file mode 100644
index 0000000..06e6a7c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr97079.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=armv8.2-a+sve" } */
+
+void g(void);
+
+int a[8][3];
+int b;
+void c(void)
+{
+ int d[] = {7, 3};
+ int *e = a[0];
+ int f;
+ b = 0;
+ for (; b < 8; b++)
+ {
+ f = 0;
+ for (; f < 3; f++)
+ a[b][f] = 0;
+ }
+ g();
+ *e = (long)d;
+}
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c
new file mode 100644
index 0000000..67a9f41
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp16-move-1.c
@@ -0,0 +1,418 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mfloat-abi=hard -mfp16-format=ieee" } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** r_w:
+** vmov.f16 r0, s0 @ __fp16
+** bx lr
+*/
+void
+r_w (_Float16 s0)
+{
+ register _Float16 r0 asm ("r0");
+ r0 = s0;
+ asm volatile ("" :: "r" (r0));
+}
+
+/*
+** w_r:
+** vmov.f16 s0, r0 @ __fp16
+** bx lr
+*/
+_Float16
+w_r ()
+{
+ register _Float16 r0 asm ("r0");
+ asm volatile ("" : "=r" (r0));
+ return r0;
+}
+
+/*
+** w_w:
+** vmov s1, s0 @ __fp16
+** bx lr
+*/
+void
+w_w (_Float16 s0)
+{
+ register _Float16 s1 asm ("s1");
+ s1 = s0;
+ asm volatile ("" :: "w" (s1));
+}
+
+/*
+** r_m_m128:
+** sub (r[0-9]+), r0, #256
+** ldrh r1, \[\1\] @ __fp16
+** bx lr
+*/
+void
+r_m_m128 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[-128];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_m127:
+** ldrh r1, \[r0, #-254\] @ __fp16
+** bx lr
+*/
+void
+r_m_m127 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[-127];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_m1:
+** ldrh r1, \[r0, #-2\] @ __fp16
+** bx lr
+*/
+void
+r_m_m1 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[-1];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_0:
+** ldrh r1, \[r0\] @ __fp16
+** bx lr
+*/
+void
+r_m_0 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[0];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_1:
+** ldrh r1, \[r0, #2\] @ __fp16
+** bx lr
+*/
+void
+r_m_1 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[1];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_255:
+** ldrh r1, \[r0, #510\] @ __fp16
+** bx lr
+*/
+void
+r_m_255 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[255];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_256:
+** ldrh r1, \[r0, #512\] @ __fp16
+** bx lr
+*/
+void
+r_m_256 (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ r1 = r0[256];
+ asm volatile ("" :: "r" (r1));
+}
+
+/* ??? This could be done in one instruction, but without mve.fp,
+ it makes more sense for memory_operand to enforce the GPR range. */
+/*
+** w_m_m128:
+** sub (r[0-9]+), r0, #256
+** vldr.16 s0, \[\1\]
+** bx lr
+*/
+void
+w_m_m128 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[-128];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_m127:
+** vldr.16 s0, \[r0, #-254\]
+** bx lr
+*/
+void
+w_m_m127 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[-127];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_m1:
+** vldr.16 s0, \[r0, #-2\]
+** bx lr
+*/
+void
+w_m_m1 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[-1];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_0:
+** vldr.16 s0, \[r0\]
+** bx lr
+*/
+void
+w_m_0 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[0];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_1:
+** vldr.16 s0, \[r0, #2\]
+** bx lr
+*/
+void
+w_m_1 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[1];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_255:
+** vldr.16 s0, \[r0, #510\]
+** bx lr
+*/
+void
+w_m_255 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[255];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_256:
+** add (r[0-9]+), r0, #512
+** vldr.16 s0, \[\1\]
+** bx lr
+*/
+void
+w_m_256 (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ s0 = r0[256];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** m_m128_r:
+** sub (r[0-9]+), r0, #256
+** strh r1, \[\1\] @ __fp16
+** bx lr
+*/
+void
+m_m128_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[-128] = r1;
+}
+
+/*
+** m_m127_r:
+** strh r1, \[r0, #-254\] @ __fp16
+** bx lr
+*/
+void
+m_m127_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[-127] = r1;
+}
+
+/*
+** m_m1_r:
+** strh r1, \[r0, #-2\] @ __fp16
+** bx lr
+*/
+void
+m_m1_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[-1] = r1;
+}
+
+/*
+** m_0_r:
+** strh r1, \[r0\] @ __fp16
+** bx lr
+*/
+void
+m_0_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[0] = r1;
+}
+
+/*
+** m_1_r:
+** strh r1, \[r0, #2\] @ __fp16
+** bx lr
+*/
+void
+m_1_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[1] = r1;
+}
+
+/*
+** m_255_r:
+** strh r1, \[r0, #510\] @ __fp16
+** bx lr
+*/
+void
+m_255_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[255] = r1;
+}
+
+/*
+** m_256_r:
+** strh r1, \[r0, #512\] @ __fp16
+** bx lr
+*/
+void
+m_256_r (_Float16 *r0)
+{
+ register _Float16 r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[256] = r1;
+}
+
+/* ??? This could be done in one instruction, but without mve.fp,
+ it makes more sense for memory_operand to enforce the GPR range. */
+/*
+** m_m128_w:
+** sub (r[0-9]+), r0, #256
+** vstr.16 s0, \[\1\]
+** bx lr
+*/
+void
+m_m128_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[-128] = s0;
+}
+
+/*
+** m_m127_w:
+** vstr.16 s0, \[r0, #-254\]
+** bx lr
+*/
+void
+m_m127_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[-127] = s0;
+}
+
+/*
+** m_m1_w:
+** vstr.16 s0, \[r0, #-2\]
+** bx lr
+*/
+void
+m_m1_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[-1] = s0;
+}
+
+/*
+** m_0_w:
+** vstr.16 s0, \[r0\]
+** bx lr
+*/
+void
+m_0_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[0] = s0;
+}
+
+/*
+** m_1_w:
+** vstr.16 s0, \[r0, #2\]
+** bx lr
+*/
+void
+m_1_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[1] = s0;
+}
+
+/*
+** m_255_w:
+** vstr.16 s0, \[r0, #510\]
+** bx lr
+*/
+void
+m_255_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[255] = s0;
+}
+
+/*
+** m_256_w:
+** add (r[0-9]+), r0, #512
+** vstr.16 s0, \[\1\]
+** bx lr
+*/
+void
+m_256_w (_Float16 *r0)
+{
+ register _Float16 s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[256] = s0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c
new file mode 100644
index 0000000..1ecb839
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp32-move-1.c
@@ -0,0 +1,420 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mfloat-abi=hard" } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** r_w:
+** vmov r0, s0
+** bx lr
+*/
+void
+r_w (float s0)
+{
+ register float r0 asm ("r0");
+ r0 = s0;
+ asm volatile ("" :: "r" (r0));
+}
+
+/*
+** w_r:
+** vmov s0, r0
+** bx lr
+*/
+float
+w_r ()
+{
+ register float r0 asm ("r0");
+ asm volatile ("" : "=r" (r0));
+ return r0;
+}
+
+/*
+** w_w:
+** vmov.f32 s1, s0
+** bx lr
+*/
+void
+w_w (float s0)
+{
+ register float s1 asm ("s1");
+ s1 = s0;
+ asm volatile ("" :: "w" (s1));
+}
+
+/*
+** r_m_m64:
+** sub (r[0-9]+), r0, #256
+** ldr r1, \[\1\] @ float
+** bx lr
+*/
+void
+r_m_m64 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[-64];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_m63:
+** ldr r1, \[r0, #-252\] @ float
+** bx lr
+*/
+void
+r_m_m63 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[-63];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_m1:
+** ldr r1, \[r0, #-4\] @ float
+** bx lr
+*/
+void
+r_m_m1 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[-1];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_0:
+** ldr r1, \[r0\] @ float
+** bx lr
+*/
+void
+r_m_0 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[0];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_1:
+** ldr r1, \[r0, #4\] @ float
+** bx lr
+*/
+void
+r_m_1 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[1];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_255:
+** ldr r1, \[r0, #1020\] @ float
+** bx lr
+*/
+void
+r_m_255 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[255];
+ asm volatile ("" :: "r" (r1));
+}
+
+/*
+** r_m_256:
+** add (r[0-9]+), r0, #1024
+** ldr r1, \[r0\] @ float
+** bx lr
+*/
+void
+r_m_256 (float *r0)
+{
+ register float r1 asm ("r1");
+ r1 = r0[256];
+ asm volatile ("" :: "r" (r1));
+}
+
+/* ??? This could be done in one instruction, but without mve.fp,
+ it makes more sense for memory_operand to enforce the GPR range. */
+/*
+** w_m_m64:
+** sub (r[0-9]+), r0, #256
+** vldr.32 s0, \[\1\]
+** bx lr
+*/
+void
+w_m_m64 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[-64];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_m63:
+** vldr.32 s0, \[r0, #-252\]
+** bx lr
+*/
+void
+w_m_m63 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[-63];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_m1:
+** vldr.32 s0, \[r0, #-4\]
+** bx lr
+*/
+void
+w_m_m1 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[-1];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_0:
+** vldr.32 s0, \[r0\]
+** bx lr
+*/
+void
+w_m_0 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[0];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_1:
+** vldr.32 s0, \[r0, #4\]
+** bx lr
+*/
+void
+w_m_1 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[1];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_255:
+** vldr.32 s0, \[r0, #1020\]
+** bx lr
+*/
+void
+w_m_255 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[255];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** w_m_256:
+** add (r[0-9]+), r0, #1024
+** vldr.32 s0, \[\1\]
+** bx lr
+*/
+void
+w_m_256 (float *r0)
+{
+ register float s0 asm ("s0");
+ s0 = r0[256];
+ asm volatile ("" :: "w" (s0));
+}
+
+/*
+** m_m64_r:
+** sub (r[0-9]+), r0, #256
+** str r1, \[\1\] @ float
+** bx lr
+*/
+void
+m_m64_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[-64] = r1;
+}
+
+/*
+** m_m63_r:
+** str r1, \[r0, #-252\] @ float
+** bx lr
+*/
+void
+m_m63_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[-63] = r1;
+}
+
+/*
+** m_m1_r:
+** str r1, \[r0, #-4\] @ float
+** bx lr
+*/
+void
+m_m1_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[-1] = r1;
+}
+
+/*
+** m_0_r:
+** str r1, \[r0\] @ float
+** bx lr
+*/
+void
+m_0_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[0] = r1;
+}
+
+/*
+** m_1_r:
+** str r1, \[r0, #4\] @ float
+** bx lr
+*/
+void
+m_1_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[1] = r1;
+}
+
+/*
+** m_255_r:
+** str r1, \[r0, #1020\] @ float
+** bx lr
+*/
+void
+m_255_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[255] = r1;
+}
+
+/*
+** m_256_r:
+** add (r[0-9]+), r0, #1024
+** str r1, \[r0\] @ float
+** bx lr
+*/
+void
+m_256_r (float *r0)
+{
+ register float r1 asm ("r1");
+ asm volatile ("" : "=r" (r1));
+ r0[256] = r1;
+}
+
+/* ??? This could be done in one instruction, but without mve.fp,
+ it makes more sense for memory_operand to enforce the GPR range. */
+/*
+** m_m64_w:
+** sub (r[0-9]+), r0, #256
+** vstr.32 s0, \[\1\]
+** bx lr
+*/
+void
+m_m64_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[-64] = s0;
+}
+
+/*
+** m_m63_w:
+** vstr.32 s0, \[r0, #-252\]
+** bx lr
+*/
+void
+m_m63_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[-63] = s0;
+}
+
+/*
+** m_m1_w:
+** vstr.32 s0, \[r0, #-4\]
+** bx lr
+*/
+void
+m_m1_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[-1] = s0;
+}
+
+/*
+** m_0_w:
+** vstr.32 s0, \[r0\]
+** bx lr
+*/
+void
+m_0_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[0] = s0;
+}
+
+/*
+** m_1_w:
+** vstr.32 s0, \[r0, #4\]
+** bx lr
+*/
+void
+m_1_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[1] = s0;
+}
+
+/*
+** m_255_w:
+** vstr.32 s0, \[r0, #1020\]
+** bx lr
+*/
+void
+m_255_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[255] = s0;
+}
+
+/*
+** m_256_w:
+** add (r[0-9]+), r0, #1024
+** vstr.32 s0, \[\1\]
+** bx lr
+*/
+void
+m_256_w (float *r0)
+{
+ register float s0 asm ("s0");
+ asm volatile ("" : "=w" (s0));
+ r0[256] = s0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c b/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c
new file mode 100644
index 0000000..3f81350
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/armv8_1m-fp64-move-1.c
@@ -0,0 +1,426 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mfloat-abi=hard" } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** r_w:
+** vmov r0, r1, d0
+** bx lr
+*/
+void
+r_w (double d0)
+{
+ register double r0 asm ("r0");
+ r0 = d0;
+ asm volatile ("" :: "r" (r0));
+}
+
+/*
+** w_r:
+** vmov d0, r0, r1
+** bx lr
+*/
+double
+w_r ()
+{
+ register double r0 asm ("r0");
+ asm volatile ("" : "=r" (r0));
+ return r0;
+}
+
+/*
+** w_w:
+** (
+** vmov.f32 s2, s0
+** vmov.f32 s3, s1
+** |
+** vmov.f32 s3, s1
+** vmov.f32 s2, s0
+** )
+** bx lr
+*/
+void
+w_w (double d0)
+{
+ register double d1 asm ("d1");
+ d1 = d0;
+ asm volatile ("" :: "w" (d1));
+}
+
+/*
+** r_m_m32:
+** sub (r[0-9]+), r0, #256
+** ldrd r2, \[\1\]
+** bx lr
+*/
+void
+r_m_m32 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[-32];
+ asm volatile ("" :: "r" (r2));
+}
+
+/*
+** r_m_m31:
+** ldrd r2, \[r0, #-248\]
+** bx lr
+*/
+void
+r_m_m31 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[-31];
+ asm volatile ("" :: "r" (r2));
+}
+
+/*
+** r_m_m1:
+** ldrd r2, \[r0, #-8\]
+** bx lr
+*/
+void
+r_m_m1 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[-1];
+ asm volatile ("" :: "r" (r2));
+}
+
+/*
+** r_m_0:
+** ldrd r2, \[r0\]
+** bx lr
+*/
+void
+r_m_0 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[0];
+ asm volatile ("" :: "r" (r2));
+}
+
+/*
+** r_m_1:
+** ldrd r2, \[r0, #8\]
+** bx lr
+*/
+void
+r_m_1 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[1];
+ asm volatile ("" :: "r" (r2));
+}
+
+/*
+** r_m_127:
+** ldrd r2, \[r0, #1016\]
+** bx lr
+*/
+void
+r_m_127 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[127];
+ asm volatile ("" :: "r" (r2));
+}
+
+/*
+** r_m_128:
+** add (r[0-9]+), r0, #1024
+** ldrd r2, \[r0\]
+** bx lr
+*/
+void
+r_m_128 (double *r0)
+{
+ register double r2 asm ("r2");
+ r2 = r0[128];
+ asm volatile ("" :: "r" (r2));
+}
+
+/* ??? This could be done in one instruction, but without mve.fp,
+ it makes more sense for memory_operand to enforce the GPR range. */
+/*
+** w_m_m32:
+** sub (r[0-9]+), r0, #256
+** vldr.64 d0, \[\1\]
+** bx lr
+*/
+void
+w_m_m32 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[-32];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** w_m_m31:
+** vldr.64 d0, \[r0, #-248\]
+** bx lr
+*/
+void
+w_m_m31 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[-31];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** w_m_m1:
+** vldr.64 d0, \[r0, #-8\]
+** bx lr
+*/
+void
+w_m_m1 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[-1];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** w_m_0:
+** vldr.64 d0, \[r0\]
+** bx lr
+*/
+void
+w_m_0 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[0];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** w_m_1:
+** vldr.64 d0, \[r0, #8\]
+** bx lr
+*/
+void
+w_m_1 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[1];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** w_m_127:
+** vldr.64 d0, \[r0, #1016\]
+** bx lr
+*/
+void
+w_m_127 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[127];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** w_m_128:
+** add (r[0-9]+), r0, #1024
+** vldr.64 d0, \[\1\]
+** bx lr
+*/
+void
+w_m_128 (double *r0)
+{
+ register double d0 asm ("d0");
+ d0 = r0[128];
+ asm volatile ("" :: "w" (d0));
+}
+
+/*
+** m_m32_r:
+** sub (r[0-9]+), r0, #256
+** strd r2, \[\1\]
+** bx lr
+*/
+void
+m_m32_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[-32] = r2;
+}
+
+/*
+** m_m31_r:
+** strd r2, \[r0, #-248\]
+** bx lr
+*/
+void
+m_m31_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[-31] = r2;
+}
+
+/*
+** m_m1_r:
+** strd r2, \[r0, #-8\]
+** bx lr
+*/
+void
+m_m1_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[-1] = r2;
+}
+
+/*
+** m_0_r:
+** strd r2, \[r0\]
+** bx lr
+*/
+void
+m_0_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[0] = r2;
+}
+
+/*
+** m_1_r:
+** strd r2, \[r0, #8\]
+** bx lr
+*/
+void
+m_1_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[1] = r2;
+}
+
+/*
+** m_127_r:
+** strd r2, \[r0, #1016\]
+** bx lr
+*/
+void
+m_127_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[127] = r2;
+}
+
+/*
+** m_128_r:
+** add (r[0-9]+), r0, #1024
+** strd r2, \[r0\]
+** bx lr
+*/
+void
+m_128_r (double *r0)
+{
+ register double r2 asm ("r2");
+ asm volatile ("" : "=r" (r2));
+ r0[128] = r2;
+}
+
+/* ??? This could be done in one instruction, but without mve.fp,
+ it makes more sense for memory_operand to enforce the GPR range. */
+/*
+** m_m32_w:
+** sub (r[0-9]+), r0, #256
+** vstr.64 d0, \[\1\]
+** bx lr
+*/
+void
+m_m32_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[-32] = d0;
+}
+
+/*
+** m_m31_w:
+** vstr.64 d0, \[r0, #-248\]
+** bx lr
+*/
+void
+m_m31_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[-31] = d0;
+}
+
+/*
+** m_m1_w:
+** vstr.64 d0, \[r0, #-8\]
+** bx lr
+*/
+void
+m_m1_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[-1] = d0;
+}
+
+/*
+** m_0_w:
+** vstr.64 d0, \[r0\]
+** bx lr
+*/
+void
+m_0_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[0] = d0;
+}
+
+/*
+** m_1_w:
+** vstr.64 d0, \[r0, #8\]
+** bx lr
+*/
+void
+m_1_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[1] = d0;
+}
+
+/*
+** m_127_w:
+** vstr.64 d0, \[r0, #1016\]
+** bx lr
+*/
+void
+m_127_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[127] = d0;
+}
+
+/*
+** m_128_w:
+** add (r[0-9]+), r0, #1024
+** vstr.64 d0, \[\1\]
+** bx lr
+*/
+void
+m_128_w (double *r0)
+{
+ register double d0 asm ("d0");
+ asm volatile ("" : "=w" (d0));
+ r0[128] = d0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-2.c b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-2.c
index 24d0528..f94109c 100644
--- a/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-2.c
+++ b/gcc/testsuite/gcc.target/arm/armv8_2-fp16-arith-2.c
@@ -6,9 +6,9 @@
/* Test instructions generated for half-precision arithmetic without
unsafe-math-optimizations. */
-typedef __fp16 float16_t;
-typedef __simd64_float16_t float16x4_t;
-typedef __simd128_float16_t float16x8_t;
+typedef _Float16 float16_t;
+typedef _Float16 float16x4_t __attribute__ ((vector_size (8)));
+typedef _Float16 float16x8_t __attribute__ ((vector_size (16)));
typedef short int16x4_t __attribute__ ((vector_size (8)));
typedef short int int16x8_t __attribute__ ((vector_size (16)));
@@ -16,7 +16,7 @@ typedef short int int16x8_t __attribute__ ((vector_size (16)));
float16_t
fp16_abs (float16_t a)
{
- return (a < 0) ? -a : a;
+ return __builtin_fabsf16 (a);
}
#define TEST_UNOP(NAME, OPERATOR, TY) \
@@ -89,17 +89,23 @@ TEST_CMP (greaterthanqual, >=, int16x8_t, float16x8_t)
/* { dg-final { scan-assembler-times {vneg\.f16\ts[0-9]+, s[0-9]+} 1 } } */
/* { dg-final { scan-assembler-times {vneg\.f16\td[0-9]+, d[0-9]+} 1 } } */
/* { dg-final { scan-assembler-times {vneg\.f16\tq[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vabs\.f16\ts[0-9]+, s[0-9]+} 2 } } */
+
+/* { dg-final { scan-assembler-times {vadd\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vadd\.f16\td[0-9]+, d[0-9]+, d[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vadd\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+/* { dg-final { scan-assembler-times {vsub\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vsub\.f16\td[0-9]+, d[0-9]+, d[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vsub\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+/* { dg-final { scan-assembler-times {vmul\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmul\.f16\td[0-9]+, d[0-9]+, d[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
-/* { dg-final { scan-assembler-times {vadd\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 13 } } */
-/* { dg-final { scan-assembler-times {vsub\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 13 } } */
-/* { dg-final { scan-assembler-times {vmul\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 13 } } */
/* { dg-final { scan-assembler-times {vdiv\.f16\ts[0-9]+, s[0-9]+, s[0-9]+} 13 } } */
/* { dg-final { scan-assembler-times {vcmp\.f32\ts[0-9]+, s[0-9]+} 26 } } */
-
/* { dg-final { scan-assembler-times {vcmpe\.f32\ts[0-9]+, s[0-9]+} 52 } } */
-/* { dg-final { scan-assembler-times {vcmpe\.f32\ts[0-9]+, #0} 2 } } */
-
-/* { dg-final { scan-assembler-not {vabs\.f16} } } */
/* { dg-final { scan-assembler-not {vadd\.f32} } } */
/* { dg-final { scan-assembler-not {vsub\.f32} } } */
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-hard.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-hard.c
new file mode 100644
index 0000000..b3c7fd0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-hard.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nodsp -mfloat-abi=hard -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler "\.fpu fpv5-d16" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-softfp.c
new file mode 100644
index 0000000..3806554
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-flag-softfp.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nodsp -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler "\.fpu fpv5-d16" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c
new file mode 100644
index 0000000..d22eb4e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nodsp-nofp-flag-softfp.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nodsp+nofp -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler "\.fpu softvfp" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c
new file mode 100644
index 0000000..da1cc25
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-hard.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nofp -mfloat-abi=hard -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler-not "\.fpu" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c
new file mode 100644
index 0000000..0a4fb14
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-flag-softfp.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nofp -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler-not "\.fpu" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c
new file mode 100644
index 0000000..2ae7f34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nofp-nomve-flag-softfp.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nomve+nofp -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler-not "\.fpu" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-hard.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-hard.c
new file mode 100644
index 0000000..a6ccd7b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-hard.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nomve -mfloat-abi=hard -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler "\.fpu fpv5-d16" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-softfp.c
new file mode 100644
index 0000000..2ad976a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve-flag-softfp.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nomve -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler "\.fpu fpv5-d16" } } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c
new file mode 100644
index 0000000..40d54b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-hard.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nomve.fp -mfloat-abi=hard -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler "\.fpu fpv5-d16" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c
new file mode 100644
index 0000000..c726803
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cortex-m55-nomve.fp-flag-softfp.c
@@ -0,0 +1,15 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-additional-options "-mcpu=cortex-m55+nomve.fp -mfloat-abi=softfp -mfpu=auto --save-temps" } */
+/* { dg-final { scan-assembler-not "\.arch_extension mve.fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension mve" } } */
+/* { dg-final { scan-assembler "\.arch_extension dsp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp" } } */
+/* { dg-final { scan-assembler "\.arch_extension fp.dp" } } */
+/* { dg-final { scan-assembler "\.fpu fpv5-d16" } } */
+
+int
+f ()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.target/arm/csinc-1.c b/gcc/testsuite/gcc.target/arm/csinc-1.c
index b992849..255e6e8 100644
--- a/gcc/testsuite/gcc.target/arm/csinc-1.c
+++ b/gcc/testsuite/gcc.target/arm/csinc-1.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_arch_v8_1m_main_ok } */
-/* { dg-options "-O2 -march=armv8.1-m.main" } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8_1m_main } */
int
test_csinc32_condasn1(int w0, int w1, int w2, int w3)
diff --git a/gcc/testsuite/gcc.target/arm/csinv-1.c b/gcc/testsuite/gcc.target/arm/csinv-1.c
index 6b5383a..28450a4 100644
--- a/gcc/testsuite/gcc.target/arm/csinv-1.c
+++ b/gcc/testsuite/gcc.target/arm/csinv-1.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_arch_v8_1m_main_ok } */
-/* { dg-options "-O2 -march=armv8.1-m.main" } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8_1m_main } */
int
test_csinv32_condasn1(int w0, int w1, int w2, int w3)
diff --git a/gcc/testsuite/gcc.target/arm/csneg.c b/gcc/testsuite/gcc.target/arm/csneg.c
index e486062..cf3df13 100644
--- a/gcc/testsuite/gcc.target/arm/csneg.c
+++ b/gcc/testsuite/gcc.target/arm/csneg.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_arch_v8_1m_main_ok } */
-/* { dg-options "-O2 -march=armv8.1-m.main" } */
+/* { dg-options "-O2" } */
+/* { dg-add-options arm_arch_v8_1m_main } */
int
test_csneg32_condasn1(int w0, int w1, int w2, int w3)
diff --git a/gcc/testsuite/gcc.target/arm/lob1.c b/gcc/testsuite/gcc.target/arm/lob1.c
index b92dc55..ba5c82c 100644
--- a/gcc/testsuite/gcc.target/arm/lob1.c
+++ b/gcc/testsuite/gcc.target/arm/lob1.c
@@ -3,7 +3,7 @@
/* { dg-do run } */
/* { dg-require-effective-target arm_v8_1_lob_ok } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */
-/* { dg-options "-march=armv8.1-m.main -O3 --save-temps" } */
+/* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps" } */
#include <stdlib.h>
#include "lob.h"
diff --git a/gcc/testsuite/gcc.target/arm/lob2.c b/gcc/testsuite/gcc.target/arm/lob2.c
index 1fe9a9d..fdeb268 100644
--- a/gcc/testsuite/gcc.target/arm/lob2.c
+++ b/gcc/testsuite/gcc.target/arm/lob2.c
@@ -2,7 +2,7 @@
if a non-inlineable function call takes place inside the loop. */
/* { dg-do compile } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */
-/* { dg-options "-march=armv8.1-m.main -O3 --save-temps" } */
+/* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps" } */
#include <stdlib.h>
#include "lob.h"
diff --git a/gcc/testsuite/gcc.target/arm/lob3.c b/gcc/testsuite/gcc.target/arm/lob3.c
index 17cba00..70314ea 100644
--- a/gcc/testsuite/gcc.target/arm/lob3.c
+++ b/gcc/testsuite/gcc.target/arm/lob3.c
@@ -2,7 +2,7 @@
if causes VFP emulation library calls to happen inside the loop. */
/* { dg-do compile } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */
-/* { dg-options "-march=armv8.1-m.main -O3 --save-temps -mfloat-abi=soft" } */
+/* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps -mfloat-abi=soft" } */
/* { dg-require-effective-target arm_softfloat } */
#include <stdlib.h>
#include "lob.h"
diff --git a/gcc/testsuite/gcc.target/arm/lob4.c b/gcc/testsuite/gcc.target/arm/lob4.c
index 444a2c7..792f352 100644
--- a/gcc/testsuite/gcc.target/arm/lob4.c
+++ b/gcc/testsuite/gcc.target/arm/lob4.c
@@ -2,7 +2,7 @@
if LR is modified within the loop. */
/* { dg-do compile } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */
-/* { dg-options "-march=armv8.1-m.main -O3 --save-temps -mfloat-abi=soft" } */
+/* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps -mfloat-abi=soft" } */
/* { dg-require-effective-target arm_softfloat } */
#include <stdlib.h>
#include "lob.h"
diff --git a/gcc/testsuite/gcc.target/arm/lob5.c b/gcc/testsuite/gcc.target/arm/lob5.c
index c4f46e4..1a6adf1 100644
--- a/gcc/testsuite/gcc.target/arm/lob5.c
+++ b/gcc/testsuite/gcc.target/arm/lob5.c
@@ -3,7 +3,7 @@
therefore is not optimizable. Outer loops are not optimized. */
/* { dg-do compile } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */
-/* { dg-options "-march=armv8.1-m.main -O3 --save-temps" } */
+/* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps" } */
#include <stdlib.h>
#include "lob.h"
diff --git a/gcc/testsuite/gcc.target/arm/lob6.c b/gcc/testsuite/gcc.target/arm/lob6.c
index 5612676..17b6124 100644
--- a/gcc/testsuite/gcc.target/arm/lob6.c
+++ b/gcc/testsuite/gcc.target/arm/lob6.c
@@ -3,7 +3,7 @@
/* { dg-do run } */
/* { dg-require-effective-target arm_v8_1_lob_ok } */
/* { dg-skip-if "avoid conflicting multilib options" { *-*-* } { "-marm" "-mcpu=*" } } */
-/* { dg-options "-march=armv8.1-m.main -O3 --save-temps" } */
+/* { dg-options "-march=armv8.1-m.main -mthumb -O3 --save-temps" } */
#include <stdlib.h>
#include "lob.h"
diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp
index c5f3c02..6aba29e 100644
--- a/gcc/testsuite/gcc.target/arm/multilib.exp
+++ b/gcc/testsuite/gcc.target/arm/multilib.exp
@@ -824,6 +824,22 @@ if {[multilib_config "rmprofile"] } {
{-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
{-march=armv8.1-m.main+mve+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
{-march=armv8.1-m.main+mve.fp+fp.dp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-mcpu=cortex-m55+nomve -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-mcpu=cortex-m55+nomve.fp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nomve.fp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-mcpu=cortex-m55+nomve.fp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-mcpu=cortex-m55+nofp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nofp -mfpu=auto -mfloat-abi=hard} "thumb/v8.1-m.main+mve/hard"
+ {-mcpu=cortex-m55+nodsp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nodsp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main+dp/softfp"
+ {-mcpu=cortex-m55+nodsp -mfpu=auto -mfloat-abi=hard} "thumb/v8-m.main+dp/hard"
+ {-mcpu=cortex-m55+nomve+nofp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nomve+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nodsp+nofp -mfpu=auto -mfloat-abi=soft} "thumb/v8-m.main/nofp"
+ {-mcpu=cortex-m55+nodsp+nofp -mfpu=auto -mfloat-abi=softfp} "thumb/v8-m.main/nofp"
} {
check_multi_dir $opts $dir
}
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c
index 0a69ace..50b1953 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve-vldstr16-no-writeback.c
@@ -13,5 +13,6 @@ fn1 (__fp16 *pSrc)
pDst[i] = high;
}
-/* { dg-final { scan-assembler {vldr\.16\ts[0-9]+, \[r[0-9]+\]\n} } } */
-/* { dg-final { scan-assembler {vstr\.16\ts[0-9]+, \[r[0-9]+\]\n} } } */
+/* { dg-final { scan-assembler {vldr\.16\ts[0-9]+, \[r[0-9]+(, #-?[0-9]+)?\]\n} } } */
+/* { dg-final { scan-assembler-not {vldr\.16\t[^\n]*\]!} } } */
+/* { dg-final { scan-assembler-not {vstr\.16\t[^\n]*\]!} } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fp_vaddq_n.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fp_vaddq_n.c
new file mode 100644
index 0000000..714fbf9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_fp_vaddq_n.c
@@ -0,0 +1,47 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include <arm_mve.h>
+int8x16_t foo (int8x16_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+int16x8_t foo1 (int16x8_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+int32x4_t foo2 (int32x4_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+uint8x16_t foo3 (uint8x16_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+uint16x8_t foo4 (uint16x8_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+uint32x4_t foo5 (uint32x4_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+float16x8_t foo6 (float16x8_t a)
+{
+ return vaddq (a, (float16_t)23.6);
+}
+float32x4_t foo7 (float32x4_t a)
+{
+ return vaddq (a, (float32_t)23.46);
+}
+float16x8_t foo8 (float16x8_t a)
+{
+ return vaddq (a, 23.6);
+}
+float32x4_t foo9 (float32x4_t a)
+{
+ return vaddq (a, 23.46);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vaddq_n.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vaddq_n.c
new file mode 100644
index 0000000..baa7fab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vaddq_n.c
@@ -0,0 +1,31 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include <arm_mve.h>
+int8x16_t foo (int8x16_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+int16x8_t foo1 (int16x8_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+int32x4_t foo2 (int32x4_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+uint8x16_t foo3 (uint8x16_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+uint16x8_t foo4 (uint16x8_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+uint32x4_t foo5 (uint32x4_t a, int16_t b)
+{
+ return vaddq (a, (b<<3));
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c
new file mode 100644
index 0000000..8f6d360
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c
@@ -0,0 +1,8 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=hard" } { "" } } */
+/* { dg-additional-options "-mcpu=cortex-m55 -mfloat-abi=soft -mfpu=auto -Werror" } */
+
+int main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f16-1.c
new file mode 100644
index 0000000..8348098
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t inactive, float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vaddq_m (inactive, a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f32-1.c
new file mode 100644
index 0000000..c34cc98
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t inactive, float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vaddq_m (inactive, a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f16-1.c
new file mode 100644
index 0000000..3bb0167
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vaddq_x (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f32-1.c
new file mode 100644
index 0000000..66dedc7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vaddq_x_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vaddq_x (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f16-1.c
new file mode 100644
index 0000000..909ca93
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vcmpeqq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f32-1.c
new file mode 100644
index 0000000..8f993af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vcmpeqq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16-1.c
new file mode 100644
index 0000000..223cffc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vcmpeqq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f32-1.c
new file mode 100644
index 0000000..81669bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpeqq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vcmpeqq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f16-1.c
new file mode 100644
index 0000000..4a4e4b3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vcmpgeq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f32-1.c
new file mode 100644
index 0000000..c406a63
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vcmpgeq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f16-1.c
new file mode 100644
index 0000000..a65ed44
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vcmpgeq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f32-1.c
new file mode 100644
index 0000000..2e2fc01
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgeq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vcmpgeq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f16-1.c
new file mode 100644
index 0000000..08c91a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vcmpgtq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f32-1.c
new file mode 100644
index 0000000..0b74482
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vcmpgtq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f16-1.c
new file mode 100644
index 0000000..3b2faea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vcmpgtq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f32-1.c
new file mode 100644
index 0000000..16862e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpgtq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vcmpgtq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f16-1.c
new file mode 100644
index 0000000..50e53bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vcmpleq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f32-1.c
new file mode 100644
index 0000000..b16da27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vcmpleq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f16-1.c
new file mode 100644
index 0000000..4a4b973
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vcmpleq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f32-1.c
new file mode 100644
index 0000000..8d8f105
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpleq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vcmpleq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f16-1.c
new file mode 100644
index 0000000..62ab53f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vcmpltq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f32-1.c
new file mode 100644
index 0000000..55886fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vcmpltq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f16-1.c
new file mode 100644
index 0000000..cd95dae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vcmpltq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f32-1.c
new file mode 100644
index 0000000..db76687
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpltq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vcmpltq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f16-1.c
new file mode 100644
index 0000000..30618e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vcmpneq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f32-1.c
new file mode 100644
index 0000000..4ecfda6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vcmpneq_m (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f16-1.c
new file mode 100644
index 0000000..75a0090
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vcmpneq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f32-1.c
new file mode 100644
index 0000000..11ae14c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcmpneq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+mve_pred16_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vcmpneq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcvtnq_u32_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcvtnq_u32_f32.c
new file mode 100644
index 0000000..b6d5eb9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vcvtnq_u32_f32.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+uint32x4_t
+foo (float32x4_t a)
+{
+ return vcvtnq_u32_f32 (a);
+}
+
+/* { dg-final { scan-assembler "vcvtn.u32.f32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f16-1.c
new file mode 100644
index 0000000..e47ae6d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16x8_t b, float16_t c, mve_pred16_t p)
+{
+ return vfmaq_m (a, b, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f32-1.c
new file mode 100644
index 0000000..78c39f0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32x4_t b, float32_t c, mve_pred16_t p)
+{
+ return vfmaq_m (a, b, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f16-1.c
new file mode 100644
index 0000000..f7867f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16x8_t b, float16_t c)
+{
+ return vfmaq (a, b, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f32-1.c
new file mode 100644
index 0000000..f0bc45b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmaq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32x4_t b, float32_t c)
+{
+ return vfmaq (a, b, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f16-1.c
new file mode 100644
index 0000000..4750e10
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16x8_t b, float16_t c, mve_pred16_t p)
+{
+ return vfmasq_m (a, b, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f32-1.c
new file mode 100644
index 0000000..4a37971
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32x4_t b, float32_t c, mve_pred16_t p)
+{
+ return vfmasq_m (a, b, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f16-1.c
new file mode 100644
index 0000000..db82451
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16x8_t b, float16_t c)
+{
+ return vfmasq (a, b, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f32-1.c
new file mode 100644
index 0000000..12b1410
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vfmasq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32x4_t b, float32_t c)
+{
+ return vfmasq (a, b, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s16.c
index 02e0227..74ffad4 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, int16x8_t b, mve_pred16_t p)
return vmaxavq_p_s16 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxavt.s16" } } */
uint16_t
foo1 (uint16_t a, int16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, int16x8_t b, mve_pred16_t p)
return vmaxavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxavt.s16" } } */
+
+int16_t
+foo2 (uint8_t a, int16x8_t b, mve_pred16_t p)
+{
+ return vmaxavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxavt.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s32.c
index 7ecd94a..40800b0 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, int32x4_t b, mve_pred16_t p)
return vmaxavq_p_s32 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxavt.s32" } } */
uint32_t
foo1 (uint32_t a, int32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, int32x4_t b, mve_pred16_t p)
return vmaxavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxavt.s32" } } */
+
+int32_t
+foo2 (uint16_t a, int32x4_t b, mve_pred16_t p)
+{
+ return vmaxavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxavt.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s8.c
index 7a21de7..7638737 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_p_s8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, int8x16_t b, mve_pred16_t p)
return vmaxavq_p_s8 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxavt.s8" } } */
uint8_t
foo1 (uint8_t a, int8x16_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, int8x16_t b, mve_pred16_t p)
return vmaxavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxavt.s8" } } */
+
+int8_t
+foo2 (uint32_t a, int8x16_t b, mve_pred16_t p)
+{
+ return vmaxavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxavt.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s16.c
index 4621eba..0dca149 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, int16x8_t b)
return vmaxavq_s16 (a, b);
}
-/* { dg-final { scan-assembler "vmaxav.s16" } } */
uint16_t
foo1 (uint16_t a, int16x8_t b)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, int16x8_t b)
return vmaxavq (a, b);
}
-/* { dg-final { scan-assembler "vmaxav.s16" } } */
+
+int16_t
+foo2 (uint8_t a, int16x8_t b)
+{
+ return vmaxavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxav.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s32.c
index 8813d9d..f419a77 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, int32x4_t b)
return vmaxavq_s32 (a, b);
}
-/* { dg-final { scan-assembler "vmaxav.s32" } } */
uint32_t
foo1 (uint32_t a, int32x4_t b)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, int32x4_t b)
return vmaxavq (a, b);
}
-/* { dg-final { scan-assembler "vmaxav.s32" } } */
+
+int32_t
+foo2 (uint16_t a, int32x4_t b)
+{
+ return vmaxavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxav.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s8.c
index 961f1d2..214ad88 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxavq_s8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, int8x16_t b)
return vmaxavq_s8 (a, b);
}
-/* { dg-final { scan-assembler "vmaxav.s8" } } */
uint8_t
foo1 (uint8_t a, int8x16_t b)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, int8x16_t b)
return vmaxavq (a, b);
}
-/* { dg-final { scan-assembler "vmaxav.s8" } } */
+
+int8_t
+foo2 (uint32_t a, int8x16_t b)
+{
+ return vmaxavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxav.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16-1.c
new file mode 100644
index 0000000..7c2349d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b)
+{
+ return vmaxnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16.c
index de48ea8..6d8cf19 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b)
return vmaxnmavq_f16 (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmav.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b)
return vmaxnmavq (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmav.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b)
+{
+ return vmaxnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmav.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32-1.c
new file mode 100644
index 0000000..0deef7948
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b)
+{
+ return vmaxnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32.c
index b4c7f83..ef79030 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b)
return vmaxnmavq_f32 (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmav.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b)
return vmaxnmavq (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmav.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b)
+{
+ return vmaxnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmav.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16-1.c
new file mode 100644
index 0000000..56a7ac0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vmaxnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16.c
index 9c2eed0..f7f39f5 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b, mve_pred16_t p)
return vmaxnmavq_p_f16 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmavt.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
return vmaxnmavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmavt.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vmaxnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmavt.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32-1.c
new file mode 100644
index 0000000..36c10a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vmaxnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32.c
index 1cadccb..341f625 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmavq_p_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b, mve_pred16_t p)
return vmaxnmavq_p_f32 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmavt.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
return vmaxnmavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmavt.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vmaxnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmavt.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16-1.c
new file mode 100644
index 0000000..f60641f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b)
+{
+ return vmaxnmvq (23.35, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16.c
index 81f4b9b..80bd1d4 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b)
return vmaxnmvq_f16 (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmv.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b)
return vmaxnmvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmv.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b)
+{
+ return vmaxnmvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmv.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32-1.c
new file mode 100644
index 0000000..f8c9f44
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b)
+{
+ return vmaxnmvq (34.56, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32.c
index ab06c2b..bb2fc46 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b)
return vmaxnmvq_f32 (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmv.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b)
return vmaxnmvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxnmv.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b)
+{
+ return vmaxnmvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmv.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16-1.c
new file mode 100644
index 0000000..96820ec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vmaxnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16.c
index e37c5a1..3efe203 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b, mve_pred16_t p)
return vmaxnmvq_p_f16 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmvt.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
return vmaxnmvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmvt.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vmaxnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmvt.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32-1.c
new file mode 100644
index 0000000..826ee8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vmaxnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32.c
index 884cd45..6c13247 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxnmvq_p_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b, mve_pred16_t p)
return vmaxnmvq_p_f32 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmvt.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
return vmaxnmvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxnmvt.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vmaxnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxnmvt.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s16.c
index 79de370..657efc5 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s16.c
@@ -10,7 +10,6 @@ foo (int16_t a, int16x8_t b, mve_pred16_t p)
return vmaxvq_p_s16 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.s16" } } */
int16_t
foo1 (int16_t a, int16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (int16_t a, int16x8_t b, mve_pred16_t p)
return vmaxvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.s16" } } */
+
+int16_t
+foo2 (int8_t a, int16x8_t b, mve_pred16_t p)
+{
+ return vmaxvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxvt.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s32.c
index e526744..5882351 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s32.c
@@ -10,7 +10,6 @@ foo (int32_t a, int32x4_t b, mve_pred16_t p)
return vmaxvq_p_s32 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.s32" } } */
int32_t
foo1 (int32_t a, int32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (int32_t a, int32x4_t b, mve_pred16_t p)
return vmaxvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.s32" } } */
+
+int32_t
+foo2 (int16_t a, int32x4_t b, mve_pred16_t p)
+{
+ return vmaxvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxvt.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s8.c
index d3cedd4..3737ecd 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_s8.c
@@ -10,7 +10,6 @@ foo (int8_t a, int8x16_t b, mve_pred16_t p)
return vmaxvq_p_s8 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.s8" } } */
int8_t
foo1 (int8_t a, int8x16_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (int8_t a, int8x16_t b, mve_pred16_t p)
return vmaxvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.s8" } } */
+
+int8_t
+foo2 (int32_t a, int8x16_t b, mve_pred16_t p)
+{
+ return vmaxvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxvt.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u16.c
index 79572f7..348cf39 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, uint16x8_t b, mve_pred16_t p)
return vmaxvq_p_u16 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.u16" } } */
uint16_t
foo1 (uint16_t a, uint16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, uint16x8_t b, mve_pred16_t p)
return vmaxvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.u16" } } */
+
+uint16_t
+foo2 (uint32_t a, uint16x8_t b, mve_pred16_t p)
+{
+ return vmaxvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxvt.u16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u32.c
index e2f7a6f..f2e9762 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, uint32x4_t b, mve_pred16_t p)
return vmaxvq_p_u32 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.u32" } } */
uint32_t
foo1 (uint32_t a, uint32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, uint32x4_t b, mve_pred16_t p)
return vmaxvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.u32" } } */
+
+uint32_t
+foo2 (uint8_t a, uint32x4_t b, mve_pred16_t p)
+{
+ return vmaxvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxvt.u32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u8.c
index f977806..7df5b63 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_p_u8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, uint8x16_t b, mve_pred16_t p)
return vmaxvq_p_u8 (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.u8" } } */
uint8_t
foo1 (uint8_t a, uint8x16_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, uint8x16_t b, mve_pred16_t p)
return vmaxvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vmaxvt.u8" } } */
+
+uint8_t
+foo2 (uint16_t a, uint8x16_t b, mve_pred16_t p)
+{
+ return vmaxvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxvt.u8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s16.c
index 90f10b5..8412452 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s16.c
@@ -10,7 +10,6 @@ foo (int16_t a, int16x8_t b)
return vmaxvq_s16 (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.s16" } } */
int16_t
foo1 (int16_t a, int16x8_t b)
@@ -18,4 +17,12 @@ foo1 (int16_t a, int16x8_t b)
return vmaxvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.s16" } } */
+
+int16_t
+foo2 (int8_t a, int16x8_t b)
+{
+ return vmaxvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxv.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s32.c
index aa0e88b..09f4909 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s32.c
@@ -10,7 +10,6 @@ foo (int32_t a, int32x4_t b)
return vmaxvq_s32 (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.s32" } } */
int32_t
foo1 (int32_t a, int32x4_t b)
@@ -18,4 +17,12 @@ foo1 (int32_t a, int32x4_t b)
return vmaxvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.s32" } } */
+
+int32_t
+foo2 (int16_t a, int32x4_t b)
+{
+ return vmaxvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxv.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s8.c
index 884b84d..a087bbc 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_s8.c
@@ -10,7 +10,6 @@ foo (int8_t a, int8x16_t b)
return vmaxvq_s8 (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.s8" } } */
int8_t
foo1 (int8_t a, int8x16_t b)
@@ -18,4 +17,12 @@ foo1 (int8_t a, int8x16_t b)
return vmaxvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.s8" } } */
+
+int8_t
+foo2 (int32_t a, int8x16_t b)
+{
+ return vmaxvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxv.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u16.c
index 2813ebd..47fe0d1 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, uint16x8_t b)
return vmaxvq_u16 (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.u16" } } */
uint16_t
foo1 (uint16_t a, uint16x8_t b)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, uint16x8_t b)
return vmaxvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.u16" } } */
+
+uint16_t
+foo2 (uint32_t a, uint16x8_t b)
+{
+ return vmaxvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxv.u16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u32.c
index ab51b1e..aa723da 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, uint32x4_t b)
return vmaxvq_u32 (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.u32" } } */
uint32_t
foo1 (uint32_t a, uint32x4_t b)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, uint32x4_t b)
return vmaxvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.u32" } } */
+
+uint32_t
+foo2 (uint8_t a, uint32x4_t b)
+{
+ return vmaxvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxv.u32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u8.c
index 3326cfb..3aae785 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmaxvq_u8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, uint8x16_t b)
return vmaxvq_u8 (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.u8" } } */
uint8_t
foo1 (uint8_t a, uint8x16_t b)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, uint8x16_t b)
return vmaxvq (a, b);
}
-/* { dg-final { scan-assembler "vmaxv.u8" } } */
+
+uint8_t
+foo2 (uint16_t a, uint8x16_t b)
+{
+ return vmaxvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vmaxv.u8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s16.c
index 6b87648..9303ae0 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, int16x8_t b, mve_pred16_t p)
return vminavq_p_s16 (a, b, p);
}
-/* { dg-final { scan-assembler "vminavt.s16" } } */
uint16_t
foo1 (uint16_t a, int16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, int16x8_t b, mve_pred16_t p)
return vminavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminavt.s16" } } */
+
+int16_t
+foo2 (uint8_t a, int16x8_t b, mve_pred16_t p)
+{
+ return vminavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminavt.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s32.c
index 086ff56..36247f6 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, int32x4_t b, mve_pred16_t p)
return vminavq_p_s32 (a, b, p);
}
-/* { dg-final { scan-assembler "vminavt.s32" } } */
uint32_t
foo1 (uint32_t a, int32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, int32x4_t b, mve_pred16_t p)
return vminavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminavt.s32" } } */
+
+int32_t
+foo2 (uint16_t a, int32x4_t b, mve_pred16_t p)
+{
+ return vminavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminavt.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s8.c
index 999c11c..d336161 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_p_s8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, int8x16_t b, mve_pred16_t p)
return vminavq_p_s8 (a, b, p);
}
-/* { dg-final { scan-assembler "vminavt.s8" } } */
uint8_t
foo1 (uint8_t a, int8x16_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, int8x16_t b, mve_pred16_t p)
return vminavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminavt.s8" } } */
+
+int8_t
+foo2 (uint32_t a, int8x16_t b, mve_pred16_t p)
+{
+ return vminavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminavt.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s16.c
index a626e31..17e4edc 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, int16x8_t b)
return vminavq_s16 (a, b);
}
-/* { dg-final { scan-assembler "vminav.s16" } } */
uint16_t
foo1 (uint16_t a, int16x8_t b)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, int16x8_t b)
return vminavq (a, b);
}
-/* { dg-final { scan-assembler "vminav.s16" } } */
+
+int16_t
+foo2 (uint8_t a, int16x8_t b)
+{
+ return vminavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminav.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s32.c
index be575cb..032d02b 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, int32x4_t b)
return vminavq_s32 (a, b);
}
-/* { dg-final { scan-assembler "vminav.s32" } } */
uint32_t
foo1 (uint32_t a, int32x4_t b)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, int32x4_t b)
return vminavq (a, b);
}
-/* { dg-final { scan-assembler "vminav.s32" } } */
+
+int32_t
+foo2 (uint16_t a, int32x4_t b)
+{
+ return vminavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminav.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s8.c
index c3dfe4b..2a2bb3d6 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminavq_s8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, int8x16_t b)
return vminavq_s8 (a, b);
}
-/* { dg-final { scan-assembler "vminav.s8" } } */
uint8_t
foo1 (uint8_t a, int8x16_t b)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, int8x16_t b)
return vminavq (a, b);
}
-/* { dg-final { scan-assembler "vminav.s8" } } */
+
+int8_t
+foo2 (uint32_t a, int8x16_t b)
+{
+ return vminavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminav.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16-1.c
new file mode 100644
index 0000000..37d5136
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b)
+{
+ return vminnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16.c
index 2111681..fadb23e 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b)
return vminnmavq_f16 (a, b);
}
-/* { dg-final { scan-assembler "vminnmav.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b)
return vminnmavq (a, b);
}
-/* { dg-final { scan-assembler "vminnmav.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b)
+{
+ return vminnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmav.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32-1.c
new file mode 100644
index 0000000..78978d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b)
+{
+ return vminnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32.c
index bd87b85..84714a9 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b)
return vminnmavq_f32 (a, b);
}
-/* { dg-final { scan-assembler "vminnmav.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b)
return vminnmavq (a, b);
}
-/* { dg-final { scan-assembler "vminnmav.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b)
+{
+ return vminnmavq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmav.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16-1.c
new file mode 100644
index 0000000..7170b74
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vminnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16.c
index e6d0bb5..c79fa30 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b, mve_pred16_t p)
return vminnmavq_p_f16 (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmavt.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
return vminnmavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmavt.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vminnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmavt.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32-1.c
new file mode 100644
index 0000000..0955905
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vminnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32.c
index 6b56b67..bea04c7 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmavq_p_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b, mve_pred16_t p)
return vminnmavq_p_f32 (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmavt.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
return vminnmavq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmavt.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vminnmavq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmavt.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16-1.c
new file mode 100644
index 0000000..132d1a1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b)
+{
+ return vminnmvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16.c
index 4d4caae..0eb3a4a 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b)
return vminnmvq_f16 (a, b);
}
-/* { dg-final { scan-assembler "vminnmv.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b)
return vminnmvq (a, b);
}
-/* { dg-final { scan-assembler "vminnmv.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b)
+{
+ return vminnmvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmv.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32-1.c
new file mode 100644
index 0000000..7490907
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b)
+{
+ return vminnmvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32.c
index dab04d9..f318350 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b)
return vminnmvq_f32 (a, b);
}
-/* { dg-final { scan-assembler "vminnmv.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b)
return vminnmvq (a, b);
}
-/* { dg-final { scan-assembler "vminnmv.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b)
+{
+ return vminnmvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmv.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16-1.c
new file mode 100644
index 0000000..c88c3b7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16_t
+foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vminnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16.c
index f5eafb1..16f6ac5 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f16.c
@@ -10,7 +10,6 @@ foo (float16_t a, float16x8_t b, mve_pred16_t p)
return vminnmvq_p_f16 (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmvt.f16" } } */
float16_t
foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float16_t a, float16x8_t b, mve_pred16_t p)
return vminnmvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmvt.f16" } } */
+
+float16_t
+foo2 (float32_t a, float16x8_t b, mve_pred16_t p)
+{
+ return vminnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmvt.f16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32-1.c
new file mode 100644
index 0000000..e4db972
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32_t
+foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vminnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32.c
index 5ac20bf..a8e4f9f 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminnmvq_p_f32.c
@@ -10,7 +10,6 @@ foo (float32_t a, float32x4_t b, mve_pred16_t p)
return vminnmvq_p_f32 (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmvt.f32" } } */
float32_t
foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (float32_t a, float32x4_t b, mve_pred16_t p)
return vminnmvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminnmvt.f32" } } */
+
+float32_t
+foo2 (float16_t a, float32x4_t b, mve_pred16_t p)
+{
+ return vminnmvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminnmvt.f32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s16.c
index c2edb62..91bb63f 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s16.c
@@ -10,7 +10,6 @@ foo (int16_t a, int16x8_t b, mve_pred16_t p)
return vminvq_p_s16 (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.s16" } } */
int16_t
foo1 (int16_t a, int16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (int16_t a, int16x8_t b, mve_pred16_t p)
return vminvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.s16" } } */
+
+int16_t
+foo2 (int8_t a, int16x8_t b, mve_pred16_t p)
+{
+ return vminvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminvt.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s32.c
index ba89217..a846701 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s32.c
@@ -10,7 +10,6 @@ foo (int32_t a, int32x4_t b, mve_pred16_t p)
return vminvq_p_s32 (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.s32" } } */
int32_t
foo1 (int32_t a, int32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (int32_t a, int32x4_t b, mve_pred16_t p)
return vminvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.s32" } } */
+
+int32_t
+foo2 (int16_t a, int32x4_t b, mve_pred16_t p)
+{
+ return vminvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminvt.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s8.c
index 1665c53..716d414 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_s8.c
@@ -10,7 +10,6 @@ foo (int8_t a, int8x16_t b, mve_pred16_t p)
return vminvq_p_s8 (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.s8" } } */
int8_t
foo1 (int8_t a, int8x16_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (int8_t a, int8x16_t b, mve_pred16_t p)
return vminvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.s8" } } */
+
+int8_t
+foo2 (int32_t a, int8x16_t b, mve_pred16_t p)
+{
+ return vminvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminvt.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u16.c
index 5bade0a..cc7f8fe 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, uint16x8_t b, mve_pred16_t p)
return vminvq_p_u16 (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.u16" } } */
uint16_t
foo1 (uint16_t a, uint16x8_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, uint16x8_t b, mve_pred16_t p)
return vminvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.u16" } } */
+
+uint16_t
+foo2 (uint32_t a, uint16x8_t b, mve_pred16_t p)
+{
+ return vminvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminvt.u16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u32.c
index c4c5748..6bde0be 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, uint32x4_t b, mve_pred16_t p)
return vminvq_p_u32 (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.u32" } } */
uint32_t
foo1 (uint32_t a, uint32x4_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint32_t a, uint32x4_t b, mve_pred16_t p)
return vminvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.u32" } } */
+
+uint32_t
+foo2 (uint8_t a, uint32x4_t b, mve_pred16_t p)
+{
+ return vminvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminvt.u32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u8.c
index dc890dc..bb89490 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_p_u8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, uint8x16_t b, mve_pred16_t p)
return vminvq_p_u8 (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.u8" } } */
uint8_t
foo1 (uint8_t a, uint8x16_t b, mve_pred16_t p)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, uint8x16_t b, mve_pred16_t p)
return vminvq_p (a, b, p);
}
-/* { dg-final { scan-assembler "vminvt.u8" } } */
+
+uint8_t
+foo2 (uint16_t a, uint8x16_t b, mve_pred16_t p)
+{
+ return vminvq_p (a, b, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminvt.u8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s16.c
index f6eed63..6d589aa 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s16.c
@@ -10,7 +10,6 @@ foo (int16_t a, int16x8_t b)
return vminvq_s16 (a, b);
}
-/* { dg-final { scan-assembler "vminv.s16" } } */
int16_t
foo1 (int16_t a, int16x8_t b)
@@ -18,4 +17,11 @@ foo1 (int16_t a, int16x8_t b)
return vminvq (a, b);
}
-/* { dg-final { scan-assembler "vminv.s16" } } */
+int16_t
+foo2 (int8_t a, int16x8_t b)
+{
+ return vminvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminv.s16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s32.c
index 4077c32..7c727d6 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s32.c
@@ -10,7 +10,6 @@ foo (int32_t a, int32x4_t b)
return vminvq_s32 (a, b);
}
-/* { dg-final { scan-assembler "vminv.s32" } } */
int32_t
foo1 (int32_t a, int32x4_t b)
@@ -18,4 +17,11 @@ foo1 (int32_t a, int32x4_t b)
return vminvq (a, b);
}
-/* { dg-final { scan-assembler "vminv.s32" } } */
+int32_t
+foo2 (int8_t a, int32x4_t b)
+{
+ return vminvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminv.s32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s8.c
index bdf15f4..7630948 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_s8.c
@@ -10,7 +10,6 @@ foo (int8_t a, int8x16_t b)
return vminvq_s8 (a, b);
}
-/* { dg-final { scan-assembler "vminv.s8" } } */
int8_t
foo1 (int8_t a, int8x16_t b)
@@ -18,4 +17,11 @@ foo1 (int8_t a, int8x16_t b)
return vminvq (a, b);
}
-/* { dg-final { scan-assembler "vminv.s8" } } */
+int8_t
+foo2 (int32_t a, int8x16_t b)
+{
+ return vminvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminv.s8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u16.c
index 5c0935c..698975f 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u16.c
@@ -10,7 +10,6 @@ foo (uint16_t a, uint16x8_t b)
return vminvq_u16 (a, b);
}
-/* { dg-final { scan-assembler "vminv.u16" } } */
uint16_t
foo1 (uint16_t a, uint16x8_t b)
@@ -18,4 +17,12 @@ foo1 (uint16_t a, uint16x8_t b)
return vminvq (a, b);
}
-/* { dg-final { scan-assembler "vminv.u16" } } */
+
+uint8_t
+foo2 (uint32_t a, uint16x8_t b)
+{
+ return vminvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminv.u16" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u32.c
index 1580c87..7489f81 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u32.c
@@ -10,7 +10,6 @@ foo (uint32_t a, uint32x4_t b)
return vminvq_u32 (a, b);
}
-/* { dg-final { scan-assembler "vminv.u32" } } */
uint32_t
foo1 (uint32_t a, uint32x4_t b)
@@ -18,4 +17,11 @@ foo1 (uint32_t a, uint32x4_t b)
return vminvq (a, b);
}
-/* { dg-final { scan-assembler "vminv.u32" } } */
+uint32_t
+foo2 (uint16_t a, uint32x4_t b)
+{
+ return vminvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminv.u32" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u8.c
index 95919b4..aa2b986 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vminvq_u8.c
@@ -10,7 +10,6 @@ foo (uint8_t a, uint8x16_t b)
return vminvq_u8 (a, b);
}
-/* { dg-final { scan-assembler "vminv.u8" } } */
uint8_t
foo1 (uint8_t a, uint8x16_t b)
@@ -18,4 +17,12 @@ foo1 (uint8_t a, uint8x16_t b)
return vminvq (a, b);
}
-/* { dg-final { scan-assembler "vminv.u8" } } */
+
+uint16_t
+foo2 (uint32_t a, uint8x16_t b)
+{
+ return vminvq (a, b);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
+/* { dg-final { scan-assembler-times "vminv.u8" 3 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u16.c
deleted file mode 100644
index 704d0e7..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u16.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint64_t
-foo (uint64_t a, uint16x8_t b, uint16x8_t c, mve_pred16_t p)
-{
- return vmlaldavaxq_p_u16 (a, b, c, p);
-}
-
-/* { dg-final { scan-assembler "vmlaldavaxt.u16" } } */
-
-uint64_t
-foo1 (uint64_t a, uint16x8_t b, uint16x8_t c, mve_pred16_t p)
-{
- return vmlaldavaxq_p (a, b, c, p);
-}
-
-/* { dg-final { scan-assembler "vmlaldavaxt.u16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u32.c
deleted file mode 100644
index 84dca18..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmlaldavaxq_p_u32.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint64_t
-foo (uint64_t a, uint32x4_t b, uint32x4_t c, mve_pred16_t p)
-{
- return vmlaldavaxq_p_u32 (a, b, c, p);
-}
-
-/* { dg-final { scan-assembler "vmlaldavaxt.u32" } } */
-
-uint64_t
-foo1 (uint64_t a, uint32x4_t b, uint32x4_t c, mve_pred16_t p)
-{
- return vmlaldavaxq_p (a, b, c, p);
-}
-
-/* { dg-final { scan-assembler "vmlaldavaxt.u32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f16-1.c
new file mode 100644
index 0000000..c8222c5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t inactive, float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vmulq_m (inactive, a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f32-1.c
new file mode 100644
index 0000000..2fae3a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t inactive, float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vmulq_m (inactive, a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f16-1.c
new file mode 100644
index 0000000..cef311d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vmulq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f32-1.c
new file mode 100644
index 0000000..d6d4b9a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vmulq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f16-1.c
new file mode 100644
index 0000000..ea4cab0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vmulq_x (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f32-1.c
new file mode 100644
index 0000000..a7a54c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vmulq_x_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vmulq_x (a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u16.c
deleted file mode 100644
index 67ebb79..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u16.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint16x8_t
-foo (uint16x8_t a, uint16x8_t b, uint16_t c)
-{
- return vqdmlahq_n_u16 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqdmlah.s16" } } */
-
-uint16x8_t
-foo1 (uint16x8_t a, uint16x8_t b, uint16_t c)
-{
- return vqdmlahq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqdmlah.s16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u32.c
deleted file mode 100644
index d82bca1..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u32.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint32x4_t
-foo (uint32x4_t a, uint32x4_t b, uint32_t c)
-{
- return vqdmlahq_n_u32 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqdmlah.s32" } } */
-
-uint32x4_t
-foo1 (uint32x4_t a, uint32x4_t b, uint32_t c)
-{
- return vqdmlahq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqdmlah.s32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u8.c
deleted file mode 100644
index 4b4c246..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlahq_n_u8.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint8x16_t
-foo (uint8x16_t a, uint8x16_t b, uint8_t c)
-{
- return vqdmlahq_n_u8 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqdmlah.s8" } } */
-
-uint8x16_t
-foo1 (uint8x16_t a, uint8x16_t b, uint8_t c)
-{
- return vqdmlahq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqdmlah.s8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c
new file mode 100644
index 0000000..7c2e5cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s16.c
@@ -0,0 +1,23 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+int16x8_t
+foo (int16x8_t a, int16x8_t b, int16_t c, mve_pred16_t p)
+{
+ return vqdmlashq_m_n_s16 (a, b, c, p);
+}
+
+/* { dg-final { scan-assembler "vpst" } } */
+/* { dg-final { scan-assembler "vqdmlasht.s16" } } */
+
+int16x8_t
+foo1 (int16x8_t a, int16x8_t b, int16_t c, mve_pred16_t p)
+{
+ return vqdmlashq_m (a, b, c, p);
+}
+
+/* { dg-final { scan-assembler "vpst" } } */
+/* { dg-final { scan-assembler "vqdmlasht.s16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c
new file mode 100644
index 0000000..cea9d9b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s32.c
@@ -0,0 +1,23 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+int32x4_t
+foo (int32x4_t a, int32x4_t b, int32_t c, mve_pred16_t p)
+{
+ return vqdmlashq_m_n_s32 (a, b, c, p);
+}
+
+/* { dg-final { scan-assembler "vpst" } } */
+/* { dg-final { scan-assembler "vqdmlasht.s32" } } */
+
+int32x4_t
+foo1 (int32x4_t a, int32x4_t b, int32_t c, mve_pred16_t p)
+{
+ return vqdmlashq_m (a, b, c, p);
+}
+
+/* { dg-final { scan-assembler "vpst" } } */
+/* { dg-final { scan-assembler "vqdmlasht.s32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c
new file mode 100644
index 0000000..83ee258
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_m_n_s8.c
@@ -0,0 +1,23 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+int8x16_t
+foo (int8x16_t a, int8x16_t b, int8_t c, mve_pred16_t p)
+{
+ return vqdmlashq_m_n_s8 (a, b, c, p);
+}
+
+/* { dg-final { scan-assembler "vpst" } } */
+/* { dg-final { scan-assembler "vqdmlasht.s8" } } */
+
+int8x16_t
+foo1 (int8x16_t a, int8x16_t b, int8_t c, mve_pred16_t p)
+{
+ return vqdmlashq_m (a, b, c, p);
+}
+
+/* { dg-final { scan-assembler "vpst" } } */
+/* { dg-final { scan-assembler "vqdmlasht.s8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c
new file mode 100644
index 0000000..c71a61c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s16.c
@@ -0,0 +1,21 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+int16x8_t
+foo (int16x8_t a, int16x8_t b, int16_t c)
+{
+ return vqdmlashq_n_s16 (a, b, c);
+}
+
+/* { dg-final { scan-assembler "vqdmlash.s16" } } */
+
+int16x8_t
+foo1 (int16x8_t a, int16x8_t b, int16_t c)
+{
+ return vqdmlashq (a, b, c);
+}
+
+/* { dg-final { scan-assembler "vqdmlash.s16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c
new file mode 100644
index 0000000..61f6c66
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s32.c
@@ -0,0 +1,21 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+int32x4_t
+foo (int32x4_t a, int32x4_t b, int32_t c)
+{
+ return vqdmlashq_n_s32 (a, b, c);
+}
+
+/* { dg-final { scan-assembler "vqdmlash.s32" } } */
+
+int32x4_t
+foo1 (int32x4_t a, int32x4_t b, int32_t c)
+{
+ return vqdmlashq (a, b, c);
+}
+
+/* { dg-final { scan-assembler "vqdmlash.s32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c
new file mode 100644
index 0000000..a078928
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqdmlashq_n_s8.c
@@ -0,0 +1,21 @@
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+int8x16_t
+foo (int8x16_t a, int8x16_t b, int8_t c)
+{
+ return vqdmlashq_n_s8 (a, b, c);
+}
+
+/* { dg-final { scan-assembler "vqdmlash.s8" } } */
+
+int8x16_t
+foo1 (int8x16_t a, int8x16_t b, int8_t c)
+{
+ return vqdmlashq (a, b, c);
+}
+
+/* { dg-final { scan-assembler "vqdmlash.s8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u16.c
deleted file mode 100644
index 6fe4f77..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u16.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint16x8_t
-foo (uint16x8_t a, uint16x8_t b, uint16_t c)
-{
- return vqrdmlahq_n_u16 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlah.s16" } } */
-
-uint16x8_t
-foo1 (uint16x8_t a, uint16x8_t b, uint16_t c)
-{
- return vqrdmlahq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlah.s16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u32.c
deleted file mode 100644
index 8205403..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u32.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint32x4_t
-foo (uint32x4_t a, uint32x4_t b, uint32_t c)
-{
- return vqrdmlahq_n_u32 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlah.s32" } } */
-
-uint32x4_t
-foo1 (uint32x4_t a, uint32x4_t b, uint32_t c)
-{
- return vqrdmlahq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlah.s32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u8.c
deleted file mode 100644
index ed5c3a0..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlahq_n_u8.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint8x16_t
-foo (uint8x16_t a, uint8x16_t b, uint8_t c)
-{
- return vqrdmlahq_n_u8 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlah.s8" } } */
-
-uint8x16_t
-foo1 (uint8x16_t a, uint8x16_t b, uint8_t c)
-{
- return vqrdmlahq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlah.s8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u16.c
deleted file mode 100644
index 6c5f280..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u16.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint16x8_t
-foo (uint16x8_t a, uint16x8_t b, uint16_t c)
-{
- return vqrdmlashq_n_u16 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlash.s16" } } */
-
-uint16x8_t
-foo1 (uint16x8_t a, uint16x8_t b, uint16_t c)
-{
- return vqrdmlashq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlash.s16" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u32.c
deleted file mode 100644
index daf520d..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u32.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint32x4_t
-foo (uint32x4_t a, uint32x4_t b, uint32_t c)
-{
- return vqrdmlashq_n_u32 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlash.s32" } } */
-
-uint32x4_t
-foo1 (uint32x4_t a, uint32x4_t b, uint32_t c)
-{
- return vqrdmlashq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlash.s32" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u8.c
deleted file mode 100644
index 59b0e39..0000000
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vqrdmlashq_n_u8.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* { dg-require-effective-target arm_v8_1m_mve_ok } */
-/* { dg-add-options arm_v8_1m_mve } */
-/* { dg-additional-options "-O2" } */
-
-#include "arm_mve.h"
-
-uint8x16_t
-foo (uint8x16_t a, uint8x16_t b, uint8_t c)
-{
- return vqrdmlashq_n_u8 (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlash.s8" } } */
-
-uint8x16_t
-foo1 (uint8x16_t a, uint8x16_t b, uint8_t c)
-{
- return vqrdmlashq (a, b, c);
-}
-
-/* { dg-final { scan-assembler "vqrdmlash.s8" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c
index f59f697..2398d89 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f16.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int8x16_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_f16 (r7, vreinterpretq_f16 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.f16" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.f16" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c
index dac47c7..5a58dc6 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_f32.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_f32 (r7, vreinterpretq_f32 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.f32" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.f32" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c
index edc2f2f..9ab05e9 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s16.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int8x16_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_s16 (r7, vreinterpretq_s16 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.i16" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.i16" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c
index 880de06..fbfff1f 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s32.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_s32 (r7, vreinterpretq_s32 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.i32" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.i32" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c
index b0e8154..beb6b92 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s64.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -42,4 +42,4 @@ foo1 (mve_pred16_t __p)
return vpselq_s64 (r7, vreinterpretq_s64 (value9), __p);
}
-/* { dg-final { scan-assembler-times "vpsel" 8 } } */
+/* { dg-final { scan-assembler-times "vpsel" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c
index a5ceebb..727d89b 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_s8.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_s8 (r7, vreinterpretq_s8 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.i8" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.i8" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c
index cd31c23..600f6d7 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u16.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int8x16_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_u16 (r7, vreinterpretq_u16 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.i16" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.i16" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c
index faa66c9..d536ae8 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u32.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_u32 (r7, vreinterpretq_u32 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.i32" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.i32" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c
index 853b28a..abc4361 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u64.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -42,4 +42,4 @@ foo1 (mve_pred16_t __p)
return vpselq_u64 (r7, vreinterpretq_u64 (value9), __p);
}
-/* { dg-final { scan-assembler-times "vpsel" 8 } } */
+/* { dg-final { scan-assembler-times "vpsel" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c
index bdf8cd5..c138e5b 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vreinterpretq_u8.c
@@ -1,6 +1,6 @@
/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
/* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -fno-ipa-icf" } */
#include "arm_mve.h"
int16x8_t value1;
@@ -41,4 +41,4 @@ foo1 ()
return vaddq_u8 (r7, vreinterpretq_u8 (value9));
}
-/* { dg-final { scan-assembler-times "vadd.i8" 8 } } */
+/* { dg-final { scan-assembler-times "vadd.i8" 16 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16-1.c
new file mode 100644
index 0000000..608dd30
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f16-1.c
@@ -0,0 +1,13 @@
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo (float16_t a, float16x8_t b)
+{
+ return vsetq_lane (23.26, b, 0);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32-1.c
new file mode 100644
index 0000000..c5f5db7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsetq_lane_f32-1.c
@@ -0,0 +1,13 @@
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=soft" } {""} } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo (float32_t a, float32x4_t b)
+{
+ return vsetq_lane (23.34, b, 0);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c
index 6570d4a..319188b7 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_s64.c
@@ -10,12 +10,10 @@ foo (uint64x2_t * addr, const int offset, int64x2_t value, mve_pred16_t p)
vstrdq_scatter_base_wb_p_s64 (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrdt.u64" } } */
-
void
foo1 (uint64x2_t * addr, const int offset, int64x2_t value, mve_pred16_t p)
{
vstrdq_scatter_base_wb_p (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrdt.u64" } } */
+/* { dg-final { scan-assembler-times "vstrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c
index 8444a3a..940b542 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_p_u64.c
@@ -10,12 +10,10 @@ foo (uint64x2_t * addr, const int offset, uint64x2_t value, mve_pred16_t p)
vstrdq_scatter_base_wb_p_u64 (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrdt.u64" } } */
-
void
foo1 (uint64x2_t * addr, const int offset, uint64x2_t value, mve_pred16_t p)
{
vstrdq_scatter_base_wb_p (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrdt.u64" } } */
+/* { dg-final { scan-assembler-times "vstrdt.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c
index e0ec283..33926d5 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_s64.c
@@ -10,12 +10,10 @@ foo (uint64x2_t * addr, const int offset, int64x2_t value)
vstrdq_scatter_base_wb_s64 (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrd.u64" } } */
-
void
foo1 (uint64x2_t * addr, const int offset, int64x2_t value)
{
vstrdq_scatter_base_wb (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrd.u64" } } */
+/* { dg-final { scan-assembler-times "vstrd.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c
index fe41d6b..b7ffcf9 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrdq_scatter_base_wb_u64.c
@@ -10,12 +10,10 @@ foo (uint64x2_t * addr, const int offset, uint64x2_t value)
vstrdq_scatter_base_wb_u64 (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrd.u64" } } */
-
void
foo1 (uint64x2_t * addr, const int offset, uint64x2_t value)
{
vstrdq_scatter_base_wb (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrd.u64" } } */
+/* { dg-final { scan-assembler-times "vstrd.u64\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c
index f4ceabb..b2cc6e5 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_f32.c
@@ -10,12 +10,10 @@ foo (uint32x4_t * addr, const int offset, float32x4_t value)
vstrwq_scatter_base_wb_f32 (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrw.u32" } } */
-
void
foo1 (uint32x4_t * addr, const int offset, float32x4_t value)
{
vstrwq_scatter_base_wb (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrw.u32" } } */
+/* { dg-final { scan-assembler-times "vstrw.u32\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c
index cb2eb68..4befd49 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_f32.c
@@ -10,12 +10,10 @@ foo (uint32x4_t * addr, const int offset, float32x4_t value, mve_pred16_t p)
vstrwq_scatter_base_wb_p_f32 (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrwt.u32" } } */
-
void
foo1 (uint32x4_t * addr, const int offset, float32x4_t value, mve_pred16_t p)
{
vstrwq_scatter_base_wb_p (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrwt.u32" } } */
+/* { dg-final { scan-assembler-times "vstrwt.u32\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c
index d973c02..dfb1827 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_s32.c
@@ -10,12 +10,10 @@ foo (uint32x4_t * addr, const int offset, int32x4_t value, mve_pred16_t p)
vstrwq_scatter_base_wb_p_s32 (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrwt.u32" } } */
-
void
foo1 (uint32x4_t * addr, const int offset, int32x4_t value, mve_pred16_t p)
{
vstrwq_scatter_base_wb_p (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrwt.u32" } } */
+/* { dg-final { scan-assembler-times "vstrwt.u32\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c
index c0f0964..4eb78c6 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_p_u32.c
@@ -10,12 +10,10 @@ foo (uint32x4_t * addr, const int offset, uint32x4_t value, mve_pred16_t p)
vstrwq_scatter_base_wb_p_u32 (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrwt.u32" } } */
-
void
foo1 (uint32x4_t * addr, const int offset, uint32x4_t value, mve_pred16_t p)
{
vstrwq_scatter_base_wb_p (addr, 8, value, p);
}
-/* { dg-final { scan-assembler "vstrwt.u32" } } */
+/* { dg-final { scan-assembler-times "vstrwt.u32\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c
index 6ef0955..618dbaf 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_s32.c
@@ -10,12 +10,10 @@ foo (uint32x4_t * addr, const int offset, int32x4_t value)
vstrwq_scatter_base_wb_s32 (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrw.u32" } } */
-
void
foo1 (uint32x4_t * addr, const int offset, int32x4_t value)
{
vstrwq_scatter_base_wb (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrw.u32" } } */
+/* { dg-final { scan-assembler-times "vstrw.u32\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c
index 620dffa8..912a459 100644
--- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vstrwq_scatter_base_wb_u32.c
@@ -10,12 +10,10 @@ foo (uint32x4_t * addr, uint32x4_t value)
vstrwq_scatter_base_wb_u32 (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrw.u32" } } */
-
void
foo1 (uint32x4_t * addr, uint32x4_t value)
{
vstrwq_scatter_base_wb (addr, 8, value);
}
-/* { dg-final { scan-assembler "vstrw.u32" } } */
+/* { dg-final { scan-assembler-times "vstrw.u32\tq\[0-9\]+, \\\[q\[0-9\]+, #\[0-9\]+\\\]!" 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f16-1.c
new file mode 100644
index 0000000..f3e1961
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t inactive, float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vsubq_m (inactive, a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f32-1.c
new file mode 100644
index 0000000..4b5cd90
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_m_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t inactive, float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vsubq_m (inactive, a, 23.23, p);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f16-1.c
new file mode 100644
index 0000000..f883254
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f16-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo1 (float16x8_t a, float16_t b)
+{
+ return vsubq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f32-1.c
new file mode 100644
index 0000000..88d9675
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_n_f32-1.c
@@ -0,0 +1,12 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo1 (float32x4_t a, float32_t b)
+{
+ return vsubq (a, 23.23);
+}
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f16-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f16-1.c
new file mode 100644
index 0000000..b3a67bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f16-1.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float16x8_t
+foo (float16x8_t a, float16_t b, mve_pred16_t p)
+{
+ return vsubq_x_n_f16 (a, 23.23, p);
+}
+
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f32-1.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f32-1.c
new file mode 100644
index 0000000..dcb2425
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/vsubq_x_n_f32-1.c
@@ -0,0 +1,13 @@
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+float32x4_t
+foo (float32x4_t a, float32_t b, mve_pred16_t p)
+{
+ return vsubq_x_n_f32 (a, 23.23, p);
+}
+
+
+/* { dg-final { scan-assembler-not "__ARM_undef" } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-compare-1.c b/gcc/testsuite/gcc.target/arm/neon-compare-1.c
new file mode 100644
index 0000000..c915eca
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/neon-compare-1.c
@@ -0,0 +1,84 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O1" } */
+/* { dg-add-options arm_neon } */
+
+#define COMPARE_REG(NAME, OP, TYPE) \
+ TYPE \
+ cmp_##NAME##_##TYPE##_reg (TYPE a, TYPE b) \
+ { \
+ return a OP b; \
+ }
+
+#define COMPARE_REG_AND_ZERO(NAME, OP, TYPE) \
+ COMPARE_REG (NAME, OP, TYPE) \
+ \
+ TYPE \
+ cmp_##NAME##_##TYPE##_zero (TYPE a) \
+ { \
+ return a OP (TYPE) {}; \
+ }
+
+#define COMPARE_TYPE(TYPE, COMPARE_ORDERED) \
+ COMPARE_REG_AND_ZERO (eq, ==, TYPE) \
+ COMPARE_REG_AND_ZERO (ne, !=, TYPE) \
+ COMPARE_ORDERED (lt, <, TYPE) \
+ COMPARE_ORDERED (le, <=, TYPE) \
+ COMPARE_ORDERED (gt, >, TYPE) \
+ COMPARE_ORDERED (ge, >=, TYPE)
+
+#define TEST_TYPE(NAME, ELEM, COMPARE_ORDERED) \
+ typedef ELEM NAME __attribute__((vector_size(16))); \
+ COMPARE_TYPE (NAME, COMPARE_ORDERED)
+
+TEST_TYPE (vs8, __INT8_TYPE__, COMPARE_REG_AND_ZERO)
+TEST_TYPE (vu8, __UINT8_TYPE__, COMPARE_REG)
+TEST_TYPE (vs16, __INT16_TYPE__, COMPARE_REG_AND_ZERO)
+TEST_TYPE (vu16, __UINT16_TYPE__, COMPARE_REG)
+TEST_TYPE (vs32, __INT32_TYPE__, COMPARE_REG_AND_ZERO)
+TEST_TYPE (vu32, __UINT32_TYPE__, COMPARE_REG)
+
+/* { s8, u8 } x { eq, ne }.
+/* { dg-final { scan-assembler-times {\tvceq.i8\tq[0-9]+, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvceq.i8\tq[0-9]+, q[0-9]+, #0\n} 4 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.s8\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.s8\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvclt.s8\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcge.s8\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.s8\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcle.s8\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.u8\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.u8\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+
+/* { s16, u16 } x { eq, ne }.
+/* { dg-final { scan-assembler-times {\tvceq.i16\tq[0-9]+, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvceq.i16\tq[0-9]+, q[0-9]+, #0\n} 4 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.s16\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.s16\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvclt.s16\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcge.s16\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.s16\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcle.s16\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.u16\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.u16\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+
+/* { s32, u32 } x { eq, ne }.
+/* { dg-final { scan-assembler-times {\tvceq.i32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvceq.i32\tq[0-9]+, q[0-9]+, #0\n} 4 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.s32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.s32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvclt.s32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcge.s32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.s32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcle.s32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.u32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.u32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-compare-2.c b/gcc/testsuite/gcc.target/arm/neon-compare-2.c
new file mode 100644
index 0000000..559c5e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/neon-compare-2.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O1 -funsafe-math-optimizations" } */
+/* { dg-add-options arm_neon } */
+
+#ifndef ELEM_TYPE
+#define ELEM_TYPE float
+#endif
+#ifndef INT_ELEM_TYPE
+#define INT_ELEM_TYPE __INT32_TYPE__
+#endif
+
+#define COMPARE(NAME, OP) \
+ int_vec \
+ cmp_##NAME##_reg (vec a, vec b) \
+ { \
+ return a OP b; \
+ } \
+ \
+ int_vec \
+ cmp_##NAME##_zero (vec a) \
+ { \
+ return a OP (vec) {}; \
+ }
+
+typedef INT_ELEM_TYPE int_vec __attribute__((vector_size(16)));
+typedef ELEM_TYPE vec __attribute__((vector_size(16)));
+
+COMPARE (eq, ==)
+COMPARE (ne, !=)
+COMPARE (lt, <)
+COMPARE (le, <=)
+COMPARE (gt, >)
+COMPARE (ge, >=)
+
+/* { dg-final { scan-assembler-times {\tvceq.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvceq.f32\tq[0-9]+, q[0-9]+, #0\n} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvclt.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcge.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcle.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-compare-3.c b/gcc/testsuite/gcc.target/arm/neon-compare-3.c
new file mode 100644
index 0000000..efbe797
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/neon-compare-3.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O1 -ftree-vectorize -funsafe-math-optimizations" } */
+/* { dg-add-options arm_neon } */
+
+#define ult(a, b) (!__builtin_isgreaterequal (a, b))
+#define ule(a, b) (!__builtin_isgreater (a, b))
+#define ugt(a, b) (!__builtin_islessequal (a, b))
+#define uge(a, b) (!__builtin_isless (a, b))
+
+int x[16];
+float a[16];
+float b[16];
+
+#define COMPARE(NAME) \
+ void \
+ cmp_##NAME##_reg (void) \
+ { \
+ for (int i = 0; i < 16; ++i) \
+ x[i] = NAME (a[i], b[i]) ? 2 : 0; \
+ } \
+ \
+ void \
+ cmp_##NAME##_zero (void) \
+ { \
+ for (int i = 0; i < 16; ++i) \
+ x[i] = NAME (a[i], 0) ? 2 : 0; \
+ }
+
+typedef int int_vec __attribute__((vector_size(16)));
+typedef float vec __attribute__((vector_size(16)));
+
+COMPARE (ult)
+COMPARE (ule)
+COMPARE (ugt)
+COMPARE (uge)
+
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvclt.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+
+/* { dg-final { scan-assembler-times {\tvcge.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcge.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
+/* { dg-final { scan-assembler-times {\tvcle.f32\tq[0-9]+, q[0-9]+, #0\n} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-compare-4.c b/gcc/testsuite/gcc.target/arm/neon-compare-4.c
new file mode 100644
index 0000000..3f8cc90
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/neon-compare-4.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O1 -ftree-vectorize -funsafe-math-optimizations" } */
+/* { dg-add-options arm_neon } */
+
+#define ordered(a, b) (!__builtin_isunordered (a, b))
+#define unordered(a, b) (__builtin_isunordered (a, b))
+
+int x[16];
+float a[16];
+float b[16];
+
+#define COMPARE(NAME) \
+ void \
+ cmp_##NAME##_reg (void) \
+ { \
+ for (int i = 0; i < 16; ++i) \
+ x[i] = NAME (a[i], b[i]) ? 2 : 0; \
+ } \
+ \
+ void \
+ cmp_##NAME##_zero (void) \
+ { \
+ for (int i = 0; i < 16; ++i) \
+ x[i] = NAME (a[i], 0) ? 2 : 0; \
+ }
+
+typedef int int_vec __attribute__((vector_size(16)));
+typedef float vec __attribute__((vector_size(16)));
+
+COMPARE (ordered)
+COMPARE (unordered)
+
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, #0\n} 2 } } */
+
+/* { dg-final { scan-assembler-times {\tvcge.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvcle.f32\tq[0-9]+, q[0-9]+, #0\n} 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-compare-5.c b/gcc/testsuite/gcc.target/arm/neon-compare-5.c
new file mode 100644
index 0000000..cb6428d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/neon-compare-5.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_neon_ok } */
+/* { dg-options "-O1 -ftree-vectorize -funsafe-math-optimizations" } */
+/* { dg-add-options arm_neon } */
+
+#define uneq(a, b) (!__builtin_islessgreater (a, b))
+/* RTL's LTGT is a signaling comparison. */
+#define ltgt(a, b) (a < b || b < a)
+
+int x[16];
+float a[16];
+float b[16];
+
+#define COMPARE(NAME) \
+ void \
+ cmp_##NAME##_reg (void) \
+ { \
+ for (int i = 0; i < 16; ++i) \
+ x[i] = NAME (a[i], b[i]) ? 2 : 0; \
+ } \
+ \
+ void \
+ cmp_##NAME##_zero (void) \
+ { \
+ for (int i = 0; i < 16; ++i) \
+ x[i] = NAME (a[i], 0) ? 2 : 0; \
+ }
+
+typedef int int_vec __attribute__((vector_size(16)));
+typedef float vec __attribute__((vector_size(16)));
+
+COMPARE (uneq)
+COMPARE (ltgt)
+
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, q[0-9]+\n} 4 } } */
+/* { dg-final { scan-assembler-times {\tvcgt.f32\tq[0-9]+, q[0-9]+, #0\n} 2 } } */
+/* { dg-final { scan-assembler-times {\tvclt.f32\tq[0-9]+, q[0-9]+, #0\n} 2 } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-vcond-gt.c b/gcc/testsuite/gcc.target/arm/neon-vcond-gt.c
index 8e9f378..9f601a1 100644
--- a/gcc/testsuite/gcc.target/arm/neon-vcond-gt.c
+++ b/gcc/testsuite/gcc.target/arm/neon-vcond-gt.c
@@ -13,5 +13,5 @@ void foo (int ilast,float* w, float* w2)
}
}
-/* { dg-final { scan-assembler "vcgt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
+/* { dg-final { scan-assembler "vclt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*#0" } } */
/* { dg-final { scan-assembler "vbsl|vbit|vbif\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-vcond-ltgt.c b/gcc/testsuite/gcc.target/arm/neon-vcond-ltgt.c
index c8306e3..74bc220 100644
--- a/gcc/testsuite/gcc.target/arm/neon-vcond-ltgt.c
+++ b/gcc/testsuite/gcc.target/arm/neon-vcond-ltgt.c
@@ -13,6 +13,7 @@ void foo (int ilast,float* w, float* w2)
}
}
-/* { dg-final { scan-assembler-times "vcgt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" 2 } } */
+/* { dg-final { scan-assembler "vclt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*#0" } } */
+/* { dg-final { scan-assembler "vcgt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*#0" } } */
/* { dg-final { scan-assembler "vorr\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
/* { dg-final { scan-assembler "vbsl|vbit|vbif\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
diff --git a/gcc/testsuite/gcc.target/arm/neon-vcond-unordered.c b/gcc/testsuite/gcc.target/arm/neon-vcond-unordered.c
index 3bb67d3..8d31875 100644
--- a/gcc/testsuite/gcc.target/arm/neon-vcond-unordered.c
+++ b/gcc/testsuite/gcc.target/arm/neon-vcond-unordered.c
@@ -13,7 +13,7 @@ void foo (int ilast,float* w, float* w2)
}
}
-/* { dg-final { scan-assembler "vcgt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
-/* { dg-final { scan-assembler "vcge\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
+/* { dg-final { scan-assembler "vcgt\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*#0" } } */
+/* { dg-final { scan-assembler "vcle\\.f32\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*#0" } } */
/* { dg-final { scan-assembler "vorr\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
/* { dg-final { scan-assembler "vbsl|vbit|vbif\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+,\[\\t \]*q\[0-9\]+" } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vminmax_1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vminmax_1.c
new file mode 100644
index 0000000..6c8e7d4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vminmax_1.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-options "-O3" } */
+/* { dg-add-options arm_v8_1m_mve } */
+
+#include <stdint.h>
+
+#define MAX(a, b) ((a) > (b)) ? (a) : (b)
+#define MIN(a, b) ((a) < (b)) ? (a) : (b)
+
+
+#define TEST_BINOP(OP, TY, N) \
+ TY test_##OP##_##TY (TY * dest, TY * a, TY * b) \
+ { \
+ int i; \
+ for (i=0; i<N; i++) \
+ { \
+ dest[i] = OP (a[i], b[i]); \
+ } \
+ }
+
+/* Test vmax. */
+
+TEST_BINOP (MAX, int32_t, 4)
+/* { dg-final { scan-assembler-times {vmax\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MAX, uint32_t, 4)
+/* { dg-final { scan-assembler-times {vmax\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MAX, int16_t, 8)
+/* { dg-final { scan-assembler-times {vmax\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MAX, uint16_t, 8)
+/* { dg-final { scan-assembler-times {vmax\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MAX, int8_t, 16)
+/* { dg-final { scan-assembler-times {vmax\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MAX, uint8_t, 16)
+/* { dg-final { scan-assembler-times {vmax\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+/* Test vmin. */
+
+TEST_BINOP (MIN, int32_t, 4)
+/* { dg-final { scan-assembler-times {vmin\.s32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MIN, uint32_t, 4)
+/* { dg-final { scan-assembler-times {vmin\.u32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MIN, int16_t, 8)
+/* { dg-final { scan-assembler-times {vmin\.s16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MIN, uint16_t, 8)
+/* { dg-final { scan-assembler-times {vmin\.u16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MIN, int8_t, 16)
+/* { dg-final { scan-assembler-times {vmin\.s8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
+TEST_BINOP (MIN, uint8_t, 16)
+/* { dg-final { scan-assembler-times {vmin\.u8\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vmul_1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vmul_1.c
new file mode 100644
index 0000000..514f292
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vmul_1.c
@@ -0,0 +1,64 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+void test_vmul_i32 (int32_t * dest, int32_t * a, int32_t * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+void test_vmul_i32_u (uint32_t * dest, uint32_t * a, uint32_t * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vmul\.i32\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vmul_i16 (int16_t * dest, int16_t * a, int16_t * b) {
+ int i;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+void test_vmul_i16_u (uint16_t * dest, uint16_t * a, uint16_t * b) {
+ int i;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vmul\.i16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vmul_i8 (int8_t * dest, int8_t * a, int8_t * b) {
+ int i;
+ for (i=0; i<16; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+void test_vmul_i8_u (uint8_t * dest, uint8_t * a, uint8_t * b) {
+ int i;
+ for (i=0; i<16; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vmul\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vmul_f32 (float * dest, float * a, float * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] * b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vmul\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
new file mode 100644
index 0000000..cb3ef3a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
@@ -0,0 +1,65 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg -additional-options "-O3 -funsafe-math-optimizations" } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+void test_vsub_i32 (int32_t * dest, int32_t * a, int32_t * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+void test_vsub_i32_u (uint32_t * dest, uint32_t * a, uint32_t * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vsub\.i32\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vsub_i16 (int16_t * dest, int16_t * a, int16_t * b) {
+ int i;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+void test_vsub_i16_u (uint16_t * dest, uint16_t * a, uint16_t * b) {
+ int i;
+ for (i=0; i<8; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vsub\.i16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vsub_i8 (int8_t * dest, int8_t * a, int8_t * b) {
+ int i;
+ for (i=0; i<16; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+void test_vsub_i8_u (uint8_t * dest, uint8_t * a, uint8_t * b) {
+ int i;
+ for (i=0; i<16; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vsub\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+
+void test_vsub_f32 (float * dest, float * a, float * b) {
+ int i;
+ for (i=0; i<4; i++) {
+ dest[i] = a[i] - b[i];
+ }
+}
+
+/* { dg-final { scan-assembler-times {vsub\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-3.c b/gcc/testsuite/gcc.target/arm/stack-protector-3.c
new file mode 100644
index 0000000..b8f77fa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-3.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fstack_protector } */
+/* { dg-options "-fstack-protector-all -O2" } */
+
+extern volatile long *stack_chk_guard_ptr;
+
+void __attribute__ ((noipa))
+f (void)
+{
+ volatile int x;
+ /* Munging the contents of __stack_chk_guard should trigger a
+ stack-smashing failure for this function. */
+ *stack_chk_guard_ptr += 1;
+}
+
+asm (
+" .data\n"
+" .align 3\n"
+" .globl stack_chk_guard_ptr\n"
+"stack_chk_guard_ptr:\n"
+" .word __stack_chk_guard\n"
+" .weak __stack_chk_guard\n"
+"__stack_chk_guard:\n"
+" .word 0xdead4321\n"
+" .text\n"
+" .type __stack_chk_fail, %function\n"
+"__stack_chk_fail:\n"
+" movs r0, #0\n"
+" b exit\n"
+" .size __stack_chk_fail, .-__stack_chk_fail"
+);
+
+int
+main (void)
+{
+ f ();
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-4.c b/gcc/testsuite/gcc.target/arm/stack-protector-4.c
new file mode 100644
index 0000000..6334dd0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-4.c
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fstack_protector } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-fstack-protector-all -O2 -fpic" } */
+
+#include "stack-protector-3.c"
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-5.c b/gcc/testsuite/gcc.target/arm/stack-protector-5.c
new file mode 100644
index 0000000..ae70b99
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-5.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-fstack-protector-all -Os" } */
+
+void __attribute__ ((noipa))
+f (void)
+{
+ volatile int x;
+ asm volatile ("" :::
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r14");
+}
+
+/* The register clobbers above should not generate any single LDRs or STRs;
+ all registers should be pushed and popped using register lists. The only
+ STRs should therefore be those associated with the stack protector tests
+ themselves.
+
+ Make sure the address of the canary is not spilled and reloaded,
+ since that would give the attacker an opportunity to change the
+ canary value. */
+/* { dg-final { scan-assembler-times {\tstr\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-6.c b/gcc/testsuite/gcc.target/arm/stack-protector-6.c
new file mode 100644
index 0000000..2b7e6f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-6.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-fstack-protector-all -Os -fpic" } */
+
+#include "stack-protector-5.c"
+
+/* See the comment in stack-protector-5.c. */
+/* { dg-final { scan-assembler-times {\tstr\t} 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-1.c b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-1.c
index 45ab605..36204f4 100644
--- a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-1.c
+++ b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-1.c
@@ -1,6 +1,6 @@
/* Use conditional compare */
/* { dg-options "-O2" } */
-/* { dg-skip-if "" { arm_thumb1_ok } } */
+/* { dg-skip-if "" { arm_thumb1_ok || arm_cortex_m } } */
/* { dg-final { scan-assembler "cmpne" } } */
int f(int i, int j)
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-2.c b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-2.c
index 17d9a8f..108d1c3 100644
--- a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-2.c
+++ b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-2.c
@@ -1,6 +1,6 @@
/* Use conditional compare */
/* { dg-options "-O2" } */
-/* { dg-skip-if "" { arm_thumb1_ok } } */
+/* { dg-skip-if "" { arm_thumb1_ok || arm_cortex_m } } */
/* { dg-final { scan-assembler "cmpeq" } } */
int f(int i, int j)
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-3.c b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-3.c
index 6b2a79b..ca7fd9f 100644
--- a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-3.c
+++ b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-3.c
@@ -1,6 +1,6 @@
/* Use conditional compare */
/* { dg-options "-O2" } */
-/* { dg-skip-if "" { arm_thumb1_ok } } */
+/* { dg-skip-if "" { arm_thumb1_ok || arm_cortex_m } } */
/* { dg-final { scan-assembler "cmpgt" } } */
int f(int i, int j)
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-4.c b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-4.c
index 80e1076..91cc8f4 100644
--- a/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-4.c
+++ b/gcc/testsuite/gcc.target/arm/thumb2-cond-cmp-4.c
@@ -1,6 +1,6 @@
/* Use conditional compare */
/* { dg-options "-O2" } */
-/* { dg-skip-if "" { arm_thumb1_ok } } */
+/* { dg-skip-if "" { arm_thumb1_ok || arm_cortex_m } } */
/* { dg-final { scan-assembler "cmpgt" } } */
int f(int i, int j)
diff --git a/gcc/testsuite/gcc.target/bpf/diag-sdiv.c b/gcc/testsuite/gcc.target/bpf/diag-sdiv.c
new file mode 100644
index 0000000..db0c494
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/diag-sdiv.c
@@ -0,0 +1,12 @@
+/* Verify signed division does not produce 'sdiv' insn in eBPF. */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void
+foo ()
+{
+ signed int x = 5;
+ signed int y = 2;
+ signed int z = x / y;
+}
+/* { dg-final { scan-assembler-not "sdiv(32)?\t%r" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/diag-smod.c b/gcc/testsuite/gcc.target/bpf/diag-smod.c
new file mode 100644
index 0000000..20234ee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/diag-smod.c
@@ -0,0 +1,12 @@
+/* Verify signed modulo does not produce 'smod' insn in eBPF. */
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+void
+foo ()
+{
+ signed int x = 5;
+ signed int y = 2;
+ signed int z = x % y;
+}
+/* { dg-final { scan-assembler-not "smod(32)?\t%r" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c b/gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c
new file mode 100644
index 0000000..f6c5c9e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/xbpf-sdiv-1.c
@@ -0,0 +1,14 @@
+/* Verify that sdiv instruction is used for xBPF. */
+/* { dg-do compile } */
+/* { dg-options "-O0 -mxbpf" } */
+
+void
+foo ()
+{
+ signed int x = 5;
+ signed int y = 2;
+ signed int z = x / y;
+ signed int w = x / 3;
+}
+
+/* { dg-final { scan-assembler "sdiv(32)?\t%r" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c b/gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c
new file mode 100644
index 0000000..b3e5816
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/xbpf-smod-1.c
@@ -0,0 +1,14 @@
+/* Verify that smod instruction is used for xBPF. */
+/* { dg-do compile } */
+/* { dg-options "-O0 -mxbpf" } */
+
+void
+foo ()
+{
+ signed int x = 5;
+ signed int y = 2;
+ signed int z = x % y;
+ signed int w = x % 3;
+}
+
+/* { dg-final { scan-assembler "smod(32)?\t%r" } } */
diff --git a/gcc/testsuite/gcc.target/i386/amx-check.h b/gcc/testsuite/gcc.target/i386/amx-check.h
new file mode 100644
index 0000000..03616ff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amx-check.h
@@ -0,0 +1,185 @@
+#ifndef AMX_CHECK_H_INCLUDED
+#define AMX_CHECK_H_INCLUDED
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+#include "cpuid.h"
+
+/* TODO: The tmm emulation is temporary for current
+ AMX implementation with no tmm regclass, should
+ be changed in the future. */
+typedef struct __tile_config
+{
+ uint8_t palette_id;
+ uint8_t start_row;
+ uint8_t reserved_0[14];
+ uint16_t colsb[8]; /* Colum size of each tmm register in bytes */
+ uint16_t reserved_1[8];
+ uint8_t rows[8]; /* Row size of each tmm reg in bytes */
+ uint8_t reserved_2[8];
+} __tilecfg;
+
+typedef union __union_tile_config
+{
+ __tilecfg s;
+ uint8_t a[64];
+} __tilecfg_u;
+
+typedef struct __tile
+{
+ /* Max size of tile register */
+ uint8_t buf[1024];
+ int rows;
+ int colsb;
+} __tile;
+
+/* Maxium col/row size in bytes */
+#define MAX_ROWS 16
+#define MAX_COLS 64
+
+/* Stride (colum width in byte) used for tileload/store */
+#define _STRIDE 64
+
+/* Initialize tile config by setting all tmm size to 16x64 */
+void init_tile_config (__tilecfg_u *dst)
+{
+ int i;
+
+ dst->s.palette_id = 1;
+ dst->s.start_row = 0;
+
+ for (i = 0; i < 14; i++)
+ dst->s.reserved_0[i] = 0;
+
+ for (i = 0; i < 8; i++)
+ {
+ dst->s.colsb[i] = _STRIDE;
+ dst->s.rows[i] = 16;
+ dst->s.reserved_1[i] = 0;
+ dst->s.reserved_2[i] = 0;
+ }
+
+ _tile_loadconfig (dst->a);
+}
+
+/* Init __tile variable that going to be store to register
+ w/o extra buffer. If buffer exists, it should be the same
+ size matrix as corresponding tmm register.
+ Should execute init_tile_config first */
+void init_tile_src (const int tmm_num, __tile *src, uint8_t *buffer)
+{
+ int rows, colsb, i, j;
+ __tilecfg_u tmp;
+
+ _tile_storeconfig (tmp.a);
+
+ src->rows = rows = tmp.s.rows[tmm_num];
+ src->colsb = colsb = tmp.s.colsb[tmm_num];
+
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < colsb; j++)
+ {
+ if(buffer)
+ src->buf[i * colsb + j] = buffer[i * colsb + j];
+ else
+ src->buf[i * colsb + j] = (i + 11 * j) % 256;
+ }
+
+}
+
+/* Init __tile src and corresponding tmm register */
+#define init_tile_reg_and_src(tmm_num, src) \
+{ \
+ init_tile_src (tmm_num, &src, NULL); \
+ _tile_loadd (tmm_num, src.buf, _STRIDE); \
+}
+
+#define init_tile_reg_and_src_with_buffer(tmm_num, src, buffer) \
+{ \
+ init_tile_src (tmm_num, &src, buffer); \
+ _tile_loadd (tmm_num, src.buf, _STRIDE); \
+}
+
+/* Zero __tile src. It should be init first. */
+void zero_tile_src (__tile *src)
+{
+ int i, j;
+
+ for (i = 0; i < src->rows; i++)
+ for (j = 0; j < src->colsb; j++)
+ src->buf[i * src->colsb + j] = 0;
+}
+
+/* Compare tile config value with __tilecfg_u dst */
+int check_tile_config (__tilecfg_u *src, __tilecfg_u *dst)
+{
+ size_t size = sizeof(__tilecfg);
+ uint8_t *pa_src = (uint8_t *) src->a;
+ uint8_t *pa_dst = (uint8_t *) dst->a;
+
+ for (int i = 0; i < size; i++)
+ if (pa_src[i] != pa_dst[i])
+ return 0;
+
+ return 1;
+}
+
+/* Compare tile register value with __tile variable */
+int check_tile_register (__tile* ref, __tile* target)
+{
+ /* Tile register should be stored from tmm to
+ memory and compare with emulation results. */
+ int rows = target->rows;
+ int colsb = target->colsb;
+ int i, j;
+
+ for (i = 0; i < rows; i++)
+ for (j = 0; j < colsb; j++)
+ if (ref->buf[i * colsb + j] != target->buf[i * colsb + j])
+ return 0;
+
+ return 1;
+}
+
+#ifndef DO_TEST
+#define DO_TEST do_test
+static void test_amx (void);
+__attribute__ ((noinline))
+static void
+do_test (void)
+{
+ test_amx ();
+}
+#endif
+
+int
+main ()
+{
+ /* Check cpu support for AMX */
+ if (__builtin_cpu_supports ("amx-tile")
+#ifdef AMX_INT8
+ && __builtin_cpu_supports ("amx-int8")
+#endif
+#ifdef AMX_BF16
+ && __builtin_cpu_supports ("amx-bf16")
+#endif
+ )
+ {
+ DO_TEST ();
+#ifdef DEBUG
+ printf ("PASSED\n");
+#endif
+ }
+#ifdef DEBUG
+ else
+ printf ("SKIPPED\n");
+#endif
+
+ return 0;
+}
+
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-asmatt-1.c b/gcc/testsuite/gcc.target/i386/amxbf16-asmatt-1.c
new file mode 100644
index 0000000..a5e5bdd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxbf16-asmatt-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mamx-bf16" } */
+/* { dg-final { scan-assembler "tdpbf16ps\[ \\t]+\[^\n\]*%tmm3+\[^\n\]*%tmm2+\[^\n\]*%tmm1" } } */
+#include <immintrin.h>
+
+#define TMM1 1
+#define TMM2 2
+#define TMM3 3
+
+void TEST ()
+{
+ _tile_dpbf16ps (TMM1, TMM2, TMM3);
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c b/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c
new file mode 100644
index 0000000..c2d6074
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mamx-bf16 -masm=intel" } */
+/* { dg-final { scan-assembler "tdpbf16ps\[ \\t]+\[^\n\]*%tmm1+\[^\n\]*%tmm2+\[^\n\]*%tmm3" } } */
+#include <immintrin.h>
+
+void TEST ()
+{
+ _tile_dpbf16ps (1, 2, 3);
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
new file mode 100644
index 0000000..349ec58
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxbf16-dpbf16ps-2.c
@@ -0,0 +1,85 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target amx_tile } */
+/* { dg-require-effective-target amx_bf16 } */
+/* { dg-options "-O2 -mamx-tile -mamx-bf16" } */
+#include <immintrin.h>
+
+#define AMX_BF16
+#define DO_TEST test_amx_bf16_dpbf16ps
+void test_amx_bf16_dpbf16ps ();
+#include "amx-check.h"
+
+/* Transformation functions between bf16/float */
+static uint16_t make_bf16 (float f)
+{
+ uint32_t u = (uint32_t)f;
+ u = (u >> 16) & 0xffff;
+ return (uint16_t)u;
+}
+
+static float make_f32 (uint16_t bf)
+{
+ uint32_t u = (uint32_t)(bf << 16);
+ return (float)u;
+}
+
+/* Init tile buffer with bf16 pairs */
+void init_bf16_max_tile_buffer (uint8_t *buf)
+{
+ int i, j;
+ uint16_t *ptr = (uint16_t *)buf;
+
+ for(i = 0; i < 16; i++)
+ for(j = 0; j < 32; j++)
+ {
+ float f = 16.1f * i + 3.4f * j;
+ ptr[i * 32 + j] = make_bf16(f);
+ }
+}
+
+void calc_matrix_dpbf16ps (__tile *dst, __tile *src1, __tile *src2)
+{
+ uint16_t *src1_buf = (uint16_t *)src1->buf;
+ uint16_t *src2_buf = (uint16_t *)src2->buf;
+ float *dst_buf = (float *)dst->buf;
+
+ int M = src1->rows;
+ int N = src1->colsb / 4;
+ int K = src2->colsb / 4;
+ int i, j, k, t;
+
+ for (i = 0; i < M; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < K; k++)
+ for (t = 0; t < 2; t+=2)
+ {
+ dst_buf[i * N + k] +=
+ (make_f32(src1_buf[i * 4 * N + 4 * j + t]) *
+ make_f32(src2_buf[j * 4 * K + 4 * k + t])) +
+ (make_f32(src1_buf[i * 4 * N + 4 * j + t + 1]) *
+ make_f32(src1_buf[i * 4 * N + 4 * j + t + 1]));
+ }
+
+}
+
+void test_amx_bf16_dpbf16ps ()
+{
+ __tilecfg_u cfg;
+ __tile dst, dst_ref, src1, src2;
+ uint8_t tmp_dst_buf[1024];
+
+ init_bf16_max_tile_buffer (tmp_dst_buf);
+
+ init_tile_config (&cfg);
+ init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
+ init_tile_reg_and_src_with_buffer (2, dst, tmp_dst_buf);
+ init_tile_reg_and_src_with_buffer (3, dst, tmp_dst_buf);
+
+ calc_matrix_dpbf16ps (&dst, &src1, &src2);
+
+ _tile_dpbf16ps (1, 2, 3);
+ _tile_stored (1, dst_ref.buf, _STRIDE);
+
+ if (!check_tile_register (&dst_ref, &dst))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-asmatt-1.c b/gcc/testsuite/gcc.target/i386/amxint8-asmatt-1.c
new file mode 100644
index 0000000..1842c23
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxint8-asmatt-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mamx-int8" } */
+/* { dg-final { scan-assembler "tdpbssd\[ \\t]+\[^\n\]*%tmm3+\[^\n\]*%tmm2+\[^\n\]*%tmm1" } } */
+/* { dg-final { scan-assembler "tdpbsud\[ \\t]+\[^\n\]*%tmm3+\[^\n\]*%tmm2+\[^\n\]*%tmm1" } } *
+/* { dg-final { scan-assembler "tdpbusd\[ \\t]+\[^\n\]*%tmm3+\[^\n\]*%tmm2+\[^\n\]*%tmm1" } } */
+/* { dg-final { scan-assembler "tdpbuud\[ \\t]+\[^\n\]*%tmm3+\[^\n\]*%tmm2+\[^\n\]*%tmm1" } } */
+#include <immintrin.h>
+
+#define TMM1 1
+#define TMM2 2
+#define TMM3 3
+
+void TEST ()
+{
+ _tile_dpbssd (TMM1, TMM2, TMM3);
+ _tile_dpbsud (TMM1, TMM2, TMM3);
+ _tile_dpbusd (TMM1, TMM2, TMM3);
+ _tile_dpbuud (TMM1, TMM2, TMM3);
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c b/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c
new file mode 100644
index 0000000..bcfbb3f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mamx-int8 -masm=intel" } */
+/* { dg-final { scan-assembler "tdpbssd\[ \\t]+\[^\n\]*%tmm1+\[^\n\]*%tmm2+\[^\n\]*%tmm3" } } */
+/* { dg-final { scan-assembler "tdpbsud\[ \\t]+\[^\n\]*%tmm1+\[^\n\]*%tmm2+\[^\n\]*%tmm3" } } *
+/* { dg-final { scan-assembler "tdpbusd\[ \\t]+\[^\n\]*%tmm1+\[^\n\]*%tmm2+\[^\n\]*%tmm3" } } */
+/* { dg-final { scan-assembler "tdpbuud\[ \\t]+\[^\n\]*%tmm1+\[^\n\]*%tmm2+\[^\n\]*%tmm3" } } */
+#include <immintrin.h>
+
+void TEST ()
+{
+ _tile_dpbssd (1, 2, 3);
+ _tile_dpbsud (1, 2, 3);
+ _tile_dpbusd (1, 2, 3);
+ _tile_dpbuud (1, 2, 3);
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
new file mode 100644
index 0000000..74ad71b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbssd-2.c
@@ -0,0 +1,64 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target amx_tile } */
+/* { dg-require-effective-target amx_int8 } */
+/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+#include <immintrin.h>
+
+#define AMX_INT8
+#define DO_TEST test_amx_int8_dpbssd
+void test_amx_int8_dpbssd ();
+#include "amx-check.h"
+
+/* Init tile buffer with int32 value*/
+void init_i32_max_tile_buffer (uint8_t *buf)
+{
+ int i, j;
+ int *ptr = (int *)buf;
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 16; j++)
+ ptr[i * 16 + j] = 2 * i - (16 - j);
+}
+
+void calc_matrix_dpbssd (__tile *dst, __tile *src1, __tile *src2)
+{
+ int8_t *src1_buf = (int8_t *)src1->buf;
+ int8_t *src2_buf = (int8_t *)src2->buf;
+ int *dst_buf = (int *)dst->buf;
+
+ int M = src1->rows;
+ int N = src1->colsb / 4;
+ int K = src2->colsb / 4;
+ int i, j, k, t;
+
+ for (i = 0; i < M; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < K; k++)
+ for (t = 0; t < 4; t++)
+ {
+ dst_buf[i * N + k] +=
+ ((int) src1_buf[i * 4 * N + 4 * j + t]) *
+ ((int) src2_buf[j * 4 * K + 4 * k + t]);
+ }
+}
+
+void test_amx_int8_dpbssd ()
+{
+ __tilecfg_u cfg;
+ __tile dst, dst_ref, src1, src2;
+ uint8_t tmp_dst_buf[1024];
+
+ init_i32_max_tile_buffer (tmp_dst_buf);
+
+ init_tile_config (&cfg);
+ init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
+ init_tile_reg_and_src (2, src1);
+ init_tile_reg_and_src (3, src2);
+
+ calc_matrix_dpbssd (&dst, &src1, &src2);
+
+ _tile_dpbssd (1, 2, 3);
+ _tile_stored (1, dst_ref.buf, _STRIDE);
+
+ if (!check_tile_register (&dst_ref, &dst))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
new file mode 100644
index 0000000..e7241bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbsud-2.c
@@ -0,0 +1,63 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target amx_tile } */
+/* { dg-require-effective-target amx_int8 } */
+/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+#include <immintrin.h>
+
+#define AMX_INT8
+#define DO_TEST test_amx_int8_dpbsud
+void test_amx_int8_dpbsud ();
+#include "amx-check.h"
+
+/* Init tile buffer with int32 value*/
+void init_i32_max_tile_buffer (uint8_t *buf)
+{
+ int i, j;
+ int *ptr = (int *)buf;
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 16; j++)
+ ptr[i * 16 + j] = 2 * i - (16 - j);
+}
+
+void calc_matrix_dpbsud (__tile *dst, __tile *src1, __tile *src2)
+{
+ int8_t *src1_buf = (int8_t *)src1->buf;
+ uint8_t *src2_buf = (uint8_t *)src2->buf;
+ int *dst_buf = (int *)dst->buf;
+
+ int M = src1->rows;
+ int N = src1->colsb / 4;
+ int K = src2->colsb / 4;
+ int i, j, k, t;
+
+ for (i = 0; i < M; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < K; k++)
+ for (t = 0; t < 4; t++)
+ {
+ dst_buf[i * N + k] +=
+ ((int) src1_buf[i * 4 * N + 4 * j + t]) *
+ ((unsigned) src2_buf[j * 4 * K + 4 * k + t]);
+ }
+}
+
+void test_amx_int8_dpbsud ()
+{
+ __tilecfg_u cfg;
+ __tile dst, dst_ref, src1, src2;
+ uint8_t tmp_dst_buf[1024];
+
+ init_i32_max_tile_buffer (tmp_dst_buf);
+
+ init_tile_config (&cfg);
+ init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
+ init_tile_reg_and_src (2, src1);
+ init_tile_reg_and_src (3, src2);
+
+ calc_matrix_dpbsud (&dst, &src1, &src2);
+ _tile_dpbsud (1, 2, 3);
+ _tile_stored (1, dst_ref.buf, _STRIDE);
+
+ if (!check_tile_register (&dst_ref, &dst))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
new file mode 100644
index 0000000..f0b9f97
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbusd-2.c
@@ -0,0 +1,63 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target amx_tile } */
+/* { dg-require-effective-target amx_int8 } */
+/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+#include <immintrin.h>
+
+#define AMX_INT8
+#define DO_TEST test_amx_int8_dpbusd
+void test_amx_int8_dpbusd ();
+#include "amx-check.h"
+
+/* Init tile buffer with int32 value*/
+void init_i32_max_tile_buffer (uint8_t *buf)
+{
+ int i, j;
+ int *ptr = (int *)buf;
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 16; j++)
+ ptr[i * 16 + j] = 2 * i - (16 - j);
+}
+
+void calc_matrix_dpbusd (__tile *dst, __tile *src1, __tile *src2)
+{
+ uint8_t *src1_buf = (uint8_t *)src1->buf;
+ int8_t *src2_buf = (int8_t *)src2->buf;
+ int *dst_buf = (int *)dst->buf;
+
+ int M = src1->rows;
+ int N = src1->colsb / 4;
+ int K = src2->colsb / 4;
+ int i, j, k, t;
+
+ for (i = 0; i < M; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < K; k++)
+ for (t = 0; t < 4; t++)
+ {
+ dst_buf[i * N + k] +=
+ ((unsigned) src1_buf[i * 4 * N + 4 * j + t]) *
+ ((int) src2_buf[j * 4 * K + 4 * k + t]);
+ }
+}
+
+void test_amx_int8_dpbusd ()
+{
+ __tilecfg_u cfg;
+ __tile dst, dst_ref, src1, src2;
+ uint8_t tmp_dst_buf[1024];
+
+ init_i32_max_tile_buffer (tmp_dst_buf);
+
+ init_tile_config (&cfg);
+ init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
+ init_tile_reg_and_src (2, src1);
+ init_tile_reg_and_src (3, src2);
+
+ calc_matrix_dpbusd (&dst, &src1, &src2);
+ _tile_dpbusd (1, 2, 3);
+ _tile_stored (1, dst_ref.buf, _STRIDE);
+
+ if (!check_tile_register (&dst_ref, &dst))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c b/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
new file mode 100644
index 0000000..eb70b2f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxint8-dpbuud-2.c
@@ -0,0 +1,63 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target amx_tile } */
+/* { dg-require-effective-target amx_int8 } */
+/* { dg-options "-O2 -mamx-tile -mamx-int8" } */
+#include <immintrin.h>
+
+#define AMX_INT8
+#define DO_TEST test_amx_int8_dpbuud
+void test_amx_int8_dpbuud ();
+#include "amx-check.h"
+
+/* Init tile buffer with int32 value*/
+void init_i32_max_tile_buffer (uint8_t *buf)
+{
+ int i, j;
+ int *ptr = (int *)buf;
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 16; j++)
+ ptr[i * 16 + j] = 2 * i - (16 - j);
+}
+
+void calc_matrix_dpbuud (__tile *dst, __tile *src1, __tile *src2)
+{
+ uint8_t *src1_buf = (uint8_t *)src1->buf;
+ uint8_t *src2_buf = (uint8_t *)src2->buf;
+ int *dst_buf = (int *)dst->buf;
+
+ int M = src1->rows;
+ int N = src1->colsb / 4;
+ int K = src2->colsb / 4;
+ int i, j, k, t;
+
+ for (i = 0; i < M; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < K; k++)
+ for (t = 0; t < 4; t++)
+ {
+ dst_buf[i * N + k] +=
+ ((unsigned) src1_buf[i * 4 * N + 4 * j + t]) *
+ ((unsigned) src2_buf[j * 4 * K + 4 * k + t]);
+ }
+}
+
+void test_amx_int8_dpbuud ()
+{
+ __tilecfg_u cfg;
+ __tile dst, dst_ref, src1, src2;
+ uint8_t tmp_dst_buf[1024];
+
+ init_i32_max_tile_buffer (tmp_dst_buf);
+
+ init_tile_config (&cfg);
+ init_tile_reg_and_src_with_buffer (1, dst, tmp_dst_buf);
+ init_tile_reg_and_src (2, src1);
+ init_tile_reg_and_src (3, src2);
+
+ calc_matrix_dpbuud (&dst, &src1, &src2);
+ _tile_dpbuud (1, 2, 3);
+ _tile_stored (1, dst_ref.buf, _STRIDE);
+
+ if (!check_tile_register (&dst_ref, &dst))
+ abort();
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxtile-2.c b/gcc/testsuite/gcc.target/i386/amxtile-2.c
new file mode 100644
index 0000000..1f4138e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxtile-2.c
@@ -0,0 +1,48 @@
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-require-effective-target amx_tile } */
+/* { dg-options "-O2 -mamx-tile " } */
+#include <immintrin.h>
+
+#define DO_TEST test_amx_tile
+void test_amx_tile ();
+#include "amx-check.h"
+
+void test_amx_tile ()
+{
+ __tilecfg_u cfg_src, cfg_dst;
+ __tile reg_src1, reg_src2, reg_ref;
+
+ /* check tile config load & store. */
+ init_tile_config (&cfg_src);
+ _tile_storeconfig (cfg_dst.a);
+
+ if (!check_tile_config (&cfg_src, &cfg_dst))
+ abort ();
+
+ /* check tile register load & store. */
+ init_tile_reg_and_src (1, reg_src1);
+ _tile_stored (1, reg_ref.buf, _STRIDE);
+ if (!check_tile_register (&reg_ref, &reg_src1))
+ abort ();
+
+ /* check tile stream load instruction */
+ init_tile_src (2, &reg_src2, NULL);
+ _tile_stream_loadd (2, reg_src2.buf, _STRIDE);
+ _tile_stored (2, reg_ref.buf, _STRIDE);
+ if (!check_tile_register (&reg_ref, &reg_src2))
+ abort ();
+
+ /* check tile register zeroing */
+ zero_tile_src (&reg_src2);
+ _tile_zero (2);
+ _tile_stored (2, reg_ref.buf, _STRIDE);
+ if (!check_tile_register (&reg_ref, &reg_src2))
+ abort ();
+
+ /* check tile cfg zeroing */
+ memset (cfg_dst.a, 0, sizeof(__tilecfg));
+ _tile_release ();
+ _tile_storeconfig (cfg_src.a);
+ if (!check_tile_config (&cfg_src, &cfg_dst))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxtile-asmatt-1.c b/gcc/testsuite/gcc.target/i386/amxtile-asmatt-1.c
new file mode 100644
index 0000000..ceb5fa4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxtile-asmatt-1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mamx-tile " } */
+/* { dg-final { scan-assembler "ldtilecfg\[ \\t]+\(\[^\)\n\]*\)" } } */
+/* { dg-final { scan-assembler "sttilecfg\[ \\t]+\(\[^\)\n\]*\)" } } */
+/* { dg-final { scan-assembler "tilerelease" } } */
+/* { dg-final { scan-assembler "tileloadd\[ \\t]+\[^\n\]*\\(%\[a-z0-9]*\,%\[a-z0-9\]*\,\[124\]\\)+\[^\n\]*%tmm\[0-9\]" } } */
+/* { dg-final { scan-assembler "tileloaddt1\[ \\t]+\[^\n\]*\\(%\[a-z0-9]*\,%\[a-z0-9\]*\,\[124\]\\)+\[^\n\]*%tmm\[0-9\]" } } */
+/* { dg-final { scan-assembler "tilestored\[ \\t]+\[^\n\]*%tmm\[0-9\]+\[^\n\]*\\(%\[a-z0-9]*\,%\[a-z0-9\]*\,\[124\]\\)" } } */
+/* { dg-final { scan-assembler "tilezero\[ \\t]+\[^\n\]*%tmm\[0-9\]" } } */
+#include <immintrin.h>
+
+extern int a[];
+extern const void* base;
+extern const int stride;
+
+#define TMM0 0
+#define TMM1 1
+#define TMM2 2
+#define TMM3 3
+
+void TEST ()
+{
+ _tile_loadconfig (a);
+ _tile_storeconfig (a);
+ _tile_release ();
+ _tile_loadd (TMM3, base, stride);
+ _tile_stream_loadd (TMM2, base, stride);
+ _tile_stored (TMM1, base, stride);
+ _tile_zero (TMM0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c b/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c
new file mode 100644
index 0000000..88ef612
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c
@@ -0,0 +1,24 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mamx-tile -masm=intel " } */
+/* { dg-final { scan-assembler "ldtilecfg\[ \\t]" } } */
+/* { dg-final { scan-assembler "sttilecfg\[ \\t]" } } */
+/* { dg-final { scan-assembler "tilerelease" } } */
+/* { dg-final { scan-assembler "tileloadd\[ \\t]%tmm\[0-9\]" } } */
+/* { dg-final { scan-assembler "tileloaddt1\[ \\t]%tmm\[0-9\]" } } */
+/* { dg-final { scan-assembler "tilestored\[ \\t]\[^\n\]+\[^\n\]*%tmm\[0-9\]" } } */
+/* { dg-final { scan-assembler "tilezero\[ \\t]+\[^\n\]*%tmm\[0-9\]" } } */
+#include <immintrin.h>
+
+extern int a[];
+extern const void* base;
+extern const int stride;
+void TEST ()
+{
+ _tile_loadconfig (a);
+ _tile_storeconfig (a);
+ _tile_release ();
+ _tile_loadd (5, base, stride);
+ _tile_stream_loadd (4, base, stride);
+ _tile_stored (3, base, stride);
+ _tile_zero (2);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx-1.c b/gcc/testsuite/gcc.target/i386/avx-1.c
index 3600a7a..6178e38 100644
--- a/gcc/testsuite/gcc.target/i386/avx-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx-1.c
@@ -381,6 +381,8 @@
#define __builtin_ia32_vfmaddss3_mask3(A, B, C, D, E) __builtin_ia32_vfmaddss3_mask3(A, B, C, D, 8)
#define __builtin_ia32_vfmaddss3_maskz(A, B, C, D, E) __builtin_ia32_vfmaddss3_maskz(A, B, C, D, 8)
#define __builtin_ia32_vfmsubss3_mask3(A, B, C, D, E) __builtin_ia32_vfmsubss3_mask3(A, B, C, D, 8)
+#define __builtin_ia32_cvtsd2ss_mask_round(A, B, C, D, E) __builtin_ia32_cvtsd2ss_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_cvtss2sd_mask_round(A, B, C, D, E) __builtin_ia32_cvtss2sd_mask_round(A, B, C, D, 8)
/* avx512erintrin.h */
#define __builtin_ia32_exp2ps_mask(A, B, C, D) __builtin_ia32_exp2ps_mask(A, B, C, 8)
@@ -393,6 +395,10 @@
#define __builtin_ia32_rcp28sd_round(A, B, C) __builtin_ia32_rcp28sd_round(A, B, 8)
#define __builtin_ia32_rsqrt28ss_round(A, B, C) __builtin_ia32_rsqrt28ss_round(A, B, 8)
#define __builtin_ia32_rsqrt28sd_round(A, B, C) __builtin_ia32_rsqrt28sd_round(A, B, 8)
+#define __builtin_ia32_rcp28sd_mask_round(A, B, C, D, E) __builtin_ia32_rcp28sd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rcp28ss_mask_round(A, B, C, D, E) __builtin_ia32_rcp28ss_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rsqrt28sd_mask_round(A, B, C, D, E) __builtin_ia32_rsqrt28sd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rsqrt28ss_mask_round(A, B, C, D, E) __builtin_ia32_rsqrt28ss_mask_round(A, B, C, D, 8)
/* avx512pfintrin.h */
#define __builtin_ia32_gatherpfdps(A, B, C, D, E) __builtin_ia32_gatherpfdps(A, B, C, 1, _MM_HINT_T0)
@@ -464,6 +470,10 @@
#define __builtin_ia32_cvtps2qq512_mask(A, B, C, D) __builtin_ia32_cvtps2qq512_mask(A, B, C, 8)
#define __builtin_ia32_cvtpd2uqq512_mask(A, B, C, D) __builtin_ia32_cvtpd2uqq512_mask(A, B, C, 8)
#define __builtin_ia32_cvtpd2qq512_mask(A, B, C, D) __builtin_ia32_cvtpd2qq512_mask(A, B, C, 8)
+#define __builtin_ia32_reducesd_mask_round(A, B, C, D, E, F) __builtin_ia32_reducesd_mask_round(A, B, 8, D, E, 8)
+#define __builtin_ia32_reducess_mask_round(A, B, C, D, E, F) __builtin_ia32_reducess_mask_round(A, B, 8, D, E, 8)
+#define __builtin_ia32_reducepd512_mask_round(A, B, C, D, E) __builtin_ia32_reducepd512_mask_round(A, 8, C, D, 8)
+#define __builtin_ia32_reduceps512_mask_round(A, B, C, D, E) __builtin_ia32_reduceps512_mask_round(A, 8, C, D, 8)
/* avx512vlintrin.h */
#define __builtin_ia32_vpermilps_mask(A, E, C, D) __builtin_ia32_vpermilps_mask(A, 1, C, D)
@@ -680,6 +690,16 @@
#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)
+/* lwpintrin.h */
+#define __builtin_ia32_lwpval32(D2, D1, F) __builtin_ia32_lwpval32 (D2, D1, 1)
+#define __builtin_ia32_lwpval64(D2, D1, F) __builtin_ia32_lwpval64 (D2, D1, 1)
+#define __builtin_ia32_lwpins32(D2, D1, F) __builtin_ia32_lwpins32 (D2, D1, 1)
+#define __builtin_ia32_lwpins64(D2, D1, F) __builtin_ia32_lwpins64 (D2, D1, 1)
+
+/* tbmintrin.h */
+#define __builtin_ia32_bextri_u32(X, Y) __builtin_ia32_bextri_u32 (X, 1)
+#define __builtin_ia32_bextri_u64(X, Y) __builtin_ia32_bextri_u64 (X, 1)
+
#include <wmmintrin.h>
#include <immintrin.h>
#include <mm3dnow.h>
diff --git a/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-1.c b/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-1.c
index 7805e3d..24dadbe 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-1.c
@@ -1,14 +1,15 @@
/* { dg-do compile } */
/* { dg-options "-mavx2 -O2" } */
-/* { dg-final { scan-assembler "vbroadcasti128\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
+/* { dg-final { scan-assembler-times "vbroadcasti128\[ \\t\]+\[^\n\]*%ymm\[0-9\]+" 2 } } */
#include <immintrin.h>
-volatile __m256i x;
-__m128i y;
+volatile __m256i x,xx;
+__m128i y,yy;
void extern
avx2_test (void)
{
x = _mm256_broadcastsi128_si256 (y);
+ xx = _mm_broadcastsi128_si256 (yy);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-2.c b/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-2.c
index ef1d370..a19464e 100644
--- a/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx2-vbroadcastsi128-2.c
@@ -9,7 +9,7 @@ void static
avx2_test (void)
{
union128i_q s1;
- union256i_q res;
+ union256i_q res, res1;
long long int res_ref[4];
int i, j;
int fail = 0;
@@ -20,11 +20,13 @@ avx2_test (void)
s1.a[j] = j * i;
res.x = _mm256_broadcastsi128_si256 (s1.x);
+ res1.x = _mm_broadcastsi128_si256 (s1.x);
memcpy (res_ref, s1.a, 16);
memcpy (res_ref + 2, s1.a, 16);
fail += check_union256i_q (res, res_ref);
+ fail += check_union256i_q (res1, res_ref);
}
if (fail != 0)
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu16-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu16-1.c
index a0d0e36..dcb8caa 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu16-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu16-1.c
@@ -15,13 +15,19 @@
/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vmovdqu16|vinserti128)\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vmovdqu16|vextracti128)\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu16\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-short *p;
-volatile __m512i x1, yy;
-volatile __m256i x2, y2;
-volatile __m128i x3, y3;
+short *p, *p1, *p2, *p3, *p4, *p5, *p6;
+volatile __m512i x1, yy, zzz;
+volatile __m256i x2, y2, yyy;
+volatile __m128i x3, y3, xxx;
volatile __mmask32 m32;
volatile __mmask16 m16;
volatile __mmask8 m8;
@@ -45,7 +51,15 @@ avx512bw_test (void)
x2 = _mm256_maskz_loadu_epi16 (m16, p);
x3 = _mm_maskz_loadu_epi16 (m8, p);
+ zzz = _mm512_loadu_epi16 (p5);
+ yyy = _mm256_loadu_epi16 (p3);
+ xxx = _mm_loadu_epi16 (p1);
+
_mm512_mask_storeu_epi16 (p, m32, x1);
_mm256_mask_storeu_epi16 (p, m16, x2);
_mm_mask_storeu_epi16 (p, m8, x3);
+
+ _mm512_storeu_epi16 (p6, zzz);
+ _mm256_storeu_epi16 (p4, yyy);
+ _mm_storeu_epi16 (p2, xxx);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu8-1.c b/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu8-1.c
index 6d24e79..a335bca 100644
--- a/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu8-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512bw-vmovdqu8-1.c
@@ -15,13 +15,17 @@
/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqu8\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-char *p;
-volatile __m512i x1, yy;
+char *p, *p1, *p2, *p3, *p4;
+volatile __m512i x1, yy, zzz;
volatile __m256i x2, y2;
-volatile __m128i x3, y3;
+volatile __m128i x3, y3, xxx;
volatile __mmask64 m64;
volatile __mmask32 m32;
volatile __mmask16 m16;
@@ -45,7 +49,13 @@ avx512bw_test (void)
x2 = _mm256_maskz_loadu_epi8 (m32, p);
x3 = _mm_maskz_loadu_epi8 (m16, p);
+ zzz = _mm512_loadu_epi8 (p3);
+ xxx = _mm_loadu_epi8 (p1);
+
_mm512_mask_storeu_epi8 (p, m64, x1);
_mm256_mask_storeu_epi8 (p, m32, x2);
_mm_mask_storeu_epi8 (p, m16, x3);
+
+ _mm512_storeu_epi8 (p4, zzz);
+ _mm_storeu_epi8 (p2, xxx);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-3.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-3.c
new file mode 100644
index 0000000..4dc1585
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-3.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512dq -O2" } */
+/* { dg-final { scan-assembler-times "vreducepd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducepd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducepd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+#define IMM 123
+
+volatile __m512d xx1;
+volatile __mmask8 m;
+
+void extern
+avx512dq_test (void)
+{
+ xx1 = _mm512_reduce_round_pd(xx1, IMM, _MM_FROUND_NO_EXC);
+
+ xx1 = _mm512_mask_reduce_round_pd (xx1, m, xx1, IMM, _MM_FROUND_NO_EXC);
+
+ xx1 = _mm512_maskz_reduce_round_pd (m, xx1, IMM, _MM_FROUND_NO_EXC);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-4.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-4.c
new file mode 100644
index 0000000..2b39670
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreducepd-4.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512dq" } */
+/* { dg-require-effective-target avx512dq } */
+
+#define AVX512DQ
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 64)
+#include "avx512f-mask-type.h"
+
+#define IMM 0x23
+
+void
+CALC (double *s, double *r)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ double tmp = (int) (4 * s[i]) / 4.0;
+ r[i] = s[i] - tmp;
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN, d) s, res1, res2, res3;
+ MASK_TYPE mask = MASK_VALUE;
+ double res_ref[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s.a[i] = 123.456 * (i + 2000) * sign;
+ res2.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res1.x = INTRINSIC (_reduce_round_pd) (s.x, IMM, _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res2.x = INTRINSIC (_mask_reduce_round_pd) (res2.x, mask, s.x,
+ IMM, _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res3.x = INTRINSIC (_maskz_reduce_round_pd) (mask, s.x, IMM,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+
+ CALC (s.a, res_ref);
+
+ if (UNION_FP_CHECK (AVX512F_LEN, d) (res1, res_ref))
+ abort ();
+
+ MASK_MERGE (d) (res_ref, mask, SIZE);
+ if (UNION_FP_CHECK (AVX512F_LEN, d) (res2, res_ref))
+ abort ();
+
+ MASK_ZERO (d) (res_ref, mask, SIZE);
+ if (UNION_FP_CHECK (AVX512F_LEN, d) (res3, res_ref))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-3.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-3.c
new file mode 100644
index 0000000..959d51f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-3.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512dq -O2" } */
+/* { dg-final { scan-assembler-times "vreduceps\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreduceps\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreduceps\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+#define IMM 123
+
+volatile __m512 xx1;
+volatile __mmask16 m16;
+
+void extern
+avx512dq_test (void)
+{
+ xx1 = _mm512_reduce_round_ps (xx1, IMM, _MM_FROUND_NO_EXC);
+
+ xx1 = _mm512_mask_reduce_round_ps (xx1, m16, xx1, IMM, _MM_FROUND_NO_EXC);
+
+ xx1 = _mm512_maskz_reduce_round_ps (m16, xx1, IMM, _MM_FROUND_NO_EXC);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-4.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-4.c
new file mode 100644
index 0000000..6b687b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreduceps-4.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mavx512dq" } */
+/* { dg-require-effective-target avx512dq } */
+
+#define AVX512DQ
+#include "avx512f-helper.h"
+
+#define SIZE (AVX512F_LEN / 32)
+#include "avx512f-mask-type.h"
+
+#define IMM 0x23
+
+void
+CALC (float *s, float *r)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ float tmp = (int) (4 * s[i]) / 4.0;
+ r[i] = s[i] - tmp;
+ }
+}
+
+void
+TEST (void)
+{
+ UNION_TYPE (AVX512F_LEN,) s, res1, res2, res3;
+ MASK_TYPE mask = MASK_VALUE;
+ float res_ref[SIZE];
+ int i, sign = 1;
+
+ for (i = 0; i < SIZE; i++)
+ {
+ s.a[i] = 123.456 * (i + 2000) * sign;
+ res2.a[i] = DEFAULT_VALUE;
+ sign = -sign;
+ }
+
+ res1.x = INTRINSIC (_reduce_round_ps) (s.x, IMM, _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res2.x = INTRINSIC (_mask_reduce_round_ps) (res2.x, mask, s.x,
+ IMM, _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res3.x = INTRINSIC (_maskz_reduce_round_ps) (mask, s.x, IMM,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+
+ CALC (s.a, res_ref);
+
+ if (UNION_FP_CHECK (AVX512F_LEN,) (res1, res_ref))
+ abort ();
+
+ MASK_MERGE () (res_ref, mask, SIZE);
+ if (UNION_FP_CHECK (AVX512F_LEN,) (res2, res_ref))
+ abort ();
+
+ MASK_ZERO () (res_ref, mask, SIZE);
+ if (UNION_FP_CHECK (AVX512F_LEN,) (res3, res_ref))
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-1.c
index b8f24a0c..63d9537 100644
--- a/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-1.c
@@ -2,8 +2,11 @@
/* { dg-options "-mavx512dq -O2" } */
/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vreducesd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
@@ -11,15 +14,18 @@
#define IMM 123
-volatile __m128d x1, x2;
+volatile __m128d x1, x2, xx1, xx2;
volatile __mmask8 m;
void extern
avx512dq_test (void)
{
+ xx1 = _mm_reduce_round_sd (xx1, xx2, IMM, _MM_FROUND_NO_EXC);
x1 = _mm_reduce_sd (x1, x2, IMM);
+ xx1 = _mm_mask_reduce_round_sd(xx1, m, xx1, xx2, IMM, _MM_FROUND_NO_EXC);
x1 = _mm_mask_reduce_sd(x1, m, x1, x2, IMM);
+ xx1 = _mm_maskz_reduce_round_sd(m, xx1, xx2, IMM, _MM_FROUND_NO_EXC);
x1 = _mm_maskz_reduce_sd(m, x1, x2, IMM);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-2.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-2.c
index 93e1827..17448c0 100644
--- a/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreducesd-2.c
@@ -28,7 +28,7 @@ CALC (double *r, double *s)
void
TEST (void)
{
- union128d res1, res2, res3;
+ union128d res1, res2, res3, res4, res5, res6;
union128d s1, s2, src;
double res_ref[2];
MASK_TYPE mask = MASK_VALUE;
@@ -42,25 +42,45 @@ TEST (void)
res1.a[j] = DEFAULT_VALUE;
res2.a[j] = DEFAULT_VALUE;
res3.a[j] = DEFAULT_VALUE;
+ res4.a[j] = DEFAULT_VALUE;
+ res5.a[j] = DEFAULT_VALUE;
+ res6.a[j] = DEFAULT_VALUE;
}
res1.x = _mm_reduce_sd (s1.x, s2.x, IMM);
res2.x = _mm_mask_reduce_sd (s1.x, mask, s1.x, s2.x, IMM);
res3.x = _mm_maskz_reduce_sd (mask, s1.x, s2.x, IMM);
+ res4.x = _mm_reduce_round_sd (s1.x, s2.x, IMM,_MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res5.x = _mm_mask_reduce_round_sd (s1.x, mask, s1.x, s2.x, IMM,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res6.x = _mm_maskz_reduce_round_sd (mask, s1.x, s2.x, IMM,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
CALC (res_ref, s2.a);
if (check_union128d (res1, res_ref))
abort ();
+ if (check_union128d (res4, res_ref))
+ abort ();
+
MASK_MERGE (d) (res_ref, mask, 1);
if (check_union128d (res2, res_ref))
abort ();
+ if (check_union128d (res5, res_ref))
+ abort ();
+
MASK_ZERO (d) (res_ref, mask, 1);
if (check_union128d (res3, res_ref))
abort ();
+ if (check_union128d (res6, res_ref))
+ abort ();
+
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-1.c
index 804074e..341bd46 100644
--- a/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-1.c
@@ -2,23 +2,29 @@
/* { dg-options "-mavx512dq -O2" } */
/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vreducess\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
#define IMM 123
-volatile __m128 x1, x2;
+volatile __m128 x1, x2, xx1, xx2;
volatile __mmask8 m;
void extern
avx512dq_test (void)
{
+ xx1 = _mm_reduce_round_ss (xx1, xx2, IMM, _MM_FROUND_NO_EXC);
x1 = _mm_reduce_ss (x1, x2, IMM);
+ xx1 = _mm_mask_reduce_round_ss (xx1, m, xx1, xx2, IMM, _MM_FROUND_NO_EXC);
x1 = _mm_mask_reduce_ss (x1, m, x1, x2, IMM);
+ xx1 = _mm_maskz_reduce_round_ss (m, xx1, xx2, IMM, _MM_FROUND_NO_EXC);
x1 = _mm_maskz_reduce_ss (m, x1, x2, IMM);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-2.c b/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-2.c
index 8558c3b..6d8938d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512dq-vreducess-2.c
@@ -30,7 +30,7 @@ TEST (void)
{
printf("\nsize = %d\n\n", SIZE);
- union128 res1, res2, res3;
+ union128 res1, res2, res3, res4, res5, res6;
union128 s1, s2, src;
float res_ref[4];
MASK_TYPE mask = MASK_VALUE;
@@ -44,25 +44,45 @@ TEST (void)
res1.a[j] = DEFAULT_VALUE;
res2.a[j] = DEFAULT_VALUE;
res3.a[j] = DEFAULT_VALUE;
+ res4.a[j] = DEFAULT_VALUE;
+ res5.a[j] = DEFAULT_VALUE;
+ res6.a[j] = DEFAULT_VALUE;
}
res1.x = _mm_reduce_ss (s1.x, s2.x, IMM);
res2.x = _mm_mask_reduce_ss (s1.x, mask, s1.x, s2.x, IMM);
res3.x = _mm_maskz_reduce_ss (mask, s1.x, s2.x, IMM);
+ res4.x = _mm_reduce_round_ss (s1.x, s2.x, IMM, _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res5.x = _mm_mask_reduce_round_ss (s1.x, mask, s1.x, s2.x,
+ IMM, _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res6.x = _mm_maskz_reduce_round_ss (mask, s1.x, s2.x, IMM,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
CALC (res_ref, s2.a);
if (check_union128 (res1, res_ref))
abort ();
+ if (check_union128 (res4, res_ref))
+ abort ();
+
MASK_MERGE () (res_ref, mask, 1);
if (check_union128 (res2, res_ref))
abort ();
+ if (check_union128 (res5, res_ref))
+ abort ();
+
MASK_ZERO () (res_ref, mask, 1);
if (check_union128 (res3, res_ref))
abort ();
+ if (check_union128 (res6, res_ref))
+ abort ();
+
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-1.c b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-1.c
index 9c76085..03e75cc 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-1.c
@@ -2,14 +2,23 @@
/* { dg-options "-mavx512er -O2" } */
/* { dg-final { scan-assembler-times "vrcp28sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vrcp28sd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28sd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28sd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128d x, y;
+volatile __m128d x, y, z;
+volatile __mmask8 m;
void extern
avx512er_test (void)
{
x = _mm_rcp28_sd (x, y);
x = _mm_rcp28_round_sd (x, y, _MM_FROUND_NO_EXC);
+ x = _mm_mask_rcp28_sd (z, m, x, y);
+ x = _mm_mask_rcp28_round_sd (z, m, x, y, _MM_FROUND_NO_EXC);
+ x = _mm_maskz_rcp28_sd (m, x, y);
+ x = _mm_maskz_rcp28_round_sd (m, x, y, _MM_FROUND_NO_EXC);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-2.c b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-2.c
index 889f990..93d370d 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28sd-2.c
@@ -7,11 +7,14 @@
#include "avx512f-helper.h"
#include <math.h>
+#define IMM 0x23
+
void static
avx512er_test (void)
{
- union128d src1, src2, res;
+ union128d src1, src2, res, res1, res2, res3, res4;
double res_ref[2];
+ MASK_TYPE mask = MASK_VALUE;
int i;
for (i = 0; i < 2; i++)
@@ -24,7 +27,32 @@ avx512er_test (void)
res_ref[0] = 1.0 / src2.a[0];
res.x = _mm_rcp28_round_sd (src1.x, src2.x, _MM_FROUND_NO_EXC);
+ res1.x = _mm_mask_rcp28_sd (src1.x, IMM, src1.x, src2.x);
+ res2.x = _mm_mask_rcp28_round_sd (src1.x, IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res3.x = _mm_maskz_rcp28_sd (IMM, src1.x, src2.x);
+ res4.x = _mm_maskz_rcp28_round_sd (IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+
if (checkVd (res.a, res_ref, 2))
abort ();
+
+ MASK_MERGE (d) (res_ref, mask, 1);
+
+ if (checkVd (res1.a, res_ref, 2))
+ abort ();
+
+ if (checkVd (res2.a, res_ref, 2))
+ abort ();
+
+ MASK_ZERO (d) (res_ref, mask, 1);
+
+ if (checkVd (res3.a, res_ref, 2))
+ abort ();
+
+ if (checkVd (res4.a, res_ref, 2))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-1.c b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-1.c
index 335c44f..87a8ac3 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-1.c
@@ -2,14 +2,23 @@
/* { dg-options "-mavx512er -O2" } */
/* { dg-final { scan-assembler-times "vrcp28ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vrcp28ss\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\]*(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28ss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrcp28ss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128 x, y;
+volatile __m128 x, y, z;
+volatile __mmask8 m;
void extern
avx512er_test (void)
{
x = _mm_rcp28_ss (x, y);
x = _mm_rcp28_round_ss (x, y, _MM_FROUND_NO_EXC);
+ x = _mm_mask_rcp28_ss (z, m, x, y);
+ x = _mm_mask_rcp28_round_ss (z, m, x, y, _MM_FROUND_NO_EXC);
+ x = _mm_maskz_rcp28_ss (m, x, y);
+ x = _mm_maskz_rcp28_round_ss (m, x, y, _MM_FROUND_NO_EXC);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-2.c b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-2.c
index 3280879..4ffa92c 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrcp28ss-2.c
@@ -7,11 +7,14 @@
#include "avx512f-helper.h"
#include <math.h>
+#define IMM 0x23
+
void static
avx512er_test (void)
{
- union128 src1, src2, res;
+ union128 src1, src2, res, res1, res2, res3, res4;
float res_ref[4];
+ MASK_TYPE mask = MASK_VALUE;
int i;
for (i = 0; i < 4; i++)
@@ -24,7 +27,31 @@ avx512er_test (void)
res_ref[0] = 1.0 / src2.a[0];
res.x = _mm_rcp28_round_ss (src1.x, src2.x, _MM_FROUND_NO_EXC);
+ res1.x = _mm_mask_rcp28_ss (src1.x, IMM, src1.x, src2.x);
+ res2.x = _mm_mask_rcp28_round_ss (src1.x, IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res3.x = _mm_maskz_rcp28_ss (IMM, src1.x, src2.x);
+ res4.x = _mm_maskz_rcp28_round_ss (IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
if (checkVf (res.a, res_ref, 4))
abort ();
+
+ MASK_MERGE () (res_ref, mask, 1);
+
+ if (checkVf (res1.a, res_ref, 2))
+ abort ();
+
+ if (checkVf (res2.a, res_ref, 2))
+ abort ();
+
+ MASK_ZERO () (res_ref, mask, 1);
+
+ if (checkVf (res3.a, res_ref, 2))
+ abort ();
+
+ if (checkVf (res4.a, res_ref, 2))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-1.c b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-1.c
index de3341f..ca54906 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-1.c
@@ -2,14 +2,23 @@
/* { dg-options "-mavx512er -O2" } */
/* { dg-final { scan-assembler-times "vrsqrt28sd\[ \\t\]+\[^\{^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vrsqrt28sd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28sd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28sd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128d x, y;
+volatile __m128d x, y, z;
+volatile __mmask8 m;
void extern
avx512er_test (void)
{
x = _mm_rsqrt28_sd (x, y);
x = _mm_rsqrt28_round_sd (x, y, _MM_FROUND_NO_EXC);
+ x = _mm_mask_rsqrt28_sd (z, m, x, y);
+ x = _mm_mask_rsqrt28_round_sd (z, m, x, y, _MM_FROUND_NO_EXC);
+ x = _mm_maskz_rsqrt28_sd (m, x, y);
+ x = _mm_maskz_rsqrt28_round_sd (m, x, y, _MM_FROUND_NO_EXC);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-2.c b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-2.c
index bd217e8..2606191 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28sd-2.c
@@ -7,11 +7,14 @@
#include "avx512f-helper.h"
#include <math.h>
+#define IMM 0x23
+
void static
avx512er_test (void)
{
- union128d src1, src2, res;
+ union128d src1, src2, res, res1, res2, res3, res4;
double res_ref[2];
+ MASK_TYPE mask = MASK_VALUE;
int i;
for (i = 0; i < 2; i++)
@@ -24,7 +27,31 @@ avx512er_test (void)
res_ref[0] = 1.0 / sqrt (src2.a[0]);
res.x = _mm_rsqrt28_round_sd (src1.x, src2.x, _MM_FROUND_NO_EXC);
+ res1.x = _mm_mask_rsqrt28_sd (src1.x, IMM, src1.x, src2.x);
+ res2.x = _mm_mask_rsqrt28_round_sd (src1.x, IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res3.x = _mm_maskz_rsqrt28_sd (IMM, src1.x, src2.x);
+ res4.x = _mm_maskz_rsqrt28_round_sd (IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
if (checkVd (res.a, res_ref, 2))
abort ();
+
+ MASK_MERGE (d) (res_ref, mask, 1);
+
+ if (checkVd (res1.a, res_ref, 2))
+ abort ();
+
+ if (checkVd (res2.a, res_ref, 2))
+ abort ();
+
+ MASK_ZERO (d) (res_ref, mask, 1);
+
+ if (checkVd (res3.a, res_ref, 2))
+ abort ();
+
+ if (checkVd (res4.a, res_ref, 2))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-1.c b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-1.c
index 701cb55..c97376e 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-1.c
@@ -2,14 +2,23 @@
/* { dg-options "-mavx512er -O2" } */
/* { dg-final { scan-assembler-times "vrsqrt28ss\[ \\t\]+\[^\{^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vrsqrt28ss\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28ss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28ss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128 x, y;
+volatile __m128 x, y, z;
+volatile __mmask8 m;
void extern
avx512er_test (void)
{
x = _mm_rsqrt28_ss (x, y);
x = _mm_rsqrt28_round_ss (x, y, _MM_FROUND_NO_EXC);
+ x = _mm_mask_rsqrt28_ss (z, m, x, y);
+ x = _mm_mask_rsqrt28_round_ss (z, m, x, y, _MM_FROUND_NO_EXC);
+ x = _mm_maskz_rsqrt28_ss (m, x, y);
+ x = _mm_maskz_rsqrt28_round_ss (m, x, y, _MM_FROUND_NO_EXC);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-2.c b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-2.c
index f7bfff5..fa1c19b 100644
--- a/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512er-vrsqrt28ss-2.c
@@ -7,11 +7,14 @@
#include "avx512f-helper.h"
#include <math.h>
+#define IMM 0x23
+
void static
avx512er_test (void)
{
- union128 src1, src2, res;
+ union128 src1, src2, res, res1, res2, res3, res4;
float res_ref[4];
+ MASK_TYPE mask = MASK_VALUE;
int i;
for (i = 0; i < 4; i++)
@@ -24,7 +27,31 @@ avx512er_test (void)
res_ref[0] = 1.0 / sqrt (src2.a[0]);
res.x = _mm_rsqrt28_round_ss (src1.x, src2.x, _MM_FROUND_NO_EXC);
+ res1.x = _mm_mask_rsqrt28_ss (src1.x, IMM, src1.x, src2.x);
+ res2.x = _mm_mask_rsqrt28_round_ss (src1.x, IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
+ res3.x = _mm_maskz_rsqrt28_ss (IMM, src1.x, src2.x);
+ res4.x = _mm_maskz_rsqrt28_round_ss (IMM, src1.x, src2.x,
+ _MM_FROUND_TO_NEAREST_INT
+ | _MM_FROUND_NO_EXC);
if (checkVf (res.a, res_ref, 4))
abort ();
+
+ MASK_MERGE () (res_ref, mask, 1);
+
+ if (checkVf (res1.a, res_ref, 2))
+ abort ();
+
+ if (checkVf (res2.a, res_ref, 2))
+ abort ();
+
+ MASK_ZERO () (res_ref, mask, 1);
+
+ if (checkVf (res3.a, res_ref, 2))
+ abort ();
+
+ if (checkVf (res4.a, res_ref, 2))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si-1.c
index 845e206..402af50 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si-1.c
@@ -1,13 +1,15 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f" } */
/* { dg-final { scan-assembler-times "vcvtsd2sil?\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2sil?\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m128d x;
-volatile unsigned y;
+volatile unsigned y, z;
void extern
avx512f_test (void)
{
y = _mm_cvt_roundsd_i32 (x, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ z = _mm_cvtsd_i32 (x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si64-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si64-1.c
index ad11e8b..dad26e4 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2si64-1.c
@@ -1,14 +1,16 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-O2 -mavx512f" } */
/* { dg-final { scan-assembler-times "vcvtsd2siq\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2siq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m128d x;
-volatile unsigned long long y;
+volatile unsigned long long y, z;
void extern
avx512f_test (void)
{
y = _mm_cvt_roundsd_i64 (x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ z = _mm_cvtsd_i64 (x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2ss-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2ss-1.c
index 84d8e05..d61e76c 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2ss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsd2ss-1.c
@@ -1,14 +1,23 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
/* { dg-final { scan-assembler-times "vcvtsd2ss\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2ss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2ss\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsd2ss\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128 s1, r;
+volatile __m128 s1, r, s3;
volatile __m128d s2;
+volatile __mmask8 m;
void extern
avx512f_test (void)
{
r = _mm_cvt_roundsd_ss (s1, s2, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ r = _mm_mask_cvtsd_ss (s3, m, s1, s2);
+ r = _mm_maskz_cvtsd_ss (m, s1, s2);
+ r = _mm_mask_cvt_roundsd_ss (s3, m, s1, s2, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ r = _mm_maskz_cvt_roundsd_ss (m, s1, s2, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd-1.c
new file mode 100644
index 0000000..2035eea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd-1.c
@@ -0,0 +1,13 @@
+/* { dg-options "-mavx512f -O2" } */
+/* { dg-final { scan-assembler-times "vcvtsi2sdl\[ \\t\]+\[^%\n\]*%e\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+volatile __m128d x;
+volatile int n;
+
+void extern
+avx512f_test (void)
+{
+ x = _mm_cvti32_sd (x, n);
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd64-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd64-1.c
index 440ddbc..4843ace 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2sd64-1.c
@@ -1,14 +1,16 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-mavx512f -O2" } */
/* { dg-final { scan-assembler-times "vcvtsi2sdq\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*\{ru-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsi2sdq\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128d x;
+volatile __m128d x, y;
volatile long long n;
void extern
avx512f_test (void)
{
x = _mm_cvt_roundi64_sd (x, n, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
+ y = _mm_cvti64_sd (x, n);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss-1.c
index 8e26576..0b3f518 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss-1.c
@@ -1,14 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
/* { dg-final { scan-assembler-times "vcvtsi2ssl\[ \\t\]+\[^%\n\]*%e\[^\{\n\]*\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsi2ssl\[ \\t\]+\[^%\n\]*%e\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128 x;
+volatile __m128 x, y;
volatile int n;
void extern
avx512f_test (void)
{
x = _mm_cvt_roundi32_ss (x, n, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ y = _mm_cvti32_ss (x, n);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss64-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss64-1.c
index ceef7cd..9b2bce1 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtsi2ss64-1.c
@@ -1,14 +1,16 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-mavx512f -O2" } */
/* { dg-final { scan-assembler-times "vcvtsi2ssq\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtsi2ssq\[ \\t\]+\[^%\n\]*%r\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128 x;
+volatile __m128 x, y;
volatile long long n;
void extern
avx512f_test (void)
{
x = _mm_cvt_roundi64_ss (x, n, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ y = _mm_cvti64_ss (x, n);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2sd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2sd-1.c
index ee98d36..48cbac5 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2sd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2sd-1.c
@@ -1,14 +1,23 @@
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
/* { dg-final { scan-assembler-times "vcvtss2sd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sd\[ \\t\]+\[^\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sd\[ \\t\]+\[^\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128d s1, r;
+volatile __m128d s1, r, s3;
volatile __m128 s2;
+volatile __mmask8 m;
void extern
avx512f_test (void)
{
r = _mm_cvt_roundss_sd (s1, s2, _MM_FROUND_NO_EXC);
+ r = _mm_mask_cvtss_sd (s3, m, s1, s2);
+ r = _mm_maskz_cvtss_sd (m, s1, s2);
+ r = _mm_mask_cvt_roundss_sd (s3, m, s1, s2, _MM_FROUND_NO_EXC);
+ r = _mm_maskz_cvt_roundss_sd (m, s1, s2, _MM_FROUND_NO_EXC);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si-1.c
index 96289ef..e3f4223 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si-1.c
@@ -1,13 +1,15 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512f" } */
/* { dg-final { scan-assembler-times "vcvtss2sil?\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2sil?\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m128 x;
-volatile unsigned y;
+volatile unsigned y, z;
void extern
avx512f_test (void)
{
y = _mm_cvt_roundss_i32 (x, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ z = _mm_cvtss_i32 (x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si64-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si64-1.c
index 7ada1f4..86ef95a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vcvtss2si64-1.c
@@ -1,14 +1,16 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-options "-O2 -mavx512f" } */
/* { dg-final { scan-assembler-times "vcvtss2siq\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vcvtss2siq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+.{6}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m128 x;
-volatile unsigned long long y;
+volatile unsigned long long y, z;
void extern
avx512f_test (void)
{
y = _mm_cvt_roundss_i64 (x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ z = _mm_cvtss_i64 (x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-1.c
index 09bc5c6..d0ba9cf 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-1.c
@@ -4,6 +4,8 @@
/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\n\]*\{rd-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
@@ -18,4 +20,6 @@ avx512f_test (void)
x = _mm_scalef_round_sd (x, x, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
x = _mm_mask_scalef_round_sd (x, m, x, x, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
x = _mm_maskz_scalef_round_sd (m, x, x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ x = _mm_mask_scalef_sd (x, m, x, x);
+ x = _mm_maskz_scalef_sd (m, x, x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-2.c
index afe73dc..986e978 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vscalefsd-2.c
@@ -18,7 +18,7 @@ compute_scalefsd (double *s1, double *s2, double *r)
void static
avx512f_test (void)
{
- union128d res1, res2, res3, res4;
+ union128d res1, res2, res3, res4, res5, res6;
union128d s1, s2;
double res_ref[SIZE];
MASK_TYPE mask = MASK_VALUE;
@@ -33,6 +33,8 @@ avx512f_test (void)
res2.a[i] = DEFAULT_VALUE;
res3.a[i] = DEFAULT_VALUE;
res4.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
+ res6.a[i] = DEFAULT_VALUE;
}
res1.x = _mm_scalef_sd (s1.x, s2.x);
@@ -42,6 +44,8 @@ avx512f_test (void)
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
res4.x = _mm_maskz_scalef_round_sd (mask, s1.x, s2.x,
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ res5.x = _mm_mask_scalef_sd (s1.x, mask, s1.x, s2.x);
+ res6.x = _mm_maskz_scalef_sd (mask, s1.x, s2.x);
compute_scalefsd (s1.a, s2.a, res_ref);
@@ -55,8 +59,14 @@ avx512f_test (void)
if (check_union128d (res3, res_ref))
abort ();
+ if (check_union128d (res5, res_ref))
+ abort ();
+
MASK_ZERO (d) (res_ref, mask, 1);
if (check_union128d (res4, res_ref))
abort ();
+
+ if (check_union128d (res6, res_ref))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-1.c
index d1af336..381d39e 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-1.c
@@ -4,6 +4,8 @@
/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\n\]*\{ru-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vscalefss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
@@ -17,4 +19,6 @@ avx512f_test (void)
x = _mm_scalef_round_ss (x, x, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
x = _mm_mask_scalef_round_ss (x, m, x, x, _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC);
x = _mm_maskz_scalef_round_ss (m, x, x, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ x = _mm_mask_scalef_ss (x, m, x, x);
+ x = _mm_maskz_scalef_ss (m, x, x);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-2.c
index 811ff15..d83feec 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vscalefss-2.c
@@ -20,7 +20,7 @@ compute_scalefss (float *s1, float *s2, float *r)
static void
avx512f_test (void)
{
- union128 res1, res2, res3, res4;
+ union128 res1, res2, res3, res4, res5, res6;
union128 s1, s2;
float res_ref[SIZE];
MASK_TYPE mask = MASK_VALUE;
@@ -35,6 +35,8 @@ avx512f_test (void)
res2.a[i] = DEFAULT_VALUE;
res3.a[i] = DEFAULT_VALUE;
res4.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
+ res6.a[i] = DEFAULT_VALUE;
}
res1.x = _mm_scalef_ss (s1.x, s2.x);
@@ -44,6 +46,8 @@ avx512f_test (void)
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
res4.x = _mm_maskz_scalef_round_ss (mask, s1.x, s2.x,
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ res5.x = _mm_mask_scalef_ss (s1.x, mask, s1.x, s2.x);
+ res6.x = _mm_maskz_scalef_ss (mask, s1.x, s2.x);
compute_scalefss (s1.a, s2.a, res_ref);
@@ -57,8 +61,14 @@ avx512f_test (void)
if (check_union128 (res3, res_ref))
abort ();
+ if (check_union128 (res5, res_ref))
+ abort ();
+
MASK_ZERO () (res_ref, mask, 1);
if (check_union128 (res4, res_ref))
abort ();
+
+ if (check_union128 (res6, res_ref))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-1.c
index a7d7af9..22601e9 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-1.c
@@ -3,10 +3,12 @@
/* { dg-final { scan-assembler-times "vsqrtsd\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vsqrtsd\[ \\t\]+\[^\n\]*\{rd-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vsqrtsd\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsqrtsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsqrtsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128d x1, x2;
+volatile __m128d x1, x2, x3;
volatile __mmask8 m;
void extern
@@ -15,4 +17,6 @@ avx512f_test (void)
x1 = _mm_sqrt_round_sd (x1, x2, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
x1 = _mm_mask_sqrt_round_sd (x1, m, x1, x2, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
x1 = _mm_maskz_sqrt_round_sd (m, x1, x2, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ x1 = _mm_mask_sqrt_sd (x3, m, x1, x2);
+ x1 = _mm_maskz_sqrt_sd (m, x1, x2);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-2.c
index 49ca7ee..ec908fd 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtsd-2.c
@@ -18,7 +18,7 @@ compute_sqrtsd (double *s1, double *s2, double *r)
void static
avx512f_test (void)
{
- union128d res1, res2, res3;
+ union128d res1, res2, res3, res4, res5;
union128d s1, s2;
double res_ref[SIZE];
MASK_TYPE mask = MASK_VALUE;
@@ -32,6 +32,8 @@ avx512f_test (void)
res1.a[i] = DEFAULT_VALUE;
res2.a[i] = DEFAULT_VALUE;
res3.a[i] = DEFAULT_VALUE;
+ res4.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
}
res1.x = _mm_sqrt_round_sd (s1.x, s2.x,
@@ -40,6 +42,8 @@ avx512f_test (void)
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
res3.x = _mm_maskz_sqrt_round_sd (mask, s1.x, s2.x,
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ res4.x = _mm_mask_sqrt_sd (s1.x, mask, s1.x, s2.x);
+ res5.x = _mm_maskz_sqrt_sd (mask, s1.x, s2.x);
compute_sqrtsd (s1.a, s2.a, res_ref);
@@ -51,10 +55,16 @@ avx512f_test (void)
if (check_union128d (res2, res_ref))
abort ();
+ if (check_union128d (res4, res_ref))
+ abort ();
+
MASK_ZERO (d) (res_ref, mask, 1);
if (check_union128d (res3, res_ref))
abort ();
+
+ if (check_union128d (res5, res_ref))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-1.c
index 103ff30..c32903b 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-1.c
@@ -3,11 +3,13 @@
/* { dg-final { scan-assembler-times "vsqrtss\[ \\t\]+\[^\n\]*\{rn-sae\}\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vsqrtss\[ \\t\]+\[^\n\]*\{rd-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vsqrtss\[ \\t\]+\[^\n\]*\{rz-sae\}\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsqrtss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vsqrtss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-volatile __m128 x1, x2;
+volatile __m128 x1, x2, x3;
volatile __mmask8 m;
void extern
@@ -16,4 +18,6 @@ avx512f_test (void)
x1 = _mm_sqrt_round_ss (x1, x2, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
x1 = _mm_mask_sqrt_round_ss (x1, m, x1, x2, _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC);
x1 = _mm_maskz_sqrt_round_ss (m, x1, x2, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
+ x1 = _mm_mask_sqrt_ss (x3, m, x1, x2);
+ x1 = _mm_maskz_sqrt_ss (m, x1, x2);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-2.c
index 90f88be..33222bb 100644
--- a/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-2.c
+++ b/gcc/testsuite/gcc.target/i386/avx512f-vsqrtss-2.c
@@ -22,7 +22,7 @@ compute_sqrtss (float *s1, float *s2, float *r)
static void
avx512f_test (void)
{
- union128 res1, res2, res3;
+ union128 res1, res2, res3, res4, res5;
union128 s1, s2;
float res_ref[SIZE];
MASK_TYPE mask = MASK_VALUE;
@@ -36,6 +36,8 @@ avx512f_test (void)
res1.a[i] = DEFAULT_VALUE;
res2.a[i] = DEFAULT_VALUE;
res3.a[i] = DEFAULT_VALUE;
+ res4.a[i] = DEFAULT_VALUE;
+ res5.a[i] = DEFAULT_VALUE;
}
res1.x = _mm_sqrt_round_ss (s1.x, s2.x,
@@ -44,6 +46,8 @@ avx512f_test (void)
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
res3.x = _mm_maskz_sqrt_round_ss (mask, s1.x, s2.x,
_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC);
+ res4.x = _mm_mask_sqrt_ss (s1.x, mask, s1.x, s2.x);
+ res5.x = _mm_maskz_sqrt_ss (mask, s1.x, s2.x);
compute_sqrtss (s1.a, s2.a, res_ref);
@@ -55,9 +59,15 @@ avx512f_test (void)
if (check_union128 (res2, res_ref))
abort ();
+ if (check_union128 (res4, res_ref))
+ abort ();
+
MASK_ZERO () (res_ref, mask, 1);
if (check_union128 (res3, res_ref))
abort ();
+
+ if (check_union128 (res5, res_ref))
+ abort ();
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa32-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa32-1.c
index 217afbc..5c6a3d0 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa32-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa32-1.c
@@ -10,12 +10,16 @@
/* { dg-final { scan-assembler-times "vmovdqa32\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqa32\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqa32\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\\)\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\\(\[^\{\n\]*\\)\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\\(\[^\{\n\]*\\)\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\[ \\t\]+\\(\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*\[ \\t\]+\\(\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
-int *p;
-volatile __m256i yy, y2;
-volatile __m128i xx, x2;
+int *p, *p1, *p2;
+volatile __m256i yy, y2, yyy;
+volatile __m128i xx, x2, xxx;
volatile __mmask8 m;
void extern
@@ -30,9 +34,15 @@ avx512vl_test (void)
yy = _mm256_mask_load_epi32 (yy, m, p);
xx = _mm_mask_load_epi32 (xx, m, p);
+ yyy = _mm256_load_epi32 (p2);
+ xxx = _mm_load_epi32 (p1);
+
yy = _mm256_maskz_load_epi32 (m, p);
xx = _mm_maskz_load_epi32 (m, p);
_mm256_mask_store_epi32 (p, m, yy);
_mm_mask_store_epi32 (p, m, xx);
+
+ _mm256_store_epi32 (p2, yyy);
+ _mm_store_epi32 (p2, xxx);
}
diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa64-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa64-1.c
index 9dc794d..592541a 100644
--- a/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa64-1.c
+++ b/gcc/testsuite/gcc.target/i386/avx512vl-vmovdqa64-1.c
@@ -4,8 +4,8 @@
/* { dg-final { scan-assembler-times "(?:vmovdqa64|vpblendmq)\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqa64\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqa64\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
-/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\\(\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 { target nonpic } } } */
-/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\\(\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 { target nonpic } } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\\(\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 2 { target nonpic } } } */
+/* { dg-final { scan-assembler-times "vmovdqa\[ \\t\]+\\(\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 2 { target nonpic } } } */
/* { dg-final { scan-assembler-times "vmovdqa64\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqa64\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vmovdqa64\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
@@ -35,6 +35,9 @@ avx512vl_test (void)
yy = _mm256_load_si256 (p1);
xx = _mm_load_si128 (p2);
+ yy = _mm256_load_epi64 (p);
+ xx = _mm_load_epi64 (p);
+
yy = _mm256_mask_load_epi64 (yy, m, p);
xx = _mm_mask_load_epi64 (xx, m, p);
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
index 94ffbb6..02cdc34 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc
+++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
@@ -71,6 +71,11 @@ extern void test_tsxldtrk (void) __attribute__((__target__("tsxldtrk")));
extern void test_enqcmd (void) __attribute__((__target__("enqcmd")));
extern void test_avx512bf16 (void) __attribute__((__target__("avx512bf16")));
extern void test_avx512vp2intersect (void) __attribute__((__target__("avx512vp2intersect")));
+extern void test_amx_tile (void) __attribute__((__target__("amx-tile")));
+extern void test_amx_int8 (void) __attribute__((__target__("amx-int8")));
+extern void test_amx_bf16 (void) __attribute__((__target__("amx-bf16")));
+extern void test_uintr (void) __attribute__((__target__("uintr")));
+extern void test_hreset (void) __attribute__((__target__("hreset")));
extern void test_no_sgx (void) __attribute__((__target__("no-sgx")));
extern void test_no_avx5124fmaps(void) __attribute__((__target__("no-avx5124fmaps")));
@@ -143,6 +148,11 @@ extern void test_no_tsxldtrk (void) __attribute__((__target__("no-tsxldtrk")));
extern void test_no_enqcmd (void) __attribute__((__target__("no-enqcmd")));
extern void test_no_avx512bf16 (void) __attribute__((__target__("no-avx512bf16")));
extern void test_no_avx512vp2intersect (void) __attribute__((__target__("no-avx512vp2intersect")));
+extern void test_no_amx_tile (void) __attribute__((__target__("no-amx-tile")));
+extern void test_no_amx_int8 (void) __attribute__((__target__("no-amx-int8")));
+extern void test_no_amx_bf16 (void) __attribute__((__target__("no-amx-bf16")));
+extern void test_no_uintr (void) __attribute__((__target__("no-uintr")));
+extern void test_no_hreset (void) __attribute__((__target__("no-hreset")));
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/hreset-1.c b/gcc/testsuite/gcc.target/i386/hreset-1.c
new file mode 100644
index 0000000..573513f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/hreset-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mhreset" } */
+/* { dg-final { scan-assembler-times "eax" 1 } } */
+/* { dg-final { scan-assembler-times "hreset\[ \\t\]+\[\$\]\?0" 1 } } */
+
+#include <immintrin.h>
+
+void foo(unsigned int eax)
+{
+ _hreset (eax);
+}
diff --git a/gcc/testsuite/gcc.target/i386/m128-check.h b/gcc/testsuite/gcc.target/i386/m128-check.h
index 48b2332..6f414b0 100644
--- a/gcc/testsuite/gcc.target/i386/m128-check.h
+++ b/gcc/testsuite/gcc.target/i386/m128-check.h
@@ -78,6 +78,7 @@ typedef union
#define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT) \
static int \
+__attribute__((optimize ("no-strict-aliasing"))) \
__attribute__((noinline, unused)) \
check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
{ \
diff --git a/gcc/testsuite/gcc.target/i386/movdir64b.c b/gcc/testsuite/gcc.target/i386/movdir64b.c
new file mode 100644
index 0000000..70d872e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/movdir64b.c
@@ -0,0 +1,23 @@
+/* { dg-do run { target movdir } } */
+/* { dg-options "-mmovdir64b -O2" } */
+
+#include <x86intrin.h>
+#include <string.h>
+
+unsigned long long int src[8] = {1, 2, 3, 4, 5, 6, 7, 8};
+unsigned long long int dest[8] __attribute__ ((aligned (64)))
+ = {-1, -1, -1, -1, -1, -1, -1, -1};
+
+int
+main ()
+{
+ if (!__builtin_cpu_supports ("movdir64b"))
+ return 0;
+
+ _movdir64b (dest, src);
+
+ if (memcmp (dest, src, sizeof (dest)) != 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/movdiri32.c b/gcc/testsuite/gcc.target/i386/movdiri32.c
new file mode 100644
index 0000000..604fa0d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/movdiri32.c
@@ -0,0 +1,20 @@
+/* { dg-do run { target movdir } } */
+/* { dg-options "-mmovdiri -O2" } */
+
+#include <x86intrin.h>
+
+unsigned int dest = -1;
+
+int
+main ()
+{
+ if (!__builtin_cpu_supports ("movdiri"))
+ return 0;
+
+ _directstoreu_u32 (&dest, 0xbadbeef);
+
+ if (dest != 0xbadbeef)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/movdiri64.c b/gcc/testsuite/gcc.target/i386/movdiri64.c
new file mode 100644
index 0000000..551b98e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/movdiri64.c
@@ -0,0 +1,20 @@
+/* { dg-do run { target { movdir && { ! ia32 } } } } */
+/* { dg-options "-mmovdiri -O2" } */
+
+#include <x86intrin.h>
+
+unsigned long long int dest = -1LL;
+
+int
+main ()
+{
+ if (!__builtin_cpu_supports ("movdiri"))
+ return 0;
+
+ _directstoreu_u64 (&dest, 0x12345678badbeef);
+
+ if (dest != 0x12345678badbeef)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr60693.c b/gcc/testsuite/gcc.target/i386/pr60693.c
index e6033a7..962c705 100644
--- a/gcc/testsuite/gcc.target/i386/pr60693.c
+++ b/gcc/testsuite/gcc.target/i386/pr60693.c
@@ -11,3 +11,6 @@ foo (void)
__builtin_memcpy (buf, (void *) 0x8000, 4096);
bar (buf);
}
+
+/* Reading from a constant address might triggers:
+ { dg-prune-output "\\\[-Wstringop-overread" } */
diff --git a/gcc/testsuite/gcc.target/i386/pr68961.c b/gcc/testsuite/gcc.target/i386/pr68961.c
index ef379c4..dfa8977 100644
--- a/gcc/testsuite/gcc.target/i386/pr68961.c
+++ b/gcc/testsuite/gcc.target/i386/pr68961.c
@@ -15,5 +15,5 @@ pack (double a, double aa)
/* The function should be optimized to just return as arguments and
result exactly overlap even when previously vectorized. */
-/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
/* { dg-final { scan-assembler-not "mov" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr84101.c b/gcc/testsuite/gcc.target/i386/pr84101.c
index 65117f1..994ada6 100644
--- a/gcc/testsuite/gcc.target/i386/pr84101.c
+++ b/gcc/testsuite/gcc.target/i386/pr84101.c
@@ -19,4 +19,4 @@ uint64_pair_t pair(int num)
}
/* See PR92266 for the XFAIL. */
-/* { dg-final { scan-tree-dump-not "basic block vectorized" "slp2" { xfail ilp32 } } } */
+/* { dg-final { scan-tree-dump-not "optimized: basic block" "slp2" { xfail ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-1.c b/gcc/testsuite/gcc.target/i386/pr95483-1.c
new file mode 100644
index 0000000..6b00826
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse" } */
+/* { dg-final { scan-assembler-times "pxor\[ \\t\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "pinsrw\[ \\t\]+\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "pextrw\[ \\t\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+
+#include <emmintrin.h>
+unsigned short *p1,*p2;
+volatile __m128i x1,x2;
+
+void foo (void)
+{
+ x1=_mm_loadu_si16 (p1);
+ _mm_storeu_si16 (p2, x2);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-2.c b/gcc/testsuite/gcc.target/i386/pr95483-2.c
new file mode 100644
index 0000000..a12aea8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+/* { dg-final { scan-assembler-times "(?:vpinsrd|movd)\[ \\t\]+\[^\n\]*\\)\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "movd\[ \\t\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <emmintrin.h>
+unsigned int *p1,*p2;
+volatile __m128i x1,x2;
+
+void foo (void)
+{
+ x1=_mm_loadu_si32 (p1);
+ _mm_storeu_si32 (p2, x2);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-3.c b/gcc/testsuite/gcc.target/i386/pr95483-3.c
new file mode 100644
index 0000000..ec90189
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-3.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+/* { dg-final { scan-assembler-times "vmovd\[ \\t\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+volatile __m256i x1;
+
+int foo (void)
+{
+ return _mm256_cvtsi256_si32 (x1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-4.c b/gcc/testsuite/gcc.target/i386/pr95483-4.c
new file mode 100644
index 0000000..1d4cdb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-4.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f" } */
+/* { dg-final { scan-assembler-times "vmovd\[ \\t\]+\[^\n\]*%xmm\[0-9\]+\[^\n\]*(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+volatile __m512i x1;
+
+int foo (void)
+{
+ return _mm512_cvtsi512_si32 (x1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-5.c b/gcc/testsuite/gcc.target/i386/pr95483-5.c
new file mode 100644
index 0000000..b52e39d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-5.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512bw -mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "(?:vmovdqu8|vinserti128)\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "(?:vmovdqu8|vextracti128)\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\[^\n\]*\\)(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <immintrin.h>
+
+char *p, *p1;
+volatile __m256i yyy;
+
+void extern
+avx512bw_test (void)
+{
+ yyy = _mm256_loadu_epi8 (p);
+ _mm256_storeu_epi8 (p1, yyy);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-6.c b/gcc/testsuite/gcc.target/i386/pr95483-6.c
new file mode 100644
index 0000000..3540bf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-6.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "(?:vinserti128|vmovdqu)\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+int *p;
+long long *p1;
+volatile __m256i x1, x2;
+
+void extern
+avx512vl_test (void)
+{
+ x1 = _mm256_loadu_epi32 (p);
+ x2 = _mm256_loadu_epi64 (p1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr95483-7.c b/gcc/testsuite/gcc.target/i386/pr95483-7.c
new file mode 100644
index 0000000..f72aa93
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95483-7.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512vl -O2" } */
+/* { dg-final { scan-assembler-times "vmovdqu\[ \\t\]+\[^\{\n\]*\\)\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 2 } } */
+
+#include <immintrin.h>
+
+int *p;
+long long *p1;
+volatile __m128i x1, x2;
+
+void extern
+avx512vl_test (void)
+{
+ x1 = _mm_loadu_epi32 (p);
+ x2 = _mm_loadu_epi64 (p1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr96814.c b/gcc/testsuite/gcc.target/i386/pr96814.c
new file mode 100644
index 0000000..b280c73
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr96814.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-mavx512vl -mavx512bw" } */
+/* { dg-require-effective-target avx512bw } */
+/* { dg-require-effective-target avx512vl } */
+
+typedef unsigned char __attribute__ ((__vector_size__ (32))) V;
+
+void
+test (void)
+{
+ V x = ((V){8} > 0) == 0;
+ for (unsigned i = 0; i < sizeof (x); i++)
+ if (x[i] != (i ? 0xff : 0)) __builtin_abort();
+}
+
+#define DO_TEST test
+#define AVX512VL
+#define AVX512BW
+#include "avx512-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/pr96827.c b/gcc/testsuite/gcc.target/i386/pr96827.c
new file mode 100644
index 0000000..309e9e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr96827.c
@@ -0,0 +1,41 @@
+/* { dg-do run { target sse2_runtime } } */
+/* { dg-options "-O3 -msse2 -mfpmath=sse" } */
+
+typedef unsigned short int __uint16_t;
+typedef unsigned int __uint32_t;
+typedef __uint16_t uint16_t;
+typedef __uint32_t uint32_t;
+typedef int __v4si __attribute__ ((__vector_size__ (16)));
+typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
+extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_store_si128 (__m128i *__P, __m128i __B)
+{
+ *__P = __B;
+}
+extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_set_epi32 (int __q3, int __q2, int __q1, int __q0)
+{
+ return __extension__ (__m128i)(__v4si){ __q0, __q1, __q2, __q3 };
+}
+typedef uint16_t u16;
+typedef uint32_t u32;
+extern int printf (const char *__restrict __format, ...);
+void do_the_thing(u32 idx, __m128i *dude)
+{
+ u32 dude_[4] = { idx+0, idx+2, idx+4, idx+6 };
+ for (u32 i = 0; i < 3; ++i)
+ if (dude_[i] == 1234)
+ dude_[i]--;
+ *dude = _mm_set_epi32(dude_[0], dude_[1], dude_[2], dude_[3]);
+}
+int main()
+{
+ __m128i dude;
+ u32 idx = 0;
+ do_the_thing(idx, &dude);
+ __attribute__((aligned(16))) u32 dude_[4];
+ _mm_store_si128((__m128i*)dude_, dude);
+ if (!(6 == dude_[0] && 4 == dude_[1] && 2 == dude_[2] && 0 == dude_[3]))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97249-1.c b/gcc/testsuite/gcc.target/i386/pr97249-1.c
new file mode 100644
index 0000000..4478a34
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97249-1.c
@@ -0,0 +1,30 @@
+/* PR target/97249 */
+/* { dg-do compile } */
+/* { dg-options "-mavx2 -O3 -masm=att" } */
+/* { dg-final { scan-assembler-times {(?n)vpmovzxbw[ \t]+\(.*%xmm[0-9]} 2 } } */
+/* { dg-final { scan-assembler-times {(?n)vpmovzxwd[ \t]+\(.*%xmm[0-9]} 2 } } */
+/* { dg-final { scan-assembler-times {(?n)vpmovzxdq[ \t]+\(.*%xmm[0-9]} 2 } } */
+
+void
+foo (unsigned char* p1, unsigned char* p2, short* __restrict p3)
+{
+ for (int i = 0 ; i != 8; i++)
+ p3[i] = p1[i] + p2[i];
+ return;
+}
+
+void
+foo1 (unsigned short* p1, unsigned short* p2, int* __restrict p3)
+{
+ for (int i = 0 ; i != 4; i++)
+ p3[i] = p1[i] + p2[i];
+ return;
+}
+
+void
+foo2 (unsigned int* p1, unsigned int* p2, long long* __restrict p3)
+{
+ for (int i = 0 ; i != 2; i++)
+ p3[i] = (long long)p1[i] + (long long)p2[i];
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97282.c b/gcc/testsuite/gcc.target/i386/pr97282.c
new file mode 100644
index 0000000..6fb10c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97282.c
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/97282 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "call\[^\n\r]*__udivmod\[dt]i4" } } */
+
+#ifdef __SIZEOF_INT128__
+typedef __uint128_t T;
+#else
+typedef unsigned long long T;
+#endif
+
+unsigned long
+foo (T x)
+{
+ if (x == 0)
+ return 0;
+
+ unsigned long ret = 0;
+ while (x > 0)
+ {
+ ret = ret + x % 10;
+ x = x / 10;
+ }
+ return ret;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97313.c b/gcc/testsuite/gcc.target/i386/pr97313.c
new file mode 100644
index 0000000..ef93cf1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97313.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIE" } */
+
+typedef struct {
+ int unspecified : 1;
+ int secure : 1;
+} MemTxAttrs;
+
+enum { MSCAllowNonSecure } tz_msc_read_pdata;
+
+int tz_msc_read_s_0;
+int tz_msc_check();
+int address_space_ldl_le();
+
+void tz_msc_read(MemTxAttrs attrs) {
+ int as = tz_msc_read_s_0;
+ long long data;
+ switch (tz_msc_check()) {
+ case MSCAllowNonSecure:
+ attrs.secure = attrs.unspecified = 0;
+ data = address_space_ldl_le(as, attrs);
+ }
+ tz_msc_read_pdata = data;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97387-1.c b/gcc/testsuite/gcc.target/i386/pr97387-1.c
new file mode 100644
index 0000000..352092a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97387-1.c
@@ -0,0 +1,31 @@
+/* PR target/97387 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fomit-frame-pointer" } */
+/* { dg-final { scan-assembler-times "\taddl\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tadcl\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tsubl\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tsbbl\t" 3 } } */
+/* { dg-final { scan-assembler-not "\tset\[bc]\t" } } */
+/* { dg-final { scan-assembler-not "\taddb\t" } } */
+
+#include <x86intrin.h>
+
+void
+foo (unsigned int a[4], unsigned int b[4])
+{
+ unsigned char carry = 0;
+ carry = _addcarry_u32 (carry, a[0], b[0], &a[0]);
+ carry = _addcarry_u32 (carry, a[1], b[1], &a[1]);
+ carry = _addcarry_u32 (carry, a[2], b[2], &a[2]);
+ _addcarry_u32 (carry, a[3], b[3], &a[3]);
+}
+
+void
+bar (unsigned int a[4], unsigned int b[4])
+{
+ unsigned char carry = 0;
+ carry = _subborrow_u32 (carry, a[0], b[0], &a[0]);
+ carry = _subborrow_u32 (carry, a[1], b[1], &a[1]);
+ carry = _subborrow_u32 (carry, a[2], b[2], &a[2]);
+ _subborrow_u32 (carry, a[3], b[3], &a[3]);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97387-2.c b/gcc/testsuite/gcc.target/i386/pr97387-2.c
new file mode 100644
index 0000000..21d8cce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97387-2.c
@@ -0,0 +1,31 @@
+/* PR target/97387 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -fomit-frame-pointer" } */
+/* { dg-final { scan-assembler-times "\taddq\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tadcq\t" 3 } } */
+/* { dg-final { scan-assembler-times "\tsubq\t" 1 } } */
+/* { dg-final { scan-assembler-times "\tsbbq\t" 3 } } */
+/* { dg-final { scan-assembler-not "\tset\[bc]\t" } } */
+/* { dg-final { scan-assembler-not "\taddb\t" } } */
+
+#include <x86intrin.h>
+
+void
+foo (unsigned long long a[4], unsigned long long b[4])
+{
+ unsigned char carry = 0;
+ carry = _addcarry_u64 (carry, a[0], b[0], &a[0]);
+ carry = _addcarry_u64 (carry, a[1], b[1], &a[1]);
+ carry = _addcarry_u64 (carry, a[2], b[2], &a[2]);
+ _addcarry_u64 (carry, a[3], b[3], &a[3]);
+}
+
+void
+bar (unsigned long long a[4], unsigned long long b[4])
+{
+ unsigned char carry = 0;
+ carry = _subborrow_u64 (carry, a[0], b[0], &a[0]);
+ carry = _subborrow_u64 (carry, a[1], b[1], &a[1]);
+ carry = _subborrow_u64 (carry, a[2], b[2], &a[2]);
+ _subborrow_u64 (carry, a[3], b[3], &a[3]);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97506.c b/gcc/testsuite/gcc.target/i386/pr97506.c
new file mode 100644
index 0000000..74714cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97506.c
@@ -0,0 +1,19 @@
+/* PR target/97506 */
+/* { dg-do compile } */
+/* { dg-options "-Og -finline-functions-called-once -fno-tree-ccp -mavx512vbmi -mavx512vl" } */
+
+typedef unsigned char __attribute__ ((__vector_size__ (16))) U;
+typedef int __attribute__ ((__vector_size__ (4))) V;
+U u;
+
+void
+bar (int i, V v)
+{
+ u += (char) i & (char) i > (U){};
+}
+
+void
+foo (void)
+{
+ bar (0, (V){});
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse-12.c b/gcc/testsuite/gcc.target/i386/sse-12.c
index b1690d7..61146b2b 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" } */
+/* { 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" } */
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c
index 3a640470..dd6dd55 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" } */
+/* { 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" } */
/* { dg-add-options bind_pic_locally } */
#include <mm_malloc.h>
@@ -398,6 +398,8 @@
#define __builtin_ia32_vfmaddss3_mask3(A, B, C, D, E) __builtin_ia32_vfmaddss3_mask3(A, B, C, D, 8)
#define __builtin_ia32_vfmaddss3_maskz(A, B, C, D, E) __builtin_ia32_vfmaddss3_maskz(A, B, C, D, 8)
#define __builtin_ia32_vfmsubss3_mask3(A, B, C, D, E) __builtin_ia32_vfmsubss3_mask3(A, B, C, D, 8)
+#define __builtin_ia32_cvtsd2ss_mask_round(A, B, C, D, E) __builtin_ia32_cvtsd2ss_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_cvtss2sd_mask_round(A, B, C, D, E) __builtin_ia32_cvtss2sd_mask_round(A, B, C, D, 8)
/* avx512erintrin.h */
#define __builtin_ia32_exp2ps_mask(A, B, C, D) __builtin_ia32_exp2ps_mask(A, B, C, 8)
@@ -410,6 +412,10 @@
#define __builtin_ia32_rcp28sd_round(A, B, C) __builtin_ia32_rcp28sd_round(A, B, 8)
#define __builtin_ia32_rsqrt28ss_round(A, B, C) __builtin_ia32_rsqrt28ss_round(A, B, 8)
#define __builtin_ia32_rsqrt28sd_round(A, B, C) __builtin_ia32_rsqrt28sd_round(A, B, 8)
+#define __builtin_ia32_rcp28sd_mask_round(A, B, C, D, E) __builtin_ia32_rcp28sd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rcp28ss_mask_round(A, B, C, D, E) __builtin_ia32_rcp28ss_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rsqrt28sd_mask_round(A, B, C, D, E) __builtin_ia32_rsqrt28sd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rsqrt28ss_mask_round(A, B, C, D, E) __builtin_ia32_rsqrt28ss_mask_round(A, B, C, D, 8)
/* avx512pfintrin.h */
#define __builtin_ia32_gatherpfdps(A, B, C, D, E) __builtin_ia32_gatherpfdps(A, B, C, 1, _MM_HINT_T0)
@@ -621,6 +627,10 @@
#define __builtin_ia32_cmpw128_mask(A, B, E, D) __builtin_ia32_cmpw128_mask(A, B, 1, D)
#define __builtin_ia32_cmpb256_mask(A, B, E, D) __builtin_ia32_cmpb256_mask(A, B, 1, D)
#define __builtin_ia32_cmpb128_mask(A, B, E, D) __builtin_ia32_cmpb128_mask(A, B, 1, D)
+#define __builtin_ia32_reducepd512_mask_round(A,B,C,D,E) __builtin_ia32_reducepd512_mask_round(A,1,C,D,8)
+#define __builtin_ia32_reduceps512_mask_round(A,B,C,D,E) __builtin_ia32_reduceps512_mask_round(A,1,C,D,8)
+#define __builtin_ia32_reducesd_mask_round(A, B, F, W, U, E) __builtin_ia32_reducesd_mask_round(A, B, 1, W, U, 8)
+#define __builtin_ia32_reducess_mask_round(A, B, F, W, U, E) __builtin_ia32_reducess_mask_round(A, B, 1, W, U, 8)
/* avx512vldqintrin.h */
#define __builtin_ia32_reduceps256_mask(A, E, C, D) __builtin_ia32_reduceps256_mask(A, 1, C, D)
diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c
index edaa2aa..837b51c 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" } */
+/* { 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" } */
/* { 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 7364b2f..fc75669f 100644
--- a/gcc/testsuite/gcc.target/i386/sse-22.c
+++ b/gcc/testsuite/gcc.target/i386/sse-22.c
@@ -11,6 +11,7 @@
tbmintrin.h, lwpintrin.h, popcntintrin.h, fmaintrin.h, tsxldtrkintrin.h,
avx5124fmapsintrin.h, avx5124vnniwintrin.h, avx512vpopcntdqintrin.h,
avx512bitalgintrin.h, avx512vp2intersectintrin.h,
+ amxtileintrin.h, amxint8intrin.h, amxbf16intrin.h,
avx512vp2intersectvlintrin.h and mm_malloc.h that reference the proper
builtin functions.
Defining away "extern" and "__inline" results in all of them being
@@ -102,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")
+#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")
#endif
/* Following intrinsics require immediate arguments. They
@@ -219,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")
+#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")
#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 eaadebe..b51644c 100644
--- a/gcc/testsuite/gcc.target/i386/sse-23.c
+++ b/gcc/testsuite/gcc.target/i386/sse-23.c
@@ -10,6 +10,7 @@
tbmintrin.h, lwpintrin.h, popcntintrin.h, fmaintrin.h, tsxtrkintrin.h,
avx5124fmapsintrin.h, avx5124vnniwintrin.h, avx512vpopcntdqintrin.h,
avx512bitalgintrin.h, avx512vp2intersectintrin.h,
+ amxtileintrin.h, amxint8intrin.h, amxbf16intrin.h,
avx512vp2intersectvlintrin.h and mm_malloc.h that reference the proper
builtin functions.
Defining away "extern" and "__inline" results in all of them being
@@ -398,6 +399,8 @@
#define __builtin_ia32_vfmaddss3_mask3(A, B, C, D, E) __builtin_ia32_vfmaddss3_mask3(A, B, C, D, 8)
#define __builtin_ia32_vfmaddss3_maskz(A, B, C, D, E) __builtin_ia32_vfmaddss3_maskz(A, B, C, D, 8)
#define __builtin_ia32_vfmsubss3_mask3(A, B, C, D, E) __builtin_ia32_vfmsubss3_mask3(A, B, C, D, 8)
+#define __builtin_ia32_cvtsd2ss_mask_round(A, B, C, D, E) __builtin_ia32_cvtsd2ss_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_cvtss2sd_mask_round(A, B, C, D, E) __builtin_ia32_cvtss2sd_mask_round(A, B, C, D, 8)
/* avx512pfintrin.h */
#define __builtin_ia32_gatherpfdps(A, B, C, D, E) __builtin_ia32_gatherpfdps(A, B, C, 1, _MM_HINT_T0)
@@ -420,6 +423,10 @@
#define __builtin_ia32_rcp28ss_round(A, B, C) __builtin_ia32_rcp28ss_round(A, B, 8)
#define __builtin_ia32_rsqrt28sd_round(A, B, C) __builtin_ia32_rsqrt28sd_round(A, B, 8)
#define __builtin_ia32_rsqrt28ss_round(A, B, C) __builtin_ia32_rsqrt28ss_round(A, B, 8)
+#define __builtin_ia32_rcp28sd_mask_round(A, B, C, D, E) __builtin_ia32_rcp28sd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rcp28ss_mask_round(A, B, C, D, E) __builtin_ia32_rcp28ss_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rsqrt28sd_mask_round(A, B, C, D, E) __builtin_ia32_rsqrt28sd_mask_round(A, B, C, D, 8)
+#define __builtin_ia32_rsqrt28ss_mask_round(A, B, C, D, E) __builtin_ia32_rsqrt28ss_mask_round(A, B, C, D, 8)
/* shaintrin.h */
#define __builtin_ia32_sha1rnds4(A, B, C) __builtin_ia32_sha1rnds4(A, B, 1)
@@ -481,6 +488,10 @@
#define __builtin_ia32_cvtps2qq512_mask(A, B, C, D) __builtin_ia32_cvtps2qq512_mask(A, B, C, 8)
#define __builtin_ia32_cvtpd2uqq512_mask(A, B, C, D) __builtin_ia32_cvtpd2uqq512_mask(A, B, C, 8)
#define __builtin_ia32_cvtpd2qq512_mask(A, B, C, D) __builtin_ia32_cvtpd2qq512_mask(A, B, C, 8)
+#define __builtin_ia32_reducesd_mask_round(A, B, C, D, E, F) __builtin_ia32_reducesd_mask_round(A, B, 8, D, E, 8)
+#define __builtin_ia32_reducess_mask_round(A, B, C, D, E, F) __builtin_ia32_reducess_mask_round(A, B, 8, D, E, 8)
+#define __builtin_ia32_reducepd512_mask_round(A, B, C, D, E) __builtin_ia32_reducepd512_mask_round(A, 8, C, D, 8)
+#define __builtin_ia32_reduceps512_mask_round(A, B, C, D, E) __builtin_ia32_reduceps512_mask_round(A, 8, C, D, 8)
/* avx512vlintrin.h */
#define __builtin_ia32_vpermilps_mask(A, E, C, D) __builtin_ia32_vpermilps_mask(A, 1, C, D)
@@ -697,6 +708,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")
+#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")
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse2-mmx-pinsrw.c b/gcc/testsuite/gcc.target/i386/sse2-mmx-pinsrw.c
index c25ddd9..fd93355 100644
--- a/gcc/testsuite/gcc.target/i386/sse2-mmx-pinsrw.c
+++ b/gcc/testsuite/gcc.target/i386/sse2-mmx-pinsrw.c
@@ -42,7 +42,7 @@ compute_correct_result (__m64 *src_p, int val, unsigned int imm,
static void
sse2_test (void)
{
- int r, ck;
+ int r[2], ck[2];
int i;
int failed = 0;
__v4hi y = { 3320, -3339, 48, 4392 };
@@ -50,9 +50,9 @@ sse2_test (void)
/* Run the MMX tests */
for (i = 0; i < 4; i++)
{
- test_pinsrw ((__m64 *) &y, 0x1234, i, &r);
- compute_correct_result ((__m64 *) &y, 0x1234, i, &ck);
- if (r != ck)
+ test_pinsrw ((__m64 *) &y, 0x1234, i, r);
+ compute_correct_result ((__m64 *) &y, 0x1234, i, ck);
+ if (r[0] != ck[0] || r[1] != ck[1])
failed++;
}
diff --git a/gcc/testsuite/gcc.target/i386/uintr-1.c b/gcc/testsuite/gcc.target/i386/uintr-1.c
new file mode 100644
index 0000000..f30f755
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/uintr-1.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -muintr" } */
+/* { dg-final { scan-assembler-times "clui" "1" } } */
+/* { dg-final { scan-assembler-times "stui" "2" } } */
+/* { dg-final { scan-assembler-times "senduipi" "1" } } */
+/* { dg-final { scan-assembler-times "setc" "1" } } */
+/* { dg-final { scan-assembler-times "testui" "1" } } */
+
+#include <x86gprintrin.h>
+
+extern volatile unsigned char c;
+extern volatile unsigned long long l;
+
+void
+foo (void)
+{
+ _clui ();
+ _stui ();
+ _senduipi (l);
+ c = _testui ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/uintr-2.c b/gcc/testsuite/gcc.target/i386/uintr-2.c
new file mode 100644
index 0000000..e705732
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/uintr-2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -muintr -mgeneral-regs-only" } */
+/* { dg-final { scan-assembler-times "uiret" "2" } } */
+
+#include <x86gprintrin.h>
+
+void
+__attribute__((interrupt))
+foo (void *frame)
+{
+}
+
+void
+__attribute__((interrupt))
+UINTR_hanlder (struct __uintr_frame *frame)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/uintr-3.c b/gcc/testsuite/gcc.target/i386/uintr-3.c
new file mode 100644
index 0000000..d284349
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/uintr-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -muintr" } */
+/* { dg-final { scan-assembler "uiret" } } */
+#include <x86gprintrin.h>
+
+void __attribute__ ((target("general-regs-only"), interrupt))
+UINTR_handler (struct __uintr_frame *p)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/uintr-4.c b/gcc/testsuite/gcc.target/i386/uintr-4.c
new file mode 100644
index 0000000..f3b371b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/uintr-4.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -muintr" } */
+
+#include <x86gprintrin.h>
+
+void __attribute__ ((interrupt))
+UINTR_handler (struct __uintr_frame *p)
+{ /* { dg-message "SSE instructions aren't allowed in an interrupt service routine" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/uintr-5.c b/gcc/testsuite/gcc.target/i386/uintr-5.c
new file mode 100644
index 0000000..ac44be0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/uintr-5.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -muintr" } */
+/* { dg-error "'-muintr' not supported for 32-bit code" "" { target ia32 } 0 } */
+
+#include <x86gprintrin.h>
+
+void
+UINTR_hanlder (struct __uintr_frame *frame)
+{
+}
diff --git a/gcc/testsuite/gcc.target/i386/x86-64-v2.c b/gcc/testsuite/gcc.target/i386/x86-64-v2.c
new file mode 100644
index 0000000..f17a15d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86-64-v2.c
@@ -0,0 +1,119 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mabi=sysv -march=x86-64-v2" } */
+
+/* Verify that the CPU features required by x86-64-v2 are enabled. */
+
+#ifndef __MMX__
+# error __MMX__ not defined
+#endif
+#ifndef __SSE__
+# error __SSE__ not defined
+#endif
+#ifndef __SSE2__
+# error __SSE2__ not defined
+#endif
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
+# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined
+#endif
+#ifndef __LAHF_SAHF__
+# error __LAHF_SAHF__ not defined
+#endif
+#ifndef __POPCNT__
+# error __POPCNT__ not defined
+#endif
+#ifndef __SSE3__
+# error __SSE3__ not defined
+#endif
+#ifndef __SSE4_1__
+# error __SSE4_1__ not defined
+#endif
+#ifndef __SSE4_2__
+# error __SSE4_2__ not defined
+#endif
+#ifndef __SSSE3__
+# error __SSSE3__ not defined
+#endif
+#ifdef __SSE4A__
+# error __SSE4A__ defined
+#endif
+#ifdef __AVX__
+# error __AVX__ defined
+#endif
+#ifdef __AVX2__
+# error __AVX2__ defined
+#endif
+#ifdef __F16C__
+# error __F16C__ defined
+#endif
+#ifdef __FMA__
+# error __FMA__ defined
+#endif
+#ifdef __LZCNT__
+# error __LZCNT__ defined
+#endif
+#ifdef __MOVBE__
+# error __MOVBE__ defined
+#endif
+#ifdef __XSAVE__
+# error __XSAVE__ defined
+#endif
+#ifdef __XSAVEC__
+# error __XSAVEC__ defined
+#endif
+#ifdef __AVX512F__
+# error __AVX512F__ defined
+#endif
+#ifdef __AVX512BW__
+# error __AVX512BW__ defined
+#endif
+#ifdef __AVX512CD__
+# error __AVX512CD__ defined
+#endif
+#ifdef __AVX512DQ__
+# error __AVX512DQ__ defined
+#endif
+#ifdef __AVX512VL__
+# error __AVX512VL__ defined
+#endif
+#ifdef __AVX512PF__
+# error __AVX512PF__ defined
+#endif
+#ifdef __AVX512VBMI__
+# error __AVX512VBMI__ defined
+#endif
+#ifdef __AVX512IFMA__
+# error __AVX512IFMA__ defined
+#endif
+#ifdef __AVX512VNNIW__
+# error __AVX512VNNIW__ defined
+#endif
+#ifdef __AVX512VBMI2__
+# error __AVX512VBMI2__ defined
+#endif
+#ifdef __AVX5124FMAPS__
+# error __AVX5124FMAPS__ defined
+#endif
+#ifdef __AVX5124BITALG__
+# error __AVX5124BITALG__ defined
+#endif
+#ifdef __AVX5124VPOPCNTDQ__
+# error __AVX5124VPOPCNTDQ__ defined
+#endif
+#ifdef __AVX5124BF16__
+# error __AVX5124BF16__ defined
+#endif
+#ifdef __AVX512VP2INTERSECT__
+# error __AVX512VP2INTERSECT__ defined
+#endif
+#ifdef __AVX512VNNI__
+# error __AVX512VNNI__ defined
+#endif
+#ifdef __FMA4__
+# error __FMA4__ defined
+#endif
+#ifdef __3dNOW__
+# error __3dNOW__ defined
+#endif
+#ifdef __tune_k8__
+# error __tune_k8__ defined
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/x86-64-v3-haswell.c b/gcc/testsuite/gcc.target/i386/x86-64-v3-haswell.c
new file mode 100644
index 0000000..216467e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86-64-v3-haswell.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mabi=sysv -mtune=haswell -march=x86-64-v3" } */
+
+/* Check that -march=x86-64-v3 preserves tuning. */
+
+/* PCLMUL is not in x86-64-v3, but in -march=haswell. Make sure that
+ it is absent. */
+#ifdef __PCLMUL__
+# error __PCLMUL__ is defined
+#endif
+
+/* -mtune=haswell tuning is preserved. */
+#ifndef __k8__
+# error __k8__ is not defined
+#endif
+#ifndef __tune_haswell__
+# error __tune_haswell__ is not defined
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/x86-64-v3-skylake.c b/gcc/testsuite/gcc.target/i386/x86-64-v3-skylake.c
new file mode 100644
index 0000000..aa34862
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86-64-v3-skylake.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mabi=sysv -march=skylake -march=x86-64-v3" } */
+
+/* Check that -march=x86-64-v3 overrides a previous -march= setting. */
+
+/* PCLMUL is not in x86-64-v3, but in -march=skylake. Make sure that
+ it is absent. */
+#ifdef __PCLMUL__
+# error __PCLMUL__ is defined
+#endif
+
+/* -march=skylake tuning is deactivated. */
+#ifndef __k8__
+# error __k8__ is not defined
+#endif
+#ifdef __skylake__
+# error __skylake__ is defined
+#endif
+#ifdef __tune_skylake__
+# error __tune_skylake__ is defined
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/x86-64-v3.c b/gcc/testsuite/gcc.target/i386/x86-64-v3.c
new file mode 100644
index 0000000..784202f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86-64-v3.c
@@ -0,0 +1,119 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mabi=sysv -march=x86-64-v3" } */
+
+/* Verify that the CPU features required by x86-64-v4 are enabled. */
+
+#ifndef __MMX__
+# error __MMX__ not defined
+#endif
+#ifndef __SSE__
+# error __SSE__ not defined
+#endif
+#ifndef __SSE2__
+# error __SSE2__ not defined
+#endif
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
+# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined
+#endif
+#ifndef __LAHF_SAHF__
+# error __LAHF_SAHF__ not defined
+#endif
+#ifndef __POPCNT__
+# error __POPCNT__ not defined
+#endif
+#ifndef __SSE3__
+# error __SSE3__ not defined
+#endif
+#ifndef __SSE4_1__
+# error __SSE4_1__ not defined
+#endif
+#ifndef __SSE4_2__
+# error __SSE4_2__ not defined
+#endif
+#ifndef __SSSE3__
+# error __SSSE3__ not defined
+#endif
+#ifdef __SSE4A__
+# error __SSE4A__ defined
+#endif
+#ifndef __AVX__
+# error __AVX__ not defined
+#endif
+#ifndef __AVX2__
+# error __AVX2__ not defined
+#endif
+#ifndef __F16C__
+# error __F16C__ not defined
+#endif
+#ifndef __FMA__
+# error __FMA__ not defined
+#endif
+#ifndef __LZCNT__
+# error __LZCNT__ not defined
+#endif
+#ifndef __MOVBE__
+# error __MOVBE__ not defined
+#endif
+#ifndef __XSAVE__
+# error __XSAVE__ not defined
+#endif
+#ifdef __XSAVEC__
+# error __XSAVEC__ defined
+#endif
+#ifdef __AVX512F__
+# error __AVX512F__ defined
+#endif
+#ifdef __AVX512BW__
+# error __AVX512BW__ defined
+#endif
+#ifdef __AVX512CD__
+# error __AVX512CD__ defined
+#endif
+#ifdef __AVX512DQ__
+# error __AVX512DQ__ defined
+#endif
+#ifdef __AVX512VL__
+# error __AVX512VL__ defined
+#endif
+#ifdef __AVX512PF__
+# error __AVX512PF__ defined
+#endif
+#ifdef __AVX512VBMI__
+# error __AVX512VBMI__ defined
+#endif
+#ifdef __AVX512IFMA__
+# error __AVX512IFMA__ defined
+#endif
+#ifdef __AVX512VNNIW__
+# error __AVX512VNNIW__ defined
+#endif
+#ifdef __AVX512VBMI2__
+# error __AVX512VBMI2__ defined
+#endif
+#ifdef __AVX5124FMAPS__
+# error __AVX5124FMAPS__ defined
+#endif
+#ifdef __AVX5124BITALG__
+# error __AVX5124BITALG__ defined
+#endif
+#ifdef __AVX5124VPOPCNTDQ__
+# error __AVX5124VPOPCNTDQ__ defined
+#endif
+#ifdef __AVX5124BF16__
+# error __AVX5124BF16__ defined
+#endif
+#ifdef __AVX512VP2INTERSECT__
+# error __AVX512VP2INTERSECT__ defined
+#endif
+#ifdef __AVX512VNNI__
+# error __AVX512VNNI__ defined
+#endif
+#ifdef __FMA4__
+# error __FMA4__ defined
+#endif
+#ifdef __3dNOW__
+# error __3dNOW__ defined
+#endif
+#ifdef __tune_k8__
+# error __tune_k8__ defined
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/x86-64-v4.c b/gcc/testsuite/gcc.target/i386/x86-64-v4.c
new file mode 100644
index 0000000..7c202a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86-64-v4.c
@@ -0,0 +1,119 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mabi=sysv -march=x86-64-v4" } */
+
+/* Verify that the CPU features required by x86-64-v4 are enabled. */
+
+#ifndef __MMX__
+# error __MMX__ not defined
+#endif
+#ifndef __SSE__
+# error __SSE__ not defined
+#endif
+#ifndef __SSE2__
+# error __SSE2__ not defined
+#endif
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
+# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined
+#endif
+#ifndef __LAHF_SAHF__
+# error __LAHF_SAHF__ not defined
+#endif
+#ifndef __POPCNT__
+# error __POPCNT__ not defined
+#endif
+#ifndef __SSE3__
+# error __SSE3__ not defined
+#endif
+#ifndef __SSE4_1__
+# error __SSE4_1__ not defined
+#endif
+#ifndef __SSE4_2__
+# error __SSE4_2__ not defined
+#endif
+#ifndef __SSSE3__
+# error __SSSE3__ not defined
+#endif
+#ifdef __SSE4A__
+# error __SSE4A__ defined
+#endif
+#ifndef __AVX__
+# error __AVX__ not defined
+#endif
+#ifndef __AVX2__
+# error __AVX2__ not defined
+#endif
+#ifndef __F16C__
+# error __F16C__ not defined
+#endif
+#ifndef __FMA__
+# error __FMA__ not defined
+#endif
+#ifndef __LZCNT__
+# error __LZCNT__ not defined
+#endif
+#ifndef __MOVBE__
+# error __MOVBE__ not defined
+#endif
+#ifndef __XSAVE__
+# error __XSAVE__ not defined
+#endif
+#ifdef __XSAVEC__
+# error __XSAVEC__ defined
+#endif
+#ifndef __AVX512F__
+# error __AVX512F__ not defined
+#endif
+#ifndef __AVX512BW__
+# error __AVX512BW__ not defined
+#endif
+#ifndef __AVX512CD__
+# error __AVX512CD__ not defined
+#endif
+#ifndef __AVX512DQ__
+# error __AVX512DQ__ not defined
+#endif
+#ifndef __AVX512VL__
+# error __AVX512VL__ not defined
+#endif
+#ifdef __AVX512PF__
+# error __AVX512PF__ defined
+#endif
+#ifdef __AVX512VBMI__
+# error __AVX512VBMI__ defined
+#endif
+#ifdef __AVX512IFMA__
+# error __AVX512IFMA__ defined
+#endif
+#ifdef __AVX512VNNIW__
+# error __AVX512VNNIW__ defined
+#endif
+#ifdef __AVX512VBMI2__
+# error __AVX512VBMI2__ defined
+#endif
+#ifdef __AVX5124FMAPS__
+# error __AVX5124FMAPS__ defined
+#endif
+#ifdef __AVX5124BITALG__
+# error __AVX5124BITALG__ defined
+#endif
+#ifdef __AVX5124VPOPCNTDQ__
+# error __AVX5124VPOPCNTDQ__ defined
+#endif
+#ifdef __AVX5124BF16__
+# error __AVX5124BF16__ defined
+#endif
+#ifdef __AVX512VP2INTERSECT__
+# error __AVX512VP2INTERSECT__ defined
+#endif
+#ifdef __AVX512VNNI__
+# error __AVX512VNNI__ defined
+#endif
+#ifdef __FMA4__
+# error __FMA4__ defined
+#endif
+#ifdef __3dNOW__
+# error __3dNOW__ defined
+#endif
+#ifdef __tune_k8__
+# error __tune_k8__ defined
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-1.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-1.c
new file mode 100644
index 0000000..293be09
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-1.c
@@ -0,0 +1,8 @@
+/* Test that <x86gprintrin.h> is usable with -O -std=c89 -pedantic-errors. */
+/* { dg-do compile } */
+/* { dg-options "-O -std=c89 -pedantic-errors -march=x86-64 -madx -mbmi -mbmi2 -mcldemote -mclflushopt -mclwb -mclzero -menqcmd -mfsgsbase -mfxsr -mhreset -mlzcnt -mlwp -mmovdiri -mmwaitx -mpconfig -mpopcnt -mpku -mptwrite -mrdpid -mrdrnd -mrdseed -mrtm -mserialize -msgx -mshstk -mtbm -mtsxldtrk -mwaitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-sse -mno-mmx" } */
+/* { dg-additional-options "-muintr" { target { ! ia32 } } } */
+
+#include <x86gprintrin.h>
+
+int dummy;
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c
new file mode 100644
index 0000000..c633027
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=x86-64 -madx -mbmi -mbmi2 -mcldemote -mclflushopt -mclwb -mclzero -menqcmd -mfsgsbase -mfxsr -mhreset -mlzcnt -mlwp -mmovdiri -mmwaitx -mpconfig -mpopcnt -mpku -mptwrite -mrdpid -mrdrnd -mrdseed -mrtm -mserialize -msgx -mshstk -mtbm -mtsxldtrk -mwaitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-sse -mno-mmx" } */
+/* { dg-add-options bind_pic_locally } */
+/* { dg-additional-options "-muintr" { target { ! ia32 } } } */
+
+/* Test that the intrinsics in <x86gprintrin.h> compile with optimization.
+ All of them are defined as inline functions that reference the proper
+ builtin functions.
+
+ Defining away "extern" and "__inline" results in all of them being
+ compiled as proper functions. */
+
+#define extern
+#define __inline
+
+/* Following intrinsics require immediate arguments. */
+
+/* lwpintrin.h */
+#define __builtin_ia32_lwpval32(D2, D1, F) __builtin_ia32_lwpval32 (D2, D1, 1)
+#define __builtin_ia32_lwpval64(D2, D1, F) __builtin_ia32_lwpval64 (D2, D1, 1)
+#define __builtin_ia32_lwpins32(D2, D1, F) __builtin_ia32_lwpins32 (D2, D1, 1)
+#define __builtin_ia32_lwpins64(D2, D1, F) __builtin_ia32_lwpins64 (D2, D1, 1)
+
+/* tbmintrin.h */
+#define __builtin_ia32_bextri_u32(X, Y) __builtin_ia32_bextri_u32 (X, 1)
+#define __builtin_ia32_bextri_u64(X, Y) __builtin_ia32_bextri_u64 (X, 1)
+
+/* rtmintrin.h */
+#define __builtin_ia32_xabort(N) __builtin_ia32_xabort(1)
+
+#include <x86gprintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c
new file mode 100644
index 0000000..3a7e1f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=x86-64 -madx -mbmi -mbmi2 -mcldemote -mclflushopt -mclwb -mclzero -menqcmd -mfsgsbase -mfxsr -mhreset -mlzcnt -mlwp -mmovdiri -mmwaitx -mpconfig -mpopcnt -mpku -mptwrite -mrdpid -mrdrnd -mrdseed -mrtm -mserialize -msgx -mshstk -mtbm -mtsxldtrk -mwaitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-sse -mno-mmx" } */
+/* { dg-add-options bind_pic_locally } */
+/* { dg-additional-options "-muintr" { target { ! ia32 } } } */
+
+/* Test that the intrinsics in <x86gprintrin.h> compile without optimization.
+ All of them are defined as inline functions that reference the proper
+ builtin functions.
+
+ Defining away "extern" and "__inline" results in all of them being compiled
+ as proper functions. */
+
+#define extern
+#define __inline
+
+#include <x86gprintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c
new file mode 100644
index 0000000..d8a6126
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c
@@ -0,0 +1,34 @@
+/* Same as x86gprintrin-3.c, except converted to use #pragma GCC option. */
+/* { dg-do compile } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=x86-64 -mno-sse -mno-mmx" } */
+/* { dg-add-options bind_pic_locally } */
+
+/* Test that the intrinsics in <x86gprintrin.h> compile without optimization.
+ All of them are defined as inline functions that reference the proper
+ builtin functions.
+
+ Defining away "extern" and "__inline" results in all of them being
+ compiled as proper functions. */
+
+#define extern
+#define __inline
+
+#ifndef DIFFERENT_PRAGMAS
+#ifdef __x86_64__
+#pragma GCC target ("adx,bmi,bmi2,fsgsbase,fxsr,hreset,lwp,lzcnt,popcnt,rdrnd,rdseed,tbm,rtm,serialize,tsxldtrk,uintr,xsaveopt")
+#else
+#pragma GCC target ("adx,bmi,bmi2,fsgsbase,fxsr,hreset,lwp,lzcnt,popcnt,rdrnd,rdseed,tbm,rtm,serialize,tsxldtrk,xsaveopt")
+#endif
+#endif
+
+/* popcnintrin.h (POPCNT). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC target ("popcnt")
+#endif
+#include <popcntintrin.h>
+
+/* x86intrin.h (LWP/BMI/BMI2/TBM/LZCNT). */
+#ifdef DIFFERENT_PRAGMAS
+#pragma GCC target ("lwp,bmi,bmi2,tbm,lzcnt")
+#endif
+#include <x86gprintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-4a.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-4a.c
new file mode 100644
index 0000000..f6e9c70
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-4a.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8" } */
+/* { dg-add-options bind_pic_locally } */
+
+#define DIFFERENT_PRAGMAS
+
+#include "x86gprintrin-4.c"
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c
new file mode 100644
index 0000000..9ef66fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=x86-64 -mno-sse -mno-mmx" } */
+/* { dg-add-options bind_pic_locally } */
+
+/* Test that the intrinsics in <x86gprintrin.h> compile with optimization.
+ All of them are defined as inline functions that reference the proper
+ builtin functions.
+
+ Defining away "extern" and "__inline" results in all of them being
+ compiled as proper functions. */
+
+#define extern
+#define __inline
+
+/* Following intrinsics require immediate arguments. */
+
+/* lwpintrin.h */
+#define __builtin_ia32_lwpval32(D2, D1, F) __builtin_ia32_lwpval32 (D2, D1, 1)
+#define __builtin_ia32_lwpval64(D2, D1, F) __builtin_ia32_lwpval64 (D2, D1, 1)
+#define __builtin_ia32_lwpins32(D2, D1, F) __builtin_ia32_lwpins32 (D2, D1, 1)
+#define __builtin_ia32_lwpins64(D2, D1, F) __builtin_ia32_lwpins64 (D2, D1, 1)
+
+/* tbmintrin.h */
+#define __builtin_ia32_bextri_u32(X, Y) __builtin_ia32_bextr_u32 (X, 1)
+#define __builtin_ia32_bextri_u64(X, Y) __builtin_ia32_bextr_u64 (X, 1)
+
+/* rtmintrin.h */
+#define __builtin_ia32_xabort(M) __builtin_ia32_xabort(1)
+
+#ifdef __x86_64__
+#pragma GCC target ("adx,bmi,bmi2,clflushopt,clwb,clzero,enqcmd,fsgsbase,fxsr,hreset,lwp,lzcnt,mwaitx,pconfig,pku,popcnt,rdpid,rdrnd,rdseed,tbm,rtm,serialize,sgx,tsxldtrk,uintr,xsavec,xsaveopt,xsaves,wbnoinvd")
+#else
+#pragma GCC target ("adx,bmi,bmi2,clflushopt,clwb,clzero,enqcmd,fsgsbase,fxsr,hreset,lwp,lzcnt,mwaitx,pconfig,pku,popcnt,rdpid,rdrnd,rdseed,tbm,rtm,serialize,sgx,tsxldtrk,xsavec,xsaveopt,xsaves,wbnoinvd")
+#endif
+
+#include <x86gprintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-5a.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-5a.c
new file mode 100644
index 0000000..6670a25
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-5a.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -mno-sse -mno-mmx" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include "x86gprintrin-5.c"
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-5b.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-5b.c
new file mode 100644
index 0000000..f76bb24
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-5b.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -funsigned-char -mno-sse -mno-mmx" } */
+/* { dg-add-options bind_pic_locally } */
+
+#include "x86gprintrin-5.c"
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-6.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-6.c
new file mode 100644
index 0000000..40e84dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-6.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -miamcu" } */
+/* { dg-add-options bind_pic_locally } */
+
+/* Defining away "extern" and "__inline" results in all of them being
+ compiled as proper functions. */
+
+#define extern
+#define __inline
+
+#include <x86gprintrin.h>
diff --git a/gcc/testsuite/gcc.target/nvptx/atomic_fetch-3.c b/gcc/testsuite/gcc.target/nvptx/atomic_fetch-3.c
deleted file mode 100644
index 36a83eb..0000000
--- a/gcc/testsuite/gcc.target/nvptx/atomic_fetch-3.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Test the nvptx atomic instructions for __atomic_fetch_OP for
- SImode arguments. */
-
-/* { dg-do compile } */
-/* { dg-options "-O2 -m32" } */
-
-int
-main()
-{
- unsigned long a = ~0;
- unsigned b = 0xa;
-
- __atomic_fetch_add (&a, b, 0);
- __atomic_fetch_and (&a, b, 0);
- __atomic_fetch_or (&a, b, 0);
- __atomic_fetch_xor (&a, b, 0);
-
- return a;
-}
-
-/* { dg-final { scan-assembler "atom.add.u32" } } */
-/* { dg-final { scan-assembler "atom.b32.and" } } */
-/* { dg-final { scan-assembler "atom.b32.or" } } */
-/* { dg-final { scan-assembler "atom.b32.xor" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c
index 711e3d0..9766541 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c
@@ -16,8 +16,13 @@ int main() {
vfb = (vector float){10.0, -2.0, 70.0, 999.0 };
/* Expected results. */
+#ifdef __BIG_ENDIAN__
+ vexpected = (vector unsigned short) { 0x4900, 0xc000, 0x5460, 0x63ce,
+ 0x3666, 0x3e66, 0x4d00, 0x563e };
+#else
vexpected = (vector unsigned short) { 0x3666, 0x3e66, 0x4d00, 0x563e,
- 0x4900, 0xc000, 0x5460, 0x63ce};
+ 0x4900, 0xc000, 0x5460, 0x63ce };
+#endif
/*
vresult = vec_pack_to_short_fp32 (vfa, vfb);
@@ -44,7 +49,7 @@ int main() {
for(i = 0; i< 8; i++) {
if (vresult[i] != vexpected[i]) {
printf("i=[%d] 0x%x != 0x%x \n",i,vresult[i],vexpected[i]);
- abort();
+ abort();
}
}
}
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
index 5818361..96bdc48 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { le } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O1" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-5-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-5-p9-runnable.c
index 0fe6206..14e9355 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-5-p9-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-5-p9-runnable.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target lp64 } } */
/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c
index 1333d01..fa4eb2d 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-7-p9-runnable.c
@@ -93,10 +93,17 @@ int main()
vsi_arg = (vector signed int){0xA, 0xB, 0xC, 0xD};
+#ifdef __BIG_ENDIAN__
+ vec_uc_expected = (vector unsigned char){0, 0, 0, 0xB,
+ 5, 6, 7, 8,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16};
+#else
vec_uc_expected = (vector unsigned char){0xC, 0, 0, 0,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16};
+#endif
/* Test vec_insert4b() */
/* Insert into char 0 location */
vec_uc_result = vec_insert4b (vsi_arg, vec_uc_arg, 0);
@@ -112,10 +119,17 @@ int main()
}
/* insert into char 4 location */
+#ifdef __BIG_ENDIAN__
+ vec_uc_expected = (vector unsigned char){1, 2, 3, 4,
+ 0, 0, 0, 3,
+ 9, 10, 11, 12,
+ 13, 14, 15, 16};
+#else
vec_uc_expected = (vector unsigned char){1, 2, 3, 4,
2, 0, 0, 0,
9, 10, 11, 12,
13, 14, 15, 16};
+#endif
vui_arg = (vector unsigned int){0x4, 0x3, 0x2, 0x1};
vec_uc_result = vec_insert4b (vui_arg, vec_uc_arg, 4);
@@ -132,12 +146,20 @@ int main()
/* Test vec_extract4b() */
/* Extract 4b, from char 0 location */
+#ifdef __BIG_ENDIAN__
+ vec_uc_arg = (vector unsigned char){0, 0, 0, 10,
+ 0, 0, 0, 20,
+ 0, 0, 0, 30,
+ 0, 0, 0, 40};
+ vec_ull_expected = (vector unsigned long long){10, 0};
+#else
vec_uc_arg = (vector unsigned char){10, 0, 0, 0,
20, 0, 0, 0,
30, 0, 0, 0,
40, 0, 0, 0};
-
vec_ull_expected = (vector unsigned long long){0, 10};
+#endif
+
vec_ull_result = vec_extract4b(vec_uc_arg, 0);
if (result_wrong_ull(vec_ull_expected, vec_ull_result))
@@ -151,12 +173,20 @@ int main()
}
/* Extract 4b, from char 12 location */
+#ifdef __BIG_ENDIAN__
+ vec_uc_arg = (vector unsigned char){0, 0, 0, 10,
+ 0, 0, 0, 20,
+ 0, 0, 0, 30,
+ 0, 0, 0, 40};
+ vec_ull_expected = (vector unsigned long long){40, 0};
+#else
vec_uc_arg = (vector unsigned char){10, 0, 0, 0,
20, 0, 0, 0,
30, 0, 0, 0,
40, 0, 0, 0};
-
vec_ull_expected = (vector unsigned long long){0, 40};
+#endif
+
vec_ull_result = vec_extract4b(vec_uc_arg, 12);
if (result_wrong_ull(vec_ull_expected, vec_ull_result))
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-msum-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-msum-runnable.c
index 0fa5c31..abc0a0d 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-msum-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-msum-runnable.c
@@ -1,4 +1,6 @@
-/* { dg-do run { target { p9vector_hw } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p9vector_hw } */
+/* { dg-require-effective-target int128 } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-cmp2-runnable.c b/gcc/testsuite/gcc.target/powerpc/float128-cmp2-runnable.c
index 93dd112..d376a3c 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-cmp2-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-cmp2-runnable.c
@@ -1,4 +1,6 @@
-/* { dg-do run { target { powerpc*-*-* && p9vector_hw } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-O2 -mdejagnu-cpu=power9 " } */
#define NAN_Q __builtin_nanq ("")
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p7.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p7.c
index 8f6d369..42599c2 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p7.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p7.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with char
inputs produce the right code with a power7 (BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mdejagnu-cpu=power7 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c
index f3fea46..f3b9556 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with char
inputs produce the right code with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c
index ff07c88..ff03c9a 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-char.p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with char
inputs produce the right code with a P9 (LE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 " } */
@@ -12,7 +12,7 @@
/* { dg-final { scan-assembler-times "stxv" 6 { target ilp32 } } } */
/* { dg-final { scan-assembler-times "lbz" 6 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times "addi" 6 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "addi" 3 { target ilp32 } } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c
index 26fe343..cbf6cff 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p7.c
@@ -1,9 +1,10 @@
/* Verify that overloaded built-ins for vec_extract() with
double inputs produce the right code. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-mdejagnu-cpu=power7 -O2 -mbig-endian" } */
+/* { dg-options "-mdejagnu-cpu=power7 -O2" } */
+/* { dg-additional-options "-mbig-endian" { target powerpc*-*-linux* } } */
// targeting P7 (BE), 2 tests.
// P7 constants: xxpermdi
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c
index 188a1d2..2b8dbb0 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with
double inputs produce the right code with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c
index 2a3bfc1..6c51503 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c
@@ -5,10 +5,10 @@
/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 " } */
-/* { dg-final { scan-assembler-times {\mxxlor\M} 2 } } */
-/* { dg-final { scan-assembler-times {\mrldic\M} 1 } } */
-/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 1 } } */
-/* { dg-final { scan-assembler-times {\mvslo\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxxlor\M} 2 { target lp64} } } */
+/* { dg-final { scan-assembler-times {\mrldic\M} 1 { target lp64} } } */
+/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 1 { target lp64} } } */
+/* { dg-final { scan-assembler-times {\mvslo\M} 1 { target lp64} } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c
index fa2dbb3..c9abb6c 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p7.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with float
inputs produce the right code with a P7 (BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mdejagnu-cpu=power7 -O2 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c
index 815f9b5..68eeeed 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with float
inputs produce the right code with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p9.c
index d078e8a..aaa8a92 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-float.p9.c
@@ -1,13 +1,13 @@
/* Verify that overloaded built-ins for vec_extract() with float
inputs produce the right code. */
-/* { dg-do compile { target { powerpc*-*-linux* && le } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 " } */
/* { dg-final { scan-assembler-times {\mxscvspdp\M} 2 } } */
-/* { dg-final { scan-assembler-times {\mrldicl\M} 1 } } */
-/* { dg-final { scan-assembler-times {\msubfic\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mrldicl\M} 1 { target le } } } */
+/* { dg-final { scan-assembler-times {\msubfic\M} 1 { target le } } } */
/* { dg-final { scan-assembler-times {\msldi\M} 1 } } */
/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 1 } } */
/* { dg-final { scan-assembler-times {\mvslo\M} 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c
index 2285881..418762e 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p7.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with int
inputs produce the right code with a P7 (BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mdejagnu-cpu=power7 -O2 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c
index 83ce4ee..d1e3b62 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with int
inputs produce the right code with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c
index 0187803..868b673 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-int.p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with int
inputs produce the right code with a P9 (LE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 " } */
@@ -18,7 +18,7 @@
/* { dg-final { scan-assembler-times {\madd\M} 3 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mstxv\M} 6 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlwz\M} 6 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\maddi\M} 6 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\maddi\M} 3 { target ilp32 } } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c
index 3fa9cab..033d21c 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with long long
inputs produce the right code with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mdejagnu-cpu=power7 -O2" } */
@@ -21,7 +21,8 @@
/* { dg-final { scan-assembler-times {\mli\M} 3 { target lp64 } } } */
/* -m32 target with constant test uses (+2)li where the -m64 has an ld */
/* { dg-final { scan-assembler-times {\mli\M} 5 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\maddi\M} 6 } } */
+/* { dg-final { scan-assembler-times {\maddi\M} 6 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {\maddi\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstvx\M} 3 } } */
/* { dg-final { scan-assembler-times {\mrldic\M|\mrlwinm\M} 3 } } */
/* { dg-final { scan-assembler-times {\mldx\M} 3 { target lp64 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c
index 5674698..0b624d2 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with long long
inputs produce the right code with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
@@ -17,7 +17,7 @@
/* { dg-final { scan-assembler-times {\mstxvd2x\M|\mstxvw4x\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\madd\M} 3 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlwz\M} 11 { target ilp32 } } } */
-/* { dg-final { scan-assembler-times {\maddi\M} 6 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\maddi\M} 4 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mmfvsrd\M} 6 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mmtvsrd\M} 3 { target lp64 } } } */
/* { dg-final { scan-assembler-times {\mxxpermdi\M} 3 { target le } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p9.c
index c98c0da..29814ed 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with long long
- inputs produce the right code for a P9 (LE) target. */
+ inputs produce the right code for a P9 target. */
-/* { dg-do compile { target { powerpc*-*-linux* && le } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
@@ -10,11 +10,13 @@
// p9 vars: xori, rldic, mtvsrdd, vslo, mfvsrd
/* results. */
-/* { dg-final { scan-assembler-times {\mxori\M} 3 } } */
+/* { dg-final { scan-assembler-times {\mxori\M} 3 { target le } } } */
/* { dg-final { scan-assembler-times {\mrldic\M} 3 } } */
/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 3 } } */
/* { dg-final { scan-assembler-times {\mvslo\M} 3 } } */
-/* { dg-final { scan-assembler-times {\mmfvsrd\M} 6 } } */
+/* { dg-final { scan-assembler-times {\mmfvsrd\M} 6 { target le } } } */
+/* { dg-final { scan-assembler-times {\mmfvsrd\M} 3 { target be } } } */
+/* { dg-final { scan-assembler-times {\mmfvsrld\M} 3 { target be } } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c
index 8616e7b..46e943f 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p7.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with short
inputs produce the right code for a P7 (BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mdejagnu-cpu=power7 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c
index e749a22..00685ac 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_extract() with short
inputs produce the right results with a P8 (LE or BE) target. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p9.c
index 0978334..fac35cb 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-short.p9.c
@@ -1,17 +1,18 @@
/* Verify that overloaded built-ins for vec_extract() with short
- inputs produce the right code for a P9 (LE) target. */
+ inputs produce the right code for a P9 target. */
-/* { dg-do compile { target { powerpc*-*-linux* && le } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
-// six tests total. Targeting P9 LE.
+// six tests total. Targeting P9.
// p9 (le) variable offset: slwi, vextuhlx, extsh
// p9 (le) const offset: li, vextuhlx, extsh
/* { dg-final { scan-assembler-times {\mslwi\M} 3 } } */
/* { dg-final { scan-assembler-times {\mli\M} 3 } } */
-/* { dg-final { scan-assembler-times "vextuhrx" 6 } } */
+/* { dg-final { scan-assembler-times "vextuhrx" 6 { target le } } } */
+/* { dg-final { scan-assembler-times "vextuhlx" 6 { target be } } } */
/* { dg-final { scan-assembler-times {\mextsh\M} 2 } } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c
index b13c8ca..39fd4df 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert () with char
inputs produce the right codegen. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c
index 1643228..ae1daad 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-char-p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert () with char
inputs produce the right codegen. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c
index 435d28d..120579c 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-double.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert with
double inputs produce the right codegen. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mvsx -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c
index 7682aea..76039bc 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert with float
inputs produce the right codegen. Power8 variant. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
index 93c263e..3819fe6 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-float-p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert with float
inputs produce the right codegen. Power9 variant. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c
index 4a3b1ae..0f2bdd7 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert() with int
inputs produce the right codegen. Power8 variant. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c
index 5ba5d53..81ac1f1 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-int-p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert() with int
inputs produce the right codegen. Power9 variant. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
@@ -59,7 +59,7 @@ testui2_cst(unsigned int x, vector unsigned int v)
/* { dg-final { scan-assembler-times {\mxxinsertw\M} 4 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {\maddi\M} 12 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {\maddi\M} 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mstw\M} 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlxv\M} 8 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {\mlvewx\M} 4 { target ilp32 } } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c
index 337b38f..e969898 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-longlong.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert() with long long
inputs produce the right codegen. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c
index 3ed4004..0a73db7 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p8.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert() with short
inputs produce the right codegen. Power8 variant. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c
index f09fd21..0f35042 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-insert-short-p9.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_insert() with short
inputs produce the right codegen. Power9 variant. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-select-double.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-select-double.c
index 7de7abc..bb7dce1 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-select-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-select-double.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_sel with
double inputs for VSX produce the right code. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-select-float.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-select-float.c
index cc37eb5..1656fbf 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-select-float.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-select-float.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_sel with float
inputs for VSX produce the right code. */
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-maltivec -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c
index 01b95c5..dff0f55 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_splat with int
inputs produce the right code. */
-/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -O2 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c
index 2dbf48e..2425650 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c
@@ -1,7 +1,7 @@
/* Verify that overloaded built-ins for vec_splat with long long
inputs produce the right code. */
-/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mvsx -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c b/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c
index b2cd3d6..9914f94 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c b/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c
index c2196a2..6d74728 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
index c47ca5a..2b79145 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-2.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-2.c
index 9ffb050..ffbc6b9 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-extract-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-3.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-3.c
index 15ce107..3c1361d 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-extract-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-3.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-1.c b/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-1.c
index e7e9d9a..3ad8198 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-2.c b/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-2.c
index 11999e4..c7ea1c2 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-fpcvt-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-1.c b/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-1.c
index e302f71..5539429 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O3" } */
/* { dg-final { scan-assembler "lxvx" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-2.c b/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-2.c
index 0da44eb..edab616 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O1" } */
/* { dg-final { scan-assembler "lxvx" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c b/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c
index 6d64a1b..3cb28ee 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-lxvx-stxvx-3.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target ppc_float128_sw } */
/* { dg-options "-mdejagnu-cpu=power9 -O3 -mfloat128" } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-final { scan-assembler "lxvx" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-minmax-1.c b/gcc/testsuite/gcc.target/powerpc/p9-minmax-1.c
index 5a54bcb..686fdcc 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-minmax-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-minmax-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 -mpower9-minmax -ffast-math" } */
/* { dg-final { scan-assembler-not "fsel" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-minmax-2.c b/gcc/testsuite/gcc.target/powerpc/p9-minmax-2.c
index 94747b8..78a3d9a 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-minmax-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-minmax-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 -mpower9-minmax" } */
/* { dg-final { scan-assembler-not "fsel" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-minmax-3.c b/gcc/testsuite/gcc.target/powerpc/p9-minmax-3.c
index 141603e..3248b9a 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-minmax-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-minmax-3.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 -mpower9-minmax" } */
/* { dg-final { scan-assembler-not "xsmaxcdp" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-permute.c b/gcc/testsuite/gcc.target/powerpc/p9-permute.c
index cf2655a..b9bf05a 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-permute.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-permute.c
@@ -1,6 +1,6 @@
-/* { dg-do compile { target { powerpc64*-*-* } } } */
-/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-splat-1.c b/gcc/testsuite/gcc.target/powerpc/p9-splat-1.c
index d0cb1cc..ecb8d26 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-splat-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-splat-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-splat-2.c b/gcc/testsuite/gcc.target/powerpc/p9-splat-2.c
index 4ad8a36..efbe7e1 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-splat-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-splat-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-splat-3.c b/gcc/testsuite/gcc.target/powerpc/p9-splat-3.c
index 4384a23..3cfacb29 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-splat-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-splat-3.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-splat-4.c b/gcc/testsuite/gcc.target/powerpc/p9-splat-4.c
index 7d08460..b317445 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-splat-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-splat-4.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vbpermd.c b/gcc/testsuite/gcc.target/powerpc/p9-vbpermd.c
index 1252c54..b26a8f9 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vbpermd.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vbpermd.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c
index ebb2f45..d248f09 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-1.c
@@ -10,6 +10,6 @@
/* { dg-final { scan-assembler-times {\mlxvx?\M} 20 } } */
/* { dg-final { scan-assembler-times {\mstxvx?\M} 10 } } */
-/* { dg-final { scan-assembler-times {\mlxvl\M} 20 } } */
-/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */
+/* { dg-final { scan-assembler-times {\mlxvl\M} 14 } } */
+/* { dg-final { scan-assembler-times {\mstxvl\M} 7 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c
index 9d40328..a27ee34 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-7.c
@@ -8,4 +8,4 @@
#include "p9-vec-length-7.h"
-/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */
+/* { dg-final { scan-assembler-times {\mstxvl\M} 7 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c
index 6b54a29..961df0d 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-epil-8.c
@@ -8,5 +8,5 @@
#include "p9-vec-length-8.h"
-/* { dg-final { scan-assembler-times {\mlxvl\M} 30 } } */
-/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */
+/* { dg-final { scan-assembler-times {\mlxvl\M} 21 } } */
+/* { dg-final { scan-assembler-times {\mstxvl\M} 7 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c
index cfae9bb..5d2357a 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vec-length-full-6.c
@@ -9,8 +9,7 @@
#include "p9-vec-length-6.h"
/* It can use normal vector load for constant vector load. */
-/* { dg-final { scan-assembler-not {\mstxv\M} } } */
-/* { dg-final { scan-assembler-not {\mlxvx\M} } } */
-/* { dg-final { scan-assembler-not {\mstxvx\M} } } */
-/* { dg-final { scan-assembler-times {\mlxvl\M} 16 } } */
-/* { dg-final { scan-assembler-times {\mstxvl\M} 16 } } */
+/* { dg-final { scan-assembler-times {\mstxvx?\M} 6 } } */
+/* 64bit/32bit pairs won't use partial vectors. */
+/* { dg-final { scan-assembler-times {\mlxvl\M} 10 } } */
+/* { dg-final { scan-assembler-times {\mstxvl\M} 10 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vneg.c b/gcc/testsuite/gcc.target/powerpc/p9-vneg.c
index 9e1c9bd3..7d6e9bc 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vneg.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vneg.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vparity.c b/gcc/testsuite/gcc.target/powerpc/p9-vparity.c
index bd6c83d..f4aba15 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vparity.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vparity.c
@@ -1,5 +1,6 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-require-effective-target int128 } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vpermr.c b/gcc/testsuite/gcc.target/powerpc/p9-vpermr.c
index 9c77e33..6f87640 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-vpermr.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-vpermr.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
/* Test generation of VPERMR/XXPERMR on ISA 3.0 in little endian. */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c
index 8ef7880..a449dda 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* && { lp64 && p9vector_hw } } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O3" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c
index de6d5ba..a14ac68 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-3.c b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-3.c
index 98ad7eb..62a946f 100644
--- a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-3.c
@@ -1,6 +1,6 @@
-/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-options "-mpower9-vector -O2" } */
+/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
/* Verify that the XXBR{H,W} instructions are generated if the value is
forced to be in a vector register, and XXBRD is generated all of the
diff --git a/gcc/testsuite/gcc.target/powerpc/pr63335.c b/gcc/testsuite/gcc.target/powerpc/pr63335.c
index 3398a56..27dbc0a 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr63335.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr63335.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc64*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr87507.c b/gcc/testsuite/gcc.target/powerpc/pr87507.c
index a1d3d1b..ae7c1d8 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr87507.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr87507.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target powerpc64le-*-* } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
typedef struct
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96139-a.c b/gcc/testsuite/gcc.target/powerpc/pr96139-a.c
index 12a3383..70f477f 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr96139-a.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr96139-a.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Wall -m32 -mvsx" } */
+/* { dg-options "-O2 -Wall -mvsx" } */
/* { dg-require-effective-target ilp32 } */
/* { dg-require-effective-target powerpc_vsx_ok } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96139-b.c b/gcc/testsuite/gcc.target/powerpc/pr96139-b.c
index 379849a..3264a8e 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr96139-b.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr96139-b.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Wall -m64 -mvsx" } */
+/* { dg-options "-O2 -Wall -mvsx" } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target powerpc_vsx_ok } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr97360.c b/gcc/testsuite/gcc.target/powerpc/pr97360.c
new file mode 100644
index 0000000..2328d28
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr97360.c
@@ -0,0 +1,18 @@
+/* PR target/97360 */
+/* { dg-do compile } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
+
+/* Verify we do not ICE on the test below. */
+
+typedef unsigned char vec_t __attribute__((vector_size(16)));
+
+void
+foo (__vector_quad *dst, __vector_pair *vpair, vec_t *vec)
+{
+ __vector_quad acc = *dst;
+ for (;;)
+ {
+ __builtin_mma_xvf64gerpp(&acc, *vpair, vec[7]);
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/rlwimi-2.c b/gcc/testsuite/gcc.target/powerpc/rlwimi-2.c
index 62344a9..bafa371 100644
--- a/gcc/testsuite/gcc.target/powerpc/rlwimi-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/rlwimi-2.c
@@ -6,9 +6,10 @@
/* { dg-final { scan-assembler-times {(?n)^\s+blr} 6750 } } */
/* { dg-final { scan-assembler-times {(?n)^\s+mr} 643 { target ilp32 } } } */
/* { dg-final { scan-assembler-times {(?n)^\s+mr} 11 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {(?n)^\s+rldicl} 6728 { target lp64 } } } */
+/* { dg-final { scan-assembler-times {(?n)^\s+rldicl} 7790 { target lp64 } } } */
-/* { dg-final { scan-assembler-times {(?n)^\s+rlwimi} 1692 } } */
+/* { dg-final { scan-assembler-times {(?n)^\s+rlwimi} 1692 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times {(?n)^\s+rlwimi} 1666 { target lp64 } } } */
/* { dg-final { scan-assembler-times {(?n)^\s+mulli} 5036 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c
index 1e4acf2..9cc14e4 100644
--- a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-O3 -mdejagnu-cpu=power9" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c
index 8149870..e1de52b 100644
--- a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-O3 -mdejagnu-cpu=power9" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrb.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrb.c
new file mode 100644
index 0000000..4fa5e83
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrb.c
@@ -0,0 +1,110 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+/* { dg-require-effective-target p8vector_hw } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+#include <string.h>
+
+#define msk0 0x00
+#define msk1 0x01
+#define msk2 0x02
+#define msk3 0x03
+#define msk4 0x04
+#define msk5 0x05
+#define msk6 0x06
+#define msk7 0x07
+#define msk8 0x08
+#define msk9 0x09
+#define mskA 0x0A
+#define mskB 0x0B
+#define mskC 0x0C
+#define mskD 0x0D
+#define mskE 0x0E
+#define mskF 0x0F
+
+static void
+TEST (void)
+{
+ union
+ {
+ __m128i x;
+ unsigned int i[4];
+ unsigned char c[16];
+ } res [16], val, tmp;
+ int masks[16];
+ unsigned char ins[4] = { 3, 4, 5, 6 };
+ int i;
+
+ val.i[0] = 0x35251505;
+ val.i[1] = 0x75655545;
+ val.i[2] = 0xB5A59585;
+ val.i[3] = 0xF5E5D5C5;
+
+ /* Check pinsrb imm8, r32, xmm. */
+ res[0].x = _mm_insert_epi8 (val.x, ins[0], msk0);
+ res[1].x = _mm_insert_epi8 (val.x, ins[0], msk1);
+ res[2].x = _mm_insert_epi8 (val.x, ins[0], msk2);
+ res[3].x = _mm_insert_epi8 (val.x, ins[0], msk3);
+ res[4].x = _mm_insert_epi8 (val.x, ins[0], msk4);
+ res[5].x = _mm_insert_epi8 (val.x, ins[0], msk5);
+ res[6].x = _mm_insert_epi8 (val.x, ins[0], msk6);
+ res[7].x = _mm_insert_epi8 (val.x, ins[0], msk7);
+ res[8].x = _mm_insert_epi8 (val.x, ins[0], msk8);
+ res[9].x = _mm_insert_epi8 (val.x, ins[0], msk9);
+ res[10].x = _mm_insert_epi8 (val.x, ins[0], mskA);
+ res[11].x = _mm_insert_epi8 (val.x, ins[0], mskB);
+ res[12].x = _mm_insert_epi8 (val.x, ins[0], mskC);
+ res[13].x = _mm_insert_epi8 (val.x, ins[0], mskD);
+ res[14].x = _mm_insert_epi8 (val.x, ins[0], mskE);
+ res[15].x = _mm_insert_epi8 (val.x, ins[0], mskF);
+
+ masks[0] = msk0;
+ masks[1] = msk1;
+ masks[2] = msk2;
+ masks[3] = msk3;
+ masks[4] = msk4;
+ masks[5] = msk5;
+ masks[6] = msk6;
+ masks[7] = msk7;
+ masks[8] = msk8;
+ masks[9] = msk9;
+ masks[10] = mskA;
+ masks[11] = mskB;
+ masks[12] = mskC;
+ masks[13] = mskD;
+ masks[14] = mskE;
+ masks[15] = mskF;
+
+ for (i = 0; i < 16; i++)
+ {
+ tmp.x = val.x;
+ tmp.c[masks[i]] = ins[0];
+ if (memcmp (&tmp, &res[i], sizeof (tmp)))
+ abort ();
+ }
+
+ /* Check pinsrb imm8, m8, xmm. */
+ for (i = 0; i < 16; i++)
+ {
+ res[i].x = _mm_insert_epi8 (val.x, ins[i % 4], msk0);
+ masks[i] = msk0;
+ }
+
+ for (i = 0; i < 16; i++)
+ {
+ tmp.x = val.x;
+ tmp.c[masks[i]] = ins[i % 4];
+ if (memcmp (&tmp, &res[i], sizeof (tmp)))
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrd.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrd.c
new file mode 100644
index 0000000..0bec936
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrd.c
@@ -0,0 +1,73 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+/* { dg-require-effective-target p8vector_hw } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+#include <string.h>
+
+#define msk0 0x00
+#define msk1 0x01
+#define msk2 0x02
+#define msk3 0x03
+
+static void
+TEST (void)
+{
+ union
+ {
+ __m128i x;
+ unsigned int i[4];
+ } res [4], val, tmp;
+ static unsigned int ins[4] = { 3, 4, 5, 6 };
+ int masks[4];
+ int i;
+
+ val.i[0] = 55;
+ val.i[1] = 55;
+ val.i[2] = 55;
+ val.i[3] = 55;
+
+ /* Check pinsrd imm8, r32, xmm. */
+ res[0].x = _mm_insert_epi32 (val.x, ins[0], msk0);
+ res[1].x = _mm_insert_epi32 (val.x, ins[0], msk1);
+ res[2].x = _mm_insert_epi32 (val.x, ins[0], msk2);
+ res[3].x = _mm_insert_epi32 (val.x, ins[0], msk3);
+
+ masks[0] = msk0;
+ masks[1] = msk1;
+ masks[2] = msk2;
+ masks[3] = msk3;
+
+ for (i = 0; i < 4; i++)
+ {
+ tmp.x = val.x;
+ tmp.i[masks[i]] = ins[0];
+ if (memcmp (&tmp, &res[i], sizeof (tmp)))
+ abort ();
+ }
+
+ /* Check pinsrd imm8, m32, xmm. */
+ for (i = 0; i < 4; i++)
+ {
+ res[i].x = _mm_insert_epi32 (val.x, ins[i], msk0);
+ masks[i] = msk0;
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ tmp.x = val.x;
+ tmp.i[masks[i]] = ins[i];
+ if (memcmp (&tmp, &res[i], sizeof (tmp)))
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrq.c b/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrq.c
new file mode 100644
index 0000000..395c20e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/sse4_1-pinsrq.c
@@ -0,0 +1,67 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -mpower8-vector -Wno-psabi" } */
+/* { dg-require-effective-target p8vector_hw } */
+
+#ifndef CHECK_H
+#define CHECK_H "sse4_1-check.h"
+#endif
+
+#ifndef TEST
+#define TEST sse4_1_test
+#endif
+
+#include CHECK_H
+
+#include <smmintrin.h>
+#include <string.h>
+
+#define msk0 0x00
+#define msk1 0x01
+
+static void
+__attribute__((noinline))
+TEST (void)
+{
+ union
+ {
+ __m128i x;
+ unsigned long long ll[2];
+ } res [4], val, tmp;
+ int masks[4];
+ static unsigned long long ins[2] =
+ { 0xAABBAABBAABBAABBLL, 0xCCDDCCDDCCDDCCDDLL };
+ int i;
+
+ val.ll[0] = 0x0807060504030201LL;
+ val.ll[1] = 0x100F0E0D0C0B0A09LL;
+
+ /* Check pinsrq imm8, r64, xmm. */
+ res[0].x = _mm_insert_epi64 (val.x, ins[0], msk0);
+ res[1].x = _mm_insert_epi64 (val.x, ins[0], msk1);
+
+ masks[0] = msk0;
+ masks[1] = msk1;
+
+ for (i = 0; i < 2; i++)
+ {
+ tmp.x = val.x;
+ tmp.ll[masks[i]] = ins[0];
+ if (memcmp (&tmp, &res[i], sizeof (tmp)))
+ abort ();
+ }
+
+ /* Check pinsrq imm8, m64, xmm. */
+ for (i = 0; i < 2; i++)
+ {
+ res[i].x = _mm_insert_epi64 (val.x, ins[i], msk0);
+ masks[i] = msk0;
+ }
+
+ for (i = 0; i < 2; i++)
+ {
+ tmp.x = val.x;
+ tmp.ll[masks[i]] = ins[i];
+ if (memcmp (&tmp, &res[i], sizeof (tmp)))
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c
index 7c98719..ff7b67d 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c
index 501d8c2..4e5d70c 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
void abort ();
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c
index b90a5e9..b3d0e5a 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c
index 8f9763c..c71918c 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c
index a87735a..1fcaf53 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c
index 15f834a..01c4d73 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c
index b7dd946..6b3534a 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c
index 46d2e85..e8205e1 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c
index e81d1f5..5edbca4 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target { le } } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O1 -mno-fold-gimple" } */
/* { dg-prune-output "gimple folding of rs6000 builtins has been disabled." } */
/* { dg-final { scan-assembler "lxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c
index a6f3f1a..dadc420 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler-not "xxpermdi" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-19.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-19.c
index f15cff0..d09db20 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-19.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-19.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -ftree-vectorize -mdejagnu-cpu=power8 -ffast-math -fvect-cost-model=unlimited" } */
/* This tests special handling for various uses of xxpermdi, other than
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c
index 4c2c908..9b3c367 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c
index 9b63bb4..564e8ac 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8 -maltivec" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c
index 204a219..f50e265 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8 -maltivec" } */
/* The expansion for vector character multiply introduces a vperm operation.
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-22.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-22.c
index 6d262e3..83f6ab3 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-22.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-22.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8 -maltivec -mcmodel=large" } */
/* The expansion for vector character multiply introduces a vperm operation.
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-23.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-23.c
index 84e3431..bcbc889 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-23.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-23.c
@@ -1,7 +1,8 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 -ffast-math" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
-/* { dg-final { scan-assembler-not "xxpermdi" } } */
+/* { dg-final { scan-assembler-not "xxpermdi" { target le } } } */
/* Verify that swap optimization works correctly in the presence of
a V2DFmode reduction. */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-24.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-24.c
index 29444c4..fdc9e96 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-24.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-24.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 -ffast-math" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler-not "xxpermdi" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c
index c782796..51fab6a 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c
index 8aef1cc..88f1dc6 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-26.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c
index af15c2c..758542a 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-27.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */
/* { dg-final { scan-assembler-times "stxvd2x" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-28.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-28.c
index 5f9a867..f77fe51 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-28.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-28.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-29.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-29.c
index 711e08e..ad3939f 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-29.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-29.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c
index f249965..a05d4cc 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-30.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-30.c
index 4745d72..03d63fd 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-30.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-30.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-31.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-31.c
index f4b7cf3..e31c880 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-31.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-31.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-32.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-32.c
index 182d1b2..cafb5d4 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-32.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-32.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-33.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-33.c
index 0216d62..6b53991 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-33.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-33.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-34.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-34.c
index 1037818..449e219 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-34.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-34.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-35.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-35.c
index bef610f..2377ec25 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-35.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-35.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-36.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-36.c
index 14c1e83..f05aee0 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-36.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-36.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-37.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-37.c
index a04ae52..e52d804 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-37.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-37.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-38.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-38.c
index 4300416..b07fe8c 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-38.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-38.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-39.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-39.c
index 1dc63f3..937828b 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-39.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-39.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c
index 3867c05..7ec5977 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-40.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-40.c
index 3c9a67d..c5376d9 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-40.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-40.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-41.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-41.c
index ec1b917..30afea7 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-41.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-41.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-42.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-42.c
index e18b1f8..bd29d3f 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-42.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-42.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-43.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-43.c
index 8526c08..e9245e7 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-43.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-43.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-44.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-44.c
index 4f4ac34..57a3a3e 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-44.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-44.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-45.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-45.c
index 46d4303..716a8b4 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-45.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-45.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c
index 1873b4b5..4738d5e 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-46.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run { target le } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2 " } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c
index 885529d..3c73569 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { powerpc64le-*-* } } } */
+/* { dg-do compile { target le } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
/* { dg-final { scan-assembler "lxvd2x" } } */
/* { dg-final { scan-assembler "stxvd2x" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c
index c895eaa..c5cb8a8 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
void abort();
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c
index dace627..767657e 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
void abort ();
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c
index 924229d..61f8ae1 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
void abort ();
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c
index dc6ea54..e76799c 100644
--- a/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64le-*-* } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3" } */
void abort ();
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cmp.c b/gcc/testsuite/gcc.target/powerpc/vec-cmp.c
index 9d53038..eaeb4c6 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cmp.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cmp.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c
index abde916..edba9de 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc64*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mvsx -O3" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi-df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi-df.c
index cfcb8d7..30a9366 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi-df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi.c
index a28cb2f..9be6517 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qi.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-df.c
index 514de25..e70ba41 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu-df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu.c
index 431e6fc..6efd058 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v16qiu.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v2df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v2df.c
index 34c9b00..43c17dd 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v2df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v2df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v2di.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v2di.c
index 1e6f666..870113f 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v2di.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v2di.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-do run { target lp64 } } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4sf.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4sf.c
index 518ff4a..17aed71 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4sf.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4sf.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si-df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si-df.c
index afcc7de..f4feb21 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si-df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si.c
index cf38423..5b72b9e 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4si.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu-df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu-df.c
index 071e492..f51a377 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu-df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu.c
index 1b85f90..01121e4 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v4siu.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi-df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi-df.c
index 4a15fb6..b7dfe42 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi-df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi.c
index ba1e338..245e1d8 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hi.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu-df.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu-df.c
index ff45c17..3140bcd 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu-df.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu-df.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu.c
index 82581e1..6082b74 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-v8hiu.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-1.c b/gcc/testsuite/gcc.target/powerpc/vec-init-1.c
index 079e6d8..e222723 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-1.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-2.c b/gcc/testsuite/gcc.target/powerpc/vec-init-2.c
index ddd41e2..75697e0 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-do run { target lp64 } } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-3.c b/gcc/testsuite/gcc.target/powerpc/vec-init-3.c
index dc76c2b..3265e2a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-3.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-4.c b/gcc/testsuite/gcc.target/powerpc/vec-init-4.c
index 5e724c8..04d1742 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-4.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-5.c b/gcc/testsuite/gcc.target/powerpc/vec-init-5.c
index 0059c48..87e1e4d 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-5.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-6.c b/gcc/testsuite/gcc.target/powerpc/vec-init-6.c
index 0b90da0..3b17300 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-6.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-7.c b/gcc/testsuite/gcc.target/powerpc/vec-init-7.c
index e3350fe..f75177c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-7.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-8.c b/gcc/testsuite/gcc.target/powerpc/vec-init-8.c
index 4393398..d3c2a33 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-8.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-8.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-9.c b/gcc/testsuite/gcc.target/powerpc/vec-init-9.c
index 3515096..0bb4e7c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-init-9.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-init-9.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-do run { target lp64 } } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-mul.c b/gcc/testsuite/gcc.target/powerpc/vec-mul.c
index db57328..bfcaf80 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-mul.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-mul.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc64*-*-* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-mvsx -O3" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c b/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
index f0d9a71..1e7d739 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-rlmi-rlnm.c
@@ -1,5 +1,4 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
-/* { dg-require-effective-target lp64 } */
+/* { dg-do compile }
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
@@ -63,6 +62,6 @@ rlnm_test_2 (vector unsigned long long x, vector unsigned long long y,
/* { dg-final { scan-assembler-times "vextsb2d" 1 } } */
/* { dg-final { scan-assembler-times "vslw" 1 } } */
/* { dg-final { scan-assembler-times "vsld" 1 } } */
-/* { dg-final { scan-assembler-times "xxlor" 2 } } */
+/* { dg-final { scan-assembler-times "xxlor" 3 } } */
/* { dg-final { scan-assembler-times "vrlwnm" 2 } } */
/* { dg-final { scan-assembler-times "vrldnm" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-set-char.c b/gcc/testsuite/gcc.target/powerpc/vec-set-char.c
index 841a917..eb7296d 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-set-char.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-set-char.c
@@ -1,9 +1,9 @@
-#include <altivec.h>
-
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
+#include <altivec.h>
+
vector char
insert_0_0 (vector char v)
{
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-set-int.c b/gcc/testsuite/gcc.target/powerpc/vec-set-int.c
index e3217b4..6dc7d73 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-set-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-set-int.c
@@ -1,9 +1,9 @@
-#include <altivec.h>
-
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
+#include <altivec.h>
+
vector int
insert_0_0 (vector int v)
{
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-set-short.c b/gcc/testsuite/gcc.target/powerpc/vec-set-short.c
index 2daf0a7..a03ada7 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-set-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-set-short.c
@@ -1,9 +1,9 @@
-#include <altivec.h>
-
-/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2" } */
+#include <altivec.h>
+
vector short
insert_0_0 (vector short v)
{
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-setup-double.c b/gcc/testsuite/gcc.target/powerpc/vec-setup-double.c
index 36c6405..1f6d6fd 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-setup-double.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-setup-double.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-setup-long.c b/gcc/testsuite/gcc.target/powerpc/vec-setup-long.c
index 5588e15..d33993c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-setup-long.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-setup-long.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
index afb0bfd..e5a4935 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
@@ -5,7 +5,7 @@
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
@@ -100,7 +100,7 @@ main (int argc, char *argv [])
printf(" vresult_d[%i] = %e, expected_vresult_d[%i] = %e\n",
i, vresult_d[i], i, expected_vresult_d[i]);
#else
- abort();
+ ;
#endif
}
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c b/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
index d56276a..d57aca5 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
@@ -1,4 +1,5 @@
-/* { dg-do run { target { powerpc64*-*-* && vsx_hw } } } */
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-O2 -mvsx" } */
/* Added for PR79261 to test that vec_xxpermdi works correctly for
diff --git a/gcc/testsuite/gcc.target/powerpc/vsu/vec-xl-len-13.c b/gcc/testsuite/gcc.target/powerpc/vsu/vec-xl-len-13.c
index 9de6424..1cfed57 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsu/vec-xl-len-13.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsu/vec-xl-len-13.c
@@ -10,8 +10,8 @@
error should be issued because this built-in function is not
available on 32-bit configurations. */
-__vector float
+int
fetch_data (float *address, size_t length)
{
- return __builtin_vec_lxvl (address, length); /* { dg-error "'__builtin_vec_lxvl' is not supported in this compiler configuration" } */
+ return __builtin_vec_lxvl (address, length); /* { dg-warning "'__builtin_vec_lxvl'" } */
}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsu/vsu.exp b/gcc/testsuite/gcc.target/powerpc/vsu/vsu.exp
index 627b771..68b7e5b 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsu/vsu.exp
+++ b/gcc/testsuite/gcc.target/powerpc/vsu/vsu.exp
@@ -17,8 +17,7 @@
# <http://www.gnu.org/licenses/>.
# Exit immediately if this isn't a PowerPC target or if the target is aix.
-if { (![istarget powerpc*-*-*] && ![istarget rs6000-*-*])
- || [istarget "powerpc*-*-aix*"] } then {
+if { (![istarget powerpc*-*-*] && ![istarget rs6000-*-*]) } then {
return
}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
new file mode 100644
index 0000000..0b8cfd6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
@@ -0,0 +1,170 @@
+/*
+ Test of vec_xl_sext and vec_xl_zext (load into rightmost
+ vector element and zero/sign extend). */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3" } */
+
+/* At the time of writing, the number of lxvrbx instructions is
+ double what we expect because we are generating a
+ .constprop copy of the function. */
+/* { dg-final { scan-assembler-times {\mlxvrbx\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mlbx\M} 0 } } */
+
+#define NUM_VEC_ELEMS 16
+#define ITERS 16
+
+/*
+Codegen at time of writing is a lxvrbx for both the
+zero and sign extended tests. The sign extension test
+also uses mfvsr*d, extsb, mtvsrdd, vextsd2q.
+
+0000000010000c90 <test_sign_extended_load>:
+ 10000c90: 1a 18 04 7c lxvrbx vs0,r4,r3
+ 10000c94: 66 00 0b 7c mfvsrd r11,vs0
+ 10000c98: 66 02 0a 7c mfvsrld r10,vs0
+ 10000c9c: 74 07 4a 7d extsb r10,r10
+ 10000ca0: 67 53 40 7c mtvsrdd vs34,0,r10
+ 10000ca4: 02 16 5b 10 vextsd2q v2,v2
+ 10000ca8: 20 00 80 4e blr
+
+0000000010000cc0 <test_zero_extended_unsigned_load>:
+ 10000cc0: 1b 18 44 7c lxvrbx vs34,r4,r3
+ 10000cc4: 20 00 80 4e blr
+*/
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+long long buffer[8];
+unsigned long verbose=0;
+
+char initbuffer[64] = {
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+};
+
+vector signed __int128 signed_expected[16] = {
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000011},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000012},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000013},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000014},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000015},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000016},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000017},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000000018},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff89},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff8a},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff8b},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff8c},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff8d},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff8e},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff8f},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffffff80}
+};
+
+vector unsigned __int128 unsigned_expected[16] = {
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000011},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000012},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000013},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000014},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000015},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000016},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000017},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000018},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000089},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000000000008a},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000000000008b},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000000000008c},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000000000008d},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000000000008e},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000000000008f},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000080}
+};
+
+__attribute__ ((noinline))
+vector signed __int128 test_sign_extended_load(int RA, signed char * RB) {
+ return vec_xl_sext (RA, RB);
+}
+
+__attribute__ ((noinline))
+vector unsigned __int128 test_zero_extended_unsigned_load(int RA, unsigned char * RB) {
+ return vec_xl_zext (RA, RB);
+}
+
+int main (int argc, char *argv [])
+{
+ int iteration=0;
+ int mismatch=0;
+ vector signed __int128 signed_result_v;
+ vector unsigned __int128 unsigned_result_v;
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ memcpy(&buffer, &initbuffer, sizeof(buffer));
+
+ if (verbose) {
+ printf("input buffer:\n");
+ for (int k=0;k<64;k++) {
+ printf("%x ",initbuffer[k]);
+ if (k && (k+1)%16==0) printf("\n");
+ }
+ printf("signed_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ printf("unsigned_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ signed_result_v = test_sign_extended_load (iteration, (signed char*)buffer);
+ if (signed_result_v[0] != signed_expected[iteration][0] ) {
+ mismatch++;
+ printf("Unexpected results from signed load. i=%d \n", iteration);
+ printf("got: %llx ",signed_result_v[0]>>64);
+ printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ unsigned_result_v = test_zero_extended_unsigned_load (iteration, (unsigned char*)buffer);
+ if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
+ mismatch++;
+ printf("Unexpected results from unsigned load. i=%d \n", iteration);
+ printf("got: %llx ",unsigned_result_v[0]>>64);
+ printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
+ printf(" %llx \n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
new file mode 100644
index 0000000..b10d3cb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
@@ -0,0 +1,168 @@
+/*
+ Test of vec_xl_sext and vec_xl_zext (load into rightmost
+ vector element and zero/sign extend). */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+
+/* Deliberately set optization to zero for this test to confirm
+ the lxvr*x instruction is generated. At higher optimization levels
+ the instruction we are looking for is sometimes replaced by other
+ load instructions. */
+/* { dg-options "-mdejagnu-cpu=power10 -O0" } */
+
+/* { dg-final { scan-assembler-times {\mlxvrwx\M} 2 } } */
+
+#define NUM_VEC_ELEMS 4
+#define ITERS 16
+
+/*
+Codegen at time of writing is a single lxvrwx for the zero
+extended test, and a lwax,mtvsrdd,vextsd2q for the sign
+extended test.
+
+0000000010000c90 <test_sign_extended_load>:
+ 10000c90: aa 1a 24 7d lwax r9,r4,r3
+ 10000c94: 67 4b 40 7c mtvsrdd vs34,0,r9
+ 10000c98: 02 16 5b 10 vextsd2q v2,v2
+ 10000c9c: 20 00 80 4e blr
+
+0000000010000cb0 <test_zero_extended_unsigned_load>:
+ 10000cb0: 9b 18 44 7c lxvrwx vs34,r4,r3
+ 10000cb4: 20 00 80 4e blr
+*/
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+long long buffer[8];
+unsigned long verbose=0;
+
+char initbuffer[64] = {
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+};
+
+vector signed __int128 signed_expected[16] = {
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000014131211},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000015141312},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000016151413},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000017161514},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000018171615},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff89181716},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8a891817},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8b8a8918},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8c8b8a89},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8d8c8b8a},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8e8d8c8b},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8f8e8d8c},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff808f8e8d},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000021808f8e},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x000000002221808f},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000023222180}
+};
+
+vector unsigned __int128 unsigned_expected[16] = {
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000014131211},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000015141312},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000016151413},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000017161514},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000018171615},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000089181716},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000008a891817},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000008b8a8918},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000008c8b8a89},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000008d8c8b8a},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000008e8d8c8b},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000008f8e8d8c},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000808f8e8d},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000021808f8e},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x000000002221808f},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000023222180}
+};
+
+__attribute__ ((noinline))
+vector signed __int128 test_sign_extended_load(int RA, signed int * RB) {
+ return vec_xl_sext (RA, RB);
+}
+
+__attribute__ ((noinline))
+vector unsigned __int128 test_zero_extended_unsigned_load(int RA, unsigned int * RB) {
+ return vec_xl_zext (RA, RB);
+}
+
+int main (int argc, char *argv [])
+{
+ int iteration=0;
+ int mismatch=0;
+ vector signed __int128 signed_result_v;
+ vector unsigned __int128 unsigned_result_v;
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ memcpy(&buffer, &initbuffer, sizeof(buffer));
+
+ if (verbose) {
+ printf("input buffer:\n");
+ for (int k=0;k<64;k++) {
+ printf("%x ",initbuffer[k]);
+ if (k && (k+1)%16==0) printf("\n");
+ }
+ printf("signed_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ printf("unsigned_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ signed_result_v = test_sign_extended_load (iteration, (signed int*)buffer);
+ if (signed_result_v[0] != signed_expected[iteration][0] ) {
+ mismatch++;
+ printf("Unexpected results from signed load. i=%d \n", iteration);
+ printf("got: %llx ",signed_result_v[0]>>64);
+ printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ unsigned_result_v = test_zero_extended_unsigned_load (iteration, (unsigned int*)buffer);
+ if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
+ mismatch++;
+ printf("Unexpected results from unsigned load. i=%d \n", iteration);
+ printf("got: %llx ",unsigned_result_v[0]>>64);
+ printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
+ printf(" %llx \n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
new file mode 100644
index 0000000..52fcf2e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
@@ -0,0 +1,169 @@
+/*
+ Test of vec_xl_sext and vec_xl_zext (load into rightmost
+ vector element and zero/sign extend). */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3" } */
+
+/* At time of writing, we also geenerate a .constrprop copy
+ of the function, so our instruction hit count is
+ twice of what we would otherwise expect. */
+/* { dg-final { scan-assembler-times {\mlxvrdx\M} 4 } } */
+/* { dg-final { scan-assembler-times {\mlvdx\M} 0 } } */
+
+#define NUM_VEC_ELEMS 2
+#define ITERS 16
+
+/*
+Codegen at time of writing uses lxvrdx for both sign and
+zero extend tests. The sign extended test also uses
+mfvsr*d, mtvsrdd, vextsd2q.
+
+0000000010000c90 <test_sign_extended_load>:
+ 10000c90: da 18 04 7c lxvrdx vs0,r4,r3
+ 10000c94: 66 00 0b 7c mfvsrd r11,vs0
+ 10000c98: 66 02 0a 7c mfvsrld r10,vs0
+ 10000c9c: 67 53 40 7c mtvsrdd vs34,0,r10
+ 10000ca0: 02 16 5b 10 vextsd2q v2,v2
+ 10000ca4: 20 00 80 4e blr
+
+0000000010000cc0 <test_zero_extended_unsigned_load>:
+ 10000cc0: db 18 44 7c lxvrdx vs34,r4,r3
+ 10000cc4: 20 00 80 4e blr
+*/
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+long long buffer[8];
+unsigned long verbose=0;
+
+char initbuffer[64] = {
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+};
+
+vector signed __int128 signed_expected[16] = {
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x1817161514131211},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8918171615141312},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8a89181716151413},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8b8a891817161514},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8c8b8a8918171615},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8d8c8b8a89181716},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8e8d8c8b8a891817},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8f8e8d8c8b8a8918},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x808f8e8d8c8b8a89},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x21808f8e8d8c8b8a},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x2221808f8e8d8c8b},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x232221808f8e8d8c},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x24232221808f8e8d},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x2524232221808f8e},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x262524232221808f},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x2726252423222180}
+};
+
+vector unsigned __int128 unsigned_expected[16] = {
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x1817161514131211},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8918171615141312},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8a89181716151413},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8b8a891817161514},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8c8b8a8918171615},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8d8c8b8a89181716},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8e8d8c8b8a891817},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x8f8e8d8c8b8a8918},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x808f8e8d8c8b8a89},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x21808f8e8d8c8b8a},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x2221808f8e8d8c8b},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x232221808f8e8d8c},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x24232221808f8e8d},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x2524232221808f8e},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x262524232221808f},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x2726252423222180}
+};
+
+__attribute__ ((noinline))
+vector signed __int128 test_sign_extended_load(int RA, signed long long * RB) {
+ return vec_xl_sext (RA, RB);
+}
+
+__attribute__ ((noinline))
+vector unsigned __int128 test_zero_extended_unsigned_load(int RA, unsigned long long * RB) {
+ return vec_xl_zext (RA, RB);
+}
+
+int main (int argc, char *argv [])
+{
+ int iteration=0;
+ int mismatch=0;
+ vector signed __int128 signed_result_v;
+ vector unsigned __int128 unsigned_result_v;
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ memcpy(&buffer, &initbuffer, sizeof(buffer));
+
+ if (verbose) {
+ printf("input buffer:\n");
+ for (int k=0;k<64;k++) {
+ printf("%x ",initbuffer[k]);
+ if (k && (k+1)%16==0) printf("\n");
+ }
+ printf("signed_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ printf("unsigned_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ signed_result_v = test_sign_extended_load (iteration, (signed long long*)buffer);
+ if (signed_result_v[0] != signed_expected[iteration][0] ) {
+ mismatch++;
+ printf("Unexpected results from signed load. i=%d \n", iteration);
+ printf("got: %llx ",signed_result_v[0]>>64);
+ printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ unsigned_result_v = test_zero_extended_unsigned_load (iteration, (unsigned long long*)buffer);
+ if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
+ mismatch++;
+ printf("Unexpected results from unsigned load. i=%d \n", iteration);
+ printf("got: %llx ",unsigned_result_v[0]>>64);
+ printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
+ printf(" %llx \n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c
new file mode 100644
index 0000000..8fc0cc6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c
@@ -0,0 +1,168 @@
+/*
+ Test of vec_xl_sext and vec_xl_zext (load into rightmost
+ vector element and zero/sign extend). */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+
+/* Deliberately set optization to zero for this test to confirm
+ the lxvr*x instruction is generated. At higher optimization levels
+ the instruction we are looking for is sometimes replaced by other
+ load instructions. */
+/* { dg-options "-mdejagnu-cpu=power10 -O0" } */
+
+/* { dg-final { scan-assembler-times {\mlxvrhx\M} 2 } } */
+
+#define NUM_VEC_ELEMS 8
+#define ITERS 16
+
+/*
+Codegen at time of writing uses lxvrhx for the zero
+extension test and lhax,mtvsrdd,vextsd2q for the
+sign extended test.
+
+0000000010001810 <test_sign_extended_load>:
+ 10001810: ae 1a 24 7d lhax r9,r4,r3
+ 10001814: 67 4b 40 7c mtvsrdd vs34,0,r9
+ 10001818: 02 16 5b 10 vextsd2q v2,v2
+ 1000181c: 20 00 80 4e blr
+
+0000000010001830 <test_zero_extended_unsigned_load>:
+ 10001830: 5b 18 44 7c lxvrhx vs34,r4,r3
+ 10001834: 20 00 80 4e blr
+*/
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+long long buffer[8];
+unsigned long verbose=0;
+
+char initbuffer[64] = {
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
+ 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+};
+
+vector signed __int128 signed_expected[16] = {
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001211},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001312},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001413},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001514},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001615},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001716},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001817},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8918},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8a89},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8b8a},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8c8b},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8d8c},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8e8d},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8f8e},
+ { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff808f},
+ { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000002180}
+};
+
+vector unsigned __int128 unsigned_expected[16] = {
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001211},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001312},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001413},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001514},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001615},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001716},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000001817},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008918},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008a89},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008b8a},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008c8b},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008d8c},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008e8d},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000008f8e},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x0000000000000808f},
+ { (unsigned __int128) 0x0000000000000000 << 64 | (unsigned __int128) 0x00000000000002180}
+};
+
+__attribute__ ((noinline))
+vector signed __int128 test_sign_extended_load(int RA, signed short * RB) {
+ return vec_xl_sext (RA, RB);
+}
+
+__attribute__ ((noinline))
+vector unsigned __int128 test_zero_extended_unsigned_load(int RA, unsigned short * RB) {
+ return vec_xl_zext (RA, RB);
+}
+
+int main (int argc, char *argv [])
+{
+ int iteration=0;
+ int mismatch=0;
+ vector signed __int128 signed_result_v;
+ vector unsigned __int128 unsigned_result_v;
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ memcpy(&buffer, &initbuffer, sizeof(buffer));
+
+ if (verbose) {
+ printf("input buffer:\n");
+ for (int k=0;k<64;k++) {
+ printf("%x ",initbuffer[k]);
+ if (k && (k+1)%16==0) printf("\n");
+ }
+ printf("signed_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ printf("unsigned_expected:\n");
+ for (int k=0;k<ITERS;k++) {
+ printf("%llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ printf("\n");
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ signed_result_v = test_sign_extended_load (iteration, (signed short*)buffer);
+ if (signed_result_v[0] != signed_expected[iteration][0] ) {
+ mismatch++;
+ printf("Unexpected results from signed load. i=%d \n", iteration);
+ printf("got: %llx ",signed_result_v[0]>>64);
+ printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",signed_expected[iteration][0]>>64);
+ printf(" %llx \n",signed_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ for (iteration = 0; iteration < ITERS ; iteration++ ) {
+ unsigned_result_v = test_zero_extended_unsigned_load (iteration, (unsigned short*)buffer);
+ if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
+ mismatch++;
+ printf("Unexpected results from unsigned load. i=%d \n", iteration);
+ printf("got: %llx ",unsigned_result_v[0]>>64);
+ printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
+ printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
+ printf(" %llx \n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+ fflush(stdout);
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c
new file mode 100644
index 0000000..99f3904
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c
@@ -0,0 +1,125 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+/* Deliberately set optization to zero for this test to confirm
+ the stxvr*x instruction is generated. At higher optimization levels
+ the instruction we are looking for is sometimes replaced by other
+ store instructions. */
+/* { dg-options "-mdejagnu-cpu=power10 -O0" } */
+
+/* { dg-final { scan-assembler-times {\mstxvrbx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstbx\M} 0 } } */
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+vector signed __int128 store_this_s[4] = {
+{ (__int128) 0x7000000000000000 << 64 | (__int128) 0x123456789abcdef8ULL},
+{ (__int128) 0x8000000000000000 << 64 | (__int128) 0xfedcba9876543217ULL},
+{ (__int128) 0x1000000000000000 << 64 | (__int128) 0xccccccccccccccccULL},
+{ (__int128) 0xf000000000000000 << 64 | (__int128) 0xaaaaaaaaaaaaaaaaULL}
+};
+
+vector unsigned __int128 store_this_us[4] = {
+{ (unsigned __int128) 0x7000000000000000 << 64 | (unsigned __int128) 0x123456789abcdef8ULL},
+{ (unsigned __int128) 0x8000000000000000 << 64 | (unsigned __int128) 0xfedcba9876543217ULL},
+{ (unsigned __int128) 0x1000000000000000 << 64 | (unsigned __int128) 0xeeeeeeeeeeeeeeeeULL},
+{ (unsigned __int128) 0xf000000000000000 << 64 | (unsigned __int128) 0x5555555555555555ULL}
+};
+
+#define NUM_VEC_ELEMS 16
+
+vector signed char signed_expected[4] = {
+ { 0xf8, 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0},
+ { 0x0 , 0x0, 0x0, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0},
+ { 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0xcc, 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0},
+ { 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0xaa, 0x0, 0x0, 0x0}
+};
+vector unsigned char unsigned_expected[4] = {
+ { 0xf8, 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0},
+ { 0x0 , 0x0, 0x0, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0},
+ { 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0xee, 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0},
+ { 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x0 , 0x0, 0x0, 0x0, 0x55, 0x0, 0x0, 0x0}
+};
+
+unsigned long long rawbuffer[32];
+signed char * vsbuffer = (char *)rawbuffer;
+unsigned char * vubuffer = (unsigned char *)rawbuffer;
+
+void reset_buffer() {
+ memset (&rawbuffer,0,sizeof(rawbuffer));
+}
+
+#define PRINT_VEC(V) \
+ for (int j=0;j<NUM_VEC_ELEMS;j++) { printf ("(0x%lx) ", V[j] ); }
+
+void test_signed_store(vector signed __int128 myvec, int offset, signed char * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data );
+}
+
+void test_unsigned_store(vector unsigned __int128 myvec, int offset, unsigned char * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data );
+}
+
+int main (int argc, char *argv [])
+{
+ int i;
+ int memcmpresult;
+ int mismatch=0;
+ int verbose=0;
+
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ if (verbose) {
+ printf("expected results from signed tests:\n");
+ for (i = 0; i < 4 ; i++ ) {
+ PRINT_VEC(signed_expected[i]);
+ printf("\n");
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_signed_store (store_this_s[i], 4*i, vsbuffer);
+ memcmpresult = memcmp(rawbuffer,&signed_expected[i],sizeof(vector char));
+ if (memcmpresult) {
+ printf("mismatch signed buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results: ");
+ PRINT_VEC(vsbuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_unsigned_store (store_this_us[i], 4*i, vubuffer);
+ memcmpresult = memcmp(rawbuffer,&unsigned_expected[i],sizeof(vector char));
+ if (memcmpresult) {
+ printf("mismatch unsigned buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results :");
+ PRINT_VEC(vubuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c
new file mode 100644
index 0000000..6e2acf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c
@@ -0,0 +1,125 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+/* Deliberately set optization to zero for this test to confirm
+ the stxvr*x instruction is generated. At higher optimization levels
+ the instruction we are looking for is sometimes replaced by other
+ store instructions. */
+/* { dg-options "-mdejagnu-cpu=power10 -O0" } */
+
+/* { dg-final { scan-assembler-times {\mstxvrwx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstwx\M} 0 } } */
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+vector signed __int128 store_this_s[4] = {
+{ (__int128) 0x7000000000000000 << 64 | (__int128) 0x123456789abcdef8ULL},
+{ (__int128) 0x8000000000000000 << 64 | (__int128) 0xfedcba9876543217ULL},
+{ (__int128) 0x1000000000000000 << 64 | (__int128) 0xccccccccccccccccULL},
+{ (__int128) 0xf000000000000000 << 64 | (__int128) 0xaaaaaaaaaaaaaaaaULL}
+};
+
+vector unsigned __int128 store_this_us[4] = {
+{ (unsigned __int128) 0x7000000000000000 << 64 | (unsigned __int128) 0x123456789abcdef8ULL},
+{ (unsigned __int128) 0x8000000000000000 << 64 | (unsigned __int128) 0xfedcba9876543217ULL},
+{ (unsigned __int128) 0x1000000000000000 << 64 | (unsigned __int128) 0xeeeeeeeeeeeeeeeeULL},
+{ (unsigned __int128) 0xf000000000000000 << 64 | (unsigned __int128) 0x5555555555555555ULL}
+};
+
+#define NUM_VEC_ELEMS 4
+
+vector signed int signed_expected[4] = {
+ {0x9abcdef8, 0x0 , 0x0 , 0x0 },
+ {0x0 , 0x76543217, 0x0 , 0x0 },
+ {0x0 , 0x0 , 0xcccccccc, 0x0 },
+ {0x0 , 0x0 , 0x0 , 0xaaaaaaaa },
+};
+vector unsigned int unsigned_expected[4] = {
+ {0x9abcdef8, 0x0 , 0x0 , 0x0 },
+ {0x0 , 0x76543217, 0x0 , 0x0 },
+ {0x0 , 0x0 , 0xeeeeeeee, 0x0 },
+ {0x0 , 0x0 , 0x0 , 0x55555555 },
+};
+
+unsigned long long rawbuffer[32];
+signed int * vsbuffer = (int *)rawbuffer;
+unsigned int * vubuffer = (unsigned int *)rawbuffer;
+
+void reset_buffer() {
+ memset (&rawbuffer,0,sizeof(rawbuffer));
+}
+
+#define PRINT_VEC(V) \
+ for (int j=0;j<NUM_VEC_ELEMS;j++) { printf ("(0x%lx) ", V[j] ); }
+
+void test_signed_store(vector signed __int128 myvec, int offset, signed int * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data);
+}
+
+void test_unsigned_store(vector unsigned __int128 myvec, int offset, unsigned int * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data);
+}
+
+int main (int argc, char *argv [])
+{
+ int i;
+ int memcmpresult;
+ int mismatch=0;
+ int verbose=0;
+
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ if (verbose) {
+ printf("expected results from signed tests:\n");
+ for (i = 0; i < 4 ; i++ ) {
+ PRINT_VEC(signed_expected[i]);
+ printf("\n");
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_signed_store (store_this_s[i], 4*i, vsbuffer);
+ memcmpresult = memcmp(rawbuffer,&signed_expected[i],sizeof(vector int));
+ if (memcmpresult) {
+ printf("mismatch signed buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results: ");
+ PRINT_VEC(vsbuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_unsigned_store (store_this_us[i], 4*i, vubuffer);
+ memcmpresult = memcmp(rawbuffer,&unsigned_expected[i],sizeof(vector int));
+ if (memcmpresult) {
+ printf("mismatch unsigned buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results :");
+ PRINT_VEC(vubuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c
new file mode 100644
index 0000000..7fce6a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c
@@ -0,0 +1,126 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+
+/* Deliberately set optization to zero for this test to confirm
+ the stxvr*x instruction is generated. At higher optimization levels
+ the instruction we are looking for is sometimes replaced by other
+ store instructions. */
+/* { dg-options "-mdejagnu-cpu=power10 -O0" } */
+
+/* { dg-final { scan-assembler-times {\mstxvrdx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mstwx\M} 0 } } */
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+vector signed __int128 store_this_s[4] = {
+{ (__int128) 0x7000000000000000 << 64 | (__int128) 0x123456789abcdef8ULL},
+{ (__int128) 0x8000000000000000 << 64 | (__int128) 0xfedcba9876543217ULL},
+{ (__int128) 0x1000000000000000 << 64 | (__int128) 0xccccccccccccccccULL},
+{ (__int128) 0xf000000000000000 << 64 | (__int128) 0xaaaaaaaaaaaaaaaaULL}
+};
+
+vector unsigned __int128 store_this_us[4] = {
+{ (unsigned __int128) 0x7000000000000000 << 64 | (unsigned __int128) 0x123456789abcdef8ULL},
+{ (unsigned __int128) 0x8000000000000000 << 64 | (unsigned __int128) 0xfedcba9876543217ULL},
+{ (unsigned __int128) 0x1000000000000000 << 64 | (unsigned __int128) 0xeeeeeeeeeeeeeeeeULL},
+{ (unsigned __int128) 0xf000000000000000 << 64 | (unsigned __int128) 0x5555555555555555ULL}
+};
+
+#define NUM_VEC_ELEMS 2
+
+vector signed long long signed_expected[5] = {
+ { 0x123456789abcdef8, 0x0},
+ { 0x7654321700000000, 0xfedcba98},
+ { 0x0000000000000000, 0xcccccccccccccccc},
+ { 0x0000000000000000, 0xaaaaaaaa00000000} /*note that some data written into the next word */
+};
+vector unsigned long long unsigned_expected[5] = {
+ { 0x123456789abcdef8, 0x0},
+ { 0x7654321700000000, 0xfedcba98},
+ { 0x0000000000000000, 0xeeeeeeeeeeeeeeee},
+ { 0x0000000000000000, 0x5555555500000000}
+};
+
+unsigned long long rawbuffer[32];
+signed long long * vsbuffer = (long long *)rawbuffer;
+unsigned long long * vubuffer = (unsigned long long *)rawbuffer;
+
+void reset_buffer() {
+ memset (&rawbuffer,0,sizeof(rawbuffer));
+}
+
+#define PRINT_VEC(V) \
+ for (int j=0;j<NUM_VEC_ELEMS;j++) { printf ("(0x%lx) ", V[j] ); }
+
+void test_signed_store(vector signed __int128 myvec, int offset, signed long long * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data);
+}
+
+void test_unsigned_store(vector unsigned __int128 myvec, int offset, unsigned long long * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data);
+}
+
+int main (int argc, char *argv [])
+{
+ int i;
+ int memcmpresult;
+ int mismatch=0;
+ int verbose=0;
+
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ if (verbose) {
+ printf("expected results from signed tests:\n");
+ for (i = 0; i < 4 ; i++ ) {
+ PRINT_VEC(signed_expected[i]);
+ printf("\n");
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_signed_store (store_this_s[i], 4*i, vsbuffer);
+ memcmpresult = memcmp(rawbuffer,&signed_expected[i],sizeof(vector long long));
+ if (memcmpresult) {
+ printf("mismatch signed buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results: ");
+ PRINT_VEC(vsbuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_unsigned_store (store_this_us[i], 4*i, vubuffer);
+ memcmpresult = memcmp(rawbuffer,&unsigned_expected[i],sizeof(vector long long));
+ if (memcmpresult) {
+ printf("mismatch unsigned buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results :");
+ PRINT_VEC(vubuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c
new file mode 100644
index 0000000..17925c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c
@@ -0,0 +1,126 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do compile {target power10_ok} } */
+/* { dg-do run {target power10_hw} } */
+
+/* Deliberately set optization to zero for this test to confirm
+ the stxvr*x instruction is generated. At higher optimization levels
+ the instruction we are looking for is sometimes replaced by other
+ store instructions. */
+/* { dg-options "-mdejagnu-cpu=power10 -O0" } */
+
+/* { dg-final { scan-assembler-times {\mstxvrhx\M} 2 } } */
+/* { dg-final { scan-assembler-times {\msthx\M} 0 } } */
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+vector signed __int128 store_this_s[4] = {
+{ (__int128) 0x7000000000000000 << 64 | (__int128) 0x123456789abcdef8ULL},
+{ (__int128) 0x8000000000000000 << 64 | (__int128) 0xfedcba9876543217ULL},
+{ (__int128) 0x1000000000000000 << 64 | (__int128) 0xccccccccccccccccULL},
+{ (__int128) 0xf000000000000000 << 64 | (__int128) 0xaaaaaaaaaaaaaaaaULL}
+};
+
+vector unsigned __int128 store_this_us[4] = {
+{ (unsigned __int128) 0x7000000000000000 << 64 | (unsigned __int128) 0x123456789abcdef8ULL},
+{ (unsigned __int128) 0x8000000000000000 << 64 | (unsigned __int128) 0xfedcba9876543217ULL},
+{ (unsigned __int128) 0x1000000000000000 << 64 | (unsigned __int128) 0xeeeeeeeeeeeeeeeeULL},
+{ (unsigned __int128) 0xf000000000000000 << 64 | (unsigned __int128) 0x5555555555555555ULL}
+};
+
+#define NUM_VEC_ELEMS 8
+
+vector signed short signed_expected[4] = {
+ {0xdef8, 0x0, 0x0 , 0x0, 0x0 , 0x0, 0x0 , 0x0},
+ {0x0 , 0x0, 0x3217, 0x0, 0x0 , 0x0, 0x0 , 0x0},
+ {0x0 , 0x0, 0x0 , 0x0, 0xcccc, 0x0, 0x0 , 0x0},
+ {0x0 , 0x0, 0x0 , 0x0, 0x0 , 0x0, 0xaaaa, 0x0}
+ };
+vector unsigned short unsigned_expected[4] = {
+ {0xdef8, 0x0, 0x0 , 0x0, 0x0 , 0x0, 0x0 , 0x0},
+ {0x0 , 0x0, 0x3217, 0x0, 0x0 , 0x0, 0x0 , 0x0},
+ {0x0 , 0x0, 0x0 , 0x0, 0xeeee, 0x0, 0x0 , 0x0},
+ {0x0 , 0x0, 0x0 , 0x0, 0x0 , 0x0, 0x5555, 0x0}
+};
+
+unsigned long long rawbuffer[32];
+signed short * vsbuffer = (short *)rawbuffer;
+unsigned short * vubuffer = (unsigned short *)rawbuffer;
+
+void reset_buffer() {
+ memset (&rawbuffer,0,sizeof(rawbuffer));
+}
+
+#define PRINT_VEC(V) \
+ for (int j=0;j<NUM_VEC_ELEMS;j++) { printf ("(0x%lx) ", V[j] ); }
+
+void test_signed_store(vector signed __int128 myvec, int offset, signed short * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data);
+}
+
+void test_unsigned_store(vector unsigned __int128 myvec, int offset, unsigned short * store_data ) {
+ vec_xst_trunc (myvec, offset, store_data);
+}
+
+int main (int argc, char *argv [])
+{
+ int i;
+ int memcmpresult;
+ int mismatch=0;
+ int verbose=0;
+
+#if VERBOSE
+ verbose=1;
+ printf("%s %s\n", __DATE__, __TIME__);
+#endif
+
+ if (verbose) {
+ printf("expected results from signed tests:\n");
+ for (i = 0; i < 4 ; i++ ) {
+ PRINT_VEC(signed_expected[i]);
+ printf("\n");
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_signed_store (store_this_s[i], 4*i, vsbuffer);
+ memcmpresult = memcmp(rawbuffer,&signed_expected[i],sizeof(vector short));
+ if (memcmpresult) {
+ printf("mismatch signed buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results: ");
+ PRINT_VEC(vsbuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ for (i = 0; i < 4 ; i++ ) {
+ reset_buffer();
+ test_unsigned_store (store_this_us[i], 4*i, vubuffer);
+ memcmpresult = memcmp(rawbuffer,&unsigned_expected[i],sizeof(vector short));
+ if (memcmpresult) {
+ printf("mismatch unsigned buffer, i %d (memcmpresult:%d) \n",i,memcmpresult);
+ mismatch++;
+ if (verbose) {
+ printf("results :");
+ PRINT_VEC(vubuffer);
+ printf("\n");
+ }
+ }
+ }
+
+ if (mismatch) {
+ printf("%d mismatches. \n",mismatch);
+ abort();
+ }
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/vsxcopy.c b/gcc/testsuite/gcc.target/powerpc/vsxcopy.c
index 61c9f77..d1b7c4b 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsxcopy.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsxcopy.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O1 -mvsx" } */
/* { dg-final { scan-assembler {\m(lxvd2x|lxv)\M} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-1.c b/gcc/testsuite/gcc.target/riscv/mcpu-1.c
new file mode 100644
index 0000000..6f6005c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */
+/* { dg-options "-mcpu=sifive-e20 -mabi=ilp32" } */
+/* sifive-e20 = rv32imc */
+
+#if !((__riscv_xlen == 32) \
+ && !defined(__riscv_32e) \
+ && defined(__riscv_mul) \
+ && !defined(__riscv_atomic) \
+ && !defined(__riscv_flen) \
+ && defined(__riscv_compressed))
+#error "unexpected arch"
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-2.c b/gcc/testsuite/gcc.target/riscv/mcpu-2.c
new file mode 100644
index 0000000..2992f4e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */
+/* { dg-options "-mcpu=sifive-e34 -mabi=ilp32" } */
+/* sifive-e34 = rv32imafc */
+
+#if !((__riscv_xlen == 32) \
+ && !defined(__riscv_32e) \
+ && defined(__riscv_mul) \
+ && defined(__riscv_atomic) \
+ && (__riscv_flen == 32) \
+ && defined(__riscv_compressed))
+#error "unexpected arch"
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-3.c b/gcc/testsuite/gcc.target/riscv/mcpu-3.c
new file mode 100644
index 0000000..97b3f81
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */
+/* { dg-options "-mcpu=sifive-s51 -mabi=lp64" } */
+/* sifive-s51 = rv64imac */
+
+#if !((__riscv_xlen == 64) \
+ && !defined(__riscv_32e) \
+ && defined(__riscv_mul) \
+ && defined(__riscv_atomic) \
+ && !defined(__riscv_flen) \
+ && defined(__riscv_compressed))
+#error "unexpected arch"
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-4.c b/gcc/testsuite/gcc.target/riscv/mcpu-4.c
new file mode 100644
index 0000000..52c5987
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-4.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */
+/* { dg-options "-mcpu=sifive-u74 -mabi=lp64" } */
+/* sifive-u74 = rv64imafdc */
+
+#if !((__riscv_xlen == 64) \
+ && !defined(__riscv_32e) \
+ && defined(__riscv_mul) \
+ && defined(__riscv_atomic) \
+ && (__riscv_flen == 64) \
+ && defined(__riscv_compressed))
+#error "unexpected arch"
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-5.c b/gcc/testsuite/gcc.target/riscv/mcpu-5.c
new file mode 100644
index 0000000..c4ea7b5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-5.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-skip-if "-march given" { *-*-* } { "-march=*" } } */
+/* Verify -march will override arch option from -mcpu. */
+/* { dg-options "-mcpu=sifive-u74 -march=rv32ic -mabi=ilp32" } */
+/* sifive-s51 = rv64imafdc */
+
+#if !((__riscv_xlen == 32) \
+ && !defined(__riscv_32e) \
+ && !defined(__riscv_mul) \
+ && !defined(__riscv_atomic) \
+ && !defined(__riscv_flen) \
+ && defined(__riscv_compressed))
+#error "unexpected arch"
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-6.c b/gcc/testsuite/gcc.target/riscv/mcpu-6.c
new file mode 100644
index 0000000..57e3345
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-6.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* Verify -mtune has higher priority than -mcpu for pipeline model . */
+/* { dg-options "-mcpu=sifive-u74 -mtune=rocket -fdump-rtl-sched2-details -O3 -march=rv32i -mabi=ilp32" } */
+/* { dg-final { scan-rtl-dump "simple_return\[ \]+:alu" "sched2" } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/mcpu-7.c b/gcc/testsuite/gcc.target/riscv/mcpu-7.c
new file mode 100644
index 0000000..fe3c04b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/mcpu-7.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* Verify -mtune has higher priority than -mcpu for pipeline model . */
+/* { dg-options "-mcpu=sifive-s21 -mtune=sifive-u74 -fdump-rtl-sched2-details -O3 -march=rv32i -mabi=ilp32" } */
+/* { dg-final { scan-rtl-dump "simple_return\[ \]+:sifive_7_B" "sched2" } } */
+
+int main()
+{
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/riscv/pr96759.c b/gcc/testsuite/gcc.target/riscv/pr96759.c
new file mode 100644
index 0000000..621c391
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/pr96759.c
@@ -0,0 +1,13 @@
+/* { dg-options "-mno-strict-align" } */
+/* { dg-do compile } */
+
+struct S {
+ int a;
+ double b;
+};
+struct S GetNumbers();
+struct S g;
+
+void foo(){
+ g = GetNumbers();
+}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-3.c b/gcc/testsuite/gcc.target/riscv/predef-3.c
index 6f4f2e2..d7c9793 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-3.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-3.c
@@ -55,11 +55,11 @@ int main () {
#if defined(__riscv_cmodel_medlow)
#error "__riscv_cmodel_medlow"
#endif
-#if defined(__riscv_cmodel_medany)
-#error "__riscv_cmodel_medlow"
+#if !defined(__riscv_cmodel_medany)
+#error "__riscv_cmodel_medany"
#endif
#if !defined(__riscv_cmodel_pic)
-#error "__riscv_cmodel_medlow"
+#error "__riscv_cmodel_pic"
#endif
return 0;
diff --git a/gcc/testsuite/gcc.target/riscv/predef-6.c b/gcc/testsuite/gcc.target/riscv/predef-6.c
index ee4e02b..7530f95 100644
--- a/gcc/testsuite/gcc.target/riscv/predef-6.c
+++ b/gcc/testsuite/gcc.target/riscv/predef-6.c
@@ -55,11 +55,11 @@ int main () {
#if defined(__riscv_cmodel_medlow)
#error "__riscv_cmodel_medlow"
#endif
-#if defined(__riscv_cmodel_medany)
-#error "__riscv_cmodel_medlow"
+#if !defined(__riscv_cmodel_medany)
+#error "__riscv_cmodel_medany"
#endif
#if !defined(__riscv_cmodel_pic)
-#error "__riscv_cmodel_medlow"
+#error "__riscv_cmodel_medpic"
#endif
return 0;
diff --git a/gcc/testsuite/gcc.target/s390/load-and-test-fp-1.c b/gcc/testsuite/gcc.target/s390/load-and-test-fp-1.c
index 2a7e88c..f89d2d3 100644
--- a/gcc/testsuite/gcc.target/s390/load-and-test-fp-1.c
+++ b/gcc/testsuite/gcc.target/s390/load-and-test-fp-1.c
@@ -1,17 +1,12 @@
/* { dg-do compile } */
-/* { dg-options "-O3 -mzarch" } */
+/* { dg-options "-O3 -mzarch -march=z196" } */
-/* a is used after the comparison. We cannot use load and test here
- since it would turn SNaNs into QNaNs. */
+/* Use load-and-test instructions if compared for (in)equality and if variable
+ `a` is dead after the comparison. For all other cases use
+ compare-and-signal instructions. */
-double gl;
+#include "load-and-test-fp.h"
-double
-foo (double dummy, double a)
-{
- if (a == 0.0)
- gl = 1;
- return a;
-}
-
-/* { dg-final { scan-assembler {\tcdbr?\t} } } */
+/* { dg-final { scan-assembler-times "ltdbr\t" 2 } } */
+/* { dg-final { scan-assembler-times "cdbr\t" 2 } } */
+/* { dg-final { scan-assembler-times "kdbr\t" 8 } } */
diff --git a/gcc/testsuite/gcc.target/s390/load-and-test-fp-2.c b/gcc/testsuite/gcc.target/s390/load-and-test-fp-2.c
index 7646fdd..53dab3c 100644
--- a/gcc/testsuite/gcc.target/s390/load-and-test-fp-2.c
+++ b/gcc/testsuite/gcc.target/s390/load-and-test-fp-2.c
@@ -1,16 +1,9 @@
/* { dg-do compile } */
-/* { dg-options "-O3" } */
+/* { dg-options "-O3 -mzarch -ffast-math" } */
-/* a is not used after the comparison. So we should use load and test
- here. */
+/* Fast-math implies -fno-trapping-math -fno-signaling-nans which imply
+ that no user visible trap will happen. */
-double gl;
+#include "load-and-test-fp.h"
-void
-bar (double a)
-{
- if (a == 0.0)
- gl = 1;
-}
-
-/* { dg-final { scan-assembler "ltdbr\t" } } */
+/* { dg-final { scan-assembler-times "ltdbr\t" 12 } } */
diff --git a/gcc/testsuite/gcc.target/s390/load-and-test-fp.h b/gcc/testsuite/gcc.target/s390/load-and-test-fp.h
new file mode 100644
index 0000000..f153d96
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/load-and-test-fp.h
@@ -0,0 +1,12 @@
+double gl;
+
+#define test(N, CMP) \
+ void N ## _dead(double a) { if (a CMP 0.0) gl = 1; } \
+ double N ## _live(double a) { if (a CMP 0.0) gl = 1; return a; }
+
+test(eq, ==)
+test(ne, !=)
+test(ge, >=)
+test(gt, >)
+test(le, <=)
+test(lt, <)
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail21001.d b/gcc/testsuite/gdc.test/fail_compilation/fail21001.d
new file mode 100644
index 0000000..0faeb40
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/fail21001.d
@@ -0,0 +1,12 @@
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail21001.d(12): Error: undefined identifier `Alias`
+---
+*/
+
+module fail21001;
+
+import imports.fail21001b;
+
+void main() { Alias var; }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d b/gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d
new file mode 100644
index 0000000..69c1c20
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/fail21001b.d
@@ -0,0 +1,5 @@
+module imports.fail21001b;
+
+private struct S { Alias member; }
+
+private alias Alias = int;
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d
new file mode 100644
index 0000000..d9298bf
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295ast_node.d
@@ -0,0 +1,5 @@
+module imports.issue21295ast_node;
+import imports.issue21295visitor : Visitor;
+class ASTNode {
+ void accept(Visitor);
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d
new file mode 100644
index 0000000..5eccf6a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295astcodegen.d
@@ -0,0 +1,4 @@
+module imports.issue21295astcodegen;
+struct ASTCodegen {
+ import imports.issue21295dtemplate;
+}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d
new file mode 100644
index 0000000..8864f9e
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295dtemplate.d
@@ -0,0 +1,3 @@
+module imports.issue21295dtemplate;
+import imports.issue21295ast_node;
+class TemplateParameter : ASTNode { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d
new file mode 100644
index 0000000..3665a7f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/imports/issue21295visitor.d
@@ -0,0 +1,3 @@
+module imports.issue21295visitor;
+import imports.issue21295astcodegen;
+class Visitor { }
diff --git a/gcc/testsuite/gdc.test/fail_compilation/issue21295.d b/gcc/testsuite/gdc.test/fail_compilation/issue21295.d
new file mode 100644
index 0000000..9916e9b
--- /dev/null
+++ b/gcc/testsuite/gdc.test/fail_compilation/issue21295.d
@@ -0,0 +1,9 @@
+/*
+REQUIRED_ARGS: -de
+TEST_OUTPUT:
+---
+fail_compilation/issue21295.d(9): Deprecation: imports.issue21295ast_node.Visitor is not visible from module issue21295
+---
+*/
+import imports.issue21295ast_node;
+Visitor should_fail;
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_result_2.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_result_2.f90
index 89ff5ac..2e907e3 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_result_2.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_result_2.f90
@@ -1,9 +1,8 @@
-! { dg-do run }
! Tests the fix for PR40440, in which gfortran tried to deallocate
! the allocatable components of the actual argument of CALL SUB
!
! Contributed by Juergen Reuter <juergen.reuter@desy.de>
-! Reduced testcase from Tobias Burnus <burnus@gcc.gnu.org>
+! Reduced testcase from Tobias Burnus <burnus@gcc.gnu.org>
!
implicit none
type t
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_result_3.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_result_3.f90
new file mode 100644
index 0000000..8c4c982
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_result_3.f90
@@ -0,0 +1,75 @@
+! { dg-do run }
+!
+! Test the fix for PR96495 - segfaults at runtime at locations below.
+!
+! Contributed by Paul Luckner <paul.luckner@rwth-aachen.de>
+!
+module foo_m
+
+ implicit none
+
+ type foo
+ integer, allocatable :: j(:)
+ end type
+
+ interface operator(.unary.)
+ module procedure neg_foo
+ end interface
+
+ interface operator(.binary.)
+ module procedure foo_sub_foo
+ end interface
+
+ interface operator(.binaryElemental.)
+ module procedure foo_add_foo
+ end interface
+
+contains
+
+ elemental function foo_add_foo(f, g) result(h)
+ !! an example for an elemental binary operator
+ type(foo), intent(in) :: f, g
+ type(foo) :: h
+
+ allocate (h%j(size(f%j)), source = f%j+g%j)
+ end function
+
+ elemental function foo_sub_foo(f, g) result(h)
+ !! an example for an elemental binary operator
+ type(foo), intent(in) :: f, g
+ type(foo) :: h
+
+ allocate (h%j(size(f%j)), source = f%j-3*g%j)
+ end function
+
+ pure function neg_foo(f) result(g)
+ !! an example for a unary operator
+ type(foo), intent(in) :: f
+ type(foo) :: g
+
+ allocate (g%j(size(f%j)), source = -f%j)
+ end function
+
+end module
+
+program main_tmp
+
+ use foo_m
+
+ implicit none
+
+ type(foo) f, g(2)
+
+ allocate (f%j(3))
+ f%j = [2, 3, 4]
+
+ g = f
+ if (any (g(2)%j .ne. [2, 3, 4])) stop 1
+
+ g = g .binaryElemental. (f .binary. f) ! threw "Segmentation fault"
+ if (any (g(2)%j .ne. [-2,-3,-4])) stop 2
+
+ g = g .binaryElemental. ( .unary. f) ! threw "Segmentation fault"
+ if (any (g(2)%j .ne. [-4,-6,-8])) stop 3
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/analyzer/analyzer.exp b/gcc/testsuite/gfortran.dg/analyzer/analyzer.exp
index 00edfa5..462395c 100644
--- a/gcc/testsuite/gfortran.dg/analyzer/analyzer.exp
+++ b/gcc/testsuite/gfortran.dg/analyzer/analyzer.exp
@@ -33,7 +33,7 @@ if [info exists DEFAULT_FFLAGS] then {
}
# If a testcase doesn't have special options, use these.
-set DEFAULT_FFLAGS "-fanalyzer -fdiagnostics-path-format=separate-events -Wanalyzer-too-complex -fanalyzer-call-summaries"
+set DEFAULT_FFLAGS "-fanalyzer -Wanalyzer-too-complex -fanalyzer-call-summaries"
# Initialize `dg'.
dg-init
diff --git a/gcc/testsuite/gfortran.dg/check_bits_2.f90 b/gcc/testsuite/gfortran.dg/check_bits_2.f90
new file mode 100644
index 0000000..25357a0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/check_bits_2.f90
@@ -0,0 +1,38 @@
+! { dg-do run }
+! { dg-options "-fcheck=bits -fdump-tree-original" }
+! { dg-shouldfail "Fortran runtime error: FROMPOS(64)+LEN(1)>BIT_SIZE(64) in intrinsic MVBITS" }
+! { dg-output "At line 33 .*" }
+!
+! Verify that the runtime checks for the MVBITS intrinsic functions
+! do not generate false-positives
+program check
+ implicit none
+ integer, parameter :: bs4 = bit_size (1_4)
+ integer, parameter :: bs8 = bit_size (1_8)
+ integer(4), dimension(0:bs4) :: from4, frompos4, len4, to4, topos4
+ integer(8), dimension(0:bs8) :: from8, frompos8, len8, to8, topos8
+ integer :: i
+ from4 = -1
+ to4 = -1
+ len4 = [ (i, i=0,bs4) ]
+ frompos4 = bs4 - len4
+ topos4 = frompos4
+ call mvbits (from4, frompos4, len4, to4, topos4)
+ if (any (to4 /= -1)) stop 1
+ from8 = -1
+ to8 = -1
+ len8 = [ (i, i=0,bs8) ]
+ frompos8 = bs8 - len8
+ topos8 = frompos8
+ call mvbits (from8, frompos8, len8, to8, topos8)
+ if (any (to8 /= -1)) stop 2
+ from8 = -1
+ to8 = -1
+ len8(0) = 1
+ ! The following line should fail with a runtime error:
+ call mvbits (from8, frompos8, len8, to8, topos8)
+ ! Should never get here with -fcheck=bits
+ stop 3
+end
+
+! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 15 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/contiguous_11.f90 b/gcc/testsuite/gfortran.dg/contiguous_11.f90
new file mode 100644
index 0000000..b7eb7bf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/contiguous_11.f90
@@ -0,0 +1,45 @@
+! { dg-do compile }
+!
+! PR fortran/97242
+!
+implicit none
+type t
+ integer, allocatable :: A(:,:,:)
+ integer :: D(5,5,5)
+end type t
+
+type(t), target :: B(5)
+integer, pointer, contiguous :: P(:,:,:)
+integer, target :: C(5,5,5)
+integer :: i
+
+i = 1
+
+! OK: contiguous
+P => B(i)%A
+P => B(i)%A(:,:,:)
+P => C
+P => C(:,:,:)
+call foo (B(i)%A)
+call foo (B(i)%A(:,:,:))
+call foo (C)
+call foo (C(:,:,:))
+
+! Invalid - not contiguous
+! "If the pointer object has the CONTIGUOUS attribute, the pointer target shall be contiguous."
+! → known to be noncontigous (not always checkable, however)
+P => B(i)%A(:,::3,::4) ! <<< Unknown as (1:2:3,1:3:4) is contiguous and has one element.
+P => B(i)%D(:,::2,::2) ! { dg-error "Assignment to contiguous pointer from non-contiguous target" }
+P => C(::2,::2,::2) ! { dg-error "Assignment to contiguous pointer from non-contiguous target" }
+
+! This following is stricter:
+! C1541 The actual argument corresponding to a dummy pointer with the
+! CONTIGUOUS attribute shall be simply contiguous (9.5.4).
+call foo (B(i)%A(:,::3,::4)) ! { dg-error "must be simply contiguous" }
+call foo (C(::2,::2,::2)) ! { dg-error "must be simply contiguous" }
+
+contains
+ subroutine foo(Q)
+ integer, pointer, intent(in), contiguous :: Q(:,:,:)
+ end subroutine foo
+end
diff --git a/gcc/testsuite/gfortran.dg/contiguous_4.f90 b/gcc/testsuite/gfortran.dg/contiguous_4.f90
index 874ef8b..e784287 100644
--- a/gcc/testsuite/gfortran.dg/contiguous_4.f90
+++ b/gcc/testsuite/gfortran.dg/contiguous_4.f90
@@ -10,8 +10,10 @@ program cont_01_neg
x = (/ (real(i),i=1,45) /)
x2 = reshape(x,shape(x2))
- r => x(::3)
- r2 => x2(2:,:)
+ r => x(::46)
+ r => x(::3) ! { dg-error "Assignment to contiguous pointer from non-contiguous target" }
+ r2 => x2(2:,9:)
+ r2 => x2(2:,:) ! { dg-error "Assignment to contiguous pointer from non-contiguous target" }
r2 => x2(:,2:3)
r => x2(2:3,1)
r => x(::1)
diff --git a/gcc/testsuite/gfortran.dg/contiguous_7.f90 b/gcc/testsuite/gfortran.dg/contiguous_7.f90
index cccc89f..7444b4c 100644
--- a/gcc/testsuite/gfortran.dg/contiguous_7.f90
+++ b/gcc/testsuite/gfortran.dg/contiguous_7.f90
@@ -8,17 +8,29 @@ program cont_01_neg
implicit none
real, pointer, contiguous :: r(:)
real, pointer, contiguous :: r2(:,:)
- real, target :: x(45)
- real, target :: x2(5,9)
+ real, target, allocatable :: x(:)
+ real, target, allocatable :: x2(:,:)
+ real, target :: y(45)
+ real, target :: y2(5,9)
integer :: i
integer :: n=1
x = (/ (real(i),i=1,45) /)
x2 = reshape(x,shape(x2))
+ y = x
+ y2 = x2
+
r => x(::3) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
r2 => x2(2:,:) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
r2 => x2(:,2:3)
r => x2(2:3,1)
r => x(::1)
r => x(::n) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
+
+ r => y(::3) ! { dg-error "ssignment to contiguous pointer from non-contiguous target" }
+ r2 => y2(2:,:) ! { dg-error "ssignment to contiguous pointer from non-contiguous target" }
+ r2 => y2(:,2:3)
+ r => y2(2:3,1)
+ r => y(::1)
+ r => y(::n) ! { dg-warning "ssignment to contiguous pointer from non-contiguous target" }
end program
diff --git a/gcc/testsuite/gfortran.dg/goacc/warn_truncated.f90 b/gcc/testsuite/gfortran.dg/goacc/warn_truncated.f90
new file mode 100644
index 0000000..15ef3f5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/warn_truncated.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! PR fortran/97390
+!
+integer :: tempRbuffer, array, compactHaloInfo, dimsizes, nHaloLayers, gpu_nList_send, gpu_idx_send, gpu_bufferOffset_send, counter
+ !$acc data present(tempRbuffer, array, compactHaloInfo, dimsizes, nHaloLayers, gpu_nList_send, gpu_idx_send, gpu_bufferOffset_send) async(counter+1) ! { dg-error "Line truncated" }
+! { dg-error "Syntax error in Open.* variable list" "" { target "*-*-*" } .-1 }
+
+ !$acc end data ! { dg-error "Unexpected !.ACC END DATA statement" }
+end
+
+! { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 }
diff --git a/gcc/testsuite/gfortran.dg/gomp/flush-1.f90 b/gcc/testsuite/gfortran.dg/gomp/flush-1.f90
new file mode 100644
index 0000000..d0b7f9e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/flush-1.f90
@@ -0,0 +1,41 @@
+! { dg-additional-options "-fdump-tree-gimple" }
+! { dg-final { scan-tree-dump "foo \\(4\\);\[\n\r]* __atomic_thread_fence \\(4\\);\[\n\r]* foo \\(4\\);" "gimple" } }
+! { dg-final { scan-tree-dump "foo \\(3\\);\[\n\r]* __atomic_thread_fence \\(3\\);\[\n\r]* foo \\(3\\);" "gimple" } }
+! { dg-final { scan-tree-dump "foo \\(2\\);\[\n\r]* __atomic_thread_fence \\(2\\);\[\n\r]* foo \\(2\\);" "gimple" } }
+! { dg-final { scan-tree-dump "foo \\(5\\);\[\n\r]* __sync_synchronize \\(\\);\[\n\r]* foo \\(5\\);" "gimple" } }
+
+module m
+ interface
+ subroutine foo(x)
+ integer, value :: x
+ end
+ end interface
+end module m
+
+subroutine f1
+ use m
+ call foo (4)
+ !$omp flush acq_rel
+ call foo (4)
+end
+
+subroutine f2
+ use m
+ call foo (3)
+ !$omp flush release
+ call foo (3)
+end
+
+subroutine f3
+ use m
+ call foo (2)
+ !$omp flush acquire
+ call foo (2)
+end
+
+subroutine f4
+ use m
+ call foo (5)
+ !$omp flush
+ call foo (5)
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/flush-2.f90 b/gcc/testsuite/gfortran.dg/gomp/flush-2.f90
new file mode 100644
index 0000000..6857371
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/flush-2.f90
@@ -0,0 +1,18 @@
+module m
+ integer :: a, b
+end module m
+
+subroutine foo (void)
+ use m
+ !$omp flush
+ !$omp flush (a, b)
+ !$omp flush acquire
+ !$omp flush release
+ !$omp flush acq_rel
+ !$omp flush relaxed ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush seq_cst ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush foobar ! { dg-error "Expected AQC_REL, RELEASE, or ACQUIRE" }
+ !$omp flush acquire (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
+ !$omp flush release (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
+ !$omp flush acq_rel (a, b) ! { dg-error "List specified together with memory order clause in FLUSH directive" }
+end
diff --git a/gcc/testsuite/gfortran.dg/index_4.f90 b/gcc/testsuite/gfortran.dg/index_4.f90
new file mode 100644
index 0000000..0909378
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/index_4.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! { dg-options "-fdump-tree-original" }
+! { dg-final { scan-tree-dump-times "string_index" 0 "original" } }
+! PR fortran/95979
+
+program p
+ implicit none
+ integer, parameter :: i0 = index( 'abcd', 'b' , .true. , kind=4)
+ integer, parameter :: i1(*) = index(['abcd'], 'b' , .true. , kind=4)
+ integer, parameter :: i2(*) = index( 'abcd' ,['b'], .true. )
+ integer, parameter :: i3(*) = index( 'abcd' , 'b' ,[.true.] )
+ integer, parameter :: i4(*) = index(['abcd'],['b'],[.true.], kind=8)
+ if (size (i1) /= 1) stop 1
+ if (size (i2) /= 1) stop 2
+ if (size (i3) /= 1) stop 3
+ if (size (i4) /= 1) stop 4
+ if (i0 /= 2) stop 5
+ if (i1(1) /= 2 .or. i2(1) /= 2 .or. i3(1) /= 2 .or. i4(1) /= 2) stop 6
+end
diff --git a/gcc/testsuite/gfortran.dg/matmul_20.f90 b/gcc/testsuite/gfortran.dg/matmul_20.f90
new file mode 100644
index 0000000..7a211a4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_20.f90
@@ -0,0 +1,47 @@
+! { dg-do run }
+! PR97063 - Wrong result for vector (step size is negative) * matrix
+
+program p
+ implicit none
+ integer, parameter :: m = 3, k = 2*m, l = k-1, n = 4
+ integer :: i, j, m1, m2, ms
+ integer :: ai(k), bi(k,n), ci(n), ci_ref(n), c1, c2
+ real :: ar(k), br(k,n), cr(n), cr_ref(n)
+
+ ai(:) = [(i,i=0,k-1)]
+ bi(:,:) = reshape ([(((5*i+j),i=0,k-1),j=0,n-1)],[k,n])
+
+ ! Parameters of subscript triplet
+ m1 = 1; m2 = l; ms = 2
+
+ ! Reference values for cross-checks: integer variant
+ c1 = dot_product (ai(m1:m2: ms), bi(m1:m2: ms,1))
+ c2 = dot_product (ai(m1:m2: ms), bi(m1:m2: ms,2))
+ ci_ref = matmul (ai(m1:m2: ms), bi(m1:m2: ms,:))
+ ci = matmul (ai(m2:m1:-ms), bi(m2:m1:-ms,:))
+
+ if (ci_ref(1) /= c1 .or. ci_ref(2) /= c2) stop 1
+ if (any (ci /= ci_ref)) stop 2
+
+ ! Real variant
+ ar = real (ai)
+ br = real (bi)
+ cr_ref = matmul (ar(m1:m2: ms), br(m1:m2: ms,:))
+ cr = matmul (ar(m2:m1:-ms), br(m2:m1:-ms,:))
+
+ if (any (cr_ref /= real (ci_ref))) stop 3
+ if (any (cr /= cr_ref )) stop 4
+
+ ! Mixed variants
+ cr_ref = matmul (ar(m1:m2: ms), bi(m1:m2: ms,:))
+ cr = matmul (ar(m2:m1:-ms), bi(m2:m1:-ms,:))
+
+ if (any (cr_ref /= real (ci_ref))) stop 5
+ if (any (cr /= cr_ref )) stop 6
+
+ cr_ref = matmul (ai(m1:m2: ms), br(m1:m2: ms,:))
+ cr = matmul (ai(m2:m1:-ms), br(m2:m1:-ms,:))
+
+ if (any (cr_ref /= real (ci_ref))) stop 7
+ if (any (cr /= cr_ref )) stop 8
+end program
diff --git a/gcc/testsuite/gfortran.dg/pr68627.f b/gcc/testsuite/gfortran.dg/pr68627.f
index 7754b72..2ff1f3c 100644
--- a/gcc/testsuite/gfortran.dg/pr68627.f
+++ b/gcc/testsuite/gfortran.dg/pr68627.f
@@ -1,6 +1,6 @@
! { dg-do compile { target { { i?86-*-* x86_64-*-* } && { ! { ia32 } } } } }
-! { dg-options "-Ofast -mavx512f -ffixed-xmm1 -ffixed-xmm2 -ffixed-xmm3 -ffixed-xmm4 -ffixed-xmm5 -ffixed-xmm6 -ffixed-xmm7 -ffixed-xmm8 -ffixed-xmm9 -ffixed-xmm10 -ffixed-xmm11 -ffixed-xmm12 -ffixed-xmm13 -ffixed-xmm14 -ffixed-xmm15" }
+! { dg-options "-Ofast -fno-tree-slp-vectorize -mavx512f -ffixed-xmm1 -ffixed-xmm2 -ffixed-xmm3 -ffixed-xmm4 -ffixed-xmm5 -ffixed-xmm6 -ffixed-xmm7 -ffixed-xmm8 -ffixed-xmm9 -ffixed-xmm10 -ffixed-xmm11 -ffixed-xmm12 -ffixed-xmm13 -ffixed-xmm14 -ffixed-xmm15" }
IMPLICIT REAL*8(A-H,O-Z)
ALLOCATABLE DD1(:), DD2(:), WY(:,:)
diff --git a/gcc/testsuite/gfortran.dg/pr95614_1.f90 b/gcc/testsuite/gfortran.dg/pr95614_1.f90
new file mode 100644
index 0000000..f835143
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95614_1.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+
+module m ! { dg-error ".1." }
+ common m ! { dg-error "cannot appear in a COMMON" }
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr95614_2.f90 b/gcc/testsuite/gfortran.dg/pr95614_2.f90
new file mode 100644
index 0000000..9d69a50
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95614_2.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+
+module m ! { dg-error ".1." }
+ common /xc/ m ! { dg-error "cannot appear in a COMMON" }
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr95614_3.f90 b/gcc/testsuite/gfortran.dg/pr95614_3.f90
new file mode 100644
index 0000000..7a66bec
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95614_3.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+subroutine s
+end subroutine
+
+program pr95614
+ common /c1/ s
+ s = 9.0
+end program
diff --git a/gcc/testsuite/gfortran.dg/pr95614_4.f90 b/gcc/testsuite/gfortran.dg/pr95614_4.f90
new file mode 100644
index 0000000..48f9b9b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95614_4.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+function f()
+ f = 1.0
+end function
+
+program pr95614
+ common /c1/ f
+end program
diff --git a/gcc/testsuite/gfortran.dg/pr96099_1.f90 b/gcc/testsuite/gfortran.dg/pr96099_1.f90
new file mode 100644
index 0000000..9754bd3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr96099_1.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+
+program pr96099_1
+ implicit class(t) (1) ! { dg-error "Syntax error in IMPLICIT" }
+ type t
+ end type
+end
+
diff --git a/gcc/testsuite/gfortran.dg/pr96099_2.f90 b/gcc/testsuite/gfortran.dg/pr96099_2.f90
new file mode 100644
index 0000000..3136d2e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr96099_2.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+program pr96099_2
+ integer n1
+ parameter (n1 = 1)
+ implicit class(t) (n1) ! { dg-error "Syntax error in IMPLICIT" }
+ type t
+ end type
+end
diff --git a/gcc/testsuite/gfortran.dg/pr97272.f90 b/gcc/testsuite/gfortran.dg/pr97272.f90
new file mode 100644
index 0000000..e819038
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr97272.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! PR fortran/97272 - Wrong answer from MAXLOC with character arg
+
+program test
+ implicit none
+ integer :: i, j, k, l = 10
+ character, allocatable :: a(:)
+ allocate (a(l))
+ a(:) = 'a'
+ l = l - 1
+ a(l) = 'b'
+ i = maxloc (a, dim=1)
+ j = maxloc (a, dim=1, kind=2)
+ k = maxloc (a, dim=1, kind=8, back=.true.)
+! print *, 'i = ', i, 'a(i) = ', a(i)
+! print *, 'j = ', j, 'a(j) = ', a(j)
+! print *, 'k = ', k, 'a(k) = ', a(k)
+ if (i /= l .or. j /= l .or. k /= l) stop 1
+end
diff --git a/gcc/testsuite/gfortran.dg/pr97500.f90 b/gcc/testsuite/gfortran.dg/pr97500.f90
new file mode 100644
index 0000000..d63b861
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr97500.f90
@@ -0,0 +1,35 @@
+! { dg-do run }
+! { dg-additional-options "-ftree-vectorize -fno-guess-branch-probability" }
+module testmod
+ implicit none
+
+ contains
+
+ subroutine foo(n)
+ integer, intent(in) :: n
+ real :: r(0:n,-n:n), a(0:n,-n:n), dj
+ integer :: k, j
+
+ ! initialize with some dummy values
+ do j = -n, n
+ a(:, j) = j
+ r(:,j) = j + 1
+ end do
+
+ ! here be dragons
+ do k = 0, n
+ dj = r(k, k - 2) * a(k, k - 2)
+ r(k,k) = a(k, k - 1) * dj
+ enddo
+
+ if (r(0,0) .ne. -2.) STOP 1
+
+ end subroutine
+
+end module
+
+program test
+ use testmod
+ implicit none
+ call foo(5)
+end program
diff --git a/gcc/testsuite/gfortran.dg/pr97505.f90 b/gcc/testsuite/gfortran.dg/pr97505.f90
new file mode 100644
index 0000000..f0599b3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr97505.f90
@@ -0,0 +1,49 @@
+! { dg-do compile }
+! { dg-options "-Os -fsanitize=signed-integer-overflow" }
+!
+! Test the fix for PR35824, in which the interface assignment and
+! negation did not work correctly.
+!
+! Contributed by Rolf Roth <everyo@gmx.net>
+!
+module typemodule
+ type alltype
+ double precision :: a
+ double precision,allocatable :: b(:)
+ end type
+ interface assignment(=)
+ module procedure at_from_at
+ end interface
+ interface operator(-)
+ module procedure neg_at
+ end interface
+contains
+ subroutine at_from_at(b,a)
+ type(alltype), intent(in) :: a
+ type(alltype), intent(out) :: b
+ b%a=a%a
+ allocate(b%b(2))
+ b%b=a%b
+ end subroutine at_from_at
+ function neg_at(a) result(b)
+ type(alltype), intent(in) :: a
+ type(alltype) :: b
+ b%a=-a%a
+ allocate(b%b(2))
+ b%b=-a%b
+ end function neg_at
+end module
+ use typemodule
+ type(alltype) t1,t2,t3
+ allocate(t1%b(2))
+ t1%a=0.5d0
+ t1%b(1)=1d0
+ t1%b(2)=2d0
+ t2=-t1
+ if (t2%a .ne. -0.5d0) STOP 1
+ if (any(t2%b .ne. [-1d0, -2d0])) STOP 2
+
+ t1=-t1
+ if (t1%a .ne. -0.5d0) STOP 3
+ if (any(t1%b .ne. [-1d0, -2d0])) STOP 4
+end
diff --git a/gcc/testsuite/gfortran.dg/select_type_50.f90 b/gcc/testsuite/gfortran.dg/select_type_50.f90
new file mode 100644
index 0000000..aea1c81
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/select_type_50.f90
@@ -0,0 +1,52 @@
+! { dg-do run }
+!
+! Test the fix for PR97045. The report was for the INTEGER version. Testing
+! revealed a further bug with the character versions.
+!
+! Contributed by Igor Gayday <igor.gayday@mu.edu>
+!
+program test_prg
+ implicit none
+ integer :: i
+ integer, allocatable :: arr(:, :)
+ character(kind = 1, len = 2), allocatable :: chr(:, :)
+ character(kind = 4, len = 2), allocatable :: chr4(:, :)
+
+ arr = reshape ([(i, i = 1, 9)], [3, 3])
+ do i = 1, 3
+ call write_array(arr(1:2, i), i)
+ end do
+
+ chr = reshape([(char (i)//char (i+1), i = 65, 83, 2)], [3, 3])
+ do i = 1, 3
+ call write_array (chr(1:2, i), i)
+ end do
+
+ chr4 = reshape([(char (i, kind = 4)//char (i+1, kind = 4), i = 65, 83, 2)], &
+ [3, 3])
+ do i = 1, 3
+ call write_array (chr4(1:2, i), i)
+ end do
+
+contains
+
+ subroutine write_array(array, j)
+ class(*), intent(in) :: array(:)
+ integer :: i = 2
+ integer :: j, k
+
+ select type (elem => array(i))
+ type is (integer)
+ k = 3*(j-1)+i
+ if (elem .ne. k) stop 1
+ type is (character(kind = 1, len = *))
+ k = 63 + 2*(3*(j-1)+i)
+ if (elem .ne. char (k)//char (k+1)) print *, elem, " ", char (k)//char (k+1)
+ type is (character(kind = 4, len = *))
+ k = 63 + 2*(3*(j-1)+i)
+ if (elem .ne. char (k, kind = 4)//char (k+1, kind = 4)) stop 3
+ end select
+
+ end subroutine
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/vect/pr62283-2.f b/gcc/testsuite/gfortran.dg/vect/pr62283-2.f
index 8f5b6d6..0c4e103 100644
--- a/gcc/testsuite/gfortran.dg/vect/pr62283-2.f
+++ b/gcc/testsuite/gfortran.dg/vect/pr62283-2.f
@@ -8,4 +8,4 @@
y(3)=y(3)+alpha*x(3)
y(4)=y(4)+alpha*x(4)
end
-! { dg-final { scan-tree-dump "basic block vectorized" "slp2" } }
+! { dg-final { scan-tree-dump "optimized: basic block" "slp2" } }
diff --git a/gcc/testsuite/gfortran.dg/vect/vect-4.f90 b/gcc/testsuite/gfortran.dg/vect/vect-4.f90
index c2eeafd..9c067c6 100644
--- a/gcc/testsuite/gfortran.dg/vect/vect-4.f90
+++ b/gcc/testsuite/gfortran.dg/vect/vect-4.f90
@@ -13,4 +13,3 @@ Y = Y + A * X
END
! { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } }
-! { dg-final { scan-tree-dump-times "accesses have the same alignment." 1 "vect" } }
diff --git a/gcc/testsuite/gnat.dg/addr16.adb b/gcc/testsuite/gnat.dg/addr16.adb
new file mode 100644
index 0000000..8f09da0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/addr16.adb
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+
+with Addr16_Pkg; use Addr16_Pkg;
+
+procedure Addr16 (R : Rec) is
+
+ pragma Unsuppress (Alignment_Check);
+
+ B : Integer;
+ for B'Address use R.A'Address;
+
+begin
+ null;
+end;
diff --git a/gcc/testsuite/gnat.dg/addr16_pkg.ads b/gcc/testsuite/gnat.dg/addr16_pkg.ads
new file mode 100644
index 0000000..9a1b9e3
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/addr16_pkg.ads
@@ -0,0 +1,9 @@
+package Addr16_Pkg is
+
+ type Arr is array (Positive range <>) of Long_Long_Integer;
+
+ type Rec (D : Positive) is record
+ A : Arr (1 .. D);
+ end record;
+
+end Addr16_Pkg;
diff --git a/gcc/testsuite/gnat.dg/assert1.adb b/gcc/testsuite/gnat.dg/assert1.adb
index d761cd0..7a40d3c 100644
--- a/gcc/testsuite/gnat.dg/assert1.adb
+++ b/gcc/testsuite/gnat.dg/assert1.adb
@@ -2,8 +2,9 @@
-- { dg-options "-gnatws" }
pragma Assertion_Policy (Check);
-with Text_IO; use Text_IO;
+
procedure assert1 is
+ Int128 : constant Boolean := Standard'Max_Integer_Size = 128;
type p1 is array (1 .. 113) of Boolean;
pragma Pack (p1);
type p2 is array (1 .. 13) of Boolean;
@@ -19,21 +20,21 @@ procedure assert1 is
v3 : p3;
v4 : p4;
begin
- pragma Assert (p1'Size = 120);
+ pragma Assert (p1'Size = (if Int128 then 113 else 120));
pragma Assert (p2'Size = 13);
pragma Assert (p3'Size = 113);
pragma Assert (p4'Size = 13);
- pragma Assert (p1'Value_Size = 120);
+ pragma Assert (p1'Value_Size = (if Int128 then 113 else 120));
pragma Assert (p2'Value_Size = 13);
pragma Assert (p3'Value_Size = 113);
pragma Assert (p4'Value_Size = 13);
- pragma Assert (p1'Object_Size = 120);
+ pragma Assert (p1'Object_Size = (if Int128 then 128 else 120));
pragma Assert (p2'Object_Size = 16);
- pragma Assert (p3'Object_Size = 120);
+ pragma Assert (p3'Object_Size = (if Int128 then 128 else 120));
pragma Assert (p4'Object_Size = 16);
- pragma Assert (v1'Size = 120);
+ pragma Assert (v1'Size = (if Int128 then 128 else 120));
pragma Assert (v2'Size = 16);
- pragma Assert (v3'Size = 120);
+ pragma Assert (v3'Size = (if Int128 then 128 else 120));
pragma Assert (v4'Size = 16);
null;
end;
diff --git a/gcc/testsuite/gnat.dg/multfixed.adb b/gcc/testsuite/gnat.dg/multfixed.adb
index 2eca3cd..572cd32 100644
--- a/gcc/testsuite/gnat.dg/multfixed.adb
+++ b/gcc/testsuite/gnat.dg/multfixed.adb
@@ -18,7 +18,7 @@ begin
raise Program_Error;
exception
when Exc : Constraint_Error =>
- if Exception_Message (Exc) /= "System.Arith_64.Raise_Error: 64-bit arithmetic overflow" then
+ if Exception_Message (Exc) /= "System.Arith_64.Impl.Raise_Error: Double arithmetic overflow" then
raise Program_Error;
end if;
-end Multfixed; \ No newline at end of file
+end Multfixed;
diff --git a/gcc/testsuite/gnat.dg/opt11.adb b/gcc/testsuite/gnat.dg/opt11.adb
index 9189814..e02e426 100644
--- a/gcc/testsuite/gnat.dg/opt11.adb
+++ b/gcc/testsuite/gnat.dg/opt11.adb
@@ -6,7 +6,7 @@ package body Opt11 is
procedure Proc is
R : Rec;
begin
- R := (others => <>);
+ R := (others => <>); -- { dg-warning "aggregate not fully initialized" }
end;
end Opt11;
diff --git a/gcc/testsuite/gnat.dg/size_clause1.adb b/gcc/testsuite/gnat.dg/size_clause1.adb
index fc090eb..0a313bf 100644
--- a/gcc/testsuite/gnat.dg/size_clause1.adb
+++ b/gcc/testsuite/gnat.dg/size_clause1.adb
@@ -4,7 +4,7 @@ procedure Size_Clause1 is
for Modular'Size use 64;
subtype Enlarged_Modular is Modular;
- for Enlarged_Modular'Object_Size use 128; -- { dg-warning "warning: 64 bits of \"Enlarged_Modular\" unused" }
+ for Enlarged_Modular'Object_Size use 128; -- { dg-warning "64 bits of \"Enlarged_Modular\" unused" "" { target { ! lp64 } } }
begin
null;
diff --git a/gcc/testsuite/gnat.dg/specs/rep_clause5.ads b/gcc/testsuite/gnat.dg/specs/rep_clause5.ads
index ffac17b..3e1ff4d 100644
--- a/gcc/testsuite/gnat.dg/specs/rep_clause5.ads
+++ b/gcc/testsuite/gnat.dg/specs/rep_clause5.ads
@@ -33,6 +33,7 @@ package Rep_Clause5 is
type Array_2_Type is array (0 .. 127) of Boolean;
for Array_2_Type'size use 128;
+ for Array_2_Type'Alignment use 4;
type Array_3_Type is array (0 .. 31) of Boolean;
for Array_3_Type'size use 32;
diff --git a/gcc/testsuite/gnat.dg/warn11.adb b/gcc/testsuite/gnat.dg/warn11.adb
index e92835f..7e6f1a1 100644
--- a/gcc/testsuite/gnat.dg/warn11.adb
+++ b/gcc/testsuite/gnat.dg/warn11.adb
@@ -5,7 +5,7 @@ with Ada.Text_IO; use Ada.Text_IO;
procedure Warn11 is
type My_Integer is new Integer range 1 .. 10;
- for My_Integer'Size use 65; -- { dg-warning "unused" }
+ for My_Integer'Size use 65; -- { dg-warning "unused" "" { target { ! lp64 } } }
type My_Integer2 is new Integer range 1 .. 10;
for My_Integer2'Size use 129; -- { dg-warning "unused" }
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue4458.go b/gcc/testsuite/go.test/test/fixedbugs/issue4458.go
index 820f18c..82b104a 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/issue4458.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/issue4458.go
@@ -16,5 +16,5 @@ func (T) foo() {}
func main() {
av := T{}
pav := &av
- (**T).foo(&pav) // ERROR "no method foo|requires named type or pointer to named"
+ (**T).foo(&pav) // ERROR "no method|requires named type or pointer to named"
}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 5cbe32f..8439720 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -86,7 +86,10 @@ proc check_compile {basename type contents args} {
set f [open $src "w"]
puts $f $contents
close $f
+ global compiler_flags
+ set save_compiler_flags $compiler_flags
set lines [${tool}_target_compile $src $output $compile_type "$options"]
+ set compiler_flags $save_compiler_flags
file delete $src
set scan_output $output
@@ -7194,6 +7197,14 @@ proc check_effective_target_vect_load_lanes { } {
|| [istarget aarch64*-*-*] }}]
}
+# Return 1 if the target supports vector masked loads.
+
+proc check_effective_target_vect_masked_load { } {
+ return [expr { [check_avx_available]
+ || [check_effective_target_aarch64_sve]
+ || [istarget amdgcn*-*-*] } ]
+}
+
# Return 1 if the target supports vector masked stores.
proc check_effective_target_vect_masked_store { } {
@@ -7233,6 +7244,8 @@ proc check_effective_target_vect_cond_mixed { } {
expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
|| [istarget aarch64*-*-*]
|| [istarget powerpc*-*-*]
+ || ([istarget arm*-*-*]
+ && [check_effective_target_arm_neon_ok])
|| ([istarget mips*-*-*]
&& [et-is-effective-target mips_msa])
|| ([istarget s390*-*-*]
@@ -8956,6 +8969,39 @@ proc check_effective_target_avx512vaes { } {
} "-mvaes" ]
}
+# Return 1 if amx-tile instructions can be compiled.
+proc check_effective_target_amx_tile { } {
+ return [check_no_compiler_messages amx_tile object {
+ void
+ foo ()
+ {
+ __asm__ volatile ("tilerelease" ::);
+ }
+ } "-mamx-tile" ]
+}
+
+# Return 1 if amx-int8 instructions can be compiled.
+proc check_effective_target_amx_int8 { } {
+ return [check_no_compiler_messages amx_int8 object {
+ void
+ foo ()
+ {
+ __asm__ volatile ("tdpbssd\t%%tmm1, %%tmm2, %%tmm3" ::);
+ }
+ } "-mamx-int8" ]
+}
+
+# Return 1 if amx-bf16 instructions can be compiled.
+proc check_effective_target_amx_bf16 { } {
+ return [check_no_compiler_messages amx_bf16 object {
+ void
+ foo ()
+ {
+ __asm__ volatile ("tdpbf16ps\t%%tmm1, %%tmm2, %%tmm3" ::);
+ }
+ } "-mamx-bf16" ]
+}
+
# Return 1 if vpclmulqdq instructions can be compiled.
proc check_effective_target_vpclmulqdq { } {
return [check_no_compiler_messages vpclmulqdq object {
@@ -10347,7 +10393,7 @@ proc check_effective_target_arm_v8_3a_bkey_directive { } {
# Overhead Loop, 0 otherwise. The test is valid for ARM.
proc check_effective_target_arm_v8_1_lob_ok { } {
- if { ![istarget arm*-*-*] } {
+ if { ![check_effective_target_arm_cortex_m] } {
return 0;
} else {
return [check_runtime arm_v8_1_lob_hw_available {
@@ -10361,7 +10407,7 @@ proc check_effective_target_arm_v8_1_lob_ok { } {
asm goto ("le lr, %l0" : : : "lr" : loop);
return i != 10;
}
- } "-march=armv8.1-m.main" ]
+ } "-march=armv8.1-m.main -mthumb" ]
}
}
@@ -10510,3 +10556,29 @@ proc check_symver_available { } {
}
}]
}
+
+# Return 1 if emitted assembly contains .ident directive.
+
+proc check_effective_target_ident_directive {} {
+ return [check_no_messages_and_pattern ident_directive \
+ "(?n)^\[\t\]+\\.ident" assembly {
+ int i;
+ }]
+}
+
+# Return 1 if we're able to assemble movdiri and movdir64b
+
+proc check_effective_target_movdir { } {
+ return [check_no_compiler_messages movdir object {
+ void
+ foo (unsigned int *d, unsigned int s)
+ {
+ __builtin_ia32_directstoreu_u32 (d, s);
+ }
+ void
+ bar (void *d, const void *s)
+ {
+ __builtin_ia32_movdir64b (d, s);
+ }
+ } "-mmovdiri -mmovdir64b" ]
+}
diff --git a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
index 18b671d..0712355 100644
--- a/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
+++ b/gcc/testsuite/obj-c++.dg/cxx-ivars-3.mm
@@ -2,14 +2,14 @@
// { dg-do run { target *-*-darwin* } }
// { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } }
-// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[3-8]* } { "-fnext-runtime" } { "" } }
+// { dg-skip-if "Headers incompatible with 10.4 APIs" { *-*-darwin1[1-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } }
// { dg-additional-options "-fobjc-call-cxx-cdtors -mmacosx-version-min=10.4 -framework Foundation" }
// This test has no equivalent or meaning for m64/ABI V2
// { dg-xfail-run-if "No Test Avail" { *-*-darwin* && lp64 } { "-fnext-runtime" } { "" } }
-#include <objc/objc-runtime.h>
#include <stdlib.h>
#include "../objc-obj-c++-shared/F-NSObject.h"
+#include <objc/objc-runtime.h>
//extern "C" { int printf(const char *,...); }
#define CHECK_IF(expr) if(!(expr)) abort()
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
index 7806d6f..bdaef98 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
@@ -20,6 +20,7 @@
/* { dg-do run } */
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
index 9a7c092..ae39026 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
@@ -7,6 +7,7 @@
/* { dg-do run } */
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
index e5b1a69..201ab7e 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm
@@ -3,8 +3,12 @@
This is test 'objc', covering all functions starting with 'objc'. */
/* { dg-do run } */
-/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
-/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* Although this works with the NeXT runtime in a sub-set of cases, some
+ versions of the runtime header pulls in a number of system protocols,
+ which causes the objc_copyProtocolList test to fail (in addition to those
+ systems that don't have the V2 APis). XFAILing the run is not useful
+ since it will XPASS on the sub-set that works. */
+/* { dg-skip-if "Incompatible" { *-*-darwin* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
index 68bebf8..45ffbc5 100644
--- a/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
+++ b/gcc/testsuite/obj-c++.dg/objc-gc-3.mm
@@ -3,7 +3,7 @@
/* Contributed by Ziemowit Laski <zlaski@apple.com> */
/* { dg-do compile } */
-/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */
+/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } } */
/* { dg-options "-fobjc-gc" } */
/* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
diff --git a/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm b/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
index 609fe3d..988b290 100644
--- a/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
+++ b/gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm
@@ -1,10 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-O -fdiagnostics-show-caret" } */
+/* { dg-excess-errors "tree range 0:0-0:0" { target { *-*-darwin* } } } */
/* This file is similar to diagnostic-test-expressions-1.c
(see the notes in that file); this file adds test
coverage for various Objective C constructs. */
+#include <objc/runtime.h> /* for SEL, Protocol */
+
extern void __emit_expression_range (int dummy, ...);
@protocol prot
@@ -17,7 +20,7 @@ extern void __emit_expression_range (int dummy, ...);
- (void) test_sending_messages;
+ (void) test_class_dot_name;
- (void) test_at_selector;
-- (void) test_at_protocol;
+- (void) test_at_protocol:(int)i;
- (void) test_at_encode:(int)i;
@end
@@ -49,27 +52,37 @@ extern void __emit_expression_range (int dummy, ...);
}
+ (void) test_class_dot_name
{
- __emit_expression_range ( 0, tests.func2 ); /* { dg-warning "range" } */
+ __emit_expression_range ( 0, tests.func2 ); /* { dg-warning "range" } */
/* { dg-begin-multiline-output "" }
__emit_expression_range ( 0, tests.func2 );
~~~~~~^~~~~
- { dg-end-multiline-output "" } */
+ { dg-end-multiline-output "" } */
}
- (void) test_at_selector
{
- __emit_expression_range ( 0, @selector(func0) ); /* { dg-warning "range" } */
+ /* For the NeXT runtime, @selector() generates a a var decl which (a) isn't
+ handled by the plugin, and (b) if it was would not necessarily have the
+ right location (there is only one var decl uniqued to each selector
+ spelling, so the location would be that of the first occurrence). Use an
+ assignment expression to test the operation. This isn't reliable here,
+ unfortunately. */
+ SEL aSel;
+ __emit_expression_range ( 0, aSel = @selector(foo) ); /* { dg-warning "range" } */
/* { dg-begin-multiline-output "" }
- __emit_expression_range ( 0, @selector(func0) );
- ^~~~~~~~~~~~~~~~
- { dg-end-multiline-output "" } */
+ __emit_expression_range ( 0, aSel = @selector(foo) );
+ ~~~~~^~~~~~~~~~~~~~~~
+ { dg-end-multiline-output "" { xfail { *-*-darwin* } } } */
}
-- (void) test_at_protocol
+- (void) test_at_protocol:(int)i
{
- __emit_expression_range ( 0, @protocol(prot) ); /* { dg-warning "range" } */
+ /* As for @selector(), the NeXT runtime generates a a var decl for
+ @protocol(); Unfortunately, we can't so easily fabricate a mechanism to
+ handle this (C++ FE turns the assignment op into a NOP). */
+ __emit_expression_range ( 0, @protocol(prot) ); /* { dg-warning "range" "" { xfail { *-*-darwin* && lp64 } } } */
/* { dg-begin-multiline-output "" }
__emit_expression_range ( 0, @protocol(prot) );
^~~~~~~~~~~~~~~
- { dg-end-multiline-output "" } */
+ { dg-end-multiline-output "" { xfail { *-*-darwin* && lp64 } } } */
}
- (void) test_at_encode:(int)i
{
diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
index 66b68c8..a1a964d 100644
--- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
+++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.h
@@ -24,6 +24,9 @@ along with GCC; see the file COPYING3. If not see
/* We use this root class instead of Object to keep the tests
independent of the runtime being used. Keep it simple. */
+#if defined(__has_attribute) && __has_attribute(objc_root_class)
+__attribute__((objc_root_class))
+#endif
@interface TestsuiteObject
{
Class isa;
@@ -42,6 +45,11 @@ along with GCC; see the file COPYING3. If not see
+ (Class) superclass;
+ (const char *)name;
- (const char *)name;
+
+/* For try-catch impl that retains and releases thrown objects. */
+- (id) retain;
+- (void) release;
+
@end
#endif /* _TESTSUITE_OBJECT_H_ */
diff --git a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
index 6bbe7d4..96717e3 100644
--- a/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
+++ b/gcc/testsuite/objc-obj-c++-shared/TestsuiteObject.m
@@ -64,6 +64,17 @@ along with GCC; see the file COPYING3. If not see
}
- (const char *)name
{
- return class_getName (isa);
+ return object_getClassName (self);
}
+
+- (id) retain
+{
+ return self;
+}
+
+- (void) release
+{
+ return;
+}
+
@end
diff --git a/gcc/testsuite/objc.dg/call-super-2.m b/gcc/testsuite/objc.dg/call-super-2.m
index 0a3765f..836cad9 100644
--- a/gcc/testsuite/objc.dg/call-super-2.m
+++ b/gcc/testsuite/objc.dg/call-super-2.m
@@ -3,7 +3,8 @@
/* { dg-do compile } */
#include "../objc-obj-c++-shared/TestsuiteObject.h"
-#include "../objc-obj-c++-shared/runtime.h"
+/* NOTE: we are relying on the built-in type for objc_getClass being used
+ rather than the one that might come from including <objc/runtime.h>. */
#include <stddef.h>
/* FIXME: This is temporary. At the moment, the compiler, when
@@ -14,6 +15,9 @@
# define objc_getClass(C) objc_get_class(C)
#endif
+/* FIXME: casting of super is not permitted by clang, so that many of the
+ tests here are testing non-portable code. */
+
@protocol Func
+ (int) class_func0;
- (int) instance_func0;
diff --git a/gcc/testsuite/objc.dg/gnu-api-2-class-meta.m b/gcc/testsuite/objc.dg/gnu-api-2-class-meta.m
index 07e0ba2..3a85b16 100644
--- a/gcc/testsuite/objc.dg/gnu-api-2-class-meta.m
+++ b/gcc/testsuite/objc.dg/gnu-api-2-class-meta.m
@@ -20,6 +20,7 @@
/* { dg-do run } */
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
@@ -28,6 +29,9 @@
#include <stdio.h>
#include <string.h>
+#if __has_attribute(objc_root_class)
+__attribute__((objc_root_class))
+#endif
@interface MyRootClass
{ Class isa; }
+ alloc;
@@ -65,7 +69,7 @@ static id static_variable = nil;
+ (id) mySelf;
@end
-int main(int argc, void **args)
+int main(int argc, char **args)
{
/* Functions are tested in alphabetical order. */
diff --git a/gcc/testsuite/objc.dg/gnu-api-2-class.m b/gcc/testsuite/objc.dg/gnu-api-2-class.m
index 34195296..eade0dc 100644
--- a/gcc/testsuite/objc.dg/gnu-api-2-class.m
+++ b/gcc/testsuite/objc.dg/gnu-api-2-class.m
@@ -7,6 +7,7 @@
/* { dg-do run } */
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/objc.dg/gnu-api-2-objc.m b/gcc/testsuite/objc.dg/gnu-api-2-objc.m
index d65c120..1b4ce8e 100644
--- a/gcc/testsuite/objc.dg/gnu-api-2-objc.m
+++ b/gcc/testsuite/objc.dg/gnu-api-2-objc.m
@@ -3,8 +3,12 @@
This is test 'objc', covering all functions starting with 'objc'. */
/* { dg-do run } */
-/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */
-/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+/* Although this works with the NeXT runtime in a sub-set of cases, some
+ versions of the runtime header pulls in a number of system protocols,
+ which causes the objc_copyProtocolList test to fail (in addition to those
+ systems that don't have the V2 APis). XFAILing the run is not useful
+ since it will XPASS on the sub-set that works. */
+/* { dg-skip-if "Incompatible" { *-*-darwin* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
diff --git a/gcc/testsuite/objc.dg/ivar-scope-4.m b/gcc/testsuite/objc.dg/ivar-scope-4.m
index f720972..5fc29f9 100644
--- a/gcc/testsuite/objc.dg/ivar-scope-4.m
+++ b/gcc/testsuite/objc.dg/ivar-scope-4.m
@@ -18,6 +18,7 @@ int someivar = 1;
int someivar;
}
++ (id) initialize;
+ (id) alloc;
- (id) init;
- (int) getGlobal;
@@ -26,6 +27,11 @@ int someivar = 1;
@end
@implementation MyClass
++ (id) initialize
+{
+ return self;
+}
+
+ (id) alloc
{
return class_createInstance (self, 0);
diff --git a/gcc/testsuite/objc.dg/objc-gc-4.m b/gcc/testsuite/objc.dg/objc-gc-4.m
index 96c3278..8102a5a 100644
--- a/gcc/testsuite/objc.dg/objc-gc-4.m
+++ b/gcc/testsuite/objc.dg/objc-gc-4.m
@@ -3,7 +3,7 @@
/* Contributed by Ziemowit Laski <zlaski@apple.com> */
/* { dg-do compile } */
-/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */
+/* { dg-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-9]* *-*-darwin2[0-9]* } { "-fnext-runtime" } { "" } } */
/* { dg-options "-fobjc-gc" } */
/* { dg-prune-output "cc1obj: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
diff --git a/gcc/testsuite/objc.dg/plugin/diagnostic-test-expressions-1.m b/gcc/testsuite/objc.dg/plugin/diagnostic-test-expressions-1.m
index ed7aca3..23a9302 100644
--- a/gcc/testsuite/objc.dg/plugin/diagnostic-test-expressions-1.m
+++ b/gcc/testsuite/objc.dg/plugin/diagnostic-test-expressions-1.m
@@ -5,6 +5,8 @@
(see the notes in that file); this file adds test
coverage for various Objective C constructs. */
+#include <objc/runtime.h> /* for SEL, Protocol */
+
extern void __emit_expression_range (int dummy, ...);
@protocol prot
@@ -55,22 +57,33 @@ extern void __emit_expression_range (int dummy, ...);
~~~~~~~~~~~
{ dg-end-multiline-output "" } */
}
+
- (void) test_at_selector
{
- __emit_expression_range ( 0, @selector(func0) ); /* { dg-warning "range" } */
+ /* For the NeXT runtime, @selector() generates a a var decl which (a) isn't
+ handled by the plugin, and (b) if it was would not necessarily have the
+ right location (there is only one var decl uniqued to each selector
+ spelling, so the location would be that of the first occurrence). Use an
+ assignment expression to test the operation. */
+ SEL aSel;
+ __emit_expression_range ( 0, aSel = @selector(foo) ); /* { dg-warning "range" } */
/* { dg-begin-multiline-output "" }
- __emit_expression_range ( 0, @selector(func0) );
- ^~~~~~~~~~~~~~~~
+ __emit_expression_range ( 0, aSel = @selector(foo) );
+ ~~~~~^~~~~~~~~~~~~~~~
{ dg-end-multiline-output "" } */
}
- (void) test_at_protocol
{
- __emit_expression_range ( 0, @protocol(prot) ); /* { dg-warning "range" } */
+ /* As for @selector(), the NeXT runtime generates a a var decl for
+ @protocol() handle this in a similar way. */
+ Protocol *aProt;
+ __emit_expression_range ( 0, aProt = @protocol(prot) ); /* { dg-warning "range" "" } */
/* { dg-begin-multiline-output "" }
- __emit_expression_range ( 0, @protocol(prot) );
- ~~~~~~~~~~~~~~~
+ __emit_expression_range ( 0, aProt = @protocol(prot) );
+ ~~~~~~^~~~~~~~~~~~~~~~~
{ dg-end-multiline-output "" } */
}
+
- (void) test_at_encode:(int)i
{
/* @encode() generates a STRING_CST which doesn't retain a location
diff --git a/gcc/testsuite/objc.dg/torture/forward-1.m b/gcc/testsuite/objc.dg/torture/forward-1.m
index b45f1b4..a25012d 100644
--- a/gcc/testsuite/objc.dg/torture/forward-1.m
+++ b/gcc/testsuite/objc.dg/torture/forward-1.m
@@ -1,32 +1,53 @@
/* { dg-do run } */
/* See if -forward:: is able to work. */
/* { dg-skip-if "Needs OBJC2 Implementation" { *-*-darwin8* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
-
+/* { dg-additional-options "-Wl,-framework,Foundation" { target *-*-darwin* } } */
#include <stdio.h>
#include <stdlib.h>
+/* Versions of the runtime after 10.13 no longer support the original
+ 'forward:' mechanism, so we make a stripped down representation of
+ NSInvocation and need to link with -framework Foundation. */
+#if __NEXT_RUNTIME__
+@class NSInvocation, NSMethodSignature;
+# include "../../objc-obj-c++-shared/F-NSObject.h"
+@interface NSInvocation : NSObject
++ (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)sig;
+@property SEL selector;
+- (void)invoke;
+- (void)invokeWithTarget:(id)target;
+@end
+# define OBJECT NSObject
+#else
#include "../../objc-obj-c++-shared/TestsuiteObject.m"
+#define OBJECT TestsuiteObject
+#endif
#define VALUETOUSE 1234567890
id forwarder, receiver;
-@interface Forwarder: TestsuiteObject
+@interface Forwarder : OBJECT
{
id receiver;
}
-initWithReceiver:theReceiver;
+#if __NEXT_RUNTIME__
+- (void)forwardInvocation:(NSInvocation *)anInvocation;
+- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
+#endif
@end
-@interface Receiver:TestsuiteObject
+@interface Receiver : OBJECT
{
int foo;
}
-display;
-initWithFoo:(int)theFoo;
@end
+
@implementation Receiver
-initWithFoo: (int)theFoo
@@ -56,7 +77,22 @@ id forwarder, receiver;
receiver = theReceiver;
return self;
}
--(void *) forward: (SEL)theSel: (void *)theArgFrame
+
+#if __NEXT_RUNTIME__
+- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSel
+{
+ return [receiver methodSignatureForSelector:aSel];
+}
+- (void)forwardInvocation:(NSInvocation *)anInvocation
+{
+ if ([receiver respondsToSelector:[anInvocation selector]]) {
+ [anInvocation invokeWithTarget:receiver];
+ }
+ else {
+ }
+}
+#else
+-(void *) forward:(SEL)theSel : (void *)theArgFrame
{
/* If we have a reciever try to perform on that object */
if (receiver)
@@ -75,6 +111,8 @@ id forwarder, receiver;
printf ("Unrecognized selector\n");
return NULL;
}
+#endif
+
@end
int main()
{
diff --git a/gcc/testsuite/objc/execute/class-tests-1.h b/gcc/testsuite/objc/execute/class-tests-1.h
index cfdd72b..65f1f70 100644
--- a/gcc/testsuite/objc/execute/class-tests-1.h
+++ b/gcc/testsuite/objc/execute/class-tests-1.h
@@ -4,6 +4,8 @@
#include <stdlib.h>
#include "../../objc-obj-c++-shared/runtime.h"
+extern int strcmp(const char *, const char *);
+
/*
* Standard Tests For Classes and Objects - abort upon failing; return
* normally if all is well.
diff --git a/gcc/timevar.c b/gcc/timevar.c
index a3a882d..8fbf5fa 100644
--- a/gcc/timevar.c
+++ b/gcc/timevar.c
@@ -661,8 +661,8 @@ timer::print_row (FILE *fp,
#endif /* HAVE_WALL_TIME */
/* Print the amount of ggc memory allocated. */
- fprintf (fp, "%8u kB (%3.0f%%)",
- (unsigned) (elapsed.ggc_mem >> 10),
+ fprintf (fp, PRsa (6) " (%3.0f%%)",
+ SIZE_AMOUNT (elapsed.ggc_mem),
(total->ggc_mem == 0
? 0
: (float) elapsed.ggc_mem / total->ggc_mem) * 100);
@@ -712,7 +712,7 @@ timer::print (FILE *fp)
TIMEVAR. */
m_start_time = now;
- fprintf (fp, "\n%-35s%16s%14s%14s%18s\n", "Time variable", "usr", "sys",
+ fprintf (fp, "\n%-35s%16s%14s%14s%14s\n", "Time variable", "usr", "sys",
"wall", "GGC");
if (m_jit_client_items)
fputs ("GCC items:\n", fp);
@@ -776,7 +776,7 @@ timer::print (FILE *fp)
#ifdef HAVE_WALL_TIME
fprintf (fp, "%8.2f ", total->wall);
#endif
- fprintf (fp, "%9u kB\n", (unsigned) (total->ggc_mem >> 10));
+ fprintf (fp, PRsa (7) "\n", SIZE_AMOUNT (total->ggc_mem));
if (CHECKING_P || flag_checking)
fprintf (fp, "Extra diagnostic checks enabled; compiler may run slowly.\n");
diff --git a/gcc/toplev.c b/gcc/toplev.c
index cdd4b5b..20e231f 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -84,6 +84,9 @@ along with GCC; see the file COPYING3. If not see
#include "dump-context.h"
#include "print-tree.h"
#include "optinfo-emit-json.h"
+#include "ipa-modref-tree.h"
+#include "ipa-modref.h"
+#include "dbgcnt.h"
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h"
@@ -2211,6 +2214,9 @@ finalize (bool no_backend)
if (profile_report)
dump_profile_report ();
+ if (flag_dbg_cnt_list)
+ dbg_cnt_list_all_counters ();
+
/* Language-specific end of compilation actions. */
lang_hooks.finish ();
}
@@ -2497,9 +2503,11 @@ toplev::finalize (void)
/* Needs to be called before cgraph_c_finalize since it uses symtab. */
ipa_reference_c_finalize ();
ipa_fnsummary_c_finalize ();
+ ipa_modref_c_finalize ();
cgraph_c_finalize ();
cgraphunit_c_finalize ();
+ symtab_thunks_cc_finalize ();
dwarf2out_c_finalize ();
gcse_c_finalize ();
ipa_cp_c_finalize ();
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 82ede72..2f9daf9 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -53,7 +53,7 @@
#include "fibonacci_heap.h"
#include "tracer.h"
-static int count_insns (basic_block);
+static void analyze_bb (basic_block, int *);
static bool better_p (const_edge, const_edge);
static edge find_best_successor (basic_block);
static edge find_best_predecessor (basic_block);
@@ -84,6 +84,33 @@ bb_seen_p (basic_block bb)
return bitmap_bit_p (bb_seen, bb->index);
}
+static sbitmap can_duplicate_bb;
+
+/* Cache VAL as value of can_duplicate_bb_p for BB. */
+static inline void
+cache_can_duplicate_bb_p (const_basic_block bb, bool val)
+{
+ if (val)
+ bitmap_set_bit (can_duplicate_bb, bb->index);
+}
+
+/* Return cached value of can_duplicate_bb_p for BB. */
+static bool
+cached_can_duplicate_bb_p (const_basic_block bb)
+{
+ if (can_duplicate_bb)
+ {
+ unsigned int size = SBITMAP_SIZE (can_duplicate_bb);
+ if ((unsigned int)bb->index < size)
+ return bitmap_bit_p (can_duplicate_bb, bb->index);
+
+ /* Assume added bb's should not be duplicated. */
+ return false;
+ }
+
+ return can_duplicate_block_p (bb);
+}
+
/* Return true if we should ignore the basic block for purposes of tracing. */
bool
ignore_bb_p (const_basic_block bb)
@@ -93,28 +120,13 @@ ignore_bb_p (const_basic_block bb)
if (optimize_bb_for_size_p (bb))
return true;
- if (gimple *g = last_stmt (CONST_CAST_BB (bb)))
- {
- /* A transaction is a single entry multiple exit region. It
- must be duplicated in its entirety or not at all. */
- if (gimple_code (g) == GIMPLE_TRANSACTION)
- return true;
-
- /* An IFN_UNIQUE call must be duplicated as part of its group,
- or not at all. */
- if (is_gimple_call (g)
- && gimple_call_internal_p (g)
- && gimple_call_internal_unique_p (g))
- return true;
- }
-
- return false;
+ return !cached_can_duplicate_bb_p (bb);
}
/* Return number of instructions in the block. */
-static int
-count_insns (basic_block bb)
+static void
+analyze_bb (basic_block bb, int *count)
{
gimple_stmt_iterator gsi;
gimple *stmt;
@@ -125,7 +137,9 @@ count_insns (basic_block bb)
stmt = gsi_stmt (gsi);
n += estimate_num_insns (stmt, &eni_size_weights);
}
- return n;
+ *count = n;
+
+ cache_can_duplicate_bb_p (bb, can_duplicate_block_p (CONST_CAST_BB (bb)));
}
/* Return true if E1 is more frequent than E2. */
@@ -273,6 +287,8 @@ tail_duplicate (void)
resize it. */
bb_seen = sbitmap_alloc (last_basic_block_for_fn (cfun) * 2);
bitmap_clear (bb_seen);
+ can_duplicate_bb = sbitmap_alloc (last_basic_block_for_fn (cfun));
+ bitmap_clear (can_duplicate_bb);
initialize_original_copy_tables ();
if (profile_info && profile_status_for_fn (cfun) == PROFILE_READ)
@@ -286,7 +302,8 @@ tail_duplicate (void)
FOR_EACH_BB_FN (bb, cfun)
{
- int n = count_insns (bb);
+ int n;
+ analyze_bb (bb, &n);
if (!ignore_bb_p (bb))
blocks[bb->index] = heap.insert (-bb->count.to_frequency (cfun), bb);
@@ -376,6 +393,8 @@ tail_duplicate (void)
free_original_copy_tables ();
sbitmap_free (bb_seen);
+ sbitmap_free (can_duplicate_bb);
+ can_duplicate_bb = NULL;
free (trace);
free (counts);
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index e466b24..e4f264d 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -51,6 +51,9 @@
#include "tree-ssa-address.h"
#include "stringpool.h"
#include "attribs.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
#define A_RUNINSTRUMENTEDCODE 0x0001
#define A_RUNUNINSTRUMENTEDCODE 0x0002
@@ -4729,7 +4732,8 @@ ipa_tm_mayenterirr_function (struct cgraph_node *node)
result in one of the bits above being set so that we will not
have to recurse next time. */
if (node->alias)
- return ipa_tm_mayenterirr_function (cgraph_node::get (node->thunk.alias));
+ return ipa_tm_mayenterirr_function
+ (cgraph_node::get (thunk_info::get (node)->alias));
/* What remains is unmarked local functions without items that force
the function to go irrevocable. */
@@ -5475,7 +5479,7 @@ ipa_tm_execute (void)
we need not scan the callees now, as the base will do. */
if (node->alias)
{
- node = cgraph_node::get (node->thunk.alias);
+ node = cgraph_node::get (thunk_info::get (node)->alias);
d = get_cg_data (&node, true);
maybe_push_queue (node, &tm_callees, &d->in_callee_queue);
continue;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 4064417..5139f11 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2888,35 +2888,6 @@ last_and_only_stmt (basic_block bb)
return NULL;
}
-/* Reinstall those PHI arguments queued in OLD_EDGE to NEW_EDGE. */
-
-static void
-reinstall_phi_args (edge new_edge, edge old_edge)
-{
- edge_var_map *vm;
- int i;
- gphi_iterator phis;
-
- vec<edge_var_map> *v = redirect_edge_var_map_vector (old_edge);
- if (!v)
- return;
-
- for (i = 0, phis = gsi_start_phis (new_edge->dest);
- v->iterate (i, &vm) && !gsi_end_p (phis);
- i++, gsi_next (&phis))
- {
- gphi *phi = phis.phi ();
- tree result = redirect_edge_var_map_result (vm);
- tree arg = redirect_edge_var_map_def (vm);
-
- gcc_assert (result == gimple_phi_result (phi));
-
- add_phi_arg (phi, arg, new_edge, redirect_edge_var_map_location (vm));
- }
-
- redirect_edge_var_map_clear (old_edge);
-}
-
/* Returns the basic block after which the new basic block created
by splitting edge EDGE_IN should be placed. Tries to keep the new block
near its "logical" location. This is of most help to humans looking
@@ -2956,11 +2927,24 @@ gimple_split_edge (edge edge_in)
new_bb = create_empty_bb (after_bb);
new_bb->count = edge_in->count ();
- e = redirect_edge_and_branch (edge_in, new_bb);
- gcc_assert (e == edge_in);
-
+ /* We want to avoid re-allocating PHIs when we first
+ add the fallthru edge from new_bb to dest but we also
+ want to avoid changing PHI argument order when
+ first redirecting edge_in away from dest. The former
+ avoids changing PHI argument order by adding them
+ last and then the redirection swapping it back into
+ place by means of unordered remove.
+ So hack around things by temporarily removing all PHIs
+ from the destination during the edge redirection and then
+ making sure the edges stay in order. */
+ gimple_seq saved_phis = phi_nodes (dest);
+ unsigned old_dest_idx = edge_in->dest_idx;
+ set_phi_nodes (dest, NULL);
new_edge = make_single_succ_edge (new_bb, dest, EDGE_FALLTHRU);
- reinstall_phi_args (new_edge, e);
+ e = redirect_edge_and_branch (edge_in, new_bb);
+ gcc_assert (e == edge_in && new_edge->dest_idx == old_dest_idx);
+ /* set_phi_nodes sets the BB of the PHI nodes, so do it manually here. */
+ dest->il.gimple.phi_nodes = saved_phis;
return new_bb;
}
@@ -3489,14 +3473,9 @@ verify_gimple_comparison (tree type, tree op0, tree op1, enum tree_code code)
/* For comparisons we do not have the operations type as the
effective type the comparison is carried out in. Instead
we require that either the first operand is trivially
- convertible into the second, or the other way around.
- Because we special-case pointers to void we allow
- comparisons of pointers with the same mode as well. */
+ convertible into the second, or the other way around. */
if (!useless_type_conversion_p (op0_type, op1_type)
- && !useless_type_conversion_p (op1_type, op0_type)
- && (!POINTER_TYPE_P (op0_type)
- || !POINTER_TYPE_P (op1_type)
- || TYPE_MODE (op0_type) != TYPE_MODE (op1_type)))
+ && !useless_type_conversion_p (op1_type, op0_type))
{
error ("mismatching comparison operand types");
debug_generic_expr (op0_type);
@@ -6211,8 +6190,44 @@ gimple_split_block_before_cond_jump (basic_block bb)
/* Return true if basic_block can be duplicated. */
static bool
-gimple_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED)
+gimple_can_duplicate_bb_p (const_basic_block bb)
{
+ gimple *last = last_stmt (CONST_CAST_BB (bb));
+
+ /* Do checks that can only fail for the last stmt, to minimize the work in the
+ stmt loop. */
+ if (last) {
+ /* A transaction is a single entry multiple exit region. It
+ must be duplicated in its entirety or not at all. */
+ if (gimple_code (last) == GIMPLE_TRANSACTION)
+ return false;
+
+ /* An IFN_UNIQUE call must be duplicated as part of its group,
+ or not at all. */
+ if (is_gimple_call (last)
+ && gimple_call_internal_p (last)
+ && gimple_call_internal_unique_p (last))
+ return false;
+ }
+
+ for (gimple_stmt_iterator gsi = gsi_start_bb (CONST_CAST_BB (bb));
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple *g = gsi_stmt (gsi);
+
+ /* An IFN_GOMP_SIMT_ENTER_ALLOC/IFN_GOMP_SIMT_EXIT call must be
+ duplicated as part of its group, or not at all.
+ The IFN_GOMP_SIMT_VOTE_ANY and IFN_GOMP_SIMT_XCHG_* are part of such a
+ group, so the same holds there. */
+ if (is_gimple_call (g)
+ && (gimple_call_internal_p (g, IFN_GOMP_SIMT_ENTER_ALLOC)
+ || gimple_call_internal_p (g, IFN_GOMP_SIMT_EXIT)
+ || gimple_call_internal_p (g, IFN_GOMP_SIMT_VOTE_ANY)
+ || gimple_call_internal_p (g, IFN_GOMP_SIMT_XCHG_BFLY)
+ || gimple_call_internal_p (g, IFN_GOMP_SIMT_XCHG_IDX)))
+ return false;
+ }
+
return true;
}
@@ -7220,6 +7235,8 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
free_stmt_operands (cfun, stmt);
push_cfun (dest_cfun);
update_stmt (stmt);
+ if (is_gimple_call (stmt))
+ notice_special_calls (as_a <gcall *> (stmt));
pop_cfun ();
}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 2e54bbb..f132e0f 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -569,7 +569,8 @@ set_component_ssa_name (tree ssa_name, bool imag_p, tree value)
{
/* Replace an anonymous base value with the variable from cvc_lookup.
This should result in better debug info. */
- if (SSA_NAME_VAR (ssa_name)
+ if (!SSA_NAME_IS_DEFAULT_DEF (value)
+ && SSA_NAME_VAR (ssa_name)
&& (!SSA_NAME_VAR (value) || DECL_IGNORED_P (SSA_NAME_VAR (value)))
&& !DECL_IGNORED_P (SSA_NAME_VAR (ssa_name)))
{
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 0e15878..752bec3 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1220,7 +1220,8 @@ struct GTY(()) tree_base {
all decls
CALL_FROM_THUNK_P and
- CALL_ALLOCA_FOR_VAR_P in
+ CALL_ALLOCA_FOR_VAR_P and
+ CALL_FROM_NEW_OR_DELETE_P in
CALL_EXPR
OMP_CLAUSE_LINEAR_VARIABLE_STRIDE in
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 5505ba4..3bf460c 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -754,7 +754,9 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1,
&& TYPE_PRECISION (type) >= TYPE_PRECISION (itype)
&& (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type)))
{
- if (INTEGRAL_TYPE_P (itype) && TYPE_OVERFLOW_WRAPS (itype))
+ if (INTEGRAL_TYPE_P (itype) && TYPE_OVERFLOW_WRAPS (itype)
+ && (TYPE_PRECISION (type) > TYPE_PRECISION (itype)
+ || TYPE_UNSIGNED (itype) != TYPE_UNSIGNED (type)))
{
/* Split the unconverted operand and try to prove that
wrapping isn't a problem. */
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 1376b82..c3314bb 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -899,26 +899,18 @@ lower_try_finally_dup_block (gimple_seq seq, struct leh_state *outer_state,
gtry *region = NULL;
gimple_seq new_seq;
gimple_stmt_iterator gsi;
- location_t last_loc = UNKNOWN_LOCATION;
new_seq = copy_gimple_seq_and_replace_locals (seq);
- for (gsi = gsi_last (new_seq); !gsi_end_p (gsi); gsi_prev (&gsi))
+ for (gsi = gsi_start (new_seq); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
- /* We duplicate __builtin_stack_restore at -O0 in the hope of eliminating
- it on the EH paths. When it is not eliminated, give it the next
- location in the sequence or make it transparent in the debug info. */
- if (gimple_call_builtin_p (stmt, BUILT_IN_STACK_RESTORE))
- gimple_set_location (stmt, last_loc);
- else if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
+ if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
{
tree block = gimple_block (stmt);
gimple_set_location (stmt, loc);
gimple_set_block (stmt, block);
}
- else
- last_loc = gimple_location (stmt);
}
if (outer_state->tf)
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 4b8d457..2062758 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2544,8 +2544,7 @@ combine_blocks (class loop *loop)
if (need_to_predicate)
predicate_statements (loop);
- /* Merge basic blocks: first remove all the edges in the loop,
- except for those from the exit block. */
+ /* Merge basic blocks. */
exit_bb = NULL;
bool *predicated = XNEWVEC (bool, orig_loop_num_nodes);
for (i = 0; i < orig_loop_num_nodes; i++)
@@ -2561,43 +2560,6 @@ combine_blocks (class loop *loop)
}
gcc_assert (exit_bb != loop->latch);
- for (i = 1; i < orig_loop_num_nodes; i++)
- {
- bb = ifc_bbs[i];
-
- for (ei = ei_start (bb->preds); (e = ei_safe_edge (ei));)
- {
- if (e->src == exit_bb)
- ei_next (&ei);
- else
- remove_edge (e);
- }
- }
-
- if (exit_bb != NULL)
- {
- if (exit_bb != loop->header)
- {
- /* Connect this node to loop header. */
- make_single_succ_edge (loop->header, exit_bb, EDGE_FALLTHRU);
- set_immediate_dominator (CDI_DOMINATORS, exit_bb, loop->header);
- }
-
- /* Redirect non-exit edges to loop->latch. */
- FOR_EACH_EDGE (e, ei, exit_bb->succs)
- {
- if (!loop_exit_edge_p (loop, e))
- redirect_edge_and_branch (e, loop->latch);
- }
- set_immediate_dominator (CDI_DOMINATORS, loop->latch, exit_bb);
- }
- else
- {
- /* If the loop does not have an exit, reconnect header and latch. */
- make_edge (loop->header, loop->latch, EDGE_FALLTHRU);
- set_immediate_dominator (CDI_DOMINATORS, loop->latch, loop->header);
- }
-
merge_target_bb = loop->header;
/* Get at the virtual def valid for uses starting at the first block
@@ -2682,13 +2644,9 @@ combine_blocks (class loop *loop)
last = gsi_last_bb (merge_target_bb);
gsi_insert_seq_after_without_update (&last, bb_seq (bb), GSI_NEW_STMT);
set_bb_seq (bb, NULL);
-
- delete_basic_block (bb);
}
- /* If possible, merge loop header to the block with the exit edge.
- This reduces the number of basic blocks to two, to please the
- vectorizer that handles only loops with two nodes. */
+ /* Fixup virtual operands in the exit block. */
if (exit_bb
&& exit_bb != loop->header)
{
@@ -2698,6 +2656,11 @@ combine_blocks (class loop *loop)
vphi = get_virtual_phi (exit_bb);
if (vphi)
{
+ /* When there's just loads inside the loop a stray virtual
+ PHI merging the uses can appear, update last_vdef from
+ it. */
+ if (!last_vdef)
+ last_vdef = gimple_phi_arg_def (vphi, 0);
imm_use_iterator iter;
use_operand_p use_p;
gimple *use_stmt;
@@ -2711,7 +2674,63 @@ combine_blocks (class loop *loop)
gimple_stmt_iterator gsi = gsi_for_stmt (vphi);
remove_phi_node (&gsi, true);
}
+ }
+
+ /* Now remove all the edges in the loop, except for those from the exit
+ block and delete the blocks we elided. */
+ for (i = 1; i < orig_loop_num_nodes; i++)
+ {
+ bb = ifc_bbs[i];
+
+ for (ei = ei_start (bb->preds); (e = ei_safe_edge (ei));)
+ {
+ if (e->src == exit_bb)
+ ei_next (&ei);
+ else
+ remove_edge (e);
+ }
+ }
+ for (i = 1; i < orig_loop_num_nodes; i++)
+ {
+ bb = ifc_bbs[i];
+
+ if (bb == exit_bb || bb == loop->latch)
+ continue;
+
+ delete_basic_block (bb);
+ }
+
+ /* Re-connect the exit block. */
+ if (exit_bb != NULL)
+ {
+ if (exit_bb != loop->header)
+ {
+ /* Connect this node to loop header. */
+ make_single_succ_edge (loop->header, exit_bb, EDGE_FALLTHRU);
+ set_immediate_dominator (CDI_DOMINATORS, exit_bb, loop->header);
+ }
+ /* Redirect non-exit edges to loop->latch. */
+ FOR_EACH_EDGE (e, ei, exit_bb->succs)
+ {
+ if (!loop_exit_edge_p (loop, e))
+ redirect_edge_and_branch (e, loop->latch);
+ }
+ set_immediate_dominator (CDI_DOMINATORS, loop->latch, exit_bb);
+ }
+ else
+ {
+ /* If the loop does not have an exit, reconnect header and latch. */
+ make_edge (loop->header, loop->latch, EDGE_FALLTHRU);
+ set_immediate_dominator (CDI_DOMINATORS, loop->latch, loop->header);
+ }
+
+ /* If possible, merge loop header to the block with the exit edge.
+ This reduces the number of basic blocks to two, to please the
+ vectorizer that handles only loops with two nodes. */
+ if (exit_bb
+ && exit_bb != loop->header)
+ {
if (can_merge_blocks_p (loop->header, exit_bb))
merge_blocks (loop->header, exit_bb);
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0d33ee7..32fb378 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -61,6 +61,9 @@ along with GCC; see the file COPYING3. If not see
#include "sreal.h"
#include "tree-cfgcleanup.h"
#include "tree-ssa-live.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
/* I'm not real happy about this, but we need to handle gimple and
non-gimple trees. */
@@ -4792,13 +4795,14 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
/* If callee is thunk, all we need is to adjust the THIS pointer
and redirect to function being thunked. */
- if (id->src_node->thunk.thunk_p)
+ if (id->src_node->thunk)
{
cgraph_edge *edge;
tree virtual_offset = NULL;
profile_count count = cg_edge->count;
tree op;
gimple_stmt_iterator iter = gsi_for_stmt (stmt);
+ thunk_info *info = thunk_info::get (id->src_node);
cgraph_edge::remove (cg_edge);
edge = id->src_node->callees->clone (id->dst_node, call_stmt,
@@ -4807,16 +4811,16 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
profile_count::one (),
true);
edge->count = count;
- if (id->src_node->thunk.virtual_offset_p)
- virtual_offset = size_int (id->src_node->thunk.virtual_value);
+ if (info->virtual_offset_p)
+ virtual_offset = size_int (info->virtual_value);
op = create_tmp_reg_fn (cfun, TREE_TYPE (gimple_call_arg (stmt, 0)),
NULL);
gsi_insert_before (&iter, gimple_build_assign (op,
gimple_call_arg (stmt, 0)),
GSI_NEW_STMT);
- gcc_assert (id->src_node->thunk.this_adjusting);
- op = thunk_adjust (&iter, op, 1, id->src_node->thunk.fixed_offset,
- virtual_offset, id->src_node->thunk.indirect_offset);
+ gcc_assert (info->this_adjusting);
+ op = thunk_adjust (&iter, op, 1, info->fixed_offset,
+ virtual_offset, info->indirect_offset);
gimple_call_set_arg (stmt, 0, op);
gimple_call_set_fndecl (stmt, edge->callee->decl);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 0d01613..1493b32 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
#include "asan.h"
+#include "attr-fnspec.h"
#define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
@@ -2492,19 +2493,19 @@ pass_build_ssa::execute (function *fun)
}
/* Initialize SSA_NAME_POINTS_TO_READONLY_MEMORY. */
- tree fnspec = lookup_attribute ("fn spec",
- TYPE_ATTRIBUTES (TREE_TYPE (fun->decl)));
- if (fnspec)
+ tree fnspec_tree
+ = lookup_attribute ("fn spec",
+ TYPE_ATTRIBUTES (TREE_TYPE (fun->decl)));
+ if (fnspec_tree)
{
- fnspec = TREE_VALUE (TREE_VALUE (fnspec));
- unsigned i = 1;
+ attr_fnspec fnspec (TREE_VALUE (TREE_VALUE (fnspec_tree)));
+ unsigned i = 0;
for (tree arg = DECL_ARGUMENTS (cfun->decl);
arg; arg = DECL_CHAIN (arg), ++i)
{
- if (i >= (unsigned) TREE_STRING_LENGTH (fnspec))
- break;
- if (TREE_STRING_POINTER (fnspec)[i] == 'R'
- || TREE_STRING_POINTER (fnspec)[i] == 'r')
+ if (!fnspec.arg_specified_p (i))
+ break;
+ if (fnspec.arg_readonly_p (i))
{
tree name = ssa_default_def (fun, arg);
if (name)
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index f74a727..788883f 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -42,7 +42,101 @@
#include "gimple-low.h"
#include "gomp-constants.h"
#include "diagnostic.h"
+#include "alloc-pool.h"
+#include "tree-nested.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
+
+/* Summary of nested functions. */
+static function_summary <nested_function_info *>
+ *nested_function_sum = NULL;
+
+/* Return nested_function_info, if available. */
+nested_function_info *
+nested_function_info::get (cgraph_node *node)
+{
+ if (!nested_function_sum)
+ return NULL;
+ return nested_function_sum->get (node);
+}
+
+/* Return nested_function_info possibly creating new one. */
+nested_function_info *
+nested_function_info::get_create (cgraph_node *node)
+{
+ if (!nested_function_sum)
+ nested_function_sum = new function_summary <nested_function_info *>
+ (symtab);
+ return nested_function_sum->get_create (node);
+}
+
+/* cgraph_node is no longer nested function; update cgraph accordingly. */
+void
+unnest_function (cgraph_node *node)
+{
+ nested_function_info *info = nested_function_info::get (node);
+ cgraph_node **node2 = &nested_function_info::get
+ (nested_function_origin (node))->nested;
+
+ gcc_checking_assert (info->origin);
+ while (*node2 != node)
+ node2 = &nested_function_info::get (*node2)->next_nested;
+ *node2 = info->next_nested;
+ info->next_nested = NULL;
+ info->origin = NULL;
+ nested_function_sum->remove (node);
+}
+/* Destructor: unlink function from nested function lists. */
+nested_function_info::~nested_function_info ()
+{
+ cgraph_node *next;
+ for (cgraph_node *n = nested; n; n = next)
+ {
+ nested_function_info *info = nested_function_info::get (n);
+ next = info->next_nested;
+ info->origin = NULL;
+ info->next_nested = NULL;
+ }
+ nested = NULL;
+ if (origin)
+ {
+ cgraph_node **node2
+ = &nested_function_info::get (origin)->nested;
+
+ nested_function_info *info;
+ while ((info = nested_function_info::get (*node2)) != this && info)
+ node2 = &info->next_nested;
+ *node2 = next_nested;
+ }
+}
+
+/* Free nested function info summaries. */
+void
+nested_function_info::release ()
+{
+ if (nested_function_sum)
+ delete (nested_function_sum);
+ nested_function_sum = NULL;
+}
+
+/* If NODE is nested function, record it. */
+void
+maybe_record_nested_function (cgraph_node *node)
+{
+ if (DECL_CONTEXT (node->decl)
+ && TREE_CODE (DECL_CONTEXT (node->decl)) == FUNCTION_DECL)
+ {
+ cgraph_node *origin = cgraph_node::get_create (DECL_CONTEXT (node->decl));
+ nested_function_info *info = nested_function_info::get_create (node);
+ nested_function_info *origin_info
+ = nested_function_info::get_create (origin);
+
+ info->origin = origin;
+ info->next_nested = origin_info->nested;
+ origin_info->nested = node;
+ }
+}
/* The object of this pass is to lower the representation of a set of nested
functions in order to expose all of the gory details of the various
@@ -586,7 +680,7 @@ lookup_element_for_decl (struct nesting_info *info, tree decl,
*slot = build_tree_list (NULL_TREE, NULL_TREE);
return (tree) *slot;
-}
+}
/* Given DECL, a nested function, create a field in the non-local
frame structure for this function. */
@@ -817,7 +911,8 @@ check_for_nested_with_variably_modified (tree fndecl, tree orig_fndecl)
struct cgraph_node *cgn = cgraph_node::get (fndecl);
tree arg;
- for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
+ for (cgn = first_nested_function (cgn); cgn;
+ cgn = next_nested_function (cgn))
{
for (arg = DECL_ARGUMENTS (cgn->decl); arg; arg = DECL_CHAIN (arg))
if (variably_modified_type_p (TREE_TYPE (arg), orig_fndecl))
@@ -843,9 +938,10 @@ create_nesting_tree (struct cgraph_node *cgn)
info->mem_refs = new hash_set<tree *>;
info->suppress_expansion = BITMAP_ALLOC (&nesting_info_bitmap_obstack);
info->context = cgn->decl;
- info->thunk_p = cgn->thunk.thunk_p;
+ info->thunk_p = cgn->thunk;
- for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
+ for (cgn = first_nested_function (cgn); cgn;
+ cgn = next_nested_function (cgn))
{
struct nesting_info *sub = create_nesting_tree (cgn);
sub->outer = info;
@@ -2952,7 +3048,7 @@ convert_all_function_calls (struct nesting_info *root)
if (n->thunk_p)
{
tree decl = n->context;
- tree alias = cgraph_node::get (decl)->thunk.alias;
+ tree alias = thunk_info::get (cgraph_node::get (decl))->alias;
DECL_STATIC_CHAIN (decl) = DECL_STATIC_CHAIN (alias);
}
@@ -2988,7 +3084,7 @@ convert_all_function_calls (struct nesting_info *root)
if (n->thunk_p)
{
tree decl = n->context;
- tree alias = cgraph_node::get (decl)->thunk.alias;
+ tree alias = thunk_info::get (cgraph_node::get (decl))->alias;
DECL_STATIC_CHAIN (decl) = DECL_STATIC_CHAIN (alias);
}
}
@@ -3498,9 +3594,9 @@ unnest_nesting_tree_1 (struct nesting_info *root)
/* For nested functions update the cgraph to reflect unnesting.
We also delay finalizing of these functions up to this point. */
- if (node->origin)
+ if (nested_function_info::get (node)->origin)
{
- node->unnest ();
+ unnest_function (node);
if (!root->thunk_p)
cgraph_node::finalize_function (root->context, true);
}
@@ -3541,8 +3637,9 @@ gimplify_all_functions (struct cgraph_node *root)
struct cgraph_node *iter;
if (!gimple_body (root->decl))
gimplify_function_tree (root->decl);
- for (iter = root->nested; iter; iter = iter->next_nested)
- if (!iter->thunk.thunk_p)
+ for (iter = first_nested_function (root); iter;
+ iter = next_nested_function (iter))
+ if (!iter->thunk)
gimplify_all_functions (iter);
}
@@ -3557,7 +3654,7 @@ lower_nested_functions (tree fndecl)
/* If there are no nested functions, there's nothing to do. */
cgn = cgraph_node::get (fndecl);
- if (!cgn->nested)
+ if (!first_nested_function (cgn))
return;
gimplify_all_functions (cgn);
diff --git a/gcc/tree-nested.h b/gcc/tree-nested.h
index 4ee56f4..bdef416 100644
--- a/gcc/tree-nested.h
+++ b/gcc/tree-nested.h
@@ -24,4 +24,66 @@ extern tree build_addr (tree);
extern void insert_field_into_struct (tree, tree);
extern void lower_nested_functions (tree);
+class nested_function_info
+{
+public:
+ /* Constructor. */
+ nested_function_info ()
+ : origin (NULL),
+ nested (NULL),
+ next_nested (NULL)
+ {
+ }
+ /* Copy constructor. We can not simply copy the structure,
+ because the linked lists would go wrong. However we should never
+ need that. */
+ nested_function_info (const nested_function_info &)
+ {
+ gcc_unreachable ();
+ }
+ ~nested_function_info ();
+
+ /* Return nested_function_info, if available. */
+ static nested_function_info *get (cgraph_node *node);
+
+ /* Return nested_function_info possibly creating new one. */
+ static nested_function_info *get_create (cgraph_node *node);
+
+ /* Release all nested_function_infos. */
+ static void release (void);
+
+ /* For nested functions points to function the node is nested in. */
+ cgraph_node *origin;
+ /* Points to first nested function, if any. */
+ cgraph_node *nested;
+ /* Pointer to the next function with same origin, if any. */
+ cgraph_node *next_nested;
+};
+
+extern void maybe_record_nested_function (cgraph_node *node);
+extern void unnest_function (cgraph_node *node);
+
+/* If there are functions nested in NODE, return first one. */
+inline cgraph_node *
+first_nested_function (cgraph_node *node)
+{
+ nested_function_info *info = nested_function_info::get (node);
+ return info ? info->nested : NULL;
+}
+
+/* Return next nested function (used to iterate from first_nested_function). */
+inline cgraph_node *
+next_nested_function (cgraph_node *node)
+{
+ return nested_function_info::get (node)->next_nested;
+}
+
+/* Return origin of nested function (and NULL otherwise). */
+inline cgraph_node *
+nested_function_origin (cgraph_node *node)
+{
+ nested_function_info *info = nested_function_info::get (node);
+ return info ? info->origin : NULL;
+}
+
#endif /* GCC_TREE_NESTED_H */
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 9d17a10..df757f7 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -315,8 +315,8 @@ dest_safe_for_nrv_p (gcall *call)
if (TREE_CODE (dest) == SSA_NAME)
return true;
- if (call_may_clobber_ref_p (call, dest)
- || ref_maybe_used_by_stmt_p (call, dest))
+ if (call_may_clobber_ref_p (call, dest, false)
+ || ref_maybe_used_by_stmt_p (call, dest, false))
return false;
return true;
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 62e5b69..1e8badf 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -519,8 +519,6 @@ extern ipa_opt_pass_d *make_pass_ipa_cdtor_merge (gcc::context *ctxt);
extern ipa_opt_pass_d *make_pass_ipa_single_use (gcc::context *ctxt);
extern ipa_opt_pass_d *make_pass_ipa_comdats (gcc::context *ctxt);
extern ipa_opt_pass_d *make_pass_ipa_modref (gcc::context *ctxt);
-extern simple_ipa_opt_pass *make_pass_materialize_all_clones (gcc::context *
- ctxt);
extern gimple_opt_pass *make_pass_cleanup_cfg_post_optimizing (gcc::context
*ctxt);
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index b1d6e63..7a5990a 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -737,13 +737,12 @@ static basic_block
last_always_executed_block (class loop *loop)
{
unsigned i;
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
edge ex;
basic_block last = loop->latch;
FOR_EACH_VEC_ELT (exits, i, ex)
last = nearest_common_dominator (CDI_DOMINATORS, last, ex->src);
- exits.release ();
return last;
}
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index ed6407c..64ac5ab 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1542,8 +1542,7 @@ dump_mem_ref (pretty_printer *pp, tree node, int spc, dump_flags_t flags)
dump_generic_node (pp, op1type, spc, flags | TDF_SLIM, false);
pp_right_paren (pp);
dump_generic_node (pp, op0, spc, flags, false);
- if (TREE_CODE (node) == MEM_REF
- && !integer_zerop (op1))
+ if (!integer_zerop (op1))
{
pp_string (pp, " + ");
dump_generic_node (pp, op1, spc, flags, false);
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 6c08382..07a6d99 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -55,6 +55,9 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "stor-layout.h"
#include "xregex.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-thunks.h"
static GTY(()) tree gcov_type_node;
static GTY(()) tree tree_interval_profiler_fn;
@@ -726,7 +729,7 @@ tree_profiling (void)
FOR_EACH_DEFINED_FUNCTION (node)
{
bool thunk = false;
- if (!gimple_has_body_p (node->decl) && !node->thunk.thunk_p)
+ if (!gimple_has_body_p (node->decl) && !node->thunk)
continue;
/* Don't profile functions produced for builtin stuff. */
@@ -747,7 +750,7 @@ tree_profiling (void)
if (!include_source_file_for_profile (file))
continue;
- if (node->thunk.thunk_p)
+ if (node->thunk)
{
/* We cannot expand variadic thunks to Gimple. */
if (stdarg_p (TREE_TYPE (node->decl)))
@@ -756,7 +759,7 @@ tree_profiling (void)
/* When generate profile, expand thunk to gimple so it can be
instrumented same way as other functions. */
if (profile_arc_flag)
- node->expand_thunk (false, true);
+ expand_thunk (node, false, true);
/* Read cgraph profile but keep function as thunk at profile-use
time. */
else
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index be4d446..877e499 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -40,6 +40,10 @@ along with GCC; see the file COPYING3. If not see
#include "varasm.h"
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
+#include "attr-fnspec.h"
+#include "errors.h"
+#include "dbgcnt.h"
+#include "gimple-pretty-print.h"
/* Broad overview of how alias analysis on gimple works:
@@ -114,6 +118,7 @@ static struct {
unsigned HOST_WIDE_INT modref_clobber_may_alias;
unsigned HOST_WIDE_INT modref_clobber_no_alias;
unsigned HOST_WIDE_INT modref_tests;
+ unsigned HOST_WIDE_INT modref_baseptr_tests;
} alias_stats;
void
@@ -169,14 +174,19 @@ dump_alias_stats (FILE *s)
+ alias_stats.modref_use_may_alias);
fprintf (s, " modref clobber: "
HOST_WIDE_INT_PRINT_DEC" disambiguations, "
- HOST_WIDE_INT_PRINT_DEC" queries\n "
- HOST_WIDE_INT_PRINT_DEC" tbaa querries (%f per modref querry)\n",
+ HOST_WIDE_INT_PRINT_DEC" queries\n"
+ " " HOST_WIDE_INT_PRINT_DEC" tbaa queries (%f per modref query)\n"
+ " " HOST_WIDE_INT_PRINT_DEC" base compares (%f per modref query)\n",
alias_stats.modref_clobber_no_alias,
alias_stats.modref_clobber_no_alias
+ alias_stats.modref_clobber_may_alias,
alias_stats.modref_tests,
((double)alias_stats.modref_tests)
/ (alias_stats.modref_clobber_no_alias
+ + alias_stats.modref_clobber_may_alias),
+ alias_stats.modref_baseptr_tests,
+ ((double)alias_stats.modref_baseptr_tests)
+ / (alias_stats.modref_clobber_no_alias
+ alias_stats.modref_clobber_may_alias));
}
@@ -729,14 +739,21 @@ ao_ref_alias_set (ao_ref *ref)
}
/* Init an alias-oracle reference representation from a gimple pointer
- PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE then the
- size is assumed to be unknown. The access is assumed to be only
- to or after of the pointer target, not before it. */
-
-void
-ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
+ PTR a range specified by OFFSET, SIZE and MAX_SIZE under the assumption
+ that RANGE_KNOWN is set.
+
+ The access is assumed to be only to or after of the pointer target adjusted
+ by the offset, not before it (even in the case RANGE_KNOWN is false). */
+
+static void
+ao_ref_init_from_ptr_and_range (ao_ref *ref, tree ptr,
+ bool range_known,
+ poly_int64 offset,
+ poly_int64 size,
+ poly_int64 max_size)
{
- poly_int64 t, size_hwi, extra_offset = 0;
+ poly_int64 t, extra_offset = 0;
+
ref->ref = NULL_TREE;
if (TREE_CODE (ptr) == SSA_NAME)
{
@@ -760,7 +777,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
ref->offset = BITS_PER_UNIT * t;
else
{
- size = NULL_TREE;
+ range_known = false;
ref->offset = 0;
ref->base = get_base_address (TREE_OPERAND (ptr, 0));
}
@@ -772,11 +789,12 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
ptr, null_pointer_node);
ref->offset = 0;
}
- ref->offset += extra_offset;
- if (size
- && poly_int_tree_p (size, &size_hwi)
- && coeffs_in_range_p (size_hwi, 0, HOST_WIDE_INT_MAX / BITS_PER_UNIT))
- ref->max_size = ref->size = size_hwi * BITS_PER_UNIT;
+ ref->offset += extra_offset + offset;
+ if (range_known)
+ {
+ ref->max_size = max_size;
+ ref->size = size;
+ }
else
ref->max_size = ref->size = -1;
ref->ref_alias_set = 0;
@@ -784,6 +802,26 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
ref->volatile_p = false;
}
+/* Init an alias-oracle reference representation from a gimple pointer
+ PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE then the
+ size is assumed to be unknown. The access is assumed to be only
+ to or after of the pointer target, not before it. */
+
+void
+ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
+{
+ poly_int64 size_hwi;
+ if (size
+ && poly_int_tree_p (size, &size_hwi)
+ && coeffs_in_range_p (size_hwi, 0, HOST_WIDE_INT_MAX / BITS_PER_UNIT))
+ {
+ size_hwi = size_hwi * BITS_PER_UNIT;
+ ao_ref_init_from_ptr_and_range (ref, ptr, true, 0, size_hwi, size_hwi);
+ }
+ else
+ ao_ref_init_from_ptr_and_range (ref, ptr, false, 0, -1, -1);
+}
+
/* S1 and S2 are TYPE_SIZE or DECL_SIZE. Compare them:
Return -1 if S1 < S2
Return 1 if S1 > S2
@@ -2423,16 +2461,20 @@ refs_output_dependent_p (tree store1, tree store2)
IF TBAA_P is true, use TBAA oracle. */
static bool
-modref_may_conflict (modref_tree <alias_set_type> *tt, ao_ref *ref, bool tbaa_p)
+modref_may_conflict (const gimple *stmt,
+ modref_tree <alias_set_type> *tt, ao_ref *ref, bool tbaa_p)
{
alias_set_type base_set, ref_set;
modref_base_node <alias_set_type> *base_node;
modref_ref_node <alias_set_type> *ref_node;
- size_t i, j;
+ size_t i, j, k;
if (tt->every_base)
return true;
+ if (!dbg_cnt (ipa_mod_ref))
+ return true;
+
base_set = ao_ref_base_alias_set (ref);
ref_set = ao_ref_alias_set (ref);
@@ -2440,37 +2482,91 @@ modref_may_conflict (modref_tree <alias_set_type> *tt, ao_ref *ref, bool tbaa_p)
int num_tests = 0, max_tests = param_modref_max_tests;
FOR_EACH_VEC_SAFE_ELT (tt->bases, i, base_node)
{
- if (base_node->every_ref)
- return true;
-
- if (!base_node->base)
- return true;
-
if (tbaa_p && flag_strict_aliasing)
{
+ if (num_tests >= max_tests)
+ return true;
+ alias_stats.modref_tests++;
if (!alias_sets_conflict_p (base_set, base_node->base))
continue;
- alias_stats.modref_tests++;
num_tests++;
}
- else
- return true;
- if (num_tests >= max_tests)
+
+ if (base_node->every_ref)
return true;
FOR_EACH_VEC_SAFE_ELT (base_node->refs, j, ref_node)
{
/* Do not repeat same test as before. */
- if (ref_set == base_set && base_node->base == ref_node->ref)
- return true;
- if (!flag_strict_aliasing)
- return true;
- if (alias_sets_conflict_p (ref_set, ref_node->ref))
- return true;
- alias_stats.modref_tests++;
- num_tests++;
- if (num_tests >= max_tests)
+ if ((ref_set != base_set || base_node->base != ref_node->ref)
+ && tbaa_p && flag_strict_aliasing)
+ {
+ if (num_tests >= max_tests)
+ return true;
+ alias_stats.modref_tests++;
+ if (!alias_sets_conflict_p (ref_set, ref_node->ref))
+ continue;
+ num_tests++;
+ }
+
+ /* TBAA checks did not disambiguate, try to use base pointer, for
+ that we however need to have ref->ref or ref->base. */
+ if (ref_node->every_access || (!ref->ref && !ref->base))
return true;
+
+ modref_access_node *access_node;
+ FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node)
+ {
+ if (num_tests >= max_tests)
+ return true;
+
+ if (access_node->parm_index == -1
+ || (unsigned)access_node->parm_index
+ >= gimple_call_num_args (stmt))
+ return true;
+
+ alias_stats.modref_baseptr_tests++;
+
+ tree arg = gimple_call_arg (stmt, access_node->parm_index);
+
+ if (integer_zerop (arg) && flag_delete_null_pointer_checks)
+ continue;
+
+ if (!POINTER_TYPE_P (TREE_TYPE (arg)))
+ return true;
+
+ /* ao_ref_init_from_ptr_and_range assumes that memory access
+ starts by the pointed to location. If we did not track the
+ offset it is possible that it starts before the actual
+ pointer. */
+ if (!access_node->parm_offset_known)
+ {
+ if (ptr_deref_may_alias_ref_p_1 (arg, ref))
+ return true;
+ }
+ else
+ {
+ ao_ref ref2;
+ poly_offset_int off = (poly_offset_int)access_node->offset
+ + ((poly_offset_int)access_node->parm_offset
+ << LOG2_BITS_PER_UNIT);
+ poly_int64 off2;
+ if (off.to_shwi (&off2))
+ {
+ ao_ref_init_from_ptr_and_range
+ (&ref2, arg, true, off2,
+ access_node->size,
+ access_node->max_size);
+ ref2.ref_alias_set = ref_set;
+ ref2.base_alias_set = base_set;
+ if (refs_may_alias_p_1 (&ref2, ref, tbaa_p))
+ return true;
+ }
+ else if (ptr_deref_may_alias_ref_p_1 (arg, ref))
+ return true;
+ }
+ num_tests++;
+ }
}
}
return false;
@@ -2510,18 +2606,28 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
modref_summary *summary = get_modref_function_summary (node);
if (summary)
{
- if (!modref_may_conflict (summary->loads, ref, tbaa_p))
+ if (!modref_may_conflict (call, summary->loads, ref, tbaa_p))
{
alias_stats.modref_use_no_alias++;
if (dump_file && (dump_flags & TDF_DETAILS))
{
- fprintf (dump_file, "ipa-modref: in %s,"
- " call to %s does not use ",
- cgraph_node::get
- (current_function_decl)->dump_name (),
+ fprintf (dump_file,
+ "ipa-modref: call stmt ");
+ print_gimple_stmt (dump_file, call, 0);
+ fprintf (dump_file,
+ "ipa-modref: call to %s does not use ",
node->dump_name ());
- print_generic_expr (dump_file, ref->ref);
- fprintf (dump_file, " %i->%i\n",
+ if (!ref->ref && ref->base)
+ {
+ fprintf (dump_file, "base: ");
+ print_generic_expr (dump_file, ref->base);
+ }
+ else if (ref->ref)
+ {
+ fprintf (dump_file, "ref: ");
+ print_generic_expr (dump_file, ref->ref);
+ }
+ fprintf (dump_file, " alias sets: %i->%i\n",
ao_ref_base_alias_set (ref),
ao_ref_alias_set (ref));
}
@@ -2934,19 +3040,28 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
modref_summary *summary = get_modref_function_summary (node);
if (summary)
{
- if (!modref_may_conflict (summary->stores, ref, tbaa_p))
+ if (!modref_may_conflict (call, summary->stores, ref, tbaa_p))
{
alias_stats.modref_clobber_no_alias++;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file,
- "ipa-modref: in %s, "
- "call to %s does not clobber ",
- cgraph_node::get
- (current_function_decl)->dump_name (),
+ "ipa-modref: call stmt ");
+ print_gimple_stmt (dump_file, call, 0);
+ fprintf (dump_file,
+ "ipa-modref: call to %s does not clobber ",
node->dump_name ());
- print_generic_expr (dump_file, ref->ref);
- fprintf (dump_file, " %i->%i\n",
+ if (!ref->ref && ref->base)
+ {
+ fprintf (dump_file, "base: ");
+ print_generic_expr (dump_file, ref->base);
+ }
+ else if (ref->ref)
+ {
+ fprintf (dump_file, "ref: ");
+ print_generic_expr (dump_file, ref->ref);
+ }
+ fprintf (dump_file, " alias sets: %i->%i\n",
ao_ref_base_alias_set (ref),
ao_ref_alias_set (ref));
}
@@ -3225,12 +3340,12 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
return true, otherwise return false. */
bool
-call_may_clobber_ref_p (gcall *call, tree ref)
+call_may_clobber_ref_p (gcall *call, tree ref, bool tbaa_p)
{
bool res;
ao_ref r;
ao_ref_init (&r, ref);
- res = call_may_clobber_ref_p_1 (call, &r, true);
+ res = call_may_clobber_ref_p_1 (call, &r, tbaa_p);
if (res)
++alias_stats.call_may_clobber_ref_p_may_alias;
else
@@ -3957,3 +4072,49 @@ walk_aliased_vdefs (ao_ref *ref, tree vdef,
return ret;
}
+/* Verify validity of the fnspec string.
+ See attr-fnspec.h for details. */
+
+void
+attr_fnspec::verify ()
+{
+ bool err = false;
+
+ /* Check return value specifier. */
+ if (len < return_desc_size)
+ err = true;
+ else if ((len - return_desc_size) % arg_desc_size)
+ err = true;
+ else if ((str[0] < '1' || str[0] > '4')
+ && str[0] != '.' && str[0] != 'm'
+ /* FIXME: Fortran trans-decl.c contains multiple wrong fnspec
+ strings. The following characters have no meaning. */
+ && str[0] != 'R' && str[0] != 'W')
+ err = true;
+
+ if (str[1] != ' ')
+ err = true;
+
+ /* Now check all parameters. */
+ for (unsigned int i = 0; arg_specified_p (i); i++)
+ {
+ unsigned int idx = arg_idx (i);
+ switch (str[idx])
+ {
+ case 'x':
+ case 'X':
+ case 'r':
+ case 'R':
+ case 'w':
+ case 'W':
+ case '.':
+ break;
+ default:
+ err = true;
+ }
+ if (str[idx + 1] != ' ')
+ err = true;
+ }
+ if (err)
+ internal_error ("invalid fn spec attribute \"%s\"", str);
+}
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index 1dd02c0..1561ead 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -128,7 +128,7 @@ extern bool ref_maybe_used_by_stmt_p (gimple *, ao_ref *, bool = true);
extern bool stmt_may_clobber_global_p (gimple *);
extern bool stmt_may_clobber_ref_p (gimple *, tree, bool = true);
extern bool stmt_may_clobber_ref_p_1 (gimple *, ao_ref *, bool = true);
-extern bool call_may_clobber_ref_p (gcall *, tree);
+extern bool call_may_clobber_ref_p (gcall *, tree, bool = true);
extern bool call_may_clobber_ref_p_1 (gcall *, ao_ref *, bool = true);
extern bool stmt_kills_ref_p (gimple *, tree);
extern bool stmt_kills_ref_p (gimple *, ao_ref *);
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 65dffe0..0432fe5 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -946,7 +946,7 @@ do_dbg_cnt (void)
class ccp_folder : public substitute_and_fold_engine
{
public:
- tree get_value (tree, gimple *) FINAL OVERRIDE;
+ tree value_of_expr (tree, gimple *) FINAL OVERRIDE;
bool fold_stmt (gimple_stmt_iterator *) FINAL OVERRIDE;
};
@@ -955,7 +955,7 @@ class ccp_folder : public substitute_and_fold_engine
of calling member functions. */
tree
-ccp_folder::get_value (tree op, gimple *stmt ATTRIBUTE_UNUSED)
+ccp_folder::value_of_expr (tree op, gimple *)
{
return get_constant_value (op);
}
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 9bcb708..3d77982 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -492,13 +492,13 @@ init_copy_prop (void)
class copy_folder : public substitute_and_fold_engine
{
public:
- tree get_value (tree, gimple *) FINAL OVERRIDE;
+ tree value_of_expr (tree name, gimple *) FINAL OVERRIDE;
};
/* Callback for substitute_and_fold to get at the final copy-of values. */
tree
-copy_folder::get_value (tree name, gimple *stmt ATTRIBUTE_UNUSED)
+copy_folder::value_of_expr (tree name, gimple *)
{
tree val;
if (SSA_NAME_VERSION (name) >= n_copy_of)
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index fae5ae7..a046612 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -593,9 +593,9 @@ mark_all_reaching_defs_necessary_1 (ao_ref *ref ATTRIBUTE_UNUSED,
/* We want to skip statments that do not constitute stores but have
a virtual definition. */
- if (is_gimple_call (def_stmt))
+ if (gcall *call = dyn_cast <gcall *> (def_stmt))
{
- tree callee = gimple_call_fndecl (def_stmt);
+ tree callee = gimple_call_fndecl (call);
if (callee != NULL_TREE
&& fndecl_built_in_p (callee, BUILT_IN_NORMAL))
switch (DECL_FUNCTION_CODE (callee))
@@ -612,7 +612,8 @@ mark_all_reaching_defs_necessary_1 (ao_ref *ref ATTRIBUTE_UNUSED,
if (callee != NULL_TREE
&& (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee)
- || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee)))
+ || DECL_IS_OPERATOR_DELETE_P (callee))
+ && gimple_call_from_new_or_delete (call))
return false;
}
@@ -875,23 +876,25 @@ propagate_necessity (bool aggressive)
processing the argument. */
bool is_delete_operator
= (is_gimple_call (stmt)
- && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt)));
+ && gimple_call_from_new_or_delete (as_a <gcall *> (stmt))
+ && gimple_call_operator_delete_p (as_a <gcall *> (stmt)));
if (is_delete_operator
|| gimple_call_builtin_p (stmt, BUILT_IN_FREE))
{
tree ptr = gimple_call_arg (stmt, 0);
- gimple *def_stmt;
+ gcall *def_stmt;
tree def_callee;
/* If the pointer we free is defined by an allocation
function do not add the call to the worklist. */
if (TREE_CODE (ptr) == SSA_NAME
- && is_gimple_call (def_stmt = SSA_NAME_DEF_STMT (ptr))
+ && (def_stmt = dyn_cast <gcall *> (SSA_NAME_DEF_STMT (ptr)))
&& (def_callee = gimple_call_fndecl (def_stmt))
&& ((DECL_BUILT_IN_CLASS (def_callee) == BUILT_IN_NORMAL
&& (DECL_FUNCTION_CODE (def_callee) == BUILT_IN_ALIGNED_ALLOC
|| DECL_FUNCTION_CODE (def_callee) == BUILT_IN_MALLOC
|| DECL_FUNCTION_CODE (def_callee) == BUILT_IN_CALLOC))
- || DECL_IS_REPLACEABLE_OPERATOR_NEW_P (def_callee)))
+ || (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (def_callee)
+ && gimple_call_from_new_or_delete (def_stmt))))
{
if (is_delete_operator)
{
@@ -947,9 +950,9 @@ propagate_necessity (bool aggressive)
in 1). By keeping a global visited bitmap for references
we walk for 2) we avoid quadratic behavior for those. */
- if (is_gimple_call (stmt))
+ if (gcall *call = dyn_cast <gcall *> (stmt))
{
- tree callee = gimple_call_fndecl (stmt);
+ tree callee = gimple_call_fndecl (call);
unsigned i;
/* Calls to functions that are merely acting as barriers
@@ -972,22 +975,23 @@ propagate_necessity (bool aggressive)
if (callee != NULL_TREE
&& (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee)
- || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee)))
+ || DECL_IS_OPERATOR_DELETE_P (callee))
+ && gimple_call_from_new_or_delete (call))
continue;
/* Calls implicitly load from memory, their arguments
in addition may explicitly perform memory loads. */
- mark_all_reaching_defs_necessary (stmt);
- for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ mark_all_reaching_defs_necessary (call);
+ for (i = 0; i < gimple_call_num_args (call); ++i)
{
- tree arg = gimple_call_arg (stmt, i);
+ tree arg = gimple_call_arg (call, i);
if (TREE_CODE (arg) == SSA_NAME
|| is_gimple_min_invariant (arg))
continue;
if (TREE_CODE (arg) == WITH_SIZE_EXPR)
arg = TREE_OPERAND (arg, 0);
if (!ref_may_be_aliased (arg))
- mark_aliased_reaching_defs_necessary (stmt, arg);
+ mark_aliased_reaching_defs_necessary (call, arg);
}
}
else if (gimple_assign_single_p (stmt))
@@ -1397,7 +1401,8 @@ eliminate_unnecessary_stmts (void)
if (gimple_plf (stmt, STMT_NECESSARY)
&& (gimple_call_builtin_p (stmt, BUILT_IN_FREE)
|| (is_gimple_call (stmt)
- && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt)))))
+ && gimple_call_from_new_or_delete (as_a <gcall *> (stmt))
+ && gimple_call_operator_delete_p (as_a <gcall *> (stmt)))))
{
tree ptr = gimple_call_arg (stmt, 0);
if (TREE_CODE (ptr) == SSA_NAME)
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index de5025f..c21bfe9 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1500,7 +1500,7 @@ dom_opt_dom_walker::before_dom_children (basic_block bb)
void
dom_opt_dom_walker::after_dom_children (basic_block bb)
{
- x_vr_values = evrp_range_analyzer.get_vr_values ();
+ x_vr_values = &evrp_range_analyzer;
thread_outgoing_edges (bb, m_dummy_cond, m_const_and_copies,
m_avail_exprs_stack,
&evrp_range_analyzer,
@@ -1970,7 +1970,7 @@ dom_opt_dom_walker::optimize_stmt (basic_block bb, gimple_stmt_iterator *si,
opt_stats.num_stmts++;
/* Const/copy propagate into USES, VUSES and the RHS of VDEFs. */
- cprop_into_stmt (stmt, evrp_range_analyzer.get_vr_values ());
+ cprop_into_stmt (stmt, &evrp_range_analyzer);
/* If the statement has been modified with constant replacements,
fold its RHS before checking for redundant computations. */
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index b9002d8..1f3d932 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -425,7 +425,8 @@ ch_base::copy_headers (function *fun)
if (!gimple_duplicate_sese_region (entry, exit, bbs, n_bbs, copied_bbs,
true))
{
- fprintf (dump_file, "Duplication failed.\n");
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Duplication failed.\n");
continue;
}
copied.safe_push (std::make_pair (entry, loop));
@@ -504,14 +505,13 @@ ch_base::copy_headers (function *fun)
{
edge entry = copied[i].first;
loop_p loop = copied[i].second;
- vec<edge> exit_edges = get_loop_exit_edges (loop);
+ auto_vec<edge> exit_edges = get_loop_exit_edges (loop);
bitmap exit_bbs = BITMAP_ALLOC (NULL);
for (unsigned j = 0; j < exit_edges.length (); ++j)
bitmap_set_bit (exit_bbs, exit_edges[j]->dest->index);
bitmap_set_bit (exit_bbs, loop->header->index);
do_rpo_vn (cfun, entry, exit_bbs);
BITMAP_FREE (exit_bbs);
- exit_edges.release ();
}
}
free (bbs);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index f87c287..6bb07e1 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2232,9 +2232,11 @@ sm_seq_push_down (vec<seq_entry> &seq, unsigned ptr, unsigned *at)
|| (against.second == sm_other && against.from != NULL_TREE))
/* Found the tail of the sequence. */
break;
- if (!refs_independent_p (memory_accesses.refs_list[new_cand.first],
- memory_accesses.refs_list[against.first],
- false))
+ /* We may not ignore self-dependences here. */
+ if (new_cand.first == against.first
+ || !refs_independent_p (memory_accesses.refs_list[new_cand.first],
+ memory_accesses.refs_list[against.first],
+ false))
/* ??? Prune new_cand from the list of refs to apply SM to. */
return false;
std::swap (new_cand, against);
@@ -2866,7 +2868,7 @@ loop_suitable_for_sm (class loop *loop ATTRIBUTE_UNUSED,
static void
store_motion_loop (class loop *loop, bitmap sm_executed)
{
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
class loop *subloop;
bitmap sm_in_loop = BITMAP_ALLOC (&lim_bitmap_obstack);
@@ -2876,7 +2878,6 @@ store_motion_loop (class loop *loop, bitmap sm_executed)
if (!bitmap_empty_p (sm_in_loop))
hoist_memory_references (loop, sm_in_loop, exits);
}
- exits.release ();
bitmap_ior_into (sm_executed, sm_in_loop);
for (subloop = loop->inner; subloop != NULL; subloop = subloop->next)
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 298ab21..5bb781d 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -444,7 +444,6 @@ estimated_unrolled_size (struct loop_size *size,
static edge
loop_edge_to_cancel (class loop *loop)
{
- vec<edge> exits;
unsigned i;
edge edge_to_cancel;
gimple_stmt_iterator gsi;
@@ -453,7 +452,7 @@ loop_edge_to_cancel (class loop *loop)
if (EDGE_COUNT (loop->latch->preds) > 1)
return NULL;
- exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
FOR_EACH_VEC_ELT (exits, i, edge_to_cancel)
{
@@ -477,8 +476,6 @@ loop_edge_to_cancel (class loop *loop)
if (edge_to_cancel->dest != loop->latch)
continue;
- exits.release ();
-
/* Verify that the code in loop latch does nothing that may end program
execution without really reaching the exit. This may include
non-pure/const function calls, EH statements, volatile ASMs etc. */
@@ -487,7 +484,6 @@ loop_edge_to_cancel (class loop *loop)
return NULL;
return edge_to_cancel;
}
- exits.release ();
return NULL;
}
@@ -1222,10 +1218,9 @@ canonicalize_loop_induction_variables (class loop *loop,
by find_loop_niter_by_eval. Be sure to keep it for future. */
if (niter && TREE_CODE (niter) == INTEGER_CST)
{
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
record_niter_bound (loop, wi::to_widest (niter),
exit == single_likely_exit (loop, exits), true);
- exits.release ();
}
/* Force re-computation of loop bounds so we can remove redundant exits. */
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 5acf044..da04dd5 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -7947,6 +7947,9 @@ analyze_and_mark_doloop_use (struct ivopts_data *data)
if (!flag_branch_on_count_reg)
return;
+ if (data->current_loop->unroll == USHRT_MAX)
+ return;
+
if (!generic_predict_doloop_p (data))
return;
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index a2717a4..cdd1ac7 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -368,11 +368,10 @@ get_loops_exits (bitmap *loop_exits)
FOR_EACH_LOOP (loop, 0)
{
- vec<edge> exit_edges = get_loop_exit_edges (loop);
+ auto_vec<edge> exit_edges = get_loop_exit_edges (loop);
loop_exits[loop->num] = BITMAP_ALLOC (&loop_renamer_obstack);
FOR_EACH_VEC_ELT (exit_edges, j, e)
bitmap_set_bit (loop_exits[loop->num], e->dest->index);
- exit_edges.release ();
}
}
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index b3647d9e..697d30f 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2752,7 +2752,7 @@ tree
find_loop_niter (class loop *loop, edge *exit)
{
unsigned i;
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
edge ex;
tree niter = NULL_TREE, aniter;
class tree_niter_desc desc;
@@ -2803,7 +2803,6 @@ find_loop_niter (class loop *loop, edge *exit)
continue;
}
}
- exits.release ();
return niter ? niter : chrec_dont_know;
}
@@ -2837,21 +2836,18 @@ finite_loop_p (class loop *loop)
if (loop->finite_p)
{
unsigned i;
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
edge ex;
/* If the loop has a normal exit, we can assume it will terminate. */
FOR_EACH_VEC_ELT (exits, i, ex)
if (!(ex->flags & (EDGE_EH | EDGE_ABNORMAL | EDGE_FAKE)))
{
- exits.release ();
if (dump_file)
fprintf (dump_file, "Assume loop %i to be finite: it has an exit "
"and -ffinite-loops is on.\n", loop->num);
return true;
}
-
- exits.release ();
}
return false;
@@ -3114,7 +3110,7 @@ tree
find_loop_niter_by_eval (class loop *loop, edge *exit)
{
unsigned i;
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
edge ex;
tree niter = NULL_TREE, aniter;
@@ -3123,10 +3119,7 @@ find_loop_niter_by_eval (class loop *loop, edge *exit)
/* Loops with multiple exits are expensive to handle and less important. */
if (!flag_expensive_optimizations
&& exits.length () > 1)
- {
- exits.release ();
- return chrec_dont_know;
- }
+ return chrec_dont_know;
FOR_EACH_VEC_ELT (exits, i, ex)
{
@@ -3144,7 +3137,6 @@ find_loop_niter_by_eval (class loop *loop, edge *exit)
niter = aniter;
*exit = ex;
}
- exits.release ();
return niter ? niter : chrec_dont_know;
}
@@ -4236,7 +4228,6 @@ get_upper_bound_based_on_builtin_expr_with_prob (gcond *cond)
void
estimate_numbers_of_iterations (class loop *loop)
{
- vec<edge> exits;
tree niter, type;
unsigned i;
class tree_niter_desc niter_desc;
@@ -4275,7 +4266,7 @@ estimate_numbers_of_iterations (class loop *loop)
number_of_latch_executions (loop);
basic_block *body = get_loop_body (loop);
- exits = get_loop_exit_edges (loop, body);
+ auto_vec<edge> exits = get_loop_exit_edges (loop, body);
likely_exit = single_likely_exit (loop, exits);
FOR_EACH_VEC_ELT (exits, i, ex)
{
@@ -4311,10 +4302,10 @@ estimate_numbers_of_iterations (class loop *loop)
true, ex == likely_exit, true);
record_control_iv (loop, &niter_desc);
}
- exits.release ();
if (flag_aggressive_loop_optimizations)
infer_loop_bounds_from_undefined (loop, body);
+ free (body);
discover_iteration_bound_by_body_walk (loop);
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index d19ece6..5e94a19 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -1289,7 +1289,7 @@ mark_nontemporal_store (struct mem_ref *ref)
static void
emit_mfence_after_loop (class loop *loop)
{
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
edge exit;
gcall *call;
gimple_stmt_iterator bsi;
@@ -1309,7 +1309,6 @@ emit_mfence_after_loop (class loop *loop)
gsi_insert_before (&bsi, call, GSI_NEW_STMT);
}
- exits.release ();
update_ssa (TODO_update_ssa_only_virtuals);
}
@@ -1327,7 +1326,7 @@ may_use_storent_in_loop_p (class loop *loop)
is a suitable place for it at each of the loop exits. */
if (FENCE_FOLLOWING_MOVNT != NULL_TREE)
{
- vec<edge> exits = get_loop_exit_edges (loop);
+ auto_vec<edge> exits = get_loop_exit_edges (loop);
unsigned i;
edge exit;
@@ -1335,8 +1334,6 @@ may_use_storent_in_loop_p (class loop *loop)
if ((exit->flags & EDGE_ABNORMAL)
&& exit->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
ret = false;
-
- exits.release ();
}
return ret;
diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index 1eb6be5..46ee7c0 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -977,6 +977,9 @@ ssa_semi_invariant_p (struct loop *loop, tree name,
if (!def_bb || !flow_bb_inside_loop_p (loop, def_bb))
return true;
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))
+ return false;
+
return stmt_semi_invariant_p_1 (loop, def, skip_head, stmt_stat);
}
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 8423caa..90dfb98 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1139,7 +1139,7 @@ execute_cse_sincos_1 (tree name)
{
gimple_stmt_iterator gsi;
imm_use_iterator use_iter;
- tree fndecl, res, type;
+ tree fndecl, res, type = NULL_TREE;
gimple *def_stmt, *use_stmt, *stmt;
int seen_cos = 0, seen_sin = 0, seen_cexpi = 0;
auto_vec<gimple *> stmts;
@@ -1147,7 +1147,6 @@ execute_cse_sincos_1 (tree name)
int i;
bool cfg_changed = false;
- type = TREE_TYPE (name);
FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name)
{
if (gimple_code (use_stmt) != GIMPLE_CALL
@@ -1169,9 +1168,21 @@ execute_cse_sincos_1 (tree name)
break;
default:;
+ continue;
}
- }
+ tree t = mathfn_built_in_type (gimple_call_combined_fn (use_stmt));
+ if (!type)
+ {
+ type = t;
+ t = TREE_TYPE (name);
+ }
+ /* This checks that NAME has the right type in the first round,
+ and, in subsequent rounds, that the built_in type is the same
+ type, or a compatible type. */
+ if (type != t && !types_compatible_p (type, t))
+ return false;
+ }
if (seen_cos + seen_sin + seen_cexpi <= 1)
return false;
@@ -2176,12 +2187,14 @@ pass_cse_sincos::execute (function *fun)
CASE_CFN_COS:
CASE_CFN_SIN:
CASE_CFN_CEXPI:
+ arg = gimple_call_arg (stmt, 0);
/* Make sure we have either sincos or cexp. */
- if (!targetm.libc_has_function (function_c99_math_complex)
- && !targetm.libc_has_function (function_sincos))
+ if (!targetm.libc_has_function (function_c99_math_complex,
+ TREE_TYPE (arg))
+ && !targetm.libc_has_function (function_sincos,
+ TREE_TYPE (arg)))
break;
- arg = gimple_call_arg (stmt, 0);
if (TREE_CODE (arg) == SSA_NAME)
cfg_changed |= execute_cse_sincos_1 (arg);
break;
@@ -3565,9 +3578,24 @@ divmod_candidate_p (gassign *stmt)
/* Disable the transform if either is a constant, since division-by-constant
may have specialized expansion. */
- if (CONSTANT_CLASS_P (op1) || CONSTANT_CLASS_P (op2))
+ if (CONSTANT_CLASS_P (op1))
return false;
+ if (CONSTANT_CLASS_P (op2))
+ {
+ if (integer_pow2p (op2))
+ return false;
+
+ if (TYPE_PRECISION (type) <= HOST_BITS_PER_WIDE_INT
+ && TYPE_PRECISION (type) <= BITS_PER_WORD)
+ return false;
+
+ /* If the divisor is not power of 2 and the precision wider than
+ HWI, expand_divmod punts on that, so in that case it is better
+ to use divmod optab or libfunc. Similarly if choose_multiplier
+ might need pre/post shifts of BITS_PER_WORD or more. */
+ }
+
/* Exclude the case where TYPE_OVERFLOW_TRAPS (type) as that should
expand using the [su]divv optabs. */
if (TYPE_OVERFLOW_TRAPS (type))
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index b97f863..aa6bb88 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "case-cfn-macros.h"
#include "tree-eh.h"
#include "gimple-fold.h"
+#include "internal-fn.h"
static unsigned int tree_ssa_phiopt_worker (bool, bool, bool);
static bool two_value_replacement (basic_block, basic_block, edge, gphi *,
@@ -61,8 +62,9 @@ static bool minmax_replacement (basic_block, basic_block,
edge, edge, gimple *, tree, tree);
static bool abs_replacement (basic_block, basic_block,
edge, edge, gimple *, tree, tree);
-static bool cond_removal_in_popcount_pattern (basic_block, basic_block,
- edge, edge, gimple *, tree, tree);
+static bool cond_removal_in_popcount_clz_ctz_pattern (basic_block, basic_block,
+ edge, edge, gimple *,
+ tree, tree);
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);
@@ -344,8 +346,9 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
else if (abs_replacement (bb, bb1, e1, e2, phi, arg0, arg1))
cfgchanged = true;
else if (!early_p
- && cond_removal_in_popcount_pattern (bb, bb1, e1, e2,
- phi, arg0, arg1))
+ && cond_removal_in_popcount_clz_ctz_pattern (bb, bb1, e1,
+ e2, phi, arg0,
+ arg1))
cfgchanged = true;
else if (minmax_replacement (bb, bb1, e1, e2, phi, arg0, arg1))
cfgchanged = true;
@@ -1777,16 +1780,20 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
<bb 4>
c_12 = PHI <_9(2)>
-*/
+
+ Similarly for __builtin_clz or __builtin_ctz if
+ C?Z_DEFINED_VALUE_AT_ZERO is 2, optab is present and
+ instead of 0 above it uses the value from that macro. */
static bool
-cond_removal_in_popcount_pattern (basic_block cond_bb, basic_block middle_bb,
- edge e1, edge e2,
- gimple *phi, tree arg0, tree arg1)
+cond_removal_in_popcount_clz_ctz_pattern (basic_block cond_bb,
+ basic_block middle_bb,
+ edge e1, edge e2, gimple *phi,
+ tree arg0, tree arg1)
{
gimple *cond;
gimple_stmt_iterator gsi, gsi_from;
- gimple *popcount;
+ gimple *call;
gimple *cast = NULL;
tree lhs, arg;
@@ -1804,35 +1811,67 @@ cond_removal_in_popcount_pattern (basic_block cond_bb, basic_block middle_bb,
gsi_next_nondebug (&gsi);
if (!gsi_end_p (gsi))
{
- popcount = gsi_stmt (gsi);
+ call = gsi_stmt (gsi);
gsi_next_nondebug (&gsi);
if (!gsi_end_p (gsi))
return false;
}
else
{
- popcount = cast;
+ call = cast;
cast = NULL;
}
- /* Check that we have a popcount builtin. */
- if (!is_gimple_call (popcount))
+ /* Check that we have a popcount/clz/ctz builtin. */
+ if (!is_gimple_call (call) || gimple_call_num_args (call) != 1)
return false;
- combined_fn cfn = gimple_call_combined_fn (popcount);
+
+ arg = gimple_call_arg (call, 0);
+ lhs = gimple_get_lhs (call);
+
+ if (lhs == NULL_TREE)
+ return false;
+
+ combined_fn cfn = gimple_call_combined_fn (call);
+ internal_fn ifn = IFN_LAST;
+ int val = 0;
switch (cfn)
{
CASE_CFN_POPCOUNT:
break;
+ CASE_CFN_CLZ:
+ if (INTEGRAL_TYPE_P (TREE_TYPE (arg)))
+ {
+ tree type = TREE_TYPE (arg);
+ if (direct_internal_fn_supported_p (IFN_CLZ, type, OPTIMIZE_FOR_BOTH)
+ && CLZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (type),
+ val) == 2)
+ {
+ ifn = IFN_CLZ;
+ break;
+ }
+ }
+ return false;
+ CASE_CFN_CTZ:
+ if (INTEGRAL_TYPE_P (TREE_TYPE (arg)))
+ {
+ tree type = TREE_TYPE (arg);
+ if (direct_internal_fn_supported_p (IFN_CTZ, type, OPTIMIZE_FOR_BOTH)
+ && CTZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (type),
+ val) == 2)
+ {
+ ifn = IFN_CTZ;
+ break;
+ }
+ }
+ return false;
default:
return false;
}
- arg = gimple_call_arg (popcount, 0);
- lhs = gimple_get_lhs (popcount);
-
if (cast)
{
- /* We have a cast stmt feeding popcount builtin. */
+ /* We have a cast stmt feeding popcount/clz/ctz builtin. */
/* Check that we have a cast prior to that. */
if (gimple_code (cast) != GIMPLE_ASSIGN
|| !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (cast)))
@@ -1845,7 +1884,7 @@ cond_removal_in_popcount_pattern (basic_block cond_bb, basic_block middle_bb,
cond = last_stmt (cond_bb);
- /* Cond_bb has a check for b_4 [!=|==] 0 before calling the popcount
+ /* Cond_bb has a check for b_4 [!=|==] 0 before calling the popcount/clz/ctz
builtin. */
if (gimple_code (cond) != GIMPLE_COND
|| (gimple_cond_code (cond) != NE_EXPR
@@ -1865,10 +1904,13 @@ cond_removal_in_popcount_pattern (basic_block cond_bb, basic_block middle_bb,
}
/* Check PHI arguments. */
- if (lhs != arg0 || !integer_zerop (arg1))
+ if (lhs != arg0
+ || TREE_CODE (arg1) != INTEGER_CST
+ || wi::to_wide (arg1) != val)
return false;
- /* And insert the popcount builtin and cast stmt before the cond_bb. */
+ /* And insert the popcount/clz/ctz builtin and cast stmt before the
+ cond_bb. */
gsi = gsi_last_bb (cond_bb);
if (cast)
{
@@ -1876,9 +1918,19 @@ cond_removal_in_popcount_pattern (basic_block cond_bb, basic_block middle_bb,
gsi_move_before (&gsi_from, &gsi);
reset_flow_sensitive_info (gimple_get_lhs (cast));
}
- gsi_from = gsi_for_stmt (popcount);
- gsi_move_before (&gsi_from, &gsi);
- reset_flow_sensitive_info (gimple_get_lhs (popcount));
+ gsi_from = gsi_for_stmt (call);
+ if (ifn == IFN_LAST || gimple_call_internal_p (call))
+ gsi_move_before (&gsi_from, &gsi);
+ else
+ {
+ /* For __builtin_c[lt]z* force .C[LT]Z ifn, because only
+ the latter is well defined at zero. */
+ call = gimple_build_call_internal (ifn, 1, gimple_call_arg (call, 0));
+ gimple_call_set_lhs (call, lhs);
+ gsi_insert_before (&gsi, call, GSI_SAME_STMT);
+ gsi_remove (&gsi_from, true);
+ }
+ reset_flow_sensitive_info (lhs);
/* Now update the PHI and remove unneeded bbs. */
replace_phi_edge_with_variable (cond_bb, e2, phi, lhs);
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 5a30176d..87dbf55 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -868,7 +868,7 @@ substitute_and_fold_engine::replace_uses_in (gimple *stmt)
FOR_EACH_SSA_USE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
tree tuse = USE_FROM_PTR (use);
- tree val = get_value (tuse, stmt);
+ tree val = value_of_expr (tuse, stmt);
if (val == tuse || val == NULL_TREE)
continue;
@@ -909,12 +909,11 @@ substitute_and_fold_engine::replace_phi_args_in (gphi *phi)
if (TREE_CODE (arg) == SSA_NAME)
{
- tree val = get_value (arg, phi);
+ edge e = gimple_phi_arg_edge (phi, i);
+ tree val = value_on_edge (e, arg);
if (val && val != arg && may_propagate_copy (arg, val))
{
- edge e = gimple_phi_arg_edge (phi, i);
-
if (TREE_CODE (val) != SSA_NAME)
prop_stats.num_const_prop++;
else
@@ -1036,7 +1035,7 @@ substitute_and_fold_engine::propagate_into_phi_args (basic_block bb)
if (TREE_CODE (arg) != SSA_NAME
|| virtual_operand_p (arg))
continue;
- tree val = get_value (arg, phi);
+ tree val = value_on_edge (e, arg);
if (val
&& is_gimple_min_invariant (val)
&& may_propagate_copy (arg, val))
@@ -1070,7 +1069,7 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
}
if (res && TREE_CODE (res) == SSA_NAME)
{
- tree sprime = substitute_and_fold_engine->get_value (res, phi);
+ tree sprime = substitute_and_fold_engine->value_of_expr (res, phi);
if (sprime
&& sprime != res
&& may_propagate_copy (res, sprime))
@@ -1110,7 +1109,7 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb)
tree lhs = gimple_get_lhs (stmt);
if (lhs && TREE_CODE (lhs) == SSA_NAME)
{
- tree sprime = substitute_and_fold_engine->get_value (lhs, stmt);
+ tree sprime = substitute_and_fold_engine->value_of_expr (lhs, stmt);
if (sprime
&& sprime != lhs
&& may_propagate_copy (lhs, sprime)
diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h
index 9406cdf..da362ab 100644
--- a/gcc/tree-ssa-propagate.h
+++ b/gcc/tree-ssa-propagate.h
@@ -22,6 +22,8 @@ along with GCC; see the file COPYING3. If not see
#ifndef _TREE_SSA_PROPAGATE_H
#define _TREE_SSA_PROPAGATE_H 1
+#include "value-query.h"
+
/* If SIM_P is true, statement S will be simulated again. */
static inline void
@@ -97,14 +99,13 @@ class ssa_propagation_engine
void simulate_block (basic_block);
};
-class substitute_and_fold_engine
+class substitute_and_fold_engine : public value_query
{
public:
substitute_and_fold_engine (bool fold_all_stmts = false)
: fold_all_stmts (fold_all_stmts) { }
virtual ~substitute_and_fold_engine (void) { }
virtual bool fold_stmt (gimple_stmt_iterator *) { return false; }
- virtual tree get_value (tree, gimple *) { return NULL_TREE; }
bool substitute_and_fold (basic_block = NULL);
bool replace_uses_in (gimple *);
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index facc794..a2ca171 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3910,7 +3910,7 @@ ovce_extract_ops (tree var, gassign **rets, bool *reti, tree *type,
return ERROR_MARK;
gassign *assign = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (cond));
- if (stmt == NULL
+ if (assign == NULL
|| TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) != tcc_comparison)
return ERROR_MARK;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 014b7bd..c139adb 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -2586,7 +2586,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
if (valueized_anything)
{
bool res = call_may_clobber_ref_p_1 (as_a <gcall *> (def_stmt),
- ref);
+ ref, data->tbaa_p);
for (unsigned i = 0; i < gimple_call_num_args (def_stmt); ++i)
gimple_call_set_arg (def_stmt, i, oldargs[i]);
if (!res)
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index 4cc5195..207aae2 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -369,10 +369,9 @@ statement_sink_location (gimple *stmt, basic_block frombb,
return false;
/* If this is a load then do not sink past any stores.
- ??? This is overly simple but cheap. We basically look
- for an existing load with the same VUSE in the path to one
- of the sink candidate blocks and we adjust commondom to the
- nearest to commondom. */
+ Look for virtual definitions in the path from frombb to the sink
+ location computed from the real uses and if found, adjust
+ that it a common dominator. */
if (gimple_vuse (stmt))
{
/* Do not sink loads from hard registers. */
@@ -383,29 +382,35 @@ statement_sink_location (gimple *stmt, basic_block frombb,
imm_use_iterator imm_iter;
use_operand_p use_p;
- basic_block found = NULL;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, gimple_vuse (stmt))
{
gimple *use_stmt = USE_STMT (use_p);
basic_block bb = gimple_bb (use_stmt);
- /* For PHI nodes the block we know sth about
- is the incoming block with the use. */
+ /* For PHI nodes the block we know sth about is the incoming block
+ with the use. */
if (gimple_code (use_stmt) == GIMPLE_PHI)
- bb = EDGE_PRED (bb, PHI_ARG_INDEX_FROM_USE (use_p))->src;
- /* Any dominator of commondom would be ok with
- adjusting commondom to that block. */
- bb = nearest_common_dominator (CDI_DOMINATORS, bb, commondom);
- if (!found)
- found = bb;
- else if (dominated_by_p (CDI_DOMINATORS, bb, found))
- found = bb;
- /* If we can't improve, stop. */
- if (found == commondom)
- break;
+ {
+ /* In case the PHI node post-dominates the current insert location
+ we can disregard it. But make sure it is not dominating
+ it as well as can happen in a CFG cycle. */
+ if (commondom != bb
+ && !dominated_by_p (CDI_DOMINATORS, commondom, bb)
+ && dominated_by_p (CDI_POST_DOMINATORS, commondom, bb))
+ continue;
+ bb = EDGE_PRED (bb, PHI_ARG_INDEX_FROM_USE (use_p))->src;
+ }
+ else if (!gimple_vdef (use_stmt))
+ continue;
+ /* If the use is not dominated by the path entry it is not on
+ the path. */
+ if (!dominated_by_p (CDI_DOMINATORS, bb, frombb))
+ continue;
+ /* There is no easy way to disregard defs not on the path from
+ frombb to commondom so just consider them all. */
+ commondom = nearest_common_dominator (CDI_DOMINATORS, bb, commondom);
+ if (commondom == frombb)
+ return false;
}
- commondom = found;
- if (commondom == frombb)
- return false;
}
/* Our common dominator has to be dominated by frombb in order to be a
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 47f537a..ebb17cd 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -200,7 +200,8 @@ static void handle_builtin_stxncpy_strncat (bool, gimple_stmt_iterator *);
to determine the range, otherwise get_range_info. */
tree
-get_range (tree val, wide_int minmax[2], const vr_values *rvals /* = NULL */)
+get_range (tree val, gimple *stmt, wide_int minmax[2],
+ range_query *rvals /* = NULL */)
{
if (TREE_CODE (val) == INTEGER_CST)
{
@@ -211,28 +212,36 @@ get_range (tree val, wide_int minmax[2], const vr_values *rvals /* = NULL */)
if (TREE_CODE (val) != SSA_NAME)
return NULL_TREE;
- if (rvals)
- {
- /* The range below may be "inaccurate" if a constant has been
- substituted earlier for VAL by this pass that hasn't been
- propagated through the CFG. This shoud be fixed by the new
- on-demand VRP if/when it becomes available (hopefully in
- GCC 11). */
- const value_range *vr
- = (CONST_CAST (class vr_values *, rvals)->get_value_range (val));
- value_range_kind rng = vr->kind ();
- if (rng != VR_RANGE || !range_int_cst_p (vr))
+ if (rvals && stmt)
+ {
+ value_range vr;
+ if (!rvals->range_of_expr (vr, val, stmt))
+ return NULL_TREE;
+ value_range_kind rng = vr.kind ();
+ if (rng != VR_RANGE)
return NULL_TREE;
- minmax[0] = wi::to_wide (vr->min ());
- minmax[1] = wi::to_wide (vr->max ());
+ minmax[0] = wi::to_wide (vr.min ());
+ minmax[1] = wi::to_wide (vr.max ());
return val;
}
value_range_kind rng = get_range_info (val, minmax, minmax + 1);
if (rng == VR_RANGE)
+ /* This may be an inverted range whose MINMAX[1] < MINMAX[0]. */
return val;
+ if (rng == VR_ANTI_RANGE)
+ {
+ /* An anti-range is the same as an ordinary range with inverted
+ bounds (where MINMAX[1] < MINMAX[0] is true) that may result
+ from the conversion of a signed anti-range to unsigned. */
+ wide_int tmp = minmax[0];
+ minmax[0] = minmax[1] + 1;
+ minmax[1] = wi::sub (tmp, 1);
+ return val;
+ }
+
/* Do not handle anti-ranges and instead make use of the on-demand
VRP if/when it becomes available (hopefully in GCC 11). */
return NULL_TREE;
@@ -263,7 +272,7 @@ compare_nonzero_chars (strinfo *si, unsigned HOST_WIDE_INT off)
static int
compare_nonzero_chars (strinfo *si, unsigned HOST_WIDE_INT off,
- const vr_values *rvals)
+ range_query *rvals)
{
if (!si->nonzero_chars)
return -1;
@@ -274,20 +283,19 @@ compare_nonzero_chars (strinfo *si, unsigned HOST_WIDE_INT off,
if (!rvals || TREE_CODE (si->nonzero_chars) != SSA_NAME)
return -1;
- const value_range_equiv *vr
- = (CONST_CAST (class vr_values *, rvals)
- ->get_value_range (si->nonzero_chars));
-
- value_range_kind rng = vr->kind ();
- if (rng != VR_RANGE || !range_int_cst_p (vr))
+ value_range vr;
+ if (!rvals->range_of_expr (vr, si->nonzero_chars, si->stmt))
+ return -1;
+ value_range_kind rng = vr.kind ();
+ if (rng != VR_RANGE)
return -1;
/* If the offset is less than the minimum length or if the bounds
of the length range are equal return the result of the comparison
same as in the constant case. Otherwise return a conservative
result. */
- int cmpmin = compare_tree_int (vr->min (), off);
- if (cmpmin > 0 || tree_int_cst_equal (vr->min (), vr->max ()))
+ int cmpmin = compare_tree_int (vr.min (), off);
+ if (cmpmin > 0 || tree_int_cst_equal (vr.min (), vr.max ()))
return cmpmin;
return -1;
@@ -332,7 +340,7 @@ get_next_strinfo (strinfo *si)
static int
get_addr_stridx (tree exp, tree ptr, unsigned HOST_WIDE_INT *offset_out,
- const vr_values *rvals = NULL)
+ range_query *rvals = NULL)
{
HOST_WIDE_INT off;
struct stridxlist *list, *last = NULL;
@@ -392,7 +400,7 @@ get_addr_stridx (tree exp, tree ptr, unsigned HOST_WIDE_INT *offset_out,
When nonnull, uses RVALS to determine range information. */
static int
-get_stridx (tree exp, wide_int offrng[2] = NULL, const vr_values *rvals = NULL)
+get_stridx (tree exp, wide_int offrng[2] = NULL, range_query *rvals = NULL)
{
if (offrng)
offrng[0] = offrng[1] = wi::zero (TYPE_PRECISION (ptrdiff_type_node));
@@ -474,7 +482,7 @@ get_stridx (tree exp, wide_int offrng[2] = NULL, const vr_values *rvals = NULL)
return the index corresponding to the SSA_NAME.
Do this irrespective of the whether the offset
is known. */
- if (get_range (off, offrng, rvals))
+ if (get_range (off, def_stmt, offrng, rvals))
{
/* When the offset range is known, increment it
it by the constant offset computed in prior
@@ -864,11 +872,11 @@ get_string_length (strinfo *si)
}
/* Dump strlen data to FP for statement STMT. When non-null, RVALS
- points to EVRP info and is used to dump strlen range for non-constant
- results. */
+ points to the valuation engine used to calculate ranges, and is
+ used to dump strlen range for non-constant results. */
DEBUG_FUNCTION void
-dump_strlen_info (FILE *fp, gimple *stmt, const vr_values *rvals)
+dump_strlen_info (FILE *fp, gimple *stmt, range_query *rvals)
{
if (stmt)
{
@@ -909,14 +917,14 @@ dump_strlen_info (FILE *fp, gimple *stmt, const vr_values *rvals)
wide_int min, max;
if (rvals)
{
- const value_range *vr
- = CONST_CAST (class vr_values *, rvals)
- ->get_value_range (si->nonzero_chars);
- rng = vr->kind ();
- if (range_int_cst_p (vr))
+ value_range vr;
+ rvals->range_of_expr (vr, si->nonzero_chars,
+ si->stmt);
+ rng = vr.kind ();
+ if (range_int_cst_p (&vr))
{
- min = wi::to_wide (vr->min ());
- max = wi::to_wide (vr->max ());
+ min = wi::to_wide (vr.min ());
+ max = wi::to_wide (vr.max ());
}
else
rng = VR_UNDEFINED;
@@ -1004,13 +1012,14 @@ dump_strlen_info (FILE *fp, gimple *stmt, const vr_values *rvals)
/* Attempt to determine the length of the string SRC. On success, store
the length in *PDATA and return true. Otherwise, return false.
- VISITED is a bitmap of visited PHI nodes. RVALS points to EVRP info
- and PSSA_DEF_MAX to an SSA_NAME assignment limit used to prevent runaway
- recursion. */
+ VISITED is a bitmap of visited PHI nodes. RVALS points to the valuation
+ engine used to calculate ranges. PSSA_DEF_MAX to an SSA_NAME
+ assignment limit used to prevent runaway recursion. */
static bool
-get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
- const vr_values *rvals, unsigned *pssa_def_max)
+get_range_strlen_dynamic (tree src, gimple *stmt,
+ c_strlen_data *pdata, bitmap *visited,
+ range_query *rvals, unsigned *pssa_def_max)
{
int idx = get_stridx (src);
if (!idx)
@@ -1042,8 +1051,8 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
continue;
c_strlen_data argdata = { };
- if (get_range_strlen_dynamic (arg, &argdata, visited, rvals,
- pssa_def_max))
+ if (get_range_strlen_dynamic (arg, phi, &argdata, visited,
+ rvals, pssa_def_max))
{
/* Set the DECL of an unterminated array this argument
refers to if one hasn't been found yet. */
@@ -1110,14 +1119,12 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
pdata->minlen = si->nonzero_chars;
else if (TREE_CODE (si->nonzero_chars) == SSA_NAME)
{
- const value_range_equiv *vr
- = CONST_CAST (class vr_values *, rvals)
- ->get_value_range (si->nonzero_chars);
- if (vr->kind () == VR_RANGE
- && range_int_cst_p (vr))
+ value_range vr;
+ rvals->range_of_expr (vr, si->nonzero_chars, si->stmt);
+ if (range_int_cst_p (&vr))
{
- pdata->minlen = vr->min ();
- pdata->maxlen = vr->max ();
+ pdata->minlen = vr.min ();
+ pdata->maxlen = vr.max ();
}
else
pdata->minlen = build_zero_cst (size_type_node);
@@ -1156,14 +1163,12 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
}
else if (pdata->minlen && TREE_CODE (pdata->minlen) == SSA_NAME)
{
- const value_range_equiv *vr
- = CONST_CAST (class vr_values *, rvals)
- ->get_value_range (si->nonzero_chars);
- if (vr->kind () == VR_RANGE
- && range_int_cst_p (vr))
+ value_range vr;
+ rvals->range_of_expr (vr, si->nonzero_chars, stmt);
+ if (range_int_cst_p (&vr))
{
- pdata->minlen = vr->min ();
- pdata->maxlen = vr->max ();
+ pdata->minlen = vr.min ();
+ pdata->maxlen = vr.max ();
pdata->maxbound = pdata->maxlen;
}
else
@@ -1198,17 +1203,17 @@ get_range_strlen_dynamic (tree src, c_strlen_data *pdata, bitmap *visited,
Try to obtain the range of the lengths of the string(s) referenced
by SRC, or the size of the largest array SRC refers to if the range
of lengths cannot be determined, and store all in *PDATA. RVALS
- points to EVRP info. */
+ points to the valuation engine used to calculate ranges. */
void
-get_range_strlen_dynamic (tree src, c_strlen_data *pdata,
- const vr_values *rvals)
+get_range_strlen_dynamic (tree src, gimple *stmt, c_strlen_data *pdata,
+ range_query *rvals)
{
bitmap visited = NULL;
tree maxbound = pdata->maxbound;
unsigned limit = param_ssa_name_def_chain_limit;
- if (!get_range_strlen_dynamic (src, pdata, &visited, rvals, &limit))
+ if (!get_range_strlen_dynamic (src, stmt, pdata, &visited, rvals, &limit))
{
/* On failure extend the length range to an impossible maximum
(a valid MAXLEN must be less than PTRDIFF_MAX - 1). Other
@@ -1803,6 +1808,7 @@ set_strlen_range (tree lhs, wide_int min, wide_int max,
else if (TREE_CODE (bound) == SSA_NAME)
{
wide_int minbound, maxbound;
+ // FIXME: Use range_query instead of global ranges.
value_range_kind rng = get_range_info (bound, &minbound, &maxbound);
if (rng == VR_RANGE)
{
@@ -1907,7 +1913,7 @@ maybe_set_strlen_range (tree lhs, tree src, tree bound)
static void
maybe_warn_overflow (gimple *stmt, tree len,
- const vr_values *rvals = NULL,
+ range_query *rvals = NULL,
strinfo *si = NULL, bool plus_one = false,
bool rawmem = false)
{
@@ -1959,7 +1965,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
tree off = TREE_OPERAND (ref, 1);
ref = TREE_OPERAND (ref, 0);
wide_int rng[2];
- if (get_range (off, rng, rvals))
+ if (get_range (off, stmt, rng, rvals))
{
/* Convert offsets to the maximum precision. */
offrng[0] = widest_int::from (rng[0], SIGNED);
@@ -1977,7 +1983,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
tree mem_off = TREE_OPERAND (ref, 1);
ref = TREE_OPERAND (ref, 0);
wide_int rng[2];
- if (get_range (mem_off, rng, rvals))
+ if (get_range (mem_off, stmt, rng, rvals))
{
offrng[0] += widest_int::from (rng[0], SIGNED);
offrng[1] += widest_int::from (rng[1], SIGNED);
@@ -2049,7 +2055,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
}
wide_int rng[2];
- if (get_range (destsize, rng, rvals))
+ if (get_range (destsize, stmt, rng, rvals))
{
sizrng[0] = widest_int::from (rng[0], UNSIGNED);
sizrng[1] = widest_int::from (rng[1], UNSIGNED);
@@ -2080,7 +2086,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
return;
wide_int rng[2];
- if (!get_range (len, rng, rvals))
+ if (!get_range (len, stmt, rng, rvals))
return;
widest_int lenrng[2] =
@@ -2231,7 +2237,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
if (destoff)
{
wide_int rng[2];
- if (get_range (destoff, rng))
+ if (get_range (destoff, stmt, rng))
{
offrng[0] = widest_int::from (rng[0], SIGNED);
offrng[1] = widest_int::from (rng[1], SIGNED);
@@ -2249,7 +2255,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
sprintf (offstr, "[%lli, %lli]",
(long long) offrng[0].to_shwi (), (long long) offrng[1].to_shwi ());
- if (destdecl)
+ if (destdecl && DECL_P (destdecl))
{
if (tree size = DECL_SIZE_UNIT (destdecl))
inform (DECL_SOURCE_LOCATION (destdecl),
@@ -2339,7 +2345,7 @@ maybe_warn_overflow (gimple *stmt, tree len,
static inline void
maybe_warn_overflow (gimple *stmt, unsigned HOST_WIDE_INT len,
- const vr_values *rvals = NULL, strinfo *si = NULL,
+ range_query *rvals = NULL, strinfo *si = NULL,
bool plus_one = false, bool rawmem = false)
{
maybe_warn_overflow (stmt, build_int_cst (size_type_node, len), rvals,
@@ -2642,7 +2648,7 @@ handle_builtin_strchr (gimple_stmt_iterator *gsi)
static void
handle_builtin_strcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi,
- const vr_values *rvals)
+ range_query *rvals)
{
int idx, didx;
tree src, dst, srclen, len, lhs, type, fn, oldlen;
@@ -3036,6 +3042,7 @@ maybe_diag_stxncpy_trunc (gimple_stmt_iterator gsi, tree src, tree cnt)
cntrange[0] = cntrange[1] = wi::to_wide (cnt);
else if (TREE_CODE (cnt) == SSA_NAME)
{
+ // FIXME: Use range_query instead of global ranges.
enum value_range_kind rng = get_range_info (cnt, cntrange, cntrange + 1);
if (rng == VR_RANGE)
;
@@ -3444,7 +3451,7 @@ handle_builtin_stxncpy_strncat (bool append_p, gimple_stmt_iterator *gsi)
static void
handle_builtin_memcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi,
- const vr_values *rvals)
+ range_query *rvals)
{
tree lhs, oldlen, newlen;
gimple *stmt = gsi_stmt (*gsi);
@@ -3909,7 +3916,7 @@ handle_alloc_call (enum built_in_function bcode, gimple_stmt_iterator *gsi)
static bool
handle_builtin_memset (gimple_stmt_iterator *gsi, bool *zero_write,
- const vr_values *rvals)
+ range_query *rvals)
{
gimple *memset_stmt = gsi_stmt (*gsi);
tree ptr = gimple_call_arg (memset_stmt, 0);
@@ -4103,9 +4110,10 @@ handle_builtin_memcmp (gimple_stmt_iterator *gsi)
determine range information. Returns true on success. */
static bool
-get_len_or_size (tree arg, int idx, unsigned HOST_WIDE_INT lenrng[2],
+get_len_or_size (gimple *stmt, tree arg, int idx,
+ unsigned HOST_WIDE_INT lenrng[2],
unsigned HOST_WIDE_INT *size, bool *nulterm,
- const vr_values *rvals)
+ range_query *rvals)
{
/* Invalidate. */
*size = HOST_WIDE_INT_M1U;
@@ -4140,6 +4148,7 @@ get_len_or_size (tree arg, int idx, unsigned HOST_WIDE_INT lenrng[2],
else if (TREE_CODE (si->nonzero_chars) == SSA_NAME)
{
wide_int min, max;
+ // FIXME: Use range_query instead of global ranges.
value_range_kind rng = get_range_info (si->nonzero_chars, &min, &max);
if (rng == VR_RANGE)
{
@@ -4158,7 +4167,7 @@ get_len_or_size (tree arg, int idx, unsigned HOST_WIDE_INT lenrng[2],
/* Set MAXBOUND to an arbitrary non-null non-integer node as a request
to have it set to the length of the longest string in a PHI. */
lendata.maxbound = arg;
- get_range_strlen_dynamic (arg, &lendata, rvals);
+ get_range_strlen_dynamic (arg, stmt, &lendata, rvals);
unsigned HOST_WIDE_INT maxbound = HOST_WIDE_INT_M1U;
if (tree_fits_uhwi_p (lendata.maxbound)
@@ -4216,17 +4225,17 @@ get_len_or_size (tree arg, int idx, unsigned HOST_WIDE_INT lenrng[2],
Otherwise return null. */
static tree
-strxcmp_eqz_result (tree arg1, int idx1, tree arg2, int idx2,
+strxcmp_eqz_result (gimple *stmt, tree arg1, int idx1, tree arg2, int idx2,
unsigned HOST_WIDE_INT bound, unsigned HOST_WIDE_INT len[2],
- unsigned HOST_WIDE_INT *psize, const vr_values *rvals)
+ unsigned HOST_WIDE_INT *psize, range_query *rvals)
{
/* Determine the range the length of each string is in and whether it's
known to be nul-terminated, or the size of the array it's stored in. */
bool nul1, nul2;
unsigned HOST_WIDE_INT siz1, siz2;
unsigned HOST_WIDE_INT len1rng[2], len2rng[2];
- if (!get_len_or_size (arg1, idx1, len1rng, &siz1, &nul1, rvals)
- || !get_len_or_size (arg2, idx2, len2rng, &siz2, &nul2, rvals))
+ if (!get_len_or_size (stmt, arg1, idx1, len1rng, &siz1, &nul1, rvals)
+ || !get_len_or_size (stmt, arg2, idx2, len2rng, &siz2, &nul2, rvals))
return NULL_TREE;
/* BOUND is set to HWI_M1U for strcmp and less to strncmp, and LENiRNG
@@ -4375,7 +4384,7 @@ maybe_warn_pointless_strcmp (gimple *stmt, HOST_WIDE_INT bound,
another and false otherwise. */
static bool
-handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals)
+handle_builtin_string_cmp (gimple_stmt_iterator *gsi, range_query *rvals)
{
gcall *stmt = as_a <gcall *> (gsi_stmt (*gsi));
tree lhs = gimple_call_lhs (stmt);
@@ -4420,7 +4429,7 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals)
/* Try to determine if the two strings are either definitely equal
or definitely unequal and if so, either fold the result to zero
(when equal) or set the range of the result to ~[0, 0] otherwise. */
- if (tree eqz = strxcmp_eqz_result (arg1, idx1, arg2, idx2, bound,
+ if (tree eqz = strxcmp_eqz_result (stmt, arg1, idx1, arg2, idx2, bound,
len, &siz, rvals))
{
if (integer_zerop (eqz))
@@ -4457,8 +4466,9 @@ handle_builtin_string_cmp (gimple_stmt_iterator *gsi, const vr_values *rvals)
unsigned HOST_WIDE_INT arsz1, arsz2;
bool nulterm[2];
- if (!get_len_or_size (arg1, idx1, len1rng, &arsz1, nulterm, rvals)
- || !get_len_or_size (arg2, idx2, len2rng, &arsz2, nulterm + 1, rvals))
+ if (!get_len_or_size (stmt, arg1, idx1, len1rng, &arsz1, nulterm, rvals)
+ || !get_len_or_size (stmt, arg2, idx2, len2rng, &arsz2, nulterm + 1,
+ rvals))
return false;
if (len1rng[0] == len1rng[1] && len1rng[0] < HOST_WIDE_INT_MAX)
@@ -4623,7 +4633,7 @@ int ssa_name_limit_t::next_ssa_name (tree ssa_name)
static bool
count_nonzero_bytes_addr (tree, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT,
unsigned [3], bool *, bool *, bool *,
- const vr_values *, ssa_name_limit_t &);
+ range_query *, ssa_name_limit_t &);
/* Determines the minimum and maximum number of leading non-zero bytes
in the representation of EXP and set LENRANGE[0] and LENRANGE[1]
@@ -4644,7 +4654,7 @@ static bool
count_nonzero_bytes (tree exp, unsigned HOST_WIDE_INT offset,
unsigned HOST_WIDE_INT nbytes,
unsigned lenrange[3], bool *nulterm,
- bool *allnul, bool *allnonnul, const vr_values *rvals,
+ bool *allnul, bool *allnonnul, range_query *rvals,
ssa_name_limit_t &snlim)
{
if (TREE_CODE (exp) == SSA_NAME)
@@ -4836,7 +4846,7 @@ count_nonzero_bytes_addr (tree exp, unsigned HOST_WIDE_INT offset,
unsigned HOST_WIDE_INT nbytes,
unsigned lenrange[3], bool *nulterm,
bool *allnul, bool *allnonnul,
- const vr_values *rvals, ssa_name_limit_t &snlim)
+ range_query *rvals, ssa_name_limit_t &snlim)
{
int idx = get_stridx (exp);
if (idx > 0)
@@ -4853,13 +4863,13 @@ count_nonzero_bytes_addr (tree exp, unsigned HOST_WIDE_INT offset,
else if (si->nonzero_chars
&& TREE_CODE (si->nonzero_chars) == SSA_NAME)
{
- vr_values *v = CONST_CAST (vr_values *, rvals);
- const value_range_equiv *vr = v->get_value_range (si->nonzero_chars);
- if (vr->kind () != VR_RANGE || !range_int_cst_p (vr))
+ value_range vr;
+ rvals->range_of_expr (vr, si->nonzero_chars, si->stmt);
+ if (vr.kind () != VR_RANGE)
return false;
- minlen = tree_to_uhwi (vr->min ());
- maxlen = tree_to_uhwi (vr->max ());
+ minlen = tree_to_uhwi (vr.min ());
+ maxlen = tree_to_uhwi (vr.max ());
}
else
return false;
@@ -4948,7 +4958,7 @@ count_nonzero_bytes_addr (tree exp, unsigned HOST_WIDE_INT offset,
static bool
count_nonzero_bytes (tree exp, unsigned lenrange[3], bool *nulterm,
- bool *allnul, bool *allnonnul, const vr_values *rvals)
+ bool *allnul, bool *allnonnul, range_query *rvals)
{
/* Set to optimistic values so the caller doesn't have to worry about
initializing these and to what. On success, the function will clear
@@ -4972,7 +4982,7 @@ count_nonzero_bytes (tree exp, unsigned lenrange[3], bool *nulterm,
static bool
handle_store (gimple_stmt_iterator *gsi, bool *zero_write,
- const vr_values *rvals)
+ range_query *rvals)
{
int idx = -1;
strinfo *si = NULL;
@@ -5382,7 +5392,7 @@ is_char_type (tree type)
static bool
strlen_check_and_optimize_call (gimple_stmt_iterator *gsi, bool *zero_write,
- const vr_values *rvals)
+ range_query *rvals)
{
gimple *stmt = gsi_stmt (*gsi);
@@ -5473,7 +5483,7 @@ strlen_check_and_optimize_call (gimple_stmt_iterator *gsi, bool *zero_write,
static void
handle_integral_assign (gimple_stmt_iterator *gsi, bool *cleanup_eh,
- const vr_values *rvals)
+ range_query *rvals)
{
gimple *stmt = gsi_stmt (*gsi);
tree lhs = gimple_assign_lhs (stmt);
@@ -5565,6 +5575,7 @@ handle_integral_assign (gimple_stmt_iterator *gsi, bool *cleanup_eh,
wide_int min, max;
signop sign = TYPE_SIGN (lhs_type);
int prec = TYPE_PRECISION (lhs_type);
+ // FIXME: Use range_query instead of global ranges.
value_range_kind vr = get_range_info (lhs, &min, &max);
if (vr == VR_VARYING
|| (vr == VR_RANGE
@@ -5617,7 +5628,7 @@ handle_integral_assign (gimple_stmt_iterator *gsi, bool *cleanup_eh,
static bool
check_and_optimize_stmt (gimple_stmt_iterator *gsi, bool *cleanup_eh,
- const vr_values *rvals)
+ range_query *rvals)
{
gimple *stmt = gsi_stmt (*gsi);
@@ -5860,7 +5871,7 @@ strlen_dom_walker::before_dom_children (basic_block bb)
can be used by printf argument processing. */
evrp.record_ranges_from_stmt (stmt, false);
- if (check_and_optimize_stmt (&gsi, &cleanup_eh, evrp.get_vr_values ()))
+ if (check_and_optimize_stmt (&gsi, &cleanup_eh, &evrp))
gsi_next (&gsi);
}
diff --git a/gcc/tree-ssa-strlen.h b/gcc/tree-ssa-strlen.h
index a11c4d5..225f64b 100644
--- a/gcc/tree-ssa-strlen.h
+++ b/gcc/tree-ssa-strlen.h
@@ -25,13 +25,14 @@ extern bool is_strlen_related_p (tree, tree);
extern bool maybe_diag_stxncpy_trunc (gimple_stmt_iterator, tree, tree);
extern tree set_strlen_range (tree, wide_int, wide_int, tree = NULL_TREE);
-class vr_values;
-extern tree get_range (tree, wide_int[2], const vr_values * = NULL);
+extern tree get_range (tree, gimple *, wide_int[2],
+ class range_query * = NULL);
struct c_strlen_data;
-extern void get_range_strlen_dynamic (tree , c_strlen_data *, const vr_values *);
+extern void get_range_strlen_dynamic (tree, gimple *, c_strlen_data *,
+ class range_query *);
/* APIs internal to strlen pass. Defined in gimple-ssa-sprintf.c. */
-extern bool handle_printf_call (gimple_stmt_iterator *, const vr_values *);
+extern bool handle_printf_call (gimple_stmt_iterator *, class range_query *);
#endif // GCC_TREE_SSA_STRLEN_H
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 44fe52e..9bac06f 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4857,6 +4857,14 @@ find_func_aliases_for_call (struct function *fn, gcall *t)
point for reachable memory of their arguments. */
else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE))
handle_pure_call (t, &rhsc);
+ /* If the call is to a replaceable operator delete and results
+ from a delete expression as opposed to a direct call to
+ such operator, then the effects for PTA (in particular
+ the escaping of the pointer) can be ignored. */
+ else if (fndecl
+ && DECL_IS_OPERATOR_DELETE_P (fndecl)
+ && gimple_call_from_new_or_delete (t))
+ ;
else
handle_rhs_call (t, &rhsc);
if (gimple_call_lhs (t))
@@ -7964,7 +7972,7 @@ static bool
associate_varinfo_to_alias (struct cgraph_node *node, void *data)
{
if ((node->alias
- || (node->thunk.thunk_p
+ || (node->thunk
&& ! node->inlined_to))
&& node->analyzed
&& !node->ifunc_resolver)
@@ -8130,6 +8138,10 @@ ipa_pta_execute (void)
from = constraints.length ();
}
+ /* FIXME: Clone materialization is not preserving stmt references. */
+ FOR_EACH_DEFINED_FUNCTION (node)
+ node->clear_stmts_in_references ();
+
/* Build the constraints. */
FOR_EACH_DEFINED_FUNCTION (node)
{
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 03a2108..f43d581 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -163,8 +163,8 @@ record_temporary_equivalences_from_phis (edge e,
{
/* Get an empty new VR we can pass to update_value_range and save
away in the VR stack. */
- vr_values *vr_values = evrp_range_analyzer->get_vr_values ();
- value_range_equiv *new_vr = vr_values->allocate_value_range_equiv ();
+ value_range_equiv *new_vr
+ = evrp_range_analyzer->allocate_value_range_equiv ();
new (new_vr) value_range_equiv ();
/* There are three cases to consider:
@@ -178,7 +178,7 @@ record_temporary_equivalences_from_phis (edge e,
Otherwise set NEW_VR to varying. This may be overly
conservative. */
if (TREE_CODE (src) == SSA_NAME)
- new_vr->deep_copy (vr_values->get_value_range (src));
+ new_vr->deep_copy (evrp_range_analyzer->get_value_range (src));
else if (TREE_CODE (src) == INTEGER_CST)
new_vr->set (src);
else
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 4b43594..03a1fe6 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -984,9 +984,6 @@ switch_conversion::expand (gswitch *swtch)
during gimplification). */
gcc_checking_assert (TREE_TYPE (m_index_expr) != error_mark_node);
- /* A switch on a constant should have been optimized in tree-cfg-cleanup. */
- gcc_checking_assert (!TREE_CONSTANT (m_index_expr));
-
/* Prefer bit test if possible. */
if (tree_fits_uhwi_p (m_range_size)
&& bit_test_cluster::can_be_handled (tree_to_uhwi (m_range_size), m_uniq)
@@ -1271,6 +1268,18 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
if (range == 0)
return false;
+ if (range > HOST_WIDE_INT_M1U / 100)
+ return false;
+
+ unsigned HOST_WIDE_INT lhs = 100 * range;
+ if (lhs < range)
+ return false;
+
+ /* First make quick guess as each cluster
+ can add at maximum 2 to the comparison_count. */
+ if (lhs > 2 * max_ratio * (end - start + 1))
+ return false;
+
unsigned HOST_WIDE_INT comparison_count = 0;
for (unsigned i = start; i <= end; i++)
{
@@ -1278,10 +1287,6 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
comparison_count += sc->m_range_p ? 2 : 1;
}
- unsigned HOST_WIDE_INT lhs = 100 * range;
- if (lhs < range)
- return false;
-
return lhs <= max_ratio * comparison_count;
}
@@ -1367,12 +1372,12 @@ bit_test_cluster::can_be_handled (unsigned HOST_WIDE_INT range,
{
/* Check overflow. */
if (range == 0)
- return 0;
+ return false;
if (range >= GET_MODE_BITSIZE (word_mode))
return false;
- return uniq <= 3;
+ return uniq <= m_max_case_bit_tests;
}
/* Return true when cluster starting at START and ending at END (inclusive)
@@ -1382,6 +1387,7 @@ bool
bit_test_cluster::can_be_handled (const vec<cluster *> &clusters,
unsigned start, unsigned end)
{
+ auto_vec<int, m_max_case_bit_tests> dest_bbs;
/* For algorithm correctness, bit test for a single case must return
true. We bail out in is_beneficial if it's called just for
a single case. */
@@ -1390,15 +1396,25 @@ bit_test_cluster::can_be_handled (const vec<cluster *> &clusters,
unsigned HOST_WIDE_INT range = get_range (clusters[start]->get_low (),
clusters[end]->get_high ());
- auto_bitmap dest_bbs;
+
+ /* Make a guess first. */
+ if (!can_be_handled (range, m_max_case_bit_tests))
+ return false;
for (unsigned i = start; i <= end; i++)
{
simple_cluster *sc = static_cast<simple_cluster *> (clusters[i]);
- bitmap_set_bit (dest_bbs, sc->m_case_bb->index);
+ /* m_max_case_bit_tests is very small integer, thus the operation
+ is constant. */
+ if (!dest_bbs.contains (sc->m_case_bb->index))
+ {
+ if (dest_bbs.length () >= m_max_case_bit_tests)
+ return false;
+ dest_bbs.quick_push (sc->m_case_bb->index);
+ }
}
- return can_be_handled (range, bitmap_count_bits (dest_bbs));
+ return true;
}
/* Return true when COUNT of cases of UNIQ labels is beneficial for bit test
diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
index 9ebcf10..dbfd9ee 100644
--- a/gcc/tree-switch-conversion.h
+++ b/gcc/tree-switch-conversion.h
@@ -84,11 +84,10 @@ public:
then return 0. */
static unsigned HOST_WIDE_INT get_range (tree low, tree high)
{
- tree r = fold_build2 (MINUS_EXPR, TREE_TYPE (low), high, low);
- if (!tree_fits_uhwi_p (r))
+ wide_int w = wi::to_wide (high) - wi::to_wide (low);
+ if (wi::neg_p (w, TYPE_SIGN (TREE_TYPE (low))) || !wi::fits_uhwi_p (w))
return 0;
-
- return tree_to_uhwi (r) + 1;
+ return w.to_uhwi () + 1;
}
/* Case label. */
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index d81e921..44643be 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -523,7 +523,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
tree result_decl = DECL_RESULT (cfun->decl);
if (result_decl
&& may_be_aliased (result_decl)
- && ref_maybe_used_by_stmt_p (call, result_decl))
+ && ref_maybe_used_by_stmt_p (call, result_decl, false))
return;
/* We found the call, check whether it is suitable. */
@@ -597,8 +597,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
if (TREE_CODE (var) != PARM_DECL
&& auto_var_in_fn_p (var, cfun->decl)
&& may_be_aliased (var)
- && (ref_maybe_used_by_stmt_p (call, var)
- || call_may_clobber_ref_p (call, var)))
+ && (ref_maybe_used_by_stmt_p (call, var, false)
+ || call_may_clobber_ref_p (call, var, false)))
{
if (!VAR_P (var))
{
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 5bf93e2..4abd27e 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -589,12 +589,11 @@ vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo,
LOOP_VINFO_DDRS (loop_vinfo)
.create (LOOP_VINFO_DATAREFS (loop_vinfo).length ()
* LOOP_VINFO_DATAREFS (loop_vinfo).length ());
- /* We need read-read dependences to compute
- STMT_VINFO_SAME_ALIGN_REFS. */
+ /* We do not need read-read dependences. */
bool res = compute_all_dependences (LOOP_VINFO_DATAREFS (loop_vinfo),
&LOOP_VINFO_DDRS (loop_vinfo),
LOOP_VINFO_LOOP_NEST (loop_vinfo),
- true);
+ false);
gcc_assert (res);
}
@@ -841,7 +840,7 @@ vect_slp_analyze_instance_dependence (vec_info *vinfo, slp_instance instance)
/* The stores of this instance are at the root of the SLP tree. */
slp_tree store = SLP_INSTANCE_TREE (instance);
- if (! STMT_VINFO_DATA_REF (SLP_TREE_SCALAR_STMTS (store)[0]))
+ if (! STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (store)))
store = NULL;
/* Verify we can sink stores to the vectorized stmt insert location. */
@@ -1130,6 +1129,45 @@ vect_compute_data_ref_alignment (vec_info *vinfo, dr_vec_info *dr_info)
return;
}
+/* Return whether DR_INFO, which is related to DR_PEEL_INFO in
+ that it only differs in DR_INIT, is aligned if DR_PEEL_INFO
+ is made aligned via peeling. */
+
+static bool
+vect_dr_aligned_if_related_peeled_dr_is (dr_vec_info *dr_info,
+ dr_vec_info *dr_peel_info)
+{
+ if (multiple_p (DR_TARGET_ALIGNMENT (dr_peel_info),
+ DR_TARGET_ALIGNMENT (dr_info)))
+ {
+ poly_offset_int diff
+ = (wi::to_poly_offset (DR_INIT (dr_peel_info->dr))
+ - wi::to_poly_offset (DR_INIT (dr_info->dr)));
+ if (known_eq (diff, 0)
+ || multiple_p (diff, DR_TARGET_ALIGNMENT (dr_info)))
+ return true;
+ }
+ return false;
+}
+
+/* Return whether DR_INFO is aligned if DR_PEEL_INFO is made
+ aligned via peeling. */
+
+static bool
+vect_dr_aligned_if_peeled_dr_is (dr_vec_info *dr_info,
+ dr_vec_info *dr_peel_info)
+{
+ if (!operand_equal_p (DR_BASE_ADDRESS (dr_info->dr),
+ DR_BASE_ADDRESS (dr_peel_info->dr), 0)
+ || !operand_equal_p (DR_OFFSET (dr_info->dr),
+ DR_OFFSET (dr_peel_info->dr), 0)
+ || !operand_equal_p (DR_STEP (dr_info->dr),
+ DR_STEP (dr_peel_info->dr), 0))
+ return false;
+
+ return vect_dr_aligned_if_related_peeled_dr_is (dr_info, dr_peel_info);
+}
+
/* Function vect_update_misalignment_for_peel.
Sets DR_INFO's misalignment
- to 0 if it has the same alignment as DR_PEEL_INFO,
@@ -1146,18 +1184,10 @@ static void
vect_update_misalignment_for_peel (dr_vec_info *dr_info,
dr_vec_info *dr_peel_info, int npeel)
{
- unsigned int i;
- vec<dr_p> same_aligned_drs;
- struct data_reference *current_dr;
- stmt_vec_info peel_stmt_info = dr_peel_info->stmt;
-
/* It can be assumed that if dr_info has the same alignment as dr_peel,
it is aligned in the vector loop. */
- same_aligned_drs = STMT_VINFO_SAME_ALIGN_REFS (peel_stmt_info);
- FOR_EACH_VEC_ELT (same_aligned_drs, i, current_dr)
+ if (vect_dr_aligned_if_peeled_dr_is (dr_info, dr_peel_info))
{
- if (current_dr != dr_info->dr)
- continue;
gcc_assert (!known_alignment_for_access_p (dr_info)
|| !known_alignment_for_access_p (dr_peel_info)
|| (DR_MISALIGNMENT (dr_info)
@@ -1572,6 +1602,43 @@ vect_peeling_supportable (loop_vec_info loop_vinfo, dr_vec_info *dr0_info,
return true;
}
+/* Compare two data-references DRA and DRB to group them into chunks
+ with related alignment. */
+
+static int
+dr_align_group_sort_cmp (const void *dra_, const void *drb_)
+{
+ data_reference_p dra = *(data_reference_p *)const_cast<void *>(dra_);
+ data_reference_p drb = *(data_reference_p *)const_cast<void *>(drb_);
+ int cmp;
+
+ /* Stabilize sort. */
+ if (dra == drb)
+ return 0;
+
+ /* Ordering of DRs according to base. */
+ cmp = data_ref_compare_tree (DR_BASE_ADDRESS (dra),
+ DR_BASE_ADDRESS (drb));
+ if (cmp != 0)
+ return cmp;
+
+ /* And according to DR_OFFSET. */
+ cmp = data_ref_compare_tree (DR_OFFSET (dra), DR_OFFSET (drb));
+ if (cmp != 0)
+ return cmp;
+
+ /* And after step. */
+ cmp = data_ref_compare_tree (DR_STEP (dra), DR_STEP (drb));
+ if (cmp != 0)
+ return cmp;
+
+ /* Then sort after DR_INIT. In case of identical DRs sort after stmt UID. */
+ cmp = data_ref_compare_tree (DR_INIT (dra), DR_INIT (drb));
+ if (cmp == 0)
+ return gimple_uid (DR_STMT (dra)) < gimple_uid (DR_STMT (drb)) ? -1 : 1;
+ return cmp;
+}
+
/* Function vect_enhance_data_refs_alignment
This pass will use loop versioning and loop peeling in order to enhance
@@ -1666,7 +1733,6 @@ vect_peeling_supportable (loop_vec_info loop_vinfo, dr_vec_info *dr0_info,
opt_result
vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
{
- vec<data_reference_p> datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
enum dr_alignment_support supportable_dr_alignment;
dr_vec_info *first_store = NULL;
@@ -1680,7 +1746,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
bool one_misalignment_unknown = false;
bool one_dr_unsupportable = false;
dr_vec_info *unsupportable_dr_info = NULL;
- unsigned int mis, same_align_drs_max = 0;
+ unsigned int mis, dr0_same_align_drs = 0, first_store_same_align_drs = 0;
hash_table<peel_info_hasher> peeling_htab (1);
DUMP_VECT_SCOPE ("vect_enhance_data_refs_alignment");
@@ -1689,6 +1755,54 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo).truncate (0);
LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) = 0;
+ if (LOOP_VINFO_DATAREFS (loop_vinfo).is_empty ())
+ return opt_result::success ();
+
+ /* Sort the vector of datarefs so DRs that have the same or dependent
+ alignment are next to each other. */
+ auto_vec<data_reference_p> datarefs
+ = LOOP_VINFO_DATAREFS (loop_vinfo).copy ();
+ datarefs.qsort (dr_align_group_sort_cmp);
+
+ /* Compute the number of DRs that become aligned when we peel
+ a dataref so it becomes aligned. */
+ auto_vec<unsigned> n_same_align_refs (datarefs.length ());
+ n_same_align_refs.quick_grow_cleared (datarefs.length ());
+ unsigned i0;
+ for (i0 = 0; i0 < datarefs.length (); ++i0)
+ if (DR_BASE_ADDRESS (datarefs[i0]))
+ break;
+ for (i = i0 + 1; i <= datarefs.length (); ++i)
+ {
+ if (i == datarefs.length ()
+ || !operand_equal_p (DR_BASE_ADDRESS (datarefs[i0]),
+ DR_BASE_ADDRESS (datarefs[i]), 0)
+ || !operand_equal_p (DR_OFFSET (datarefs[i0]),
+ DR_OFFSET (datarefs[i]), 0)
+ || !operand_equal_p (DR_STEP (datarefs[i0]),
+ DR_STEP (datarefs[i]), 0))
+ {
+ /* The subgroup [i0, i-1] now only differs in DR_INIT and
+ possibly DR_TARGET_ALIGNMENT. Still the whole subgroup
+ will get known misalignment if we align one of the refs
+ with the largest DR_TARGET_ALIGNMENT. */
+ for (unsigned j = i0; j < i; ++j)
+ {
+ dr_vec_info *dr_infoj = loop_vinfo->lookup_dr (datarefs[j]);
+ for (unsigned k = i0; k < i; ++k)
+ {
+ if (k == j)
+ continue;
+ dr_vec_info *dr_infok = loop_vinfo->lookup_dr (datarefs[k]);
+ if (vect_dr_aligned_if_related_peeled_dr_is (dr_infok,
+ dr_infoj))
+ n_same_align_refs[j]++;
+ }
+ }
+ i0 = i;
+ }
+ }
+
/* While cost model enhancements are expected in the future, the high level
view of the code at this time is as follows:
@@ -1790,18 +1904,17 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
peeling for data-ref that has the maximum number of data-refs
with the same alignment, unless the target prefers to align
stores over load. */
- unsigned same_align_drs
- = STMT_VINFO_SAME_ALIGN_REFS (stmt_info).length ();
+ unsigned same_align_drs = n_same_align_refs[i];
if (!dr0_info
- || same_align_drs_max < same_align_drs)
+ || dr0_same_align_drs < same_align_drs)
{
- same_align_drs_max = same_align_drs;
+ dr0_same_align_drs = same_align_drs;
dr0_info = dr_info;
}
/* For data-refs with the same number of related
accesses prefer the one where the misalign
computation will be invariant in the outermost loop. */
- else if (same_align_drs_max == same_align_drs)
+ else if (dr0_same_align_drs == same_align_drs)
{
class loop *ivloop0, *ivloop;
ivloop0 = outermost_invariant_loop_for_expr
@@ -1825,7 +1938,10 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
}
if (!first_store && DR_IS_WRITE (dr))
- first_store = dr_info;
+ {
+ first_store = dr_info;
+ first_store_same_align_drs = same_align_drs;
+ }
}
}
else
@@ -1895,6 +2011,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
&& load_outside_cost > store_outside_cost))
{
dr0_info = first_store;
+ dr0_same_align_drs = first_store_same_align_drs;
peel_for_unknown_alignment.inside_cost = store_inside_cost;
peel_for_unknown_alignment.outside_cost = store_outside_cost;
}
@@ -1917,8 +2034,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
prologue_cost_vec.release ();
epilogue_cost_vec.release ();
- peel_for_unknown_alignment.peel_info.count = 1
- + STMT_VINFO_SAME_ALIGN_REFS (dr0_info->stmt).length ();
+ peel_for_unknown_alignment.peel_info.count = dr0_same_align_drs + 1;
}
peel_for_unknown_alignment.peel_info.npeel = 0;
@@ -2270,69 +2386,6 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
}
-/* Function vect_find_same_alignment_drs.
-
- Update group and alignment relations in VINFO according to the chosen
- vectorization factor. */
-
-static void
-vect_find_same_alignment_drs (vec_info *vinfo, data_dependence_relation *ddr)
-{
- struct data_reference *dra = DDR_A (ddr);
- struct data_reference *drb = DDR_B (ddr);
- dr_vec_info *dr_info_a = vinfo->lookup_dr (dra);
- dr_vec_info *dr_info_b = vinfo->lookup_dr (drb);
- stmt_vec_info stmtinfo_a = dr_info_a->stmt;
- stmt_vec_info stmtinfo_b = dr_info_b->stmt;
-
- if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
- return;
-
- if (dra == drb)
- return;
-
- if (STMT_VINFO_GATHER_SCATTER_P (stmtinfo_a)
- || STMT_VINFO_GATHER_SCATTER_P (stmtinfo_b))
- return;
-
- if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0)
- || !operand_equal_p (DR_OFFSET (dra), DR_OFFSET (drb), 0)
- || !operand_equal_p (DR_STEP (dra), DR_STEP (drb), 0))
- return;
-
- /* Two references with distance zero have the same alignment. */
- poly_offset_int diff = (wi::to_poly_offset (DR_INIT (dra))
- - wi::to_poly_offset (DR_INIT (drb)));
- if (maybe_ne (diff, 0))
- {
- /* Get the wider of the two alignments. */
- poly_uint64 align_a =
- exact_div (vect_calculate_target_alignment (dr_info_a),
- BITS_PER_UNIT);
- poly_uint64 align_b =
- exact_div (vect_calculate_target_alignment (dr_info_b),
- BITS_PER_UNIT);
- unsigned HOST_WIDE_INT align_a_c, align_b_c;
- if (!align_a.is_constant (&align_a_c)
- || !align_b.is_constant (&align_b_c))
- return;
-
- unsigned HOST_WIDE_INT max_align = MAX (align_a_c, align_b_c);
-
- /* Require the gap to be a multiple of the larger vector alignment. */
- if (!multiple_p (diff, max_align))
- return;
- }
-
- STMT_VINFO_SAME_ALIGN_REFS (stmtinfo_a).safe_push (drb);
- STMT_VINFO_SAME_ALIGN_REFS (stmtinfo_b).safe_push (dra);
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "accesses have the same alignment: %T and %T\n",
- DR_REF (dra), DR_REF (drb));
-}
-
-
/* Function vect_analyze_data_refs_alignment
Analyze the alignment of the data-references in the loop.
@@ -2343,17 +2396,9 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo)
{
DUMP_VECT_SCOPE ("vect_analyze_data_refs_alignment");
- /* Mark groups of data references with same alignment using
- data dependence information. */
- vec<ddr_p> ddrs = LOOP_VINFO_DDRS (loop_vinfo);
- struct data_dependence_relation *ddr;
- unsigned int i;
-
- FOR_EACH_VEC_ELT (ddrs, i, ddr)
- vect_find_same_alignment_drs (loop_vinfo, ddr);
-
vec<data_reference_p> datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
struct data_reference *dr;
+ unsigned int i;
vect_record_base_alignments (loop_vinfo);
FOR_EACH_VEC_ELT (datarefs, i, dr)
@@ -4045,29 +4090,42 @@ vect_find_stmt_data_reference (loop_p loop, gimple *stmt,
return opt_result::success ();
if (refs.length () > 1)
- return opt_result::failure_at (stmt,
- "not vectorized:"
- " more than one data ref in stmt: %G", stmt);
+ {
+ while (!refs.is_empty ())
+ free_data_ref (refs.pop ());
+ return opt_result::failure_at (stmt,
+ "not vectorized: more than one "
+ "data ref in stmt: %G", stmt);
+ }
+ data_reference_p dr = refs.pop ();
if (gcall *call = dyn_cast <gcall *> (stmt))
if (!gimple_call_internal_p (call)
|| (gimple_call_internal_fn (call) != IFN_MASK_LOAD
&& gimple_call_internal_fn (call) != IFN_MASK_STORE))
- return opt_result::failure_at (stmt,
- "not vectorized: dr in a call %G", stmt);
+ {
+ free_data_ref (dr);
+ return opt_result::failure_at (stmt,
+ "not vectorized: dr in a call %G", stmt);
+ }
- data_reference_p dr = refs.pop ();
if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF
&& DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
- return opt_result::failure_at (stmt,
- "not vectorized:"
- " statement is bitfield access %G", stmt);
+ {
+ free_data_ref (dr);
+ return opt_result::failure_at (stmt,
+ "not vectorized:"
+ " statement is bitfield access %G", stmt);
+ }
if (DR_BASE_ADDRESS (dr)
&& TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
- return opt_result::failure_at (stmt,
- "not vectorized:"
- " base addr of dr is a constant\n");
+ {
+ free_data_ref (dr);
+ return opt_result::failure_at (stmt,
+ "not vectorized:"
+ " base addr of dr is a constant\n");
+ }
/* Check whether this may be a SIMD lane access and adjust the
DR to make it easier for us to handle it. */
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 47cfa6f..7cf00e6 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -2386,6 +2386,34 @@ slpeel_update_phi_nodes_for_lcssa (class loop *epilog)
rename_use_op (PHI_ARG_DEF_PTR_FROM_EDGE (gsi.phi (), e));
}
+/* EPILOGUE_VINFO is an epilogue loop that we now know would need to
+ iterate exactly CONST_NITERS times. Make a final decision about
+ whether the epilogue loop should be used, returning true if so. */
+
+static bool
+vect_update_epilogue_niters (loop_vec_info epilogue_vinfo,
+ unsigned HOST_WIDE_INT const_niters)
+{
+ /* Avoid wrap-around when computing const_niters - 1. Also reject
+ using an epilogue loop for a single scalar iteration, even if
+ we could in principle implement that using partial vectors. */
+ unsigned int gap_niters = LOOP_VINFO_PEELING_FOR_GAPS (epilogue_vinfo);
+ if (const_niters <= gap_niters + 1)
+ return false;
+
+ /* Install the number of iterations. */
+ tree niters_type = TREE_TYPE (LOOP_VINFO_NITERS (epilogue_vinfo));
+ tree niters_tree = build_int_cst (niters_type, const_niters);
+ tree nitersm1_tree = build_int_cst (niters_type, const_niters - 1);
+
+ LOOP_VINFO_NITERS (epilogue_vinfo) = niters_tree;
+ LOOP_VINFO_NITERSM1 (epilogue_vinfo) = nitersm1_tree;
+
+ /* Decide what to do if the number of epilogue iterations is not
+ a multiple of the epilogue loop's vectorization factor. */
+ return vect_determine_partial_vectors_and_peeling (epilogue_vinfo, true);
+}
+
/* Function vect_do_peeling.
Input:
@@ -2493,6 +2521,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
int estimated_vf;
int prolog_peeling = 0;
bool vect_epilogues = loop_vinfo->epilogue_vinfos.length () > 0;
+ bool vect_epilogues_updated_niters = false;
/* We currently do not support prolog peeling if the target alignment is not
known at compile time. 'vect_gen_prolog_loop_niters' depends on the
target alignment being constant. */
@@ -2601,8 +2630,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
if (vect_epilogues
&& LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
&& prolog_peeling >= 0
- && known_eq (vf, lowest_vf)
- && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (epilogue_vinfo))
+ && known_eq (vf, lowest_vf))
{
unsigned HOST_WIDE_INT eiters
= (LOOP_VINFO_INT_NITERS (loop_vinfo)
@@ -2612,13 +2640,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
eiters
= eiters % lowest_vf + LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo);
- unsigned int ratio;
- unsigned int epilogue_gaps
- = LOOP_VINFO_PEELING_FOR_GAPS (epilogue_vinfo);
- while (!(constant_multiple_p
- (GET_MODE_SIZE (loop_vinfo->vector_mode),
- GET_MODE_SIZE (epilogue_vinfo->vector_mode), &ratio)
- && eiters >= lowest_vf / ratio + epilogue_gaps))
+ while (!vect_update_epilogue_niters (epilogue_vinfo, eiters))
{
delete epilogue_vinfo;
epilogue_vinfo = NULL;
@@ -2629,8 +2651,8 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
}
epilogue_vinfo = loop_vinfo->epilogue_vinfos[0];
loop_vinfo->epilogue_vinfos.ordered_remove (0);
- epilogue_gaps = LOOP_VINFO_PEELING_FOR_GAPS (epilogue_vinfo);
}
+ vect_epilogues_updated_niters = true;
}
/* Prolog loop may be skipped. */
bool skip_prolog = (prolog_peeling != 0);
@@ -2928,7 +2950,9 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
skip_e edge. */
if (skip_vector)
{
- gcc_assert (update_e != NULL && skip_e != NULL);
+ gcc_assert (update_e != NULL
+ && skip_e != NULL
+ && !vect_epilogues_updated_niters);
gphi *new_phi = create_phi_node (make_ssa_name (TREE_TYPE (niters)),
update_e->dest);
tree new_ssa = make_ssa_name (TREE_TYPE (niters));
@@ -2953,25 +2977,32 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
niters = PHI_RESULT (new_phi);
}
- /* Subtract the number of iterations performed by the vectorized loop
- from the number of total iterations. */
- tree epilogue_niters = fold_build2 (MINUS_EXPR, TREE_TYPE (niters),
- before_loop_niters,
- niters);
-
- LOOP_VINFO_NITERS (epilogue_vinfo) = epilogue_niters;
- LOOP_VINFO_NITERSM1 (epilogue_vinfo)
- = fold_build2 (MINUS_EXPR, TREE_TYPE (epilogue_niters),
- epilogue_niters,
- build_one_cst (TREE_TYPE (epilogue_niters)));
-
/* Set ADVANCE to the number of iterations performed by the previous
loop and its prologue. */
*advance = niters;
- /* Redo the peeling for niter analysis as the NITERs and alignment
- may have been updated to take the main loop into account. */
- determine_peel_for_niter (epilogue_vinfo);
+ if (!vect_epilogues_updated_niters)
+ {
+ /* Subtract the number of iterations performed by the vectorized loop
+ from the number of total iterations. */
+ tree epilogue_niters = fold_build2 (MINUS_EXPR, TREE_TYPE (niters),
+ before_loop_niters,
+ niters);
+
+ LOOP_VINFO_NITERS (epilogue_vinfo) = epilogue_niters;
+ LOOP_VINFO_NITERSM1 (epilogue_vinfo)
+ = fold_build2 (MINUS_EXPR, TREE_TYPE (epilogue_niters),
+ epilogue_niters,
+ build_one_cst (TREE_TYPE (epilogue_niters)));
+
+ /* Decide what to do if the number of epilogue iterations is not
+ a multiple of the epilogue loop's vectorization factor.
+ We should have rejected the loop during the analysis phase
+ if this fails. */
+ if (!vect_determine_partial_vectors_and_peeling (epilogue_vinfo,
+ true))
+ gcc_unreachable ();
+ }
}
adjust_vec.release ();
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index b1a6e15..e42f327 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -814,7 +814,7 @@ _loop_vec_info::_loop_vec_info (class loop *loop_in, vec_info_shared *shared)
vec_outside_cost (0),
vec_inside_cost (0),
vectorizable (false),
- can_use_partial_vectors_p (true),
+ can_use_partial_vectors_p (param_vect_partial_vector_usage != 0),
using_partial_vectors_p (false),
epil_using_partial_vectors_p (false),
peeling_for_gaps (false),
@@ -2003,22 +2003,123 @@ vect_dissolve_slp_only_groups (loop_vec_info loop_vinfo)
}
}
+/* Determine if operating on full vectors for LOOP_VINFO might leave
+ some scalar iterations still to do. If so, decide how we should
+ handle those scalar iterations. The possibilities are:
-/* Decides whether we need to create an epilogue loop to handle
- remaining scalar iterations and sets PEELING_FOR_NITERS accordingly. */
+ (1) Make LOOP_VINFO operate on partial vectors instead of full vectors.
+ In this case:
-void
-determine_peel_for_niter (loop_vec_info loop_vinfo)
+ LOOP_VINFO_USING_PARTIAL_VECTORS_P == true
+ LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P == false
+ LOOP_VINFO_PEELING_FOR_NITER == false
+
+ (2) Make LOOP_VINFO operate on full vectors and use an epilogue loop
+ to handle the remaining scalar iterations. In this case:
+
+ LOOP_VINFO_USING_PARTIAL_VECTORS_P == false
+ LOOP_VINFO_PEELING_FOR_NITER == true
+
+ There are two choices:
+
+ (2a) Consider vectorizing the epilogue loop at the same VF as the
+ main loop, but using partial vectors instead of full vectors.
+ In this case:
+
+ LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P == true
+
+ (2b) Consider vectorizing the epilogue loop at lower VFs only.
+ In this case:
+
+ LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P == false
+
+ When FOR_EPILOGUE_P is true, make this determination based on the
+ assumption that LOOP_VINFO is an epilogue loop, otherwise make it
+ based on the assumption that LOOP_VINFO is the main loop. The caller
+ has made sure that the number of iterations is set appropriately for
+ this value of FOR_EPILOGUE_P. */
+
+opt_result
+vect_determine_partial_vectors_and_peeling (loop_vec_info loop_vinfo,
+ bool for_epilogue_p)
{
- LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo) = false;
+ /* Determine whether there would be any scalar iterations left over. */
+ bool need_peeling_or_partial_vectors_p
+ = vect_need_peeling_or_partial_vectors_p (loop_vinfo);
- if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
- /* The main loop handles all iterations. */
- LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo) = false;
- else if (vect_need_peeling_or_partial_vectors_p (loop_vinfo))
- LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo) = true;
-}
+ /* Decide whether to vectorize the loop with partial vectors. */
+ LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
+ LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
+ if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
+ && need_peeling_or_partial_vectors_p)
+ {
+ /* For partial-vector-usage=1, try to push the handling of partial
+ vectors to the epilogue, with the main loop continuing to operate
+ on full vectors.
+
+ ??? We could then end up failing to use partial vectors if we
+ decide to peel iterations into a prologue, and if the main loop
+ then ends up processing fewer than VF iterations. */
+ if (param_vect_partial_vector_usage == 1
+ && !LOOP_VINFO_EPILOGUE_P (loop_vinfo)
+ && !vect_known_niters_smaller_than_vf (loop_vinfo))
+ LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P (loop_vinfo) = true;
+ else
+ LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = true;
+ }
+ if (dump_enabled_p ())
+ {
+ if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "operating on partial vectors%s.\n",
+ for_epilogue_p ? " for epilogue loop" : "");
+ else
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "operating only on full vectors%s.\n",
+ for_epilogue_p ? " for epilogue loop" : "");
+ }
+
+ if (for_epilogue_p)
+ {
+ loop_vec_info orig_loop_vinfo = LOOP_VINFO_ORIG_LOOP_INFO (loop_vinfo);
+ gcc_assert (orig_loop_vinfo);
+ if (!LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
+ gcc_assert (known_lt (LOOP_VINFO_VECT_FACTOR (loop_vinfo),
+ LOOP_VINFO_VECT_FACTOR (orig_loop_vinfo)));
+ }
+
+ if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
+ {
+ /* Check that the loop processes at least one full vector. */
+ poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+ tree scalar_niters = LOOP_VINFO_NITERS (loop_vinfo);
+ if (known_lt (wi::to_widest (scalar_niters), vf))
+ return opt_result::failure_at (vect_location,
+ "loop does not have enough iterations"
+ " to support vectorization.\n");
+
+ /* If we need to peel an extra epilogue iteration to handle data
+ accesses with gaps, check that there are enough scalar iterations
+ available.
+
+ The check above is redundant with this one when peeling for gaps,
+ but the distinction is useful for diagnostics. */
+ tree scalar_nitersm1 = LOOP_VINFO_NITERSM1 (loop_vinfo);
+ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
+ && known_lt (wi::to_widest (scalar_nitersm1), vf))
+ return opt_result::failure_at (vect_location,
+ "loop does not have enough iterations"
+ " to support peeling for gaps.\n");
+ }
+
+ LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo)
+ = (!LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
+ && need_peeling_or_partial_vectors_p);
+
+ return opt_result::success ();
+}
/* Function vect_analyze_loop_2.
@@ -2272,72 +2373,32 @@ start_over:
LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false;
}
- /* Decide whether to vectorize a loop with partial vectors for
- this vectorization factor. */
- if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo))
- {
- /* Don't use partial vectors if we don't need to peel the loop. */
- if (param_vect_partial_vector_usage == 0
- || !vect_need_peeling_or_partial_vectors_p (loop_vinfo))
- LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
- else if (vect_verify_full_masking (loop_vinfo)
- || vect_verify_loop_lens (loop_vinfo))
- {
- /* The epilogue and other known niters less than VF
- cases can still use vector access with length fully. */
- if (param_vect_partial_vector_usage == 1
- && !LOOP_VINFO_EPILOGUE_P (loop_vinfo)
- && !vect_known_niters_smaller_than_vf (loop_vinfo))
- {
- LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
- LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P (loop_vinfo) = true;
- }
- else
- LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = true;
- }
- else
- LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
- }
- else
- LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
-
- if (dump_enabled_p ())
- {
- if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
- dump_printf_loc (MSG_NOTE, vect_location,
- "operating on partial vectors.\n");
- else
- dump_printf_loc (MSG_NOTE, vect_location,
- "operating only on full vectors.\n");
- }
-
- /* If epilog loop is required because of data accesses with gaps,
- one additional iteration needs to be peeled. Check if there is
- enough iterations for vectorization. */
- if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
- && LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
- {
- poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
- tree scalar_niters = LOOP_VINFO_NITERSM1 (loop_vinfo);
-
- if (known_lt (wi::to_widest (scalar_niters), vf))
- return opt_result::failure_at (vect_location,
- "loop has no enough iterations to"
- " support peeling for gaps.\n");
- }
+ /* If we still have the option of using partial vectors,
+ check whether we can generate the necessary loop controls. */
+ if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
+ && !vect_verify_full_masking (loop_vinfo)
+ && !vect_verify_loop_lens (loop_vinfo))
+ LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false;
/* If we're vectorizing an epilogue loop, the vectorized loop either needs
to be able to handle fewer than VF scalars, or needs to have a lower VF
than the main loop. */
if (LOOP_VINFO_EPILOGUE_P (loop_vinfo)
- && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
+ && !LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)
&& maybe_ge (LOOP_VINFO_VECT_FACTOR (loop_vinfo),
LOOP_VINFO_VECT_FACTOR (orig_loop_vinfo)))
return opt_result::failure_at (vect_location,
"Vectorization factor too high for"
" epilogue loop.\n");
+ /* Decide whether this loop_vinfo should use partial vectors or peeling,
+ assuming that the loop will be used as a main loop. We will redo
+ this analysis later if we instead decide to use the loop as an
+ epilogue loop. */
+ ok = vect_determine_partial_vectors_and_peeling (loop_vinfo, false);
+ if (!ok)
+ return ok;
+
/* Check the costings of the loop make vectorizing worthwhile. */
res = vect_analyze_loop_costing (loop_vinfo);
if (res < 0)
@@ -2350,7 +2411,6 @@ start_over:
return opt_result::failure_at (vect_location,
"Loop costings not worthwhile.\n");
- determine_peel_for_niter (loop_vinfo);
/* If an epilogue loop is required make sure we can create one. */
if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
|| LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo))
@@ -6297,12 +6357,16 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
gphi *reduc_def_phi = as_a <gphi *> (phi_info->stmt);
/* Verify following REDUC_IDX from the latch def leads us back to the PHI
- and compute the reduction chain length. */
- tree reduc_def = PHI_ARG_DEF_FROM_EDGE (reduc_def_phi,
- loop_latch_edge (loop));
+ and compute the reduction chain length. Discover the real
+ reduction operation stmt on the way (stmt_info and slp_for_stmt_info). */
+ tree reduc_def
+ = PHI_ARG_DEF_FROM_EDGE (reduc_def_phi,
+ loop_latch_edge
+ (gimple_bb (reduc_def_phi)->loop_father));
unsigned reduc_chain_length = 0;
bool only_slp_reduc_chain = true;
stmt_info = NULL;
+ slp_tree slp_for_stmt_info = slp_node ? slp_node_instance->root : NULL;
while (reduc_def != PHI_RESULT (reduc_def_phi))
{
stmt_vec_info def = loop_vinfo->lookup_def (reduc_def);
@@ -6345,6 +6409,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
stmt_info = vdef;
reduc_def = gimple_op (vdef->stmt, 1 + STMT_VINFO_REDUC_IDX (vdef));
reduc_chain_length++;
+ if (!stmt_info && slp_node)
+ slp_for_stmt_info = SLP_TREE_CHILDREN (slp_for_stmt_info)[0];
}
/* PHIs should not participate in patterns. */
gcc_assert (!STMT_VINFO_RELATED_STMT (phi_info));
@@ -6431,17 +6497,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
The last use is the reduction variable. In case of nested cycle this
assumption is not true: we use reduc_index to record the index of the
reduction variable. */
- /* ??? To get at invariant/constant uses on the SLP node we have to
- get to it here, slp_node is still the reduction PHI. */
- slp_tree slp_for_stmt_info = NULL;
- if (slp_node)
- {
- slp_for_stmt_info = slp_node_instance->root;
- /* And then there's reduction chain with a conversion ... */
- if (SLP_TREE_REPRESENTATIVE (slp_for_stmt_info) != stmt_info)
- slp_for_stmt_info = SLP_TREE_CHILDREN (slp_for_stmt_info)[0];
- gcc_assert (SLP_TREE_REPRESENTATIVE (slp_for_stmt_info) == stmt_info);
- }
slp_tree *slp_op = XALLOCAVEC (slp_tree, op_type);
/* We need to skip an extra operand for COND_EXPRs with embedded
comparison. */
@@ -8342,11 +8397,16 @@ vectorizable_live_operation (vec_info *vinfo,
were not code-generated yet so it is not too bad.
??? In fact we'd likely want to avoid this situation
in the first place. */
- if (gimple_code (use_stmt) != GIMPLE_PHI
- && !vect_stmt_dominates_stmt_p (gsi_stmt (*gsi), use_stmt))
+ if (TREE_CODE (new_tree) == SSA_NAME
+ && !SSA_NAME_IS_DEFAULT_DEF (new_tree)
+ && gimple_code (use_stmt) != GIMPLE_PHI
+ && !vect_stmt_dominates_stmt_p (SSA_NAME_DEF_STMT (new_tree),
+ use_stmt))
{
- gcc_assert (is_gimple_assign (use_stmt)
- && gimple_assign_rhs_code (use_stmt) == CONSTRUCTOR);
+ enum tree_code code = gimple_assign_rhs_code (use_stmt);
+ gcc_assert (code == CONSTRUCTOR
+ || code == VIEW_CONVERT_EXPR
+ || CONVERT_EXPR_CODE_P (code));
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Using original scalar computation for "
@@ -8762,6 +8822,7 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance)
basic_block *epilogue_bbs = get_loop_body (epilogue);
unsigned i;
+ free (LOOP_VINFO_BBS (epilogue_vinfo));
LOOP_VINFO_BBS (epilogue_vinfo) = epilogue_bbs;
/* Advance data_reference's with the number of iterations of the previous
@@ -9023,8 +9084,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
split_edge (loop_preheader_edge (loop));
- if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)
- && vect_use_loop_mask_for_alignment_p (loop_vinfo))
+ if (vect_use_loop_mask_for_alignment_p (loop_vinfo))
/* This will deal with any possible peeling. */
vect_prepare_for_masked_peels (loop_vinfo);
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index db45740..ac56ace 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1638,6 +1638,8 @@ vect_recog_over_widening_pattern (vec_info *vinfo,
single_use_p |= op_single_use_p;
}
}
+ else
+ return NULL;
}
/* Although the operation could be done in operation_precision, we have
@@ -4028,14 +4030,18 @@ vect_recog_bool_pattern (vec_info *vinfo,
var = gimple_assign_rhs1 (last_stmt);
lhs = gimple_assign_lhs (last_stmt);
+ rhs_code = gimple_assign_rhs_code (last_stmt);
+
+ if (rhs_code == VIEW_CONVERT_EXPR)
+ var = TREE_OPERAND (var, 0);
if (!VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (var)))
return NULL;
hash_set<gimple *> bool_stmts;
- rhs_code = gimple_assign_rhs_code (last_stmt);
- if (CONVERT_EXPR_CODE_P (rhs_code))
+ if (CONVERT_EXPR_CODE_P (rhs_code)
+ || rhs_code == VIEW_CONVERT_EXPR)
{
if (! INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
@@ -4241,6 +4247,8 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo,
tree lhs = NULL_TREE, rhs1, rhs2, tmp, rhs1_type, rhs2_type;
tree vectype1, vectype2;
stmt_vec_info pattern_stmt_info;
+ tree rhs1_op0 = NULL_TREE, rhs1_op1 = NULL_TREE;
+ tree rhs1_op0_type = NULL_TREE, rhs1_op1_type = NULL_TREE;
/* Check for MASK_LOAD ans MASK_STORE calls requiring mask conversion. */
if (is_gimple_call (last_stmt)
@@ -4340,9 +4348,37 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo,
it is better for b1 and b2 to use the mask type associated
with int elements rather bool (byte) elements. */
- rhs1_type = integer_type_for_mask (TREE_OPERAND (rhs1, 0), vinfo);
- if (!rhs1_type)
- rhs1_type = TREE_TYPE (TREE_OPERAND (rhs1, 0));
+ rhs1_op0 = TREE_OPERAND (rhs1, 0);
+ rhs1_op1 = TREE_OPERAND (rhs1, 1);
+ if (!rhs1_op0 || !rhs1_op1)
+ return NULL;
+ rhs1_op0_type = integer_type_for_mask (rhs1_op0, vinfo);
+ rhs1_op1_type = integer_type_for_mask (rhs1_op1, vinfo);
+
+ if (!rhs1_op0_type)
+ rhs1_type = TREE_TYPE (rhs1_op0);
+ else if (!rhs1_op1_type)
+ rhs1_type = TREE_TYPE (rhs1_op1);
+ else if (TYPE_PRECISION (rhs1_op0_type)
+ != TYPE_PRECISION (rhs1_op1_type))
+ {
+ int tmp0 = (int) TYPE_PRECISION (rhs1_op0_type)
+ - (int) TYPE_PRECISION (TREE_TYPE (lhs));
+ int tmp1 = (int) TYPE_PRECISION (rhs1_op1_type)
+ - (int) TYPE_PRECISION (TREE_TYPE (lhs));
+ if ((tmp0 > 0 && tmp1 > 0) || (tmp0 < 0 && tmp1 < 0))
+ {
+ if (abs (tmp0) > abs (tmp1))
+ rhs1_type = rhs1_op1_type;
+ else
+ rhs1_type = rhs1_op0_type;
+ }
+ else
+ rhs1_type = build_nonstandard_integer_type
+ (TYPE_PRECISION (TREE_TYPE (lhs)), 1);
+ }
+ else
+ rhs1_type = rhs1_op0_type;
}
else
return NULL;
@@ -4360,8 +4396,8 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo,
name from the outset. */
if (known_eq (TYPE_VECTOR_SUBPARTS (vectype1),
TYPE_VECTOR_SUBPARTS (vectype2))
- && (TREE_CODE (rhs1) == SSA_NAME
- || rhs1_type == TREE_TYPE (TREE_OPERAND (rhs1, 0))))
+ && !rhs1_op0_type
+ && !rhs1_op1_type)
return NULL;
/* If rhs1 is invariant and we can promote it leave the COND_EXPR
@@ -4393,7 +4429,16 @@ vect_recog_mask_conversion_pattern (vec_info *vinfo,
if (TREE_CODE (rhs1) != SSA_NAME)
{
tmp = vect_recog_temp_ssa_var (TREE_TYPE (rhs1), NULL);
- pattern_stmt = gimple_build_assign (tmp, rhs1);
+ if (rhs1_op0_type
+ && TYPE_PRECISION (rhs1_op0_type) != TYPE_PRECISION (rhs1_type))
+ rhs1_op0 = build_mask_conversion (vinfo, rhs1_op0,
+ vectype2, stmt_vinfo);
+ if (rhs1_op1_type
+ && TYPE_PRECISION (rhs1_op1_type) != TYPE_PRECISION (rhs1_type))
+ rhs1_op1 = build_mask_conversion (vinfo, rhs1_op1,
+ vectype2, stmt_vinfo);
+ pattern_stmt = gimple_build_assign (tmp, TREE_CODE (rhs1),
+ rhs1_op0, rhs1_op1);
rhs1 = tmp;
append_pattern_def_seq (vinfo, stmt_vinfo, pattern_stmt, vectype2,
rhs1_type);
@@ -5119,12 +5164,14 @@ vect_determine_precisions (vec_info *vinfo)
else
{
bb_vec_info bb_vinfo = as_a <bb_vec_info> (vinfo);
- for (gimple *stmt : bb_vinfo->reverse_region_stmts ())
- {
- stmt_vec_info stmt_info = vinfo->lookup_stmt (stmt);
- if (stmt_info && STMT_VINFO_VECTORIZABLE (stmt_info))
- vect_determine_stmt_precisions (vinfo, stmt_info);
- }
+ for (int i = bb_vinfo->bbs.length () - 1; i != -1; --i)
+ for (gimple_stmt_iterator gsi = gsi_last_bb (bb_vinfo->bbs[i]);
+ !gsi_end_p (gsi); gsi_prev (&gsi))
+ {
+ stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi_stmt (gsi));
+ if (stmt_info && STMT_VINFO_VECTORIZABLE (stmt_info))
+ vect_determine_stmt_precisions (vinfo, stmt_info);
+ }
}
}
@@ -5483,17 +5530,19 @@ vect_pattern_recog (vec_info *vinfo)
else
{
bb_vec_info bb_vinfo = as_a <bb_vec_info> (vinfo);
- for (gimple *stmt : bb_vinfo->region_stmts ())
- {
- stmt_vec_info stmt_info = bb_vinfo->lookup_stmt (stmt);
- if (!stmt_info || !STMT_VINFO_VECTORIZABLE (stmt_info))
- continue;
-
- /* Scan over all generic vect_recog_xxx_pattern functions. */
- for (j = 0; j < NUM_PATTERNS; j++)
- vect_pattern_recog_1 (vinfo,
- &vect_vect_recog_func_ptrs[j], stmt_info);
- }
+ for (unsigned i = 0; i < bb_vinfo->bbs.length (); ++i)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb_vinfo->bbs[i]);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ stmt_vec_info stmt_info = bb_vinfo->lookup_stmt (gsi_stmt (gsi));
+ if (!stmt_info || !STMT_VINFO_VECTORIZABLE (stmt_info))
+ continue;
+
+ /* Scan over all generic vect_recog_xxx_pattern functions. */
+ for (j = 0; j < NUM_PATTERNS; j++)
+ vect_pattern_recog_1 (vinfo,
+ &vect_vect_recog_func_ptrs[j], stmt_info);
+ }
}
/* After this no more add_stmt calls are allowed. */
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index ef62c2d..4544f0f 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -45,7 +45,9 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-fold.h"
#include "internal-fn.h"
#include "dump-context.h"
-
+#include "cfganal.h"
+#include "tree-eh.h"
+#include "tree-cfg.h"
static bool vectorizable_slp_permutation (vec_info *, gimple_stmt_iterator *,
slp_tree, stmt_vector_for_cost *);
@@ -66,7 +68,7 @@ _slp_tree::_slp_tree ()
SLP_TREE_CODE (this) = ERROR_MARK;
SLP_TREE_VECTYPE (this) = NULL_TREE;
SLP_TREE_REPRESENTATIVE (this) = NULL;
- this->refcnt = 1;
+ SLP_TREE_REF_COUNT (this) = 1;
this->max_nunits = 1;
this->lanes = 0;
}
@@ -92,7 +94,7 @@ vect_free_slp_tree (slp_tree node)
int i;
slp_tree child;
- if (--node->refcnt != 0)
+ if (--SLP_TREE_REF_COUNT (node) != 0)
return;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
@@ -354,6 +356,16 @@ can_duplicate_and_interleave_p (vec_info *vinfo, unsigned int count,
}
}
+/* Return true if DTA and DTB match. */
+
+static bool
+vect_def_types_match (enum vect_def_type dta, enum vect_def_type dtb)
+{
+ return (dta == dtb
+ || ((dta == vect_external_def || dta == vect_constant_def)
+ && (dtb == vect_external_def || dtb == vect_constant_def)));
+}
+
/* Get the defs for the rhs of STMT (collect them in OPRNDS_INFO), check that
they are of a valid type and that they match the defs of the first stmt of
the SLP group (stored in OPRNDS_INFO). This function tries to match stmts
@@ -419,9 +431,9 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
bool swapped = (swap != 0);
gcc_assert (!swapped || first_op_cond);
+ enum vect_def_type *dts = XALLOCAVEC (enum vect_def_type, number_of_oprnds);
for (i = 0; i < number_of_oprnds; i++)
{
-again:
if (first_op_cond)
{
/* Map indicating how operands of cond_expr should be swapped. */
@@ -442,7 +454,7 @@ again:
oprnd_info = (*oprnds_info)[i];
stmt_vec_info def_stmt_info;
- if (!vect_is_simple_use (oprnd, vinfo, &dt, &def_stmt_info))
+ if (!vect_is_simple_use (oprnd, vinfo, &dts[i], &def_stmt_info))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -455,63 +467,13 @@ again:
if (def_stmt_info && is_pattern_stmt_p (def_stmt_info))
oprnd_info->any_pattern = true;
+ oprnd_info->def_stmts.quick_push (def_stmt_info);
+ oprnd_info->ops.quick_push (oprnd);
+
if (first)
{
- /* For the swapping logic below force vect_reduction_def
- for the reduction op in a SLP reduction group. */
- if (!STMT_VINFO_DATA_REF (stmt_info)
- && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
- && (int)i == STMT_VINFO_REDUC_IDX (stmt_info)
- && def_stmt_info)
- dt = vect_reduction_def;
- oprnd_info->first_dt = dt;
- oprnd_info->first_op_type = TREE_TYPE (oprnd);
- }
- else
- {
- /* Not first stmt of the group, check that the def-stmt/s match
- the def-stmt/s of the first stmt. Allow different definition
- types for reduction chains: the first stmt must be a
- vect_reduction_def (a phi node), and the rest
- end in the reduction chain. */
tree type = TREE_TYPE (oprnd);
- if ((oprnd_info->first_dt != dt
- && !(oprnd_info->first_dt == vect_reduction_def
- && !STMT_VINFO_DATA_REF (stmt_info)
- && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
- && def_stmt_info
- && !STMT_VINFO_DATA_REF (def_stmt_info)
- && (REDUC_GROUP_FIRST_ELEMENT (def_stmt_info)
- == REDUC_GROUP_FIRST_ELEMENT (stmt_info)))
- && !((oprnd_info->first_dt == vect_external_def
- || oprnd_info->first_dt == vect_constant_def)
- && (dt == vect_external_def
- || dt == vect_constant_def)))
- || !types_compatible_p (oprnd_info->first_op_type, type)
- || (!STMT_VINFO_DATA_REF (stmt_info)
- && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
- && ((!def_stmt_info
- || STMT_VINFO_DATA_REF (def_stmt_info)
- || (REDUC_GROUP_FIRST_ELEMENT (def_stmt_info)
- != REDUC_GROUP_FIRST_ELEMENT (stmt_info)))
- != (oprnd_info->first_dt != vect_reduction_def))))
- {
- /* Try swapping operands if we got a mismatch. */
- if (i == commutative_op && !swapped)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "trying swapped operands\n");
- swapped = true;
- goto again;
- }
-
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: different types\n");
-
- return 1;
- }
+ dt = dts[i];
if ((dt == vect_constant_def
|| dt == vect_external_def)
&& !GET_MODE_SIZE (vinfo->vector_mode).is_constant ()
@@ -525,53 +487,140 @@ again:
"for variable-length SLP %T\n", oprnd);
return -1;
}
- }
- /* Check the types of the definitions. */
- switch (dt)
- {
- case vect_external_def:
- /* Make sure to demote the overall operand to external. */
- oprnd_info->first_dt = vect_external_def;
- /* Fallthru. */
- case vect_constant_def:
- oprnd_info->def_stmts.quick_push (NULL);
- oprnd_info->ops.quick_push (oprnd);
- break;
-
- case vect_internal_def:
- case vect_reduction_def:
- if (oprnd_info->first_dt == vect_reduction_def
- && !STMT_VINFO_DATA_REF (stmt_info)
+ /* For the swapping logic below force vect_reduction_def
+ for the reduction op in a SLP reduction group. */
+ if (!STMT_VINFO_DATA_REF (stmt_info)
&& REDUC_GROUP_FIRST_ELEMENT (stmt_info)
- && !STMT_VINFO_DATA_REF (def_stmt_info)
- && (REDUC_GROUP_FIRST_ELEMENT (def_stmt_info)
- == REDUC_GROUP_FIRST_ELEMENT (stmt_info)))
+ && (int)i == STMT_VINFO_REDUC_IDX (stmt_info)
+ && def_stmt_info)
+ dts[i] = dt = vect_reduction_def;
+
+ /* Check the types of the definition. */
+ switch (dt)
{
- /* For a SLP reduction chain we want to duplicate the
- reduction to each of the chain members. That gets
- us a sane SLP graph (still the stmts are not 100%
- correct wrt the initial values). */
- gcc_assert (!first);
- oprnd_info->def_stmts.quick_push (oprnd_info->def_stmts[0]);
- oprnd_info->ops.quick_push (oprnd_info->ops[0]);
+ case vect_external_def:
+ case vect_constant_def:
+ case vect_internal_def:
+ case vect_reduction_def:
+ case vect_induction_def:
break;
+
+ default:
+ /* FORNOW: Not supported. */
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Build SLP failed: illegal type of def %T\n",
+ oprnd);
+ return -1;
}
- /* Fallthru. */
- case vect_induction_def:
- oprnd_info->def_stmts.quick_push (def_stmt_info);
- oprnd_info->ops.quick_push (oprnd);
- break;
- default:
- /* FORNOW: Not supported. */
+ oprnd_info->first_dt = dt;
+ oprnd_info->first_op_type = type;
+ }
+ }
+ if (first)
+ return 0;
+
+ /* Now match the operand definition types to that of the first stmt. */
+ for (i = 0; i < number_of_oprnds;)
+ {
+ oprnd_info = (*oprnds_info)[i];
+ dt = dts[i];
+ stmt_vec_info def_stmt_info = oprnd_info->def_stmts[stmt_num];
+ oprnd = oprnd_info->ops[stmt_num];
+ tree type = TREE_TYPE (oprnd);
+
+ if (!types_compatible_p (oprnd_info->first_op_type, type))
+ {
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: illegal type of def %T\n",
- oprnd);
+ "Build SLP failed: different operand types\n");
+ return 1;
+ }
- return -1;
+ /* Not first stmt of the group, check that the def-stmt/s match
+ the def-stmt/s of the first stmt. Allow different definition
+ types for reduction chains: the first stmt must be a
+ vect_reduction_def (a phi node), and the rest
+ end in the reduction chain. */
+ if ((!vect_def_types_match (oprnd_info->first_dt, dt)
+ && !(oprnd_info->first_dt == vect_reduction_def
+ && !STMT_VINFO_DATA_REF (stmt_info)
+ && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
+ && def_stmt_info
+ && !STMT_VINFO_DATA_REF (def_stmt_info)
+ && (REDUC_GROUP_FIRST_ELEMENT (def_stmt_info)
+ == REDUC_GROUP_FIRST_ELEMENT (stmt_info))))
+ || (!STMT_VINFO_DATA_REF (stmt_info)
+ && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
+ && ((!def_stmt_info
+ || STMT_VINFO_DATA_REF (def_stmt_info)
+ || (REDUC_GROUP_FIRST_ELEMENT (def_stmt_info)
+ != REDUC_GROUP_FIRST_ELEMENT (stmt_info)))
+ != (oprnd_info->first_dt != vect_reduction_def))))
+ {
+ /* Try swapping operands if we got a mismatch. For BB
+ vectorization only in case it will clearly improve things. */
+ if (i == commutative_op && !swapped
+ && (!is_a <bb_vec_info> (vinfo)
+ || (!vect_def_types_match ((*oprnds_info)[i+1]->first_dt,
+ dts[i+1])
+ && (vect_def_types_match (oprnd_info->first_dt, dts[i+1])
+ || vect_def_types_match
+ ((*oprnds_info)[i+1]->first_dt, dts[i])))))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "trying swapped operands\n");
+ std::swap (dts[i], dts[i+1]);
+ std::swap ((*oprnds_info)[i]->def_stmts[stmt_num],
+ (*oprnds_info)[i+1]->def_stmts[stmt_num]);
+ std::swap ((*oprnds_info)[i]->ops[stmt_num],
+ (*oprnds_info)[i+1]->ops[stmt_num]);
+ swapped = true;
+ continue;
+ }
+
+ if (is_a <bb_vec_info> (vinfo)
+ && !oprnd_info->any_pattern)
+ {
+ /* Now for commutative ops we should see whether we can
+ make the other operand matching. */
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "treating operand as external\n");
+ oprnd_info->first_dt = dt = vect_external_def;
+ }
+ else
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Build SLP failed: different types\n");
+ return 1;
+ }
}
+
+ /* Make sure to demote the overall operand to external. */
+ if (dt == vect_external_def)
+ oprnd_info->first_dt = vect_external_def;
+ /* For a SLP reduction chain we want to duplicate the reduction to
+ each of the chain members. That gets us a sane SLP graph (still
+ the stmts are not 100% correct wrt the initial values). */
+ else if ((dt == vect_internal_def
+ || dt == vect_reduction_def)
+ && oprnd_info->first_dt == vect_reduction_def
+ && !STMT_VINFO_DATA_REF (stmt_info)
+ && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
+ && !STMT_VINFO_DATA_REF (def_stmt_info)
+ && (REDUC_GROUP_FIRST_ELEMENT (def_stmt_info)
+ == REDUC_GROUP_FIRST_ELEMENT (stmt_info)))
+ {
+ oprnd_info->def_stmts[stmt_num] = oprnd_info->def_stmts[0];
+ oprnd_info->ops[stmt_num] = oprnd_info->ops[0];
+ }
+
+ ++i;
}
/* Swap operands. */
@@ -761,13 +810,22 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "Build SLP for %G", stmt);
- /* Fail to vectorize statements marked as unvectorizable. */
- if (!STMT_VINFO_VECTORIZABLE (stmt_info))
+ /* Fail to vectorize statements marked as unvectorizable, throw
+ or are volatile. */
+ if (!STMT_VINFO_VECTORIZABLE (stmt_info)
+ || stmt_can_throw_internal (cfun, stmt)
+ || gimple_has_volatile_ops (stmt))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unvectorizable statement %G",
stmt);
+ /* ??? For BB vectorization we want to commutate operands in a way
+ to shuffle all unvectorizable defs into one operand and have
+ the other still vectorized. The following doesn't reliably
+ work for this though but it's the easiest we can do here. */
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -780,6 +838,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: not GIMPLE_ASSIGN nor "
"GIMPLE_CALL %G", stmt);
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -792,6 +852,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
&& !vect_record_max_nunits (vinfo, stmt_info, group_size,
nunits_vectype, max_nunits)))
{
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -818,6 +880,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported call type %G",
call_stmt);
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -860,6 +924,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: no optab.\n");
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -871,6 +937,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: "
"op not supported by target.\n");
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -895,6 +963,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
if (TREE_CODE (vec) != SSA_NAME
|| !types_compatible_p (vectype, TREE_TYPE (vec)))
{
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: "
@@ -1043,6 +1113,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
"Build SLP failed: not grouped load %G", stmt);
/* FORNOW: Not grouped loads are not supported. */
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -1061,6 +1133,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: operation unsupported %G",
stmt);
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -1180,7 +1254,7 @@ vect_build_slp_tree (vec_info *vinfo,
*leader ? "" : "failed ", *leader);
if (*leader)
{
- (*leader)->refcnt++;
+ SLP_TREE_REF_COUNT (*leader)++;
vect_update_max_nunits (max_nunits, (*leader)->max_nunits);
}
return *leader;
@@ -1194,7 +1268,7 @@ vect_build_slp_tree (vec_info *vinfo,
res->max_nunits = this_max_nunits;
vect_update_max_nunits (max_nunits, this_max_nunits);
/* Keep a reference for the bst_map use. */
- res->refcnt++;
+ SLP_TREE_REF_COUNT (res)++;
}
bst_map->put (stmts.copy (), res);
return res;
@@ -1229,8 +1303,8 @@ vect_build_slp_tree_2 (vec_info *vinfo,
if (gimple_assign_rhs_code (stmt) == COND_EXPR)
nops++;
}
- else if (is_a <gphi *> (stmt_info->stmt))
- nops = 0;
+ else if (gphi *phi = dyn_cast <gphi *> (stmt_info->stmt))
+ nops = gimple_phi_num_args (phi);
else
return NULL;
@@ -1239,7 +1313,8 @@ vect_build_slp_tree_2 (vec_info *vinfo,
if (gphi *stmt = dyn_cast <gphi *> (stmt_info->stmt))
{
tree scalar_type = TREE_TYPE (PHI_RESULT (stmt));
- tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
+ tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type,
+ group_size);
if (!vect_record_max_nunits (vinfo, stmt_info, group_size, vectype,
max_nunits))
return NULL;
@@ -1266,7 +1341,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
else
return NULL;
(*tree_size)++;
- node = vect_create_new_slp_node (stmts, 0);
+ node = vect_create_new_slp_node (stmts, nops);
SLP_TREE_VECTYPE (node) = vectype;
return node;
}
@@ -1540,7 +1615,8 @@ fail:
vect_free_oprnd_info (oprnds_info);
/* If we have all children of a child built up from uniform scalars
- then just throw that away, causing it built up from scalars.
+ or does more than one possibly expensive vector construction then
+ just throw that away, causing it built up from scalars.
The exception is the SLP node for the vector store. */
if (is_a <bb_vec_info> (vinfo)
&& !STMT_VINFO_GROUPED_ACCESS (stmt_info)
@@ -1551,11 +1627,20 @@ fail:
{
slp_tree child;
unsigned j;
+ bool all_uniform_p = true;
+ unsigned n_vector_builds = 0;
FOR_EACH_VEC_ELT (children, j, child)
- if (SLP_TREE_DEF_TYPE (child) == vect_internal_def
- || !vect_slp_tree_uniform_p (child))
- break;
- if (!child)
+ {
+ if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
+ all_uniform_p = false;
+ else if (!vect_slp_tree_uniform_p (child))
+ {
+ all_uniform_p = false;
+ if (SLP_TREE_DEF_TYPE (child) == vect_external_def)
+ n_vector_builds++;
+ }
+ }
+ if (all_uniform_p || n_vector_builds > 1)
{
/* Roll back. */
matches[0] = false;
@@ -1590,7 +1675,7 @@ fail:
SLP_TREE_CHILDREN (two).safe_splice (children);
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (two), i, child)
- child->refcnt++;
+ SLP_TREE_REF_COUNT (child)++;
/* Here we record the original defs since this
node represents the final lane configuration. */
@@ -1650,7 +1735,8 @@ vect_print_slp_tree (dump_flags_t dump_kind, dump_location_t loc,
: (SLP_TREE_DEF_TYPE (node) == vect_constant_def
? " (constant)"
: ""), node,
- estimated_poly_value (node->max_nunits), node->refcnt);
+ estimated_poly_value (node->max_nunits),
+ SLP_TREE_REF_COUNT (node));
if (SLP_TREE_SCALAR_STMTS (node).exists ())
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
dump_printf_loc (metadata, user_loc, "\tstmt %u %G", i, stmt_info->stmt);
@@ -1783,188 +1869,6 @@ vect_mark_slp_stmts_relevant (slp_tree node)
vect_mark_slp_stmts_relevant (node, visited);
}
-/* Copy the SLP subtree rooted at NODE. */
-
-static slp_tree
-slp_copy_subtree (slp_tree node, hash_map<slp_tree, slp_tree> &map)
-{
- unsigned i;
-
- bool existed_p;
- slp_tree &copy_ref = map.get_or_insert (node, &existed_p);
- if (existed_p)
- return copy_ref;
-
- copy_ref = new _slp_tree;
- slp_tree copy = copy_ref;
- SLP_TREE_DEF_TYPE (copy) = SLP_TREE_DEF_TYPE (node);
- SLP_TREE_VECTYPE (copy) = SLP_TREE_VECTYPE (node);
- SLP_TREE_REPRESENTATIVE (copy) = SLP_TREE_REPRESENTATIVE (node);
- SLP_TREE_LANES (copy) = SLP_TREE_LANES (node);
- copy->max_nunits = node->max_nunits;
- copy->refcnt = 0;
- if (SLP_TREE_SCALAR_STMTS (node).exists ())
- SLP_TREE_SCALAR_STMTS (copy) = SLP_TREE_SCALAR_STMTS (node).copy ();
- if (SLP_TREE_SCALAR_OPS (node).exists ())
- SLP_TREE_SCALAR_OPS (copy) = SLP_TREE_SCALAR_OPS (node).copy ();
- if (SLP_TREE_LOAD_PERMUTATION (node).exists ())
- SLP_TREE_LOAD_PERMUTATION (copy) = SLP_TREE_LOAD_PERMUTATION (node).copy ();
- if (SLP_TREE_LANE_PERMUTATION (node).exists ())
- SLP_TREE_LANE_PERMUTATION (copy) = SLP_TREE_LANE_PERMUTATION (node).copy ();
- if (SLP_TREE_CHILDREN (node).exists ())
- SLP_TREE_CHILDREN (copy) = SLP_TREE_CHILDREN (node).copy ();
- gcc_assert (!SLP_TREE_VEC_STMTS (node).exists ());
-
- slp_tree child;
- FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (copy), i, child)
- {
- SLP_TREE_CHILDREN (copy)[i] = slp_copy_subtree (child, map);
- SLP_TREE_CHILDREN (copy)[i]->refcnt++;
- }
- return copy;
-}
-
-/* Rearrange the statements of NODE according to PERMUTATION. */
-
-static void
-vect_slp_rearrange_stmts (slp_tree node, unsigned int group_size,
- vec<unsigned> permutation,
- hash_set<slp_tree> &visited)
-{
- unsigned int i;
- slp_tree child;
-
- if (visited.add (node))
- return;
-
- FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- vect_slp_rearrange_stmts (child, group_size, permutation, visited);
-
- if (SLP_TREE_SCALAR_STMTS (node).exists ())
- {
- gcc_assert (group_size == SLP_TREE_SCALAR_STMTS (node).length ());
- vec<stmt_vec_info> tmp_stmts;
- tmp_stmts.create (group_size);
- tmp_stmts.quick_grow (group_size);
- stmt_vec_info stmt_info;
- FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
- tmp_stmts[permutation[i]] = stmt_info;
- SLP_TREE_SCALAR_STMTS (node).release ();
- SLP_TREE_SCALAR_STMTS (node) = tmp_stmts;
- }
- if (SLP_TREE_SCALAR_OPS (node).exists ())
- {
- gcc_assert (group_size == SLP_TREE_SCALAR_OPS (node).length ());
- vec<tree> tmp_ops;
- tmp_ops.create (group_size);
- tmp_ops.quick_grow (group_size);
- tree op;
- FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_OPS (node), i, op)
- tmp_ops[permutation[i]] = op;
- SLP_TREE_SCALAR_OPS (node).release ();
- SLP_TREE_SCALAR_OPS (node) = tmp_ops;
- }
- if (SLP_TREE_LANE_PERMUTATION (node).exists ())
- {
- gcc_assert (group_size == SLP_TREE_LANE_PERMUTATION (node).length ());
- for (i = 0; i < group_size; ++i)
- SLP_TREE_LANE_PERMUTATION (node)[i].second
- = permutation[SLP_TREE_LANE_PERMUTATION (node)[i].second];
- }
-}
-
-
-/* Attempt to reorder stmts in a reduction chain so that we don't
- require any load permutation. Return true if that was possible,
- otherwise return false. */
-
-static bool
-vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
-{
- unsigned int i, j;
- unsigned int lidx;
- slp_tree node, load;
-
- if (SLP_INSTANCE_LOADS (slp_instn).is_empty ())
- return false;
-
- /* Compare all the permutation sequences to the first one. We know
- that at least one load is permuted. */
- node = SLP_INSTANCE_LOADS (slp_instn)[0];
- if (!SLP_TREE_LOAD_PERMUTATION (node).exists ())
- return false;
- unsigned int group_size = SLP_TREE_LOAD_PERMUTATION (node).length ();
- for (i = 1; SLP_INSTANCE_LOADS (slp_instn).iterate (i, &load); ++i)
- {
- if (!SLP_TREE_LOAD_PERMUTATION (load).exists ()
- || SLP_TREE_LOAD_PERMUTATION (load).length () != group_size)
- return false;
- FOR_EACH_VEC_ELT (SLP_TREE_LOAD_PERMUTATION (load), j, lidx)
- if (lidx != SLP_TREE_LOAD_PERMUTATION (node)[j])
- return false;
- }
-
- /* Check that the loads in the first sequence are different and there
- are no gaps between them and that there is an actual permutation. */
- bool any_permute = false;
- auto_sbitmap load_index (group_size);
- bitmap_clear (load_index);
- FOR_EACH_VEC_ELT (node->load_permutation, i, lidx)
- {
- if (lidx != i)
- any_permute = true;
- if (lidx >= group_size)
- return false;
- if (bitmap_bit_p (load_index, lidx))
- return false;
-
- bitmap_set_bit (load_index, lidx);
- }
- if (!any_permute)
- return false;
- for (i = 0; i < group_size; i++)
- if (!bitmap_bit_p (load_index, i))
- return false;
-
- /* This permutation is valid for reduction. Since the order of the
- statements in the nodes is not important unless they are memory
- accesses, we can rearrange the statements in all the nodes
- according to the order of the loads. */
-
- /* We have to unshare the SLP tree we modify. */
- hash_map<slp_tree, slp_tree> map;
- slp_tree unshared = slp_copy_subtree (SLP_INSTANCE_TREE (slp_instn), map);
- vect_free_slp_tree (SLP_INSTANCE_TREE (slp_instn));
- unshared->refcnt++;
- SLP_INSTANCE_TREE (slp_instn) = unshared;
- FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node)
- SLP_INSTANCE_LOADS (slp_instn)[i] = *map.get (node);
- node = SLP_INSTANCE_LOADS (slp_instn)[0];
-
- /* Do the actual re-arrangement. */
- hash_set<slp_tree> visited;
- vect_slp_rearrange_stmts (SLP_INSTANCE_TREE (slp_instn), group_size,
- node->load_permutation, visited);
-
- /* We are done, no actual permutations need to be generated. */
- poly_uint64 unrolling_factor = SLP_INSTANCE_UNROLLING_FACTOR (slp_instn);
- FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node)
- {
- stmt_vec_info first_stmt_info = SLP_TREE_SCALAR_STMTS (node)[0];
- first_stmt_info = DR_GROUP_FIRST_ELEMENT (first_stmt_info);
- /* But we have to keep those permutations that are required because
- of handling of gaps. */
- if (known_eq (unrolling_factor, 1U)
- || (group_size == DR_GROUP_SIZE (first_stmt_info)
- && DR_GROUP_GAP (first_stmt_info) == 0))
- SLP_TREE_LOAD_PERMUTATION (node).release ();
- else
- for (j = 0; j < SLP_TREE_LOAD_PERMUTATION (node).length (); ++j)
- SLP_TREE_LOAD_PERMUTATION (node)[j] = j;
- }
-
- return true;
-}
/* Gather loads in the SLP graph NODE and populate the INST loads array. */
@@ -2105,7 +2009,6 @@ vect_analyze_slp_instance (vec_info *vinfo,
slp_instance new_instance;
slp_tree node;
unsigned int group_size;
- tree vectype, scalar_type = NULL_TREE;
unsigned int i;
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
vec<stmt_vec_info> scalar_stmts;
@@ -2115,41 +2018,25 @@ vect_analyze_slp_instance (vec_info *vinfo,
vect_location = stmt_info->stmt;
if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
{
- scalar_type = TREE_TYPE (DR_REF (dr));
group_size = DR_GROUP_SIZE (stmt_info);
- vectype = get_vectype_for_scalar_type (vinfo, scalar_type, group_size);
}
else if (!dr && REDUC_GROUP_FIRST_ELEMENT (stmt_info))
{
gcc_assert (is_a <loop_vec_info> (vinfo));
- vectype = STMT_VINFO_VECTYPE (stmt_info);
group_size = REDUC_GROUP_SIZE (stmt_info);
}
else if (is_gimple_assign (stmt_info->stmt)
&& gimple_assign_rhs_code (stmt_info->stmt) == CONSTRUCTOR)
{
- vectype = TREE_TYPE (gimple_assign_rhs1 (stmt_info->stmt));
group_size = CONSTRUCTOR_NELTS (gimple_assign_rhs1 (stmt_info->stmt));
constructor = true;
}
else
{
gcc_assert (is_a <loop_vec_info> (vinfo));
- vectype = STMT_VINFO_VECTYPE (stmt_info);
group_size = as_a <loop_vec_info> (vinfo)->reductions.length ();
}
- if (!vectype)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: unsupported data-type %T\n",
- scalar_type);
-
- return false;
- }
- poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
-
/* Create a node (a root of the SLP tree) for the packed grouped stores. */
scalar_stmts.create (group_size);
stmt_vec_info next_info = stmt_info;
@@ -2223,7 +2110,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
/* Build the tree for the SLP instance. */
bool *matches = XALLOCAVEC (bool, group_size);
unsigned npermutes = 0;
- poly_uint64 max_nunits = nunits;
+ poly_uint64 max_nunits = 1;
unsigned tree_size = 0;
node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
&max_nunits, matches, &npermutes,
@@ -2254,7 +2141,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
dump_printf_loc (MSG_NOTE, vect_location,
"SLP discovery succeeded but node needs "
"splitting\n");
- matches[0] = true;
+ memset (matches, true, group_size);
matches[group_size / const_max_nunits * const_max_nunits] = false;
vect_free_slp_tree (node);
}
@@ -2297,7 +2184,9 @@ vect_analyze_slp_instance (vec_info *vinfo,
instructions do not generate this SLP instance. */
if (is_a <loop_vec_info> (vinfo)
&& loads_permuted
- && dr && vect_store_lanes_supported (vectype, group_size, false))
+ && dr
+ && vect_store_lanes_supported
+ (STMT_VINFO_VECTYPE (scalar_stmts[0]), group_size, false))
{
slp_tree load_node;
FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (new_instance), i, load_node)
@@ -2379,45 +2268,82 @@ vect_analyze_slp_instance (vec_info *vinfo,
scalar_stmts.release ();
}
- /* For basic block SLP, try to break the group up into multiples of the
- vector size. */
- unsigned HOST_WIDE_INT const_nunits;
- if (is_a <bb_vec_info> (vinfo)
- && STMT_VINFO_GROUPED_ACCESS (stmt_info)
- && DR_IS_WRITE (STMT_VINFO_DATA_REF (stmt_info))
- && nunits.is_constant (&const_nunits))
+ /* Try to break the group up into pieces. */
+ if (STMT_VINFO_GROUPED_ACCESS (stmt_info)
+ && DR_IS_WRITE (STMT_VINFO_DATA_REF (stmt_info)))
{
- /* We consider breaking the group only on VF boundaries from the existing
- start. */
for (i = 0; i < group_size; i++)
- if (!matches[i]) break;
+ if (!matches[i])
+ break;
+
+ /* For basic block SLP, try to break the group up into multiples of
+ a vector size. */
+ if (is_a <bb_vec_info> (vinfo)
+ && (i > 1 && i < group_size))
+ {
+ tree scalar_type
+ = TREE_TYPE (DR_REF (STMT_VINFO_DATA_REF (stmt_info)));
+ tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type,
+ least_bit_hwi (i));
+ unsigned HOST_WIDE_INT const_nunits;
+ if (vectype
+ && TYPE_VECTOR_SUBPARTS (vectype).is_constant (&const_nunits))
+ {
+ /* Split into two groups at the first vector boundary. */
+ gcc_assert ((const_nunits & (const_nunits - 1)) == 0);
+ unsigned group1_size = i & ~(const_nunits - 1);
- if (i >= const_nunits && i < group_size)
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Splitting SLP group at stmt %u\n", i);
+ stmt_vec_info rest = vect_split_slp_store_group (stmt_info,
+ group1_size);
+ bool res = vect_analyze_slp_instance (vinfo, bst_map, stmt_info,
+ max_tree_size);
+ /* If the first non-match was in the middle of a vector,
+ skip the rest of that vector. Do not bother to re-analyze
+ single stmt groups. */
+ if (group1_size < i)
+ {
+ i = group1_size + const_nunits;
+ if (i + 1 < group_size)
+ rest = vect_split_slp_store_group (rest, const_nunits);
+ }
+ if (i + 1 < group_size)
+ res |= vect_analyze_slp_instance (vinfo, bst_map,
+ rest, max_tree_size);
+ return res;
+ }
+ }
+
+ /* For loop vectorization split into arbitrary pieces of size > 1. */
+ if (is_a <loop_vec_info> (vinfo)
+ && (i > 1 && i < group_size))
{
- /* Split into two groups at the first vector boundary before i. */
- gcc_assert ((const_nunits & (const_nunits - 1)) == 0);
- unsigned group1_size = i & ~(const_nunits - 1);
+ unsigned group1_size = i;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"Splitting SLP group at stmt %u\n", i);
+
stmt_vec_info rest = vect_split_slp_store_group (stmt_info,
group1_size);
+ /* Loop vectorization cannot handle gaps in stores, make sure
+ the split group appears as strided. */
+ STMT_VINFO_STRIDED_P (rest) = 1;
+ DR_GROUP_GAP (rest) = 0;
+ STMT_VINFO_STRIDED_P (stmt_info) = 1;
+ DR_GROUP_GAP (stmt_info) = 0;
+
bool res = vect_analyze_slp_instance (vinfo, bst_map, stmt_info,
max_tree_size);
- /* If the first non-match was in the middle of a vector,
- skip the rest of that vector. */
- if (group1_size < i)
- {
- i = group1_size + const_nunits;
- if (i < group_size)
- rest = vect_split_slp_store_group (rest, const_nunits);
- }
- if (i < group_size)
+ if (i + 1 < group_size)
res |= vect_analyze_slp_instance (vinfo, bst_map,
rest, max_tree_size);
+
return res;
}
+
/* Even though the first vector did not all match, we might be able to SLP
(some) of the remainder. FORNOW ignore this possibility. */
}
@@ -2428,6 +2354,59 @@ vect_analyze_slp_instance (vec_info *vinfo,
return false;
}
+/* Fill in backedge SLP children in the SLP graph. */
+
+static void
+vect_analyze_slp_backedges (vec_info *vinfo, slp_tree node,
+ scalar_stmts_to_slp_tree_map_t *bst_map,
+ hash_set<slp_tree> &visited)
+{
+ if (SLP_TREE_DEF_TYPE (node) != vect_internal_def
+ || visited.add (node))
+ return;
+
+ slp_tree child;
+ unsigned i;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
+ if (child)
+ vect_analyze_slp_backedges (vinfo, child, bst_map, visited);
+
+ /* Inductions are not vectorized by vectorizing their defining cycle
+ but by materializing the values from SCEV data. */
+ if (STMT_VINFO_DEF_TYPE (SLP_TREE_REPRESENTATIVE (node))
+ == vect_induction_def)
+ return;
+
+ if (gphi *phi = dyn_cast <gphi *> (SLP_TREE_REPRESENTATIVE (node)->stmt))
+ for (unsigned i = 0; i < gimple_phi_num_args (phi); ++i)
+ {
+ auto_vec<stmt_vec_info, 64> stmts;
+ unsigned j;
+ stmt_vec_info phi_info;
+ FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), j, phi_info)
+ {
+ tree def = gimple_phi_arg_def (as_a <gphi *>(phi_info->stmt), i);
+ stmt_vec_info def_info = vinfo->lookup_def (def);
+ if (!def_info)
+ break;
+ stmts.safe_push (vect_stmt_to_vectorize (def_info));
+ }
+ if (j != SLP_TREE_LANES (node))
+ continue;
+ slp_tree *edge_def = bst_map->get (stmts);
+ if (edge_def)
+ {
+ /* ??? We're currently not recording non-backedge children
+ of PHIs like external reduction initial values. Avoid
+ NULL entries in SLP_TREE_CHILDREN for those and thus
+ for now simply only record backedge defs at a
+ SLP_TREE_CHILDREN index possibly not matching that of
+ the corresponding PHI argument index. */
+ SLP_TREE_CHILDREN (node).quick_push (*edge_def);
+ (*edge_def)->refcnt++;
+ }
+ }
+}
/* Check if there are stmts in the loop can be vectorized using SLP. Build SLP
trees of packed scalar stmts if SLP is possible. */
@@ -2479,6 +2458,13 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
max_tree_size);
}
+ /* Fill in backedges. */
+ slp_instance instance;
+ hash_set<slp_tree> visited;
+ FOR_EACH_VEC_ELT (vinfo->slp_instances, i, instance)
+ vect_analyze_slp_backedges (vinfo, SLP_INSTANCE_TREE (instance),
+ bst_map, visited);
+
/* The map keeps a reference on SLP nodes built, release that. */
for (scalar_stmts_to_slp_tree_map_t::iterator it = bst_map->begin ();
it != bst_map->end (); ++it)
@@ -2486,35 +2472,399 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
vect_free_slp_tree ((*it).second);
delete bst_map;
- /* Optimize permutations in SLP reductions. */
+ return opt_result::success ();
+}
+
+/* Fill the vertices and leafs vector with all nodes in the SLP graph. */
+
+static void
+vect_slp_build_vertices (hash_set<slp_tree> &visited, slp_tree node,
+ vec<slp_tree> &vertices, vec<int> &leafs)
+{
+ unsigned i;
+ slp_tree child;
+
+ if (visited.add (node))
+ return;
+
+ node->vertex = vertices.length ();
+ vertices.safe_push (node);
+ if (SLP_TREE_CHILDREN (node).is_empty ())
+ leafs.safe_push (node->vertex);
+ else
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
+ vect_slp_build_vertices (visited, child, vertices, leafs);
+}
+
+/* Fill the vertices and leafs vector with all nodes in the SLP graph. */
+
+static void
+vect_slp_build_vertices (vec_info *info, vec<slp_tree> &vertices,
+ vec<int> &leafs)
+{
+ hash_set<slp_tree> visited;
+ unsigned i;
slp_instance instance;
- FOR_EACH_VEC_ELT (vinfo->slp_instances, i, instance)
+ FOR_EACH_VEC_ELT (info->slp_instances, i, instance)
+ vect_slp_build_vertices (visited, SLP_INSTANCE_TREE (instance), vertices,
+ leafs);
+}
+
+/* Apply (reverse) bijectite PERM to VEC. */
+
+template <class T>
+static void
+vect_slp_permute (vec<unsigned> perm,
+ vec<T> &vec, bool reverse)
+{
+ auto_vec<T, 64> saved;
+ saved.create (vec.length ());
+ for (unsigned i = 0; i < vec.length (); ++i)
+ saved.quick_push (vec[i]);
+
+ if (reverse)
{
- slp_tree node = SLP_INSTANCE_TREE (instance);
- stmt_vec_info stmt_info = SLP_TREE_SCALAR_STMTS (node)[0];
- /* Reduction (there are no data-refs in the root).
- In reduction chain the order of the loads is not important. */
- if (!STMT_VINFO_DATA_REF (stmt_info)
- && !REDUC_GROUP_FIRST_ELEMENT (stmt_info))
- vect_attempt_slp_rearrange_stmts (instance);
+ for (unsigned i = 0; i < vec.length (); ++i)
+ vec[perm[i]] = saved[i];
+ for (unsigned i = 0; i < vec.length (); ++i)
+ gcc_assert (vec[perm[i]] == saved[i]);
}
+ else
+ {
+ for (unsigned i = 0; i < vec.length (); ++i)
+ vec[i] = saved[perm[i]];
+ for (unsigned i = 0; i < vec.length (); ++i)
+ gcc_assert (vec[i] == saved[perm[i]]);
+ }
+}
- /* Gather all loads in the SLP graph. */
- hash_set<slp_tree> visited;
- FOR_EACH_VEC_ELT (vinfo->slp_instances, i, instance)
- vect_gather_slp_loads (vinfo->slp_loads, SLP_INSTANCE_TREE (instance),
- visited);
+/* Return whether permutations PERM_A and PERM_B as recorded in the
+ PERMS vector are equal. */
- return opt_result::success ();
+static bool
+vect_slp_perms_eq (const vec<vec<unsigned> > &perms,
+ int perm_a, int perm_b)
+{
+ return (perm_a == perm_b
+ || (perms[perm_a].length () == perms[perm_b].length ()
+ && memcmp (&perms[perm_a][0], &perms[perm_b][0],
+ sizeof (unsigned) * perms[perm_a].length ()) == 0));
}
+/* Optimize the SLP graph of VINFO. */
+
void
vect_optimize_slp (vec_info *vinfo)
{
+ if (vinfo->slp_instances.is_empty ())
+ return;
+
slp_tree node;
unsigned i;
- FOR_EACH_VEC_ELT (vinfo->slp_loads, i, node)
+ auto_vec<slp_tree> vertices;
+ auto_vec<int> leafs;
+ vect_slp_build_vertices (vinfo, vertices, leafs);
+
+ struct graph *slpg = new_graph (vertices.length ());
+ FOR_EACH_VEC_ELT (vertices, i, node)
+ {
+ unsigned j;
+ slp_tree child;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
+ add_edge (slpg, i, child->vertex);
+ }
+
+ /* Compute (reverse) postorder on the inverted graph. */
+ auto_vec<int> ipo;
+ graphds_dfs (slpg, &leafs[0], leafs.length (), &ipo, false, NULL, NULL);
+
+ auto_sbitmap n_visited (vertices.length ());
+ auto_sbitmap n_materialize (vertices.length ());
+ auto_vec<int> n_perm (vertices.length ());
+ auto_vec<vec<unsigned> > perms;
+
+ bitmap_clear (n_visited);
+ bitmap_clear (n_materialize);
+ n_perm.quick_grow_cleared (vertices.length ());
+ perms.safe_push (vNULL); /* zero is no permute */
+
+ /* Produce initial permutations. */
+ for (i = 0; i < leafs.length (); ++i)
+ {
+ int idx = leafs[i];
+ slp_tree node = vertices[idx];
+
+ /* Handle externals and constants optimistically throughout the
+ iteration. */
+ if (SLP_TREE_DEF_TYPE (node) == vect_external_def
+ || SLP_TREE_DEF_TYPE (node) == vect_constant_def)
+ continue;
+
+ /* Loads are the only thing generating permutes and leafs do not
+ change across iterations. */
+ bitmap_set_bit (n_visited, idx);
+ if (!SLP_TREE_LOAD_PERMUTATION (node).exists ())
+ continue;
+
+ /* If splitting out a SLP_TREE_LANE_PERMUTATION can make the
+ node unpermuted, record this permute. */
+ stmt_vec_info dr_stmt = SLP_TREE_REPRESENTATIVE (node);
+ if (!STMT_VINFO_GROUPED_ACCESS (dr_stmt))
+ continue;
+ dr_stmt = DR_GROUP_FIRST_ELEMENT (dr_stmt);
+ unsigned imin = DR_GROUP_SIZE (dr_stmt) + 1, imax = 0;
+ bool any_permute = false;
+ for (unsigned j = 0; j < SLP_TREE_LANES (node); ++j)
+ {
+ unsigned idx = SLP_TREE_LOAD_PERMUTATION (node)[j];
+ imin = MIN (imin, idx);
+ imax = MAX (imax, idx);
+ if (idx - SLP_TREE_LOAD_PERMUTATION (node)[0] != j)
+ any_permute = true;
+ }
+ /* If there's no permute no need to split one out. */
+ if (!any_permute)
+ continue;
+ /* If the span doesn't match we'd disrupt VF computation, avoid
+ that for now. */
+ if (imax - imin + 1 != SLP_TREE_LANES (node))
+ continue;
+
+ /* For now only handle true permutes, like
+ vect_attempt_slp_rearrange_stmts did. This allows us to be lazy
+ when permuting constants and invariants keeping the permute
+ bijective. */
+ auto_sbitmap load_index (SLP_TREE_LANES (node));
+ bitmap_clear (load_index);
+ for (unsigned j = 0; j < SLP_TREE_LANES (node); ++j)
+ bitmap_set_bit (load_index, SLP_TREE_LOAD_PERMUTATION (node)[j] - imin);
+ unsigned j;
+ for (j = 0; j < SLP_TREE_LANES (node); ++j)
+ if (!bitmap_bit_p (load_index, j))
+ break;
+ if (j != SLP_TREE_LANES (node))
+ continue;
+
+ vec<unsigned> perm = vNULL;
+ perm.safe_grow (SLP_TREE_LANES (node), true);
+ for (unsigned j = 0; j < SLP_TREE_LANES (node); ++j)
+ perm[j] = SLP_TREE_LOAD_PERMUTATION (node)[j] - imin;
+ perms.safe_push (perm);
+ n_perm[idx] = perms.length () - 1;
+ }
+
+ /* Propagate permutes along the graph and compute materialization points. */
+ bool changed;
+ unsigned iteration = 0;
+ do
+ {
+ changed = false;
+ ++iteration;
+
+ for (i = vertices.length (); i > 0 ; --i)
+ {
+ int idx = ipo[i-1];
+ slp_tree node = vertices[idx];
+ /* For leafs there's nothing to do - we've seeded permutes
+ on those above. */
+ if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
+ continue;
+
+ bitmap_set_bit (n_visited, idx);
+
+ /* We cannot move a permute across a store. */
+ if (STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (node))
+ && DR_IS_WRITE
+ (STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (node))))
+ continue;
+
+ int perm = -1;
+ for (graph_edge *succ = slpg->vertices[idx].succ;
+ succ; succ = succ->succ_next)
+ {
+ int succ_idx = succ->dest;
+ /* Handle unvisited nodes optimistically. */
+ /* ??? But for constants once we want to handle non-bijective
+ permutes we have to verify the permute, when unifying lanes,
+ will not unify different constants. For example see
+ gcc.dg/vect/bb-slp-14.c for a case that would break. */
+ if (!bitmap_bit_p (n_visited, succ_idx))
+ continue;
+ int succ_perm = n_perm[succ_idx];
+ /* Once we materialize succs permutation its output lanes
+ appear unpermuted to us. */
+ if (bitmap_bit_p (n_materialize, succ_idx))
+ succ_perm = 0;
+ if (perm == -1)
+ perm = succ_perm;
+ else if (succ_perm == 0)
+ {
+ perm = 0;
+ break;
+ }
+ else if (!vect_slp_perms_eq (perms, perm, succ_perm))
+ {
+ perm = 0;
+ break;
+ }
+ }
+
+ if (perm == -1)
+ /* Pick up pre-computed leaf values. */
+ perm = n_perm[idx];
+ else if (!vect_slp_perms_eq (perms, perm, n_perm[idx]))
+ {
+ if (iteration > 1)
+ /* Make sure we eventually converge. */
+ gcc_checking_assert (perm == 0);
+ n_perm[idx] = perm;
+ if (perm == 0)
+ bitmap_clear_bit (n_materialize, idx);
+ changed = true;
+ }
+
+ if (perm == 0)
+ continue;
+
+ /* Elide pruning at materialization points in the first
+ iteration so every node was visited once at least. */
+ if (iteration == 1)
+ continue;
+
+ /* Decide on permute materialization. Look whether there's
+ a use (pred) edge that is permuted differently than us.
+ In that case mark ourselves so the permutation is applied. */
+ bool all_preds_permuted = slpg->vertices[idx].pred != NULL;
+ for (graph_edge *pred = slpg->vertices[idx].pred;
+ pred; pred = pred->pred_next)
+ {
+ gcc_checking_assert (bitmap_bit_p (n_visited, pred->src));
+ int pred_perm = n_perm[pred->src];
+ if (!vect_slp_perms_eq (perms, perm, pred_perm))
+ {
+ all_preds_permuted = false;
+ break;
+ }
+ }
+ if (!all_preds_permuted)
+ {
+ if (!bitmap_bit_p (n_materialize, idx))
+ changed = true;
+ bitmap_set_bit (n_materialize, idx);
+ }
+ }
+ }
+ while (changed || iteration == 1);
+
+ /* Materialize. */
+ for (i = 0; i < vertices.length (); ++i)
{
+ int perm = n_perm[i];
+ if (perm <= 0)
+ continue;
+
+ slp_tree node = vertices[i];
+
+ /* First permute invariant/external original successors. */
+ unsigned j;
+ slp_tree child;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
+ {
+ if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
+ continue;
+
+ /* If the vector is uniform there's nothing to do. */
+ if (vect_slp_tree_uniform_p (child))
+ continue;
+
+ /* We can end up sharing some externals via two_operator
+ handling. Be prepared to unshare those. */
+ if (child->refcnt != 1)
+ {
+ gcc_assert (slpg->vertices[child->vertex].pred->pred_next);
+ SLP_TREE_CHILDREN (node)[j] = child
+ = vect_create_new_slp_node
+ (SLP_TREE_SCALAR_OPS (child).copy ());
+ }
+ vect_slp_permute (perms[perm],
+ SLP_TREE_SCALAR_OPS (child), true);
+ }
+
+ if (bitmap_bit_p (n_materialize, i))
+ {
+ if (SLP_TREE_LOAD_PERMUTATION (node).exists ())
+ /* For loads simply drop the permutation, the load permutation
+ already performs the desired permutation. */
+ ;
+ else
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "inserting permute node in place of %p\n",
+ node);
+
+ /* Make a copy of NODE and in-place change it to a
+ VEC_PERM node to permute the lanes of the copy. */
+ slp_tree copy = new _slp_tree;
+ SLP_TREE_CHILDREN (copy) = SLP_TREE_CHILDREN (node);
+ SLP_TREE_CHILDREN (node) = vNULL;
+ SLP_TREE_SCALAR_STMTS (copy)
+ = SLP_TREE_SCALAR_STMTS (node).copy ();
+ vect_slp_permute (perms[perm],
+ SLP_TREE_SCALAR_STMTS (copy), true);
+ gcc_assert (!SLP_TREE_SCALAR_OPS (node).exists ());
+ SLP_TREE_REPRESENTATIVE (copy) = SLP_TREE_REPRESENTATIVE (node);
+ gcc_assert (!SLP_TREE_LOAD_PERMUTATION (node).exists ());
+ SLP_TREE_LANE_PERMUTATION (copy)
+ = SLP_TREE_LANE_PERMUTATION (node);
+ SLP_TREE_LANE_PERMUTATION (node) = vNULL;
+ SLP_TREE_VECTYPE (copy) = SLP_TREE_VECTYPE (node);
+ copy->refcnt = 1;
+ copy->max_nunits = node->max_nunits;
+ SLP_TREE_DEF_TYPE (copy) = SLP_TREE_DEF_TYPE (node);
+ SLP_TREE_LANES (copy) = SLP_TREE_LANES (node);
+ SLP_TREE_CODE (copy) = SLP_TREE_CODE (node);
+
+ /* Now turn NODE into a VEC_PERM. */
+ SLP_TREE_CHILDREN (node).safe_push (copy);
+ SLP_TREE_LANE_PERMUTATION (node).create (SLP_TREE_LANES (node));
+ for (unsigned j = 0; j < SLP_TREE_LANES (node); ++j)
+ SLP_TREE_LANE_PERMUTATION (node)
+ .quick_push (std::make_pair (0, perms[perm][j]));
+ SLP_TREE_CODE (node) = VEC_PERM_EXPR;
+ }
+ }
+ else
+ {
+ /* Apply the reverse permutation to our stmts. */
+ vect_slp_permute (perms[perm],
+ SLP_TREE_SCALAR_STMTS (node), true);
+ /* And to the load permutation, which we can simply
+ make regular by design. */
+ if (SLP_TREE_LOAD_PERMUTATION (node).exists ())
+ {
+ /* ??? When we handle non-bijective permutes the idea
+ is that we can force the load-permutation to be
+ { min, min + 1, min + 2, ... max }. But then the
+ scalar defs might no longer match the lane content
+ which means wrong-code with live lane vectorization.
+ So we possibly have to have NULL entries for those. */
+ vect_slp_permute (perms[perm],
+ SLP_TREE_LOAD_PERMUTATION (node), true);
+ }
+ }
+ }
+
+ /* Free the perms vector used for propagation. */
+ while (!perms.is_empty ())
+ perms.pop ().release ();
+ free_graph (slpg);
+
+
+ /* Now elide load permutations that are not necessary. */
+ for (i = 0; i < leafs.length (); ++i)
+ {
+ node = vertices[i];
if (!SLP_TREE_LOAD_PERMUTATION (node).exists ())
continue;
@@ -2561,7 +2911,8 @@ vect_optimize_slp (vec_info *vinfo)
/* The load requires permutation when unrolling exposes
a gap either because the group is larger than the SLP
group-size or because there is a gap between the groups. */
- && (known_eq (LOOP_VINFO_VECT_FACTOR (as_a <loop_vec_info> (vinfo)), 1U)
+ && (known_eq (LOOP_VINFO_VECT_FACTOR
+ (as_a <loop_vec_info> (vinfo)), 1U)
|| ((SLP_TREE_LANES (node) == DR_GROUP_SIZE (first_stmt_info))
&& DR_GROUP_GAP (first_stmt_info) == 0)))
{
@@ -2724,26 +3075,31 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo)
}
-/* Initialize a bb_vec_info struct for the statements between
- REGION_BEGIN_IN (inclusive) and REGION_END_IN (exclusive). */
+/* Initialize a bb_vec_info struct for the statements in BBS basic blocks. */
-_bb_vec_info::_bb_vec_info (gimple_stmt_iterator region_begin_in,
- gimple_stmt_iterator region_end_in,
- vec_info_shared *shared)
- : vec_info (vec_info::bb, init_cost (NULL), shared),
- bb (gsi_bb (region_begin_in)),
- region_begin (region_begin_in),
- region_end (region_end_in)
+_bb_vec_info::_bb_vec_info (vec<basic_block> _bbs, vec_info_shared *shared)
+ : vec_info (vec_info::bb, init_cost (NULL), shared), bbs (_bbs)
{
- for (gimple *stmt : this->region_stmts ())
+ for (unsigned i = 0; i < bbs.length (); ++i)
{
- gimple_set_uid (stmt, 0);
- if (is_gimple_debug (stmt))
- continue;
- add_stmt (stmt);
+ if (i != 0)
+ for (gphi_iterator si = gsi_start_phis (bbs[i]); !gsi_end_p (si);
+ gsi_next (&si))
+ {
+ gphi *phi = si.phi ();
+ gimple_set_uid (phi, 0);
+ add_stmt (phi);
+ }
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ gimple_set_uid (stmt, 0);
+ if (is_gimple_debug (stmt))
+ continue;
+ add_stmt (stmt);
+ }
}
-
- bb->aux = this;
}
@@ -2752,11 +3108,23 @@ _bb_vec_info::_bb_vec_info (gimple_stmt_iterator region_begin_in,
_bb_vec_info::~_bb_vec_info ()
{
- for (gimple *stmt : this->region_stmts ())
- /* Reset region marker. */
- gimple_set_uid (stmt, -1);
-
- bb->aux = NULL;
+ /* Reset region marker. */
+ for (unsigned i = 0; i < bbs.length (); ++i)
+ {
+ if (i != 0)
+ for (gphi_iterator si = gsi_start_phis (bbs[i]); !gsi_end_p (si);
+ gsi_next (&si))
+ {
+ gphi *phi = si.phi ();
+ gimple_set_uid (phi, -1);
+ }
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ gimple_set_uid (stmt, -1);
+ }
+ }
}
/* Subroutine of vect_slp_analyze_node_operations. Handle the root of NODE,
@@ -2926,12 +3294,9 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
return true;
/* If we already analyzed the exact same set of scalar stmts we're done.
- We share the generated vector stmts for those.
- The SLP graph is acyclic so not caching whether we failed or succeeded
- doesn't result in any issue since we throw away the lvisited set
- when we fail. */
+ We share the generated vector stmts for those. */
if (visited.contains (node)
- || lvisited.contains (node))
+ || lvisited.add (node))
return true;
bool res = true;
@@ -2944,12 +3309,10 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
}
if (res)
- {
- res = vect_slp_analyze_node_operations_1 (vinfo, node, node_instance,
- cost_vec);
- if (res)
- lvisited.add (node);
- }
+ res = vect_slp_analyze_node_operations_1 (vinfo, node, node_instance,
+ cost_vec);
+ if (!res)
+ lvisited.remove (node);
/* When the node can be vectorized cost invariant nodes it references.
This is not done in DFS order to allow the refering node
@@ -3021,10 +3384,14 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
bool all_visited = true;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
{
- stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
- if (svisited.contains (orig_stmt_info))
+ if (svisited.contains (stmt_info))
continue;
all_visited = false;
+ stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
+ if (STMT_VINFO_IN_PATTERN_P (orig_stmt_info)
+ && STMT_VINFO_RELATED_STMT (orig_stmt_info) != stmt_info)
+ /* Only the pattern root stmt computes the original scalar value. */
+ continue;
bool mark_visited = true;
gimple *orig_stmt = orig_stmt_info->stmt;
ssa_op_iter op_iter;
@@ -3091,7 +3458,7 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
}
}
if (mark_visited)
- svisited.add (orig_stmt_info);
+ svisited.add (stmt_info);
}
if (all_visited)
return;
@@ -3201,18 +3568,19 @@ static void
vect_bb_partition_graph_r (bb_vec_info bb_vinfo,
slp_instance instance, slp_tree node,
hash_map<stmt_vec_info, slp_instance> &stmt_to_instance,
- hash_map<slp_instance, slp_instance> &instance_leader)
+ hash_map<slp_instance, slp_instance> &instance_leader,
+ hash_set<slp_tree> &visited)
{
stmt_vec_info stmt_info;
unsigned i;
- bool all = true;
+
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
{
bool existed_p;
slp_instance &stmt_instance
= stmt_to_instance.get_or_insert (stmt_info, &existed_p);
if (!existed_p)
- all = false;
+ ;
else if (stmt_instance != instance)
{
/* If we're running into a previously marked stmt make us the
@@ -3226,15 +3594,15 @@ vect_bb_partition_graph_r (bb_vec_info bb_vinfo,
}
stmt_instance = instance;
}
- /* If not all stmts had been visited we have to recurse on children. */
- if (all)
+
+ if (visited.add (node))
return;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
vect_bb_partition_graph_r (bb_vinfo, instance, child, stmt_to_instance,
- instance_leader);
+ instance_leader, visited);
}
/* Partition the SLP graph into pieces that can be costed independently. */
@@ -3249,13 +3617,15 @@ vect_bb_partition_graph (bb_vec_info bb_vinfo)
marked stmt, make the stmts leader the current SLP graph entry. */
hash_map<stmt_vec_info, slp_instance> stmt_to_instance;
hash_map<slp_instance, slp_instance> instance_leader;
+ hash_set<slp_tree> visited;
slp_instance instance;
for (unsigned i = 0; bb_vinfo->slp_instances.iterate (i, &instance); ++i)
{
instance_leader.put (instance, instance);
vect_bb_partition_graph_r (bb_vinfo,
instance, SLP_INSTANCE_TREE (instance),
- stmt_to_instance, instance_leader);
+ stmt_to_instance, instance_leader,
+ visited);
}
/* Then collect entries to each independent subgraph. */
@@ -3453,9 +3823,11 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
static void
vect_slp_check_for_constructors (bb_vec_info bb_vinfo)
{
- for (gimple *stmt : bb_vinfo->region_stmts ())
+ for (unsigned i = 0; i < bb_vinfo->bbs.length (); ++i)
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb_vinfo->bbs[i]);
+ !gsi_end_p (gsi); gsi_next (&gsi))
{
- gassign *assign = dyn_cast<gassign *> (stmt);
+ gassign *assign = dyn_cast<gassign *> (gsi_stmt (gsi));
if (!assign || gimple_assign_rhs_code (assign) != CONSTRUCTOR)
continue;
@@ -3594,17 +3966,13 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal,
return true;
}
-/* Subroutine of vect_slp_bb. Try to vectorize the statements between
- REGION_BEGIN (inclusive) and REGION_END (exclusive), returning true
- on success. The region has N_STMTS statements and has the datarefs
- given by DATAREFS. */
+/* Subroutine of vect_slp_bb. Try to vectorize the statements for all
+ basic blocks in BBS, returning true on success.
+ The region has N_STMTS statements and has the datarefs given by DATAREFS. */
static bool
-vect_slp_region (gimple_stmt_iterator region_begin,
- gimple_stmt_iterator region_end,
- vec<data_reference_p> datarefs,
- vec<int> *dataref_groups,
- unsigned int n_stmts)
+vect_slp_region (vec<basic_block> bbs, vec<data_reference_p> datarefs,
+ vec<int> *dataref_groups, unsigned int n_stmts)
{
bb_vec_info bb_vinfo;
auto_vector_modes vector_modes;
@@ -3621,7 +3989,7 @@ vect_slp_region (gimple_stmt_iterator region_begin,
{
bool vectorized = false;
bool fatal = false;
- bb_vinfo = new _bb_vec_info (region_begin, region_end, &shared);
+ bb_vinfo = new _bb_vec_info (bbs, &shared);
bool first_time_p = shared.datarefs.is_empty ();
BB_VINFO_DATAREFS (bb_vinfo) = datarefs;
@@ -3746,50 +4114,122 @@ vect_slp_region (gimple_stmt_iterator region_begin,
}
}
-/* Main entry for the BB vectorizer. Analyze and transform BB, returns
+
+/* Main entry for the BB vectorizer. Analyze and transform BBS, returns
true if anything in the basic-block was vectorized. */
-bool
-vect_slp_bb (basic_block bb)
+static bool
+vect_slp_bbs (vec<basic_block> bbs)
{
vec<data_reference_p> datarefs = vNULL;
- vec<int> dataref_groups = vNULL;
+ auto_vec<int> dataref_groups;
int insns = 0;
int current_group = 0;
- gimple_stmt_iterator region_begin = gsi_start_nondebug_after_labels_bb (bb);
- gimple_stmt_iterator region_end = gsi_last_bb (bb);
- if (!gsi_end_p (region_end))
- gsi_next (&region_end);
- for (gimple_stmt_iterator gsi = gsi_after_labels (bb); !gsi_end_p (gsi);
- gsi_next (&gsi))
+ for (unsigned i = 0; i < bbs.length (); i++)
{
- gimple *stmt = gsi_stmt (gsi);
- if (is_gimple_debug (stmt))
- continue;
+ basic_block bb = bbs[i];
+ for (gimple_stmt_iterator gsi = gsi_after_labels (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ if (is_gimple_debug (stmt))
+ continue;
- insns++;
+ insns++;
- if (gimple_location (stmt) != UNKNOWN_LOCATION)
- vect_location = stmt;
+ if (gimple_location (stmt) != UNKNOWN_LOCATION)
+ vect_location = stmt;
- if (!vect_find_stmt_data_reference (NULL, stmt, &datarefs,
- &dataref_groups, current_group))
- ++current_group;
+ if (!vect_find_stmt_data_reference (NULL, stmt, &datarefs,
+ &dataref_groups, current_group))
+ ++current_group;
- if (insns > param_slp_max_insns_in_bb)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: too many instructions in "
- "basic block.\n");
+ if (insns > param_slp_max_insns_in_bb)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: too many instructions in "
+ "region.\n");
+ }
}
}
- return vect_slp_region (region_begin, region_end, datarefs,
- &dataref_groups, insns);
+ return vect_slp_region (bbs, datarefs, &dataref_groups, insns);
+}
+
+/* Main entry for the BB vectorizer. Analyze and transform BB, returns
+ true if anything in the basic-block was vectorized. */
+
+bool
+vect_slp_bb (basic_block bb)
+{
+ auto_vec<basic_block> bbs;
+ bbs.safe_push (bb);
+ return vect_slp_bbs (bbs);
}
+/* Main entry for the BB vectorizer. Analyze and transform BB, returns
+ true if anything in the basic-block was vectorized. */
+
+bool
+vect_slp_function (function *fun)
+{
+ bool r = false;
+ int *rpo = XNEWVEC (int, n_basic_blocks_for_fn (fun));
+ unsigned n = pre_and_rev_post_order_compute_fn (fun, NULL, rpo, false);
+
+ /* For the moment split the function into pieces to avoid making
+ the iteration on the vector mode moot. Split at points we know
+ to not handle well which is CFG merges (SLP discovery doesn't
+ handle non-loop-header PHIs) and loop exits. Since pattern
+ recog requires reverse iteration to visit uses before defs
+ simply chop RPO into pieces. */
+ auto_vec<basic_block> bbs;
+ for (unsigned i = 0; i < n; i++)
+ {
+ basic_block bb = BASIC_BLOCK_FOR_FN (fun, rpo[i]);
+
+ /* Split when a basic block has multiple predecessors or when the
+ edge into it exits a loop (because of implementation issues with
+ respect to placement of CTORs for externals). */
+ bool split = false;
+ edge e;
+ if (!single_pred_p (bb)
+ || ((e = single_pred_edge (bb)),
+ loop_exit_edge_p (e->src->loop_father, e)))
+ split = true;
+ /* Split when a BB is not dominated by the first block. */
+ else if (!bbs.is_empty ()
+ && !dominated_by_p (CDI_DOMINATORS, bb, bbs[0]))
+ split = true;
+
+ if (split && !bbs.is_empty ())
+ {
+ r |= vect_slp_bbs (bbs);
+ bbs.truncate (0);
+ bbs.quick_push (bb);
+ }
+ else
+ bbs.safe_push (bb);
+
+ /* When we have a stmt ending this block we have to insert on
+ edges when inserting after it. Avoid this for now. */
+ if (gimple *last = last_stmt (bb))
+ if (is_ctrl_altering_stmt (last))
+ {
+ r |= vect_slp_bbs (bbs);
+ bbs.truncate (0);
+ }
+ }
+
+ if (!bbs.is_empty ())
+ r |= vect_slp_bbs (bbs);
+
+ free (rpo);
+
+ return r;
+}
/* Build a variable-length vector in which the elements in ELTS are repeated
to a fill NRESULTS vectors of type VECTOR_TYPE. Store the vectors in
@@ -4051,10 +4491,30 @@ vect_create_constant_vectors (vec_info *vinfo, slp_tree op_node)
{
if (insert_after)
{
- gimple_stmt_iterator gsi
- = gsi_for_stmt (insert_after->stmt);
- gsi_insert_seq_after (&gsi, ctor_seq,
- GSI_CONTINUE_LINKING);
+ gimple_stmt_iterator gsi;
+ if (gimple_code (insert_after->stmt) == GIMPLE_PHI)
+ {
+ gsi = gsi_after_labels (gimple_bb (insert_after->stmt));
+ gsi_insert_seq_before (&gsi, ctor_seq,
+ GSI_CONTINUE_LINKING);
+ }
+ else if (!stmt_ends_bb_p (insert_after->stmt))
+ {
+ gsi = gsi_for_stmt (insert_after->stmt);
+ gsi_insert_seq_after (&gsi, ctor_seq,
+ GSI_CONTINUE_LINKING);
+ }
+ else
+ {
+ /* When we want to insert after a def where the
+ defining stmt throws then insert on the fallthru
+ edge. */
+ edge e = find_fallthru_edge
+ (gimple_bb (insert_after->stmt)->succs);
+ basic_block new_bb
+ = gsi_insert_seq_on_edge_immediate (e, ctor_seq);
+ gcc_assert (!new_bb);
+ }
}
else
vinfo->insert_seq_on_entry (NULL, ctor_seq);
@@ -4548,7 +5008,8 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi,
static void
vect_schedule_slp_instance (vec_info *vinfo,
- slp_tree node, slp_instance instance)
+ slp_tree node, slp_instance instance,
+ hash_set<slp_tree> &visited)
{
gimple_stmt_iterator si;
int i;
@@ -4575,8 +5036,12 @@ vect_schedule_slp_instance (vec_info *vinfo,
return;
}
+ /* ??? If we'd have a way to mark backedges that would be cheaper. */
+ if (visited.add (node))
+ return;
+
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- vect_schedule_slp_instance (vinfo, child, instance);
+ vect_schedule_slp_instance (vinfo, child, instance, visited);
gcc_assert (SLP_TREE_NUMBER_OF_VEC_STMTS (node) != 0);
SLP_TREE_VEC_STMTS (node).create (SLP_TREE_NUMBER_OF_VEC_STMTS (node));
@@ -4600,14 +5065,13 @@ vect_schedule_slp_instance (vec_info *vinfo,
last_stmt_info = vect_find_last_scalar_stmt_in_slp (node);
si = gsi_for_stmt (last_stmt_info->stmt);
}
- else if (SLP_TREE_CHILDREN (node).is_empty ())
+ else if ((STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
+ == cycle_phi_info_type)
+ || (STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
+ == induc_vec_info_type))
{
- /* This happens for reduction and induction PHIs where we do not use the
+ /* For reduction and induction PHIs we do not use the
insertion iterator. */
- gcc_assert (STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
- == cycle_phi_info_type
- || (STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
- == induc_vec_info_type));
si = gsi_none ();
}
else
@@ -4666,7 +5130,8 @@ vect_schedule_slp_instance (vec_info *vinfo,
we do not insert before the region boundary. */
if (SLP_TREE_SCALAR_OPS (child).is_empty ()
&& !vinfo->lookup_def (SLP_TREE_VEC_DEFS (child)[0]))
- last_stmt = gsi_stmt (as_a <bb_vec_info> (vinfo)->region_begin);
+ last_stmt = gsi_stmt (gsi_after_labels
+ (as_a <bb_vec_info> (vinfo)->bbs[0]));
else
{
unsigned j;
@@ -4819,6 +5284,7 @@ vect_schedule_slp (vec_info *vinfo, vec<slp_instance> slp_instances)
slp_instance instance;
unsigned int i;
+ hash_set<slp_tree> visited;
FOR_EACH_VEC_ELT (slp_instances, i, instance)
{
slp_tree node = SLP_INSTANCE_TREE (instance);
@@ -4833,7 +5299,7 @@ vect_schedule_slp (vec_info *vinfo, vec<slp_instance> slp_instances)
SLP_INSTANCE_TREE (instance));
}
/* Schedule the tree of INSTANCE. */
- vect_schedule_slp_instance (vinfo, node, instance);
+ vect_schedule_slp_instance (vinfo, node, instance, visited);
if (SLP_INSTANCE_ROOT_STMT (instance))
vectorize_slp_instance_root_stmt (node, instance);
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 191957c..3575f25 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2235,25 +2235,23 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
/* First cope with the degenerate case of a single-element
vector. */
if (known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U))
- *memory_access_type = VMAT_CONTIGUOUS;
+ ;
/* Otherwise try using LOAD/STORE_LANES. */
- if (*memory_access_type == VMAT_ELEMENTWISE
- && (vls_type == VLS_LOAD
- ? vect_load_lanes_supported (vectype, group_size, masked_p)
- : vect_store_lanes_supported (vectype, group_size,
- masked_p)))
+ else if (vls_type == VLS_LOAD
+ ? vect_load_lanes_supported (vectype, group_size, masked_p)
+ : vect_store_lanes_supported (vectype, group_size,
+ masked_p))
{
*memory_access_type = VMAT_LOAD_STORE_LANES;
overrun_p = would_overrun_p;
}
/* If that fails, try using permuting loads. */
- if (*memory_access_type == VMAT_ELEMENTWISE
- && (vls_type == VLS_LOAD
- ? vect_grouped_load_supported (vectype, single_element_p,
- group_size)
- : vect_grouped_store_supported (vectype, group_size)))
+ else if (vls_type == VLS_LOAD
+ ? vect_grouped_load_supported (vectype, single_element_p,
+ group_size)
+ : vect_grouped_store_supported (vectype, group_size))
{
*memory_access_type = VMAT_CONTIGUOUS_PERMUTE;
overrun_p = would_overrun_p;
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 37e36f5..778177a 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -605,11 +605,7 @@ vec_info::remove_stmt (stmt_vec_info stmt_info)
set_vinfo_for_stmt (stmt_info->stmt, NULL);
unlink_stmt_vdef (stmt_info->stmt);
gimple_stmt_iterator si = gsi_for_stmt (stmt_info->stmt);
- gimple_stmt_iterator *psi = &si;
- if (bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (this))
- if (gsi_stmt (bb_vinfo->region_begin) == stmt_info->stmt)
- psi = &bb_vinfo->region_begin;
- gsi_remove (psi, true);
+ gsi_remove (&si, true);
release_defs (stmt_info->stmt);
free_stmt_vec_info (stmt_info);
}
@@ -653,7 +649,8 @@ vec_info::insert_seq_on_entry (stmt_vec_info context, gimple_seq seq)
else
{
bb_vec_info bb_vinfo = as_a <bb_vec_info> (this);
- gimple_stmt_iterator gsi_region_begin = bb_vinfo->region_begin;
+ gimple_stmt_iterator gsi_region_begin
+ = gsi_after_labels (bb_vinfo->bbs[0]);
gsi_insert_seq_before (&gsi_region_begin, seq, GSI_SAME_STMT);
}
}
@@ -693,7 +690,6 @@ vec_info::new_stmt_vec_info (gimple *stmt)
else
STMT_VINFO_DEF_TYPE (res) = vect_internal_def;
- STMT_VINFO_SAME_ALIGN_REFS (res).create (0);
STMT_SLP_TYPE (res) = loop_vect;
/* This is really "uninitialized" until vect_compute_data_ref_alignment. */
@@ -749,7 +745,6 @@ vec_info::free_stmt_vec_info (stmt_vec_info stmt_info)
release_ssa_name (lhs);
}
- STMT_VINFO_SAME_ALIGN_REFS (stmt_info).release ();
STMT_VINFO_SIMD_CLONE_INFO (stmt_info).release ();
STMT_VINFO_VEC_STMTS (stmt_info).release ();
free (stmt_info);
@@ -1052,9 +1047,6 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
}
if (!require_loop_vectorize && vect_slp_bb (bb))
{
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "basic block vectorized\n");
fold_loop_internal_call (loop_vectorized_call,
boolean_true_node);
loop_vectorized_call = NULL;
@@ -1419,6 +1411,13 @@ pass_slp_vectorize::execute (function *fun)
/* Mark all stmts as not belonging to the current region and unvisited. */
FOR_EACH_BB_FN (bb, fun)
{
+ for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ gphi *stmt = gsi.phi ();
+ gimple_set_uid (stmt, -1);
+ gimple_set_visited (stmt, false);
+ }
for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
gsi_next (&gsi))
{
@@ -1428,12 +1427,7 @@ pass_slp_vectorize::execute (function *fun)
}
}
- FOR_EACH_BB_FN (bb, fun)
- {
- if (vect_slp_bb (bb))
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "basic block vectorized\n");
- }
+ vect_slp_function (fun);
if (!in_loop_pipeline)
{
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 9dffc55..b56073c 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -161,6 +161,8 @@ struct _slp_tree {
unsigned int lanes;
/* The operation of this node. */
enum tree_code code;
+
+ int vertex;
};
@@ -204,6 +206,7 @@ public:
#define SLP_TREE_CHILDREN(S) (S)->children
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
#define SLP_TREE_SCALAR_OPS(S) (S)->ops
+#define SLP_TREE_REF_COUNT(S) (S)->refcnt
#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
#define SLP_TREE_VEC_DEFS(S) (S)->vec_defs
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
@@ -359,7 +362,6 @@ public:
/* The SLP graph. */
auto_vec<slp_instance> slp_instances;
- auto_vec<slp_tree> slp_loads;
/* Maps base addresses to an innermost_loop_behavior that gives the maximum
known alignment for that base. */
@@ -827,94 +829,14 @@ loop_vec_info_for_loop (class loop *loop)
typedef class _bb_vec_info : public vec_info
{
public:
-
- /* GIMPLE statement iterator going from region_begin to region_end. */
-
- struct const_iterator
- {
- const_iterator (gimple_stmt_iterator _gsi) : gsi (_gsi) {}
-
- const const_iterator &
- operator++ ()
- {
- gsi_next (&gsi); return *this;
- }
-
- gimple *operator* () const { return gsi_stmt (gsi); }
-
- bool
- operator== (const const_iterator &other) const
- {
- return gsi_stmt (gsi) == gsi_stmt (other.gsi);
- }
-
- bool
- operator!= (const const_iterator &other) const
- {
- return !(*this == other);
- }
-
- gimple_stmt_iterator gsi;
- };
-
- /* GIMPLE statement iterator going from region_end to region_begin. */
-
- struct const_reverse_iterator
- {
- const_reverse_iterator (gimple_stmt_iterator _gsi) : gsi (_gsi) {}
-
- const const_reverse_iterator &
- operator++ ()
- {
- gsi_prev (&gsi); return *this;
- }
-
- gimple *operator* () const { return gsi_stmt (gsi); }
-
- bool
- operator== (const const_reverse_iterator &other) const
- {
- return gsi_stmt (gsi) == gsi_stmt (other.gsi);
- }
-
- bool
- operator!= (const const_reverse_iterator &other) const
- {
- return !(*this == other);
- }
-
- gimple_stmt_iterator gsi;
- };
-
- _bb_vec_info (gimple_stmt_iterator, gimple_stmt_iterator, vec_info_shared *);
+ _bb_vec_info (vec<basic_block> bbs, vec_info_shared *);
~_bb_vec_info ();
- /* Returns iterator_range for range-based loop. */
-
- iterator_range<const_iterator>
- region_stmts ()
- {
- return iterator_range<const_iterator> (region_begin, region_end);
- }
-
- /* Returns iterator_range for range-based loop in a reverse order. */
-
- iterator_range<const_reverse_iterator>
- reverse_region_stmts ()
- {
- const_reverse_iterator begin = region_end;
- if (*begin == NULL)
- begin = const_reverse_iterator (gsi_last_bb (gsi_bb (region_end)));
- else
- ++begin;
-
- const_reverse_iterator end = region_begin;
- return iterator_range<const_reverse_iterator> (begin, ++end);
- }
-
- basic_block bb;
- gimple_stmt_iterator region_begin;
- gimple_stmt_iterator region_end;
+ /* The region we are operating on. bbs[0] is the entry, excluding
+ its PHI nodes. In the future we might want to track an explicit
+ entry edge to cover bbs[0] PHI nodes and have a region entry
+ insert location. */
+ vec<basic_block> bbs;
} *bb_vec_info;
#define BB_VINFO_BB(B) (B)->bb
@@ -1136,10 +1058,6 @@ public:
pattern statement. */
gimple_seq pattern_def_seq;
- /* List of datarefs that are known to have the same alignment as the dataref
- of this stmt. */
- vec<dr_p> same_align_refs;
-
/* Selected SIMD clone's function info. First vector element
is SIMD clone's function decl, followed by a pair of trees (base + step)
for linear arguments (pair of NULLs for other arguments). */
@@ -1329,7 +1247,6 @@ struct gather_scatter_info {
#define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p
#define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt
#define STMT_VINFO_PATTERN_DEF_SEQ(S) (S)->pattern_def_seq
-#define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs
#define STMT_VINFO_SIMD_CLONE_INFO(S) (S)->simd_clone_info
#define STMT_VINFO_DEF_TYPE(S) (S)->def_type
#define STMT_VINFO_GROUPED_ACCESS(S) \
@@ -1967,7 +1884,8 @@ extern tree vect_create_addr_base_for_vector_ref (vec_info *,
extern widest_int vect_iv_limit_for_partial_vectors (loop_vec_info loop_vinfo);
bool vect_rgroup_iv_might_wrap_p (loop_vec_info, rgroup_controls *);
/* Used in tree-vect-loop-manip.c */
-extern void determine_peel_for_niter (loop_vec_info);
+extern opt_result vect_determine_partial_vectors_and_peeling (loop_vec_info,
+ bool);
/* Used in gimple-loop-interchange.c and tree-parloops.c. */
extern bool check_reduction_path (dump_user_location_t, loop_p, gphi *, tree,
enum tree_code);
@@ -2034,6 +1952,7 @@ extern void vect_get_slp_defs (slp_tree, vec<tree> *);
extern void vect_get_slp_defs (vec_info *, slp_tree, vec<vec<tree> > *,
unsigned n = -1U);
extern bool vect_slp_bb (basic_block);
+extern bool vect_slp_function (function *);
extern stmt_vec_info vect_find_last_scalar_stmt_in_slp (slp_tree);
extern stmt_vec_info vect_find_first_scalar_stmt_in_slp (slp_tree);
extern bool is_simple_and_all_uses_invariant (stmt_vec_info, loop_vec_info);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index b493e40..e00c034 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4010,9 +4010,12 @@ class vrp_folder : public substitute_and_fold_engine
: substitute_and_fold_engine (/* Fold all stmts. */ true),
m_vr_values (v), simplifier (v)
{ }
- tree get_value (tree, gimple *stmt) FINAL OVERRIDE;
bool fold_stmt (gimple_stmt_iterator *) FINAL OVERRIDE;
+ tree value_of_expr (tree name, gimple *stmt) OVERRIDE
+ {
+ return m_vr_values->value_of_expr (name, stmt);
+ }
class vr_values *m_vr_values;
private:
@@ -4023,8 +4026,6 @@ private:
{ return simplifier.vrp_evaluate_conditional (code, op0, op1, stmt); }
bool simplify_stmt_using_ranges (gimple_stmt_iterator *gsi)
{ return simplifier.simplify (gsi); }
- tree op_with_constant_singleton_value_range (tree op)
- { return m_vr_values->op_with_constant_singleton_value_range (op); }
simplify_using_ranges simplifier;
};
@@ -4102,18 +4103,6 @@ vrp_folder::fold_stmt (gimple_stmt_iterator *si)
return simplify_stmt_using_ranges (si);
}
-/* If OP has a value range with a single constant value return that,
- otherwise return NULL_TREE. This returns OP itself if OP is a
- constant.
-
- Implemented as a pure wrapper right now, but this will change. */
-
-tree
-vrp_folder::get_value (tree op, gimple *stmt ATTRIBUTE_UNUSED)
-{
- return op_with_constant_singleton_value_range (op);
-}
-
/* Return the LHS of any ASSERT_EXPR where OP appears as the first
argument to the ASSERT_EXPR and in which the ASSERT_EXPR dominates
BB. If no such ASSERT_EXPR is found, return OP. */
@@ -4406,6 +4395,67 @@ vrp_prop::vrp_finalize (vrp_folder *folder, bool warn_array_bounds_p)
}
}
+/* STMT is a conditional at the end of a basic block.
+
+ If the conditional is of the form SSA_NAME op constant and the SSA_NAME
+ was set via a type conversion, try to replace the SSA_NAME with the RHS
+ of the type conversion. Doing so makes the conversion dead which helps
+ subsequent passes. */
+
+static void
+vrp_simplify_cond_using_ranges (vr_values *query, gcond *stmt)
+{
+ tree op0 = gimple_cond_lhs (stmt);
+ tree op1 = gimple_cond_rhs (stmt);
+
+ /* If we have a comparison of an SSA_NAME (OP0) against a constant,
+ see if OP0 was set by a type conversion where the source of
+ the conversion is another SSA_NAME with a range that fits
+ into the range of OP0's type.
+
+ If so, the conversion is redundant as the earlier SSA_NAME can be
+ used for the comparison directly if we just massage the constant in the
+ comparison. */
+ if (TREE_CODE (op0) == SSA_NAME
+ && TREE_CODE (op1) == INTEGER_CST)
+ {
+ gimple *def_stmt = SSA_NAME_DEF_STMT (op0);
+ tree innerop;
+
+ if (!is_gimple_assign (def_stmt)
+ || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
+ return;
+
+ innerop = gimple_assign_rhs1 (def_stmt);
+
+ if (TREE_CODE (innerop) == SSA_NAME
+ && !POINTER_TYPE_P (TREE_TYPE (innerop))
+ && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (innerop)
+ && desired_pro_or_demotion_p (TREE_TYPE (innerop), TREE_TYPE (op0)))
+ {
+ const value_range *vr = query->get_value_range (innerop);
+
+ if (range_int_cst_p (vr)
+ && range_fits_type_p (vr,
+ TYPE_PRECISION (TREE_TYPE (op0)),
+ TYPE_SIGN (TREE_TYPE (op0)))
+ && int_fits_type_p (op1, TREE_TYPE (innerop)))
+ {
+ tree newconst = fold_convert (TREE_TYPE (innerop), op1);
+ gimple_cond_set_lhs (stmt, innerop);
+ gimple_cond_set_rhs (stmt, newconst);
+ update_stmt (stmt);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Folded into: ");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+ }
+ }
+ }
+}
+
/* Main entry point to VRP (Value Range Propagation). This pass is
loosely based on J. R. C. Patterson, ``Accurate Static Branch
Prediction by Value Range Propagation,'' in SIGPLAN Conference on
@@ -4493,8 +4543,8 @@ execute_vrp (struct function *fun, bool warn_array_bounds_p)
{
gimple *last = last_stmt (bb);
if (last && gimple_code (last) == GIMPLE_COND)
- simplify_cond_using_ranges_2 (&vrp_prop.vr_values,
- as_a <gcond *> (last));
+ vrp_simplify_cond_using_ranges (&vrp_prop.vr_values,
+ as_a <gcond *> (last));
}
free_numbers_of_iterations_estimates (fun);
diff --git a/gcc/tree.c b/gcc/tree.c
index 4046deb..fa03d96 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5777,7 +5777,7 @@ free_lang_data_in_decl (tree decl, class free_lang_data_d *fld)
DECL_INITIAL (decl) = error_mark_node;
}
}
- if (gimple_has_body_p (decl) || (node && node->thunk.thunk_p))
+ if (gimple_has_body_p (decl) || (node && node->thunk))
{
tree t;
@@ -10952,7 +10952,7 @@ build_truth_vector_type_for (tree vectype)
unsigned HOST_WIDE_INT esize = vector_element_size (vsize, nunits);
tree bool_type = build_nonstandard_boolean_type (esize);
- return make_vector_type (bool_type, nunits, BLKmode);
+ return make_vector_type (bool_type, nunits, VOIDmode);
}
/* Like build_vector_type, but builds a variant type with TYPE_VECTOR_OPAQUE
@@ -13640,20 +13640,21 @@ get_initializer_for (tree init, tree decl)
/* Determines the size of the member referenced by the COMPONENT_REF
REF, using its initializer expression if necessary in order to
determine the size of an initialized flexible array member.
- If non-null, *INTERIOR_ZERO_LENGTH is set when REF refers to
- an interior zero-length array.
+ If non-null, set *ARK when REF refers to an interior zero-length
+ array or a trailing one-element array.
Returns the size as sizetype (which might be zero for an object
with an uninitialized flexible array member) or null if the size
cannot be determined. */
tree
-component_ref_size (tree ref, bool *interior_zero_length /* = NULL */)
+component_ref_size (tree ref, special_array_member *sam /* = NULL */)
{
gcc_assert (TREE_CODE (ref) == COMPONENT_REF);
- bool int_0_len = false;
- if (!interior_zero_length)
- interior_zero_length = &int_0_len;
+ special_array_member arkbuf;
+ if (!sam)
+ sam = &arkbuf;
+ *sam = special_array_member::none;
/* The object/argument referenced by the COMPONENT_REF and its type. */
tree arg = TREE_OPERAND (ref, 0);
@@ -13675,9 +13676,16 @@ component_ref_size (tree ref, bool *interior_zero_length /* = NULL */)
more than one element. */
return memsize;
- *interior_zero_length = zero_length && !trailing;
- if (*interior_zero_length)
- memsize = NULL_TREE;
+ if (zero_length)
+ {
+ if (trailing)
+ *sam = special_array_member::trail_0;
+ else
+ {
+ *sam = special_array_member::int_0;
+ memsize = NULL_TREE;
+ }
+ }
if (!zero_length)
if (tree dom = TYPE_DOMAIN (memtype))
@@ -13688,9 +13696,13 @@ component_ref_size (tree ref, bool *interior_zero_length /* = NULL */)
{
offset_int minidx = wi::to_offset (min);
offset_int maxidx = wi::to_offset (max);
- if (maxidx - minidx > 0)
+ offset_int neltsm1 = maxidx - minidx;
+ if (neltsm1 > 0)
/* MEMBER is an array with more than one element. */
return memsize;
+
+ if (neltsm1 == 0)
+ *sam = special_array_member::trail_1;
}
/* For a refernce to a zero- or one-element array member of a union
@@ -13708,7 +13720,7 @@ component_ref_size (tree ref, bool *interior_zero_length /* = NULL */)
tree base = get_addr_base_and_unit_offset (ref, &baseoff);
if (!base || !VAR_P (base))
{
- if (!*interior_zero_length)
+ if (*sam != special_array_member::int_0)
return NULL_TREE;
if (TREE_CODE (arg) != COMPONENT_REF)
@@ -13728,7 +13740,7 @@ component_ref_size (tree ref, bool *interior_zero_length /* = NULL */)
/* Determine the base type of the referenced object. If it's
the same as ARGTYPE and MEMBER has a known size, return it. */
tree bt = basetype;
- if (!*interior_zero_length)
+ if (*sam != special_array_member::int_0)
while (TREE_CODE (bt) == ARRAY_TYPE)
bt = TREE_TYPE (bt);
bool typematch = useless_type_conversion_p (argtype, bt);
@@ -13768,7 +13780,7 @@ component_ref_size (tree ref, bool *interior_zero_length /* = NULL */)
if (DECL_P (base)
&& DECL_EXTERNAL (base)
&& bt == basetype
- && !*interior_zero_length)
+ && *sam != special_array_member::int_0)
/* The size of a flexible array member of an extern struct
with no initializer cannot be determined (it's defined
in another translation unit and can have an initializer
diff --git a/gcc/tree.h b/gcc/tree.h
index 5bb6e7b..f43ac9f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -921,7 +921,8 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
(TREE_CHECK (NODE, PARM_DECL)->decl_common.decl_nonshareable_flag)
/* In a CALL_EXPR, means that the call is the jump from a thunk to the
- thunked-to function. */
+ thunked-to function. Be careful to avoid using this macro when one of the
+ next two applies instead. */
#define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->base.protected_flag)
/* In a CALL_EXPR, if the function being called is BUILT_IN_ALLOCA, means that
@@ -931,6 +932,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define CALL_ALLOCA_FOR_VAR_P(NODE) \
(CALL_EXPR_CHECK (NODE)->base.protected_flag)
+/* In a CALL_EXPR, if the function being called is DECL_IS_OPERATOR_NEW_P or
+ DECL_IS_OPERATOR_DELETE_P, true for allocator calls from C++ new or delete
+ expressions. */
+#define CALL_FROM_NEW_OR_DELETE_P(NODE) \
+ (CALL_EXPR_CHECK (NODE)->base.protected_flag)
+
/* Used in classes in C++. */
#define TREE_PRIVATE(NODE) ((NODE)->base.private_flag)
/* Used in classes in C++. */
@@ -3067,9 +3074,6 @@ set_function_decl_type (tree decl, function_decl_type t, bool set)
#define DECL_IS_OPERATOR_DELETE_P(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == OPERATOR_DELETE)
-#define DECL_IS_REPLACEABLE_OPERATOR_DELETE_P(NODE) \
- (DECL_IS_OPERATOR_DELETE_P (NODE) && DECL_IS_REPLACEABLE_OPERATOR (NODE))
-
#define DECL_SET_IS_OPERATOR_DELETE(NODE, VAL) \
set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_DELETE, VAL)
@@ -5288,12 +5292,22 @@ extern bool array_at_struct_end_p (tree);
by EXP. This does not include any offset in DECL_FIELD_BIT_OFFSET. */
extern tree component_ref_field_offset (tree);
+/* Describes a "special" array member due to which component_ref_size
+ returns null. */
+enum struct special_array_member
+ {
+ none, /* Not a special array member. */
+ int_0, /* Interior array member with size zero. */
+ trail_0, /* Trailing array member with size zero. */
+ trail_1 /* Trailing array member with one element. */
+ };
+
/* Return the size of the member referenced by the COMPONENT_REF, using
its initializer expression if necessary in order to determine the size
of an initialized flexible array member. The size might be zero for
an object with an uninitialized flexible array member or null if it
cannot be determined. */
-extern tree component_ref_size (tree, bool * = NULL);
+extern tree component_ref_size (tree, special_array_member * = NULL);
extern int tree_map_base_eq (const void *, const void *);
extern unsigned int tree_map_base_hash (const void *);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index ea1b1a8..db4fb8a 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -331,7 +331,10 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist)
/* When user uses an unsigned type with a big value, constant converted
to gcov_type (a signed type) can be negative. */
gcov_type value = hist->hvalue.counters[i];
- if (hist->type == HIST_TYPE_TOPN_VALUES)
+ if (hist->type == HIST_TYPE_TOPN_VALUES
+ || hist->type == HIST_TYPE_IOR)
+ /* Note that the IOR counter tracks pointer values and these can have
+ sign bit set. */
;
else
gcc_assert (value >= 0);
@@ -1219,7 +1222,7 @@ init_node_map (bool local)
cgraph_node_map = new hash_map<profile_id_hash, cgraph_node *>;
FOR_EACH_DEFINED_FUNCTION (n)
- if (n->has_gimple_body_p () || n->thunk.thunk_p)
+ if (n->has_gimple_body_p () || n->thunk)
{
cgraph_node **val;
dump_user_location_t loc
diff --git a/gcc/value-query.cc b/gcc/value-query.cc
new file mode 100644
index 0000000..23ba48d
--- /dev/null
+++ b/gcc/value-query.cc
@@ -0,0 +1,177 @@
+/* Support routines for value queries.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com> and
+ Andrew MacLeod <amacleod@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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "tree.h"
+#include "gimple.h"
+#include "ssa.h"
+#include "tree-pretty-print.h"
+#include "fold-const.h"
+#include "value-range-equiv.h"
+#include "value-query.h"
+#include "alloc-pool.h"
+
+// value_query default methods.
+
+tree
+value_query::value_on_edge (edge, tree name)
+{
+ return value_of_expr (name);
+}
+
+tree
+value_query::value_of_stmt (gimple *stmt, tree name)
+{
+ if (!name)
+ name = gimple_get_lhs (stmt);
+
+ gcc_checking_assert (!name || name == gimple_get_lhs (stmt));
+
+ if (name)
+ return value_of_expr (name);
+ return NULL_TREE;
+}
+
+// range_query default methods.
+
+bool
+range_query::range_on_edge (irange &r, edge, tree name)
+{
+ return range_of_expr (r, name);
+}
+
+bool
+range_query::range_of_stmt (irange &r, gimple *stmt, tree name)
+{
+ if (!name)
+ name = gimple_get_lhs (stmt);
+
+ gcc_checking_assert (!name || name == gimple_get_lhs (stmt));
+
+ if (name)
+ return range_of_expr (r, name);
+ return false;
+}
+
+tree
+range_query::value_of_expr (tree name, gimple *stmt)
+{
+ tree t;
+ value_range r;
+
+ if (!irange::supports_type_p (TREE_TYPE (name)))
+ return NULL_TREE;
+
+ if (range_of_expr (r, name, stmt))
+ {
+ // A constant used in an unreachable block oftens returns as UNDEFINED.
+ // If the result is undefined, check the global value for a constant.
+ if (r.undefined_p ())
+ range_of_expr (r, name);
+ if (r.singleton_p (&t))
+ return t;
+ }
+ return NULL_TREE;
+}
+
+tree
+range_query::value_on_edge (edge e, tree name)
+{
+ tree t;
+ value_range r;
+
+ if (!irange::supports_type_p (TREE_TYPE (name)))
+ return NULL_TREE;
+ if (range_on_edge (r, e, name))
+ {
+ // A constant used in an unreachable block oftens returns as UNDEFINED.
+ // If the result is undefined, check the global value for a constant.
+ if (r.undefined_p ())
+ range_of_expr (r, name);
+ if (r.singleton_p (&t))
+ return t;
+ }
+ return NULL_TREE;
+
+}
+
+tree
+range_query::value_of_stmt (gimple *stmt, tree name)
+{
+ tree t;
+ value_range r;
+
+ if (!name)
+ name = gimple_get_lhs (stmt);
+
+ gcc_checking_assert (!name || name == gimple_get_lhs (stmt));
+
+ if (!name || !irange::supports_type_p (TREE_TYPE (name)))
+ return NULL_TREE;
+ if (range_of_stmt (r, stmt, name) && r.singleton_p (&t))
+ return t;
+ return NULL_TREE;
+
+}
+
+// valuation_query support routines for value_range_equiv's.
+
+class equiv_allocator : public object_allocator<value_range_equiv>
+{
+public:
+ equiv_allocator ()
+ : object_allocator<value_range_equiv> ("equiv_allocator pool") { }
+};
+
+value_range_equiv *
+range_query::allocate_value_range_equiv ()
+{
+ return new (equiv_alloc->allocate ()) value_range_equiv;
+}
+
+void
+range_query::free_value_range_equiv (value_range_equiv *v)
+{
+ equiv_alloc->remove (v);
+}
+
+const class value_range_equiv *
+range_query::get_value_range (const_tree expr, gimple *stmt)
+{
+ int_range_max r;
+ if (range_of_expr (r, const_cast<tree> (expr), stmt))
+ return new (equiv_alloc->allocate ()) value_range_equiv (r);
+ return new (equiv_alloc->allocate ()) value_range_equiv (TREE_TYPE (expr));
+}
+
+range_query::range_query ()
+{
+ equiv_alloc = new equiv_allocator;
+}
+
+range_query::~range_query ()
+{
+ equiv_alloc->release ();
+ delete equiv_alloc;
+}
diff --git a/gcc/value-query.h b/gcc/value-query.h
new file mode 100644
index 0000000..cf0b6ed
--- /dev/null
+++ b/gcc/value-query.h
@@ -0,0 +1,107 @@
+/* Support routines for value queries.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@redhat.com> and
+ Andrew Macleod <amacleod@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/>. */
+
+#ifndef GCC_QUERY_H
+#define GCC_QUERY_H
+
+// The value_query class is used by optimization passes that require
+// valueizing SSA names in terms of a tree value, but have no neeed
+// for ranges.
+//
+// value_of_expr must be provided. The default for value_on_edge and
+// value_of_stmt is to call value_of_expr.
+//
+// This implies the valuation is global in nature. If a pass can make
+// use of more specific information, it can override the other queries.
+//
+// Proper usage of the correct query in passes will enable other
+// valuation mechanisms to produce more precise results.
+
+class value_query
+{
+public:
+ value_query () { }
+ // Return the singleton expression for NAME at a gimple statement,
+ // or NULL if none found.
+ virtual tree value_of_expr (tree name, gimple * = NULL) = 0;
+ // Return the singleton expression for NAME at an edge, or NULL if
+ // none found.
+ virtual tree value_on_edge (edge, tree name);
+ // Return the singleton expression for the LHS of a gimple
+ // statement, assuming an (optional) initial value of NAME. Returns
+ // NULL if none found.
+ //
+ // Note that this method calculates the range the LHS would have
+ // *after* the statement has executed.
+ virtual tree value_of_stmt (gimple *, tree name = NULL);
+
+private:
+ DISABLE_COPY_AND_ASSIGN (value_query);
+};
+
+// The range_query class is used by optimization passes which are
+// range aware.
+//
+// range_of_expr must be provided. The default for range_on_edge and
+// range_of_stmt is to call range_of_expr. If a pass can make use of
+// more specific information, then it can override the other queries.
+//
+// The default for the value_* routines is to call the equivalent
+// range_* routines, check if the range is a singleton, and return it
+// if so.
+//
+// The get_value_range method is currently provided for compatibility
+// with vr-values. It will be deprecated when possible.
+
+class range_query : public value_query
+{
+public:
+ range_query ();
+ virtual ~range_query ();
+
+ virtual tree value_of_expr (tree name, gimple * = NULL) OVERRIDE;
+ virtual tree value_on_edge (edge, tree name) OVERRIDE;
+ virtual tree value_of_stmt (gimple *, tree name = NULL) OVERRIDE;
+
+ // These are the range equivalents of the value_* methods. Instead
+ // of returning a singleton, they calculate a range and return it in
+ // R. TRUE is returned on success or FALSE if no range was found.
+ //
+ // Note that range_of_expr must always return TRUE unless ranges are
+ // unsupported for NAME's type (supports_type_p is false).
+ virtual bool range_of_expr (irange &r, tree name, gimple * = NULL) = 0;
+ virtual bool range_on_edge (irange &r, edge, tree name);
+ virtual bool range_of_stmt (irange &r, gimple *, tree name = NULL);
+
+ // DEPRECATED: This method is used from vr-values. The plan is to
+ // rewrite all uses of it to the above API.
+ virtual const class value_range_equiv *get_value_range (const_tree,
+ gimple * = NULL);
+
+protected:
+ class value_range_equiv *allocate_value_range_equiv ();
+ void free_value_range_equiv (class value_range_equiv *);
+
+private:
+ class equiv_allocator *equiv_alloc;
+};
+
+#endif // GCC_QUERY_H
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index ed2c322..7847104 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -35,18 +35,14 @@ along with GCC; see the file COPYING3. If not see
irange &
irange::operator= (const irange &src)
{
- if (legacy_mode_p () != src.legacy_mode_p ())
+ if (legacy_mode_p ())
{
- copy_legacy_range (src);
+ copy_to_legacy (src);
return *this;
}
- if (legacy_mode_p ())
+ if (src.legacy_mode_p ())
{
- gcc_checking_assert (src.legacy_mode_p ());
- m_num_ranges = src.m_num_ranges;
- m_base[0] = src.m_base[0];
- m_base[1] = src.m_base[1];
- m_kind = src.m_kind;
+ copy_legacy_to_multi_range (src);
return *this;
}
@@ -81,44 +77,60 @@ irange::maybe_anti_range () const
&& upper_bound () == wi::max_value (precision, sign));
}
-// Copy between a legacy and a multi-range, or vice-versa.
-
void
-irange::copy_legacy_range (const irange &src)
+irange::copy_legacy_to_multi_range (const irange &src)
{
- gcc_checking_assert (src.legacy_mode_p () != legacy_mode_p ());
+ gcc_checking_assert (src.legacy_mode_p ());
+ gcc_checking_assert (!legacy_mode_p ());
if (src.undefined_p ())
set_undefined ();
else if (src.varying_p ())
set_varying (src.type ());
- else if (src.kind () == VR_ANTI_RANGE)
- {
- if (src.legacy_mode_p () && !range_has_numeric_bounds_p (&src))
- set_varying (src.type ());
- else
- set (src.min (), src.max (), VR_ANTI_RANGE);
- }
- else if (legacy_mode_p () && src.maybe_anti_range ())
- {
- int_range<3> tmp (src);
- tmp.invert ();
- set (tmp.min (), wide_int_to_tree (src.type (), tmp.upper_bound (0)),
- VR_ANTI_RANGE);
- }
else
{
- // If copying legacy to int_range, normalize any symbolics.
- if (src.legacy_mode_p () && !range_has_numeric_bounds_p (&src))
+ if (range_has_numeric_bounds_p (&src))
+ set (src.min (), src.max (), src.kind ());
+ else
{
value_range cst (src);
cst.normalize_symbolics ();
+ gcc_checking_assert (cst.varying_p () || cst.kind () == VR_RANGE);
set (cst.min (), cst.max ());
- return;
}
- set (src.min (), src.max ());
}
}
+// Copy any type of irange into a legacy.
+
+void
+irange::copy_to_legacy (const irange &src)
+{
+ gcc_checking_assert (legacy_mode_p ());
+ // Copy legacy to legacy.
+ if (src.legacy_mode_p ())
+ {
+ m_num_ranges = src.m_num_ranges;
+ m_base[0] = src.m_base[0];
+ m_base[1] = src.m_base[1];
+ m_kind = src.m_kind;
+ return;
+ }
+ // Copy multi-range to legacy.
+ if (src.undefined_p ())
+ set_undefined ();
+ else if (src.varying_p ())
+ set_varying (src.type ());
+ else if (src.maybe_anti_range ())
+ {
+ int_range<3> r (src);
+ r.invert ();
+ // Use tree variants to save on tree -> wi -> tree conversions.
+ set (r.tree_lower_bound (0), r.tree_upper_bound (0), VR_ANTI_RANGE);
+ }
+ else
+ set (src.tree_lower_bound (), src.tree_upper_bound ());
+}
+
// Swap min/max if they are out of order. Return TRUE if further
// processing of the range is necessary, FALSE otherwise.
@@ -1093,19 +1105,14 @@ intersect_ranges (enum value_range_kind *vr0type,
void
irange::legacy_intersect (irange *vr0, const irange *vr1)
{
+ gcc_checking_assert (vr0->legacy_mode_p ());
+ gcc_checking_assert (vr1->legacy_mode_p ());
/* If either range is VR_VARYING the other one wins. */
if (vr1->varying_p ())
return;
if (vr0->varying_p ())
{
- /* Avoid the full copy if we already know both sides are simple
- and can be trivially copied. */
- if (vr1->legacy_mode_p ())
- {
- vr0->set (vr1->min (), vr1->max (), vr1->kind ());
- return;
- }
- *vr0 = *vr1;
+ vr0->set (vr1->min (), vr1->max (), vr1->kind ());
return;
}
@@ -1122,17 +1129,9 @@ irange::legacy_intersect (irange *vr0, const irange *vr1)
value_range_kind vr0kind = vr0->kind ();
tree vr0min = vr0->min ();
tree vr0max = vr0->max ();
- /* Handle multi-ranges that can be represented as anti-ranges. */
- if (!vr1->legacy_mode_p () && vr1->maybe_anti_range ())
- {
- int_range<3> tmp (*vr1);
- tmp.invert ();
- intersect_ranges (&vr0kind, &vr0min, &vr0max,
- VR_ANTI_RANGE, tmp.min (), tmp.max ());
- }
- else
- intersect_ranges (&vr0kind, &vr0min, &vr0max,
- vr1->kind (), vr1->min (), vr1->max ());
+
+ intersect_ranges (&vr0kind, &vr0min, &vr0max,
+ vr1->kind (), vr1->min (), vr1->max ());
/* Make sure to canonicalize the result though as the inversion of a
VR_RANGE can still be a VR_RANGE. */
@@ -1427,6 +1426,9 @@ give_up:
void
irange::legacy_union (irange *vr0, const irange *vr1)
{
+ gcc_checking_assert (vr0->legacy_mode_p ());
+ gcc_checking_assert (vr1->legacy_mode_p ());
+
/* VR0 has the resulting range if VR1 is undefined or VR0 is varying. */
if (vr1->undefined_p ()
|| vr0->varying_p ())
@@ -1435,16 +1437,10 @@ irange::legacy_union (irange *vr0, const irange *vr1)
/* VR1 has the resulting range if VR0 is undefined or VR1 is varying. */
if (vr0->undefined_p ())
{
- /* Avoid the full copy if we already know both sides are simple
- and can be trivially copied. */
- if (vr1->legacy_mode_p ())
- {
- vr0->set (vr1->min (), vr1->max (), vr1->kind ());
- return;
- }
- *vr0 = *vr1;
+ vr0->set (vr1->min (), vr1->max (), vr1->kind ());
return;
}
+
if (vr1->varying_p ())
{
vr0->set_varying (vr1->type ());
@@ -1454,17 +1450,9 @@ irange::legacy_union (irange *vr0, const irange *vr1)
value_range_kind vr0kind = vr0->kind ();
tree vr0min = vr0->min ();
tree vr0max = vr0->max ();
- /* Handle multi-ranges that can be represented as anti-ranges. */
- if (!vr1->legacy_mode_p () && vr1->maybe_anti_range ())
- {
- int_range<3> tmp (*vr1);
- tmp.invert ();
- union_ranges (&vr0kind, &vr0min, &vr0max,
- VR_ANTI_RANGE, tmp.min (), tmp.max ());
- }
- else
- union_ranges (&vr0kind, &vr0min, &vr0max,
- vr1->kind (), vr1->min (), vr1->max ());
+
+ union_ranges (&vr0kind, &vr0min, &vr0max,
+ vr1->kind (), vr1->min (), vr1->max ());
if (vr0kind == VR_UNDEFINED)
vr0->set_undefined ();
@@ -1492,6 +1480,12 @@ irange::union_ (const irange *other)
{
if (legacy_mode_p ())
{
+ if (!other->legacy_mode_p ())
+ {
+ int_range<1> tmp = *other;
+ legacy_union (this, &tmp);
+ return;
+ }
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Meeting\n ");
@@ -1514,8 +1508,7 @@ irange::union_ (const irange *other)
if (other->legacy_mode_p ())
{
- int_range<2> wider;
- wider = *other;
+ int_range<2> wider = *other;
irange_union (wider);
}
else
@@ -1527,6 +1520,12 @@ irange::intersect (const irange *other)
{
if (legacy_mode_p ())
{
+ if (!other->legacy_mode_p ())
+ {
+ int_range<1> tmp = *other;
+ legacy_intersect (this, &tmp);
+ return;
+ }
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Intersecting\n ");
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 8497791..760ee77 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -43,6 +43,7 @@ enum value_range_kind
class irange
{
+ friend class irange_allocator;
public:
// In-place setters.
void set (tree, tree, value_range_kind = VR_RANGE);
@@ -80,6 +81,7 @@ public:
bool operator!= (const irange &r) const { return !(*this == r); }
// Misc methods.
+ bool fits_p (const irange &r) { return m_max_ranges >= r.num_pairs (); }
void dump (FILE * = stderr) const;
// Deprecated legacy public methods.
@@ -122,7 +124,8 @@ protected:
wide_int legacy_upper_bound (unsigned) const;
int value_inside_range (tree) const;
bool maybe_anti_range () const;
- void copy_legacy_range (const irange &);
+ void copy_to_legacy (const irange &);
+ void copy_legacy_to_multi_range (const irange &);
private:
unsigned char m_num_ranges;
@@ -619,4 +622,67 @@ vrp_val_min (const_tree type)
return NULL_TREE;
}
+// This is the irange storage class. It is used to allocate the
+// minimum amount of storage needed for a given irange. Storage is
+// automatically freed at destruction of the storage class.
+//
+// It is meant for long term storage, as opposed to int_range_max
+// which is meant for intermediate temporary results on the stack.
+//
+// The newly allocated irange is initialized to the empty set
+// (undefined_p() is true).
+
+class irange_allocator
+{
+public:
+ irange_allocator ();
+ ~irange_allocator ();
+ // Return a new range with NUM_PAIRS.
+ irange *allocate (unsigned num_pairs);
+ // Return a copy of SRC with the minimum amount of sub-ranges needed
+ // to represent it.
+ irange *allocate (const irange &src);
+private:
+ DISABLE_COPY_AND_ASSIGN (irange_allocator);
+ struct obstack m_obstack;
+};
+
+inline
+irange_allocator::irange_allocator ()
+{
+ obstack_init (&m_obstack);
+}
+
+inline
+irange_allocator::~irange_allocator ()
+{
+ obstack_free (&m_obstack, NULL);
+}
+
+// Return a new range with NUM_PAIRS.
+
+inline irange *
+irange_allocator::allocate (unsigned num_pairs)
+{
+ // Never allocate 0 pairs.
+ // Don't allocate 1 either, or we get legacy value_range's.
+ if (num_pairs < 2)
+ num_pairs = 2;
+
+ size_t nbytes = sizeof (tree) * 2 * num_pairs;
+
+ // Allocate the irange and required memory for the vector.
+ void *r = obstack_alloc (&m_obstack, sizeof (irange));
+ tree *mem = (tree *) obstack_alloc (&m_obstack, nbytes);
+ return new (r) irange (mem, num_pairs);
+}
+
+inline irange *
+irange_allocator::allocate (const irange &src)
+{
+ irange *r = allocate (src.num_pairs ());
+ *r = src;
+ return r;
+}
+
#endif // GCC_VALUE_RANGE_H
diff --git a/gcc/vec.h b/gcc/vec.h
index 48e756e..3ad2697 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1540,6 +1540,21 @@ public:
auto_vec () { this->m_vec = NULL; }
auto_vec (size_t n) { this->create (n); }
~auto_vec () { this->release (); }
+
+ auto_vec (vec<T, va_heap>&& r)
+ {
+ gcc_assert (!r.using_auto_storage ());
+ this->m_vec = r.m_vec;
+ r.m_vec = NULL;
+ }
+ auto_vec& operator= (vec<T, va_heap>&& r)
+ {
+ gcc_assert (!r.using_auto_storage ());
+ this->release ();
+ this->m_vec = r.m_vec;
+ r.m_vec = NULL;
+ return *this;
+ }
};
diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index 9b21441..7a0e70e 100644
--- a/gcc/vr-values.c
+++ b/gcc/vr-values.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "vr-values.h"
#include "cfghooks.h"
#include "range-op.h"
+#include "gimple-range.h"
/* Set value range VR to a non-negative range of type TYPE. */
@@ -92,7 +93,7 @@ vr_values::get_lattice_entry (const_tree var)
return vr;
/* Create a default value range. */
- vr = new (vrp_value_range_pool.allocate ()) value_range_equiv;
+ vr = allocate_value_range_equiv ();
vr_value[ver] = vr;
/* After propagation finished return varying. */
@@ -173,6 +174,52 @@ vr_values::get_value_range (const_tree var,
return vr;
}
+bool
+vr_values::range_of_expr (irange &r, tree expr, gimple *stmt)
+{
+ if (!gimple_range_ssa_p (expr))
+ return get_tree_range (r, expr);
+
+ if (const value_range *vr = get_value_range (expr, stmt))
+ {
+ if (vr->undefined_p () || vr->varying_p () || vr->constant_p ())
+ r = *vr;
+ else
+ {
+ value_range tmp = *vr;
+ tmp.normalize_symbolics ();
+ r = tmp;
+ }
+ return true;
+ }
+ return false;
+}
+
+tree
+vr_values::value_of_expr (tree op, gimple *)
+{
+ return op_with_constant_singleton_value_range (op);
+}
+
+tree
+vr_values::value_on_edge (edge, tree op)
+{
+ return op_with_constant_singleton_value_range (op);
+}
+
+tree
+vr_values::value_of_stmt (gimple *stmt, tree op)
+{
+ if (!op)
+ op = gimple_get_lhs (stmt);
+
+ gcc_checking_assert (!op|| op == gimple_get_lhs (stmt));
+
+ if (op)
+ return op_with_constant_singleton_value_range (op);
+ return NULL_TREE;
+}
+
/* Set the lattice entry for DEF to VARYING. */
void
@@ -451,7 +498,7 @@ simplify_using_ranges::op_with_boolean_value_range_p (tree op)
/* ?? Errr, this should probably check for [0,0] and [1,1] as well
as [0,1]. */
- const value_range *vr = get_value_range (op);
+ const value_range *vr = query->get_value_range (op);
return *vr == value_range (build_zero_cst (TREE_TYPE (op)),
build_one_cst (TREE_TYPE (op)));
}
@@ -1006,20 +1053,20 @@ vr_values::extract_range_from_comparison (value_range_equiv *vr,
overflow. */
static bool
-check_for_binary_op_overflow (range_query *store,
+check_for_binary_op_overflow (range_query *query,
enum tree_code subcode, tree type,
tree op0, tree op1, bool *ovf)
{
value_range vr0, vr1;
if (TREE_CODE (op0) == SSA_NAME)
- vr0 = *store->get_value_range (op0);
+ vr0 = *query->get_value_range (op0);
else if (TREE_CODE (op0) == INTEGER_CST)
vr0.set (op0);
else
vr0.set_varying (TREE_TYPE (op0));
if (TREE_CODE (op1) == SSA_NAME)
- vr1 = *store->get_value_range (op1);
+ vr1 = *query->get_value_range (op1);
else if (TREE_CODE (op1) == INTEGER_CST)
vr1.set (op1);
else
@@ -1108,127 +1155,138 @@ check_for_binary_op_overflow (range_query *store,
return true;
}
-/* Try to derive a nonnegative or nonzero range out of STMT relying
- primarily on generic routines in fold in conjunction with range data.
- Store the result in *VR */
+/* Derive a range from a builtin. Set range in VR and return TRUE if
+ successful. */
-void
-vr_values::extract_range_basic (value_range_equiv *vr, gimple *stmt)
+bool
+vr_values::extract_range_builtin (value_range_equiv *vr, gimple *stmt)
{
- bool sop;
+ gcc_assert (is_gimple_call (stmt));
tree type = gimple_expr_type (stmt);
+ tree arg;
+ int mini, maxi, zerov = 0, prec;
+ enum tree_code subcode = ERROR_MARK;
+ combined_fn cfn = gimple_call_combined_fn (stmt);
+ scalar_int_mode mode;
- if (is_gimple_call (stmt))
+ switch (cfn)
{
- tree arg;
- int mini, maxi, zerov = 0, prec;
- enum tree_code subcode = ERROR_MARK;
- combined_fn cfn = gimple_call_combined_fn (stmt);
- scalar_int_mode mode;
-
- switch (cfn)
+ case CFN_BUILT_IN_CONSTANT_P:
+ /* Resolve calls to __builtin_constant_p after inlining. */
+ if (cfun->after_inlining)
{
- case CFN_BUILT_IN_CONSTANT_P:
- /* Resolve calls to __builtin_constant_p after inlining. */
- if (cfun->after_inlining)
+ vr->set_zero (type);
+ vr->equiv_clear ();
+ return true;
+ }
+ break;
+ /* Both __builtin_ffs* and __builtin_popcount return
+ [0, prec]. */
+ CASE_CFN_FFS:
+ CASE_CFN_POPCOUNT:
+ arg = gimple_call_arg (stmt, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec;
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ const value_range_equiv *vr0 = get_value_range (arg);
+ /* If arg is non-zero, then ffs or popcount are non-zero. */
+ if (range_includes_zero_p (vr0) == 0)
+ mini = 1;
+ /* If some high bits are known to be zero,
+ we can decrease the maximum. */
+ if (vr0->kind () == VR_RANGE
+ && TREE_CODE (vr0->max ()) == INTEGER_CST
+ && !operand_less_p (vr0->min (),
+ build_zero_cst (TREE_TYPE (vr0->min ()))))
+ maxi = tree_floor_log2 (vr0->max ()) + 1;
+ }
+ goto bitop_builtin;
+ /* __builtin_parity* returns [0, 1]. */
+ CASE_CFN_PARITY:
+ mini = 0;
+ maxi = 1;
+ goto bitop_builtin;
+ /* __builtin_clz* return [0, prec-1], except for
+ when the argument is 0, but that is undefined behavior.
+ Always handle __builtin_clz* which can be only written
+ by user as UB on 0 and so [0, prec-1] range, and the internal-fn
+ calls depending on how CLZ_DEFINED_VALUE_AT_ZERO is defined. */
+ CASE_CFN_CLZ:
+ arg = gimple_call_arg (stmt, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec - 1;
+ mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
+ if (gimple_call_internal_p (stmt))
+ {
+ if (optab_handler (clz_optab, mode) != CODE_FOR_nothing
+ && CLZ_DEFINED_VALUE_AT_ZERO (mode, zerov) == 2)
{
- vr->set_zero (type);
- vr->equiv_clear ();
- return;
+ /* Handle only the single common value. */
+ if (zerov == prec)
+ maxi = prec;
+ /* Magic value to give up, unless vr0 proves
+ arg is non-zero. */
+ else
+ mini = -2;
}
- break;
- /* Both __builtin_ffs* and __builtin_popcount return
- [0, prec]. */
- CASE_CFN_FFS:
- CASE_CFN_POPCOUNT:
- arg = gimple_call_arg (stmt, 0);
- prec = TYPE_PRECISION (TREE_TYPE (arg));
- mini = 0;
- maxi = prec;
- if (TREE_CODE (arg) == SSA_NAME)
+ }
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ const value_range_equiv *vr0 = get_value_range (arg);
+ /* From clz of VR_RANGE minimum we can compute
+ result maximum. */
+ if (vr0->kind () == VR_RANGE
+ && TREE_CODE (vr0->min ()) == INTEGER_CST
+ && integer_nonzerop (vr0->min ()))
{
- const value_range_equiv *vr0 = get_value_range (arg);
- /* If arg is non-zero, then ffs or popcount are non-zero. */
- if (range_includes_zero_p (vr0) == 0)
- mini = 1;
- /* If some high bits are known to be zero,
- we can decrease the maximum. */
- if (vr0->kind () == VR_RANGE
- && TREE_CODE (vr0->max ()) == INTEGER_CST
- && !operand_less_p (vr0->min (),
- build_zero_cst (TREE_TYPE (vr0->min ()))))
- maxi = tree_floor_log2 (vr0->max ()) + 1;
+ maxi = prec - 1 - tree_floor_log2 (vr0->min ());
+ if (mini == -2)
+ mini = 0;
}
- goto bitop_builtin;
- /* __builtin_parity* returns [0, 1]. */
- CASE_CFN_PARITY:
- mini = 0;
- maxi = 1;
- goto bitop_builtin;
- /* __builtin_c[lt]z* return [0, prec-1], except for
- when the argument is 0, but that is undefined behavior.
- On many targets where the CLZ RTL or optab value is defined
- for 0 the value is prec, so include that in the range
- by default. */
- CASE_CFN_CLZ:
- arg = gimple_call_arg (stmt, 0);
- prec = TYPE_PRECISION (TREE_TYPE (arg));
- mini = 0;
- maxi = prec;
- mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
- if (optab_handler (clz_optab, mode) != CODE_FOR_nothing
- && CLZ_DEFINED_VALUE_AT_ZERO (mode, zerov)
- /* Handle only the single common value. */
- && zerov != prec)
- /* Magic value to give up, unless vr0 proves
- arg is non-zero. */
- mini = -2;
- if (TREE_CODE (arg) == SSA_NAME)
+ else if (vr0->kind () == VR_ANTI_RANGE
+ && integer_zerop (vr0->min ()))
{
- const value_range_equiv *vr0 = get_value_range (arg);
- /* From clz of VR_RANGE minimum we can compute
- result maximum. */
- if (vr0->kind () == VR_RANGE
- && TREE_CODE (vr0->min ()) == INTEGER_CST)
- {
- maxi = prec - 1 - tree_floor_log2 (vr0->min ());
- if (maxi != prec)
- mini = 0;
- }
- else if (vr0->kind () == VR_ANTI_RANGE
- && integer_zerop (vr0->min ()))
- {
- maxi = prec - 1;
- mini = 0;
- }
- if (mini == -2)
- break;
- /* From clz of VR_RANGE maximum we can compute
- result minimum. */
- if (vr0->kind () == VR_RANGE
- && TREE_CODE (vr0->max ()) == INTEGER_CST)
- {
- mini = prec - 1 - tree_floor_log2 (vr0->max ());
- if (mini == prec)
- break;
- }
+ maxi = prec - 1;
+ mini = 0;
}
if (mini == -2)
break;
- goto bitop_builtin;
- /* __builtin_ctz* return [0, prec-1], except for
- when the argument is 0, but that is undefined behavior.
- If there is a ctz optab for this mode and
- CTZ_DEFINED_VALUE_AT_ZERO, include that in the range,
- otherwise just assume 0 won't be seen. */
- CASE_CFN_CTZ:
- arg = gimple_call_arg (stmt, 0);
- prec = TYPE_PRECISION (TREE_TYPE (arg));
- mini = 0;
- maxi = prec - 1;
- mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
+ /* From clz of VR_RANGE maximum we can compute
+ result minimum. */
+ if (vr0->kind () == VR_RANGE
+ && TREE_CODE (vr0->max ()) == INTEGER_CST)
+ {
+ int newmini = prec - 1 - tree_floor_log2 (vr0->max ());
+ if (newmini == prec)
+ {
+ if (maxi == prec)
+ mini = prec;
+ }
+ else
+ mini = newmini;
+ }
+ }
+ if (mini == -2)
+ break;
+ goto bitop_builtin;
+ /* __builtin_ctz* return [0, prec-1], except for
+ when the argument is 0, but that is undefined behavior.
+ Always handle __builtin_ctz* which can be only written
+ by user as UB on 0 and so [0, prec-1] range, and the internal-fn
+ calls depending on how CTZ_DEFINED_VALUE_AT_ZERO is defined. */
+ CASE_CFN_CTZ:
+ arg = gimple_call_arg (stmt, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec - 1;
+ mode = SCALAR_INT_TYPE_MODE (TREE_TYPE (arg));
+ if (gimple_call_internal_p (stmt))
+ {
if (optab_handler (ctz_optab, mode) != CODE_FOR_nothing
- && CTZ_DEFINED_VALUE_AT_ZERO (mode, zerov))
+ && CTZ_DEFINED_VALUE_AT_ZERO (mode, zerov) == 2)
{
/* Handle only the two common values. */
if (zerov == -1)
@@ -1240,117 +1298,149 @@ vr_values::extract_range_basic (value_range_equiv *vr, gimple *stmt)
arg is non-zero. */
mini = -2;
}
- if (TREE_CODE (arg) == SSA_NAME)
+ }
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ const value_range_equiv *vr0 = get_value_range (arg);
+ /* If arg is non-zero, then use [0, prec - 1]. */
+ if ((vr0->kind () == VR_RANGE
+ && integer_nonzerop (vr0->min ()))
+ || (vr0->kind () == VR_ANTI_RANGE
+ && integer_zerop (vr0->min ())))
{
- const value_range_equiv *vr0 = get_value_range (arg);
- /* If arg is non-zero, then use [0, prec - 1]. */
- if ((vr0->kind () == VR_RANGE
- && integer_nonzerop (vr0->min ()))
- || (vr0->kind () == VR_ANTI_RANGE
- && integer_zerop (vr0->min ())))
- {
- mini = 0;
- maxi = prec - 1;
- }
- /* If some high bits are known to be zero,
- we can decrease the result maximum. */
- if (vr0->kind () == VR_RANGE
- && TREE_CODE (vr0->max ()) == INTEGER_CST)
+ mini = 0;
+ maxi = prec - 1;
+ }
+ /* If some high bits are known to be zero,
+ we can decrease the result maximum. */
+ if (vr0->kind () == VR_RANGE
+ && TREE_CODE (vr0->max ()) == INTEGER_CST)
+ {
+ int newmaxi = tree_floor_log2 (vr0->max ());
+ if (newmaxi == -1)
{
- maxi = tree_floor_log2 (vr0->max ());
- /* For vr0 [0, 0] give up. */
- if (maxi == -1)
- break;
+ if (mini == -1)
+ maxi = -1;
+ else if (maxi == prec)
+ mini = prec;
}
+ else if (maxi != prec)
+ maxi = newmaxi;
}
- if (mini == -2)
- break;
- goto bitop_builtin;
- /* __builtin_clrsb* returns [0, prec-1]. */
- CASE_CFN_CLRSB:
- arg = gimple_call_arg (stmt, 0);
- prec = TYPE_PRECISION (TREE_TYPE (arg));
- mini = 0;
- maxi = prec - 1;
- goto bitop_builtin;
- bitop_builtin:
- vr->set (build_int_cst (type, mini), build_int_cst (type, maxi));
- return;
- case CFN_UBSAN_CHECK_ADD:
- subcode = PLUS_EXPR;
- break;
- case CFN_UBSAN_CHECK_SUB:
- subcode = MINUS_EXPR;
- break;
- case CFN_UBSAN_CHECK_MUL:
- subcode = MULT_EXPR;
- break;
- case CFN_GOACC_DIM_SIZE:
- case CFN_GOACC_DIM_POS:
- /* Optimizing these two internal functions helps the loop
- optimizer eliminate outer comparisons. Size is [1,N]
- and pos is [0,N-1]. */
+ }
+ if (mini == -2)
+ break;
+ goto bitop_builtin;
+ /* __builtin_clrsb* returns [0, prec-1]. */
+ CASE_CFN_CLRSB:
+ arg = gimple_call_arg (stmt, 0);
+ prec = TYPE_PRECISION (TREE_TYPE (arg));
+ mini = 0;
+ maxi = prec - 1;
+ goto bitop_builtin;
+ bitop_builtin:
+ vr->set (build_int_cst (type, mini), build_int_cst (type, maxi));
+ return true;
+ case CFN_UBSAN_CHECK_ADD:
+ subcode = PLUS_EXPR;
+ break;
+ case CFN_UBSAN_CHECK_SUB:
+ subcode = MINUS_EXPR;
+ break;
+ case CFN_UBSAN_CHECK_MUL:
+ subcode = MULT_EXPR;
+ break;
+ case CFN_GOACC_DIM_SIZE:
+ case CFN_GOACC_DIM_POS:
+ /* Optimizing these two internal functions helps the loop
+ optimizer eliminate outer comparisons. Size is [1,N]
+ and pos is [0,N-1]. */
+ {
+ bool is_pos = cfn == CFN_GOACC_DIM_POS;
+ int axis = oacc_get_ifn_dim_arg (stmt);
+ int size = oacc_get_fn_dim_size (current_function_decl, axis);
+
+ if (!size)
+ /* If it's dynamic, the backend might know a hardware
+ limitation. */
+ size = targetm.goacc.dim_limit (axis);
+
+ tree type = TREE_TYPE (gimple_call_lhs (stmt));
+ vr->set(build_int_cst (type, is_pos ? 0 : 1),
+ size
+ ? build_int_cst (type, size - is_pos) : vrp_val_max (type));
+ }
+ return true;
+ case CFN_BUILT_IN_STRLEN:
+ if (tree lhs = gimple_call_lhs (stmt))
+ if (ptrdiff_type_node
+ && (TYPE_PRECISION (ptrdiff_type_node)
+ == TYPE_PRECISION (TREE_TYPE (lhs))))
{
- bool is_pos = cfn == CFN_GOACC_DIM_POS;
- int axis = oacc_get_ifn_dim_arg (stmt);
- int size = oacc_get_fn_dim_size (current_function_decl, axis);
-
- if (!size)
- /* If it's dynamic, the backend might know a hardware
- limitation. */
- size = targetm.goacc.dim_limit (axis);
-
- tree type = TREE_TYPE (gimple_call_lhs (stmt));
- vr->set(build_int_cst (type, is_pos ? 0 : 1),
- size
- ? build_int_cst (type, size - is_pos) : vrp_val_max (type));
+ tree type = TREE_TYPE (lhs);
+ tree max = vrp_val_max (ptrdiff_type_node);
+ wide_int wmax = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max)));
+ tree range_min = build_zero_cst (type);
+ /* To account for the terminating NUL, the maximum length
+ is one less than the maximum array size, which in turn
+ is one less than PTRDIFF_MAX (or SIZE_MAX where it's
+ smaller than the former type).
+ FIXME: Use max_object_size() - 1 here. */
+ tree range_max = wide_int_to_tree (type, wmax - 2);
+ vr->set (range_min, range_max);
+ return true;
}
- return;
- case CFN_BUILT_IN_STRLEN:
- if (tree lhs = gimple_call_lhs (stmt))
- if (ptrdiff_type_node
- && (TYPE_PRECISION (ptrdiff_type_node)
- == TYPE_PRECISION (TREE_TYPE (lhs))))
- {
- tree type = TREE_TYPE (lhs);
- tree max = vrp_val_max (ptrdiff_type_node);
- wide_int wmax = wi::to_wide (max, TYPE_PRECISION (TREE_TYPE (max)));
- tree range_min = build_zero_cst (type);
- /* To account for the terminating NUL, the maximum length
- is one less than the maximum array size, which in turn
- is one less than PTRDIFF_MAX (or SIZE_MAX where it's
- smaller than the former type).
- FIXME: Use max_object_size() - 1 here. */
- tree range_max = wide_int_to_tree (type, wmax - 2);
- vr->set (range_min, range_max);
- return;
- }
- break;
- default:
- break;
- }
- if (subcode != ERROR_MARK)
- {
- bool saved_flag_wrapv = flag_wrapv;
- /* Pretend the arithmetics is wrapping. If there is
- any overflow, we'll complain, but will actually do
- wrapping operation. */
- flag_wrapv = 1;
- extract_range_from_binary_expr (vr, subcode, type,
- gimple_call_arg (stmt, 0),
- gimple_call_arg (stmt, 1));
- flag_wrapv = saved_flag_wrapv;
-
- /* If for both arguments vrp_valueize returned non-NULL,
- this should have been already folded and if not, it
- wasn't folded because of overflow. Avoid removing the
- UBSAN_CHECK_* calls in that case. */
- if (vr->kind () == VR_RANGE
- && (vr->min () == vr->max ()
- || operand_equal_p (vr->min (), vr->max (), 0)))
- vr->set_varying (vr->type ());
- return;
- }
+ break;
+ default:
+ break;
+ }
+ if (subcode != ERROR_MARK)
+ {
+ bool saved_flag_wrapv = flag_wrapv;
+ /* Pretend the arithmetics is wrapping. If there is
+ any overflow, we'll complain, but will actually do
+ wrapping operation. */
+ flag_wrapv = 1;
+ extract_range_from_binary_expr (vr, subcode, type,
+ gimple_call_arg (stmt, 0),
+ gimple_call_arg (stmt, 1));
+ flag_wrapv = saved_flag_wrapv;
+
+ /* If for both arguments vrp_valueize returned non-NULL,
+ this should have been already folded and if not, it
+ wasn't folded because of overflow. Avoid removing the
+ UBSAN_CHECK_* calls in that case. */
+ if (vr->kind () == VR_RANGE
+ && (vr->min () == vr->max ()
+ || operand_equal_p (vr->min (), vr->max (), 0)))
+ vr->set_varying (vr->type ());
+
+ return !vr->varying_p ();
+ }
+ return false;
+}
+
+/* Try to derive a nonnegative or nonzero range out of STMT relying
+ primarily on generic routines in fold in conjunction with range data.
+ Store the result in *VR */
+
+void
+vr_values::extract_range_basic (value_range_equiv *vr, gimple *stmt)
+{
+ bool sop;
+ tree type = gimple_expr_type (stmt);
+
+ if (is_gimple_call (stmt) && extract_range_builtin (vr, stmt))
+ {
+ value_range_equiv tmp;
+ /* Assert that any ranges vr_values::extract_range_builtin gets
+ are also handled by the ranger counterpart. */
+ gcc_assert (range_of_builtin_call (*this, tmp, as_a<gcall *> (stmt)));
+#if 0
+ /* Disable this while PR97505 is resolved. */
+ gcc_assert (tmp.equal_p (*vr, /*ignore_equivs=*/false));
+#endif
+ return;
}
/* Handle extraction of the two results (result of arithmetics and
a flag whether arithmetics overflowed) from {ADD,SUB,MUL}_OVERFLOW
@@ -1754,7 +1844,7 @@ bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
if (is_gimple_min_invariant (chrec))
{
*min = *max = chrec;
- return true;
+ goto fix_overflow;
}
if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
@@ -1874,6 +1964,7 @@ bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
else
*min = init;
+ fix_overflow:
/* Even for valid range info, sometimes overflow flag will leak in.
As GIMPLE IL should have no constants with TREE_OVERFLOW set, we
drop them. */
@@ -1934,7 +2025,7 @@ vr_values::dump_all_value_ranges (FILE *file)
for (i = 0; i < num_vr_values; i++)
{
- if (vr_value[i])
+ if (vr_value[i] && ssa_name (i))
{
print_generic_expr (file, ssa_name (i));
fprintf (file, ": ");
@@ -1948,8 +2039,7 @@ vr_values::dump_all_value_ranges (FILE *file)
/* Initialize VRP lattice. */
-vr_values::vr_values () : vrp_value_range_pool ("Tree VRP value ranges"),
- simplifier (this)
+vr_values::vr_values () : simplifier (this)
{
values_propagated = false;
num_vr_values = num_ssa_names * 2;
@@ -1966,7 +2056,6 @@ vr_values::~vr_values ()
free (vr_value);
free (vr_phi_edge_counts);
bitmap_obstack_release (&vrp_equiv_obstack);
- vrp_value_range_pool.release ();
/* So that we can distinguish between VRP data being available
and not available. */
@@ -2092,7 +2181,7 @@ const value_range_equiv *
simplify_using_ranges::get_vr_for_comparison (int i, value_range_equiv *tem)
{
/* Shallow-copy equiv bitmap. */
- const value_range_equiv *vr = get_value_range (ssa_name (i));
+ const value_range_equiv *vr = query->get_value_range (ssa_name (i));
/* If name N_i does not have a valid range, use N_i as its own
range. This allows us to compare against names that may
@@ -2117,7 +2206,7 @@ simplify_using_ranges::compare_name_with_value
bool *strict_overflow_p, bool use_equiv_p)
{
/* Get the set of equivalences for VAR. */
- bitmap e = get_value_range (var)->equiv ();
+ bitmap e = query->get_value_range (var)->equiv ();
/* Start at -1. Set it to 0 if we do a comparison without relying
on overflow, or 1 if all comparisons rely on overflow. */
@@ -2197,8 +2286,8 @@ simplify_using_ranges::compare_names (enum tree_code comp, tree n1, tree n2,
{
/* Compare the ranges of every name equivalent to N1 against the
ranges of every name equivalent to N2. */
- bitmap e1 = get_value_range (n1)->equiv ();
- bitmap e2 = get_value_range (n2)->equiv ();
+ bitmap e1 = query->get_value_range (n1)->equiv ();
+ bitmap e2 = query->get_value_range (n2)->equiv ();
/* Use the fake bitmaps if e1 or e2 are not available. */
static bitmap s_e1 = NULL, s_e2 = NULL;
@@ -2310,8 +2399,8 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops_using_ranges
(enum tree_code code, tree op0, tree op1, bool * strict_overflow_p)
{
const value_range_equiv *vr0, *vr1;
- vr0 = (TREE_CODE (op0) == SSA_NAME) ? get_value_range (op0) : NULL;
- vr1 = (TREE_CODE (op1) == SSA_NAME) ? get_value_range (op1) : NULL;
+ vr0 = (TREE_CODE (op0) == SSA_NAME) ? query->get_value_range (op0) : NULL;
+ vr1 = (TREE_CODE (op1) == SSA_NAME) ? query->get_value_range (op1) : NULL;
tree res = NULL_TREE;
if (vr0 && vr1)
@@ -2390,7 +2479,7 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops
}
else
gcc_unreachable ();
- const value_range_equiv *vr0 = get_value_range (op0, stmt);
+ const value_range_equiv *vr0 = query->get_value_range (op0, stmt);
/* If vro, the range for OP0 to pass the overflow test, has
no intersection with *vr0, OP0's known range, then the
overflow test can't pass, so return the node for false.
@@ -2496,7 +2585,7 @@ simplify_using_ranges::vrp_evaluate_conditional (tree_code code, tree op0,
always fold regardless of the value of OP0. If -Wtype-limits
was specified, emit a warning. */
tree type = TREE_TYPE (op0);
- const value_range_equiv *vr0 = get_value_range (op0, stmt);
+ const value_range_equiv *vr0 = query->get_value_range (op0, stmt);
if (vr0->varying_p ()
&& INTEGRAL_TYPE_P (type)
@@ -2547,7 +2636,7 @@ simplify_using_ranges::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p)
fprintf (dump_file, "\t");
print_generic_expr (dump_file, use);
fprintf (dump_file, ": ");
- dump_value_range (dump_file, get_value_range (use, stmt));
+ dump_value_range (dump_file, query->get_value_range (use, stmt));
}
fprintf (dump_file, "\n");
@@ -3123,7 +3212,7 @@ simplify_using_ranges::simplify_div_or_mod_using_ranges
}
else
{
- vr = get_value_range (op0, stmt);
+ vr = query->get_value_range (op0, stmt);
if (range_int_cst_p (vr))
{
op0min = vr->min ();
@@ -3134,7 +3223,7 @@ simplify_using_ranges::simplify_div_or_mod_using_ranges
if (rhs_code == TRUNC_MOD_EXPR
&& TREE_CODE (op1) == SSA_NAME)
{
- const value_range_equiv *vr1 = get_value_range (op1, stmt);
+ const value_range_equiv *vr1 = query->get_value_range (op1, stmt);
if (range_int_cst_p (vr1))
op1min = vr1->min ();
}
@@ -3283,7 +3372,7 @@ simplify_using_ranges::simplify_abs_using_ranges (gimple_stmt_iterator *gsi,
gimple *stmt)
{
tree op = gimple_assign_rhs1 (stmt);
- const value_range *vr = get_value_range (op, stmt);
+ const value_range *vr = query->get_value_range (op, stmt);
if (vr)
{
@@ -3373,14 +3462,14 @@ simplify_using_ranges::simplify_bit_ops_using_ranges
wide_int mask;
if (TREE_CODE (op0) == SSA_NAME)
- vr0 = *(get_value_range (op0, stmt));
+ vr0 = *(query->get_value_range (op0, stmt));
else if (is_gimple_min_invariant (op0))
vr0.set (op0);
else
return false;
if (TREE_CODE (op1) == SSA_NAME)
- vr1 = *(get_value_range (op1, stmt));
+ vr1 = *(query->get_value_range (op1, stmt));
else if (is_gimple_min_invariant (op1))
vr1.set (op1);
else
@@ -3506,7 +3595,7 @@ test_for_singularity (enum tree_code cond_code, tree op0,
/* Return whether the value range *VR fits in an integer type specified
by PRECISION and UNSIGNED_P. */
-static bool
+bool
range_fits_type_p (const value_range *vr,
unsigned dest_precision, signop dest_sgn)
{
@@ -3565,6 +3654,35 @@ simplify_using_ranges::fold_cond (gcond *cond)
some point we should merge all variants of this code. */
edge taken_edge;
vrp_visit_cond_stmt (cond, &taken_edge);
+
+ int_range_max r;
+ if (query->range_of_stmt (r, cond) && r.singleton_p ())
+ {
+ // COND has already been folded if arguments are constant.
+ if (TREE_CODE (gimple_cond_lhs (cond)) != SSA_NAME
+ && TREE_CODE (gimple_cond_rhs (cond)) != SSA_NAME)
+ return false;
+
+ if (r.zero_p ())
+ {
+ gcc_checking_assert (!taken_edge
+ || taken_edge->flags & EDGE_FALSE_VALUE);
+ if (dump_file && (dump_flags & TDF_DETAILS) && !taken_edge)
+ fprintf (dump_file, "\nPredicate evaluates to: 0\n");
+ gimple_cond_make_false (cond);
+ }
+ else
+ {
+ gcc_checking_assert (!taken_edge
+ || taken_edge->flags & EDGE_TRUE_VALUE);
+ if (dump_file && (dump_flags & TDF_DETAILS) && !taken_edge)
+ fprintf (dump_file, "\nPredicate evaluates to: 1\n");
+ gimple_cond_make_true (cond);
+ }
+ update_stmt (cond);
+ return true;
+ }
+
if (taken_edge)
{
if (taken_edge->flags & EDGE_TRUE_VALUE)
@@ -3599,7 +3717,7 @@ simplify_using_ranges::simplify_cond_using_ranges_1 (gcond *stmt)
&& INTEGRAL_TYPE_P (TREE_TYPE (op0))
&& is_gimple_min_invariant (op1))
{
- const value_range *vr = get_value_range (op0, stmt);
+ const value_range *vr = query->get_value_range (op0, stmt);
/* If we have range information for OP0, then we might be
able to simplify this conditional. */
@@ -3664,67 +3782,6 @@ simplify_using_ranges::simplify_cond_using_ranges_1 (gcond *stmt)
return false;
}
-/* STMT is a conditional at the end of a basic block.
-
- If the conditional is of the form SSA_NAME op constant and the SSA_NAME
- was set via a type conversion, try to replace the SSA_NAME with the RHS
- of the type conversion. Doing so makes the conversion dead which helps
- subsequent passes. */
-
-void
-simplify_cond_using_ranges_2 (vr_values *store, gcond *stmt)
-{
- tree op0 = gimple_cond_lhs (stmt);
- tree op1 = gimple_cond_rhs (stmt);
-
- /* If we have a comparison of an SSA_NAME (OP0) against a constant,
- see if OP0 was set by a type conversion where the source of
- the conversion is another SSA_NAME with a range that fits
- into the range of OP0's type.
-
- If so, the conversion is redundant as the earlier SSA_NAME can be
- used for the comparison directly if we just massage the constant in the
- comparison. */
- if (TREE_CODE (op0) == SSA_NAME
- && TREE_CODE (op1) == INTEGER_CST)
- {
- gimple *def_stmt = SSA_NAME_DEF_STMT (op0);
- tree innerop;
-
- if (!is_gimple_assign (def_stmt)
- || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
- return;
-
- innerop = gimple_assign_rhs1 (def_stmt);
-
- if (TREE_CODE (innerop) == SSA_NAME
- && !POINTER_TYPE_P (TREE_TYPE (innerop))
- && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (innerop)
- && desired_pro_or_demotion_p (TREE_TYPE (innerop), TREE_TYPE (op0)))
- {
- const value_range *vr = store->get_value_range (innerop);
-
- if (range_int_cst_p (vr)
- && range_fits_type_p (vr,
- TYPE_PRECISION (TREE_TYPE (op0)),
- TYPE_SIGN (TREE_TYPE (op0)))
- && int_fits_type_p (op1, TREE_TYPE (innerop)))
- {
- tree newconst = fold_convert (TREE_TYPE (innerop), op1);
- gimple_cond_set_lhs (stmt, innerop);
- gimple_cond_set_rhs (stmt, newconst);
- update_stmt (stmt);
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Folded into: ");
- print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
- fprintf (dump_file, "\n");
- }
- }
- }
- }
-}
-
/* Simplify a switch statement using the value range of the switch
argument. */
@@ -3743,7 +3800,7 @@ simplify_using_ranges::simplify_switch_using_ranges (gswitch *stmt)
if (TREE_CODE (op) == SSA_NAME)
{
- vr = get_value_range (op, stmt);
+ vr = query->get_value_range (op, stmt);
/* We can only handle integer ranges. */
if (vr->varying_p ()
@@ -3906,7 +3963,7 @@ simplify_using_ranges::simplify_switch_using_ranges (gswitch *stmt)
su.stmt = stmt;
su.vec = vec2;
to_update_switch_stmts.safe_push (su);
- return false;
+ return true;
}
void
@@ -4036,7 +4093,7 @@ simplify_using_ranges::simplify_float_conversion_using_ranges
gimple *stmt)
{
tree rhs1 = gimple_assign_rhs1 (stmt);
- const value_range *vr = get_value_range (rhs1, stmt);
+ const value_range *vr = query->get_value_range (rhs1, stmt);
scalar_float_mode fltmode
= SCALAR_FLOAT_TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt)));
scalar_int_mode mode;
@@ -4141,7 +4198,7 @@ simplify_using_ranges::simplify_internal_call_using_ranges
return false;
else
type = TREE_TYPE (TREE_TYPE (gimple_call_lhs (stmt)));
- if (!check_for_binary_op_overflow (store, subcode, type, op0, op1, &ovf)
+ if (!check_for_binary_op_overflow (query, subcode, type, op0, op1, &ovf)
|| (is_ubsan && ovf))
return false;
@@ -4200,7 +4257,7 @@ simplify_using_ranges::simplify_internal_call_using_ranges
bool
simplify_using_ranges::two_valued_val_range_p (tree var, tree *a, tree *b)
{
- value_range vr = *get_value_range (var);
+ value_range vr = *query->get_value_range (var);
vr.normalize_symbolics ();
if (vr.varying_p () || vr.undefined_p ())
return false;
@@ -4217,8 +4274,8 @@ simplify_using_ranges::two_valued_val_range_p (tree var, tree *a, tree *b)
return false;
}
-simplify_using_ranges::simplify_using_ranges (range_query *store)
- : store (store)
+simplify_using_ranges::simplify_using_ranges (range_query *query)
+ : query (query)
{
to_remove_edges = vNULL;
to_update_switch_stmts = vNULL;
@@ -4234,6 +4291,8 @@ simplify_using_ranges::~simplify_using_ranges ()
bool
simplify_using_ranges::simplify (gimple_stmt_iterator *gsi)
{
+ gcc_checking_assert (query);
+
gimple *stmt = gsi_stmt (*gsi);
if (is_gimple_assign (stmt))
{
diff --git a/gcc/vr-values.h b/gcc/vr-values.h
index 7051e13..59fac0c 100644
--- a/gcc/vr-values.h
+++ b/gcc/vr-values.h
@@ -21,28 +21,19 @@ along with GCC; see the file COPYING3. If not see
#define GCC_VR_VALUES_H
#include "value-range-equiv.h"
+#include "value-query.h"
// Abstract class to return a range for a given SSA.
-class range_query
-{
-public:
- virtual const value_range_equiv *get_value_range (const_tree,
- gimple * = NULL) = 0;
- virtual ~range_query () { }
-};
-
// Class to simplify a statement using range information.
-//
-// The constructor takes a full vr_values, but all it needs is
-// get_value_range() from it. This class could be made to work with
-// any range repository.
-class simplify_using_ranges : public range_query
+class simplify_using_ranges
{
public:
- simplify_using_ranges (class range_query *);
+ simplify_using_ranges (class range_query *query = NULL);
~simplify_using_ranges ();
+ void set_range_query (class range_query *q) { query = q; }
+
bool simplify (gimple_stmt_iterator *);
// ?? These should be cleaned, merged, and made private.
@@ -53,8 +44,6 @@ public:
bool *, bool *);
private:
- const value_range_equiv *get_value_range (const_tree op,
- gimple *stmt = NULL) OVERRIDE;
bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *);
bool simplify_abs_using_ranges (gimple_stmt_iterator *, gimple *);
@@ -89,7 +78,7 @@ private:
vec<edge> to_remove_edges;
vec<switch_update> to_update_switch_stmts;
- class range_query *store;
+ class range_query *query;
};
/* The VR_VALUES class holds the current view of range information
@@ -112,7 +101,12 @@ class vr_values : public range_query
vr_values (void);
~vr_values (void);
- const value_range_equiv *get_value_range (const_tree, gimple * = NULL);
+ virtual bool range_of_expr (irange &r, tree expr, gimple *stmt) OVERRIDE;
+ virtual tree value_of_expr (tree, gimple * = NULL) OVERRIDE;
+ virtual tree value_on_edge (edge, tree) OVERRIDE;
+ virtual tree value_of_stmt (gimple *, tree = NULL_TREE) OVERRIDE;
+ virtual const value_range_equiv *get_value_range (const_tree,
+ gimple * = NULL) OVERRIDE;
void set_vr_value (tree, value_range_equiv *);
value_range_equiv *swap_vr_value (tree, value_range_equiv *);
@@ -136,9 +130,9 @@ class vr_values : public range_query
/* Allocate a new value_range object. */
value_range_equiv *allocate_value_range_equiv (void)
- { return vrp_value_range_pool.allocate (); }
+ { return range_query::allocate_value_range_equiv (); }
void free_value_range (value_range_equiv *vr)
- { vrp_value_range_pool.remove (vr); }
+ { free_value_range_equiv (vr); }
private:
value_range_equiv *get_lattice_entry (const_tree);
@@ -154,9 +148,7 @@ class vr_values : public range_query
void extract_range_from_comparison (value_range_equiv *, gimple *);
void vrp_visit_assignment_or_call (gimple*, tree *, value_range_equiv *);
void vrp_visit_switch_stmt (gswitch *, edge *);
-
- /* Allocation pools for value_range objects. */
- object_allocator<value_range_equiv> vrp_value_range_pool;
+ bool extract_range_builtin (value_range_equiv *, gimple *);
/* This probably belongs in the lattice rather than in here. */
bool values_propagated;
@@ -176,17 +168,10 @@ class vr_values : public range_query
simplify_using_ranges simplifier;
};
-inline const value_range_equiv *
-simplify_using_ranges::get_value_range (const_tree op, gimple *stmt)
-{
- return store->get_value_range (op, stmt);
-}
-
extern tree get_output_for_vrp (gimple *);
-// FIXME: Move this to tree-vrp.c.
-void simplify_cond_using_ranges_2 (class vr_values *, gcond *);
-
+extern bool range_fits_type_p (const value_range *vr,
+ unsigned dest_precision, signop dest_sgn);
extern bool bounds_of_var_in_loop (tree *min, tree *max, range_query *,
class loop *loop, gimple *stmt, tree var);