aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-11-10 07:26:18 -0800
committerIan Lance Taylor <iant@golang.org>2020-11-10 07:26:18 -0800
commit8d703821c69062c0cd255787d793e44f1a95d463 (patch)
tree6b1df9cdc36cc47b6164db69a14bc86a63dc77c6 /gcc
parent9cd320ea6572c577cdf17ce1f9ea5230b166af6d (diff)
parentcf392dbdf17e38026f8e3c0e9af7f5b87f63be56 (diff)
downloadgcc-8d703821c69062c0cd255787d793e44f1a95d463.zip
gcc-8d703821c69062c0cd255787d793e44f1a95d463.tar.gz
gcc-8d703821c69062c0cd255787d793e44f1a95d463.tar.bz2
Merge from trunk revision cf392dbdf17e38026f8e3c0e9af7f5b87f63be56.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3834
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in21
-rw-r--r--gcc/ada/ChangeLog2919
-rw-r--r--gcc/ada/Makefile.rtl421
-rw-r--r--gcc/ada/ada_get_targ.adb58
-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.adb130
-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.rst44
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst89
-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.rst11
-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.ads24
-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.adb450
-rw-r--r--gcc/ada/exp_attr.adb387
-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.adb1240
-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.adb1066
-rw-r--r--gcc/ada/exp_prag.ads11
-rw-r--r--gcc/ada/exp_put_image.adb16
-rw-r--r--gcc/ada/exp_spark.adb171
-rw-r--r--gcc/ada/exp_tss.adb8
-rw-r--r--gcc/ada/exp_unst.adb4
-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.adb184
-rw-r--r--gcc/ada/freeze.ads18
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in12
-rw-r--r--gcc/ada/gcc-interface/Makefile.in7
-rw-r--r--gcc/ada/gcc-interface/decl.c46
-rw-r--r--gcc/ada/gcc-interface/misc.c2
-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.c8
-rw-r--r--gcc/ada/gcc-interface/utils.c31
-rw-r--r--gcc/ada/get_targ.adb43
-rw-r--r--gcc/ada/get_targ.ads7
-rw-r--r--gcc/ada/ghost.adb135
-rw-r--r--gcc/ada/gnat1drv.adb51
-rw-r--r--gcc/ada/gnat_cuda.adb586
-rw-r--r--gcc/ada/gnat_cuda.ads107
-rw-r--r--gcc/ada/gnat_rm.texi1078
-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.adb25
-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.adb44
-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.adb44
-rw-r--r--gcc/ada/libgnat/a-cohama.ads12
-rw-r--r--gcc/ada/libgnat/a-cohase.adb39
-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__vxworks.ads)84
-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.ads87
-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-numaux__darwin.ads103
-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.adb146
-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.adb79
-rw-r--r--gcc/ada/libgnat/g-socket.ads12
-rw-r--r--gcc/ada/libgnat/g-socpol.adb429
-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.adb137
-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.adb25
-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-imgrea.ads4
-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.ads40
-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.adb118
-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.c74
-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.adb284
-rw-r--r--gcc/ada/sem_aggr.ads2
-rw-r--r--gcc/ada/sem_attr.adb134
-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.adb283
-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.adb527
-rw-r--r--gcc/ada/sem_ch7.adb28
-rw-r--r--gcc/ada/sem_ch8.adb355
-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.adb155
-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.ads37
-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/vxworks7-cert-rtp-link.spec9
-rw-r--r--gcc/ada/widechar.adb14
-rw-r--r--gcc/ada/widechar.ads14
-rw-r--r--gcc/analyzer/ChangeLog230
-rw-r--r--gcc/analyzer/analyzer.h3
-rw-r--r--gcc/analyzer/complexity.cc95
-rw-r--r--gcc/analyzer/complexity.h51
-rw-r--r--gcc/analyzer/constraint-manager.cc22
-rw-r--r--gcc/analyzer/diagnostic-manager.cc10
-rw-r--r--gcc/analyzer/engine.cc185
-rw-r--r--gcc/analyzer/exploded-graph.h8
-rw-r--r--gcc/analyzer/program-point.cc27
-rw-r--r--gcc/analyzer/program-point.h3
-rw-r--r--gcc/analyzer/program-state.cc123
-rw-r--r--gcc/analyzer/program-state.h5
-rw-r--r--gcc/analyzer/region-model-manager.cc41
-rw-r--r--gcc/analyzer/region-model-reachability.cc119
-rw-r--r--gcc/analyzer/region-model-reachability.h8
-rw-r--r--gcc/analyzer/region-model.cc54
-rw-r--r--gcc/analyzer/region-model.h2125
-rw-r--r--gcc/analyzer/region.cc46
-rw-r--r--gcc/analyzer/region.h1017
-rw-r--r--gcc/analyzer/state-purge.cc10
-rw-r--r--gcc/analyzer/store.cc83
-rw-r--r--gcc/analyzer/store.h8
-rw-r--r--gcc/analyzer/supergraph.cc9
-rw-r--r--gcc/analyzer/svalue.cc240
-rw-r--r--gcc/analyzer/svalue.h1150
-rw-r--r--gcc/attr-fnspec.h123
-rw-r--r--gcc/attribs.c3
-rw-r--r--gcc/builtin-attrs.def6
-rw-r--r--gcc/builtins.c222
-rw-r--r--gcc/builtins.def36
-rw-r--r--gcc/c-family/ChangeLog182
-rw-r--r--gcc/c-family/c-ada-spec.c8
-rw-r--r--gcc/c-family/c-attribs.c135
-rw-r--r--gcc/c-family/c-common.c41
-rw-r--r--gcc/c-family/c-common.def3
-rw-r--r--gcc/c-family/c-common.h13
-rw-r--r--gcc/c-family/c-cppbuiltin.c8
-rw-r--r--gcc/c-family/c-gimplify.c4
-rw-r--r--gcc/c-family/c-indentation.c70
-rw-r--r--gcc/c-family/c-lex.c4
-rw-r--r--gcc/c-family/c-objc.h68
-rw-r--r--gcc/c-family/c-omp.c282
-rw-r--r--gcc/c-family/c-opts.c14
-rw-r--r--gcc/c-family/c-pragma.c19
-rw-r--r--gcc/c-family/c-pragma.h1
-rw-r--r--gcc/c-family/c-warn.c68
-rw-r--r--gcc/c-family/c.opt32
-rw-r--r--gcc/c-family/stub-objc.c27
-rw-r--r--gcc/c/ChangeLog90
-rw-r--r--gcc/c/c-decl.c51
-rw-r--r--gcc/c/c-parser.c605
-rw-r--r--gcc/c/c-tree.h1
-rw-r--r--gcc/c/c-typeck.c204
-rw-r--r--gcc/calls.c75
-rw-r--r--gcc/calls.h3
-rw-r--r--gcc/cfg.c134
-rw-r--r--gcc/cfg.h2
-rw-r--r--gcc/cfgexpand.c134
-rw-r--r--gcc/cfghooks.c21
-rw-r--r--gcc/cgraph.c299
-rw-r--r--gcc/cgraph.h175
-rw-r--r--gcc/cgraphclones.c211
-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.c17
-rw-r--r--gcc/combine.c25
-rw-r--r--gcc/common.opt12
-rw-r--r--gcc/common/config/i386/cpuinfo.h24
-rw-r--r--gcc/common/config/i386/i386-common.c116
-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.c183
-rw-r--r--gcc/config.gcc82
-rw-r--r--gcc/config.in6
-rw-r--r--gcc/config/aarch64/aarch64-bti-insert.c2
-rw-r--r--gcc/config/aarch64/aarch64-builtins.c13
-rw-r--r--gcc/config/aarch64/aarch64-cores.def2
-rw-r--r--gcc/config/aarch64/aarch64-linux.h2
-rw-r--r--gcc/config/aarch64/aarch64-modes.def4
-rw-r--r--gcc/config/aarch64/aarch64-simd-builtins.def296
-rw-r--r--gcc/config/aarch64/aarch64-simd.md60
-rw-r--r--gcc/config/aarch64/aarch64-sve.md57
-rw-r--r--gcc/config/aarch64/aarch64-vxworks.h12
-rw-r--r--gcc/config/aarch64/aarch64.c229
-rw-r--r--gcc/config/aarch64/aarch64.md7
-rw-r--r--gcc/config/aarch64/arm_bf16.h7
-rw-r--r--gcc/config/aarch64/arm_neon.h659
-rw-r--r--gcc/config/aarch64/iterators.md54
-rw-r--r--gcc/config/arc/arc.c8
-rw-r--r--gcc/config/arc/arc.md71
-rw-r--r--gcc/config/arc/constraints.md5
-rw-r--r--gcc/config/arc/simdext.md90
-rw-r--r--gcc/config/arm/arm-builtins.c11
-rw-r--r--gcc/config/arm/arm-protos.h3
-rw-r--r--gcc/config/arm/arm.c322
-rw-r--r--gcc/config/arm/arm_mve.h30
-rw-r--r--gcc/config/arm/arm_mve_builtins.def10
-rw-r--r--gcc/config/arm/arm_neon.h166
-rw-r--r--gcc/config/arm/arm_neon_builtins.def42
-rw-r--r--gcc/config/arm/iterators.md2
-rw-r--r--gcc/config/arm/mve.md278
-rw-r--r--gcc/config/arm/neon.md35
-rw-r--r--gcc/config/arm/thumb1.md74
-rw-r--r--gcc/config/arm/vec-common.md55
-rw-r--r--gcc/config/arm/vxworks.h2
-rw-r--r--gcc/config/darwin-c.c4
-rw-r--r--gcc/config/darwin-driver.c21
-rw-r--r--gcc/config/gcn/mkoffload.c7
-rw-r--r--gcc/config/glibc-d.c16
-rw-r--r--gcc/config/host-darwin.c5
-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/avxintrin.h7
-rw-r--r--gcc/config/i386/constraints.md4
-rw-r--r--gcc/config/i386/cpuid.h9
-rw-r--r--gcc/config/i386/emmintrin.h25
-rw-r--r--gcc/config/i386/hresetintrin.h48
-rw-r--r--gcc/config/i386/i386-builtin-types.def12
-rw-r--r--gcc/config/i386/i386-builtin.def31
-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.c9
-rw-r--r--gcc/config/i386/i386-expand.c343
-rw-r--r--gcc/config/i386/i386-options.c21
-rw-r--r--gcc/config/i386/i386-protos.h2
-rw-r--r--gcc/config/i386/i386.c458
-rw-r--r--gcc/config/i386/i386.h37
-rw-r--r--gcc/config/i386/i386.md150
-rw-r--r--gcc/config/i386/i386.opt16
-rw-r--r--gcc/config/i386/i386elf.h62
-rw-r--r--gcc/config/i386/immintrin.h2
-rw-r--r--gcc/config/i386/intelmic-mkoffload.c12
-rw-r--r--gcc/config/i386/keylockerintrin.h129
-rw-r--r--gcc/config/i386/linux-common.h3
-rw-r--r--gcc/config/i386/mingw-w64.h6
-rw-r--r--gcc/config/i386/mmintrin.h6
-rw-r--r--gcc/config/i386/predicates.md131
-rw-r--r--gcc/config/i386/sse.md622
-rw-r--r--gcc/config/i386/subst.md4
-rw-r--r--gcc/config/i386/t-i3863
-rw-r--r--gcc/config/i386/t-vxworks19
-rw-r--r--gcc/config/i386/uintrintrin.h87
-rw-r--r--gcc/config/i386/vxworks.h96
-rw-r--r--gcc/config/i386/x86gprintrin.h4
-rw-r--r--gcc/config/msp430/msp430.md4
-rw-r--r--gcc/config/nvptx/mkoffload.c7
-rw-r--r--gcc/config/nvptx/nvptx.opt8
-rwxr-xr-xgcc/config/riscv/multilib-generator142
-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/riscv/t-withmultilib-generator2
-rw-r--r--gcc/config/rs6000/altivec.h28
-rw-r--r--gcc/config/rs6000/altivec.md104
-rw-r--r--gcc/config/rs6000/dfp.md22
-rw-r--r--gcc/config/rs6000/rs6000-builtin.def99
-rw-r--r--gcc/config/rs6000/rs6000-call.c319
-rw-r--r--gcc/config/rs6000/rs6000.c247
-rw-r--r--gcc/config/rs6000/rs6000.h6
-rw-r--r--gcc/config/rs6000/rs6000.md36
-rw-r--r--gcc/config/rs6000/vsx.md65
-rw-r--r--gcc/config/rs6000/vxworks.h286
-rw-r--r--gcc/config/rx/rx.c8
-rw-r--r--gcc/config/rx/rx.md1
-rw-r--r--gcc/config/s390/s390-modes.def5
-rw-r--r--gcc/config/s390/s390-protos.h1
-rw-r--r--gcc/config/s390/s390.c94
-rw-r--r--gcc/config/s390/s390.h35
-rw-r--r--gcc/config/s390/s390.md214
-rw-r--r--gcc/config/s390/s390.opt11
-rw-r--r--gcc/config/s390/vector.md417
-rw-r--r--gcc/config/s390/vx-builtins.md38
-rw-r--r--gcc/config/sol2-d.c12
-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.h23
-rw-r--r--gcc/config/vxworks/_vxworks-versions.h20
-rwxr-xr-xgcc/configure122
-rw-r--r--gcc/configure.ac64
-rw-r--r--gcc/coretypes.h20
-rw-r--r--gcc/cp/ChangeLog685
-rw-r--r--gcc/cp/call.c35
-rw-r--r--gcc/cp/class.c49
-rw-r--r--gcc/cp/constexpr.c136
-rw-r--r--gcc/cp/constraint.cc250
-rw-r--r--gcc/cp/coroutines.cc25
-rw-r--r--gcc/cp/cp-gimplify.c16
-rw-r--r--gcc/cp/cp-objcp-common.c5
-rw-r--r--gcc/cp/cp-tree.h103
-rw-r--r--gcc/cp/cvt.c38
-rw-r--r--gcc/cp/cxx-pretty-print.c33
-rw-r--r--gcc/cp/decl.c233
-rw-r--r--gcc/cp/decl2.c60
-rw-r--r--gcc/cp/except.c24
-rw-r--r--gcc/cp/friend.c15
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/cp/logic.cc17
-rw-r--r--gcc/cp/method.c17
-rw-r--r--gcc/cp/name-lookup.c564
-rw-r--r--gcc/cp/name-lookup.h23
-rw-r--r--gcc/cp/parser.c706
-rw-r--r--gcc/cp/pt.c433
-rw-r--r--gcc/cp/rtti.c88
-rw-r--r--gcc/cp/search.c11
-rw-r--r--gcc/cp/semantics.c200
-rw-r--r--gcc/cp/tree.c102
-rw-r--r--gcc/cp/typeck.c137
-rw-r--r--gcc/cp/typeck2.c2
-rw-r--r--gcc/d/ChangeLog29
-rw-r--r--gcc/d/d-target.cc10
-rw-r--r--gcc/d/d-target.def10
-rw-r--r--gcc/d/decl.cc10
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/dtemplate.c66
-rw-r--r--gcc/d/dmd/idgen.c2
-rw-r--r--gcc/d/dmd/statementsem.c14
-rw-r--r--gcc/d/dmd/target.h2
-rw-r--r--gcc/dbgcnt.def2
-rw-r--r--gcc/df-scan.c12
-rw-r--r--gcc/df.h1
-rw-r--r--gcc/dfp.c2
-rw-r--r--gcc/doc/extend.texi187
-rw-r--r--gcc/doc/install.texi31
-rw-r--r--gcc/doc/invoke.texi307
-rw-r--r--gcc/doc/md.texi2
-rw-r--r--gcc/doc/sourcebuild.texi5
-rw-r--r--gcc/doc/tm.texi19
-rw-r--r--gcc/doc/tm.texi.in4
-rw-r--r--gcc/dwarf2out.c20
-rw-r--r--gcc/emit-rtl.h3
-rw-r--r--gcc/expr.c41
-rw-r--r--gcc/flag-types.h22
-rw-r--r--gcc/fold-const-call.c3
-rw-r--r--gcc/fold-const.c7
-rw-r--r--gcc/fortran/ChangeLog186
-rw-r--r--gcc/fortran/class.c2
-rw-r--r--gcc/fortran/cpp.c10
-rw-r--r--gcc/fortran/decl.c5
-rw-r--r--gcc/fortran/dump-parse-tree.c34
-rw-r--r--gcc/fortran/expr.c2
-rw-r--r--gcc/fortran/gfortran.h45
-rw-r--r--gcc/fortran/gfortran.texi3
-rw-r--r--gcc/fortran/intrinsic.c42
-rw-r--r--gcc/fortran/iresolve.c6
-rw-r--r--gcc/fortran/match.c5
-rw-r--r--gcc/fortran/match.h6
-rw-r--r--gcc/fortran/module.c3
-rw-r--r--gcc/fortran/openmp.c312
-rw-r--r--gcc/fortran/parse.c20
-rw-r--r--gcc/fortran/resolve.c35
-rw-r--r--gcc/fortran/scanner.c4
-rw-r--r--gcc/fortran/st.c4
-rw-r--r--gcc/fortran/symbol.c25
-rw-r--r--gcc/fortran/trans-array.c184
-rw-r--r--gcc/fortran/trans-decl.c97
-rw-r--r--gcc/fortran/trans-intrinsic.c123
-rw-r--r--gcc/fortran/trans-openmp.c109
-rw-r--r--gcc/fortran/trans-types.c8
-rw-r--r--gcc/fortran/trans.c7
-rw-r--r--gcc/function-tests.c1
-rw-r--r--gcc/function.c192
-rw-r--r--gcc/function.h7
-rw-r--r--gcc/gcc.c29
-rw-r--r--gcc/gcov-io.h2
-rw-r--r--gcc/gcov.c8
-rw-r--r--gcc/gengtype.c5
-rw-r--r--gcc/gimple-fold.c2
-rw-r--r--gcc/gimple-isel.cc5
-rw-r--r--gcc/gimple-range-cache.cc374
-rw-r--r--gcc/gimple-range-cache.h24
-rw-r--r--gcc/gimple-range-edge.cc24
-rw-r--r--gcc/gimple-range-gori.cc67
-rw-r--r--gcc/gimple-range.cc183
-rw-r--r--gcc/gimple-range.h16
-rw-r--r--gcc/gimple-ssa-evrp.c13
-rw-r--r--gcc/gimple-ssa-store-merging.c6
-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.c52
-rw-r--r--gcc/gimple.h4
-rw-r--r--gcc/gimplify.c347
-rw-r--r--gcc/ginclude/stdbool.h5
-rw-r--r--gcc/go/ChangeLog10
-rw-r--r--gcc/go/go-gcc.cc2
-rw-r--r--gcc/go/go-lang.c6
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/export.cc3
-rw-r--r--gcc/go/gofrontend/expressions.cc82
-rw-r--r--gcc/go/gofrontend/expressions.h8
-rw-r--r--gcc/go/gofrontend/import.cc18
-rw-r--r--gcc/go/gofrontend/types.cc10
-rw-r--r--gcc/go/gofrontend/types.h14
-rw-r--r--gcc/godump.c4
-rw-r--r--gcc/ipa-comdats.c4
-rw-r--r--gcc/ipa-cp.c79
-rw-r--r--gcc/ipa-fnsummary.c172
-rw-r--r--gcc/ipa-fnsummary.h29
-rw-r--r--gcc/ipa-icf.c36
-rw-r--r--gcc/ipa-inline-analysis.c3
-rw-r--r--gcc/ipa-inline-transform.c71
-rw-r--r--gcc/ipa-inline.c72
-rw-r--r--gcc/ipa-modref-tree.c5
-rw-r--r--gcc/ipa-modref-tree.h44
-rw-r--r--gcc/ipa-modref.c1087
-rw-r--r--gcc/ipa-modref.h1
-rw-r--r--gcc/ipa-param-manipulation.c19
-rw-r--r--gcc/ipa-polymorphic-call.c14
-rw-r--r--gcc/ipa-predicate.c2
-rw-r--r--gcc/ipa-predicate.h3
-rw-r--r--gcc/ipa-prop.c107
-rw-r--r--gcc/ipa-prop.h7
-rw-r--r--gcc/ipa-pure-const.c8
-rw-r--r--gcc/ipa-ref.c6
-rw-r--r--gcc/ipa-ref.h21
-rw-r--r--gcc/ipa-reference.c6
-rw-r--r--gcc/ipa-sra.c180
-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-costs.c12
-rw-r--r--gcc/ira.c256
-rw-r--r--gcc/ira.h7
-rw-r--r--gcc/langhooks.c2
-rw-r--r--gcc/lra-constraints.c54
-rw-r--r--gcc/lra-int.h3
-rw-r--r--gcc/lra-remat.c4
-rw-r--r--gcc/lra-spills.c10
-rw-r--r--gcc/lra.c165
-rw-r--r--gcc/lto-cgraph.c110
-rw-r--r--gcc/lto-streamer-in.c4
-rw-r--r--gcc/lto-streamer-out.c5
-rw-r--r--gcc/lto-streamer.h6
-rw-r--r--gcc/lto-wrapper.c53
-rw-r--r--gcc/lto/ChangeLog18
-rw-r--r--gcc/lto/lto-common.c1
-rw-r--r--gcc/lto/lto-partition.c7
-rw-r--r--gcc/lto/lto-symtab.c4
-rw-r--r--gcc/match.pd33
-rw-r--r--gcc/objc/ChangeLog45
-rw-r--r--gcc/objc/objc-act.c368
-rw-r--r--gcc/objc/objc-act.h7
-rw-r--r--gcc/objc/objc-gnu-runtime-abi-01.c7
-rw-r--r--gcc/objc/objc-next-runtime-abi-01.c7
-rw-r--r--gcc/objc/objc-next-runtime-abi-02.c7
-rw-r--r--gcc/omp-expand.c102
-rw-r--r--gcc/omp-general.c121
-rw-r--r--gcc/omp-low.c221
-rw-r--r--gcc/omp-offload.c26
-rw-r--r--gcc/omp-simd-clone.c70
-rw-r--r--gcc/optabs.c42
-rw-r--r--gcc/optabs.h2
-rw-r--r--gcc/optc-gen.awk3
-rw-r--r--gcc/opts.c44
-rw-r--r--gcc/opts.h6
-rw-r--r--gcc/output.h3
-rw-r--r--gcc/params.opt12
-rw-r--r--gcc/passes.c61
-rw-r--r--gcc/passes.def13
-rw-r--r--gcc/poly-int-types.h8
-rw-r--r--gcc/poly-int.h57
-rw-r--r--gcc/predict.c65
-rw-r--r--gcc/predict.h12
-rw-r--r--gcc/print-rtl.c2
-rw-r--r--gcc/print-tree.c22
-rw-r--r--gcc/profile-count.c4
-rw-r--r--gcc/range-op.cc701
-rw-r--r--gcc/recog.c29
-rw-r--r--gcc/recog.h1
-rw-r--r--gcc/regs.h3
-rw-r--r--gcc/resource.c2
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/sbitmap.c3
-rw-r--r--gcc/selftest.h1
-rw-r--r--gcc/simplify-rtx.c41
-rw-r--r--gcc/stor-layout.c17
-rw-r--r--gcc/symbol-summary.h189
-rw-r--r--gcc/symtab-clones.cc62
-rw-r--r--gcc/symtab-clones.h90
-rw-r--r--gcc/symtab-thunks.cc674
-rw-r--r--gcc/symtab-thunks.h173
-rw-r--r--gcc/symtab.c38
-rw-r--r--gcc/target.def15
-rw-r--r--gcc/targhooks.c32
-rw-r--r--gcc/targhooks.h1
-rw-r--r--gcc/testsuite/ChangeLog2473
-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/Wimplicit-fallthrough-20.c6
-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/Wunused-value-1.c33
-rw-r--r--gcc/testsuite/c-c++-common/attr-fallthrough-2.c4
-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-gomp/atomic.c43
-rw-r--r--gcc/testsuite/c-c++-common/goacc/atomic.c30
-rw-r--r--gcc/testsuite/c-c++-common/goacc/clause-locations.c19
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c236
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c (renamed from gcc/testsuite/c-c++-common/goacc/nested-reductions.c)108
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c68
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c305
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c (renamed from gcc/testsuite/c-c++-common/goacc/nested-reductions-warn.c)142
-rw-r--r--gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c93
-rw-r--r--gcc/testsuite/c-c++-common/goacc/pr92793-1.c141
-rw-r--r--gcc/testsuite/c-c++-common/gomp/allocate-1.c84
-rw-r--r--gcc/testsuite/c-c++-common/gomp/allocate-2.c45
-rw-r--r--gcc/testsuite/c-c++-common/gomp/allocate-3.c38
-rw-r--r--gcc/testsuite/c-c++-common/gomp/allocate-4.c39
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clauses-1.c138
-rw-r--r--gcc/testsuite/c-c++-common/gomp/clauses-2.c20
-rw-r--r--gcc/testsuite/c-c++-common/gomp/map-5.c24
-rw-r--r--gcc/testsuite/c-c++-common/ident-0b.c1
-rw-r--r--gcc/testsuite/c-c++-common/pr97164.c15
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-1.c15
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-10.c93
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-11.c5
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-2.c4
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-3.c4
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-4.c4
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-5.c4
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-6.c4
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-8.c5
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-9.c5
-rw-r--r--gcc/testsuite/c-c++-common/zero-scratch-regs-attr-usages.c16
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr2303.C37
-rw-r--r--gcc/testsuite/g++.dg/DRs/dr625.C15
-rw-r--r--gcc/testsuite/g++.dg/Wclass-memaccess.C209
-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/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/pr97414.C19
-rw-r--r--gcc/testsuite/g++.dg/compat/eh/filter2_y.C6
-rw-r--r--gcc/testsuite/g++.dg/concepts/pack-1.C31
-rw-r--r--gcc/testsuite/g++.dg/coroutines/pr97438.C30
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto9.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-96241.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/fallthrough2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-60.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-72.C45
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist-deduce3.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic11.C20
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/linkage2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/static_assert16.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/attr-deprecated-2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-96241.C47
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/decltype-auto1.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction75.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-96575.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/fold12.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/attr-likely2.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-complete1.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-decltype2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-fn7.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-3.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-pr84979.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-using3.C52
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/concepts-variadic2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-dtor5.C35
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-dtor6.C36
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C19
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/constexpr-dtor8.C19
-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-new15.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/enum-conv1.C117
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/enum-conv2.C115
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/enum-conv3.C115
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/fn-template16.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/fn-template7.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-eq10.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/spaceship-err5.C23
-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/eh/pr42859.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-used-2.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/is_nothrow_constructible1.C48
-rw-r--r--gcc/testsuite/g++.dg/ext/is_nothrow_constructible2.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/is_nothrow_constructible3.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/is_nothrow_constructible4.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/is_nothrow_constructible5.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/is_nothrow_constructible6.C11
-rw-r--r--gcc/testsuite/g++.dg/gomp/allocate-1.C88
-rw-r--r--gcc/testsuite/g++.dg/gomp/allocate-2.C11
-rw-r--r--gcc/testsuite/g++.dg/gomp/allocate-3.C206
-rw-r--r--gcc/testsuite/g++.dg/guality/guality.exp2
-rw-r--r--gcc/testsuite/g++.dg/inherit/thunk8.C1
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-24.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/extern-redecl2.C18
-rw-r--r--gcc/testsuite/g++.dg/lookup/local-extern.C13
-rw-r--r--gcc/testsuite/g++.dg/lookup/pr80891-5.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/using26.C4
-rw-r--r--gcc/testsuite/g++.dg/lookup/using53.C1
-rw-r--r--gcc/testsuite/g++.dg/lto/pr79050_0.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/pr84805_0.C2
-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/pr64411.C1
-rw-r--r--gcc/testsuite/g++.dg/opt/pr97767.C10
-rw-r--r--gcc/testsuite/g++.dg/other/i386-2.C2
-rw-r--r--gcc/testsuite/g++.dg/other/i386-3.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/attr3.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/pr58898.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/pr96258.C5
-rw-r--r--gcc/testsuite/g++.dg/pr57878.C1
-rw-r--r--gcc/testsuite/g++.dg/pr65032.C1
-rw-r--r--gcc/testsuite/g++.dg/pr84279.C1
-rw-r--r--gcc/testsuite/g++.dg/pr97538.C27
-rw-r--r--gcc/testsuite/g++.dg/pr97560.C45
-rw-r--r--gcc/testsuite/g++.dg/pr97609.C46
-rw-r--r--gcc/testsuite/g++.dg/template/error25.C2
-rw-r--r--gcc/testsuite/g++.dg/template/lookup16.C23
-rw-r--r--gcc/testsuite/g++.dg/template/pr97460.C9
-rw-r--r--gcc/testsuite/g++.dg/template/scope5.C2
-rw-r--r--gcc/testsuite/g++.dg/template/shadow3.C4
-rw-r--r--gcc/testsuite/g++.dg/torture/pr81659.C2
-rw-r--r--gcc/testsuite/g++.dg/torture/pr92421.C4
-rw-r--r--gcc/testsuite/g++.dg/vect/simd-11.cc61
-rw-r--r--gcc/testsuite/g++.dg/vect/slp-pr97636.cc83
-rw-r--r--gcc/testsuite/g++.dg/warn/Wdiv-by-zero-3.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wexceptions1.C9
-rw-r--r--gcc/testsuite/g++.dg/warn/Wexceptions2.C10
-rw-r--r--gcc/testsuite/g++.dg/warn/Wexceptions3.C29
-rw-r--r--gcc/testsuite/g++.dg/warn/Winit-list4.C15
-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++.dg/warn/Wtautological-compare3.C11
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits5.C11
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse.C110
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse2.C24
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse3.C129
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse4.C74
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse5.C14
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse6.C24
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse7.C27
-rw-r--r--gcc/testsuite/g++.dg/warn/Wvexing-parse8.C11
-rw-r--r--gcc/testsuite/g++.dg/warn/mvp3.C30
-rw-r--r--gcc/testsuite/g++.old-deja/g++.brendan/recurse.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/catch10.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/template4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/arm4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/for2.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/local4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/using1.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash10.C1
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash3.C2
-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/pr96998.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr97205.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr97576.c18
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr97578.c11
-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/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.c-torture/execute/pr97695.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr97764.c14
-rw-r--r--gcc/testsuite/gcc.dg/20031223-1.c5
-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-68.c118
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-70.c18
-rw-r--r--gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-9.c3
-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-44.s271
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-56.c163
-rw-r--r--gcc/testsuite/gcc.dg/Wstringop-overflow-57.c91
-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-8.c86
-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/malloc-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97514.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97568.c29
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97608.c17
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr97668.c27
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/setjmp-pr93378.c2
-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/asan/pr80166.c1
-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/attr-alloc_size-11.c4
-rw-r--r--gcc/testsuite/gcc.dg/c11-bool-1.c50
-rw-r--r--gcc/testsuite/gcc.dg/c11-labels-1.c15
-rw-r--r--gcc/testsuite/gcc.dg/c11-labels-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/c11-labels-3.c15
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/c11-parm-omit-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c7
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c12
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c62
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c42
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c11
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c7
-rw-r--r--gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c5
-rw-r--r--gcc/testsuite/gcc.dg/c2x-bool-1.c50
-rw-r--r--gcc/testsuite/gcc.dg/c2x-labels-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/c2x-labels-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/c2x-labels-3.c38
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-3.c23
-rw-r--r--gcc/testsuite/gcc.dg/c2x-parm-omit-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/c99-bool-4.c46
-rw-r--r--gcc/testsuite/gcc.dg/darwin-minversion-link.c5
-rw-r--r--gcc/testsuite/gcc.dg/decl-9.c3
-rw-r--r--gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c44
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr97439.c27
-rw-r--r--gcc/testsuite/gcc.dg/gomp/barrier-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-simd-5.c3
-rw-r--r--gcc/testsuite/gcc.dg/gomp/declare-variant-2.c3
-rw-r--r--gcc/testsuite/gcc.dg/guality/guality.exp2
-rw-r--r--gcc/testsuite/gcc.dg/ipa/inlinehint-5.c36
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modref-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/ipa/modref-2.c15
-rw-r--r--gcc/testsuite/gcc.dg/label-compound-stmt-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/modref-2_0.c27
-rw-r--r--gcc/testsuite/gcc.dg/no-strict-overflow-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr79758.c2
-rw-r--r--gcc/testsuite/gcc.dg/parse-decl-after-label.c2
-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/pr66552.c14
-rw-r--r--gcc/testsuite/gcc.dg/pr68671.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr91441.c (renamed from gcc/testsuite/gcc.target/riscv/pr91441.c)1
-rw-r--r--gcc/testsuite/gcc.dg/pr96260.c (renamed from gcc/testsuite/gcc.target/riscv/pr96260.c)1
-rw-r--r--gcc/testsuite/gcc.dg/pr96307.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr97360-2.c14
-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/pr97505.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr97515.c25
-rw-r--r--gcc/testsuite/gcc.dg/pr97520.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr97539.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr97555.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr97567-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr97567.c34
-rw-r--r--gcc/testsuite/gcc.dg/pr97596.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr97721.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr97725.c28
-rw-r--r--gcc/testsuite/gcc.dg/pr97737.c16
-rw-r--r--gcc/testsuite/gcc.dg/pr97741.c17
-rw-r--r--gcc/testsuite/gcc.dg/pragma-diag-6.c9
-rw-r--r--gcc/testsuite/gcc.dg/self-right-shift.c12
-rw-r--r--gcc/testsuite/gcc.dg/sin_cos.c41
-rw-r--r--gcc/testsuite/gcc.dg/sms-12.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr97461.c64
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-4.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c11
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr71077.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr84512.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr96789.c58
-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-ccp-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c54
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/switch-4.c25
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-41.c5
-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-54.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-55.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-56.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-57.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-58.c24
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-59.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-60.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-61.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-62.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-63.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-64.c11
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-65.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-66.c32
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-67.c16
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-68.c22
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-69.c45
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c5
-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-pr97615.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c34
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c61
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c11
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97428.c44
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97457.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97558-2.c54
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97558.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97678.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97753.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97760.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr97769.c32
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-11b.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-49.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-perm-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/tree-vect.h2
-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-outer-slp-1.c31
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c51
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c62
-rw-r--r--gcc/testsuite/gcc.misc-tests/outputs.exp24
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c27
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vect_copy_lane_1.c32
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_1.c74
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_2.c52
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_1.c227
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_2.c52
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c40
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_1.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_2.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_2.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_2.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_2.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrn_high_n.c195
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrun_high_n.c197
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrn_high_n.c193
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrun_high_n.c143
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_bf16_indices_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_bf16_indices_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_bf16_indices_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_bf16_indices_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_bf16_indices_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_bf16_indices_1.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vstX_lane.c2
-rw-r--r--gcc/testsuite/gcc.target/aarch64/narrow_high-intrinsics.c12
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr97535.c16
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr97638.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr97546.c22
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/dup_lane_2.c331
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/dup_lane_3.c90
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/ext_4.c353
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/rev_2.c177
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/revhw_1.c127
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c127
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/slp_perm_8.c18
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/trn1_2.c403
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/trn2_2.c403
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/uzp1_2.c375
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/uzp2_2.c375
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/zip1_2.c403
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/zip2_2.c403
-rw-r--r--gcc/testsuite/gcc.target/arm/mve/intrinsics/pr97327.c8
-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/pure-code/no-literal-pool-m0.c176
-rw-r--r--gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool-m23.c172
-rw-r--r--gcc/testsuite/gcc.target/arm/pure-code/pr96767.c10
-rw-r--r--gcc/testsuite/gcc.target/arm/pure-code/pr96770.c21
-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/simd/vld1_bf16_1.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_1.c22
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_indices_1.c19
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c19
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vldn_lane_bf16_1.c73
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vst1_bf16_1.c29
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_1.c22
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vstn_lane_bf16_1.c73
-rw-r--r--gcc/testsuite/gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c17
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-protector-5.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/stack-protector-6.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/avx-1.c10
-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/builtin_thread_pointer.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/fentryname1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/fentryname2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/fentryname3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/funcspec-56.inc8
-rw-r--r--gcc/testsuite/gcc.target/i386/hreset-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c33
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-encodekey128.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-encodekey256.c30
-rw-r--r--gcc/testsuite/gcc.target/i386/keylocker-loadiwkey.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/ms_hook_prologue.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/pr45352-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr47602.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr55151.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr55458.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr56348.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr57097.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr65753.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr65915.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr66232-5.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr66334.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr66819-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr67265.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr81481.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr83994.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95151-1.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95151-2.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95151-3.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95151-4.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95458-1.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/pr95458-2.c7
-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/pr95866-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97140.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97249-1.c30
-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/pr97521.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr97540.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/returninst1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/returninst2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/returninst3.c1
-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.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-23.c12
-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/x86gprintrin-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-2.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-3.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-4.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/x86gprintrin-5.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-1.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-10.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-11.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-12.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-13.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-14.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-15.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-16.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-17.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-18.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-19.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-2.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-20.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-21.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-22.c21
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-23.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-24.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-25.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-26.c23
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-27.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-28.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-29.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-3.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-30.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-31.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c11
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-4.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-5.c20
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-6.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-7.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-8.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/zero-scratch-regs-9.c15
-rw-r--r--gcc/testsuite/gcc.target/nvptx/atomic_fetch-3.c24
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-consts.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bcd-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bcd-3.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bcd-4.c521
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap64-4.c6
-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/byte-in-either-range-0.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/byte-in-either-range-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/byte-in-range-0.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/byte-in-range-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/byte-in-set-0.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/byte-in-set-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cfuged-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cntlzdm-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cnttzdm-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cprophard.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dg-future-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dimode_off.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-cmp2-runnable.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-hw3.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-mix-2.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-mix-3.c16
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-mix.c20
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-type-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/float128-type-2.c2
-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.c3
-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.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p7.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/fold-vec-extract-longlong.p8.c3
-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/le-altivec-consts.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/localentry-1.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/lsbb-runnable.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/mma-alignment.c41
-rwxr-xr-xgcc/testsuite/gcc.target/powerpc/mma-double-test.c5
-rwxr-xr-xgcc/testsuite/gcc.target/powerpc/mma-single-test.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p10-arch31.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p10-identify.c5
-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-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/pdep-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pextd-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr63335.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr64505.c265
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr67789.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79439-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79439-2.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr83629.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr84112.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr87507.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr93122.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr94740.c2
-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/pr96787-2.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96933-1.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96933-2.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96933-3.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96933-4.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96933-run.h56
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr96933.h50
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr97267.c19
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr97360.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/r2_shrink-wrap.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/rlwimi-2.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sad-vectorize-3.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/sad-vectorize-4.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/signbit-1.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/signbit-2.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/signbit-3.c2
-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/vadsdu-0.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdu-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdu-2.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdu-3.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdu-4.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdu-5.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdub-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsdub-2.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsduh-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsduh-2.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsduw-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vadsduw-2.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-blend-runnable.c12
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-cfuged-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-clrl-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-clrl-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-clrr-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-clrr-3.c5
-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-cntlzm-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-cnttzm-1.c5
-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-extracth-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extracth-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extracth-5.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extracth-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extractl-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extractl-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extractl-5.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-extractl-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-gnb-1.c5
-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-insert-word-runnable.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-mul.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-pdep-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-permute-ext-runnable.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-pext-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-replace-word-runnable.c22
-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-shift-double-runnable.c15
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c11
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-16.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-17.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-18.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-19.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-20.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-21.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-22.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-23.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-5.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril_p-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril_p-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril_p-5.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-stril_p-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-16.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-17.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-18.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-19.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-20.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-21.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-22.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-23.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-5.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir_p-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir_p-3.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir_p-5.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-strir_p-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-1.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-3.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-5.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-7.c5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-9.c7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vslv-0.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vslv-1.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsrv-0.c3
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsrv-1.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.c172
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c170
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c171
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c170
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c127
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c127
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c128
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c128
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx_mask-count-runnable.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx_mask-expand-runnable.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx_mask-extract-runnable.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx_mask-move-runnable.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsxcopy.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c5
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-7.c6
-rw-r--r--gcc/testsuite/gcc.target/riscv/attribute-10.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/s390/pr97497.c36
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-callee-abi-scan.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-run.c4
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-scan.c13
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-copysign.c21
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-fprx2-constant.c11
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-double.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-float.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-i16.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-i32.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-i64.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-i8.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-u16.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-u32.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-u64.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-from-u8.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-double.c18
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-float.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-i16.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-i32.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-i64.c21
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-i8.c19
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-u16.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-u32.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-u64.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-to-u8.c20
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-vec-duplicate.c13
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wf.h60
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfaxb.c17
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0001.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0111.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1011.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1101.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfdxb.c17
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfixb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-0111.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1011.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1101.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wflcxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wflpxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-2.c24
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-3.c14
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-disabled.c8
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb-disabled.c8
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfmxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb-disabled.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb-disabled.c9
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfsqxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb-1.c21
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb.c7
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb-1.c15
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb.c7
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21299/func.d8
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21299/mtype.d8
-rw-r--r--gcc/testsuite/gdc.test/compilable/imports/test21299/rootstringtable.d96
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21299a.d4
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21299b.d4
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21299c.d5
-rw-r--r--gcc/testsuite/gdc.test/compilable/test21299d.d27
-rw-r--r--gcc/testsuite/gfortran.dg/analyzer/pr97668.f26
-rw-r--r--gcc/testsuite/gfortran.dg/attr_deprecated.f9030
-rw-r--r--gcc/testsuite/gfortran.dg/coverage.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/goacc-gomp/atomic.f9048
-rw-r--r--gcc/testsuite/gfortran.dg/goacc-gomp/goacc-gomp.exp37
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/atomic.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/clause-locations.f9018
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f9524
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/loop-5.f95357
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/loop-6.f9574
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90300
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90 (renamed from gcc/testsuite/gfortran.dg/goacc/nested-reductions.f90)142
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f9088
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90389
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90 (renamed from gcc/testsuite/gfortran.dg/goacc/nested-reductions-warn.f90)181
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90119
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90135
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/specification-part.f90100
-rw-r--r--gcc/testsuite/gfortran.dg/goacc/warn_truncated.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/atomic-2.f9070
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/atomic.f9087
-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/gomp/map-2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/requires-9.f904
-rw-r--r--gcc/testsuite/gfortran.dg/guality/guality.exp2
-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/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/pr97500.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/pr97505.f9049
-rw-r--r--gcc/testsuite/gfortran.dg/value_8.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/vect/O3-bb-slp-1.f28
-rw-r--r--gcc/testsuite/gfortran.dg/vect/O3-bb-slp-2.f40
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr97761.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/vect/vect-4.f901
-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/opt88.adb52
-rw-r--r--gcc/testsuite/gnat.dg/sin_cos.adb14
-rw-r--r--gcc/testsuite/gnat.dg/sin_cos.ads4
-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/gnat.dg/warn14.adb2
-rw-r--r--gcc/testsuite/lib/asan-dg.exp6
-rw-r--r--gcc/testsuite/lib/target-supports.exp52
-rw-r--r--gcc/testsuite/lib/tsan-dg.exp6
-rw-r--r--gcc/testsuite/lib/ubsan-dg.exp6
-rw-r--r--gcc/testsuite/obj-c++.dg/SEL-typedef.mm7
-rw-r--r--gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm66
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-1.mm13
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-29.mm8
-rw-r--r--gcc/testsuite/obj-c++.dg/property/at-property-4.mm36
-rw-r--r--gcc/testsuite/obj-c++.dg/property/property-neg-2.mm2
-rw-r--r--gcc/testsuite/objc.dg/SEL-typedef.m7
-rw-r--r--gcc/testsuite/objc.dg/attributes/nsobject-01.m66
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-1.m12
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-29.m7
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-4.m32
-rw-r--r--gcc/testsuite/objc.dg/property/at-property-5.m2
-rw-r--r--gcc/testsuite/objc.dg/property/property-neg-2.m2
-rw-r--r--gcc/timevar.def1
-rw-r--r--gcc/toplev.c2
-rw-r--r--gcc/tracer.c66
-rw-r--r--gcc/trans-mem.c8
-rw-r--r--gcc/tree-cfg.c97
-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-diagnostic-path.cc204
-rw-r--r--gcc/tree-inline.c67
-rw-r--r--gcc/tree-nested.c147
-rw-r--r--gcc/tree-nested.h62
-rw-r--r--gcc/tree-pass.h9
-rw-r--r--gcc/tree-pretty-print.c18
-rw-r--r--gcc/tree-profile.c9
-rw-r--r--gcc/tree-ssa-alias.c559
-rw-r--r--gcc/tree-ssa-ccp.c27
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c3
-rw-r--r--gcc/tree-ssa-loop-ivopts.c3
-rw-r--r--gcc/tree-ssa-math-opts.c107
-rw-r--r--gcc/tree-ssa-phiopt.c138
-rw-r--r--gcc/tree-ssa-pre.c506
-rw-r--r--gcc/tree-ssa-sccvn.c55
-rw-r--r--gcc/tree-ssa-sccvn.h12
-rw-r--r--gcc/tree-ssa-structalias.c2
-rw-r--r--gcc/tree-ssa-uninit.c192
-rw-r--r--gcc/tree-switch-conversion.c3
-rw-r--r--gcc/tree-switch-conversion.h6
-rw-r--r--gcc/tree-vect-data-refs.c257
-rw-r--r--gcc/tree-vect-loop-manip.c68
-rw-r--r--gcc/tree-vect-loop.c670
-rw-r--r--gcc/tree-vect-patterns.c152
-rw-r--r--gcc/tree-vect-slp.c1591
-rw-r--r--gcc/tree-vect-stmts.c83
-rw-r--r--gcc/tree-vectorizer.c14
-rw-r--r--gcc/tree-vectorizer.h33
-rw-r--r--gcc/tree-vrp.c65
-rw-r--r--gcc/tree.c55
-rw-r--r--gcc/tree.h29
-rw-r--r--gcc/value-prof.c2
-rw-r--r--gcc/value-query.cc29
-rw-r--r--gcc/value-range.cc615
-rw-r--r--gcc/value-range.h54
-rw-r--r--gcc/varasm.c9
-rw-r--r--gcc/varpool.c2
-rw-r--r--gcc/vec.h8
-rw-r--r--gcc/vr-values.c582
-rw-r--r--gcc/vr-values.h8
-rw-r--r--gcc/wide-int.cc7
-rw-r--r--gcc/wide-int.h10
-rw-r--r--gcc/xcoffout.c2
2194 files changed, 99811 insertions, 28338 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a5dadb9..7509245 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,3833 @@
+2020-11-09 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * config/arc/arc.c (arc_split_move): Recognize vadd2 instructions.
+ * config/arc/arc.md (movdi_insn): Update pattern to use vadd2
+ instructions.
+ (movdf_insn): Likewise.
+ (maddhisi4): New pattern.
+ (umaddhisi4): Likewise.
+ * config/arc/simdext.md (mov<mode>_int): Update pattern to use
+ vadd2.
+ (sdot_prodv4hi): New pattern.
+ (udot_prodv4hi): Likewise.
+ (arc_vec_<V_US>mac_hi_v4hi): Update/renamed to
+ arc_vec_<V_US>mac_v2hiv2si.
+ (arc_vec_<V_US>mac_v2hiv2si_zero): New pattern.
+ * config/arc/constraints.md (Ral): Accumulator register
+ constraint.
+
+2020-11-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * function-tests.c (test_ranges): Call range_op_tests.
+ * range-op.cc (build_range3): Move to value-range.cc.
+ (range3_tests): Same.
+ (int_range_max_tests): Same.
+ (multi_precision_range_tests): Same.
+ (range_tests): Same.
+ (operator_tests): Split up...
+ (range_op_tests): Split up...
+ (range_op_cast_tests): ...here.
+ (range_op_lshift_tests): ...here.
+ (range_op_rshift_tests): ...here.
+ (range_op_bitwise_and_tests): ...here.
+ * selftest.h (range_op_tests): New.
+ * value-range.cc (build_range3): New.
+ (range_tests_irange3): New.
+ (range_tests_int_range_max): New.
+ (range_tests_legacy): New.
+ (range_tests_misc): New.
+ (range_tests): New.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97761
+ * tree-vect-slp.c (vect_bb_slp_mark_live_stmts): Remove
+ premature end of DFS walk.
+
+2020-11-09 Aldy Hernandez <aldyh@redhat.com>
+
+ * value-range.cc (irange::swap_out_of_order_endpoints): Rewrite
+ into static function.
+ (irange::set): Cleanup redundant manipulations.
+ * value-range.h (irange::normalize_min_max): Modify object
+ in-place instead of modifying arguments.
+
+2020-11-09 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/aarch64/aarch64-builtins.c
+ (aarch64_expand_fcmla_builtin): Do not alter force_reg returned
+ register.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97753
+ * tree-vect-loop.c (vectorizable_induction): Fill vec_steps
+ when CSEing inside the group.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97746
+ * tree-vect-patterns.c (vect_determine_precisions): First walk PHIs.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-pre.c (get_representative_for): CSE VN_INFO calls.
+ (create_expression_by_pieces): Likewise.
+ (insert_into_preds_of_block): Likewsie.
+ (do_pre_regular_insertion): Likewsie.
+ * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_insert):
+ Likewise.
+ (eliminate_dom_walker::eliminate_stmt): Likewise.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97765
+ * tree-ssa-pre.c (bb_bitmap_sets::phi_translate_table): Add.
+ (PHI_TRANS_TABLE): New macro.
+ (phi_translate_table): Remove.
+ (expr_pred_trans_d::pred): Remove.
+ (expr_pred_trans_d::hash): Simplify.
+ (expr_pred_trans_d::equal): Likewise.
+ (phi_trans_add): Adjust.
+ (phi_translate): Likewise. Remove hash-table expansion
+ detection and optimization.
+ (phi_translate_set): Allocate PHI_TRANS_TABLE here.
+ (init_pre): Adjsust.
+ (fini_pre): Free PHI_TRANS_TABLE.
+
+2020-11-09 Lili Cui <lili.cui@intel.com>
+
+ PR target/97685
+ * config/i386/i386.h:
+ (PTA_BROADWELL): Delete PTA_PRFCHW.
+ (PTA_SILVERMONT): Add PTA_PRFCHW.
+ (PTA_KNL): Add PTA_PREFETCHWT1.
+ (PTA_TREMONT): Add PTA_MOVDIRI, PTA_MOVDIR64B, PTA_CLDEMOTE and PTA_WAITPKG.
+ * doc/invoke.texi: Delete PREFETCHW for broadwell, skylake, knl, knm,
+ skylake-avx512, cannonlake, icelake-client, icelake-server, cascadelake,
+ cooperlake, tigerlake and sapphirerapids.
+ Add PREFETCHW for silvermont, goldmont, goldmont-plus and tremont.
+ Add XSAVEC and XSAVES for goldmont, goldmont-plus and tremont.
+ Add MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG for tremont.
+ Add KEYLOCKER and HREST for alderlake.
+ Add AMX-BF16, AMX-TILE, AMX-INT8 and UINTR for sapphirerapids.
+ Add KEYLOCKER for tigerlake.
+
+2020-11-09 Kewen Lin <linkw@linux.ibm.com>
+
+ PR rtl-optimization/97705
+ * ira.c (ira): Refactor some regstat free/init/compute invocation
+ into lambda function regstat_recompute_for_max_regno, and call it
+ when max_regno increases as remove_scratches succeeds.
+
+2020-11-08 David Edelsohn <dje.gcc@gmail.com>
+
+ * config/rs6000/rs6000.c (rs6000_mangle_decl_assembler_name): Change
+ DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN.
+
+2020-11-07 Martin Uecker <muecker@gwdg.de>
+
+ * doc/extend.texi: Document mixing labels and code.
+ * doc/invoke.texi: Likewise.
+
+2020-11-06 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/rs6000/rs6000.md (@tablejump<mode>_normal): Don't abuse
+ operands[].
+ (@tablejump<mode>_nospec): Ditto.
+
+2020-11-06 Peter Bergner <bergner@linux.ibm.com>
+
+ * config/rs6000/rs6000.h (BIGGEST_ALIGNMENT): Revert previous commit
+ so as not to break the ABI.
+ * config/rs6000/rs6000-call.c (rs6000_init_builtins): Set the ABI
+ mandated alignment for __vector_pair and __vector_quad types.
+
+2020-11-06 Jeff Law <law@torsion.usersys.redhat.com>
+
+ PR target/91489
+ * config/i386/i386.md (simple_return): Also check
+ for ms_hook_prologue function attribute.
+ * config/i386/i386.c (ix86_can_use_return_insn_p):
+ Also check for ms_hook_prologue function attribute.
+ * config/i386/i386-protos.h (ix86_function_ms_hook_prologue): Declare.
+
+2020-11-06 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/96933
+ * config/rs6000/rs6000.c (rs6000_expand_vector_init): Use
+ TARGET_POWERPC64 instead of TARGET_64BIT.
+
+2020-11-06 Joseph Myers <joseph@codesourcery.com>
+
+ * builtins.def (BUILT_IN_NANSD32, BUILT_IN_NANSD64)
+ (BUILT_IN_NANSD128): New built-in functions.
+ * fold-const-call.c (fold_const_call): Handle the new built-in
+ functions.
+ * doc/extend.texi (__builtin_nansd32, __builtin_nansd64)
+ (__builtin_nansd128): Document.
+ * doc/sourcebuild.texi (Effective-Target Keywords): Document
+ fenv_exceptions_dfp.
+
+2020-11-06 Bin Cheng <bin.cheng@linux.alibaba.com>
+
+ * tree-ssa-uninit.c (find_var_cmp_const): New function.
+ (use_pred_not_overlap_with_undef_path_pred): Call above.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin-c.c: Allow for Darwin20 to correspond to macOS 11.
+ * config/darwin-driver.c: Likewise.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-pre.c (expr_pred_trans_d): Modify so elements
+ are embedded rather than allocated. Remove hashval member,
+ make all members integers.
+ (phi_trans_add): Adjust accordingly.
+ (phi_translate): Likewise. Deal with re-allocation
+ of the table.
+
+2020-11-06 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97737
+ PR tree-optimization/97741
+ * gimple-range.cc: (gimple_ranger::range_of_stmt): Intersect newly
+ calculated ranges with the existing known global range.
+
+2020-11-06 Darius Galis <darius.galis@cyberthorstudios.com>
+
+ * config/rx/rx.md (CTRLREG_PC): Add.
+ * config/rx/rx.c (CTRLREG_PC): Add
+ (rx_expand_builtin_mvtc): Add warning: PC register cannot
+ be used as dest.
+
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * tree.h (DECL_IS_BUILTIN): Rename to ...
+ (DECL_IS_UNDECLARED_BUILTIN): ... here. No need to use SOURCE_LOCUS.
+ * calls.c (maybe_warn_alloc_args_overflow): Adjust for rename.
+ * cfgexpand.c (pass_expand::execute): Likewise.
+ * dwarf2out.c (base_type_die, is_naming_typedef_decl): Likewise.
+ * godump.c (go_decl, go_type_decl): Likewise.
+ * print-tree.c (print_decl_identifier): Likewise.
+ * tree-pretty-print.c (dump_generic_node): Likewise.
+ * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise.
+ * xcoffout.c (xcoff_assign_fundamental_type_number): Likewise.
+
+2020-11-06 David Candler <david.candler@arm.com>
+
+ * config/aarch64/aarch64-builtins.c
+ (TYPES_SHIFT2IMM): Add define.
+ (TYPES_SHIFT2IMM_UUSS): Add define.
+ (TYPES_USHIFT2IMM): Add define.
+ * config/aarch64/aarch64-simd.md
+ (aarch64_<sur>q<r>shr<u>n2_n<mode>): Add new insn for upper saturating shift right.
+ * config/aarch64/aarch64-simd-builtins.def: Add intrinsics.
+ * config/aarch64/arm_neon.h:
+ (vqrshrn_high_n_s16): Expand using intrinsic rather than inline asm.
+ (vqrshrn_high_n_s32): Likewise.
+ (vqrshrn_high_n_s64): Likewise.
+ (vqrshrn_high_n_u16): Likewise.
+ (vqrshrn_high_n_u32): Likewise.
+ (vqrshrn_high_n_u64): Likewise.
+ (vqrshrun_high_n_s16): Likewise.
+ (vqrshrun_high_n_s32): Likewise.
+ (vqrshrun_high_n_s64): Likewise.
+ (vqshrn_high_n_s16): Likewise.
+ (vqshrn_high_n_s32): Likewise.
+ (vqshrn_high_n_s64): Likewise.
+ (vqshrn_high_n_u16): Likewise.
+ (vqshrn_high_n_u32): Likewise.
+ (vqshrn_high_n_u64): Likewise.
+ (vqshrun_high_n_s16): Likewise.
+ (vqshrun_high_n_s32): Likewise.
+ (vqshrun_high_n_s64): Likewise.
+
+2020-11-06 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/aarch64-modes.def (VNx2BF, VNx4BF): Adjust nunits
+ and alignment based on the current VG.
+ * config/aarch64/iterators.md (SVE_ALL, SVE_24, SVE_2, SVE_4): Add
+ partial SVE BF modes.
+ (UNSPEC_REVBHW): New unspec.
+ (Vetype, Vesize, Vctype, VEL, Vel, vwcore, V_INT_CONTAINER)
+ (v_int_container, VPRED, vpred): Handle partial SVE BF modes.
+ (container_bits, Vcwtype): New mode attributes.
+ * config/aarch64/aarch64-sve.md
+ (@aarch64_sve_revbhw_<SVE_ALL:mode><PRED_HSD:mode>): New pattern.
+ (@aarch64_sve_dup_lane<mode>): Extended from SVE_FULL to SVE_ALL.
+ (@aarch64_sve_rev<mode>, @aarch64_sve_<perm_insn><mode>): Likewise.
+ (@aarch64_sve_ext<mode>): Likewise.
+ * config/aarch64/aarch64.c (aarch64_classify_vector_mode): Handle
+ E_VNx2BFmode and E_VNx4BFmode.
+ (aarch64_evpc_rev_local): Base the analysis on the container size
+ instead of the element size. Use the new aarch64_sve_revbhw
+ patterns for SVE.
+ (aarch64_evpc_dup): Handle partial SVE data modes. Use the
+ container size instead of the element size when applying the
+ SVE immediate limit. Fix a previously incorrect bounds check.
+ (aarch64_expand_vec_perm_const_1): Handle partial SVE data modes.
+
+2020-11-06 Martin Liska <mliska@suse.cz>
+
+ * common.opt: Add new -fbit-tests option.
+ * doc/invoke.texi: Document the option.
+ * tree-switch-conversion.c (bit_test_cluster::find_bit_tests):
+ Use the option.
+ * tree-switch-conversion.h (is_enabled): New function.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-sccvn.h (get_max_constant_value_id): Declare.
+ (get_next_constant_value_id): Likewise.
+ (value_id_constant_p): Inline and simplify.
+ * tree-ssa-sccvn.c (constant_value_ids): Remove.
+ (next_constant_value_id): Add.
+ (get_or_alloc_constant_value_id): Adjust.
+ (value_id_constant_p): Remove definition.
+ (get_max_constant_value_id): Define.
+ (get_next_value_id): Add assert for overflow.
+ (get_next_constant_value_id): Define.
+ (run_rpo_vn): Adjust.
+ (free_rpo_vn): Likewise.
+ (do_rpo_vn): Initialize next_constant_value_id.
+ * tree-ssa-pre.c (constant_value_expressions): New.
+ (add_to_value): Split into constant/non-constant value
+ handling. Avoid exact re-allocation.
+ (vn_valnum_from_value_id): Adjust.
+ (phi_translate_1): Remove spurious exact re-allocation.
+ (bitmap_find_leader): Adjust. Make sure we return
+ a CONSTANT value for a constant value id.
+ (do_pre_regular_insertion): Use 2 auto-elements for avail.
+ (do_pre_partial_partial_insertion): Likewise.
+ (init_pre): Allocate constant_value_expressions.
+ (fini_pre): Release constant_value_expressions.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97706
+ * tree-vect-patterns.c (possible_vector_mask_operation_p):
+ PHIs are possible mask operations.
+ (vect_determine_mask_precision): Handle PHIs.
+ (vect_determine_precisions): Walk PHIs in BB analysis.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_analyze_slp): Pass down the
+ SLP graph entry kind.
+ (vect_analyze_slp_instance): Simplify.
+ (vect_build_slp_instance): Adjust.
+ (vect_slp_check_for_constructors): Perform more
+ eligibility checks here.
+
+2020-11-06 Jan Hubicka <jh@suse.cz>
+
+ * ipa-ref.h (enum ipa_ref_use): Remove GTY marker.
+ (struct ipa_ref): Remove GTY marker; reorder for better packing.
+ (struct ipa_ref_list): Remove GTY marker; turn references
+ nad referring to va_heap, vl_ptr vectors; update accesors.
+ * cgraph.h (symtab_node::iterate_reference): Update.
+ * ipa-ref.c (ipa_ref::remove_reference): Update.
+ * symtab.c (symtab_node::create_reference): Update.
+ (symtab_node::remove_all_references): Update.
+ (symtab_node::resolve_alias): Update.
+
+2020-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ * ipa-modref-tree.h: Fix comment typos.
+ * ipa-modref.c: Likewise.
+
+2020-11-06 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * config/s390/s390.c (s390_option_override_internal): Remove
+ override of inline params.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97706
+ * tree-vect-patterns.c (vect_determine_mask_precision):
+ Remove worklist operation.
+ (vect_determine_stmt_precisions): Do not call
+ vect_determine_mask_precision here.
+ (vect_determine_precisions): Compute mask precision
+ in a forward walk.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97732
+ * tree-vect-loop.c (vectorizable_induction): Convert the
+ init elements to the vector component type.
+ * gimple-fold.c (gimple_build_vector): Use CONSTANT_CLASS_P
+ rather than TREE_CONSTANT to determine if elements are
+ eligible for VECTOR_CSTs.
+
+2020-11-06 Jan Hubicka <jh@suse.cz>
+
+ * attr-fnspec.h (attr_fnspec::get_str): New accessor
+ * ipa-fnsummary.c (read_ipa_call_summary): Store also parm info
+ for builtins.
+ * ipa-modref.c (class fnspec_summary): New type.
+ (class fnspec_summaries_t): New type.
+ (modref_summary::modref_summary): Initialize writes_errno.
+ (struct modref_summary_lto): Add writes_errno.
+ (modref_summary_lto::modref_summary_lto): Initialize writes_errno.
+ (modref_summary::dump): Check for NULL pointers.
+ (modref_summary_lto::dump): Dump writes_errno.
+ (collapse_loads): Move up in source file.
+ (collapse_stores): New function.
+ (process_fnspec): Handle also internal calls.
+ (analyze_call): Likewise.
+ (analyze_stmt): Store fnspec string if needed.
+ (analyze_function): Initialize fnspec_sumarries.
+ (modref_summaries_lto::duplicate): Copy writes_errno.
+ (modref_write): Store writes_errno and fnspec summaries.
+ (read_section): Read writes_errno and fnspec summaries.
+ (modref_read): Initialize fnspec summaries.
+ (update_signature): Fix formating.
+ (compute_parm_map): Return true if sucessful.
+ (get_parm_type): New function.
+ (get_access_for_fnspec): New function.
+ (propagate_unknown_call): New function.
+ (modref_propagate_in_scc): Use it.
+ (pass_ipa_modref::execute): Delete fnspec_summaries.
+ (ipa_modref_c_finalize): Delete fnspec_summaries.
+ * ipa-prop.c: Include attr-fnspec.h.
+ (ipa_compute_jump_functions_for_bb): Also compute jump functions
+ for functions with fnspecs.
+ (ipa_read_edge_info): Read jump functions for builtins.
+
+2020-11-06 Jan Hubicka <jh@suse.cz>
+
+ * ipa-fnsummary.h (class size_time_entry): Do not GTY annotate.
+ (class ipa_fnsummary): Turn size_time_table to auto_vec and
+ call_size_time_table to effecient vec; update constructors.
+ * ipa-fnsummary.c (ipa_fn_summary::account_size_time): Update.
+ (ipa_fn_summary::~ipa_fn_summary): Update.
+ (ipa_fn_summary_t::duplicate): Update.
+ (ipa_dump_fn_summary): Update.
+ (set_switch_stmt_execution_predicate): Update.
+ (analyze_function_body): Update.
+ (estimate_calls_size_and_time): Update.
+ (ipa_call_context::estimate_size_and_time): Update.
+ (ipa_merge_fn_summary_after_inlining): Update.
+ (ipa_update_overall_fn_summary): Update.
+ (inline_read_section): Update.
+ (ipa_fn_summary_write): Update.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97733
+ * tree-vect-slp.c (vect_analyze_slp_instance): If less
+ than two reductions were relevant or live do nothing.
+
+2020-11-06 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/97223
+ * match.pd (overflow detection and optimization): Handle conversions.
+
+2020-11-06 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * match.pd (x >> x): New pattern.
+
+2020-11-06 Kito Cheng <kito.cheng@sifive.com>
+
+ * common/config/riscv/riscv-common.c (riscv_implied_info):
+ Add static and const.
+ (riscv_subset_list::handle_implied_ext): Add const due to
+ riscv_implied_info changed to const.
+
+2020-11-06 Kito Cheng <kito.cheng@sifive.com>
+
+ PR target/96307
+ * toplev.c (process_options): Remove param_asan_stack checking for kasan
+ option checking.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97675
+ * doc/invoke.texi: Document -Wexceptions.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/25814
+ * doc/invoke.texi: Document -Wvexing-parse.
+
+2020-11-05 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97725
+ * range-op.cc (operator_equal::fold_range): Use new tmp value.
+ (operator_not_equal::fold_range): Ditto.
+ * value-query.cc (range_query::value_of_expr): Use int_range_max
+ not a value_range.
+ (range_query::value_on_edge): Ditto.
+ (range_query::value_of_stmt): Ditto.
+
+2020-11-05 Olivier Hainque <hainque@adacore.com>
+
+ * config/aarch64/aarch64-vxworks.h (TARGET_OS_USES_R18):
+ Remove definition.
+ (STATIC_CHAIN_REGNUM): Redefine to 9.
+
+2020-11-05 Olivier Hainque <hainque@adacore.com>
+
+ * config/aarch64/aarch64.md: Define PROBE_STACK_FIRST_REGNUM
+ and PROBE_STACK_SECOND_REGNUM constants, designating r10/r11.
+ Replacements for the PROBE_STACK_FIRST/SECOND_REG constants in
+ aarch64.c.
+ * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG): Remove.
+ (PROBE_STACK_SECOND_REG): Remove.
+ (aarch64_emit_probe_stack_range): Adjust to the _REG -> _REGNUM
+ suffix update for PROBE_STACK register numbers.
+
+2020-11-05 Jan Hubicka <jh@suse.cz>
+
+ * gimple.c (gimple_call_fnspec): Handle C++ new and delete.
+ * gimple.h (gimple_call_from_new_or_delete): Constify parameter.
+
+2020-11-05 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97721
+ * gimple-range.cc (get_tree_range): Drop overflow from constants.
+
+2020-11-05 David Malcolm <dmalcolm@redhat.com>
+
+ * tree-diagnostic-path.cc (struct path_summary::event_range): Move
+ out of path_summary to...
+ (struct event_range): ...here.
+ (class path_summary): Convert to...
+ (struct path_summary): ...this.
+ (path_summary::m_ranges): Drop "private".
+ (path_summary::print): Convert to...
+ (print_path_summary_as_text): ...this, passing in the path_summary
+ explicitly.
+ (default_tree_diagnostic_path_printer): Update for above change.
+ (selftest::test_empty_path): Likewise.
+ (selftest::test_intraprocedural_path): Likewise.
+ (selftest::test_interprocedural_path_1): Likewise.
+ (selftest::test_interprocedural_path_2): Likewise.
+ (selftest::test_recursion): Likewise.
+
+2020-11-05 qing zhao <qinzhao@gcc.gnu.org>
+
+ PR target/97715
+ * config/i386/i386.c (zero_all_st_registers): Return
+ earlier when the FPU is disabled.
+
+2020-11-05 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (parm_map_for_arg): Initialize parm_offset and
+ parm_offset_knonw.
+ (read_section): Set writes_errno to false.
+
+2020-11-05 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-data-refs.c (vect_slp_analyze_node_dependences):
+ Use the original stmts.
+ (vect_slp_analyze_node_alignment): Use the pattern stmt.
+ * tree-vect-slp.c (vect_fixup_store_groups_with_patterns):
+ New function.
+ (vect_slp_analyze_bb_1): Call it.
+
+2020-11-05 Tamar Christina <tamar.christina@arm.com>
+
+ * tree-vect-slp.c (vect_slp_tree_permute_noop_p): New.
+ (vect_optimize_slp): Optimize permutes.
+ (vectorizable_slp_permutation): Fix typo.
+
+2020-11-05 Richard Biener <rguenther@suse.de>
+
+ PR debug/97718
+ * dwarf2out.c (add_abstract_origin_attribute): Make sure to
+ point to the abstract instance.
+
+2020-11-05 Tamar Christina <tamar.christina@arm.com>
+
+ * tree-vect-loop.c (vect_analyze_loop_2): Check kind.
+ * tree-vect-slp.c (vect_build_slp_instance): New.
+ (enum slp_instance_kind): Move to...
+ * tree-vectorizer.h (enum slp_instance_kind): .. Here
+ (SLP_INSTANCE_KIND): New.
+
+2020-11-05 Kewen Lin <linkw@linux.ibm.com>
+
+ PR target/96933
+ * config/rs6000/rs6000.c (rs6000_expand_vector_init): Use direct move
+ instructions for vector construction with char/short types.
+ * config/rs6000/rs6000.md (p8_mtvsrwz_v16qisi2): New define_insn.
+ (p8_mtvsrd_v16qidi2): Likewise.
+
+2020-11-04 Tamar Christina <tamar.christina@arm.com>
+
+ * tree-vect-slp.c (vect_analyze_slp_instance): Moved load/store lanes
+ check to ...
+ * tree-vect-loop.c (vect_analyze_loop_2): ..Here
+
+2020-11-04 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * config/s390/s390.c (NR_C_MODES): Unhardcode.
+ (s390_alloc_pool): Use size_t for iterating from 0 to
+ NR_C_MODES.
+ (s390_add_constant): Likewise.
+ (s390_find_constant): Likewise.
+ (s390_dump_pool): Likewise.
+ (s390_free_pool): Likewise.
+
+2020-11-04 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * config/s390/s390.md (RRe): Remove.
+ (RXe): Remove.
+
+2020-11-04 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97515
+ * gimple-range-cache.h (class ranger_cache): New prototypes plus
+ temporal cache pointer.
+ * gimple-range-cache.cc (struct range_timestamp): New.
+ (class temporal_cache): New.
+ (temporal_cache::temporal_cache): New.
+ (temporal_cache::~temporal_cache): New.
+ (temporal_cache::get_timestamp): New.
+ (temporal_cache::set_dependency): New.
+ (temporal_cache::temporal_value): New.
+ (temporal_cache::current_p): New.
+ (temporal_cache::set_timestamp): New.
+ (temporal_cache::set_always_current): New.
+ (ranger_cache::ranger_cache): Allocate the temporal cache.
+ (ranger_cache::~ranger_cache): Free temporal cache.
+ (ranger_cache::get_non_stale_global_range): New.
+ (ranger_cache::set_global_range): Add a timestamp.
+ (ranger_cache::register_dependency): New. Add timestamp dependency.
+ * gimple-range.cc (gimple_ranger::range_of_range_op): Add operand
+ dependencies.
+ (gimple_ranger::range_of_phi): Ditto.
+ (gimple_ranger::range_of_stmt): Check if global range is stale, and
+ recalculate if so.
+
+2020-11-04 Tobias Burnus <tobias@codesourcery.com>
+
+ * targhooks.c (default_zero_call_used_regs): Fix flag-name typo
+ in sorry.
+
+2020-11-04 Richard Biener <rguenther@suse.de>
+
+ * tree-vectorizer.h (vectorizable_phi): Adjust prototype.
+ * tree-vect-stmts.c (vect_transform_stmt): Adjust.
+ (vect_analyze_stmt): Pass cost_vec to vectorizable_phi.
+ * tree-vect-loop.c (vectorizable_phi): Do costing.
+
+2020-11-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97709
+ * tree-vect-loop.c (vectorizable_live_operation): Set
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI when necessary.
+
+2020-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97690
+ * tree-ssa-phiopt.c (conditional_replacement): Also optimize
+ cond ? pow2p_cst : 0 as ((type) cond) << cst.
+
+2020-11-04 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-loop.c (vectorizable_induction): Re-instantiate
+ previously removed CSE of SLP IVs.
+
+2020-11-04 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386-options.c (ix86_recompute_optlev_based_flags):
+ Fix Intel MCU psABI comment w.r.t DEFAULT_PCC_STRUCT_RETURN.
+
+2020-11-04 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/97666
+ * tree-vect-slp.c (vect_build_slp_tree_2): Revert previous
+ fix and instead adjust the memset.
+
+2020-11-04 Pat Bernardi <bernardi@adacore.com>
+
+ * config/i386/i386elf.h (SUBTARGET_RETURN_IN_MEMORY): Remove.
+ (ASM_OUTPUT_ASCII): Likewise.
+ (DEFAULT_PCC_STRUCT_RETURN): Define.
+ * config/i386/i386.c (ix86_return_in_memory): Remove
+ SUBTARGET_RETURN_IN_MEMORY.
+
+2020-11-04 liuhongt <hongtao.liu@intel.com>
+
+ PR target/97540
+ * ira.c: (ira_setup_alts): Extract memory from operand only
+ for special memory constraint.
+ * recog.c (asm_operand_ok): Ditto.
+ * lra-constraints.c (process_alt_operands): MEM_P is
+ required for normal memory constraint.
+
+2020-11-04 liuhongt <hongtao.liu@intel.com>
+
+ PR target/97532
+ * lra-constraints.c (valid_address_p): Handle operand of
+ special memory constraint.
+ (process_address_1): Ditto.
+
+2020-11-03 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/97695
+ * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Fix ICE with
+ in dumping code.
+ (cgraph_node::remove): Save clone info before releasing it and pass it
+ to unregister.
+ * cgraph.h (symtab_node::unregister): Add clone_info parameter.
+ (cgraph_clone::unregister): Likewise.
+ * cgraphclones.c (cgraph_node::find_replacement): Copy clone info
+ * symtab-clones.cc (clone_infos_t::duplicate): Remove.
+ (clone_info::get_create): Simplify.
+ * symtab.c (symtab_node::unregister): Pass around clone info.
+ * varpool.c (varpool_node::remove): Update.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * omp-low.c (scan_omp_for) <OpenACC>: Use proper location to
+ 'inform' of enclosing parent compute construct.
+
+2020-11-03 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/97698
+ * cgraphclones.c (duplicate_thunk_for_node): Check that info is
+ non-NULL.
+
+2020-11-03 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (ix86_function_arg_regno_p): Use up to
+ SSE_REGPARM_MAX registers to pass function parameters
+ for 32bit Mach-O targets.
+ * config/i386/i386.h (X86_32_MMX_REGPARM_MAX): New macro.
+ (MMX_REGPARM_MAX): Use it.
+
+2020-11-03 Dennis Zhang <dennis.zhang@arm.com>
+
+ * config/aarch64/aarch64-simd-builtins.def (vget_lo_half): New entry.
+ (vget_hi_half): Likewise.
+ * config/aarch64/aarch64-simd.md (aarch64_vget_lo_halfv8bf): New entry.
+ (aarch64_vget_hi_halfv8bf): Likewise.
+ * config/aarch64/arm_neon.h (vget_low_bf16): New intrinsic.
+ (vget_high_bf16): Likewise.
+
+2020-11-03 Yang Yang <yangyang305@huawei.com>
+
+ * cgraph.h (struct cgraph_simd_clone): Change field "simdlen" of
+ struct cgraph_simd_clone from unsigned int to poly_uint64.
+ * config/aarch64/aarch64.c
+ (aarch64_simd_clone_compute_vecsize_and_simdlen): adaptation of
+ operations on "simdlen".
+ * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen):
+ Printf formats update.
+ * gengtype.c (main): Handle poly_uint64.
+ * omp-simd-clone.c (simd_clone_mangle): Likewise.Re
+ (simd_clone_adjust_return_type): Likewise.
+ (create_tmp_simd_array): Likewise.
+ (simd_clone_adjust_argument_types): Likewise.
+ (simd_clone_init_simd_arrays): Likewise.
+ (ipa_simd_modify_function_body): Likewise.
+ (simd_clone_adjust): Likewise.
+ (expand_simd_clones): Likewise.
+ * poly-int-types.h (vector_unroll_factor): New macro.
+ * poly-int.h (constant_multiple_p): Add two-argument versions.
+ * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97623
+ * params.opt (-param=max-pre-hoist-insert-iterations): New.
+ * doc/invoke.texi (max-pre-hoist-insert-iterations): Document.
+ * tree-ssa-pre.c (insert): Do at most max-pre-hoist-insert-iterations
+ hoist insert iterations.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97579
+ * gimple-isel.cc (gimple_expand_vec_cond_expr): Use
+ the correct types for the vcond_mask/vec_cmp optab queries.
+
+2020-11-03 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-range-cache.cc (ssa_global_cache::get_global_range): Return
+ true if there was a previous range set.
+ (ranger_cache::ranger_cache): Take a gimple_ranger parameter.
+ (ranger_cache::set_global_range): Propagate the value if updating.
+ (ranger_cache::propagate_cache): Renamed from iterative_cache_update.
+ (ranger_cache::propagate_updated_value): New. Split from:
+ (ranger_cache::fill_block_cache): Split out value propagator.
+ * gimple-range-cache.h (ssa_global_cache): Update prototypes.
+ (ranger_cache): Update prototypes.
+
+2020-11-03 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-range-cache.h (block_range_cache): Add new entry point.
+ (ranger_cache): Privatize global abnd block cache members.
+ * gimple-range-cache.cc (ssa_block_ranges::set_bb_range): Add bounds
+ check.
+ (ssa_block_ranges::set_bb_varying): Ditto.
+ (ssa_block_ranges::get_bb_range): Ditto.
+ (ssa_block_ranges::bb_range_p): Ditto.
+ (block_range_cache::get_block_ranges): Fix formatting.
+ (block_range_cache::query_block_ranges): New.
+ (block_range_cache::get_bb_range): Use Query_block_ranges.
+ (block_range_cache::bb_range_p): Ditto.
+ (ranger_cache::dump): New.
+ (ranger_cache::get_global_range): New.
+ (ranger_cache::set_global_range): New.
+ * gimple-range.cc (gimple_ranger::range_of_expr): Use new API.
+ (gimple_ranger::range_of_stmt): Ditto.
+ (gimple_ranger::export_global_ranges): Ditto.
+ (gimple_ranger::dump): Ditto.
+
+2020-11-03 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * fold-const.c (getbyterep): Remove duplicated statement.
+
+2020-11-03 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR target/97205
+ * cfgexpand.c (align_local_variable): Make SSA_NAMEs
+ at least MODE_ALIGNED.
+ (expand_one_stack_var_at): Increase MEM_ALIGN for SSA_NAMEs.
+
+2020-11-03 Zhiheng Xie <xiezhiheng@huawei.com>
+ Nannan Zheng <zhengnannan@huawei.com>
+
+ * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+ for AES/SHA/SM3/SM4 intrinsics.
+
+2020-11-03 Zhiheng Xie <xiezhiheng@huawei.com>
+ Nannan Zheng <zhengnannan@huawei.com>
+
+ * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+ for compare intrinsics.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ * dwarf2out.c (maybe_create_die_with_external_ref): Remove
+ hashtable entry.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/arm/arm_neon.h (vst2_lane_bf16, vst2q_lane_bf16)
+ (vst3_lane_bf16, vst3q_lane_bf16, vst4_lane_bf16)
+ (vst4q_lane_bf16): New intrinsics.
+ * config/arm/arm_neon_builtins.def: Touch it for:
+ __builtin_neon_vst2_lanev4bf, __builtin_neon_vst2_lanev8bf,
+ __builtin_neon_vst3_lanev4bf, __builtin_neon_vst3_lanev8bf,
+ __builtin_neon_vst4_lanev4bf,__builtin_neon_vst4_lanev8bf.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/arm/arm_neon.h (vld2_lane_bf16, vld2q_lane_bf16)
+ (vld3_lane_bf16, vld3q_lane_bf16, vld4_lane_bf16)
+ (vld4q_lane_bf16): Add intrinsics.
+ * config/arm/arm_neon_builtins.def: Touch for:
+ __builtin_neon_vld2_lanev4bf, __builtin_neon_vld2_lanev8bf,
+ __builtin_neon_vld3_lanev4bf, __builtin_neon_vld3_lanev8bf,
+ __builtin_neon_vld4_lanev4bf, __builtin_neon_vld4_lanev8bf.
+ * config/arm/iterators.md (VQ_HS): Add V8BF to the iterator.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/arm/arm_neon.h (vst1_bf16, vst1q_bf16): Add intrinsics.
+ * config/arm/arm_neon_builtins.def : Touch for:
+ __builtin_neon_vst1v4bf, __builtin_neon_vst1v8bf.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/arm/arm-builtins.c (VAR14): Define macro.
+ * config/arm/arm_neon_builtins.def: Touch for:
+ __builtin_neon_vld1v4bf, __builtin_neon_vld1v8bf.
+ * config/arm/arm_neon.h (vld1_bf16, vld1q_bf16): Add intrinsics.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/arm/arm_neon.h (vst1_lane_bf16, vst1q_lane_bf16): Add
+ intrinsics.
+ * config/arm/arm_neon_builtins.def (STORE1LANE): Add v4bf, v8bf.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/arm/arm_neon_builtins.def: Add to LOAD1LANE v4bf, v8bf.
+ * config/arm/arm_neon.h (vld1_lane_bf16, vld1q_lane_bf16): Add
+ intrinsics.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/97666
+ * tree-vect-slp.c (vect_build_slp_tree_2): Scale
+ allocation of skip_args by sizeof (bool).
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80928
+ * tree-vect-loop.c (vectorizable_induction): SLP vectorize
+ nested inductions.
+
+2020-11-03 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/97578
+ * ipa-inline-transform.c (maybe_materialize_called_clones): New
+ function.
+ (inline_transform): Use it.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97678
+ * tree-vect-slp.c (vect_build_slp_tree_2): Do not track
+ the initial values of inductions when not nested.
+ * tree-vect-loop.c (vectorizable_induction): Look at
+ PHI node initial values again for SLP and not nested
+ inductions. Handle LOOP_VINFO_MASK_SKIP_NITERS and cost
+ invariants.
+
+2020-11-03 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sse.md (aes<aeswideklvariant>u8):
+ Do not use xmm_regs array. Fix whitespace.
+
+2020-11-03 Uroš Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386-expand.c (ix86_expand_builtin): Fix comment.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * omp-low.c (scan_omp_for) <OpenACC>: Move earlier inconsistent
+ nested 'reduction' clauses checking.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * omp-low.c (scan_omp_for) <OpenACC>: More precise diagnostics for
+ 'gang', 'worker', 'vector' clauses with arguments only allowed in
+ 'kernels' regions.
+
+2020-11-03 Kewen Lin <linkw@gcc.gnu.org>
+
+ PR tree-optimization/96789
+ * function.h (struct function): New member unsigned pending_TODOs.
+ * passes.c (class pass_pre_slp_scalar_cleanup): New class.
+ (make_pass_pre_slp_scalar_cleanup): New function.
+ (pass_data_pre_slp_scalar_cleanup): New pass data.
+ * passes.def: (pass_pre_slp_scalar_cleanup): New pass, add
+ pass_fre and pass_dse as its children.
+ * timevar.def (TV_SCALAR_CLEANUP): New timevar.
+ * tree-pass.h (PENDING_TODO_force_next_scalar_cleanup): New
+ pending TODO flag.
+ (make_pass_pre_slp_scalar_cleanup): New declare.
+ * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely_1):
+ Once any outermost loop gets unrolled, flag cfun pending_TODOs
+ PENDING_TODO_force_next_scalar_cleanup on.
+
+2020-11-02 Alan Modra <amodra@gmail.com>
+
+ PR middle-end/97267
+ * calls.h (maybe_complain_about_tail_call): Declare.
+ * calls.c (maybe_complain_about_tail_call): Make global.
+ (can_implement_as_sibling_call_p): Delete reg_parm_stack_space
+ param. Adjust caller. Move REG_PARM_STACK_SPACE check to..
+ * config/i386/i386.c (ix86_function_ok_for_sibcall): ..here.
+
+2020-11-02 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ * ira.c (ira_remove_scratches): Rename to remove_scratches. Make
+ it static and returning flag of any change.
+ (ira.c): Call ira_expand_reg_equiv in case of removing scratches.
+
+2020-11-02 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97140
+ * config/i386/i386-expand.c (ix86_expand_builtin): Require MMX
+ for __builtin_ia32_maskmovq.
+
+2020-11-02 Martin Sebor <msebor@redhat.com>
+
+ * doc/invoke.texi (-Wstringop-overflow): Correct default setting.
+ (-Wstringop-overread): Move past -Wstringop-overflow.
+
+2020-11-02 François-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR bootstrap/57076
+ * Makefile.in (gcc-vers.texi): Quote @, { and }.
+
+2020-11-02 Carl Love <cel@us.ibm.com>
+
+ PR target/93449
+ * config/rs6000/altivec.h (__builtin_bcdadd, __builtin_bcdadd_lt,
+ __builtin_bcdadd_eq, __builtin_bcdadd_gt, __builtin_bcdadd_ofl,
+ __builtin_bcdadd_ov, __builtin_bcdsub, __builtin_bcdsub_lt,
+ __builtin_bcdsub_eq, __builtin_bcdsub_gt, __builtin_bcdsub_ofl,
+ __builtin_bcdsub_ov, __builtin_bcdinvalid, __builtin_bcdmul10,
+ __builtin_bcddiv10, __builtin_bcd2dfp, __builtin_bcdcmpeq,
+ __builtin_bcdcmpgt, __builtin_bcdcmplt, __builtin_bcdcmpge,
+ __builtin_bcdcmple): Add defines.
+ * config/rs6000/altivec.md: Add UNSPEC_BCDSHIFT.
+ (BCD_TEST): Add le, ge to code iterator.
+ Add VBCD mode iterator.
+ (bcd<bcd_add_sub>_test, *bcd<bcd_add_sub>_test2,
+ bcd<bcd_add_sub>_<code>, bcd<bcd_add_sub>_<code>): Add mode to name.
+ Change iterator from V1TI to VBCD.
+ (*bcdinvalid_<mode>, bcdshift_v16qi): New define_insn.
+ (bcdinvalid_<mode>, bcdmul10_v16qi, bcddiv10_v16qi): New define.
+ * config/rs6000/dfp.md (dfp_denbcd_v16qi_inst): New define_insn.
+ (dfp_denbcd_v16qi): New define_expand.
+ * config/rs6000/rs6000-builtin.def (BU_P8V_MISC_1): New define.
+ (BCDADD): Replaced with BCDADD_V1TI and BCDADD_V16QI.
+ (BCDADD_LT): Replaced with BCDADD_LT_V1TI and BCDADD_LT_V16QI.
+ (BCDADD_EQ): Replaced with BCDADD_EQ_V1TI and BCDADD_EQ_V16QI.
+ (BCDADD_GT): Replaced with BCDADD_GT_V1TI and BCDADD_GT_V16QI.
+ (BCDADD_OV): Replaced with BCDADD_OV_V1TI and BCDADD_OV_V16QI.
+ (BCDSUB_V1TI, BCDSUB_V16QI, BCDSUB_LT_V1TI, BCDSUB_LT_V16QI,
+ BCDSUB_LE_V1TI, BCDSUB_LE_V16QI, BCDSUB_EQ_V1TI, BCDSUB_EQ_V16QI,
+ BCDSUB_GT_V1TI, BCDSUB_GT_V16QI, BCDSUB_GE_V1TI, BCDSUB_GE_V16QI,
+ BCDSUB_OV_V1TI, BCDSUB_OV_V16QI, BCDINVALID_V1TI, BCDINVALID_V16QI,
+ BCDMUL10_V16QI, BCDDIV10_V16QI, DENBCD_V16QI): New builtin definitions.
+ (BCDADD, BCDADD_LT, BCDADD_EQ, BCDADD_GT, BCDADD_OV, BCDSUB, BCDSUB_LT,
+ BCDSUB_LE, BCDSUB_EQ, BCDSUB_GT, BCDSUB_GE, BCDSUB_OV, BCDINVALID,
+ BCDMUL10, BCDDIV10, DENBCD): New overload definitions.
+ * config/rs6000/rs6000-call.c (P8V_BUILTIN_VEC_BCDADD, P8V_BUILTIN_VEC_BCDADD_LT,
+ P8V_BUILTIN_VEC_BCDADD_EQ, P8V_BUILTIN_VEC_BCDADD_GT, P8V_BUILTIN_VEC_BCDADD_OV,
+ P8V_BUILTIN_VEC_BCDINVALID, P9V_BUILTIN_VEC_BCDMUL10, P8V_BUILTIN_VEC_DENBCD.
+ P8V_BUILTIN_VEC_BCDSUB, P8V_BUILTIN_VEC_BCDSUB_LT, P8V_BUILTIN_VEC_BCDSUB_LE,
+ P8V_BUILTIN_VEC_BCDSUB_EQ, P8V_BUILTIN_VEC_BCDSUB_GT, P8V_BUILTIN_VEC_BCDSUB_GE,
+ P8V_BUILTIN_VEC_BCDSUB_OV): New overloaded specifications.
+ (CODE_FOR_bcdadd): Replaced with CODE_FOR_bcdadd_v16qi and CODE_FOR_bcdadd_v1ti.
+ (CODE_FOR_bcdadd_lt): Replaced with CODE_FOR_bcdadd_lt_v16qi and CODE_FOR_bcdadd_lt_v1ti.
+ (CODE_FOR_bcdadd_eq): Replaced with CODE_FOR_bcdadd_eq_v16qi and CODE_FOR_bcdadd_eq_v1ti.
+ (CODE_FOR_bcdadd_gt): Replaced with CODE_FOR_bcdadd_gt_v16qi and CODE_FOR_bcdadd_gt_v1ti.
+ (CODE_FOR_bcdsub): Replaced with CODE_FOR_bcdsub_v16qi and CODE_FOR_bcdsub_v1ti.
+ (CODE_FOR_bcdsub_lt): Replaced with CODE_FOR_bcdsub_lt_v16qi and CODE_FOR_bcdsub_lt_v1ti.
+ (CODE_FOR_bcdsub_eq): Replaced with CODE_FOR_bcdsub_eq_v16qi and CODE_FOR_bcdsub_eq_v1ti.
+ (CODE_FOR_bcdsub_gt): Replaced with CODE_FOR_bcdsub_gt_v16qi and CODE_FOR_bcdsub_gt_v1ti.
+ (rs6000_expand_ternop_builtin): Add CODE_FOR_dfp_denbcd_v16qi to else if.
+ * doc/extend.texi: Add documentation for new builtins.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * tree.c (cache_integer_cst): Fixup pointer caching to match
+ wide_int_to_type_1's expectations. Add comment.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * tree.h (id_equal): Call the symetric predicate with swapped
+ arguments.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * print-tree.c (print_node): Display all the operands of a call
+ expr.
+
+2020-11-02 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ * config/rs6000/vsx.md (*vsx_extract_<mode>_store_p9): Add hint *
+ to 2nd alternative of the 1st scratch.
+
+2020-11-02 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/97638
+ * config/aarch64/aarch64-bti-insert.c (aarch64_pac_insn_p): Update
+ return value on INSN_P check.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ * tree.h (build_real_from_wide): Declare.
+ * tree.c (build_real_from_wide): New function.
+ * tree-vect-slp.c (vect_build_slp_tree_2): Remove
+ restriction on induction vectorization, represent
+ the initial value.
+ * tree-vect-loop.c (vect_model_induction_cost): Inline ...
+ (vectorizable_induction): ... here. Rewrite SLP
+ code generation.
+
+2020-11-02 Martin Jambor <mjambor@suse.cz>
+
+ * dbgcnt.def (ipa_cp_values): New counter.
+ (ipa_cp_vr): Likewise.
+ * ipa-cp.c (decide_about_value): Check and bump ipa_cp_values debug
+ counter.
+ (decide_whether_version_node): Likewise.
+ (ipcp_store_vr_results):Check and bump ipa_cp_vr debug counter.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * config/arm/arm.c (arm_thumb1_mi_thunk): Build mi_delta in r3 and
+ do not emit function address and delta when -mpure-code is used.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * config/arm/thumb1.md (thumb1_movsi_insn): Call
+ thumb1_gen_const_int_print.
+ * config/arm/arm-protos.h (thumb1_gen_const_int_print): Add
+ prototype.
+ * config/arm/arm.c (thumb1_gen_const_int_print): New.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * config/arm/arm.c (thumb1_const_rtl, thumb1_const_print): New
+ classes.
+ (thumb1_gen_const_int): Rename to ...
+ (thumb1_gen_const_int_1): ... New helper function. Add capability
+ to emit either RTL or asm, improve generated code.
+ (thumb1_gen_const_int_rtl): New function.
+ * config/arm/arm-protos.h (thumb1_gen_const_int): Rename to
+ thumb1_gen_const_int_rtl.
+ * config/arm/thumb1.md: Call thumb1_gen_const_int_rtl instead
+ of thumb1_gen_const_int.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97558
+ * tree-vect-loop.c (vectorizable_reduction): For nested SLP
+ cycles compute invariant operands vector type.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97558
+ * tree-vect-loop.c (vect_fixup_scalar_cycles_with_patterns):
+ Check for any mismatch in pattern vs. non-pattern and dissolve
+ the group if there is one.
+ * tree-vect-slp.c (vect_analyze_slp_instance): Avoid
+ analyzing not relevant reductions.
+ (vect_analyze_slp): Avoid analyzing not relevant reduction
+ groups.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97650
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Check
+ for SSA_NAME before checking SSA_NAME_IS_DEFAULT_DEF.
+
+2020-11-02 Kito Cheng <kito.cheng@sifive.com>
+
+ * common/config/riscv/riscv-common.c
+ (riscv_subset_list::parse_multiletter_ext): Checking multiletter
+ extension has more than 1 letter.
+
+2020-11-02 Kito Cheng <kito.cheng@sifive.com>
+
+ * config.gcc (riscv*-*-*): Handle --with-multilib-generator.
+ * configure: Regen.
+ * configure.ac: Add --with-multilib-generator.
+ * config/riscv/multilib-generator: Exit when parsing arch string error.
+ * config/riscv/t-withmultilib-generator: New.
+ * doc/install.texi: Document --with-multilib-generator.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96770
+ * config/arm/arm.c (thumb_legitimate_constant_p): Accept
+ (symbol_ref + addend) when literal pool is disabled.
+ (arm_valid_symbolic_address_p): Add support for thumb-1 without
+ MOVT/MOVW.
+ * config/arm/thumb1.md (*thumb1_movsi_insn): Accept (symbol_ref +
+ addend) in the pure-code alternative.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96967
+ * config/arm/arm.c (thumb_legitimate_constant_p): Add support for
+ disabled literal pool in thumb-1.
+ * config/arm/thumb1.md (thumb1_movsi_symbol_ref): Remove.
+ (*thumb1_movsi_insn): Add support for SYMBOL_REF with -mpure-code.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/host-darwin.c: Align pch_address_space to 16384.
+
+2020-11-01 Pat Bernardi <bernardi@adacore.com>
+
+ * config/i386/i386.c (ix86_expand_prologue): Set the stack usage to 0
+ for naked functions.
+
+2020-11-01 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR ipa/97660
+ * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Don't call
+ clone_info::get when cgraph_node::get returns NULL.
+
+2020-10-31 Jan Hubicka <jh@suse.cz>
+
+ * Makefile.in: (OBJS): Add symtab-clones.o
+ (GTFILES): Add symtab-clones.h
+ * cgraph.c: Include symtab-clones.h.
+ (cgraph_edge::resolve_speculation): Fix formating
+ (cgraph_edge::redirect_call_stmt_to_callee): Update.
+ (cgraph_update_edges_for_call_stmt): Update
+ (release_function_body): Fix formating.
+ (cgraph_node::remove): Fix formating.
+ (cgraph_node::dump): Fix formating.
+ (cgraph_node::get_availability): Fix formating.
+ (cgraph_node::call_for_symbol_thunks_and_aliases): Fix formating.
+ (set_const_flag_1): Fix formating.
+ (set_pure_flag_1): Fix formating.
+ (cgraph_node::can_remove_if_no_direct_calls_p): Fix formating.
+ (collect_callers_of_node_1): Fix formating.
+ (clone_of_p): Update.
+ (cgraph_node::verify_node): Update.
+ (cgraph_c_finalize): Call clone_info::release ().
+ * cgraph.h (struct cgraph_clone_info): Move to symtab-clones.h.
+ (cgraph_node): Remove clone_info.
+ (symbol_table): Add m_clones.
+ * cgraphclones.c: Include symtab-clone.h.
+ (duplicate_thunk_for_node): Update.
+ (cgraph_node::create_clone): Update.
+ (cgraph_node::create_virtual_clone): Update.
+ (cgraph_node::find_replacement): Update.
+ (cgraph_node::materialize_clone): Update.
+ * gengtype.c (open_base_files): Include symtab-clones.h.
+ * ipa-cp.c: Include symtab-clones.h.
+ (initialize_node_lattices): Update.
+ (want_remove_some_param_p): Update.
+ (create_specialized_node): Update.
+ * ipa-fnsummary.c: Include symtab-clones.h.
+ (ipa_fn_summary_t::duplicate): Update.
+ * ipa-modref.c: Include symtab-clones.h.
+ (update_signature): Update.
+ * ipa-param-manipulation.c: Include symtab-clones.h.
+ (ipa_param_body_adjustments::common_initialization): Update.
+ * ipa-prop.c: Include symtab-clones.h.
+ (adjust_agg_replacement_values): Update.
+ (ipcp_get_parm_bits): Update.
+ (ipcp_update_bits): Update.
+ (ipcp_update_vr): Update.
+ * ipa-sra.c: Include symtab-clones.h.
+ (process_isra_node_results): Update.
+ (disable_unavailable_parameters): Update.
+ * lto-cgraph.c: Include symtab-clone.h.
+ (output_cgraph_opt_summary_p): Update.
+ (output_node_opt_summary): Update.
+ (input_node_opt_summary): Update.
+ * symtab-clones.cc: New file.
+ * symtab-clones.h: New file.
+ * tree-inline.c (expand_call_inline): Update.
+ (update_clone_info): Update.
+ (tree_function_versioning): Update.
+
+2020-10-31 Jan Hubicka <jh@suse.cz>
+
+ * ipa-modref.c (modref_summary::dump): Dump writes_errno.
+ (parm_map_for_arg): Break out from ...
+ (merge_call_side_effects): ... here.
+ (get_access_for_fnspec): New function.
+ (process_fnspec): New function.
+ (analyze_call): Use it.
+ (analyze_stmt): Update.
+ (analyze_function): Initialize writes_errno.
+ (modref_summaries::duplicate): Duplicate writes_errno.
+ * ipa-modref.h (struct modref_summary): Add writes_errno.
+ * tree-ssa-alias.c (call_may_clobber_ref_p_1): Check errno.
+
+2020-10-30 Michael Meissner <meissner@linux.ibm.com>
+
+ * config/rs6000/rs6000.c (glibc_supports_ieee_128bit): New helper
+ function.
+ (rs6000_option_override_internal): Call it.
+
+2020-10-30 Qing Zhao <qing.zhao@oracle.com>
+ H.J.Lu <hjl.tools@gmail.com>
+
+ * common.opt: Add new option -fzero-call-used-regs
+ * config/i386/i386.c (zero_call_used_regno_p): New function.
+ (zero_call_used_regno_mode): Likewise.
+ (zero_all_vector_registers): Likewise.
+ (zero_all_st_registers): Likewise.
+ (zero_all_mm_registers): Likewise.
+ (ix86_zero_call_used_regs): Likewise.
+ (TARGET_ZERO_CALL_USED_REGS): Define.
+ * df-scan.c (df_epilogue_uses_p): New function.
+ (df_get_exit_block_use_set): Replace EPILOGUE_USES with
+ df_epilogue_uses_p.
+ * df.h (df_epilogue_uses_p): Declare.
+ * doc/extend.texi: Document the new zero_call_used_regs attribute.
+ * doc/invoke.texi: Document the new -fzero-call-used-regs option.
+ * doc/tm.texi: Regenerate.
+ * doc/tm.texi.in (TARGET_ZERO_CALL_USED_REGS): New hook.
+ * emit-rtl.h (struct rtl_data): New field must_be_zero_on_return.
+ * flag-types.h (namespace zero_regs_flags): New namespace.
+ * function.c (gen_call_used_regs_seq): New function.
+ (class pass_zero_call_used_regs): New class.
+ (pass_zero_call_used_regs::execute): New function.
+ (make_pass_zero_call_used_regs): New function.
+ * optabs.c (expand_asm_reg_clobber_mem_blockage): New function.
+ * optabs.h (expand_asm_reg_clobber_mem_blockage): Declare.
+ * opts.c (zero_call_used_regs_opts): New structure array
+ initialization.
+ (parse_zero_call_used_regs_options): New function.
+ (common_handle_option): Handle -fzero-call-used-regs.
+ * opts.h (zero_call_used_regs_opts): New structure array.
+ * passes.def: Add new pass pass_zero_call_used_regs.
+ * recog.c (valid_insn_p): New function.
+ * recog.h (valid_insn_p): Declare.
+ * resource.c (init_resource_info): Replace EPILOGUE_USES with
+ df_epilogue_uses_p.
+ * target.def (zero_call_used_regs): New hook.
+ * targhooks.c (default_zero_call_used_regs): New function.
+ * targhooks.h (default_zero_call_used_regs): Declare.
+ * tree-pass.h (make_pass_zero_call_used_regs): Declare.
+
+2020-10-30 Vladimir N. Makarov <vmakarov@redhat.com>
+
+ * lra.c (get_scratch_reg): New function.
+ (remove_scratches_1): Rename remove_insn_scratches. Use
+ ira_remove_insn_scratches and get_scratch_reg.
+ (remove_scratches): Do not
+ initialize scratches, scratch_bitmap, and scratch_operand_bitmap.
+ (lra): Call ira_restore_scratches instead of restore_scratches.
+ (struct sloc, sloc_t, scratches, scratch_bitmap)
+ (scratch_operand_bitmap, lra_former_scratch_p)
+ (lra_former_scratch_operand_p, lra_register_new_scratch_op)
+ (restore_scratches): Move them to ...
+ * ira.c: ... here.
+ (former_scratch_p, former_scratch_operand_p): Rename to
+ ira_former_scratch_p and ira_former_scratch_operand_p.
+ (contains_X_constraint_p): New function.
+ (register_new_scratch_op): Rename to ira_register_new_scratch_op.
+ Change it to work for IRA and LRA.
+ (restore_scratches): Rename to ira_restore_scratches.
+ (get_scratch_reg, ira_remove_insn_scratches): New functions.
+ (ira): Call ira_remove_scratches if we use LRA.
+ * ira.h (ira_former_scratch_p, ira_former_scratch_operand_p): New
+ prototypes.
+ (ira_register_new_scratch_op, ira_restore_scratches): New prototypes.
+ (ira_remove_insn_scratches): New prototype.
+ * lra-int.h (lra_former_scratch_p, lra_former_scratch_operand_p):
+ Remove prototypes.
+ (lra_register_new_scratch_op): Ditto.
+ * lra-constraints.c: Rename lra_former_scratch_p and
+ lra_former_scratch_p to ira_former_scratch_p and to
+ ira_former_scratch_p.
+ * lra-remat.c: Ditto.
+ * lra-spills.c: Rename lra_former_scratch_p to ira_former_scratch_p.
+
+2020-10-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97556
+ * builtins.c (access_ref::add_offset): Cap offset lower bound
+ to at most the the upper bound.
+
+2020-10-30 Jan Hubicka <jh@suse.cz>
+
+ PR pch/97593
+ * cgraph.c (cgraph_node::create_thunk): Register thunk as early during
+ parsing.
+ * cgraphunit.c (analyze_functions): Call
+ thunk_info::process_early_thunks.
+ * symtab-thunks.cc (struct unprocessed_thunk): New struct.
+ (thunks): New static variable.
+ (thunk_info::register_early): New member function.
+ (thunk_info::process_early_thunks): New member function.
+ * symtab-thunks.h (thunk_info::register_early): Declare.
+ (thunk_info::process_early_thunks): Declare.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97623
+ * tree-ssa-pre.c (insert): First do hoist insertion in
+ a backward walk.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97626
+ * tree-vect-slp.c (vect_slp_analyze_node_operations):
+ Exchange the lvisited hash-set for a vector, roll back
+ recursive adds to visited when analysis failed.
+ (vect_slp_analyze_operations): Likewise.
+
+2020-10-30 Zhiheng Xie <xiezhiheng@huawei.com>
+ Nannan Zheng <zhengnannan@huawei.com>
+
+ * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+ for conversion intrinsics.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97633
+ * tree-vect-slp.c (): Update backedges in single-node cycles.
+ Optimize processing of externals.
+
+2020-10-30 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/96998
+ * combine.c (make_extraction): Also handle shifts written as
+ (mult x 2^n), avoid creating an extract rtx for these.
+ * config/aarch64/aarch64.c (aarch64_is_extend_from_extract): Delete.
+ (aarch64_classify_index): Remove extract-based address handling.
+ (aarch64_strip_extend): Likewise.
+ (aarch64_rtx_arith_op_extract_p): Likewise, remove now-unused parameter.
+ Update callers...
+ (aarch64_rtx_costs): ... here.
+
+2020-10-30 Olivier Hainque <hainque@adacore.com>
+
+ * config/rs6000/vxworks.h (TARGET_OS_CPP_BUILTINS): Also
+ builtin_define __ppc and __ppc__ for VxWorks 7.
+
+2020-10-30 Olivier Hainque <hainque@adacore.com>
+ Douglas Rupp <rupp@adacore.com>
+ Pat Bernardi <bernardi@adacore.com>
+
+ * config.gcc: Adjust the ix86/x86_64-wrs-vxworks filters
+ to apply to VxWorks 7 as well.
+ * config/i386/t-vxworks (MULTILIB_OPTIONS, MULTILIB_DIRNAMES):
+ Remove the fPIC multilib and add one for the large code model
+ on x86_64.
+ * config/i386/vxworks.h: Separate sections for TARGET_VXWORKS7,
+ other variants and common bits.
+ (TARGET_OS_CPP_BUILTINS): Augment to support a range of CPU
+ families. Leverage VX_CPU_PREFIX.
+ (CC1_SPEC): Add definition.
+ (STACK_CHECK_PROTECT): Use conditional expression instead of
+ heavier to read conditioned macro definitions.
+
+2020-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gimplify.c (gimplify_scan_omp_clauses): Force
+ OMP_CLAUSE_ALLOCATE_ALLOCATOR into a temporary if it is non-NULL and
+ non-constant.
+ (gimplify_omp_for): Only put allocate on inner taskloop if lastprivate
+ for the same variable is going to be put there, and in that case
+ if the OMP_CLAUSE_ALLOCATE_ALLOCATOR is non-NULL non-constant, make
+ the allocator firstprivate on task.
+
+2020-10-30 Michael Meissner <meissner@linux.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Allow
+ long double type to be changed for C/C++ if glibc 2.32 or newer.
+ (rs6000_invalid_binary_op): Update error messages about mixing IBM
+ long double and IEEE 128-bit.
+
+2020-10-29 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-pre.c (compute_avail): Free operands consistently.
+ * tree-vect-loop.c (vectorizable_phi): Make sure all operand
+ defs vectors are released.
+
+2020-10-29 Jan Hubicka <jh@suse.cz>
+
+ * vec.h (vec<T, va_heap, vl_ptr>::copy): Pass mem stat info.
+
+2020-10-29 Jan Hubicka <jh@suse.cz>
+
+ * wide-int.h (trailing_wide_ints <N>): Turn len to array of structures
+ so it does not imply typeless storage.
+ (trailing_wide_ints <N>::operator): update
+ (trailing_wide_ints <N>::operator []): Update.
+
+2020-10-29 Joseph Myers <joseph@codesourcery.com>
+
+ * ginclude/stdbool.h [__STDC_VERSION__ > 201710L] (true, false):
+ Define with type _Bool.
+
+2020-10-29 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97505
+ * vr-values.c (vr_values::extract_range_basic): Enable
+ trap again for everything except UBSAN builtins.
+
+2020-10-29 Richard Sandiford <richard.sandiford@arm.com>
+
+ * tree-vectorizer.h (vect_transform_slp_perm_load): Take an
+ optional extra parameter.
+ * tree-vect-slp.c (vect_transform_slp_perm_load): Calculate
+ the number of loads as well as the number of permutes, taking
+ the counting loop from...
+ * tree-vect-stmts.c (vect_model_load_cost): ...here. Use the
+ value computed by vect_transform_slp_perm_load for ncopies.
+
+2020-10-29 Martin Liska <mliska@suse.cz>
+
+ PR lto/97508
+ * langhooks.c (lhd_begin_section): Call get_section with
+ not_existing = true.
+ * output.h (get_section): Add new argument.
+ * varasm.c (get_section): Fail when NOT_EXISTING is true
+ and a section already exists.
+ * ipa-cp.c (ipcp_write_summary): Remove.
+ (ipcp_read_summary): Likewise.
+ * ipa-fnsummary.c (ipa_fn_summary_read): Always read jump
+ functions summary.
+ (ipa_fn_summary_write): Always stream it.
+
+2020-10-29 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_bb_slp_scalar_cost): Pass
+ SLP_TREE_VECTYPE to record_stmt_cost.
+
+2020-10-29 Martin Liska <mliska@suse.cz>
+
+ * optc-gen.awk: Check that params start with -param=.
+ * params.opt: Fix ipa-jump-function-lookups.
+
+2020-10-29 Alexandre Oliva <oliva@adacore.com>
+
+ * tree-ssa-math-opts.c (sincos_stats): Add conv_removed.
+ (execute_cse_conv_1): New.
+ (execute_cse_sincos_1): Call it. Fix return within
+ FOR_EACH_IMM_USE_STMT.
+ (pass_cse_sincos::execute): Report conv_inserted.
+
+2020-10-29 Xuepeng Guo <xuepeng.guo@intel.com>
+ Hongyu Wang <hongyu.wang@intel.com>
+ Hongtao Liu <hongtao.liu@intel.com>
+
+ * common/config/i386/cpuinfo.h (get_available_features):
+ Detect KL, AESKLE and WIDEKL features.
+ * common/config/i386/i386-common.c
+ (OPTION_MASK_ISA_KL_SET): New.
+ (OPTION_MASK_ISA_WIDEKL_SET): Likewise.
+ (OPTION_MASK_ISA_KL_UNSET): Likewise.
+ (OPTION_MASK_ISA_WIDEKL_UNSET): Likewise.
+ (OPTION_MASK_ISA2_AVX2_UNSET): Likewise.
+ (OPTION_MASK_ISA2_AVX_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSE4_2_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSE4_1_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSE4_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSSE3_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSE3_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSE2_UNSET): Likewise.
+ (OPTION_MASK_ISA2_SSE_UNSET): Likewise.
+ (ix86_handle_option): Handle kl and widekl, add dependency chain
+ for KL and SSE2.
+ * common/config/i386/i386-cpuinfo.h (enum processor_features):
+ (FEATURE_KL, FEATURE_AESKLE, FEATURE_WIDEKL): New.
+ * common/config/i386/i386-isas.h: Add ISA_NAMES_TABLE_ENTRY
+ for KL, AESKLE and WIDEKL.
+ * config.gcc: Add keylockerintrin.h.
+ * doc/invoke.texi: Document new option -mkl and -mwidekl.
+ * doc/extend.texi: Document kl and widekl.
+ * config/i386/cpuid.h (bit_KL, bit_AESKLE, bit_WIDEKL): New.
+ * config/i386/i386-builtin-types.def ((UINT, UINT, V2DI, V2DI, PVOID),
+ (UINT, UINT, V2DI, PVOID), (VOID, V2DI, V2DI, V2DI, UINT),
+ (UINT8, PV2DI, V2DI, PCVOID), (UINT8, PV2DI, PCV2DI, PCVOID)): New
+ function types.
+ * config/i386/i386-builtin.def: Add
+ __builtin_ia32_loadiwkey,
+ __builtin_ia32_aesdec128kl_u8,
+ __builtin_ia32_aesdec256kl_u8,
+ __builtin_ia32_aesenc128kl_u8,
+ __builtin_ia32_aesenc256kl_u8,
+ __builtin_ia32_aesdecwide128kl_u8,
+ __builtin_ia32_aesdecwide256kl_u8,
+ __builtin_ia32_aesencwide128kl_u8,
+ __builtin_ia32_aesencwide256kl_u8,
+ __builtin_ia32_encodekey128_u32,
+ __builtin_ia32_encodekey256_u32.
+ * config/i386/i386-c.c (ix86_target_macros_internal): Handle
+ kl and widekl.
+ * config/i386/i386-options.c (isa2_opts): Add -mkl and -mwidekl.
+ (ix86_option_override_internal): Handle KL and WIDEKL.
+ (ix86_valid_target_attribute_inner_p): Add attribute for kl and widekl.
+ * config/i386/i386-expand.c
+ (ix86_expand_builtin): Expand Keylocker Builtins.
+ * config/i386/i386.h (TARGET_KL): New.
+ (TARGET_KL_P): Likewise.
+ (TARGET_WIDEKL): Likewise.
+ (TARGET_WIDEKL_P): Likewise.
+ (PTA_KL): Likewise.
+ (PTA_WIDEKL): Likewise.
+ (PTA_TIGERLAKE): Add PTA_KL, PTA_WIDEKL.
+ (PTA_ALDERLAKE): Likewise.
+ * config/i386/i386.opt: Add new option mkl and mwidekl.
+ * config/i386/keylockerintrin.h: New header file for Keylocker.
+ * config/i386/immintrin.h: Include keylockerintrin.h.
+ * config/i386/predicates.md (encodekey128_operation): New
+ predicate.
+ (encodekey256_operation): Likewise.
+ (aeswidekl_operation): Likewise.
+ * config/i386/sse.md (UNSPECV_LOADIWKEY): New.
+ (UNSPECV_AESDEC128KLU8): Likewise.
+ (UNSPECV_AESENC128KLU8): Likewise.
+ (UNSPECV_AESDEC256KLU8): Likewise.
+ (UNSPECV_AESENC256KLU8): Likewise.
+ (UNSPECV_AESDECWIDE128KLU8): Likewise.
+ (UNSPECV_AESENCWIDE128KLU8): Likewise.
+ (UNSPECV_AESDECWIDE256KLU8): Likewise.
+ (UNSPECV_AESENCWIDE256KLU8): Likewise.
+ (UNSPECV_ENCODEKEY128U32): Likewise.
+ (UNSPECV_ENCODEKEY256U32): Likewise.
+ (encodekey128u32): New expander.
+ (encodekey256u32): Likewise.
+ (aes<aeswideklvariant>u8): Likewise.
+ (loadiwkey): New insn pattern.
+ (*encodekey128u32): Likewise.
+ (*encodekey256u32): Likewise.
+ (aes<aesklvariant>u8): Likewise.
+ (*aes<aeswideklvariant>u8): Likewise.
+
+2020-10-29 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_build_slp_tree_2): Allow splatting
+ not vectorizable loads.
+ (vect_build_slp_instance): Amend dumping with address.
+ (vect_slp_convert_to_external): Likewise.
+
+2020-10-29 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97609
+ * gimple-range-cache.cc (non_null_ref::process_name): Call
+ infer_nonnull_range directly instead of infer_value_range.
+
+2020-10-29 David Malcolm <dmalcolm@redhat.com>
+
+ * Makefile.in (ANALYZER_OBJS): Add analyzer/complexity.o.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97573
+ * doc/invoke.texi: Document -Wdeprecated-enum-enum-conversion
+ and -Wdeprecated-enum-float-conversion. -Wenum-conversion is
+ no longer C/ObjC only.
+
+2020-10-28 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/97457
+ * value-range.cc (irange::set): Don't decay POLY_INT_CST ranges
+ to integer ranges.
+
+2020-10-28 Carl Love <cel@us.ibm.com>
+
+ * config/rs6000/vsx.md(xxgenpcvm_<mode>_internal): Remove TARGET_64BIT.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_slp_analyze_node_operations_1): Dump
+ when shared vectype update fails.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): For skipped
+ args just push NULLs and vect_uninitialized_def.
+ (vect_build_slp_tree_2): Allocate skip_args for all ops
+ and pass it down to vect_get_and_check_slp_defs.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97615
+ * tree-vect-slp.c (vect_build_slp_tree_2): Do not build
+ an external from pattern defs.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_optimize_slp): Fix iteration over
+ all loads.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_build_slp_instance): Split the store
+ group at the failure boundary and also re-analyze a large enough
+ matching rest.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-data-refs.c (vect_slp_analyze_node_alignment):
+ Dump when vect_update_shared_vectype fails.
+
+2020-10-28 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/aarch64/arm_neon.h (__ST2_LANE_FUNC, __ST3_LANE_FUNC)
+ (__ST4_LANE_FUNC): Rename the macro generating the 'q' variants
+ into __ST2Q_LANE_FUNC, __ST2Q_LANE_FUNC, __ST2Q_LANE_FUNC so they
+ all can be undefed at the and of the file.
+ (vst2_lane_bf16, vst2q_lane_bf16, vst3_lane_bf16, vst3q_lane_bf16)
+ (vst4_lane_bf16, vst4q_lane_bf16): Add new intrinsics.
+
+2020-10-28 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/aarch64/arm_neon.h (__LD2_LANE_FUNC, __LD3_LANE_FUNC)
+ (__LD4_LANE_FUNC): Rename the macro generating the 'q' variants
+ into __LD2Q_LANE_FUNC, __LD2Q_LANE_FUNC, __LD2Q_LANE_FUNC so they
+ all can be undefed at the and of the file.
+ (vld2_lane_bf16, vld2q_lane_bf16, vld3_lane_bf16, vld3q_lane_bf16)
+ (vld4_lane_bf16, vld4q_lane_bf16): Add new intrinsics.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ALLOCATE.
+ * tree.h (OMP_CLAUSE_ALLOCATE_ALLOCATOR,
+ OMP_CLAUSE_ALLOCATE_COMBINED): Define.
+ * tree.c (omp_clause_num_ops, omp_clause_code_name): Add allocate
+ clause.
+ (walk_tree_1): Handle OMP_CLAUSE_ALLOCATE.
+ * tree-pretty-print.c (dump_omp_clause): Likewise.
+ * gimplify.c (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses,
+ gimplify_omp_for): Likewise.
+ * tree-nested.c (convert_nonlocal_omp_clauses,
+ convert_local_omp_clauses): Likewise.
+ * omp-low.c (scan_sharing_clauses): Likewise.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-offload.c (omp_declare_target_tgt_fn_r): Handle direct calls to
+ declare variant base functions.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR lto/96680
+ * lto-streamer.h (omp_lto_output_declare_variant_alt,
+ omp_lto_input_declare_variant_alt): Declare variant.
+ * symtab.c (symtab_node::get_partitioning_class): Return
+ SYMBOL_DUPLICATE for declare_variant_alt nodes.
+ * passes.c (ipa_write_summaries): Add declare_variant_alt to
+ partition.
+ * lto-cgraph.c (output_refs): Call omp_lto_output_declare_variant_alt
+ on declare_variant_alt nodes.
+ (input_refs): Call omp_lto_input_declare_variant_alt on
+ declare_variant_alt nodes.
+ * lto-streamer-out.c (output_function): Don't call
+ collect_block_tree_leafs if DECL_INITIAL is error_mark_node.
+ (lto_output): Call output_function even for declare_variant_alt
+ nodes.
+ * omp-general.c (omp_lto_output_declare_variant_alt,
+ omp_lto_input_declare_variant_alt): New functions.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * wide-int.cc (wi::set_bit_large): Call canonize unless setting
+ msb bit and clearing bits above it.
+
+2020-10-28 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-range-gori.cc (gori_compute_cache::cache_stmt): Accumulate
+ return values and only set cache when everything returned true.
+ * gimple-range.cc (get_tree_range): Set the return range to UNDEFINED
+ when the range isn't supported.
+ (gimple_ranger::calc_stmt): Return varying if the type is supported,
+ even if the stmt processing failed. False otherwise.
+ (range_of_builtin_ubsan_call): Don't use gcc_assert.
+ (range_of_builtin_call): Ditto.
+ (gimple_ranger::range_of_cond_expr): Ditto.
+ (gimple_ranger::range_of_expr): Ditto
+ (gimple_ranger::range_on_entry): Ditto.
+ (gimple_ranger::range_on_exit): Ditto.
+ (gimple_ranger::range_on_edge): DItto.
+ (gimple_ranger::range_of_stmt): Don't use gcc_assert, and initialize
+ return value to UNDEFINED.
+
+2020-10-27 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR rtl-optimization/97497
+ * config/s390/s390.c (s390_hard_regno_call_part_clobbered): Do not
+ return true for r12 when -fpic is used.
+
+2020-10-27 Tamar Christina <tamar.christina@arm.com>
+
+ PR target/97535
+ * config/aarch64/aarch64.c (aarch64_expand_cpymem): Use unsigned
+ arithmetic in check.
+
+2020-10-27 Andrea Corallo <andrea.corallo@arm.com>
+
+ * config/aarch64/arm_neon.h (vcopy_lane_bf16, vcopyq_lane_bf16)
+ (vcopyq_laneq_bf16, vcopy_laneq_bf16): New intrinsics.
+
+2020-10-27 Olivier Hainque <hainque@adacore.com>
+
+ * config/vxworks.h (VX_CPU_PREFIX): #define here.
+ * config/rs6000/vxworks.h: Remove #definition.
+
+2020-10-27 Olivier Hainque <hainque@adacore.com>
+
+ * config/rs6000/vxworks.h (CPP_SPEC): Fix macro definition
+ for -mcpu=e6500.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_build_slp_instance): Use ceil_log2
+ to compute maximum group-size.
+
+2020-10-27 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97586
+ * ipa-modref-tree.h (modref_tree::remap_params): New member function.
+ * ipa-modref.c (modref_summaries_lto::duplicate): Check that
+ optimization summaries are not duplicated.
+ (remap_arguments): Remove.
+ (modref_transform): Rename to ...
+ (update_signature): ... this one; handle also lto summary.
+ (pass_ipa_modref::execute): Update signatures here rather
+ than in transform hook.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_slp_bbs): Remove no-op
+ slp-max-insns-in-bb check.
+ (vect_slp_function): Dump when splitting the function.
+ Adjust the split condition for control altering stmts.
+ * params.opt (-param=slp-max-insns-in-bb): Remove.
+ * doc/invoke.texi (-param=slp-max-insns-in-bb): Likewise.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * gimple.h (gimple_expr_type): For PHIs return the type
+ of the result.
+ * tree-vect-loop-manip.c (slpeel_tree_duplicate_loop_to_edge_cfg):
+ Make sure edge order into copied loop headers line up with the
+ originals.
+ * tree-vect-loop.c (vect_transform_cycle_phi): Handle nested
+ loops with SLP.
+ (vectorizable_phi): New function.
+ (vectorizable_live_operation): For BB vectorization compute insert
+ location here.
+ * tree-vect-slp.c (vect_free_slp_tree): Deal with NULL
+ SLP_TREE_CHILDREN entries.
+ (vect_create_new_slp_node): Add overloads with pre-existing node
+ argument.
+ (vect_print_slp_graph): Likewise.
+ (vect_mark_slp_stmts): Likewise.
+ (vect_mark_slp_stmts_relevant): Likewise.
+ (vect_gather_slp_loads): Likewise.
+ (vect_optimize_slp): Likewise.
+ (vect_slp_analyze_node_operations): Likewise.
+ (vect_bb_slp_scalar_cost): Likewise.
+ (vect_remove_slp_scalar_calls): Likewise.
+ (vect_get_and_check_slp_defs): Handle PHIs.
+ (vect_build_slp_tree_1): Handle PHIs.
+ (vect_build_slp_tree_2): Continue SLP build, following PHI
+ arguments. Fix memory leak.
+ (vect_build_slp_tree): Put stub node into the hash-map so
+ we can discover cycles directly.
+ (vect_build_slp_instance): Set the backedge SLP def for
+ reduction chains.
+ (vect_analyze_slp_backedges): Remove.
+ (vect_analyze_slp): Do not call it.
+ (vect_slp_convert_to_external): Release SLP_TREE_LOAD_PERMUTATION.
+ (vect_slp_analyze_node_operations): Handle stray failed
+ backedge defs by failing.
+ (vect_slp_build_vertices): Adjust leaf condition.
+ (vect_bb_slp_mark_live_stmts): Handle PHIs, use visited
+ hash-set to handle cycles.
+ (vect_slp_analyze_operations): Adjust.
+ (vect_bb_partition_graph_r): Likewise.
+ (vect_slp_function): Adjust split condition to allow CFG
+ merges.
+ (vect_schedule_slp_instance): Rename to ...
+ (vect_schedule_slp_node): ... this. Move DFS walk to ...
+ (vect_schedule_scc): ... this new function.
+ (vect_schedule_slp): Call it. Remove ad-hoc vectorized
+ backedge fill code.
+ * tree-vect-stmts.c (vect_analyze_stmt): Call
+ vectorizable_phi.
+ (vect_transform_stmt): Likewise.
+ (vect_is_simple_use): Handle vect_backedge_def.
+ * tree-vectorizer.c (vec_info::new_stmt_vec_info): Only
+ set loop header PHIs to vect_unknown_def_type for loop
+ vectorization.
+ * tree-vectorizer.h (enum vect_def_type): Add vect_backedge_def.
+ (enum stmt_vec_info_type): Add phi_info_type.
+ (vectorizable_phi): Declare.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (vect_build_slp_tree_2): When vectorizing
+ BBs splat uniform operands and stop SLP discovery.
+
+2020-10-27 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * config/aarch64/aarch64-linux.h (GNU_USER_TARGET_D_CRITSEC_SIZE):
+ Remove.
+ * config/glibc-d.c (glibc_d_critsec_size): Likewise.
+ (TARGET_D_CRITSEC_SIZE): Likewise.
+ * config/i386/linux-common.h (GNU_USER_TARGET_D_CRITSEC_SIZE):
+ Likewise.
+ * config/sol2-d.c (solaris_d_critsec_size): Likewise.
+ (TARGET_D_CRITSEC_SIZE): Likewise.
+ * doc/tm.texi.in (TARGET_D_CRITSEC_SIZE): Likewise.
+ * doc/tm.texi: Regenerate.
+
+2020-10-27 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/97461
+ * gcov-io.h (GCOV_PREALLOCATED_KVP): Pre-allocate 64
+ static counters.
+
+2020-10-27 Jan Hubicka <jh@suse.cz>
+
+ * tree-ssa-alias.c (attr_fnspec::verify): Re-enabl checking.
+
+2020-10-27 Jan Hubicka <jh@suse.cz>
+
+ * builtin-attrs.def (STRERRNOC): New macro.
+ (STRERRNOP): New macro.
+ (ATTR_ERRNOCONST_NOTHROW_LEAF_LIST): New attr list.
+ (ATTR_ERRNOPURE_NOTHROW_LEAF_LIST): New attr list.
+ * builtins.def (ATTR_MATHFN_ERRNO): Use
+ ATTR_ERRNOCONST_NOTHROW_LEAF_LIST.
+ (ATTR_MATHFN_FPROUNDING_ERRNO): Use ATTR_ERRNOCONST_NOTHROW_LEAF_LIST
+ or ATTR_ERRNOPURE_NOTHROW_LEAF_LIST.
+
+2020-10-27 Kito Cheng <kito.cheng@sifive.com>
+
+ * common/config/riscv/riscv-common.c (opt_var_ref_t): New.
+ (riscv_ext_flag_table_t): New.
+ (riscv_ext_flag_table): New.
+ (riscv_parse_arch_string): Pass gcc_options* instead of
+ &opts->x_target_flags only, and using riscv_arch_option_table to
+ setup flags.
+ (riscv_handle_option): Update argument for riscv_parse_arch_string.
+ (riscv_expand_arch): Ditto.
+ (riscv_expand_arch_from_cpu): Ditto.
+
+2020-10-27 Jan Hubicka <jh@suse.cz>
+
+ * tree-ssa-ccp.c (evaluate_stmt): Use EAF_RETURN_ARG; do not handle
+ string buitings specially.
+
+2020-10-27 Jan Hubicka <jh@suse.cz>
+
+ * tree.c (set_call_expr_flags): Fix string for ECF_RET1.
+ (build_common_builtin_nodes): Do not set ECF_RET1 for memcpy, memmove,
+ and memset. They are handled by builtin_fnspec.
+
+2020-10-27 Jan Hubicka <jh@suse.cz>
+
+ * builtins.c (builtin_fnspec): Add bzero, memcmp, memcmp_eq, bcmp,
+ strncmp, strncmp_eq, strncasecmp, rindex, strlen, strlnen, strcasecmp,
+ strcspn, strspn, strcmp, strcmp_eq.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * tree-vectorizer.h (slp_tree_pool): Declare.
+ (_slp_tree::operator new): Likewise.
+ (_slp_tree::operator delete): Likewise.
+ * tree-vectorizer.c (vectorize_loops): Allocate and free the
+ slp_tree_pool.
+ (pass_slp_vectorize::execute): Likewise.
+ * tree-vect-slp.c (slp_tree_pool): Define.
+ (_slp_tree::operator new): Likewise.
+ (_slp_tree::operator delete): Likewise.
+
+2020-10-27 Martin Liska <mliska@suse.cz>
+
+ * lto-wrapper.c (run_gcc): Do not use sub-make when jobserver is
+ not detected properly.
+
+2020-10-27 Martin Liska <mliska@suse.cz>
+
+ * symbol-summary.h (call_summary_base): Pass symtab hooks to
+ base and register (or unregister) hooks directly.
+
+2020-10-27 Martin Liska <mliska@suse.cz>
+
+ * symbol-summary.h (function_summary_base::unregister_hooks):
+ Call disable_insertion_hook and disable_duplication_hook.
+ (function_summary_base::symtab_insertion): New field.
+ (function_summary_base::symtab_removal): Likewise.
+ (function_summary_base::symtab_duplication): Likewise.
+ Register hooks in function_summary_base and directly register
+ (or unregister) hooks.
+
+2020-10-26 Andrew MacLeod <amacleod@redhat.com>
+
+ PR tree-optimization/97567
+ * gimple-range-gori.cc (gori_compute::logical_combine): Union the
+ ranges of operand1 and operand2, not intersect.
+
+2020-10-26 Jan Hubicka <jh@suse.cz>
+
+ * attr-fnspec.h: Update toplevel comment.
+ (attr_fnspec::attr_fnspec): New constructor.
+ (attr_fnspec::arg_read_p,
+ attr_fnspec::arg_written_p,
+ attr_fnspec::arg_access_size_given_by_arg_p,
+ attr_fnspec::arg_single_access_p
+ attr_fnspec::loads_known_p
+ attr_fnspec::stores_known_p,
+ attr_fnspec::clobbers_errno_p): New member functions.
+ (gimple_call_fnspec): Declare.
+ (builtin_fnspec): Declare.
+ * builtins.c: Include attr-fnspec.h
+ (builtin_fnspec): New function.
+ * builtins.def (BUILT_IN_MEMCPY): Do not specify RET1 fnspec.
+ (BUILT_IN_MEMMOVE): Do not specify RET1 fnspec.
+ (BUILT_IN_MEMSET): Do not specify RET1 fnspec.
+ (BUILT_IN_STRCAT): Do not specify RET1 fnspec.
+ (BUILT_IN_STRCPY): Do not specify RET1 fnspec.
+ (BUILT_IN_STRNCAT): Do not specify RET1 fnspec.
+ (BUILT_IN_STRNCPY): Do not specify RET1 fnspec.
+ (BUILT_IN_MEMCPY_CHK): Do not specify RET1 fnspec.
+ (BUILT_IN_MEMMOVE_CHK): Do not specify RET1 fnspec.
+ (BUILT_IN_MEMSET_CHK): Do not specify RET1 fnspec.
+ (BUILT_IN_STRCAT_CHK): Do not specify RET1 fnspec.
+ (BUILT_IN_STRCPY_CHK): Do not specify RET1 fnspec.
+ (BUILT_IN_STRNCAT_CHK): Do not specify RET1 fnspec.
+ (BUILT_IN_STRNCPY_CHK): Do not specify RET1 fnspec.
+ * gimple.c (gimple_call_fnspec): Return attr_fnspec.
+ (gimple_call_arg_flags): Update.
+ (gimple_call_return_flags): Update.
+ * tree-ssa-alias.c (check_fnspec): New function.
+ (ref_maybe_used_by_call_p_1): Use fnspec for builtin handling.
+ (call_may_clobber_ref_p_1): Likewise.
+ (attr_fnspec::verify): Update verifier.
+ * calls.c (decl_fnspec): New function.
+ (decl_return_flags): Use it.
+
+2020-10-26 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97555
+ * range-op.cc (range_tests): Test 1-bit signed invert.
+ * value-range.cc (subtract_one): Adjust comment.
+ (add_one): New.
+ (irange::invert): Call add_one.
+
+2020-10-26 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.h (cgraph_node::optimize_for_size_p): Return
+ optimize_size_level.
+ (cgraph_node::optimize_for_size_p): Update.
+ * coretypes.h (enum optimize_size_level): New enum.
+ * predict.c (unlikely_executed_edge_p): Microoptimize.
+ (optimize_function_for_size_p): Return optimize_size_level.
+ (optimize_bb_for_size_p): Likewise.
+ (optimize_edge_for_size_p): Likewise.
+ (optimize_insn_for_size_p): Likewise.
+ (optimize_loop_nest_for_size_p): Likewise.
+ * predict.h (optimize_function_for_size_p): Update declaration.
+ (optimize_bb_for_size_p): Update declaration.
+ (optimize_edge_for_size_p): Update declaration.
+ (optimize_insn_for_size_p): Update declaration.
+ (optimize_loop_for_size_p): Update declaration.
+ (optimize_loop_nest_for_size_p): Update declaration.
+
+2020-10-26 Richard Biener <rguenther@suse.de>
+
+ * tree-vect-slp.c (enum slp_instance_kind): New.
+ (vect_build_slp_instance): Split out from...
+ (vect_analyze_slp_instance): ... this.
+
+2020-10-26 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple-range.cc (range_of_builtin_call): Initialize zerov to 0.
+
+2020-10-26 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97576
+ * cgraphclones.c (cgraph_node::materialize_clone): Clear stmt
+ references.
+ * cgraphunit.c (mark_functions_to_output): Do not clear them here.
+ * ipa-inline-transform.c (inline_transform): Clear stmt references.
+ * symtab.c (symtab_node::clear_stmts_in_references): Make recursive
+ for clones.
+ * tree-ssa-structalias.c (ipa_pta_execute): Do not clear references.
+
+2020-10-26 Zhiheng Xie <xiezhiheng@huawei.com>
+ Nannan Zheng <zhengnannan@huawei.com>
+
+ * config/aarch64/aarch64-builtins.c: Add FLAG STORE.
+ * config/aarch64/aarch64-simd-builtins.def: Add proper FLAG
+ for store intrinsics.
+
+2020-10-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR tree-optimization/97546
+ * gimple-ssa-store-merging.c (find_bswap_or_nop): Return NULL if
+ type is not INTEGER_CST.
+
+2020-10-26 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97521
+ * expr.c (const_scalar_mask_from_tree): Remove.
+ (expand_expr_real_1): Always VIEW_CONVERT integer mode
+ vector constants to an integer type.
+ * tree.c (build_truth_vector_type_for_mode): Use a single-bit
+ boolean component type for non-vector-mode mask_mode.
+
+2020-10-26 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/95458
+ * config/i386/i386-expand.c (ix86_expand_cmpstrn_or_cmpmem):
+ Return false for -mno-inline-all-stringops.
+
+2020-10-26 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/95151
+ * config/i386/i386-expand.c (ix86_expand_cmpstrn_or_cmpmem): New
+ function.
+ * config/i386/i386-protos.h (ix86_expand_cmpstrn_or_cmpmem): New
+ prototype.
+ * config/i386/i386.md (cmpmemsi): New pattern.
+
+2020-10-26 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * config/s390/vector.md ("vcond_mask_<mode><mode>"): New expander.
+
+2020-10-26 Richard Biener <rguenther@suse.de>
+
+ * sbitmap.c (sbitmap_vector_alloc): Use size_t for byte
+ quantities to avoid overflow.
+
+2020-10-26 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97539
+ * tree-vect-loop-manip.c (vect_do_peeling): Reset out-of-loop
+ debug uses before peeling.
+
+2020-10-26 Jan Hubicka <hubicka@ucw.cz>
+
+ * cgraph.h (struct cgraph_node): Make ipa_transforms_to_apply vl_ptr.
+ * ipa-inline-analysis.c (initialize_growth_caches): Disable insertion
+ and duplication hooks.
+ * ipa-inline-transform.c (clone_inlined_nodes): Clear
+ ipa_transforms_to_apply.
+ (save_inline_function_body): Disable insertion hoook for
+ ipa_saved_clone_sources.
+ * ipa-prop.c (ipcp_transformation_initialize): Disable insertion hook.
+ * ipa-prop.h (ipa_node_params_t): Disable insertion hook.
+ * ipa-reference.c (propagate): Disable insertion hoook.
+ * ipa-sra.c (ipa_sra_summarize_function): Move out of anonymous
+ namespace.
+ (ipa_sra_function_summaries::insert): New virtual function.
+ * passes.c (execute_one_pass): Do not add transforms to inline clones.
+ * symbol-summary.h (function_summary_base): Make insert and duplicate
+ hooks fail instead of silently producing empty summaries; add way to
+ disable duplication hooks
+ (call_summary_base): Likewise.
+ * tree-nested.c (nested_function_info::get_create): Disable insertion
+ hooks
+ (maybe_record_nested_function): Likewise.
+
+2020-10-26 Xionghu Luo <luoxhu@linux.ibm.com>
+
+ * cfg.c (debug_bb): New overloaded function.
+ (debug_bb_n): New overloaded function.
+ * cfg.h (debug_bb): New declaration.
+ (debug_bb_n): New declaration.
+ * print-rtl.c (debug_bb_slim): Call debug_bb with flags.
+
+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-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
@@ -1165,10 +4995,6 @@
* 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
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 0237336..2cca29c 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20201012
+20201110
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 5a8fb0d..978a08f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1230,6 +1230,7 @@ ANALYZER_OBJS = \
analyzer/bar-chart.o \
analyzer/call-string.o \
analyzer/checker-path.o \
+ analyzer/complexity.o \
analyzer/constraint-manager.o \
analyzer/diagnostic-manager.o \
analyzer/engine.o \
@@ -1297,6 +1298,8 @@ OBJS = \
cfgloopmanip.o \
cfgrtl.o \
symtab.o \
+ symtab-thunks.o \
+ symtab-clones.o \
cgraph.o \
cgraphbuild.o \
cgraphunit.o \
@@ -2591,6 +2594,8 @@ 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)/symtab-clones.h \
$(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 \
@@ -2629,7 +2634,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 \
@@ -3281,7 +3286,7 @@ gcc-vers.texi: $(BASEVER) $(DEVPHASE)
then echo "@set DEVELOPMENT"; \
else echo "@clear DEVELOPMENT"; \
fi) > $@T
- $(build_file_translate) echo @set srcdir $(abs_srcdir) >> $@T
+ $(build_file_translate) echo @set srcdir `echo $(abs_srcdir) | sed -e 's|\\([@{}]\\)|@\\1|g'` >> $@T
if [ -n "$(PKGVERSION)" ]; then \
echo "@set VERSION_PACKAGE $(PKGVERSION)" >> $@T; \
fi
@@ -3594,7 +3599,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
@@ -3604,7 +3610,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
@@ -3617,8 +3623,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'`; \
@@ -3630,7 +3636,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 98e0f45..e00b1a1 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,2922 @@
+2020-11-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/Makefile.in: Force target_cpu to powerpc if the
+ nominal target is powerpc64-suse-linux.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc-interface/misc.c (gnat_printable_name): Change
+ DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTIN.
+
+2020-10-28 Alexandre Oliva <oliva@adacore.com>
+
+ PR ada/97504
+ * Makefile.rtl (LIBGNAT_TARGET_PAIRS> <riscv*-*-*>: Use wraplf
+ version of Aux_Long_Long_Float.
+
+2020-10-27 Doug Rupp <rupp@adacore.com>
+
+ * Makefile.rtl: Add vx7r2cert spec file to ARM, PowerPC and x86
+ targets.
+ * vxworks7-cert-rtp-link.spec: New spec file.
+
+2020-10-27 Arnaud Charlet <charlet@adacore.com>
+
+ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-spogwa object.
+ * libgnat/g-spogwa.adb: Fix style errors.
+
+2020-10-27 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK_Array_Aggregate): Dedicated
+ routine for array aggregates; mostly reuses existing code, but
+ calls itself recursively for multi-dimensional array aggregates.
+ (Expand_SPARK_N_Aggregate): Call Expand_SPARK_Array_Aggregate to
+ do the actual expansion, starting from the first index of the
+ array type.
+
+2020-10-27 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Iterated_Component_Association): new
+ internal subprogram Remove_References, to reset semantic
+ information on each reference to the index variable of the
+ association, so that Collect_Aggregate_Bounds can work properly
+ on multidimensional arrays with nested associations, and
+ subsequent expansion into loops can verify that dimensions of
+ each subaggregate are compatible.
+
+2020-10-27 Ghjuvan Lacambre <lacambre@adacore.com>
+
+ * exp_prag.adb (Append_Copies): Handle N_Parameter_Associations.
+
+2020-10-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * ada_get_targ.adb (Digits_From_Size): Delete.
+ (Width_From_Size): Likewise.
+ * get_targ.adb (Digits_From_Size): Likewise.
+ (Width_From_Size): Likewise.
+ * get_targ.ads (Digits_From_Size): Likewise.
+ (Width_From_Size): Likewise.
+ * ttypes.ads: Remove with clause for Get_Targ.
+ (Standard_Short_Short_Integer_Width): Delete.
+ (Standard_Short_Integer_Width): Likewise.
+ (Standard_Integer_Width): Likewise.
+ (Standard_Long_Integer_Width): Likewise.
+ (Standard_Long_Long_Integer_Width): Likewise.
+ (Standard_Long_Long_Long_Integer_Width): Likewise.
+ (Standard_Short_Float_Digits): Likewise.
+ (Standard_Float_Digits): Likewise.
+ (Standard_Long_Float_Digits): Likewise.
+ (Standard_Long_Long_Float_Digits): Likewise.
+ * gnat1drv.adb (Adjust_Global_Switches): Adjust.
+
+2020-10-27 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch6.adb, freeze.adb, gnat1drv.adb, opt.ads, sem_ch6.adb
+ (Transform_Function_Array): New flag, split from Modify_Tree_For_C.
+ * exp_unst.adb: Minor reformatting.
+
+2020-10-27 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * libgnat/g-socpol.adb (Wait): Do not exit from loop on EINTR
+ error and timeout is over.
+
+2020-10-26 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Build_Array_Aggr_Code): If the aggregate
+ includes an Others_Choice in an association that is an
+ Iterated_Component_Association, generate a proper loop for it.
+
+2020-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/a-tifiio.adb: Add missing sign in documentation.
+ * libgnat/s-imgrea.ads: Minor fixes in commentary.
+
+2020-10-26 Pat Rogers <rogers@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_pragmas.rst: Include
+ "Jorvik" in pragma Profile description.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-26 Bob Duff <duff@adacore.com>
+
+ * sem_attr.adb (Check_Image_Type): Remove "|", so the compiler
+ will not crash.
+ * errout.ads: Improve comment. This has nothing to do with
+ -gnatQ.
+
+2020-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/a-tifiio.adb: Minor editions to documentation.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * contracts.adb (Causes_Contract_Freezing): Extend condition to
+ match the one in Analyze_Subprogram_Body_Helper. This routine is
+ used both as an assertion at the very start of
+ Freeze_Previous_Contracts and to detect previous declaration for
+ which Freeze_Previous_Contracts has been executed.
+
+2020-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/a-tifiio.adb: Move around documentaton paragraph.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Add
+ guard for a call to Set_Last_Assignment with the same condition
+ as the assertion in that routine and explain why this guard
+ fails in GNATprove mode.
+
+2020-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * doc/gnat_rm/implementation_defined_characteristics.rst: Adjust
+ the entries of 3.5.9(8) and 3.5.9(10).
+ * gnat_rm.texi: Regenerate.
+
+2020-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/a-tifiio.adb: Change the range of supported Small
+ values.
+ (E0, E1, E2): Adjust factors.
+ (Exact): Return false if the Small does not fit in 64 bits.
+
+2020-10-26 Dmitriy Anisimkov <anisimko@adacore.com>
+
+ * libgnat/g-socket.adb (Wait_On_Socket): Boolean parameter
+ For_Read changed to Event parameter of type
+ GNAT.Sockets.Poll.Wait_Event_Set. Implementation is simplified
+ and based on call to GNAT.Sockets.Poll.Wait now.
+
+2020-10-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * libgnat/a-tifiio.adb: Minor editions to documentation.
+
+2020-10-26 Yannick Moy <moy@adacore.com>
+
+ * sem_ch12.adb (Restore_Private_Views): Do not lose the
+ information provided by Is_Generic_Actual_Type in GNATprove
+ mode.
+
+2020-10-26 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_warn.adb (Warn_On_Unreferenced_Entity): Suppress warning
+ on formal parameters of all dispatching operations.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): Fix typos in
+ error message.
+
+2020-10-26 Olivier Hainque <hainque@adacore.com>
+
+ * libgnat/s-dwalin.adb (Symbolic_Traceback): Always emit the hex
+ address at the beginning of an entry if suppression is not
+ requested. Consistently output a "???" for the subprogram name
+ when it is unknown.
+
+2020-10-26 Doug Rupp <rupp@adacore.com>
+
+ * s-oscons-tmplt.c (_nfds_t): Use sizeof (unsigned long int).
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * par-ch4.adb (P_Iterated_Component_Association): Move code for
+ iterated_element_association to
+ Build_Iterated_Element_Association.
+
+2020-10-26 Yannick Moy <moy@adacore.com>
+
+ * sem_ch12.adb (Needs_Body_Instantiated): In GNATprove mode, do
+ not instantiate bodies outside of the main unit.
+
+2020-10-26 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): For an
+ association that is an iterated component association, attach
+ the copy of the expression to the tree prior to analysis, in
+ order to preserve its context. This is needed when verifying
+ static semantic rules that depend on context, for example that a
+ use of 'Old appears only within a postcondition.
+
+2020-10-26 Bob Duff <duff@adacore.com>
+
+ * doc/gnat_ugn/gnat_utility_programs.rst: Document that
+ --no-comments-fill is now the default.
+
+2020-10-26 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb (Resolve_Extension_Aggregate): When testing for
+ an aggregate that is illegal due to having an ancestor type that
+ has unknown discriminants, add an "or else" condition testing
+ whether the aggregate type has unknown discriminants and that
+ Partial_View_Has_Unknown_Discr is also set on the ancestor type.
+ Extend the comment, including adding ??? about a possible
+ simpler test.
+
+2020-10-26 Bob Duff <duff@adacore.com>
+
+ * libgnat/a-cihama.adb, libgnat/a-cohama.adb,
+ libgnat/a-cohase.adb (Delete): Set Position.Position, and
+ assert.
+
+2020-10-26 Arnaud Charlet <charlet@adacore.com>
+
+ * sem_ch8.adb (Find_Direct_Name.Undefined): Handle known unit
+ names with 3 selectors.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Add missing call
+ to Enter_Name, just like it is called for
+ iterated_component_association in Expand_SPARK_N_Aggregate.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK_Delta_Or_Update): Reuse local
+ constant Expr and the Choice_List routine.
+ (Expand_SPARK_N_Aggregate): Reuse local constant Expr.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * par-ch4.adb (P_Iterated_Component_Association): Fix typos in
+ comments.
+
+2020-10-26 Arnaud Charlet <charlet@adacore.com>
+
+ * par-ch6.adb (P_Formal_Part): Ada 2020 supports scanning
+ aspects on formal parameters.
+ * doc/gnat_rm/implementation_defined_aspects.rst (Aspect
+ Unreferenced): Update documentation.
+ * gnat_rm.texi: Regenerate.
+
+2020-10-26 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Type_Refs): When an entity in an expression
+ function is a type, freeze the entity and not just its type,
+ which would be incomplete when the type is derived and/or
+ tagged.
+
+2020-10-26 Piotr Trojanek <trojanek@adacore.com>
+
+ * exp_attr.adb (Expand_Update_Attribute): Handle
+ subtype_indication just like in Expand_Delta_Array_Aggregate.
+
+2020-10-25 Iain Sandoe <iain@sandoe.co.uk>
+
+ * Makefile.rtl: Add GNATRTL_128BIT_PAIRS/OBJS for 64bit
+ PowerPC Darwin cases.
+
+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.
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index fc978a2..6d9efc4 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) \
@@ -476,6 +483,7 @@ GNATRTL_NONTASKING_OBJS= \
g-speche$(objext) \
g-spipat$(objext) \
g-spitbo$(objext) \
+ g-spogwa$(objext) \
g-sptabo$(objext) \
g-sptain$(objext) \
g-sptavs$(objext) \
@@ -511,6 +519,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 +584,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 +605,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 +743,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 +759,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 +821,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 +829,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 +858,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 +884,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 +1029,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 +1046,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 +1065,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))),)
@@ -1015,6 +1136,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworksspe vxworks7% vxworks7spe
else
GCC_SPEC_FILES+=vxworks7-rtp-base-link.spec
endif
+ GCC_SPEC_FILES+=vxworks7-cert-rtp-link.spec
else
GCC_SPEC_FILES+=vxworks-$(ARCH_STR)-link.spec
GCC_SPEC_FILES+=vxworks-cert-$(ARCH_STR)-link.spec
@@ -1039,7 +1161,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 +1208,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 +1220,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 +1267,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 +1276,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 +1298,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 +1398,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
@@ -1278,6 +1412,7 @@ ifeq ($(strip $(filter-out %86 x86_64 wrs vxworks vxworks7%,$(target_cpu) $(targ
ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
GCC_SPEC_FILES+=vxworks7-$(X86CPU)-rtp-base-link.spec
+ GCC_SPEC_FILES+=vxworks7-cert-rtp-link.spec
else
GCC_SPEC_FILES+=vxworks-x86-link.spec
GCC_SPEC_FILES+=vxworks-cert-x86-link.spec
@@ -1288,11 +1423,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 +1472,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 +1519,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
@@ -1395,6 +1536,9 @@ ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
GCC_SPEC_FILES+=vxworks-smp-arm-link.spec
endif
endif
+ ifeq ($(strip $(filter-out vxworks7%, $(target_os))),)
+ GCC_SPEC_FILES+=vxworks7-cert-rtp-link.spec
+ endif
endif
# ARM android
@@ -1429,6 +1573,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 +1586,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 +1604,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 +1628,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 +1649,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 +1673,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 +1686,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 +1723,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 +1814,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 +1822,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 +1842,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 +1854,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 +1914,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 +1945,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 +1964,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 +1978,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 +2002,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 +2086,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 +2180,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 +2214,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 +2280,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 +2292,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 +2365,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 +2382,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 +2396,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 +2414,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 +2524,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 +2543,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 +2574,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 +2607,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 +2645,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
@@ -2475,6 +2703,7 @@ endif
ifeq ($(strip $(filter-out riscv% 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__riscv.ads \
@@ -2488,6 +2717,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 +2762,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,24 +2785,36 @@ 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
- ifeq ($(strip $(MULTISUBDIR)),/ppc64)
+ ifeq ($(strip $(filter-out powerpc64,$(target_cpu))),)
+ ifneq ($(strip $(MULTISUBDIR)),/ppc)
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ else
+ SO_OPTS += -m32
+ endif
+ else
+ ifeq ($(strip $(MULTISUBDIR)),/ppc64)
SO_OPTS += -m64
+ LIBGNAT_TARGET_PAIRS += $(GNATRTL_128BIT_PAIRS)
+ EXTRA_GNATRTL_NONTASKING_OBJS += $(GNATRTL_128BIT_OBJS)
+ endif
endif
endif
@@ -2576,11 +2831,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 +2876,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..123ba4e 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 --
--------------------------------
@@ -208,22 +217,6 @@ package body Get_Targ is
return 64; -- Can be different on some targets (e.g., AAMP)
end Get_Max_Unaligned_Field;
- ----------------------
- -- Digits_From_Size --
- ----------------------
-
- function Digits_From_Size (Size : Pos) return Pos is
- begin
- case Size is
- when 32 => return 6;
- when 48 => return 9;
- when 64 => return 15;
- when 96 => return 18;
- when 128 => return 18;
- when others => raise Program_Error;
- end case;
- end Digits_From_Size;
-
-----------------------------
-- Register_Back_End_Types --
-----------------------------
@@ -251,21 +244,6 @@ package body Get_Targ is
Alignment => 64);
end Register_Back_End_Types;
- ---------------------
- -- Width_From_Size --
- ---------------------
-
- 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 others => raise Program_Error;
- end case;
- end Width_From_Size;
-
------------------------------
-- Get_Back_End_Config_File --
------------------------------
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..936b16e 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);
@@ -2864,7 +2833,10 @@ package body Contracts is
procedure Freeze_Previous_Contracts (Body_Decl : Node_Id) is
function Causes_Contract_Freezing (N : Node_Id) return Boolean;
pragma Inline (Causes_Contract_Freezing);
- -- Determine whether arbitrary node N causes contract freezing
+ -- Determine whether arbitrary node N causes contract freezing. This is
+ -- used as an assertion for the current body declaration that caused
+ -- contract freezing, and as a condition to detect body declaration that
+ -- already caused contract freezing before.
procedure Freeze_Contracts;
pragma Inline (Freeze_Contracts);
@@ -2882,9 +2854,17 @@ package body Contracts is
function Causes_Contract_Freezing (N : Node_Id) return Boolean is
begin
- return Nkind (N) in
- N_Entry_Body | N_Package_Body | N_Protected_Body |
- N_Subprogram_Body | N_Subprogram_Body_Stub | N_Task_Body;
+ -- The following condition matches guards for calls to
+ -- Freeze_Previous_Contracts from routines that analyze various body
+ -- declarations. In particular, it detects expression functions, as
+ -- described in the call from Analyze_Subprogram_Body_Helper.
+
+ return
+ Comes_From_Source (Original_Node (N))
+ and then
+ Nkind (N) in
+ N_Entry_Body | N_Package_Body | N_Protected_Body |
+ N_Subprogram_Body | N_Subprogram_Body_Stub | N_Task_Body;
end Causes_Contract_Freezing;
----------------------
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..6f39de6 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 ``-gnat2020`` 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..3174825 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
@@ -146,18 +147,19 @@ Type Representation
*
"The small of an ordinary fixed point type. See 3.5.9(8)."
-``Fine_Delta`` is 2**(-63)
+The small is the largest power of two that does not exceed the delta.
*
"What combinations of small, range, and digits are
supported for fixed point types. See 3.5.9(10)."
-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
-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.
+For an ordinary fixed point type, the small must lie in 2**(-80) .. 2**80
+and the range in -10.0**36 .. 10.0**36; any combination is permitted that
+does not result in a mantissa larger than 63 bits. However, if the mantissa
+is larger than 53 bits on machines where Long_Long_Float is 64 bits (true
+of all architectures except x86), then the output from Text_IO may be
+accurate to only 53 bits, rather than the full mantissa. This is because
+floating-point conversions may be used to convert fixed point.
*
@@ -1220,7 +1222,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..ddf60ec 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
@@ -5107,7 +5079,7 @@ Syntax:
.. code-block:: ada
- pragma Profile (Ravenscar | Restricted | Rational |
+ pragma Profile (Ravenscar | Restricted | Rational | Jorvik |
GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
@@ -5115,10 +5087,12 @@ This pragma is standard in Ada 2005, but is available in all earlier
versions of Ada as an implementation-defined pragma. This is a
configuration pragma that establishes a set of configuration pragmas
that depend on the argument. ``Ravenscar`` is standard in Ada 2005.
+``Jorvik`` is standard in Ada 202x.
The other possibilities (``Restricted``, ``Rational``,
``GNAT_Extended_Ravenscar``, ``GNAT_Ravenscar_EDF``)
-are implementation-defined. The set of configuration pragmas
-is defined in the following sections.
+are implementation-defined. ``GNAT_Extended_Ravenscar`` is an alias for ``Jorvik``.
+
+The set of configuration pragmas is defined in the following sections.
* Pragma Profile (Ravenscar)
@@ -5188,7 +5162,7 @@ is defined in the following sections.
* ``Simple_Barriers``
The Ravenscar profile also includes the following restrictions that specify
- that there are no semantic dependences on the corresponding predefined
+ that there are no semantic dependencies on the corresponding predefined
packages:
* ``No_Dependence => Ada.Asynchronous_Task_Control``
@@ -5229,12 +5203,10 @@ is defined in the following sections.
automatically causes the use of a simplified,
more efficient version of the tasking run-time library.
-* Pragma Profile (GNAT_Extended_Ravenscar)
+* Pragma Profile (Jorvik)
- This profile corresponds to a GNAT specific extension of the
- Ravenscar profile. The profile may change in the future although
- only in a compatible way: some restrictions may be removed or
- relaxed. It is defined as a variation of the Ravenscar profile.
+ ``Jorvik`` is the new profile added to the Ada 202x draft standard,
+ previously implemented under the name ``GNAT_Extended_Ravenscar``.
The ``No_Implicit_Heap_Allocations`` restriction has been replaced
by ``No_Implicit_Task_Allocations`` and
@@ -5246,6 +5218,13 @@ is defined in the following sections.
The ``Max_Protected_Entries``, ``Max_Entry_Queue_Length``, and
``No_Relative_Delay`` restrictions have been removed.
+ Details on the rationale for ``Jorvik`` and implications for use may be
+ found in :title:`A New Ravenscar-Based Profile` by P. Rogers, J. Ruiz,
+ T. Gingold and P. Bernardi, in :title:`Reliable Software Technologies --
+ Ada Europe 2017`, Springer-Verlag Lecture Notes in Computer Science,
+ Number 10300.
+
+
* Pragma Profile (GNAT_Ravenscar_EDF)
This profile corresponds to the Ravenscar profile but using
@@ -7313,12 +7292,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..f152ce3 100644
--- a/gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst
+++ b/gcc/ada/doc/gnat_ugn/gnat_utility_programs.rst
@@ -1921,11 +1921,12 @@ building specialized scripts.
:switch:`--comments-fill`
Fill comment blocks.
+ The default is :switch:`--no-comments-fill`.
: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..b49b9a9 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.
---------------------------------------------------------
@@ -381,12 +381,11 @@ package Errout is
-- continuations are being gathered into a single message.
-- Insertion character | (Vertical bar: non-serious error)
- -- By default, error messages (other than warning messages) are
- -- considered to be fatal error messages which prevent expansion or
- -- generation of code in the presence of the -gnatQ switch. If the
- -- insertion character | appears, the message is considered to be
- -- non-serious, and does not cause Serious_Errors_Detected to be
- -- incremented (so expansion is not prevented by such a msg). This
+ -- By default, error messages (but not warning messages) are considered
+ -- to be fatal error messages, which prevent expansion and generation
+ -- of code. If the insertion character | appears, the message is
+ -- considered to be nonserious, and Serious_Errors_Detected is not
+ -- incremented, so expansion is not prevented by such a msg. This
-- insertion character is ignored in continuation messages.
-- Insertion character ~ (Tilde: insert string)
@@ -453,6 +452,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..986ccc9 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;
@@ -2422,18 +2448,30 @@ package body Exp_Aggr is
Next (Expr);
end loop;
- -- STEP 2 (b): Generate final loop if an others choice is present
+ -- STEP 2 (b): Generate final loop if an others choice is present.
-- Here Nb_Elements gives the offset of the last positional element.
if Present (Component_Associations (N)) then
Assoc := Last (Component_Associations (N));
- -- Ada 2005 (AI-287)
+ if Nkind (Assoc) = N_Iterated_Component_Association then
+ -- Ada 2020: generate a loop to have a proper scope for
+ -- the identifier that typically appears in the expression.
+ -- The lower bound of the loop is the position after all
+ -- previous positional components.
- Append_List (Gen_While (Add (Nb_Elements, To => Aggr_L),
- Aggr_High,
- Get_Assoc_Expr (Assoc)), -- AI-287
- To => New_Code);
+ Append_List (Gen_Loop (Add (Nb_Elements + 1, To => Aggr_L),
+ Aggr_High,
+ Expression (Assoc)),
+ To => New_Code);
+ else
+ -- Ada 2005 (AI-287)
+
+ Append_List (Gen_While (Add (Nb_Elements, To => Aggr_L),
+ Aggr_High,
+ Get_Assoc_Expr (Assoc)),
+ To => New_Code);
+ end if;
end if;
end if;
@@ -6376,7 +6414,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 +6793,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 +6850,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 +6923,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 +6939,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 +7124,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 +7152,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 +7269,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 +7292,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 +7324,6 @@ package body Exp_Aggr is
Pos : Int := 0;
Stat : Node_Id;
Key : Node_Id;
- Size : Int := 0;
-----------------------------
-- Expand_Raange_Component --
@@ -7116,74 +7363,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 +7372,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 +7451,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 +8303,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 +8351,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..f95c682 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
@@ -8048,6 +8164,9 @@ package body Exp_Attr is
while Present (Comp) loop
if Nkind (Comp) = N_Range then
Process_Range_Update (Temp, Comp, Expr, Typ);
+ elsif Nkind (Comp) = N_Subtype_Indication then
+ Process_Range_Update
+ (Temp, Range_Expression (Constraint (Comp)), Expr, Typ);
else
Process_Component_Or_Element_Update (Temp, Comp, Expr, Typ);
end if;
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..4f13576 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))
@@ -3416,7 +3665,7 @@ package body Exp_Ch6 is
return;
end if;
- if Modify_Tree_For_C
+ if Transform_Function_Array
and then Nkind (Call_Node) = N_Function_Call
and then Is_Entity_Name (Name (Call_Node))
then
@@ -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
@@ -6906,7 +6691,7 @@ package body Exp_Ch6 is
-- are not needed by the C generator (and this also produces cleaner
-- output).
- if Modify_Tree_For_C
+ if Transform_Function_Array
and then Nkind (Specification (N)) = N_Function_Specification
and then Is_Array_Type (Etype (Subp))
and then Is_Constrained (Etype (Subp))
@@ -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..53e2d97 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,579 @@ 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;
+ Expr : Node_Id;
+ begin
+ Param := First (Params);
+ while Present (Param) loop
+ Copy := Make_Temporary (Loc, 'C');
+
+ if Nkind (Param) = N_Parameter_Association then
+ Expr := Explicit_Actual_Parameter (Param);
+ else
+ Expr := Param;
+ end if;
+
+ Append_To (Decls,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Copy,
+ Object_Definition => New_Occurrence_Of (Etype (Expr), Loc),
+ Expression => New_Copy_Tree (Expr)));
+
+ 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 +1470,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 +1515,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));
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Temp,
- Object_Definition =>
- New_Occurrence_Of (Etype (Pref), Loc));
+ if Indirect then
+ if No (Eval_Stmts) then
+ Eval_Stmts := New_List;
+ end if;
- -- Place that temporary at the beginning of declarations, to
- -- prevent anomalies in the GNATprove flow-analysis pass in
- -- the precondition procedure that follows.
+ Declare_Indirect_Temporary
+ (Attr_Prefix => Pref,
+ Indirect_Temp => Temp);
- Prepend_To (Decls, Decl);
+ -- 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.
- -- If the type is unconstrained, the prefix provides its
- -- value and constraint, so add it to declaration.
+ else
+ Temp := Make_Temporary (Loc, 'T', Pref);
+ Set_Etype (Temp, Etype (Pref));
- if not Is_Constrained (Etype (Pref))
- and then Is_Entity_Name (Pref)
- then
- Set_Expression (Decl, Pref);
- Analyze (Decl);
+ -- Generate a temporary to capture the value of the prefix:
+ -- Temp : <Pref type>;
- -- Otherwise add an assignment statement to temporary using
- -- prefix as RHS.
+ Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Temp,
+ Object_Definition =>
+ New_Occurrence_Of (Etype (Pref), Loc));
- else
+ -- Place that temporary at the beginning of declarations, to
+ -- prevent anomalies in the GNATprove flow-analysis pass in
+ -- the precondition procedure that follows.
+
+ Prepend_To (Decls, Decl);
+
+ -- 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 +1568,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 +1579,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 +1936,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 +2473,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 +2481,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 +2552,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 +2583,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 +2767,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..75cdbe6 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,16 @@ package body Exp_SPARK is
-- Local Subprograms --
-----------------------
+ procedure Expand_SPARK_Array_Aggregate (N : Node_Id; Index : Node_Id);
+ -- Perform array-aggregate-specific expansion of an array sub-aggregate N
+ -- corresponding to the Index of the outer-most aggregate. This routine
+ -- mimics Resolve_Array_Aggregate which only checks the aggregate for being
+ -- well-formed, but doesn't analyze nor apply range checks to
+ -- iterated_component_associations.
+
+ 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 +112,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.
@@ -147,6 +161,107 @@ package body Exp_SPARK is
end Expand_SPARK;
----------------------------------
+ -- Expand_SPARK_Array_Aggregate --
+ ----------------------------------
+
+ procedure Expand_SPARK_Array_Aggregate (N : Node_Id; Index : Node_Id) is
+
+ procedure Expand_Aggr_Expr (Expr : Node_Id);
+ -- If Expr is a subaggregate, then process it recursively; otherwise it
+ -- is an expression for the array components which might not have been
+ -- analyzed and where scalar range checks could be missing.
+
+ ----------------------
+ -- Expand_Aggr_Expr --
+ ----------------------
+
+ procedure Expand_Aggr_Expr (Expr : Node_Id) is
+ Nxt_Ind : constant Node_Id := Next_Index (Index);
+ begin
+ if Present (Nxt_Ind) then
+ Expand_SPARK_Array_Aggregate (Expr, Index => Nxt_Ind);
+ else
+ declare
+ Comp_Type : constant Entity_Id := Component_Type (Etype (N));
+ begin
+ Analyze_And_Resolve (Expr, Comp_Type);
+
+ if Is_Scalar_Type (Comp_Type) then
+ Apply_Scalar_Range_Check (Expr, Comp_Type);
+ end if;
+ end;
+ end if;
+ end Expand_Aggr_Expr;
+
+ -- Local variables
+
+ Assoc : Node_Id := First (Component_Associations (N));
+
+ -- Start of processing for Expand_SPARK_Array_Aggregate
+
+ begin
+ while Present (Assoc) loop
+ -- For iterated_component_association we must apply range check to
+ -- discrete choices and re-analyze the expression, because frontend
+ -- only checks its legality and then analyzes the expanded loop code.
+
+ if Nkind (Assoc) = N_Iterated_Component_Association then
+ declare
+ Choice : Node_Id;
+ begin
+ -- Analyze discrete choices
+
+ Choice := First (Discrete_Choices (Assoc));
+
+ while Present (Choice) loop
+
+ -- The index denotes a range of elements where range checks
+ -- have been already applied.
+
+ if Nkind (Choice) 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 (Choice) in N_Subexpr);
+ Apply_Scalar_Range_Check (Choice, Etype (Index));
+ end if;
+
+ Next (Choice);
+ end loop;
+
+ -- Keep processing the expression with index parameter in scope
+
+ Push_Scope (Scope (Defining_Identifier (Assoc)));
+ Enter_Name (Defining_Identifier (Assoc));
+ Expand_Aggr_Expr (Expression (Assoc));
+ End_Scope;
+ end;
+
+ -- For ordinary component associations we recurse into subaggregates,
+ -- because there could be nested iterated_component_association (and
+ -- it is harmless to analyze and apply checks if there is none).
+
+ else pragma Assert (Nkind (Assoc) = N_Component_Association);
+ declare
+ Expr : constant Node_Id := Expression (Assoc);
+ pragma Assert (Present (Expr) xor Box_Present (Assoc));
+ begin
+ if Present (Expr) then
+ Expand_Aggr_Expr (Expr);
+ end if;
+ end;
+ end if;
+
+ Next (Assoc);
+ end loop;
+ end Expand_SPARK_Array_Aggregate;
+
+ ----------------------------------
-- Expand_SPARK_Delta_Or_Update --
----------------------------------
@@ -215,25 +330,45 @@ 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)));
+ Enter_Name (Defining_Identifier (Assoc));
+ Analyze_And_Resolve (Expr, 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 (Choice_List (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 +475,18 @@ 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
+ Aggr_Typ : constant Entity_Id := Etype (N);
+ begin
+ if Is_Array_Type (Aggr_Typ) then
+ Expand_SPARK_Array_Aggregate (N, Index => First_Index (Aggr_Typ));
+ end if;
+ 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_unst.adb b/gcc/ada/exp_unst.adb
index ffc30c3..e0f2bd1 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -882,8 +882,8 @@ package body Exp_Unst is
-- outside the nested structure do not affect us.
if Scope_Within (Ent, Subp)
- and then Is_Subprogram (Ent)
- and then not Is_Imported (Ent)
+ and then Is_Subprogram (Ent)
+ and then not Is_Imported (Ent)
then
Append_Unique_Call ((N, Current_Subprogram, Ent));
end if;
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..0779165 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).
@@ -7960,7 +7978,16 @@ package body Freeze is
-- Check that a type referenced by an entity can be frozen
if Is_Entity_Name (Node) and then Present (Entity (Node)) then
- Check_And_Freeze_Type (Etype (Entity (Node)));
+ -- The entity itself may be a type, as in a membership test
+ -- or an attribute reference. Freezing its own type would be
+ -- incomplete if the entity is derived or an extension.
+
+ if Is_Type (Entity (Node)) then
+ Check_And_Freeze_Type (Entity (Node));
+
+ else
+ Check_And_Freeze_Type (Etype (Entity (Node)));
+ end if;
-- Check that the enclosing record type can be frozen
@@ -7990,19 +8017,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 +8521,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 +8544,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));
@@ -9116,7 +9142,7 @@ package body Freeze is
Check_Overriding_Indicator (E, Empty, Is_Primitive (E));
end if;
- if Modify_Tree_For_C
+ if Transform_Function_Array
and then Nkind (Parent (E)) = N_Function_Specification
and then Is_Array_Type (Etype (E))
and then Is_Constrained (Etype (E))
@@ -9127,6 +9153,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/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 6177d75..bdf6ae2 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -338,7 +338,7 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
# picks up the right files. For a given target this must be coherent
# with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
-ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
+ifeq ($(strip $(filter-out x86_64, $(target_cpu))),)
ifeq ($(strip $(MULTISUBDIR)),/32)
target_cpu:=i686
else
@@ -348,6 +348,11 @@ ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
endif
endif
+# The SuSE PowerPC64/Linux compiler is actually a 32-bit PowerPC compiler
+ifeq ($(strip $(filter-out powerpc64 suse linux%, $(target_cpu) $(target_vendor) $(target_os))),)
+ target_cpu:=powerpc
+endif
+
# Configuration of host tools
# Under linux, host tools need to be linked with -ldl
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index cd0a50b..4e6dc84 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -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));
@@ -4603,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. */
@@ -4721,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);
}
@@ -5250,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
@@ -7105,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
@@ -7122,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);
@@ -7131,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)
@@ -7145,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 ^}";
@@ -7237,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);
@@ -7333,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);
@@ -9278,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/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 781868e..87724af 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -559,7 +559,7 @@ gnat_printable_name (tree decl, int verbosity)
__gnat_decode (coded_name, ada_name, 0);
- if (verbosity == 2 && !DECL_IS_BUILTIN (decl))
+ if (verbosity == 2 && !DECL_IS_UNDECLARED_BUILTIN (decl))
{
Set_Identifier_Casing (ada_name, DECL_SOURCE_FILE (decl));
return ggc_strdup (Name_Buffer);
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 f03d591..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);
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..881c06c 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 --
----------------------
@@ -266,22 +278,6 @@ package body Get_Targ is
return null;
end Get_Back_End_Config_File;
- ----------------------
- -- Digits_From_Size --
- ----------------------
-
- function Digits_From_Size (Size : Pos) return Pos is
- begin
- case Size is
- when 32 => return 6;
- when 48 => return 9;
- when 64 => return 15;
- when 96 => return 18;
- when 128 => return 18;
- when others => raise Program_Error;
- end case;
- end Digits_From_Size;
-
-----------------------------
-- Get_Max_Unaligned_Field --
-----------------------------
@@ -302,19 +298,4 @@ package body Get_Targ is
Enumerate_Modes (Call_Back);
end Register_Back_End_Types;
- ---------------------
- -- Width_From_Size --
- ---------------------
-
- 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 others => raise Program_Error;
- end case;
- end Width_From_Size;
-
end Get_Targ;
diff --git a/gcc/ada/get_targ.ads b/gcc/ada/get_targ.ads
index 5a21418..5315292 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
@@ -112,10 +115,6 @@ package Get_Targ is
-- Returns the maximum supported size in bits for a field that is
-- not aligned on a storage unit boundary.
- function Width_From_Size (Size : Pos) return Pos;
- function Digits_From_Size (Size : Pos) return Pos;
- -- Calculate values for 'Width or 'Digits from 'Size
-
type C_String is array (0 .. 255) of aliased Character;
pragma Convention (C, C_String);
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..65da307 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -167,6 +167,7 @@ procedure Gnat1drv is
if Debug_Flag_Dot_U then
Modify_Tree_For_C := True;
+ Transform_Function_Array := True;
end if;
-- -gnatd_A disables generation of ALI files
@@ -179,6 +180,7 @@ procedure Gnat1drv is
if Generate_C_Code then
Modify_Tree_For_C := True;
+ Transform_Function_Array := True;
Unnest_Subprogram_Mode := True;
Building_Static_Dispatch_Tables := False;
Minimize_Expression_With_Actions := True;
@@ -246,9 +248,10 @@ procedure Gnat1drv is
-- this way when we are doing CodePeer tests on existing test suites
-- that may have -gnateg set, to avoid the need for special casing.
- Modify_Tree_For_C := False;
- Generate_C_Code := False;
- Unnest_Subprogram_Mode := False;
+ Modify_Tree_For_C := False;
+ Transform_Function_Array := False;
+ Generate_C_Code := False;
+ Unnest_Subprogram_Mode := False;
-- Turn off inlining, confuses CodePeer output and gains nothing
@@ -342,10 +345,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).
@@ -458,9 +457,10 @@ procedure Gnat1drv is
-- this way when we are doing GNATprove tests on existing test suites
-- that may have -gnateg set, to avoid the need for special casing.
- Modify_Tree_For_C := False;
- Generate_C_Code := False;
- Unnest_Subprogram_Mode := False;
+ Modify_Tree_For_C := False;
+ Transform_Function_Array := False;
+ Generate_C_Code := False;
+ Unnest_Subprogram_Mode := False;
-- Turn off inlining, which would confuse formal verification output
-- and gain nothing.
@@ -531,10 +531,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 +803,22 @@ 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.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 +1087,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 +1716,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..c28518f 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,14 +6529,14 @@ 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
Syntax:
@example
-pragma Profile (Ravenscar | Restricted | Rational |
+pragma Profile (Ravenscar | Restricted | Rational | Jorvik |
GNAT_Extended_Ravenscar | GNAT_Ravenscar_EDF );
@end example
@@ -6572,10 +6544,12 @@ This pragma is standard in Ada 2005, but is available in all earlier
versions of Ada as an implementation-defined pragma. This is a
configuration pragma that establishes a set of configuration pragmas
that depend on the argument. @code{Ravenscar} is standard in Ada 2005.
+@code{Jorvik} is standard in Ada 202x.
The other possibilities (@code{Restricted}, @code{Rational},
@code{GNAT_Extended_Ravenscar}, @code{GNAT_Ravenscar_EDF})
-are implementation-defined. The set of configuration pragmas
-is defined in the following sections.
+are implementation-defined. @code{GNAT_Extended_Ravenscar} is an alias for @code{Jorvik}.
+
+The set of configuration pragmas is defined in the following sections.
@itemize *
@@ -6675,7 +6649,7 @@ No rendezvous statements are allowed.
@end itemize
The Ravenscar profile also includes the following restrictions that specify
-that there are no semantic dependences on the corresponding predefined
+that there are no semantic dependencies on the corresponding predefined
packages:
@@ -6727,12 +6701,10 @@ automatically causes the use of a simplified,
more efficient version of the tasking run-time library.
@item
-Pragma Profile (GNAT_Extended_Ravenscar)
+Pragma Profile (Jorvik)
-This profile corresponds to a GNAT specific extension of the
-Ravenscar profile. The profile may change in the future although
-only in a compatible way: some restrictions may be removed or
-relaxed. It is defined as a variation of the Ravenscar profile.
+@code{Jorvik} is the new profile added to the Ada 202x draft standard,
+previously implemented under the name @code{GNAT_Extended_Ravenscar}.
The @code{No_Implicit_Heap_Allocations} restriction has been replaced
by @code{No_Implicit_Task_Allocations} and
@@ -6744,6 +6716,11 @@ The @code{Simple_Barriers} restriction has been replaced by
The @code{Max_Protected_Entries}, @code{Max_Entry_Queue_Length}, and
@code{No_Relative_Delay} restrictions have been removed.
+Details on the rationale for @code{Jorvik} and implications for use may be
+found in @cite{A New Ravenscar-Based Profile} by P. Rogers, J. Ruiz,
+T. Gingold and P. Bernardi, in @cite{Reliable Software Technologies -- Ada Europe 2017}, Springer-Verlag Lecture Notes in Computer Science,
+Number 10300.
+
@item
Pragma Profile (GNAT_Ravenscar_EDF)
@@ -6831,7 +6808,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 +6826,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 +6845,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 +6865,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 +6885,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 +6947,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 +6965,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 +6985,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 +7018,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 +7043,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 +7057,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 +7083,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 +7098,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 +7124,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 +7145,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 +7183,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 +7287,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 +7323,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 +7341,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 +7349,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 +7368,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 +7382,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 +7436,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 +7446,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 +7542,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 +7567,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 +7591,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 +7673,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 +7697,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 +7774,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 +7847,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 +7861,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 +7934,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 +7953,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 +7968,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 +7991,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 +8036,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 +8092,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 +8112,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 +8168,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 +8206,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 +8222,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 +8247,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 +8268,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 +8295,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 +8315,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 +8370,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 +8390,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 +8409,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 +8433,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 +8467,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 +8527,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 +8552,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 +8588,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 +8624,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 +8648,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 +8682,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 +8738,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 +8756,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 +8781,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 +8796,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 +8836,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 +8886,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 +9042,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 +9093,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 +9124,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 +9244,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 +9253,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 +9280,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 +9289,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 +9298,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 +9307,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 +9318,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 +9327,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 +9336,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 +9372,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 +9432,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 +9445,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 +9454,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 +9463,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 +9472,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 +9481,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 +9490,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 +9499,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 +9508,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 +9517,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 +9526,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 +9537,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 +9628,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 +9637,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 +9646,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 +9655,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 +9664,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 +9674,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 +9683,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 +9694,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 +9714,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 +9723,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 +9732,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 +9746,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 +9801,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{-gnat2020} 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 +10055,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 +10093,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 +10107,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 +10123,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 +10137,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 +10156,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 +10171,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 +10202,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 +10217,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 +10260,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 +10271,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 +10286,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 +10303,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 +10320,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 +10333,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 +10362,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 +10377,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 +10393,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 +10409,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 +10423,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 +10436,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 +10460,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 +10500,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 +10526,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 +10539,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 +10550,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 +10568,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 +10595,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 +10605,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 +10623,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 +10639,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 +10669,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 +10679,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 +10707,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 +10721,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 +10730,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 +10743,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 +10769,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 +10779,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 +10809,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 +10819,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 +10831,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 +10847,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 +10915,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 +11176,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 +11299,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 +11891,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 +12653,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 +13749,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 +15392,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 +15527,7 @@ further details.
@end itemize
-@multitable {xxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
+@multitable {xxxxxxxxxxxxxxxxxxxxxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@headitem
Type
@@ -15558,7 +15542,7 @@ Representation
@tab
-8 bit signed
+8-bit signed
@item
@@ -15566,7 +15550,7 @@ Representation
@tab
-(Short) 16 bit signed
+16-bit signed
@item
@@ -15574,7 +15558,7 @@ Representation
@tab
-32 bit signed
+32-bit signed
@item
@@ -15582,9 +15566,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 +15576,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
@@ -15687,7 +15680,7 @@ Representation
"The small of an ordinary fixed point type. See 3.5.9(8)."
@end itemize
-@code{Fine_Delta} is 2**(-63)
+The small is the largest power of two that does not exceed the delta.
@itemize *
@@ -15697,12 +15690,13 @@ Representation
supported for fixed point types. See 3.5.9(10)."
@end itemize
-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
-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.
+For an ordinary fixed point type, the small must lie in 2**(-80) .. 2**80
+and the range in -10.0**36 .. 10.0**36; any combination is permitted that
+does not result in a mantissa larger than 63 bits. However, if the mantissa
+is larger than 53 bits on machines where Long_Long_Float is 64 bits (true
+of all architectures except x86), then the output from Text_IO may be
+accurate to only 53 bits, rather than the full mantissa. This is because
+floating-point conversions may be used to convert fixed point.
@itemize *
@@ -17524,7 +17518,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 +17944,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 +18111,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 +18680,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 +19102,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 +19133,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 +19215,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 +19225,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 +19255,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 +19270,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 +19300,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 +19314,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 +19368,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 +22589,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 +23187,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 +23204,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 +23232,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 +23247,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 +23260,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 +23275,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 +23290,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 +23303,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 +23318,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 +23333,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 +23346,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 +23357,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 +23371,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 +23383,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 +23398,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 +23411,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 +23426,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 +23439,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 +23450,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 +23465,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 +23478,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 +23493,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 +23509,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 +23525,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 +23541,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 +23555,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 +23569,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 +23580,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 +23597,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 +23612,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 +23627,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 +23642,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 +23654,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 +23667,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 +23685,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 +23696,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 +23713,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 +23730,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 +23743,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 +23767,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 +23788,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 +23801,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 +23813,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 +23831,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 +23851,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 +23873,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 +23894,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 +23907,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 +23921,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 +23942,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 +23958,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 +23970,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 +23984,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 +23999,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 +24013,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 +24029,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 +24043,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 +24056,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 +24072,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 +24086,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 +24100,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 +24112,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 +24124,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 +24137,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 +24150,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 +24164,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 +24180,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 +24198,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 +24210,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 +24226,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 +24240,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 +24255,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 +24269,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 +24281,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 +24292,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 +24304,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 +24317,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 +24330,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 +24343,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 +24356,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 +24369,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 +24381,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 +24396,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 +24410,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 +24422,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 +24435,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 +24451,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 +24466,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 +24481,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 +24498,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 +24515,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 +24527,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 +24536,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 +24548,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 +24558,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 +24572,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 +24592,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 +24609,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 +24624,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 +24641,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 +24653,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 +24662,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 +24681,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 +24694,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 +24706,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 +24720,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 +24732,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 +24746,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 +24757,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 +24770,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 +24785,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 +24801,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 +24817,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 +24840,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 +24856,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 +24872,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 +24886,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 +24904,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 +24917,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 +24930,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 +24943,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 +24960,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 +24977,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 +24993,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 +25009,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 +25025,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 +25038,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 +25059,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 +25071,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 +25089,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 +25229,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 +25286,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 +25294,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 +25304,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 +25328,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 +25369,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 +25387,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 +25555,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 +25571,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 +25640,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 +25691,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 +25725,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 +25823,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 +25854,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 +25901,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 +25916,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 +25944,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 +25955,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 +25997,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 +26077,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 +26104,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 +28270,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 +28289,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 +28302,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 +28311,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 +28321,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 +28347,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 +28357,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 +28379,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 +28501,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 +28529,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 +28629,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 +28657,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 +28699,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 +28732,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 +28804,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 +28827,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 +28849,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 +28863,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 +28892,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 +28928,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 +28941,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 +28987,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 +29080,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 +29110,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..c24763a 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
@@ -2916,7 +2917,24 @@ package body Inline is
-- formal in the inlined code.
if Is_Entity_Name (A) and then Ekind (F) /= E_In_Parameter then
- Set_Last_Assignment (Entity (A), Empty);
+
+ -- In GNATprove mode a protected component acting as an actual
+ -- subprogram parameter will appear as inlined-for-proof. However,
+ -- its E_Component entity is not an assignable object, so the
+ -- assertion in Set_Last_Assignment will fail. We just omit the
+ -- call to Set_Last_Assignment, because GNATprove flags useless
+ -- assignments with its own flow analysis.
+ --
+ -- In GNAT mode such a problem does not occur, because protected
+ -- components are inlined via object renamings whose entity kind
+ -- E_Variable is assignable.
+
+ if Is_Assignable (Entity (A)) then
+ Set_Last_Assignment (Entity (A), Empty);
+ else
+ pragma Assert
+ (GNATprove_Mode and then Is_Protected_Component (Entity (A)));
+ end if;
end if;
-- If the argument may be a controlling argument in a call within
@@ -3728,8 +3746,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 +5137,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..7a490d5 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
@@ -348,6 +349,8 @@ is
Free (Position.Node);
Position.Container := null;
+ Position.Position := No_Element.Position;
+ pragma Assert (Position = No_Element);
end Delete;
-------------
@@ -384,6 +387,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 +966,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..9c4e51a 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
@@ -335,6 +336,8 @@ is
Free (Position.Node);
Position.Container := null;
+ Position.Position := No_Element.Position;
+ pragma Assert (Position = No_Element);
end Delete;
-------------
@@ -366,6 +369,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 +884,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..0131f73 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
@@ -318,6 +319,8 @@ is
Free (Position.Node);
Position.Container := null;
+ Position.Position := No_Element.Position;
+ pragma Assert (Position = No_Element);
end Delete;
----------------
@@ -467,6 +470,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 +1163,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__vxworks.ads b/gcc/ada/libgnat/a-nallfl.ads
index 410655d..ca998fa 100644
--- a/gcc/ada/libgnat/a-numaux__vxworks.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 --
--- (C Library Version, VxWorks) --
+-- (C Math Library Version, Long 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_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_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 (Intrinsic, Sin, "sin");
- pragma Pure_Function (Sin);
+ function Sin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinl";
- function Cos (X : Double) return Double;
- pragma Import (Intrinsic, Cos, "cos");
- pragma Pure_Function (Cos);
+ function Cos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cosl";
- function Tan (X : Double) return Double;
- pragma Import (Intrinsic, Tan, "tan");
- pragma Pure_Function (Tan);
+ function Tan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanl";
- function Exp (X : Double) return Double;
- pragma Import (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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-nalofl.ads b/gcc/ada/libgnat/a-nalofl.ads
new file mode 100644
index 0000000..4cdf2f4
--- /dev/null
+++ b/gcc/ada/libgnat/a-nalofl.ads
@@ -0,0 +1,87 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- 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 Math Library Version, 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 C library version interfaces with the routines
+-- in the C mathematical library, and is thus quite portable.
+
+with Ada.Numerics.Aux_Linker_Options;
+pragma Warnings (Off, Ada.Numerics.Aux_Linker_Options);
+
+package Ada.Numerics.Aux_Long_Float is
+ pragma Pure;
+
+ 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 : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sin";
+
+ function Cos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cos";
+
+ function Tan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tan";
+
+ function Exp (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "exp";
+
+ function Sqrt (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sqrt";
+
+ function Log (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "log";
+
+ function Acos (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "acos";
+
+ function Asin (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "asin";
+
+ function Atan (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "atan";
+
+ function Sinh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "sinh";
+
+ function Cosh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "cosh";
+
+ function Tanh (X : T) return T with
+ Import, Convention => Intrinsic, External_Name => "tanh";
+
+ function Pow (X, Y : T) return T with
+ Import, Convention => Intrinsic, External_Name => "pow";
+
+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 f6deebe..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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 4154e1a..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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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 (Intrinsic, 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-numaux__darwin.ads b/gcc/ada/libgnat/a-numaux__darwin.ads
deleted file mode 100644
index add87a4..0000000
--- a/gcc/ada/libgnat/a-numaux__darwin.ads
+++ /dev/null
@@ -1,103 +0,0 @@
-------------------------------------------------------------------------------
--- --
--- GNAT RUN-TIME COMPONENTS --
--- --
--- A D A . N U M E R I C S . A U X --
--- --
--- S p e c --
--- (Apple OS X Version) --
--- --
--- 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 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.
-
-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
-
- -- 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);
-
- function Cos (X : Double) return Double;
- pragma Inline (Cos);
-
- -- 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 (Intrinsic, Tan, "tan");
- pragma Pure_Function (Tan);
-
- function Exp (X : Double) return Double;
- pragma Import (Intrinsic, Exp, "exp");
- pragma Pure_Function (Exp);
-
- function Sqrt (X : Double) return Double;
- pragma Import (Intrinsic, Sqrt, "sqrt");
- pragma Pure_Function (Sqrt);
-
- function Log (X : Double) return Double;
- pragma Import (Intrinsic, Log, "log");
- pragma Pure_Function (Log);
-
- function Acos (X : Double) return Double;
- pragma Import (Intrinsic, Acos, "acos");
- pragma Pure_Function (Acos);
-
- function Asin (X : Double) return Double;
- pragma Import (Intrinsic, Asin, "asin");
- pragma Pure_Function (Asin);
-
- function Atan (X : Double) return Double;
- pragma Import (Intrinsic, Atan, "atan");
- pragma Pure_Function (Atan);
-
- function Sinh (X : Double) return Double;
- pragma Import (Intrinsic, Sinh, "sinh");
- pragma Pure_Function (Sinh);
-
- function Cosh (X : Double) return Double;
- pragma Import (Intrinsic, Cosh, "cosh");
- pragma Pure_Function (Cosh);
-
- function Tanh (X : Double) return Double;
- pragma Import (Intrinsic, Tanh, "tanh");
- pragma Pure_Function (Tanh);
-
- function Pow (X, Y : Double) return Double;
- pragma Import (Intrinsic, Pow, "pow");
- pragma Pure_Function (Pow);
-
-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..2d0b47c 100644
--- a/gcc/ada/libgnat/a-tifiio.adb
+++ b/gcc/ada/libgnat/a-tifiio.adb
@@ -32,15 +32,15 @@
-- Fixed point I/O
-- ---------------
--- The following documents implementation details of the fixed point
--- input/output routines in the GNAT run time. The first part describes
--- general properties of fixed point types as defined by the Ada 95 standard,
+-- The following text documents implementation details of the fixed point
+-- input/output routines in the GNAT runtime. The first part describes the
+-- general properties of fixed point types as defined by the Ada standard,
-- including the Information Systems Annex.
-- Subsequently these are reduced to implementation constraints and the impact
--- of these constraints on a few possible approaches to I/O are given.
+-- of these constraints on a few possible approaches to input/output is given.
-- Based on this analysis, a specific implementation is selected for use in
--- the GNAT run time. Finally, the chosen algorithm is analyzed numerically in
+-- the GNAT runtime. Finally, the chosen algorithm is analyzed numerically in
-- order to provide user-level documentation on limits for range and precision
-- of fixed point types as well as accuracy of input/output conversions.
@@ -48,24 +48,22 @@
-- - General Properties of Fixed Point Types -
-- -------------------------------------------
--- Operations on fixed point values, other than input and output, are not
--- important for the purposes of this document. Only the set of values that a
--- fixed point type can represent and the input and output operations are
--- significant.
+-- Operations on fixed point types, other than input/output, are not important
+-- for the purpose of this document. Only the set of values that a fixed point
+-- type can represent and the input/output operations are significant.
-- Values
-- ------
--- Set set of values of a fixed point type comprise the integral
--- multiples of a number called the small of the type. The small can
--- either be a power of ten, a power of two or (if the implementation
--- allows) an arbitrary strictly positive real value.
+-- The set of values of a fixed point type comprise the integral multiples of
+-- a number called the small of the type. The small can be either a power of
+-- two, a power of ten or (if the implementation allows) an arbitrary strictly
+-- positive real value.
--- Implementations need to support fixed-point types with a precision
--- of at least 24 bits, and (in order to comply with the Information
--- Systems Annex) decimal types need to support at least digits 18.
--- For the rest, however, no requirements exist for the minimal small
--- and range that need to be supported.
+-- Implementations need to support ordinary fixed point types with a precision
+-- of at least 24 bits, and (in order to comply with the Information Systems
+-- Annex) decimal fixed point types with at least 18 digits. For the rest, no
+-- requirements exist for the minimal small and range that must be supported.
-- Operations
-- ----------
@@ -112,27 +110,27 @@
-- Implementation Strategies
-- -------------------------
--- * Float arithmetic
+-- * Floating point arithmetic
-- * Arbitrary-precision integer arithmetic
-- * Fixed-precision integer arithmetic
--- Although it seems convenient to convert fixed point numbers to floating-
+-- Although it seems convenient to convert fixed point numbers to floating
-- point and then print them, this leads to a number of restrictions.
-- The first one is precision. The widest floating-point type generally
-- available has 53 bits of mantissa. This means that Fine_Delta cannot
-- be less than 2.0**(-53).
--- In GNAT, Fine_Delta is 2.0**(-63), and Duration for example is a
--- 64-bit type. It would still be possible to use multi-precision
--- floating-point to perform calculations using longer mantissas,
--- but this is a much harder approach.
+-- In GNAT, Fine_Delta is 2.0**(-63), and Duration for example is a 64-bit
+-- type. This means that a floating-point type with 63 bits of mantissa needs
+-- to be used, which is only generally available on the x86 architecture. It
+-- would still be possible to use multi-precision floating point to perform
+-- calculations using longer mantissas, but this is a much harder approach.
--- The base conversions needed for input and output of (non-decimal)
--- fixed point types can be seen as pairs of integer multiplications
--- and divisions.
+-- The base conversions needed for input/output of (non-decimal) fixed point
+-- types can be seen as pairs of integer multiplications and divisions.
--- Arbitrary-precision integer arithmetic would be suitable for the job
--- at hand, but has the draw-back that it is very heavy implementation-wise.
+-- Arbitrary-precision integer arithmetic would be suitable for the job at
+-- hand, but has the drawback that it is very heavy implementation-wise.
-- Especially in embedded systems, where fixed point types are often used,
-- it may not be desirable to require large amounts of storage and time
-- for fixed I/O operations.
@@ -142,21 +140,6 @@
-- solution. The downside however may be a too limited set of acceptable
-- fixed point types.
--- Extra Precision
--- ---------------
-
--- Using a scaled divide which truncates and returns a remainder R,
--- another E trailing digits can be calculated by computing the value
--- (R * (10.0**E)) / Z using another scaled divide. This procedure
--- can be repeated to compute an arbitrary number of digits in linear
--- time and storage. The last scaled divide should be rounded, with
--- a possible carry propagating to the more significant digits, to
--- ensure correct rounding of the unit in the last place.
-
--- An extension of this technique is to limit the value of Q to 9 decimal
--- digits, since 32-bit integers can be much more efficient than 64-bit
--- integers to output.
-
with Interfaces; use Interfaces;
with System.Arith_64; use System.Arith_64;
with System.Img_Real; use System.Img_Real;
@@ -181,7 +164,7 @@ package body Ada.Text_IO.Fixed_IO is
-- Fore + Aft + Exp + Extra_Layout_Space
- -- is always long enough for formatting any fixed point number
+ -- is always long enough for formatting any fixed point number.
-- Implementation of Put routines
@@ -205,15 +188,15 @@ package body Ada.Text_IO.Fixed_IO is
-- factor 10**E can be trivially handled during final output, by adjusting
-- the decimal point or exponent.
- -- Convert a value X * S of type T to a 64-bit integer value Q equal
- -- to 10.0**D * (X * S) rounded to the nearest integer.
- -- This conversion is a scaled integer divide of the form
+ -- The idea is to convert a value X * S of type T to a 64-bit integer value
+ -- Q equal to 10.0**D * (X * S) rounded to the nearest integer, using only
+ -- a scaled integer divide of the form
-- Q := (X * Y) / Z,
- -- where all variables are 64-bit signed integers using 2's complement,
- -- and both the multiplication and division are done using full
- -- intermediate precision. The final decimal value to be output is
+ -- where the variables X, Y, Z are 64-bit integers, and both multiplication
+ -- and division are done using full intermediate precision. Then the final
+ -- decimal value to be output is
-- Q * 10**(E-D)
@@ -221,13 +204,12 @@ package body Ada.Text_IO.Fixed_IO is
-- according to the format described in RM A.3.10. The details of this
-- operation are omitted here.
- -- A 64-bit value can contain all integers with 18 decimal digits, but
- -- not all with 19 decimal digits. If the total number of requested output
- -- digits (Fore - 1) + Aft is greater than 18, for purposes of the
- -- conversion Aft is adjusted to 18 - (Fore - 1). In that case, or
- -- when Fore > 19, trailing zeros can complete the output after writing
- -- the first 18 significant digits, or the technique described in the
- -- next section can be used.
+ -- A 64-bit value can represent all integers with 18 decimal digits, but
+ -- not all with 19 decimal digits. If the total number of requested ouput
+ -- digits (Fore - 1) + Aft is greater than 18 then, for purposes of the
+ -- conversion, Aft is adjusted to 18 - (Fore - 1). In that case, trailing
+ -- zeros can complete the output after writing the first 18 significant
+ -- digits, or the technique described in the next section can be used.
-- The final expression for D is
@@ -235,15 +217,13 @@ package body Ada.Text_IO.Fixed_IO is
-- For Y and Z the following expressions can be derived:
- -- Q / (10.0**D) = X * S
-
-- Q = X * S * (10.0**D) = (X * Y) / Z
-- S * 10.0**D = Y / Z;
-- If S is an integer greater than or equal to one, then Fore must be at
- -- least 20 in order to print T'First, which is at most -2.0**63.
- -- This means D < 0, so use
+ -- least 20 in order to print T'First, which is at most -2.0**63. This
+ -- means that D < 0, so use
-- (1) Y = -S and Z = -10**(-D)
@@ -253,7 +233,7 @@ package body Ada.Text_IO.Fixed_IO is
-- or
- -- (3) Y = 1 and Z = (1.0 / S) * 10**(-D), for D < 0
+ -- (3) Y = -1 and Z = -(1.0 / S) * 10**(-D), for D < 0
-- Negative values are used for nominator Y and denominator Z, so that S
-- can have a maximum value of 2.0**63 and a minimum of 2.0**(-63).
@@ -262,11 +242,23 @@ package body Ada.Text_IO.Fixed_IO is
-- in the denominator for the extra decimal scaling required, so case (3)
-- will not overflow.
+ -- Extra Precision
+
+ -- Using a scaled divide which truncates and returns a remainder R,
+ -- another K trailing digits can be calculated by computing the value
+ -- (R * (10.0**K)) / Z using another scaled divide. This procedure
+ -- can be repeated to compute an arbitrary number of digits in linear
+ -- time and storage. The last scaled divide should be rounded, with
+ -- a possible carry propagating to the more significant digits, to
+ -- ensure correct rounding of the unit in the last place.
+
+ -- A variant of this technique is to limit the value of Q to 9 decimal
+ -- digits, since 32-bit integers can be much more efficient than 64-bit
+ -- integers to output.
+
pragma Assert (System.Fine_Delta >= 2.0**(-63));
- pragma Assert (Num'Small in 2.0**(-63) .. 2.0**63);
+ pragma Assert (Num'Small in 2.0**(-80) .. 2.0**80);
pragma Assert (Num'Fore <= 37);
- -- These assertions need to be relaxed to allow for a Small of
- -- 2.0**(-64) at least, since there is an ACATS test for this ???
Max_Digits : constant := 18;
-- Maximum number of decimal digits that can be represented in a
@@ -277,9 +269,9 @@ package body Ada.Text_IO.Fixed_IO is
-- decimal point.
subtype Int is Integer;
- E0 : constant Int := -(20 * Boolean'Pos (Num'Small >= 1.0E1));
- E1 : constant Int := E0 + 10 * Boolean'Pos (Num'Small * 10.0**E0 < 1.0E-10);
- E2 : constant Int := E1 + 5 * Boolean'Pos (Num'Small * 10.0**E1 < 1.0E-5);
+ E0 : constant Int := -(25 * Boolean'Pos (Num'Small >= 1.0E1));
+ E1 : constant Int := E0 + 13 * Boolean'Pos (Num'Small * 10.0**E0 < 1.0E-13);
+ E2 : constant Int := E1 + 6 * Boolean'Pos (Num'Small * 10.0**E1 < 1.0E-6);
E3 : constant Int := E2 + 3 * Boolean'Pos (Num'Small * 10.0**E2 < 1.0E-3);
E4 : constant Int := E3 + 2 * Boolean'Pos (Num'Small * 10.0**E3 < 1.0E-1);
E5 : constant Int := E4 + 1 * Boolean'Pos (Num'Small * 10.0**E4 < 1.0E-0);
@@ -290,10 +282,12 @@ package body Ada.Text_IO.Fixed_IO is
and then Num'Small * 10.0**Scale < 10.0);
Exact : constant Boolean :=
- Float'Floor (Num'Small) = Float'Ceiling (Num'Small)
- or else Float'Floor (1.0 / Num'Small) = Float'Ceiling (1.0 / Num'Small)
- or else Num'Small >= 10.0**Max_Digits;
- -- True iff a numerator and denominator can be calculated such that
+ (Float'Floor (Num'Small) = Float'Ceiling (Num'Small)
+ or else Float'Floor (1.0 / Num'Small) = Float'Ceiling (1.0 / Num'Small)
+ or else Num'Small >= 10.0**Max_Digits)
+ and then Num'Small >= 2.0**(-63)
+ and then Num'Small <= 2.0**63;
+ -- True iff a 64-bit numerator and denominator can be calculated such that
-- their ratio exactly represents the small of Num.
procedure Put
@@ -565,9 +559,9 @@ package body Ada.Text_IO.Fixed_IO is
Q : array (0 .. N - 1) of Int64 := (others => 0);
-- Each element of Q has Max_Digits decimal digits, except the
- -- last, which has eAA rem Max_Digits. Only Q (Q'First) may have an
+ -- last, which has AA rem Max_Digits. Only Q (Q'First) may have an
-- absolute value equal to or larger than 10**Max_Digits. Only the
- -- absolute value of the elements is not significant, not the sign.
+ -- absolute value of the elements is significant, not the sign.
XX : Int64 := X;
YY : Int64 := Y;
@@ -580,7 +574,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..a4e9fd1 100644
--- a/gcc/ada/libgnat/g-socket.adb
+++ b/gcc/ada/libgnat/g-socket.adb
@@ -42,6 +42,8 @@ with GNAT.Sockets.Linker_Options;
pragma Warnings (Off, GNAT.Sockets.Linker_Options);
-- Need to include pragma Linker_Options which is platform dependent
+with GNAT.Sockets.Poll;
+
with System; use System;
with System.Communication; use System.Communication;
with System.CRTL; use System.CRTL;
@@ -186,10 +188,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
@@ -256,15 +254,13 @@ package body GNAT.Sockets is
procedure Wait_On_Socket
(Socket : Socket_Type;
- For_Read : Boolean;
+ Event : Poll.Wait_Event_Set;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status);
-- Common code for variants of socket operations supporting a timeout:
- -- block in Check_Selector on Socket for at most the indicated timeout.
- -- If For_Read is True, Socket is added to the read set for this call, else
- -- it is added to the write set. If no selector is provided, a local one is
- -- created for this call and destroyed prior to returning.
+ -- block in Poll.Wait on Socket for at most the indicated timeout.
+ -- Event parameter defines what the Poll.Wait is waiting for.
type Sockets_Library_Controller is new Ada.Finalization.Limited_Controlled
with null record;
@@ -375,11 +371,11 @@ package body GNAT.Sockets is
-- Wait for socket to become available for reading
Wait_On_Socket
- (Socket => Server,
- For_Read => True,
- Timeout => Timeout,
- Selector => Selector,
- Status => Status);
+ (Socket => Server,
+ Event => Poll.Input_Event,
+ Timeout => Timeout,
+ Selector => Selector,
+ Status => Status);
-- Accept connection if available
@@ -733,7 +729,7 @@ package body GNAT.Sockets is
else
Wait_On_Socket
(Socket => Socket,
- For_Read => False,
+ Event => Poll.Output_Event,
Timeout => Timeout,
Selector => Selector,
Status => Status);
@@ -2020,57 +2016,32 @@ package body GNAT.Sockets is
procedure Wait_On_Socket
(Socket : Socket_Type;
- For_Read : Boolean;
+ Event : Poll.Wait_Event_Set;
Timeout : Selector_Duration;
Selector : access Selector_Type := null;
Status : out Selector_Status)
is
- type Local_Selector_Access is access Selector_Type;
- for Local_Selector_Access'Storage_Size use Selector_Type'Size;
-
- procedure Unchecked_Free is new Ada.Unchecked_Deallocation
- (Selector_Type, Local_Selector_Access);
-
- Local_S : Local_Selector_Access;
- S : Selector_Access;
- -- Selector to use for waiting
+ Fd_Set : Poll.Set := Poll.To_Set (Socket, Event, 2);
+ -- Socket itself and second place for signaling socket if necessary
- R_Fd_Set : Socket_Set_Type;
- W_Fd_Set : Socket_Set_Type;
+ Count : Natural;
+ Index : Natural := 0;
begin
- -- Create selector if not provided by the user
-
- if Selector = null then
- Local_S := new Selector_Type;
- S := Local_S.all'Unchecked_Access;
- Create_Selector (S.all);
-
- else
- S := Selector.all'Access;
- end if;
+ -- Add signaling socket if selector defined
- if For_Read then
- Set (R_Fd_Set, Socket);
- else
- Set (W_Fd_Set, Socket);
+ if Selector /= null then
+ Poll.Append (Fd_Set, Selector.R_Sig_Socket, Poll.Input_Event);
end if;
- Check_Selector (S.all, R_Fd_Set, W_Fd_Set, Status, Timeout);
+ Poll.Wait (Fd_Set, Timeout, Count);
- if Selector = null then
- Close_Selector (S.all);
- Unchecked_Free (Local_S);
+ if Count = 0 then
+ Status := Expired;
+ else
+ Poll.Next (Fd_Set, Index);
+ Status := (if Index = 1 then Completed else Aborted);
end if;
-
- exception
- when others =>
- Status := Completed;
-
- if Selector = null then
- Close_Selector (S.all);
- Unchecked_Free (Local_S);
- end if;
end Wait_On_Socket;
-----------------
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..cd82bb8
--- /dev/null
+++ b/gcc/ada/libgnat/g-socpol.adb
@@ -0,0 +1,429 @@
+------------------------------------------------------------------------------
+-- --
+-- 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
+ Poll_Timeout := 0.0;
+
+ 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..6e0af44
--- /dev/null
+++ b/gcc/ada/libgnat/g-spogwa.adb
@@ -0,0 +1,137 @@
+------------------------------------------------------------------------------
+-- --
+-- 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;
+
+ 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..d8b15c5d 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;
@@ -1586,6 +1582,13 @@ package body System.Dwarf_Lines is
Subprg_Name,
Line_Num);
+ -- If we're not requested to suppress hex addresses, emit it now.
+
+ if not Suppress_Hex then
+ Append_Address (Res, Addr_In_Traceback);
+ Append (Res, ' ');
+ end if;
+
if File_Name /= null then
declare
Last : constant Natural := String_Length (File_Name);
@@ -1630,26 +1633,22 @@ package body System.Dwarf_Lines is
(Res,
String (Subprg_Name.Ptr (Off .. Subprg_Name.Len)));
end if;
- Append (Res, ' ');
+ else
+ Append (Res, "???");
end if;
- Append (Res, "at ");
+ Append (Res, " at ");
Append (Res, String (File_Name (1 .. Last)));
Append (Res, ':');
Append (Res, Line_Image (2 .. Line_Image'Last));
end;
else
- if Suppress_Hex then
- Append (Res, "...");
- else
- Append_Address (Res, Addr_In_Traceback);
- end if;
-
if Subprg_Name.Len > 0 then
Off := Strip_Leading_Char (C.Obj.all, Subprg_Name);
- Append (Res, ' ');
Append (Res, String (Subprg_Name.Ptr (Off .. Subprg_Name.Len)));
+ else
+ Append (Res, "???");
end if;
Append (Res, " at ???");
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-imgrea.ads b/gcc/ada/libgnat/s-imgrea.ads
index 9711516..565666a 100644
--- a/gcc/ada/libgnat/s-imgrea.ads
+++ b/gcc/ada/libgnat/s-imgrea.ads
@@ -44,7 +44,7 @@ package System.Img_Real is
-- image for fixed-point types (RM 3.5(34)), where Aft is the value of the
-- Aft attribute for the fixed-point type. This function is used only for
-- ordinary fixed point (see package System.Img_Dec for handling of decimal
- -- fixed-point). The caller guarantees that S is long enough to hold the
+ -- fixed point). The caller guarantees that S is long enough to hold the
-- result and has a lower bound of 1.
procedure Image_Floating_Point
@@ -52,7 +52,7 @@ package System.Img_Real is
S : in out String;
P : out Natural;
Digs : Natural);
- -- Computes fixed_type'Image (V) and returns the result in S (1 .. P)
+ -- Computes float_type'Image (V) and returns the result in S (1 .. P)
-- updating P on return. The result is computed according to the rules for
-- image for floating-point types (RM 3.5(33)), where Digs is the value of
-- the Digits attribute for the floating-point type. The caller guarantees
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..3e9f36e 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:
@@ -1593,6 +1588,12 @@ package Opt is
-- Tolerate time stamp and other consistency errors. If this flag is set to
-- True (-t), then inconsistencies result in warnings rather than errors.
+ Transform_Function_Array : Boolean := False;
+ -- GNAT
+ -- If this switch is set True, then functions returning constrained arrays
+ -- are transformed into a procedure with an out parameter, and all calls
+ -- are updated accordingly.
+
Treat_Categorization_Errors_As_Warnings : Boolean := False;
-- Normally categorization errors are true illegalities. If this switch
-- is set, then such errors result in warning messages rather than error
@@ -2103,14 +2104,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 +2331,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..a146902 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,44 @@ 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
+ -- Build loop_parameter_specification
+
+ Loop_Spec :=
+ New_Node (N_Loop_Parameter_Specification, Prev_Token_Ptr);
+ Set_Defining_Identifier (Loop_Spec, Id);
+
+ 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,29 +3475,40 @@ 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 container
+ -- aggregates, and is illegal in array aggregates.
Id := P_Defining_Identifier;
Assoc_Node :=
New_Node (N_Iterated_Component_Association, Prev_Token_Ptr);
- if Token = Tok_In then
+ if Token = Tok_In then
Set_Defining_Identifier (Assoc_Node, Id);
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;
+
if Token = Tok_Use then
- -- Key-expression is present, rewrite node as an
- -- iterated_Element_Awwoiation.
+ -- Ada_2020 Key-expression is present, rewrite node as an
+ -- Iterated_Element_Association.
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
+ -- construct, in contrast with a subtype indication used in
+ -- array aggregates.
+
+ Build_Iterated_Element_Association;
end if;
TF_Arrow;
@@ -3467,7 +3525,7 @@ package body Ch4 is
if Token = Tok_Use then
Scan; -- past USE
- -- This is an iterated_elenent_qssociation.
+ -- This is an iterated_element_association
Assoc_Node :=
New_Node (N_Iterated_Element_Association, Prev_Token_Ptr);
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 1ff7950..c8f4d87 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 Ada_Version < Ada_2020 then
+ Error_Msg_SP ("aspect on formal parameter requires -gnat2020");
+ 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..bce5437 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,31 @@ CND(SIZEOF_sigset, "sigset")
#endif
#if defined(_WIN32) || defined(__vxworks)
+#define SIZEOF_nfds_t sizeof (int) * 8
#define SIZEOF_socklen_t sizeof (size_t)
+#elif defined(__Lynx__)
+#define SIZEOF_nfds_t sizeof (unsigned long int) * 8
+#define SIZEOF_socklen_t sizeof (socklen_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 +1773,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 +1864,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..90ddee2 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
@@ -450,7 +452,7 @@ package body Sem_Aggr is
This_Range : constant Node_Id := Aggregate_Bounds (N);
-- The aggregate range node of this specific sub-aggregate
- This_Low : constant Node_Id := Low_Bound (Aggregate_Bounds (N));
+ This_Low : constant Node_Id := Low_Bound (Aggregate_Bounds (N));
This_High : constant Node_Id := High_Bound (Aggregate_Bounds (N));
-- The aggregate bounds of this specific sub-aggregate
@@ -783,12 +785,39 @@ package body Sem_Aggr is
-----------------------
procedure Resolve_Aggregate (N : Node_Id; Typ : Entity_Id) is
- Loc : constant Source_Ptr := Sloc (N);
+ Loc : constant Source_Ptr := Sloc (N);
Aggr_Subtyp : Entity_Id;
-- 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;
+
+ -- Start of processing for Resolve_Aggregate
+
begin
-- Ignore junk empty aggregate resulting from parser error
@@ -809,16 +838,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 +870,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 +901,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 +1088,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;
@@ -1537,12 +1590,39 @@ package body Sem_Aggr is
Index_Typ : Entity_Id)
is
Loc : constant Source_Ptr := Sloc (N);
+ Id : constant Entity_Id := Defining_Identifier (N);
+
+ -----------------------
+ -- Remove_References --
+ -----------------------
+
+ function Remove_Ref (N : Node_Id) return Traverse_Result;
+ -- Remove references to the entity Id after analysis, so it can be
+ -- properly reanalyzed after construct is expanded into a loop.
+
+ function Remove_Ref (N : Node_Id) return Traverse_Result is
+ begin
+ if Nkind (N) = N_Identifier
+ and then Present (Entity (N))
+ and then Entity (N) = Id
+ then
+ Set_Entity (N, Empty);
+ Set_Etype (N, Empty);
+ end if;
+ Set_Analyzed (N, False);
+ return OK;
+ end Remove_Ref;
+
+ procedure Remove_References is new Traverse_Proc (Remove_Ref);
+
+ -- Local variables
Choice : Node_Id;
Dummy : Boolean;
Ent : Entity_Id;
Expr : Node_Id;
- Id : Entity_Id;
+
+ -- Start of processing for Resolve_Iterated_Component_Association
begin
-- An element iterator specification cannot appear in
@@ -1590,35 +1670,33 @@ 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.
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
- -- enclosing aggregate is expanded, and the construct is rewritten
- -- as a loop with a new index variable.
+ -- Analyze the expression without expansion, to verify legality.
+ -- After analysis we remove references to the index variable because
+ -- the expression will be analyzed anew when the enclosing aggregate
+ -- is expanded, and the construct is rewritten as a loop with a new
+ -- index variable.
+
+ Expr := Expression (N);
- Expr := New_Copy_Tree (Expression (N));
- Dummy := Resolve_Aggr_Expr (Expr, False);
+ Expander_Mode_Save_And_Set (False);
+ Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False);
+ Expander_Mode_Restore;
+ Remove_References (Expr);
-- An iterated_component_association may appear in a nested
-- aggregate for a multidimensional structure: preserve the bounds
-- computed for the expression, as well as the anonymous array
-- type generated for it; both are needed during array expansion.
- -- This does not work for more than two levels of nesting. ???
if Nkind (Expr) = N_Aggregate then
Set_Aggregate_Bounds (Expression (N), Aggregate_Bounds (Expr));
@@ -1791,7 +1869,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 +2085,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)
@@ -2520,7 +2603,7 @@ package body Sem_Aggr is
-- In order to diagnose the semantic error we create a duplicate
-- tree to analyze it and perform the check.
- else
+ elsif Nkind (Assoc) /= N_Iterated_Component_Association then
declare
Save_Analysis : constant Boolean := Full_Analysis;
Expr : constant Node_Id :=
@@ -2644,11 +2727,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 +2748,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 +2822,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 +2863,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 +2909,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 +2949,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 +2962,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 +2985,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 +3004,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;
@@ -2931,6 +3057,7 @@ package body Sem_Aggr is
Assoc : Node_Id;
Choice : Node_Id;
+ Expr : Node_Id;
begin
Assoc := First (Deltas);
@@ -2958,17 +3085,21 @@ 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));
+ -- Resolve a copy of the expression, after setting
+ -- its parent properly to preserve its context.
+
+ Expr := New_Copy_Tree (Expression (Assoc));
+ Set_Parent (Expr, Assoc);
+ Analyze_And_Resolve (Expr, Component_Type (Typ));
End_Scope;
end;
@@ -2991,7 +3122,7 @@ package body Sem_Aggr is
Base_Type (Index_Type)
then
Error_Msg_NE
- ("choice does mat match index type of",
+ ("choice does not match index type of &",
Choice, Typ);
end if;
else
@@ -3363,10 +3494,23 @@ package body Sem_Aggr is
if Is_Entity_Name (A) and then Is_Type (Entity (A)) then
- -- AI05-0115: if the ancestor part is a subtype mark, the ancestor
- -- must not have unknown discriminants.
-
- if Has_Unknown_Discriminants (Entity (A)) then
+ -- AI05-0115: If the ancestor part is a subtype mark, the ancestor
+ -- must not have unknown discriminants. To catch cases where the
+ -- aggregate occurs at a place where the full view of the ancestor
+ -- type is visible and doesn't have unknown discriminants, but the
+ -- aggregate type was derived from a partial view that has unknown
+ -- discriminants, we check whether the aggregate type has unknown
+ -- discriminants (unknown discriminants were inherited), along
+ -- with checking that the partial view of the ancestor has unknown
+ -- discriminants. (It might be sufficient to replace the entire
+ -- condition with Has_Unknown_Discriminants (Typ), but that might
+ -- miss some cases, not clear, and causes error changes in some tests
+ -- such as class-wide cases, that aren't clearly improvements. ???)
+
+ if Has_Unknown_Discriminants (Entity (A))
+ or else (Has_Unknown_Discriminants (Typ)
+ and then Partial_View_Has_Unknown_Discr (Entity (A)))
+ then
Error_Msg_NE
("aggregate not available for type& whose ancestor "
& "has unknown discriminants", N, Typ);
@@ -3965,7 +4109,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 +5175,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..ee65185 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1460,7 +1460,7 @@ package body Sem_Attr is
if Ada_Version < Ada_2020
and then not Is_Scalar_Type (Image_Type)
then
- Error_Msg_Ada_2020_Feature ("|nonscalar ''Image", Sloc (P));
+ Error_Msg_Ada_2020_Feature ("nonscalar ''Image", Sloc (P));
Error_Attr;
end if;
end Check_Image_Type;
@@ -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..af77263 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
@@ -4069,6 +4070,16 @@ package body Sem_Ch12 is
return True;
end if;
+ -- In GNATprove mode, never instantiate bodies outside of the main
+ -- unit, as it does not use frontend/backend inlining in the way that
+ -- GNAT does, so does not benefit from such instantiations. On the
+ -- contrary, such instantiations may bring artificial constraints,
+ -- as for example such bodies may require preprocessing.
+
+ if GNATprove_Mode then
+ return False;
+ end if;
+
-- If not, then again no need to instantiate bodies in generic units
if Is_Generic_Unit (Cunit_Entity (Get_Code_Unit (N))) then
@@ -7512,11 +7523,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 +8065,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 +8232,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 +8990,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 +9116,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 +9133,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 +9160,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 +11389,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 +11404,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 +11689,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 +11702,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 +11776,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 +11857,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 +12075,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 +12138,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 +12173,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 +12197,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 +12718,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
@@ -15204,13 +15389,21 @@ package body Sem_Ch12 is
if Is_Type (E)
and then Nkind (Parent (E)) = N_Subtype_Declaration
then
+ -- Always preserve the flag Is_Generic_Actual_Type for GNATprove,
+ -- as it is needed to identify the subtype with the type it
+ -- renames, when there are conversions between access types
+ -- to these.
+
+ if GNATprove_Mode then
+ null;
+
-- If the actual for E is itself a generic actual type from
-- an enclosing instance, E is still a generic actual type
-- outside of the current instance. This matter when resolving
-- an overloaded call that may be ambiguous in the enclosing
-- instance, when two of its actuals coincide.
- if Is_Entity_Name (Subtype_Indication (Parent (E)))
+ elsif Is_Entity_Name (Subtype_Indication (Parent (E)))
and then Is_Generic_Actual_Type
(Entity (Subtype_Indication (Parent (E))))
then
@@ -15656,10 +15849,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 +15898,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..c476e45 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
@@ -2957,10 +3023,10 @@ package body Sem_Ch6 is
-- Required to ensure that Expand_Call rewrites calls to this
-- function by calls to the built procedure.
- if Modify_Tree_For_C
+ if Transform_Function_Array
and then Nkind (Body_Spec) = N_Function_Specification
and then
- Rewritten_For_C (Defining_Entity (Specification (Subp_Decl)))
+ Rewritten_For_C (Defining_Entity (Specification (Subp_Decl)))
then
Set_Rewritten_For_C (Defining_Entity (Body_Spec));
Set_Corresponding_Procedure (Defining_Entity (Body_Spec),
@@ -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;
@@ -3950,11 +4073,11 @@ package body Sem_Ch6 is
Build_Subprogram_Declaration;
-- If this is a function that returns a constrained array, and
- -- we are generating C code, create subprogram declaration
- -- to simplify subsequent C generation.
+ -- Transform_Function_Array is set, create subprogram
+ -- declaration to simplify e.g. subsequent C generation.
elsif No (Spec_Id)
- and then Modify_Tree_For_C
+ and then Transform_Function_Array
and then Nkind (Body_Spec) = N_Function_Specification
and then Is_Array_Type (Etype (Body_Id))
and then Is_Constrained (Etype (Body_Id))
@@ -4048,17 +4171,18 @@ package body Sem_Ch6 is
Spec_Id := Build_Internal_Protected_Declaration (N);
end if;
- -- If we are generating C and this is a function returning a constrained
- -- array type for which we must create a procedure with an extra out
- -- parameter, build and analyze the body now. The procedure declaration
- -- has already been created. We reuse the source body of the function,
- -- because in an instance it may contain global references that cannot
- -- be reanalyzed. The source function itself is not used any further,
- -- so we mark it as having a completion. If the subprogram is a stub the
- -- transformation is done later, when the proper body is analyzed.
+ -- If Transform_Function_Array is set and this is a function returning a
+ -- constrained array type for which we must create a procedure with an
+ -- extra out parameter, build and analyze the body now. The procedure
+ -- declaration has already been created. We reuse the source body of the
+ -- function, because in an instance it may contain global references
+ -- that cannot be reanalyzed. The source function itself is not used any
+ -- further, so we mark it as having a completion. If the subprogram is a
+ -- stub the transformation is done later, when the proper body is
+ -- analyzed.
if Expander_Active
- and then Modify_Tree_For_C
+ and then Transform_Function_Array
and then Present (Spec_Id)
and then Ekind (Spec_Id) = E_Function
and then Nkind (N) /= N_Subprogram_Body_Stub
@@ -4646,7 +4770,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 +4819,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 +9227,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 +12385,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..69430a6 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,130 @@ 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.
+ elsif Nkind (Parent (N)) = N_Selected_Component
+ and then N = Prefix (Parent (N))
+ and then Is_Known_Unit (Parent (N))
+ then
declare
- E : Entity_Id;
- Ematch : Entity_Id := Empty;
-
- Last_Name_Id : constant Name_Id :=
- Name_Id (Nat (First_Name_Id) +
- Name_Entries_Count - 1);
-
+ P : Node_Id := Parent (N);
begin
- for Nam in First_Name_Id .. Last_Name_Id loop
- E := Get_Name_Entity_Id (Nam);
+ Error_Msg_Name_1 := Chars (N);
+ Error_Msg_Name_2 := Chars (Selector_Name (P));
- 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 if;
- end loop;
+ if Nkind (Parent (P)) = N_Selected_Component
+ and then Is_Known_Unit (Parent (P))
+ then
+ P := Parent (P);
+ Error_Msg_Name_3 := Chars (Selector_Name (P));
+ Error_Msg_N -- CODEFIX
+ ("\\missing `WITH %.%.%;`", N);
- if Present (Ematch) then
- Error_Msg_NE -- CODEFIX
- ("\possible misspelling of&", N, Ematch);
+ else
+ Error_Msg_N -- CODEFIX
+ ("\\missing `WITH %.%;`", N);
end if;
end;
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.
+ -- Now check for possible misspellings
- 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;
+ 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;
+ end if;
+ end loop;
+
+ if Present (Ematch) then
+ Error_Msg_NE -- CODEFIX
+ ("\possible misspelling of&", N, Ematch);
+ end if;
+ end;
+ 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 +5633,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 +5688,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 +5737,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 +5781,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 +6062,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 +6081,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 +6111,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 +6120,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 +6140,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 +6189,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 +6290,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 +6371,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 +6782,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..7289ea7 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;
@@ -4421,23 +4421,30 @@ package body Sem_Warn is
end if;
declare
- B : constant Node_Id := Parent (Parent (Scope (E)));
- S : Entity_Id := Empty;
+ S : Node_Id := Scope (E);
begin
- if Nkind (B) in
- N_Expression_Function |
- N_Subprogram_Body |
- N_Subprogram_Renaming_Declaration
- then
- S := Corresponding_Spec (B);
+ if Ekind (S) = E_Subprogram_Body then
+ S := Parent (S);
+
+ while Nkind (S) not in
+ N_Expression_Function |
+ N_Subprogram_Body |
+ N_Subprogram_Renaming_Declaration |
+ N_Empty
+ loop
+ S := Parent (S);
+ end loop;
+
+ if Present (S) then
+ S := Corresponding_Spec (S);
+ end if;
end if;
-- Do not warn for dispatching operations, because
-- that causes too much noise. Also do not warn for
- -- trivial subprograms.
+ -- trivial subprograms (e.g. stubs).
- if (not Present (S)
- or else not Is_Dispatching_Operation (S))
+ if (No (S) or else not Is_Dispatching_Operation (S))
and then not Is_Trivial_Subprogram (Scope (E))
then
Error_Msg_NE -- CODEFIX
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..46f9698 100644
--- a/gcc/ada/ttypes.ads
+++ b/gcc/ada/ttypes.ads
@@ -26,7 +26,6 @@
-- This package contains constants describing target properties
with Types; use Types;
-with Get_Targ;
with Set_Targ;
package Ttypes is
@@ -102,57 +101,33 @@ package Ttypes is
Standard_Short_Short_Integer_Size : constant Pos :=
Set_Targ.Char_Size;
- Standard_Short_Short_Integer_Width : constant Pos :=
- Get_Targ.Width_From_Size
- (Standard_Short_Short_Integer_Size);
Standard_Short_Integer_Size : constant Pos :=
Set_Targ.Short_Size;
- Standard_Short_Integer_Width : constant Pos :=
- Get_Targ.Width_From_Size
- (Standard_Short_Integer_Size);
Standard_Integer_Size : constant Pos :=
Set_Targ.Int_Size;
- Standard_Integer_Width : constant Pos :=
- Get_Targ.Width_From_Size
- (Standard_Integer_Size);
Standard_Long_Integer_Size : constant Pos :=
Set_Targ.Long_Size;
- Standard_Long_Integer_Width : constant Pos :=
- Get_Targ.Width_From_Size
- (Standard_Long_Integer_Size);
Standard_Long_Long_Integer_Size : constant Pos :=
Set_Targ.Long_Long_Size;
- Standard_Long_Long_Integer_Width : constant Pos :=
- Get_Targ.Width_From_Size
- (Standard_Long_Long_Integer_Size);
+
+ Standard_Long_Long_Long_Integer_Size : Pos :=
+ Set_Targ.Long_Long_Long_Size;
Standard_Short_Float_Size : constant Pos :=
Set_Targ.Float_Size;
- Standard_Short_Float_Digits : constant Pos :=
- Get_Targ.Digits_From_Size
- (Standard_Short_Float_Size);
Standard_Float_Size : constant Pos :=
Set_Targ.Float_Size;
- Standard_Float_Digits : constant Pos :=
- Get_Targ.Digits_From_Size
- (Standard_Float_Size);
Standard_Long_Float_Size : constant Pos :=
Set_Targ.Double_Size;
- Standard_Long_Float_Digits : constant Pos :=
- Get_Targ.Digits_From_Size
- (Standard_Long_Float_Size);
Standard_Long_Long_Float_Size : constant Pos :=
Set_Targ.Long_Double_Size;
- Standard_Long_Long_Float_Digits : constant Pos :=
- Get_Targ.Digits_From_Size
- (Standard_Long_Long_Float_Size);
Standard_Character_Size : constant Pos := Set_Targ.Char_Size;
@@ -176,8 +151,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/vxworks7-cert-rtp-link.spec b/gcc/ada/vxworks7-cert-rtp-link.spec
new file mode 100644
index 0000000..0e0440f
--- /dev/null
+++ b/gcc/ada/vxworks7-cert-rtp-link.spec
@@ -0,0 +1,9 @@
+*self_spec:
++ %{!nostdlib:-nodefaultlibs -nostartfiles}
+
+*link:
++ %{!nostdlib:%{mrtp:%{!shared: \
+ -l:certRtp.o \
+ -L%:getenv(VSB_DIR /usr/lib/common/objcert) \
+ -T%:getenv(VSB_DIR /usr/ldscripts/rtp.ld) \
+ }}}
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/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
index d8453cb..44847ed 100644
--- a/gcc/analyzer/ChangeLog
+++ b/gcc/analyzer/ChangeLog
@@ -1,3 +1,233 @@
+2020-11-05 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97668
+ * svalue.cc (cmp_cst): Handle COMPLEX_CST.
+
+2020-10-29 David Malcolm <dmalcolm@redhat.com>
+
+ * program-state.cc (sm_state_map::on_liveness_change): Sort the
+ leaking svalues before calling on_state_leak.
+ (program_state::detect_leaks): Likewise when calling
+ on_svalue_leak.
+ * region-model-reachability.cc
+ (reachable_regions::mark_escaped_clusters): Likewise when
+ calling on_escaped_function.
+
+2020-10-29 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97608
+ * region-model-reachability.cc (reachable_regions::handle_sval):
+ Operands of reachable reversible operations are reachable.
+
+2020-10-29 David Malcolm <dmalcolm@redhat.com>
+
+ * analyzer.h (class state_machine): New forward decl.
+ (class logger): Likewise.
+ (class visitor): Likewise.
+ * complexity.cc: New file, taken from svalue.cc.
+ * complexity.h: New file, taken from region-model.h.
+ * region-model.h: Include "analyzer/svalue.h" and
+ "analyzer/region.h". Move struct complexity to complexity.h.
+ Move svalue, its subclasses and supporting decls to svalue.h.
+ Move region, its subclasses and supporting decls to region.h.
+ * region.cc: Include "analyzer/region.h".
+ (symbolic_region::symbolic_region): Move here from region-model.h.
+ * region.h: New file, based on material from region-model.h.
+ * svalue.cc: Include "analyzer/svalue.h".
+ (complexity::complexity): Move to complexity.cc.
+ (complexity::from_pair): Likewise.
+ * svalue.h: New file, based on material from region-model.h.
+
+2020-10-29 David Malcolm <dmalcolm@redhat.com>
+
+ * program-state.cc (sm_state_map::print): Guard the printing of
+ the origin pointer with !flag_dump_noaddr.
+ * region.cc (string_region::dump_to_pp): Likewise for
+ m_string_cst.
+
+2020-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97568
+ * region-model.cc (region_model::get_initial_value_for_global):
+ Move check that !DECL_EXTERNAL from here to...
+ * region.cc (decl_region::get_svalue_for_initializer): ...here,
+ using it to reject zero initialization.
+
+2020-10-27 Markus Böck <markus.boeck02@gmail.com>
+
+ PR analyzer/96608
+ * store.h (hash): Cast to intptr_t instead of long
+
+2020-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ * constraint-manager.cc (svalue_cmp_by_ptr): Delete.
+ (equiv_class::canonicalize): Use svalue::cmp_ptr_ptr instead.
+ (equiv_class_cmp): Eliminate pointer comparison.
+ * diagnostic-manager.cc (dedupe_key::comparator): If they are at
+ the same location, also compare epath ength and pending_diagnostic
+ kind.
+ * engine.cc (readability_comparator): If two path_vars have the
+ same readability, then impose an arbitrary ordering on them.
+ (worklist::key_t::cmp): If two points have the same plan ordering,
+ continue the comparison. Call sm_state_map::cmp rather than
+ comparing hash values.
+ * program-state.cc (sm_state_map::entry_t::cmp): New.
+ (sm_state_map::cmp): New.
+ * program-state.h (sm_state_map::entry_t::cmp): New decl.
+ (sm_state_map::elements): New.
+ (sm_state_map::cmp): New.
+
+2020-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ * engine.cc (setjmp_record::cmp): New.
+ (supernode_cluster::dump_dot): Avoid embedding pointer in cluster
+ name.
+ (supernode_cluster::cmp_ptr_ptr): New.
+ (function_call_string_cluster::dump_dot): Avoid embedding pointer
+ in cluster name. Sort m_map when dumping child clusters.
+ (function_call_string_cluster::cmp_ptr_ptr): New.
+ (root_cluster::dump_dot): Sort m_map when dumping child clusters.
+ * program-point.cc (function_point::cmp): New.
+ (function_point::cmp_ptr): New.
+ * program-point.h (function_point::cmp): New decl.
+ (function_point::cmp_ptr): New decl.
+ * program-state.cc (sm_state_map::print): Sort the values. Guard
+ the printing of pointers with !flag_dump_noaddr.
+ (program_state::prune_for_point): Sort the regions.
+ (log_set_of_svalues): Sort the values. Guard the printing of
+ pointers with !flag_dump_noaddr.
+ * region-model-manager.cc (log_uniq_map): Sort the values.
+ * region-model-reachability.cc (dump_set): New function template.
+ (reachable_regions::dump_to_pp): Use it.
+ * region-model.h (svalue::cmp_ptr): New decl.
+ (svalue::cmp_ptr_ptr): New decl.
+ (setjmp_record::cmp): New decl.
+ (placeholder_svalue::get_name): New accessor.
+ (widening_svalue::get_point): New accessor.
+ (compound_svalue::get_map): New accessor.
+ (conjured_svalue::get_stmt): New accessor.
+ (conjured_svalue::get_id_region): New accessor.
+ (region::cmp_ptrs): Rename to...
+ (region::cmp_ptr_ptr): ...this.
+ * region.cc (region::cmp_ptrs): Rename to...
+ (region::cmp_ptr_ptr): ...this.
+ * state-purge.cc
+ (state_purge_per_ssa_name::state_purge_per_ssa_name): Sort
+ m_points_needing_name when dumping.
+ * store.cc (concrete_binding::cmp_ptr_ptr): New.
+ (symbolic_binding::cmp_ptr_ptr): New.
+ (binding_map::cmp): New.
+ (get_sorted_parent_regions): Update for renaming of
+ region::cmp_ptrs to region::cmp_ptr_ptr.
+ (store::dump_to_pp): Likewise.
+ (store::to_json): Likewise.
+ (store::can_merge_p): Sort the base regions before considering
+ them.
+ * store.h (concrete_binding::cmp_ptr_ptr): New decl.
+ (symbolic_binding::cmp_ptr_ptr): New decl.
+ (binding_map::cmp): New decl.
+ * supergraph.cc (supergraph::supergraph): Assign UIDs to the
+ gimple stmts.
+ * svalue.cc (cmp_cst): New.
+ (svalue::cmp_ptr): New.
+ (svalue::cmp_ptr_ptr): New.
+
+2020-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ * engine.cc (exploded_graph::get_or_create_node): Fix off-by-one
+ when imposing param_analyzer_max_enodes_per_program_point limit.
+
+2020-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ * region-model.cc (region_model::get_representative_path_var):
+ Implement case RK_LABEL.
+ * region-model.h (label_region::get_label): New accessor.
+
+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
diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h
index aa43b7f..c84d7fd 100644
--- a/gcc/analyzer/analyzer.h
+++ b/gcc/analyzer/analyzer.h
@@ -97,6 +97,9 @@ class state_change;
class rewind_info_t;
class engine;
+class state_machine;
+class logger;
+class visitor;
/* Forward decls of functions. */
diff --git a/gcc/analyzer/complexity.cc b/gcc/analyzer/complexity.cc
new file mode 100644
index 0000000..221f3a6
--- /dev/null
+++ b/gcc/analyzer/complexity.cc
@@ -0,0 +1,95 @@
+/* Measuring the complexity of svalues/regions.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "diagnostic-core.h"
+#include "gimple-pretty-print.h"
+#include "function.h"
+#include "basic-block.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
+#include "diagnostic-core.h"
+#include "graphviz.h"
+#include "options.h"
+#include "cgraph.h"
+#include "tree-dfa.h"
+#include "stringpool.h"
+#include "convert.h"
+#include "target.h"
+#include "fold-const.h"
+#include "tree-pretty-print.h"
+#include "tristate.h"
+#include "bitmap.h"
+#include "selftest.h"
+#include "function.h"
+#include "json.h"
+#include "analyzer/analyzer.h"
+#include "analyzer/analyzer-logging.h"
+#include "options.h"
+#include "cgraph.h"
+#include "cfg.h"
+#include "digraph.h"
+#include "analyzer/call-string.h"
+#include "analyzer/program-point.h"
+#include "analyzer/store.h"
+#include "analyzer/complexity.h"
+#include "analyzer/svalue.h"
+#include "analyzer/region.h"
+
+#if ENABLE_ANALYZER
+
+namespace ana {
+
+/* struct complexity. */
+
+/* Get complexity for a new node that references REG
+ (the complexity of REG, plus one for the new node). */
+
+complexity::complexity (const region *reg)
+: m_num_nodes (reg->get_complexity ().m_num_nodes + 1),
+ m_max_depth (reg->get_complexity ().m_max_depth + 1)
+{
+}
+
+/* Get complexity for a new node that references SVAL.
+ (the complexity of SVAL, plus one for the new node). */
+
+complexity::complexity (const svalue *sval)
+: m_num_nodes (sval->get_complexity ().m_num_nodes + 1),
+ m_max_depth (sval->get_complexity ().m_max_depth + 1)
+{
+}
+
+/* Get complexity for a new node that references nodes with complexity
+ C1 and C2. */
+
+complexity
+complexity::from_pair (const complexity &c1, const complexity &c2)
+{
+ return complexity (c1.m_num_nodes + c2.m_num_nodes + 1,
+ MAX (c1.m_max_depth, c2.m_max_depth) + 1);
+}
+
+} // namespace ana
+
+#endif /* #if ENABLE_ANALYZER */
diff --git a/gcc/analyzer/complexity.h b/gcc/analyzer/complexity.h
new file mode 100644
index 0000000..e15967f
--- /dev/null
+++ b/gcc/analyzer/complexity.h
@@ -0,0 +1,51 @@
+/* Measuring the complexity of svalues/regions.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_ANALYZER_COMPLEXITY_H
+#define GCC_ANALYZER_COMPLEXITY_H
+
+namespace ana {
+
+/* A measurement of the complexity of an svalue or region, so that
+ we can impose bounds on the growth of these tree-like structures
+ and thus avoid infinite chains of analysis. */
+
+struct complexity
+{
+ complexity (unsigned num_nodes, unsigned max_depth)
+ : m_num_nodes (num_nodes), m_max_depth (max_depth)
+ {}
+
+ complexity (const region *reg);
+ complexity (const svalue *sval);
+ static complexity from_pair (const complexity &c1, const complexity &c);
+
+ /* The total number of svalues and regions in the tree of this
+ entity, including the entity itself. */
+ unsigned m_num_nodes;
+
+ /* The maximum depth of the tree of this entity, including the
+ entity itself. */
+ unsigned m_max_depth;
+};
+
+} // namespace ana
+
+#endif /* GCC_ANALYZER_COMPLEXITY_H */
diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc
index 603b228..2978f1b 100644
--- a/gcc/analyzer/constraint-manager.cc
+++ b/gcc/analyzer/constraint-manager.cc
@@ -423,26 +423,12 @@ equiv_class::get_representative () const
return m_vars[0];
}
-/* Comparator for use by equiv_class::canonicalize. */
-
-static int
-svalue_cmp_by_ptr (const void *p1, const void *p2)
-{
- const svalue *sval1 = *(const svalue * const *)p1;
- const svalue *sval2 = *(const svalue * const *)p2;
- if (sval1 < sval2)
- return 1;
- if (sval1 > sval2)
- return -1;
- return 0;
-}
-
/* Sort the svalues within this equiv_class. */
void
equiv_class::canonicalize ()
{
- m_vars.qsort (svalue_cmp_by_ptr);
+ m_vars.qsort (svalue::cmp_ptr_ptr);
}
/* Get a debug string for C_OP. */
@@ -1693,11 +1679,7 @@ equiv_class_cmp (const void *p1, const void *p2)
gcc_assert (rep1);
gcc_assert (rep2);
- if (rep1 < rep2)
- return 1;
- if (rep1 > rep2)
- return -1;
- return 0;
+ return svalue::cmp_ptr (rep1, rep2);
}
/* Comparator for use by constraint_manager::canonicalize.
diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index cb95a95..93f270f 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -318,7 +318,15 @@ public:
location_t loc1 = pk1->get_location ();
location_t loc2 = pk2->get_location ();
- return linemap_compare_locations (line_table, loc2, loc1);
+ if (int cmp = linemap_compare_locations (line_table, loc2, loc1))
+ return cmp;
+ if (int cmp = ((int)pk1->m_sd.get_epath_length ()
+ - (int)pk2->m_sd.get_epath_length ()))
+ return cmp;
+ if (int cmp = strcmp (pk1->m_sd.m_d->get_kind (),
+ pk2->m_sd.m_d->get_kind ()))
+ return cmp;
+ return 0;
}
const saved_diagnostic &m_sd;
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 0e79254..d247ebb 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -143,6 +143,23 @@ 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);
+}
+
+/* struct setjmp_record. */
+
+int
+setjmp_record::cmp (const setjmp_record &rec1, const setjmp_record &rec2)
+{
+ if (int cmp_enode = rec1.m_enode->m_index - rec2.m_enode->m_index)
+ return cmp_enode;
+ gcc_assert (&rec1 == &rec2);
+ return 0;
+}
+
/* class setjmp_svalue : public svalue. */
/* Implementation of svalue::accept vfunc for setjmp_svalue. */
@@ -500,6 +517,29 @@ readability_comparator (const void *p1, const void *p2)
if (int cmp = pv2.m_stack_depth - pv1.m_stack_depth)
return cmp;
+ /* Otherwise, if they have the same readability, then impose an
+ arbitrary deterministic ordering on them. */
+
+ if (int cmp = TREE_CODE (pv1.m_tree) - TREE_CODE (pv2.m_tree))
+ return cmp;
+
+ switch (TREE_CODE (pv1.m_tree))
+ {
+ default:
+ break;
+ case SSA_NAME:
+ if (int cmp = (SSA_NAME_VERSION (pv1.m_tree)
+ - SSA_NAME_VERSION (pv2.m_tree)))
+ return cmp;
+ break;
+ case PARM_DECL:
+ case VAR_DECL:
+ case RESULT_DECL:
+ if (int cmp = DECL_UID (pv1.m_tree) - DECL_UID (pv2.m_tree))
+ return cmp;
+ break;
+ }
+
/* TODO: We ought to find ways of sorting such cases. */
return 0;
}
@@ -1807,8 +1847,9 @@ worklist::key_t::cmp (const worklist::key_t &ka, const worklist::key_t &kb)
&& point_b.get_function () != NULL
&& point_a.get_function () != point_b.get_function ())
{
- return ka.m_worklist.m_plan.cmp_function (point_a.get_function (),
- point_b.get_function ());
+ if (int cmp = ka.m_worklist.m_plan.cmp_function (point_a.get_function (),
+ point_b.get_function ()))
+ return cmp;
}
/* First, order by SCC. */
@@ -1859,20 +1900,15 @@ worklist::key_t::cmp (const worklist::key_t &ka, const worklist::key_t &kb)
const program_state &state_b = kb.m_enode->get_state ();
/* Sort by sm-state, so that identical sm-states are grouped
- together in the worklist.
- For now, sort by the hash value (might not be deterministic). */
+ together in the worklist. */
for (unsigned sm_idx = 0; sm_idx < state_a.m_checker_states.length ();
++sm_idx)
{
sm_state_map *smap_a = state_a.m_checker_states[sm_idx];
sm_state_map *smap_b = state_b.m_checker_states[sm_idx];
- hashval_t hash_a = smap_a->hash ();
- hashval_t hash_b = smap_b->hash ();
- if (hash_a < hash_b)
- return -1;
- else if (hash_a > hash_b)
- return 1;
+ if (int smap_cmp = sm_state_map::cmp (*smap_a, *smap_b))
+ return smap_cmp;
}
/* Otherwise, we have two enodes at the same program point but with
@@ -1931,6 +1967,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);
@@ -1939,9 +1986,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;
}
@@ -2079,7 +2130,7 @@ exploded_graph::get_or_create_node (const program_point &point,
/* Impose a limit on the number of enodes per program point, and
simply stop if we exceed it. */
if ((int)per_point_data->m_enodes.length ()
- > param_analyzer_max_enodes_per_program_point)
+ >= param_analyzer_max_enodes_per_program_point)
{
pretty_printer pp;
point.print (&pp, format (false));
@@ -2261,6 +2312,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. */
@@ -2286,6 +2349,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.
@@ -3460,8 +3536,7 @@ public:
void dump_dot (graphviz_out *gv, const dump_args_t &args) const FINAL OVERRIDE
{
- gv->println ("subgraph \"cluster_supernode_%p\" {",
- (const void *)this);
+ gv->println ("subgraph \"cluster_supernode_%i\" {", m_supernode->m_index);
gv->indent ();
gv->println ("style=\"dashed\";");
gv->println ("label=\"SN: %i (bb: %i; scc: %i)\";",
@@ -3483,6 +3558,17 @@ public:
m_enodes.safe_push (en);
}
+ /* Comparator for use by auto_vec<supernode_cluster *>::qsort. */
+
+ static int cmp_ptr_ptr (const void *p1, const void *p2)
+ {
+ const supernode_cluster *c1
+ = *(const supernode_cluster * const *)p1;
+ const supernode_cluster *c2
+ = *(const supernode_cluster * const *)p2;
+ return c1->m_supernode->m_index - c2->m_supernode->m_index;
+ }
+
private:
const supernode *m_supernode;
auto_vec <exploded_node *> m_enodes;
@@ -3509,7 +3595,8 @@ public:
{
const char *funcname = function_name (m_fun);
- gv->println ("subgraph \"cluster_function_%p\" {", (const void *)this);
+ gv->println ("subgraph \"cluster_function_%s\" {",
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (m_fun->decl)));
gv->indent ();
gv->write_indent ();
gv->print ("label=\"call string: ");
@@ -3517,10 +3604,19 @@ public:
gv->print (" function: %s \";", funcname);
gv->print ("\n");
+ /* Dump m_map, sorting it to avoid churn when comparing dumps. */
+ auto_vec<supernode_cluster *> child_clusters (m_map.elements ());
for (map_t::iterator iter = m_map.begin ();
iter != m_map.end ();
++iter)
- (*iter).second->dump_dot (gv, args);
+ child_clusters.quick_push ((*iter).second);
+
+ child_clusters.qsort (supernode_cluster::cmp_ptr_ptr);
+
+ unsigned i;
+ supernode_cluster *child_cluster;
+ FOR_EACH_VEC_ELT (child_clusters, i, child_cluster)
+ child_cluster->dump_dot (gv, args);
/* Terminate subgraph. */
gv->outdent ();
@@ -3542,6 +3638,21 @@ public:
}
}
+ /* Comparator for use by auto_vec<function_call_string_cluster *>. */
+
+ static int cmp_ptr_ptr (const void *p1, const void *p2)
+ {
+ const function_call_string_cluster *c1
+ = *(const function_call_string_cluster * const *)p1;
+ const function_call_string_cluster *c2
+ = *(const function_call_string_cluster * const *)p2;
+ if (int cmp_names
+ = strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (c1->m_fun->decl)),
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (c2->m_fun->decl))))
+ return cmp_names;
+ return call_string::cmp (c1->m_cs, c2->m_cs);
+ }
+
private:
function *m_fun;
call_string m_cs;
@@ -3634,10 +3745,18 @@ public:
FOR_EACH_VEC_ELT (m_functionless_enodes, i, enode)
enode->dump_dot (gv, args);
+ /* Dump m_map, sorting it to avoid churn when comparing dumps. */
+ auto_vec<function_call_string_cluster *> child_clusters (m_map.elements ());
for (map_t::iterator iter = m_map.begin ();
iter != m_map.end ();
++iter)
- (*iter).second->dump_dot (gv, args);
+ child_clusters.quick_push ((*iter).second);
+
+ child_clusters.qsort (function_call_string_cluster::cmp_ptr_ptr);
+
+ function_call_string_cluster *child_cluster;
+ FOR_EACH_VEC_ELT (child_clusters, i, child_cluster)
+ child_cluster->dump_dot (gv, args);
}
void add_node (exploded_node *en) FINAL OVERRIDE
@@ -3923,6 +4042,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). */
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index a6ca4b9..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;
@@ -799,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;
@@ -845,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. */
diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc
index 0aadd73..d8fde60 100644
--- a/gcc/analyzer/program-point.cc
+++ b/gcc/analyzer/program-point.cc
@@ -558,6 +558,33 @@ function_point::cmp_within_supernode (const function_point &point_a,
return result;
}
+/* Comparator for imposing an order on function_points. */
+
+int
+function_point::cmp (const function_point &point_a,
+ const function_point &point_b)
+{
+ int idx_a = point_a.m_supernode ? point_a.m_supernode->m_index : -1;
+ int idx_b = point_b.m_supernode ? point_b.m_supernode->m_index : -1;
+ if (int cmp_idx = idx_a - idx_b)
+ return cmp_idx;
+ gcc_assert (point_a.m_supernode == point_b.m_supernode);
+ if (point_a.m_supernode)
+ return cmp_within_supernode (point_a, point_b);
+ else
+ return 0;
+}
+
+/* Comparator for use by vec<function_point>::qsort. */
+
+int
+function_point::cmp_ptr (const void *p1, const void *p2)
+{
+ const function_point *fp1 = (const function_point *)p1;
+ const function_point *fp2 = (const function_point *)p2;
+ return cmp (*fp1, *fp2);
+}
+
/* For PK_BEFORE_STMT, go to next stmt (or to PK_AFTER_SUPERNODE). */
void
diff --git a/gcc/analyzer/program-point.h b/gcc/analyzer/program-point.h
index d804621..2d1c3ab 100644
--- a/gcc/analyzer/program-point.h
+++ b/gcc/analyzer/program-point.h
@@ -138,6 +138,9 @@ public:
const function_point &point_b);
static int cmp_within_supernode (const function_point &point_a,
const function_point &point_b);
+ static int cmp (const function_point &point_a,
+ const function_point &point_b);
+ static int cmp_ptr (const void *p1, const void *p2);
/* For before_stmt, go to next stmt. */
void next_stmt ();
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index 5bb8907..b39e55a 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -131,6 +131,25 @@ extrinsic_state::get_model_manager () const
return NULL; /* for selftests. */
}
+/* struct sm_state_map::entry_t. */
+
+int
+sm_state_map::entry_t::cmp (const entry_t &entry_a, const entry_t &entry_b)
+{
+ gcc_assert (entry_a.m_state);
+ gcc_assert (entry_b.m_state);
+ if (int cmp_state = ((int)entry_a.m_state->get_id ()
+ - (int)entry_b.m_state->get_id ()))
+ return cmp_state;
+ if (entry_a.m_origin && entry_b.m_origin)
+ return svalue::cmp_ptr (entry_a.m_origin, entry_b.m_origin);
+ if (entry_a.m_origin)
+ return 1;
+ if (entry_b.m_origin)
+ return -1;
+ return 0;
+}
+
/* class sm_state_map. */
/* sm_state_map's ctor. */
@@ -170,21 +189,29 @@ sm_state_map::print (const region_model *model,
pp_newline (pp);
first = false;
}
+ auto_vec <const svalue *> keys (m_map.elements ());
for (map_t::iterator iter = m_map.begin ();
iter != m_map.end ();
++iter)
+ keys.quick_push ((*iter).first);
+ keys.qsort (svalue::cmp_ptr_ptr);
+ unsigned i;
+ const svalue *sval;
+ FOR_EACH_VEC_ELT (keys, i, sval)
{
if (multiline)
pp_string (pp, " ");
else if (!first)
pp_string (pp, ", ");
first = false;
- const svalue *sval = (*iter).first;
- pp_pointer (pp, sval);
- pp_string (pp, ": ");
+ if (!flag_dump_noaddr)
+ {
+ pp_pointer (pp, sval);
+ pp_string (pp, ": ");
+ }
sval->dump_to_pp (pp, simple);
- entry_t e = (*iter).second;
+ entry_t e = *const_cast <map_t &> (m_map).get (sval);
pp_string (pp, ": ");
e.m_state->dump_to_pp (pp);
if (model)
@@ -197,8 +224,11 @@ sm_state_map::print (const region_model *model,
if (e.m_origin)
{
pp_string (pp, " (origin: ");
- pp_pointer (pp, e.m_origin);
- pp_string (pp, ": ");
+ if (!flag_dump_noaddr)
+ {
+ pp_pointer (pp, e.m_origin);
+ pp_string (pp, ": ");
+ }
e.m_origin->dump_to_pp (pp, simple);
if (model)
if (tree rep = model->get_representative_tree (e.m_origin))
@@ -487,6 +517,7 @@ sm_state_map::on_liveness_change (const svalue_set &live_svalues,
{
svalue_set svals_to_unset;
+ auto_vec<const svalue *> leaked_svals (m_map.elements ());
for (map_t::iterator iter = m_map.begin ();
iter != m_map.end ();
++iter)
@@ -497,10 +528,20 @@ sm_state_map::on_liveness_change (const svalue_set &live_svalues,
svals_to_unset.add (iter_sval);
entry_t e = (*iter).second;
if (!m_sm.can_purge_p (e.m_state))
- ctxt->on_state_leak (m_sm, iter_sval, e.m_state);
+ leaked_svals.quick_push (iter_sval);
}
}
+ leaked_svals.qsort (svalue::cmp_ptr_ptr);
+
+ unsigned i;
+ const svalue *sval;
+ FOR_EACH_VEC_ELT (leaked_svals, i, sval)
+ {
+ entry_t e = *m_map.get (sval);
+ ctxt->on_state_leak (m_sm, sval, e.m_state);
+ }
+
for (svalue_set::iterator iter = svals_to_unset.begin ();
iter != svals_to_unset.end (); ++iter)
m_map.remove (*iter);
@@ -545,6 +586,44 @@ sm_state_map::on_unknown_change (const svalue *sval,
impl_set_state (*iter, (state_machine::state_t)0, NULL, ext_state);
}
+/* Comparator for imposing an order on sm_state_map instances. */
+
+int
+sm_state_map::cmp (const sm_state_map &smap_a, const sm_state_map &smap_b)
+{
+ if (int cmp_count = smap_a.elements () - smap_b.elements ())
+ return cmp_count;
+
+ auto_vec <const svalue *> keys_a (smap_a.elements ());
+ for (map_t::iterator iter = smap_a.begin ();
+ iter != smap_a.end ();
+ ++iter)
+ keys_a.quick_push ((*iter).first);
+ keys_a.qsort (svalue::cmp_ptr_ptr);
+
+ auto_vec <const svalue *> keys_b (smap_b.elements ());
+ for (map_t::iterator iter = smap_b.begin ();
+ iter != smap_b.end ();
+ ++iter)
+ keys_b.quick_push ((*iter).first);
+ keys_b.qsort (svalue::cmp_ptr_ptr);
+
+ unsigned i;
+ const svalue *sval_a;
+ FOR_EACH_VEC_ELT (keys_a, i, sval_a)
+ {
+ const svalue *sval_b = keys_b[i];
+ if (int cmp_sval = svalue::cmp_ptr (sval_a, sval_b))
+ return cmp_sval;
+ const entry_t *e_a = const_cast <map_t &> (smap_a.m_map).get (sval_a);
+ const entry_t *e_b = const_cast <map_t &> (smap_b.m_map).get (sval_b);
+ if (int cmp_entry = entry_t::cmp (*e_a, *e_b))
+ return cmp_entry;
+ }
+
+ return 0;
+}
+
/* Canonicalize SVAL before getting/setting it within the map.
Convert all NULL pointers to (void *) to avoid state explosions
involving all of the various (foo *)NULL vs (bar *)NULL. */
@@ -916,6 +995,7 @@ program_state::prune_for_point (exploded_graph &eg,
auto_vec<const decl_region *> ssa_name_regs;
new_state.m_region_model->get_ssa_name_regions_for_current_frame
(&ssa_name_regs);
+ ssa_name_regs.qsort (region::cmp_ptr_ptr);
unsigned i;
const decl_region *reg;
FOR_EACH_VEC_ELT (ssa_name_regs, i, reg)
@@ -1032,18 +1112,26 @@ program_state::validate (const extrinsic_state &ext_state) const
static void
log_set_of_svalues (logger *logger, const char *name,
- const svalue_set &set)
+ const svalue_set &set)
{
logger->log (name);
logger->inc_indent ();
+ auto_vec<const svalue *> sval_vecs (set.elements ());
for (svalue_set::iterator iter = set.begin ();
iter != set.end (); ++iter)
+ sval_vecs.quick_push (*iter);
+ sval_vecs.qsort (svalue::cmp_ptr_ptr);
+ unsigned i;
+ const svalue *sval;
+ FOR_EACH_VEC_ELT (sval_vecs, i, sval)
{
logger->start_log_line ();
pretty_printer *pp = logger->get_printer ();
- const svalue *sval = (*iter);
- pp_pointer (pp, sval);
- pp_string (pp, ": ");
+ if (!flag_dump_noaddr)
+ {
+ pp_pointer (pp, sval);
+ pp_string (pp, ": ");
+ }
sval->dump_to_pp (pp, false);
logger->end_log_line ();
}
@@ -1104,6 +1192,7 @@ program_state::detect_leaks (const program_state &src_state,
dest_svalues);
}
+ auto_vec <const svalue *> dead_svals (src_svalues.elements ());
for (svalue_set::iterator iter = src_svalues.begin ();
iter != src_svalues.end (); ++iter)
{
@@ -1111,11 +1200,19 @@ program_state::detect_leaks (const program_state &src_state,
/* For each sval reachable from SRC_STATE, determine if it is
live in DEST_STATE: either explicitly reachable, or implicitly
live based on the set of explicitly reachable svalues.
- Call CTXT->on_svalue_leak on those that have ceased to be live. */
+ Record those that have ceased to be live. */
if (!sval->live_p (dest_svalues, dest_state.m_region_model))
- ctxt->on_svalue_leak (sval);
+ dead_svals.quick_push (sval);
}
+ /* Call CTXT->on_svalue_leak on all svals in SRC_STATE that have ceased
+ to be live, sorting them first to ensure deterministic behavior. */
+ dead_svals.qsort (svalue::cmp_ptr_ptr);
+ unsigned i;
+ const svalue *sval;
+ FOR_EACH_VEC_ELT (dead_svals, i, sval)
+ ctxt->on_svalue_leak (sval);
+
/* Purge dead svals from sm-state. */
ctxt->on_liveness_change (dest_svalues, dest_state.m_region_model);
diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h
index 094d256..c44fc94 100644
--- a/gcc/analyzer/program-state.h
+++ b/gcc/analyzer/program-state.h
@@ -96,6 +96,8 @@ public:
return !(*this == other);
}
+ static int cmp (const entry_t &entry_a, const entry_t &entry_b);
+
state_machine::state_t m_state;
const svalue *m_origin;
};
@@ -157,6 +159,9 @@ public:
iterator_t begin () const { return m_map.begin (); }
iterator_t end () const { return m_map.end (); }
+ size_t elements () const { return m_map.elements (); }
+
+ static int cmp (const sm_state_map &smap_a, const sm_state_map &smap_b);
static const svalue *
canonicalize_svalue (const svalue *sval, const extrinsic_state &ext_state);
diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc
index 8dd3ad0..f7fa33b 100644
--- a/gcc/analyzer/region-model-manager.cc
+++ b/gcc/analyzer/region-model-manager.cc
@@ -1033,13 +1033,19 @@ log_uniq_map (logger *logger, bool show_objs, const char *title,
const hash_map<K, T*> &uniq_map)
{
logger->log (" # %s: %li", title, uniq_map.elements ());
- if (show_objs)
- for (typename hash_map<K, T*>::iterator iter = uniq_map.begin ();
- iter != uniq_map.end (); ++iter)
- {
- T *managed_obj = (*iter).second;
- log_managed_object<T> (logger, managed_obj);
- }
+ if (!show_objs)
+ return;
+ auto_vec<const T *> vec_objs (uniq_map.elements ());
+ for (typename hash_map<K, T*>::iterator iter = uniq_map.begin ();
+ iter != uniq_map.end (); ++iter)
+ vec_objs.quick_push ((*iter).second);
+
+ vec_objs.qsort (T::cmp_ptr_ptr);
+
+ unsigned i;
+ const T *obj;
+ FOR_EACH_VEC_ELT (vec_objs, i, obj)
+ log_managed_object<T> (logger, obj);
}
/* Dump the number of objects that were managed by MAP to LOGGER.
@@ -1051,13 +1057,20 @@ log_uniq_map (logger *logger, bool show_objs, const char *title,
const consolidation_map<T> &map)
{
logger->log (" # %s: %li", title, map.elements ());
- if (show_objs)
- for (typename consolidation_map<T>::iterator iter = map.begin ();
- iter != map.end (); ++iter)
- {
- T *managed_obj = (*iter).second;
- log_managed_object<T> (logger, managed_obj);
- }
+ if (!show_objs)
+ return;
+
+ auto_vec<const T *> vec_objs (map.elements ());
+ for (typename consolidation_map<T>::iterator iter = map.begin ();
+ iter != map.end (); ++iter)
+ vec_objs.quick_push ((*iter).second);
+
+ vec_objs.qsort (T::cmp_ptr_ptr);
+
+ unsigned i;
+ const T *obj;
+ FOR_EACH_VEC_ELT (vec_objs, i, obj)
+ log_managed_object<T> (logger, obj);
}
/* Dump the number of objects of each class that were managed by this
diff --git a/gcc/analyzer/region-model-reachability.cc b/gcc/analyzer/region-model-reachability.cc
index c1b3b2d..7fd8905 100644
--- a/gcc/analyzer/region-model-reachability.cc
+++ b/gcc/analyzer/region-model-reachability.cc
@@ -58,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 ()
{
}
@@ -135,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
@@ -181,6 +181,40 @@ reachable_regions::handle_sval (const svalue *sval)
}
if (const svalue *cast = sval->maybe_undo_cast ())
handle_sval (cast);
+
+ /* If SVAL is the result of a reversible operation, then the operands
+ are reachable. */
+ switch (sval->get_kind ())
+ {
+ default:
+ break;
+ case SK_UNARYOP:
+ {
+ const unaryop_svalue *unaryop_sval = (const unaryop_svalue *)sval;
+ switch (unaryop_sval->get_op ())
+ {
+ default:
+ break;
+ case NEGATE_EXPR:
+ handle_sval (unaryop_sval->get_arg ());
+ break;
+ }
+ }
+ break;
+ case SK_BINOP:
+ {
+ const binop_svalue *binop_sval = (const binop_svalue *)sval;
+ switch (binop_sval->get_op ())
+ {
+ default:
+ break;
+ case POINTER_PLUS_EXPR:
+ handle_sval (binop_sval->get_arg0 ());
+ handle_sval (binop_sval->get_arg1 ());
+ break;
+ }
+ }
+ }
}
/* Add SVAL. If it is a pointer, add the pointed-to region.
@@ -206,17 +240,55 @@ 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);
+ auto_vec<const function_region *> escaped_fn_regs
+ (m_mutable_base_regs.elements ());
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 ())
+ escaped_fn_regs.quick_push (fn_reg);
+ }
+ /* Sort to ensure deterministic results. */
+ escaped_fn_regs.qsort (region::cmp_ptr_ptr);
+ unsigned i;
+ const function_region *fn_reg;
+ FOR_EACH_VEC_ELT (escaped_fn_regs, i, fn_reg)
+ ctxt->on_escaped_function (fn_reg->get_fndecl ());
+}
+
+/* Dump SET to PP, sorting it to avoid churn when comparing dumps. */
+
+template <typename T>
+static void
+dump_set (const hash_set<const T *> &set, pretty_printer *pp)
+{
+ auto_vec<const T *> elements (set.elements ());
+ for (typename hash_set<const T *>::iterator iter = set.begin ();
+ iter != set.end (); ++iter)
+ elements.quick_push (*iter);
+
+ elements.qsort (T::cmp_ptr_ptr);
+
+ unsigned i;
+ const T *element;
+ FOR_EACH_VEC_ELT (elements, i, element)
+ {
+ pp_string (pp, " ");
+ element->dump_to_pp (pp, true);
+ pp_newline (pp);
}
}
@@ -227,40 +299,19 @@ reachable_regions::dump_to_pp (pretty_printer *pp) const
{
pp_string (pp, "reachable clusters: ");
pp_newline (pp);
- for (hash_set<const region *>::iterator iter = m_reachable_base_regs.begin ();
- iter != m_reachable_base_regs.end (); ++iter)
- {
- pp_string (pp, " ");
- (*iter)->dump_to_pp (pp, true);
- pp_newline (pp);
- }
+ dump_set (m_reachable_base_regs, pp);
+
pp_string (pp, "mutable clusters: ");
pp_newline (pp);
- for (hash_set<const region *>::iterator iter = m_mutable_base_regs.begin ();
- iter != m_mutable_base_regs.end (); ++iter)
- {
- pp_string (pp, " ");
- (*iter)->dump_to_pp (pp, true);
- pp_newline (pp);
- }
+ dump_set (m_mutable_base_regs, pp);
+
pp_string (pp, "reachable svals: ");
pp_newline (pp);
- for (svalue_set::iterator iter = m_reachable_svals.begin ();
- iter != m_reachable_svals.end (); ++iter)
- {
- pp_string (pp, " ");
- (*iter)->dump_to_pp (pp, true);
- pp_newline (pp);
- }
+ dump_set (m_reachable_svals, pp);
+
pp_string (pp, "mutable svals: ");
pp_newline (pp);
- for (svalue_set::iterator iter = m_mutable_svals.begin ();
- iter != m_mutable_svals.end (); ++iter)
- {
- pp_string (pp, " ");
- (*iter)->dump_to_pp (pp, true);
- pp_newline (pp);
- }
+ dump_set (m_mutable_svals, pp);
}
/* Dump a multiline representation of this object to stderr. */
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 480f25a..e5f027b 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -836,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. */
{
@@ -884,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. */
@@ -904,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. */
@@ -1333,35 +1333,38 @@ 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 () || 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;
+ }
}
}
}
@@ -2188,7 +2191,10 @@ region_model::get_representative_path_var (const region *reg,
return path_var (function_reg->get_fndecl (), 0);
}
case RK_LABEL:
- gcc_unreachable (); // TODO
+ {
+ const label_region *label_reg = as_a <const label_region *> (reg);
+ return path_var (label_reg->get_label (), 0);
+ }
case RK_SYMBOLIC:
{
diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h
index 234ca16..75f1512 100644
--- a/gcc/analyzer/region-model.h
+++ b/gcc/analyzer/region-model.h
@@ -26,6 +26,9 @@ along with GCC; see the file COPYING3. If not see
(Zhongxing Xu, Ted Kremenek, and Jian Zhang)
http://lcs.ios.ac.cn/~xuzb/canalyze/memmodel.pdf */
+#include "analyzer/svalue.h"
+#include "analyzer/region.h"
+
using namespace ana;
namespace inchash
@@ -147,29 +150,6 @@ struct purge_stats
int m_num_client_items;
};
-/* A measurement of the complexity of an svalue or region, so that
- we can impose bounds on the growth of these tree-like structures
- and thus avoid infinite chains of analysis. */
-
-struct complexity
-{
- complexity (unsigned num_nodes, unsigned max_depth)
- : m_num_nodes (num_nodes), m_max_depth (max_depth)
- {}
-
- complexity (const region *reg);
- complexity (const svalue *sval);
- static complexity from_pair (const complexity &c1, const complexity &c);
-
- /* The total number of svalues and regions in the tree of this
- entity, including the entity itself. */
- unsigned m_num_nodes;
-
- /* The maximum depth of the tree of this entity, including the
- entity itself. */
- unsigned m_max_depth;
-};
-
/* A base class for visiting regions and svalues, with do-nothing
base implementations of the per-subclass vfuncs. */
@@ -194,2104 +174,10 @@ public:
virtual void visit_region (const region *) {}
};
-/* An enum for discriminating between the different concrete subclasses
- of svalue. */
-
-enum svalue_kind
-{
- SK_REGION,
- SK_CONSTANT,
- SK_UNKNOWN,
- SK_POISONED,
- SK_SETJMP,
- SK_INITIAL,
- SK_UNARYOP,
- SK_BINOP,
- SK_SUB,
- SK_UNMERGEABLE,
- SK_PLACEHOLDER,
- SK_WIDENING,
- SK_COMPOUND,
- SK_CONJURED
-};
-
-/* svalue and its subclasses.
-
- The class hierarchy looks like this (using indentation to show
- inheritance, and with svalue_kinds shown for the concrete subclasses):
-
- svalue
- region_svalue (SK_REGION): a pointer to a region
- constant_svalue (SK_CONSTANT): a constant
- unknown_svalue (SK_UNKNOWN): an unknowable value
- poisoned_svalue (SK_POISONED): a unusable value (undefined)
- setjmp_svalue (SK_SETJMP): a setjmp/longjmp buffer
- initial_svalue (SK_INITIAL): the initial value of a region
- unaryop_svalue (SK_UNARYOP): unary operation on another svalue
- binop_svalue (SK_BINOP): binary operation on two svalues
- sub_svalue (SK_SUB): the result of accessing a subregion
- unmergeable_svalue (SK_UNMERGEABLE): a value that is so interesting
- from a control-flow perspective that it can inhibit state-merging
- placeholder_svalue (SK_PLACEHOLDER): for use in selftests.
- widening_svalue (SK_WIDENING): a merger of two svalues (possibly
- in an iteration).
- compound_svalue (SK_COMPOUND): a mapping of bit-ranges to svalues
- conjured_svalue (SK_CONJURED): a value arising from a stmt. */
-
-/* An abstract base class representing a value held by a region of memory. */
-
-class svalue
-{
-public:
- virtual ~svalue () {}
-
- tree get_type () const { return m_type; }
-
- virtual enum svalue_kind get_kind () const = 0;
-
- void print (const region_model &model,
- pretty_printer *pp) const;
-
- virtual void dump_to_pp (pretty_printer *pp, bool simple) const = 0;
- 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 *
- dyn_cast_constant_svalue () const { return NULL; }
- virtual const poisoned_svalue *
- dyn_cast_poisoned_svalue () const { return NULL; }
- virtual const setjmp_svalue *
- dyn_cast_setjmp_svalue () const { return NULL; }
- virtual const initial_svalue *
- dyn_cast_initial_svalue () const { return NULL; }
- virtual const unaryop_svalue *
- dyn_cast_unaryop_svalue () const { return NULL; }
- virtual const binop_svalue *
- dyn_cast_binop_svalue () const { return NULL; }
- virtual const sub_svalue *
- dyn_cast_sub_svalue () const { return NULL; }
- virtual const unmergeable_svalue *
- dyn_cast_unmergeable_svalue () const { return NULL; }
- virtual const widening_svalue *
- dyn_cast_widening_svalue () const { return NULL; }
- virtual const compound_svalue *
- dyn_cast_compound_svalue () const { return NULL; }
- virtual const conjured_svalue *
- dyn_cast_conjured_svalue () const { return NULL; }
-
- tree maybe_get_constant () const;
- const svalue *maybe_undo_cast () const;
- const svalue *unwrap_any_unmergeable () const;
-
- const svalue *can_merge_p (const svalue *other,
- region_model_manager *mgr,
- model_merger *merger) const;
-
- const complexity &get_complexity () const { return m_complexity; }
-
- virtual void accept (visitor *v) const = 0;
-
- bool live_p (const svalue_set &live_svalues,
- const region_model *model) const;
- virtual bool implicitly_live_p (const svalue_set &live_svalues,
- const region_model *model) const;
-
- protected:
- svalue (complexity c, tree type)
- : m_complexity (c), m_type (type)
- {}
-
- private:
- complexity m_complexity;
- tree m_type;
-};
-
-/* Concrete subclass of svalue representing a pointer value that points to
- a known region */
-
-class region_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of region_svalue. */
- struct key_t
- {
- key_t (tree type, const region *reg)
- : m_type (type), m_reg (reg)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_type);
- hstate.add_ptr (m_reg);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type && m_reg == other.m_reg);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- tree m_type;
- const region *m_reg;
- };
-
- region_svalue (tree type, const region *reg)
- : svalue (complexity (reg), type),
- m_reg (reg)
- {
- gcc_assert (m_reg != NULL);
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_REGION; }
- const region_svalue *
- dyn_cast_region_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;
-
- const region * get_pointee () const { return m_reg; }
-
- static tristate eval_condition (const region_svalue *lhs_ptr,
- enum tree_code op,
- const region_svalue *rhs_ptr);
-
- private:
- const region *m_reg;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const region_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_REGION;
-}
-
-template <> struct default_hash_traits<region_svalue::key_t>
-: public member_function_hash_traits<region_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete subclass of svalue representing a specific constant value. */
-
-class constant_svalue : public svalue
-{
-public:
- constant_svalue (tree cst_expr)
- : svalue (complexity (1, 1), TREE_TYPE (cst_expr)), m_cst_expr (cst_expr)
- {
- gcc_assert (cst_expr);
- gcc_assert (CONSTANT_CLASS_P (cst_expr));
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONSTANT; }
- const constant_svalue *
- dyn_cast_constant_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;
- bool implicitly_live_p (const svalue_set &,
- const region_model *) const FINAL OVERRIDE;
-
- tree get_constant () const { return m_cst_expr; }
- static tristate eval_condition (const constant_svalue *lhs,
- enum tree_code op,
- const constant_svalue *rhs);
-
- private:
- tree m_cst_expr;
-};
-
} // namespace ana
-template <>
-template <>
-inline bool
-is_a_helper <const constant_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_CONSTANT;
-}
-
namespace ana {
-/* Concrete subclass of svalue representing an unknowable value, the bottom
- value when thinking of svalues as a lattice.
- This is a singleton (w.r.t. its manager): there is a single unknown_svalue
- per type. Self-comparisons of such instances yield "unknown". */
-
-class unknown_svalue : public svalue
-{
-public:
- unknown_svalue (tree type)
- : svalue (complexity (1, 1), type)
- {}
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNKNOWN; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- void accept (visitor *v) const FINAL OVERRIDE;
-};
-
-/* An enum describing a particular kind of "poisoned" value. */
-
-enum poison_kind
-{
- /* For use to describe freed memory. */
- POISON_KIND_FREED,
-
- /* For use on pointers to regions within popped stack frames. */
- POISON_KIND_POPPED_STACK
-};
-
-extern const char *poison_kind_to_str (enum poison_kind);
-
-/* Concrete subclass of svalue representing a value that should not
- be used (e.g. uninitialized memory, freed memory). */
-
-class poisoned_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of poisoned_svalue. */
- struct key_t
- {
- key_t (enum poison_kind kind, tree type)
- : m_kind (kind), m_type (type)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_int (m_kind);
- hstate.add_ptr (m_type);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_kind == other.m_kind && m_type == other.m_type);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- enum poison_kind m_kind;
- tree m_type;
- };
-
- poisoned_svalue (enum poison_kind kind, tree type)
- : svalue (complexity (1, 1), type), m_kind (kind) {}
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_POISONED; }
- const poisoned_svalue *
- dyn_cast_poisoned_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;
-
- enum poison_kind get_poison_kind () const { return m_kind; }
-
- private:
- enum poison_kind m_kind;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const poisoned_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_POISONED;
-}
-
-template <> struct default_hash_traits<poisoned_svalue::key_t>
-: public member_function_hash_traits<poisoned_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* A bundle of information recording a setjmp/sigsetjmp call, corresponding
- roughly to a jmp_buf. */
-
-struct setjmp_record
-{
- setjmp_record (const exploded_node *enode,
- const gcall *setjmp_call)
- : m_enode (enode), m_setjmp_call (setjmp_call)
- {
- }
-
- bool operator== (const setjmp_record &other) const
- {
- return (m_enode == other.m_enode
- && m_setjmp_call == other.m_setjmp_call);
- }
-
- void add_to_hash (inchash::hash *hstate) const
- {
- hstate->add_ptr (m_enode);
- hstate->add_ptr (m_setjmp_call);
- }
-
- const exploded_node *m_enode;
- const gcall *m_setjmp_call;
-};
-
-/* Concrete subclass of svalue representing buffers for setjmp/sigsetjmp,
- so that longjmp/siglongjmp can potentially "return" to an entirely
- different function. */
-
-class setjmp_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of poisoned_svalue. */
- struct key_t
- {
- key_t (const setjmp_record &record, tree type)
- : m_record (record), m_type (type)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- m_record.add_to_hash (&hstate);
- hstate.add_ptr (m_type);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_record == other.m_record && m_type == other.m_type);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- setjmp_record m_record;
- tree m_type;
- };
-
- setjmp_svalue (const setjmp_record &setjmp_record,
- tree type)
- : svalue (complexity (1, 1), type), m_setjmp_record (setjmp_record)
- {}
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_SETJMP; }
- const setjmp_svalue *
- dyn_cast_setjmp_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;
-
- int get_enode_index () const;
-
- const setjmp_record &get_setjmp_record () const { return m_setjmp_record; }
-
- private:
- setjmp_record m_setjmp_record;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const setjmp_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_SETJMP;
-}
-
-template <> struct default_hash_traits<setjmp_svalue::key_t>
-: public member_function_hash_traits<setjmp_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete subclass of svalue representing the initial value of a
- specific region.
-
- This represents the initial value at the start of the analysis path,
- as opposed to the first time the region is accessed during the path.
- Hence as soon as we have a call to an unknown function, all previously
- unmodelled globals become implicitly "unknown" rathen than "initial". */
-
-class initial_svalue : public svalue
-{
-public:
- initial_svalue (tree type, const region *reg)
- : svalue (complexity (reg), type), m_reg (reg)
- {
- gcc_assert (m_reg != NULL);
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_INITIAL; }
- const initial_svalue *
- dyn_cast_initial_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;
- bool implicitly_live_p (const svalue_set &,
- const region_model *) const FINAL OVERRIDE;
-
- const region *get_region () const { return m_reg; }
-
- private:
- const region *m_reg;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const initial_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_INITIAL;
-}
-
-namespace ana {
-
-/* Concrete subclass of svalue representing a unary operation on
- another svalues (e.g. a cast). */
-
-class unaryop_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of unaryop_svalue. */
- struct key_t
- {
- key_t (tree type, enum tree_code op, const svalue *arg)
- : m_type (type), m_op (op), m_arg (arg)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_type);
- hstate.add_int (m_op);
- hstate.add_ptr (m_arg);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type
- && m_op == other.m_op
- && m_arg == other.m_arg);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- tree m_type;
- enum tree_code m_op;
- const svalue *m_arg;
- };
-
- unaryop_svalue (tree type, enum tree_code op, const svalue *arg)
- : svalue (complexity (arg), type), m_op (op), m_arg (arg)
- {
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNARYOP; }
- const unaryop_svalue *
- dyn_cast_unaryop_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;
- bool implicitly_live_p (const svalue_set &,
- const region_model *) const FINAL OVERRIDE;
-
- enum tree_code get_op () const { return m_op; }
- const svalue *get_arg () const { return m_arg; }
-
- private:
- enum tree_code m_op;
- const svalue *m_arg;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const unaryop_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_UNARYOP;
-}
-
-template <> struct default_hash_traits<unaryop_svalue::key_t>
-: public member_function_hash_traits<unaryop_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete subclass of svalue representing a binary operation of
- two svalues. */
-
-class binop_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of binop_svalue. */
- struct key_t
- {
- key_t (tree type, enum tree_code op,
- const svalue *arg0, const svalue *arg1)
- : m_type (type), m_op (op), m_arg0 (arg0), m_arg1 (arg1)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_type);
- hstate.add_int (m_op);
- hstate.add_ptr (m_arg0);
- hstate.add_ptr (m_arg1);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type
- && m_op == other.m_op
- && m_arg0 == other.m_arg0
- && m_arg1 == other.m_arg1);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- tree m_type;
- enum tree_code m_op;
- const svalue *m_arg0;
- const svalue *m_arg1;
- };
-
- binop_svalue (tree type, enum tree_code op,
- const svalue *arg0, const svalue *arg1)
- : svalue (complexity::from_pair (arg0->get_complexity (),
- arg1->get_complexity ()),
- type),
- m_op (op), m_arg0 (arg0), m_arg1 (arg1)
- {
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_BINOP; }
- 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;
- bool implicitly_live_p (const svalue_set &,
- const region_model *) const FINAL OVERRIDE;
-
- enum tree_code get_op () const { return m_op; }
- const svalue *get_arg0 () const { return m_arg0; }
- const svalue *get_arg1 () const { return m_arg1; }
-
- private:
- enum tree_code m_op;
- const svalue *m_arg0;
- const svalue *m_arg1;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const binop_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_BINOP;
-}
-
-template <> struct default_hash_traits<binop_svalue::key_t>
-: public member_function_hash_traits<binop_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete subclass of svalue representing the result of accessing a subregion
- of another svalue (the value of a component/field of a struct, or an element
- from an array). */
-
-class sub_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of sub_svalue. */
- struct key_t
- {
- key_t (tree type, const svalue *parent_svalue, const region *subregion)
- : m_type (type), m_parent_svalue (parent_svalue), m_subregion (subregion)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_type);
- hstate.add_ptr (m_parent_svalue);
- hstate.add_ptr (m_subregion);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type
- && m_parent_svalue == other.m_parent_svalue
- && m_subregion == other.m_subregion);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- tree m_type;
- const svalue *m_parent_svalue;
- const region *m_subregion;
- };
- sub_svalue (tree type, const svalue *parent_svalue,
- const region *subregion);
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_SUB; }
- const sub_svalue *dyn_cast_sub_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;
- bool implicitly_live_p (const svalue_set &,
- const region_model *) const FINAL OVERRIDE;
-
- const svalue *get_parent () const { return m_parent_svalue; }
- const region *get_subregion () const { return m_subregion; }
-
- private:
- const svalue *m_parent_svalue;
- const region *m_subregion;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const sub_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_SUB;
-}
-
-template <> struct default_hash_traits<sub_svalue::key_t>
-: public member_function_hash_traits<sub_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete subclass of svalue: decorate another svalue,
- so that the resulting svalue can be identified as being
- "interesting to control flow".
- For example, consider the return value from setjmp. We
- don't want to merge states in which the result is 0 with
- those in which the result is non-zero. By using an
- unmergeable_svalue for the result, we can inhibit such merges
- and have separate exploded nodes for those states, keeping
- the first and second returns from setjmp distinct in the exploded
- graph. */
-
-class unmergeable_svalue : public svalue
-{
-public:
- unmergeable_svalue (const svalue *arg)
- : svalue (complexity (arg), arg->get_type ()), m_arg (arg)
- {
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNMERGEABLE; }
- const unmergeable_svalue *
- dyn_cast_unmergeable_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;
- bool implicitly_live_p (const svalue_set &,
- const region_model *) const FINAL OVERRIDE;
-
- const svalue *get_arg () const { return m_arg; }
-
- private:
- const svalue *m_arg;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const unmergeable_svalue *>::test (const svalue *sval)
-{
- return sval->get_kind () == SK_UNMERGEABLE;
-}
-
-namespace ana {
-
-/* Concrete subclass of svalue for use in selftests, where
- we want a specific but unknown svalue.
- Unlike other svalue subclasses these aren't managed by
- region_model_manager. */
-
-class placeholder_svalue : public svalue
-{
-public:
- placeholder_svalue (tree type, const char *name)
- : svalue (complexity (1, 1), type), m_name (name)
- {
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_PLACEHOLDER; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- void accept (visitor *v) const FINAL OVERRIDE;
-
- private:
- const char *m_name;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <placeholder_svalue *>::test (svalue *sval)
-{
- return sval->get_kind () == SK_PLACEHOLDER;
-}
-
-namespace ana {
-
-/* Concrete subclass of svalue representing a "widening" seen when merging
- states, widening from a base value to {base value, iter value} and thus
- representing a possible fixed point in an iteration from the base to
- +ve infinity, or -ve infinity, and thus useful for representing a value
- within a loop.
- We also need to capture the program_point at which the merger happens,
- so that distinguish between different iterators, and thus handle
- nested loops. (currently we capture the function_point instead, for
- simplicity of hashing). */
-
-class widening_svalue : public svalue
-{
-public:
- /* A support class for uniquifying instances of widening_svalue. */
- struct key_t
- {
- key_t (tree type, const program_point &point,
- const svalue *base_sval, const svalue *iter_sval)
- : m_type (type), m_point (point.get_function_point ()),
- m_base_sval (base_sval), m_iter_sval (iter_sval)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_base_sval);
- hstate.add_ptr (m_iter_sval);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type
- && m_point == other.m_point
- && m_base_sval == other.m_base_sval
- && m_iter_sval == other.m_iter_sval);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- tree m_type;
- function_point m_point;
- const svalue *m_base_sval;
- const svalue *m_iter_sval;
- };
-
- enum direction_t
- {
- DIR_ASCENDING,
- DIR_DESCENDING,
- DIR_UNKNOWN
- };
-
- widening_svalue (tree type, const program_point &point,
- const svalue *base_sval, const svalue *iter_sval)
- : svalue (complexity::from_pair (base_sval->get_complexity (),
- iter_sval->get_complexity ()),
- type),
- m_point (point.get_function_point ()),
- m_base_sval (base_sval), m_iter_sval (iter_sval)
- {
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_WIDENING; }
- 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;
-
- const svalue *get_base_svalue () const { return m_base_sval; }
- const svalue *get_iter_svalue () const { return m_iter_sval; }
-
- enum direction_t get_direction () const;
-
- tristate eval_condition_without_cm (enum tree_code op,
- tree rhs_cst) const;
-
- private:
- function_point m_point;
- const svalue *m_base_sval;
- const svalue *m_iter_sval;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <widening_svalue *>::test (svalue *sval)
-{
- return sval->get_kind () == SK_WIDENING;
-}
-
-template <> struct default_hash_traits<widening_svalue::key_t>
-: public member_function_hash_traits<widening_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete subclass of svalue representing a mapping of bit-ranges
- to svalues, analogous to a cluster within the store.
-
- This is for use in places where we want to represent a store-like
- mapping, but are required to use an svalue, such as when handling
- compound assignments and compound return values.
-
- All keys within the underlying binding_map are required to be concrete,
- not symbolic.
-
- Instances of this class shouldn't be bound as-is into the store;
- instead they should be unpacked. Similarly, they should not be
- nested. */
-
-class compound_svalue : public svalue
-{
-public:
- typedef binding_map::iterator_t iterator_t;
-
- /* A support class for uniquifying instances of compound_svalue.
- Note that to avoid copies, keys store pointers to binding_maps,
- rather than the maps themselves. */
- struct key_t
- {
- key_t (tree type, const binding_map *map_ptr)
- : m_type (type), m_map_ptr (map_ptr)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_type);
- //hstate.add_ptr (m_map_ptr); // TODO
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type
- && *m_map_ptr == *other.m_map_ptr);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- tree m_type;
- const binding_map *m_map_ptr;
- };
-
- 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 FINAL OVERRIDE
- {
- return this;
- }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- void accept (visitor *v) const FINAL OVERRIDE;
-
- iterator_t begin () const { return m_map.begin (); }
- iterator_t end () const { return m_map.end (); }
-
- struct key_t make_key () const
- {
- return key_t (get_type (), &m_map);
- }
-
- private:
- static complexity calc_complexity (const binding_map &map);
-
- binding_map m_map;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <compound_svalue *>::test (svalue *sval)
-{
- return sval->get_kind () == SK_COMPOUND;
-}
-
-template <> struct default_hash_traits<compound_svalue::key_t>
-: public member_function_hash_traits<compound_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* A defined value arising from a statement, where we want to identify a
- particular unknown value, rather than resorting to the unknown_value
- singleton, so that the value can have sm-state.
-
- Comparisons of variables that share the same conjured_svalue are known
- to be equal, even if we don't know what the value is.
-
- For example, this is used for the values of regions that may have been
- touched when calling an unknown function.
-
- The value captures a region as well as a stmt in order to avoid falsely
- aliasing the various values that could arise in one statement. For
- example, after:
- unknown_fn (&a, &b);
- we want values to clobber a and b with, but we don't want to use the
- same value, or it would falsely implicitly assume that a == b. */
-
-class conjured_svalue : public svalue
-{
-public:
- typedef binding_map::iterator_t iterator_t;
-
- /* A support class for uniquifying instances of conjured_svalue. */
- struct key_t
- {
- key_t (tree type, const gimple *stmt, const region *id_reg)
- : m_type (type), m_stmt (stmt), m_id_reg (id_reg)
- {}
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_type);
- hstate.add_ptr (m_stmt);
- hstate.add_ptr (m_id_reg);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_type == other.m_type
- && m_stmt == other.m_stmt
- && m_id_reg == other.m_id_reg);
- }
-
- /* Use m_stmt to mark empty/deleted, as m_type can be NULL for
- legitimate instances. */
- void mark_deleted () { m_stmt = reinterpret_cast<const gimple *> (1); }
- void mark_empty () { m_stmt = NULL; }
- bool is_deleted () const
- {
- return m_stmt == reinterpret_cast<const gimple *> (1);
- }
- bool is_empty () const { return m_stmt == NULL; }
-
- tree m_type;
- const gimple *m_stmt;
- const region *m_id_reg;
- };
-
- conjured_svalue (tree type, const gimple *stmt, const region *id_reg)
- : svalue (complexity (id_reg), type),
- m_stmt (stmt), m_id_reg (id_reg)
- {
- gcc_assert (m_stmt != NULL);
- }
-
- enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONJURED; }
- 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;
-
- private:
- const gimple *m_stmt;
- const region *m_id_reg;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <conjured_svalue *>::test (svalue *sval)
-{
- return sval->get_kind () == SK_CONJURED;
-}
-
-template <> struct default_hash_traits<conjured_svalue::key_t>
-: public member_function_hash_traits<conjured_svalue::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* An enum for discriminating between the different concrete subclasses
- of region. */
-
-enum region_kind
-{
- RK_FRAME,
- RK_GLOBALS,
- RK_CODE,
- RK_FUNCTION,
- RK_LABEL,
- RK_STACK,
- RK_HEAP,
- RK_ROOT,
- RK_SYMBOLIC,
- RK_DECL,
- RK_FIELD,
- RK_ELEMENT,
- RK_OFFSET,
- RK_CAST,
- RK_HEAP_ALLOCATED,
- RK_ALLOCA,
- RK_STRING,
- RK_UNKNOWN
-};
-
-/* Region and its subclasses.
-
- The class hierarchy looks like this (using indentation to show
- inheritance, and with region_kinds shown for the concrete subclasses):
-
- region
- space_region
- frame_region (RK_FRAME)
- globals_region (RK_GLOBALS)
- code_region (RK_CODE)
- stack_region (RK_STACK)
- heap_region (RK_HEAP)
- root_region (RK_ROOT)
- function_region (RK_FUNCTION)
- label_region (RK_LABEL)
- symbolic_region (RK_SYMBOLIC)
- decl_region (RK_DECL),
- field_region (RK_FIELD)
- element_region (RK_ELEMENT)
- offset_region (RK_OFFSET)
- cast_region (RK_CAST)
- heap_allocated_region (RK_HEAP_ALLOCATED)
- alloca_region (RK_ALLOCA)
- string_region (RK_STRING)
- unknown_region (RK_UNKNOWN). */
-
-/* Abstract base class for representing ways of accessing chunks of memory.
-
- Regions form a tree-like hierarchy, with a root region at the base,
- with memory space regions within it, representing the stack and
- globals, with frames within the stack, and regions for variables
- within the frames and the "globals" region. Regions for structs
- can have subregions for fields. */
-
-class region
-{
-public:
- virtual ~region ();
-
- unsigned get_id () const { return m_id; }
- static int cmp_ids (const region *reg1, const region *reg2);
-
- virtual enum region_kind get_kind () const = 0;
- virtual const frame_region *
- dyn_cast_frame_region () const { return NULL; }
- virtual const function_region *
- dyn_cast_function_region () const { return NULL; }
- virtual const symbolic_region *
- dyn_cast_symbolic_region () const { return NULL; }
- virtual const decl_region *
- dyn_cast_decl_region () const { return NULL; }
- virtual const field_region *
- dyn_cast_field_region () const { return NULL; }
- virtual const element_region *
- dyn_cast_element_region () const { return NULL; }
- virtual const offset_region *
- dyn_cast_offset_region () const { return NULL; }
- virtual const cast_region *
- dyn_cast_cast_region () const { return NULL; }
- virtual const string_region *
- dyn_cast_string_region () const { return NULL; }
-
- virtual void accept (visitor *v) const;
-
- const region *get_parent_region () const { return m_parent; }
- const region *get_base_region () const;
- bool base_region_p () const;
- bool descendent_of_p (const region *elder) const;
- const frame_region *maybe_get_frame_region () const;
-
- tree maybe_get_decl () const;
-
- tree get_type () const { return m_type; }
-
- void print (const region_model &model,
- pretty_printer *pp) const;
- label_text get_desc (bool simple=true) const;
-
- void dump_to_pp (const region_model &model,
- pretty_printer *pp,
- const char *prefix,
- bool is_last_child) const;
-
- 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 *);
-
- region_offset get_offset () const;
- bool get_byte_size (byte_size_t *out) const;
- bool get_bit_size (bit_size_t *out) const;
-
- void
- get_subregions_for_binding (region_model_manager *mgr,
- bit_offset_t start_bit_offset,
- bit_size_t size_in_bits,
- tree type,
- auto_vec <const region *> *out) const;
-
- bool symbolic_for_unknown_ptr_p () const;
-
- const complexity &get_complexity () const { return m_complexity; }
-
- protected:
- region (complexity c, unsigned id, const region *parent, tree type);
-
- private:
- region_offset calc_offset () const;
-
- complexity m_complexity;
- unsigned m_id; // purely for deterministic sorting at this stage, for dumps
- const region *m_parent;
- tree m_type;
-
- mutable region_offset *m_cached_offset;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const region *>::test (const region *)
-{
- return true;
-}
-
-namespace ana {
-
-/* Abstract subclass of region, for regions that represent an untyped
- space within memory, such as the stack or the heap. */
-
-class space_region : public region
-{
-protected:
- space_region (unsigned id, const region *parent)
- : region (complexity (parent), id, parent, NULL_TREE)
- {}
-};
-
-/* Concrete space_region subclass, representing a function frame on the stack,
- to contain the locals.
- The parent is the stack region; there's also a hierarchy of call-stack
- prefixes expressed via m_calling_frame.
- For example, given "oldest" calling "middle" called "newest" we would have
- - a stack depth of 3
- - frame (A) for "oldest" with index 0 for depth 1, calling_frame == NULL
- - frame (B) for "middle" with index 1 for depth 2, calling_frame == (A)
- - frame (C) for "newest" with index 2 for depth 3, calling_frame == (B)
- where the parent region for each of the frames is the "stack" region.
- The index is the count of frames earlier than this in the stack. */
-
-class frame_region : public space_region
-{
-public:
- /* A support class for uniquifying instances of frame_region. */
- struct key_t
- {
- key_t (const frame_region *calling_frame, function *fun)
- : m_calling_frame (calling_frame), m_fun (fun)
- {
- /* calling_frame can be NULL. */
- gcc_assert (fun);
- }
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_calling_frame);
- hstate.add_ptr (m_fun);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_calling_frame == other.m_calling_frame && m_fun == other.m_fun);
- }
-
- void mark_deleted () { m_fun = reinterpret_cast<function *> (1); }
- void mark_empty () { m_fun = NULL; }
- bool is_deleted () const
- {
- return m_fun == reinterpret_cast<function *> (1);
- }
- bool is_empty () const { return m_fun == NULL; }
-
- const frame_region *m_calling_frame;
- function *m_fun;
- };
-
- frame_region (unsigned id, const region *parent,
- const frame_region *calling_frame,
- function *fun, int index)
- : space_region (id, parent), m_calling_frame (calling_frame),
- m_fun (fun), m_index (index)
- {}
- ~frame_region ();
-
- /* region vfuncs. */
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_FRAME; }
- const frame_region * dyn_cast_frame_region () const FINAL OVERRIDE
- {
- return this;
- }
- void accept (visitor *v) const FINAL OVERRIDE;
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- /* Accessors. */
- const frame_region *get_calling_frame () const { return m_calling_frame; }
- function *get_function () const { return m_fun; }
- int get_index () const { return m_index; }
- int get_stack_depth () const { return m_index + 1; }
-
- const decl_region *get_region_for_local (region_model_manager *mgr,
- tree expr) const;
-
- unsigned get_num_locals () const { return m_locals.elements (); }
-
- private:
- const frame_region *m_calling_frame;
- function *m_fun;
- int m_index;
-
- /* The regions for the decls within this frame are managed by this
- object, rather than the region_model_manager, to make it a simple
- lookup by tree. */
- typedef hash_map<tree, decl_region *> map_t;
- map_t m_locals;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const frame_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_FRAME;
-}
-
-template <> struct default_hash_traits<frame_region::key_t>
-: public member_function_hash_traits<frame_region::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete space_region subclass, to hold global variables (data and bss). */
-
-class globals_region : public space_region
-{
- public:
- globals_region (unsigned id, const region *parent)
- : space_region (id, parent)
- {}
-
- /* region vfuncs. */
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_GLOBALS; }
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const globals_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_GLOBALS;
-}
-
-namespace ana {
-
-/* Concrete space_region subclass, representing the code segment
- containing functions. */
-
-class code_region : public space_region
-{
-public:
- code_region (unsigned id, const region *parent)
- : space_region (id, parent)
- {}
-
- /* region vfuncs. */
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_CODE; }
-
- const region *get_element (region_model *model,
- const svalue *index,
- region_model_context *ctxt);
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const code_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_CODE;
-}
-
-namespace ana {
-
-/* Concrete region subclass. A region representing the code for
- a particular function. */
-
-class function_region : public region
-{
-public:
- function_region (unsigned id, const code_region *parent, tree fndecl)
- : region (complexity (parent), id, parent, TREE_TYPE (fndecl)),
- m_fndecl (fndecl)
- {
- gcc_assert (FUNC_OR_METHOD_TYPE_P (TREE_TYPE (fndecl)));
- }
-
- /* region vfuncs. */
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_FUNCTION; }
- const function_region *
- dyn_cast_function_region () const FINAL OVERRIDE{ return this; }
-
- tree get_fndecl () const { return m_fndecl; }
-
- region *get_element (region_model *model,
- const svalue *index_sid,
- region_model_context *ctxt);
-
-private:
- tree m_fndecl;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const function_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_FUNCTION;
-}
-
-namespace ana {
-
-/* Concrete region subclass. A region representing a particular label
- within a function. */
-
-class label_region : public region
-{
-public:
- label_region (unsigned id, const function_region *parent, tree label)
- : region (complexity (parent), id, parent, NULL_TREE), m_label (label)
- {
- gcc_assert (TREE_CODE (label) == LABEL_DECL);
- }
-
- /* region vfuncs. */
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_LABEL; }
-
-private:
- tree m_label;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const label_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_LABEL;
-}
-
-namespace ana {
-
-/* Concrete space_region subclass representing a stack, containing all stack
- frames. */
-
-class stack_region : public space_region
-{
-public:
- stack_region (unsigned id, region *parent)
- : space_region (id, parent)
- {}
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_STACK; }
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const stack_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_STACK;
-}
-
-namespace ana {
-
-/* Concrete space_region subclass: a region within which regions can be
- dynamically allocated. */
-
-class heap_region : public space_region
-{
-public:
- heap_region (unsigned id, region *parent)
- : space_region (id, parent)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_HEAP; }
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const heap_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_HEAP;
-}
-
-namespace ana {
-
-/* Concrete region subclass. The root region, containing all regions
- (either directly, or as descendents).
- Unique within a region_model_manager. */
-
-class root_region : public region
-{
-public:
- root_region (unsigned id);
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_ROOT; }
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const root_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_ROOT;
-}
-
-namespace ana {
-
-/* Concrete region subclass: a region to use when dereferencing an unknown
- pointer. */
-
-class symbolic_region : public region
-{
-public:
- /* A support class for uniquifying instances of symbolic_region. */
- struct key_t
- {
- key_t (const region *parent, const svalue *sval_ptr)
- : m_parent (parent), m_sval_ptr (sval_ptr)
- {
- gcc_assert (sval_ptr);
- }
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_parent);
- hstate.add_ptr (m_sval_ptr);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_parent == other.m_parent && m_sval_ptr == other.m_sval_ptr);
- }
-
- void mark_deleted () { m_sval_ptr = reinterpret_cast<const svalue *> (1); }
- void mark_empty () { m_sval_ptr = NULL; }
- bool is_deleted () const
- {
- return m_sval_ptr == reinterpret_cast<const svalue *> (1);
- }
- bool is_empty () const { return m_sval_ptr == NULL; }
-
- const region *m_parent;
- const svalue *m_sval_ptr;
- };
-
- symbolic_region (unsigned id, region *parent, const svalue *sval_ptr)
- : region (complexity::from_pair (parent, sval_ptr), id, parent,
- TREE_TYPE (sval_ptr->get_type ())),
- m_sval_ptr (sval_ptr)
- {}
-
- const symbolic_region *
- dyn_cast_symbolic_region () const FINAL OVERRIDE { return this; }
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_SYMBOLIC; }
- void accept (visitor *v) const FINAL OVERRIDE;
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- const svalue *get_pointer () const { return m_sval_ptr; }
-
-private:
- const svalue *m_sval_ptr;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const symbolic_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_SYMBOLIC;
-}
-
-template <> struct default_hash_traits<symbolic_region::key_t>
-: public member_function_hash_traits<symbolic_region::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* Concrete region subclass representing the memory occupied by a
- variable (whether for a global or a local). */
-
-class decl_region : public region
-{
-public:
- decl_region (unsigned id, const region *parent, tree decl)
- : region (complexity (parent), id, parent, TREE_TYPE (decl)), m_decl (decl)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_DECL; }
- const decl_region *
- dyn_cast_decl_region () const FINAL OVERRIDE { return this; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- tree get_decl () const { return m_decl; }
- int get_stack_depth () const;
-
- const svalue *maybe_get_constant_value (region_model_manager *mgr) const;
- const svalue *get_svalue_for_constructor (tree ctor,
- region_model_manager *mgr) const;
- const svalue *get_svalue_for_initializer (region_model_manager *mgr) const;
-
-private:
- tree m_decl;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const decl_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_DECL;
-}
-
-namespace ana {
-
-/* Concrete region subclass representing the memory occupied by a
- field within a struct or union. */
-
-class field_region : public region
-{
-public:
- /* A support class for uniquifying instances of field_region. */
- struct key_t
- {
- key_t (const region *parent, tree field)
- : m_parent (parent), m_field (field)
- {
- gcc_assert (field);
- }
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_parent);
- hstate.add_ptr (m_field);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_parent == other.m_parent && m_field == other.m_field);
- }
-
- void mark_deleted () { m_field = reinterpret_cast<tree> (1); }
- void mark_empty () { m_field = NULL_TREE; }
- bool is_deleted () const { return m_field == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_field == NULL_TREE; }
-
- const region *m_parent;
- tree m_field;
- };
-
- field_region (unsigned id, const region *parent, tree field)
- : region (complexity (parent), id, parent, TREE_TYPE (field)),
- m_field (field)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_FIELD; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
- const field_region *
- dyn_cast_field_region () const FINAL OVERRIDE { return this; }
-
- tree get_field () const { return m_field; }
-
-private:
- tree m_field;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const field_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_FIELD;
-}
-
-template <> struct default_hash_traits<field_region::key_t>
-: public member_function_hash_traits<field_region::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* An element within an array. */
-
-class element_region : public region
-{
-public:
- /* A support class for uniquifying instances of element_region. */
- struct key_t
- {
- key_t (const region *parent, tree element_type, const svalue *index)
- : m_parent (parent), m_element_type (element_type), m_index (index)
- {
- gcc_assert (index);
- }
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_parent);
- hstate.add_ptr (m_element_type);
- hstate.add_ptr (m_index);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_parent == other.m_parent
- && m_element_type == other.m_element_type
- && m_index == other.m_index);
- }
-
- void mark_deleted () { m_index = reinterpret_cast<const svalue *> (1); }
- void mark_empty () { m_index = NULL; }
- bool is_deleted () const
- {
- return m_index == reinterpret_cast<const svalue *> (1);
- }
- bool is_empty () const { return m_index == NULL; }
-
- const region *m_parent;
- tree m_element_type;
- const svalue *m_index;
- };
-
- element_region (unsigned id, const region *parent, tree element_type,
- const svalue *index)
- : region (complexity::from_pair (parent, index), id, parent, element_type),
- m_index (index)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_ELEMENT; }
- const element_region *
- dyn_cast_element_region () const FINAL OVERRIDE { return this; }
-
- void accept (visitor *v) const FINAL OVERRIDE;
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- const svalue *get_index () const { return m_index; }
-
-private:
- const svalue *m_index;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const element_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_ELEMENT;
-}
-
-template <> struct default_hash_traits<element_region::key_t>
-: public member_function_hash_traits<element_region::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* A byte-offset within another region, for handling pointer arithmetic
- as a region. */
-
-class offset_region : public region
-{
-public:
- /* A support class for uniquifying instances of offset_region. */
- struct key_t
- {
- key_t (const region *parent, tree element_type, const svalue *byte_offset)
- : m_parent (parent), m_element_type (element_type), m_byte_offset (byte_offset)
- {
- gcc_assert (byte_offset);
- }
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_parent);
- hstate.add_ptr (m_element_type);
- hstate.add_ptr (m_byte_offset);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_parent == other.m_parent
- && m_element_type == other.m_element_type
- && m_byte_offset == other.m_byte_offset);
- }
-
- void mark_deleted () { m_byte_offset = reinterpret_cast<const svalue *> (1); }
- void mark_empty () { m_byte_offset = NULL; }
- bool is_deleted () const
- {
- return m_byte_offset == reinterpret_cast<const svalue *> (1);
- }
- bool is_empty () const { return m_byte_offset == NULL; }
-
- const region *m_parent;
- tree m_element_type;
- const svalue *m_byte_offset;
- };
-
- offset_region (unsigned id, const region *parent, tree type,
- const svalue *byte_offset)
- : region (complexity::from_pair (parent, byte_offset), id, parent, type),
- m_byte_offset (byte_offset)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_OFFSET; }
- const offset_region *
- dyn_cast_offset_region () const FINAL OVERRIDE { return this; }
-
- void accept (visitor *v) const FINAL OVERRIDE;
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- const svalue *get_byte_offset () const { return m_byte_offset; }
-
-private:
- const svalue *m_byte_offset;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const offset_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_OFFSET;
-}
-
-template <> struct default_hash_traits<offset_region::key_t>
-: public member_function_hash_traits<offset_region::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* A region that views another region using a different type. */
-
-class cast_region : public region
-{
-public:
- /* A support class for uniquifying instances of cast_region. */
- struct key_t
- {
- key_t (const region *original_region, tree type)
- : m_original_region (original_region), m_type (type)
- {
- gcc_assert (type);
- }
-
- hashval_t hash () const
- {
- inchash::hash hstate;
- hstate.add_ptr (m_original_region);
- hstate.add_ptr (m_type);
- return hstate.end ();
- }
-
- bool operator== (const key_t &other) const
- {
- return (m_original_region == other.m_original_region
- && m_type == other.m_type);
- }
-
- void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
- void mark_empty () { m_type = NULL_TREE; }
- bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
- bool is_empty () const { return m_type == NULL_TREE; }
-
- const region *m_original_region;
- tree m_type;
- };
-
- cast_region (unsigned id, const region *original_region, tree type)
- : region (complexity (original_region), id,
- original_region->get_parent_region (), type),
- m_original_region (original_region)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_CAST; }
- const cast_region *
- dyn_cast_cast_region () const FINAL OVERRIDE { return this; }
- void accept (visitor *v) const FINAL OVERRIDE;
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- const region *get_original_region () const { return m_original_region; }
-
-private:
- const region *m_original_region;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const cast_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_CAST;
-}
-
-template <> struct default_hash_traits<cast_region::key_t>
-: public member_function_hash_traits<cast_region::key_t>
-{
- static const bool empty_zero_p = true;
-};
-
-namespace ana {
-
-/* An untyped region dynamically allocated on the heap via "malloc"
- or similar. */
-
-class heap_allocated_region : public region
-{
-public:
- heap_allocated_region (unsigned id, const region *parent)
- : region (complexity (parent), id, parent, NULL_TREE)
- {}
-
- enum region_kind
- get_kind () const FINAL OVERRIDE { return RK_HEAP_ALLOCATED; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-};
-
-/* An untyped region dynamically allocated on the stack via "alloca". */
-
-class alloca_region : public region
-{
-public:
- alloca_region (unsigned id, const frame_region *parent)
- : region (complexity (parent), id, parent, NULL_TREE)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_ALLOCA; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-};
-
-/* A region for a STRING_CST. */
-
-class string_region : public region
-{
-public:
- string_region (unsigned id, const region *parent, tree string_cst)
- : region (complexity (parent), id, parent, TREE_TYPE (string_cst)),
- m_string_cst (string_cst)
- {}
-
- const string_region *
- dyn_cast_string_region () const FINAL OVERRIDE { return this; }
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_STRING; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-
- tree get_string_cst () const { return m_string_cst; }
-
-private:
- tree m_string_cst;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const string_region *>::test (const region *reg)
-{
- return reg->get_kind () == RK_STRING;
-}
-
-namespace ana {
-
-/* An unknown region, for handling unimplemented tree codes. */
-
-class unknown_region : public region
-{
-public:
- unknown_region (unsigned id, const region *parent, tree type)
- : region (complexity (parent), id, parent, type)
- {}
-
- enum region_kind get_kind () const FINAL OVERRIDE { return RK_UNKNOWN; }
-
- void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
-};
-
/* A class responsible for owning and consolidating region and svalue
instances.
region and svalue instances are immutable as far as clients are
@@ -2795,6 +681,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. */
@@ -2821,6 +710,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
diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc
index 0820893..cce366d 100644
--- a/gcc/analyzer/region.cc
+++ b/gcc/analyzer/region.cc
@@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see
#include "analyzer/call-string.h"
#include "analyzer/program-point.h"
#include "analyzer/store.h"
+#include "analyzer/region.h"
#include "analyzer/region-model.h"
#if ENABLE_ANALYZER
@@ -517,10 +518,11 @@ region::region (complexity c, unsigned id, const region *parent, tree type)
gcc_assert (type == NULL_TREE || TYPE_P (type));
}
-/* Comparator for regions, using their IDs to order them. */
+/* Comparator for use by vec<const region *>::qsort,
+ using their IDs to order them. */
int
-region::cmp_ptrs (const void *p1, const void *p2)
+region::cmp_ptr_ptr (const void *p1, const void *p2)
{
const region * const *reg1 = (const region * const *)p1;
const region * const *reg2 = (const region * const *)p2;
@@ -824,6 +826,16 @@ root_region::dump_to_pp (pretty_printer *pp, bool simple) const
/* class symbolic_region : public map_region. */
+/* symbolic_region's ctor. */
+
+symbolic_region::symbolic_region (unsigned id, region *parent,
+ const svalue *sval_ptr)
+: region (complexity::from_pair (parent, sval_ptr), id, parent,
+ TREE_TYPE (sval_ptr->get_type ())),
+ m_sval_ptr (sval_ptr)
+{
+}
+
/* Implementation of region::accept vfunc for symbolic_region. */
void
@@ -927,7 +939,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
@@ -935,12 +949,25 @@ 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. */
+ /* If we have an "extern" decl then there may be an initializer in
+ another TU. */
+ if (DECL_EXTERNAL (m_decl))
+ return NULL;
+
+ /* 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);
@@ -1119,9 +1146,12 @@ string_region::dump_to_pp (pretty_printer *pp, bool simple) const
{
pp_string (pp, "string_region(");
dump_tree (pp, m_string_cst);
- pp_string (pp, " (");
- pp_pointer (pp, m_string_cst);
- pp_string (pp, "))");
+ if (!flag_dump_noaddr)
+ {
+ pp_string (pp, " (");
+ pp_pointer (pp, m_string_cst);
+ pp_string (pp, "))");
+ }
}
}
diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h
new file mode 100644
index 0000000..8430650
--- /dev/null
+++ b/gcc/analyzer/region.h
@@ -0,0 +1,1017 @@
+/* Regions of memory.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_ANALYZER_REGION_H
+#define GCC_ANALYZER_REGION_H
+
+#include "analyzer/complexity.h"
+
+namespace ana {
+
+/* An enum for discriminating between the different concrete subclasses
+ of region. */
+
+enum region_kind
+{
+ RK_FRAME,
+ RK_GLOBALS,
+ RK_CODE,
+ RK_FUNCTION,
+ RK_LABEL,
+ RK_STACK,
+ RK_HEAP,
+ RK_ROOT,
+ RK_SYMBOLIC,
+ RK_DECL,
+ RK_FIELD,
+ RK_ELEMENT,
+ RK_OFFSET,
+ RK_CAST,
+ RK_HEAP_ALLOCATED,
+ RK_ALLOCA,
+ RK_STRING,
+ RK_UNKNOWN
+};
+
+/* Region and its subclasses.
+
+ The class hierarchy looks like this (using indentation to show
+ inheritance, and with region_kinds shown for the concrete subclasses):
+
+ region
+ space_region
+ frame_region (RK_FRAME)
+ globals_region (RK_GLOBALS)
+ code_region (RK_CODE)
+ stack_region (RK_STACK)
+ heap_region (RK_HEAP)
+ root_region (RK_ROOT)
+ function_region (RK_FUNCTION)
+ label_region (RK_LABEL)
+ symbolic_region (RK_SYMBOLIC)
+ decl_region (RK_DECL),
+ field_region (RK_FIELD)
+ element_region (RK_ELEMENT)
+ offset_region (RK_OFFSET)
+ cast_region (RK_CAST)
+ heap_allocated_region (RK_HEAP_ALLOCATED)
+ alloca_region (RK_ALLOCA)
+ string_region (RK_STRING)
+ unknown_region (RK_UNKNOWN). */
+
+/* Abstract base class for representing ways of accessing chunks of memory.
+
+ Regions form a tree-like hierarchy, with a root region at the base,
+ with memory space regions within it, representing the stack and
+ globals, with frames within the stack, and regions for variables
+ within the frames and the "globals" region. Regions for structs
+ can have subregions for fields. */
+
+class region
+{
+public:
+ virtual ~region ();
+
+ unsigned get_id () const { return m_id; }
+ static int cmp_ids (const region *reg1, const region *reg2);
+
+ virtual enum region_kind get_kind () const = 0;
+ virtual const frame_region *
+ dyn_cast_frame_region () const { return NULL; }
+ virtual const function_region *
+ dyn_cast_function_region () const { return NULL; }
+ virtual const symbolic_region *
+ dyn_cast_symbolic_region () const { return NULL; }
+ virtual const decl_region *
+ dyn_cast_decl_region () const { return NULL; }
+ virtual const field_region *
+ dyn_cast_field_region () const { return NULL; }
+ virtual const element_region *
+ dyn_cast_element_region () const { return NULL; }
+ virtual const offset_region *
+ dyn_cast_offset_region () const { return NULL; }
+ virtual const cast_region *
+ dyn_cast_cast_region () const { return NULL; }
+ virtual const string_region *
+ dyn_cast_string_region () const { return NULL; }
+
+ virtual void accept (visitor *v) const;
+
+ const region *get_parent_region () const { return m_parent; }
+ const region *get_base_region () const;
+ bool base_region_p () const;
+ bool descendent_of_p (const region *elder) const;
+ const frame_region *maybe_get_frame_region () const;
+
+ tree maybe_get_decl () const;
+
+ tree get_type () const { return m_type; }
+
+ void print (const region_model &model,
+ pretty_printer *pp) const;
+ label_text get_desc (bool simple=true) const;
+
+ void dump_to_pp (const region_model &model,
+ pretty_printer *pp,
+ const char *prefix,
+ bool is_last_child) const;
+
+ 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_ptr_ptr (const void *, const void *);
+
+ region_offset get_offset () const;
+ bool get_byte_size (byte_size_t *out) const;
+ bool get_bit_size (bit_size_t *out) const;
+
+ void
+ get_subregions_for_binding (region_model_manager *mgr,
+ bit_offset_t start_bit_offset,
+ bit_size_t size_in_bits,
+ tree type,
+ auto_vec <const region *> *out) const;
+
+ bool symbolic_for_unknown_ptr_p () const;
+
+ const complexity &get_complexity () const { return m_complexity; }
+
+ protected:
+ region (complexity c, unsigned id, const region *parent, tree type);
+
+ private:
+ region_offset calc_offset () const;
+
+ complexity m_complexity;
+ unsigned m_id; // purely for deterministic sorting at this stage, for dumps
+ const region *m_parent;
+ tree m_type;
+
+ mutable region_offset *m_cached_offset;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const region *>::test (const region *)
+{
+ return true;
+}
+
+namespace ana {
+
+/* Abstract subclass of region, for regions that represent an untyped
+ space within memory, such as the stack or the heap. */
+
+class space_region : public region
+{
+protected:
+ space_region (unsigned id, const region *parent)
+ : region (complexity (parent), id, parent, NULL_TREE)
+ {}
+};
+
+/* Concrete space_region subclass, representing a function frame on the stack,
+ to contain the locals.
+ The parent is the stack region; there's also a hierarchy of call-stack
+ prefixes expressed via m_calling_frame.
+ For example, given "oldest" calling "middle" called "newest" we would have
+ - a stack depth of 3
+ - frame (A) for "oldest" with index 0 for depth 1, calling_frame == NULL
+ - frame (B) for "middle" with index 1 for depth 2, calling_frame == (A)
+ - frame (C) for "newest" with index 2 for depth 3, calling_frame == (B)
+ where the parent region for each of the frames is the "stack" region.
+ The index is the count of frames earlier than this in the stack. */
+
+class frame_region : public space_region
+{
+public:
+ /* A support class for uniquifying instances of frame_region. */
+ struct key_t
+ {
+ key_t (const frame_region *calling_frame, function *fun)
+ : m_calling_frame (calling_frame), m_fun (fun)
+ {
+ /* calling_frame can be NULL. */
+ gcc_assert (fun);
+ }
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_calling_frame);
+ hstate.add_ptr (m_fun);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_calling_frame == other.m_calling_frame && m_fun == other.m_fun);
+ }
+
+ void mark_deleted () { m_fun = reinterpret_cast<function *> (1); }
+ void mark_empty () { m_fun = NULL; }
+ bool is_deleted () const
+ {
+ return m_fun == reinterpret_cast<function *> (1);
+ }
+ bool is_empty () const { return m_fun == NULL; }
+
+ const frame_region *m_calling_frame;
+ function *m_fun;
+ };
+
+ frame_region (unsigned id, const region *parent,
+ const frame_region *calling_frame,
+ function *fun, int index)
+ : space_region (id, parent), m_calling_frame (calling_frame),
+ m_fun (fun), m_index (index)
+ {}
+ ~frame_region ();
+
+ /* region vfuncs. */
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_FRAME; }
+ const frame_region * dyn_cast_frame_region () const FINAL OVERRIDE
+ {
+ return this;
+ }
+ void accept (visitor *v) const FINAL OVERRIDE;
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ /* Accessors. */
+ const frame_region *get_calling_frame () const { return m_calling_frame; }
+ function *get_function () const { return m_fun; }
+ int get_index () const { return m_index; }
+ int get_stack_depth () const { return m_index + 1; }
+
+ const decl_region *get_region_for_local (region_model_manager *mgr,
+ tree expr) const;
+
+ unsigned get_num_locals () const { return m_locals.elements (); }
+
+ private:
+ const frame_region *m_calling_frame;
+ function *m_fun;
+ int m_index;
+
+ /* The regions for the decls within this frame are managed by this
+ object, rather than the region_model_manager, to make it a simple
+ lookup by tree. */
+ typedef hash_map<tree, decl_region *> map_t;
+ map_t m_locals;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const frame_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_FRAME;
+}
+
+template <> struct default_hash_traits<frame_region::key_t>
+: public member_function_hash_traits<frame_region::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete space_region subclass, to hold global variables (data and bss). */
+
+class globals_region : public space_region
+{
+ public:
+ globals_region (unsigned id, const region *parent)
+ : space_region (id, parent)
+ {}
+
+ /* region vfuncs. */
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_GLOBALS; }
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const globals_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_GLOBALS;
+}
+
+namespace ana {
+
+/* Concrete space_region subclass, representing the code segment
+ containing functions. */
+
+class code_region : public space_region
+{
+public:
+ code_region (unsigned id, const region *parent)
+ : space_region (id, parent)
+ {}
+
+ /* region vfuncs. */
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_CODE; }
+
+ const region *get_element (region_model *model,
+ const svalue *index,
+ region_model_context *ctxt);
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const code_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_CODE;
+}
+
+namespace ana {
+
+/* Concrete region subclass. A region representing the code for
+ a particular function. */
+
+class function_region : public region
+{
+public:
+ function_region (unsigned id, const code_region *parent, tree fndecl)
+ : region (complexity (parent), id, parent, TREE_TYPE (fndecl)),
+ m_fndecl (fndecl)
+ {
+ gcc_assert (FUNC_OR_METHOD_TYPE_P (TREE_TYPE (fndecl)));
+ }
+
+ /* region vfuncs. */
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_FUNCTION; }
+ const function_region *
+ dyn_cast_function_region () const FINAL OVERRIDE{ return this; }
+
+ tree get_fndecl () const { return m_fndecl; }
+
+ region *get_element (region_model *model,
+ const svalue *index_sid,
+ region_model_context *ctxt);
+
+private:
+ tree m_fndecl;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const function_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_FUNCTION;
+}
+
+namespace ana {
+
+/* Concrete region subclass. A region representing a particular label
+ within a function. */
+
+class label_region : public region
+{
+public:
+ label_region (unsigned id, const function_region *parent, tree label)
+ : region (complexity (parent), id, parent, NULL_TREE), m_label (label)
+ {
+ gcc_assert (TREE_CODE (label) == LABEL_DECL);
+ }
+
+ /* region vfuncs. */
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_LABEL; }
+
+ tree get_label () const { return m_label; }
+
+private:
+ tree m_label;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const label_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_LABEL;
+}
+
+namespace ana {
+
+/* Concrete space_region subclass representing a stack, containing all stack
+ frames. */
+
+class stack_region : public space_region
+{
+public:
+ stack_region (unsigned id, region *parent)
+ : space_region (id, parent)
+ {}
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_STACK; }
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const stack_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_STACK;
+}
+
+namespace ana {
+
+/* Concrete space_region subclass: a region within which regions can be
+ dynamically allocated. */
+
+class heap_region : public space_region
+{
+public:
+ heap_region (unsigned id, region *parent)
+ : space_region (id, parent)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_HEAP; }
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const heap_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_HEAP;
+}
+
+namespace ana {
+
+/* Concrete region subclass. The root region, containing all regions
+ (either directly, or as descendents).
+ Unique within a region_model_manager. */
+
+class root_region : public region
+{
+public:
+ root_region (unsigned id);
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_ROOT; }
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const root_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_ROOT;
+}
+
+namespace ana {
+
+/* Concrete region subclass: a region to use when dereferencing an unknown
+ pointer. */
+
+class symbolic_region : public region
+{
+public:
+ /* A support class for uniquifying instances of symbolic_region. */
+ struct key_t
+ {
+ key_t (const region *parent, const svalue *sval_ptr)
+ : m_parent (parent), m_sval_ptr (sval_ptr)
+ {
+ gcc_assert (sval_ptr);
+ }
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_parent);
+ hstate.add_ptr (m_sval_ptr);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_parent == other.m_parent && m_sval_ptr == other.m_sval_ptr);
+ }
+
+ void mark_deleted () { m_sval_ptr = reinterpret_cast<const svalue *> (1); }
+ void mark_empty () { m_sval_ptr = NULL; }
+ bool is_deleted () const
+ {
+ return m_sval_ptr == reinterpret_cast<const svalue *> (1);
+ }
+ bool is_empty () const { return m_sval_ptr == NULL; }
+
+ const region *m_parent;
+ const svalue *m_sval_ptr;
+ };
+
+ symbolic_region (unsigned id, region *parent, const svalue *sval_ptr);
+
+ const symbolic_region *
+ dyn_cast_symbolic_region () const FINAL OVERRIDE { return this; }
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_SYMBOLIC; }
+ void accept (visitor *v) const FINAL OVERRIDE;
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ const svalue *get_pointer () const { return m_sval_ptr; }
+
+private:
+ const svalue *m_sval_ptr;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const symbolic_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_SYMBOLIC;
+}
+
+template <> struct default_hash_traits<symbolic_region::key_t>
+: public member_function_hash_traits<symbolic_region::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete region subclass representing the memory occupied by a
+ variable (whether for a global or a local). */
+
+class decl_region : public region
+{
+public:
+ decl_region (unsigned id, const region *parent, tree decl)
+ : region (complexity (parent), id, parent, TREE_TYPE (decl)), m_decl (decl)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_DECL; }
+ const decl_region *
+ dyn_cast_decl_region () const FINAL OVERRIDE { return this; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ tree get_decl () const { return m_decl; }
+ int get_stack_depth () const;
+
+ const svalue *maybe_get_constant_value (region_model_manager *mgr) const;
+ const svalue *get_svalue_for_constructor (tree ctor,
+ region_model_manager *mgr) const;
+ const svalue *get_svalue_for_initializer (region_model_manager *mgr) const;
+
+private:
+ tree m_decl;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const decl_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_DECL;
+}
+
+namespace ana {
+
+/* Concrete region subclass representing the memory occupied by a
+ field within a struct or union. */
+
+class field_region : public region
+{
+public:
+ /* A support class for uniquifying instances of field_region. */
+ struct key_t
+ {
+ key_t (const region *parent, tree field)
+ : m_parent (parent), m_field (field)
+ {
+ gcc_assert (field);
+ }
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_parent);
+ hstate.add_ptr (m_field);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_parent == other.m_parent && m_field == other.m_field);
+ }
+
+ void mark_deleted () { m_field = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_field = NULL_TREE; }
+ bool is_deleted () const { return m_field == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_field == NULL_TREE; }
+
+ const region *m_parent;
+ tree m_field;
+ };
+
+ field_region (unsigned id, const region *parent, tree field)
+ : region (complexity (parent), id, parent, TREE_TYPE (field)),
+ m_field (field)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_FIELD; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ const field_region *
+ dyn_cast_field_region () const FINAL OVERRIDE { return this; }
+
+ tree get_field () const { return m_field; }
+
+private:
+ tree m_field;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const field_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_FIELD;
+}
+
+template <> struct default_hash_traits<field_region::key_t>
+: public member_function_hash_traits<field_region::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* An element within an array. */
+
+class element_region : public region
+{
+public:
+ /* A support class for uniquifying instances of element_region. */
+ struct key_t
+ {
+ key_t (const region *parent, tree element_type, const svalue *index)
+ : m_parent (parent), m_element_type (element_type), m_index (index)
+ {
+ gcc_assert (index);
+ }
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_parent);
+ hstate.add_ptr (m_element_type);
+ hstate.add_ptr (m_index);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_parent == other.m_parent
+ && m_element_type == other.m_element_type
+ && m_index == other.m_index);
+ }
+
+ void mark_deleted () { m_index = reinterpret_cast<const svalue *> (1); }
+ void mark_empty () { m_index = NULL; }
+ bool is_deleted () const
+ {
+ return m_index == reinterpret_cast<const svalue *> (1);
+ }
+ bool is_empty () const { return m_index == NULL; }
+
+ const region *m_parent;
+ tree m_element_type;
+ const svalue *m_index;
+ };
+
+ element_region (unsigned id, const region *parent, tree element_type,
+ const svalue *index)
+ : region (complexity::from_pair (parent, index), id, parent, element_type),
+ m_index (index)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_ELEMENT; }
+ const element_region *
+ dyn_cast_element_region () const FINAL OVERRIDE { return this; }
+
+ void accept (visitor *v) const FINAL OVERRIDE;
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ const svalue *get_index () const { return m_index; }
+
+private:
+ const svalue *m_index;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const element_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_ELEMENT;
+}
+
+template <> struct default_hash_traits<element_region::key_t>
+: public member_function_hash_traits<element_region::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* A byte-offset within another region, for handling pointer arithmetic
+ as a region. */
+
+class offset_region : public region
+{
+public:
+ /* A support class for uniquifying instances of offset_region. */
+ struct key_t
+ {
+ key_t (const region *parent, tree element_type, const svalue *byte_offset)
+ : m_parent (parent), m_element_type (element_type), m_byte_offset (byte_offset)
+ {
+ gcc_assert (byte_offset);
+ }
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_parent);
+ hstate.add_ptr (m_element_type);
+ hstate.add_ptr (m_byte_offset);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_parent == other.m_parent
+ && m_element_type == other.m_element_type
+ && m_byte_offset == other.m_byte_offset);
+ }
+
+ void mark_deleted () { m_byte_offset = reinterpret_cast<const svalue *> (1); }
+ void mark_empty () { m_byte_offset = NULL; }
+ bool is_deleted () const
+ {
+ return m_byte_offset == reinterpret_cast<const svalue *> (1);
+ }
+ bool is_empty () const { return m_byte_offset == NULL; }
+
+ const region *m_parent;
+ tree m_element_type;
+ const svalue *m_byte_offset;
+ };
+
+ offset_region (unsigned id, const region *parent, tree type,
+ const svalue *byte_offset)
+ : region (complexity::from_pair (parent, byte_offset), id, parent, type),
+ m_byte_offset (byte_offset)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_OFFSET; }
+ const offset_region *
+ dyn_cast_offset_region () const FINAL OVERRIDE { return this; }
+
+ void accept (visitor *v) const FINAL OVERRIDE;
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ const svalue *get_byte_offset () const { return m_byte_offset; }
+
+private:
+ const svalue *m_byte_offset;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const offset_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_OFFSET;
+}
+
+template <> struct default_hash_traits<offset_region::key_t>
+: public member_function_hash_traits<offset_region::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* A region that views another region using a different type. */
+
+class cast_region : public region
+{
+public:
+ /* A support class for uniquifying instances of cast_region. */
+ struct key_t
+ {
+ key_t (const region *original_region, tree type)
+ : m_original_region (original_region), m_type (type)
+ {
+ gcc_assert (type);
+ }
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_original_region);
+ hstate.add_ptr (m_type);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_original_region == other.m_original_region
+ && m_type == other.m_type);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ const region *m_original_region;
+ tree m_type;
+ };
+
+ cast_region (unsigned id, const region *original_region, tree type)
+ : region (complexity (original_region), id,
+ original_region->get_parent_region (), type),
+ m_original_region (original_region)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_CAST; }
+ const cast_region *
+ dyn_cast_cast_region () const FINAL OVERRIDE { return this; }
+ void accept (visitor *v) const FINAL OVERRIDE;
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ const region *get_original_region () const { return m_original_region; }
+
+private:
+ const region *m_original_region;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const cast_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_CAST;
+}
+
+template <> struct default_hash_traits<cast_region::key_t>
+: public member_function_hash_traits<cast_region::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* An untyped region dynamically allocated on the heap via "malloc"
+ or similar. */
+
+class heap_allocated_region : public region
+{
+public:
+ heap_allocated_region (unsigned id, const region *parent)
+ : region (complexity (parent), id, parent, NULL_TREE)
+ {}
+
+ enum region_kind
+ get_kind () const FINAL OVERRIDE { return RK_HEAP_ALLOCATED; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+};
+
+/* An untyped region dynamically allocated on the stack via "alloca". */
+
+class alloca_region : public region
+{
+public:
+ alloca_region (unsigned id, const frame_region *parent)
+ : region (complexity (parent), id, parent, NULL_TREE)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_ALLOCA; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+};
+
+/* A region for a STRING_CST. */
+
+class string_region : public region
+{
+public:
+ string_region (unsigned id, const region *parent, tree string_cst)
+ : region (complexity (parent), id, parent, TREE_TYPE (string_cst)),
+ m_string_cst (string_cst)
+ {}
+
+ const string_region *
+ dyn_cast_string_region () const FINAL OVERRIDE { return this; }
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_STRING; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+
+ tree get_string_cst () const { return m_string_cst; }
+
+private:
+ tree m_string_cst;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const string_region *>::test (const region *reg)
+{
+ return reg->get_kind () == RK_STRING;
+}
+
+namespace ana {
+
+/* An unknown region, for handling unimplemented tree codes. */
+
+class unknown_region : public region
+{
+public:
+ unknown_region (unsigned id, const region *parent, tree type)
+ : region (complexity (parent), id, parent, type)
+ {}
+
+ enum region_kind get_kind () const FINAL OVERRIDE { return RK_UNKNOWN; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+};
+
+} // namespace ana
+
+#endif /* GCC_ANALYZER_REGION_H */
diff --git a/gcc/analyzer/state-purge.cc b/gcc/analyzer/state-purge.cc
index e4942a6..418d80c 100644
--- a/gcc/analyzer/state-purge.cc
+++ b/gcc/analyzer/state-purge.cc
@@ -209,13 +209,21 @@ state_purge_per_ssa_name::state_purge_per_ssa_name (const state_purge_map &map,
if (map.get_logger ())
{
map.log ("%qE in %qD is needed to process:", name, fun->decl);
+ /* Log m_points_needing_name, sorting it to avoid churn when comparing
+ dumps. */
+ auto_vec<function_point> points;
for (point_set_t::iterator iter = m_points_needing_name.begin ();
iter != m_points_needing_name.end ();
++iter)
+ points.safe_push (*iter);
+ points.qsort (function_point::cmp_ptr);
+ unsigned i;
+ function_point *point;
+ FOR_EACH_VEC_ELT (points, i, point)
{
map.start_log_line ();
map.get_logger ()->log_partial (" point: ");
- (*iter).print (map.get_logger ()->get_printer (), format (false));
+ point->print (map.get_logger ()->get_printer (), format (false));
map.end_log_line ();
}
}
diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc
index 1158512..05dd47d 100644
--- a/gcc/analyzer/store.cc
+++ b/gcc/analyzer/store.cc
@@ -208,6 +208,23 @@ concrete_binding::overlaps_p (const concrete_binding &other) const
return false;
}
+/* Comparator for use by vec<const concrete_binding *>::qsort. */
+
+int
+concrete_binding::cmp_ptr_ptr (const void *p1, const void *p2)
+{
+ const concrete_binding *b1 = *(const concrete_binding * const *)p1;
+ const concrete_binding *b2 = *(const concrete_binding * const *)p2;
+
+ if (int kind_cmp = b1->get_kind () - b2->get_kind ())
+ return kind_cmp;
+
+ if (int start_cmp = wi::cmps (b1->m_start_bit_offset, b2->m_start_bit_offset))
+ return start_cmp;
+
+ return wi::cmpu (b1->m_size_in_bits, b2->m_size_in_bits);
+}
+
/* class symbolic_binding : public binding_key. */
void
@@ -218,6 +235,20 @@ symbolic_binding::dump_to_pp (pretty_printer *pp, bool simple) const
m_region->dump_to_pp (pp, simple);
}
+/* Comparator for use by vec<const symbolic_binding *>::qsort. */
+
+int
+symbolic_binding::cmp_ptr_ptr (const void *p1, const void *p2)
+{
+ const symbolic_binding *b1 = *(const symbolic_binding * const *)p1;
+ const symbolic_binding *b2 = *(const symbolic_binding * const *)p2;
+
+ if (int kind_cmp = b1->get_kind () - b2->get_kind ())
+ return kind_cmp;
+
+ return region::cmp_ids (b1->get_region (), b2->get_region ());
+}
+
/* The store is oblivious to the types of the svalues bound within
it: any type can get bound at any location.
Simplify any casts before binding.
@@ -409,6 +440,40 @@ binding_map::to_json () const
return map_obj;
}
+/* Comparator for imposing an order on binding_maps. */
+
+int
+binding_map::cmp (const binding_map &map1, const binding_map &map2)
+{
+ if (int count_cmp = map1.elements () - map2.elements ())
+ return count_cmp;
+
+ auto_vec <const binding_key *> keys1 (map1.elements ());
+ for (map_t::iterator iter = map1.begin ();
+ iter != map1.end (); ++iter)
+ keys1.quick_push ((*iter).first);
+ keys1.qsort (binding_key::cmp_ptrs);
+
+ auto_vec <const binding_key *> keys2 (map2.elements ());
+ for (map_t::iterator iter = map2.begin ();
+ iter != map2.end (); ++iter)
+ keys2.quick_push ((*iter).first);
+ keys2.qsort (binding_key::cmp_ptrs);
+
+ for (size_t i = 0; i < keys1.length (); i++)
+ {
+ const binding_key *k1 = keys1[i];
+ const binding_key *k2 = keys2[i];
+ if (int key_cmp = binding_key::cmp (k1, k2))
+ return key_cmp;
+ gcc_assert (k1 == k2);
+ if (int sval_cmp = svalue::cmp_ptr (map1.get (k1), map2.get (k2)))
+ return sval_cmp;
+ }
+
+ return 0;
+}
+
/* Get the child region of PARENT_REG based upon INDEX within a
CONSTRUCTOR. */
@@ -455,7 +520,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;
@@ -1513,7 +1577,7 @@ get_sorted_parent_regions (auto_vec<const region *> *out,
out->safe_push (*iter);
/* Sort OUT. */
- out->qsort (region::cmp_ptrs);
+ out->qsort (region::cmp_ptr_ptr);
}
/* Dump a representation of this store to PP, using SIMPLE to control how
@@ -1533,7 +1597,7 @@ store::dump_to_pp (pretty_printer *pp, bool simple, bool multiline,
const region *base_reg = (*iter).first;
base_regions.safe_push (base_reg);
}
- base_regions.qsort (region::cmp_ptrs);
+ base_regions.qsort (region::cmp_ptr_ptr);
/* Gather clusters, organize by parent region, so that we can group
together locals, globals, etc. */
@@ -1654,7 +1718,7 @@ store::to_json () const
const region *base_reg = (*iter).first;
base_regions.safe_push (base_reg);
}
- base_regions.qsort (region::cmp_ptrs);
+ base_regions.qsort (region::cmp_ptr_ptr);
/* Gather clusters, organize by parent region, so that we can group
together locals, globals, etc. */
@@ -1992,10 +2056,19 @@ store::can_merge_p (const store *store_a, const store *store_b,
base_regions.add (base_reg_b);
}
+ /* Sort the base regions before considering them. This ought not to
+ affect the results, but can affect which types UNKNOWN_REGIONs are
+ created for in a run; sorting them thus avoids minor differences
+ in logfiles. */
+ auto_vec<const region *> vec_base_regions (base_regions.elements ());
for (hash_set<const region *>::iterator iter = base_regions.begin ();
iter != base_regions.end (); ++iter)
+ vec_base_regions.quick_push (*iter);
+ vec_base_regions.qsort (region::cmp_ptr_ptr);
+ unsigned i;
+ const region *base_reg;
+ FOR_EACH_VEC_ELT (vec_base_regions, i, base_reg)
{
- const region *base_reg = *iter;
const binding_cluster *cluster_a = store_a->get_cluster (base_reg);
const binding_cluster *cluster_b = store_b->get_cluster (base_reg);
/* At least one of cluster_a and cluster_b must be non-NULL. */
diff --git a/gcc/analyzer/store.h b/gcc/analyzer/store.h
index 0f4e7ab..8054b34 100644
--- a/gcc/analyzer/store.h
+++ b/gcc/analyzer/store.h
@@ -237,6 +237,8 @@ public:
bool overlaps_p (const concrete_binding &other) const;
+ static int cmp_ptr_ptr (const void *, const void *);
+
private:
bit_offset_t m_start_bit_offset;
bit_size_t m_size_in_bits;
@@ -269,7 +271,7 @@ public:
hashval_t hash () const
{
- return (binding_key::impl_hash () ^ (long)m_region);
+ return (binding_key::impl_hash () ^ (intptr_t)m_region);
}
bool operator== (const symbolic_binding &other) const
{
@@ -282,6 +284,8 @@ public:
const region *get_region () const { return m_region; }
+ static int cmp_ptr_ptr (const void *, const void *);
+
private:
const region *m_region;
};
@@ -346,6 +350,8 @@ public:
bool apply_ctor_to_region (const region *parent_reg, tree ctor,
region_model_manager *mgr);
+ static int cmp (const binding_map &map1, const binding_map &map2);
+
private:
bool apply_ctor_val_to_range (const region *parent_reg,
region_model_manager *mgr,
diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc
index 735c4a3..37f143c 100644
--- a/gcc/analyzer/supergraph.cc
+++ b/gcc/analyzer/supergraph.cc
@@ -90,7 +90,8 @@ supergraph_call_edge (function *fun, gimple *stmt)
/* supergraph's ctor. Walk the callgraph, building supernodes for each
CFG basic block, splitting the basic blocks at callsites. Join
together the supernodes with interprocedural and intraprocedural
- superedges as appropriate. */
+ superedges as appropriate.
+ Assign UIDs to the gimple stmts. */
supergraph::supergraph (logger *logger)
{
@@ -98,8 +99,10 @@ supergraph::supergraph (logger *logger)
LOG_FUNC (logger);
- /* First pass: make supernodes. */
+ /* First pass: make supernodes (and assign UIDs to the gimple stmts). */
{
+ unsigned next_uid = 0;
+
/* Sort the cgraph_nodes? */
cgraph_node *node;
FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
@@ -124,6 +127,7 @@ supergraph::supergraph (logger *logger)
{
gimple *stmt = gsi_stmt (gpi);
m_stmt_to_node_t.put (stmt, node_for_stmts);
+ stmt->uid = next_uid++;
}
/* Append statements from BB to the current supernode, splitting
@@ -135,6 +139,7 @@ supergraph::supergraph (logger *logger)
gimple *stmt = gsi_stmt (gsi);
node_for_stmts->m_stmts.safe_push (stmt);
m_stmt_to_node_t.put (stmt, node_for_stmts);
+ stmt->uid = next_uid++;
if (cgraph_edge *edge = supergraph_call_edge (fun, stmt))
{
m_cgraph_edge_to_caller_prev_node.put(edge, node_for_stmts);
diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc
index ae3b678..e930452 100644
--- a/gcc/analyzer/svalue.cc
+++ b/gcc/analyzer/svalue.cc
@@ -52,42 +52,13 @@ along with GCC; see the file COPYING3. If not see
#include "analyzer/call-string.h"
#include "analyzer/program-point.h"
#include "analyzer/store.h"
+#include "analyzer/svalue.h"
#include "analyzer/region-model.h"
#if ENABLE_ANALYZER
namespace ana {
-/* struct complexity. */
-
-/* Get complexity for a new node that references REG
- (the complexity of REG, plus one for the new node). */
-
-complexity::complexity (const region *reg)
-: m_num_nodes (reg->get_complexity ().m_num_nodes + 1),
- m_max_depth (reg->get_complexity ().m_max_depth + 1)
-{
-}
-
-/* Get complexity for a new node that references SVAL.
- (the complexity of SVAL, plus one for the new node). */
-
-complexity::complexity (const svalue *sval)
-: m_num_nodes (sval->get_complexity ().m_num_nodes + 1),
- m_max_depth (sval->get_complexity ().m_max_depth + 1)
-{
-}
-
-/* Get complexity for a new node that references nodes with complexity
- C1 and C2. */
-
-complexity
-complexity::from_pair (const complexity &c1, const complexity &c2)
-{
- return complexity (c1.m_num_nodes + c2.m_num_nodes + 1,
- MAX (c1.m_max_depth, c2.m_max_depth) + 1);
-}
-
/* class svalue and its various subclasses. */
/* class svalue. */
@@ -298,6 +269,215 @@ svalue::implicitly_live_p (const svalue_set &, const region_model *) const
return false;
}
+/* Comparator for imposing a deterministic order on constants that are
+ of the same type. */
+
+static int
+cmp_cst (const_tree cst1, const_tree cst2)
+{
+ gcc_assert (TREE_TYPE (cst1) == TREE_TYPE (cst2));
+ gcc_assert (TREE_CODE (cst1) == TREE_CODE (cst2));
+ switch (TREE_CODE (cst1))
+ {
+ default:
+ gcc_unreachable ();
+ case INTEGER_CST:
+ return tree_int_cst_compare (cst1, cst2);
+ case STRING_CST:
+ return strcmp (TREE_STRING_POINTER (cst1),
+ TREE_STRING_POINTER (cst2));
+ case REAL_CST:
+ /* Impose an arbitrary but deterministic order. */
+ return memcmp (TREE_REAL_CST_PTR (cst1),
+ TREE_REAL_CST_PTR (cst2),
+ sizeof (real_value));
+ case COMPLEX_CST:
+ if (int cmp_real = cmp_cst (TREE_REALPART (cst1), TREE_REALPART (cst2)))
+ return cmp_real;
+ return cmp_cst (TREE_IMAGPART (cst1), TREE_IMAGPART (cst2));
+ case VECTOR_CST:
+ if (int cmp_log2_npatterns
+ = ((int)VECTOR_CST_LOG2_NPATTERNS (cst1)
+ - (int)VECTOR_CST_LOG2_NPATTERNS (cst2)))
+ return cmp_log2_npatterns;
+ if (int cmp_nelts_per_pattern
+ = ((int)VECTOR_CST_NELTS_PER_PATTERN (cst1)
+ - (int)VECTOR_CST_NELTS_PER_PATTERN (cst2)))
+ return cmp_nelts_per_pattern;
+ unsigned encoded_nelts = vector_cst_encoded_nelts (cst1);
+ for (unsigned i = 0; i < encoded_nelts; i++)
+ if (int el_cmp = cmp_cst (VECTOR_CST_ENCODED_ELT (cst1, i),
+ VECTOR_CST_ENCODED_ELT (cst2, i)))
+ return el_cmp;
+ return 0;
+ }
+}
+
+/* Comparator for imposing a deterministic order on svalues. */
+
+int
+svalue::cmp_ptr (const svalue *sval1, const svalue *sval2)
+{
+ if (sval1 == sval2)
+ return 0;
+ if (int cmp_kind = sval1->get_kind () - sval2->get_kind ())
+ return cmp_kind;
+ int t1 = sval1->get_type () ? TYPE_UID (sval1->get_type ()) : -1;
+ int t2 = sval2->get_type () ? TYPE_UID (sval2->get_type ()) : -1;
+ if (int cmp_type = t1 - t2)
+ return cmp_type;
+ switch (sval1->get_kind ())
+ {
+ default:
+ gcc_unreachable ();
+ case SK_REGION:
+ {
+ const region_svalue *region_sval1 = (const region_svalue *)sval1;
+ const region_svalue *region_sval2 = (const region_svalue *)sval2;
+ return region::cmp_ids (region_sval1->get_pointee (),
+ region_sval2->get_pointee ());
+ }
+ break;
+ case SK_CONSTANT:
+ {
+ const constant_svalue *constant_sval1 = (const constant_svalue *)sval1;
+ const constant_svalue *constant_sval2 = (const constant_svalue *)sval2;
+ const_tree cst1 = constant_sval1->get_constant ();
+ const_tree cst2 = constant_sval2->get_constant ();
+ return cmp_cst (cst1, cst2);
+ }
+ break;
+ case SK_UNKNOWN:
+ {
+ gcc_assert (sval1 == sval2);
+ return 0;
+ }
+ break;
+ case SK_POISONED:
+ {
+ const poisoned_svalue *poisoned_sval1 = (const poisoned_svalue *)sval1;
+ const poisoned_svalue *poisoned_sval2 = (const poisoned_svalue *)sval2;
+ return (poisoned_sval1->get_poison_kind ()
+ - poisoned_sval2->get_poison_kind ());
+ }
+ break;
+ case SK_SETJMP:
+ {
+ const setjmp_svalue *setjmp_sval1 = (const setjmp_svalue *)sval1;
+ const setjmp_svalue *setjmp_sval2 = (const setjmp_svalue *)sval2;
+ const setjmp_record &rec1 = setjmp_sval1->get_setjmp_record ();
+ const setjmp_record &rec2 = setjmp_sval2->get_setjmp_record ();
+ return setjmp_record::cmp (rec1, rec2);
+ }
+ break;
+ case SK_INITIAL:
+ {
+ const initial_svalue *initial_sval1 = (const initial_svalue *)sval1;
+ const initial_svalue *initial_sval2 = (const initial_svalue *)sval2;
+ return region::cmp_ids (initial_sval1->get_region (),
+ initial_sval2->get_region ());
+ }
+ break;
+ case SK_UNARYOP:
+ {
+ const unaryop_svalue *unaryop_sval1 = (const unaryop_svalue *)sval1;
+ const unaryop_svalue *unaryop_sval2 = (const unaryop_svalue *)sval2;
+ if (int op_cmp = unaryop_sval1->get_op () - unaryop_sval2->get_op ())
+ return op_cmp;
+ return svalue::cmp_ptr (unaryop_sval1->get_arg (),
+ unaryop_sval2->get_arg ());
+ }
+ break;
+ case SK_BINOP:
+ {
+ const binop_svalue *binop_sval1 = (const binop_svalue *)sval1;
+ const binop_svalue *binop_sval2 = (const binop_svalue *)sval2;
+ if (int op_cmp = binop_sval1->get_op () - binop_sval2->get_op ())
+ return op_cmp;
+ if (int arg0_cmp = svalue::cmp_ptr (binop_sval1->get_arg0 (),
+ binop_sval2->get_arg0 ()))
+ return arg0_cmp;
+ return svalue::cmp_ptr (binop_sval1->get_arg1 (),
+ binop_sval2->get_arg1 ());
+ }
+ break;
+ case SK_SUB:
+ {
+ const sub_svalue *sub_sval1 = (const sub_svalue *)sval1;
+ const sub_svalue *sub_sval2 = (const sub_svalue *)sval2;
+ if (int parent_cmp = svalue::cmp_ptr (sub_sval1->get_parent (),
+ sub_sval2->get_parent ()))
+ return parent_cmp;
+ return region::cmp_ids (sub_sval1->get_subregion (),
+ sub_sval2->get_subregion ());
+ }
+ break;
+ case SK_UNMERGEABLE:
+ {
+ const unmergeable_svalue *unmergeable_sval1
+ = (const unmergeable_svalue *)sval1;
+ const unmergeable_svalue *unmergeable_sval2
+ = (const unmergeable_svalue *)sval2;
+ return svalue::cmp_ptr (unmergeable_sval1->get_arg (),
+ unmergeable_sval2->get_arg ());
+ }
+ break;
+ case SK_PLACEHOLDER:
+ {
+ const placeholder_svalue *placeholder_sval1
+ = (const placeholder_svalue *)sval1;
+ const placeholder_svalue *placeholder_sval2
+ = (const placeholder_svalue *)sval2;
+ return strcmp (placeholder_sval1->get_name (),
+ placeholder_sval2->get_name ());
+ }
+ break;
+ case SK_WIDENING:
+ {
+ const widening_svalue *widening_sval1 = (const widening_svalue *)sval1;
+ const widening_svalue *widening_sval2 = (const widening_svalue *)sval2;
+ if (int point_cmp = function_point::cmp (widening_sval1->get_point (),
+ widening_sval2->get_point ()))
+ return point_cmp;
+ if (int base_cmp = svalue::cmp_ptr (widening_sval1->get_base_svalue (),
+ widening_sval2->get_base_svalue ()))
+ return base_cmp;
+ return svalue::cmp_ptr (widening_sval1->get_iter_svalue (),
+ widening_sval2->get_iter_svalue ());
+ }
+ break;
+ case SK_COMPOUND:
+ {
+ const compound_svalue *compound_sval1 = (const compound_svalue *)sval1;
+ const compound_svalue *compound_sval2 = (const compound_svalue *)sval2;
+ return binding_map::cmp (compound_sval1->get_map (),
+ compound_sval2->get_map ());
+ }
+ break;
+ case SK_CONJURED:
+ {
+ const conjured_svalue *conjured_sval1 = (const conjured_svalue *)sval1;
+ const conjured_svalue *conjured_sval2 = (const conjured_svalue *)sval2;
+ if (int stmt_cmp = (conjured_sval1->get_stmt ()->uid
+ - conjured_sval2->get_stmt ()->uid))
+ return stmt_cmp;
+ return region::cmp_ids (conjured_sval1->get_id_region (),
+ conjured_sval2->get_id_region ());
+ }
+ break;
+ }
+}
+
+/* Comparator for use by vec<const svalue *>::qsort. */
+
+int
+svalue::cmp_ptr_ptr (const void *p1, const void *p2)
+{
+ const svalue *sval1 = *(const svalue * const *)p1;
+ const svalue *sval2 = *(const svalue * const *)p2;
+ return cmp_ptr (sval1, sval2);
+}
+
/* class region_svalue : public svalue. */
/* Implementation of svalue::dump_to_pp vfunc for region_svalue. */
diff --git a/gcc/analyzer/svalue.h b/gcc/analyzer/svalue.h
new file mode 100644
index 0000000..b519d26
--- /dev/null
+++ b/gcc/analyzer/svalue.h
@@ -0,0 +1,1150 @@
+/* Symbolic values.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Contributed by David Malcolm <dmalcolm@redhat.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_ANALYZER_SVALUE_H
+#define GCC_ANALYZER_SVALUE_H
+
+#include "analyzer/complexity.h"
+
+using namespace ana;
+
+namespace ana {
+
+/* An enum for discriminating between the different concrete subclasses
+ of svalue. */
+
+enum svalue_kind
+{
+ SK_REGION,
+ SK_CONSTANT,
+ SK_UNKNOWN,
+ SK_POISONED,
+ SK_SETJMP,
+ SK_INITIAL,
+ SK_UNARYOP,
+ SK_BINOP,
+ SK_SUB,
+ SK_UNMERGEABLE,
+ SK_PLACEHOLDER,
+ SK_WIDENING,
+ SK_COMPOUND,
+ SK_CONJURED
+};
+
+/* svalue and its subclasses.
+
+ The class hierarchy looks like this (using indentation to show
+ inheritance, and with svalue_kinds shown for the concrete subclasses):
+
+ svalue
+ region_svalue (SK_REGION): a pointer to a region
+ constant_svalue (SK_CONSTANT): a constant
+ unknown_svalue (SK_UNKNOWN): an unknowable value
+ poisoned_svalue (SK_POISONED): a unusable value (undefined)
+ setjmp_svalue (SK_SETJMP): a setjmp/longjmp buffer
+ initial_svalue (SK_INITIAL): the initial value of a region
+ unaryop_svalue (SK_UNARYOP): unary operation on another svalue
+ binop_svalue (SK_BINOP): binary operation on two svalues
+ sub_svalue (SK_SUB): the result of accessing a subregion
+ unmergeable_svalue (SK_UNMERGEABLE): a value that is so interesting
+ from a control-flow perspective that it can inhibit state-merging
+ placeholder_svalue (SK_PLACEHOLDER): for use in selftests.
+ widening_svalue (SK_WIDENING): a merger of two svalues (possibly
+ in an iteration).
+ compound_svalue (SK_COMPOUND): a mapping of bit-ranges to svalues
+ conjured_svalue (SK_CONJURED): a value arising from a stmt. */
+
+/* An abstract base class representing a value held by a region of memory. */
+
+class svalue
+{
+public:
+ virtual ~svalue () {}
+
+ tree get_type () const { return m_type; }
+
+ virtual enum svalue_kind get_kind () const = 0;
+
+ void print (const region_model &model,
+ pretty_printer *pp) const;
+
+ virtual void dump_to_pp (pretty_printer *pp, bool simple) const = 0;
+ 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 *
+ dyn_cast_constant_svalue () const { return NULL; }
+ virtual const poisoned_svalue *
+ dyn_cast_poisoned_svalue () const { return NULL; }
+ virtual const setjmp_svalue *
+ dyn_cast_setjmp_svalue () const { return NULL; }
+ virtual const initial_svalue *
+ dyn_cast_initial_svalue () const { return NULL; }
+ virtual const unaryop_svalue *
+ dyn_cast_unaryop_svalue () const { return NULL; }
+ virtual const binop_svalue *
+ dyn_cast_binop_svalue () const { return NULL; }
+ virtual const sub_svalue *
+ dyn_cast_sub_svalue () const { return NULL; }
+ virtual const unmergeable_svalue *
+ dyn_cast_unmergeable_svalue () const { return NULL; }
+ virtual const widening_svalue *
+ dyn_cast_widening_svalue () const { return NULL; }
+ virtual const compound_svalue *
+ dyn_cast_compound_svalue () const { return NULL; }
+ virtual const conjured_svalue *
+ dyn_cast_conjured_svalue () const { return NULL; }
+
+ tree maybe_get_constant () const;
+ const svalue *maybe_undo_cast () const;
+ const svalue *unwrap_any_unmergeable () const;
+
+ const svalue *can_merge_p (const svalue *other,
+ region_model_manager *mgr,
+ model_merger *merger) const;
+
+ const complexity &get_complexity () const { return m_complexity; }
+
+ virtual void accept (visitor *v) const = 0;
+
+ bool live_p (const svalue_set &live_svalues,
+ const region_model *model) const;
+ virtual bool implicitly_live_p (const svalue_set &live_svalues,
+ const region_model *model) const;
+
+ static int cmp_ptr (const svalue *, const svalue *);
+ static int cmp_ptr_ptr (const void *, const void *);
+
+ protected:
+ svalue (complexity c, tree type)
+ : m_complexity (c), m_type (type)
+ {}
+
+ private:
+ complexity m_complexity;
+ tree m_type;
+};
+
+/* Concrete subclass of svalue representing a pointer value that points to
+ a known region */
+
+class region_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of region_svalue. */
+ struct key_t
+ {
+ key_t (tree type, const region *reg)
+ : m_type (type), m_reg (reg)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_type);
+ hstate.add_ptr (m_reg);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type && m_reg == other.m_reg);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ tree m_type;
+ const region *m_reg;
+ };
+
+ region_svalue (tree type, const region *reg)
+ : svalue (complexity (reg), type),
+ m_reg (reg)
+ {
+ gcc_assert (m_reg != NULL);
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_REGION; }
+ const region_svalue *
+ dyn_cast_region_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;
+
+ const region * get_pointee () const { return m_reg; }
+
+ static tristate eval_condition (const region_svalue *lhs_ptr,
+ enum tree_code op,
+ const region_svalue *rhs_ptr);
+
+ private:
+ const region *m_reg;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const region_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_REGION;
+}
+
+template <> struct default_hash_traits<region_svalue::key_t>
+: public member_function_hash_traits<region_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete subclass of svalue representing a specific constant value. */
+
+class constant_svalue : public svalue
+{
+public:
+ constant_svalue (tree cst_expr)
+ : svalue (complexity (1, 1), TREE_TYPE (cst_expr)), m_cst_expr (cst_expr)
+ {
+ gcc_assert (cst_expr);
+ gcc_assert (CONSTANT_CLASS_P (cst_expr));
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONSTANT; }
+ const constant_svalue *
+ dyn_cast_constant_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;
+ bool implicitly_live_p (const svalue_set &,
+ const region_model *) const FINAL OVERRIDE;
+
+ tree get_constant () const { return m_cst_expr; }
+ static tristate eval_condition (const constant_svalue *lhs,
+ enum tree_code op,
+ const constant_svalue *rhs);
+
+ private:
+ tree m_cst_expr;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const constant_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_CONSTANT;
+}
+
+namespace ana {
+
+/* Concrete subclass of svalue representing an unknowable value, the bottom
+ value when thinking of svalues as a lattice.
+ This is a singleton (w.r.t. its manager): there is a single unknown_svalue
+ per type. Self-comparisons of such instances yield "unknown". */
+
+class unknown_svalue : public svalue
+{
+public:
+ unknown_svalue (tree type)
+ : svalue (complexity (1, 1), type)
+ {}
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNKNOWN; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ void accept (visitor *v) const FINAL OVERRIDE;
+};
+
+/* An enum describing a particular kind of "poisoned" value. */
+
+enum poison_kind
+{
+ /* For use to describe freed memory. */
+ POISON_KIND_FREED,
+
+ /* For use on pointers to regions within popped stack frames. */
+ POISON_KIND_POPPED_STACK
+};
+
+extern const char *poison_kind_to_str (enum poison_kind);
+
+/* Concrete subclass of svalue representing a value that should not
+ be used (e.g. uninitialized memory, freed memory). */
+
+class poisoned_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of poisoned_svalue. */
+ struct key_t
+ {
+ key_t (enum poison_kind kind, tree type)
+ : m_kind (kind), m_type (type)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_int (m_kind);
+ hstate.add_ptr (m_type);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_kind == other.m_kind && m_type == other.m_type);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ enum poison_kind m_kind;
+ tree m_type;
+ };
+
+ poisoned_svalue (enum poison_kind kind, tree type)
+ : svalue (complexity (1, 1), type), m_kind (kind) {}
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_POISONED; }
+ const poisoned_svalue *
+ dyn_cast_poisoned_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;
+
+ enum poison_kind get_poison_kind () const { return m_kind; }
+
+ private:
+ enum poison_kind m_kind;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const poisoned_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_POISONED;
+}
+
+template <> struct default_hash_traits<poisoned_svalue::key_t>
+: public member_function_hash_traits<poisoned_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* A bundle of information recording a setjmp/sigsetjmp call, corresponding
+ roughly to a jmp_buf. */
+
+struct setjmp_record
+{
+ setjmp_record (const exploded_node *enode,
+ const gcall *setjmp_call)
+ : m_enode (enode), m_setjmp_call (setjmp_call)
+ {
+ }
+
+ bool operator== (const setjmp_record &other) const
+ {
+ return (m_enode == other.m_enode
+ && m_setjmp_call == other.m_setjmp_call);
+ }
+
+ void add_to_hash (inchash::hash *hstate) const
+ {
+ hstate->add_ptr (m_enode);
+ hstate->add_ptr (m_setjmp_call);
+ }
+
+ static int cmp (const setjmp_record &rec1, const setjmp_record &rec2);
+
+ const exploded_node *m_enode;
+ const gcall *m_setjmp_call;
+};
+
+/* Concrete subclass of svalue representing buffers for setjmp/sigsetjmp,
+ so that longjmp/siglongjmp can potentially "return" to an entirely
+ different function. */
+
+class setjmp_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of poisoned_svalue. */
+ struct key_t
+ {
+ key_t (const setjmp_record &record, tree type)
+ : m_record (record), m_type (type)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ m_record.add_to_hash (&hstate);
+ hstate.add_ptr (m_type);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_record == other.m_record && m_type == other.m_type);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ setjmp_record m_record;
+ tree m_type;
+ };
+
+ setjmp_svalue (const setjmp_record &setjmp_record,
+ tree type)
+ : svalue (complexity (1, 1), type), m_setjmp_record (setjmp_record)
+ {}
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_SETJMP; }
+ const setjmp_svalue *
+ dyn_cast_setjmp_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;
+
+ int get_enode_index () const;
+
+ const setjmp_record &get_setjmp_record () const { return m_setjmp_record; }
+
+ private:
+ setjmp_record m_setjmp_record;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const setjmp_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_SETJMP;
+}
+
+template <> struct default_hash_traits<setjmp_svalue::key_t>
+: public member_function_hash_traits<setjmp_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete subclass of svalue representing the initial value of a
+ specific region.
+
+ This represents the initial value at the start of the analysis path,
+ as opposed to the first time the region is accessed during the path.
+ Hence as soon as we have a call to an unknown function, all previously
+ unmodelled globals become implicitly "unknown" rathen than "initial". */
+
+class initial_svalue : public svalue
+{
+public:
+ initial_svalue (tree type, const region *reg)
+ : svalue (complexity (reg), type), m_reg (reg)
+ {
+ gcc_assert (m_reg != NULL);
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_INITIAL; }
+ const initial_svalue *
+ dyn_cast_initial_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;
+ bool implicitly_live_p (const svalue_set &,
+ const region_model *) const FINAL OVERRIDE;
+
+ const region *get_region () const { return m_reg; }
+
+ private:
+ const region *m_reg;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const initial_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_INITIAL;
+}
+
+namespace ana {
+
+/* Concrete subclass of svalue representing a unary operation on
+ another svalues (e.g. a cast). */
+
+class unaryop_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of unaryop_svalue. */
+ struct key_t
+ {
+ key_t (tree type, enum tree_code op, const svalue *arg)
+ : m_type (type), m_op (op), m_arg (arg)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_type);
+ hstate.add_int (m_op);
+ hstate.add_ptr (m_arg);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type
+ && m_op == other.m_op
+ && m_arg == other.m_arg);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ tree m_type;
+ enum tree_code m_op;
+ const svalue *m_arg;
+ };
+
+ unaryop_svalue (tree type, enum tree_code op, const svalue *arg)
+ : svalue (complexity (arg), type), m_op (op), m_arg (arg)
+ {
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNARYOP; }
+ const unaryop_svalue *
+ dyn_cast_unaryop_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;
+ bool implicitly_live_p (const svalue_set &,
+ const region_model *) const FINAL OVERRIDE;
+
+ enum tree_code get_op () const { return m_op; }
+ const svalue *get_arg () const { return m_arg; }
+
+ private:
+ enum tree_code m_op;
+ const svalue *m_arg;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const unaryop_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_UNARYOP;
+}
+
+template <> struct default_hash_traits<unaryop_svalue::key_t>
+: public member_function_hash_traits<unaryop_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete subclass of svalue representing a binary operation of
+ two svalues. */
+
+class binop_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of binop_svalue. */
+ struct key_t
+ {
+ key_t (tree type, enum tree_code op,
+ const svalue *arg0, const svalue *arg1)
+ : m_type (type), m_op (op), m_arg0 (arg0), m_arg1 (arg1)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_type);
+ hstate.add_int (m_op);
+ hstate.add_ptr (m_arg0);
+ hstate.add_ptr (m_arg1);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type
+ && m_op == other.m_op
+ && m_arg0 == other.m_arg0
+ && m_arg1 == other.m_arg1);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ tree m_type;
+ enum tree_code m_op;
+ const svalue *m_arg0;
+ const svalue *m_arg1;
+ };
+
+ binop_svalue (tree type, enum tree_code op,
+ const svalue *arg0, const svalue *arg1)
+ : svalue (complexity::from_pair (arg0->get_complexity (),
+ arg1->get_complexity ()),
+ type),
+ m_op (op), m_arg0 (arg0), m_arg1 (arg1)
+ {
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_BINOP; }
+ 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;
+ bool implicitly_live_p (const svalue_set &,
+ const region_model *) const FINAL OVERRIDE;
+
+ enum tree_code get_op () const { return m_op; }
+ const svalue *get_arg0 () const { return m_arg0; }
+ const svalue *get_arg1 () const { return m_arg1; }
+
+ private:
+ enum tree_code m_op;
+ const svalue *m_arg0;
+ const svalue *m_arg1;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const binop_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_BINOP;
+}
+
+template <> struct default_hash_traits<binop_svalue::key_t>
+: public member_function_hash_traits<binop_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete subclass of svalue representing the result of accessing a subregion
+ of another svalue (the value of a component/field of a struct, or an element
+ from an array). */
+
+class sub_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of sub_svalue. */
+ struct key_t
+ {
+ key_t (tree type, const svalue *parent_svalue, const region *subregion)
+ : m_type (type), m_parent_svalue (parent_svalue), m_subregion (subregion)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_type);
+ hstate.add_ptr (m_parent_svalue);
+ hstate.add_ptr (m_subregion);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type
+ && m_parent_svalue == other.m_parent_svalue
+ && m_subregion == other.m_subregion);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ tree m_type;
+ const svalue *m_parent_svalue;
+ const region *m_subregion;
+ };
+ sub_svalue (tree type, const svalue *parent_svalue,
+ const region *subregion);
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_SUB; }
+ const sub_svalue *dyn_cast_sub_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;
+ bool implicitly_live_p (const svalue_set &,
+ const region_model *) const FINAL OVERRIDE;
+
+ const svalue *get_parent () const { return m_parent_svalue; }
+ const region *get_subregion () const { return m_subregion; }
+
+ private:
+ const svalue *m_parent_svalue;
+ const region *m_subregion;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const sub_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_SUB;
+}
+
+template <> struct default_hash_traits<sub_svalue::key_t>
+: public member_function_hash_traits<sub_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete subclass of svalue: decorate another svalue,
+ so that the resulting svalue can be identified as being
+ "interesting to control flow".
+ For example, consider the return value from setjmp. We
+ don't want to merge states in which the result is 0 with
+ those in which the result is non-zero. By using an
+ unmergeable_svalue for the result, we can inhibit such merges
+ and have separate exploded nodes for those states, keeping
+ the first and second returns from setjmp distinct in the exploded
+ graph. */
+
+class unmergeable_svalue : public svalue
+{
+public:
+ unmergeable_svalue (const svalue *arg)
+ : svalue (complexity (arg), arg->get_type ()), m_arg (arg)
+ {
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNMERGEABLE; }
+ const unmergeable_svalue *
+ dyn_cast_unmergeable_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;
+ bool implicitly_live_p (const svalue_set &,
+ const region_model *) const FINAL OVERRIDE;
+
+ const svalue *get_arg () const { return m_arg; }
+
+ private:
+ const svalue *m_arg;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <const unmergeable_svalue *>::test (const svalue *sval)
+{
+ return sval->get_kind () == SK_UNMERGEABLE;
+}
+
+namespace ana {
+
+/* Concrete subclass of svalue for use in selftests, where
+ we want a specific but unknown svalue.
+ Unlike other svalue subclasses these aren't managed by
+ region_model_manager. */
+
+class placeholder_svalue : public svalue
+{
+public:
+ placeholder_svalue (tree type, const char *name)
+ : svalue (complexity (1, 1), type), m_name (name)
+ {
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_PLACEHOLDER; }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ void accept (visitor *v) const FINAL OVERRIDE;
+
+ const char *get_name () const { return m_name; }
+
+ private:
+ const char *m_name;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <placeholder_svalue *>::test (svalue *sval)
+{
+ return sval->get_kind () == SK_PLACEHOLDER;
+}
+
+namespace ana {
+
+/* Concrete subclass of svalue representing a "widening" seen when merging
+ states, widening from a base value to {base value, iter value} and thus
+ representing a possible fixed point in an iteration from the base to
+ +ve infinity, or -ve infinity, and thus useful for representing a value
+ within a loop.
+ We also need to capture the program_point at which the merger happens,
+ so that distinguish between different iterators, and thus handle
+ nested loops. (currently we capture the function_point instead, for
+ simplicity of hashing). */
+
+class widening_svalue : public svalue
+{
+public:
+ /* A support class for uniquifying instances of widening_svalue. */
+ struct key_t
+ {
+ key_t (tree type, const program_point &point,
+ const svalue *base_sval, const svalue *iter_sval)
+ : m_type (type), m_point (point.get_function_point ()),
+ m_base_sval (base_sval), m_iter_sval (iter_sval)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_base_sval);
+ hstate.add_ptr (m_iter_sval);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type
+ && m_point == other.m_point
+ && m_base_sval == other.m_base_sval
+ && m_iter_sval == other.m_iter_sval);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ tree m_type;
+ function_point m_point;
+ const svalue *m_base_sval;
+ const svalue *m_iter_sval;
+ };
+
+ enum direction_t
+ {
+ DIR_ASCENDING,
+ DIR_DESCENDING,
+ DIR_UNKNOWN
+ };
+
+ widening_svalue (tree type, const program_point &point,
+ const svalue *base_sval, const svalue *iter_sval)
+ : svalue (complexity::from_pair (base_sval->get_complexity (),
+ iter_sval->get_complexity ()),
+ type),
+ m_point (point.get_function_point ()),
+ m_base_sval (base_sval), m_iter_sval (iter_sval)
+ {
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_WIDENING; }
+ 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;
+
+ const function_point &get_point () const { return m_point; }
+ const svalue *get_base_svalue () const { return m_base_sval; }
+ const svalue *get_iter_svalue () const { return m_iter_sval; }
+
+ enum direction_t get_direction () const;
+
+ tristate eval_condition_without_cm (enum tree_code op,
+ tree rhs_cst) const;
+
+ private:
+ function_point m_point;
+ const svalue *m_base_sval;
+ const svalue *m_iter_sval;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <widening_svalue *>::test (svalue *sval)
+{
+ return sval->get_kind () == SK_WIDENING;
+}
+
+template <> struct default_hash_traits<widening_svalue::key_t>
+: public member_function_hash_traits<widening_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* Concrete subclass of svalue representing a mapping of bit-ranges
+ to svalues, analogous to a cluster within the store.
+
+ This is for use in places where we want to represent a store-like
+ mapping, but are required to use an svalue, such as when handling
+ compound assignments and compound return values.
+
+ All keys within the underlying binding_map are required to be concrete,
+ not symbolic.
+
+ Instances of this class shouldn't be bound as-is into the store;
+ instead they should be unpacked. Similarly, they should not be
+ nested. */
+
+class compound_svalue : public svalue
+{
+public:
+ typedef binding_map::iterator_t iterator_t;
+
+ /* A support class for uniquifying instances of compound_svalue.
+ Note that to avoid copies, keys store pointers to binding_maps,
+ rather than the maps themselves. */
+ struct key_t
+ {
+ key_t (tree type, const binding_map *map_ptr)
+ : m_type (type), m_map_ptr (map_ptr)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_type);
+ //hstate.add_ptr (m_map_ptr); // TODO
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type
+ && *m_map_ptr == *other.m_map_ptr);
+ }
+
+ void mark_deleted () { m_type = reinterpret_cast<tree> (1); }
+ void mark_empty () { m_type = NULL_TREE; }
+ bool is_deleted () const { return m_type == reinterpret_cast<tree> (1); }
+ bool is_empty () const { return m_type == NULL_TREE; }
+
+ tree m_type;
+ const binding_map *m_map_ptr;
+ };
+
+ 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 FINAL OVERRIDE
+ {
+ return this;
+ }
+
+ void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE;
+ void accept (visitor *v) const FINAL OVERRIDE;
+
+ const binding_map &get_map () const { return m_map; }
+
+ iterator_t begin () const { return m_map.begin (); }
+ iterator_t end () const { return m_map.end (); }
+
+ struct key_t make_key () const
+ {
+ return key_t (get_type (), &m_map);
+ }
+
+ private:
+ static complexity calc_complexity (const binding_map &map);
+
+ binding_map m_map;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <compound_svalue *>::test (svalue *sval)
+{
+ return sval->get_kind () == SK_COMPOUND;
+}
+
+template <> struct default_hash_traits<compound_svalue::key_t>
+: public member_function_hash_traits<compound_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+namespace ana {
+
+/* A defined value arising from a statement, where we want to identify a
+ particular unknown value, rather than resorting to the unknown_value
+ singleton, so that the value can have sm-state.
+
+ Comparisons of variables that share the same conjured_svalue are known
+ to be equal, even if we don't know what the value is.
+
+ For example, this is used for the values of regions that may have been
+ touched when calling an unknown function.
+
+ The value captures a region as well as a stmt in order to avoid falsely
+ aliasing the various values that could arise in one statement. For
+ example, after:
+ unknown_fn (&a, &b);
+ we want values to clobber a and b with, but we don't want to use the
+ same value, or it would falsely implicitly assume that a == b. */
+
+class conjured_svalue : public svalue
+{
+public:
+ typedef binding_map::iterator_t iterator_t;
+
+ /* A support class for uniquifying instances of conjured_svalue. */
+ struct key_t
+ {
+ key_t (tree type, const gimple *stmt, const region *id_reg)
+ : m_type (type), m_stmt (stmt), m_id_reg (id_reg)
+ {}
+
+ hashval_t hash () const
+ {
+ inchash::hash hstate;
+ hstate.add_ptr (m_type);
+ hstate.add_ptr (m_stmt);
+ hstate.add_ptr (m_id_reg);
+ return hstate.end ();
+ }
+
+ bool operator== (const key_t &other) const
+ {
+ return (m_type == other.m_type
+ && m_stmt == other.m_stmt
+ && m_id_reg == other.m_id_reg);
+ }
+
+ /* Use m_stmt to mark empty/deleted, as m_type can be NULL for
+ legitimate instances. */
+ void mark_deleted () { m_stmt = reinterpret_cast<const gimple *> (1); }
+ void mark_empty () { m_stmt = NULL; }
+ bool is_deleted () const
+ {
+ return m_stmt == reinterpret_cast<const gimple *> (1);
+ }
+ bool is_empty () const { return m_stmt == NULL; }
+
+ tree m_type;
+ const gimple *m_stmt;
+ const region *m_id_reg;
+ };
+
+ conjured_svalue (tree type, const gimple *stmt, const region *id_reg)
+ : svalue (complexity (id_reg), type),
+ m_stmt (stmt), m_id_reg (id_reg)
+ {
+ gcc_assert (m_stmt != NULL);
+ }
+
+ enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONJURED; }
+ 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;
+
+ const gimple *get_stmt () const { return m_stmt; }
+ const region *get_id_region () const { return m_id_reg; }
+
+ private:
+ const gimple *m_stmt;
+ const region *m_id_reg;
+};
+
+} // namespace ana
+
+template <>
+template <>
+inline bool
+is_a_helper <conjured_svalue *>::test (svalue *sval)
+{
+ return sval->get_kind () == SK_CONJURED;
+}
+
+template <> struct default_hash_traits<conjured_svalue::key_t>
+: public member_function_hash_traits<conjured_svalue::key_t>
+{
+ static const bool empty_zero_p = true;
+};
+
+#endif /* GCC_ANALYZER_SVALUE_H */
diff --git a/gcc/attr-fnspec.h b/gcc/attr-fnspec.h
index 921bb48..28135328 100644
--- a/gcc/attr-fnspec.h
+++ b/gcc/attr-fnspec.h
@@ -27,19 +27,32 @@
'.' specifies that nothing is known.
character 1 specifies additional function properties
' ' specifies that nothing is known
+ 'p' or 'P' specifies that function is pure except for described side
+ effects.
+ 'c' or 'C' specifies that function is const except for described side
+ effects.
+ The uppercase letter in addition specifies that function clobbers errno.
character 2+2i specifies properties of argument number i as follows:
'x' or 'X' specifies that parameter is unused.
- 'r' or 'R' specifies that parameter is only read and memory pointed to is
- never dereferenced.
- 'w' or 'W' specifies that parameter is only written to.
+ 'r' or 'R' specifies that the memory pointed to by the parameter is only
+ read and does not escape
+ 'o' or 'O' specifies that the memory pointed to by the parameter is only
+ written 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 parameter
- is non-escaping.
+ 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
+ 't' the size of value written/read corresponds to the size of
+ of the pointed-to type of the argument type
+ '1'...'9' the size of value written/read is given by the specified
+ argument
*/
#ifndef ATTR_FNSPEC_H
@@ -70,6 +83,12 @@ public:
if (flag_checking)
verify ();
}
+ attr_fnspec (const char *str)
+ : str (str), len (strlen (str))
+ {
+ if (flag_checking)
+ verify ();
+ }
attr_fnspec (const_tree identifier)
: str (TREE_STRING_POINTER (identifier)),
len (TREE_STRING_LENGTH (identifier))
@@ -77,6 +96,17 @@ public:
if (flag_checking)
verify ();
}
+ attr_fnspec ()
+ : str (NULL), len (0)
+ {
+ }
+
+ /* Return true if fn spec is known. */
+ bool
+ known_p ()
+ {
+ return len;
+ }
/* Return true if arg I is specified. */
bool
@@ -92,7 +122,7 @@ public:
{
unsigned int idx = arg_idx (i);
gcc_checking_assert (arg_specified_p (i));
- return str[idx] == 'R' || str[idx] == 'W';
+ return str[idx] == 'R' || str[idx] == 'O' || str[idx] == 'W';
}
/* True if argument is used. */
@@ -113,6 +143,53 @@ public:
return str[idx] == 'r' || str[idx] == 'R';
}
+ /* True if memory reached by the argument is read (directly or indirectly) */
+ bool
+ arg_maybe_read_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx] != 'o' && str[idx] != 'O'
+ && str[idx] != 'x' && str[idx] != 'X';
+ }
+
+ /* True if memory reached by the argument is written.
+ (directly or indirectly) */
+ bool
+ arg_maybe_written_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx] != 'r' && str[idx] != 'R'
+ && str[idx] != 'x' && str[idx] != 'X';
+ }
+
+ /* Return true if load of memory pointed to by argument I is specified
+ by another argument. In this case set ARG. */
+ bool
+ arg_max_access_size_given_by_arg_p (unsigned int i, unsigned int *arg)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ if (str[idx + 1] >= '1' && str[idx + 1] <= '9')
+ {
+ *arg = str[idx + 1] - '1';
+ return true;
+ }
+ else
+ return false;
+ }
+
+ /* Return true if the pointed-to type of the argument correspond to the
+ size of the memory acccess. */
+ bool
+ arg_access_size_given_by_type_p (unsigned int i)
+ {
+ unsigned int idx = arg_idx (i);
+ gcc_checking_assert (arg_specified_p (i));
+ return str[idx + 1] == 't';
+ }
+
/* True if the argument does not escape. */
bool
arg_noescape_p (unsigned int i)
@@ -120,7 +197,8 @@ public:
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';
+ || str[idx] == 'r' || str[idx] == 'R'
+ || str[idx] == 'o' || str[idx] == 'O';
}
/* Return true if function returns value of its parameter. If ARG_NO is
@@ -145,8 +223,39 @@ public:
return str[0] == 'm';
}
+ /* Return true if all memory read by the function is specified by fnspec. */
+ bool
+ global_memory_read_p ()
+ {
+ return str[1] != 'c' && str[1] != 'C';
+ }
+
+ /* Return true if all memory written by the function
+ is specified by fnspec. */
+ bool
+ global_memory_written_p ()
+ {
+ return str[1] != 'c' && str[1] != 'C' && str[1] != 'p' && str[1] != 'P';
+ }
+
+ bool
+ errno_maybe_written_p ()
+ {
+ return str[1] == 'C' || str[1] == 'P';
+ }
+
/* Check validity of the string. */
void verify ();
+
+ /* Return the fnspec string. */
+ const char *
+ get_str ()
+ {
+ return str;
+ }
};
+extern attr_fnspec gimple_call_fnspec (const gcall *stmt);
+extern attr_fnspec builtin_fnspec (tree);
+
#endif /* ATTR_FNSPEC_H */
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 94b9e02..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;
}
diff --git a/gcc/builtin-attrs.def b/gcc/builtin-attrs.def
index 778bc8a..0875724 100644
--- a/gcc/builtin-attrs.def
+++ b/gcc/builtin-attrs.def
@@ -67,6 +67,8 @@ DEF_ATTR_FOR_INT (6)
DEF_ATTR_TREE_LIST (ATTR_LIST_##ENUM, ATTR_NULL, \
ATTR_##ENUM, ATTR_NULL)
DEF_ATTR_FOR_STRING (STR1, "1 ")
+DEF_ATTR_FOR_STRING (STRERRNOC, ".C")
+DEF_ATTR_FOR_STRING (STRERRNOP, ".P")
#undef DEF_ATTR_FOR_STRING
/* Construct a tree for a list of two integers. */
@@ -136,6 +138,10 @@ DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LIST, ATTR_CONST, \
ATTR_NULL, ATTR_NOTHROW_LIST)
DEF_ATTR_TREE_LIST (ATTR_CONST_NOTHROW_LEAF_LIST, ATTR_CONST, \
ATTR_NULL, ATTR_NOTHROW_LEAF_LIST)
+DEF_ATTR_TREE_LIST (ATTR_ERRNOCONST_NOTHROW_LEAF_LIST, ATTR_FNSPEC,\
+ ATTR_LIST_STRERRNOC, ATTR_NOTHROW_LEAF_LIST)
+DEF_ATTR_TREE_LIST (ATTR_ERRNOPURE_NOTHROW_LEAF_LIST, ATTR_FNSPEC,\
+ ATTR_LIST_STRERRNOP, ATTR_NOTHROW_LEAF_LIST)
DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LIST, ATTR_PURE, \
ATTR_NULL, ATTR_NOTHROW_LIST)
DEF_ATTR_TREE_LIST (ATTR_PURE_NOTHROW_LEAF_LIST, ATTR_PURE, \
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 3a77da2..da25343 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -76,6 +76,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-ssa.h"
#include "tree-ssa-live.h"
#include "tree-outof-ssa.h"
+#include "attr-fnspec.h"
struct target_builtins default_target_builtins;
#if SWITCHABLE_TARGET
@@ -320,7 +321,13 @@ void access_ref::add_offset (const offset_int &min, const offset_int &max)
offrng[1] = maxoff;
offset_int absmax = wi::abs (max);
if (offrng[0] < absmax)
- offrng[0] += min;
+ {
+ offrng[0] += min;
+ /* Cap the lower bound at the upper (set to MAXOFF above)
+ to avoid inadvertently recreating an inverted range. */
+ if (offrng[1] < offrng[0])
+ offrng[0] = offrng[1];
+ }
else
offrng[0] = 0;
}
@@ -2451,37 +2458,37 @@ tree
mathfn_built_in_type (combined_fn fn)
{
#define CASE_MATHFN(MATHFN) \
- case BUILT_IN_##MATHFN: \
+ case CFN_BUILT_IN_##MATHFN: \
return double_type_node; \
- case BUILT_IN_##MATHFN##F: \
+ case CFN_BUILT_IN_##MATHFN##F: \
return float_type_node; \
- case BUILT_IN_##MATHFN##L: \
+ case CFN_BUILT_IN_##MATHFN##L: \
return long_double_type_node;
#define CASE_MATHFN_FLOATN(MATHFN) \
CASE_MATHFN(MATHFN) \
- case BUILT_IN_##MATHFN##F16: \
+ case CFN_BUILT_IN_##MATHFN##F16: \
return float16_type_node; \
- case BUILT_IN_##MATHFN##F32: \
+ case CFN_BUILT_IN_##MATHFN##F32: \
return float32_type_node; \
- case BUILT_IN_##MATHFN##F64: \
+ case CFN_BUILT_IN_##MATHFN##F64: \
return float64_type_node; \
- case BUILT_IN_##MATHFN##F128: \
+ case CFN_BUILT_IN_##MATHFN##F128: \
return float128_type_node; \
- case BUILT_IN_##MATHFN##F32X: \
+ case CFN_BUILT_IN_##MATHFN##F32X: \
return float32x_type_node; \
- case BUILT_IN_##MATHFN##F64X: \
+ case CFN_BUILT_IN_##MATHFN##F64X: \
return float64x_type_node; \
- case BUILT_IN_##MATHFN##F128X: \
+ 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 BUILT_IN_##MATHFN##_R: \
+ case CFN_BUILT_IN_##MATHFN##_R: \
return double_type_node; \
- case BUILT_IN_##MATHFN##F_R: \
+ case CFN_BUILT_IN_##MATHFN##F_R: \
return float_type_node; \
- case BUILT_IN_##MATHFN##L_R: \
+ case CFN_BUILT_IN_##MATHFN##L_R: \
return long_double_type_node;
switch (fn)
@@ -4493,12 +4500,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;
@@ -12916,3 +12920,183 @@ access_ref::offset_bounded () const
tree max = TYPE_MAX_VALUE (ptrdiff_type_node);
return wi::to_offset (min) <= offrng[0] && offrng[1] <= wi::to_offset (max);
}
+
+/* If CALLEE has known side effects, fill in INFO and return true.
+ See tree-ssa-structalias.c:find_func_aliases
+ for the list of builtins we might need to handle here. */
+
+attr_fnspec
+builtin_fnspec (tree callee)
+{
+ built_in_function code = DECL_FUNCTION_CODE (callee);
+
+ switch (code)
+ {
+ /* All the following functions read memory pointed to by
+ their second argument and write memory pointed to by first
+ argument.
+ strcat/strncat additionally reads memory pointed to by the first
+ argument. */
+ case BUILT_IN_STRCAT:
+ case BUILT_IN_STRCAT_CHK:
+ return "1cW R ";
+ case BUILT_IN_STRNCAT:
+ case BUILT_IN_STRNCAT_CHK:
+ return "1cW R3";
+ case BUILT_IN_STRCPY:
+ case BUILT_IN_STRCPY_CHK:
+ return "1cO R ";
+ case BUILT_IN_STPCPY:
+ case BUILT_IN_STPCPY_CHK:
+ return ".cO R ";
+ case BUILT_IN_STRNCPY:
+ case BUILT_IN_MEMCPY:
+ case BUILT_IN_MEMMOVE:
+ case BUILT_IN_TM_MEMCPY:
+ case BUILT_IN_TM_MEMMOVE:
+ case BUILT_IN_STRNCPY_CHK:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ return "1cO3R3";
+ case BUILT_IN_MEMPCPY:
+ case BUILT_IN_MEMPCPY_CHK:
+ return ".cO3R3";
+ case BUILT_IN_STPNCPY:
+ case BUILT_IN_STPNCPY_CHK:
+ return ".cO3R3";
+ case BUILT_IN_BCOPY:
+ return ".cR3O3";
+ case BUILT_IN_BZERO:
+ return ".cO2";
+ case BUILT_IN_MEMCMP:
+ case BUILT_IN_MEMCMP_EQ:
+ case BUILT_IN_BCMP:
+ case BUILT_IN_STRNCMP:
+ case BUILT_IN_STRNCMP_EQ:
+ case BUILT_IN_STRNCASECMP:
+ return ".cR3R3";
+
+ /* The following functions read memory pointed to by their
+ first argument. */
+ CASE_BUILT_IN_TM_LOAD (1):
+ CASE_BUILT_IN_TM_LOAD (2):
+ CASE_BUILT_IN_TM_LOAD (4):
+ CASE_BUILT_IN_TM_LOAD (8):
+ CASE_BUILT_IN_TM_LOAD (FLOAT):
+ CASE_BUILT_IN_TM_LOAD (DOUBLE):
+ CASE_BUILT_IN_TM_LOAD (LDOUBLE):
+ CASE_BUILT_IN_TM_LOAD (M64):
+ CASE_BUILT_IN_TM_LOAD (M128):
+ CASE_BUILT_IN_TM_LOAD (M256):
+ case BUILT_IN_TM_LOG:
+ case BUILT_IN_TM_LOG_1:
+ case BUILT_IN_TM_LOG_2:
+ case BUILT_IN_TM_LOG_4:
+ case BUILT_IN_TM_LOG_8:
+ case BUILT_IN_TM_LOG_FLOAT:
+ case BUILT_IN_TM_LOG_DOUBLE:
+ case BUILT_IN_TM_LOG_LDOUBLE:
+ case BUILT_IN_TM_LOG_M64:
+ case BUILT_IN_TM_LOG_M128:
+ case BUILT_IN_TM_LOG_M256:
+ return ".cR ";
+
+ case BUILT_IN_INDEX:
+ case BUILT_IN_RINDEX:
+ case BUILT_IN_STRCHR:
+ case BUILT_IN_STRLEN:
+ case BUILT_IN_STRRCHR:
+ return ".cR ";
+ case BUILT_IN_STRNLEN:
+ return ".cR2";
+
+ /* These read memory pointed to by the first argument.
+ Allocating memory does not have any side-effects apart from
+ being the definition point for the pointer.
+ Unix98 specifies that errno is set on allocation failure. */
+ case BUILT_IN_STRDUP:
+ return "mCR ";
+ case BUILT_IN_STRNDUP:
+ return "mCR2";
+ /* Allocating memory does not have any side-effects apart from
+ being the definition point for the pointer. */
+ case BUILT_IN_MALLOC:
+ case BUILT_IN_ALIGNED_ALLOC:
+ case BUILT_IN_CALLOC:
+ return "mC";
+ CASE_BUILT_IN_ALLOCA:
+ return "mc";
+ /* These read memory pointed to by the first argument with size
+ in the third argument. */
+ case BUILT_IN_MEMCHR:
+ return ".cR3";
+ /* These read memory pointed to by the first and second arguments. */
+ case BUILT_IN_STRSTR:
+ case BUILT_IN_STRPBRK:
+ case BUILT_IN_STRCASECMP:
+ case BUILT_IN_STRCSPN:
+ case BUILT_IN_STRSPN:
+ case BUILT_IN_STRCMP:
+ case BUILT_IN_STRCMP_EQ:
+ return ".cR R ";
+ /* Freeing memory kills the pointed-to memory. More importantly
+ the call has to serve as a barrier for moving loads and stores
+ across it. */
+ case BUILT_IN_STACK_RESTORE:
+ case BUILT_IN_FREE:
+ return ".co ";
+ case BUILT_IN_VA_END:
+ return ".cO ";
+ /* Realloc serves both as allocation point and deallocation point. */
+ case BUILT_IN_REALLOC:
+ return ".cw ";
+ case BUILT_IN_GAMMA_R:
+ case BUILT_IN_GAMMAF_R:
+ case BUILT_IN_GAMMAL_R:
+ case BUILT_IN_LGAMMA_R:
+ case BUILT_IN_LGAMMAF_R:
+ case BUILT_IN_LGAMMAL_R:
+ return ".C. Ot";
+ case BUILT_IN_FREXP:
+ case BUILT_IN_FREXPF:
+ case BUILT_IN_FREXPL:
+ case BUILT_IN_MODF:
+ case BUILT_IN_MODFF:
+ case BUILT_IN_MODFL:
+ return ".c. Ot";
+ case BUILT_IN_REMQUO:
+ case BUILT_IN_REMQUOF:
+ case BUILT_IN_REMQUOL:
+ return ".c. . Ot";
+ case BUILT_IN_SINCOS:
+ case BUILT_IN_SINCOSF:
+ case BUILT_IN_SINCOSL:
+ return ".c. OtOt";
+ case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMSET_CHK:
+ case BUILT_IN_TM_MEMSET:
+ return "1cO3";
+ CASE_BUILT_IN_TM_STORE (1):
+ CASE_BUILT_IN_TM_STORE (2):
+ CASE_BUILT_IN_TM_STORE (4):
+ CASE_BUILT_IN_TM_STORE (8):
+ CASE_BUILT_IN_TM_STORE (FLOAT):
+ CASE_BUILT_IN_TM_STORE (DOUBLE):
+ CASE_BUILT_IN_TM_STORE (LDOUBLE):
+ CASE_BUILT_IN_TM_STORE (M64):
+ CASE_BUILT_IN_TM_STORE (M128):
+ CASE_BUILT_IN_TM_STORE (M256):
+ return ".cO ";
+ case BUILT_IN_STACK_SAVE:
+ return ".c";
+ case BUILT_IN_ASSUME_ALIGNED:
+ return "1cX ";
+ /* But posix_memalign stores a pointer into the memory pointed to
+ by its first argument. */
+ case BUILT_IN_POSIX_MEMALIGN:
+ return ".cOt";
+
+ default:
+ return "";
+ }
+}
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 95428c0..b4494c7 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -254,7 +254,7 @@ along with GCC; see the file COPYING3. If not see
`errno'. If !flag_errno_math they are instead "const". */
#undef ATTR_MATHFN_ERRNO
#define ATTR_MATHFN_ERRNO (flag_errno_math ? \
- ATTR_NOTHROW_LEAF_LIST : ATTR_CONST_NOTHROW_LEAF_LIST)
+ ATTR_ERRNOCONST_NOTHROW_LEAF_LIST : ATTR_CONST_NOTHROW_LEAF_LIST)
/* Define an attribute list for math functions that are normally
"const" but if flag_rounding_math is set they are instead "pure".
@@ -271,7 +271,8 @@ along with GCC; see the file COPYING3. If not see
"const" depending on whether we care about FP rounding. */
#undef ATTR_MATHFN_FPROUNDING_ERRNO
#define ATTR_MATHFN_FPROUNDING_ERRNO (flag_errno_math ? \
- ATTR_NOTHROW_LEAF_LIST : ATTR_MATHFN_FPROUNDING)
+ (flag_rounding_math ? ATTR_ERRNOPURE_NOTHROW_LEAF_LIST \
+ : ATTR_ERRNOCONST_NOTHROW_LEAF_LIST) : ATTR_MATHFN_FPROUNDING)
/* Define an attribute list for math functions that need to mind FP
rounding, but because they store into memory they are never "const"
@@ -517,6 +518,9 @@ DEF_GCC_BUILTIN (BUILT_IN_NANSF, "nansf", BT_FN_FLOAT_CONST_STRING, ATTR_
DEF_GCC_BUILTIN (BUILT_IN_NANSL, "nansl", BT_FN_LONGDOUBLE_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
DEF_GCC_FLOATN_NX_BUILTINS (BUILT_IN_NANS, "nans", NAN_TYPE, ATTR_CONST_NOTHROW_NONNULL)
#undef NAN_TYPE
+DEF_GCC_BUILTIN (BUILT_IN_NANSD32, "nansd32", BT_FN_DFLOAT32_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
+DEF_GCC_BUILTIN (BUILT_IN_NANSD64, "nansd64", BT_FN_DFLOAT64_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
+DEF_GCC_BUILTIN (BUILT_IN_NANSD128, "nansd128", BT_FN_DFLOAT128_CONST_STRING, ATTR_CONST_NOTHROW_NONNULL)
DEF_C99_BUILTIN (BUILT_IN_NEARBYINT, "nearbyint", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_NEARBYINTF, "nearbyintf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
DEF_C99_BUILTIN (BUILT_IN_NEARBYINTL, "nearbyintl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
@@ -701,26 +705,26 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN_BZERO, "bzero", BT_FN_VOID_PTR_SIZE, ATTR_NOTHR
DEF_EXT_LIB_BUILTIN (BUILT_IN_INDEX, "index", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_MEMCHR, "memchr", BT_FN_PTR_CONST_PTR_INT_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_MEMCMP, "memcmp", BT_FN_INT_CONST_PTR_CONST_PTR_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_MEMCPY, "memcpy", BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_MEMMOVE, "memmove", BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_MEMCPY, "memcpy", BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_MEMMOVE, "memmove", BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMPCPY, "mempcpy", BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_RETNONNULL_NOTHROW_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_MEMSET, "memset", BT_FN_PTR_PTR_INT_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_MEMSET, "memset", BT_FN_PTR_PTR_INT_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_RINDEX, "rindex", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STPCPY, "stpcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_RETNONNULL_NOTHROW_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STPNCPY, "stpncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RETNONNULL_NOTHROW_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCASECMP, "strcasecmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_STRCAT, "strcat", BT_FN_STRING_STRING_CONST_STRING, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_STRCAT, "strcat", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRCHR, "strchr", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRCMP, "strcmp", BT_FN_INT_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_STRCPY, "strcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_STRCPY, "strcpy", BT_FN_STRING_STRING_CONST_STRING, ATTR_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRCSPN, "strcspn", BT_FN_SIZE_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_C2X_BUILTIN (BUILT_IN_STRDUP, "strdup", BT_FN_STRING_CONST_STRING, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
DEF_C2X_BUILTIN (BUILT_IN_STRNDUP, "strndup", BT_FN_STRING_CONST_STRING_SIZE, ATTR_MALLOC_WARN_UNUSED_RESULT_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRLEN, "strlen", BT_FN_SIZE_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCASECMP, "strncasecmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_STRNCAT, "strncat", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_STRNCAT, "strncat", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRNCMP, "strncmp", BT_FN_INT_CONST_STRING_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
-DEF_LIB_BUILTIN (BUILT_IN_STRNCPY, "strncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_LIB_BUILTIN (BUILT_IN_STRNCPY, "strncpy", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNLEN, "strnlen", BT_FN_SIZE_CONST_STRING_SIZE, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRPBRK, "strpbrk", BT_FN_STRING_CONST_STRING_CONST_STRING, ATTR_PURE_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN (BUILT_IN_STRRCHR, "strrchr", BT_FN_STRING_CONST_STRING_INT, ATTR_PURE_NOTHROW_NONNULL_LEAF)
@@ -970,16 +974,16 @@ DEF_BUILTIN_STUB (BUILT_IN_STRNCMP_EQ, "__builtin_strncmp_eq")
/* Object size checking builtins. */
DEF_GCC_BUILTIN (BUILT_IN_OBJECT_SIZE, "object_size", BT_FN_SIZE_CONST_PTR_INT, ATTR_CONST_NOTHROW_LEAF_LIST)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMCPY_CHK, "__memcpy_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMMOVE_CHK, "__memmove_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMCPY_CHK, "__memcpy_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMMOVE_CHK, "__memmove_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMPCPY_CHK, "__mempcpy_chk", BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, ATTR_RETNONNULL_NOTHROW_LEAF)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMSET_CHK, "__memset_chk", BT_FN_PTR_PTR_INT_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_MEMSET_CHK, "__memset_chk", BT_FN_PTR_PTR_INT_SIZE_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STPCPY_CHK, "__stpcpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RETNONNULL_NOTHROW_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_STPNCPY_CHK, "__stpncpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_RETNONNULL_NOTHROW_LEAF)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCAT_CHK, "__strcat_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCPY_CHK, "__strcpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCAT_CHK, "__strncat_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
-DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCPY_CHK, "__strncpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCAT_CHK, "__strcat_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_STRCPY_CHK, "__strcpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCAT_CHK, "__strncat_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
+DEF_EXT_LIB_BUILTIN (BUILT_IN_STRNCPY_CHK, "__strncpy_chk", BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, ATTR_NOTHROW_NONNULL_LEAF)
DEF_EXT_LIB_BUILTIN (BUILT_IN_SNPRINTF_CHK, "__snprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR, ATTR_FORMAT_PRINTF_NOTHROW_5_6)
DEF_EXT_LIB_BUILTIN (BUILT_IN_SPRINTF_CHK, "__sprintf_chk", BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, ATTR_NOTHROW_NONNULL_1_FORMAT_PRINTF_4_5)
DEF_EXT_LIB_BUILTIN (BUILT_IN_VSNPRINTF_CHK, "__vsnprintf_chk", BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, ATTR_FORMAT_PRINTF_NOTHROW_5_0)
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 9889555..d2ad058 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,185 @@
+2020-11-09 Marek Polacek <polacek@redhat.com>
+
+ DR 1914
+ * c-common.c (attribute_fallthrough_p): Tweak the warning
+ message.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ * c-pragma.c (handle_pragma_diagnostic): Split the
+ unknown-option -Wpragmas diagnostic into a warning and a
+ subsequent note containing a spelling suggestion. Avoid
+ computing the suggestion if -Wpragmas warnings are being
+ suppressed.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ PR testsuite/97117
+ * c-indentation.c (get_visual_column): Remove location_t
+ parameter. Move the column-tracking diagnostic code from here
+ to ...
+ (should_warn_for_misleading_indentation): ... here, before the
+ early exit for when the loci are not all distinct. Don't pass a
+ location_t argument to get_visual_column.
+ (assert_get_visual_column_succeeds): Don't pass a location_t
+ argument to get_visual_column.
+ (assert_get_visual_column_fails): Likewise.
+
+2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-common.h (OBJC_IS_PATTR_KEYWORD): Add class to the list
+ of keywords accepted in @property attribute contexts.
+ * c-objc.h (enum objc_property_attribute_group): Add
+ OBJC_PROPATTR_GROUP_CLASS.
+ (enum objc_property_attribute_kind): Add
+ OBJC_PROPERTY_ATTR_CLASS.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-common.c (c_common_reswords): Add 'atomic' property
+ attribute.
+ * c-common.h (enum rid): Add RID_PROPATOMIC for atomic
+ property attributes.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-attribs.c (handle_nsobject_attribute): New.
+ * c.opt: Add WNSObject-attribute.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-objc.h (enum objc_property_attribute_group): New
+ (enum objc_property_attribute_kind): New.
+ (OBJC_PROPATTR_GROUP_MASK): New.
+ (struct property_attribute_info): Small class encapsulating
+ parser output from property attributes.
+ (objc_prop_attr_kind_for_rid): New
+ (objc_add_property_declaration): Simplify interface.
+ * stub-objc.c (enum rid): Dummy type.
+ (objc_add_property_declaration): Simplify interface.
+ (objc_prop_attr_kind_for_rid): New.
+
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * c-ada-spec.c (collect_ada_nodes): Rename
+ DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
+ (collect_ada_node): Likewise.
+ (dump_forward_type): Likewise.
+ * c-common.c (set_underlying_type): Rename
+ DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
+ (user_facing_original_type, c_common_finalize_early_debug): Likewise.
+
+2020-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ * c-common.c (verify_sequence_points): Remove DEBUG_FUNCTION.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97675
+ * c.opt (Wexceptions): New option.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/25814
+ * c.opt (Wvexing-parse): New option.
+
+2020-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97670
+ * c-omp.c (c_omp_split_clauses): Look through array reductions to find
+ underlying decl to clear in the allocate_head bitmap.
+
+2020-11-04 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-objc.h (objc_non_constant_expr_p): New.
+ * stub-objc.c (objc_non_constant_expr_p): New.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * c.opt (MQ,MT): Reword description to be make-agnostic.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * c-opts.c (c_common_post_options): Move var decl to its
+ initialization point.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-lex.c (c_lex_with_flags): When combining '@' with a
+ keyword for Objective-C, combine the location ranges too.
+
+2020-10-30 Qing Zhao <qing.zhao@oracle.com>
+ H.J.Lu <hjl.tools@gmail.com>
+
+ * c-attribs.c (c_common_attribute_table): Add new attribute
+ zero_call_used_regs.
+ (handle_zero_call_used_regs_attribute): New function.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97573
+ * c-opts.c (c_common_post_options): In C++20, turn on
+ -Wdeprecated-enum-enum-conversion and
+ -Wdeprecated-enum-float-conversion.
+ * c.opt (Wdeprecated-enum-enum-conversion,
+ Wdeprecated-enum-float-conversion): New options.
+ (Wenum-conversion): Allow for C++ too.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALLOCATE.
+ * c-omp.c: Include bitmap.h.
+ (c_omp_split_clauses): Handle OMP_CLAUSE_ALLOCATE.
+
+2020-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ * c-common.c (__is_nothrow_assignable): New.
+ (__is_nothrow_constructible): Likewise.
+ * c-common.h (RID_IS_NOTHROW_ASSIGNABLE): New.
+ (RID_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
+
+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>
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index c75b173..266a7fe 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -713,7 +713,7 @@ collect_ada_nodes (tree t, const char *source_file)
in the context of bindings) and namespaces (we do not handle them properly
yet). */
for (n = t; n; n = TREE_CHAIN (n))
- if (!DECL_IS_BUILTIN (n)
+ if (!DECL_IS_UNDECLARED_BUILTIN (n)
&& TREE_CODE (n) != NAMESPACE_DECL
&& LOCATION_FILE (decl_sloc (n, false)) == source_file)
to_dump_count++;
@@ -723,7 +723,7 @@ collect_ada_nodes (tree t, const char *source_file)
/* Store the relevant nodes. */
for (n = t; n; n = TREE_CHAIN (n))
- if (!DECL_IS_BUILTIN (n)
+ if (!DECL_IS_UNDECLARED_BUILTIN (n)
&& TREE_CODE (n) != NAMESPACE_DECL
&& LOCATION_FILE (decl_sloc (n, false)) == source_file)
to_dump[i++] = n;
@@ -2321,7 +2321,7 @@ dump_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
return 0;
case TYPE_DECL:
- if (DECL_IS_BUILTIN (node))
+ if (DECL_IS_UNDECLARED_BUILTIN (node))
{
/* Don't print the declaration of built-in types. */
if (name_only)
@@ -2444,7 +2444,7 @@ dump_forward_type (pretty_printer *buffer, tree type, tree t, int spc)
return;
}
- if (DECL_IS_BUILTIN (decl) || TREE_VISITED (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl) || TREE_VISITED (decl))
return;
/* Forward declarations are only needed within a given file. */
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index c779d13..f168082 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 *);
@@ -138,6 +140,8 @@ static tree handle_target_clones_attribute (tree *, tree, tree, int, bool *);
static tree handle_optimize_attribute (tree *, tree, tree, int, bool *);
static tree ignore_attribute (tree *, tree, tree, int, bool *);
static tree handle_no_split_stack_attribute (tree *, tree, tree, int, bool *);
+static tree handle_zero_call_used_regs_attribute (tree *, tree, tree, int,
+ bool *);
static tree handle_argspec_attribute (tree *, tree, tree, int, bool *);
static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
static tree handle_warn_unused_attribute (tree *, tree, tree, int, bool *);
@@ -153,6 +157,7 @@ static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *);
static tree handle_patchable_function_entry_attribute (tree *, tree, tree,
int, bool *);
static tree handle_copy_attribute (tree *, tree, tree, int, bool *);
+static tree handle_nsobject_attribute (tree *, tree, tree, int, bool *);
/* Helper to define attribute exclusions. */
#define ATTR_EXCL(name, function, type, variable) \
@@ -248,6 +253,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 +288,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 },
@@ -437,6 +454,8 @@ const struct attribute_spec c_common_attribute_table[] =
ignore_attribute, NULL },
{ "no_split_stack", 0, 0, true, false, false, false,
handle_no_split_stack_attribute, NULL },
+ { "zero_call_used_regs", 1, 1, true, false, false, false,
+ handle_zero_call_used_regs_attribute, NULL },
/* For internal use only (marking of function arguments).
The name contains a space to prevent its usage in source code. */
{ "arg spec", 1, -1, true, false, false, false,
@@ -491,6 +510,9 @@ const struct attribute_spec c_common_attribute_table[] =
handle_noinit_attribute, attr_noinit_exclusions },
{ "access", 1, 3, false, true, true, false,
handle_access_attribute, NULL },
+ /* Attributes used by Objective-C. */
+ { "NSObject", 0, 0, true, false, false, false,
+ handle_nsobject_attribute, NULL },
{ NULL, 0, 0, false, false, false, false, NULL, NULL }
};
@@ -1156,6 +1178,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. */
@@ -4547,10 +4585,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)
@@ -4654,13 +4693,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
@@ -4959,6 +5002,53 @@ handle_no_split_stack_attribute (tree *node, tree name,
return NULL_TREE;
}
+/* Handle a "zero_call_used_regs" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_zero_call_used_regs_attribute (tree *node, tree name, tree args,
+ int ARG_UNUSED (flags),
+ bool *no_add_attrs)
+{
+ tree decl = *node;
+ tree id = TREE_VALUE (args);
+
+ if (TREE_CODE (decl) != FUNCTION_DECL)
+ {
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "%qE attribute applies only to functions", name);
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ if (TREE_CODE (id) != STRING_CST)
+ {
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "%qE argument not a string", name);
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ bool found = false;
+ for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL; ++i)
+ if (strcmp (TREE_STRING_POINTER (id),
+ zero_call_used_regs_opts[i].name) == 0)
+ {
+ found = true;
+ break;
+ }
+
+ if (!found)
+ {
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "unrecognized %qE attribute argument %qs",
+ name, TREE_STRING_POINTER (id));
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "returns_nonnull" attribute; arguments as in
struct attribute_spec.handler. */
@@ -5038,6 +5128,41 @@ handle_patchable_function_entry_attribute (tree *, tree name, tree args,
return NULL_TREE;
}
+/* Handle a "NSObject" attributes; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_nsobject_attribute (tree *node, tree name, tree args,
+ int /*flags*/, bool *no_add_attrs)
+{
+ *no_add_attrs = true;
+
+ /* This attribute only applies to typedefs (or field decls for properties),
+ we drop it otherwise - but warn about this if enabled. */
+ if (TREE_CODE (*node) != TYPE_DECL && TREE_CODE (*node) != FIELD_DECL)
+ {
+ warning (OPT_WNSObject_attribute, "%qE attribute may be put on a"
+ " typedef only; attribute is ignored", name);
+ return NULL_TREE;
+ }
+
+ /* The original implementation only allowed pointers to records, however
+ recent implementations also allow void *. */
+ tree type = TREE_TYPE (*node);
+ if (!type || !POINTER_TYPE_P (type)
+ || (TREE_CODE (TREE_TYPE (type)) != RECORD_TYPE
+ && !VOID_TYPE_P (TREE_TYPE (type))))
+ {
+ error ("%qE attribute is for pointer types only", name);
+ return NULL_TREE;
+ }
+
+ tree t = tree_cons (name, args, TYPE_ATTRIBUTES (type));
+ TREE_TYPE (*node) = build_type_attribute_variant (type, t);
+
+ return NULL_TREE;
+}
+
/* Attempt to partially validate a single attribute ATTR as if
it were to be applied to an entity OPER. */
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e16ca38..29508bc 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -527,6 +527,8 @@ const struct c_common_resword c_common_reswords[] =
{ "while", RID_WHILE, 0 },
{ "__is_assignable", RID_IS_ASSIGNABLE, D_CXXONLY },
{ "__is_constructible", RID_IS_CONSTRUCTIBLE, D_CXXONLY },
+ { "__is_nothrow_assignable", RID_IS_NOTHROW_ASSIGNABLE, D_CXXONLY },
+ { "__is_nothrow_constructible", RID_IS_NOTHROW_CONSTRUCTIBLE, D_CXXONLY },
/* C++ transactional memory. */
{ "synchronized", RID_SYNCHRONIZED, D_CXX_OBJC | D_TRANSMEM },
@@ -569,14 +571,15 @@ const struct c_common_resword c_common_reswords[] =
{ "oneway", RID_ONEWAY, D_OBJC },
{ "out", RID_OUT, D_OBJC },
/* These are recognized inside a property attribute list */
- { "assign", RID_ASSIGN, D_OBJC },
- { "copy", RID_COPY, D_OBJC },
- { "getter", RID_GETTER, D_OBJC },
- { "nonatomic", RID_NONATOMIC, D_OBJC },
- { "readonly", RID_READONLY, D_OBJC },
- { "readwrite", RID_READWRITE, D_OBJC },
- { "retain", RID_RETAIN, D_OBJC },
- { "setter", RID_SETTER, D_OBJC },
+ { "assign", RID_ASSIGN, D_OBJC },
+ { "atomic", RID_PROPATOMIC, D_OBJC },
+ { "copy", RID_COPY, D_OBJC },
+ { "getter", RID_GETTER, D_OBJC },
+ { "nonatomic", RID_NONATOMIC, D_OBJC },
+ { "readonly", RID_READONLY, D_OBJC },
+ { "readwrite", RID_READWRITE, D_OBJC },
+ { "retain", RID_RETAIN, D_OBJC },
+ { "setter", RID_SETTER, D_OBJC },
};
const unsigned int num_c_common_reswords =
@@ -1854,6 +1857,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:
@@ -2042,7 +2046,7 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
/* Try to warn for undefined behavior in EXPR due to missing sequence
points. */
-DEBUG_FUNCTION void
+void
verify_sequence_points (tree expr)
{
struct tlist *before_sp = 0, *after_sp = 0;
@@ -5748,9 +5752,10 @@ attribute_fallthrough_p (tree attr)
tree t = lookup_attribute ("fallthrough", attr);
if (t == NULL_TREE)
return false;
- /* This attribute shall appear at most once in each attribute-list. */
+ /* It is no longer true that "this attribute shall appear at most once in
+ each attribute-list", but we still give a warning. */
if (lookup_attribute ("fallthrough", TREE_CHAIN (t)))
- warning (OPT_Wattributes, "%<fallthrough%> attribute specified multiple "
+ warning (OPT_Wattributes, "attribute %<fallthrough%> specified multiple "
"times");
/* No attribute-argument-clause shall be present. */
else if (TREE_VALUE (t) != NULL_TREE)
@@ -7836,7 +7841,7 @@ set_underlying_type (tree x)
{
if (x == error_mark_node)
return;
- if (DECL_IS_BUILTIN (x) && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
+ if (DECL_IS_UNDECLARED_BUILTIN (x) && TREE_CODE (TREE_TYPE (x)) != ARRAY_TYPE)
{
if (TYPE_NAME (TREE_TYPE (x)) == 0)
TYPE_NAME (TREE_TYPE (x)) = x;
@@ -7870,7 +7875,7 @@ user_facing_original_type_p (const_tree type)
tree decl = TYPE_NAME (type);
/* Look through any typedef in "user" code. */
- if (!DECL_IN_SYSTEM_HEADER (decl) && !DECL_IS_BUILTIN (decl))
+ if (!DECL_IN_SYSTEM_HEADER (decl) && !DECL_IS_UNDECLARED_BUILTIN (decl))
return true;
/* If the original type is also named and is in the user namespace,
@@ -8142,6 +8147,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);
@@ -8365,13 +8371,13 @@ reject_gcc_builtin (const_tree expr, location_t loc /* = UNKNOWN_LOCATION */)
if (TREE_TYPE (expr)
&& TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE
&& TREE_CODE (expr) == FUNCTION_DECL
- /* The intersection of DECL_BUILT_IN and DECL_IS_BUILTIN avoids
+ /* The intersection of DECL_BUILT_IN and DECL_IS_UNDECLARED_BUILTIN avoids
false positives for user-declared built-ins such as abs or
strlen, and for C++ operators new and delete.
The c_decl_implicit() test avoids false positives for implicitly
declared built-ins with library fallbacks (such as abs). */
&& fndecl_built_in_p (expr)
- && DECL_IS_BUILTIN (expr)
+ && DECL_IS_UNDECLARED_BUILTIN (expr)
&& !c_decl_implicit (expr)
&& !DECL_ASSEMBLER_NAME_SET_P (expr))
{
@@ -9132,8 +9138,9 @@ 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
- && (cnode->has_gimple_body_p () || !DECL_IS_BUILTIN (cnode->decl)))
+ if (!cnode->alias && !cnode->thunk
+ && (cnode->has_gimple_body_p ()
+ || !DECL_IS_UNDECLARED_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..94f4868 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -85,7 +85,7 @@ enum rid
RID_GETTER, RID_SETTER,
RID_READONLY, RID_READWRITE,
RID_ASSIGN, RID_RETAIN, RID_COPY,
- RID_NONATOMIC,
+ RID_PROPATOMIC, RID_NONATOMIC,
/* C (reserved and imaginary types not implemented, so any use is a
syntax error) */
@@ -176,6 +176,7 @@ enum rid
RID_IS_TRIVIALLY_COPYABLE,
RID_IS_UNION, RID_UNDERLYING_TYPE,
RID_IS_ASSIGNABLE, RID_IS_CONSTRUCTIBLE,
+ RID_IS_NOTHROW_ASSIGNABLE, RID_IS_NOTHROW_CONSTRUCTIBLE,
/* C++11 */
RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT,
@@ -274,9 +275,11 @@ enum rid
((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \
(unsigned int) (rid) <= (unsigned int) RID_LAST_PQ)
+/* Keywords permitted in an @property attribute context. */
#define OBJC_IS_PATTR_KEYWORD(rid) \
- ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \
- (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR)
+ ((((unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \
+ (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR)) \
+ || rid == RID_CLASS)
/* OBJC_IS_CXX_KEYWORD recognizes the 'CXX_OBJC' keywords (such as
'class') which are shared in a subtle way between Objective-C and
@@ -1221,6 +1224,7 @@ extern enum omp_clause_defaultmap_kind c_omp_predetermined_mapping (tree);
extern tree c_omp_check_context_selector (location_t, tree);
extern void c_omp_mark_declare_variant (location_t, tree, tree);
extern const char *c_omp_map_clause_name (tree, bool);
+extern void c_omp_adjust_map_clauses (tree, bool);
/* Return next tree in the chain for chain_next walking of tree nodes. */
static inline tree
@@ -1361,7 +1365,7 @@ extern void warn_tautological_cmp (const op_location_t &, enum tree_code,
tree, tree);
extern void warn_logical_not_parentheses (location_t, enum tree_code, tree,
tree);
-extern bool warn_if_unused_value (const_tree, location_t);
+extern bool warn_if_unused_value (const_tree, location_t, bool = false);
extern bool strict_aliasing_warning (location_t, tree, tree);
extern void sizeof_pointer_memaccess_warning (location_t *, tree,
vec<tree, va_gc> *, tree *,
@@ -1373,6 +1377,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 d1e3915..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
@@ -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-indentation.c b/gcc/c-family/c-indentation.c
index 8b88a8a..836a524 100644
--- a/gcc/c-family/c-indentation.c
+++ b/gcc/c-family/c-indentation.c
@@ -45,36 +45,11 @@ next_tab_stop (unsigned int vis_column, unsigned int tab_width)
on the line (up to or before EXPLOC). */
static bool
-get_visual_column (expanded_location exploc, location_t loc,
+get_visual_column (expanded_location exploc,
unsigned int *out,
unsigned int *first_nws,
unsigned int tab_width)
{
- /* PR c++/68819: if the column number is zero, we presumably
- had a location_t > LINE_MAP_MAX_LOCATION_WITH_COLS, and so
- we have no column information.
- Act as if no conversion was possible, triggering the
- error-handling path in the caller. */
- if (!exploc.column)
- {
- static bool issued_note = false;
- if (!issued_note)
- {
- /* Notify the user the first time this happens. */
- issued_note = true;
- inform (loc,
- "%<-Wmisleading-indentation%> is disabled from this point"
- " onwards, since column-tracking was disabled due to"
- " the size of the code/headers");
- if (!flag_large_source_files)
- inform (loc,
- "adding %<-flarge-source-files%> will allow for more"
- " column-tracking support, at the expense of compilation"
- " time and memory");
- }
- return false;
- }
-
char_span line = location_get_source_line (exploc.file, exploc.line);
if (!line)
return false;
@@ -325,14 +300,37 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
NULL);
}
- /* Give up if the loci are not all distinct. */
- if (guard_loc == body_loc || body_loc == next_stmt_loc)
- return false;
-
expanded_location body_exploc = expand_location (body_loc);
expanded_location next_stmt_exploc = expand_location (next_stmt_loc);
expanded_location guard_exploc = expand_location (guard_loc);
+ /* PR c++/68819: if the column number is zero, we presumably
+ had a location_t > LINE_MAP_MAX_LOCATION_WITH_COLS, and so
+ we have no column information. */
+ if (!guard_exploc.column || !body_exploc.column || !next_stmt_exploc.column)
+ {
+ static bool issued_note = false;
+ if (!issued_note)
+ {
+ /* Notify the user the first time this happens. */
+ issued_note = true;
+ inform (guard_loc,
+ "%<-Wmisleading-indentation%> is disabled from this point"
+ " onwards, since column-tracking was disabled due to"
+ " the size of the code/headers");
+ if (!flag_large_source_files)
+ inform (guard_loc,
+ "adding %<-flarge-source-files%> will allow for more"
+ " column-tracking support, at the expense of compilation"
+ " time and memory");
+ }
+ return false;
+ }
+
+ /* Give up if the loci are not all distinct. */
+ if (guard_loc == body_loc || body_loc == next_stmt_loc)
+ return false;
+
const unsigned int tab_width = global_dc->tabstop;
/* They must be in the same file. */
@@ -378,7 +376,7 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
gcc_assert (guard_exploc.line == next_stmt_exploc.line);
unsigned int guard_vis_column;
unsigned int guard_line_first_nws;
- if (!get_visual_column (guard_exploc, guard_loc,
+ if (!get_visual_column (guard_exploc,
&guard_vis_column,
&guard_line_first_nws, tab_width))
return false;
@@ -438,15 +436,15 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
the case for input files containing #line directives, and these
are often for autogenerated sources (e.g. from .md files), where
it's not clear that it's meaningful to look at indentation. */
- if (!get_visual_column (next_stmt_exploc, next_stmt_loc,
+ if (!get_visual_column (next_stmt_exploc,
&next_stmt_vis_column,
&next_stmt_line_first_nws, tab_width))
return false;
- if (!get_visual_column (body_exploc, body_loc,
+ if (!get_visual_column (body_exploc,
&body_vis_column,
&body_line_first_nws, tab_width))
return false;
- if (!get_visual_column (guard_exploc, guard_loc,
+ if (!get_visual_column (guard_exploc,
&guard_vis_column,
&guard_line_first_nws, tab_width))
return false;
@@ -701,7 +699,7 @@ assert_get_visual_column_succeeds (const location &loc,
exploc.sysp = false;
unsigned int actual_visual_column;
unsigned int actual_first_nws;
- bool result = get_visual_column (exploc, UNKNOWN_LOCATION,
+ bool result = get_visual_column (exploc,
&actual_visual_column,
&actual_first_nws, tab_width);
ASSERT_TRUE_AT (loc, result);
@@ -739,7 +737,7 @@ assert_get_visual_column_fails (const location &loc,
exploc.sysp = false;
unsigned int actual_visual_column;
unsigned int actual_first_nws;
- bool result = get_visual_column (exploc, UNKNOWN_LOCATION,
+ bool result = get_visual_column (exploc,
&actual_visual_column,
&actual_first_nws, tab_width);
ASSERT_FALSE_AT (loc, result);
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index b1cef23..e81e16d 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -550,7 +550,11 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags,
returning a token of type CPP_AT_NAME and rid
code RID_CLASS (not RID_AT_CLASS). The language
parser needs to convert that to RID_AT_CLASS.
+ However, we've now spliced the '@' together with the
+ keyword that follows; Adjust the location so that we
+ get a source range covering the composite.
*/
+ *loc = make_location (atloc, atloc, newloc);
break;
}
/* FALLTHROUGH */
diff --git a/gcc/c-family/c-objc.h b/gcc/c-family/c-objc.h
index 6025283..6e96731 100644
--- a/gcc/c-family/c-objc.h
+++ b/gcc/c-family/c-objc.h
@@ -28,6 +28,69 @@ enum GTY(()) objc_ivar_visibility_kind {
OBJC_IVAR_VIS_PACKAGE = 3
};
+/* ObjC property attribute kinds.
+ These have two fields; a unique value (that identifies which attribute)
+ and a group key that indicates membership of an exclusion group.
+ Only one member may be present from an exclusion group in a given attribute
+ list.
+ getters and setters have additional rules, since they are excluded from
+ non-overlapping group sets. */
+
+enum objc_property_attribute_group
+{
+ OBJC_PROPATTR_GROUP_UNKNOWN = 0,
+ OBJC_PROPATTR_GROUP_GETTER,
+ OBJC_PROPATTR_GROUP_SETTER,
+ OBJC_PROPATTR_GROUP_READWRITE,
+ OBJC_PROPATTR_GROUP_ASSIGN,
+ OBJC_PROPATTR_GROUP_ATOMIC,
+ OBJC_PROPATTR_GROUP_CLASS,
+ OBJC_PROPATTR_GROUP_MAX
+};
+
+enum objc_property_attribute_kind
+{
+ OBJC_PROPERTY_ATTR_UNKNOWN = 0|OBJC_PROPATTR_GROUP_UNKNOWN,
+ OBJC_PROPERTY_ATTR_GETTER = ( 1 << 8)|OBJC_PROPATTR_GROUP_GETTER,
+ OBJC_PROPERTY_ATTR_SETTER = ( 2 << 8)|OBJC_PROPATTR_GROUP_SETTER,
+ OBJC_PROPERTY_ATTR_READONLY = ( 3 << 8)|OBJC_PROPATTR_GROUP_READWRITE,
+ OBJC_PROPERTY_ATTR_READWRITE = ( 4 << 8)|OBJC_PROPATTR_GROUP_READWRITE,
+ OBJC_PROPERTY_ATTR_ASSIGN = ( 5 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
+ OBJC_PROPERTY_ATTR_RETAIN = ( 6 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
+ OBJC_PROPERTY_ATTR_COPY = ( 7 << 8)|OBJC_PROPATTR_GROUP_ASSIGN,
+ OBJC_PROPERTY_ATTR_ATOMIC = ( 8 << 8)|OBJC_PROPATTR_GROUP_ATOMIC,
+ OBJC_PROPERTY_ATTR_NONATOMIC = ( 9 << 8)|OBJC_PROPATTR_GROUP_ATOMIC,
+ OBJC_PROPERTY_ATTR_CLASS = (16 << 8)|OBJC_PROPATTR_GROUP_CLASS,
+ OBJC_PROPERTY_ATTR_MAX = (255 << 8|OBJC_PROPATTR_GROUP_MAX)
+};
+
+#define OBJC_PROPATTR_GROUP_MASK 0x0f
+
+/* To contain parsed, but unverified, information about a single property
+ attribute. */
+struct property_attribute_info
+{
+ property_attribute_info () = default;
+ property_attribute_info (tree name, location_t loc,
+ enum objc_property_attribute_kind k)
+ : name (name), ident (NULL_TREE), prop_loc (loc), prop_kind (k),
+ parse_error (false) {}
+
+ enum objc_property_attribute_group group ()
+ {
+ return (enum objc_property_attribute_group)
+ ((unsigned)prop_kind & OBJC_PROPATTR_GROUP_MASK);
+ }
+
+ tree name; /* Name of the attribute. */
+ tree ident; /* For getter/setter cases, the method/selector name. */
+ location_t prop_loc; /* Extended location covering the parsed attr. */
+ enum objc_property_attribute_kind prop_kind : 16;
+ unsigned parse_error : 1; /* The C/C++ parser saw an error in this attr. */
+};
+
+extern enum objc_property_attribute_kind objc_prop_attr_kind_for_rid (enum rid);
+
/* Objective-C / Objective-C++ entry points. */
/* The following ObjC/ObjC++ functions are called by the C and/or C++
@@ -90,8 +153,8 @@ extern tree objc_generate_write_barrier (tree, enum tree_code, tree);
extern void objc_set_method_opt (bool);
extern void objc_finish_foreach_loop (location_t, tree, tree, tree, tree, tree);
extern bool objc_method_decl (enum tree_code);
-extern void objc_add_property_declaration (location_t, tree, bool, bool, bool,
- bool, bool, bool, tree, tree);
+extern void objc_add_property_declaration (location_t, tree,
+ vec<property_attribute_info *>&);
extern tree objc_maybe_build_component_ref (tree, tree);
extern tree objc_build_class_component_ref (tree, tree);
extern tree objc_maybe_build_modify_expr (tree, tree);
@@ -101,6 +164,7 @@ extern void objc_add_synthesize_declaration (location_t, tree);
extern void objc_add_dynamic_declaration (location_t, tree);
extern const char * objc_maybe_printable_name (tree, int);
extern bool objc_is_property_ref (tree);
+extern bool objc_non_constant_expr_p (tree);
extern bool objc_string_ref_type_p (tree);
extern void objc_check_format_arg (tree, tree);
extern void objc_finish_function (void);
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index d7cff0f..8457211 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "gimplify.h"
#include "langhooks.h"
+#include "bitmap.h"
/* Complete a #pragma oacc wait construct. LOC is the location of
@@ -1575,6 +1576,7 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
tree next, c;
enum c_omp_clause_split s;
int i;
+ bool has_dup_allocate = false;
for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++)
cclauses[i] = NULL;
@@ -2198,6 +2200,71 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
else
s = C_OMP_CLAUSE_SPLIT_FOR;
break;
+ /* Allocate clause is allowed on target, teams, distribute, parallel,
+ for, sections and taskloop. Distribute it to all. */
+ case OMP_CLAUSE_ALLOCATE:
+ s = C_OMP_CLAUSE_SPLIT_COUNT;
+ for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++)
+ {
+ switch (i)
+ {
+ case C_OMP_CLAUSE_SPLIT_TARGET:
+ if ((mask & (OMP_CLAUSE_MASK_1
+ << PRAGMA_OMP_CLAUSE_MAP)) == 0)
+ continue;
+ break;
+ case C_OMP_CLAUSE_SPLIT_TEAMS:
+ if ((mask & (OMP_CLAUSE_MASK_1
+ << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) == 0)
+ continue;
+ break;
+ case C_OMP_CLAUSE_SPLIT_DISTRIBUTE:
+ if ((mask & (OMP_CLAUSE_MASK_1
+ << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)) == 0)
+ continue;
+ break;
+ case C_OMP_CLAUSE_SPLIT_PARALLEL:
+ if ((mask & (OMP_CLAUSE_MASK_1
+ << PRAGMA_OMP_CLAUSE_NUM_THREADS)) == 0)
+ continue;
+ break;
+ case C_OMP_CLAUSE_SPLIT_FOR:
+ STATIC_ASSERT (C_OMP_CLAUSE_SPLIT_SECTIONS
+ == C_OMP_CLAUSE_SPLIT_FOR
+ && (C_OMP_CLAUSE_SPLIT_TASKLOOP
+ == C_OMP_CLAUSE_SPLIT_FOR)
+ && (C_OMP_CLAUSE_SPLIT_LOOP
+ == C_OMP_CLAUSE_SPLIT_FOR));
+ if (code == OMP_SECTIONS)
+ break;
+ if ((mask & (OMP_CLAUSE_MASK_1
+ << PRAGMA_OMP_CLAUSE_SCHEDULE)) != 0)
+ break;
+ if ((mask & (OMP_CLAUSE_MASK_1
+ << PRAGMA_OMP_CLAUSE_NOGROUP)) != 0)
+ break;
+ continue;
+ case C_OMP_CLAUSE_SPLIT_SIMD:
+ continue;
+ default:
+ gcc_unreachable ();
+ }
+ if (s != C_OMP_CLAUSE_SPLIT_COUNT)
+ {
+ c = build_omp_clause (OMP_CLAUSE_LOCATION (clauses),
+ OMP_CLAUSE_ALLOCATE);
+ OMP_CLAUSE_DECL (c)
+ = OMP_CLAUSE_DECL (clauses);
+ OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)
+ = OMP_CLAUSE_ALLOCATE_ALLOCATOR (clauses);
+ OMP_CLAUSE_CHAIN (c) = cclauses[s];
+ cclauses[s] = c;
+ has_dup_allocate = true;
+ }
+ s = (enum c_omp_clause_split) i;
+ }
+ gcc_assert (s != C_OMP_CLAUSE_SPLIT_COUNT);
+ break;
default:
gcc_unreachable ();
}
@@ -2205,6 +2272,131 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
cclauses[s] = clauses;
}
+ if (has_dup_allocate)
+ {
+ bool need_prune = false;
+ bitmap_obstack_initialize (NULL);
+ for (i = 0; i < C_OMP_CLAUSE_SPLIT_SIMD - (code == OMP_LOOP); i++)
+ if (cclauses[i])
+ {
+ bitmap_head allocate_head;
+ bitmap_initialize (&allocate_head, &bitmap_default_obstack);
+ for (c = cclauses[i]; c; c = OMP_CLAUSE_CHAIN (c))
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ALLOCATE
+ && DECL_P (OMP_CLAUSE_DECL (c)))
+ bitmap_set_bit (&allocate_head,
+ DECL_UID (OMP_CLAUSE_DECL (c)));
+ for (c = cclauses[i]; c; c = OMP_CLAUSE_CHAIN (c))
+ switch (OMP_CLAUSE_CODE (c))
+ {
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_IN_REDUCTION:
+ case OMP_CLAUSE_TASK_REDUCTION:
+ if (TREE_CODE (OMP_CLAUSE_DECL (c)) == MEM_REF)
+ {
+ tree t = TREE_OPERAND (OMP_CLAUSE_DECL (c), 0);
+ if (TREE_CODE (t) == POINTER_PLUS_EXPR)
+ t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == ADDR_EXPR
+ || TREE_CODE (t) == INDIRECT_REF)
+ t = TREE_OPERAND (t, 0);
+ if (DECL_P (t))
+ bitmap_clear_bit (&allocate_head, DECL_UID (t));
+ break;
+ }
+ else if (TREE_CODE (OMP_CLAUSE_DECL (c)) == TREE_LIST)
+ {
+ tree t;
+ for (t = OMP_CLAUSE_DECL (c);
+ TREE_CODE (t) == TREE_LIST; t = TREE_CHAIN (t))
+ ;
+ if (DECL_P (t))
+ bitmap_clear_bit (&allocate_head, DECL_UID (t));
+ break;
+ }
+ /* FALLTHRU */
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_LINEAR:
+ if (DECL_P (OMP_CLAUSE_DECL (c)))
+ bitmap_clear_bit (&allocate_head,
+ DECL_UID (OMP_CLAUSE_DECL (c)));
+ break;
+ default:
+ break;
+ }
+ for (c = cclauses[i]; c; c = OMP_CLAUSE_CHAIN (c))
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ALLOCATE
+ && DECL_P (OMP_CLAUSE_DECL (c))
+ && bitmap_bit_p (&allocate_head,
+ DECL_UID (OMP_CLAUSE_DECL (c))))
+ {
+ /* Mark allocate clauses which don't have corresponding
+ explicit data sharing clause. */
+ OMP_CLAUSE_ALLOCATE_COMBINED (c) = 1;
+ need_prune = true;
+ }
+ }
+ bitmap_obstack_release (NULL);
+ if (need_prune)
+ {
+ /* At least one allocate clause has been marked. Walk all the
+ duplicated allocate clauses in sync. If it is marked in all
+ constituent constructs, diagnose it as invalid and remove
+ them. Otherwise, remove all marked inner clauses inside
+ a construct that doesn't have them marked. Keep the outer
+ marked ones, because some clause duplication is done only
+ during gimplification. */
+ tree *p[C_OMP_CLAUSE_SPLIT_COUNT];
+ for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++)
+ if (cclauses[i] == NULL_TREE
+ || i == C_OMP_CLAUSE_SPLIT_SIMD
+ || (i == C_OMP_CLAUSE_SPLIT_LOOP && code == OMP_LOOP))
+ p[i] = NULL;
+ else
+ p[i] = &cclauses[i];
+ do
+ {
+ int j = -1;
+ tree seen = NULL_TREE;
+ for (i = C_OMP_CLAUSE_SPLIT_COUNT - 1; i >= 0; i--)
+ if (p[i])
+ {
+ while (*p[i]
+ && OMP_CLAUSE_CODE (*p[i]) != OMP_CLAUSE_ALLOCATE)
+ p[i] = &OMP_CLAUSE_CHAIN (*p[i]);
+ if (*p[i] == NULL_TREE)
+ {
+ i = C_OMP_CLAUSE_SPLIT_COUNT;
+ break;
+ }
+ if (!OMP_CLAUSE_ALLOCATE_COMBINED (*p[i]) && j == -1)
+ j = i;
+ seen = *p[i];
+ }
+ if (i == C_OMP_CLAUSE_SPLIT_COUNT)
+ break;
+ if (j == -1)
+ error_at (OMP_CLAUSE_LOCATION (seen),
+ "%qD specified in %<allocate%> clause but not in "
+ "an explicit privatization clause",
+ OMP_CLAUSE_DECL (seen));
+ for (i = 0; i < C_OMP_CLAUSE_SPLIT_COUNT; i++)
+ if (p[i])
+ {
+ if (i > j)
+ /* Remove. */
+ *p[i] = OMP_CLAUSE_CHAIN (*p[i]);
+ else
+ /* Keep. */
+ p[i] = &OMP_CLAUSE_CHAIN (*p[i]);
+ }
+ }
+ while (1);
+ }
+ }
+
if (!flag_checking)
return;
@@ -2579,3 +2771,93 @@ c_omp_map_clause_name (tree clause, bool oacc)
}
return omp_clause_code_name[OMP_CLAUSE_CODE (clause)];
}
+
+/* Used to merge map clause information in c_omp_adjust_map_clauses. */
+struct map_clause
+{
+ tree clause;
+ bool firstprivate_ptr_p;
+ bool decl_mapped;
+ bool omp_declare_target;
+ map_clause (void) : clause (NULL_TREE), firstprivate_ptr_p (false),
+ decl_mapped (false), omp_declare_target (false) { }
+};
+
+/* Adjust map clauses after normal clause parsing, mainly to turn specific
+ base-pointer map cases into attach/detach and mark them addressable. */
+void
+c_omp_adjust_map_clauses (tree clauses, bool is_target)
+{
+ if (!is_target)
+ {
+ /* If this is not a target construct, just turn firstprivate pointers
+ into attach/detach, the runtime will check and do the rest. */
+
+ for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+ && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
+ && DECL_P (OMP_CLAUSE_DECL (c))
+ && POINTER_TYPE_P (TREE_TYPE (OMP_CLAUSE_DECL (c))))
+ {
+ tree ptr = OMP_CLAUSE_DECL (c);
+ OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ATTACH_DETACH);
+ c_common_mark_addressable_vec (ptr);
+ }
+ return;
+ }
+
+ hash_map<tree, map_clause> maps;
+
+ for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+ && DECL_P (OMP_CLAUSE_DECL (c)))
+ {
+ /* If this is for a target construct, the firstprivate pointer
+ is changed to attach/detach if either is true:
+ (1) the base-pointer is mapped in this same construct, or
+ (2) the base-pointer is a variable place on the device by
+ "declare target" directives.
+
+ Here we iterate through all map clauses collecting these cases,
+ and merge them with a hash_map to process below. */
+
+ if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
+ && POINTER_TYPE_P (TREE_TYPE (OMP_CLAUSE_DECL (c))))
+ {
+ tree ptr = OMP_CLAUSE_DECL (c);
+ map_clause &mc = maps.get_or_insert (ptr);
+ if (mc.clause == NULL_TREE)
+ mc.clause = c;
+ mc.firstprivate_ptr_p = true;
+
+ if (is_global_var (ptr)
+ && lookup_attribute ("omp declare target",
+ DECL_ATTRIBUTES (ptr)))
+ mc.omp_declare_target = true;
+ }
+ else if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALLOC
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FROM
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TOFROM
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_TO
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_FROM
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_TOFROM)
+ {
+ map_clause &mc = maps.get_or_insert (OMP_CLAUSE_DECL (c));
+ mc.decl_mapped = true;
+ }
+ }
+
+ for (hash_map<tree, map_clause>::iterator i = maps.begin ();
+ i != maps.end (); ++i)
+ {
+ map_clause &mc = (*i).second;
+
+ if (mc.firstprivate_ptr_p
+ && (mc.decl_mapped || mc.omp_declare_target))
+ {
+ OMP_CLAUSE_SET_MAP_KIND (mc.clause, GOMP_MAP_ATTACH_DETACH);
+ c_common_mark_addressable_vec (OMP_CLAUSE_DECL (mc.clause));
+ }
+ }
+}
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 38d3384..0698e58 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -752,8 +752,6 @@ default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
bool
c_common_post_options (const char **pfilename)
{
- struct cpp_callbacks *cb;
-
/* Canonicalize the input and output filenames. */
if (in_fnames == NULL)
{
@@ -925,6 +923,16 @@ c_common_post_options (const char **pfilename)
SET_OPTION_IF_UNSET (&global_options, &global_options_set, warn_volatile,
cxx_dialect >= cxx20 && warn_deprecated);
+ /* -Wdeprecated-enum-enum-conversion is enabled by default in C++20. */
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_deprecated_enum_enum_conv,
+ cxx_dialect >= cxx20 && warn_deprecated);
+
+ /* -Wdeprecated-enum-float-conversion is enabled by default in C++20. */
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_deprecated_enum_float_conv,
+ cxx_dialect >= cxx20 && warn_deprecated);
+
/* Declone C++ 'structors if -Os. */
if (flag_declone_ctor_dtor == -1)
flag_declone_ctor_dtor = optimize_size;
@@ -1095,7 +1103,7 @@ c_common_post_options (const char **pfilename)
input_location = UNKNOWN_LOCATION;
}
- cb = cpp_get_callbacks (parse_in);
+ struct cpp_callbacks *cb = cpp_get_callbacks (parse_in);
cb->file_change = cb_file_change;
cb->dir_change = cb_dir_change;
cpp_post_options (parse_in);
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index dc52ee8..d68985c 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -809,16 +809,15 @@ handle_pragma_diagnostic(cpp_reader *ARG_UNUSED(dummy))
unsigned int option_index = find_opt (option_string + 1, lang_mask);
if (option_index == OPT_SPECIAL_unknown)
{
- option_proposer op;
- const char *hint = op.suggest_option (option_string + 1);
- if (hint)
- warning_at (loc, OPT_Wpragmas,
- "unknown option after %<#pragma GCC diagnostic%> kind;"
- " did you mean %<-%s%>?", hint);
- else
- warning_at (loc, OPT_Wpragmas,
- "unknown option after %<#pragma GCC diagnostic%> kind");
-
+ auto_diagnostic_group d;
+ if (warning_at (loc, OPT_Wpragmas,
+ "unknown option after %<#pragma GCC diagnostic%> kind"))
+ {
+ option_proposer op;
+ const char *hint = op.suggest_option (option_string + 1);
+ if (hint)
+ inform (loc, "did you mean %<-%s%>?", hint);
+ }
return;
}
else if (!(cl_options[option_index].flags & CL_WARNING))
diff --git a/gcc/c-family/c-pragma.h b/gcc/c-family/c-pragma.h
index 3e9695fa..5a493fe 100644
--- a/gcc/c-family/c-pragma.h
+++ b/gcc/c-family/c-pragma.h
@@ -86,6 +86,7 @@ enum pragma_omp_clause {
PRAGMA_OMP_CLAUSE_NONE = 0,
PRAGMA_OMP_CLAUSE_ALIGNED,
+ PRAGMA_OMP_CLAUSE_ALLOCATE,
PRAGMA_OMP_CLAUSE_BIND,
PRAGMA_OMP_CLAUSE_COLLAPSE,
PRAGMA_OMP_CLAUSE_COPYIN,
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index ebd011d..6d1f9a7 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -585,7 +585,7 @@ warn_logical_not_parentheses (location_t location, enum tree_code code,
(potential) location of the expression. */
bool
-warn_if_unused_value (const_tree exp, location_t locus)
+warn_if_unused_value (const_tree exp, location_t locus, bool quiet)
{
restart:
if (TREE_USED (exp) || TREE_NO_WARNING (exp))
@@ -633,7 +633,7 @@ warn_if_unused_value (const_tree exp, location_t locus)
goto restart;
case COMPOUND_EXPR:
- if (warn_if_unused_value (TREE_OPERAND (exp, 0), locus))
+ if (warn_if_unused_value (TREE_OPERAND (exp, 0), locus, quiet))
return true;
/* Let people do `(foo (), 0)' without a warning. */
if (TREE_CONSTANT (TREE_OPERAND (exp, 1)))
@@ -648,6 +648,13 @@ warn_if_unused_value (const_tree exp, location_t locus)
return false;
goto warn;
+ case COMPLEX_EXPR:
+ /* Warn only if both operands are unused. */
+ if (warn_if_unused_value (TREE_OPERAND (exp, 0), locus, true)
+ && warn_if_unused_value (TREE_OPERAND (exp, 1), locus, true))
+ goto warn;
+ return false;
+
case INDIRECT_REF:
/* Don't warn about automatic dereferencing of references, since
the user cannot control it. */
@@ -671,6 +678,8 @@ warn_if_unused_value (const_tree exp, location_t locus)
return false;
warn:
+ if (quiet)
+ return true;
return warning_at (locus, OPT_Wunused_value, "value computed is not used");
}
}
@@ -3177,14 +3186,14 @@ 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);
- if (!newtyp)
- /* Bail on error. */
- return;
-
if (TREE_CODE (curtyp) != ARRAY_TYPE
|| TREE_CODE (newtyp) != ARRAY_TYPE)
{
@@ -3665,3 +3674,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 bbf7da8..fe16357 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -242,11 +242,11 @@ Generate phony targets for all headers.
MQ
C ObjC C++ ObjC++ Joined Separate MissingArgError(missing makefile target after %qs)
--MQ <target> Add a MAKE-quoted target.
+-MQ <target> Add a target that may require quoting.
MT
C ObjC C++ ObjC++ Joined Separate MissingArgError(missing makefile target after %qs)
--MT <target> Add an unquoted target.
+-MT <target> Add a target that does not require quoting.
P
C ObjC C++ ObjC++
@@ -256,6 +256,10 @@ U
C ObjC C++ ObjC++ Joined Separate MissingArgError(macro name missing after %qs)
-U<macro> Undefine <macro>.
+WNSObject-attribute
+C ObjC C++ ObjC++ LTO Var(warn_nsobject_attribute) Warning Init(1)
+Warn if the NSObject attribute is applied to a non-typedef.
+
Wabi
C ObjC C++ ObjC++ LTO Var(warn_abi) Warning
Warn about things that will change when compiling with an ABI-compliant compiler.
@@ -518,6 +522,15 @@ C++ ObjC++ Var(warn_deprecated_copy, 2) Warning
Mark implicitly-declared copy operations as deprecated if the class has a
user-provided copy operation or destructor.
+Wdeprecated-enum-enum-conversion
+C++ ObjC++ Var(warn_deprecated_enum_enum_conv) Warning
+Warn about deprecated arithmetic conversions on operands of enumeration types.
+
+Wdeprecated-enum-float-conversion
+C++ ObjC++ Var(warn_deprecated_enum_float_conv) Warning
+Warn about deprecated arithmetic conversions on operands where one is of enumeration
+type and the other is of a floating-point type.
+
Wdesignated-init
C ObjC Var(warn_designated_init) Init(1) Warning
Warn about positional initialization of structs requiring designated initializers.
@@ -559,7 +572,7 @@ C ObjC C++ ObjC++ Var(warn_enum_compare) Init(-1) Warning LangEnabledBy(C ObjC,W
Warn about comparison of different enum types.
Wenum-conversion
-C ObjC Var(warn_enum_conversion) Init(0) Warning LangEnabledBy(C ObjC,Wextra)
+C ObjC C++ ObjC++ Var(warn_enum_conversion) Init(0) Warning LangEnabledBy(C ObjC,Wextra)
Warn about implicit conversion of enum types.
Werror
@@ -570,6 +583,10 @@ Werror-implicit-function-declaration
C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
This switch is deprecated; use -Werror=implicit-function-declaration instead.
+Wexceptions
+C++ ObjC++ Var(warn_exceptions) Init(1)
+Warn when an exception handler is shadowed by another handler.
+
Wextra
C ObjC C++ ObjC++ Warning
; in common.opt
@@ -816,6 +833,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.
@@ -1260,6 +1282,10 @@ Wvarargs
C ObjC C++ ObjC++ Warning Var(warn_varargs) Init(1)
Warn about questionable usage of the macros used to retrieve variable arguments.
+Wvexing-parse
+C++ ObjC++ Warning Var(warn_vexing_parse) Init(1)
+Warn about the most vexing parse syntactic ambiguity.
+
Wvla
C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning
Warn if a variable length array is used.
diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c
index c30f0b3..2f53557 100644
--- a/gcc/c-family/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
@@ -23,6 +23,12 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
+#include "vec.h"
+
+/* Provide a dummy type for the RID enum used as an argument to
+ objc_prop_attr_kind_for_rid () */
+enum rid { DUMMY };
+
#include "c-objc.h"
tree
@@ -314,14 +320,8 @@ objc_get_class_ivars (tree ARG_UNUSED (name))
void
objc_add_property_declaration (location_t ARG_UNUSED (location),
tree ARG_UNUSED (decl),
- bool ARG_UNUSED (parsed_property_readonly),
- bool ARG_UNUSED (parsed_property_readwrite),
- bool ARG_UNUSED (parsed_property_assign),
- bool ARG_UNUSED (parsed_property_retain),
- bool ARG_UNUSED (parsed_property_copy),
- bool ARG_UNUSED (parsed_property_nonatomic),
- tree ARG_UNUSED (parsed_property_getter_ident),
- tree ARG_UNUSED (parsed_property_setter_ident))
+ vec<property_attribute_info *>&
+ /*prop_attr_list*/)
{
}
@@ -331,6 +331,12 @@ objc_is_property_ref (tree ARG_UNUSED (node))
return 0;
}
+bool
+objc_non_constant_expr_p (tree)
+{
+ return 0;
+}
+
tree
objc_maybe_build_component_ref (tree ARG_UNUSED (datum), tree ARG_UNUSED (component))
{
@@ -459,3 +465,8 @@ void
objc_maybe_warn_exceptions (location_t ARG_UNUSED (loc))
{
}
+
+enum objc_property_attribute_kind objc_prop_attr_kind_for_rid (enum rid)
+{
+ return OBJC_PROPERTY_ATTR_UNKNOWN;
+}
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 839bfa1..5b0d42c 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,93 @@
+2020-11-07 Martin Uecker <muecker@gwdg.de>
+
+ * c-parser.c (c_parser_label): Implement mixing of labels and code.
+ (c_parser_all_labels): Likewise.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-parser.c (c_parser_objc_at_property_declaration):
+ Improve parsing fidelity. Associate better location info
+ with @property attributes. Clean up the interface to
+ objc_add_property_declaration ().
+
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * c-decl.c (diagnose_mismatched_decls): Rename
+ DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
+ (warn_if_shadowing, implicitly_declare, names_builtin_p)
+ (collect_source_refs): Likewise.
+ * c-typeck.c (inform_declaration, inform_for_arg)
+ (convert_for_assignment): Likewise.
+
+2020-11-06 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-parser.c (c_parser_omp_atomic): Add openacc parameter and update
+ OpenACC matching.
+ (c_parser_omp_construct): Update call.
+
+2020-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97670
+ * c-typeck.c (c_finish_omp_clauses): Look through array reductions to
+ find underlying decl to clear in the aligned_head bitmap.
+
+2020-11-04 Joseph Myers <joseph@codesourcery.com>
+
+ * c-decl.c (handle_nodiscard_attribute): New.
+ (std_attribute_table): Add nodiscard.
+ * c-parser.c (c_parser_std_attribute): Expect argument to
+ nodiscard attribute to be a string. Do not special-case ignoring
+ nodiscard.
+ * c-typeck.c (maybe_warn_nodiscard): New.
+ (build_compound_expr, emit_side_effect_warnings): Call
+ maybe_warn_nodiscard.
+ (c_process_expr_stmt, c_finish_stmt_expr): Also call
+ emit_side_effect_warnings if warn_unused_result.
+
+2020-10-29 Asher Gordon <AsDaGo@posteo.net>
+
+ * c-typeck.c (free_all_tagged_tu_seen_up_to): Replace free
+ with XDELETE.
+ (finish_init): Likewise.
+ (pop_init_level): Likewise.
+
+2020-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * c-decl.c (store_parm_decls_newstyle): Use pedwarn_c11 not
+ error_at for omitted parameter name.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * c-parser.c (c_parser_omp_clause_name): Handle allocate.
+ (c_parser_omp_clause_allocate): New function.
+ (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE.
+ (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
+ OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK,
+ OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK,
+ OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK,
+ OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add
+ PRAGMA_OMP_CLAUSE_ALLOCATE.
+ * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
+
+2020-10-27 Joseph Myers <joseph@codesourcery.com>
+
+ * c-parser.c (c_parser_std_attribute_specifier): Allow duplicate
+ standard attributes.
+
+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..f19c82c 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -2051,7 +2051,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
}
}
else if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_IS_BUILTIN (olddecl))
+ && DECL_IS_UNDECLARED_BUILTIN (olddecl))
{
/* A conflicting function declaration for a predeclared
function that isn't actually built in. Objective C uses
@@ -2265,7 +2265,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
built in, newdecl silently overrides olddecl. The latter
occur only in Objective C; see also above. (FIXME: Make
Objective C use normal builtins.) */
- if (!DECL_IS_BUILTIN (olddecl)
+ if (!DECL_IS_UNDECLARED_BUILTIN (olddecl)
&& !DECL_EXTERN_INLINE (olddecl))
{
auto_diagnostic_group d;
@@ -2978,7 +2978,7 @@ warn_if_shadowing (tree new_decl)
|| warn_shadow_local
|| warn_shadow_compatible_local)
/* No shadow warnings for internally generated vars. */
- || DECL_IS_BUILTIN (new_decl))
+ || DECL_IS_UNDECLARED_BUILTIN (new_decl))
return;
/* Is anything being shadowed? Invisible decls do not count. */
@@ -3631,7 +3631,7 @@ implicitly_declare (location_t loc, tree functionid)
in the external scope because they're pushed before the file
scope gets created. Catch this here and rebind them into the
file scope. */
- if (!fndecl_built_in_p (decl) && DECL_IS_BUILTIN (decl))
+ if (!fndecl_built_in_p (decl) && DECL_IS_UNDECLARED_BUILTIN (decl))
{
bind (functionid, decl, file_scope,
/*invisible=*/false, /*nested=*/true,
@@ -4400,6 +4400,31 @@ lookup_name_fuzzy (tree name, enum lookup_name_fuzzy_kind kind, location_t loc)
}
+/* Handle the standard [[nodiscard]] attribute. */
+
+static tree
+handle_nodiscard_attribute (tree *node, tree name, tree /*args*/,
+ int /*flags*/, bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) == FUNCTION_DECL)
+ {
+ if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
+ warning_at (DECL_SOURCE_LOCATION (*node),
+ OPT_Wattributes, "%qE attribute applied to %qD with void "
+ "return type", name, *node);
+ }
+ else if (RECORD_OR_UNION_TYPE_P (*node)
+ || TREE_CODE (*node) == ENUMERAL_TYPE)
+ /* OK */;
+ else
+ {
+ pedwarn (input_location,
+ OPT_Wattributes, "%qE attribute can only be applied to "
+ "functions or to structure, union or enumeration types", name);
+ *no_add_attrs = true;
+ }
+ return NULL_TREE;
+}
/* Table of supported standard (C2x) attributes. */
const struct attribute_spec std_attribute_table[] =
{
@@ -4411,6 +4436,8 @@ const struct attribute_spec std_attribute_table[] =
handle_fallthrough_attribute, NULL },
{ "maybe_unused", 0, 0, false, false, false, false,
handle_unused_attribute, NULL },
+ { "nodiscard", 0, 1, false, false, false, false,
+ handle_nodiscard_attribute, NULL },
{ NULL, 0, 0, false, false, false, false, NULL, NULL }
};
@@ -5784,6 +5811,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 +5826,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;
}
@@ -9628,7 +9657,9 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info)
warn_if_shadowing (decl);
}
else
- error_at (DECL_SOURCE_LOCATION (decl), "parameter name omitted");
+ pedwarn_c11 (DECL_SOURCE_LOCATION (decl), OPT_Wpedantic,
+ "ISO C does not support omitting parameter names in "
+ "function definitions before C2X");
}
/* Record the parameter list in the function declaration. */
@@ -10469,7 +10500,7 @@ names_builtin_p (const char *name)
{
tree id = get_identifier (name);
if (tree decl = identifier_global_value (id))
- return TREE_CODE (decl) == FUNCTION_DECL && DECL_IS_BUILTIN (decl);
+ return TREE_CODE (decl) == FUNCTION_DECL && DECL_IS_UNDECLARED_BUILTIN (decl);
/* Also detect common reserved C words that aren't strictly built-in
functions. */
@@ -12103,12 +12134,12 @@ collect_source_refs (void)
{
decls = DECL_INITIAL (t);
for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl))
- if (!DECL_IS_BUILTIN (decl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (decl))
collect_source_ref (DECL_SOURCE_FILE (decl));
}
for (decl = BLOCK_VARS (ext_block); decl; decl = TREE_CHAIN (decl))
- if (!DECL_IS_BUILTIN (decl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (decl))
collect_source_ref (DECL_SOURCE_FILE (decl));
}
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 7d58356..377914c 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -1521,7 +1521,7 @@ static void c_parser_initval (c_parser *, struct c_expr *,
struct obstack *);
static tree c_parser_compound_statement (c_parser *, location_t * = NULL);
static location_t c_parser_compound_statement_nostart (c_parser *);
-static void c_parser_label (c_parser *);
+static void c_parser_label (c_parser *, tree);
static void c_parser_statement (c_parser *, bool *, location_t * = NULL);
static void c_parser_statement_after_labels (c_parser *, bool *,
vec<tree> * = NULL);
@@ -4950,7 +4950,8 @@ c_parser_std_attribute (c_parser *parser, bool for_tm)
&& attribute_takes_identifier_p (name));
bool require_string
= (ns == NULL_TREE
- && strcmp (IDENTIFIER_POINTER (name), "deprecated") == 0);
+ && (strcmp (IDENTIFIER_POINTER (name), "deprecated") == 0
+ || strcmp (IDENTIFIER_POINTER (name), "nodiscard") == 0));
TREE_VALUE (attribute)
= c_parser_attribute_arguments (parser, takes_identifier,
require_string, false);
@@ -4960,13 +4961,12 @@ c_parser_std_attribute (c_parser *parser, bool for_tm)
parens.require_close (parser);
}
out:
- if (ns == NULL_TREE && !for_tm && !as && !is_attribute_p ("nodiscard", name))
+ if (ns == NULL_TREE && !for_tm && !as)
{
/* An attribute with standard syntax and no namespace specified
is a constraint violation if it is not one of the known
- standard attributes (of which nodiscard is the only one
- without a handler in GCC). Diagnose it here with a pedwarn
- and then discard it to prevent a duplicate warning later. */
+ standard attributes. Diagnose it here with a pedwarn and
+ then discard it to prevent a duplicate warning later. */
pedwarn (input_location, OPT_Wattributes, "%qE attribute ignored",
name);
return error_mark_node;
@@ -4977,9 +4977,6 @@ c_parser_std_attribute (c_parser *parser, bool for_tm)
static tree
c_parser_std_attribute_specifier (c_parser *parser, bool for_tm)
{
- bool seen_deprecated = false;
- bool seen_fallthrough = false;
- bool seen_maybe_unused = false;
location_t loc = c_parser_peek_token (parser)->location;
if (!c_parser_require (parser, CPP_OPEN_SQUARE, "expected %<[%>"))
return NULL_TREE;
@@ -5005,55 +5002,8 @@ c_parser_std_attribute_specifier (c_parser *parser, bool for_tm)
tree attribute = c_parser_std_attribute (parser, for_tm);
if (attribute != error_mark_node)
{
- bool duplicate = false;
- tree name = get_attribute_name (attribute);
- tree ns = get_attribute_namespace (attribute);
- if (ns == NULL_TREE)
- {
- /* Some standard attributes may appear at most once in
- each attribute list. Diagnose duplicates and remove
- them from the list to avoid subsequent diagnostics
- such as the more general one for multiple
- "fallthrough" attributes in the same place (including
- in separate attribute lists in the same attribute
- specifier sequence, which is not a constraint
- violation). */
- if (is_attribute_p ("deprecated", name))
- {
- if (seen_deprecated)
- {
- error ("attribute %<deprecated%> can appear at most "
- "once in an attribute-list");
- duplicate = true;
- }
- seen_deprecated = true;
- }
- else if (is_attribute_p ("fallthrough", name))
- {
- if (seen_fallthrough)
- {
- error ("attribute %<fallthrough%> can appear at most "
- "once in an attribute-list");
- duplicate = true;
- }
- seen_fallthrough = true;
- }
- else if (is_attribute_p ("maybe_unused", name))
- {
- if (seen_maybe_unused)
- {
- error ("attribute %<maybe_unused%> can appear at most "
- "once in an attribute-list");
- duplicate = true;
- }
- seen_maybe_unused = true;
- }
- }
- if (!duplicate)
- {
- TREE_CHAIN (attribute) = attributes;
- attributes = attribute;
- }
+ TREE_CHAIN (attribute) = attributes;
+ attributes = attribute;
}
if (c_parser_next_token_is_not (parser, CPP_COMMA))
break;
@@ -5573,7 +5523,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
}
/* Parse a compound statement (possibly a function body) (C90 6.6.2,
- C99 6.8.2, C11 6.8.2).
+ C99 6.8.2, C11 6.8.2, C2X 6.8.2).
compound-statement:
{ block-item-list[opt] }
@@ -5584,6 +5534,7 @@ c_parser_initval (c_parser *parser, struct c_expr *after,
block-item-list block-item
block-item:
+ label
nested-declaration
statement
@@ -5724,7 +5675,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
{
location_t loc = c_parser_peek_token (parser)->location;
loc = expansion_point_location_if_in_system_header (loc);
- /* Standard attributes may start a statement or a declaration. */
+ /* Standard attributes may start a label, statement or declaration. */
bool have_std_attrs
= c_parser_nth_token_starts_std_attributes (parser, 1);
tree std_attrs = NULL_TREE;
@@ -5735,7 +5686,6 @@ c_parser_compound_statement_nostart (c_parser *parser)
|| (c_parser_next_token_is (parser, CPP_NAME)
&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
{
- c_warn_unused_attributes (std_attrs);
if (c_parser_next_token_is_keyword (parser, RID_CASE))
label_loc = c_parser_peek_2nd_token (parser)->location;
else
@@ -5743,27 +5693,31 @@ c_parser_compound_statement_nostart (c_parser *parser)
last_label = true;
last_stmt = false;
mark_valid_location_for_stdc_pragma (false);
- c_parser_label (parser);
+ c_parser_label (parser, std_attrs);
}
- else if (!last_label
- && (c_parser_next_tokens_start_declaration (parser)
- || (have_std_attrs
- && c_parser_next_token_is (parser, CPP_SEMICOLON))))
+ else if (c_parser_next_tokens_start_declaration (parser)
+ || (have_std_attrs
+ && c_parser_next_token_is (parser, CPP_SEMICOLON)))
{
- last_label = false;
+ if (last_label)
+ pedwarn_c11 (c_parser_peek_token (parser)->location, OPT_Wpedantic,
+ "a label can only be part of a statement and "
+ "a declaration is not a statement");
+
mark_valid_location_for_stdc_pragma (false);
bool fallthru_attr_p = false;
c_parser_declaration_or_fndef (parser, true, !have_std_attrs,
true, true, true, NULL,
vNULL, have_std_attrs, std_attrs,
NULL, &fallthru_attr_p);
+
if (last_stmt && !fallthru_attr_p)
pedwarn_c90 (loc, OPT_Wdeclaration_after_statement,
"ISO C90 forbids mixed declarations and code");
last_stmt = fallthru_attr_p;
+ last_label = false;
}
- else if (!last_label
- && c_parser_next_token_is_keyword (parser, RID_EXTENSION))
+ else if (c_parser_next_token_is_keyword (parser, RID_EXTENSION))
{
/* __extension__ can start a declaration, but is also an
unary operator that can start an expression. Consume all
@@ -5846,7 +5800,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
parser->error = false;
}
if (last_label)
- error_at (label_loc, "label at end of compound statement");
+ pedwarn_c11 (label_loc, OPT_Wpedantic, "label at end of compound statement");
location_t endloc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser);
/* Restore the value we started with. */
@@ -5862,19 +5816,29 @@ c_parser_compound_statement_nostart (c_parser *parser)
static void
c_parser_all_labels (c_parser *parser)
{
+ tree std_attrs = NULL;
if (c_parser_nth_token_starts_std_attributes (parser, 1))
{
- tree std_attrs = c_parser_std_attribute_specifier_sequence (parser);
+ std_attrs = c_parser_std_attribute_specifier_sequence (parser);
if (c_parser_next_token_is (parser, CPP_SEMICOLON))
c_parser_error (parser, "expected statement");
- else
- c_warn_unused_attributes (std_attrs);
}
while (c_parser_next_token_is_keyword (parser, RID_CASE)
|| c_parser_next_token_is_keyword (parser, RID_DEFAULT)
|| (c_parser_next_token_is (parser, CPP_NAME)
&& c_parser_peek_2nd_token (parser)->type == CPP_COLON))
- c_parser_label (parser);
+ {
+ c_parser_label (parser, std_attrs);
+ std_attrs = NULL;
+ if (c_parser_nth_token_starts_std_attributes (parser, 1))
+ {
+ std_attrs = c_parser_std_attribute_specifier_sequence (parser);
+ if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+ c_parser_error (parser, "expected statement");
+ }
+ }
+ if (std_attrs)
+ c_warn_unused_attributes (std_attrs);
}
/* Parse a label (C90 6.6.1, C99 6.8.1, C11 6.8.1).
@@ -5896,9 +5860,8 @@ c_parser_all_labels (c_parser *parser)
in the caller, to distinguish statements from declarations. Any
attribute-specifier-sequence after the label is parsed in this
function. */
-
static void
-c_parser_label (c_parser *parser)
+c_parser_label (c_parser *parser, tree std_attrs)
{
location_t loc1 = c_parser_peek_token (parser)->location;
tree label = NULL_TREE;
@@ -5948,8 +5911,13 @@ c_parser_label (c_parser *parser)
if (tlab)
{
decl_attributes (&tlab, attrs, 0);
+ decl_attributes (&tlab, std_attrs, 0);
label = add_stmt (build_stmt (loc1, LABEL_EXPR, tlab));
}
+ if (attrs
+ && c_parser_next_tokens_start_declaration (parser))
+ warning_at (loc2, OPT_Wattributes, "GNU-style attribute between"
+ " label and declaration appertains to the label");
}
if (label)
{
@@ -5957,55 +5925,6 @@ c_parser_label (c_parser *parser)
FALLTHROUGH_LABEL_P (LABEL_EXPR_LABEL (label)) = fallthrough_p;
else
FALLTHROUGH_LABEL_P (CASE_LABEL (label)) = fallthrough_p;
-
- /* Standard attributes are only allowed here if they start a
- statement, not a declaration (including the case of an
- attribute-declaration with only attributes). */
- bool have_std_attrs
- = c_parser_nth_token_starts_std_attributes (parser, 1);
- tree std_attrs = NULL_TREE;
- if (have_std_attrs)
- std_attrs = c_parser_std_attribute_specifier_sequence (parser);
-
- /* Allow '__attribute__((fallthrough));'. */
- if (!have_std_attrs
- && c_parser_next_token_is_keyword (parser, RID_ATTRIBUTE))
- {
- location_t loc = c_parser_peek_token (parser)->location;
- tree attrs = c_parser_gnu_attributes (parser);
- if (attribute_fallthrough_p (attrs))
- {
- if (c_parser_next_token_is (parser, CPP_SEMICOLON))
- {
- tree fn = build_call_expr_internal_loc (loc,
- IFN_FALLTHROUGH,
- void_type_node, 0);
- add_stmt (fn);
- }
- else
- warning_at (loc, OPT_Wattributes, "%<fallthrough%> attribute "
- "not followed by %<;%>");
- }
- else if (attrs != NULL_TREE)
- warning_at (loc, OPT_Wattributes, "only attribute %<fallthrough%>"
- " can be applied to a null statement");
- }
- if (c_parser_next_tokens_start_declaration (parser)
- || (have_std_attrs
- && c_parser_next_token_is (parser, CPP_SEMICOLON)))
- {
- error_at (c_parser_peek_token (parser)->location,
- "a label can only be part of a statement and "
- "a declaration is not a statement");
- c_parser_declaration_or_fndef (parser, /*fndef_ok*/ false,
- /*static_assert_ok*/ true,
- /*empty_ok*/ true, /*nested*/ true,
- /*start_attr_ok*/ true, NULL,
- vNULL, have_std_attrs, std_attrs);
- }
- else if (std_attrs)
- /* Nonempty attributes on the following statement are ignored. */
- c_warn_unused_attributes (std_attrs);
}
}
@@ -7876,7 +7795,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 +7813,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 +7831,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 +9103,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 +10721,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 +10745,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;
@@ -11996,158 +11927,196 @@ c_parser_objc_diagnose_bad_element_prefix (c_parser *parser,
static void
c_parser_objc_at_property_declaration (c_parser *parser)
{
- /* The following variables hold the attributes of the properties as
- parsed. They are 'false' or 'NULL_TREE' if the attribute was not
- seen. When we see an attribute, we set them to 'true' (if they
- are boolean properties) or to the identifier (if they have an
- argument, ie, for getter and setter). Note that here we only
- parse the list of attributes, check the syntax and accumulate the
- attributes that we find. objc_add_property_declaration() will
- then process the information. */
- bool property_assign = false;
- bool property_copy = false;
- tree property_getter_ident = NULL_TREE;
- bool property_nonatomic = false;
- bool property_readonly = false;
- bool property_readwrite = false;
- bool property_retain = false;
- tree property_setter_ident = NULL_TREE;
-
- /* 'properties' is the list of properties that we read. Usually a
- single one, but maybe more (eg, in "@property int a, b, c;" there
- are three). */
- tree properties;
- location_t loc;
-
- loc = c_parser_peek_token (parser)->location;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_AT_PROPERTY));
-
+ location_t loc = c_parser_peek_token (parser)->location;
c_parser_consume_token (parser); /* Eat '@property'. */
- /* Parse the optional attribute list... */
+ /* Parse the optional attribute list.
+
+ A list of parsed, but not verified, attributes. */
+ vec<property_attribute_info *> prop_attr_list = vNULL;
+
+ bool syntax_error = false;
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
{
matching_parens parens;
+ location_t attr_start = c_parser_peek_token (parser)->location;
/* Eat the '(' */
parens.consume_open (parser);
/* Property attribute keywords are valid now. */
parser->objc_property_attr_context = true;
- while (true)
+ /* Allow @property (), with a warning. */
+ location_t attr_end = c_parser_peek_token (parser)->location;
+
+ if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
{
- bool syntax_error = false;
- c_token *token = c_parser_peek_token (parser);
- enum rid keyword;
+ location_t attr_comb = make_location (attr_end, attr_start, attr_end);
+ warning_at (attr_comb, OPT_Wattributes,
+ "empty property attribute list");
+ }
+ else
+ while (true)
+ {
+ c_token *token = c_parser_peek_token (parser);
+ attr_start = token->location;
+ attr_end = get_finish (token->location);
+ location_t attr_comb = make_location (attr_start, attr_start,
+ attr_end);
- if (token->type != CPP_KEYWORD)
- {
- if (token->type == CPP_CLOSE_PAREN)
- c_parser_error (parser, "expected identifier");
- else
- {
- c_parser_consume_token (parser);
- c_parser_error (parser, "unknown property attribute");
- }
- break;
- }
- keyword = token->keyword;
- c_parser_consume_token (parser);
- switch (keyword)
- {
- case RID_ASSIGN: property_assign = true; break;
- case RID_COPY: property_copy = true; break;
- case RID_NONATOMIC: property_nonatomic = true; break;
- case RID_READONLY: property_readonly = true; break;
- case RID_READWRITE: property_readwrite = true; break;
- case RID_RETAIN: property_retain = true; break;
-
- case RID_GETTER:
- case RID_SETTER:
- if (c_parser_next_token_is_not (parser, CPP_EQ))
- {
- if (keyword == RID_GETTER)
- c_parser_error (parser,
- "missing %<=%> (after %<getter%> attribute)");
- else
- c_parser_error (parser,
- "missing %<=%> (after %<setter%> attribute)");
- syntax_error = true;
- break;
- }
- c_parser_consume_token (parser); /* eat the = */
- if (c_parser_next_token_is_not (parser, CPP_NAME))
- {
- c_parser_error (parser, "expected identifier");
- syntax_error = true;
+ if (token->type == CPP_CLOSE_PAREN || token->type == CPP_COMMA)
+ {
+ warning_at (attr_comb, OPT_Wattributes,
+ "missing property attribute");
+ if (token->type == CPP_CLOSE_PAREN)
break;
- }
- if (keyword == RID_SETTER)
- {
- if (property_setter_ident != NULL_TREE)
- c_parser_error (parser, "the %<setter%> attribute may only be specified once");
- else
- property_setter_ident = c_parser_peek_token (parser)->value;
- c_parser_consume_token (parser);
- if (c_parser_next_token_is_not (parser, CPP_COLON))
- c_parser_error (parser, "setter name must terminate with %<:%>");
- else
- c_parser_consume_token (parser);
- }
- else
- {
- if (property_getter_ident != NULL_TREE)
- c_parser_error (parser, "the %<getter%> attribute may only be specified once");
- else
- property_getter_ident = c_parser_peek_token (parser)->value;
- c_parser_consume_token (parser);
- }
- break;
- default:
- c_parser_error (parser, "unknown property attribute");
- syntax_error = true;
- break;
+ c_parser_consume_token (parser);
+ continue;
+ }
+
+ tree attr_name = NULL_TREE;
+ enum rid keyword = RID_MAX; /* Not a valid property attribute. */
+ bool add_at = false;
+ if (token->type == CPP_KEYWORD)
+ {
+ keyword = token->keyword;
+ if (OBJC_IS_AT_KEYWORD (keyword))
+ {
+ /* For '@' keywords the token value has the keyword,
+ prepend the '@' for diagnostics. */
+ attr_name = token->value;
+ add_at = true;
+ }
+ else
+ attr_name = ridpointers[(int)keyword];
+ }
+ else if (token->type == CPP_NAME)
+ attr_name = token->value;
+ c_parser_consume_token (parser);
+
+ enum objc_property_attribute_kind prop_kind
+ = objc_prop_attr_kind_for_rid (keyword);
+ property_attribute_info *prop
+ = new property_attribute_info (attr_name, attr_comb, prop_kind);
+ prop_attr_list.safe_push (prop);
+
+ tree meth_name;
+ switch (prop->prop_kind)
+ {
+ default: break;
+ case OBJC_PROPERTY_ATTR_UNKNOWN:
+ if (attr_name)
+ error_at (attr_comb, "unknown property attribute %<%s%s%>",
+ add_at ? "@" : "", IDENTIFIER_POINTER (attr_name));
+ else
+ error_at (attr_comb, "unknown property attribute");
+ prop->parse_error = syntax_error = true;
+ break;
+
+ case OBJC_PROPERTY_ATTR_GETTER:
+ case OBJC_PROPERTY_ATTR_SETTER:
+ if (c_parser_next_token_is_not (parser, CPP_EQ))
+ {
+ attr_comb = make_location (attr_end, attr_start, attr_end);
+ error_at (attr_comb, "expected %<=%> after Objective-C %qE",
+ attr_name);
+ prop->parse_error = syntax_error = true;
+ break;
+ }
+ token = c_parser_peek_token (parser);
+ attr_end = token->location;
+ c_parser_consume_token (parser); /* eat the = */
+ if (c_parser_next_token_is_not (parser, CPP_NAME))
+ {
+ attr_comb = make_location (attr_end, attr_start, attr_end);
+ error_at (attr_comb, "expected %qE selector name",
+ attr_name);
+ prop->parse_error = syntax_error = true;
+ break;
+ }
+ /* Get the end of the method name, and consume the name. */
+ token = c_parser_peek_token (parser);
+ attr_end = get_finish (token->location);
+ meth_name = token->value;
+ c_parser_consume_token (parser);
+ if (prop->prop_kind == OBJC_PROPERTY_ATTR_SETTER)
+ {
+ if (c_parser_next_token_is_not (parser, CPP_COLON))
+ {
+ attr_comb = make_location (attr_end, attr_start,
+ attr_end);
+ error_at (attr_comb, "setter method names must"
+ " terminate with %<:%>");
+ prop->parse_error = syntax_error = true;
+ }
+ else
+ {
+ attr_end = get_finish (c_parser_peek_token
+ (parser)->location);
+ c_parser_consume_token (parser);
+ }
+ attr_comb = make_location (attr_start, attr_start,
+ attr_end);
+ }
+ else
+ attr_comb = make_location (attr_start, attr_start,
+ attr_end);
+ prop->ident = meth_name;
+ /* Updated location including all that was successfully
+ parsed. */
+ prop->prop_loc = attr_comb;
+ break;
}
- if (syntax_error)
- break;
-
+ /* If we see a comma here, then keep going - even if we already
+ saw a syntax error. For simple mistakes e.g. (asign, getter=x)
+ this makes a more useful output and avoid spurious warnings about
+ missing attributes that are, in fact, specified after the one with
+ the syntax error. */
if (c_parser_next_token_is (parser, CPP_COMMA))
c_parser_consume_token (parser);
else
break;
}
parser->objc_property_attr_context = false;
- parens.skip_until_found_close (parser);
- }
- /* ... and the property declaration(s). */
- properties = c_parser_struct_declaration (parser);
- if (properties == error_mark_node)
- {
- c_parser_skip_until_found (parser, CPP_SEMICOLON, NULL);
- parser->error = false;
- return;
+ if (syntax_error && c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN))
+ /* We don't really want to chew the whole of the file looking for a
+ matching closing parenthesis, so we will try to read the decl and
+ let the error handling for that close out the statement. */
+ ;
+ else
+ syntax_error = false, parens.skip_until_found_close (parser);
}
- if (properties == NULL_TREE)
- c_parser_error (parser, "expected identifier");
+ /* 'properties' is the list of properties that we read. Usually a
+ single one, but maybe more (eg, in "@property int a, b, c;" there
+ are three). */
+ tree properties = c_parser_struct_declaration (parser);
+
+ if (properties == error_mark_node)
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, NULL);
else
{
- /* Comma-separated properties are chained together in
- reverse order; add them one by one. */
- properties = nreverse (properties);
-
- for (; properties; properties = TREE_CHAIN (properties))
- objc_add_property_declaration (loc, copy_node (properties),
- property_readonly, property_readwrite,
- property_assign, property_retain,
- property_copy, property_nonatomic,
- property_getter_ident, property_setter_ident);
+ if (properties == NULL_TREE)
+ c_parser_error (parser, "expected identifier");
+ else
+ {
+ /* Comma-separated properties are chained together in reverse order;
+ add them one by one. */
+ properties = nreverse (properties);
+ for (; properties; properties = TREE_CHAIN (properties))
+ objc_add_property_declaration (loc, copy_node (properties),
+ prop_attr_list);
+ }
+ c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
}
- c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
+ while (!prop_attr_list.is_empty())
+ delete prop_attr_list.pop ();
+ prop_attr_list.release ();
parser->error = false;
}
@@ -12641,6 +12610,8 @@ c_parser_omp_clause_name (c_parser *parser)
case 'a':
if (!strcmp ("aligned", p))
result = PRAGMA_OMP_CLAUSE_ALIGNED;
+ else if (!strcmp ("allocate", p))
+ result = PRAGMA_OMP_CLAUSE_ALLOCATE;
else if (!strcmp ("async", p))
result = PRAGMA_OACC_CLAUSE_ASYNC;
else if (!strcmp ("attach", p))
@@ -15150,6 +15121,62 @@ c_parser_omp_clause_aligned (c_parser *parser, tree list)
return nl;
}
+/* OpenMP 5.0:
+ allocate ( variable-list )
+ allocate ( expression : variable-list ) */
+
+static tree
+c_parser_omp_clause_allocate (c_parser *parser, tree list)
+{
+ location_t clause_loc = c_parser_peek_token (parser)->location;
+ tree nl, c;
+ tree allocator = NULL_TREE;
+
+ matching_parens parens;
+ if (!parens.require_open (parser))
+ return list;
+
+ if ((c_parser_next_token_is_not (parser, CPP_NAME)
+ && c_parser_next_token_is_not (parser, CPP_KEYWORD))
+ || (c_parser_peek_2nd_token (parser)->type != CPP_COMMA
+ && c_parser_peek_2nd_token (parser)->type != CPP_CLOSE_PAREN))
+ {
+ location_t expr_loc = c_parser_peek_token (parser)->location;
+ c_expr expr = c_parser_expr_no_commas (parser, NULL);
+ expr = convert_lvalue_to_rvalue (expr_loc, expr, false, true);
+ allocator = expr.value;
+ allocator = c_fully_fold (allocator, false, NULL);
+ tree orig_type
+ = expr.original_type ? expr.original_type : TREE_TYPE (allocator);
+ orig_type = TYPE_MAIN_VARIANT (orig_type);
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (allocator))
+ || TREE_CODE (orig_type) != ENUMERAL_TYPE
+ || TYPE_NAME (orig_type) != get_identifier ("omp_allocator_handle_t"))
+ {
+ error_at (clause_loc, "%<allocate%> clause allocator expression "
+ "has type %qT rather than "
+ "%<omp_allocator_handle_t%>",
+ TREE_TYPE (allocator));
+ allocator = NULL_TREE;
+ }
+ if (!c_parser_require (parser, CPP_COLON, "expected %<:%>"))
+ {
+ parens.skip_until_found_close (parser);
+ return list;
+ }
+ }
+
+ nl = c_parser_omp_variable_list (parser, clause_loc,
+ OMP_CLAUSE_ALLOCATE, list);
+
+ if (allocator)
+ for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
+ OMP_CLAUSE_ALLOCATE_ALLOCATOR (c) = allocator;
+
+ parens.skip_until_found_close (parser);
+ return nl;
+}
+
/* OpenMP 4.0:
linear ( variable-list )
linear ( variable-list : expression )
@@ -16392,6 +16419,10 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask,
clauses = c_parser_omp_clause_aligned (parser, clauses);
c_name = "aligned";
break;
+ case PRAGMA_OMP_CLAUSE_ALLOCATE:
+ clauses = c_parser_omp_clause_allocate (parser, clauses);
+ c_name = "allocate";
+ break;
case PRAGMA_OMP_CLAUSE_LINEAR:
clauses = c_parser_omp_clause_linear (parser, clauses);
c_name = "linear";
@@ -17280,7 +17311,7 @@ c_parser_oacc_wait (location_t loc, c_parser *parser, char *p_name)
LOC is the location of the #pragma token. */
static void
-c_parser_omp_atomic (location_t loc, c_parser *parser)
+c_parser_omp_atomic (location_t loc, c_parser *parser, bool openacc)
{
tree lhs = NULL_TREE, rhs = NULL_TREE, v = NULL_TREE;
tree lhs1 = NULL_TREE, rhs1 = NULL_TREE;
@@ -17319,6 +17350,12 @@ c_parser_omp_atomic (location_t loc, c_parser *parser)
new_code = OMP_ATOMIC;
else if (!strcmp (p, "capture"))
new_code = OMP_ATOMIC_CAPTURE_NEW;
+ else if (openacc)
+ {
+ p = NULL;
+ error_at (cloc, "expected %<read%>, %<write%>, %<update%>, "
+ "or %<capture%> clause");
+ }
else if (!strcmp (p, "seq_cst"))
new_memory_order = OMP_MEMORY_ORDER_SEQ_CST;
else if (!strcmp (p, "acq_rel"))
@@ -17346,7 +17383,12 @@ c_parser_omp_atomic (location_t loc, c_parser *parser)
{
if (new_code != ERROR_MARK)
{
- if (code != ERROR_MARK)
+ /* OpenACC permits 'update capture'. */
+ if (openacc
+ && code == OMP_ATOMIC
+ && new_code == OMP_ATOMIC_CAPTURE_NEW)
+ code = new_code;
+ else if (code != ERROR_MARK)
error_at (cloc, "too many atomic clauses");
else
code = new_code;
@@ -17368,7 +17410,9 @@ c_parser_omp_atomic (location_t loc, c_parser *parser)
if (code == ERROR_MARK)
code = OMP_ATOMIC;
- if (memory_order == OMP_MEMORY_ORDER_UNSPECIFIED)
+ if (openacc)
+ memory_order = OMP_MEMORY_ORDER_RELAXED;
+ else if (memory_order == OMP_MEMORY_ORDER_UNSPECIFIED)
{
omp_requires_mask
= (enum omp_requires) (omp_requires_mask
@@ -17424,6 +17468,7 @@ c_parser_omp_atomic (location_t loc, c_parser *parser)
}
break;
case OMP_ATOMIC:
+ /* case OMP_ATOMIC_CAPTURE_NEW: - or update to OpenMP 5.1 */
if (memory_order == OMP_MEMORY_ORDER_ACQ_REL
|| memory_order == OMP_MEMORY_ORDER_ACQUIRE)
{
@@ -18572,6 +18617,7 @@ c_parser_omp_simd (location_t loc, c_parser *parser,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
static tree
@@ -18863,6 +18909,7 @@ c_parser_omp_sections_scope (location_t sections_loc, c_parser *parser)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
static tree
@@ -18917,6 +18964,7 @@ c_parser_omp_sections (location_t loc, c_parser *parser,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COPYIN) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PROC_BIND))
static tree
@@ -19058,6 +19106,7 @@ c_parser_omp_parallel (location_t loc, c_parser *parser,
( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COPYPRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
static tree
@@ -19092,6 +19141,7 @@ c_parser_omp_single (location_t loc, c_parser *parser, bool *if_p)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MERGEABLE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIORITY) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IN_REDUCTION))
static tree
@@ -19162,7 +19212,8 @@ c_parser_omp_taskyield (c_parser *parser)
*/
#define OMP_TASKGROUP_CLAUSE_MASK \
- ( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TASK_REDUCTION))
+ ( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TASK_REDUCTION))
static tree
c_parser_omp_taskgroup (location_t loc, c_parser *parser, bool *if_p)
@@ -19263,6 +19314,7 @@ c_parser_omp_cancellation_point (c_parser *parser, enum pragma_context context)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)\
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE))
static tree
@@ -19352,6 +19404,7 @@ c_parser_omp_distribute (location_t loc, c_parser *parser,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_THREAD_LIMIT) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEFAULT))
static tree
@@ -19458,6 +19511,7 @@ c_parser_omp_target_data (location_t loc, c_parser *parser, bool *if_p)
tree clauses
= c_parser_omp_all_clauses (parser, OMP_TARGET_DATA_CLAUSE_MASK,
"#pragma omp target data");
+ c_omp_adjust_map_clauses (clauses, false);
int map_seen = 0;
for (tree *pc = &clauses; *pc;)
{
@@ -19475,6 +19529,7 @@ c_parser_omp_target_data (location_t loc, c_parser *parser, bool *if_p)
break;
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
map_seen |= 1;
@@ -19598,6 +19653,7 @@ c_parser_omp_target_enter_data (location_t loc, c_parser *parser,
tree clauses
= c_parser_omp_all_clauses (parser, OMP_TARGET_ENTER_DATA_CLAUSE_MASK,
"#pragma omp target enter data");
+ c_omp_adjust_map_clauses (clauses, false);
int map_seen = 0;
for (tree *pc = &clauses; *pc;)
{
@@ -19611,6 +19667,7 @@ c_parser_omp_target_enter_data (location_t loc, c_parser *parser,
break;
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
map_seen |= 1;
@@ -19682,7 +19739,7 @@ c_parser_omp_target_exit_data (location_t loc, c_parser *parser,
tree clauses
= c_parser_omp_all_clauses (parser, OMP_TARGET_EXIT_DATA_CLAUSE_MASK,
"#pragma omp target exit data");
-
+ c_omp_adjust_map_clauses (clauses, false);
int map_seen = 0;
for (tree *pc = &clauses; *pc;)
{
@@ -19697,6 +19754,7 @@ c_parser_omp_target_exit_data (location_t loc, c_parser *parser,
break;
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
map_seen |= 1;
@@ -19739,6 +19797,7 @@ c_parser_omp_target_exit_data (location_t loc, c_parser *parser,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEFAULTMAP) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR))
@@ -19906,6 +19965,8 @@ c_parser_omp_target (c_parser *parser, enum pragma_context context, bool *if_p)
OMP_TARGET_CLAUSES (stmt)
= c_parser_omp_all_clauses (parser, OMP_TARGET_CLAUSE_MASK,
"#pragma omp target");
+ c_omp_adjust_map_clauses (OMP_TARGET_CLAUSES (stmt), true);
+
pc = &OMP_TARGET_CLAUSES (stmt);
keep_next_level ();
block = c_begin_compound_stmt (true);
@@ -19930,6 +19991,7 @@ check_clauses:
case GOMP_MAP_ALLOC:
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
error_at (OMP_CLAUSE_LOCATION (*pc),
@@ -21369,6 +21431,7 @@ c_finish_taskloop_clauses (tree clauses)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MERGEABLE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOGROUP) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIORITY) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IN_REDUCTION))
@@ -21455,7 +21518,7 @@ c_parser_omp_construct (c_parser *parser, bool *if_p)
switch (p_kind)
{
case PRAGMA_OACC_ATOMIC:
- c_parser_omp_atomic (loc, parser);
+ c_parser_omp_atomic (loc, parser, true);
return;
case PRAGMA_OACC_CACHE:
strcpy (p_name, "#pragma acc");
@@ -21482,7 +21545,7 @@ c_parser_omp_construct (c_parser *parser, bool *if_p)
stmt = c_parser_oacc_wait (loc, parser, p_name);
break;
case PRAGMA_OMP_ATOMIC:
- c_parser_omp_atomic (loc, parser);
+ c_parser_omp_atomic (loc, parser, false);
return;
case PRAGMA_OMP_CRITICAL:
stmt = c_parser_omp_critical (loc, parser, if_p);
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..df1dad4 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -1407,7 +1407,7 @@ free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til)
const struct tagged_tu_seen_cache *const tu1
= (const struct tagged_tu_seen_cache *) tu;
tu = tu1->next;
- free (CONST_CAST (struct tagged_tu_seen_cache *, tu1));
+ XDELETE (CONST_CAST (struct tagged_tu_seen_cache *, tu1));
}
tagged_tu_seen_base = tu_til;
}
@@ -3014,7 +3014,8 @@ build_function_call (location_t loc, tree function, tree params)
static void
inform_declaration (tree decl)
{
- if (decl && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_IS_BUILTIN (decl)))
+ if (decl && (TREE_CODE (decl) != FUNCTION_DECL
+ || !DECL_IS_UNDECLARED_BUILTIN (decl)))
inform (DECL_SOURCE_LOCATION (decl), "declared here");
}
@@ -3719,7 +3720,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
@@ -5490,6 +5491,82 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
return ret;
}
+/* EXPR is an expression, location LOC, whose result is discarded.
+ Warn if it is a call to a nodiscard function (or a COMPOUND_EXPR
+ whose right-hand operand is such a call, possibly recursively). */
+
+static void
+maybe_warn_nodiscard (location_t loc, tree expr)
+{
+ if (VOID_TYPE_P (TREE_TYPE (expr)))
+ return;
+ while (TREE_CODE (expr) == COMPOUND_EXPR)
+ {
+ expr = TREE_OPERAND (expr, 1);
+ if (EXPR_HAS_LOCATION (expr))
+ loc = EXPR_LOCATION (expr);
+ }
+ if (TREE_CODE (expr) != CALL_EXPR)
+ return;
+ tree fn = CALL_EXPR_FN (expr);
+ if (!fn)
+ return;
+ tree attr;
+ if (TREE_CODE (fn) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
+ && (attr = lookup_attribute ("nodiscard",
+ DECL_ATTRIBUTES (TREE_OPERAND (fn, 0)))))
+ {
+ fn = TREE_OPERAND (fn, 0);
+ tree args = TREE_VALUE (attr);
+ if (args)
+ args = TREE_VALUE (args);
+ auto_diagnostic_group d;
+ int warned;
+ if (args)
+ warned = warning_at (loc, OPT_Wunused_result,
+ "ignoring return value of %qD, declared with "
+ "attribute %<nodiscard%>: %E", fn, args);
+ else
+ warned = warning_at (loc, OPT_Wunused_result,
+ "ignoring return value of %qD, declared with "
+ "attribute %<nodiscard%>", fn);
+ if (warned)
+ inform (DECL_SOURCE_LOCATION (fn), "declared here");
+ }
+ else
+ {
+ tree rettype = TREE_TYPE (TREE_TYPE (TREE_TYPE (fn)));
+ attr = lookup_attribute ("nodiscard", TYPE_ATTRIBUTES (rettype));
+ if (!attr)
+ return;
+ tree args = TREE_VALUE (attr);
+ if (args)
+ args = TREE_VALUE (args);
+ auto_diagnostic_group d;
+ int warned;
+ if (args)
+ warned = warning_at (loc, OPT_Wunused_result,
+ "ignoring return value of type %qT, declared "
+ "with attribute %<nodiscard%>: %E",
+ rettype, args);
+ else
+ warned = warning_at (loc, OPT_Wunused_result,
+ "ignoring return value of type %qT, declared "
+ "with attribute %<nodiscard%>", rettype);
+ if (warned)
+ {
+ if (TREE_CODE (fn) == ADDR_EXPR)
+ {
+ fn = TREE_OPERAND (fn, 0);
+ if (TREE_CODE (fn) == FUNCTION_DECL)
+ inform (DECL_SOURCE_LOCATION (fn),
+ "in call to %qD, declared here", fn);
+ }
+ }
+ }
+}
+
/* Return a compound expression that performs two expressions and
returns the value of the second of them.
@@ -5561,6 +5638,8 @@ build_compound_expr (location_t loc, tree expr1, tree expr2)
else if (warn_unused_value)
warn_if_unused_value (expr1, loc);
+ maybe_warn_nodiscard (loc, expr1);
+
if (expr2 == error_mark_node)
return error_mark_node;
@@ -6500,7 +6579,7 @@ inform_for_arg (tree fundecl, location_t ploc, int parmnum,
tree expected_type, tree actual_type)
{
location_t loc;
- if (fundecl && !DECL_IS_BUILTIN (fundecl))
+ if (fundecl && !DECL_IS_UNDECLARED_BUILTIN (fundecl))
loc = get_fndecl_argument_location (fundecl, parmnum - 1);
else
loc = ploc;
@@ -6750,7 +6829,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
if (pedwarn (expr_loc, OPT_Wc___compat, "enum conversion when "
"passing argument %d of %qE is invalid in C++",
parmnum, rname))
- inform ((fundecl && !DECL_IS_BUILTIN (fundecl))
+ inform ((fundecl && !DECL_IS_UNDECLARED_BUILTIN (fundecl))
? DECL_SOURCE_LOCATION (fundecl) : expr_loc,
"expected %qT but argument is of type %qT",
type, rhstype);
@@ -7161,7 +7240,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
case ic_argpass:
/* Do not warn for built-in functions, for example memcpy, since we
control how they behave and they can be useful in this area. */
- if (TREE_CODE (rname) != FUNCTION_DECL || !DECL_IS_BUILTIN (rname))
+ if (TREE_CODE (rname) != FUNCTION_DECL
+ || !DECL_IS_UNDECLARED_BUILTIN (rname))
warning_at (location, OPT_Wscalar_storage_order,
"passing argument %d of %qE from incompatible "
"scalar storage order", parmnum, rname);
@@ -8314,13 +8394,13 @@ finish_init (void)
{
struct constructor_stack *q = constructor_stack;
constructor_stack = q->next;
- free (q);
+ XDELETE (q);
}
gcc_assert (!constructor_range_stack);
/* Pop back to the data of the outer initializer (if any). */
- free (spelling_base);
+ XDELETE (spelling_base);
constructor_decl = p->decl;
require_constant_value = p->require_constant_value;
@@ -8333,7 +8413,7 @@ finish_init (void)
spelling_size = p->spelling_size;
constructor_top_level = p->top_level;
initializer_stack = p->next;
- free (p);
+ XDELETE (p);
}
/* Call here when we see the initializer is surrounded by braces.
@@ -8864,7 +8944,7 @@ pop_init_level (location_t loc, int implicit,
RESTORE_SPELLING_DEPTH (constructor_depth);
constructor_stack = p->next;
- free (p);
+ XDELETE (p);
if (ret.value == NULL_TREE && constructor_stack == 0)
ret.value = error_mark_node;
@@ -11072,6 +11152,9 @@ c_finish_bc_stmt (location_t loc, tree label, bool is_break)
static void
emit_side_effect_warnings (location_t loc, tree expr)
{
+ maybe_warn_nodiscard (loc, expr);
+ if (!warn_unused_value)
+ return;
if (expr == error_mark_node)
;
else if (!TREE_SIDE_EFFECTS (expr))
@@ -11127,7 +11210,7 @@ c_process_expr_stmt (location_t loc, tree expr)
Warnings for statement expressions will be emitted later, once we figure
out which is the result. */
if (!STATEMENT_LIST_STMT_EXPR (cur_stmt_list)
- && warn_unused_value)
+ && (warn_unused_value || warn_unused_result))
emit_side_effect_warnings (EXPR_LOC_OR_LOC (expr, loc), expr);
exprv = expr;
@@ -11221,7 +11304,7 @@ c_finish_stmt_expr (location_t loc, tree body)
/* If we're supposed to generate side effects warnings, process
all of the statements except the last. */
- if (warn_unused_value)
+ if (warn_unused_value || warn_unused_result)
{
for (tree_stmt_iterator i = tsi_start (last);
tsi_stmt (i) != tsi_stmt (l); tsi_next (&i))
@@ -13501,11 +13584,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
if (ort != C_ORT_OMP && ort != C_ORT_ACC)
OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_POINTER);
else if (TREE_CODE (t) == COMPONENT_REF)
- {
- gomp_map_kind k = (ort == C_ORT_ACC) ? GOMP_MAP_ATTACH_DETACH
- : GOMP_MAP_ALWAYS_POINTER;
- OMP_CLAUSE_SET_MAP_KIND (c2, k);
- }
+ OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ATTACH_DETACH);
else
OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_FIRSTPRIVATE_POINTER);
if (OMP_CLAUSE_MAP_KIND (c2) != GOMP_MAP_FIRSTPRIVATE_POINTER
@@ -13795,6 +13874,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
/* 1 if normal/task reduction has been seen, -1 if inscan reduction
has been seen, -2 if mixed inscan/normal reduction diagnosed. */
int reduction_seen = 0;
+ bool allocate_seen = false;
bitmap_obstack_initialize (NULL);
bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -14344,6 +14424,29 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
bitmap_set_bit (&oacc_reduction_head, DECL_UID (t));
break;
+ case OMP_CLAUSE_ALLOCATE:
+ t = OMP_CLAUSE_DECL (c);
+ if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qE is not a variable in %<allocate%> clause", t);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&aligned_head, DECL_UID (t)))
+ {
+ warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ "%qE appears more than once in %<allocate%> clauses",
+ t);
+ remove = true;
+ }
+ else
+ {
+ bitmap_set_bit (&aligned_head, DECL_UID (t));
+ if (!OMP_CLAUSE_ALLOCATE_COMBINED (c))
+ allocate_seen = true;
+ }
+ break;
+
case OMP_CLAUSE_DEPEND:
t = OMP_CLAUSE_DECL (c);
if (t == NULL_TREE)
@@ -14604,7 +14707,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
break;
if (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
{
- if (bitmap_bit_p (&map_field_head, DECL_UID (t)))
+ if (bitmap_bit_p (&map_field_head, DECL_UID (t))
+ || (ort == C_ORT_OMP
+ && bitmap_bit_p (&map_head, DECL_UID (t))))
break;
}
}
@@ -14673,7 +14778,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
else
bitmap_set_bit (&generic_head, DECL_UID (t));
}
- else if (bitmap_bit_p (&map_head, DECL_UID (t)))
+ else if (bitmap_bit_p (&map_head, DECL_UID (t))
+ && (ort != C_ORT_OMP
+ || !bitmap_bit_p (&map_field_head, DECL_UID (t))))
{
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
error_at (OMP_CLAUSE_LOCATION (c),
@@ -14687,7 +14794,13 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
remove = true;
}
else if (bitmap_bit_p (&generic_head, DECL_UID (t))
- || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
+ && ort == C_ORT_ACC)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qD appears more than once in data clauses", t);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
{
if (ort == C_ORT_ACC)
error_at (OMP_CLAUSE_LOCATION (c),
@@ -15041,10 +15154,40 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
reduction_seen = -2;
}
- if (linear_variable_step_check || reduction_seen == -2)
+ if (linear_variable_step_check || reduction_seen == -2 || allocate_seen)
for (pc = &clauses, c = clauses; c ; c = *pc)
{
bool remove = false;
+ if (allocate_seen)
+ switch (OMP_CLAUSE_CODE (c))
+ {
+ case OMP_CLAUSE_REDUCTION:
+ case OMP_CLAUSE_IN_REDUCTION:
+ case OMP_CLAUSE_TASK_REDUCTION:
+ if (TREE_CODE (OMP_CLAUSE_DECL (c)) == MEM_REF)
+ {
+ t = TREE_OPERAND (OMP_CLAUSE_DECL (c), 0);
+ if (TREE_CODE (t) == POINTER_PLUS_EXPR)
+ t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == ADDR_EXPR
+ || TREE_CODE (t) == INDIRECT_REF)
+ t = TREE_OPERAND (t, 0);
+ if (DECL_P (t))
+ bitmap_clear_bit (&aligned_head, DECL_UID (t));
+ break;
+ }
+ /* FALLTHRU */
+ case OMP_CLAUSE_PRIVATE:
+ case OMP_CLAUSE_FIRSTPRIVATE:
+ case OMP_CLAUSE_LASTPRIVATE:
+ case OMP_CLAUSE_LINEAR:
+ if (DECL_P (OMP_CLAUSE_DECL (c)))
+ bitmap_clear_bit (&aligned_head,
+ DECL_UID (OMP_CLAUSE_DECL (c)));
+ break;
+ default:
+ break;
+ }
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
&& OMP_CLAUSE_LINEAR_VARIABLE_STRIDE (c)
&& !bitmap_bit_p (&map_head,
@@ -15065,6 +15208,25 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
pc = &OMP_CLAUSE_CHAIN (c);
}
+ if (allocate_seen)
+ for (pc = &clauses, c = clauses; c ; c = *pc)
+ {
+ bool remove = false;
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ALLOCATE
+ && !OMP_CLAUSE_ALLOCATE_COMBINED (c)
+ && bitmap_bit_p (&aligned_head, DECL_UID (OMP_CLAUSE_DECL (c))))
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qD specified in %<allocate%> clause but not in "
+ "an explicit privatization clause", OMP_CLAUSE_DECL (c));
+ remove = true;
+ }
+ if (remove)
+ *pc = OMP_CLAUSE_CHAIN (c);
+ else
+ pc = &OMP_CLAUSE_CHAIN (c);
+ }
+
if (nogroup_seen && reduction_seen)
{
error_at (OMP_CLAUSE_LOCATION (*nogroup_seen),
diff --git a/gcc/calls.c b/gcc/calls.c
index d3120b2..a93d4bf 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "gimple-fold.h"
#include "attr-fnspec.h"
+#include "value-query.h"
#include "tree-pretty-print.h"
@@ -629,21 +630,32 @@ special_function_p (const_tree fndecl, int flags)
return flags;
}
+/* Return fnspec for DECL. */
+
+static attr_fnspec
+decl_fnspec (tree fndecl)
+{
+ tree attr;
+ tree type = TREE_TYPE (fndecl);
+ if (type)
+ {
+ attr = lookup_attribute ("fn spec", TYPE_ATTRIBUTES (type));
+ if (attr)
+ {
+ return TREE_VALUE (TREE_VALUE (attr));
+ }
+ }
+ if (fndecl_built_in_p (fndecl, BUILT_IN_NORMAL))
+ return builtin_fnspec (fndecl);
+ return "";
+}
+
/* Similar to special_function_p; return a set of ERF_ flags for the
function FNDECL. */
static int
decl_return_flags (tree fndecl)
{
- tree attr;
- tree type = TREE_TYPE (fndecl);
- if (!type)
- return 0;
-
- attr = lookup_attribute ("fn spec", TYPE_ATTRIBUTES (type));
- if (!attr)
- return 0;
-
- attr_fnspec fnspec (TREE_VALUE (TREE_VALUE (attr)));
+ attr_fnspec fnspec = decl_fnspec (fndecl);
unsigned int arg;
if (fnspec.returns_arg (&arg))
@@ -1244,7 +1256,8 @@ alloc_max_size (void)
in a multi-range, otherwise to the smallest valid subrange. */
bool
-get_size_range (tree exp, tree range[2], int flags /* = 0 */)
+get_size_range (range_query *query, tree exp, gimple *stmt, tree range[2],
+ int flags /* = 0 */)
{
if (!exp)
return false;
@@ -1263,7 +1276,19 @@ get_size_range (tree exp, tree range[2], int flags /* = 0 */)
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;
@@ -1369,6 +1394,12 @@ get_size_range (tree exp, tree range[2], int flags /* = 0 */)
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
@@ -1517,7 +1548,7 @@ maybe_warn_alloc_args_overflow (tree fn, tree exp, tree args[2], int idx[2])
{
location_t fnloc = DECL_SOURCE_LOCATION (fn);
- if (DECL_IS_BUILTIN (fn))
+ if (DECL_IS_UNDECLARED_BUILTIN (fn))
inform (loc,
"in a call to built-in allocation function %qD", fn);
else
@@ -1891,7 +1922,7 @@ maybe_warn_nonstring_arg (tree fndecl, tree exp)
/* Issue an error if CALL_EXPR was flagged as requiring
tall-call optimization. */
-static void
+void
maybe_complain_about_tail_call (tree call_expr, const char *reason)
{
gcc_assert (TREE_CODE (call_expr) == CALL_EXPR);
@@ -3494,7 +3525,6 @@ static bool
can_implement_as_sibling_call_p (tree exp,
rtx structure_value_addr,
tree funtype,
- int reg_parm_stack_space ATTRIBUTE_UNUSED,
tree fndecl,
int flags,
tree addr,
@@ -3519,20 +3549,6 @@ can_implement_as_sibling_call_p (tree exp,
return false;
}
-#ifdef REG_PARM_STACK_SPACE
- /* If outgoing reg parm stack space changes, we cannot do sibcall. */
- if (OUTGOING_REG_PARM_STACK_SPACE (funtype)
- != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl))
- || (reg_parm_stack_space != REG_PARM_STACK_SPACE (current_function_decl)))
- {
- maybe_complain_about_tail_call (exp,
- "inconsistent size of stack space"
- " allocated for arguments which are"
- " passed in registers");
- return false;
- }
-#endif
-
/* Check whether the target is able to optimize the call
into a sibcall. */
if (!targetm.function_ok_for_sibcall (fndecl, exp))
@@ -4057,7 +4073,6 @@ expand_call (tree exp, rtx target, int ignore)
try_tail_call = can_implement_as_sibling_call_p (exp,
structure_value_addr,
funtype,
- reg_parm_stack_space,
fndecl,
flags, addr, args_size);
diff --git a/gcc/calls.h b/gcc/calls.h
index 644ec45..b20d24b 100644
--- a/gcc/calls.h
+++ b/gcc/calls.h
@@ -133,6 +133,7 @@ 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 void maybe_complain_about_tail_call (tree, const char *);
enum size_range_flags
{
/* Set to consider zero a valid range. */
@@ -142,6 +143,8 @@ enum size_range_flags
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..de0e71d 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -720,7 +720,7 @@ free_aux_for_edges (void)
DEBUG_FUNCTION void
debug_bb (basic_block bb)
{
- dump_bb (stderr, bb, 0, dump_flags);
+ debug_bb (bb, dump_flags);
}
DEBUG_FUNCTION basic_block
@@ -731,6 +731,24 @@ debug_bb_n (int n)
return bb;
}
+/* Print BB with specified FLAGS. */
+
+DEBUG_FUNCTION void
+debug_bb (basic_block bb, dump_flags_t flags)
+{
+ dump_bb (stderr, bb, 0, flags);
+}
+
+/* Print basic block numbered N with specified FLAGS. */
+
+DEBUG_FUNCTION basic_block
+debug_bb_n (int n, dump_flags_t flags)
+{
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, n);
+ debug_bb (bb, flags);
+ return bb;
+}
+
/* Dumps cfg related information about basic block BB to OUTF.
If HEADER is true, dump things that appear before the instructions
contained in BB. If FOOTER is true, dump things that appear after.
@@ -959,55 +977,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 +1002,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 +1012,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 +1026,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 +1065,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 +1086,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 +1112,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/cfg.h b/gcc/cfg.h
index 1eb7866..93fde6df 100644
--- a/gcc/cfg.h
+++ b/gcc/cfg.h
@@ -108,6 +108,8 @@ extern void clear_aux_for_edges (void);
extern void free_aux_for_edges (void);
extern void debug_bb (basic_block);
extern basic_block debug_bb_n (int);
+extern void debug_bb (basic_block, dump_flags_t);
+extern basic_block debug_bb_n (int, dump_flags_t);
extern void dump_bb_info (FILE *, basic_block, int, dump_flags_t, bool, bool);
extern void brief_dump_cfg (FILE *, dump_flags_t);
extern void update_bb_profile_for_threading (basic_block, profile_count, edge);
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 1eaa1da..b2d8685 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -366,7 +366,15 @@ align_local_variable (tree decl, bool really_expand)
unsigned int align;
if (TREE_CODE (decl) == SSA_NAME)
- align = TYPE_ALIGN (TREE_TYPE (decl));
+ {
+ tree type = TREE_TYPE (decl);
+ machine_mode mode = TYPE_MODE (type);
+
+ align = TYPE_ALIGN (type);
+ if (mode != BLKmode
+ && align < GET_MODE_ALIGNMENT (mode))
+ align = GET_MODE_ALIGNMENT (mode);
+ }
else
{
align = LOCAL_DECL_ALIGNMENT (decl);
@@ -999,20 +1007,21 @@ expand_one_stack_var_at (tree decl, rtx base, unsigned base_align,
x = plus_constant (Pmode, base, offset);
x = gen_rtx_MEM (TREE_CODE (decl) == SSA_NAME
? TYPE_MODE (TREE_TYPE (decl))
- : DECL_MODE (SSAVAR (decl)), x);
+ : DECL_MODE (decl), x);
+
+ /* Set alignment we actually gave this decl if it isn't an SSA name.
+ If it is we generate stack slots only accidentally so it isn't as
+ important, we'll simply set the alignment directly on the MEM. */
+
+ if (base == virtual_stack_vars_rtx)
+ offset -= frame_phase;
+ align = known_alignment (offset);
+ align *= BITS_PER_UNIT;
+ if (align == 0 || align > base_align)
+ align = base_align;
if (TREE_CODE (decl) != SSA_NAME)
{
- /* Set alignment we actually gave this decl if it isn't an SSA name.
- If it is we generate stack slots only accidentally so it isn't as
- important, we'll simply use the alignment that is already set. */
- if (base == virtual_stack_vars_rtx)
- offset -= frame_phase;
- align = known_alignment (offset);
- align *= BITS_PER_UNIT;
- if (align == 0 || align > base_align)
- align = base_align;
-
/* One would think that we could assert that we're not decreasing
alignment here, but (at least) the i386 port does exactly this
via the MINIMUM_ALIGNMENT hook. */
@@ -1022,6 +1031,8 @@ expand_one_stack_var_at (tree decl, rtx base, unsigned base_align,
}
set_rtl (decl, x);
+
+ set_mem_align (x, align);
}
class stack_vars_data
@@ -1327,13 +1338,11 @@ expand_one_stack_var_1 (tree var)
{
tree type = TREE_TYPE (var);
size = tree_to_poly_uint64 (TYPE_SIZE_UNIT (type));
- byte_align = TYPE_ALIGN_UNIT (type);
}
else
- {
- size = tree_to_poly_uint64 (DECL_SIZE_UNIT (var));
- byte_align = align_local_variable (var, true);
- }
+ size = tree_to_poly_uint64 (DECL_SIZE_UNIT (var));
+
+ byte_align = align_local_variable (var, true);
/* We handle highly aligned variables in expand_stack_vars. */
gcc_assert (byte_align * BITS_PER_UNIT <= MAX_SUPPORTED_STACK_ALIGNMENT);
@@ -1762,13 +1771,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 +1840,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 +2146,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 +2156,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 +2172,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 +2226,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);
}
@@ -6406,7 +6412,7 @@ pass_expand::execute (function *fun)
rtl_profile_for_bb (ENTRY_BLOCK_PTR_FOR_FN (fun));
insn_locations_init ();
- if (!DECL_IS_BUILTIN (current_function_decl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (current_function_decl))
{
/* Eventually, all FEs should explicitly set function_start_locus. */
if (LOCATION_LOCUS (fun->function_start_locus) == UNKNOWN_LOCATION)
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/cgraph.c b/gcc/cgraph.c
index f018020..19dfe2b 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -64,6 +64,9 @@ 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"
+#include "symtab-clones.h"
/* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */
#include "tree-pass.h"
@@ -517,13 +520,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 +631,24 @@ 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 local_info;
+ if (symtab->state < CONSTRUCTION)
+ i = &local_info;
+ else
+ 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;
+ if (symtab->state < CONSTRUCTION)
+ i->register_early (node);
+
return node;
}
@@ -914,7 +921,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;
@@ -1230,7 +1237,7 @@ cgraph_edge::resolve_speculation (cgraph_edge *edge, tree callee_decl)
{
cgraph_edge *tmp = edge;
if (dump_file)
- fprintf (dump_file, "Speculative call turned into direct call.\n");
+ fprintf (dump_file, "Speculative call turned into direct call.\n");
edge = e2;
e2 = tmp;
/* FIXME: If EDGE is inlined, we should scale up the frequencies
@@ -1482,38 +1489,44 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge *e)
return e->call_stmt;
}
}
-
if (flag_checking && decl)
{
- cgraph_node *node = cgraph_node::get (decl);
- gcc_assert (!node || !node->clone.param_adjustments);
+ if (cgraph_node *node = cgraph_node::get (decl))
+ {
+ clone_info *info = clone_info::get (node);
+ gcc_assert (!info || !info->param_adjustments);
+ }
}
+ clone_info *callee_info = clone_info::get (e->callee);
+ clone_info *caller_info = clone_info::get (e->caller);
+
if (symtab->dump_file)
{
fprintf (symtab->dump_file, "updating call of %s -> %s: ",
e->caller->dump_name (), e->callee->dump_name ());
print_gimple_stmt (symtab->dump_file, e->call_stmt, 0, dump_flags);
- if (e->callee->clone.param_adjustments)
- e->callee->clone.param_adjustments->dump (symtab->dump_file);
+ if (callee_info && callee_info->param_adjustments)
+ callee_info->param_adjustments->dump (symtab->dump_file);
unsigned performed_len
- = vec_safe_length (e->caller->clone.performed_splits);
+ = caller_info ? vec_safe_length (caller_info->performed_splits) : 0;
if (performed_len > 0)
fprintf (symtab->dump_file, "Performed splits records:\n");
for (unsigned i = 0; i < performed_len; i++)
{
ipa_param_performed_split *sm
- = &(*e->caller->clone.performed_splits)[i];
+ = &(*caller_info->performed_splits)[i];
print_node_brief (symtab->dump_file, " dummy_decl: ", sm->dummy_decl,
TDF_UID);
fprintf (symtab->dump_file, ", unit_offset: %u\n", sm->unit_offset);
}
}
- if (ipa_param_adjustments *padjs = e->callee->clone.param_adjustments)
+ if (ipa_param_adjustments *padjs
+ = callee_info ? callee_info->param_adjustments : NULL)
{
/* We need to defer cleaning EH info on the new statement to
- fixup-cfg. We may not have dominator information at this point
+ fixup-cfg. We may not have dominator information at this point
and thus would end up with unreachable blocks and have no way
to communicate that we need to run CFG cleanup then. */
int lp_nr = lookup_stmt_eh_lp (e->call_stmt);
@@ -1522,7 +1535,8 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge *e)
tree old_fntype = gimple_call_fntype (e->call_stmt);
new_stmt = padjs->modify_call (e->call_stmt,
- e->caller->clone.performed_splits,
+ caller_info
+ ? caller_info->performed_splits : NULL,
e->callee->decl, false);
cgraph_node *origin = e->callee;
while (origin->clone_of)
@@ -1571,7 +1585,7 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge *e)
var = get_or_create_ssa_default_def
(DECL_STRUCT_FUNCTION (e->caller->decl), var);
gimple *set_stmt = gimple_build_assign (lhs, var);
- gsi = gsi_for_stmt (new_stmt);
+ gsi = gsi_for_stmt (new_stmt);
gsi_insert_before_without_update (&gsi, set_stmt, GSI_SAME_STMT);
update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), set_stmt);
}
@@ -1697,7 +1711,8 @@ cgraph_update_edges_for_call_stmt (gimple *old_stmt, tree old_decl,
if (orig->clones)
for (node = orig->clones; node != orig;)
{
- cgraph_update_edges_for_call_stmt_node (node, old_stmt, old_decl, new_stmt);
+ cgraph_update_edges_for_call_stmt_node (node, old_stmt, old_decl,
+ new_stmt);
if (node->clones)
node = node->clones;
else if (node->next_sibling_clone)
@@ -1803,7 +1818,7 @@ release_function_body (tree decl)
free_histograms (fn);
gimple_set_body (decl, NULL);
/* Struct function hangs a lot of data that would leak if we didn't
- removed all pointers to it. */
+ removed all pointers to it. */
ggc_free (fn);
DECL_STRUCT_FUNCTION (decl) = NULL;
}
@@ -1845,12 +1860,19 @@ cgraph_node::release_body (bool keep_arguments)
void
cgraph_node::remove (void)
{
+ bool clone_info_set = false;
+ clone_info *info, saved_info;
if (symtab->ipa_clones_dump_file && symtab->cloned_nodes.contains (this))
fprintf (symtab->ipa_clones_dump_file,
"Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), order,
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
DECL_SOURCE_COLUMN (decl));
+ if ((info = clone_info::get (this)) != NULL)
+ {
+ saved_info = *info;
+ clone_info_set = true;
+ }
symtab->call_cgraph_removal_hooks (this);
remove_callers ();
remove_callees ();
@@ -1861,23 +1883,8 @@ 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 ();
+ unregister (clone_info_set ? &saved_info : NULL);
if (prev_sibling_clone)
prev_sibling_clone->next_sibling_clone = next_sibling_clone;
else if (clone_of)
@@ -1889,7 +1896,7 @@ cgraph_node::remove (void)
cgraph_node *n, *next;
if (clone_of)
- {
+ {
for (n = clones; n->next_sibling_clone; n = n->next_sibling_clone)
n->clone_of = clone_of;
n->clone_of = clone_of;
@@ -1899,7 +1906,7 @@ cgraph_node::remove (void)
clone_of->clones = clones;
}
else
- {
+ {
/* We are removing node with clones. This makes clones inconsistent,
but assume they will be removed subsequently and just keep clone
tree intact. This can happen in unreachable function removal since
@@ -2139,7 +2146,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");
@@ -2192,37 +2199,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: ");
@@ -2277,12 +2264,12 @@ cgraph_node::dump (FILE *f)
{
if (edge->indirect_info->polymorphic)
{
- fprintf (f, " Polymorphic indirect call of type ");
+ fprintf (f, " Polymorphic indirect call of type ");
print_generic_expr (f, edge->indirect_info->otr_type, TDF_SLIM);
fprintf (f, " token:%i", (int) edge->indirect_info->otr_token);
}
else
- fprintf (f, " Indirect call");
+ fprintf (f, " Indirect call");
edge->dump_edge_flags (f);
if (edge->indirect_info->param_index != -1)
{
@@ -2348,19 +2335,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
@@ -2392,8 +2366,8 @@ cgraph_node::get_availability (symtab_node *ref)
Also comdat groups are always resolved in groups. */
else if ((this == ref && !has_aliases_p ())
- || (ref && get_comdat_group ()
- && get_comdat_group () == ref->get_comdat_group ()))
+ || (ref && get_comdat_group ()
+ && get_comdat_group () == ref->get_comdat_group ()))
avail = AVAIL_AVAILABLE;
/* Inline functions are safe to be analyzed even if their symbol can
be overwritten at runtime. It is not meaningful to enforce any sane
@@ -2461,7 +2435,7 @@ cgraph_node::call_for_symbol_thunks_and_aliases (bool (*callback)
|| (avail = get_availability ()) > AVAIL_INTERPOSABLE)
{
if (callback (this, data))
- return true;
+ return true;
}
FOR_EACH_ALIAS (this, ref)
{
@@ -2476,11 +2450,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))
@@ -2554,7 +2528,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);
}
@@ -2603,7 +2577,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);
}
@@ -2656,8 +2630,8 @@ set_const_flag_1 (cgraph_node *node, bool set_const, bool looping,
{
if (TREE_READONLY (node->decl))
{
- TREE_READONLY (node->decl) = 0;
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
+ TREE_READONLY (node->decl) = 0;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
*changed = true;
}
}
@@ -2684,14 +2658,14 @@ set_const_flag_1 (cgraph_node *node, bool set_const, bool looping,
{
if (!looping && DECL_LOOPING_CONST_OR_PURE_P (node->decl))
{
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
*changed = true;
}
}
else if (node->binds_to_current_def_p ())
{
TREE_READONLY (node->decl) = true;
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping;
DECL_PURE_P (node->decl) = false;
*changed = true;
}
@@ -2703,12 +2677,12 @@ set_const_flag_1 (cgraph_node *node, bool set_const, bool looping,
if (!DECL_PURE_P (node->decl))
{
DECL_PURE_P (node->decl) = true;
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping;
*changed = true;
}
else if (!looping && DECL_LOOPING_CONST_OR_PURE_P (node->decl))
{
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
*changed = true;
}
}
@@ -2722,14 +2696,14 @@ 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
- || !node->binds_to_current_def_p (e->caller)))
+ if (set_const
+ && (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
set_const_flag_1 (e->caller, set_const, looping, changed);
@@ -2799,14 +2773,14 @@ set_pure_flag_1 (cgraph_node *node, void *data)
{
if (!DECL_PURE_P (node->decl) && !TREE_READONLY (node->decl))
{
- DECL_PURE_P (node->decl) = true;
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = info->looping;
+ DECL_PURE_P (node->decl) = true;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = info->looping;
info->changed = true;
}
else if (DECL_LOOPING_CONST_OR_PURE_P (node->decl)
&& !info->looping)
{
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
info->changed = true;
}
}
@@ -2814,8 +2788,8 @@ set_pure_flag_1 (cgraph_node *node, void *data)
{
if (DECL_PURE_P (node->decl))
{
- DECL_PURE_P (node->decl) = false;
- DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
+ DECL_PURE_P (node->decl) = false;
+ DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
info->changed = true;
}
}
@@ -2969,7 +2943,7 @@ cgraph_node::can_remove_if_no_direct_calls_p (bool will_inline)
/* If function is not being inlined, we care only about
references outside of the comdat group. */
if (!will_inline)
- for (int i = 0; next->iterate_referring (i, ref); i++)
+ for (int i = 0; next->iterate_referring (i, ref); i++)
if (ref->referring->get_comdat_group () != get_comdat_group ())
return false;
}
@@ -3072,8 +3046,8 @@ 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)
- redirect_callers->safe_push (cs);
+ && !cs->caller->thunk)
+ redirect_callers->safe_push (cs);
return false;
}
@@ -3103,7 +3077,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;
@@ -3113,9 +3087,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
@@ -3125,8 +3099,9 @@ clone_of_p (cgraph_node *node, cgraph_node *node2)
return true;
node = node->callees->callee->ultimate_alias_target ();
- if (!node2->clone.param_adjustments
- || node2->clone.param_adjustments->first_param_intact_p ())
+ clone_info *info = clone_info::get (node2);
+ if (!info || !info->param_adjustments
+ || info->param_adjustments->first_param_intact_p ())
return false;
if (node2->former_clone_of == node->decl
|| node2->former_clone_of == node->former_clone_of)
@@ -3657,7 +3632,7 @@ cgraph_node::verify_node (void)
if (callees)
{
error ("Alias has call edges");
- error_found = true;
+ error_found = true;
}
for (i = 0; iterate_reference (i, ref); i++)
if (ref->use != IPA_REF_ALIAS)
@@ -3679,23 +3654,23 @@ cgraph_node::verify_node (void)
}
}
- if (analyzed && thunk.thunk_p)
+ if (analyzed && thunk)
{
if (!callees)
{
error ("No edge out of thunk node");
- error_found = true;
+ error_found = true;
}
else if (callees->next_callee)
{
error ("More than one edge out of thunk node");
- error_found = true;
+ error_found = true;
}
if (gimple_has_body_p (decl) && !inlined_to)
- {
+ {
error ("Thunk is not supposed to have body");
- error_found = true;
- }
+ error_found = true;
+ }
}
else if (analyzed && gimple_has_body_p (decl)
&& !TREE_ASM_WRITTEN (decl)
@@ -3798,27 +3773,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)
- {
- error ("missing origin for a node in a nested list");
- error_found = true;
- }
- else if (n->origin != this)
+ for (cgraph_node *n = info->nested; n != NULL;
+ n = next_nested_function (n))
{
- 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)
@@ -3858,7 +3838,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;
@@ -3885,7 +3865,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;
@@ -3899,16 +3879,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))
@@ -4022,6 +4013,9 @@ cgraph_node::get_fun () const
void
cgraph_c_finalize (void)
{
+ nested_function_info::release ();
+ thunk_info::release ();
+ clone_info::release ();
symtab = NULL;
x_cgraph_nodes_queue = NULL;
@@ -4057,7 +4051,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;
}
@@ -4129,6 +4123,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 96d6cf6..73c37d8 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -221,7 +221,7 @@ public:
/* Get number of references for this node. */
inline unsigned num_references (void)
{
- return ref_list.references ? ref_list.references->length () : 0;
+ return ref_list.references.length ();
}
/* Iterates I-th reference in the list, REF is also set. */
@@ -604,7 +604,7 @@ public:
symtab_node *same_comdat_group;
/* Vectors of referring and referenced entities. */
- ipa_ref_list ref_list;
+ ipa_ref_list GTY((skip)) ref_list;
/* Alias target. May be either DECL pointer or ASSEMBLER_NAME pointer
depending to what was known to frontend on the creation time.
@@ -631,7 +631,7 @@ protected:
/* Remove node from symbol table. This function is not used directly, but via
cgraph/varpool node removal routines. */
- void unregister (void);
+ void unregister (struct clone_info *);
/* Return the initialization and finalization priority information for
DECL. If there is no previous priority information, a freshly
@@ -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
@@ -737,27 +691,6 @@ struct GTY(()) ipa_replace_map
int parm_num;
};
-struct GTY(()) cgraph_clone_info
-{
- /* Constants discovered by IPA-CP, i.e. which parameter should be replaced
- with what. */
- vec<ipa_replace_map *, va_gc> *tree_map;
- /* Parameter modification that IPA-SRA decided to perform. */
- ipa_param_adjustments *param_adjustments;
- /* Lists of dummy-decl and offset pairs representing split formal parameters
- in the caller. Offsets of all new replacements are enumerated, those
- coming from the same original parameter have the same dummy decl stored
- along with them.
-
- Dummy decls sit in call statement arguments followed by new parameter
- decls (or their SSA names) in between (caller) clone materialization and
- call redirection. Redirection then recognizes the dummy variable and
- together with the stored offsets can reconstruct what exactly the new
- parameter decls represent and can leave in place only those that the
- callee expects. */
- vec<ipa_param_performed_split, va_gc> *performed_splits;
-};
-
enum cgraph_simd_clone_arg_type
{
SIMD_CLONE_ARG_TYPE_VECTOR,
@@ -826,17 +759,17 @@ struct GTY(()) cgraph_simd_clone_arg {
struct GTY(()) cgraph_simd_clone {
/* Number of words in the SIMD lane associated with this clone. */
- unsigned int simdlen;
+ poly_uint64 simdlen;
/* Number of annotated function arguments in `args'. This is
usually the number of named arguments in FNDECL. */
unsigned int nargs;
/* Max hardware vector size in bits for integral vectors. */
- unsigned int vecsize_int;
+ poly_uint64 vecsize_int;
/* Max hardware vector size in bits for floating point vectors. */
- unsigned int vecsize_float;
+ poly_uint64 vecsize_float;
/* Machine mode of the mask argument(s), if they are to be passed
as bitmasks in integer argument(s). VOIDmode if masks are passed
@@ -921,14 +854,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),
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),
@@ -1015,7 +949,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* cgraph node being removed from symbol table; see if its entry can be
replaced by other inline clone. */
- cgraph_node *find_replacement (void);
+ cgraph_node *find_replacement (struct clone_info *);
/* Create a new cgraph node which is the new version of
callgraph node. REDIRECT_CALLERS holds the callers
@@ -1078,7 +1012,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 +1033,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 +1072,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 +1090,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,14 +1251,14 @@ 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. */
bool check_calls_comdat_local_p ();
/* Return true if function should be optimized for size. */
- bool optimize_for_size_p (void);
+ enum optimize_size_level optimize_for_size_p (void);
/* Dump the callgraph to file F. */
static void dump_cgraph (FILE *f);
@@ -1436,13 +1362,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;
@@ -1462,15 +1381,13 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node
/* Interprocedural passes scheduled to have their transform functions
applied next time we execute local pass on them. We maintain it
per-function in order to allow IPA passes to introduce new functions. */
- vec<ipa_opt_pass> GTY((skip)) ipa_transforms_to_apply;
+ vec<ipa_opt_pass, va_heap, vl_ptr> GTY((skip)) ipa_transforms_to_apply;
/* For inline clones this points to the function they will be
inlined into. */
cgraph_node *inlined_to;
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 +1401,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;
@@ -2249,6 +2168,16 @@ struct asmname_hasher : ggc_ptr_hash <symtab_node>
static bool equal (symtab_node *n, const_tree t);
};
+/* Core summaries maintained about symbols. */
+
+struct thunk_info;
+template <class T> class function_summary;
+typedef function_summary <thunk_info *> thunk_summary;
+
+struct clone_info;
+template <class T> class function_summary;
+typedef function_summary <clone_info *> clone_summary;
+
class GTY((tag ("SYMTAB"))) symbol_table
{
public:
@@ -2265,6 +2194,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_clones (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),
@@ -2296,13 +2226,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);
@@ -2553,6 +2476,12 @@ public:
hash_set <const cgraph_node *> GTY ((skip)) cloned_nodes;
+ /* Thunk annotations. */
+ thunk_summary *m_thunks;
+
+ /* Virtual clone annotations. */
+ clone_summary *m_clones;
+
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
@@ -2627,6 +2556,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);
@@ -2744,7 +2676,7 @@ symtab_node::next_defined_symbol (void)
inline ipa_ref *
symtab_node::iterate_reference (unsigned i, ipa_ref *&ref)
{
- vec_safe_iterate (ref_list.references, i, &ref);
+ ref_list.references.iterate (i, &ref);
return ref;
}
@@ -3097,18 +3029,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. */
@@ -3381,15 +3302,17 @@ cgraph_node::mark_force_output (void)
/* Return true if function should be optimized for size. */
-inline bool
+inline enum optimize_size_level
cgraph_node::optimize_for_size_p (void)
{
if (opt_for_fn (decl, optimize_size))
- return true;
+ return OPTIMIZE_SIZE_MAX;
+ if (count == profile_count::zero ())
+ return OPTIMIZE_SIZE_MAX;
if (frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)
- return true;
+ return OPTIMIZE_SIZE_BALANCED;
else
- return false;
+ return OPTIMIZE_SIZE_NO;
}
/* Return symtab_node for NODE or create one if it is not present
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index db61c21..bc59081 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -85,6 +85,8 @@ 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"
+#include "symtab-clones.h"
/* Create clone of edge in the node N represented by CALL_EXPR
the callgraph. */
@@ -183,33 +185,34 @@ 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)
+ clone_info *info = clone_info::get (node);
+ if (info && info->param_adjustments)
{
/* We do not need to duplicate this_adjusting thunks if we have removed
this. */
- if (thunk->thunk.this_adjusting
- && !node->clone.param_adjustments->first_param_intact_p ())
+ if (i->this_adjusting
+ && !info->param_adjustments->first_param_intact_p ())
return node;
new_decl = copy_node (thunk->decl);
- ipa_param_body_adjustments body_adj (node->clone.param_adjustments,
+ ipa_param_body_adjustments body_adj (info->param_adjustments,
new_decl);
body_adj.modify_formal_parameters ();
}
@@ -236,7 +239,9 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
new_thunk->thunk = thunk->thunk;
new_thunk->unique_name = in_lto_p;
new_thunk->former_clone_of = thunk->decl;
- new_thunk->clone.param_adjustments = node->clone.param_adjustments;
+ if (info && info->param_adjustments)
+ clone_info::get_create (new_thunk)->param_adjustments
+ = info->param_adjustments;
new_thunk->unit_id = thunk->unit_id;
new_thunk->merged_comdat = thunk->merged_comdat;
new_thunk->merged_extern_inline = thunk->merged_extern_inline;
@@ -256,7 +261,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 +275,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 +387,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;
@@ -408,13 +407,16 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count,
new_node->unit_id = unit_id;
new_node->merged_comdat = merged_comdat;
new_node->merged_extern_inline = merged_extern_inline;
+ clone_info *info = clone_info::get (this);
if (param_adjustments)
- new_node->clone.param_adjustments = param_adjustments;
- else
- new_node->clone.param_adjustments = clone.param_adjustments;
- new_node->clone.tree_map = NULL;
- new_node->clone.performed_splits = vec_safe_copy (clone.performed_splits);
+ clone_info::get_create (new_node)->param_adjustments = param_adjustments;
+ else if (info && info->param_adjustments)
+ clone_info::get_create (new_node)->param_adjustments
+ = info->param_adjustments;
+ if (info && info->performed_splits)
+ clone_info::get_create (new_node)->performed_splits
+ = vec_safe_copy (info->performed_splits);
new_node->split_part = split_part;
FOR_EACH_VEC_ELT (redirect_callers, i, e)
@@ -621,7 +623,8 @@ cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers,
ABI support for this. */
set_new_clone_decl_and_node_flags (new_node);
new_node->ipcp_clone = ipcp_clone;
- new_node->clone.tree_map = tree_map;
+ if (tree_map)
+ clone_info::get_create (new_node)->tree_map = tree_map;
if (!implicit_section)
new_node->set_section (get_section ());
@@ -645,9 +648,10 @@ cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers,
}
/* callgraph node being removed from symbol table; see if its entry can be
- replaced by other inline clone. */
+ replaced by other inline clone.
+ INFO is clone info to attach to the new root. */
cgraph_node *
-cgraph_node::find_replacement (void)
+cgraph_node::find_replacement (clone_info *info)
{
cgraph_node *next_inline_clone, *replacement;
@@ -687,7 +691,8 @@ cgraph_node::find_replacement (void)
clones = NULL;
/* Copy clone info. */
- next_inline_clone->clone = clone;
+ if (info)
+ *clone_info::get_create (next_inline_clone) = *info;
/* Now place it into clone tree at same level at NODE. */
next_inline_clone->clone_of = clone_of;
@@ -818,7 +823,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 +1094,60 @@ 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_info *info = clone_info::get (this);
+ 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 (info->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 (info->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 = (*info->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 (info->param_adjustments)
+ info->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 ();
+ clear_stmts_in_references ();
+ /* Copy the OLD_VERSION_NODE function tree to the new version. */
+ tree_function_versioning (clone_of->decl, decl,
+ info ? info->tree_map : NULL,
+ info ? info->param_adjustments : NULL,
+ 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 19ae876..3a98958 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);
@@ -1157,6 +1155,8 @@ analyze_functions (bool first_time)
symtab->state = CONSTRUCTION;
input_location = UNKNOWN_LOCATION;
+ thunk_info::process_early_thunks ();
+
/* Ugly, but the fixup cannot happen at a time same body alias is created;
C++ FE is confused about the COMDAT groups being right. */
if (symtab->cpp_implicit_aliases_done)
@@ -1223,7 +1223,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 +1378,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 ());
@@ -1611,7 +1611,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 +1624,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 +1733,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 +1742,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 +1794,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 +1805,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 +1818,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 +1863,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;
}
@@ -2596,7 +2113,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));
@@ -3001,6 +2518,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;
@@ -3033,7 +2553,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;
@@ -3063,8 +2582,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);
@@ -3076,11 +2598,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 6d074a7..3a43a5a 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -644,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;
@@ -727,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);
@@ -739,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);
}
@@ -756,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)
{
@@ -1722,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
@@ -1805,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);
@@ -1818,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);
}
@@ -3040,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..ed1ad45 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -7665,6 +7665,24 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
if (new_rtx != 0)
return gen_rtx_ASHIFT (mode, new_rtx, XEXP (inner, 1));
}
+ else if (GET_CODE (inner) == MULT
+ && CONST_INT_P (XEXP (inner, 1))
+ && pos_rtx == 0 && pos == 0)
+ {
+ /* We're extracting the least significant bits of an rtx
+ (mult X (const_int 2^C)), where LEN > C. Extract the
+ least significant (LEN - C) bits of X, giving an rtx
+ whose mode is MODE, then multiply it by 2^C. */
+ const HOST_WIDE_INT shift_amt = exact_log2 (INTVAL (XEXP (inner, 1)));
+ if (IN_RANGE (shift_amt, 1, len - 1))
+ {
+ new_rtx = make_extraction (mode, XEXP (inner, 0),
+ 0, 0, len - shift_amt,
+ unsignedp, in_dest, in_compare);
+ if (new_rtx)
+ return gen_rtx_MULT (mode, new_rtx, XEXP (inner, 1));
+ }
+ }
else if (GET_CODE (inner) == TRUNCATE
/* If trying or potentionally trying to extract
bits outside of is_mode, don't look through
@@ -11003,8 +11021,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 7e789d1..7d0e0d9 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -228,6 +228,10 @@ unsigned int flag_sanitize_coverage
Variable
bool dump_base_name_prefixed = false
+; What subset of registers should be zeroed on function return
+Variable
+unsigned int flag_zero_call_used_regs
+
###
Driver
@@ -1936,6 +1940,10 @@ fjump-tables
Common Var(flag_jump_tables) Init(1) Optimization
Use jump tables for sufficiently large switch statements.
+fbit-tests
+Common Var(flag_bit_tests) Init(1) Optimization
+Use bit tests for sufficiently large switch statements.
+
fkeep-inline-functions
Common Report Var(flag_keep_inline_functions)
Generate code for functions even if they are fully inlined.
@@ -3111,6 +3119,10 @@ fzero-initialized-in-bss
Common Report Var(flag_zero_initialized_in_bss) Init(1)
Put zero initialized data in the bss section.
+fzero-call-used-regs=
+Common Report RejectNegative Joined
+Clear call-used registers upon function return.
+
g
Common Driver RejectNegative JoinedOrMissing
Generate debug information in default format.
diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index c96455c..7a93e17 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -523,6 +523,8 @@ get_available_features (struct __processor_model *cpu_model,
int avx_usable = 0;
int avx512_usable = 0;
int amx_usable = 0;
+ /* Check if KL is usable. */
+ int has_kl = 0;
if ((ecx & bit_OSXSAVE))
{
/* Check if XMM, YMM, OPMASK, upper 256 bits of ZMM0-ZMM15 and
@@ -667,6 +669,8 @@ get_available_features (struct __processor_model *cpu_model,
if (edx & bit_AMX_BF16)
set_feature (FEATURE_AMX_BF16);
}
+ if (ecx & bit_KL)
+ has_kl = 1;
if (avx512_usable)
{
if (ebx & bit_AVX512F)
@@ -701,10 +705,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);
+
}
}
@@ -728,6 +737,21 @@ get_available_features (struct __processor_model *cpu_model,
set_feature (FEATURE_PTWRITE);
}
+ /* Get Advanced Features at level 0x19 (eax = 0x19). */
+ if (max_cpuid_level >= 0x19)
+ {
+ set_feature (FEATURE_AESKLE);
+ __cpuid (19, eax, ebx, ecx, edx);
+ /* Check if OS support keylocker. */
+ if (ebx & bit_AESKLE)
+ {
+ if (ebx & bit_WIDEKL)
+ set_feature (FEATURE_WIDEKL);
+ if (has_kl)
+ set_feature (FEATURE_KL);
+ }
+ }
+
/* Check cpuid level of extended features. */
__cpuid (0x80000000, ext_level, ebx, ecx, edx);
diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c
index 62a620b..e29320d 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -163,6 +163,11 @@ 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 OPTION_MASK_ISA2_KL_SET OPTION_MASK_ISA2_KL
+#define OPTION_MASK_ISA2_WIDEKL_SET \
+ (OPTION_MASK_ISA2_WIDEKL | OPTION_MASK_ISA2_KL_SET)
/* Define a set of ISAs which aren't available when a given ISA is
disabled. MMX and SSE ISAs are handled separately. */
@@ -254,6 +259,11 @@ along with GCC; see the file COPYING3. If not see
#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
+#define OPTION_MASK_ISA2_KL_UNSET \
+ (OPTION_MASK_ISA2_KL | OPTION_MASK_ISA2_WIDEKL_UNSET)
+#define OPTION_MASK_ISA2_WIDEKL_UNSET OPTION_MASK_ISA2_WIDEKL
/* SSE4 includes both SSE4.1 and SSE4.2. -mno-sse4 should the same
as -mno-sse4.1. */
@@ -300,6 +310,16 @@ along with GCC; see the file COPYING3. If not see
| OPTION_MASK_ISA2_AVX512VP2INTERSECT_UNSET)
#define OPTION_MASK_ISA2_GENERAL_REGS_ONLY_UNSET \
(OPTION_MASK_ISA2_AVX512F_UNSET)
+#define OPTION_MASK_ISA2_AVX2_UNSET OPTION_MASK_ISA2_AVX512F_UNSET
+#define OPTION_MASK_ISA2_AVX_UNSET OPTION_MASK_ISA2_AVX2_UNSET
+#define OPTION_MASK_ISA2_SSE4_2_UNSET OPTION_MASK_ISA2_AVX_UNSET
+#define OPTION_MASK_ISA2_SSE4_1_UNSET OPTION_MASK_ISA2_SSE4_2_UNSET
+#define OPTION_MASK_ISA2_SSE4_UNSET OPTION_MASK_ISA2_SSE4_1_UNSET
+#define OPTION_MASK_ISA2_SSSE3_UNSET OPTION_MASK_ISA2_SSE4_1_UNSET
+#define OPTION_MASK_ISA2_SSE3_UNSET OPTION_MASK_ISA2_SSSE3_UNSET
+#define OPTION_MASK_ISA2_SSE2_UNSET \
+ (OPTION_MASK_ISA2_SSE3_UNSET | OPTION_MASK_ISA2_KL_UNSET)
+#define OPTION_MASK_ISA2_SSE_UNSET OPTION_MASK_ISA2_SSE2_UNSET
#define OPTION_MASK_ISA2_AVX512BW_UNSET OPTION_MASK_ISA2_AVX512BF16_UNSET
@@ -395,8 +415,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE_UNSET;
}
return true;
@@ -410,8 +430,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE2_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE2_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE2_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE2_UNSET;
}
return true;
@@ -425,8 +445,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE3_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE3_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE3_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE3_UNSET;
}
return true;
@@ -440,8 +460,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSSE3_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSSE3_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSSE3_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSSE3_UNSET;
}
return true;
@@ -455,8 +475,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE4_1_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_1_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE4_1_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE4_1_UNSET;
}
return true;
@@ -470,8 +490,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE4_2_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_2_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE4_2_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE4_2_UNSET;
}
return true;
@@ -485,8 +505,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_AVX_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_AVX_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX_UNSET;
}
return true;
@@ -500,8 +520,8 @@ ix86_handle_option (struct gcc_options *opts,
{
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_AVX2_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_AVX2_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX2_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX2_UNSET;
}
return true;
@@ -687,6 +707,40 @@ ix86_handle_option (struct gcc_options *opts,
opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_ENQCMD_UNSET;
opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_ENQCMD_UNSET;
}
+ return true;
+
+ case OPT_mkl:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_KL_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_KL_SET;
+
+ /* The Keylocker instructions need XMM registers from SSE2. */
+ opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE2_SET;
+ opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE2_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_KL_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_KL_UNSET;
+ }
+ return true;
+
+ case OPT_mwidekl:
+ if (value)
+ {
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_WIDEKL_SET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_WIDEKL_SET;
+
+ /* The Widekl instructions need XMM registers from SSE2. */
+ opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE2_SET;
+ opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE2_SET;
+ }
+ else
+ {
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_WIDEKL_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_WIDEKL_UNSET;
+ }
return true;
case OPT_mserialize:
@@ -702,6 +756,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)
{
@@ -1013,8 +1093,8 @@ ix86_handle_option (struct gcc_options *opts,
case OPT_mno_sse4:
opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE4_UNSET;
opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_UNSET;
- opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_AVX512F_UNSET;
- opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_AVX512F_UNSET;
+ opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE4_UNSET;
+ opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE4_UNSET;
return true;
case OPT_msse4a:
diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h
index 5b94b1f..2138220 100644
--- a/gcc/common/config/i386/i386-cpuinfo.h
+++ b/gcc/common/config/i386/i386-cpuinfo.h
@@ -219,6 +219,11 @@ enum processor_features
FEATURE_AMX_TILE,
FEATURE_AMX_INT8,
FEATURE_AMX_BF16,
+ FEATURE_UINTR,
+ FEATURE_HRESET,
+ FEATURE_KL,
+ FEATURE_AESKLE,
+ FEATURE_WIDEKL,
CPU_FEATURE_MAX
};
diff --git a/gcc/common/config/i386/i386-isas.h b/gcc/common/config/i386/i386-isas.h
index 3c830ea..921db06 100644
--- a/gcc/common/config/i386/i386-isas.h
+++ b/gcc/common/config/i386/i386-isas.h
@@ -163,4 +163,9 @@ ISA_NAMES_TABLE_START
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_ENTRY("kl", FEATURE_KL, P_NONE, "-mkl")
+ ISA_NAMES_TABLE_ENTRY("aeskle", FEATURE_AESKLE, P_NONE, NULL)
+ ISA_NAMES_TABLE_ENTRY("widekl", FEATURE_WIDEKL, P_NONE, "-mwidekl")
ISA_NAMES_TABLE_END
diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c
index 82c5154..9a576eb 100644
--- a/gcc/common/config/riscv/riscv-common.c
+++ b/gcc/common/config/riscv/riscv-common.c
@@ -54,12 +54,20 @@ struct riscv_implied_info_t
};
/* Implied ISA info, must end with NULL sentinel. */
-riscv_implied_info_t riscv_implied_info[] =
+static const riscv_implied_info_t riscv_implied_info[] =
{
{"d", "f"},
{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
{
@@ -451,7 +459,7 @@ riscv_subset_list::handle_implied_ext (const char *ext,
int minor_version,
bool explicit_version_p)
{
- riscv_implied_info_t *implied_info;
+ const riscv_implied_info_t *implied_info;
for (implied_info = &riscv_implied_info[0];
implied_info->ext;
++implied_info)
@@ -516,6 +524,14 @@ riscv_subset_list::parse_multiletter_ext (const char *p,
*q = '\0';
+ if (strlen (subset) == 1)
+ {
+ error_at (m_loc, "%<-march=%s%>: name of %s must be more than 1 letter",
+ m_arch, ext_type_str);
+ free (subset);
+ return NULL;
+ }
+
add (subset, major_version, minor_version, explicit_version_p);
free (subset);
p += end_of_version - subset;
@@ -604,48 +620,70 @@ 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();
}
+/* Type for pointer to member of gcc_options. */
+typedef int (gcc_options::*opt_var_ref_t);
+
+/* Types for recording extension to internal flag. */
+struct riscv_ext_flag_table_t {
+ const char *ext;
+ opt_var_ref_t var_ref;
+ int mask;
+};
+
+/* Mapping table between extension to internal flag. */
+static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
+{
+ {"e", &gcc_options::x_target_flags, MASK_RVE},
+ {"m", &gcc_options::x_target_flags, MASK_MUL},
+ {"a", &gcc_options::x_target_flags, MASK_ATOMIC},
+ {"f", &gcc_options::x_target_flags, MASK_HARD_FLOAT},
+ {"d", &gcc_options::x_target_flags, MASK_DOUBLE_FLOAT},
+ {"c", &gcc_options::x_target_flags, MASK_RVC},
+ {NULL, NULL, 0}
+};
+
/* Parse a RISC-V ISA string into an option mask. Must clear or set all arch
dependent mask bits, in case more than one -march string is passed. */
static void
-riscv_parse_arch_string (const char *isa, int *flags, location_t loc)
+riscv_parse_arch_string (const char *isa,
+ struct gcc_options *opts,
+ location_t loc)
{
riscv_subset_list *subset_list;
subset_list = riscv_subset_list::parse (isa, loc);
if (!subset_list)
return;
- if (subset_list->xlen () == 32)
- *flags &= ~MASK_64BIT;
- else if (subset_list->xlen () == 64)
- *flags |= MASK_64BIT;
-
- *flags &= ~MASK_RVE;
- if (subset_list->lookup ("e"))
- *flags |= MASK_RVE;
-
- *flags &= ~MASK_MUL;
- if (subset_list->lookup ("m"))
- *flags |= MASK_MUL;
-
- *flags &= ~MASK_ATOMIC;
- if (subset_list->lookup ("a"))
- *flags |= MASK_ATOMIC;
-
- *flags &= ~(MASK_HARD_FLOAT | MASK_DOUBLE_FLOAT);
- if (subset_list->lookup ("f"))
- *flags |= MASK_HARD_FLOAT;
-
- if (subset_list->lookup ("d"))
- *flags |= MASK_DOUBLE_FLOAT;
-
- *flags &= ~MASK_RVC;
- if (subset_list->lookup ("c"))
- *flags |= MASK_RVC;
+ if (opts)
+ {
+ const riscv_ext_flag_table_t *arch_ext_flag_tab;
+ /* Clean up target flags before we set. */
+ for (arch_ext_flag_tab = &riscv_ext_flag_table[0];
+ arch_ext_flag_tab->ext;
+ ++arch_ext_flag_tab)
+ opts->*arch_ext_flag_tab->var_ref &= ~arch_ext_flag_tab->mask;
+
+ if (subset_list->xlen () == 32)
+ opts->x_target_flags &= ~MASK_64BIT;
+ else if (subset_list->xlen () == 64)
+ opts->x_target_flags |= MASK_64BIT;
+
+
+ for (arch_ext_flag_tab = &riscv_ext_flag_table[0];
+ arch_ext_flag_tab->ext;
+ ++arch_ext_flag_tab)
+ {
+ if (subset_list->lookup (arch_ext_flag_tab->ext))
+ opts->*arch_ext_flag_tab->var_ref |= arch_ext_flag_tab->mask;
+ }
+ }
if (current_subset_list)
delete current_subset_list;
@@ -653,6 +691,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
@@ -664,7 +717,13 @@ riscv_handle_option (struct gcc_options *opts,
switch (decoded->opt_index)
{
case OPT_march_:
- riscv_parse_arch_string (decoded->arg, &opts->x_target_flags, loc);
+ riscv_parse_arch_string (decoded->arg, opts, 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:
@@ -678,15 +737,63 @@ 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;
+ riscv_parse_arch_string (argv[0], NULL, loc);
+ 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;
+
+ riscv_parse_arch_string (arch_str, NULL, 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 d5634b0..dc6d68b 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -413,7 +413,8 @@ i[34567]86-*-*)
avx512bf16intrin.h enqcmdintrin.h serializeintrin.h
avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h
tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h
- amxbf16intrin.h x86gprintrin.h"
+ amxbf16intrin.h x86gprintrin.h uintrintrin.h
+ hresetintrin.h keylockerintrin.h"
;;
x86_64-*-*)
cpu_type=i386
@@ -449,7 +450,8 @@ x86_64-*-*)
avx512bf16intrin.h enqcmdintrin.h serializeintrin.h
avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h
tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h
- amxbf16intrin.h x86gprintrin.h"
+ amxbf16intrin.h x86gprintrin.h uintrintrin.h
+ hresetintrin.h keylockerintrin.h"
;;
ia64-*-*)
extra_headers=ia64intrin.h
@@ -660,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.
@@ -670,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.
@@ -2046,7 +2050,7 @@ i[34567]86-*-solaris2* | x86_64-*-solaris2*)
esac
fi
;;
-i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae|i[4567]86-wrs-vxworks7|x86_64-wrs-vxworks7)
+i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
tm_file="${tm_file} i386/unix.h i386/att.h elfos.h"
case ${target} in
x86_64-*)
@@ -2434,11 +2438,13 @@ riscv*-*-elf* | riscv*-*-rtems*)
tmake_file="${tmake_file} riscv/t-rtems"
;;
*)
- case "x${enable_multilib}" in
- xno) ;;
- xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;;
- *) echo "Unknown value for enable_multilib"; exit 1
- esac
+ if test "x${with_multilib_generator}" == xdefault; then
+ case "x${enable_multilib}" in
+ xno) ;;
+ xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;;
+ *) echo "Unknown value for enable_multilib"; exit 1
+ esac
+ fi
esac
tmake_file="${tmake_file} riscv/t-riscv"
gnu_ld=yes
@@ -2974,6 +2980,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"
@@ -4456,6 +4483,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
;;
*)
@@ -4573,6 +4611,30 @@ case "${target}" in
exit 1
;;
esac
+ # Handle --with-multilib-generator.
+ if test "x${with_multilib_generator}" != xdefault; then
+ if test "x${with_multilib_list}" != xdefault; then
+ echo "--with-multilib-list= can't used with --with-multilib-generator= at same time" 1>&2
+ exit 1
+ fi
+ case "${target}" in
+ riscv*-*-elf*)
+ if ${srcdir}/config/riscv/multilib-generator \
+ `echo ${with_multilib_generator} | sed 's/;/ /g'`\
+ > t-multilib-config;
+ then
+ tmake_file="${tmake_file} riscv/t-withmultilib-generator"
+ else
+ echo "invalid option for --with-multilib-generator" 1>&2
+ exit 1
+ fi
+ ;;
+ *)
+ echo "--with-multilib-generator= is not supported for ${target}, only supported for riscv*-*-elf*" 1>&2
+ exit 1
+ ;;
+ esac
+ fi
# Handle --with-multilib-list.
if test "x${with_multilib_list}" != xdefault; then
diff --git a/gcc/config.in b/gcc/config.in
index 3657c46..b7c3107 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -719,10 +719,10 @@
#endif
-/* Define if your assembler supports --gdwarf-4 even with compiler generated
- .debug_line */
+/* Define if your assembler supports --gdwarf-4/--gdwarf-5 even with compiler
+ generated .debug_line. */
#ifndef USED_FOR_TARGET
-#undef HAVE_AS_WORKING_DWARF_4_FLAG
+#undef HAVE_AS_WORKING_DWARF_N_FLAG
#endif
diff --git a/gcc/config/aarch64/aarch64-bti-insert.c b/gcc/config/aarch64/aarch64-bti-insert.c
index 57663ee..9802669 100644
--- a/gcc/config/aarch64/aarch64-bti-insert.c
+++ b/gcc/config/aarch64/aarch64-bti-insert.c
@@ -95,7 +95,7 @@ static bool
aarch64_pac_insn_p (rtx x)
{
if (!INSN_P (x))
- return x;
+ return false;
subrtx_var_iterator::array_type array;
FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (x), ALL)
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 732a4dc..188fce0 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -132,6 +132,7 @@ const unsigned int FLAG_AUTO_FP = 1U << 5;
const unsigned int FLAG_FP = FLAG_READ_FPCR | FLAG_RAISE_FP_EXCEPTIONS;
const unsigned int FLAG_ALL = FLAG_READ_FPCR | FLAG_RAISE_FP_EXCEPTIONS
| FLAG_READ_MEMORY | FLAG_PREFETCH_MEMORY | FLAG_WRITE_MEMORY;
+const unsigned int FLAG_STORE = FLAG_WRITE_MEMORY | FLAG_AUTO_FP;
typedef struct
{
@@ -265,6 +266,11 @@ static enum aarch64_type_qualifiers
aarch64_types_unsigned_shift_qualifiers[SIMD_MAX_BUILTIN_ARGS]
= { qualifier_unsigned, qualifier_unsigned, qualifier_immediate };
#define TYPES_USHIFTIMM (aarch64_types_unsigned_shift_qualifiers)
+#define TYPES_USHIFT2IMM (aarch64_types_ternopu_imm_qualifiers)
+static enum aarch64_type_qualifiers
+aarch64_types_shift2_to_unsigned_qualifiers[SIMD_MAX_BUILTIN_ARGS]
+ = { qualifier_unsigned, qualifier_unsigned, qualifier_none, qualifier_immediate };
+#define TYPES_SHIFT2IMM_UUSS (aarch64_types_shift2_to_unsigned_qualifiers)
static enum aarch64_type_qualifiers
aarch64_types_ternop_s_imm_p_qualifiers[SIMD_MAX_BUILTIN_ARGS]
@@ -276,6 +282,7 @@ aarch64_types_ternop_s_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS]
#define TYPES_SETREG (aarch64_types_ternop_s_imm_qualifiers)
#define TYPES_SHIFTINSERT (aarch64_types_ternop_s_imm_qualifiers)
#define TYPES_SHIFTACC (aarch64_types_ternop_s_imm_qualifiers)
+#define TYPES_SHIFT2IMM (aarch64_types_ternop_s_imm_qualifiers)
static enum aarch64_type_qualifiers
aarch64_types_ternop_p_imm_qualifiers[SIMD_MAX_BUILTIN_ARGS]
@@ -1855,10 +1862,10 @@ aarch64_expand_fcmla_builtin (tree exp, rtx target, int fcode)
only need to know the order in a V2mode. */
lane_idx = aarch64_endian_lane_rtx (V2DImode, lane);
- if (!target)
+ if (!target
+ || !REG_P (target)
+ || GET_MODE (target) != d->mode)
target = gen_reg_rtx (d->mode);
- else
- target = force_reg (d->mode, target);
rtx pat = NULL_RTX;
diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def
index b2e1932..3aa13f6 100644
--- a/gcc/config/aarch64/aarch64-cores.def
+++ b/gcc/config/aarch64/aarch64-cores.def
@@ -143,7 +143,7 @@ AARCH64_CORE("neoverse-v1", neoversev1, cortexa57, 8_4A, AARCH64_FL_FOR_ARCH8_4
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, neoversen1, 0x41, 0xd49, -1)
+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. */
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index e587e2e..b1d1f67 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -64,8 +64,6 @@
} \
while (0)
-#define GNU_USER_TARGET_D_CRITSEC_SIZE 48
-
#define TARGET_ASM_FILE_END aarch64_file_end_indicate_exec_stack
/* Uninitialized common symbols in non-PIE executables, even with
diff --git a/gcc/config/aarch64/aarch64-modes.def b/gcc/config/aarch64/aarch64-modes.def
index af972e8..f304992 100644
--- a/gcc/config/aarch64/aarch64-modes.def
+++ b/gcc/config/aarch64/aarch64-modes.def
@@ -136,11 +136,13 @@ ADJUST_NUNITS (VNx2QI, aarch64_sve_vg);
ADJUST_NUNITS (VNx2HI, aarch64_sve_vg);
ADJUST_NUNITS (VNx2SI, aarch64_sve_vg);
ADJUST_NUNITS (VNx2HF, aarch64_sve_vg);
+ADJUST_NUNITS (VNx2BF, aarch64_sve_vg);
ADJUST_NUNITS (VNx2SF, aarch64_sve_vg);
ADJUST_NUNITS (VNx4QI, aarch64_sve_vg * 2);
ADJUST_NUNITS (VNx4HI, aarch64_sve_vg * 2);
ADJUST_NUNITS (VNx4HF, aarch64_sve_vg * 2);
+ADJUST_NUNITS (VNx4BF, aarch64_sve_vg * 2);
ADJUST_NUNITS (VNx8QI, aarch64_sve_vg * 4);
@@ -151,7 +153,9 @@ ADJUST_ALIGNMENT (VNx8QI, 1);
ADJUST_ALIGNMENT (VNx2HI, 2);
ADJUST_ALIGNMENT (VNx4HI, 2);
ADJUST_ALIGNMENT (VNx2HF, 2);
+ADJUST_ALIGNMENT (VNx2BF, 2);
ADJUST_ALIGNMENT (VNx4HF, 2);
+ADJUST_ALIGNMENT (VNx4BF, 2);
ADJUST_ALIGNMENT (VNx2SI, 4);
ADJUST_ALIGNMENT (VNx2SF, 4);
diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def
index 3554fb0..cb05aad 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>. */
@@ -111,13 +111,13 @@
BUILTIN_VALLDIF (LOADSTRUCT_LANE, ld3_lane, 0, ALL)
BUILTIN_VALLDIF (LOADSTRUCT_LANE, ld4_lane, 0, ALL)
/* Implemented by aarch64_st<VSTRUCT:nregs><VDC:mode>. */
- BUILTIN_VDC (STORESTRUCT, st2, 0, ALL)
- BUILTIN_VDC (STORESTRUCT, st3, 0, ALL)
- BUILTIN_VDC (STORESTRUCT, st4, 0, ALL)
+ BUILTIN_VDC (STORESTRUCT, st2, 0, STORE)
+ BUILTIN_VDC (STORESTRUCT, st3, 0, STORE)
+ BUILTIN_VDC (STORESTRUCT, st4, 0, STORE)
/* Implemented by aarch64_st<VSTRUCT:nregs><VQ:mode>. */
- BUILTIN_VQ (STORESTRUCT, st2, 0, ALL)
- BUILTIN_VQ (STORESTRUCT, st3, 0, ALL)
- BUILTIN_VQ (STORESTRUCT, st4, 0, ALL)
+ BUILTIN_VQ (STORESTRUCT, st2, 0, STORE)
+ BUILTIN_VQ (STORESTRUCT, st3, 0, STORE)
+ BUILTIN_VQ (STORESTRUCT, st4, 0, STORE)
BUILTIN_VALLDIF (STORESTRUCT_LANE, st2_lane, 0, ALL)
BUILTIN_VALLDIF (STORESTRUCT_LANE, st3_lane, 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)
@@ -285,6 +285,13 @@
BUILTIN_VSQN_HSDI (USHIFTIMM, uqshrn_n, 0, ALL)
BUILTIN_VSQN_HSDI (SHIFTIMM, sqrshrn_n, 0, ALL)
BUILTIN_VSQN_HSDI (USHIFTIMM, uqrshrn_n, 0, ALL)
+ /* Implemented by aarch64_<sur>q<r>shr<u>n2_n<mode>. */
+ BUILTIN_VQN (SHIFT2IMM_UUSS, sqshrun2_n, 0, NONE)
+ BUILTIN_VQN (SHIFT2IMM_UUSS, sqrshrun2_n, 0, NONE)
+ BUILTIN_VQN (SHIFT2IMM, sqshrn2_n, 0, NONE)
+ BUILTIN_VQN (USHIFT2IMM, uqshrn2_n, 0, NONE)
+ BUILTIN_VQN (SHIFT2IMM, sqrshrn2_n, 0, NONE)
+ BUILTIN_VQN (USHIFT2IMM, uqrshrn2_n, 0, NONE)
/* Implemented by aarch64_<sur>s<lr>i_n<mode>. */
BUILTIN_VSDQ_I_DI (SHIFTINSERT, ssri_n, 0, ALL)
BUILTIN_VSDQ_I_DI (USHIFTACC, usri_n, 0, ALL)
@@ -430,17 +437,17 @@
VAR1 (UNOPUS, lfrintnudf, 2, FP, di)
/* Implemented by <optab><fcvt_target><VDQF:mode>2. */
- VAR1 (UNOP, floatv4hi, 2, ALL, v4hf)
- VAR1 (UNOP, floatv8hi, 2, ALL, v8hf)
- VAR1 (UNOP, floatv2si, 2, ALL, v2sf)
- VAR1 (UNOP, floatv4si, 2, ALL, v4sf)
- VAR1 (UNOP, floatv2di, 2, ALL, v2df)
-
- VAR1 (UNOP, floatunsv4hi, 2, ALL, v4hf)
- VAR1 (UNOP, floatunsv8hi, 2, ALL, v8hf)
- VAR1 (UNOP, floatunsv2si, 2, ALL, v2sf)
- VAR1 (UNOP, floatunsv4si, 2, ALL, v4sf)
- VAR1 (UNOP, floatunsv2di, 2, ALL, v2df)
+ VAR1 (UNOP, floatv4hi, 2, FP, v4hf)
+ VAR1 (UNOP, floatv8hi, 2, FP, v8hf)
+ VAR1 (UNOP, floatv2si, 2, FP, v2sf)
+ VAR1 (UNOP, floatv4si, 2, FP, v4sf)
+ VAR1 (UNOP, floatv2di, 2, FP, v2df)
+
+ VAR1 (UNOP, floatunsv4hi, 2, FP, v4hf)
+ VAR1 (UNOP, floatunsv8hi, 2, FP, v8hf)
+ VAR1 (UNOP, floatunsv2si, 2, FP, v2sf)
+ VAR1 (UNOP, floatunsv4si, 2, FP, v4sf)
+ VAR1 (UNOP, floatunsv2di, 2, FP, v2df)
VAR5 (UNOPU, bswap, 2, ALL, v4hi, v8hi, v2si, v4si, v2di)
@@ -469,21 +476,21 @@
BUILTIN_VHSDF (UNOP, abs, 2, ALL)
VAR1 (UNOP, abs, 2, ALL, hf)
- BUILTIN_VQ_HSF (UNOP, vec_unpacks_hi_, 10, ALL)
- VAR1 (BINOP, float_truncate_hi_, 0, ALL, v4sf)
- VAR1 (BINOP, float_truncate_hi_, 0, ALL, v8hf)
+ BUILTIN_VQ_HSF (UNOP, vec_unpacks_hi_, 10, FP)
+ VAR1 (BINOP, float_truncate_hi_, 0, FP, v4sf)
+ VAR1 (BINOP, float_truncate_hi_, 0, FP, v8hf)
- VAR1 (UNOP, float_extend_lo_, 0, ALL, v2df)
- VAR1 (UNOP, float_extend_lo_, 0, ALL, v4sf)
- BUILTIN_VDF (UNOP, float_truncate_lo_, 0, ALL)
+ VAR1 (UNOP, float_extend_lo_, 0, FP, v2df)
+ VAR1 (UNOP, float_extend_lo_, 0, FP, v4sf)
+ BUILTIN_VDF (UNOP, float_truncate_lo_, 0, FP)
/* Implemented by aarch64_ld1<VALL_F16:mode>. */
BUILTIN_VALL_F16 (LOAD1, ld1, 0, ALL)
VAR1(STORE1P, ld1, 0, ALL, v2di)
/* Implemented by aarch64_st1<VALL_F16:mode>. */
- BUILTIN_VALL_F16 (STORE1, st1, 0, ALL)
- VAR1(STORE1P, st1, 0, ALL, v2di)
+ BUILTIN_VALL_F16 (STORE1, st1, 0, STORE)
+ VAR1 (STORE1P, st1, 0, STORE, v2di)
/* Implemented by aarch64_ld1x3<VALLDIF:mode>. */
BUILTIN_VALLDIF (LOADSTRUCT, ld1x3, 0, ALL)
@@ -492,13 +499,13 @@
BUILTIN_VALLDIF (LOADSTRUCT, ld1x4, 0, ALL)
/* Implemented by aarch64_st1x2<VALLDIF:mode>. */
- BUILTIN_VALLDIF (STORESTRUCT, st1x2, 0, ALL)
+ BUILTIN_VALLDIF (STORESTRUCT, st1x2, 0, STORE)
/* Implemented by aarch64_st1x3<VALLDIF:mode>. */
- BUILTIN_VALLDIF (STORESTRUCT, st1x3, 0, ALL)
+ BUILTIN_VALLDIF (STORESTRUCT, st1x3, 0, STORE)
/* Implemented by aarch64_st1x4<VALLDIF:mode>. */
- BUILTIN_VALLDIF (STORESTRUCT, st1x4, 0, ALL)
+ BUILTIN_VALLDIF (STORESTRUCT, st1x4, 0, STORE)
/* Implemented by fma<mode>4. */
BUILTIN_VHSDF (TERNOP, fma, 4, ALL)
@@ -514,52 +521,52 @@
BUILTIN_VALLDIF (BSL_S, simd_bsl, 0, ALL)
/* Implemented by aarch64_crypto_aes<op><mode>. */
- VAR1 (BINOPU, crypto_aese, 0, ALL, v16qi)
- VAR1 (BINOPU, crypto_aesd, 0, ALL, v16qi)
- VAR1 (UNOPU, crypto_aesmc, 0, ALL, v16qi)
- VAR1 (UNOPU, crypto_aesimc, 0, ALL, v16qi)
+ VAR1 (BINOPU, crypto_aese, 0, NONE, v16qi)
+ VAR1 (BINOPU, crypto_aesd, 0, NONE, v16qi)
+ VAR1 (UNOPU, crypto_aesmc, 0, NONE, v16qi)
+ VAR1 (UNOPU, crypto_aesimc, 0, NONE, v16qi)
/* Implemented by aarch64_crypto_sha1<op><mode>. */
- VAR1 (UNOPU, crypto_sha1h, 0, ALL, si)
- VAR1 (BINOPU, crypto_sha1su1, 0, ALL, v4si)
- VAR1 (TERNOPU, crypto_sha1c, 0, ALL, v4si)
- VAR1 (TERNOPU, crypto_sha1m, 0, ALL, v4si)
- VAR1 (TERNOPU, crypto_sha1p, 0, ALL, v4si)
- VAR1 (TERNOPU, crypto_sha1su0, 0, ALL, v4si)
+ VAR1 (UNOPU, crypto_sha1h, 0, NONE, si)
+ VAR1 (BINOPU, crypto_sha1su1, 0, NONE, v4si)
+ VAR1 (TERNOPU, crypto_sha1c, 0, NONE, v4si)
+ VAR1 (TERNOPU, crypto_sha1m, 0, NONE, v4si)
+ VAR1 (TERNOPU, crypto_sha1p, 0, NONE, v4si)
+ VAR1 (TERNOPU, crypto_sha1su0, 0, NONE, v4si)
/* Implemented by aarch64_crypto_sha256<op><mode>. */
- VAR1 (TERNOPU, crypto_sha256h, 0, ALL, v4si)
- VAR1 (TERNOPU, crypto_sha256h2, 0, ALL, v4si)
- VAR1 (BINOPU, crypto_sha256su0, 0, ALL, v4si)
- VAR1 (TERNOPU, crypto_sha256su1, 0, ALL, v4si)
+ VAR1 (TERNOPU, crypto_sha256h, 0, NONE, v4si)
+ VAR1 (TERNOPU, crypto_sha256h2, 0, NONE, v4si)
+ VAR1 (BINOPU, crypto_sha256su0, 0, NONE, v4si)
+ VAR1 (TERNOPU, crypto_sha256su1, 0, NONE, 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)
- VAR1 (BINOP, tbl3, 0, ALL, v16qi)
+ VAR1 (BINOP, tbl3, 0, NONE, v8qi)
+ VAR1 (BINOP, tbl3, 0, NONE, v16qi)
/* Implemented by aarch64_qtbl3<mode>. */
- VAR1 (BINOP, qtbl3, 0, ALL, v8qi)
- VAR1 (BINOP, qtbl3, 0, ALL, v16qi)
+ VAR1 (BINOP, qtbl3, 0, NONE, v8qi)
+ VAR1 (BINOP, qtbl3, 0, NONE, v16qi)
/* Implemented by aarch64_qtbl4<mode>. */
- VAR1 (BINOP, qtbl4, 0, ALL, v8qi)
- VAR1 (BINOP, qtbl4, 0, ALL, v16qi)
+ VAR1 (BINOP, qtbl4, 0, NONE, v8qi)
+ VAR1 (BINOP, qtbl4, 0, NONE, v16qi)
/* Implemented by aarch64_tbx4<mode>. */
- VAR1 (TERNOP, tbx4, 0, ALL, v8qi)
- VAR1 (TERNOP, tbx4, 0, ALL, v16qi)
+ VAR1 (TERNOP, tbx4, 0, NONE, v8qi)
+ VAR1 (TERNOP, tbx4, 0, NONE, v16qi)
/* Implemented by aarch64_qtbx3<mode>. */
- VAR1 (TERNOP, qtbx3, 0, ALL, v8qi)
- VAR1 (TERNOP, qtbx3, 0, ALL, v16qi)
+ VAR1 (TERNOP, qtbx3, 0, NONE, v8qi)
+ VAR1 (TERNOP, qtbx3, 0, NONE, v16qi)
/* Implemented by aarch64_qtbx4<mode>. */
- VAR1 (TERNOP, qtbx4, 0, ALL, v8qi)
- VAR1 (TERNOP, qtbx4, 0, ALL, v16qi)
+ VAR1 (TERNOP, qtbx4, 0, NONE, v8qi)
+ VAR1 (TERNOP, qtbx4, 0, NONE, v16qi)
/* Builtins for ARMv8.1-A Adv.SIMD instructions. */
@@ -600,60 +607,60 @@
BUILTIN_VHSDF (BINOP, faddp, 0, FP)
/* Implemented by aarch64_cm<optab><mode>. */
- BUILTIN_VHSDF_HSDF (BINOP_USS, cmeq, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, cmge, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, cmgt, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, cmle, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, cmlt, 0, ALL)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, cmeq, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, cmge, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, cmgt, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, cmle, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, cmlt, 0, FP)
/* Implemented by neg<mode>2. */
BUILTIN_VHSDF_HSDF (UNOP, neg, 2, ALL)
/* Implemented by aarch64_fac<optab><mode>. */
- BUILTIN_VHSDF_HSDF (BINOP_USS, faclt, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, facle, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, facgt, 0, ALL)
- BUILTIN_VHSDF_HSDF (BINOP_USS, facge, 0, ALL)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, faclt, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, facle, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, facgt, 0, FP)
+ BUILTIN_VHSDF_HSDF (BINOP_USS, facge, 0, FP)
/* Implemented by sqrt<mode>2. */
VAR1 (UNOP, sqrt, 2, ALL, hf)
/* Implemented by <optab><mode>hf2. */
- VAR1 (UNOP, floatdi, 2, ALL, hf)
- VAR1 (UNOP, floatsi, 2, ALL, hf)
- VAR1 (UNOP, floathi, 2, ALL, hf)
- VAR1 (UNOPUS, floatunsdi, 2, ALL, hf)
- VAR1 (UNOPUS, floatunssi, 2, ALL, hf)
- VAR1 (UNOPUS, floatunshi, 2, ALL, hf)
- BUILTIN_GPI_I16 (UNOP, fix_trunchf, 2, ALL)
- BUILTIN_GPI (UNOP, fix_truncsf, 2, ALL)
- BUILTIN_GPI (UNOP, fix_truncdf, 2, ALL)
- BUILTIN_GPI_I16 (UNOPUS, fixuns_trunchf, 2, ALL)
- BUILTIN_GPI (UNOPUS, fixuns_truncsf, 2, ALL)
- BUILTIN_GPI (UNOPUS, fixuns_truncdf, 2, ALL)
+ VAR1 (UNOP, floatdi, 2, FP, hf)
+ VAR1 (UNOP, floatsi, 2, FP, hf)
+ VAR1 (UNOP, floathi, 2, FP, hf)
+ VAR1 (UNOPUS, floatunsdi, 2, FP, hf)
+ VAR1 (UNOPUS, floatunssi, 2, FP, hf)
+ VAR1 (UNOPUS, floatunshi, 2, FP, hf)
+ BUILTIN_GPI_I16 (UNOP, fix_trunchf, 2, FP)
+ BUILTIN_GPI (UNOP, fix_truncsf, 2, FP)
+ BUILTIN_GPI (UNOP, fix_truncdf, 2, FP)
+ BUILTIN_GPI_I16 (UNOPUS, fixuns_trunchf, 2, FP)
+ BUILTIN_GPI (UNOPUS, fixuns_truncsf, 2, FP)
+ BUILTIN_GPI (UNOPUS, fixuns_truncdf, 2, FP)
/* Implemented by aarch64_sm3ss1qv4si. */
- VAR1 (TERNOPU, sm3ss1q, 0, ALL, v4si)
+ VAR1 (TERNOPU, sm3ss1q, 0, NONE, v4si)
/* Implemented by aarch64_sm3tt<sm3tt_op>qv4si. */
- VAR1 (QUADOPUI, sm3tt1aq, 0, ALL, v4si)
- VAR1 (QUADOPUI, sm3tt1bq, 0, ALL, v4si)
- VAR1 (QUADOPUI, sm3tt2aq, 0, ALL, v4si)
- VAR1 (QUADOPUI, sm3tt2bq, 0, ALL, v4si)
+ VAR1 (QUADOPUI, sm3tt1aq, 0, NONE, v4si)
+ VAR1 (QUADOPUI, sm3tt1bq, 0, NONE, v4si)
+ VAR1 (QUADOPUI, sm3tt2aq, 0, NONE, v4si)
+ VAR1 (QUADOPUI, sm3tt2bq, 0, NONE, v4si)
/* Implemented by aarch64_sm3partw<sm3part_op>qv4si. */
- VAR1 (TERNOPU, sm3partw1q, 0, ALL, v4si)
- VAR1 (TERNOPU, sm3partw2q, 0, ALL, v4si)
+ VAR1 (TERNOPU, sm3partw1q, 0, NONE, v4si)
+ VAR1 (TERNOPU, sm3partw2q, 0, NONE, v4si)
/* Implemented by aarch64_sm4eqv4si. */
- VAR1 (BINOPU, sm4eq, 0, ALL, v4si)
+ VAR1 (BINOPU, sm4eq, 0, NONE, v4si)
/* Implemented by aarch64_sm4ekeyqv4si. */
- VAR1 (BINOPU, sm4ekeyq, 0, ALL, v4si)
+ VAR1 (BINOPU, sm4ekeyq, 0, NONE, v4si)
/* Implemented by aarch64_crypto_sha512hqv2di. */
- VAR1 (TERNOPU, crypto_sha512hq, 0, ALL, v2di)
+ VAR1 (TERNOPU, crypto_sha512hq, 0, NONE, v2di)
/* Implemented by aarch64_sha512h2qv2di. */
- VAR1 (TERNOPU, crypto_sha512h2q, 0, ALL, v2di)
+ VAR1 (TERNOPU, crypto_sha512h2q, 0, NONE, v2di)
/* Implemented by aarch64_crypto_sha512su0qv2di. */
- VAR1 (BINOPU, crypto_sha512su0q, 0, ALL, v2di)
+ VAR1 (BINOPU, crypto_sha512su0q, 0, NONE, v2di)
/* Implemented by aarch64_crypto_sha512su1qv2di. */
- VAR1 (TERNOPU, crypto_sha512su1q, 0, ALL, v2di)
+ VAR1 (TERNOPU, crypto_sha512su1q, 0, NONE, v2di)
/* Implemented by eor3q<mode>4. */
BUILTIN_VQ_I (TERNOPU, eor3q, 4, ALL)
BUILTIN_VQ_I (TERNOP, eor3q, 4, ALL)
@@ -666,15 +673,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)
@@ -701,10 +708,10 @@
VAR1 (QUADOP_LANE, fmlslq_laneq_high, 0, ALL, v4sf)
/* Implemented by aarch64_<frintnzs_op><mode>. */
- BUILTIN_VSFDF (UNOP, frint32z, 0, ALL)
- BUILTIN_VSFDF (UNOP, frint32x, 0, ALL)
- BUILTIN_VSFDF (UNOP, frint64z, 0, ALL)
- BUILTIN_VSFDF (UNOP, frint64x, 0, ALL)
+ BUILTIN_VSFDF (UNOP, frint32z, 0, FP)
+ BUILTIN_VSFDF (UNOP, frint32x, 0, FP)
+ BUILTIN_VSFDF (UNOP, frint64z, 0, FP)
+ BUILTIN_VSFDF (UNOP, frint64x, 0, FP)
/* Implemented by aarch64_bfdot{_lane}{q}<mode>. */
VAR2 (TERNOP, bfdot, 0, ALL, v2sf, v4sf)
@@ -712,23 +719,32 @@
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_vget_lo/hi_halfv8bf. */
+ VAR1 (UNOP, vget_lo_half, 0, AUTO_FP, v8bf)
+ VAR1 (UNOP, vget_hi_half, 0, AUTO_FP, v8bf)
+
/* 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)
- VAR1 (UNOP, bfcvtn_q, 0, ALL, v8bf)
- VAR1 (BINOP, bfcvtn2, 0, ALL, v8bf)
- VAR1 (UNOP, bfcvt, 0, ALL, bf)
+ VAR1 (UNOP, bfcvtn, 0, FP, v4bf)
+ VAR1 (UNOP, bfcvtn_q, 0, FP, v8bf)
+ VAR1 (BINOP, bfcvtn2, 0, FP, v8bf)
+ VAR1 (UNOP, bfcvt, 0, FP, bf)
+
+ /* Implemented by aarch64_{v}bfcvt{_high}<mode>. */
+ VAR2 (UNOP, vbfcvt, 0, AUTO_FP, v4bf, v8bf)
+ VAR1 (UNOP, vbfcvt_high, 0, AUTO_FP, v8bf)
+ VAR1 (UNOP, bfcvt, 0, AUTO_FP, sf)
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 381a702..2cf6fe9 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -4720,6 +4720,17 @@
[(set_attr "type" "neon_sat_shift_imm_narrow_q")]
)
+(define_insn "aarch64_<sur>q<r>shr<u>n2_n<mode>"
+ [(set (match_operand:<VNARROWQ2> 0 "register_operand" "=w")
+ (unspec:<VNARROWQ2> [(match_operand:<VNARROWQ> 1 "register_operand" "0")
+ (match_operand:VQN 2 "register_operand" "w")
+ (match_operand:SI 3 "aarch64_simd_shift_imm_offset_<ve_mode>" "i")]
+ VQSHRN_N))]
+ "TARGET_SIMD"
+ "<sur>q<r>shr<u>n2\\t%<vn2>0.<V2ntype>, %<v>2.<Vtype>, %3"
+ [(set_attr "type" "neon_sat_shift_imm_narrow_q")]
+)
+
;; cm(eq|ge|gt|lt|le)
;; Note, we have constraints for Dz and Z as different expanders
@@ -7159,6 +7170,27 @@
[(set_attr "type" "neon_dot<VDQSF:q>")]
)
+;; vget_low/high_bf16
+(define_expand "aarch64_vget_lo_halfv8bf"
+ [(match_operand:V4BF 0 "register_operand")
+ (match_operand:V8BF 1 "register_operand")]
+ "TARGET_BF16_SIMD"
+{
+ rtx p = aarch64_simd_vect_par_cnst_half (V8BFmode, 8, false);
+ emit_insn (gen_aarch64_get_halfv8bf (operands[0], operands[1], p));
+ DONE;
+})
+
+(define_expand "aarch64_vget_hi_halfv8bf"
+ [(match_operand:V4BF 0 "register_operand")
+ (match_operand:V8BF 1 "register_operand")]
+ "TARGET_BF16_SIMD"
+{
+ rtx p = aarch64_simd_vect_par_cnst_half (V8BFmode, 8, true);
+ emit_insn (gen_aarch64_get_halfv8bf (operands[0], operands[1], p));
+ DONE;
+})
+
;; bfmmla
(define_insn "aarch64_bfmmlaqv4sf"
[(set (match_operand:V4SF 0 "register_operand" "=w")
@@ -7238,3 +7270,31 @@
"bfcvt\\t%h0, %s1"
[(set_attr "type" "f_cvt")]
)
+
+;; Use shl/shll/shll2 to convert BF scalar/vector modes to SF modes.
+(define_insn "aarch64_vbfcvt<mode>"
+ [(set (match_operand:V4SF 0 "register_operand" "=w")
+ (unspec:V4SF [(match_operand:VBF 1 "register_operand" "w")]
+ UNSPEC_BFCVTN))]
+ "TARGET_BF16_SIMD"
+ "shll\\t%0.4s, %1.4h, #16"
+ [(set_attr "type" "neon_shift_imm_long")]
+)
+
+(define_insn "aarch64_vbfcvt_highv8bf"
+ [(set (match_operand:V4SF 0 "register_operand" "=w")
+ (unspec:V4SF [(match_operand:V8BF 1 "register_operand" "w")]
+ UNSPEC_BFCVTN2))]
+ "TARGET_BF16_SIMD"
+ "shll2\\t%0.4s, %1.8h, #16"
+ [(set_attr "type" "neon_shift_imm_long")]
+)
+
+(define_insn "aarch64_bfcvtsf"
+ [(set (match_operand:SF 0 "register_operand" "=w")
+ (unspec:SF [(match_operand:BF 1 "register_operand" "w")]
+ UNSPEC_BFCVT))]
+ "TARGET_BF16_FP"
+ "shl\\t%d0, %d1, #16"
+ [(set_attr "type" "neon_shift_imm")]
+)
diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md
index 31a8c5a..4b0a1eb 100644
--- a/gcc/config/aarch64/aarch64-sve.md
+++ b/gcc/config/aarch64/aarch64-sve.md
@@ -3009,6 +3009,22 @@
"<sve_int_op>\t%0.<Vetype>, %1/m, %2.<Vetype>"
)
+;; Another way of expressing the REVB, REVH and REVW patterns, with this
+;; form being easier for permutes. The predicate mode determines the number
+;; of lanes and the data mode decides the granularity of the reversal within
+;; each lane.
+(define_insn "@aarch64_sve_revbhw_<SVE_ALL:mode><PRED_HSD:mode>"
+ [(set (match_operand:SVE_ALL 0 "register_operand" "=w")
+ (unspec:SVE_ALL
+ [(match_operand:PRED_HSD 1 "register_operand" "Upl")
+ (unspec:SVE_ALL
+ [(match_operand:SVE_ALL 2 "register_operand" "w")]
+ UNSPEC_REVBHW)]
+ UNSPEC_PRED_X))]
+ "TARGET_SVE && <PRED_HSD:elem_bits> > <SVE_ALL:container_bits>"
+ "rev<SVE_ALL:Vcwtype>\t%0.<PRED_HSD:Vetype>, %1/m, %2.<PRED_HSD:Vetype>"
+)
+
;; Predicated integer unary operations with merging.
(define_insn "@cond_<optab><mode>"
[(set (match_operand:SVE_FULL_I 0 "register_operand" "=w, ?&w, ?&w")
@@ -8273,14 +8289,14 @@
;; Duplicate one element of a vector.
(define_insn "@aarch64_sve_dup_lane<mode>"
- [(set (match_operand:SVE_FULL 0 "register_operand" "=w")
- (vec_duplicate:SVE_FULL
+ [(set (match_operand:SVE_ALL 0 "register_operand" "=w")
+ (vec_duplicate:SVE_ALL
(vec_select:<VEL>
- (match_operand:SVE_FULL 1 "register_operand" "w")
+ (match_operand:SVE_ALL 1 "register_operand" "w")
(parallel [(match_operand:SI 2 "const_int_operand")]))))]
"TARGET_SVE
- && IN_RANGE (INTVAL (operands[2]) * GET_MODE_SIZE (<VEL>mode), 0, 63)"
- "dup\t%0.<Vetype>, %1.<Vetype>[%2]"
+ && IN_RANGE (INTVAL (operands[2]) * <container_bits> / 8, 0, 63)"
+ "dup\t%0.<Vctype>, %1.<Vctype>[%2]"
)
;; Use DUP.Q to duplicate a 128-bit segment of a register.
@@ -8321,17 +8337,18 @@
;; Reverse the order of elements within a full vector.
(define_insn "@aarch64_sve_rev<mode>"
- [(set (match_operand:SVE_FULL 0 "register_operand" "=w")
- (unspec:SVE_FULL
- [(match_operand:SVE_FULL 1 "register_operand" "w")]
+ [(set (match_operand:SVE_ALL 0 "register_operand" "=w")
+ (unspec:SVE_ALL
+ [(match_operand:SVE_ALL 1 "register_operand" "w")]
UNSPEC_REV))]
"TARGET_SVE"
- "rev\t%0.<Vetype>, %1.<Vetype>")
+ "rev\t%0.<Vctype>, %1.<Vctype>")
;; -------------------------------------------------------------------------
;; ---- [INT,FP] Special-purpose binary permutes
;; -------------------------------------------------------------------------
;; Includes:
+;; - EXT
;; - SPLICE
;; - TRN1
;; - TRN2
@@ -8359,13 +8376,13 @@
;; Permutes that take half the elements from one vector and half the
;; elements from the other.
(define_insn "@aarch64_sve_<perm_insn><mode>"
- [(set (match_operand:SVE_FULL 0 "register_operand" "=w")
- (unspec:SVE_FULL
- [(match_operand:SVE_FULL 1 "register_operand" "w")
- (match_operand:SVE_FULL 2 "register_operand" "w")]
+ [(set (match_operand:SVE_ALL 0 "register_operand" "=w")
+ (unspec:SVE_ALL
+ [(match_operand:SVE_ALL 1 "register_operand" "w")
+ (match_operand:SVE_ALL 2 "register_operand" "w")]
PERMUTE))]
"TARGET_SVE"
- "<perm_insn>\t%0.<Vetype>, %1.<Vetype>, %2.<Vetype>"
+ "<perm_insn>\t%0.<Vctype>, %1.<Vctype>, %2.<Vctype>"
)
;; Apply PERMUTE to 128-bit sequences. The behavior of these patterns
@@ -8383,16 +8400,16 @@
;; Concatenate two vectors and extract a subvector. Note that the
;; immediate (third) operand is the lane index not the byte index.
(define_insn "@aarch64_sve_ext<mode>"
- [(set (match_operand:SVE_FULL 0 "register_operand" "=w, ?&w")
- (unspec:SVE_FULL
- [(match_operand:SVE_FULL 1 "register_operand" "0, w")
- (match_operand:SVE_FULL 2 "register_operand" "w, w")
+ [(set (match_operand:SVE_ALL 0 "register_operand" "=w, ?&w")
+ (unspec:SVE_ALL
+ [(match_operand:SVE_ALL 1 "register_operand" "0, w")
+ (match_operand:SVE_ALL 2 "register_operand" "w, w")
(match_operand:SI 3 "const_int_operand")]
UNSPEC_EXT))]
"TARGET_SVE
- && IN_RANGE (INTVAL (operands[3]) * GET_MODE_SIZE (<VEL>mode), 0, 255)"
+ && IN_RANGE (INTVAL (operands[3]) * <container_bits> / 8, 0, 255)"
{
- operands[3] = GEN_INT (INTVAL (operands[3]) * GET_MODE_SIZE (<VEL>mode));
+ operands[3] = GEN_INT (INTVAL (operands[3]) * <container_bits> / 8);
return (which_alternative == 0
? "ext\\t%0.b, %0.b, %2.b, #%3"
: "movprfx\t%0, %1\;ext\\t%0.b, %0.b, %2.b, #%3");
diff --git a/gcc/config/aarch64/aarch64-vxworks.h b/gcc/config/aarch64/aarch64-vxworks.h
index e22f2f5..9e172c1 100644
--- a/gcc/config/aarch64/aarch64-vxworks.h
+++ b/gcc/config/aarch64/aarch64-vxworks.h
@@ -60,12 +60,14 @@ along with GCC; see the file COPYING3. If not see
#undef STACK_CHECK_PROTECT
#define STACK_CHECK_PROTECT 16384
-/* The VxWorks environment on aarch64 is llvm-based only, uses R18 as
- a TCB pointer. */
-
+/* The VxWorks environment on aarch64 is llvm-based. */
#undef VXWORKS_PERSONALITY
#define VXWORKS_PERSONALITY "llvm"
-#undef TARGET_OS_USES_R18
-#define TARGET_OS_USES_R18 1
+/* VxWorks uses R18 as a TCB pointer. We must pick something else as
+ the static chain and R18 needs to be claimed "fixed". Until we
+ arrange to override the common parts of the port family to
+ acknowledge the latter, configure --with-specs="-ffixed-r18". */
+#undef STATIC_CHAIN_REGNUM
+#define STATIC_CHAIN_REGNUM 9
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 3cf20ea..97cb689 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1362,6 +1362,32 @@ static const struct tune_params neoversev1_tunings =
&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,
@@ -2200,6 +2226,9 @@ aarch64_classify_vector_mode (machine_mode mode)
/* Partial SVE HF vectors. */
case E_VNx2HFmode:
case E_VNx4HFmode:
+ /* Partial SVE BF vectors. */
+ case E_VNx2BFmode:
+ case E_VNx4BFmode:
/* Partial SVE SF vector. */
case E_VNx2SFmode:
return TARGET_SVE ? VEC_SVE_DATA | VEC_PARTIAL : 0;
@@ -2860,33 +2889,6 @@ aarch64_is_noplt_call_p (rtx sym)
return false;
}
-/* Return true if the offsets to a zero/sign-extract operation
- represent an expression that matches an extend operation. The
- operands represent the parameters from
-
- (extract:MODE (mult (reg) (MULT_IMM)) (EXTRACT_IMM) (const_int 0)). */
-bool
-aarch64_is_extend_from_extract (scalar_int_mode mode, rtx mult_imm,
- rtx extract_imm)
-{
- HOST_WIDE_INT mult_val, extract_val;
-
- if (! CONST_INT_P (mult_imm) || ! CONST_INT_P (extract_imm))
- return false;
-
- mult_val = INTVAL (mult_imm);
- extract_val = INTVAL (extract_imm);
-
- if (extract_val > 8
- && extract_val < GET_MODE_BITSIZE (mode)
- && exact_log2 (extract_val & ~7) > 0
- && (extract_val & 7) <= 4
- && mult_val == (1 << (extract_val & 7)))
- return true;
-
- return false;
-}
-
/* Emit an insn that's a simple single-set. Both the operands must be
known to be valid. */
inline static rtx_insn *
@@ -6273,10 +6275,6 @@ aarch64_libgcc_cmp_return_mode (void)
#error Cannot use simple address calculation for stack probing
#endif
-/* The pair of scratch registers used for stack probing. */
-#define PROBE_STACK_FIRST_REG R9_REGNUM
-#define PROBE_STACK_SECOND_REG R10_REGNUM
-
/* Emit code to probe a range of stack addresses from FIRST to FIRST+POLY_SIZE,
inclusive. These are offsets from the current stack pointer. */
@@ -6290,7 +6288,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, poly_int64 poly_size)
return;
}
- rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REG);
+ rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REGNUM);
/* See the same assertion on PROBE_INTERVAL above. */
gcc_assert ((first % ARITH_FACTOR) == 0);
@@ -6348,7 +6346,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, poly_int64 poly_size)
equality test for the loop condition. */
else
{
- rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REG);
+ rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REGNUM);
/* Step 1: round SIZE to the previous multiple of the interval. */
@@ -8910,22 +8908,6 @@ aarch64_classify_index (struct aarch64_address_info *info, rtx x,
index = XEXP (XEXP (x, 0), 0);
shift = INTVAL (XEXP (x, 1));
}
- /* (sign_extract:DI (mult:DI (reg:DI) (const_int scale)) 32+shift 0) */
- else if ((GET_CODE (x) == SIGN_EXTRACT
- || GET_CODE (x) == ZERO_EXTRACT)
- && GET_MODE (x) == DImode
- && GET_CODE (XEXP (x, 0)) == MULT
- && GET_MODE (XEXP (XEXP (x, 0), 0)) == DImode
- && CONST_INT_P (XEXP (XEXP (x, 0), 1)))
- {
- type = (GET_CODE (x) == SIGN_EXTRACT)
- ? ADDRESS_REG_SXTW : ADDRESS_REG_UXTW;
- index = XEXP (XEXP (x, 0), 0);
- shift = exact_log2 (INTVAL (XEXP (XEXP (x, 0), 1)));
- if (INTVAL (XEXP (x, 1)) != 32 + shift
- || INTVAL (XEXP (x, 2)) != 0)
- shift = -1;
- }
/* (and:DI (mult:DI (reg:DI) (const_int scale))
(const_int 0xffffffff<<shift)) */
else if (GET_CODE (x) == AND
@@ -8941,22 +8923,6 @@ aarch64_classify_index (struct aarch64_address_info *info, rtx x,
if (INTVAL (XEXP (x, 1)) != (HOST_WIDE_INT)0xffffffff << shift)
shift = -1;
}
- /* (sign_extract:DI (ashift:DI (reg:DI) (const_int shift)) 32+shift 0) */
- else if ((GET_CODE (x) == SIGN_EXTRACT
- || GET_CODE (x) == ZERO_EXTRACT)
- && GET_MODE (x) == DImode
- && GET_CODE (XEXP (x, 0)) == ASHIFT
- && GET_MODE (XEXP (XEXP (x, 0), 0)) == DImode
- && CONST_INT_P (XEXP (XEXP (x, 0), 1)))
- {
- type = (GET_CODE (x) == SIGN_EXTRACT)
- ? ADDRESS_REG_SXTW : ADDRESS_REG_UXTW;
- index = XEXP (XEXP (x, 0), 0);
- shift = INTVAL (XEXP (XEXP (x, 0), 1));
- if (INTVAL (XEXP (x, 1)) != 32 + shift
- || INTVAL (XEXP (x, 2)) != 0)
- shift = -1;
- }
/* (and:DI (ashift:DI (reg:DI) (const_int shift))
(const_int 0xffffffff<<shift)) */
else if (GET_CODE (x) == AND
@@ -11334,16 +11300,6 @@ aarch64_strip_extend (rtx x, bool strip_shift)
if (!is_a <scalar_int_mode> (GET_MODE (op), &mode))
return op;
- /* Zero and sign extraction of a widened value. */
- if ((GET_CODE (op) == ZERO_EXTRACT || GET_CODE (op) == SIGN_EXTRACT)
- && XEXP (op, 2) == const0_rtx
- && GET_CODE (XEXP (op, 0)) == MULT
- && aarch64_is_extend_from_extract (mode, XEXP (XEXP (op, 0), 1),
- XEXP (op, 1)))
- return XEXP (XEXP (op, 0), 0);
-
- /* It can also be represented (for zero-extend) as an AND with an
- immediate. */
if (GET_CODE (op) == AND
&& GET_CODE (XEXP (op, 0)) == MULT
&& CONST_INT_P (XEXP (XEXP (op, 0), 1))
@@ -11678,35 +11634,15 @@ aarch64_branch_cost (bool speed_p, bool predictable_p)
return branch_costs->unpredictable;
}
-/* Return true if the RTX X in mode MODE is a zero or sign extract
+/* Return true if X is a zero or sign extract
usable in an ADD or SUB (extended register) instruction. */
static bool
-aarch64_rtx_arith_op_extract_p (rtx x, scalar_int_mode mode)
-{
- /* Catch add with a sign extract.
- This is add_<optab><mode>_multp2. */
- if (GET_CODE (x) == SIGN_EXTRACT
- || GET_CODE (x) == ZERO_EXTRACT)
- {
- rtx op0 = XEXP (x, 0);
- rtx op1 = XEXP (x, 1);
- rtx op2 = XEXP (x, 2);
-
- if (GET_CODE (op0) == MULT
- && CONST_INT_P (op1)
- && op2 == const0_rtx
- && CONST_INT_P (XEXP (op0, 1))
- && aarch64_is_extend_from_extract (mode,
- XEXP (op0, 1),
- op1))
- {
- return true;
- }
- }
+aarch64_rtx_arith_op_extract_p (rtx x)
+{
/* The simple case <ARITH>, XD, XN, XM, [us]xt.
No shift. */
- else if (GET_CODE (x) == SIGN_EXTEND
- || GET_CODE (x) == ZERO_EXTEND)
+ if (GET_CODE (x) == SIGN_EXTEND
+ || GET_CODE (x) == ZERO_EXTEND)
return REG_P (XEXP (x, 0));
return false;
@@ -12393,8 +12329,8 @@ cost_minus:
}
/* Look for SUB (extended register). */
- if (is_a <scalar_int_mode> (mode, &int_mode)
- && aarch64_rtx_arith_op_extract_p (op1, int_mode))
+ if (is_a <scalar_int_mode> (mode)
+ && aarch64_rtx_arith_op_extract_p (op1))
{
if (speed)
*cost += extra_cost->alu.extend_arith;
@@ -12473,8 +12409,8 @@ cost_plus:
*cost += rtx_cost (op1, mode, PLUS, 1, speed);
/* Look for ADD (extended register). */
- if (is_a <scalar_int_mode> (mode, &int_mode)
- && aarch64_rtx_arith_op_extract_p (op0, int_mode))
+ if (is_a <scalar_int_mode> (mode)
+ && aarch64_rtx_arith_op_extract_p (op0))
{
if (speed)
*cost += extra_cost->alu.extend_arith;
@@ -20535,18 +20471,21 @@ aarch64_evpc_rev_local (struct expand_vec_perm_d *d)
|| !diff)
return false;
- size = (diff + 1) * GET_MODE_UNIT_SIZE (d->vmode);
- if (size == 8)
+ if (d->vec_flags & VEC_SVE_DATA)
+ size = (diff + 1) * aarch64_sve_container_bits (d->vmode);
+ else
+ size = (diff + 1) * GET_MODE_UNIT_BITSIZE (d->vmode);
+ if (size == 64)
{
unspec = UNSPEC_REV64;
pred_mode = VNx2BImode;
}
- else if (size == 4)
+ else if (size == 32)
{
unspec = UNSPEC_REV32;
pred_mode = VNx4BImode;
}
- else if (size == 2)
+ else if (size == 16)
{
unspec = UNSPEC_REV16;
pred_mode = VNx8BImode;
@@ -20563,28 +20502,11 @@ aarch64_evpc_rev_local (struct expand_vec_perm_d *d)
if (d->testing_p)
return true;
- if (d->vec_flags == VEC_SVE_DATA)
- {
- machine_mode int_mode = aarch64_sve_int_mode (pred_mode);
- rtx target = gen_reg_rtx (int_mode);
- if (BYTES_BIG_ENDIAN)
- /* The act of taking a subreg between INT_MODE and d->vmode
- is itself a reversing operation on big-endian targets;
- see the comment at the head of aarch64-sve.md for details.
- First reinterpret OP0 as INT_MODE without using a subreg
- and without changing the contents. */
- emit_insn (gen_aarch64_sve_reinterpret (int_mode, target, d->op0));
- else
- {
- /* For SVE we use REV[BHW] unspecs derived from the element size
- of v->mode and vector modes whose elements have SIZE bytes.
- This ensures that the vector modes match the predicate modes. */
- int unspec = aarch64_sve_rev_unspec (d->vmode);
- rtx pred = aarch64_ptrue_reg (pred_mode);
- emit_insn (gen_aarch64_pred (unspec, int_mode, target, pred,
- gen_lowpart (int_mode, d->op0)));
- }
- emit_move_insn (d->target, gen_lowpart (d->vmode, target));
+ if (d->vec_flags & VEC_SVE_DATA)
+ {
+ rtx pred = aarch64_ptrue_reg (pred_mode);
+ emit_insn (gen_aarch64_sve_revbhw (d->vmode, pred_mode,
+ d->target, pred, d->op0));
return true;
}
rtx src = gen_rtx_UNSPEC (d->vmode, gen_rtvec (1, d->op0), unspec);
@@ -20629,7 +20551,8 @@ aarch64_evpc_dup (struct expand_vec_perm_d *d)
|| !d->perm[0].is_constant (&elt))
return false;
- if (d->vec_flags == VEC_SVE_DATA && elt >= 64 * GET_MODE_UNIT_SIZE (vmode))
+ if ((d->vec_flags & VEC_SVE_DATA)
+ && elt * (aarch64_sve_container_bits (vmode) / 8) >= 64)
return false;
/* Success! */
@@ -20849,6 +20772,7 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d)
if ((d->vec_flags == VEC_ADVSIMD
|| d->vec_flags == VEC_SVE_DATA
+ || d->vec_flags == (VEC_SVE_DATA | VEC_PARTIAL)
|| d->vec_flags == VEC_SVE_PRED)
&& known_gt (nelt, 1))
{
@@ -21273,6 +21197,8 @@ aarch64_copy_one_block_and_progress_pointers (rtx *src, rtx *dst,
bool
aarch64_expand_cpymem (rtx *operands)
{
+ /* These need to be signed as we need to perform arithmetic on n as
+ signed operations. */
int n, mode_bits;
rtx dst = operands[0];
rtx src = operands[1];
@@ -21283,21 +21209,24 @@ aarch64_expand_cpymem (rtx *operands)
/* When optimizing for size, give a better estimate of the length of a
memcpy call, but use the default otherwise. Moves larger than 8 bytes
will always require an even number of instructions to do now. And each
- operation requires both a load+store, so devide the max number by 2. */
- int max_num_moves = (speed_p ? 16 : AARCH64_CALL_RATIO) / 2;
+ operation requires both a load+store, so divide the max number by 2. */
+ unsigned int max_num_moves = (speed_p ? 16 : AARCH64_CALL_RATIO) / 2;
/* We can't do anything smart if the amount to copy is not constant. */
if (!CONST_INT_P (operands[2]))
return false;
- n = INTVAL (operands[2]);
+ unsigned HOST_WIDE_INT tmp = INTVAL (operands[2]);
/* Try to keep the number of instructions low. For all cases we will do at
most two moves for the residual amount, since we'll always overlap the
remainder. */
- if (((n / 16) + (n % 16 ? 2 : 0)) > max_num_moves)
+ if (((tmp / 16) + (tmp % 16 ? 2 : 0)) > max_num_moves)
return false;
+ /* At this point tmp is known to have to fit inside an int. */
+ n = tmp;
+
base = copy_to_mode_reg (Pmode, XEXP (dst, 0));
dst = adjust_automodify_address (dst, VOIDmode, base, 0);
@@ -23018,18 +22947,23 @@ aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
tree base_type, int num)
{
tree t, ret_type, arg_type;
- unsigned int elt_bits, vec_bits, count;
+ unsigned int elt_bits, count;
+ unsigned HOST_WIDE_INT const_simdlen;
+ poly_uint64 vec_bits;
if (!TARGET_SIMD)
return 0;
- if (clonei->simdlen
- && (clonei->simdlen < 2
- || clonei->simdlen > 1024
- || (clonei->simdlen & (clonei->simdlen - 1)) != 0))
+ /* For now, SVE simdclones won't produce illegal simdlen, So only check
+ const simdlens here. */
+ if (maybe_ne (clonei->simdlen, 0U)
+ && clonei->simdlen.is_constant (&const_simdlen)
+ && (const_simdlen < 2
+ || const_simdlen > 1024
+ || (const_simdlen & (const_simdlen - 1)) != 0))
{
warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
- "unsupported simdlen %d", clonei->simdlen);
+ "unsupported simdlen %wd", const_simdlen);
return 0;
}
@@ -23073,21 +23007,24 @@ aarch64_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
clonei->vecsize_mangle = 'n';
clonei->mask_mode = VOIDmode;
elt_bits = GET_MODE_BITSIZE (SCALAR_TYPE_MODE (base_type));
- if (clonei->simdlen == 0)
+ if (known_eq (clonei->simdlen, 0U))
{
count = 2;
vec_bits = (num == 0 ? 64 : 128);
- clonei->simdlen = vec_bits / elt_bits;
+ clonei->simdlen = exact_div (vec_bits, elt_bits);
}
else
{
count = 1;
vec_bits = clonei->simdlen * elt_bits;
- if (vec_bits != 64 && vec_bits != 128)
+ /* For now, SVE simdclones won't produce illegal simdlen, So only check
+ const simdlens here. */
+ if (clonei->simdlen.is_constant (&const_simdlen)
+ && maybe_ne (vec_bits, 64U) && maybe_ne (vec_bits, 128U))
{
warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
- "GCC does not currently support simdlen %d for type %qT",
- clonei->simdlen, base_type);
+ "GCC does not currently support simdlen %wd for type %qT",
+ const_simdlen, base_type);
return 0;
}
}
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 78fe7c43..11e0f46 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -111,6 +111,13 @@
;; "FFR token": a fake register used for representing the scheduling
;; restrictions on FFR-related operations.
(FFRT_REGNUM 85)
+ ;; The pair of scratch registers used for stack probing with -fstack-check.
+ ;; Leave R9 alone as a possible choice for the static chain.
+ ;; Note that the use of these registers is mutually exclusive with the use
+ ;; of STACK_CLASH_SVE_CFA_REGNUM, which is for -fstack-clash-protection
+ ;; rather than -fstack-check.
+ (PROBE_STACK_FIRST_REGNUM 10)
+ (PROBE_STACK_SECOND_REGNUM 11)
;; Scratch register used by stack clash protection to calculate
;; SVE CFA offsets during probing.
(STACK_CLASH_SVE_CFA_REGNUM 11)
diff --git a/gcc/config/aarch64/arm_bf16.h b/gcc/config/aarch64/arm_bf16.h
index 984875d..8816154 100644
--- a/gcc/config/aarch64/arm_bf16.h
+++ b/gcc/config/aarch64/arm_bf16.h
@@ -40,6 +40,13 @@ vcvth_bf16_f32 (float32_t __a)
return __builtin_aarch64_bfcvtbf (__a);
}
+__extension__ extern __inline float32_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcvtah_f32_bf16 (bfloat16_t __a)
+{
+ return __builtin_aarch64_bfcvtsf (__a);
+}
+
#pragma GCC pop_options
#endif
diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 85c0d62..d79c1a2 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -9993,275 +9993,131 @@ vqrdmulhq_n_s32 (int32x4_t __a, int32_t __b)
return __result;
}
-#define vqrshrn_high_n_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x8_t b_ = (b); \
- int8x8_t a_ = (a); \
- int8x16_t result = vcombine_s8 \
- (a_, vcreate_s8 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqrshrn2 %0.16b, %1.8h, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrn_high_n_s16 (int8x8_t __a, int16x8_t __b, const int __c)
+{
+ return __builtin_aarch64_sqrshrn2_nv8hi (__a, __b, __c);
+}
-#define vqrshrn_high_n_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x4_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x8_t result = vcombine_s16 \
- (a_, vcreate_s16 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqrshrn2 %0.8h, %1.4s, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrn_high_n_s32 (int16x4_t __a, int32x4_t __b, const int __c)
+{
+ return __builtin_aarch64_sqrshrn2_nv4si (__a, __b, __c);
+}
-#define vqrshrn_high_n_s64(a, b, c) \
- __extension__ \
- ({ \
- int64x2_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x4_t result = vcombine_s32 \
- (a_, vcreate_s32 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqrshrn2 %0.4s, %1.2d, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrn_high_n_s64 (int32x2_t __a, int64x2_t __b, const int __c)
+{
+ return __builtin_aarch64_sqrshrn2_nv2di (__a, __b, __c);
+}
-#define vqrshrn_high_n_u16(a, b, c) \
- __extension__ \
- ({ \
- uint16x8_t b_ = (b); \
- uint8x8_t a_ = (a); \
- uint8x16_t result = vcombine_u8 \
- (a_, vcreate_u8 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("uqrshrn2 %0.16b, %1.8h, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrn_high_n_u16 (uint8x8_t __a, uint16x8_t __b, const int __c)
+{
+ return __builtin_aarch64_uqrshrn2_nv8hi_uuus (__a, __b, __c);
+}
-#define vqrshrn_high_n_u32(a, b, c) \
- __extension__ \
- ({ \
- uint32x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x8_t result = vcombine_u16 \
- (a_, vcreate_u16 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("uqrshrn2 %0.8h, %1.4s, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrn_high_n_u32 (uint16x4_t __a, uint32x4_t __b, const int __c)
+{
+ return __builtin_aarch64_uqrshrn2_nv4si_uuus (__a, __b, __c);
+}
-#define vqrshrn_high_n_u64(a, b, c) \
- __extension__ \
- ({ \
- uint64x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x4_t result = vcombine_u32 \
- (a_, vcreate_u32 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("uqrshrn2 %0.4s, %1.2d, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrn_high_n_u64 (uint32x2_t __a, uint64x2_t __b, const int __c)
+{
+ return __builtin_aarch64_uqrshrn2_nv2di_uuus (__a, __b, __c);
+}
-#define vqrshrun_high_n_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x8_t b_ = (b); \
- uint8x8_t a_ = (a); \
- uint8x16_t result = vcombine_u8 \
- (a_, vcreate_u8 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqrshrun2 %0.16b, %1.8h, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrun_high_n_s16 (uint8x8_t __a, int16x8_t __b, const int __c)
+{
+ return __builtin_aarch64_sqrshrun2_nv8hi_uuss (__a, __b, __c);
+}
-#define vqrshrun_high_n_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x8_t result = vcombine_u16 \
- (a_, vcreate_u16 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqrshrun2 %0.8h, %1.4s, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrun_high_n_s32 (uint16x4_t __a, int32x4_t __b, const int __c)
+{
+ return __builtin_aarch64_sqrshrun2_nv4si_uuss (__a, __b, __c);
+}
-#define vqrshrun_high_n_s64(a, b, c) \
- __extension__ \
- ({ \
- int64x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x4_t result = vcombine_u32 \
- (a_, vcreate_u32 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqrshrun2 %0.4s, %1.2d, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqrshrun_high_n_s64 (uint32x2_t __a, int64x2_t __b, const int __c)
+{
+ return __builtin_aarch64_sqrshrun2_nv2di_uuss (__a, __b, __c);
+}
-#define vqshrn_high_n_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x8_t b_ = (b); \
- int8x8_t a_ = (a); \
- int8x16_t result = vcombine_s8 \
- (a_, vcreate_s8 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqshrn2 %0.16b, %1.8h, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline int8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrn_high_n_s16 (int8x8_t __a, int16x8_t __b, const int __c)
+{
+ return __builtin_aarch64_sqshrn2_nv8hi (__a, __b, __c);
+}
-#define vqshrn_high_n_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x4_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x8_t result = vcombine_s16 \
- (a_, vcreate_s16 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqshrn2 %0.8h, %1.4s, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline int16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrn_high_n_s32 (int16x4_t __a, int32x4_t __b, const int __c)
+{
+ return __builtin_aarch64_sqshrn2_nv4si (__a, __b, __c);
+}
-#define vqshrn_high_n_s64(a, b, c) \
- __extension__ \
- ({ \
- int64x2_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x4_t result = vcombine_s32 \
- (a_, vcreate_s32 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqshrn2 %0.4s, %1.2d, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline int32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrn_high_n_s64 (int32x2_t __a, int64x2_t __b, const int __c)
+{
+ return __builtin_aarch64_sqshrn2_nv2di (__a, __b, __c);
+}
-#define vqshrn_high_n_u16(a, b, c) \
- __extension__ \
- ({ \
- uint16x8_t b_ = (b); \
- uint8x8_t a_ = (a); \
- uint8x16_t result = vcombine_u8 \
- (a_, vcreate_u8 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("uqshrn2 %0.16b, %1.8h, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrn_high_n_u16 (uint8x8_t __a, uint16x8_t __b, const int __c)
+{
+ return __builtin_aarch64_uqshrn2_nv8hi_uuus (__a, __b, __c);
+}
-#define vqshrn_high_n_u32(a, b, c) \
- __extension__ \
- ({ \
- uint32x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x8_t result = vcombine_u16 \
- (a_, vcreate_u16 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("uqshrn2 %0.8h, %1.4s, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrn_high_n_u32 (uint16x4_t __a, uint32x4_t __b, const int __c)
+{
+ return __builtin_aarch64_uqshrn2_nv4si_uuus (__a, __b, __c);
+}
-#define vqshrn_high_n_u64(a, b, c) \
- __extension__ \
- ({ \
- uint64x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x4_t result = vcombine_u32 \
- (a_, vcreate_u32 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("uqshrn2 %0.4s, %1.2d, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrn_high_n_u64 (uint32x2_t __a, uint64x2_t __b, const int __c)
+{
+ return __builtin_aarch64_uqshrn2_nv2di_uuus (__a, __b, __c);
+}
-#define vqshrun_high_n_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x8_t b_ = (b); \
- uint8x8_t a_ = (a); \
- uint8x16_t result = vcombine_u8 \
- (a_, vcreate_u8 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqshrun2 %0.16b, %1.8h, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint8x16_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrun_high_n_s16 (uint8x8_t __a, int16x8_t __b, const int __c)
+{
+ return __builtin_aarch64_sqshrun2_nv8hi_uuss (__a, __b, __c);
+}
-#define vqshrun_high_n_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x8_t result = vcombine_u16 \
- (a_, vcreate_u16 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqshrun2 %0.8h, %1.4s, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrun_high_n_s32 (uint16x4_t __a, int32x4_t __b, const int __c)
+{
+ return __builtin_aarch64_sqshrun2_nv4si_uuss (__a, __b, __c);
+}
-#define vqshrun_high_n_s64(a, b, c) \
- __extension__ \
- ({ \
- int64x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x4_t result = vcombine_u32 \
- (a_, vcreate_u32 \
- (__AARCH64_UINT64_C (0x0))); \
- __asm__ ("sqshrun2 %0.4s, %1.2d, #%2" \
- : "+w"(result) \
- : "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
+__extension__ extern __inline uint32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vqshrun_high_n_s64 (uint32x2_t __a, int64x2_t __b, const int __c)
+{
+ return __builtin_aarch64_sqshrun2_nv2di_uuss (__a, __b, __c);
+}
#define vrshrn_high_n_s16(a, b, c) \
__extension__ \
@@ -10926,8 +10782,7 @@ __ST2_LANE_FUNC (uint32x2x2_t, uint32x4x2_t, uint32_t, v2si, v4si, si, u32,
__ST2_LANE_FUNC (uint64x1x2_t, uint64x2x2_t, uint64_t, di, v2di, di, u64,
int64x2_t)
-#undef __ST2_LANE_FUNC
-#define __ST2_LANE_FUNC(intype, ptrtype, mode, ptr_mode, funcsuffix) \
+#define __ST2Q_LANE_FUNC(intype, ptrtype, mode, ptr_mode, funcsuffix) \
__extension__ extern __inline void \
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) \
vst2q_lane_ ## funcsuffix (ptrtype *__ptr, \
@@ -10939,20 +10794,20 @@ vst2q_lane_ ## funcsuffix (ptrtype *__ptr, \
__ptr, __temp.__o, __c); \
}
-__ST2_LANE_FUNC (float16x8x2_t, float16_t, v8hf, hf, f16)
-__ST2_LANE_FUNC (float32x4x2_t, float32_t, v4sf, sf, f32)
-__ST2_LANE_FUNC (float64x2x2_t, float64_t, v2df, df, f64)
-__ST2_LANE_FUNC (poly8x16x2_t, poly8_t, v16qi, qi, p8)
-__ST2_LANE_FUNC (poly16x8x2_t, poly16_t, v8hi, hi, p16)
-__ST2_LANE_FUNC (poly64x2x2_t, poly64_t, v2di, di, p64)
-__ST2_LANE_FUNC (int8x16x2_t, int8_t, v16qi, qi, s8)
-__ST2_LANE_FUNC (int16x8x2_t, int16_t, v8hi, hi, s16)
-__ST2_LANE_FUNC (int32x4x2_t, int32_t, v4si, si, s32)
-__ST2_LANE_FUNC (int64x2x2_t, int64_t, v2di, di, s64)
-__ST2_LANE_FUNC (uint8x16x2_t, uint8_t, v16qi, qi, u8)
-__ST2_LANE_FUNC (uint16x8x2_t, uint16_t, v8hi, hi, u16)
-__ST2_LANE_FUNC (uint32x4x2_t, uint32_t, v4si, si, u32)
-__ST2_LANE_FUNC (uint64x2x2_t, uint64_t, v2di, di, u64)
+__ST2Q_LANE_FUNC (float16x8x2_t, float16_t, v8hf, hf, f16)
+__ST2Q_LANE_FUNC (float32x4x2_t, float32_t, v4sf, sf, f32)
+__ST2Q_LANE_FUNC (float64x2x2_t, float64_t, v2df, df, f64)
+__ST2Q_LANE_FUNC (poly8x16x2_t, poly8_t, v16qi, qi, p8)
+__ST2Q_LANE_FUNC (poly16x8x2_t, poly16_t, v8hi, hi, p16)
+__ST2Q_LANE_FUNC (poly64x2x2_t, poly64_t, v2di, di, p64)
+__ST2Q_LANE_FUNC (int8x16x2_t, int8_t, v16qi, qi, s8)
+__ST2Q_LANE_FUNC (int16x8x2_t, int16_t, v8hi, hi, s16)
+__ST2Q_LANE_FUNC (int32x4x2_t, int32_t, v4si, si, s32)
+__ST2Q_LANE_FUNC (int64x2x2_t, int64_t, v2di, di, s64)
+__ST2Q_LANE_FUNC (uint8x16x2_t, uint8_t, v16qi, qi, u8)
+__ST2Q_LANE_FUNC (uint16x8x2_t, uint16_t, v8hi, hi, u16)
+__ST2Q_LANE_FUNC (uint32x4x2_t, uint32_t, v4si, si, u32)
+__ST2Q_LANE_FUNC (uint64x2x2_t, uint64_t, v2di, di, u64)
#define __ST3_LANE_FUNC(intype, largetype, ptrtype, mode, \
qmode, ptr_mode, funcsuffix, signedtype) \
@@ -11011,8 +10866,7 @@ __ST3_LANE_FUNC (uint32x2x3_t, uint32x4x3_t, uint32_t, v2si, v4si, si, u32,
__ST3_LANE_FUNC (uint64x1x3_t, uint64x2x3_t, uint64_t, di, v2di, di, u64,
int64x2_t)
-#undef __ST3_LANE_FUNC
-#define __ST3_LANE_FUNC(intype, ptrtype, mode, ptr_mode, funcsuffix) \
+#define __ST3Q_LANE_FUNC(intype, ptrtype, mode, ptr_mode, funcsuffix) \
__extension__ extern __inline void \
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) \
vst3q_lane_ ## funcsuffix (ptrtype *__ptr, \
@@ -11024,20 +10878,20 @@ vst3q_lane_ ## funcsuffix (ptrtype *__ptr, \
__ptr, __temp.__o, __c); \
}
-__ST3_LANE_FUNC (float16x8x3_t, float16_t, v8hf, hf, f16)
-__ST3_LANE_FUNC (float32x4x3_t, float32_t, v4sf, sf, f32)
-__ST3_LANE_FUNC (float64x2x3_t, float64_t, v2df, df, f64)
-__ST3_LANE_FUNC (poly8x16x3_t, poly8_t, v16qi, qi, p8)
-__ST3_LANE_FUNC (poly16x8x3_t, poly16_t, v8hi, hi, p16)
-__ST3_LANE_FUNC (poly64x2x3_t, poly64_t, v2di, di, p64)
-__ST3_LANE_FUNC (int8x16x3_t, int8_t, v16qi, qi, s8)
-__ST3_LANE_FUNC (int16x8x3_t, int16_t, v8hi, hi, s16)
-__ST3_LANE_FUNC (int32x4x3_t, int32_t, v4si, si, s32)
-__ST3_LANE_FUNC (int64x2x3_t, int64_t, v2di, di, s64)
-__ST3_LANE_FUNC (uint8x16x3_t, uint8_t, v16qi, qi, u8)
-__ST3_LANE_FUNC (uint16x8x3_t, uint16_t, v8hi, hi, u16)
-__ST3_LANE_FUNC (uint32x4x3_t, uint32_t, v4si, si, u32)
-__ST3_LANE_FUNC (uint64x2x3_t, uint64_t, v2di, di, u64)
+__ST3Q_LANE_FUNC (float16x8x3_t, float16_t, v8hf, hf, f16)
+__ST3Q_LANE_FUNC (float32x4x3_t, float32_t, v4sf, sf, f32)
+__ST3Q_LANE_FUNC (float64x2x3_t, float64_t, v2df, df, f64)
+__ST3Q_LANE_FUNC (poly8x16x3_t, poly8_t, v16qi, qi, p8)
+__ST3Q_LANE_FUNC (poly16x8x3_t, poly16_t, v8hi, hi, p16)
+__ST3Q_LANE_FUNC (poly64x2x3_t, poly64_t, v2di, di, p64)
+__ST3Q_LANE_FUNC (int8x16x3_t, int8_t, v16qi, qi, s8)
+__ST3Q_LANE_FUNC (int16x8x3_t, int16_t, v8hi, hi, s16)
+__ST3Q_LANE_FUNC (int32x4x3_t, int32_t, v4si, si, s32)
+__ST3Q_LANE_FUNC (int64x2x3_t, int64_t, v2di, di, s64)
+__ST3Q_LANE_FUNC (uint8x16x3_t, uint8_t, v16qi, qi, u8)
+__ST3Q_LANE_FUNC (uint16x8x3_t, uint16_t, v8hi, hi, u16)
+__ST3Q_LANE_FUNC (uint32x4x3_t, uint32_t, v4si, si, u32)
+__ST3Q_LANE_FUNC (uint64x2x3_t, uint64_t, v2di, di, u64)
#define __ST4_LANE_FUNC(intype, largetype, ptrtype, mode, \
qmode, ptr_mode, funcsuffix, signedtype) \
@@ -11101,8 +10955,7 @@ __ST4_LANE_FUNC (uint32x2x4_t, uint32x4x4_t, uint32_t, v2si, v4si, si, u32,
__ST4_LANE_FUNC (uint64x1x4_t, uint64x2x4_t, uint64_t, di, v2di, di, u64,
int64x2_t)
-#undef __ST4_LANE_FUNC
-#define __ST4_LANE_FUNC(intype, ptrtype, mode, ptr_mode, funcsuffix) \
+#define __ST4Q_LANE_FUNC(intype, ptrtype, mode, ptr_mode, funcsuffix) \
__extension__ extern __inline void \
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) \
vst4q_lane_ ## funcsuffix (ptrtype *__ptr, \
@@ -11114,20 +10967,20 @@ vst4q_lane_ ## funcsuffix (ptrtype *__ptr, \
__ptr, __temp.__o, __c); \
}
-__ST4_LANE_FUNC (float16x8x4_t, float16_t, v8hf, hf, f16)
-__ST4_LANE_FUNC (float32x4x4_t, float32_t, v4sf, sf, f32)
-__ST4_LANE_FUNC (float64x2x4_t, float64_t, v2df, df, f64)
-__ST4_LANE_FUNC (poly8x16x4_t, poly8_t, v16qi, qi, p8)
-__ST4_LANE_FUNC (poly16x8x4_t, poly16_t, v8hi, hi, p16)
-__ST4_LANE_FUNC (poly64x2x4_t, poly64_t, v2di, di, p64)
-__ST4_LANE_FUNC (int8x16x4_t, int8_t, v16qi, qi, s8)
-__ST4_LANE_FUNC (int16x8x4_t, int16_t, v8hi, hi, s16)
-__ST4_LANE_FUNC (int32x4x4_t, int32_t, v4si, si, s32)
-__ST4_LANE_FUNC (int64x2x4_t, int64_t, v2di, di, s64)
-__ST4_LANE_FUNC (uint8x16x4_t, uint8_t, v16qi, qi, u8)
-__ST4_LANE_FUNC (uint16x8x4_t, uint16_t, v8hi, hi, u16)
-__ST4_LANE_FUNC (uint32x4x4_t, uint32_t, v4si, si, u32)
-__ST4_LANE_FUNC (uint64x2x4_t, uint64_t, v2di, di, u64)
+__ST4Q_LANE_FUNC (float16x8x4_t, float16_t, v8hf, hf, f16)
+__ST4Q_LANE_FUNC (float32x4x4_t, float32_t, v4sf, sf, f32)
+__ST4Q_LANE_FUNC (float64x2x4_t, float64_t, v2df, df, f64)
+__ST4Q_LANE_FUNC (poly8x16x4_t, poly8_t, v16qi, qi, p8)
+__ST4Q_LANE_FUNC (poly16x8x4_t, poly16_t, v8hi, hi, p16)
+__ST4Q_LANE_FUNC (poly64x2x4_t, poly64_t, v2di, di, p64)
+__ST4Q_LANE_FUNC (int8x16x4_t, int8_t, v16qi, qi, s8)
+__ST4Q_LANE_FUNC (int16x8x4_t, int16_t, v8hi, hi, s16)
+__ST4Q_LANE_FUNC (int32x4x4_t, int32_t, v4si, si, s32)
+__ST4Q_LANE_FUNC (int64x2x4_t, int64_t, v2di, di, s64)
+__ST4Q_LANE_FUNC (uint8x16x4_t, uint8_t, v16qi, qi, u8)
+__ST4Q_LANE_FUNC (uint16x8x4_t, uint16_t, v8hi, hi, u16)
+__ST4Q_LANE_FUNC (uint32x4x4_t, uint32_t, v4si, si, u32)
+__ST4Q_LANE_FUNC (uint64x2x4_t, uint64_t, v2di, di, u64)
__extension__ extern __inline int64_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
@@ -20848,11 +20701,9 @@ __LD2_LANE_FUNC (uint32x2x2_t, uint32x2_t, uint32x4x2_t, uint32_t, v2si, v4si, s
__LD2_LANE_FUNC (uint64x1x2_t, uint64x1_t, uint64x2x2_t, uint64_t, di, v2di, di,
u64, int64x2_t)
-#undef __LD2_LANE_FUNC
-
/* vld2q_lane */
-#define __LD2_LANE_FUNC(intype, vtype, ptrtype, mode, ptrmode, funcsuffix) \
+#define __LD2Q_LANE_FUNC(intype, vtype, ptrtype, mode, ptrmode, funcsuffix) \
__extension__ extern __inline intype \
__attribute__ ((__always_inline__, __gnu_inline__,__artificial__)) \
vld2q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \
@@ -20868,22 +20719,20 @@ vld2q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \
return ret; \
}
-__LD2_LANE_FUNC (float16x8x2_t, float16x8_t, float16_t, v8hf, hf, f16)
-__LD2_LANE_FUNC (float32x4x2_t, float32x4_t, float32_t, v4sf, sf, f32)
-__LD2_LANE_FUNC (float64x2x2_t, float64x2_t, float64_t, v2df, df, f64)
-__LD2_LANE_FUNC (poly8x16x2_t, poly8x16_t, poly8_t, v16qi, qi, p8)
-__LD2_LANE_FUNC (poly16x8x2_t, poly16x8_t, poly16_t, v8hi, hi, p16)
-__LD2_LANE_FUNC (poly64x2x2_t, poly64x2_t, poly64_t, v2di, di, p64)
-__LD2_LANE_FUNC (int8x16x2_t, int8x16_t, int8_t, v16qi, qi, s8)
-__LD2_LANE_FUNC (int16x8x2_t, int16x8_t, int16_t, v8hi, hi, s16)
-__LD2_LANE_FUNC (int32x4x2_t, int32x4_t, int32_t, v4si, si, s32)
-__LD2_LANE_FUNC (int64x2x2_t, int64x2_t, int64_t, v2di, di, s64)
-__LD2_LANE_FUNC (uint8x16x2_t, uint8x16_t, uint8_t, v16qi, qi, u8)
-__LD2_LANE_FUNC (uint16x8x2_t, uint16x8_t, uint16_t, v8hi, hi, u16)
-__LD2_LANE_FUNC (uint32x4x2_t, uint32x4_t, uint32_t, v4si, si, u32)
-__LD2_LANE_FUNC (uint64x2x2_t, uint64x2_t, uint64_t, v2di, di, u64)
-
-#undef __LD2_LANE_FUNC
+__LD2Q_LANE_FUNC (float16x8x2_t, float16x8_t, float16_t, v8hf, hf, f16)
+__LD2Q_LANE_FUNC (float32x4x2_t, float32x4_t, float32_t, v4sf, sf, f32)
+__LD2Q_LANE_FUNC (float64x2x2_t, float64x2_t, float64_t, v2df, df, f64)
+__LD2Q_LANE_FUNC (poly8x16x2_t, poly8x16_t, poly8_t, v16qi, qi, p8)
+__LD2Q_LANE_FUNC (poly16x8x2_t, poly16x8_t, poly16_t, v8hi, hi, p16)
+__LD2Q_LANE_FUNC (poly64x2x2_t, poly64x2_t, poly64_t, v2di, di, p64)
+__LD2Q_LANE_FUNC (int8x16x2_t, int8x16_t, int8_t, v16qi, qi, s8)
+__LD2Q_LANE_FUNC (int16x8x2_t, int16x8_t, int16_t, v8hi, hi, s16)
+__LD2Q_LANE_FUNC (int32x4x2_t, int32x4_t, int32_t, v4si, si, s32)
+__LD2Q_LANE_FUNC (int64x2x2_t, int64x2_t, int64_t, v2di, di, s64)
+__LD2Q_LANE_FUNC (uint8x16x2_t, uint8x16_t, uint8_t, v16qi, qi, u8)
+__LD2Q_LANE_FUNC (uint16x8x2_t, uint16x8_t, uint16_t, v8hi, hi, u16)
+__LD2Q_LANE_FUNC (uint32x4x2_t, uint32x4_t, uint32_t, v4si, si, u32)
+__LD2Q_LANE_FUNC (uint64x2x2_t, uint64x2_t, uint64_t, v2di, di, u64)
/* vld3_lane */
@@ -20947,11 +20796,9 @@ __LD3_LANE_FUNC (uint32x2x3_t, uint32x2_t, uint32x4x3_t, uint32_t, v2si, v4si, s
__LD3_LANE_FUNC (uint64x1x3_t, uint64x1_t, uint64x2x3_t, uint64_t, di, v2di, di,
u64, int64x2_t)
-#undef __LD3_LANE_FUNC
-
/* vld3q_lane */
-#define __LD3_LANE_FUNC(intype, vtype, ptrtype, mode, ptrmode, funcsuffix) \
+#define __LD3Q_LANE_FUNC(intype, vtype, ptrtype, mode, ptrmode, funcsuffix) \
__extension__ extern __inline intype \
__attribute__ ((__always_inline__, __gnu_inline__,__artificial__)) \
vld3q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \
@@ -20969,22 +20816,20 @@ vld3q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \
return ret; \
}
-__LD3_LANE_FUNC (float16x8x3_t, float16x8_t, float16_t, v8hf, hf, f16)
-__LD3_LANE_FUNC (float32x4x3_t, float32x4_t, float32_t, v4sf, sf, f32)
-__LD3_LANE_FUNC (float64x2x3_t, float64x2_t, float64_t, v2df, df, f64)
-__LD3_LANE_FUNC (poly8x16x3_t, poly8x16_t, poly8_t, v16qi, qi, p8)
-__LD3_LANE_FUNC (poly16x8x3_t, poly16x8_t, poly16_t, v8hi, hi, p16)
-__LD3_LANE_FUNC (poly64x2x3_t, poly64x2_t, poly64_t, v2di, di, p64)
-__LD3_LANE_FUNC (int8x16x3_t, int8x16_t, int8_t, v16qi, qi, s8)
-__LD3_LANE_FUNC (int16x8x3_t, int16x8_t, int16_t, v8hi, hi, s16)
-__LD3_LANE_FUNC (int32x4x3_t, int32x4_t, int32_t, v4si, si, s32)
-__LD3_LANE_FUNC (int64x2x3_t, int64x2_t, int64_t, v2di, di, s64)
-__LD3_LANE_FUNC (uint8x16x3_t, uint8x16_t, uint8_t, v16qi, qi, u8)
-__LD3_LANE_FUNC (uint16x8x3_t, uint16x8_t, uint16_t, v8hi, hi, u16)
-__LD3_LANE_FUNC (uint32x4x3_t, uint32x4_t, uint32_t, v4si, si, u32)
-__LD3_LANE_FUNC (uint64x2x3_t, uint64x2_t, uint64_t, v2di, di, u64)
-
-#undef __LD3_LANE_FUNC
+__LD3Q_LANE_FUNC (float16x8x3_t, float16x8_t, float16_t, v8hf, hf, f16)
+__LD3Q_LANE_FUNC (float32x4x3_t, float32x4_t, float32_t, v4sf, sf, f32)
+__LD3Q_LANE_FUNC (float64x2x3_t, float64x2_t, float64_t, v2df, df, f64)
+__LD3Q_LANE_FUNC (poly8x16x3_t, poly8x16_t, poly8_t, v16qi, qi, p8)
+__LD3Q_LANE_FUNC (poly16x8x3_t, poly16x8_t, poly16_t, v8hi, hi, p16)
+__LD3Q_LANE_FUNC (poly64x2x3_t, poly64x2_t, poly64_t, v2di, di, p64)
+__LD3Q_LANE_FUNC (int8x16x3_t, int8x16_t, int8_t, v16qi, qi, s8)
+__LD3Q_LANE_FUNC (int16x8x3_t, int16x8_t, int16_t, v8hi, hi, s16)
+__LD3Q_LANE_FUNC (int32x4x3_t, int32x4_t, int32_t, v4si, si, s32)
+__LD3Q_LANE_FUNC (int64x2x3_t, int64x2_t, int64_t, v2di, di, s64)
+__LD3Q_LANE_FUNC (uint8x16x3_t, uint8x16_t, uint8_t, v16qi, qi, u8)
+__LD3Q_LANE_FUNC (uint16x8x3_t, uint16x8_t, uint16_t, v8hi, hi, u16)
+__LD3Q_LANE_FUNC (uint32x4x3_t, uint32x4_t, uint32_t, v4si, si, u32)
+__LD3Q_LANE_FUNC (uint64x2x3_t, uint64x2_t, uint64_t, v2di, di, u64)
/* vld4_lane */
@@ -21056,11 +20901,9 @@ __LD4_LANE_FUNC (uint32x2x4_t, uint32x2_t, uint32x4x4_t, uint32_t, v2si, v4si, s
__LD4_LANE_FUNC (uint64x1x4_t, uint64x1_t, uint64x2x4_t, uint64_t, di, v2di, di,
u64, int64x2_t)
-#undef __LD4_LANE_FUNC
-
/* vld4q_lane */
-#define __LD4_LANE_FUNC(intype, vtype, ptrtype, mode, ptrmode, funcsuffix) \
+#define __LD4Q_LANE_FUNC(intype, vtype, ptrtype, mode, ptrmode, funcsuffix) \
__extension__ extern __inline intype \
__attribute__ ((__always_inline__, __gnu_inline__,__artificial__)) \
vld4q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \
@@ -21080,22 +20923,20 @@ vld4q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \
return ret; \
}
-__LD4_LANE_FUNC (float16x8x4_t, float16x8_t, float16_t, v8hf, hf, f16)
-__LD4_LANE_FUNC (float32x4x4_t, float32x4_t, float32_t, v4sf, sf, f32)
-__LD4_LANE_FUNC (float64x2x4_t, float64x2_t, float64_t, v2df, df, f64)
-__LD4_LANE_FUNC (poly8x16x4_t, poly8x16_t, poly8_t, v16qi, qi, p8)
-__LD4_LANE_FUNC (poly16x8x4_t, poly16x8_t, poly16_t, v8hi, hi, p16)
-__LD4_LANE_FUNC (poly64x2x4_t, poly64x2_t, poly64_t, v2di, di, p64)
-__LD4_LANE_FUNC (int8x16x4_t, int8x16_t, int8_t, v16qi, qi, s8)
-__LD4_LANE_FUNC (int16x8x4_t, int16x8_t, int16_t, v8hi, hi, s16)
-__LD4_LANE_FUNC (int32x4x4_t, int32x4_t, int32_t, v4si, si, s32)
-__LD4_LANE_FUNC (int64x2x4_t, int64x2_t, int64_t, v2di, di, s64)
-__LD4_LANE_FUNC (uint8x16x4_t, uint8x16_t, uint8_t, v16qi, qi, u8)
-__LD4_LANE_FUNC (uint16x8x4_t, uint16x8_t, uint16_t, v8hi, hi, u16)
-__LD4_LANE_FUNC (uint32x4x4_t, uint32x4_t, uint32_t, v4si, si, u32)
-__LD4_LANE_FUNC (uint64x2x4_t, uint64x2_t, uint64_t, v2di, di, u64)
-
-#undef __LD4_LANE_FUNC
+__LD4Q_LANE_FUNC (float16x8x4_t, float16x8_t, float16_t, v8hf, hf, f16)
+__LD4Q_LANE_FUNC (float32x4x4_t, float32x4_t, float32_t, v4sf, sf, f32)
+__LD4Q_LANE_FUNC (float64x2x4_t, float64x2_t, float64_t, v2df, df, f64)
+__LD4Q_LANE_FUNC (poly8x16x4_t, poly8x16_t, poly8_t, v16qi, qi, p8)
+__LD4Q_LANE_FUNC (poly16x8x4_t, poly16x8_t, poly16_t, v8hi, hi, p16)
+__LD4Q_LANE_FUNC (poly64x2x4_t, poly64x2_t, poly64_t, v2di, di, p64)
+__LD4Q_LANE_FUNC (int8x16x4_t, int8x16_t, int8_t, v16qi, qi, s8)
+__LD4Q_LANE_FUNC (int16x8x4_t, int16x8_t, int16_t, v8hi, hi, s16)
+__LD4Q_LANE_FUNC (int32x4x4_t, int32x4_t, int32_t, v4si, si, s32)
+__LD4Q_LANE_FUNC (int64x2x4_t, int64x2_t, int64_t, v2di, di, s64)
+__LD4Q_LANE_FUNC (uint8x16x4_t, uint8x16_t, uint8_t, v16qi, qi, u8)
+__LD4Q_LANE_FUNC (uint16x8x4_t, uint16x8_t, uint16_t, v8hi, hi, u16)
+__LD4Q_LANE_FUNC (uint32x4x4_t, uint32x4_t, uint32_t, v4si, si, u32)
+__LD4Q_LANE_FUNC (uint64x2x4_t, uint64x2_t, uint64_t, v2di, di, u64)
/* vmax */
@@ -35697,6 +35538,41 @@ vbfmlaltq_laneq_f32 (float32x4_t __r, bfloat16x8_t __a, bfloat16x8_t __b,
__extension__ extern __inline bfloat16x4_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vget_low_bf16 (bfloat16x8_t __a)
+{
+ return __builtin_aarch64_vget_lo_halfv8bf (__a);
+}
+
+__extension__ extern __inline bfloat16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vget_high_bf16 (bfloat16x8_t __a)
+{
+ return __builtin_aarch64_vget_hi_halfv8bf (__a);
+}
+
+__extension__ extern __inline float32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcvt_f32_bf16 (bfloat16x4_t __a)
+{
+ return __builtin_aarch64_vbfcvtv4bf (__a);
+}
+
+__extension__ extern __inline float32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcvtq_low_f32_bf16 (bfloat16x8_t __a)
+{
+ return __builtin_aarch64_vbfcvtv8bf (__a);
+}
+
+__extension__ extern __inline float32x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcvtq_high_f32_bf16 (bfloat16x8_t __a)
+{
+ return __builtin_aarch64_vbfcvt_highv8bf (__a);
+}
+
+__extension__ extern __inline bfloat16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vcvt_bf16_f32 (float32x4_t __a)
{
return __builtin_aarch64_bfcvtnv4bf (__a);
@@ -35716,6 +35592,62 @@ vcvtq_high_bf16_f32 (bfloat16x8_t __inactive, float32x4_t __a)
return __builtin_aarch64_bfcvtn2v8bf (__inactive, __a);
}
+__extension__ extern __inline bfloat16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcopy_lane_bf16 (bfloat16x4_t __a, const int __lane1,
+ bfloat16x4_t __b, const int __lane2)
+{
+ return __aarch64_vset_lane_any (__aarch64_vget_lane_any (__b, __lane2),
+ __a, __lane1);
+}
+
+__extension__ extern __inline bfloat16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcopyq_lane_bf16 (bfloat16x8_t __a, const int __lane1,
+ bfloat16x4_t __b, const int __lane2)
+{
+ return __aarch64_vset_lane_any (__aarch64_vget_lane_any (__b, __lane2),
+ __a, __lane1);
+}
+
+__extension__ extern __inline bfloat16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcopy_laneq_bf16 (bfloat16x4_t __a, const int __lane1,
+ bfloat16x8_t __b, const int __lane2)
+{
+ return __aarch64_vset_lane_any (__aarch64_vget_lane_any (__b, __lane2),
+ __a, __lane1);
+}
+
+__extension__ extern __inline bfloat16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vcopyq_laneq_bf16 (bfloat16x8_t __a, const int __lane1,
+ bfloat16x8_t __b, const int __lane2)
+{
+ return __aarch64_vset_lane_any (__aarch64_vget_lane_any (__b, __lane2),
+ __a, __lane1);
+}
+
+__LD2_LANE_FUNC (bfloat16x4x2_t, bfloat16x4_t, bfloat16x8x2_t, bfloat16_t, v4bf,
+ v8bf, bf, bf16, bfloat16x8_t)
+__LD2Q_LANE_FUNC (bfloat16x8x2_t, bfloat16x8_t, bfloat16_t, v8bf, bf, bf16)
+__LD3_LANE_FUNC (bfloat16x4x3_t, bfloat16x4_t, bfloat16x8x3_t, bfloat16_t, v4bf,
+ v8bf, bf, bf16, bfloat16x8_t)
+__LD3Q_LANE_FUNC (bfloat16x8x3_t, bfloat16x8_t, bfloat16_t, v8bf, bf, bf16)
+__LD4_LANE_FUNC (bfloat16x4x4_t, bfloat16x4_t, bfloat16x8x4_t, bfloat16_t, v4bf,
+ v8bf, bf, bf16, bfloat16x8_t)
+__LD4Q_LANE_FUNC (bfloat16x8x4_t, bfloat16x8_t, bfloat16_t, v8bf, bf, bf16)
+
+__ST2_LANE_FUNC (bfloat16x4x2_t, bfloat16x8x2_t, bfloat16_t, v4bf, v8bf, bf,
+ bf16, bfloat16x8_t)
+__ST2Q_LANE_FUNC (bfloat16x8x2_t, bfloat16_t, v8bf, bf, bf16)
+__ST3_LANE_FUNC (bfloat16x4x3_t, bfloat16x8x3_t, bfloat16_t, v4bf, v8bf, bf,
+ bf16, bfloat16x8_t)
+__ST3Q_LANE_FUNC (bfloat16x8x3_t, bfloat16_t, v8bf, bf, bf16)
+__ST4_LANE_FUNC (bfloat16x4x4_t, bfloat16x8x4_t, bfloat16_t, v4bf, v8bf, bf,
+ bf16, bfloat16x8_t)
+__ST4Q_LANE_FUNC (bfloat16x8x4_t, bfloat16_t, v8bf, bf, bf16)
+
#pragma GCC pop_options
/* AdvSIMD 8-bit Integer Matrix Multiply (I8MM) intrinsics. */
@@ -35929,4 +35861,17 @@ vaddq_p128 (poly128_t __a, poly128_t __b)
#undef __aarch64_vdupq_laneq_u32
#undef __aarch64_vdupq_laneq_u64
+#undef __LD2_LANE_FUNC
+#undef __LD2Q_LANE_FUNC
+#undef __LD3_LANE_FUNC
+#undef __LD3Q_LANE_FUNC
+#undef __LD4_LANE_FUNC
+#undef __LD4Q_LANE_FUNC
+#undef __ST2_LANE_FUNC
+#undef __ST2Q_LANE_FUNC
+#undef __ST3_LANE_FUNC
+#undef __ST3Q_LANE_FUNC
+#undef __ST4_LANE_FUNC
+#undef __ST4Q_LANE_FUNC
+
#endif
diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md
index 054fd85..fb1426b 100644
--- a/gcc/config/aarch64/iterators.md
+++ b/gcc/config/aarch64/iterators.md
@@ -400,7 +400,7 @@
(define_mode_iterator SVE_ALL [VNx16QI VNx8QI VNx4QI VNx2QI
VNx8HI VNx4HI VNx2HI
VNx8HF VNx4HF VNx2HF
- VNx8BF
+ VNx8BF VNx4BF VNx2BF
VNx4SI VNx2SI
VNx4SF VNx2SF
VNx2DI
@@ -418,11 +418,13 @@
VNx2DI])
;; SVE modes with 2 or 4 elements.
-(define_mode_iterator SVE_24 [VNx2QI VNx2HI VNx2HF VNx2SI VNx2SF VNx2DI VNx2DF
- VNx4QI VNx4HI VNx4HF VNx4SI VNx4SF])
+(define_mode_iterator SVE_24 [VNx2QI VNx2HI VNx2HF VNx2BF VNx2SI VNx2SF
+ VNx2DI VNx2DF
+ VNx4QI VNx4HI VNx4HF VNx4BF VNx4SI VNx4SF])
;; SVE modes with 2 elements.
-(define_mode_iterator SVE_2 [VNx2QI VNx2HI VNx2HF VNx2SI VNx2SF VNx2DI VNx2DF])
+(define_mode_iterator SVE_2 [VNx2QI VNx2HI VNx2HF VNx2BF
+ VNx2SI VNx2SF VNx2DI VNx2DF])
;; SVE integer modes with 2 elements, excluding the widest element.
(define_mode_iterator SVE_2BHSI [VNx2QI VNx2HI VNx2SI])
@@ -431,7 +433,7 @@
(define_mode_iterator SVE_2HSDI [VNx2HI VNx2SI VNx2DI])
;; SVE modes with 4 elements.
-(define_mode_iterator SVE_4 [VNx4QI VNx4HI VNx4HF VNx4SI VNx4SF])
+(define_mode_iterator SVE_4 [VNx4QI VNx4HI VNx4HF VNx4BF VNx4SI VNx4SF])
;; SVE integer modes with 4 elements, excluding the widest element.
(define_mode_iterator SVE_4BHI [VNx4QI VNx4HI])
@@ -621,6 +623,7 @@
UNSPEC_REVB ; Used in aarch64-sve.md.
UNSPEC_REVH ; Used in aarch64-sve.md.
UNSPEC_REVW ; Used in aarch64-sve.md.
+ UNSPEC_REVBHW ; Used in aarch64-sve.md.
UNSPEC_SMUL_HIGHPART ; Used in aarch64-sve.md.
UNSPEC_UMUL_HIGHPART ; Used in aarch64-sve.md.
UNSPEC_FMLA ; Used in aarch64-sve.md.
@@ -968,6 +971,16 @@
(VNx4SI "32") (VNx2DI "64")
(VNx8HF "16") (VNx4SF "32") (VNx2DF "64")])
+;; The number of bits in a vector container.
+(define_mode_attr container_bits [(VNx16QI "8")
+ (VNx8HI "16") (VNx8QI "16") (VNx8HF "16")
+ (VNx8BF "16")
+ (VNx4SI "32") (VNx4HI "32") (VNx4QI "32")
+ (VNx4SF "32") (VNx4HF "32") (VNx4BF "32")
+ (VNx2DI "64") (VNx2SI "64") (VNx2HI "64")
+ (VNx2QI "64") (VNx2DF "64") (VNx2SF "64")
+ (VNx2HF "64") (VNx2BF "64")])
+
;; Attribute to describe constants acceptable in logical operations
(define_mode_attr lconst [(SI "K") (DI "L")])
@@ -1029,7 +1042,7 @@
(VNx16QI "b") (VNx8QI "b") (VNx4QI "b") (VNx2QI "b")
(VNx8HI "h") (VNx4HI "h") (VNx2HI "h")
(VNx8HF "h") (VNx4HF "h") (VNx2HF "h")
- (VNx8BF "h")
+ (VNx8BF "h") (VNx4BF "h") (VNx2BF "h")
(VNx4SI "s") (VNx2SI "s")
(VNx4SF "s") (VNx2SF "s")
(VNx2DI "d")
@@ -1047,7 +1060,7 @@
(define_mode_attr Vesize [(VNx16QI "b") (VNx8QI "b") (VNx4QI "b") (VNx2QI "b")
(VNx8HI "h") (VNx4HI "h") (VNx2HI "h")
(VNx8HF "h") (VNx4HF "h") (VNx2HF "h")
- (VNx8BF "h")
+ (VNx8BF "h") (VNx4BF "h") (VNx2BF "h")
(VNx4SI "w") (VNx2SI "w")
(VNx4SF "w") (VNx2SF "w")
(VNx2DI "d")
@@ -1066,12 +1079,23 @@
(define_mode_attr Vctype [(VNx16QI "b") (VNx8QI "h") (VNx4QI "s") (VNx2QI "d")
(VNx8HI "h") (VNx4HI "s") (VNx2HI "d")
(VNx8HF "h") (VNx4HF "s") (VNx2HF "d")
- (VNx8BF "h")
+ (VNx8BF "h") (VNx4BF "s") (VNx2BF "d")
(VNx4SI "s") (VNx2SI "d")
(VNx4SF "s") (VNx2SF "d")
(VNx2DI "d")
(VNx2DF "d")])
+;; The instruction mnemonic suffix for an SVE mode's element container,
+;; i.e. the Vewtype of full SVE modes that have the same number of elements.
+(define_mode_attr Vcwtype [(VNx16QI "b") (VNx8QI "h") (VNx4QI "w") (VNx2QI "d")
+ (VNx8HI "h") (VNx4HI "w") (VNx2HI "d")
+ (VNx8HF "h") (VNx4HF "w") (VNx2HF "d")
+ (VNx8BF "h") (VNx4BF "w") (VNx2BF "d")
+ (VNx4SI "w") (VNx2SI "d")
+ (VNx4SF "w") (VNx2SF "d")
+ (VNx2DI "d")
+ (VNx2DF "d")])
+
;; Vetype is used everywhere in scheduling type and assembly output,
;; sometimes they are not the same, for example HF modes on some
;; instructions. stype is defined to represent scheduling type
@@ -1107,7 +1131,7 @@
(VNx16QI "QI") (VNx8QI "QI") (VNx4QI "QI") (VNx2QI "QI")
(VNx8HI "HI") (VNx4HI "HI") (VNx2HI "HI")
(VNx8HF "HF") (VNx4HF "HF") (VNx2HF "HF")
- (VNx8BF "BF")
+ (VNx8BF "BF") (VNx4BF "BF") (VNx2BF "BF")
(VNx4SI "SI") (VNx2SI "SI")
(VNx4SF "SF") (VNx2SF "SF")
(VNx2DI "DI")
@@ -1127,7 +1151,7 @@
(VNx16QI "qi") (VNx8QI "qi") (VNx4QI "qi") (VNx2QI "qi")
(VNx8HI "hi") (VNx4HI "hi") (VNx2HI "hi")
(VNx8HF "hf") (VNx4HF "hf") (VNx2HF "hf")
- (VNx8BF "bf")
+ (VNx8BF "bf") (VNx4BF "bf") (VNx2BF "bf")
(VNx4SI "si") (VNx2SI "si")
(VNx4SF "sf") (VNx2SF "sf")
(VNx2DI "di")
@@ -1310,7 +1334,7 @@
(VNx16QI "w") (VNx8QI "w") (VNx4QI "w") (VNx2QI "w")
(VNx8HI "w") (VNx4HI "w") (VNx2HI "w")
(VNx8HF "w") (VNx4HF "w") (VNx2HF "w")
- (VNx8BF "w")
+ (VNx8BF "w") (VNx4BF "w") (VNx2BF "w")
(VNx4SI "w") (VNx2SI "w")
(VNx4SF "w") (VNx2SF "w")
(VNx2DI "x")
@@ -1380,6 +1404,8 @@
(VNx2DI "VNx2DI")
(VNx8HF "VNx8HI") (VNx4HF "VNx4SI")
(VNx2HF "VNx2DI")
+ (VNx8BF "VNx8HI") (VNx4BF "VNx4SI")
+ (VNx2BF "VNx2DI")
(VNx4SF "VNx4SI") (VNx2SF "VNx2DI")
(VNx2DF "VNx2DI")])
@@ -1392,6 +1418,8 @@
(VNx2DI "vnx2di")
(VNx8HF "vnx8hi") (VNx4HF "vnx4si")
(VNx2HF "vnx2di")
+ (VNx8BF "vnx8hi") (VNx4BF "vnx4si")
+ (VNx2BF "vnx2di")
(VNx4SF "vnx4si") (VNx2SF "vnx2di")
(VNx2DF "vnx2di")])
@@ -1617,7 +1645,7 @@
(VNx4QI "VNx4BI") (VNx2QI "VNx2BI")
(VNx8HI "VNx8BI") (VNx4HI "VNx4BI") (VNx2HI "VNx2BI")
(VNx8HF "VNx8BI") (VNx4HF "VNx4BI") (VNx2HF "VNx2BI")
- (VNx8BF "VNx8BI")
+ (VNx8BF "VNx8BI") (VNx4BF "VNx4BI") (VNx2BF "VNx2BI")
(VNx4SI "VNx4BI") (VNx2SI "VNx2BI")
(VNx4SF "VNx4BI") (VNx2SF "VNx2BI")
(VNx2DI "VNx2BI")
@@ -1643,7 +1671,7 @@
(VNx4QI "vnx4bi") (VNx2QI "vnx2bi")
(VNx8HI "vnx8bi") (VNx4HI "vnx4bi") (VNx2HI "vnx2bi")
(VNx8HF "vnx8bi") (VNx4HF "vnx4bi") (VNx2HF "vnx2bi")
- (VNx8BF "vnx8bi")
+ (VNx8BF "vnx8bi") (VNx4BF "vnx4bi") (VNx2BF "vnx2bi")
(VNx4SI "vnx4bi") (VNx2SI "vnx2bi")
(VNx4SF "vnx4bi") (VNx2SF "vnx2bi")
(VNx2DI "vnx2bi")
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 6b96c5e..2a7b1fb 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -10155,6 +10155,14 @@ arc_split_move (rtx *operands)
}
if (TARGET_PLUS_QMACW
+ && even_register_operand (operands[0], mode)
+ && even_register_operand (operands[1], mode))
+ {
+ emit_move_insn (operands[0], operands[1]);
+ return;
+ }
+
+ if (TARGET_PLUS_QMACW
&& GET_CODE (operands[1]) == CONST_VECTOR)
{
HOST_WIDE_INT intval0, intval1;
diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
index a7f4056..266b7ce 100644
--- a/gcc/config/arc/arc.md
+++ b/gcc/config/arc/arc.md
@@ -1322,8 +1322,8 @@ core_3, archs4x, archs4xd, archs4xd_slow"
")
(define_insn_and_split "*movdi_insn"
- [(set (match_operand:DI 0 "move_dest_operand" "=w, w,r, m")
- (match_operand:DI 1 "move_double_src_operand" "c,Hi,m,cCm3"))]
+ [(set (match_operand:DI 0 "move_dest_operand" "=r, r,r, m")
+ (match_operand:DI 1 "move_double_src_operand" "r,Hi,m,rCm3"))]
"register_operand (operands[0], DImode)
|| register_operand (operands[1], DImode)
|| (satisfies_constraint_Cm3 (operands[1])
@@ -1335,6 +1335,13 @@ core_3, archs4x, archs4xd, archs4xd_slow"
default:
return \"#\";
+ case 0:
+ if (TARGET_PLUS_QMACW
+ && even_register_operand (operands[0], DImode)
+ && even_register_operand (operands[1], DImode))
+ return \"vadd2\\t%0,%1,0\";
+ return \"#\";
+
case 2:
if (TARGET_LL64
&& memory_operand (operands[1], DImode)
@@ -1351,7 +1358,7 @@ core_3, archs4x, archs4xd, archs4xd_slow"
return \"#\";
}
}"
- "reload_completed"
+ "&& reload_completed"
[(const_int 0)]
{
arc_split_move (operands);
@@ -1397,15 +1404,24 @@ core_3, archs4x, archs4xd, archs4xd_slow"
"if (prepare_move_operands (operands, DFmode)) DONE;")
(define_insn_and_split "*movdf_insn"
- [(set (match_operand:DF 0 "move_dest_operand" "=D,r,c,c,r,m")
- (match_operand:DF 1 "move_double_src_operand" "r,D,c,E,m,c"))]
- "register_operand (operands[0], DFmode) || register_operand (operands[1], DFmode)"
+ [(set (match_operand:DF 0 "move_dest_operand" "=D,r,r,r,r,m")
+ (match_operand:DF 1 "move_double_src_operand" "r,D,r,E,m,r"))]
+ "register_operand (operands[0], DFmode)
+ || register_operand (operands[1], DFmode)"
"*
{
switch (which_alternative)
{
default:
return \"#\";
+
+ case 2:
+ if (TARGET_PLUS_QMACW
+ && even_register_operand (operands[0], DFmode)
+ && even_register_operand (operands[1], DFmode))
+ return \"vadd2\\t%0,%1,0\";
+ return \"#\";
+
case 4:
if (TARGET_LL64
&& ((even_register_operand (operands[0], DFmode)
@@ -6126,6 +6142,49 @@ core_3, archs4x, archs4xd, archs4xd_slow"
[(set_attr "length" "0")])
;; MAC and DMPY instructions
+
+; Use MAC instruction to emulate 16bit mac.
+(define_expand "maddhisi4"
+ [(match_operand:SI 0 "register_operand" "")
+ (match_operand:HI 1 "register_operand" "")
+ (match_operand:HI 2 "extend_operand" "")
+ (match_operand:SI 3 "register_operand" "")]
+ "TARGET_PLUS_DMPY"
+ "{
+ rtx acc_reg = gen_rtx_REG (DImode, ACC_REG_FIRST);
+ rtx tmp1 = gen_reg_rtx (SImode);
+ rtx tmp2 = gen_reg_rtx (SImode);
+ rtx accl = gen_lowpart (SImode, acc_reg);
+
+ emit_move_insn (accl, operands[3]);
+ emit_insn (gen_rtx_SET (tmp1, gen_rtx_SIGN_EXTEND (SImode, operands[1])));
+ emit_insn (gen_rtx_SET (tmp2, gen_rtx_SIGN_EXTEND (SImode, operands[2])));
+ emit_insn (gen_mac (tmp1, tmp2));
+ emit_move_insn (operands[0], accl);
+ DONE;
+ }")
+
+; The same for the unsigned variant, but using MACU instruction.
+(define_expand "umaddhisi4"
+ [(match_operand:SI 0 "register_operand" "")
+ (match_operand:HI 1 "register_operand" "")
+ (match_operand:HI 2 "extend_operand" "")
+ (match_operand:SI 3 "register_operand" "")]
+ "TARGET_PLUS_DMPY"
+ "{
+ rtx acc_reg = gen_rtx_REG (DImode, ACC_REG_FIRST);
+ rtx tmp1 = gen_reg_rtx (SImode);
+ rtx tmp2 = gen_reg_rtx (SImode);
+ rtx accl = gen_lowpart (SImode, acc_reg);
+
+ emit_move_insn (accl, operands[3]);
+ emit_insn (gen_rtx_SET (tmp1, gen_rtx_ZERO_EXTEND (SImode, operands[1])));
+ emit_insn (gen_rtx_SET (tmp2, gen_rtx_ZERO_EXTEND (SImode, operands[2])));
+ emit_insn (gen_macu (tmp1, tmp2));
+ emit_move_insn (operands[0], accl);
+ DONE;
+ }")
+
(define_expand "maddsidi4"
[(match_operand:DI 0 "register_operand" "")
(match_operand:SI 1 "register_operand" "")
diff --git a/gcc/config/arc/constraints.md b/gcc/config/arc/constraints.md
index b7a563a..a2a8e84 100644
--- a/gcc/config/arc/constraints.md
+++ b/gcc/config/arc/constraints.md
@@ -493,6 +493,11 @@
Condition Codes"
(and (match_code "reg") (match_test "cc_register (op, VOIDmode)")))
+(define_constraint "Ral"
+ "@internal
+ Accumulator register @code{ACCL} - do not reload into its class"
+ (and (match_code "reg")
+ (match_test "REGNO (op) == ACCL_REGNO")))
(define_constraint "Q"
"@internal
diff --git a/gcc/config/arc/simdext.md b/gcc/config/arc/simdext.md
index 0e88b3dd8..d2fc309 100644
--- a/gcc/config/arc/simdext.md
+++ b/gcc/config/arc/simdext.md
@@ -1400,8 +1400,7 @@
(define_insn_and_split "*mov<mode>_insn"
[(set (match_operand:VWH 0 "move_dest_operand" "=r,r,r,m")
(match_operand:VWH 1 "general_operand" "i,r,m,r"))]
- "TARGET_PLUS_QMACW
- && (register_operand (operands[0], <MODE>mode)
+ "(register_operand (operands[0], <MODE>mode)
|| register_operand (operands[1], <MODE>mode))"
"*
{
@@ -1411,7 +1410,11 @@
return \"#\";
case 1:
- return \"vadd2 %0, %1, 0\";
+ if (TARGET_PLUS_QMACW
+ && even_register_operand (operands[0], <MODE>mode)
+ && even_register_operand (operands[1], <MODE>mode))
+ return \"vadd2\\t%0,%1,0\";
+ return \"#\";
case 2:
if (TARGET_LL64)
@@ -1430,7 +1433,7 @@
arc_split_move (operands);
DONE;
}
- [(set_attr "type" "move,move,load,store")
+ [(set_attr "type" "move,multi,load,store")
(set_attr "predicable" "yes,no,no,no")
(set_attr "iscompact" "false,false,false,false")
])
@@ -1612,6 +1615,44 @@
DONE;
})
+(define_expand "sdot_prodv4hi"
+ [(match_operand:V2SI 0 "register_operand" "")
+ (match_operand:V4HI 1 "register_operand" "")
+ (match_operand:V4HI 2 "register_operand" "")
+ (match_operand:V2SI 3 "register_operand" "")]
+ "TARGET_PLUS_MACD"
+{
+ rtx acc_reg = gen_rtx_REG (V2SImode, ACC_REG_FIRST);
+ rtx op1_low = gen_lowpart (V2HImode, operands[1]);
+ rtx op1_high = gen_highpart (V2HImode, operands[1]);
+ rtx op2_low = gen_lowpart (V2HImode, operands[2]);
+ rtx op2_high = gen_highpart (V2HImode, operands[2]);
+
+ emit_move_insn (acc_reg, operands[3]);
+ emit_insn (gen_arc_vec_smac_v2hiv2si_zero (op1_low, op2_low));
+ emit_insn (gen_arc_vec_smac_v2hiv2si (operands[0], op1_high, op2_high));
+ DONE;
+})
+
+(define_expand "udot_prodv4hi"
+ [(match_operand:V2SI 0 "register_operand" "")
+ (match_operand:V4HI 1 "register_operand" "")
+ (match_operand:V4HI 2 "register_operand" "")
+ (match_operand:V2SI 3 "register_operand" "")]
+ "TARGET_PLUS_MACD"
+{
+ rtx acc_reg = gen_rtx_REG (V2SImode, ACC_REG_FIRST);
+ rtx op1_low = gen_lowpart (V2HImode, operands[1]);
+ rtx op1_high = gen_highpart (V2HImode, operands[1]);
+ rtx op2_low = gen_lowpart (V2HImode, operands[2]);
+ rtx op2_high = gen_highpart (V2HImode, operands[2]);
+
+ emit_move_insn (acc_reg, operands[3]);
+ emit_insn (gen_arc_vec_umac_v2hiv2si_zero (op1_low, op2_low));
+ emit_insn (gen_arc_vec_umac_v2hiv2si (operands[0], op1_high, op2_high));
+ DONE;
+})
+
(define_insn "arc_vec_<V_US>mult_lo_v4hi"
[(set (match_operand:V2SI 0 "even_register_operand" "=r,r")
(mult:V2SI (SE:V2SI (vec_select:V2HI
@@ -1704,30 +1745,37 @@
}
)
-(define_insn "arc_vec_<V_US>mac_hi_v4hi"
- [(set (match_operand:V2SI 0 "even_register_operand" "=r,r")
+(define_insn "arc_vec_<V_US>mac_v2hiv2si"
+ [(set (match_operand:V2SI 0 "even_register_operand" "=r,Ral,r")
(plus:V2SI
- (reg:V2SI ARCV2_ACC)
- (mult:V2SI (SE:V2SI (vec_select:V2HI
- (match_operand:V4HI 1 "even_register_operand" "0,r")
- (parallel [(const_int 2) (const_int 3)])))
- (SE:V2SI (vec_select:V2HI
- (match_operand:V4HI 2 "even_register_operand" "r,r")
- (parallel [(const_int 2) (const_int 3)]))))))
+ (mult:V2SI (SE:V2SI (match_operand:V2HI 1 "register_operand" "0, r,r"))
+ (SE:V2SI (match_operand:V2HI 2 "register_operand" "r, r,r")))
+ (reg:V2SI ARCV2_ACC)))
(set (reg:V2SI ARCV2_ACC)
(plus:V2SI
- (reg:V2SI ARCV2_ACC)
- (mult:V2SI (SE:V2SI (vec_select:V2HI (match_dup 1)
- (parallel [(const_int 2) (const_int 3)])))
- (SE:V2SI (vec_select:V2HI (match_dup 2)
- (parallel [(const_int 2) (const_int 3)]))))))
+ (mult:V2SI (SE:V2SI (match_dup 1))
+ (SE:V2SI (match_dup 2)))
+ (reg:V2SI ARCV2_ACC)))
]
"TARGET_PLUS_MACD"
- "vmac2h<V_US_suffix>%? %0, %R1, %R2"
+ "@
+ vmac2h<V_US_suffix>%?\\t%0,%1,%2
+ vmac2h<V_US_suffix>%?\\t0,%1,%2
+ vmac2h<V_US_suffix>%?\\t%0,%1,%2"
[(set_attr "length" "4")
(set_attr "type" "multi")
- (set_attr "predicable" "yes,no")
- (set_attr "cond" "canuse,nocond")])
+ (set_attr "predicable" "yes,no,no")])
+
+(define_insn "arc_vec_<V_US>mac_v2hiv2si_zero"
+ [(set (reg:V2SI ARCV2_ACC)
+ (plus:V2SI
+ (mult:V2SI (SE:V2SI (match_operand:V2HI 0 "register_operand" "r"))
+ (SE:V2SI (match_operand:V2HI 1 "register_operand" "r")))
+ (reg:V2SI ARCV2_ACC)))]
+ "TARGET_PLUS_MACD"
+ "vmac2h<V_US_suffix>%?\\t0,%0,%1"
+ [(set_attr "length" "4")
+ (set_attr "type" "multi")])
;; Builtins
(define_insn "dmach"
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 33e8015..51e3180 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)
@@ -946,6 +946,9 @@ typedef struct {
#define VAR13(T, N, A, B, C, D, E, F, G, H, I, J, K, L, M) \
VAR12 (T, N, A, B, C, D, E, F, G, H, I, J, K, L) \
VAR1 (T, N, M)
+#define VAR14(T, N, A, B, C, D, E, F, G, H, I, J, K, L, M, O) \
+ VAR13 (T, N, A, B, C, D, E, F, G, H, I, J, K, L, M) \
+ VAR1 (T, N, O)
/* The builtin data can be found in arm_neon_builtins.def, arm_vfp_builtins.def
and arm_acle_builtins.def. The entries in arm_neon_builtins.def require
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 703d616..1ba318a 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -74,7 +74,8 @@ extern bool arm_small_register_classes_for_mode_p (machine_mode);
extern int const_ok_for_arm (HOST_WIDE_INT);
extern int const_ok_for_op (HOST_WIDE_INT, enum rtx_code);
extern int const_ok_for_dimode_op (HOST_WIDE_INT, enum rtx_code);
-extern void thumb1_gen_const_int (rtx, HOST_WIDE_INT);
+extern void thumb1_gen_const_int_rtl (rtx, HOST_WIDE_INT);
+extern void thumb1_gen_const_int_print (rtx, HOST_WIDE_INT);
extern int arm_split_constant (RTX_CODE, machine_mode, rtx,
HOST_WIDE_INT, rtx, rtx, int);
extern int legitimate_pic_operand_p (rtx);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 0b8c5fa..5612d1e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3429,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;
@@ -4527,38 +4528,6 @@ const_ok_for_dimode_op (HOST_WIDE_INT i, enum rtx_code code)
}
}
-/* Emit a sequence of movs/adds/shift to produce a 32-bit constant.
- Avoid generating useless code when one of the bytes is zero. */
-void
-thumb1_gen_const_int (rtx op0, HOST_WIDE_INT op1)
-{
- bool mov_done_p = false;
- int i;
-
- /* Emit upper 3 bytes if needed. */
- for (i = 0; i < 3; i++)
- {
- int byte = (op1 >> (8 * (3 - i))) & 0xff;
-
- if (byte)
- {
- emit_set_insn (op0, mov_done_p
- ? gen_rtx_PLUS (SImode,op0, GEN_INT (byte))
- : GEN_INT (byte));
- mov_done_p = true;
- }
-
- if (mov_done_p)
- emit_set_insn (op0, gen_rtx_ASHIFT (SImode, op0, GEN_INT (8)));
- }
-
- /* Emit lower byte if needed. */
- if (!mov_done_p)
- emit_set_insn (op0, GEN_INT (op1 & 0xff));
- else if (op1 & 0xff)
- emit_set_insn (op0, gen_rtx_PLUS (SImode, op0, GEN_INT (op1 & 0xff)));
-}
-
/* Emit a sequence of insns to handle a large constant.
CODE is the code of the operation required, it can be any of SET, PLUS,
IOR, AND, XOR, MINUS;
@@ -9499,6 +9468,13 @@ thumb_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
|| CONST_DOUBLE_P (x)
|| CONSTANT_ADDRESS_P (x)
|| (TARGET_HAVE_MOVT && GET_CODE (x) == SYMBOL_REF)
+ /* On Thumb-1 without MOVT/MOVW and literal pool disabled,
+ we build the symbol address with upper/lower
+ relocations. */
+ || (TARGET_THUMB1
+ && !label_mentioned_p (x)
+ && arm_valid_symbolic_address_p (x)
+ && arm_disable_literal_pool)
|| flag_pic);
}
@@ -28255,6 +28231,205 @@ arm_internal_label (FILE *stream, const char *prefix, unsigned long labelno)
default_internal_label (stream, prefix, labelno);
}
+/* Define classes to generate code as RTL or output asm to a file.
+ Using templates then allows to use the same code to output code
+ sequences in the two formats. */
+class thumb1_const_rtl
+{
+ public:
+ thumb1_const_rtl (rtx dst) : dst (dst) {}
+
+ void mov (HOST_WIDE_INT val)
+ {
+ emit_set_insn (dst, GEN_INT (val));
+ }
+
+ void add (HOST_WIDE_INT val)
+ {
+ emit_set_insn (dst, gen_rtx_PLUS (SImode, dst, GEN_INT (val)));
+ }
+
+ void ashift (HOST_WIDE_INT shift)
+ {
+ emit_set_insn (dst, gen_rtx_ASHIFT (SImode, dst, GEN_INT (shift)));
+ }
+
+ void neg ()
+ {
+ emit_set_insn (dst, gen_rtx_NEG (SImode, dst));
+ }
+
+ private:
+ rtx dst;
+};
+
+class thumb1_const_print
+{
+ public:
+ thumb1_const_print (FILE *f, int regno)
+ {
+ t_file = f;
+ dst_regname = reg_names[regno];
+ }
+
+ void mov (HOST_WIDE_INT val)
+ {
+ asm_fprintf (t_file, "\tmovs\t%s, #" HOST_WIDE_INT_PRINT_DEC "\n",
+ dst_regname, val);
+ }
+
+ void add (HOST_WIDE_INT val)
+ {
+ asm_fprintf (t_file, "\tadds\t%s, #" HOST_WIDE_INT_PRINT_DEC "\n",
+ dst_regname, val);
+ }
+
+ void ashift (HOST_WIDE_INT shift)
+ {
+ asm_fprintf (t_file, "\tlsls\t%s, #" HOST_WIDE_INT_PRINT_DEC "\n",
+ dst_regname, shift);
+ }
+
+ void neg ()
+ {
+ asm_fprintf (t_file, "\trsbs\t%s, #0\n", dst_regname);
+ }
+
+ private:
+ FILE *t_file;
+ const char *dst_regname;
+};
+
+/* Emit a sequence of movs/adds/shift to produce a 32-bit constant.
+ Avoid generating useless code when one of the bytes is zero. */
+template <class T>
+void
+thumb1_gen_const_int_1 (T dst, HOST_WIDE_INT op1)
+{
+ bool mov_done_p = false;
+ unsigned HOST_WIDE_INT val = op1;
+ int shift = 0;
+ int i;
+
+ gcc_assert (op1 == trunc_int_for_mode (op1, SImode));
+
+ if (val <= 255)
+ {
+ dst.mov (val);
+ return;
+ }
+
+ /* For negative numbers with the first nine bits set, build the
+ opposite of OP1, then negate it, it's generally shorter and not
+ longer. */
+ if ((val & 0xFF800000) == 0xFF800000)
+ {
+ thumb1_gen_const_int_1 (dst, -op1);
+ dst.neg ();
+ return;
+ }
+
+ /* In the general case, we need 7 instructions to build
+ a 32 bits constant (1 movs, 3 lsls, 3 adds). We can
+ do better if VAL is small enough, or
+ right-shiftable by a suitable amount. If the
+ right-shift enables to encode at least one less byte,
+ it's worth it: we save a adds and a lsls at the
+ expense of a final lsls. */
+ int final_shift = number_of_first_bit_set (val);
+
+ int leading_zeroes = clz_hwi (val);
+ int number_of_bytes_needed
+ = ((HOST_BITS_PER_WIDE_INT - 1 - leading_zeroes)
+ / BITS_PER_UNIT) + 1;
+ int number_of_bytes_needed2
+ = ((HOST_BITS_PER_WIDE_INT - 1 - leading_zeroes - final_shift)
+ / BITS_PER_UNIT) + 1;
+
+ if (number_of_bytes_needed2 < number_of_bytes_needed)
+ val >>= final_shift;
+ else
+ final_shift = 0;
+
+ /* If we are in a very small range, we can use either a single movs
+ or movs+adds. */
+ if (val <= 510)
+ {
+ if (val > 255)
+ {
+ unsigned HOST_WIDE_INT high = val - 255;
+
+ dst.mov (high);
+ dst.add (255);
+ }
+ else
+ dst.mov (val);
+
+ if (final_shift > 0)
+ dst.ashift (final_shift);
+ }
+ else
+ {
+ /* General case, emit upper 3 bytes as needed. */
+ for (i = 0; i < 3; i++)
+ {
+ unsigned HOST_WIDE_INT byte = (val >> (8 * (3 - i))) & 0xff;
+
+ if (byte)
+ {
+ /* We are about to emit new bits, stop accumulating a
+ shift amount, and left-shift only if we have already
+ emitted some upper bits. */
+ if (mov_done_p)
+ {
+ dst.ashift (shift);
+ dst.add (byte);
+ }
+ else
+ dst.mov (byte);
+
+ /* Stop accumulating shift amount since we've just
+ emitted some bits. */
+ shift = 0;
+
+ mov_done_p = true;
+ }
+
+ if (mov_done_p)
+ shift += 8;
+ }
+
+ /* Emit lower byte. */
+ if (!mov_done_p)
+ dst.mov (val & 0xff);
+ else
+ {
+ dst.ashift (shift);
+ if (val & 0xff)
+ dst.add (val & 0xff);
+ }
+
+ if (final_shift > 0)
+ dst.ashift (final_shift);
+ }
+}
+
+/* Proxies for thumb1.md, since the thumb1_const_print and
+ thumb1_const_rtl classes are not exported. */
+void
+thumb1_gen_const_int_rtl (rtx dst, HOST_WIDE_INT op1)
+{
+ thumb1_const_rtl t (dst);
+ thumb1_gen_const_int_1 (t, op1);
+}
+
+void
+thumb1_gen_const_int_print (rtx dst, HOST_WIDE_INT op1)
+{
+ thumb1_const_print t (asm_out_file, REGNO (dst));
+ thumb1_gen_const_int_1 (t, op1);
+}
+
/* Output code to add DELTA to the first argument, and then jump
to FUNCTION. Used for C++ multiple inheritance. */
@@ -28353,9 +28528,19 @@ arm_thumb1_mi_thunk (FILE *file, tree, HOST_WIDE_INT delta,
{
if (mi_delta > 255)
{
- fputs ("\tldr\tr3, ", file);
- assemble_name (file, label);
- fputs ("+4\n", file);
+ /* With -mpure-code, we cannot load MI_DELTA from the
+ constant pool: we build it explicitly. */
+ if (target_pure_code)
+ {
+ thumb1_const_print r3 (file, 3);
+ thumb1_gen_const_int_1 (r3, mi_delta);
+ }
+ else
+ {
+ fputs ("\tldr\tr3, ", file);
+ assemble_name (file, label);
+ fputs ("+4\n", file);
+ }
asm_fprintf (file, "\t%ss\t%r, %r, r3\n",
mi_op, this_regno, this_regno);
}
@@ -28391,30 +28576,37 @@ arm_thumb1_mi_thunk (FILE *file, tree, HOST_WIDE_INT delta,
fputs ("\tpop\t{r3}\n", file);
fprintf (file, "\tbx\tr12\n");
- ASM_OUTPUT_ALIGN (file, 2);
- assemble_name (file, label);
- fputs (":\n", file);
- if (flag_pic)
+
+ /* With -mpure-code, we don't need to emit literals for the
+ function address and delta since we emitted code to build
+ them. */
+ if (!target_pure_code)
{
- /* Output ".word .LTHUNKn-[3,7]-.LTHUNKPCn". */
- rtx tem = XEXP (DECL_RTL (function), 0);
- /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC
- pipeline offset is four rather than eight. Adjust the offset
- accordingly. */
- tem = plus_constant (GET_MODE (tem), tem,
- TARGET_THUMB1_ONLY ? -3 : -7);
- tem = gen_rtx_MINUS (GET_MODE (tem),
- tem,
- gen_rtx_SYMBOL_REF (Pmode,
- ggc_strdup (labelpc)));
- assemble_integer (tem, 4, BITS_PER_WORD, 1);
- }
- else
- /* Output ".word .LTHUNKn". */
- assemble_integer (XEXP (DECL_RTL (function), 0), 4, BITS_PER_WORD, 1);
+ ASM_OUTPUT_ALIGN (file, 2);
+ assemble_name (file, label);
+ fputs (":\n", file);
+ if (flag_pic)
+ {
+ /* Output ".word .LTHUNKn-[3,7]-.LTHUNKPCn". */
+ rtx tem = XEXP (DECL_RTL (function), 0);
+ /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC
+ pipeline offset is four rather than eight. Adjust the offset
+ accordingly. */
+ tem = plus_constant (GET_MODE (tem), tem,
+ TARGET_THUMB1_ONLY ? -3 : -7);
+ tem = gen_rtx_MINUS (GET_MODE (tem),
+ tem,
+ gen_rtx_SYMBOL_REF (Pmode,
+ ggc_strdup (labelpc)));
+ assemble_integer (tem, 4, BITS_PER_WORD, 1);
+ }
+ else
+ /* Output ".word .LTHUNKn". */
+ assemble_integer (XEXP (DECL_RTL (function), 0), 4, BITS_PER_WORD, 1);
- if (TARGET_THUMB1_ONLY && mi_delta > 255)
- assemble_integer (GEN_INT(mi_delta), 4, BITS_PER_WORD, 1);
+ if (TARGET_THUMB1_ONLY && mi_delta > 255)
+ assemble_integer (GEN_INT (mi_delta), 4, BITS_PER_WORD, 1);
+ }
}
else
{
@@ -31652,7 +31844,12 @@ arm_emit_coreregs_64bit_shift (enum rtx_code code, rtx out, rtx in,
According to the ARM ELF ABI, the initial addend of REL-type relocations
processing MOVW and MOVT instructions is formed by interpreting the 16-bit
literal field of the instruction as a 16-bit signed value in the range
- -32768 <= A < 32768. */
+ -32768 <= A < 32768.
+
+ In Thumb-1 mode, we use upper/lower relocations which have an 8-bit
+ unsigned range of 0 <= A < 256 as described in the AAELF32
+ relocation handling documentation: REL-type relocations are encoded
+ as unsigned in this case. */
bool
arm_valid_symbolic_address_p (rtx addr)
@@ -31676,7 +31873,12 @@ arm_valid_symbolic_address_p (rtx addr)
xop1 = XEXP (tmp, 1);
if (GET_CODE (xop0) == SYMBOL_REF && CONST_INT_P (xop1))
- return IN_RANGE (INTVAL (xop1), -0x8000, 0x7fff);
+ {
+ if (TARGET_THUMB1 && !TARGET_HAVE_MOVT)
+ return IN_RANGE (INTVAL (xop1), 0, 0xff);
+ else
+ return IN_RANGE (INTVAL (xop1), -0x8000, 0x7fff);
+ }
}
return false;
diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h
index ccdac67..6c0d1e2 100644
--- a/gcc/config/arm/arm_mve.h
+++ b/gcc/config/arm/arm_mve.h
@@ -13956,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
@@ -19128,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
diff --git a/gcc/config/arm/arm_mve_builtins.def b/gcc/config/arm/arm_mve_builtins.def
index ac92818..f38926f 100644
--- a/gcc/config/arm/arm_mve_builtins.def
+++ b/gcc/config/arm/arm_mve_builtins.def
@@ -826,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/arm_neon.h b/gcc/config/arm/arm_neon.h
index aa21730..9569e1a 100644
--- a/gcc/config/arm/arm_neon.h
+++ b/gcc/config/arm/arm_neon.h
@@ -19510,6 +19510,20 @@ vbfmlaltq_laneq_f32 (float32x4_t __r, bfloat16x8_t __a, bfloat16x8_t __b,
}
__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst1_bf16 (bfloat16_t * __a, bfloat16x4_t __b)
+{
+ __builtin_neon_vst1v4bf (__a, __b);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst1q_bf16 (bfloat16_t * __a, bfloat16x8_t __b)
+{
+ __builtin_neon_vst1v8bf (__a, __b);
+}
+
+__extension__ extern __inline void
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vst2_bf16 (bfloat16_t * __ptr, bfloat16x4x2_t __val)
{
@@ -19557,6 +19571,20 @@ vst4q_bf16 (bfloat16_t * __ptr, bfloat16x8x4_t __val)
return __builtin_neon_vst4v8bf (__ptr, __bu.__o);
}
+__extension__ extern __inline bfloat16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld1_bf16 (bfloat16_t const * __ptr)
+{
+ return __builtin_neon_vld1v4bf (__ptr);
+}
+
+__extension__ extern __inline bfloat16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld1q_bf16 (const bfloat16_t * __ptr)
+{
+ return __builtin_neon_vld1v8bf (__ptr);
+}
+
__extension__ extern __inline bfloat16x4x2_t
__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
vld2_bf16 (bfloat16_t const * __ptr)
@@ -19665,6 +19693,144 @@ vld4q_dup_bf16 (const bfloat16_t * __ptr)
return __rv.__i;
}
+__extension__ extern __inline bfloat16x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld1_lane_bf16 (const bfloat16_t * __a, bfloat16x4_t __b, const int __c)
+{
+ return __builtin_neon_vld1_lanev4bf (__a, __b, __c);
+}
+
+__extension__ extern __inline bfloat16x8_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld1q_lane_bf16 (const bfloat16_t * __a, bfloat16x8_t __b, const int __c)
+{
+ return __builtin_neon_vld1_lanev8bf (__a, __b, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst1_lane_bf16 (bfloat16_t * __a, bfloat16x4_t __b, const int __c)
+{
+ __builtin_neon_vst1_lanev4bf (__a, __b, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst1q_lane_bf16 (bfloat16_t * __a, bfloat16x8_t __b, const int __c)
+{
+ __builtin_neon_vst1_lanev8bf (__a, __b, __c);
+}
+
+__extension__ extern __inline bfloat16x4x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld2_lane_bf16 (const bfloat16_t * __a, bfloat16x4x2_t __b, const int __c)
+{
+ union { bfloat16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b };
+ union { bfloat16x4x2_t __i; __builtin_neon_ti __o; } __rv;
+ __rv.__o = __builtin_neon_vld2_lanev4bf ( __a, __bu.__o, __c);
+ return __rv.__i;
+}
+
+__extension__ extern __inline bfloat16x8x2_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld2q_lane_bf16 (const bfloat16_t * __a, bfloat16x8x2_t __b, const int __c)
+{
+ union { bfloat16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b };
+ union { bfloat16x8x2_t __i; __builtin_neon_oi __o; } __rv;
+ __rv.__o = __builtin_neon_vld2_lanev8bf (__a, __bu.__o, __c);
+ return __rv.__i;
+}
+
+__extension__ extern __inline bfloat16x4x3_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld3_lane_bf16 (const bfloat16_t * __a, bfloat16x4x3_t __b, const int __c)
+{
+ union { bfloat16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b };
+ union { bfloat16x4x3_t __i; __builtin_neon_ei __o; } __rv;
+ __rv.__o = __builtin_neon_vld3_lanev4bf (__a, __bu.__o, __c);
+ return __rv.__i;
+}
+
+__extension__ extern __inline bfloat16x8x3_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld3q_lane_bf16 (const bfloat16_t * __a, bfloat16x8x3_t __b, const int __c)
+{
+ union { bfloat16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b };
+ union { bfloat16x8x3_t __i; __builtin_neon_ci __o; } __rv;
+ __rv.__o = __builtin_neon_vld3_lanev8bf (__a, __bu.__o, __c);
+ return __rv.__i;
+}
+
+__extension__ extern __inline bfloat16x4x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld4_lane_bf16 (const bfloat16_t * __a, bfloat16x4x4_t __b, const int __c)
+{
+ union { bfloat16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b };
+ union { bfloat16x4x4_t __i; __builtin_neon_oi __o; } __rv;
+ __rv.__o = __builtin_neon_vld4_lanev4bf (__a,
+ __bu.__o, __c);
+ return __rv.__i;
+}
+
+__extension__ extern __inline bfloat16x8x4_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vld4q_lane_bf16 (const bfloat16_t * __a, bfloat16x8x4_t __b, const int __c)
+{
+ union { bfloat16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b };
+ union { bfloat16x8x4_t __i; __builtin_neon_xi __o; } __rv;
+ __rv.__o = __builtin_neon_vld4_lanev8bf (__a,
+ __bu.__o, __c);
+ return __rv.__i;
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst2_lane_bf16 (bfloat16_t * __a, bfloat16x4x2_t __b, const int __c)
+{
+ union { bfloat16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b };
+ __builtin_neon_vst2_lanev4bf (__a, __bu.__o, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst2q_lane_bf16 (bfloat16_t * __a, bfloat16x8x2_t __b, const int __c)
+{
+ union { bfloat16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b };
+ __builtin_neon_vst2_lanev8bf (__a, __bu.__o, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst3_lane_bf16 (bfloat16_t * __a, bfloat16x4x3_t __b, const int __c)
+{
+ union { bfloat16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b };
+ __builtin_neon_vst3_lanev4bf (__a, __bu.__o, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst3q_lane_bf16 (bfloat16_t * __a, bfloat16x8x3_t __b, const int __c)
+{
+ union { bfloat16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b };
+ __builtin_neon_vst3_lanev8bf (__a, __bu.__o, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst4_lane_bf16 (bfloat16_t * __a, bfloat16x4x4_t __b, const int __c)
+{
+ union { bfloat16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b };
+ __builtin_neon_vst4_lanev4bf (__a, __bu.__o, __c);
+}
+
+__extension__ extern __inline void
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vst4q_lane_bf16 (bfloat16_t * __a, bfloat16x8x4_t __b, const int __c)
+{
+ union { bfloat16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b };
+ __builtin_neon_vst4_lanev8bf (__a, __bu.__o, __c);
+}
+
#pragma GCC pop_options
#ifdef __cplusplus
diff --git a/gcc/config/arm/arm_neon_builtins.def b/gcc/config/arm/arm_neon_builtins.def
index 34c1945..0ff0494 100644
--- a/gcc/config/arm/arm_neon_builtins.def
+++ b/gcc/config/arm/arm_neon_builtins.def
@@ -310,43 +310,45 @@ VAR1 (TERNOP, vtbx1, v8qi)
VAR1 (TERNOP, vtbx2, v8qi)
VAR1 (TERNOP, vtbx3, v8qi)
VAR1 (TERNOP, vtbx4, v8qi)
-VAR12 (LOAD1, vld1,
- v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di)
-VAR10 (LOAD1LANE, vld1_lane,
- v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di)
+VAR14 (LOAD1, vld1,
+ v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di,
+ v4bf, v8bf)
+VAR12 (LOAD1LANE, vld1_lane,
+ v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di, v4bf, v8bf)
VAR10 (LOAD1, vld1_dup,
v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di)
-VAR12 (STORE1, vst1,
- v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di)
-VAR12 (STORE1LANE, vst1_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di)
+VAR14 (STORE1, vst1,
+ v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di,
+ v4bf, v8bf)
+VAR14 (STORE1LANE, vst1_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di, v4bf, v8bf)
VAR13 (LOAD1, vld2,
v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
-VAR9 (LOAD1LANE, vld2_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf)
+VAR11 (LOAD1LANE, vld2_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
VAR8 (LOAD1, vld2_dup, v8qi, v4hi, v4hf, v2si, v2sf, di, v4bf, v8bf)
VAR13 (STORE1, vst2,
v8qi, v4hi, v4hf, v4bf, v2si, v2sf, di, v16qi, v8hi, v8hf, v8bf, v4si, v4sf)
-VAR9 (STORE1LANE, vst2_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf)
+VAR11 (STORE1LANE, vst2_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
VAR13 (LOAD1, vld3,
v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
-VAR9 (LOAD1LANE, vld3_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf)
+VAR11 (LOAD1LANE, vld3_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
VAR8 (LOAD1, vld3_dup, v8qi, v4hi, v4hf, v2si, v2sf, di, v4bf, v8bf)
VAR13 (STORE1, vst3,
v8qi, v4hi, v4hf, v4bf, v2si, v2sf, di, v16qi, v8hi, v8hf, v8bf, v4si, v4sf)
-VAR9 (STORE1LANE, vst3_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf)
+VAR11 (STORE1LANE, vst3_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
VAR13 (LOAD1, vld4,
v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
-VAR9 (LOAD1LANE, vld4_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf)
+VAR11 (LOAD1LANE, vld4_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
VAR8 (LOAD1, vld4_dup, v8qi, v4hi, v4hf, v2si, v2sf, di, v4bf, v8bf)
VAR13 (STORE1, vst4,
v8qi, v4hi, v4hf, v4bf, v2si, v2sf, di, v16qi, v8hi, v8hf, v8bf, v4si, v4sf)
-VAR9 (STORE1LANE, vst4_lane,
- v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf)
+VAR11 (STORE1LANE, vst4_lane,
+ v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf, v4bf, v8bf)
VAR2 (TERNOP, sdot, v8qi, v16qi)
VAR2 (UTERNOP, udot, v8qi, v16qi)
VAR2 (MAC_LANE, sdot_lane, v8qi, v16qi)
diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md
index f934872..592af35 100644
--- a/gcc/config/arm/iterators.md
+++ b/gcc/config/arm/iterators.md
@@ -116,7 +116,7 @@
(define_mode_iterator VQ2BF [V16QI V8HI V8HF (V8BF "TARGET_BF16_SIMD") V4SI V4SF])
;; Quad-width vector modes with 16- or 32-bit elements
-(define_mode_iterator VQ_HS [V8HI V8HF V4SI V4SF])
+(define_mode_iterator VQ_HS [V8HI V8HF V4SI V4SF (V8BF "TARGET_BF16_SIMD")])
;; Quad-width vector modes plus 64-bit elements.
(define_mode_iterator VQX [V16QI V8HI V8HF V8BF V4SI V4SF V2DI])
diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md
index 0d77601..ecbaaa9 100644
--- a/gcc/config/arm/mve.md
+++ b/gcc/config/arm/mve.md
@@ -1329,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.<supf>%#<V_sz_elem>\t%q0, %q1, %q2"
+ "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.%#<V_u_elem>\t%q0, %q1, %q2"
[(set_attr "type" "mve_move")
])
@@ -1389,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")
])
@@ -1551,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])
;;
@@ -1926,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])
;;
@@ -2382,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"
@@ -2442,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"
@@ -2562,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"
@@ -2832,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"
@@ -9700,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")
@@ -9753,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")
@@ -9811,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")
@@ -9864,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")
@@ -9922,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")
@@ -9975,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")
@@ -10028,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 85e424e..2d76769 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -521,28 +521,6 @@
(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")))]
- "ARM_HAVE_NEON_<MODE>_ARITH"
- "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")
@@ -1637,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;
})
@@ -1732,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")))]
- "ARM_HAVE_NEON_<MODE>_ARITH"
- "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")
diff --git a/gcc/config/arm/thumb1.md b/gcc/config/arm/thumb1.md
index b5377a3..56705c9 100644
--- a/gcc/config/arm/thumb1.md
+++ b/gcc/config/arm/thumb1.md
@@ -43,27 +43,6 @@
-(define_insn "thumb1_movsi_symbol_ref"
- [(set (match_operand:SI 0 "register_operand" "=l")
- (match_operand:SI 1 "general_operand" ""))
- ]
- "TARGET_THUMB1
- && arm_disable_literal_pool
- && GET_CODE (operands[1]) == SYMBOL_REF"
- "*
- output_asm_insn (\"movs\\t%0, #:upper8_15:%1\", operands);
- output_asm_insn (\"lsls\\t%0, #8\", operands);
- output_asm_insn (\"adds\\t%0, #:upper0_7:%1\", operands);
- output_asm_insn (\"lsls\\t%0, #8\", operands);
- output_asm_insn (\"adds\\t%0, #:lower8_15:%1\", operands);
- output_asm_insn (\"lsls\\t%0, #8\", operands);
- output_asm_insn (\"adds\\t%0, #:lower0_7:%1\", operands);
- return \"\";
- "
- [(set_attr "length" "14")
- (set_attr "conds" "clob")]
-)
-
(define_insn "*thumb1_adddi3"
[(set (match_operand:DI 0 "register_operand" "=l")
(plus:DI (match_operand:DI 1 "register_operand" "%0")
@@ -696,40 +675,25 @@
case 7:
/* pure-code alternative: build the constant byte by byte,
instead of loading it from a constant pool. */
- {
- int i;
- HOST_WIDE_INT op1 = INTVAL (operands[1]);
- bool mov_done_p = false;
- rtx ops[2];
- ops[0] = operands[0];
+ if (arm_valid_symbolic_address_p (operands[1]))
+ {
+ output_asm_insn (\"movs\\t%0, #:upper8_15:%1\", operands);
+ output_asm_insn (\"lsls\\t%0, #8\", operands);
+ output_asm_insn (\"adds\\t%0, #:upper0_7:%1\", operands);
+ output_asm_insn (\"lsls\\t%0, #8\", operands);
+ output_asm_insn (\"adds\\t%0, #:lower8_15:%1\", operands);
+ output_asm_insn (\"lsls\\t%0, #8\", operands);
+ output_asm_insn (\"adds\\t%0, #:lower0_7:%1\", operands);
+ return \"\";
+ }
+ else if (GET_CODE (operands[1]) == CONST_INT)
+ {
+ thumb1_gen_const_int_print (operands[0], INTVAL (operands[1]));
+ return \"\";
+ }
- /* Emit upper 3 bytes if needed. */
- for (i = 0; i < 3; i++)
- {
- int byte = (op1 >> (8 * (3 - i))) & 0xff;
-
- if (byte)
- {
- ops[1] = GEN_INT (byte);
- if (mov_done_p)
- output_asm_insn ("adds\t%0, %1", ops);
- else
- output_asm_insn ("movs\t%0, %1", ops);
- mov_done_p = true;
- }
-
- if (mov_done_p)
- output_asm_insn ("lsls\t%0, #8", ops);
- }
+ gcc_unreachable ();
- /* Emit lower byte if needed. */
- ops[1] = GEN_INT (op1 & 0xff);
- if (!mov_done_p)
- output_asm_insn ("movs\t%0, %1", ops);
- else if (op1 & 0xff)
- output_asm_insn ("adds\t%0, %1", ops);
- return "";
- }
case 8: return "ldr\t%0, %1";
case 9: return "str\t%1, %0";
case 10: return "mov\t%0, %1";
@@ -740,7 +704,7 @@
(set_attr "pool_range" "*,*,*,*,*,*,*, *,1018,*,*")
(set_attr "arch" "t1,t1,v8mb,t1,t1,t1,t1,t1,t1,t1,t1")
(set_attr "required_for_purecode" "no,no,no,no,no,no,no,yes,no,no,no")
- (set_attr "conds" "set,clob,nocond,*,*,nocond,nocond,nocond,nocond,nocond,nocond")])
+ (set_attr "conds" "set,clob,nocond,*,*,nocond,nocond,clob,nocond,nocond,nocond")])
; Split the load of 64-bit constant into two loads for high and low 32-bit parts respectively
; to see if we can load them in fewer instructions or fewer cycles.
@@ -827,7 +791,7 @@
&& !satisfies_constraint_K (operands[1])"
[(clobber (const_int 0))]
"
- thumb1_gen_const_int (operands[0], INTVAL (operands[1]));
+ thumb1_gen_const_int_rtl (operands[0], INTVAL (operands[1]));
DONE;
"
)
diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md
index c3c86c4..250e503 100644
--- a/gcc/config/arm/vec-common.md
+++ b/gcc/config/arm/vec-common.md
@@ -87,66 +87,47 @@
"ARM_HAVE_<MODE>_ARITH"
)
-;; Vector arithmetic. Expanders are blank, then unnamed insns implement
-;; patterns separately for IWMMXT and Neon.
-
(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/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/darwin-c.c b/gcc/config/darwin-c.c
index e3b999e..9034f49 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -692,10 +692,10 @@ macosx_version_as_macro (void)
if (!version_array)
goto fail;
- if (version_array[MAJOR] != 10)
+ if (version_array[MAJOR] < 10 || version_array[MAJOR] > 11)
goto fail;
- if (version_array[MINOR] < 10)
+ if (version_array[MAJOR] == 10 && version_array[MINOR] < 10)
version_macro = version_as_legacy_macro (version_array);
else
version_macro = version_as_modern_macro (version_array);
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 8fdd32e..8ae3000 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -65,7 +65,7 @@ validate_macosx_version_min (const char *version_str)
major = strtoul (version_str, &end, 10);
version_str = end + ((*end == '.') ? 1 : 0);
- if (major != 10) /* So far .. all MacOS 10 ... */
+ if (major < 10 || major > 11 ) /* MacOS 10 and 11 are known. */
return NULL;
/* Version string components must be present and numeric. */
@@ -104,7 +104,7 @@ validate_macosx_version_min (const char *version_str)
if (need_rewrite)
{
char *new_version;
- asprintf (&new_version, "10.%lu.%lu", minor, tiny);
+ asprintf (&new_version, "%2lu.%lu.%lu", major, minor, tiny);
return new_version;
}
@@ -115,6 +115,12 @@ validate_macosx_version_min (const char *version_str)
#include <sys/sysctl.h>
#include "xregex.h"
+/* Determine the version of the running OS.
+ We only look at the first two components (ignoring the patch one) and
+ report NN.MM.0 where NN is currently either 10 or 11 and MM is the OS
+ minor release number.
+ If we can't parse what the kernel gives us, warn the user, and do nothing. */
+
static char *
darwin_find_version_from_kernel (void)
{
@@ -125,8 +131,6 @@ darwin_find_version_from_kernel (void)
char * version_p;
char * new_flag;
- /* Determine the version of the running OS. If we can't, warn user,
- and do nothing. */
if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
&osversion_len, NULL, 0) == -1)
{
@@ -144,10 +148,11 @@ darwin_find_version_from_kernel (void)
major_vers = major_vers * 10 + (*version_p++ - '0');
if (*version_p++ != '.')
goto parse_failed;
-
- /* The major kernel version number is 4 plus the second OS version
- component. */
- if (major_vers - 4 <= 4)
+
+ /* Darwin20 sees a transition to macOS 11. */
+ if (major_vers >= 20)
+ asprintf (&new_flag, "11.%02d.00", major_vers - 20);
+ else if (major_vers - 4 <= 4)
/* On 10.4 and earlier, the old linker is used which does not
support three-component system versions.
FIXME: we should not assume this - a newer linker could be used. */
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/glibc-d.c b/gcc/config/glibc-d.c
index bdacdac..7eb9e31 100644
--- a/gcc/config/glibc-d.c
+++ b/gcc/config/glibc-d.c
@@ -42,23 +42,7 @@ glibc_d_os_builtins (void)
#endif
}
-/* Implement TARGET_D_CRITSEC_SIZE for Glibc targets. */
-
-static unsigned
-glibc_d_critsec_size (void)
-{
- /* This is the sizeof pthread_mutex_t. */
-#ifdef GNU_USER_TARGET_D_CRITSEC_SIZE
- return GNU_USER_TARGET_D_CRITSEC_SIZE;
-#else
- return (POINTER_SIZE == 64) ? 40 : 24;
-#endif
-}
-
#undef TARGET_D_OS_VERSIONS
#define TARGET_D_OS_VERSIONS glibc_d_os_builtins
-#undef TARGET_D_CRITSEC_SIZE
-#define TARGET_D_CRITSEC_SIZE glibc_d_critsec_size
-
struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
index 0face6c..c862935 100644
--- a/gcc/config/host-darwin.c
+++ b/gcc/config/host-darwin.c
@@ -24,7 +24,10 @@
#include "config/host-darwin.h"
/* Yes, this is really supposed to work. */
-static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096)));
+/* This allows for a pagesize of 16384, which we have on Darwin20, but should
+ continue to work OK for pagesize 4096 which we have on earlier versions.
+ The size is 1 (binary) Gb. */
+static char pch_address_space[65536*16384] __attribute__((aligned (16384)));
/* Return the address of the PCH address space, if the PCH will fit in it. */
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/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/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 4598434..595b423 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)
@@ -118,12 +119,14 @@
#define bit_MOVDIR64B (1 << 28)
#define bit_ENQCMD (1 << 29)
#define bit_CLDEMOTE (1 << 25)
+#define bit_KL (1 << 23)
/* %edx */
#define bit_AVX5124VNNIW (1 << 2)
#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)
@@ -144,6 +147,12 @@
/* %ebx */
#define bit_PTWRITE (1 << 4)
+/* Keylocker leaf (%eax == 0x19) */
+/* %ebx */
+#define bit_AESKLE ( 1<<0 )
+#define bit_WIDEKL ( 1<<2 )
+
+
/* Signatures for different CPU implementations as returned in uses
of cpuid with level 0. */
#define signature_AMD_ebx 0x68747541
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/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..3ca313c 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)
@@ -1285,3 +1290,10 @@ DEF_FUNCTION_TYPE (V8SF, V8SF, V16HI, V16HI)
DEF_FUNCTION_TYPE (V8SF, V8SF, V16HI, V16HI, UQI)
DEF_FUNCTION_TYPE (V4SF, V4SF, V8HI, V8HI)
DEF_FUNCTION_TYPE (V4SF, V4SF, V8HI, V8HI, UQI)
+
+# KEYLOCKER builtins
+DEF_FUNCTION_TYPE (UINT, UINT, V2DI, V2DI, PVOID)
+DEF_FUNCTION_TYPE (UINT, UINT, V2DI, PVOID)
+DEF_FUNCTION_TYPE (VOID, V2DI, V2DI, V2DI, UINT)
+DEF_FUNCTION_TYPE (UINT8, PV2DI, V2DI, PCVOID)
+DEF_FUNCTION_TYPE (UINT8, PV2DI, PCV2DI, PCVOID) \ No newline at end of file
diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def
index fec5cef..4d38cea 100644
--- a/gcc/config/i386/i386-builtin.def
+++ b/gcc/config/i386/i386-builtin.def
@@ -452,6 +452,27 @@ 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)
+
+/* KEYLOCKER */
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_loadiwkey", IX86_BUILTIN_LOADIWKEY, UNKNOWN, (int) VOID_FTYPE_V2DI_V2DI_V2DI_UINT)
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_aesdec128kl_u8", IX86_BUILTIN_AESDEC128KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_V2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_aesdec256kl_u8", IX86_BUILTIN_AESDEC256KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_V2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_aesenc128kl_u8", IX86_BUILTIN_AESENC128KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_V2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_aesenc256kl_u8", IX86_BUILTIN_AESENC256KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_V2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_encodekey128_u32", IX86_BUILTIN_ENCODEKEY128U32, UNKNOWN, (int) UINT_FTYPE_UINT_V2DI_PVOID)
+BDESC (0, OPTION_MASK_ISA2_KL, CODE_FOR_nothing, "__builtin_ia32_encodekey256_u32", IX86_BUILTIN_ENCODEKEY256U32, UNKNOWN, (int) UINT_FTYPE_UINT_V2DI_V2DI_PVOID)
+BDESC (0, OPTION_MASK_ISA2_WIDEKL, CODE_FOR_nothing, "__builtin_ia32_aesdecwide128kl_u8", IX86_BUILTIN_AESDECWIDE128KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_PCV2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_WIDEKL, CODE_FOR_nothing, "__builtin_ia32_aesdecwide256kl_u8", IX86_BUILTIN_AESDECWIDE256KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_PCV2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_WIDEKL, CODE_FOR_nothing, "__builtin_ia32_aesencwide128kl_u8", IX86_BUILTIN_AESENCWIDE128KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_PCV2DI_PCVOID)
+BDESC (0, OPTION_MASK_ISA2_WIDEKL, CODE_FOR_nothing, "__builtin_ia32_aesencwide256kl_u8", IX86_BUILTIN_AESENCWIDE256KLU8, UNKNOWN, (int) UINT8_FTYPE_PV2DI_PCV2DI_PCVOID)
+
BDESC_END (SPECIAL_ARGS, ARGS)
/* Builtins with variable number of arguments. */
@@ -2772,10 +2793,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 +2934,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 e647fce..3299a56 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -598,7 +598,14 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
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 (isa_flag2 & OPTION_MASK_ISA2_KL)
+ def_or_undef (parse_in, "__KL__");
+ if (isa_flag2 & OPTION_MASK_ISA2_WIDEKL)
+ def_or_undef (parse_in, "__WIDEKL__");
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..6f81b58 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);
@@ -7665,6 +7673,85 @@ ix86_expand_set_or_cpymem (rtx dst, rtx src, rtx count_exp, rtx val_exp,
return true;
}
+/* Expand cmpstrn or memcmp. */
+
+bool
+ix86_expand_cmpstrn_or_cmpmem (rtx result, rtx src1, rtx src2,
+ rtx length, rtx align, bool is_cmpstrn)
+{
+ /* Expand strncmp and memcmp only with -minline-all-stringops since
+ "repz cmpsb" can be much slower than strncmp and memcmp functions
+ implemented with vector instructions, see
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
+ */
+ if (!TARGET_INLINE_ALL_STRINGOPS)
+ return false;
+
+ /* Can't use this if the user has appropriated ecx, esi or edi. */
+ if (fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG])
+ return false;
+
+ if (is_cmpstrn)
+ {
+ /* For strncmp, length is the maximum length, which can be larger
+ than actual string lengths. We can expand the cmpstrn pattern
+ to "repz cmpsb" only if one of the strings is a constant so
+ that expand_builtin_strncmp() can write the length argument to
+ be the minimum of the const string length and the actual length
+ argument. Otherwise, "repz cmpsb" may pass the 0 byte. */
+ tree t1 = MEM_EXPR (src1);
+ tree t2 = MEM_EXPR (src2);
+ if (!((t1 && TREE_CODE (t1) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (t1, 0)) == ADDR_EXPR
+ && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (t1, 0), 0))
+ == STRING_CST))
+ || (t2 && TREE_CODE (t2) == MEM_REF
+ && TREE_CODE (TREE_OPERAND (t2, 0)) == ADDR_EXPR
+ && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (t2, 0), 0))
+ == STRING_CST))))
+ return false;
+ }
+
+ rtx addr1 = copy_addr_to_reg (XEXP (src1, 0));
+ rtx addr2 = copy_addr_to_reg (XEXP (src2, 0));
+ if (addr1 != XEXP (src1, 0))
+ src1 = replace_equiv_address_nv (src1, addr1);
+ if (addr2 != XEXP (src2, 0))
+ src2 = replace_equiv_address_nv (src2, addr2);
+
+ /* NB: Make a copy of the data length to avoid changing the original
+ data length by cmpstrnqi patterns. */
+ length = ix86_zero_extend_to_Pmode (length);
+ rtx lengthreg = gen_reg_rtx (Pmode);
+ emit_move_insn (lengthreg, length);
+
+ /* If we are testing strict equality, we can use known alignment to
+ good advantage. This may be possible with combine, particularly
+ once cc0 is dead. */
+ if (CONST_INT_P (length))
+ {
+ if (length == const0_rtx)
+ {
+ emit_move_insn (result, const0_rtx);
+ return true;
+ }
+ emit_insn (gen_cmpstrnqi_nz_1 (addr1, addr2, lengthreg, align,
+ src1, src2));
+ }
+ else
+ {
+ emit_insn (gen_cmp_1 (Pmode, lengthreg, lengthreg));
+ emit_insn (gen_cmpstrnqi_1 (addr1, addr2, lengthreg, align,
+ src1, src2));
+ }
+
+ rtx out = gen_lowpart (QImode, result);
+ emit_insn (gen_cmpintqi (out));
+ emit_move_insn (result, gen_rtx_SIGN_EXTEND (SImode, out));
+
+ return true;
+}
/* Expand the appropriate insns for doing strlen if not just doing
repnz; scasb
@@ -10225,12 +10312,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 +10504,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;
@@ -10974,19 +11066,25 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
== (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A))
&& (isa & (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A)) != 0)
isa |= (OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_3DNOW_A);
+
if (((bisa & (OPTION_MASK_ISA_SSE4_2 | OPTION_MASK_ISA_CRC32))
== (OPTION_MASK_ISA_SSE4_2 | OPTION_MASK_ISA_CRC32))
&& (isa & (OPTION_MASK_ISA_SSE4_2 | OPTION_MASK_ISA_CRC32)) != 0)
isa |= (OPTION_MASK_ISA_SSE4_2 | OPTION_MASK_ISA_CRC32);
+
if (((bisa & (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4))
== (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4))
&& (isa & (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4)) != 0)
isa |= (OPTION_MASK_ISA_FMA | OPTION_MASK_ISA_FMA4);
- if ((bisa & OPTION_MASK_ISA_MMX) && !TARGET_MMX && TARGET_MMX_WITH_SSE)
+
+ if ((bisa & OPTION_MASK_ISA_MMX) && !TARGET_MMX && TARGET_MMX_WITH_SSE
+ /* __builtin_ia32_maskmovq requires MMX registers. */
+ && fcode != IX86_BUILTIN_MASKMOVQ)
{
bisa &= ~OPTION_MASK_ISA_MMX;
bisa |= OPTION_MASK_ISA_SSE2;
}
+
if ((bisa & isa) != bisa || (bisa2 & isa2) != bisa2)
{
bool add_abi_p = bisa & OPTION_MASK_ISA_64BIT;
@@ -11203,6 +11301,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);
@@ -11221,6 +11332,226 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
emit_insn (gen_cldemote (op0));
return 0;
+ case IX86_BUILTIN_LOADIWKEY:
+ {
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ arg1 = CALL_EXPR_ARG (exp, 1);
+ arg2 = CALL_EXPR_ARG (exp, 2);
+ arg3 = CALL_EXPR_ARG (exp, 3);
+
+ op0 = expand_normal (arg0);
+ op1 = expand_normal (arg1);
+ op2 = expand_normal (arg2);
+ op3 = expand_normal (arg3);
+
+ if (!REG_P (op0))
+ op0 = copy_to_mode_reg (V2DImode, op0);
+ if (!REG_P (op1))
+ op1 = copy_to_mode_reg (V2DImode, op1);
+ if (!REG_P (op2))
+ op2 = copy_to_mode_reg (V2DImode, op2);
+ if (!REG_P (op3))
+ op3 = copy_to_mode_reg (SImode, op3);
+
+ emit_insn (gen_loadiwkey (op0, op1, op2, op3));
+
+ return 0;
+ }
+
+ case IX86_BUILTIN_AESDEC128KLU8:
+ icode = CODE_FOR_aesdec128klu8;
+ goto aesdecenc_expand;
+
+ case IX86_BUILTIN_AESDEC256KLU8:
+ icode = CODE_FOR_aesdec256klu8;
+ goto aesdecenc_expand;
+
+ case IX86_BUILTIN_AESENC128KLU8:
+ icode = CODE_FOR_aesenc128klu8;
+ goto aesdecenc_expand;
+
+ case IX86_BUILTIN_AESENC256KLU8:
+ icode = CODE_FOR_aesenc256klu8;
+
+ aesdecenc_expand:
+
+ arg0 = CALL_EXPR_ARG (exp, 0); // __m128i *odata
+ arg1 = CALL_EXPR_ARG (exp, 1); // __m128i idata
+ arg2 = CALL_EXPR_ARG (exp, 2); // const void *p
+
+ op0 = expand_normal (arg0);
+ op1 = expand_normal (arg1);
+ op2 = expand_normal (arg2);
+
+ if (!address_operand (op0, V2DImode))
+ {
+ op0 = convert_memory_address (Pmode, op0);
+ op0 = copy_addr_to_reg (op0);
+ }
+ op0 = gen_rtx_MEM (V2DImode, op0);
+
+ if (!REG_P (op1))
+ op1 = copy_to_mode_reg (V2DImode, op1);
+
+ if (!address_operand (op2, VOIDmode))
+ {
+ op2 = convert_memory_address (Pmode, op2);
+ op2 = copy_addr_to_reg (op2);
+ }
+ op2 = gen_rtx_MEM (BLKmode, op2);
+
+ emit_insn (GEN_FCN (icode) (op1, op1, op2));
+
+ if (target == 0)
+ target = gen_reg_rtx (QImode);
+
+ pat = gen_rtx_EQ (QImode, gen_rtx_REG (CCZmode, FLAGS_REG),
+ const0_rtx);
+ emit_insn (gen_rtx_SET (target, pat));
+
+ emit_insn (gen_rtx_SET (op0, op1));
+
+ return target;
+
+ case IX86_BUILTIN_AESDECWIDE128KLU8:
+ icode = CODE_FOR_aesdecwide128klu8;
+ goto wideaesdecenc_expand;
+
+ case IX86_BUILTIN_AESDECWIDE256KLU8:
+ icode = CODE_FOR_aesdecwide256klu8;
+ goto wideaesdecenc_expand;
+
+ case IX86_BUILTIN_AESENCWIDE128KLU8:
+ icode = CODE_FOR_aesencwide128klu8;
+ goto wideaesdecenc_expand;
+
+ case IX86_BUILTIN_AESENCWIDE256KLU8:
+ icode = CODE_FOR_aesencwide256klu8;
+
+ wideaesdecenc_expand:
+
+ rtx xmm_regs[8];
+ rtx op;
+
+ arg0 = CALL_EXPR_ARG (exp, 0); // __m128i * odata
+ arg1 = CALL_EXPR_ARG (exp, 1); // const __m128i * idata
+ arg2 = CALL_EXPR_ARG (exp, 2); // const void *p
+
+ op0 = expand_normal (arg0);
+ op1 = expand_normal (arg1);
+ op2 = expand_normal (arg2);
+
+ if (!address_operand (op2, VOIDmode))
+ {
+ op2 = convert_memory_address (Pmode, op2);
+ op2 = copy_addr_to_reg (op2);
+ }
+ op2 = gen_rtx_MEM (BLKmode, op2);
+
+ for (i = 0; i < 8; i++)
+ {
+ xmm_regs[i] = gen_rtx_REG (V2DImode, GET_SSE_REGNO (i));
+
+ op = gen_rtx_MEM (V2DImode,
+ plus_constant (Pmode, op1, (i * 16)));
+
+ emit_move_insn (xmm_regs[i], op);
+ }
+
+ emit_insn (GEN_FCN (icode) (op2));
+
+ if (target == 0)
+ target = gen_reg_rtx (QImode);
+
+ pat = gen_rtx_EQ (QImode, gen_rtx_REG (CCZmode, FLAGS_REG),
+ const0_rtx);
+ emit_insn (gen_rtx_SET (target, pat));
+
+ for (i = 0; i < 8; i++)
+ {
+ op = gen_rtx_MEM (V2DImode,
+ plus_constant (Pmode, op0, (i * 16)));
+ emit_move_insn (op, xmm_regs[i]);
+ }
+
+ return target;
+
+ case IX86_BUILTIN_ENCODEKEY128U32:
+ {
+ rtx op, xmm_regs[7];
+
+ arg0 = CALL_EXPR_ARG (exp, 0); // unsigned int htype
+ arg1 = CALL_EXPR_ARG (exp, 1); // __m128i key
+ arg2 = CALL_EXPR_ARG (exp, 2); // void *h
+
+ op0 = expand_normal (arg0);
+ op1 = expand_normal (arg1);
+ op2 = expand_normal (arg2);
+
+ if (!REG_P (op0))
+ op0 = copy_to_mode_reg (SImode, op0);
+
+ op = gen_rtx_REG (V2DImode, GET_SSE_REGNO (0));
+ emit_move_insn (op, op1);
+
+ for (i = 0; i < 3; i++)
+ xmm_regs[i] = gen_rtx_REG (V2DImode, GET_SSE_REGNO (i));
+
+ if (target == 0)
+ target = gen_reg_rtx (SImode);
+
+ emit_insn (gen_encodekey128u32 (target, op0));
+
+ for (i = 0; i < 3; i++)
+ {
+ op = gen_rtx_MEM (V2DImode,
+ plus_constant (Pmode, op2, (i * 16)));
+ emit_move_insn (op, xmm_regs[i]);
+ }
+
+ return target;
+ }
+ case IX86_BUILTIN_ENCODEKEY256U32:
+ {
+ rtx op, xmm_regs[7];
+
+ arg0 = CALL_EXPR_ARG (exp, 0); // unsigned int htype
+ arg1 = CALL_EXPR_ARG (exp, 1); // __m128i keylow
+ arg2 = CALL_EXPR_ARG (exp, 2); // __m128i keyhi
+ arg3 = CALL_EXPR_ARG (exp, 3); // void *h
+
+ op0 = expand_normal (arg0);
+ op1 = expand_normal (arg1);
+ op2 = expand_normal (arg2);
+ op3 = expand_normal (arg3);
+
+ if (!REG_P (op0))
+ op0 = copy_to_mode_reg (SImode, op0);
+
+ /* Force to use xmm0, xmm1 for keylow, keyhi*/
+ op = gen_rtx_REG (V2DImode, GET_SSE_REGNO (0));
+ emit_move_insn (op, op1);
+ op = gen_rtx_REG (V2DImode, GET_SSE_REGNO (1));
+ emit_move_insn (op, op2);
+
+ for (i = 0; i < 4; i++)
+ xmm_regs[i] = gen_rtx_REG (V2DImode, GET_SSE_REGNO (i));
+
+ if (target == 0)
+ target = gen_reg_rtx (SImode);
+
+ emit_insn (gen_encodekey256u32 (target, op0));
+
+ for (i = 0; i < 4; i++)
+ {
+ op = gen_rtx_MEM (V2DImode,
+ plus_constant (Pmode, op3, (i * 16)));
+ emit_move_insn (op, xmm_regs[i]);
+ }
+
+ return target;
+ }
+
case IX86_BUILTIN_VEC_INIT_V2SI:
case IX86_BUILTIN_VEC_INIT_V4HI:
case IX86_BUILTIN_VEC_INIT_V8QI:
@@ -12807,6 +13138,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 a59bd70..4128e93 100644
--- a/gcc/config/i386/i386-options.c
+++ b/gcc/config/i386/i386-options.c
@@ -212,7 +212,11 @@ static struct ix86_target_opts isa2_opts[] =
{ "-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 }
+ { "-mamx-bf16", OPTION_MASK_ISA2_AMX_BF16 },
+ { "-muintr", OPTION_MASK_ISA2_UINTR },
+ { "-mhreset", OPTION_MASK_ISA2_HRESET },
+ { "-mkl", OPTION_MASK_ISA2_KL },
+ { "-mwidekl", OPTION_MASK_ISA2_WIDEKL }
};
static struct ix86_target_opts isa_opts[] =
{
@@ -1031,7 +1035,10 @@ 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 ("kl", OPT_mkl),
+ IX86_ATTR_ISA ("widekl", OPT_mwidekl),
IX86_ATTR_ISA ("avx512bf16", OPT_mavx512bf16),
IX86_ATTR_ISA ("enqcmd", OPT_menqcmd),
IX86_ATTR_ISA ("serialize", OPT_mserialize),
@@ -1039,6 +1046,7 @@ ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
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_),
@@ -1726,7 +1734,7 @@ ix86_recompute_optlev_based_flags (struct gcc_options *opts,
if (opts->x_flag_pcc_struct_return == 2)
{
/* Intel MCU psABI specifies that -freg-struct-return should
- be on. Instead of setting DEFAULT_PCC_STRUCT_RETURN to 1,
+ be on. Instead of setting DEFAULT_PCC_STRUCT_RETURN to 0,
we check -miamcu so that -freg-struct-return is always
turned on if -miamcu is used. */
if (TARGET_IAMCU_P (opts->x_target_flags))
@@ -1899,6 +1907,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)
@@ -2332,6 +2343,12 @@ ix86_option_override_internal (bool main_args_p,
if (((processor_alias_table[i].flags & PTA_TSXLDTRK) != 0)
&& !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_TSXLDTRK))
opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_TSXLDTRK;
+ if (((processor_alias_table[i].flags & PTA_KL) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_KL))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_KL;
+ if (((processor_alias_table[i].flags & PTA_WIDEKL) != 0)
+ && !(opts->x_ix86_isa_flags2_explicit & OPTION_MASK_ISA2_WIDEKL))
+ opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_WIDEKL;
if ((processor_alias_table[i].flags
& (PTA_PREFETCH_SSE | PTA_SSE)) != 0)
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index c5b700e..b70d598 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -26,6 +26,7 @@ extern bool ix86_handle_option (struct gcc_options *opts,
/* Functions in i386.c */
extern bool ix86_target_stack_probe (void);
extern bool ix86_can_use_return_insn_p (void);
+extern bool ix86_function_ms_hook_prologue (const_tree fn);
extern void ix86_setup_frame_addresses (void);
extern bool ix86_rip_relative_addr_p (struct ix86_address *parts);
@@ -71,6 +72,7 @@ extern int avx_vperm2f128_parallel (rtx par, machine_mode mode);
extern bool ix86_expand_strlen (rtx, rtx, rtx, rtx);
extern bool ix86_expand_set_or_cpymem (rtx, rtx, rtx, rtx, rtx, rtx,
rtx, rtx, rtx, rtx, bool);
+extern bool ix86_expand_cmpstrn_or_cmpmem (rtx, rtx, rtx, rtx, rtx, bool);
extern bool constant_address_p (rtx);
extern bool legitimate_pic_operand_p (rtx);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index f684954..4396f64 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -939,6 +939,19 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
decl_or_type = type;
}
+ /* If outgoing reg parm stack space changes, we cannot do sibcall. */
+ if ((OUTGOING_REG_PARM_STACK_SPACE (type)
+ != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl)))
+ || (REG_PARM_STACK_SPACE (decl_or_type)
+ != REG_PARM_STACK_SPACE (current_function_decl)))
+ {
+ maybe_complain_about_tail_call (exp,
+ "inconsistent size of stack space"
+ " allocated for arguments which are"
+ " passed in registers");
+ return false;
+ }
+
/* Check that the return value locations are the same. Like
if we are returning floats on the 80387 register stack, we cannot
make a sibcall from a function that doesn't return a float to a
@@ -1410,23 +1423,15 @@ ix86_function_arg_regno_p (int regno)
enum calling_abi call_abi;
const int *parm_regs;
- if (!TARGET_64BIT)
- {
- if (TARGET_MACHO)
- return (regno < REGPARM_MAX
- || (TARGET_SSE && SSE_REGNO_P (regno) && !fixed_regs[regno]));
- else
- return (regno < REGPARM_MAX
- || (TARGET_MMX && MMX_REGNO_P (regno)
- && (regno < FIRST_MMX_REG + MMX_REGPARM_MAX))
- || (TARGET_SSE && SSE_REGNO_P (regno)
- && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX)));
- }
-
if (TARGET_SSE && SSE_REGNO_P (regno)
- && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX))
+ && regno < FIRST_SSE_REG + SSE_REGPARM_MAX)
return true;
+ if (!TARGET_64BIT)
+ return (regno < REGPARM_MAX
+ || (TARGET_MMX && MMX_REGNO_P (regno)
+ && regno < FIRST_MMX_REG + MMX_REGPARM_MAX));
+
/* TODO: The function should depend on current function ABI but
builtins.c would need updating then. Therefore we use the
default ABI. */
@@ -3551,6 +3556,302 @@ ix86_function_value_regno_p (const unsigned int regno)
return false;
}
+/* Check whether the register REGNO should be zeroed on X86.
+ When ALL_SSE_ZEROED is true, all SSE registers have been zeroed
+ together, no need to zero it again.
+ When NEED_ZERO_MMX is true, MMX registers should be cleared. */
+
+static bool
+zero_call_used_regno_p (const unsigned int regno,
+ bool all_sse_zeroed,
+ bool need_zero_mmx)
+{
+ return GENERAL_REGNO_P (regno)
+ || (!all_sse_zeroed && SSE_REGNO_P (regno))
+ || MASK_REGNO_P (regno)
+ || (need_zero_mmx && MMX_REGNO_P (regno));
+}
+
+/* Return the machine_mode that is used to zero register REGNO. */
+
+static machine_mode
+zero_call_used_regno_mode (const unsigned int regno)
+{
+ /* NB: We only need to zero the lower 32 bits for integer registers
+ and the lower 128 bits for vector registers since destination are
+ zero-extended to the full register width. */
+ if (GENERAL_REGNO_P (regno))
+ return SImode;
+ else if (SSE_REGNO_P (regno))
+ return V4SFmode;
+ else if (MASK_REGNO_P (regno))
+ return HImode;
+ else if (MMX_REGNO_P (regno))
+ return V4HImode;
+ else
+ gcc_unreachable ();
+}
+
+/* Generate a rtx to zero all vector registers together if possible,
+ otherwise, return NULL. */
+
+static rtx
+zero_all_vector_registers (HARD_REG_SET need_zeroed_hardregs)
+{
+ if (!TARGET_AVX)
+ return NULL;
+
+ for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if ((IN_RANGE (regno, FIRST_SSE_REG, LAST_SSE_REG)
+ || (TARGET_64BIT
+ && (REX_SSE_REGNO_P (regno)
+ || (TARGET_AVX512F && EXT_REX_SSE_REGNO_P (regno)))))
+ && !TEST_HARD_REG_BIT (need_zeroed_hardregs, regno))
+ return NULL;
+
+ return gen_avx_vzeroall ();
+}
+
+/* Generate insns to zero all st registers together.
+ Return true when zeroing instructions are generated.
+ Assume the number of st registers that are zeroed is num_of_st,
+ we will emit the following sequence to zero them together:
+ fldz; \
+ fldz; \
+ ...
+ fldz; \
+ fstp %%st(0); \
+ fstp %%st(0); \
+ ...
+ fstp %%st(0);
+ i.e., num_of_st fldz followed by num_of_st fstp to clear the stack
+ mark stack slots empty.
+
+ How to compute the num_of_st:
+ There is no direct mapping from stack registers to hard register
+ numbers. If one stack register needs to be cleared, we don't know
+ where in the stack the value remains. So, if any stack register
+ needs to be cleared, the whole stack should be cleared. However,
+ x87 stack registers that hold the return value should be excluded.
+ x87 returns in the top (two for complex values) register, so
+ num_of_st should be 7/6 when x87 returns, otherwise it will be 8. */
+
+
+static bool
+zero_all_st_registers (HARD_REG_SET need_zeroed_hardregs)
+{
+
+ /* If the FPU is disabled, no need to zero all st registers. */
+ if (! (TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387))
+ return false;
+
+ unsigned int num_of_st = 0;
+ for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if ((STACK_REGNO_P (regno) || MMX_REGNO_P (regno))
+ && TEST_HARD_REG_BIT (need_zeroed_hardregs, regno))
+ {
+ num_of_st++;
+ break;
+ }
+
+ if (num_of_st == 0)
+ return false;
+
+ bool return_with_x87 = false;
+ return_with_x87 = (crtl->return_rtx
+ && (STACK_REG_P (crtl->return_rtx)));
+
+ bool complex_return = false;
+ complex_return = (crtl->return_rtx
+ && COMPLEX_MODE_P (GET_MODE (crtl->return_rtx)));
+
+ if (return_with_x87)
+ if (complex_return)
+ num_of_st = 6;
+ else
+ num_of_st = 7;
+ else
+ num_of_st = 8;
+
+ rtx st_reg = gen_rtx_REG (XFmode, FIRST_STACK_REG);
+ for (unsigned int i = 0; i < num_of_st; i++)
+ emit_insn (gen_rtx_SET (st_reg, CONST0_RTX (XFmode)));
+
+ for (unsigned int i = 0; i < num_of_st; i++)
+ {
+ rtx insn;
+ insn = emit_insn (gen_rtx_SET (st_reg, st_reg));
+ add_reg_note (insn, REG_DEAD, st_reg);
+ }
+ return true;
+}
+
+
+/* When the routine exit in MMX mode, if any ST register needs
+ to be zeroed, we should clear all MMX registers except the
+ RET_MMX_REGNO that holds the return value. */
+static bool
+zero_all_mm_registers (HARD_REG_SET need_zeroed_hardregs,
+ unsigned int ret_mmx_regno)
+{
+ bool need_zero_all_mm = false;
+ for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (STACK_REGNO_P (regno)
+ && TEST_HARD_REG_BIT (need_zeroed_hardregs, regno))
+ {
+ need_zero_all_mm = true;
+ break;
+ }
+
+ if (!need_zero_all_mm)
+ return false;
+
+ rtx zero_mmx = NULL_RTX;
+ machine_mode mode = V4HImode;
+ for (unsigned int regno = FIRST_MMX_REG; regno <= LAST_MMX_REG; regno++)
+ if (regno != ret_mmx_regno)
+ {
+ rtx reg = gen_rtx_REG (mode, regno);
+ if (zero_mmx == NULL_RTX)
+ {
+ zero_mmx = reg;
+ emit_insn (gen_rtx_SET (reg, CONST0_RTX (mode)));
+ }
+ else
+ emit_move_insn (reg, zero_mmx);
+ }
+ return true;
+}
+
+/* TARGET_ZERO_CALL_USED_REGS. */
+/* Generate a sequence of instructions that zero registers specified by
+ NEED_ZEROED_HARDREGS. Return the ZEROED_HARDREGS that are actually
+ zeroed. */
+static HARD_REG_SET
+ix86_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs)
+{
+ HARD_REG_SET zeroed_hardregs;
+ bool all_sse_zeroed = false;
+ bool all_st_zeroed = false;
+ bool all_mm_zeroed = false;
+
+ CLEAR_HARD_REG_SET (zeroed_hardregs);
+
+ /* first, let's see whether we can zero all vector registers together. */
+ rtx zero_all_vec_insn = zero_all_vector_registers (need_zeroed_hardregs);
+ if (zero_all_vec_insn)
+ {
+ emit_insn (zero_all_vec_insn);
+ all_sse_zeroed = true;
+ }
+
+ /* mm/st registers are shared registers set, we should follow the following
+ rules to clear them:
+ MMX exit mode x87 exit mode
+ -------------|----------------------|---------------
+ uses x87 reg | clear all MMX | clear all x87
+ uses MMX reg | clear individual MMX | clear all x87
+ x87 + MMX | clear all MMX | clear all x87
+
+ first, we should decide which mode (MMX mode or x87 mode) the function
+ exit with. */
+
+ bool exit_with_mmx_mode = (crtl->return_rtx
+ && (MMX_REG_P (crtl->return_rtx)));
+
+ if (!exit_with_mmx_mode)
+ /* x87 exit mode, we should zero all st registers together. */
+ {
+ all_st_zeroed = zero_all_st_registers (need_zeroed_hardregs);
+ if (all_st_zeroed)
+ SET_HARD_REG_BIT (zeroed_hardregs, FIRST_STACK_REG);
+ }
+ else
+ /* MMX exit mode, check whether we can zero all mm registers. */
+ {
+ unsigned int exit_mmx_regno = REGNO (crtl->return_rtx);
+ all_mm_zeroed = zero_all_mm_registers (need_zeroed_hardregs,
+ exit_mmx_regno);
+ if (all_mm_zeroed)
+ for (unsigned int regno = FIRST_MMX_REG; regno <= LAST_MMX_REG; regno++)
+ if (regno != exit_mmx_regno)
+ SET_HARD_REG_BIT (zeroed_hardregs, regno);
+ }
+
+ /* Now, generate instructions to zero all the other registers. */
+
+ rtx zero_gpr = NULL_RTX;
+ rtx zero_vector = NULL_RTX;
+ rtx zero_mask = NULL_RTX;
+ rtx zero_mmx = NULL_RTX;
+
+ for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ {
+ if (!TEST_HARD_REG_BIT (need_zeroed_hardregs, regno))
+ continue;
+ if (!zero_call_used_regno_p (regno, all_sse_zeroed,
+ exit_with_mmx_mode && !all_mm_zeroed))
+ continue;
+
+ SET_HARD_REG_BIT (zeroed_hardregs, regno);
+
+ rtx reg, tmp, zero_rtx;
+ machine_mode mode = zero_call_used_regno_mode (regno);
+
+ reg = gen_rtx_REG (mode, regno);
+ zero_rtx = CONST0_RTX (mode);
+
+ if (mode == SImode)
+ if (zero_gpr == NULL_RTX)
+ {
+ zero_gpr = reg;
+ tmp = gen_rtx_SET (reg, zero_rtx);
+ if (!TARGET_USE_MOV0 || optimize_insn_for_size_p ())
+ {
+ rtx clob = gen_rtx_CLOBBER (VOIDmode,
+ gen_rtx_REG (CCmode,
+ FLAGS_REG));
+ tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2,
+ tmp,
+ clob));
+ }
+ emit_insn (tmp);
+ }
+ else
+ emit_move_insn (reg, zero_gpr);
+ else if (mode == V4SFmode)
+ if (zero_vector == NULL_RTX)
+ {
+ zero_vector = reg;
+ tmp = gen_rtx_SET (reg, zero_rtx);
+ emit_insn (tmp);
+ }
+ else
+ emit_move_insn (reg, zero_vector);
+ else if (mode == HImode)
+ if (zero_mask == NULL_RTX)
+ {
+ zero_mask = reg;
+ tmp = gen_rtx_SET (reg, zero_rtx);
+ emit_insn (tmp);
+ }
+ else
+ emit_move_insn (reg, zero_mask);
+ else if (mode == V4HImode)
+ if (zero_mmx == NULL_RTX)
+ {
+ zero_mmx = reg;
+ tmp = gen_rtx_SET (reg, zero_rtx);
+ emit_insn (tmp);
+ }
+ else
+ emit_move_insn (reg, zero_mmx);
+ else
+ gcc_unreachable ();
+ }
+ return zeroed_hardregs;
+}
+
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).
If the precise function being called is known, FUNC is its FUNCTION_DECL;
@@ -3796,9 +4097,6 @@ ix86_libcall_value (machine_mode mode)
static bool
ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
-#ifdef SUBTARGET_RETURN_IN_MEMORY
- return SUBTARGET_RETURN_IN_MEMORY (type, fntype);
-#else
const machine_mode mode = type_natural_mode (type, NULL, true);
HOST_WIDE_INT size;
@@ -3879,7 +4177,6 @@ ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
return false;
}
-#endif
}
@@ -5197,6 +5494,9 @@ symbolic_reference_mentioned_p (rtx op)
bool
ix86_can_use_return_insn_p (void)
{
+ if (ix86_function_ms_hook_prologue (current_function_decl))
+ return false;
+
if (ix86_function_naked (current_function_decl))
return false;
@@ -7851,7 +8151,11 @@ ix86_expand_prologue (void)
rtx static_chain = NULL_RTX;
if (ix86_function_naked (current_function_decl))
- return;
+ {
+ if (flag_stack_usage_info)
+ current_function_static_stack_size = 0;
+ return;
+ }
ix86_finalize_stack_frame_flags ();
@@ -13098,6 +13402,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 +15472,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 +20111,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;
@@ -22096,7 +22481,7 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
|| (clonei->simdlen & (clonei->simdlen - 1)) != 0))
{
warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
- "unsupported simdlen %d", clonei->simdlen);
+ "unsupported simdlen %wd", clonei->simdlen.to_constant ());
return 0;
}
@@ -22201,7 +22586,8 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
clonei->simdlen = clonei->vecsize_int;
else
clonei->simdlen = clonei->vecsize_float;
- clonei->simdlen /= GET_MODE_BITSIZE (TYPE_MODE (base_type));
+ clonei->simdlen = clonei->simdlen
+ / GET_MODE_BITSIZE (TYPE_MODE (base_type));
}
else if (clonei->simdlen > 16)
{
@@ -22223,7 +22609,8 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
if (cnt > (TARGET_64BIT ? 16 : 8))
{
warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
- "unsupported simdlen %d", clonei->simdlen);
+ "unsupported simdlen %wd",
+ clonei->simdlen.to_constant ());
return 0;
}
}
@@ -23229,6 +23616,9 @@ ix86_run_selftests (void)
#undef TARGET_FUNCTION_VALUE_REGNO_P
#define TARGET_FUNCTION_VALUE_REGNO_P ix86_function_value_regno_p
+#undef TARGET_ZERO_CALL_USED_REGS
+#define TARGET_ZERO_CALL_USED_REGS ix86_zero_call_used_regs
+
#undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE ix86_promote_function_mode
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 9a5de6a..5e01fe6 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -209,6 +209,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#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_KL TARGET_ISA2_KL
+#define TARGET_KL_P(x) TARGET_ISA2_KL_P(x)
+#define TARGET_WIDEKL TARGET_ISA2_WIDEKL
+#define TARGET_WIDEKL_P(x) TARGET_ISA2_WIDEKL_P(x)
#define TARGET_LP64 TARGET_ABI_64
#define TARGET_LP64_P(x) TARGET_ABI_64_P(x)
@@ -1268,6 +1276,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
@@ -1938,7 +1950,9 @@ typedef struct ix86_args {
: X86_64_SSE_REGPARM_MAX) \
: X86_32_SSE_REGPARM_MAX)
-#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : (TARGET_MMX ? 3 : 0))
+#define X86_32_MMX_REGPARM_MAX (TARGET_MMX ? (TARGET_MACHO ? 0 : 3) : 0)
+
+#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : X86_32_MMX_REGPARM_MAX)
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction. */
@@ -2475,6 +2489,10 @@ 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_KL (0, HOST_WIDE_INT_1U << 24);
+const wide_int_bitmask PTA_WIDEKL (0, HOST_WIDE_INT_1U << 25);
const wide_int_bitmask PTA_X86_64_BASELINE = PTA_64BIT | PTA_MMX | PTA_SSE
| PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR;
@@ -2485,6 +2503,7 @@ const wide_int_bitmask PTA_X86_64_V3 = PTA_X86_64_V2
| 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;
const wide_int_bitmask PTA_NEHALEM = PTA_CORE2 | PTA_SSE4_1 | PTA_SSE4_2
@@ -2496,8 +2515,7 @@ const wide_int_bitmask PTA_IVYBRIDGE = PTA_SANDYBRIDGE | PTA_FSGSBASE
| PTA_RDRND | PTA_F16C;
const wide_int_bitmask PTA_HASWELL = PTA_IVYBRIDGE | PTA_AVX2 | PTA_BMI
| PTA_BMI2 | PTA_LZCNT | PTA_FMA | PTA_MOVBE | PTA_HLE;
-const wide_int_bitmask PTA_BROADWELL = PTA_HASWELL | PTA_ADX | PTA_PRFCHW
- | PTA_RDSEED;
+const wide_int_bitmask PTA_BROADWELL = PTA_HASWELL | PTA_ADX | PTA_RDSEED;
const wide_int_bitmask PTA_SKYLAKE = PTA_BROADWELL | PTA_AES | PTA_CLFLUSHOPT
| PTA_XSAVEC | PTA_XSAVES | PTA_SGX;
const wide_int_bitmask PTA_SKYLAKE_AVX512 = PTA_SKYLAKE | PTA_AVX512F
@@ -2514,24 +2532,25 @@ const wide_int_bitmask PTA_ICELAKE_CLIENT = PTA_CANNONLAKE | PTA_AVX512VNNI
const wide_int_bitmask PTA_ICELAKE_SERVER = PTA_ICELAKE_CLIENT | PTA_PCONFIG
| PTA_WBNOINVD | PTA_CLWB;
const wide_int_bitmask PTA_TIGERLAKE = PTA_ICELAKE_CLIENT | PTA_MOVDIRI
- | PTA_MOVDIR64B | PTA_CLWB | PTA_AVX512VP2INTERSECT;
+ | PTA_MOVDIR64B | PTA_CLWB | PTA_AVX512VP2INTERSECT | PTA_KL | PTA_WIDEKL;
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_AMX_TILE
- | PTA_AMX_INT8 | PTA_AMX_BF16;
+ | 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 | PTA_KL | PTA_WIDEKL;
const wide_int_bitmask PTA_KNL = PTA_BROADWELL | PTA_AVX512PF | PTA_AVX512ER
- | PTA_AVX512F | PTA_AVX512CD;
+ | PTA_AVX512F | PTA_AVX512CD | PTA_PREFETCHWT1;
const wide_int_bitmask PTA_BONNELL = PTA_CORE2 | PTA_MOVBE;
-const wide_int_bitmask PTA_SILVERMONT = PTA_WESTMERE | PTA_MOVBE | PTA_RDRND;
+const wide_int_bitmask PTA_SILVERMONT = PTA_WESTMERE | PTA_MOVBE | PTA_RDRND
+ | PTA_PRFCHW;
const wide_int_bitmask PTA_GOLDMONT = PTA_SILVERMONT | PTA_AES | PTA_SHA | PTA_XSAVE
| PTA_RDSEED | PTA_XSAVEC | PTA_XSAVES | PTA_CLFLUSHOPT | PTA_XSAVEOPT
| PTA_FSGSBASE;
const wide_int_bitmask PTA_GOLDMONT_PLUS = PTA_GOLDMONT | PTA_RDPID
| PTA_SGX | PTA_PTWRITE;
const wide_int_bitmask PTA_TREMONT = PTA_GOLDMONT_PLUS | PTA_CLWB
- | PTA_GFNI;
+ | PTA_GFNI | PTA_MOVDIRI | PTA_MOVDIR64B | PTA_CLDEMOTE | PTA_WAITPKG;
const wide_int_bitmask PTA_KNM = PTA_KNL | PTA_AVX5124VNNIW
| PTA_AVX5124FMAPS | PTA_AVX512VPOPCNTDQ;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 9dd12cf..979e49d 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -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
@@ -13639,10 +13662,13 @@
;; static chain pointer - the first instruction has to be pushl %esi
;; and it can't be moved around, as we use alternate entry points
;; in that case.
+;; Also disallow for ms_hook_prologue functions which have frame
+;; pointer set up in function label which is correctly handled in
+;; ix86_expand_{prologue|epligoue}() only.
(define_expand "simple_return"
[(simple_return)]
- "!TARGET_SEH && !ix86_static_chain_on_stack"
+ "!TARGET_SEH && !ix86_static_chain_on_stack && !ix86_function_ms_hook_prologue (cfun->decl)"
{
if (crtl->args.pops_args)
{
@@ -13666,7 +13692,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
@@ -18092,6 +18118,22 @@
(const_string "*")))
(set_attr "mode" "QI")])
+(define_expand "cmpmemsi"
+ [(set (match_operand:SI 0 "register_operand" "")
+ (compare:SI (match_operand:BLK 1 "memory_operand" "")
+ (match_operand:BLK 2 "memory_operand" "") ) )
+ (use (match_operand 3 "general_operand"))
+ (use (match_operand 4 "immediate_operand"))]
+ ""
+{
+ if (ix86_expand_cmpstrn_or_cmpmem (operands[0], operands[1],
+ operands[2], operands[3],
+ operands[4], false))
+ DONE;
+ else
+ FAIL;
+})
+
(define_expand "cmpstrnsi"
[(set (match_operand:SI 0 "register_operand")
(compare:SI (match_operand:BLK 1 "general_operand")
@@ -18100,70 +18142,12 @@
(use (match_operand 4 "immediate_operand"))]
""
{
- rtx addr1, addr2, countreg, align, out;
-
- if (optimize_insn_for_size_p () && !TARGET_INLINE_ALL_STRINGOPS)
- FAIL;
-
- /* Can't use this if the user has appropriated ecx, esi or edi. */
- if (fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG])
- FAIL;
-
- /* One of the strings must be a constant. If so, expand_builtin_strncmp()
- will have rewritten the length arg to be the minimum of the const string
- length and the actual length arg. If both strings are the same and
- shorter than the length arg, repz cmpsb will not stop at the 0 byte and
- will incorrectly base the results on chars past the 0 byte. */
- tree t1 = MEM_EXPR (operands[1]);
- tree t2 = MEM_EXPR (operands[2]);
- if (!((t1 && TREE_CODE (t1) == MEM_REF
- && TREE_CODE (TREE_OPERAND (t1, 0)) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (t1, 0), 0)) == STRING_CST)
- || (t2 && TREE_CODE (t2) == MEM_REF
- && TREE_CODE (TREE_OPERAND (t2, 0)) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (t2, 0), 0)) == STRING_CST)))
- FAIL;
-
- addr1 = copy_addr_to_reg (XEXP (operands[1], 0));
- addr2 = copy_addr_to_reg (XEXP (operands[2], 0));
- if (addr1 != XEXP (operands[1], 0))
- operands[1] = replace_equiv_address_nv (operands[1], addr1);
- if (addr2 != XEXP (operands[2], 0))
- operands[2] = replace_equiv_address_nv (operands[2], addr2);
-
- /* NB: Make a copy of the data length to avoid changing the original
- data length by cmpstrnqi patterns. */
- rtx count = ix86_zero_extend_to_Pmode (operands[3]);
- countreg = gen_reg_rtx (Pmode);
- emit_move_insn (countreg, count);
-
- /* %%% Iff we are testing strict equality, we can use known alignment
- to good advantage. This may be possible with combine, particularly
- once cc0 is dead. */
- align = operands[4];
-
- if (CONST_INT_P (operands[3]))
- {
- if (operands[3] == const0_rtx)
- {
- emit_move_insn (operands[0], const0_rtx);
- DONE;
- }
- emit_insn (gen_cmpstrnqi_nz_1 (addr1, addr2, countreg, align,
- operands[1], operands[2]));
- }
+ if (ix86_expand_cmpstrn_or_cmpmem (operands[0], operands[1],
+ operands[2], operands[3],
+ operands[4], true))
+ DONE;
else
- {
- emit_insn (gen_cmp_1 (Pmode, countreg, countreg));
- emit_insn (gen_cmpstrnqi_1 (addr1, addr2, countreg, align,
- operands[1], operands[2]));
- }
-
- out = gen_lowpart (QImode, operands[0]);
- emit_insn (gen_cmpintqi (out));
- emit_move_insn (operands[0], gen_rtx_SIGN_EXTEND (SImode, out));
-
- DONE;
+ FAIL;
})
;; Produce a tri-state integer (-1, 0, 1) from condition codes.
@@ -21571,6 +21555,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 +21667,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 9389dc2..029cacb 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.
@@ -1127,3 +1131,15 @@ 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.
+
+mkl
+Target Report Mask(ISA2_KL) Var(ix86_isa_flags2) Save
+Support KL built-in functions and code generation.
+
+mwidekl
+Target Report Mask(ISA2_WIDEKL) Var(ix86_isa_flags2) Save
+Support WIDEKL built-in functions and code generation.
diff --git a/gcc/config/i386/i386elf.h b/gcc/config/i386/i386elf.h
index eb2203c..05cee89 100644
--- a/gcc/config/i386/i386elf.h
+++ b/gcc/config/i386/i386elf.h
@@ -19,12 +19,12 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-/* The ELF ABI for the i386 says that records and unions are returned
- in memory. */
-
-#define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
- (TYPE_MODE (TYPE) == BLKmode \
- || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
+/* Define DEFAULT_PCC_STRUCT_RETURN to 1 because the i386 SVR4 ABI returns
+ records and unions in memory. ix86_option_override_internal will overide
+ this flag when compiling 64-bit code as we never do pcc_struct_return
+ scheme on x86-64. */
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 1
#undef CPP_SPEC
#define CPP_SPEC ""
@@ -40,56 +40,6 @@ along with GCC; see the file COPYING3. If not see
#define DBX_REGISTER_NUMBER(n) \
(TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
-/* The routine used to output sequences of byte values. We use a special
- version of this for most svr4 targets because doing so makes the
- generated assembly code more compact (and thus faster to assemble)
- as well as more readable. Note that if we find subparts of the
- character sequence which end with NUL (and which are shorter than
- ELF_STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
-
-#undef ASM_OUTPUT_ASCII
-#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
- do \
- { \
- const unsigned char *_ascii_bytes = \
- (const unsigned char *) (STR); \
- const unsigned char *limit = _ascii_bytes + (LENGTH); \
- unsigned bytes_in_chunk = 0; \
- for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
- const unsigned char *p; \
- if (bytes_in_chunk >= 64) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
- continue; \
- if (p < limit && (p - _ascii_bytes) <= (long) ELF_STRING_LIMIT) \
- { \
- if (bytes_in_chunk > 0) \
- { \
- fputc ('\n', (FILE)); \
- bytes_in_chunk = 0; \
- } \
- ASM_OUTPUT_LIMITED_STRING ((FILE), (const char *) _ascii_bytes); \
- _ascii_bytes = p; \
- } \
- else \
- { \
- if (bytes_in_chunk == 0) \
- fputs (ASM_BYTE, (FILE)); \
- else \
- fputc (',', (FILE)); \
- fprintf ((FILE), "0x%02x", *_ascii_bytes); \
- bytes_in_chunk += 5; \
- } \
- } \
- if (bytes_in_chunk > 0) \
- fputc ('\n', (FILE)); \
- } \
- while (0)
-
#define LOCAL_LABEL_PREFIX "."
/* Switch into a generic section. */
diff --git a/gcc/config/i386/immintrin.h b/gcc/config/i386/immintrin.h
index 71eae83..0ce08e5 100644
--- a/gcc/config/i386/immintrin.h
+++ b/gcc/config/i386/immintrin.h
@@ -118,4 +118,6 @@
#include <prfchwintrin.h>
+#include <keylockerintrin.h>
+
#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/keylockerintrin.h b/gcc/config/i386/keylockerintrin.h
new file mode 100644
index 0000000..a5f29fd
--- /dev/null
+++ b/gcc/config/i386/keylockerintrin.h
@@ -0,0 +1,129 @@
+/* Copyright (C) 2018 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 <keylockerintrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+#ifndef _KEYLOCKERINTRIN_H_INCLUDED
+#define _KEYLOCKERINTRIN_H_INCLUDED
+
+#ifndef __KL__
+#pragma GCC push_options
+#pragma GCC target("kl")
+#define __DISABLE_KL__
+#endif /* __KL__ */
+
+
+extern __inline
+void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_loadiwkey (unsigned int __I, __m128i __A, __m128i __B, __m128i __C)
+{
+ __builtin_ia32_loadiwkey ((__v2di) __B, (__v2di) __C, (__v2di) __A, __I);
+}
+
+extern __inline
+unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_encodekey128_u32 (unsigned int __I, __m128i __A, void * __P)
+{
+ return __builtin_ia32_encodekey128_u32 (__I, (__v2di)__A, __P);
+}
+
+extern __inline
+unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_encodekey256_u32 (unsigned int __I, __m128i __A, __m128i __B, void * __P)
+{
+ return __builtin_ia32_encodekey256_u32 (__I, (__v2di)__A, (__v2di)__B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesdec128kl_u8 (__m128i * __A, __m128i __B, const void * __P)
+{
+ return __builtin_ia32_aesdec128kl_u8 ((__v2di *) __A, (__v2di) __B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesdec256kl_u8 (__m128i * __A, __m128i __B, const void * __P)
+{
+ return __builtin_ia32_aesdec256kl_u8 ((__v2di *) __A, (__v2di) __B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesenc128kl_u8 (__m128i * __A, __m128i __B, const void * __P)
+{
+ return __builtin_ia32_aesenc128kl_u8 ((__v2di *) __A, (__v2di) __B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesenc256kl_u8 (__m128i * __A, __m128i __B, const void * __P)
+{
+ return __builtin_ia32_aesenc256kl_u8 ((__v2di *) __A, (__v2di) __B, __P);
+}
+
+#ifdef __DISABLE_KL__
+#undef __DISABLE_KL__
+#pragma GCC pop_options
+#endif /* __DISABLE_KL__ */
+
+#ifndef __WIDEKL__
+#pragma GCC push_options
+#pragma GCC target("widekl")
+#define __DISABLE_WIDEKL__
+#endif /* __WIDEKL__ */
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesdecwide128kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P)
+{
+ return __builtin_ia32_aesdecwide128kl_u8 ((__v2di *) __A, (__v2di *) __B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesdecwide256kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P)
+{
+ return __builtin_ia32_aesdecwide256kl_u8 ((__v2di *) __A, (__v2di *) __B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesencwide128kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P)
+{
+ return __builtin_ia32_aesencwide128kl_u8 ((__v2di *) __A, (__v2di *) __B, __P);
+}
+
+extern __inline
+unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+_mm_aesencwide256kl_u8(__m128i __A[8], const __m128i __B[8], const void * __P)
+{
+ return __builtin_ia32_aesencwide256kl_u8 ((__v2di *) __A, (__v2di *) __B, __P);
+}
+#ifdef __DISABLE_WIDEKL__
+#undef __DISABLE_WIDEKL__
+#pragma GCC pop_options
+#endif /* __DISABLE_WIDEKL__ */
+#endif /* _KEYLOCKERINTRIN_H_INCLUDED */
diff --git a/gcc/config/i386/linux-common.h b/gcc/config/i386/linux-common.h
index 1ae6b3f..982390d 100644
--- a/gcc/config/i386/linux-common.h
+++ b/gcc/config/i386/linux-common.h
@@ -30,9 +30,6 @@ along with GCC; see the file COPYING3. If not see
#define EXTRA_TARGET_D_OS_VERSIONS() \
ANDROID_TARGET_D_OS_VERSIONS();
-#define GNU_USER_TARGET_D_CRITSEC_SIZE \
- (TARGET_64BIT ? (POINTER_SIZE == 64 ? 40 : 32) : 24)
-
#undef CC1_SPEC
#define CC1_SPEC \
LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
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/predicates.md b/gcc/config/i386/predicates.md
index b03f9cd..36f9dfc 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"
@@ -1713,3 +1726,121 @@
}
return (i >= 12 && i <= 18);
})
+
+;; Keylocker specific predicates
+(define_predicate "encodekey128_operation"
+ (match_code "parallel")
+{
+ unsigned i;
+ rtx elt;
+
+ if (XVECLEN (op, 0) != 8)
+ return false;
+
+ for(i = 0; i < 3; i++)
+ {
+ elt = XVECEXP (op, 0, i + 1);
+ if (GET_CODE (elt) != SET
+ || GET_CODE (SET_DEST (elt)) != REG
+ || GET_MODE (SET_DEST (elt)) != V2DImode
+ || REGNO (SET_DEST (elt)) != GET_SSE_REGNO (i)
+ || GET_CODE (SET_SRC (elt)) != UNSPEC_VOLATILE
+ || GET_MODE (SET_SRC (elt)) != V2DImode
+ || XVECLEN(SET_SRC (elt), 0) != 1
+ || XVECEXP(SET_SRC (elt), 0, 0) != const0_rtx)
+ return false;
+ }
+
+ for(i = 4; i < 7; i++)
+ {
+ elt = XVECEXP (op, 0, i);
+ if (GET_CODE (elt) != SET
+ || GET_CODE (SET_DEST (elt)) != REG
+ || GET_MODE (SET_DEST (elt)) != V2DImode
+ || REGNO (SET_DEST (elt)) != GET_SSE_REGNO (i)
+ || SET_SRC (elt) != CONST0_RTX (V2DImode))
+ return false;
+ }
+
+ elt = XVECEXP (op, 0, 7);
+ if (GET_CODE (elt) != CLOBBER
+ || GET_MODE (elt) != VOIDmode
+ || GET_CODE (XEXP (elt, 0)) != REG
+ || GET_MODE (XEXP (elt, 0)) != CCmode
+ || REGNO (XEXP (elt, 0)) != FLAGS_REG)
+ return false;
+ return true;
+})
+
+(define_predicate "encodekey256_operation"
+ (match_code "parallel")
+{
+ unsigned i;
+ rtx elt;
+
+ if (XVECLEN (op, 0) != 9)
+ return false;
+
+ elt = SET_SRC (XVECEXP (op, 0, 0));
+ elt = XVECEXP (elt, 0, 2);
+ if (!REG_P (elt)
+ || REGNO(elt) != GET_SSE_REGNO (1))
+ return false;
+
+ for(i = 0; i < 4; i++)
+ {
+ elt = XVECEXP (op, 0, i + 1);
+ if (GET_CODE (elt) != SET
+ || GET_CODE (SET_DEST (elt)) != REG
+ || GET_MODE (SET_DEST (elt)) != V2DImode
+ || REGNO (SET_DEST (elt)) != GET_SSE_REGNO (i)
+ || GET_CODE (SET_SRC (elt)) != UNSPEC_VOLATILE
+ || GET_MODE (SET_SRC (elt)) != V2DImode
+ || XVECLEN(SET_SRC (elt), 0) != 1
+ || XVECEXP(SET_SRC (elt), 0, 0) != const0_rtx)
+ return false;
+ }
+
+ for(i = 4; i < 7; i++)
+ {
+ elt = XVECEXP (op, 0, i + 1);
+ if (GET_CODE (elt) != SET
+ || GET_CODE (SET_DEST (elt)) != REG
+ || GET_MODE (SET_DEST (elt)) != V2DImode
+ || REGNO (SET_DEST (elt)) != GET_SSE_REGNO (i)
+ || SET_SRC (elt) != CONST0_RTX (V2DImode))
+ return false;
+ }
+
+ elt = XVECEXP (op, 0, 8);
+ if (GET_CODE (elt) != CLOBBER
+ || GET_MODE (elt) != VOIDmode
+ || GET_CODE (XEXP (elt, 0)) != REG
+ || GET_MODE (XEXP (elt, 0)) != CCmode
+ || REGNO (XEXP (elt, 0)) != FLAGS_REG)
+ return false;
+ return true;
+})
+
+
+(define_predicate "aeswidekl_operation"
+ (match_code "parallel")
+{
+ unsigned i;
+ rtx elt;
+
+ for (i = 0; i < 8; i++)
+ {
+ elt = XVECEXP (op, 0, i + 1);
+ if (GET_CODE (elt) != SET
+ || GET_CODE (SET_DEST (elt)) != REG
+ || GET_MODE (SET_DEST (elt)) != V2DImode
+ || REGNO (SET_DEST (elt)) != GET_SSE_REGNO (i)
+ || GET_CODE (SET_SRC (elt)) != UNSPEC_VOLATILE
+ || GET_MODE (SET_SRC (elt)) != V2DImode
+ || XVECLEN (SET_SRC (elt), 0) != 1
+ || REGNO (XVECEXP (SET_SRC (elt), 0, 0)) != GET_SSE_REGNO (i))
+ return false;
+ }
+ return true;
+})
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 934b60a..b153a87 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -205,6 +205,19 @@
UNSPECV_MWAIT
UNSPECV_VZEROALL
UNSPECV_VZEROUPPER
+
+ ;; For KEYLOCKER
+ UNSPECV_LOADIWKEY
+ UNSPECV_AESDEC128KLU8
+ UNSPECV_AESENC128KLU8
+ UNSPECV_AESDEC256KLU8
+ UNSPECV_AESENC256KLU8
+ UNSPECV_AESDECWIDE128KLU8
+ UNSPECV_AESENCWIDE128KLU8
+ UNSPECV_AESDECWIDE256KLU8
+ UNSPECV_AESENCWIDE256KLU8
+ UNSPECV_ENCODEKEY128U32
+ UNSPECV_ENCODEKEY256U32
])
;; All vector modes including V?TImode, used in move patterns.
@@ -1756,8 +1769,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 +1778,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 +1831,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 +1915,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 +2821,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 +4015,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 +4026,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 +4091,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 +4103,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 +4171,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 +4182,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 +4251,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 +4263,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 +6162,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 +6174,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 +6205,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 +6218,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 +11351,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 +11360,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 +11874,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 +11910,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 +11921,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 +12951,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 +13050,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 +13079,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 +13268,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 +18808,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 +18817,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 +18834,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 +18843,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")
@@ -23613,3 +23329,211 @@
(match_operand:<avx512fmaskhalfmode> 4 "register_operand" "Yk")))]
"TARGET_AVX512BF16"
"vdpbf16ps\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}")
+
+;; KEYLOCKER
+(define_insn "loadiwkey"
+ [(unspec_volatile:V2DI [(match_operand:V2DI 0 "register_operand" "v")
+ (match_operand:V2DI 1 "register_operand" "v")
+ (match_operand:V2DI 2 "register_operand" "Yz")
+ (match_operand:SI 3 "register_operand" "a")]
+ UNSPECV_LOADIWKEY)
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_KL"
+ "loadiwkey\t{%0, %1|%1, %0}"
+ [(set_attr "type" "other")])
+
+(define_expand "encodekey128u32"
+ [(match_par_dup 2
+ [(set (match_operand:SI 0 "register_operand")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand")
+ (reg:V2DI XMM0_REG)]
+ UNSPECV_ENCODEKEY128U32))])]
+ "TARGET_KL"
+{
+ rtx xmm_regs[7];
+ rtx tmp_unspec;
+ unsigned i;
+
+ /* parallel rtx for encodekey128 predicate */
+ operands[2] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (8));
+
+ for (i = 0; i < 7; i++)
+ xmm_regs[i] = gen_rtx_REG (V2DImode, GET_SSE_REGNO (i));
+
+ tmp_unspec
+ = gen_rtx_UNSPEC_VOLATILE (SImode,
+ gen_rtvec (2, operands[1], xmm_regs[0]),
+ UNSPECV_ENCODEKEY128U32);
+
+ XVECEXP (operands[2], 0, 0)
+ = gen_rtx_SET (operands[0], tmp_unspec);
+
+ tmp_unspec
+ = gen_rtx_UNSPEC_VOLATILE (V2DImode,
+ gen_rtvec (1, const0_rtx),
+ UNSPECV_ENCODEKEY128U32);
+
+ for (i = 0; i < 3; i++)
+ XVECEXP (operands[2], 0, i + 1)
+ = gen_rtx_SET (xmm_regs[i], tmp_unspec);
+
+ for (i = 4; i < 7; i++)
+ XVECEXP (operands[2], 0, i)
+ = gen_rtx_SET (xmm_regs[i], CONST0_RTX (V2DImode));
+
+ XVECEXP (operands[2], 0, 7)
+ = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
+})
+
+(define_insn "*encodekey128u32"
+ [(match_parallel 2 "encodekey128_operation"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "r")
+ (reg:V2DI XMM0_REG)]
+ UNSPECV_ENCODEKEY128U32))])]
+ "TARGET_KL"
+ "encodekey128\t{%1, %0|%0, %1}"
+ [(set_attr "type" "other")])
+
+(define_expand "encodekey256u32"
+ [(match_par_dup 2
+ [(set (match_operand:SI 0 "register_operand")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand")
+ (reg:V2DI XMM0_REG)
+ (reg:V2DI XMM1_REG)]
+ UNSPECV_ENCODEKEY256U32))])]
+ "TARGET_KL"
+{
+ rtx xmm_regs[7];
+ rtx tmp_unspec;
+ unsigned i;
+
+ /* parallel rtx for encodekey256 predicate */
+ operands[2] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (9));
+
+ for (i = 0; i < 7; i++)
+ xmm_regs[i] = gen_rtx_REG (V2DImode, GET_SSE_REGNO (i));
+
+ tmp_unspec
+ = gen_rtx_UNSPEC_VOLATILE (SImode,
+ gen_rtvec (3, operands[1],
+ xmm_regs[0], xmm_regs[1]),
+ UNSPECV_ENCODEKEY256U32);
+
+ XVECEXP (operands[2], 0, 0)
+ = gen_rtx_SET (operands[0], tmp_unspec);
+
+ tmp_unspec
+ = gen_rtx_UNSPEC_VOLATILE (V2DImode,
+ gen_rtvec (1, const0_rtx),
+ UNSPECV_ENCODEKEY256U32);
+
+ for (i = 0; i < 4; i++)
+ XVECEXP (operands[2], 0, i + 1)
+ = gen_rtx_SET (xmm_regs[i], tmp_unspec);
+
+ for (i = 4; i < 7; i++)
+ XVECEXP (operands[2], 0, i + 1)
+ = gen_rtx_SET (xmm_regs[i], CONST0_RTX (V2DImode));
+
+ XVECEXP (operands[2], 0, 8)
+ = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
+})
+
+(define_insn "*encodekey256u32"
+ [(match_parallel 2 "encodekey256_operation"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (unspec_volatile:SI
+ [(match_operand:SI 1 "register_operand" "r")
+ (reg:V2DI XMM0_REG)
+ (reg:V2DI XMM1_REG)]
+ UNSPECV_ENCODEKEY256U32))])]
+ "TARGET_KL"
+ "encodekey256\t{%1, %0|%0, %1}"
+ [(set_attr "type" "other")])
+
+(define_int_iterator AESDECENCKL
+ [UNSPECV_AESDEC128KLU8 UNSPECV_AESDEC256KLU8
+ UNSPECV_AESENC128KLU8 UNSPECV_AESENC256KLU8])
+
+(define_int_attr aesklvariant
+ [(UNSPECV_AESDEC128KLU8 "dec128kl")
+ (UNSPECV_AESDEC256KLU8 "dec256kl")
+ (UNSPECV_AESENC128KLU8 "enc128kl")
+ (UNSPECV_AESENC256KLU8 "enc256kl")])
+
+(define_insn "aes<aesklvariant>u8"
+ [(set (match_operand:V2DI 0 "register_operand" "=v")
+ (unspec_volatile:V2DI [(match_operand:V2DI 1 "register_operand" "0")
+ (match_operand:BLK 2 "memory_operand" "m")]
+ AESDECENCKL))
+ (set (reg:CCZ FLAGS_REG)
+ (unspec_volatile:CCZ [(match_dup 1) (match_dup 2)] AESDECENCKL))]
+ "TARGET_KL"
+ "aes<aesklvariant>\t{%2, %0|%0, %2}"
+ [(set_attr "type" "other")])
+
+(define_int_iterator AESDECENCWIDEKL
+ [UNSPECV_AESDECWIDE128KLU8 UNSPECV_AESDECWIDE256KLU8
+ UNSPECV_AESENCWIDE128KLU8 UNSPECV_AESENCWIDE256KLU8])
+
+(define_int_attr aeswideklvariant
+ [(UNSPECV_AESDECWIDE128KLU8 "decwide128kl")
+ (UNSPECV_AESDECWIDE256KLU8 "decwide256kl")
+ (UNSPECV_AESENCWIDE128KLU8 "encwide128kl")
+ (UNSPECV_AESENCWIDE256KLU8 "encwide256kl")])
+
+(define_int_attr AESWIDEKLVARIANT
+ [(UNSPECV_AESDECWIDE128KLU8 "AESDECWIDE128KLU8")
+ (UNSPECV_AESDECWIDE256KLU8 "AESDECWIDE256KLU8")
+ (UNSPECV_AESENCWIDE128KLU8 "AESENCWIDE128KLU8")
+ (UNSPECV_AESENCWIDE256KLU8 "AESENCWIDE256KLU8")])
+
+(define_expand "aes<aeswideklvariant>u8"
+ [(match_par_dup 1
+ [(set (reg:CCZ FLAGS_REG)
+ (unspec_volatile:CCZ
+ [(match_operand:BLK 0 "memory_operand")]
+ AESDECENCWIDEKL))])]
+ "TARGET_WIDEKL"
+{
+ rtx tmp_unspec;
+ unsigned i;
+
+ /* parallel rtx for widekl predicate */
+ operands[1] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (9));
+
+ tmp_unspec
+ = gen_rtx_UNSPEC_VOLATILE (CCZmode,
+ gen_rtvec (1, operands[0]),
+ UNSPECV_<AESWIDEKLVARIANT>);
+
+ XVECEXP (operands[1], 0, 0)
+ = gen_rtx_SET (gen_rtx_REG (CCZmode, FLAGS_REG),
+ tmp_unspec);
+
+ for (i = 0; i < 8; i++)
+ {
+ rtx xmm_reg = gen_rtx_REG (V2DImode, GET_SSE_REGNO (i));
+
+ tmp_unspec
+ = gen_rtx_UNSPEC_VOLATILE (V2DImode,
+ gen_rtvec (1, xmm_reg),
+ UNSPECV_<AESWIDEKLVARIANT>);
+ XVECEXP (operands[1], 0, i + 1)
+ = gen_rtx_SET (xmm_reg, tmp_unspec);
+ }
+})
+
+(define_insn "*aes<aeswideklvariant>u8"
+ [(match_parallel 1 "aeswidekl_operation"
+ [(set (reg:CCZ FLAGS_REG)
+ (unspec_volatile:CCZ
+ [(match_operand:BLK 0 "memory_operand" "m")]
+ AESDECENCWIDEKL))])]
+ "TARGET_WIDEKL"
+ "aes<aeswideklvariant>\t{%0}"
+ [(set_attr "type" "other")])
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-vxworks b/gcc/config/i386/t-vxworks
index c440b1f..8f5e8c7 100644
--- a/gcc/config/i386/t-vxworks
+++ b/gcc/config/i386/t-vxworks
@@ -1,8 +1,19 @@
# Multilibs for VxWorks.
-# Build multilibs for normal, -mrtp, and -mrtp -fPIC.
-MULTILIB_OPTIONS = mrtp fPIC
-MULTILIB_DIRNAMES =
+# The common variant across the board is for -mrtp
+MULTILIB_OPTIONS = mrtp
+MULTILIB_DIRNAMES = mrtp
+
+# Then variants for the "large" code model on x86_64, or fPIC on x86,
+# RTP only. -fPIC -mrtp -mcmodel=large is not functional yet.
+ifneq (,$(findstring x86_64, $(target)))
+MULTILIB_OPTIONS += mcmodel=large
+MULTILIB_DIRNAMES += large
+else
+MULTILIB_OPTIONS += fPIC
+MULTILIB_DIRNAMES += fPIC
MULTILIB_MATCHES = fPIC=fpic
-MULTILIB_EXCEPTIONS = fPIC
+# -fPIC is only supported in combination with -mrtp
+MULTILIB_EXCEPTIONS = fPIC
+endif
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/vxworks.h b/gcc/config/i386/vxworks.h
index ad9404b..891b4ff 100644
--- a/gcc/config/i386/vxworks.h
+++ b/gcc/config/i386/vxworks.h
@@ -18,12 +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/>. */
+/* VxWorks after 7 SR0600 use the ELF ABI and the system environment is llvm
+ based. Earlier versions have GNU based environment components and use the
+ same ABI as Solaris 2. */
+
+#if TARGET_VXWORKS7
+
+#undef VXWORKS_PERSONALITY
+#define VXWORKS_PERSONALITY "llvm"
+
+#else
+
#undef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-/* VxWorks uses the same ABI as Solaris 2, so use i386/sol2.h version. */
-
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
@@ -41,43 +50,73 @@ along with GCC; see the file COPYING3. If not see
#undef SIZE_TYPE
#define SIZE_TYPE (TARGET_LP64 ? "long unsigned int" : "unsigned int")
+/* We cannot use PC-relative accesses for VxWorks PIC because there is no
+ fixed gap between segments. */
+#undef ASM_PREFERRED_EH_DATA_FORMAT
+
#if TARGET_64BIT_DEFAULT
#undef VXWORKS_SYSCALL_LIBS_RTP
#define VXWORKS_SYSCALL_LIBS_RTP "-lsyscall"
#endif
+#endif
+
+/* CPU macro definitions, ordered to account for VxWorks 7 not
+ supporting CPUs older than PENTIUM4 since SR0650. */
+
+#define VX_CPUDEF(CPU) builtin_define(VX_CPU_PREFIX "CPU=" #CPU)
+#define VX_CPUVDEF(CPU) builtin_define(VX_CPU_PREFIX "CPU_VARIANT=" #CPU)
+
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
VXWORKS_OS_CPP_BUILTINS (); \
- if (TARGET_386) \
- builtin_define ("CPU=I80386"); \
+ if (TARGET_64BIT) \
+ VX_CPUDEF (X86_64); \
+ else if (TARGET_PENTIUM4) \
+ { \
+ VX_CPUDEF (PENTIUM4); \
+ VX_CPUVDEF (PENTIUM4); \
+ } \
+ else if (TARGET_CORE2) \
+ VX_CPUDEF (CORE2); \
+ else if (TARGET_NEHALEM) \
+ VX_CPUDEF (NEHALEM); \
+ else if (TARGET_SANDYBRIDGE) \
+ VX_CPUDEF (SANDYBRIDGE); \
+ else if (TARGET_HASWELL) \
+ VX_CPUDEF (HASWELL); \
+ else if (TARGET_SILVERMONT) \
+ VX_CPUDEF (SILVERMONT); \
+ else if (TARGET_SKYLAKE || TARGET_SKYLAKE_AVX512) \
+ VX_CPUDEF (SKYLAKE); \
+ else if (TARGET_GOLDMONT) \
+ VX_CPUDEF (GOLDMONT); \
+ else if (TARGET_VXWORKS7) \
+ VX_CPUDEF (PENTIUM4); \
+ else if (TARGET_386) \
+ VX_CPUDEF (I80386); \
else if (TARGET_486) \
- builtin_define ("CPU=I80486"); \
+ VX_CPUDEF (I80486); \
else if (TARGET_PENTIUM) \
- { \
- builtin_define ("CPU=PENTIUM"); \
- builtin_define ("CPU_VARIANT=PENTIUM"); \
- } \
+ { \
+ VX_CPUDEF (PENTIUM); \
+ VX_CPUVDEF (PENTIUM); \
+ } \
else if (TARGET_PENTIUMPRO) \
- { \
- builtin_define ("CPU=PENTIUM2"); \
- builtin_define ("CPU_VARIANT=PENTIUMPRO"); \
- } \
- else if (TARGET_PENTIUM4) \
- { \
- builtin_define ("CPU=PENTIUM4"); \
- builtin_define ("CPU_VARIANT=PENTIUM4"); \
- } \
- else if (TARGET_64BIT) \
- builtin_define ("CPU=X86_64"); \
+ { \
+ VX_CPUDEF (PENTIUM2); \
+ VX_CPUVDEF (PENTIUMPRO); \
+ } \
else \
- builtin_define ("CPU=I80386"); \
- } \
+ VX_CPUDEF (I80386); \
+ } \
while (0)
#undef CPP_SPEC
#define CPP_SPEC VXWORKS_ADDITIONAL_CPP_SPEC
+#undef CC1_SPEC
+#define CC1_SPEC VXWORKS_CC1_SPEC
#undef LIB_SPEC
#define LIB_SPEC VXWORKS_LIB_SPEC
#undef STARTFILE_SPEC
@@ -97,18 +136,11 @@ along with GCC; see the file COPYING3. If not see
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)
-/* We cannot use PC-relative accesses for VxWorks PIC because there is no
- fixed gap between segments. */
-#undef ASM_PREFERRED_EH_DATA_FORMAT
-
/* Define this to be nonzero if static stack checking is supported. */
#define STACK_CHECK_STATIC_BUILTIN 1
/* This platform supports the probing method of stack checking (RTP mode).
- 8K is reserved in the stack to propagate exceptions in case of overflow.
+ 8K is reserved in the stack to propagate exceptions in case of overflow.
On 64-bit targets, we double that size. */
-#if TARGET_64BIT_DEFAULT
-#define STACK_CHECK_PROTECT 16384
-#else
-#define STACK_CHECK_PROTECT 8192
-#endif
+
+#define STACK_CHECK_PROTECT (TARGET_64BIT_DEFAULT ? 16 * 1024 : 8 * 1024)
diff --git a/gcc/config/i386/x86gprintrin.h b/gcc/config/i386/x86gprintrin.h
index ecfb1c0..ffe07e4 100644
--- a/gcc/config/i386/x86gprintrin.h
+++ b/gcc/config/i386/x86gprintrin.h
@@ -76,6 +76,8 @@
#include <tsxldtrkintrin.h>
+#include <uintrintrin.h>
+
#include <waitpkgintrin.h>
#include <wbnoinvdintrin.h>
@@ -90,6 +92,8 @@
#include <xtestintrin.h>
+#include <hresetintrin.h>
+
extern __inline void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_wbinvd (void)
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.opt b/gcc/config/nvptx/nvptx.opt
index 3845422..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)
diff --git a/gcc/config/riscv/multilib-generator b/gcc/config/riscv/multilib-generator
index 8f4df18..0d9ebcb 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,105 @@ 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('-')
+ try:
+ (arch, abi, extra, ext) = cfg.split('-')
+ except:
+ print ("Invalid configure string %s, <arch>-<abi>-<extra>-<extensions>\n"
+ "<extra> and <extensions> can be empty, "
+ "e.g. rv32imafd-ilp32--" % cfg)
+ sys.exit(1)
+
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-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/riscv/t-withmultilib-generator b/gcc/config/riscv/t-withmultilib-generator
new file mode 100644
index 0000000..1a35cc0b
--- /dev/null
+++ b/gcc/config/riscv/t-withmultilib-generator
@@ -0,0 +1,2 @@
+# t-multilib-config will generated in build folder by configure script.
+include t-multilib-config
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index 8a2dcda..e1884f5 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
@@ -494,8 +497,33 @@
#define vec_xlx __builtin_vec_vextulx
#define vec_xrx __builtin_vec_vexturx
+
#endif
+/* BCD builtins, map ABI builtin name to existing builtin name. */
+#define __builtin_bcdadd __builtin_vec_bcdadd
+#define __builtin_bcdadd_lt __builtin_vec_bcdadd_lt
+#define __builtin_bcdadd_eq __builtin_vec_bcdadd_eq
+#define __builtin_bcdadd_gt __builtin_vec_bcdadd_gt
+#define __builtin_bcdadd_ofl __builtin_vec_bcdadd_ov
+#define __builtin_bcdadd_ov __builtin_vec_bcdadd_ov
+#define __builtin_bcdsub __builtin_vec_bcdsub
+#define __builtin_bcdsub_lt __builtin_vec_bcdsub_lt
+#define __builtin_bcdsub_eq __builtin_vec_bcdsub_eq
+#define __builtin_bcdsub_gt __builtin_vec_bcdsub_gt
+#define __builtin_bcdsub_ofl __builtin_vec_bcdsub_ov
+#define __builtin_bcdsub_ov __builtin_vec_bcdsub_ov
+#define __builtin_bcdinvalid __builtin_vec_bcdinvalid
+#define __builtin_bcdmul10 __builtin_vec_bcdmul10
+#define __builtin_bcddiv10 __builtin_vec_bcddiv10
+#define __builtin_bcd2dfp __builtin_vec_denb2dfp
+#define __builtin_bcdcmpeq(a,b) __builtin_vec_bcdsub_eq(a,b,0)
+#define __builtin_bcdcmpgt(a,b) __builtin_vec_bcdsub_gt(a,b,0)
+#define __builtin_bcdcmplt(a,b) __builtin_vec_bcdsub_lt(a,b,0)
+#define __builtin_bcdcmpge(a,b) __builtin_vec_bcdsub_ge(a,b,0)
+#define __builtin_bcdcmple(a,b) __builtin_vec_bcdsub_le(a,b,0)
+
+
/* Predicates.
For C++, we use templates in order to allow non-parenthesized arguments.
For C, instead, we use macros since non-parenthesized arguments were
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 0a2e634..6a6ce0f 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -160,6 +160,7 @@
UNSPEC_BCDADD
UNSPEC_BCDSUB
UNSPEC_BCD_OVERFLOW
+ UNSPEC_BCDSHIFT
UNSPEC_VRLMI
UNSPEC_VRLNM
UNSPEC_VCFUGED
@@ -4410,12 +4411,13 @@
(define_int_attr bcd_add_sub [(UNSPEC_BCDADD "add")
(UNSPEC_BCDSUB "sub")])
-(define_code_iterator BCD_TEST [eq lt gt unordered])
+(define_code_iterator BCD_TEST [eq lt le gt ge unordered])
+(define_mode_iterator VBCD [V1TI V16QI])
-(define_insn "bcd<bcd_add_sub>"
- [(set (match_operand:V1TI 0 "gpc_reg_operand" "=v")
- (unspec:V1TI [(match_operand:V1TI 1 "gpc_reg_operand" "v")
- (match_operand:V1TI 2 "gpc_reg_operand" "v")
+(define_insn "bcd<bcd_add_sub>_<mode>"
+ [(set (match_operand:VBCD 0 "register_operand" "=v")
+ (unspec:VBCD [(match_operand:VBCD 1 "register_operand" "v")
+ (match_operand:VBCD 2 "register_operand" "v")
(match_operand:QI 3 "const_0_to_1_operand" "n")]
UNSPEC_BCD_ADD_SUB))
(clobber (reg:CCFP CR6_REGNO))]
@@ -4428,23 +4430,23 @@
;; UNORDERED test on an integer type (like V1TImode) is not defined. The type
;; probably should be one that can go in the VMX (Altivec) registers, so we
;; can't use DDmode or DFmode.
-(define_insn "*bcd<bcd_add_sub>_test"
+(define_insn "*bcd<bcd_add_sub>_test_<mode>"
[(set (reg:CCFP CR6_REGNO)
(compare:CCFP
- (unspec:V2DF [(match_operand:V1TI 1 "register_operand" "v")
- (match_operand:V1TI 2 "register_operand" "v")
+ (unspec:V2DF [(match_operand:VBCD 1 "register_operand" "v")
+ (match_operand:VBCD 2 "register_operand" "v")
(match_operand:QI 3 "const_0_to_1_operand" "i")]
UNSPEC_BCD_ADD_SUB)
(match_operand:V2DF 4 "zero_constant" "j")))
- (clobber (match_scratch:V1TI 0 "=v"))]
+ (clobber (match_scratch:VBCD 0 "=v"))]
"TARGET_P8_VECTOR"
"bcd<bcd_add_sub>. %0,%1,%2,%3"
[(set_attr "type" "vecsimple")])
-(define_insn "*bcd<bcd_add_sub>_test2"
- [(set (match_operand:V1TI 0 "register_operand" "=v")
- (unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v")
- (match_operand:V1TI 2 "register_operand" "v")
+(define_insn "*bcd<bcd_add_sub>_test2_<mode>"
+ [(set (match_operand:VBCD 0 "register_operand" "=v")
+ (unspec:VBCD [(match_operand:VBCD 1 "register_operand" "v")
+ (match_operand:VBCD 2 "register_operand" "v")
(match_operand:QI 3 "const_0_to_1_operand" "i")]
UNSPEC_BCD_ADD_SUB))
(set (reg:CCFP CR6_REGNO)
@@ -4540,15 +4542,15 @@
}
[(set_attr "type" "vecsimple")])
-(define_expand "bcd<bcd_add_sub>_<code>"
+(define_expand "bcd<bcd_add_sub>_<code>_<mode>"
[(parallel [(set (reg:CCFP CR6_REGNO)
(compare:CCFP
- (unspec:V2DF [(match_operand:V1TI 1 "register_operand")
- (match_operand:V1TI 2 "register_operand")
+ (unspec:V2DF [(match_operand:VBCD 1 "register_operand")
+ (match_operand:VBCD 2 "register_operand")
(match_operand:QI 3 "const_0_to_1_operand")]
UNSPEC_BCD_ADD_SUB)
(match_dup 4)))
- (clobber (match_scratch:V1TI 5))])
+ (clobber (match_scratch:VBCD 5))])
(set (match_operand:SI 0 "register_operand")
(BCD_TEST:SI (reg:CCFP CR6_REGNO)
(const_int 0)))]
@@ -4557,6 +4559,74 @@
operands[4] = CONST0_RTX (V2DFmode);
})
+(define_insn "*bcdinvalid_<mode>"
+ [(set (reg:CCFP CR6_REGNO)
+ (compare:CCFP
+ (unspec:V2DF [(match_operand:VBCD 1 "register_operand" "v")]
+ UNSPEC_BCDADD)
+ (match_operand:V2DF 2 "zero_constant" "j")))
+ (clobber (match_scratch:VBCD 0 "=v"))]
+ "TARGET_P8_VECTOR"
+ "bcdadd. %0,%1,%1,0"
+ [(set_attr "type" "vecsimple")])
+
+(define_expand "bcdinvalid_<mode>"
+ [(parallel [(set (reg:CCFP CR6_REGNO)
+ (compare:CCFP
+ (unspec:V2DF [(match_operand:VBCD 1 "register_operand")]
+ UNSPEC_BCDADD)
+ (match_dup 2)))
+ (clobber (match_scratch:VBCD 3))])
+ (set (match_operand:SI 0 "register_operand")
+ (unordered:SI (reg:CCFP CR6_REGNO)
+ (const_int 0)))]
+ "TARGET_P8_VECTOR"
+{
+ operands[2] = CONST0_RTX (V2DFmode);
+})
+
+(define_insn "bcdshift_v16qi"
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")
+ (match_operand:V16QI 2 "register_operand" "v")
+ (match_operand:QI 3 "const_0_to_1_operand" "n")]
+ UNSPEC_BCDSHIFT))
+ (clobber (reg:CCFP CR6_REGNO))]
+ "TARGET_P8_VECTOR"
+ "bcds. %0,%1,%2,%3"
+ [(set_attr "type" "vecsimple")])
+
+(define_expand "bcdmul10_v16qi"
+ [(set (match_operand:V16QI 0 "register_operand")
+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand")]
+ UNSPEC_BCDSHIFT))
+ (clobber (reg:CCFP CR6_REGNO))]
+ "TARGET_P9_VECTOR"
+{
+ rtx one = gen_reg_rtx (V16QImode);
+
+ emit_insn (gen_altivec_vspltisb (one, const1_rtx));
+ emit_insn (gen_bcdshift_v16qi (operands[0], one, operands[1], const0_rtx));
+
+ DONE;
+})
+
+(define_expand "bcddiv10_v16qi"
+ [(set (match_operand:V16QI 0 "register_operand")
+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand")]
+ UNSPEC_BCDSHIFT))
+ (clobber (reg:CCFP CR6_REGNO))]
+ "TARGET_P9_VECTOR"
+{
+ rtx one = gen_reg_rtx (V16QImode);
+
+ emit_insn (gen_altivec_vspltisb (one, constm1_rtx));
+ emit_insn (gen_bcdshift_v16qi (operands[0], one, operands[1], const0_rtx));
+
+ DONE;
+})
+
+
;; Peephole2 pattern to combine a bcdadd/bcdsub that calculates the value and
;; the bcdadd/bcdsub that tests the value. The combiner won't work since
;; CR6 is a hard coded register. Unfortunately, all of the Altivec predicate
diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md
index 8f82273..9a95230 100644
--- a/gcc/config/rs6000/dfp.md
+++ b/gcc/config/rs6000/dfp.md
@@ -273,6 +273,28 @@
"denbcd<q> %1,%0,%2"
[(set_attr "type" "dfp")])
+(define_insn "dfp_denbcd_v16qi_inst"
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (unspec:TD [(match_operand:QI 1 "const_0_to_1_operand" "i")
+ (match_operand:V16QI 2 "register_operand" "d")]
+ UNSPEC_DENBCD))]
+ "TARGET_DFP"
+ "denbcdq %1,%0,%2"
+ [(set_attr "type" "dfp")])
+
+(define_expand "dfp_denbcd_v16qi"
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (unspec:TD [(match_operand:V16QI 1 "register_operand" "v")]
+ UNSPEC_DENBCD))]
+ "TARGET_DFP"
+ {
+ // Move vs128 upper 64-bits and lower 64-bits to fp register pair
+ convert_move (operands[0], operands[1], true);
+ emit_insn (gen_dfp_denbcd_v16qi_inst (operands[0], GEN_INT(1),
+ operands[0]));
+ DONE;
+ })
+
(define_insn "dfp_dxex_<mode>"
[(set (match_operand:DI 0 "gpc_reg_operand" "=d")
(unspec:DI [(match_operand:DDTD 1 "gpc_reg_operand" "d")]
diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index 3eb55f0..a58102c 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -696,6 +696,14 @@
/* Miscellaneous builtins for instructions added in ISA 2.07. These
instructions do require the ISA 2.07 vector support, but they aren't vector
instructions. */
+#define BU_P8V_MISC_1(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_1 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_" NAME, /* NAME */ \
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_UNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
#define BU_P8V_MISC_3(ENUM, NAME, ATTR, ICODE) \
RS6000_BUILTIN_3 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \
"__builtin_" NAME, /* NAME */ \
@@ -1145,6 +1153,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 +1195,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 +1499,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 +1777,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")
@@ -2636,16 +2676,55 @@ BU_P7_MISC_1 (CBCDTD, "cbcdtd", CONST, cbcdtd)
BU_P7_MISC_2 (ADDG6S, "addg6s", CONST, addg6s)
/* 3 argument BCD functions added in ISA 2.07. */
-BU_P8V_MISC_3 (BCDADD, "bcdadd", CONST, bcdadd)
-BU_P8V_MISC_3 (BCDADD_LT, "bcdadd_lt", CONST, bcdadd_lt)
-BU_P8V_MISC_3 (BCDADD_EQ, "bcdadd_eq", CONST, bcdadd_eq)
-BU_P8V_MISC_3 (BCDADD_GT, "bcdadd_gt", CONST, bcdadd_gt)
-BU_P8V_MISC_3 (BCDADD_OV, "bcdadd_ov", CONST, bcdadd_unordered)
-BU_P8V_MISC_3 (BCDSUB, "bcdsub", CONST, bcdsub)
-BU_P8V_MISC_3 (BCDSUB_LT, "bcdsub_lt", CONST, bcdsub_lt)
-BU_P8V_MISC_3 (BCDSUB_EQ, "bcdsub_eq", CONST, bcdsub_eq)
-BU_P8V_MISC_3 (BCDSUB_GT, "bcdsub_gt", CONST, bcdsub_gt)
-BU_P8V_MISC_3 (BCDSUB_OV, "bcdsub_ov", CONST, bcdsub_unordered)
+BU_P8V_MISC_3 (BCDADD_V1TI, "bcdadd_v1ti", CONST, bcdadd_v1ti)
+BU_P8V_MISC_3 (BCDADD_V16QI, "bcdadd_v16qi", CONST, bcdadd_v16qi)
+BU_P8V_MISC_3 (BCDADD_LT_V1TI, "bcdadd_lt_v1ti", CONST, bcdadd_lt_v1ti)
+BU_P8V_MISC_3 (BCDADD_LT_V16QI, "bcdadd_lt_v16qi", CONST, bcdadd_lt_v16qi)
+BU_P8V_MISC_3 (BCDADD_EQ_V1TI, "bcdadd_eq_v1ti", CONST, bcdadd_eq_v1ti)
+BU_P8V_MISC_3 (BCDADD_EQ_V16QI, "bcdadd_eq_v16qi", CONST, bcdadd_eq_v16qi)
+BU_P8V_MISC_3 (BCDADD_GT_V1TI, "bcdadd_gt_v1ti", CONST, bcdadd_gt_v1ti)
+BU_P8V_MISC_3 (BCDADD_GT_V16QI, "bcdadd_gt_v16qi", CONST, bcdadd_gt_v16qi)
+BU_P8V_MISC_3 (BCDADD_OV_V1TI, "bcdadd_ov_v1ti", CONST, bcdadd_unordered_v1ti)
+BU_P8V_MISC_3 (BCDADD_OV_V16QI, "bcdadd_ov_v16qi", CONST, bcdadd_unordered_v16qi)
+
+BU_P8V_MISC_3 (BCDSUB_V1TI, "bcdsub_v1ti", CONST, bcdsub_v1ti)
+BU_P8V_MISC_3 (BCDSUB_V16QI, "bcdsub_v16qi", CONST, bcdsub_v16qi)
+BU_P8V_MISC_3 (BCDSUB_LT_V1TI, "bcdsub_lt_v1ti", CONST, bcdsub_lt_v1ti)
+BU_P8V_MISC_3 (BCDSUB_LT_V16QI, "bcdsub_lt_v16qi", CONST, bcdsub_lt_v16qi)
+BU_P8V_MISC_3 (BCDSUB_LE_V1TI, "bcdsub_le_v1ti", CONST, bcdsub_le_v1ti)
+BU_P8V_MISC_3 (BCDSUB_LE_V16QI, "bcdsub_le_v16qi", CONST, bcdsub_le_v16qi)
+BU_P8V_MISC_3 (BCDSUB_EQ_V1TI, "bcdsub_eq_v1ti", CONST, bcdsub_eq_v1ti)
+BU_P8V_MISC_3 (BCDSUB_EQ_V16QI, "bcdsub_eq_v16qi", CONST, bcdsub_eq_v16qi)
+BU_P8V_MISC_3 (BCDSUB_GT_V1TI, "bcdsub_gt_v1ti", CONST, bcdsub_gt_v1ti)
+BU_P8V_MISC_3 (BCDSUB_GT_V16QI, "bcdsub_gt_v16qi", CONST, bcdsub_gt_v16qi)
+BU_P8V_MISC_3 (BCDSUB_GE_V1TI, "bcdsub_ge_v1ti", CONST, bcdsub_ge_v1ti)
+BU_P8V_MISC_3 (BCDSUB_GE_V16QI, "bcdsub_ge_v16qi", CONST, bcdsub_ge_v16qi)
+BU_P8V_MISC_3 (BCDSUB_OV_V1TI, "bcdsub_ov_v1ti", CONST, bcdsub_unordered_v1ti)
+BU_P8V_MISC_3 (BCDSUB_OV_V16QI, "bcdsub_ov_v16qi", CONST, bcdsub_unordered_v16qi)
+
+BU_P8V_MISC_1 (BCDINVALID_V1TI, "bcdinvalid_v1ti", CONST, bcdinvalid_v1ti)
+BU_P8V_MISC_1 (BCDINVALID_V16QI, "bcdinvalid_v16qi", CONST, bcdinvalid_v16qi)
+
+BU_P9V_AV_1 (BCDMUL10_V16QI, "bcdmul10_v16qi", CONST, bcdmul10_v16qi)
+BU_P9V_AV_1 (BCDDIV10_V16QI, "bcddiv10_v16qi", CONST, bcddiv10_v16qi)
+BU_P8V_MISC_1 (DENBCD_V16QI, "denb2dfp_v16qi", CONST, dfp_denbcd_v16qi)
+
+BU_P8V_OVERLOAD_3 (BCDADD, "bcdadd")
+BU_P8V_OVERLOAD_3 (BCDADD_LT, "bcdadd_lt")
+BU_P8V_OVERLOAD_3 (BCDADD_EQ, "bcdadd_eq")
+BU_P8V_OVERLOAD_3 (BCDADD_GT, "bcdadd_gt")
+BU_P8V_OVERLOAD_3 (BCDADD_OV, "bcdadd_ov")
+BU_P8V_OVERLOAD_3 (BCDSUB, "bcdsub")
+BU_P8V_OVERLOAD_3 (BCDSUB_LT, "bcdsub_lt")
+BU_P8V_OVERLOAD_3 (BCDSUB_LE, "bcdsub_le")
+BU_P8V_OVERLOAD_3 (BCDSUB_EQ, "bcdsub_eq")
+BU_P8V_OVERLOAD_3 (BCDSUB_GT, "bcdsub_gt")
+BU_P8V_OVERLOAD_3 (BCDSUB_GE, "bcdsub_ge")
+BU_P8V_OVERLOAD_3 (BCDSUB_OV, "bcdsub_ov")
+BU_P8V_OVERLOAD_1 (BCDINVALID, "bcdinvalid")
+BU_P9V_OVERLOAD_1 (BCDMUL10, "bcdmul10")
+BU_P9V_OVERLOAD_1 (BCDDIV10, "bcddiv10")
+BU_P8V_OVERLOAD_1 (DENBCD, "denb2dfp")
/* 2 argument pack/unpack 128-bit floating point types. */
BU_DFP_MISC_2 (PACK_TD, "pack_dec128", CONST, packtd)
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 9fdf97b..3bd89a7 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -985,6 +985,82 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V4SI, RS6000_BTI_V4SF, RS6000_BTI_INTSI, 0 },
{ ALTIVEC_BUILTIN_VEC_CTU, VSX_BUILTIN_XVCVDPUXDS_SCALE,
RS6000_BTI_unsigned_V2DI, RS6000_BTI_V2DF, RS6000_BTI_INTSI, 0 },
+
+ { P8V_BUILTIN_VEC_BCDADD, MISC_BUILTIN_BCDADD_V1TI,
+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD, MISC_BUILTIN_BCDADD_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_LT, MISC_BUILTIN_BCDADD_LT_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_LT, MISC_BUILTIN_BCDADD_LT_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_EQ, MISC_BUILTIN_BCDADD_EQ_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_EQ, MISC_BUILTIN_BCDADD_EQ_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_GT, MISC_BUILTIN_BCDADD_GT_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_GT, MISC_BUILTIN_BCDADD_GT_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_OV, MISC_BUILTIN_BCDADD_OV_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDADD_OV, MISC_BUILTIN_BCDADD_OV_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDINVALID, MISC_BUILTIN_BCDINVALID_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, 0, 0 },
+ { P8V_BUILTIN_VEC_BCDINVALID, MISC_BUILTIN_BCDINVALID_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI, 0, 0 },
+
+ { P9V_BUILTIN_VEC_BCDMUL10, P9V_BUILTIN_BCDMUL10_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
+ { P9V_BUILTIN_VEC_BCDDIV10, P9V_BUILTIN_BCDDIV10_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
+
+ { P8V_BUILTIN_VEC_DENBCD, MISC_BUILTIN_DENBCD_V16QI,
+ RS6000_BTI_dfloat128, RS6000_BTI_unsigned_V16QI, 0, 0 },
+
+ { P8V_BUILTIN_VEC_BCDSUB, MISC_BUILTIN_BCDSUB_V1TI,
+ RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB, MISC_BUILTIN_BCDSUB_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_LT, MISC_BUILTIN_BCDSUB_LT_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_LT, MISC_BUILTIN_BCDSUB_LT_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_LE, MISC_BUILTIN_BCDSUB_LE_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_LE, MISC_BUILTIN_BCDSUB_LE_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_EQ, MISC_BUILTIN_BCDSUB_EQ_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_EQ, MISC_BUILTIN_BCDSUB_EQ_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_GT, MISC_BUILTIN_BCDSUB_GT_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_GT, MISC_BUILTIN_BCDSUB_GT_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_GE, MISC_BUILTIN_BCDSUB_GE_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_GE, MISC_BUILTIN_BCDSUB_GE_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_OV, MISC_BUILTIN_BCDSUB_OV_V1TI,
+ RS6000_BTI_INTSI, RS6000_BTI_V1TI, RS6000_BTI_V1TI, RS6000_BTI_INTSI },
+ { P8V_BUILTIN_VEC_BCDSUB_OV, MISC_BUILTIN_BCDSUB_OV_V16QI,
+ RS6000_BTI_INTSI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI },
+
+
{ VSX_BUILTIN_VEC_DIV, VSX_BUILTIN_XVDIVSP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ VSX_BUILTIN_VEC_DIV, VSX_BUILTIN_XVDIVDP,
@@ -1152,6 +1228,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,
@@ -9574,6 +9709,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)
{
@@ -9692,7 +9906,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;
@@ -9731,6 +9945,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))
@@ -10413,14 +10646,22 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
}
else if (icode == CODE_FOR_vsx_set_v2df
|| icode == CODE_FOR_vsx_set_v2di
- || icode == CODE_FOR_bcdadd
- || icode == CODE_FOR_bcdadd_lt
- || icode == CODE_FOR_bcdadd_eq
- || icode == CODE_FOR_bcdadd_gt
- || icode == CODE_FOR_bcdsub
- || icode == CODE_FOR_bcdsub_lt
- || icode == CODE_FOR_bcdsub_eq
- || icode == CODE_FOR_bcdsub_gt)
+ || icode == CODE_FOR_bcdadd_v16qi
+ || icode == CODE_FOR_bcdadd_v1ti
+ || icode == CODE_FOR_bcdadd_lt_v16qi
+ || icode == CODE_FOR_bcdadd_lt_v1ti
+ || icode == CODE_FOR_bcdadd_eq_v16qi
+ || icode == CODE_FOR_bcdadd_eq_v1ti
+ || icode == CODE_FOR_bcdadd_gt_v16qi
+ || icode == CODE_FOR_bcdadd_gt_v1ti
+ || icode == CODE_FOR_bcdsub_v16qi
+ || icode == CODE_FOR_bcdsub_v1ti
+ || icode == CODE_FOR_bcdsub_lt_v16qi
+ || icode == CODE_FOR_bcdsub_lt_v1ti
+ || icode == CODE_FOR_bcdsub_eq_v16qi
+ || icode == CODE_FOR_bcdsub_eq_v1ti
+ || icode == CODE_FOR_bcdsub_gt_v16qi
+ || icode == CODE_FOR_bcdsub_gt_v1ti)
{
/* Only allow 1-bit unsigned literals. */
STRIP_NOPS (arg2);
@@ -10444,7 +10685,8 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
}
}
else if (icode == CODE_FOR_dfp_denbcd_dd
- || icode == CODE_FOR_dfp_denbcd_td)
+ || icode == CODE_FOR_dfp_denbcd_td
+ || icode == CODE_FOR_dfp_denbcd_v16qi)
{
/* Only allow 1-bit unsigned literals. */
STRIP_NOPS (arg0);
@@ -10750,6 +10992,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:
@@ -11012,6 +11264,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);
@@ -12914,15 +13190,15 @@ 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_ALIGN (vector_pair_type_node, 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_ALIGN (vector_quad_type_node, 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,
@@ -13296,6 +13572,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);
@@ -13361,6 +13649,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.c b/gcc/config/rs6000/rs6000.c
index b58eeae..d7dcd93 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -3539,6 +3539,20 @@ rs6000_linux64_override_options ()
}
#endif
+/* Return true if we are using GLIBC, and it supports IEEE 128-bit long double.
+ This support is only in little endian GLIBC 2.32 or newer. */
+static bool
+glibc_supports_ieee_128bit (void)
+{
+#ifdef OPTION_GLIBC
+ if (OPTION_GLIBC && !BYTES_BIG_ENDIAN
+ && ((TARGET_GLIBC_MAJOR * 1000) + TARGET_GLIBC_MINOR) >= 2032)
+ return true;
+#endif /* OPTION_GLIBC. */
+
+ return false;
+}
+
/* Override command line options.
Combine build-specific configuration information with options
@@ -4158,8 +4172,14 @@ rs6000_option_override_internal (bool global_init_p)
if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
{
+ /* Determine if the user can change the default long double type at
+ compilation time. Only C and C++ support this, and you need GLIBC
+ 2.32 or newer. Only issue one warning. */
static bool warned_change_long_double;
- if (!warned_change_long_double)
+
+ if (!warned_change_long_double
+ && (!glibc_supports_ieee_128bit ()
+ || (!lang_GNU_C () && !lang_GNU_CXX ())))
{
warned_change_long_double = true;
if (TARGET_IEEEQUAD)
@@ -4324,7 +4344,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");
@@ -6500,11 +6522,11 @@ rs6000_expand_vector_init (rtx target, rtx vals)
{
machine_mode mode = GET_MODE (target);
machine_mode inner_mode = GET_MODE_INNER (mode);
- int n_elts = GET_MODE_NUNITS (mode);
+ unsigned int n_elts = GET_MODE_NUNITS (mode);
int n_var = 0, one_var = -1;
bool all_same = true, all_const_zero = true;
rtx x, mem;
- int i;
+ unsigned int i;
for (i = 0; i < n_elts; ++i)
{
@@ -6770,6 +6792,181 @@ rs6000_expand_vector_init (rtx target, rtx vals)
return;
}
+ if (TARGET_DIRECT_MOVE && (mode == V16QImode || mode == V8HImode))
+ {
+ rtx op[16];
+ /* Force the values into word_mode registers. */
+ for (i = 0; i < n_elts; i++)
+ {
+ rtx tmp = force_reg (GET_MODE_INNER (mode), XVECEXP (vals, 0, i));
+ if (TARGET_POWERPC64)
+ {
+ op[i] = gen_reg_rtx (DImode);
+ emit_insn (gen_zero_extendqidi2 (op[i], tmp));
+ }
+ else
+ {
+ op[i] = gen_reg_rtx (SImode);
+ emit_insn (gen_zero_extendqisi2 (op[i], tmp));
+ }
+ }
+
+ /* Take unsigned char big endianness on 64bit as example for below
+ construction, the input values are: A, B, C, D, ..., O, P. */
+
+ if (TARGET_DIRECT_MOVE_128)
+ {
+ /* Move to VSX register with vec_concat, each has 2 values.
+ eg: vr1[0] = { xxxxxxxA, xxxxxxxB };
+ vr1[1] = { xxxxxxxC, xxxxxxxD };
+ ...
+ vr1[7] = { xxxxxxxO, xxxxxxxP }; */
+ rtx vr1[8];
+ for (i = 0; i < n_elts / 2; i++)
+ {
+ vr1[i] = gen_reg_rtx (V2DImode);
+ emit_insn (gen_vsx_concat_v2di (vr1[i], op[i * 2],
+ op[i * 2 + 1]));
+ }
+
+ /* Pack vectors with 2 values into vectors with 4 values.
+ eg: vr2[0] = { xxxAxxxB, xxxCxxxD };
+ vr2[1] = { xxxExxxF, xxxGxxxH };
+ vr2[1] = { xxxIxxxJ, xxxKxxxL };
+ vr2[3] = { xxxMxxxN, xxxOxxxP }; */
+ rtx vr2[4];
+ for (i = 0; i < n_elts / 4; i++)
+ {
+ vr2[i] = gen_reg_rtx (V4SImode);
+ emit_insn (gen_altivec_vpkudum (vr2[i], vr1[i * 2],
+ vr1[i * 2 + 1]));
+ }
+
+ /* Pack vectors with 4 values into vectors with 8 values.
+ eg: vr3[0] = { xAxBxCxD, xExFxGxH };
+ vr3[1] = { xIxJxKxL, xMxNxOxP }; */
+ rtx vr3[2];
+ for (i = 0; i < n_elts / 8; i++)
+ {
+ vr3[i] = gen_reg_rtx (V8HImode);
+ emit_insn (gen_altivec_vpkuwum (vr3[i], vr2[i * 2],
+ vr2[i * 2 + 1]));
+ }
+
+ /* If it's V8HImode, it's done and return it. */
+ if (mode == V8HImode)
+ {
+ emit_insn (gen_rtx_SET (target, vr3[0]));
+ return;
+ }
+
+ /* Pack vectors with 8 values into 16 values. */
+ rtx res = gen_reg_rtx (V16QImode);
+ emit_insn (gen_altivec_vpkuhum (res, vr3[0], vr3[1]));
+ emit_insn (gen_rtx_SET (target, res));
+ }
+ else
+ {
+ rtx (*merge_v16qi) (rtx, rtx, rtx) = NULL;
+ rtx (*merge_v8hi) (rtx, rtx, rtx) = NULL;
+ rtx (*merge_v4si) (rtx, rtx, rtx) = NULL;
+ rtx perm_idx;
+
+ /* Set up some common gen routines and values. */
+ if (BYTES_BIG_ENDIAN)
+ {
+ if (mode == V16QImode)
+ {
+ merge_v16qi = gen_altivec_vmrghb;
+ merge_v8hi = gen_altivec_vmrglh;
+ }
+ else
+ merge_v8hi = gen_altivec_vmrghh;
+
+ merge_v4si = gen_altivec_vmrglw;
+ perm_idx = GEN_INT (3);
+ }
+ else
+ {
+ if (mode == V16QImode)
+ {
+ merge_v16qi = gen_altivec_vmrglb;
+ merge_v8hi = gen_altivec_vmrghh;
+ }
+ else
+ merge_v8hi = gen_altivec_vmrglh;
+
+ merge_v4si = gen_altivec_vmrghw;
+ perm_idx = GEN_INT (0);
+ }
+
+ /* Move to VSX register with direct move.
+ eg: vr_qi[0] = { xxxxxxxA, xxxxxxxx };
+ vr_qi[1] = { xxxxxxxB, xxxxxxxx };
+ ...
+ vr_qi[15] = { xxxxxxxP, xxxxxxxx }; */
+ rtx vr_qi[16];
+ for (i = 0; i < n_elts; i++)
+ {
+ vr_qi[i] = gen_reg_rtx (V16QImode);
+ if (TARGET_POWERPC64)
+ emit_insn (gen_p8_mtvsrd_v16qidi2 (vr_qi[i], op[i]));
+ else
+ emit_insn (gen_p8_mtvsrwz_v16qisi2 (vr_qi[i], op[i]));
+ }
+
+ /* Merge/move to vector short.
+ eg: vr_hi[0] = { xxxxxxxx, xxxxxxAB };
+ vr_hi[1] = { xxxxxxxx, xxxxxxCD };
+ ...
+ vr_hi[7] = { xxxxxxxx, xxxxxxOP }; */
+ rtx vr_hi[8];
+ for (i = 0; i < 8; i++)
+ {
+ rtx tmp = vr_qi[i];
+ if (mode == V16QImode)
+ {
+ tmp = gen_reg_rtx (V16QImode);
+ emit_insn (merge_v16qi (tmp, vr_qi[2 * i], vr_qi[2 * i + 1]));
+ }
+ vr_hi[i] = gen_reg_rtx (V8HImode);
+ emit_move_insn (vr_hi[i], gen_lowpart (V8HImode, tmp));
+ }
+
+ /* Merge vector short to vector int.
+ eg: vr_si[0] = { xxxxxxxx, xxxxABCD };
+ vr_si[1] = { xxxxxxxx, xxxxEFGH };
+ ...
+ vr_si[3] = { xxxxxxxx, xxxxMNOP }; */
+ rtx vr_si[4];
+ for (i = 0; i < 4; i++)
+ {
+ rtx tmp = gen_reg_rtx (V8HImode);
+ emit_insn (merge_v8hi (tmp, vr_hi[2 * i], vr_hi[2 * i + 1]));
+ vr_si[i] = gen_reg_rtx (V4SImode);
+ emit_move_insn (vr_si[i], gen_lowpart (V4SImode, tmp));
+ }
+
+ /* Merge vector int to vector long.
+ eg: vr_di[0] = { xxxxxxxx, ABCDEFGH };
+ vr_di[1] = { xxxxxxxx, IJKLMNOP }; */
+ rtx vr_di[2];
+ for (i = 0; i < 2; i++)
+ {
+ rtx tmp = gen_reg_rtx (V4SImode);
+ emit_insn (merge_v4si (tmp, vr_si[2 * i], vr_si[2 * i + 1]));
+ vr_di[i] = gen_reg_rtx (V2DImode);
+ emit_move_insn (vr_di[i], gen_lowpart (V2DImode, tmp));
+ }
+
+ rtx res = gen_reg_rtx (V2DImode);
+ emit_insn (gen_vsx_xxpermdi_v2di (res, vr_di[0], vr_di[1], perm_idx));
+ emit_insn (gen_rtx_SET (target, gen_lowpart (mode, res)));
+ }
+
+ return;
+ }
+
/* Construct the vector in memory one field at a time
and load the whole vector. */
mem = assign_stack_temp (mode, GET_MODE_SIZE (mode));
@@ -9108,15 +9305,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
@@ -14384,22 +14587,10 @@ rs6000_invalid_binary_op (int op ATTRIBUTE_UNUSED,
if (!TARGET_FLOAT128_CVT)
{
- if ((mode1 == KFmode && mode2 == IFmode)
- || (mode1 == IFmode && mode2 == KFmode))
- return N_("__float128 and __ibm128 cannot be used in the same "
- "expression");
-
- if (TARGET_IEEEQUAD
- && ((mode1 == IFmode && mode2 == TFmode)
- || (mode1 == TFmode && mode2 == IFmode)))
- return N_("__ibm128 and long double cannot be used in the same "
- "expression");
-
- if (!TARGET_IEEEQUAD
- && ((mode1 == KFmode && mode2 == TFmode)
- || (mode1 == TFmode && mode2 == KFmode)))
- return N_("__float128 and long double cannot be used in the same "
- "expression");
+ if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2))
+ || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2)))
+ return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating "
+ "point types");
}
return NULL;
@@ -26893,7 +27084,8 @@ static tree
rs6000_mangle_decl_assembler_name (tree decl, tree id)
{
if (!TARGET_IEEEQUAD_DEFAULT && TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128
- && TREE_CODE (decl) == FUNCTION_DECL && DECL_IS_BUILTIN (decl) )
+ && TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_IS_UNDECLARED_BUILTIN (decl))
{
size_t len = IDENTIFIER_LENGTH (id);
const char *name = IDENTIFIER_POINTER (id);
@@ -27045,11 +27237,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.h b/gcc/config/rs6000/rs6000.h
index bbd8060..5a47aa1 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -776,8 +776,10 @@ extern unsigned rs6000_pointer_size;
/* Allocation boundary (in *bits*) for the code of a function. */
#define FUNCTION_BOUNDARY 32
-/* No data type wants to be aligned rounder than this. */
-#define BIGGEST_ALIGNMENT (TARGET_MMA ? 512 : 128)
+/* No data type is required to be aligned rounder than this. Warning, if
+ BIGGEST_ALIGNMENT is changed, then this may be an ABI break. An example
+ of where this can break an ABI is in GLIBC's struct _Unwind_Exception. */
+#define BIGGEST_ALIGNMENT 128
/* Alignment of field after `int : 0' in a structure. */
#define EMPTY_FIELD_BOUNDARY 32
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 779bfd1..5e5ad9f 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -8713,6 +8713,22 @@
"mtvsrwz %x0,%1"
[(set_attr "type" "mtvsr")])
+(define_insn "p8_mtvsrwz_v16qisi2"
+ [(set (match_operand:V16QI 0 "register_operand" "=wa")
+ (unspec:V16QI [(match_operand:SI 1 "register_operand" "r")]
+ UNSPEC_P8V_MTVSRWZ))]
+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
+ "mtvsrwz %x0,%1"
+ [(set_attr "type" "mtvsr")])
+
+(define_insn "p8_mtvsrd_v16qidi2"
+ [(set (match_operand:V16QI 0 "register_operand" "=wa")
+ (unspec:V16QI [(match_operand:DI 1 "register_operand" "r")]
+ UNSPEC_P8V_MTVSRD))]
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
+ "mtvsrd %x0,%1"
+ [(set_attr "type" "mtvsr")])
+
(define_insn_and_split "reload_fpr_from_gpr<mode>"
[(set (match_operand:FMOVE64X 0 "register_operand" "=d")
(unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
@@ -11554,7 +11570,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
@@ -12716,14 +12732,11 @@
(use (match_operand:P 1))]
"rs6000_speculate_indirect_jumps"
{
- rtx off;
- operands[0] = force_reg (SImode, operands[0]);
- if (<MODE>mode == SImode)
- off = operands[0];
- else
+ rtx off = force_reg (SImode, operands[0]);
+ if (<MODE>mode != SImode)
{
+ rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, off);
off = gen_reg_rtx (Pmode);
- rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
emit_move_insn (off, src);
}
@@ -12741,14 +12754,11 @@
(use (match_operand:CC 2))]
"!rs6000_speculate_indirect_jumps"
{
- rtx off;
- operands[0] = force_reg (SImode, operands[0]);
- if (<MODE>mode == SImode)
- off = operands[0];
- else
+ rtx off = force_reg (SImode, operands[0]);
+ if (<MODE>mode != SImode)
{
+ rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, off);
off = gen_reg_rtx (Pmode);
- rtx src = gen_rtx_fmt_e (SIGN_EXTEND, Pmode, operands[0]);
emit_move_insn (off, src);
}
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 4ff5245..947631d 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"
@@ -3089,7 +3109,7 @@
[(match_operand:VSX_EXTRACT_I4 1 "altivec_register_operand" "v")
(match_operand:QI 2 "const_0_to_3_operand" "n")]
UNSPEC_XXGENPCV))]
- "TARGET_POWER10 && TARGET_64BIT"
+ "TARGET_POWER10"
"xxgenpcv<wd>m %x0,%1,%2"
[(set_attr "type" "vecsimple")])
@@ -3697,7 +3717,7 @@
(vec_select:<VS_scalar>
(match_operand:VSX_EXTRACT_I 1 "gpc_reg_operand" "<VSX_EX>,v")
(parallel [(match_operand:QI 2 "const_int_operand" "n,n")])))
- (clobber (match_scratch:<VS_scalar> 3 "=<VSX_EX>,&r"))
+ (clobber (match_scratch:<VS_scalar> 3 "=<VSX_EX>,&*r"))
(clobber (match_scratch:SI 4 "=X,&r"))]
"VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_VEXTRACTUB"
"#"
@@ -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..51a3250 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,150 @@ 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"); \
+ } \
+ \
+ /* __ppc isn't emitted by the system compiler \
+ any more but a few system headers still depend \
+ on it, as well as on __ppc__. */ \
+ builtin_define ("__ppc"); \
+ builtin_define ("__ppc__"); \
+ } \
+ \
+ /* 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)}}"
-#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, PPCE6500) ";" \
+ 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 +196,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/rx/rx.c b/gcc/config/rx/rx.c
index 151ad39..dfb4bd4 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -639,6 +639,7 @@ rx_print_operand (FILE * file, rtx op, int letter)
switch (INTVAL (op))
{
case CTRLREG_PSW: fprintf (file, "psw"); break;
+ case CTRLREG_PC: fprintf (file, "pc"); break;
case CTRLREG_USP: fprintf (file, "usp"); break;
case CTRLREG_FPSW: fprintf (file, "fpsw"); break;
case CTRLREG_BPSW: fprintf (file, "bpsw"); break;
@@ -2474,6 +2475,13 @@ rx_expand_builtin_mvtc (tree exp)
if (! REG_P (arg2))
arg2 = force_reg (SImode, arg2);
+ if (INTVAL (arg1) == 1)
+ {
+ warning (0, "invalid control register for mvtc : %d - using 'psw'",
+ (int) INTVAL (arg1));
+ arg1 = const0_rtx;
+ }
+
emit_insn (gen_mvtc (arg1, arg2));
return NULL_RTX;
diff --git a/gcc/config/rx/rx.md b/gcc/config/rx/rx.md
index df08a9e..6e5c546 100644
--- a/gcc/config/rx/rx.md
+++ b/gcc/config/rx/rx.md
@@ -77,6 +77,7 @@
(UNSPEC_PID_ADDR 52)
(CTRLREG_PSW 0)
+ (CTRLREG_PC 1)
(CTRLREG_USP 2)
(CTRLREG_FPSW 3)
(CTRLREG_BPSW 8)
diff --git a/gcc/config/s390/s390-modes.def b/gcc/config/s390/s390-modes.def
index b1f8e1f..316ca5c 100644
--- a/gcc/config/s390/s390-modes.def
+++ b/gcc/config/s390/s390-modes.def
@@ -22,9 +22,12 @@ along with GCC; see the file COPYING3. If not see
/* 256-bit integer mode is needed for STACK_SAVEAREA_MODE. */
INT_MODE (OI, 32);
-/* Define TFmode to work around reload problem PR 20927. */
+/* 128-bit float stored in a VR on z14+ or a FPR pair on older machines. */
FLOAT_MODE (TF, 16, ieee_quad_format);
+/* 128-bit float stored in a FPR pair. */
+FLOAT_MODE (FPRX2, 16, ieee_quad_format);
+
/* Add any extra modes needed to represent the condition code. */
/*
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 029f728..ad2f7f7 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -51,6 +51,7 @@ extern bool s390_hard_regno_rename_ok (unsigned int, unsigned int);
extern int s390_class_max_nregs (enum reg_class, machine_mode);
extern bool s390_function_arg_vector (machine_mode, const_tree);
extern bool s390_return_addr_from_memory(void);
+extern bool s390_fma_allowed_p (machine_mode);
#if S390_USE_TARGET_ATTRIBUTE
extern tree s390_valid_target_attribute_tree (tree args,
struct gcc_options *opts,
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index dbb541b..2300a51 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -456,6 +456,16 @@ s390_return_addr_from_memory ()
return cfun_gpr_save_slot(RETURN_REGNUM) == SAVE_SLOT_STACK;
}
+/* Return nonzero if it's OK to use fused multiply-add for MODE. */
+bool
+s390_fma_allowed_p (machine_mode mode)
+{
+ if (TARGET_VXE && mode == TFmode)
+ return flag_vx_long_double_fma;
+
+ return true;
+}
+
/* Indicate which ABI has been used for passing vector args.
0 - no vector type arguments have been passed where the ABI is relevant
1 - the old ABI has been used
@@ -1850,6 +1860,10 @@ s390_emit_compare (enum rtx_code code, rtx op0, rtx op1)
machine_mode mode = s390_select_ccmode (code, op0, op1);
rtx cc;
+ /* Force OP1 into register in order to satisfy VXE TFmode patterns. */
+ if (TARGET_VXE && GET_MODE (op1) == TFmode)
+ op1 = force_reg (TFmode, op1);
+
if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_CC)
{
/* Do not output a redundant compare instruction if a
@@ -5955,6 +5969,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);
@@ -5996,10 +6011,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);
@@ -6958,6 +6973,13 @@ s390_expand_vec_init (rtx target, rtx vals)
extern rtx
s390_build_signbit_mask (machine_mode mode)
{
+ if (mode == TFmode && TARGET_VXE)
+ {
+ wide_int mask_val = wi::set_bit_in_zero (127, 128);
+ rtx mask = immed_wide_int_const (mask_val, TImode);
+ return gen_lowpart (TFmode, mask);
+ }
+
/* Generate the integral element mask value. */
machine_mode inner_mode = GET_MODE_INNER (mode);
int inner_bitsize = GET_MODE_BITSIZE (inner_mode);
@@ -7901,6 +7923,7 @@ print_operand_address (FILE *file, rtx addr)
CONST_VECTOR: Generate a bitmask for vgbm instruction.
'x': print integer X as if it's an unsigned halfword.
'v': print register number as vector register (v1 instead of f1).
+ 'V': print the second word of a TFmode operand as vector register.
*/
void
@@ -8070,13 +8093,13 @@ print_operand (FILE *file, rtx x, int code)
case REG:
/* Print FP regs as fx instead of vx when they are accessed
through non-vector mode. */
- if (code == 'v'
+ if ((code == 'v' || code == 'V')
|| VECTOR_NOFP_REG_P (x)
|| (FP_REG_P (x) && VECTOR_MODE_P (GET_MODE (x)))
|| (VECTOR_REG_P (x)
&& (GET_MODE_SIZE (GET_MODE (x)) /
s390_class_max_nregs (FP_REGS, GET_MODE (x))) > 8))
- fprintf (file, "%%v%s", reg_names[REGNO (x)] + 2);
+ fprintf (file, "%%v%s", reg_names[REGNO (x) + (code == 'V')] + 2);
else
fprintf (file, "%s", reg_names[REGNO (x)]);
break;
@@ -8620,10 +8643,9 @@ replace_constant_pool_ref (rtx_insn *insn, rtx ref, rtx offset)
/* We keep a list of constants which we have to add to internal
constant tables in the middle of large functions. */
-#define NR_C_MODES 32
-machine_mode constant_modes[NR_C_MODES] =
+static machine_mode constant_modes[] =
{
- TFmode, TImode, TDmode,
+ TFmode, FPRX2mode, TImode, TDmode,
V16QImode, V8HImode, V4SImode, V2DImode, V1TImode,
V4SFmode, V2DFmode, V1TFmode,
DFmode, DImode, DDmode,
@@ -8635,6 +8657,7 @@ machine_mode constant_modes[NR_C_MODES] =
QImode,
V1QImode
};
+#define NR_C_MODES (sizeof (constant_modes) / sizeof (constant_modes[0]))
struct constant
{
@@ -8663,7 +8686,7 @@ static struct constant_pool *
s390_alloc_pool (void)
{
struct constant_pool *pool;
- int i;
+ size_t i;
pool = (struct constant_pool *) xmalloc (sizeof *pool);
pool->next = NULL;
@@ -8742,7 +8765,7 @@ static void
s390_add_constant (struct constant_pool *pool, rtx val, machine_mode mode)
{
struct constant *c;
- int i;
+ size_t i;
for (i = 0; i < NR_C_MODES; i++)
if (constant_modes[i] == mode)
@@ -8787,7 +8810,7 @@ s390_find_constant (struct constant_pool *pool, rtx val,
machine_mode mode)
{
struct constant *c;
- int i;
+ size_t i;
for (i = 0; i < NR_C_MODES; i++)
if (constant_modes[i] == mode)
@@ -8894,7 +8917,7 @@ s390_dump_pool (struct constant_pool *pool, bool remote_label)
{
struct constant *c;
rtx_insn *insn = pool->pool_insn;
- int i;
+ size_t i;
/* Switch to rodata section. */
insn = emit_insn_after (gen_pool_section_start (), insn);
@@ -8965,7 +8988,7 @@ static void
s390_free_pool (struct constant_pool *pool)
{
struct constant *c, *next;
- int i;
+ size_t i;
for (i = 0; i < NR_C_MODES; i++)
for (c = pool->constants[i]; c; c = next)
@@ -10375,9 +10398,16 @@ static bool
s390_hard_regno_call_part_clobbered (unsigned int, unsigned int regno,
machine_mode mode)
{
+ /* For r12 we know that the only bits we actually care about are
+ preserved across function calls. Since r12 is a fixed reg all
+ accesses to r12 are generated by the backend.
+
+ This workaround is necessary until gcse implements proper
+ tracking of partially clobbered registers. */
if (!TARGET_64BIT
&& TARGET_ZARCH
&& GET_MODE_SIZE (mode) > 4
+ && (!flag_pic || regno != PIC_OFFSET_TABLE_REGNUM)
&& ((regno >= 6 && regno <= 15) || regno == 32))
return true;
@@ -10410,7 +10440,8 @@ s390_class_max_nregs (enum reg_class rclass, machine_mode mode)
full VRs. */
if (TARGET_VX
&& SCALAR_FLOAT_MODE_P (mode)
- && GET_MODE_SIZE (mode) >= 16)
+ && GET_MODE_SIZE (mode) >= 16
+ && !(TARGET_VXE && mode == TFmode))
reg_pair_required_p = true;
/* Even if complex types would fit into a single FPR/VR we force
@@ -10433,6 +10464,24 @@ s390_class_max_nregs (enum reg_class rclass, machine_mode mode)
return (GET_MODE_SIZE (mode) + reg_size - 1) / reg_size;
}
+/* Return nonzero if mode M describes a 128-bit float in a floating point
+ register pair. */
+
+static bool
+s390_is_fpr128 (machine_mode m)
+{
+ return m == FPRX2mode || (!TARGET_VXE && m == TFmode);
+}
+
+/* Return nonzero if mode M describes a 128-bit float in a vector
+ register. */
+
+static bool
+s390_is_vr128 (machine_mode m)
+{
+ return m == V1TFmode || (TARGET_VXE && m == TFmode);
+}
+
/* Implement TARGET_CAN_CHANGE_MODE_CLASS. */
static bool
@@ -10443,11 +10492,11 @@ s390_can_change_mode_class (machine_mode from_mode,
machine_mode small_mode;
machine_mode big_mode;
- /* V1TF and TF have different representations in vector
- registers. */
+ /* 128-bit values have different representations in floating point and
+ vector registers. */
if (reg_classes_intersect_p (VEC_REGS, rclass)
- && ((from_mode == V1TFmode && to_mode == TFmode)
- || (from_mode == TFmode && to_mode == V1TFmode)))
+ && ((s390_is_fpr128 (from_mode) && s390_is_vr128 (to_mode))
+ || (s390_is_vr128 (from_mode) && s390_is_fpr128 (to_mode))))
return false;
if (GET_MODE_SIZE (from_mode) == GET_MODE_SIZE (to_mode))
@@ -15461,13 +15510,6 @@ s390_option_override_internal (struct gcc_options *opts,
SET_OPTION_IF_UNSET (opts, opts_set, param_sched_pressure_algorithm, 2);
SET_OPTION_IF_UNSET (opts, opts_set, param_min_vect_loop_bound, 2);
- /* Use aggressive inlining parameters. */
- if (opts->x_s390_tune >= PROCESSOR_2964_Z13)
- {
- SET_OPTION_IF_UNSET (opts, opts_set, param_inline_min_speedup, 2);
- SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_auto, 80);
- }
-
/* Set the default alignment. */
s390_default_align (opts);
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index ec5128c..8c02831 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -1186,5 +1186,40 @@ struct GTY(()) machine_function
#define TARGET_INDIRECT_BRANCH_TABLE s390_indirect_branch_table
+#ifdef GENERATOR_FILE
+/* gencondmd.c is built before insn-flags.h. */
+#define HAVE_TF(icode) true
+#else
+#define HAVE_TF(icode) (HAVE_##icode##_fpr || HAVE_##icode##_vr)
+#endif
+
+/* Dispatcher for movtf. */
+#define EXPAND_MOVTF(icode) \
+ do \
+ { \
+ if (TARGET_VXE) \
+ emit_insn (gen_##icode##_vr (operands[0], operands[1])); \
+ else \
+ emit_insn (gen_##icode##_fpr (operands[0], operands[1])); \
+ DONE; \
+ } \
+ while (false)
+
+/* Like EXPAND_MOVTF, but also legitimizes operands. */
+#define EXPAND_TF(icode, nops) \
+ do \
+ { \
+ const size_t __nops = (nops); \
+ expand_operand ops[__nops]; \
+ create_output_operand (&ops[0], operands[0], GET_MODE (operands[0])); \
+ for (size_t i = 1; i < __nops; i++) \
+ create_input_operand (&ops[i], operands[i], GET_MODE (operands[i])); \
+ if (TARGET_VXE) \
+ expand_insn (CODE_FOR_##icode##_vr, __nops, ops); \
+ else \
+ expand_insn (CODE_FOR_##icode##_fpr, __nops, ops); \
+ DONE; \
+ } \
+ while (false)
#endif /* S390_H */
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 18edea1..a2c033b 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -405,6 +405,7 @@
(PFPO_OP_TYPE_SF 0x5)
(PFPO_OP_TYPE_DF 0x6)
(PFPO_OP_TYPE_TF 0x7)
+ (PFPO_OP_TYPE_FPRX2 0x7)
(PFPO_OP_TYPE_SD 0x8)
(PFPO_OP_TYPE_DD 0x9)
(PFPO_OP_TYPE_TD 0xa)
@@ -627,20 +628,29 @@
;; Iterators
-(define_mode_iterator ALL [TI DI SI HI QI TF DF SF TD DD SD V1QI V2QI V4QI V8QI V16QI V1HI V2HI V4HI V8HI V1SI V2SI V4SI V1DI V2DI V1SF V2SF V4SF V1TI V1DF V2DF V1TF])
+(define_mode_iterator ALL [TI DI SI HI QI TF FPRX2 DF SF TD DD SD V1QI V2QI
+ V4QI V8QI V16QI V1HI V2HI V4HI V8HI V1SI V2SI V4SI
+ V1DI V2DI V1SF V2SF V4SF V1TI V1DF V2DF V1TF])
;; These mode iterators allow floating point patterns to be generated from the
;; same template.
-(define_mode_iterator FP_ALL [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
+(define_mode_iterator FP_ALL [(TF "!TARGET_VXE") (FPRX2 "TARGET_VXE") DF SF
+ (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")
(SD "TARGET_HARD_DFP")])
-(define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
-(define_mode_iterator BFP [TF DF SF])
+(define_mode_iterator FP [(TF "!TARGET_VXE") (FPRX2 "TARGET_VXE") DF SF
+ (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
+;; Like FP, but without a condition on TF. Useful for expanders that must be
+;; the same for FP and VR variants of TF.
+(define_mode_iterator FP_ANYTF [TF (FPRX2 "TARGET_VXE") DF SF
+ (TD "TARGET_HARD_DFP")
+ (DD "TARGET_HARD_DFP")])
+(define_mode_iterator BFP [(TF "!TARGET_VXE") (FPRX2 "TARGET_VXE") DF SF])
(define_mode_iterator DFP [TD DD])
(define_mode_iterator DFP_ALL [TD DD SD])
(define_mode_iterator DSF [DF SF])
(define_mode_iterator SD_SF [SF SD])
(define_mode_iterator DD_DF [DF DD])
-(define_mode_iterator TD_TF [TF TD])
+(define_mode_iterator TD_TF [(TF "!TARGET_VXE") (FPRX2 "TARGET_VXE") TD])
; 32 bit int<->fp conversion instructions are available since VXE2 (z15).
(define_mode_iterator VX_CONV_BFP [DF (SF "TARGET_VXE2")])
@@ -714,37 +724,36 @@
;; In FP templates, a string like "lt<de>br" will expand to "ltxbr" in
;; TF/TDmode, "ltdbr" in DF/DDmode, and "ltebr" in SF/SDmode.
-(define_mode_attr xde [(TF "x") (DF "d") (SF "e") (TD "x") (DD "d") (SD "e") (V4SF "e") (V2DF "d")])
+(define_mode_attr xde [(TF "x") (FPRX2 "x") (DF "d") (SF "e") (TD "x")
+ (DD "d") (SD "e") (V4SF "e") (V2DF "d")])
;; In FP templates, a <dee> in "m<dee><bt>r" will expand to "mx<bt>r" in
;; TF/TDmode, "md<bt>r" in DF/DDmode, "mee<bt>r" in SFmode and "me<bt>r in
;; SDmode.
(define_mode_attr xdee [(TF "x") (DF "d") (SF "ee") (TD "x") (DD "d") (SD "e")])
-;; In FP templates, "<RRe>" will expand to "RRE" in TFmode and "RR" otherwise.
-;; Likewise for "<RXe>".
-(define_mode_attr RRe [(TF "RRE") (DF "RR") (SF "RR")])
-(define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
-
;; The decimal floating point variants of add, sub, div and mul support 3
;; fp register operands. The following attributes allow to merge the bfp and
;; dfp variants in a single insn definition.
;; These mode attributes are supposed to be used in the `enabled' insn
;; attribute to disable certain alternatives for certain modes.
-(define_mode_attr nBFP [(TF "0") (DF "0") (SF "0") (TD "*") (DD "*") (DD "*")])
-(define_mode_attr nDFP [(TF "*") (DF "*") (SF "*") (TD "0") (DD "0") (DD "0")])
-(define_mode_attr DSF [(TF "0") (DF "*") (SF "*") (TD "0") (DD "0") (SD "0")])
-(define_mode_attr DFDI [(TF "0") (DF "*") (SF "0")
+(define_mode_attr nBFP [(TF "0") (FPRX2 "0") (DF "0") (SF "0") (TD "*")
+ (DD "*") (DD "*")])
+(define_mode_attr nDFP [(TF "*") (FPRX2 "*") (DF "*") (SF "*") (TD "0")
+ (DD "0") (DD "0")])
+(define_mode_attr DSF [(TF "0") (FPRX2 "0") (DF "*") (SF "*") (TD "0")
+ (DD "0") (SD "0")])
+(define_mode_attr DFDI [(TF "0") (FPRX2 "0") (DF "*") (SF "0")
(TD "0") (DD "0") (DD "0")
(TI "0") (DI "*") (SI "0")])
-(define_mode_attr SFSI [(TF "0") (DF "0") (SF "*")
+(define_mode_attr SFSI [(TF "0") (FPRX2 "0") (DF "0") (SF "*")
(TD "0") (DD "0") (DD "0")
(TI "0") (DI "0") (SI "*")])
-(define_mode_attr DF [(TF "0") (DF "*") (SF "0")
+(define_mode_attr DF [(TF "0") (FPRX2 "0") (DF "*") (SF "0")
(TD "0") (DD "0") (DD "0")
(TI "0") (DI "0") (SI "0")])
-(define_mode_attr SF [(TF "0") (DF "0") (SF "*")
+(define_mode_attr SF [(TF "0") (FPRX2 "0") (DF "0") (SF "*")
(TD "0") (DD "0") (DD "0")
(TI "0") (DI "0") (SI "0")])
@@ -754,15 +763,17 @@
;; sign bit instructions only handle single source and target fp registers
;; these instructions can only be used for TFmode values if the source and
;; target operand uses the same fp register.
-(define_mode_attr fT0 [(TF "0") (DF "f") (SF "f")])
+(define_mode_attr fT0 [(TF "0") (FPRX2 "0") (DF "f") (SF "f")])
;; This attribute adds b for bfp instructions and t for dfp instructions and is used
;; within instruction mnemonics.
-(define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
+(define_mode_attr bt [(TF "b") (FPRX2 "b") (DF "b") (SF "b") (TD "t") (DD "t")
+ (SD "t")])
;; This attribute is used within instruction mnemonics. It evaluates to d for dfp
;; modes and to an empty string for bfp modes.
-(define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")])
+(define_mode_attr _d [(TF "") (FPRX2 "") (DF "") (SF "") (TD "d") (DD "d")
+ (SD "d")])
;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode
;; and "0" in SImode. This allows to combine instructions of which the 31bit
@@ -834,7 +845,7 @@
;; This attribute expands to DF for TFmode and to DD for TDmode . It is
;; used for Txmode splitters splitting a Txmode copy into 2 Dxmode copies.
-(define_mode_attr HALF_TMODE [(TF "DF") (TD "DD")])
+(define_mode_attr HALF_TMODE [(TF "DF") (FPRX2 "DF") (TD "DD")])
;; Maximum unsigned integer that fits in MODE.
(define_mode_attr max_uint [(HI "65535") (QI "255")])
@@ -855,6 +866,13 @@
;; Allow return and simple_return to be defined from a single template.
(define_code_iterator ANY_RETURN [return simple_return])
+;; Facilitate dispatching TFmode expanders on z14+.
+(define_mode_attr tf_fpr [(TF "_fpr") (FPRX2 "") (DF "") (SF "") (TD "")
+ (DD "") (SD "")])
+
+;; Mode names as seen in type mode_attr values.
+(define_mode_attr type [(TF "tf") (FPRX2 "tf") (DF "df") (SF "sf") (TD "td")
+ (DD "dd") (SD "sd")])
; Condition code modes generated by vector fp comparisons. These will
@@ -1426,7 +1444,7 @@
"TARGET_HARD_FLOAT"
"lt<xde><bt>r\t%0,%0"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
(define_insn "*cmp<mode>_ccs_0_fastmath"
[(set (reg CC_REGNUM)
@@ -1438,7 +1456,7 @@
&& !flag_signaling_nans"
"lt<xde><bt>r\t%0,%0"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; VX: TFmode in FPR pairs: use cxbr instead of wfcxb
; cxtr, cdtr, cxbr, cdbr, cebr, cdb, ceb, wfcsb, wfcdb
@@ -1456,6 +1474,18 @@
(set_attr "cpu_facility" "*,*,vx,vxe")
(set_attr "enabled" "*,<DSF>,<DF>,<SF>")])
+; VX: TFmode in VR: use wfcxb
+(define_insn "*cmptf_ccs"
+ [(set (reg CC_REGNUM)
+ (compare (match_operand:TF 0 "register_operand" "v")
+ (match_operand:TF 1 "register_operand" "v")))]
+ "s390_match_ccmode(insn, CCSmode) && TARGET_VXE"
+ "wfcxb\t%0,%1"
+ [(set_attr "op_type" "VRR")
+ (set_attr "cpu_facility" "vxe")])
+
+; VX: TFmode in FPR pairs: use kxbr instead of wfkxb
+; kxtr, kdtr, kxbr, kdbr, kebr, kdb, keb, wfksb, wfkdb
(define_insn "*cmp<mode>_ccsfps"
[(set (reg CC_REGNUM)
(compare (match_operand:FP 0 "register_operand" "f,f,v,v")
@@ -1470,6 +1500,16 @@
(set_attr "cpu_facility" "*,*,vx,vxe")
(set_attr "enabled" "*,<DSF>,<DF>,<SF>")])
+; VX: TFmode in VR: use wfkxb
+(define_insn "*cmptf_ccsfps"
+ [(set (reg CC_REGNUM)
+ (compare (match_operand:TF 0 "register_operand" "v")
+ (match_operand:TF 1 "register_operand" "v")))]
+ "s390_match_ccmode (insn, CCSFPSmode) && TARGET_VXE"
+ "wfkxb\t%0,%1"
+ [(set_attr "op_type" "VRR")
+ (set_attr "cpu_facility" "vxe")])
+
; Compare and Branch instructions
; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr
@@ -2494,7 +2534,7 @@
; mov(tf|td) instruction pattern(s).
;
-(define_expand "mov<mode>"
+(define_expand "mov<mode><tf_fpr>"
[(set (match_operand:TD_TF 0 "nonimmediate_operand" "")
(match_operand:TD_TF 1 "general_operand" ""))]
""
@@ -3423,7 +3463,7 @@
; Test data class.
;
-(define_expand "signbit<mode>2"
+(define_expand "signbit<mode>2<tf_fpr>"
[(set (reg:CCZ CC_REGNUM)
(unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
(match_dup 2)]
@@ -3435,7 +3475,7 @@
operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
})
-(define_expand "isinf<mode>2"
+(define_expand "isinf<mode>2<tf_fpr>"
[(set (reg:CCZ CC_REGNUM)
(unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f")
(match_dup 2)]
@@ -3473,7 +3513,7 @@
"TARGET_HARD_FLOAT"
"t<_d>c<xde><bt>\t%0,%1"
[(set_attr "op_type" "RXE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
@@ -4989,7 +5029,7 @@
; This is the only entry point for fixuns_trunc. It multiplexes the
; expansion to either the *_emu expanders below for pre z196 machines
; or emits the default pattern otherwise.
-(define_expand "fixuns_trunc<FP:mode><GPR:mode>2"
+(define_expand "fixuns_trunc<FP:mode><GPR:mode>2<FP:tf_fpr>"
[(parallel
[(set (match_operand:GPR 0 "register_operand" "")
(unsigned_fix:GPR (match_operand:FP 1 "register_operand" "")))
@@ -5252,12 +5292,12 @@
; fix_trunctf(si|di)2 instruction pattern(s).
;
-(define_expand "fix_trunctf<mode>2"
+(define_expand "fix_trunctf<mode>2_fpr"
[(parallel [(set (match_operand:GPR 0 "register_operand" "")
(fix:GPR (match_operand:TF 1 "register_operand" "")))
(unspec:GPR [(const_int BFP_RND_TOWARD_0)] UNSPEC_ROUND)
(clobber (reg:CC CC_REGNUM))])]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT && !TARGET_VXE"
"")
@@ -5266,7 +5306,7 @@
;
; cxgbr, cdgbr, cegbr, cxgtr, cdgtr
-(define_insn "floatdi<mode>2"
+(define_insn "floatdi<mode>2<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "=f,v")
(float:FP (match_operand:DI 1 "register_operand" "d,v")))]
"TARGET_ZARCH && TARGET_HARD_FLOAT"
@@ -5274,12 +5314,12 @@
c<xde>g<bt>r\t%0,%1
wcdgb\t%v0,%v1,0,0"
[(set_attr "op_type" "RRE,VRR")
- (set_attr "type" "itof<mode>" )
+ (set_attr "type" "itof<type>" )
(set_attr "cpu_facility" "*,vx")
(set_attr "enabled" "*,<DFDI>")])
; cxfbr, cdfbr, cefbr, wcefb
-(define_insn "floatsi<mode>2"
+(define_insn "floatsi<mode>2<tf_fpr>"
[(set (match_operand:BFP 0 "register_operand" "=f,v")
(float:BFP (match_operand:SI 1 "register_operand" "d,v")))]
"TARGET_HARD_FLOAT"
@@ -5287,7 +5327,7 @@
c<xde>fbr\t%0,%1
wcefb\t%v0,%v1,0,0"
[(set_attr "op_type" "RRE,VRR")
- (set_attr "type" "itof<mode>" )
+ (set_attr "type" "itof<type>" )
(set_attr "cpu_facility" "*,vxe2")
(set_attr "enabled" "*,<SFSI>")])
@@ -5298,7 +5338,7 @@
"TARGET_Z196 && TARGET_HARD_FLOAT"
"c<xde>ftr\t%0,0,%1,0"
[(set_attr "op_type" "RRE")
- (set_attr "type" "itof<mode>" )])
+ (set_attr "type" "itof<type>")])
;
; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s).
@@ -5324,9 +5364,9 @@
&& (!TARGET_VX || <FP:MODE>mode != DFmode || <GPR:MODE>mode != DImode)"
"c<FP:xde>l<GPR:gf><FP:bt>r\t%0,0,%1,0"
[(set_attr "op_type" "RRE")
- (set_attr "type" "itof<FP:mode>")])
+ (set_attr "type" "itof<FP:type>")])
-(define_expand "floatuns<GPR:mode><FP:mode>2"
+(define_expand "floatuns<GPR:mode><FP:mode>2<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "")
(unsigned_float:FP (match_operand:GPR 1 "register_operand" "")))]
"TARGET_Z196 && TARGET_HARD_FLOAT")
@@ -5352,7 +5392,7 @@
;
; ldxbr, lexbr
-(define_insn "trunctf<mode>2"
+(define_insn "trunctf<mode>2_fpr"
[(set (match_operand:DSF 0 "register_operand" "=f")
(float_truncate:DSF (match_operand:TF 1 "register_operand" "f")))
(clobber (match_scratch:TF 2 "=f"))]
@@ -5432,9 +5472,9 @@
l<BFP:xde><DSF:xde>br\t%0,%1
l<BFP:xde><DSF:xde>b\t%0,%1"
[(set_attr "op_type" "RRE,RXE")
- (set_attr "type" "fsimp<BFP:mode>, fload<BFP:mode>")])
+ (set_attr "type" "fsimp<BFP:type>, fload<BFP:type>")])
-(define_expand "extend<DSF:mode><BFP:mode>2"
+(define_expand "extend<DSF:mode><BFP:mode>2<BFP:tf_fpr>"
[(set (match_operand:BFP 0 "register_operand" "")
(float_extend:BFP (match_operand:DSF 1 "nonimmediate_operand" "")))]
"TARGET_HARD_FLOAT
@@ -5476,27 +5516,27 @@
; For all of them the inexact exceptions are suppressed.
; fiebra, fidbra, fixbra
-(define_insn "<FPINT:fpint_name><BFP:mode>2"
+(define_insn "<FPINT:fpint_name><BFP:mode>2<BFP:tf_fpr>"
[(set (match_operand:BFP 0 "register_operand" "=f")
(unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
FPINT))]
"TARGET_Z196"
"fi<BFP:xde>bra\t%0,<FPINT:fpint_roundingmode>,%1,4"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimp<BFP:mode>")])
+ (set_attr "type" "fsimp<BFP:type>")])
; rint is supposed to raise an inexact exception so we can use the
; older instructions.
; fiebr, fidbr, fixbr
-(define_insn "rint<BFP:mode>2"
+(define_insn "rint<BFP:mode>2<BFP:tf_fpr>"
[(set (match_operand:BFP 0 "register_operand" "=f")
(unspec:BFP [(match_operand:BFP 1 "register_operand" "f")]
UNSPEC_FPINT_RINT))]
""
"fi<BFP:xde>br\t%0,0,%1"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimp<BFP:mode>")])
+ (set_attr "type" "fsimp<BFP:type>")])
; Decimal Floating Point - load fp integer
@@ -5509,7 +5549,7 @@
"TARGET_HARD_DFP"
"fi<DFP:xde>tr\t%0,<FPINT:fpint_roundingmode>,%1,4"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimp<DFP:mode>")])
+ (set_attr "type" "fsimp<DFP:type>")])
; fidtr, fixtr
(define_insn "rint<DFP:mode>2"
@@ -5519,7 +5559,7 @@
"TARGET_HARD_DFP"
"fi<DFP:xde>tr\t%0,0,%1,0"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimp<DFP:mode>")])
+ (set_attr "type" "fsimp<DFP:type>")])
;
; Binary <-> Decimal floating point trunc patterns
@@ -5543,7 +5583,7 @@
"TARGET_HARD_DFP"
"pfpo")
-(define_expand "trunc<BFP:mode><DFP_ALL:mode>2"
+(define_expand "trunc<BFP:mode><DFP_ALL:mode>2<BFP:tf_fpr>"
[(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
(set (reg:SI GPR0_REGNUM) (match_dup 2))
(parallel
@@ -5570,7 +5610,7 @@
operands[2] = GEN_INT (flags);
})
-(define_expand "trunc<DFP_ALL:mode><BFP:mode>2"
+(define_expand "trunc<DFP_ALL:mode><BFP:mode>2<BFP:tf_fpr>"
[(set (reg:DFP_ALL FPR4_REGNUM)
(match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
(set (reg:SI GPR0_REGNUM) (match_dup 2))
@@ -5616,7 +5656,7 @@
"TARGET_HARD_DFP"
"pfpo")
-(define_expand "extend<BFP:mode><DFP_ALL:mode>2"
+(define_expand "extend<BFP:mode><DFP_ALL:mode>2<BFP:tf_fpr>"
[(set (reg:BFP FPR4_REGNUM) (match_operand:BFP 1 "nonimmediate_operand" ""))
(set (reg:SI GPR0_REGNUM) (match_dup 2))
(parallel
@@ -5643,7 +5683,7 @@
operands[2] = GEN_INT (flags);
})
-(define_expand "extend<DFP_ALL:mode><BFP:mode>2"
+(define_expand "extend<DFP_ALL:mode><BFP:mode>2<BFP:tf_fpr>"
[(set (reg:DFP_ALL FPR4_REGNUM)
(match_operand:DFP_ALL 1 "nonimmediate_operand" ""))
(set (reg:SI GPR0_REGNUM) (match_dup 2))
@@ -6122,7 +6162,7 @@
; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
; FIXME: wfadb does not clobber cc
-(define_insn "add<mode>3"
+(define_insn "add<mode>3<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v")
(plus:FP (match_operand:FP 1 "nonimmediate_operand" "%f,0,0,v,v")
(match_operand:FP 2 "general_operand" "f,f,R,v,v")))
@@ -6135,7 +6175,7 @@
wfadb\t%v0,%v1,%v2
wfasb\t%v0,%v1,%v2"
[(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR")
- (set_attr "type" "fsimp<mode>")
+ (set_attr "type" "fsimp<type>")
(set_attr "cpu_facility" "*,*,*,vx,vxe")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")])
@@ -6153,7 +6193,7 @@
a<xde>br\t%0,%2
a<xde>b\t%0,%2"
[(set_attr "op_type" "RRF,RRE,RXE")
- (set_attr "type" "fsimp<mode>")
+ (set_attr "type" "fsimp<type>")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")])
; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr
@@ -6169,7 +6209,7 @@
a<xde>br\t%0,%2
a<xde>b\t%0,%2"
[(set_attr "op_type" "RRF,RRE,RXE")
- (set_attr "type" "fsimp<mode>")
+ (set_attr "type" "fsimp<type>")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")])
;
@@ -6567,7 +6607,7 @@
; FIXME: (clobber (match_scratch:CC 3 "=c,c,c,X,X")) does not work - why?
; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
-(define_insn "sub<mode>3"
+(define_insn "sub<mode>3<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v")
(minus:FP (match_operand:FP 1 "register_operand" "f,0,0,v,v")
(match_operand:FP 2 "general_operand" "f,f,R,v,v")))
@@ -6580,7 +6620,7 @@
wfsdb\t%v0,%v1,%v2
wfssb\t%v0,%v1,%v2"
[(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR")
- (set_attr "type" "fsimp<mode>")
+ (set_attr "type" "fsimp<type>")
(set_attr "cpu_facility" "*,*,*,vx,vxe")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")])
@@ -6598,7 +6638,7 @@
s<xde>br\t%0,%2
s<xde>b\t%0,%2"
[(set_attr "op_type" "RRF,RRE,RXE")
- (set_attr "type" "fsimp<mode>")
+ (set_attr "type" "fsimp<type>")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")])
; sxbr, sdbr, sebr, sdb, seb, sxtr, sdtr
@@ -6614,7 +6654,7 @@
s<xde>br\t%0,%2
s<xde>b\t%0,%2"
[(set_attr "op_type" "RRF,RRE,RXE")
- (set_attr "type" "fsimp<mode>")
+ (set_attr "type" "fsimp<type>")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>")])
@@ -7148,7 +7188,7 @@
;
; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr
-(define_insn "mul<mode>3"
+(define_insn "mul<mode>3<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v")
(mult:FP (match_operand:FP 1 "nonimmediate_operand" "%f,0,0,v,v")
(match_operand:FP 2 "general_operand" "f,f,R,v,v")))]
@@ -7160,7 +7200,7 @@
wfmdb\t%v0,%v1,%v2
wfmsb\t%v0,%v1,%v2"
[(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR")
- (set_attr "type" "fmul<mode>")
+ (set_attr "type" "fmul<type>")
(set_attr "cpu_facility" "*,*,*,vx,vxe")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")])
@@ -7170,7 +7210,7 @@
(fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,v,v")
(match_operand:DSF 2 "nonimmediate_operand" "f,R,v,v")
(match_operand:DSF 3 "register_operand" "0,0,v,v")))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT && s390_fma_allowed_p (<MODE>mode)"
"@
ma<xde>br\t%0,%1,%2
ma<xde>b\t%0,%1,%2
@@ -7187,7 +7227,7 @@
(fma:DSF (match_operand:DSF 1 "nonimmediate_operand" "%f,f,v,v")
(match_operand:DSF 2 "nonimmediate_operand" "f,R,v,v")
(neg:DSF (match_operand:DSF 3 "register_operand" "0,0,v,v"))))]
- "TARGET_HARD_FLOAT"
+ "TARGET_HARD_FLOAT && s390_fma_allowed_p (<MODE>mode)"
"@
ms<xde>br\t%0,%1,%2
ms<xde>b\t%0,%1,%2
@@ -7453,7 +7493,7 @@
;
; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr
-(define_insn "div<mode>3"
+(define_insn "div<mode>3<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v")
(div:FP (match_operand:FP 1 "register_operand" "f,0,0,v,v")
(match_operand:FP 2 "general_operand" "f,f,R,v,v")))]
@@ -7465,7 +7505,7 @@
wfddb\t%v0,%v1,%v2
wfdsb\t%v0,%v1,%v2"
[(set_attr "op_type" "RRF,RRE,RXE,VRR,VRR")
- (set_attr "type" "fdiv<mode>")
+ (set_attr "type" "fdiv<type>")
(set_attr "cpu_facility" "*,*,*,vx,vxe")
(set_attr "enabled" "<nBFP>,<nDFP>,<DSF>,<DF>,<SF>")])
@@ -8782,10 +8822,10 @@
operands[6] = gen_label_rtx ();")
;
-; neg(df|sf)2 instruction pattern(s).
+; neg(tf|df|sf)2 instruction pattern(s).
;
-(define_expand "neg<mode>2"
+(define_expand "neg<mode>2<tf_fpr>"
[(parallel
[(set (match_operand:BFP 0 "register_operand")
(neg:BFP (match_operand:BFP 1 "register_operand")))
@@ -8802,7 +8842,7 @@
"s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
"lc<xde>br\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lcxbr, lcdbr, lcebr
(define_insn "*neg<mode>2_cconly"
@@ -8813,7 +8853,7 @@
"s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
"lc<xde>br\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lcdfr
(define_insn "*neg<mode>2_nocc"
@@ -8822,7 +8862,7 @@
"TARGET_DFP"
"lcdfr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lcxbr, lcdbr, lcebr
; FIXME: wflcdb does not clobber cc
@@ -8838,7 +8878,7 @@
wflcsb\t%0,%1"
[(set_attr "op_type" "RRE,VRR,VRR")
(set_attr "cpu_facility" "*,vx,vxe")
- (set_attr "type" "fsimp<mode>,*,*")
+ (set_attr "type" "fsimp<type>,*,*")
(set_attr "enabled" "*,<DF>,<SF>")])
@@ -8906,10 +8946,10 @@
(set_attr "z10prop" "z10_c")])
;
-; abs(df|sf)2 instruction pattern(s).
+; abs(tf|df|sf)2 instruction pattern(s).
;
-(define_expand "abs<mode>2"
+(define_expand "abs<mode>2<tf_fpr>"
[(parallel
[(set (match_operand:BFP 0 "register_operand" "=f")
(abs:BFP (match_operand:BFP 1 "register_operand" "f")))
@@ -8927,7 +8967,7 @@
"s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
"lp<xde>br\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lpxbr, lpdbr, lpebr
(define_insn "*abs<mode>2_cconly"
@@ -8938,7 +8978,7 @@
"s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
"lp<xde>br\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lpdfr
(define_insn "*abs<mode>2_nocc"
@@ -8947,7 +8987,7 @@
"TARGET_DFP"
"lpdfr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lpxbr, lpdbr, lpebr
; FIXME: wflpdb does not clobber cc
@@ -8961,7 +9001,7 @@
wflpdb\t%0,%1"
[(set_attr "op_type" "RRE,VRR")
(set_attr "cpu_facility" "*,vx")
- (set_attr "type" "fsimp<mode>,*")
+ (set_attr "type" "fsimp<type>,*")
(set_attr "enabled" "*,<DFDI>")])
@@ -9043,7 +9083,7 @@
"s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
"ln<xde>br\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lnxbr, lndbr, lnebr
(define_insn "*negabs<mode>2_cconly"
@@ -9054,7 +9094,7 @@
"s390_match_ccmode (insn, CCSmode) && TARGET_HARD_FLOAT"
"ln<xde>br\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lndfr
(define_insn "*negabs<mode>2_nocc"
@@ -9063,7 +9103,7 @@
"TARGET_DFP"
"lndfr\t%0,%1"
[(set_attr "op_type" "RRE")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
; lnxbr, lndbr, lnebr
; FIXME: wflndb does not clobber cc
@@ -9077,7 +9117,7 @@
wflndb\t%0,%1"
[(set_attr "op_type" "RRE,VRR")
(set_attr "cpu_facility" "*,vx")
- (set_attr "type" "fsimp<mode>,*")
+ (set_attr "type" "fsimp<type>,*")
(set_attr "enabled" "*,<DFDI>")])
;;
@@ -9089,7 +9129,7 @@
;
; sqxbr, sqdbr, sqebr, sqdb, sqeb
-(define_insn "sqrt<mode>2"
+(define_insn "sqrt<mode>2<tf_fpr>"
[(set (match_operand:BFP 0 "register_operand" "=f,f,v")
(sqrt:BFP (match_operand:BFP 1 "general_operand" "f,R,v")))]
"TARGET_HARD_FLOAT"
@@ -9098,7 +9138,7 @@
sq<xde>b\t%0,%1
wfsqdb\t%v0,%v1"
[(set_attr "op_type" "RRE,RXE,VRR")
- (set_attr "type" "fsqrt<mode>")
+ (set_attr "type" "fsqrt<type>")
(set_attr "cpu_facility" "*,*,vx")
(set_attr "enabled" "*,<DSF>,<DFDI>")])
@@ -9299,8 +9339,8 @@
(define_expand "cbranch<mode>4"
[(set (pc)
(if_then_else (match_operator 0 "comparison_operator"
- [(match_operand:FP 1 "register_operand" "")
- (match_operand:FP 2 "general_operand" "")])
+ [(match_operand:FP_ANYTF 1 "register_operand" "")
+ (match_operand:FP_ANYTF 2 "general_operand" "")])
(label_ref (match_operand 3 "" ""))
(pc)))]
"TARGET_HARD_FLOAT"
@@ -11795,7 +11835,7 @@
;;- Copy sign instructions
;;
-(define_insn "copysign<mode>3"
+(define_insn "copysign<mode>3<tf_fpr>"
[(set (match_operand:FP 0 "register_operand" "=f")
(unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>")
(match_operand:FP 2 "register_operand" "f")]
@@ -11803,7 +11843,7 @@
"TARGET_Z196"
"cpsdr\t%0,%2,%1"
[(set_attr "op_type" "RRF")
- (set_attr "type" "fsimp<mode>")])
+ (set_attr "type" "fsimp<type>")])
;;
diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt
index 300309c..0afcea3 100644
--- a/gcc/config/s390/s390.opt
+++ b/gcc/config/s390/s390.opt
@@ -304,3 +304,14 @@ mnop-mcount
Target Report Var(flag_nop_mcount)
Generate mcount/__fentry__ calls as nops. To activate they need to be
patched in.
+
+mvx-long-double-fma
+Target Report Undocumented Var(flag_vx_long_double_fma)
+Emit fused multiply-add instructions for long doubles in vector registers
+(wfmaxb, wfmsxb, wfnmaxb, wfnmsxb). Reassociation pass does not handle
+fused multiply-adds, therefore code generated by the middle-end is prone to
+having long fused multiply-add chains. This is not pipeline-friendly,
+and the default behavior is to emit separate multiplication and addition
+instructions for long doubles in vector registers, because measurements show
+that this improves performance. This option allows overriding it for testing
+purposes.
diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md
index e9332ba..31d3239 100644
--- a/gcc/config/s390/vector.md
+++ b/gcc/config/s390/vector.md
@@ -27,10 +27,14 @@
V2SF V4SF V1DF V2DF V1TF V1TI TI])
; All modes directly supported by the hardware having full vector reg size
-; V_HW2 is duplicate of V_HW for having two iterators expanding
-; independently e.g. vcond
-(define_mode_iterator V_HW [V16QI V8HI V4SI V2DI (V1TI "TARGET_VXE") V2DF (V4SF "TARGET_VXE") (V1TF "TARGET_VXE")])
-(define_mode_iterator V_HW2 [V16QI V8HI V4SI V2DI V2DF (V4SF "TARGET_VXE") (V1TF "TARGET_VXE")])
+; V_HW2 is for having two iterators expanding independently e.g. vcond.
+; It's similar to V_HW, but not fully identical: V1TI is not included, because
+; there are no 128-bit compares.
+(define_mode_iterator V_HW [V16QI V8HI V4SI V2DI (V1TI "TARGET_VXE") V2DF
+ (V4SF "TARGET_VXE") (V1TF "TARGET_VXE")
+ (TF "TARGET_VXE")])
+(define_mode_iterator V_HW2 [V16QI V8HI V4SI V2DI V2DF (V4SF "TARGET_VXE")
+ (V1TF "TARGET_VXE") (TF "TARGET_VXE")])
(define_mode_iterator V_HW_64 [V2DI V2DF])
(define_mode_iterator VT_HW_HSDT [V8HI V4SI V4SF V2DI V2DF V1TI V1TF TI TF])
@@ -55,19 +59,20 @@
(define_mode_iterator VFT [(V1SF "TARGET_VXE") (V2SF "TARGET_VXE") (V4SF "TARGET_VXE")
V1DF V2DF
- (V1TF "TARGET_VXE")])
+ (V1TF "TARGET_VXE") (TF "TARGET_VXE")])
; FP vector modes directly supported by the HW. This does not include
; vector modes using only part of a vector register and should be used
; for instructions which might trigger IEEE exceptions.
-(define_mode_iterator VF_HW [(V4SF "TARGET_VXE") V2DF (V1TF "TARGET_VXE")])
+(define_mode_iterator VF_HW [(V4SF "TARGET_VXE") V2DF (V1TF "TARGET_VXE")
+ (TF "TARGET_VXE")])
(define_mode_iterator V_8 [V1QI])
(define_mode_iterator V_16 [V2QI V1HI])
(define_mode_iterator V_32 [V4QI V2HI V1SI V1SF])
(define_mode_iterator V_64 [V8QI V4HI V2SI V2SF V1DI V1DF])
-(define_mode_iterator V_128 [V16QI V8HI V4SI V4SF V2DI V2DF V1TI V1TF])
-
+(define_mode_iterator V_128 [V16QI V8HI V4SI V4SF V2DI V2DF V1TI V1TF
+ (TF "TARGET_VXE")])
(define_mode_iterator V_128_NOSINGLE [V16QI V8HI V4SI V4SF V2DI V2DF])
; 32 bit int<->fp vector conversion instructions are available since VXE2 (z15).
@@ -86,6 +91,11 @@
(V1DF "") (V2DF "")
(V1TF "") (TF "")])
+;; Facilitate dispatching TFmode expanders on z14+.
+(define_mode_attr tf_vr [(TF "_vr") (V4SF "") (V2DF "") (V1TF "") (V1SF "")
+ (V2SF "") (V1DF "") (V16QI "") (V8HI "") (V4SI "")
+ (V2DI "") (V1TI "")])
+
; The element type of the vector.
(define_mode_attr non_vec[(V1QI "QI") (V2QI "QI") (V4QI "QI") (V8QI "QI") (V16QI "QI")
(V1HI "HI") (V2HI "HI") (V4HI "HI") (V8HI "HI")
@@ -134,7 +144,7 @@
(V1TI "V1TI")
(V1SF "V1SI") (V2SF "V2SI") (V4SF "V4SI")
(V1DF "V1DI") (V2DF "V2DI")
- (V1TF "V1TI")])
+ (V1TF "V1TI") (TF "V1TI")])
(define_mode_attr vw [(SF "w") (V1SF "w") (V2SF "v") (V4SF "v")
(DF "w") (V1DF "w") (V2DF "v")
(TF "w") (V1TF "w")])
@@ -194,7 +204,7 @@
; for TImode (use double-int for the calculations)
; vgmb, vgmh, vgmf, vgmg, vrepib, vrepih, vrepif, vrepig
-(define_insn "mov<mode>"
+(define_insn "mov<mode><tf_vr>"
[(set (match_operand:V_128 0 "nonimmediate_operand" "=v,v,R, v, v, v, v, v,v,*d,*d,?o")
(match_operand:V_128 1 "general_operand" " v,R,v,j00,jm1,jyy,jxx,jKK,d, v,dT,*d"))]
""
@@ -214,6 +224,12 @@
[(set_attr "cpu_facility" "vx,vx,vx,vx,vx,vx,vx,vx,vx,vx,*,*")
(set_attr "op_type" "VRR,VRX,VRX,VRI,VRI,VRI,VRI,VRI,VRR,*,*,*")])
+(define_expand "movtf"
+ [(match_operand:TF 0 "nonimmediate_operand" "")
+ (match_operand:TF 1 "general_operand" "")]
+ ""
+ { EXPAND_MOVTF(movtf); })
+
; VR -> GPR, no instruction so split it into 64 element sets.
(define_split
[(set (match_operand:V_128 0 "register_operand" "")
@@ -565,10 +581,10 @@
; A TFmode operand resides in FPR register pairs while V1TF is in a
; single vector register.
-(define_insn "*vec_tf_to_v1tf"
+(define_insn "*vec_tf_to_v1tf_fpr"
[(set (match_operand:V1TF 0 "nonimmediate_operand" "=v,v,R,v,v")
(vec_duplicate:V1TF (match_operand:TF 1 "general_operand" "f,R,f,G,d")))]
- "TARGET_VX"
+ "TARGET_VX && !TARGET_VXE"
"@
vmrhg\t%v0,%1,%N1
vl\t%v0,%1%A1
@@ -577,6 +593,26 @@
vlvgp\t%v0,%1,%N1"
[(set_attr "op_type" "VRR,VRX,VRX,VRI,VRR")])
+; Both TFmode and V1TFmode operands reside in vector registers.
+(define_insn "*vec_tf_to_v1tf_vr"
+ [(set (match_operand:V1TF 0 "nonimmediate_operand" "=v,v,R,v,v")
+ (vec_duplicate:V1TF (match_operand:TF 1 "general_operand" "v,R,v,G,d")))]
+ "TARGET_VXE"
+ "@
+ vlr\t%v0,%1
+ vl\t%v0,%1%A1
+ vst\t%v1,%0%A0
+ vzero\t%v0
+ vlvgp\t%v0,%1,%N1"
+ [(set_attr "op_type" "VRR,VRX,VRX,VRI,VRR")])
+
+(define_insn "*fprx2_to_tf"
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=v")
+ (subreg:TF (match_operand:FPRX2 1 "general_operand" "f") 0))]
+ "TARGET_VXE"
+ "vmrhg\t%v0,%1,%N1"
+ [(set_attr "op_type" "VRR")])
+
(define_insn "*vec_ti_to_v1ti"
[(set (match_operand:V1TI 0 "nonimmediate_operand" "=v,v,R, v, v,v")
(vec_duplicate:V1TI (match_operand:TI 1 "general_operand" "v,R,v,j00,jm1,d")))]
@@ -658,6 +694,17 @@
DONE;
})
+(define_expand "vcond_mask_<mode><mode>"
+ [(set (match_operand:V 0 "register_operand" "")
+ (if_then_else:V
+ (eq (match_operand:<tointvec> 3 "register_operand" "")
+ (match_dup 4))
+ (match_operand:V 2 "register_operand" "")
+ (match_operand:V 1 "register_operand" "")))]
+ "TARGET_VX"
+ "operands[4] = CONST0_RTX (<tointvec>mode);")
+
+
; We only have HW support for byte vectors. The middle-end is
; supposed to lower the mode if required.
(define_insn "vec_permv16qi"
@@ -680,6 +727,21 @@
"vperm\t%v0,%v1,%v2,%v3"
[(set_attr "op_type" "VRR")])
+(define_insn "*mov_tf_to_fprx2_0"
+ [(set (subreg:DF (match_operand:FPRX2 0 "nonimmediate_operand" "=f") 0)
+ (subreg:DF (match_operand:TF 1 "general_operand" "v") 0))]
+ "TARGET_VXE"
+ ; M4 == 1 corresponds to %v0[0] = %v1[0]; %v0[1] = %v0[1];
+ "vpdi\t%v0,%v1,%v0,1"
+ [(set_attr "op_type" "VRR")])
+
+(define_insn "*mov_tf_to_fprx2_1"
+ [(set (subreg:DF (match_operand:FPRX2 0 "nonimmediate_operand" "=f") 8)
+ (subreg:DF (match_operand:TF 1 "general_operand" "v") 8))]
+ "TARGET_VXE"
+ ; M4 == 5 corresponds to %V0[0] = %v1[1]; %V0[1] = %V0[1];
+ "vpdi\t%V0,%v1,%V0,5"
+ [(set_attr "op_type" "VRR")])
; vec_perm_const for V2DI using vpdi?
@@ -1242,7 +1304,7 @@
;;
; vfasb, vfadb, wfasb, wfadb, wfaxb
-(define_insn "add<mode>3"
+(define_insn "add<mode>3<tf_vr>"
[(set (match_operand:VF_HW 0 "register_operand" "=v")
(plus:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")))]
@@ -1250,8 +1312,15 @@
"<vw>fa<sdx>b\t%v0,%v1,%v2"
[(set_attr "op_type" "VRR")])
+(define_expand "addtf3"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "nonimmediate_operand" "")
+ (match_operand:TF 2 "general_operand" "")]
+ "HAVE_TF (addtf3)"
+ { EXPAND_TF (addtf3, 3); })
+
; vfssb, vfsdb, wfssb, wfsdb, wfsxb
-(define_insn "sub<mode>3"
+(define_insn "sub<mode>3<tf_vr>"
[(set (match_operand:VF_HW 0 "register_operand" "=v")
(minus:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")))]
@@ -1259,8 +1328,15 @@
"<vw>fs<sdx>b\t%v0,%v1,%v2"
[(set_attr "op_type" "VRR")])
+(define_expand "subtf3"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")
+ (match_operand:TF 2 "general_operand" "")]
+ "HAVE_TF (subtf3)"
+ { EXPAND_TF (subtf3, 3); })
+
; vfmsb, vfmdb, wfmsb, wfmdb, wfmxb
-(define_insn "mul<mode>3"
+(define_insn "mul<mode>3<tf_vr>"
[(set (match_operand:VF_HW 0 "register_operand" "=v")
(mult:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")))]
@@ -1268,8 +1344,15 @@
"<vw>fm<sdx>b\t%v0,%v1,%v2"
[(set_attr "op_type" "VRR")])
+(define_expand "multf3"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "nonimmediate_operand" "")
+ (match_operand:TF 2 "general_operand" "")]
+ "HAVE_TF (multf3)"
+ { EXPAND_TF (multf3, 3); })
+
; vfdsb, vfddb, wfdsb, wfddb, wfdxb
-(define_insn "div<mode>3"
+(define_insn "div<mode>3<tf_vr>"
[(set (match_operand:VF_HW 0 "register_operand" "=v")
(div:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")))]
@@ -1277,21 +1360,34 @@
"<vw>fd<sdx>b\t%v0,%v1,%v2"
[(set_attr "op_type" "VRR")])
+(define_expand "divtf3"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")
+ (match_operand:TF 2 "general_operand" "")]
+ "HAVE_TF (divtf3)"
+ { EXPAND_TF (divtf3, 3); })
+
; vfsqsb, vfsqdb, wfsqsb, wfsqdb, wfsqxb
-(define_insn "sqrt<mode>2"
- [(set (match_operand:VF_HW 0 "register_operand" "=v")
+(define_insn "sqrt<mode>2<tf_vr>"
+ [(set (match_operand:VF_HW 0 "register_operand" "=v")
(sqrt:VF_HW (match_operand:VF_HW 1 "register_operand" "v")))]
"TARGET_VX"
"<vw>fsq<sdx>b\t%v0,%v1"
[(set_attr "op_type" "VRR")])
+(define_expand "sqrttf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "general_operand" "")]
+ "HAVE_TF (sqrttf2)"
+ { EXPAND_TF (sqrttf2, 2); })
+
; vfmasb, vfmadb, wfmasb, wfmadb, wfmaxb
(define_insn "fma<mode>4"
[(set (match_operand:VF_HW 0 "register_operand" "=v")
(fma:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")
(match_operand:VF_HW 3 "register_operand" "v")))]
- "TARGET_VX"
+ "TARGET_VX && s390_fma_allowed_p (<MODE>mode)"
"<vw>fma<sdx>b\t%v0,%v1,%v2,%v3"
[(set_attr "op_type" "VRR")])
@@ -1301,7 +1397,7 @@
(fma:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")
(neg:VF_HW (match_operand:VF_HW 3 "register_operand" "v"))))]
- "TARGET_VX"
+ "TARGET_VX && s390_fma_allowed_p (<MODE>mode)"
"<vw>fms<sdx>b\t%v0,%v1,%v2,%v3"
[(set_attr "op_type" "VRR")])
@@ -1312,7 +1408,7 @@
(fma:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")
(match_operand:VF_HW 3 "register_operand" "v"))))]
- "TARGET_VXE"
+ "TARGET_VXE && s390_fma_allowed_p (<MODE>mode)"
"<vw>fnma<sdx>b\t%v0,%v1,%v2,%v3"
[(set_attr "op_type" "VRR")])
@@ -1323,26 +1419,38 @@
(fma:VF_HW (match_operand:VF_HW 1 "register_operand" "v")
(match_operand:VF_HW 2 "register_operand" "v")
(neg:VF_HW (match_operand:VF_HW 3 "register_operand" "v")))))]
- "TARGET_VXE"
+ "TARGET_VXE && s390_fma_allowed_p (<MODE>mode)"
"<vw>fnms<sdx>b\t%v0,%v1,%v2,%v3"
[(set_attr "op_type" "VRR")])
; vflcsb, vflcdb, wflcsb, wflcdb, wflcxb
-(define_insn "neg<mode>2"
+(define_insn "neg<mode>2<tf_vr>"
[(set (match_operand:VFT 0 "register_operand" "=v")
(neg:VFT (match_operand:VFT 1 "register_operand" "v")))]
"TARGET_VX"
"<vw>flc<sdx>b\t%v0,%v1"
[(set_attr "op_type" "VRR")])
+(define_expand "negtf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (negtf2)"
+ { EXPAND_TF (negtf2, 2); })
+
; vflpsb, vflpdb, wflpsb, wflpdb, wflpxb
-(define_insn "abs<mode>2"
+(define_insn "abs<mode>2<tf_vr>"
[(set (match_operand:VFT 0 "register_operand" "=v")
(abs:VFT (match_operand:VFT 1 "register_operand" "v")))]
"TARGET_VX"
"<vw>flp<sdx>b\t%v0,%v1"
[(set_attr "op_type" "VRR")])
+(define_expand "abstf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (abstf2)"
+ { EXPAND_TF (abstf2, 2); })
+
; vflnsb, vflndb, wflnsb, wflndb, wflnxb
(define_insn "negabs<mode>2"
[(set (match_operand:VFT 0 "register_operand" "=v")
@@ -1441,7 +1549,29 @@
;; 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")))]
@@ -2119,6 +2249,24 @@
"vc<VX_VEC_CONV_BFP:xde><VX_VEC_CONV_INT:bhfgq>b\t%v0,%v1,0,0"
[(set_attr "op_type" "VRR")])
+; There is no instruction for loading a signed integer into an extended BFP
+; operand in a VR, therefore we need to load it into a FPR pair first.
+(define_expand "float<mode>tf2_vr"
+ [(set (match_dup 2)
+ (float:FPRX2 (match_operand:DSI 1 "register_operand" "")))
+ (set (match_operand:TF 0 "register_operand" "")
+ (subreg:TF (match_dup 2) 0))]
+ "TARGET_VXE"
+{
+ operands[2] = gen_reg_rtx (FPRX2mode);
+})
+
+(define_expand "float<mode>tf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:DSI 1 "register_operand" "")]
+ "HAVE_TF (float<mode>tf2)"
+ { EXPAND_TF (float<mode>tf2, 2); })
+
; unsigned integer to floating point
; op2: inexact exception not suppressed (IEEE 754 2008)
@@ -2132,6 +2280,24 @@
"vc<VX_VEC_CONV_BFP:xde>l<VX_VEC_CONV_INT:bhfgq>b\t%v0,%v1,0,0"
[(set_attr "op_type" "VRR")])
+; There is no instruction for loading an unsigned integer into an extended BFP
+; operand in a VR, therefore load it into a FPR pair first.
+(define_expand "floatuns<mode>tf2_vr"
+ [(set (match_dup 2)
+ (unsigned_float:FPRX2 (match_operand:GPR 1 "register_operand" "")))
+ (set (match_operand:TF 0 "register_operand" "")
+ (subreg:TF (match_dup 2) 0))]
+ "TARGET_VXE"
+{
+ operands[2] = gen_reg_rtx (FPRX2mode);
+})
+
+(define_expand "floatuns<mode>tf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:GPR 1 "register_operand" "")]
+ "HAVE_TF (floatuns<mode>tf2)"
+ { EXPAND_TF (floatuns<mode>tf2, 2); })
+
; floating point to signed integer
; op2: inexact exception not suppressed (IEEE 754 2008)
@@ -2145,6 +2311,27 @@
"vc<VX_VEC_CONV_INT:bhfgq><VX_VEC_CONV_BFP:xde>b\t%v0,%v1,0,5"
[(set_attr "op_type" "VRR")])
+; There is no instruction for rounding an extended BFP operand in a VR into
+; a signed integer, therefore copy it into a FPR pair first.
+(define_expand "fix_trunctf<mode>2_vr"
+ [(set (subreg:DF (match_dup 2) 0)
+ (subreg:DF (match_operand:TF 1 "register_operand" "") 0))
+ (set (subreg:DF (match_dup 2) 8) (subreg:DF (match_dup 1) 8))
+ (parallel [(set (match_operand:GPR 0 "register_operand" "")
+ (fix:GPR (match_dup 2)))
+ (unspec:GPR [(const_int BFP_RND_TOWARD_0)] UNSPEC_ROUND)
+ (clobber (reg:CC CC_REGNUM))])]
+ "TARGET_VXE"
+{
+ operands[2] = gen_reg_rtx (FPRX2mode);
+})
+
+(define_expand "fix_trunctf<mode>2"
+ [(match_operand:GPR 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (fix_trunctf<mode>2)"
+ { EXPAND_TF (fix_trunctf<mode>2, 2); })
+
; floating point to unsigned integer
; op2: inexact exception not suppressed (IEEE 754 2008)
@@ -2158,6 +2345,186 @@
"vcl<VX_VEC_CONV_INT:bhfgq><VX_VEC_CONV_BFP:xde>b\t%v0,%v1,0,5"
[(set_attr "op_type" "VRR")])
+; There is no instruction for rounding an extended BFP operand in a VR into
+; an unsigned integer, therefore copy it into a FPR pair first.
+(define_expand "fixuns_trunctf<mode>2_vr"
+ [(set (subreg:DF (match_dup 2) 0)
+ (subreg:DF (match_operand:TF 1 "register_operand" "") 0))
+ (set (subreg:DF (match_dup 2) 8) (subreg:DF (match_dup 1) 8))
+ (parallel [(set (match_operand:GPR 0 "register_operand" "")
+ (unsigned_fix:GPR (match_dup 2)))
+ (unspec:GPR [(const_int BFP_RND_TOWARD_0)] UNSPEC_ROUND)
+ (clobber (reg:CC CC_REGNUM))])]
+ "TARGET_VXE"
+{
+ operands[2] = gen_reg_rtx (FPRX2mode);
+})
+
+(define_expand "fixuns_trunctf<mode>2"
+ [(match_operand:GPR 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (fixuns_trunctf<mode>2)"
+ { EXPAND_TF (fixuns_trunctf<mode>2, 2); })
+
+; load fp integer
+
+; vfisb, wfisb, vfidb, wfidb, wfixb; suppress inexact exceptions
+(define_insn "<FPINT:fpint_name><VF_HW:mode>2<VF_HW:tf_vr>"
+ [(set (match_operand:VF_HW 0 "register_operand" "=v")
+ (unspec:VF_HW [(match_operand:VF_HW 1 "register_operand" "v")]
+ FPINT))]
+ "TARGET_VX"
+ "<vw>fi<VF_HW:sdx>b\t%v0,%v1,4,<FPINT:fpint_roundingmode>"
+ [(set_attr "op_type" "VRR")])
+
+(define_expand "<FPINT:fpint_name>tf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")
+ ; recognize FPINT as an iterator
+ (unspec:TF [(match_dup 1)] FPINT)]
+ "HAVE_TF (<FPINT:fpint_name>tf2)"
+ { EXPAND_TF (<FPINT:fpint_name>tf2, 2); })
+
+; vfisb, wfisb, vfidb, wfidb, wfixb; raise inexact exceptions
+(define_insn "rint<mode>2<tf_vr>"
+ [(set (match_operand:VF_HW 0 "register_operand" "=v")
+ (unspec:VF_HW [(match_operand:VF_HW 1 "register_operand" "v")]
+ UNSPEC_FPINT_RINT))]
+ "TARGET_VX"
+ "<vw>fi<sdx>b\t%v0,%v1,0,0"
+ [(set_attr "op_type" "VRR")])
+
+(define_expand "rinttf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (rinttf2)"
+ { EXPAND_TF (rinttf2, 2); })
+
+; load rounded
+
+; wflrx
+(define_insn "*trunctfdf2_vr"
+ [(set (match_operand:DF 0 "register_operand" "=f")
+ (float_truncate:DF (match_operand:TF 1 "register_operand" "v")))
+ (unspec:DF [(match_operand 2 "const_int_operand" "")]
+ UNSPEC_ROUND)]
+ "TARGET_VXE"
+ "wflrx\t%v0,%v1,0,%2"
+ [(set_attr "op_type" "VRR")])
+
+(define_expand "trunctfdf2_vr"
+ [(parallel [
+ (set (match_operand:DF 0 "register_operand" "")
+ (float_truncate:DF (match_operand:TF 1 "register_operand" "")))
+ (unspec:DF [(const_int BFP_RND_CURRENT)] UNSPEC_ROUND)])]
+ "TARGET_VXE")
+
+(define_expand "trunctfdf2"
+ [(match_operand:DF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (trunctfdf2)"
+ { EXPAND_TF (trunctfdf2, 2); })
+
+; wflrx + (ledbr|wledb)
+(define_expand "trunctfsf2_vr"
+ [(parallel [
+ (set (match_dup 2)
+ (float_truncate:DF (match_operand:TF 1 "register_operand" "")))
+ (unspec:DF [(const_int BFP_RND_PREP_FOR_SHORT_PREC)] UNSPEC_ROUND)])
+ (set (match_operand:SF 0 "register_operand" "")
+ (float_truncate:SF (match_dup 2)))]
+ "TARGET_VXE"
+{
+ operands[2] = gen_reg_rtx(DFmode);
+})
+
+(define_expand "trunctfsf2"
+ [(match_operand:SF 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (trunctfsf2)"
+ { EXPAND_TF (trunctfsf2, 2); })
+
+; load lengthened
+
+(define_insn "extenddftf2_vr"
+ [(set (match_operand:TF 0 "register_operand" "=v")
+ (float_extend:TF (match_operand:DF 1 "register_operand" "f")))]
+ "TARGET_VXE"
+ "wflld\t%v0,%v1"
+ [(set_attr "op_type" "VRR")])
+
+(define_expand "extenddftf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:DF 1 "nonimmediate_operand" "")]
+ "HAVE_TF (extenddftf2)"
+ { EXPAND_TF (extenddftf2, 2); })
+
+(define_expand "extendsftf2_vr"
+ [(set (match_dup 2)
+ (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))
+ (set (match_operand:TF 0 "register_operand" "")
+ (float_extend:TF (match_dup 2)))]
+ "TARGET_VXE"
+{
+ operands[2] = gen_reg_rtx(DFmode);
+})
+
+(define_expand "extendsftf2"
+ [(match_operand:TF 0 "register_operand" "")
+ (match_operand:SF 1 "nonimmediate_operand" "")]
+ "HAVE_TF (extendsftf2)"
+ { EXPAND_TF (extendsftf2, 2); })
+
+; test data class
+
+(define_expand "signbittf2_vr"
+ [(parallel
+ [(set (reg:CCRAW CC_REGNUM)
+ (unspec:CCRAW [(match_operand:TF 1 "register_operand" "")
+ (match_dup 2)]
+ UNSPEC_VEC_VFTCICC))
+ (clobber (scratch:V1TI))])
+ (set (match_operand:SI 0 "register_operand" "")
+ (const_int 0))
+ (set (match_dup 0)
+ (if_then_else:SI (eq (reg:CCRAW CC_REGNUM) (const_int 8))
+ (const_int 1)
+ (match_dup 0)))]
+ "TARGET_VXE"
+{
+ operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET);
+})
+
+(define_expand "signbittf2"
+ [(match_operand:SI 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (signbittf2)"
+ { EXPAND_TF (signbittf2, 2); })
+
+(define_expand "isinftf2_vr"
+ [(parallel
+ [(set (reg:CCRAW CC_REGNUM)
+ (unspec:CCRAW [(match_operand:TF 1 "register_operand" "")
+ (match_dup 2)]
+ UNSPEC_VEC_VFTCICC))
+ (clobber (scratch:V1TI))])
+ (set (match_operand:SI 0 "register_operand" "")
+ (const_int 0))
+ (set (match_dup 0)
+ (if_then_else:SI (eq (reg:CCRAW CC_REGNUM) (const_int 8))
+ (const_int 1)
+ (match_dup 0)))]
+ "TARGET_VXE"
+{
+ operands[2] = GEN_INT (S390_TDC_INFINITY);
+})
+
+(define_expand "isinftf2"
+ [(match_operand:SI 0 "register_operand" "")
+ (match_operand:TF 1 "register_operand" "")]
+ "HAVE_TF (isinftf2)"
+ { EXPAND_TF (isinftf2, 2); })
+
;
; Vector byte swap patterns
;
diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md
index 6f1add0..010db4d 100644
--- a/gcc/config/s390/vx-builtins.md
+++ b/gcc/config/s390/vx-builtins.md
@@ -1940,22 +1940,22 @@
; These ignore the vector result and only want CC stored to an int
; pointer.
-; vftcisb, vftcidb
+; vftcisb, vftcidb, wftcixb
(define_insn "*vftci<mode>_cconly"
[(set (reg:CCRAW CC_REGNUM)
- (unspec:CCRAW [(match_operand:VECF_HW 1 "register_operand")
- (match_operand:HI 2 "const_int_operand")]
+ (unspec:CCRAW [(match_operand:VF_HW 1 "register_operand" "v")
+ (match_operand:HI 2 "const_int_operand" "J")]
UNSPEC_VEC_VFTCICC))
- (clobber (match_scratch:<tointvec> 0))]
+ (clobber (match_scratch:<tointvec> 0 "=v"))]
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'J', \"J\")"
- "vftci<sdx>b\t%v0,%v1,%x2"
+ "<vw>ftci<sdx>b\t%v0,%v1,%x2"
[(set_attr "op_type" "VRR")])
(define_expand "vftci<mode>_intcconly"
[(parallel
[(set (reg:CCRAW CC_REGNUM)
- (unspec:CCRAW [(match_operand:VECF_HW 0 "register_operand")
- (match_operand:HI 1 "const_int_operand")]
+ (unspec:CCRAW [(match_operand:VF_HW 0 "register_operand")
+ (match_operand:HI 1 "const_int_operand")]
UNSPEC_VEC_VFTCICC))
(clobber (scratch:<tointvec>))])
(set (match_operand:SI 2 "register_operand" "")
@@ -1965,27 +1965,27 @@
; vec_fp_test_data_class wants the result vector and the CC stored to
; an int pointer.
-; vftcisb, vftcidb
-(define_insn "*vftci<mode>"
- [(set (match_operand:VECF_HW 0 "register_operand" "=v")
- (unspec:VECF_HW [(match_operand:VECF_HW 1 "register_operand" "v")
- (match_operand:HI 2 "const_int_operand" "J")]
- UNSPEC_VEC_VFTCI))
+; vftcisb, vftcidb, wftcixb
+(define_insn "vftci<mode>"
+ [(set (match_operand:VF_HW 0 "register_operand" "=v")
+ (unspec:VF_HW [(match_operand:VF_HW 1 "register_operand" "v")
+ (match_operand:HI 2 "const_int_operand" "J")]
+ UNSPEC_VEC_VFTCI))
(set (reg:CCRAW CC_REGNUM)
(unspec:CCRAW [(match_dup 1) (match_dup 2)] UNSPEC_VEC_VFTCICC))]
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'J', \"J\")"
- "vftci<sdx>b\t%v0,%v1,%x2"
+ "<vw>ftci<sdx>b\t%v0,%v1,%x2"
[(set_attr "op_type" "VRR")])
(define_expand "vftci<mode>_intcc"
[(parallel
- [(set (match_operand:VECF_HW 0 "register_operand")
- (unspec:VECF_HW [(match_operand:VECF_HW 1 "register_operand")
- (match_operand:HI 2 "const_int_operand")]
- UNSPEC_VEC_VFTCI))
+ [(set (match_operand:VF_HW 0 "register_operand")
+ (unspec:VF_HW [(match_operand:VF_HW 1 "register_operand")
+ (match_operand:HI 2 "const_int_operand")]
+ UNSPEC_VEC_VFTCI))
(set (reg:CCRAW CC_REGNUM)
(unspec:CCRAW [(match_dup 1) (match_dup 2)] UNSPEC_VEC_VFTCICC))])
- (set (match_operand:SI 3 "memory_operand" "")
+ (set (match_operand:SI 3 "nonimmediate_operand")
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))]
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'J', \"J\")")
diff --git a/gcc/config/sol2-d.c b/gcc/config/sol2-d.c
index 73ca786..27068f8 100644
--- a/gcc/config/sol2-d.c
+++ b/gcc/config/sol2-d.c
@@ -33,19 +33,7 @@ solaris_d_os_builtins (void)
d_add_builtin_version ("Solaris"); \
}
-/* Implement TARGET_D_CRITSEC_SIZE for Solaris targets. */
-
-static unsigned
-solaris_d_critsec_size (void)
-{
- /* This is the sizeof pthread_mutex_t. */
- return 24;
-}
-
#undef TARGET_D_OS_VERSIONS
#define TARGET_D_OS_VERSIONS solaris_d_os_builtins
-#undef TARGET_D_CRITSEC_SIZE
-#define TARGET_D_CRITSEC_SIZE solaris_d_critsec_size
-
struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;
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..e2ce22b 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 ""
@@ -260,6 +265,18 @@ extern void vxworks_asm_out_destructor (rtx symbol, int priority);
} \
while (0)
+/* For specific CPU macro definitions expected by the system headers,
+ different versions of VxWorks expect different forms of macros,
+ such as "_VX_CPU=..." on Vx7 and some variants of Vx6, or "CPU=..."
+ on all Vx6 and earlier. Setup a common prefix macro here, that
+ arch specific ports can reuse. */
+
+#if TARGET_VXWORKS7
+#define VX_CPU_PREFIX "_VX_"
+#else
+#define VX_CPU_PREFIX ""
+#endif
+
#define VXWORKS_KIND VXWORKS_KIND_NORMAL
/* The diab linker does not handle .gnu_attribute sections. */
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 abff47d..9d2fd0d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -972,6 +972,7 @@ with_documentation_root_url
with_changes_root_url
enable_languages
with_multilib_list
+with_multilib_generator
with_zstd
with_zstd_include
with_zstd_lib
@@ -1811,6 +1812,8 @@ Optional Packages:
--with-changes-root-url=URL
Root for GCC changes URLs
--with-multilib-list select multilibs (AArch64, SH and x86-64 only)
+ --with-multilib-generator
+ Multi-libs configuration string (RISC-V only)
--with-zstd=PATH specify prefix directory for installed zstd library.
Equivalent to --with-zstd-include=PATH/include plus
--with-zstd-lib=PATH/lib
@@ -8002,6 +8005,15 @@ else
fi
+
+# Check whether --with-multilib-generator was given.
+if test "${with_multilib_generator+set}" = set; then :
+ withval=$with_multilib_generator; :
+else
+ with_multilib_generator=default
+fi
+
+
# -------------------------
# Checks for other programs
# -------------------------
@@ -19018,7 +19030,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19021 "configure"
+#line 19033 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19124,7 +19136,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19127 "configure"
+#line 19139 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -28701,7 +28713,7 @@ 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
- success=yes
+ dwarf4_success=yes
fi
else
@@ -28741,6 +28753,7 @@ 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 :
@@ -28772,9 +28785,7 @@ 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
-
-$as_echo "#define HAVE_AS_WORKING_DWARF_4_FLAG 1" >>confdefs.h
-
+ dwarf4_success=yes
fi
break
@@ -28785,6 +28796,105 @@ fi
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 :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 26a5d8e..73034bb 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1102,6 +1102,11 @@ AC_ARG_WITH(multilib-list,
:,
with_multilib_list=default)
+AC_ARG_WITH(multilib-generator,
+[AS_HELP_STRING([--with-multilib-generator], [Multi-libs configuration string (RISC-V only)])],
+:,
+with_multilib_generator=default)
+
# -------------------------
# Checks for other programs
# -------------------------
@@ -5364,7 +5369,7 @@ foo:
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],,
- [success=yes])
+ [dwarf4_success=yes])
else
gcc_GAS_CHECK_FEATURE([assembly of compiler generated 64-bit .debug_line],
gcc_cv_as_debug_line_64_flag,
@@ -5372,11 +5377,11 @@ foo:
[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],,
- [AC_DEFINE(HAVE_AS_WORKING_DWARF_4_FLAG, 1,
-[Define if your assembler supports --gdwarf-4 even with compiler generated .debug_line])])
+ [dwarf4_success=yes])
break
fi
dwarf4_debug_info_size=0x36
@@ -5385,6 +5390,59 @@ foo:
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],,
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 6b6cfcd..da178b6 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
@@ -436,6 +444,18 @@ enum excess_precision_type
EXCESS_PRECISION_TYPE_FAST
};
+/* Level of size optimization. */
+
+enum optimize_size_level
+{
+ /* Do not optimize for size. */
+ OPTIMIZE_SIZE_NO,
+ /* Optimize for size but not at extreme performance costs. */
+ OPTIMIZE_SIZE_BALANCED,
+ /* Optimize for size as much as possible. */
+ OPTIMIZE_SIZE_MAX
+};
+
/* Support for user-provided GGC and PCH markers. The first parameter
is a pointer to a pointer, the second a cookie. */
typedef void (*gt_pointer_operator) (void *, void *);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c28ae8c..9c36b80 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,688 @@
+2020-11-09 Marek Polacek <polacek@redhat.com>
+
+ DR 1914
+ * parser.c (cp_parser_check_std_attribute): Return bool. Add a
+ location_t parameter. Return true if the attribute wasn't duplicated.
+ Give a warning instead of an error. Check more attributes.
+ (cp_parser_std_attribute_list): Don't add duplicated attributes to
+ the list. Pass location to cp_parser_check_std_attribute.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ * constraint.cc (norm_info::norm_info): Initialize orig_decl.
+ (norm_info::orig_decl): New data member.
+ (normalize_atom): When caching an atom for the first time,
+ compute a list of template parameters used in the targets of the
+ parameter mapping and store it in the TREE_TYPE of the mapping.
+ (get_normalized_constraints_from_decl): Set current_function_decl
+ appropriately when normalizing. As an optimization, don't
+ set up a push_nested_class_guard when decl has no constraints.
+ (sat_hasher::hash): Use this list to hash only the template
+ arguments that are relevant to the atom.
+ (satisfy_atom): Use this list to compare only the template
+ arguments that are relevant to the atom.
+ * pt.c (keep_template_parm): Do a sanity check on the parameter's
+ index when flag_checking.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ * cp-tree.h (ATOMIC_CONSTR_MAP_INSTANTIATED_P): Define this flag
+ for ATOMIC_CONSTRs.
+ * constraint.cc (sat_hasher::hash): Use hash_atomic_constraint
+ if the flag is set, otherwise keep using a pointer hash.
+ (sat_hasher::equal): Return false if the flag's setting differs
+ on two atoms. Call atomic_constraints_identical_p if the flag
+ is set, otherwise keep using a pointer equality test.
+ (satisfy_atom): After instantiating the parameter mapping, form
+ another ATOMIC_CONSTR using the instantiated mapping and query
+ the cache again. Cache the satisfaction value of both atoms.
+ (diagnose_atomic_constraint): Simplify now that the supplied
+ atom has an instantiated mapping.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ * constraint.cc (atom_cache): Define this deletable hash_table.
+ (normalize_atom): Use it to cache ATOMIC_CONSTRs when not
+ generating diagnostics.
+ (sat_hasher::hash): Use htab_hash_pointer instead of
+ hash_atomic_constraint.
+ (sat_hasher::equal): Test for pointer equality instead of
+ atomic_constraints_identical_p.
+ * cp-tree.h (struct atom_hasher): Moved and renamed from ...
+ * logic.cc (struct constraint_hash): ... here.
+ (clause::m_set): Adjust accordingly.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/93907
+ * constraint.cc (tsubst_parameter_mapping): Also canonicalize
+ the type arguments of a TYPE_ARGUMENT_PACk.
+
+2020-11-09 Jason Merrill <jason@redhat.com>
+
+ * pt.c (tsubst): Replace *_ARGUMENT_PACK code with
+ a call to tsubst_argument_pack.
+
+2020-11-09 Jason Merrill <jason@redhat.com>
+
+ * class.c (handle_using_decl): Add an iloc_sentinel.
+
+2020-11-09 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97762
+ * parser.c (warn_about_ambiguous_parse): Handle the case when
+ there is no type in the decl-specifiers.
+
+2020-11-09 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (LOOKUP_FOUND_P): Add ENUMERAL_TYPE.
+ * name-lookup.c (class name_lookup): Add comments.
+ (name_lookup::adl_namespace_only): Replace with ...
+ (name_lookup::adl_class_fns): ... this and ...
+ (name_lookup::adl_namespace_fns): ... this.
+ (name_lookup::adl_namespace): Deal with inline nests here.
+ (name_lookup::adl_class): Complete the type here.
+ (name_lookup::adl_type): Call broken-out enum ..
+ (name_lookup::adl_enum): New. No need to call the namespace adl
+ if it is class-scope.
+ (name_lookup::search_adl): Iterate over collected scopes here.
+
+2020-11-09 Nathan Sidwell <nathan@acm.org>
+
+ * name-lookup.c (lookup_qualified_name): Expose an overload of a
+ singleton with known type.
+ (lookup_name_1): Just check the overload's type to expose it.
+ * parser.c (cp_parser_lookup_name): Do not do that check here.
+
+2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
+
+ * parser.c (cp_parser_objc_at_property_declaration): Handle
+ class keywords in @property attribute context.
+
+2020-11-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/81660
+ * except.c (can_convert_eh): Change the return type to bool. If
+ the type TO and FROM are the same, return true.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * parser.c (cp_parser_objc_at_property_declaration):
+ Improve parsing fidelity. Associate better location info
+ with @property attributes. Clean up the interface to
+ objc_add_property_declaration ().
+
+2020-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/67453
+ * decl.c (duplicate_decls): Propagate DECL_ATTRIBUTES and
+ DECL_PRESERVE_P from olddecl to its clones if any.
+
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete.
+ * cp-objcp-common.c (names_bultin_p): Rename
+ DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
+ * decl.c (decls_match): Likewise. Replace
+ DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN.
+ (duplicate_decls): Likewise.
+ * decl2.c (collect_source_refs): Likewise.
+ * name-lookup.c (anticipated_builtin_p, print_binding_level)
+ (do_nonmember_using_decl): Likewise.
+ * pt.c (builtin_pack_fn_p): Likewise.
+ * typeck.c (error_args_num): Likewise.
+
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * parser.c (cp_parser_template_declaration): Adjust 'export' warning.
+ (cp_parser_explicit_specialization): Remove unneeded bool setting.
+
+2020-11-06 Jan Hubicka <jh@suse.cz>
+
+ * tree.c (cp_fix_function_decl_p): Do not access ipa_ref_list dirrectly.
+
+2020-11-06 Tobias Burnus <tobias@codesourcery.com>
+
+ * parser.c (cp_parser_omp_atomic): Add openacc parameter and update
+ OpenACC matching.
+ (cp_parser_omp_construct): Update call.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ * except.c (check_handlers_1): Add auto_diagnostic_group.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/78209
+ * pt.c (do_auto_deduction): If init is REFERENCE_REF_P, use its
+ first operand.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97675
+ * except.c (check_handlers_1): Use OPT_Wexceptions for the
+ warning. Use inform for the second part of the warning.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/25814
+ * cp-tree.h (enum cp_tree_index): Add CPTI_EXPLICIT_VOID_LIST.
+ (explicit_void_list_node): Define.
+ (PARENTHESIZED_LIST_P): New macro.
+ (struct cp_declarator): Add function::parens_loc.
+ * decl.c (cxx_init_decl_processing): Initialize explicit_void_list_node.
+ (grokparms): Also break when explicit_void_list_node.
+ * parser.c (make_call_declarator): New location_t parameter. Use it
+ to set declarator->u.function.parens_loc.
+ (cp_parser_lambda_declarator_opt): Pass UNKNOWN_LOCATION to
+ make_call_declarator.
+ (warn_about_ambiguous_parse): New function.
+ (cp_parser_init_declarator): Call warn_about_ambiguous_parse.
+ (cp_parser_declarator): Set *parenthesized_p to false rather than to
+ true.
+ (cp_parser_direct_declarator): Create a location for the function's
+ parentheses and pass it to make_call_declarator.
+ (cp_parser_parameter_declaration_clause): Return explicit_void_list_node
+ for (void).
+ (cp_parser_parameter_declaration_list): Set PARENTHESIZED_LIST_P
+ in the parameters tree.
+
+2020-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97670
+ * semantics.c (finish_omp_clauses): Look through array reductions to
+ find underlying decl to clear in the aligned_head bitmap. Use
+ DECL_UID (t) instead of DECL_UID (OMP_CLAUSE_DECL (c)) when clearing
+ in the bitmap. Only diagnose errors about allocate vars not being
+ privatized on the same construct on allocate clause if it has
+ a DECL_P OMP_CLAUSE_DECL.
+
+2020-11-04 Iain Sandoe <iain@sandoe.co.uk>
+
+ * constexpr.c (potential_constant_expression_1): Handle
+ expressions known to be non-constant for Objective-C.
+
+2020-11-03 Jason Merrill <jason@redhat.com>
+
+ * tree.c (is_byte_access_type): Don't use char_type_p.
+
+2020-11-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97663
+ * parser.c (cp_parser_init_declarator): Don't try to parse
+ C++17 deduction guides if there are any type specifiers even when
+ type is NULL.
+
+2020-11-03 Kamlesh Kumar <kamleshbhalui@gmail.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/97453
+ DR2303
+ * pt.c (get_template_base): Consider closest base in template
+ deduction when base of base also matches.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * pt.c (tsubst_expr): Simplify using decl instantiation, add
+ asserts.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * class.c (copy_fndecl_with_name): Always not top level.
+ (build_cdtor_clones): Add update_methods parm, use it to
+ conditionally update the method vec. Return void
+ (clone_cdtor): Adjust.
+ (clone_constructors_and_destructors): Adjust comment.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * pt.c (primary_template_specialization_p): Use
+ VAR_OR_FUNCTION_DECL_P.
+ (tsubst_template_decl): Check for FUNCTION_DECL, not !TYPE && !VAR
+ for registering a specialization.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (fixup_deferred_exception_variants): Declare.
+ * parser.c (cp_parser_class_specifier_1): Call it when
+ completing deferred parses rather than creating a variant.
+ (cp_parser_member_declaration): Move comment from ...
+ (cp_parser_noexcept_specification_opt): ... here. Refactor the
+ deferred parse.
+ * tree.c (fixup_deferred_exception_variants): New.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * pt.c (tsubst_lambda_expr): Reorder extra-scope handling to match
+ the non-template case.
+ (instantiate_body): Move a couple of declarations to their
+ initializers.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (duplicate_decls): Return error_mark_node fo extern-c
+ mismatch.
+
+2020-11-03 Marek Polacek <polacek@redhat.com>
+
+ * constexpr.c (potential_constant_expression_1): Treat
+ __PRETTY_FUNCTION__ inside a template function as
+ potentially-constant.
+ * pt.c (uses_template_parms): Call
+ instantiation_dependent_expression_p instead of
+ value_dependent_expression_p.
+ (instantiation_dependent_expression_p): Check
+ potential_constant_expression before calling
+ value_dependent_expression_p.
+
+2020-11-03 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97632
+ * init.c (build_new_1): Disable -Winit-list-lifetime for an unevaluated
+ operand.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * tree.c (bind_template_template_parm): Mark the parm as a
+ template parm.
+ (cp_tree_equal): Refactor CALL_EXPR. Use comp_template_args for
+ TREE_VECs.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * rtti.c (init_rtti_processing): Move var decl to its init.
+ (get_tinfo_decl): Likewise. Break out creation to called helper
+ ...
+ (get_tinfo_decl_direct): ... here.
+ (build_dynamic_cast_1): Move var decls to their initializers.
+ (tinfo_base_init): Set decl's location to BUILTINS_LOCATION.
+ (get_tinfo_desc): Only push ABI namespace when needed. Set type's
+ context.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (start_decl_1): Refactor declarations. Fixup some
+ whitespace.
+ (lookup_and_check_tag): Fixup some whitespace.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * decl.c (duplicate_decls): Refactor some template & builtin
+ handling.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (struct cxx_int_tree_map): Delete.
+ (struct cxx_int_tree_map_hasher): Delete.
+ * cp-gimplify.c (cxx_int_tree_map_hasher::equal): Delete.
+ (cxx_int_tree_map_hasher::hash): Delete.
+
+2020-11-02 Patrick Palka <ppalka@redhat.com>
+
+ * class.c (finish_struct_1): Don't call clear_satisfaction_cache.
+ * constexpr.c (clear_cv_and_fold_caches): Likewise. Remove bool
+ parameter.
+ * constraint.cc (clear_satisfaction_cache): Remove definition.
+ * cp-tree.h (clear_satisfaction_cache): Remove declaration.
+ (clear_cv_and_fold_caches): Remove bool parameter.
+ * typeck2.c (store_init_value): Remove argument to
+ clear_cv_and_fold_caches.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * parser.c (cp_parser_objc_at_property_declaration): Use any
+ exisiting syntax error to suppress complaints about a missing
+ closing parenthesis in parsing property attributes.
+
+2020-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_ALLOCATE>: Handle
+ non-static members in methods.
+ * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
+
+2020-10-29 Marek Polacek <polacek@redhat.com>
+
+ DR 625
+ PR c++/97479
+ * parser.c (cp_parser_type_id_1): Reject using auto as
+ a template-argument in C++20.
+
+2020-10-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/93107
+ * pt.c (do_auto_deduction): Call resolve_nondeduced_context for
+ the elements of a { } list.
+
+2020-10-29 Marek Polacek <polacek@redhat.com>
+
+ * typeck.c (do_warn_enum_conversions): Don't warn for SPACESHIP_EXPR.
+ (cp_build_binary_op): Reject float <=> enum or enum <=> float. Use
+ CP_INTEGRAL_TYPE_P instead of INTEGRAL_OR_ENUMERATION_TYPE_P.
+
+2020-10-29 Patrick Palka <ppalka@redhat.com>
+
+ * constraint.cc (get_normalized_constraints): Remove 'args'
+ parameter. Pass NULL_TREE as the initial template arguments to
+ normalize_expression.
+ (get_normalized_constraints_from_info): Remove 'args' parameter
+ and adjust the call to get_normalized_constraints.
+ (get_normalized_constraints_from_decl): Remove 'args' local
+ variable and adjust call to get_normalized_constraints_from_info.
+ (normalize_concept_definition): Remove 'args' local variable
+ and adjust call to get_normalized_constraints.
+ (normalize_constraint_expression): Remove the two-parameter
+ overload. Remove 'args' parameter from the three-parameter
+ overload and update function comment accordingly. Remove
+ default argument from 'diag' parameter. Adjust call to
+ get_normalized_constraints.
+ (finish_nested_requirement): Adjust call to
+ normalize_constraint_expression.
+ (strictly_subsumes): Remove 'args' parameter. Adjust call to
+ get_normalized_constraints_from_info.
+ (weakly_subsumes): Likewise.
+ * cp-tree.h (strictly_subsumes): Remove 'args' parameter.
+ (weakly_subsumes): Likewise.
+ * pt.c (process_partial_specialization): Adjust call to
+ strictly_subsumes.
+ (is_compatible_template_arg): Adjust call to weakly_subsumes.
+
+2020-10-29 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97412
+ * constraint.cc (normalize_concept_check): Don't call
+ tsubst_template_args when 'args' is NULL.
+
+2020-10-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/97388
+ * constexpr.c (cxx_eval_outermost_constant_expr): Revert to
+ original expression if evaluation sets non_constant_p.
+
+2020-10-29 Jakub Jelinek <jakub@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/97388
+ * constexpr.c (cxx_bind_parameters_in_call): Set non_constant_args
+ if the parameter type has a non-trivial destructor.
+ (cxx_eval_call_expression): Only unshare arguments if we're
+ memoizing this evaluation.
+
+2020-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/95808
+ * cp-tree.h (enum cp_tree_index): Add CPTI_HEAP_VEC_UNINIT_IDENTIFIER
+ and CPTI_HEAP_VEC_IDENTIFIER.
+ (heap_vec_uninit_identifier, heap_vec_identifier): Define.
+ * decl.c (initialize_predefined_identifiers): Initialize those
+ identifiers.
+ * constexpr.c (cxx_eval_call_expression): Reject array allocations
+ deallocated with non-array deallocation or non-array allocations
+ deallocated with array deallocation.
+ (non_const_var_error): Handle heap_vec_uninit_identifier and
+ heap_vec_identifier too.
+ (cxx_eval_constant_expression): Handle also heap_vec_uninit_identifier
+ and in that case during initialization replace it with
+ heap_vec_identifier.
+ (find_heap_var_refs): Handle heap_vec_uninit_identifier and
+ heap_vec_identifier too.
+
+2020-10-29 Nathan Sidwell <nathan@acm.org>
+
+ * pt.c (push_template_decl): Do not give function-scope entities
+ other than implicit typedefs a template header. Do not readd
+ template info to a redeclared template.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ * decl.c (grokdeclarator): Offer a fix-it hint for the "unnecessary
+ parentheses in declaration" warning.
+ * parser.c (cp_parser_direct_declarator): When setting
+ declarator->parenthesized, use a location range.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97573
+ * call.c (build_conditional_expr_1): Warn about the deprecated
+ enum/real type conversion in C++20. Also warn about a non-enumerated
+ and enumerated type in ?: when -Wenum-conversion is on.
+ * typeck.c (do_warn_enum_conversions): New function.
+ (cp_build_binary_op): Call it.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/96675
+ PR c++/96742
+ * pt.c (tsubst_copy_and_build): Call value_dependent_expression_p or
+ type_dependent_expression_p instead of type_dependent_expression_p_push.
+ But only call value_dependent_expression_p for expressions that are
+ potential_constant_expression.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94799
+ * parser.c (cp_parser_class_name): Use parser->scope when
+ setting typename_p.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/86773
+ * parser.c (cp_parser_fold_expression): Return error_mark_node
+ if a left fold is preceded by an expression.
+
+2020-10-28 Nathan Sidwell <nathan@acm.org>
+
+ * parser.c (cp_parser_omp_declare_reduction): Set
+ DECL_LOCAL_DECL_P before push_template_decl.
+ * pt.c (instantiate_body): Nested fns do not have template_info.
+
+2020-10-28 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/95132
+ * decl2.c (mark_used): Move up the constraints_satisfied_p check
+ so that we check constraints before calling maybe_instantiate_decl.
+
+2020-10-28 Nathan Sidwell <nathan@acm.org>
+
+ * pt.c (push_template_decl): Refactor for some RAII.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * parser.c (cp_parser_omp_clause_name): Handle allocate.
+ (cp_parser_omp_clause_allocate): New function.
+ (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE.
+ (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
+ OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK,
+ OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK,
+ OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK,
+ OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add
+ PRAGMA_OMP_CLAUSE_ALLOCATE.
+ * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE.
+ * pt.c (tsubst_omp_clauses): Likewise.
+
+2020-10-27 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (struct lang_type): Delete nested_udts field.
+ (CLASSTYPE_NESTED_UTDS): Delete.
+ * name-lookup.h (binding_table, binding_entry): Delete typedefs.
+ (bt_foreach_proc): Likewise.
+ (struct binding_entry_s): Delete.
+ (SCOPE_DEFAULT_HT_SIZE, CLASS_SCOPE_HT_SIZE)
+ (NAMESPACE_ORDINARY_HT_SIZE, NAMESPACE_STD_HT_SIZE)
+ (GLOBAL_SCOPE_HT_SIZE): Delete.
+ (binding_table_foreach, binding_table_find): Delete declarations.
+ * name-lookup.c (ENTRY_INDEX): Delete.
+ (free_binding_entry): Delete.
+ (binding_entry_make, binding_entry_free): Delete.
+ (struct binding_table_s): Delete.
+ (binding_table_construct, binding_table_free): Delete.
+ (binding_table_new, binding_table_expand): Delete.
+ (binding_table_insert, binding_table_find): Delete.
+ (binding_table_foreach): Delete.
+ (maybe_process_template_type_declaration): Delete
+ CLASSTYPE_NESTED_UTDS insertion.
+ (do_pushtag): Likewise.
+ * decl2.c (bt_reset_linkage_1): Fold into reset_type_linkage_1.
+ (reset_type_linkage_2, bt_reset_linkage_2): Fold into
+ reset_type_linkage.
+ * pt.c (instantiate_class_template_1): Delete NESTED_UTDs comment.
+ (bt_instantiate_type_proc): Delete.
+ (do_type_instantiation): Instantiate implicit typedef fields.
+ Delete NESTED_UTD walk.
+ * search.c (lookup_field_r): Delete unreachable NESTED_UTD
+ search.
+
+2020-10-27 Nathan Sidwell <nathan@acm.org>
+
+ * parser.c (cp_parser_explicit_instantiation): Refactor some RAII.
+ * pt.c (bt_instantiate_type_proc): DATA is the tree, pass type to
+ do_type_instantiation.
+ (do_type_instantiation): Require T to be a type. Refactor for
+ some RAII.
+
+2020-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ * cp-tree.h (CPTK_IS_NOTHROW_ASSIGNABLE): New.
+ (CPTK_IS_NOTHROW_CONSTRUCTIBLE): Likewise.
+ (is_nothrow_xible): Likewise.
+ * method.c (is_nothrow_xible): New.
+ (is_trivially_xible): Tweak.
+ * parser.c (cp_parser_primary_expression): Handle the new RID_*.
+ (cp_parser_trait_expr): Likewise.
+ * semantics.c (trait_expr_value): Handle the new RID_*.
+ (finish_trait_expr): Likewise.
+
+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
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index bd66251..9861be1 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5643,17 +5643,40 @@ build_conditional_expr_1 (const op_location_t &loc,
"in conditional expression: %qT vs %qT",
arg2_type, arg3_type);
}
- else if (extra_warnings
+ else if ((complain & tf_warning)
+ && warn_deprecated_enum_float_conv
+ && ((TREE_CODE (arg2_type) == ENUMERAL_TYPE
+ && TREE_CODE (arg3_type) == REAL_TYPE)
+ || (TREE_CODE (arg2_type) == REAL_TYPE
+ && TREE_CODE (arg3_type) == ENUMERAL_TYPE)))
+ {
+ if (TREE_CODE (arg2_type) == ENUMERAL_TYPE)
+ warning_at (loc, OPT_Wdeprecated_enum_float_conversion,
+ "conditional expression between enumeration type "
+ "%qT and floating-point type %qT is deprecated",
+ arg2_type, arg3_type);
+ else
+ warning_at (loc, OPT_Wdeprecated_enum_float_conversion,
+ "conditional expression between floating-point "
+ "type %qT and enumeration type %qT is deprecated",
+ arg2_type, arg3_type);
+ }
+ else if ((extra_warnings || warn_enum_conversion)
&& ((TREE_CODE (arg2_type) == ENUMERAL_TYPE
&& !same_type_p (arg3_type, type_promotes_to (arg2_type)))
|| (TREE_CODE (arg3_type) == ENUMERAL_TYPE
&& !same_type_p (arg2_type,
type_promotes_to (arg3_type)))))
- {
- if (complain & tf_warning)
- warning_at (loc, OPT_Wextra, "enumerated and non-enumerated "
- "type in conditional expression");
- }
+ {
+ if (complain & tf_warning)
+ {
+ enum opt_code opt = (warn_enum_conversion
+ ? OPT_Wenum_conversion
+ : OPT_Wextra);
+ warning_at (loc, opt, "enumerated and "
+ "non-enumerated type in conditional expression");
+ }
+ }
arg2 = perform_implicit_conversion (result_type, arg2, complain);
arg3 = perform_implicit_conversion (result_type, arg3, complain);
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 01780fe..7c34d94 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1,4 +1,4 @@
-/* Functions related to building classes and their related objects.
+/* Functions related to building -*- C++ -*- classes and their related objects.
Copyright (C) 1987-2020 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
@@ -1322,6 +1322,8 @@ handle_using_decl (tree using_decl, tree t)
return;
}
+ iloc_sentinel ils (DECL_SOURCE_LOCATION (using_decl));
+
/* Make type T see field decl FDECL with access ACCESS. */
if (flist)
for (ovl_iterator iter (flist); iter; ++iter)
@@ -3283,7 +3285,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
@@ -3292,7 +3295,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)
@@ -4837,7 +4840,10 @@ copy_fndecl_with_name (tree fn, tree name, tree_code code,
/* Create the RTL for this function. */
SET_DECL_RTL (clone, NULL);
- rest_of_decl_compilation (clone, namespace_bindings_p (), at_eof);
+
+ /* Regardless of the current scope, this is a member function, so
+ not at namespace scope. */
+ rest_of_decl_compilation (clone, /*top_level=*/0, at_eof);
return clone;
}
@@ -4897,8 +4903,9 @@ build_clone (tree fn, tree name, bool need_vtt_parm_p,
/* Build the clones of FN, return the number of clones built. These
will be inserted onto DECL_CHAIN of FN. */
-static unsigned
-build_cdtor_clones (tree fn, bool needs_vtt_p, bool base_omits_inherited_p)
+static void
+build_cdtor_clones (tree fn, bool needs_vtt_p, bool base_omits_inherited_p,
+ bool update_methods)
{
unsigned count = 0;
@@ -4934,7 +4941,16 @@ build_cdtor_clones (tree fn, bool needs_vtt_p, bool base_omits_inherited_p)
count += 2;
}
- return count;
+ /* The original is now an abstract function that is never
+ emitted. */
+ DECL_ABSTRACT_P (fn) = true;
+
+ if (update_methods)
+ for (tree clone = fn; count--;)
+ {
+ clone = DECL_CHAIN (clone);
+ add_method (DECL_CONTEXT (clone), clone, false);
+ }
}
/* Produce declarations for all appropriate clones of FN. If
@@ -4957,17 +4973,7 @@ clone_cdtor (tree fn, bool update_methods)
bool base_omits_inherited = (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
&& base_ctor_omit_inherited_parms (fn));
- 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;
-
- if (update_methods)
- for (tree clone = fn; count--;)
- {
- clone = DECL_CHAIN (clone);
- add_method (DECL_CONTEXT (clone), clone, false);
- }
+ build_cdtor_clones (fn, vtt, base_omits_inherited, update_methods);
}
/* DECL is an in charge constructor, which is being defined. This will
@@ -5054,8 +5060,8 @@ adjust_clone_args (tree decl)
static void
clone_constructors_and_destructors (tree t)
{
- /* While constructors can be via a using declaration, at this point
- we no longer need to know that. */
+ /* We do not need to propagate the usingness to the clone, at this
+ point that is not needed. */
for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
clone_cdtor (*iter, /*update_methods=*/true);
@@ -7471,9 +7477,6 @@ finish_struct_1 (tree t)
/* Finish debugging output for this type. */
rest_of_type_compilation (t, ! LOCAL_CLASS_P (t));
- /* Recalculate satisfaction that might depend on completeness. */
- clear_satisfaction_cache ();
-
if (TYPE_TRANSPARENT_AGGR (t))
{
tree field = first_field (t);
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index a118f8a..b6f9c43 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1602,6 +1602,11 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
arg = adjust_temp_type (type, arg);
if (!TREE_CONSTANT (arg))
*non_constant_args = true;
+ else if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
+ /* The destructor needs to see any modifications the callee makes
+ to the argument. */
+ *non_constant_args = true;
+
/* For virtual calls, adjust the this argument, so that it is
the object on which the method is called, rather than
one of its bases. */
@@ -2288,7 +2293,11 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
{
tree type = build_array_type_nelts (char_type_node,
tree_to_uhwi (arg0));
- tree var = build_decl (loc, VAR_DECL, heap_uninit_identifier,
+ tree var = build_decl (loc, VAR_DECL,
+ (IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun))
+ & OVL_OP_FLAG_VEC)
+ ? heap_vec_uninit_identifier
+ : heap_uninit_identifier,
type);
DECL_ARTIFICIAL (var) = 1;
TREE_STATIC (var) = 1;
@@ -2306,6 +2315,42 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
if (DECL_NAME (var) == heap_uninit_identifier
|| DECL_NAME (var) == heap_identifier)
{
+ if (IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun))
+ & OVL_OP_FLAG_VEC)
+ {
+ if (!ctx->quiet)
+ {
+ error_at (loc, "array deallocation of object "
+ "allocated with non-array "
+ "allocation");
+ inform (DECL_SOURCE_LOCATION (var),
+ "allocation performed here");
+ }
+ *non_constant_p = true;
+ return t;
+ }
+ DECL_NAME (var) = heap_deleted_identifier;
+ ctx->global->values.remove (var);
+ ctx->global->heap_dealloc_count++;
+ return void_node;
+ }
+ else if (DECL_NAME (var) == heap_vec_uninit_identifier
+ || DECL_NAME (var) == heap_vec_identifier)
+ {
+ if ((IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun))
+ & OVL_OP_FLAG_VEC) == 0)
+ {
+ if (!ctx->quiet)
+ {
+ error_at (loc, "non-array deallocation of "
+ "object allocated with array "
+ "allocation");
+ inform (DECL_SOURCE_LOCATION (var),
+ "allocation performed here");
+ }
+ *non_constant_p = true;
+ return t;
+ }
DECL_NAME (var) = heap_deleted_identifier;
ctx->global->values.remove (var);
ctx->global->heap_dealloc_count++;
@@ -2586,14 +2631,14 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
problems with verify_gimple. */
arg = unshare_expr_without_location (arg);
TREE_VEC_ELT (bound, i) = arg;
+
+ /* And then unshare again so the callee doesn't change the
+ argument values in the hash table. XXX Could we unshare
+ lazily in cxx_eval_store_expression? */
+ arg = unshare_constructor (arg);
+ if (TREE_CODE (arg) == CONSTRUCTOR)
+ vec_safe_push (ctors, arg);
}
- /* Don't share a CONSTRUCTOR that might be changed. This is not
- redundant with the unshare just above; we also don't want to
- change the argument values in the hash table. XXX Could we
- unshare lazily in cxx_eval_store_expression? */
- arg = unshare_constructor (arg);
- if (TREE_CODE (arg) == CONSTRUCTOR)
- vec_safe_push (ctors, arg);
ctx->global->values.put (remapped, arg);
remapped = DECL_CHAIN (remapped);
}
@@ -3657,15 +3702,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.
@@ -3954,7 +4006,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;
@@ -3967,7 +4020,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;
@@ -4591,7 +4650,9 @@ non_const_var_error (location_t loc, tree r)
auto_diagnostic_group d;
tree type = TREE_TYPE (r);
if (DECL_NAME (r) == heap_uninit_identifier
- || DECL_NAME (r) == heap_identifier)
+ || DECL_NAME (r) == heap_identifier
+ || DECL_NAME (r) == heap_vec_uninit_identifier
+ || DECL_NAME (r) == heap_vec_identifier)
{
error_at (loc, "the content of uninitialized storage is not usable "
"in a constant expression");
@@ -6351,8 +6412,10 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
&& TREE_TYPE (op) == ptr_type_node
&& TREE_CODE (TREE_OPERAND (op, 0)) == ADDR_EXPR
&& VAR_P (TREE_OPERAND (TREE_OPERAND (op, 0), 0))
- && DECL_NAME (TREE_OPERAND (TREE_OPERAND (op, 0),
- 0)) == heap_uninit_identifier)
+ && (DECL_NAME (TREE_OPERAND (TREE_OPERAND (op, 0),
+ 0)) == heap_uninit_identifier
+ || DECL_NAME (TREE_OPERAND (TREE_OPERAND (op, 0),
+ 0)) == heap_vec_uninit_identifier))
{
tree var = TREE_OPERAND (TREE_OPERAND (op, 0), 0);
tree var_size = TYPE_SIZE_UNIT (TREE_TYPE (var));
@@ -6366,7 +6429,9 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
elt_type = TREE_TYPE (TREE_TYPE (fld2));
cookie_size = TYPE_SIZE_UNIT (TREE_TYPE (fld1));
}
- DECL_NAME (var) = heap_identifier;
+ DECL_NAME (var)
+ = (DECL_NAME (var) == heap_uninit_identifier
+ ? heap_identifier : heap_vec_identifier);
TREE_TYPE (var)
= build_new_constexpr_heap_type (elt_type, cookie_size,
var_size);
@@ -6403,9 +6468,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;
@@ -6637,6 +6702,8 @@ find_heap_var_refs (tree *tp, int *walk_subtrees, void */*data*/)
if (VAR_P (*tp)
&& (DECL_NAME (*tp) == heap_uninit_identifier
|| DECL_NAME (*tp) == heap_identifier
+ || DECL_NAME (*tp) == heap_vec_uninit_identifier
+ || DECL_NAME (*tp) == heap_vec_identifier
|| DECL_NAME (*tp) == heap_deleted_identifier))
return *tp;
@@ -6858,6 +6925,10 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
non_constant_p = true;
}
+ if (non_constant_p)
+ /* If we saw something bad, go back to our argument. The wrapping below is
+ only for the cases of TREE_CONSTANT argument or overflow. */
+ r = t;
if (!non_constant_p && overflow_p)
non_constant_p = true;
@@ -6874,12 +6945,6 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
return r;
else if (non_constant_p && TREE_CONSTANT (r))
{
- /* If __builtin_is_constant_evaluated () was evaluated to true
- and the result is not a valid constant expression, we need to
- punt. */
- if (manifestly_const_eval)
- return cxx_eval_outermost_constant_expr (t, true, strict,
- false, false, object);
/* This isn't actually constant, so unset TREE_CONSTANT.
Don't clear TREE_CONSTANT on ADDR_EXPR, as the middle-end requires
it to be set if it is invariant address, even when it is not
@@ -7071,15 +7136,13 @@ clear_cv_cache (void)
cv_cache->empty ();
}
-/* Dispose of the whole CV_CACHE, FOLD_CACHE, and satisfaction caches. */
+/* Dispose of the whole CV_CACHE and FOLD_CACHE. */
void
-clear_cv_and_fold_caches (bool sat /*= true*/)
+clear_cv_and_fold_caches ()
{
clear_cv_cache ();
clear_fold_cache ();
- if (sat)
- clear_satisfaction_cache ();
}
/* Internal function handling expressions in templates for
@@ -7651,6 +7714,11 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
}
return false;
}
+ /* Treat __PRETTY_FUNCTION__ inside a template function as
+ potentially-constant. */
+ else if (DECL_PRETTY_FUNCTION_P (t)
+ && DECL_VALUE_EXPR (t) == error_mark_node)
+ return true;
return RECUR (DECL_VALUE_EXPR (t), rval);
}
if (want_rval
@@ -8186,13 +8254,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;
@@ -8321,7 +8387,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:
{
@@ -8347,7 +8413,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
return false;
default:
- if (objc_is_property_ref (t))
+ if (objc_non_constant_expr_p (t))
return false;
sorry ("unexpected AST of kind %s", get_tree_code_name (TREE_CODE (t)));
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 050b55c..8691281 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -616,7 +616,8 @@ struct norm_info : subst_info
norm_info (tree in_decl, tsubst_flags_t complain)
: subst_info (tf_warning_or_error | complain, in_decl),
- context (make_context (in_decl))
+ context (make_context (in_decl)),
+ orig_decl (in_decl)
{}
bool generate_diagnostics() const
@@ -647,6 +648,12 @@ struct norm_info : subst_info
for that check. */
tree context;
+
+ /* The declaration whose constraints we're normalizing. The targets
+ of the parameter mapping of each atom will be in terms of the
+ template parameters of ORIG_DECL. */
+
+ tree orig_decl = NULL_TREE;
};
static tree normalize_expression (tree, tree, norm_info);
@@ -686,7 +693,8 @@ normalize_concept_check (tree check, tree args, norm_info info)
}
/* Substitute through the arguments of the concept check. */
- targs = tsubst_template_args (targs, args, info.complain, info.in_decl);
+ if (args)
+ targs = tsubst_template_args (targs, args, info.complain, info.in_decl);
if (targs == error_mark_node)
return error_mark_node;
@@ -709,6 +717,10 @@ normalize_concept_check (tree check, tree args, norm_info info)
return normalize_expression (def, subst, info);
}
+/* Used by normalize_atom to cache ATOMIC_CONSTRs. */
+
+static GTY((deletable)) hash_table<atom_hasher> *atom_cache;
+
/* The normal form of an atom depends on the expression. The normal
form of a function call to a function concept is a check constraint
for that concept. The normal form of a reference to a variable
@@ -728,7 +740,41 @@ normalize_atom (tree t, tree args, norm_info info)
/* Build a new info object for the atom. */
tree ci = build_tree_list (t, info.context);
- return build1 (ATOMIC_CONSTR, ci, map);
+ tree atom = build1 (ATOMIC_CONSTR, ci, map);
+ if (!info.generate_diagnostics ())
+ {
+ /* Cache the ATOMIC_CONSTRs that we return, so that sat_hasher::equal
+ later can cheaply compare two atoms using just pointer equality. */
+ if (!atom_cache)
+ atom_cache = hash_table<atom_hasher>::create_ggc (31);
+ tree *slot = atom_cache->find_slot (atom, INSERT);
+ if (*slot)
+ return *slot;
+
+ /* Find all template parameters used in the targets of the parameter
+ mapping, and store a list of them in the TREE_TYPE of the mapping.
+ This list will be used by sat_hasher to determine the subset of
+ supplied template arguments that the satisfaction value of the atom
+ depends on. */
+ if (map)
+ {
+ tree targets = make_tree_vec (list_length (map));
+ int i = 0;
+ for (tree node = map; node; node = TREE_CHAIN (node))
+ {
+ tree target = TREE_PURPOSE (node);
+ TREE_VEC_ELT (targets, i++) = target;
+ }
+ tree ctx_parms = (info.orig_decl
+ ? DECL_TEMPLATE_PARMS (info.orig_decl)
+ : current_template_parms);
+ tree target_parms = find_template_parameters (targets, ctx_parms);
+ TREE_TYPE (map) = target_parms;
+ }
+
+ *slot = atom;
+ }
+ return atom;
}
/* Returns the normal form of an expression. */
@@ -758,20 +804,18 @@ normalize_expression (tree t, tree args, norm_info info)
static GTY((deletable)) hash_map<tree,tree> *normalized_map;
static tree
-get_normalized_constraints (tree t, tree args, norm_info info)
+get_normalized_constraints (tree t, norm_info info)
{
auto_timevar time (TV_CONSTRAINT_NORM);
- return normalize_expression (t, args, info);
+ return normalize_expression (t, NULL_TREE, info);
}
/* Returns the normalized constraints from a constraint-info object
- or NULL_TREE if the constraints are null. ARGS provide the initial
- arguments for normalization and IN_DECL provides the declaration
- to which the constraints belong. */
+ or NULL_TREE if the constraints are null. IN_DECL provides the
+ declaration to which the constraints belong. */
static tree
-get_normalized_constraints_from_info (tree ci, tree args, tree in_decl,
- bool diag = false)
+get_normalized_constraints_from_info (tree ci, tree in_decl, bool diag = false)
{
if (ci == NULL_TREE)
return NULL_TREE;
@@ -779,8 +823,7 @@ get_normalized_constraints_from_info (tree ci, tree args, tree in_decl,
/* Substitution errors during normalization are fatal. */
++processing_template_decl;
norm_info info (in_decl, diag ? tf_norm : tf_none);
- tree t = get_normalized_constraints (CI_ASSOCIATED_CONSTRAINTS (ci),
- args, info);
+ tree t = get_normalized_constraints (CI_ASSOCIATED_CONSTRAINTS (ci), info);
--processing_template_decl;
return t;
@@ -840,11 +883,17 @@ get_normalized_constraints_from_decl (tree d, bool diag = false)
if (tree *p = hash_map_safe_get (normalized_map, tmpl))
return *p;
- push_nested_class_guard pncs (DECL_CONTEXT (d));
+ tree norm = NULL_TREE;
+ if (tree ci = get_constraints (decl))
+ {
+ push_nested_class_guard pncs (DECL_CONTEXT (d));
+
+ temp_override<tree> ovr (current_function_decl);
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ current_function_decl = decl;
- tree args = generic_targs_for (tmpl);
- tree ci = get_constraints (decl);
- tree norm = get_normalized_constraints_from_info (ci, args, tmpl, diag);
+ norm = get_normalized_constraints_from_info (ci, tmpl, diag);
+ }
if (!diag)
hash_map_safe_put<hm_ggc> (normalized_map, tmpl, norm);
@@ -865,11 +914,10 @@ normalize_concept_definition (tree tmpl, bool diag = false)
if (OVL_P (tmpl))
tmpl = OVL_FIRST (tmpl);
gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL);
- tree args = generic_targs_for (tmpl);
tree def = get_concept_definition (DECL_TEMPLATE_RESULT (tmpl));
++processing_template_decl;
norm_info info (tmpl, diag ? tf_norm : tf_none);
- tree norm = get_normalized_constraints (def, args, info);
+ tree norm = get_normalized_constraints (def, info);
--processing_template_decl;
if (!diag)
@@ -894,42 +942,20 @@ normalize_nontemplate_requirements (tree decl, bool diag = false)
return get_normalized_constraints_from_decl (decl, diag);
}
-/* Normalize an EXPR as a constraint using ARGS. */
+/* Normalize an EXPR as a constraint. */
static tree
-normalize_constraint_expression (tree expr, tree args, bool diag = false)
+normalize_constraint_expression (tree expr, bool diag)
{
if (!expr || expr == error_mark_node)
return expr;
++processing_template_decl;
norm_info info (diag ? tf_norm : tf_none);
- tree norm = get_normalized_constraints (expr, args, info);
+ tree norm = get_normalized_constraints (expr, info);
--processing_template_decl;
return norm;
}
-/* Normalize an EXPR as a constraint. */
-
-static tree
-normalize_constraint_expression (tree expr, bool diag = false)
-{
- if (!expr || expr == error_mark_node)
- return expr;
-
- /* For concept checks, use the supplied template arguments as those used
- for normalization. Otherwise, there are no template arguments. */
- tree args;
- if (concept_check_p (expr))
- {
- tree id = unpack_concept_check (expr);
- args = TREE_OPERAND (id, 1);
- }
- else
- args = NULL_TREE;
-
- return normalize_constraint_expression (expr, args, diag);
-}
-
/* 17.4.1.2p2. Two constraints are identical if they are formed
from the same expression and the targets of the parameter mapping
are equivalent. */
@@ -1201,7 +1227,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 +1243,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))
@@ -2273,6 +2304,16 @@ tsubst_parameter_mapping (tree map, tree args, subst_info info)
new_arg = tsubst_template_arg (arg, args, complain, in_decl);
if (TYPE_P (new_arg))
new_arg = canonicalize_type_argument (new_arg, complain);
+ if (TREE_CODE (new_arg) == TYPE_ARGUMENT_PACK)
+ {
+ tree pack_args = ARGUMENT_PACK_ARGS (new_arg);
+ for (int i = 0; i < TREE_VEC_LENGTH (pack_args); i++)
+ {
+ tree& pack_arg = TREE_VEC_ELT (pack_args, i);
+ if (TYPE_P (pack_arg))
+ pack_arg = canonicalize_type_argument (pack_arg, complain);
+ }
+ }
}
if (new_arg == error_mark_node)
return error_mark_node;
@@ -2305,15 +2346,68 @@ struct sat_hasher : ggc_ptr_hash<sat_entry>
{
static hashval_t hash (sat_entry *e)
{
- hashval_t value = hash_atomic_constraint (e->constr);
- return iterative_hash_template_arg (e->args, value);
+ if (ATOMIC_CONSTR_MAP_INSTANTIATED_P (e->constr))
+ {
+ /* Atoms with instantiated mappings are built during satisfaction.
+ They live only inside the sat_cache, and we build one to query
+ the cache with each time we instantiate a mapping. */
+ gcc_assert (!e->args);
+ return hash_atomic_constraint (e->constr);
+ }
+
+ /* Atoms with uninstantiated mappings are built during normalization.
+ Since normalize_atom caches the atoms it returns, we can assume
+ pointer-based identity for fast hashing and comparison. Even if this
+ assumption is violated, that's okay, we'll just get a cache miss. */
+ hashval_t value = htab_hash_pointer (e->constr);
+
+ if (tree map = ATOMIC_CONSTR_MAP (e->constr))
+ /* Only the parameters that are used in the targets of the mapping
+ affect the satisfaction value of the atom. So we consider only
+ the arguments for these parameters, and ignore the rest. */
+ for (tree target_parms = TREE_TYPE (map);
+ target_parms;
+ target_parms = TREE_CHAIN (target_parms))
+ {
+ int level, index;
+ tree parm = TREE_VALUE (target_parms);
+ template_parm_level_and_index (parm, &level, &index);
+ tree arg = TMPL_ARG (e->args, level, index);
+ value = iterative_hash_template_arg (arg, value);
+ }
+ return value;
}
static bool equal (sat_entry *e1, sat_entry *e2)
{
- if (!atomic_constraints_identical_p (e1->constr, e2->constr))
+ if (ATOMIC_CONSTR_MAP_INSTANTIATED_P (e1->constr)
+ != ATOMIC_CONSTR_MAP_INSTANTIATED_P (e2->constr))
return false;
- return template_args_equal (e1->args, e2->args);
+
+ /* See sat_hasher::hash. */
+ if (ATOMIC_CONSTR_MAP_INSTANTIATED_P (e1->constr))
+ {
+ gcc_assert (!e1->args && !e2->args);
+ return atomic_constraints_identical_p (e1->constr, e2->constr);
+ }
+
+ if (e1->constr != e2->constr)
+ return false;
+
+ if (tree map = ATOMIC_CONSTR_MAP (e1->constr))
+ for (tree target_parms = TREE_TYPE (map);
+ target_parms;
+ target_parms = TREE_CHAIN (target_parms))
+ {
+ int level, index;
+ tree parm = TREE_VALUE (target_parms);
+ template_parm_level_and_index (parm, &level, &index);
+ tree arg1 = TMPL_ARG (e1->args, level, index);
+ tree arg2 = TMPL_ARG (e2->args, level, index);
+ if (!template_args_equal (arg1, arg2))
+ return false;
+ }
+ return true;
}
};
@@ -2348,15 +2442,6 @@ save_satisfaction (tree constr, tree args, tree result)
*slot = entry;
}
-void
-clear_satisfaction_cache ()
-{
- if (sat_cache)
- sat_cache->empty ();
- if (decl_satisfied_cache)
- decl_satisfied_cache->empty ();
-}
-
/* A tool to help manage satisfaction caching in satisfy_constraint_r.
Note the cache is only used when not diagnosing errors. */
@@ -2613,6 +2698,18 @@ satisfy_atom (tree t, tree args, subst_info info)
return cache.save (boolean_false_node);
}
+ /* Now build a new atom using the instantiated mapping. We use
+ this atom as a second key to the satisfaction cache, and we
+ also pass it to diagnose_atomic_constraint so that diagnostics
+ which refer to the atom display the instantiated mapping. */
+ t = copy_node (t);
+ ATOMIC_CONSTR_MAP (t) = map;
+ gcc_assert (!ATOMIC_CONSTR_MAP_INSTANTIATED_P (t));
+ ATOMIC_CONSTR_MAP_INSTANTIATED_P (t) = true;
+ satisfaction_cache inst_cache (t, /*args=*/NULL_TREE, info.complain);
+ if (tree r = inst_cache.get ())
+ return cache.save (r);
+
/* Rebuild the argument vector from the parameter mapping. */
args = get_mapped_args (map);
@@ -2625,19 +2722,19 @@ satisfy_atom (tree t, tree args, subst_info info)
is not satisfied. Replay the substitution. */
if (info.noisy ())
tsubst_expr (expr, args, info.complain, info.in_decl, false);
- return cache.save (boolean_false_node);
+ return cache.save (inst_cache.save (boolean_false_node));
}
/* [17.4.1.2] ... lvalue-to-rvalue conversion is performed as necessary,
and EXPR shall be a constant expression of type bool. */
result = force_rvalue (result, info.complain);
if (result == error_mark_node)
- return cache.save (error_mark_node);
+ return cache.save (inst_cache.save (error_mark_node));
if (!same_type_p (TREE_TYPE (result), boolean_type_node))
{
if (info.noisy ())
diagnose_atomic_constraint (t, map, result, info);
- return cache.save (error_mark_node);
+ return cache.save (inst_cache.save (error_mark_node));
}
/* Compute the value of the constraint. */
@@ -2654,7 +2751,7 @@ satisfy_atom (tree t, tree args, subst_info info)
if (result == boolean_false_node && info.noisy ())
diagnose_atomic_constraint (t, map, result, info);
- return cache.save (result);
+ return cache.save (inst_cache.save (result));
}
/* Determine if the normalized constraint T is satisfied.
@@ -2992,9 +3089,7 @@ finish_compound_requirement (location_t loc, tree expr, tree type, bool noexcept
tree
finish_nested_requirement (location_t loc, tree expr)
{
- /* Currently open template headers have dummy arg vectors, so don't
- pass into normalization. */
- tree norm = normalize_constraint_expression (expr, NULL_TREE, false);
+ tree norm = normalize_constraint_expression (expr, false);
/* Build the constraint, saving its normalization as its type. */
tree r = build1 (NESTED_REQ, norm, expr);
@@ -3099,25 +3194,25 @@ subsumes_constraints (tree a, tree b)
return subsumes (a, b);
}
-/* Returns true when the constraints in CI (with arguments
- ARGS) strictly subsume the associated constraints of TMPL. */
+/* Returns true when the constraints in CI strictly subsume
+ the associated constraints of TMPL. */
bool
-strictly_subsumes (tree ci, tree args, tree tmpl)
+strictly_subsumes (tree ci, tree tmpl)
{
- tree n1 = get_normalized_constraints_from_info (ci, args, NULL_TREE);
+ tree n1 = get_normalized_constraints_from_info (ci, NULL_TREE);
tree n2 = get_normalized_constraints_from_decl (tmpl);
return subsumes (n1, n2) && !subsumes (n2, n1);
}
-/* REturns true when the constraints in CI (with arguments ARGS) subsume
- the associated constraints of TMPL. */
+/* Returns true when the constraints in CI subsume the
+ associated constraints of TMPL. */
bool
-weakly_subsumes (tree ci, tree args, tree tmpl)
+weakly_subsumes (tree ci, tree tmpl)
{
- tree n1 = get_normalized_constraints_from_info (ci, args, NULL_TREE);
+ tree n1 = get_normalized_constraints_from_info (ci, NULL_TREE);
tree n2 = get_normalized_constraints_from_decl (tmpl);
return subsumes (n1, n2);
@@ -3496,14 +3591,11 @@ diagnose_atomic_constraint (tree t, tree map, tree result, subst_info info)
diagnose_requires_expr (expr, map, info.in_decl);
break;
default:
- tree a = copy_node (t);
- ATOMIC_CONSTR_MAP (a) = map;
if (!same_type_p (TREE_TYPE (result), boolean_type_node))
error_at (loc, "constraint %qE has type %qT, not %<bool%>",
- a, TREE_TYPE (result));
+ t, TREE_TYPE (result));
else
- inform (loc, "the expression %qE evaluated to %<false%>", a);
- ggc_free (a);
+ inform (loc, "the expression %qE evaluated to %<false%>", t);
}
}
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index ba81345..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);
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 44c9d24..064a44c 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -680,22 +680,6 @@ is_invisiref_parm (const_tree t)
&& DECL_BY_REFERENCE (t));
}
-/* Return true if the uid in both int tree maps are equal. */
-
-bool
-cxx_int_tree_map_hasher::equal (cxx_int_tree_map *a, cxx_int_tree_map *b)
-{
- return (a->uid == b->uid);
-}
-
-/* Hash a UID in a cxx_int_tree_map. */
-
-unsigned int
-cxx_int_tree_map_hasher::hash (cxx_int_tree_map *item)
-{
- return item->uid;
-}
-
/* A stable comparison routine for use with splay trees and DECLs. */
static int
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index e1397b7..a38bb0a 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -366,7 +366,8 @@ names_builtin_p (const char *name)
tree id = get_identifier (name);
if (tree binding = get_global_binding (id))
{
- if (TREE_CODE (binding) == FUNCTION_DECL && DECL_IS_BUILTIN (binding))
+ if (TREE_CODE (binding) == FUNCTION_DECL
+ && DECL_IS_UNDECLARED_BUILTIN (binding))
return true;
/* Handle the case when an overload for a built-in name exists. */
@@ -376,7 +377,7 @@ names_builtin_p (const char *name)
for (ovl_iterator it (binding); it; ++it)
{
tree decl = *it;
- if (DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl))
return true;
}
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4672561..b98d47a 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -125,6 +125,7 @@ enum cp_tree_index
CPTI_CLASS_TYPE,
CPTI_UNKNOWN_TYPE,
CPTI_INIT_LIST_TYPE,
+ CPTI_EXPLICIT_VOID_LIST,
CPTI_VTBL_TYPE,
CPTI_VTBL_PTR_TYPE,
CPTI_STD,
@@ -178,6 +179,8 @@ enum cp_tree_index
CPTI_HEAP_UNINIT_IDENTIFIER,
CPTI_HEAP_IDENTIFIER,
CPTI_HEAP_DELETED_IDENTIFIER,
+ CPTI_HEAP_VEC_UNINIT_IDENTIFIER,
+ CPTI_HEAP_VEC_IDENTIFIER,
CPTI_LANG_NAME_C,
CPTI_LANG_NAME_CPLUSPLUS,
@@ -230,6 +233,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
#define init_list_type_node cp_global_trees[CPTI_INIT_LIST_TYPE]
+#define explicit_void_list_node cp_global_trees[CPTI_EXPLICIT_VOID_LIST]
#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
#define std_node cp_global_trees[CPTI_STD]
@@ -322,6 +326,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define heap_uninit_identifier cp_global_trees[CPTI_HEAP_UNINIT_IDENTIFIER]
#define heap_identifier cp_global_trees[CPTI_HEAP_IDENTIFIER]
#define heap_deleted_identifier cp_global_trees[CPTI_HEAP_DELETED_IDENTIFIER]
+#define heap_vec_uninit_identifier cp_global_trees[CPTI_HEAP_VEC_UNINIT_IDENTIFIER]
+#define heap_vec_identifier cp_global_trees[CPTI_HEAP_VEC_IDENTIFIER]
#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
@@ -409,6 +415,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute)
ABI_TAG_IMPLICIT (in the TREE_LIST for the argument of abi_tag)
LAMBDA_CAPTURE_EXPLICIT_P (in a TREE_LIST in LAMBDA_EXPR_CAPTURE_LIST)
+ PARENTHESIZED_LIST_P (in the TREE_LIST for a parameter-declaration-list)
CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR)
LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR)
DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE)
@@ -431,6 +438,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
REINTERPRET_CAST_P (in NOP_EXPR)
ALIGNOF_EXPR_STD_P (in ALIGNOF_EXPR)
OVL_DEDUP_P (in OVERLOAD)
+ ATOMIC_CONSTR_MAP_INSTANTIATED_P (in ATOMIC_CONSTR)
1: IDENTIFIER_KIND_BIT_1 (in IDENTIFIER_NODE)
TI_PENDING_TEMPLATE_FLAG.
TEMPLATE_PARMS_FOR_INLINE.
@@ -480,7 +488,7 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
DECL_TINFO_P (in VAR_DECL)
FUNCTION_REF_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
OVL_LOOKUP_P (in OVERLOAD)
- LOOKUP_FOUND_P (in RECORD_TYPE, UNION_TYPE, NAMESPACE_DECL)
+ LOOKUP_FOUND_P (in RECORD_TYPE, UNION_TYPE, ENUMERAL_TYPE, NAMESPACE_DECL)
5: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
@@ -738,9 +746,10 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
&& flag_hosted)
/* Lookup walker marking. */
-#define LOOKUP_SEEN_P(NODE) TREE_VISITED(NODE)
+#define LOOKUP_SEEN_P(NODE) TREE_VISITED (NODE)
#define LOOKUP_FOUND_P(NODE) \
- TREE_LANG_FLAG_4 (TREE_CHECK3(NODE,RECORD_TYPE,UNION_TYPE,NAMESPACE_DECL))
+ TREE_LANG_FLAG_4 (TREE_CHECK4 (NODE,RECORD_TYPE,UNION_TYPE,ENUMERAL_TYPE,\
+ NAMESPACE_DECL))
/* These two accessors should only be used by OVL manipulators.
Other users should use iterators and convenience functions. */
@@ -1323,7 +1332,9 @@ enum cp_trait_kind
CPTK_IS_UNION,
CPTK_UNDERLYING_TYPE,
CPTK_IS_ASSIGNABLE,
- CPTK_IS_CONSTRUCTIBLE
+ CPTK_IS_CONSTRUCTIBLE,
+ CPTK_IS_NOTHROW_ASSIGNABLE,
+ CPTK_IS_NOTHROW_CONSTRUCTIBLE
};
/* The types that we are processing. */
@@ -1587,6 +1598,12 @@ check_constraint_info (tree t)
#define ATOMIC_CONSTR_MAP(NODE) \
TREE_OPERAND (TREE_CHECK (NODE, ATOMIC_CONSTR), 0)
+/* Whether the parameter mapping of this atomic constraint
+ is already instantiated with concrete template arguments.
+ Used only in satisfy_atom and in the satisfaction cache. */
+#define ATOMIC_CONSTR_MAP_INSTANTIATED_P(NODE) \
+ TREE_LANG_FLAG_0 (ATOMIC_CONSTR_CHECK (NODE))
+
/* The expression of an atomic constraint. */
#define ATOMIC_CONSTR_EXPR(NODE) \
CONSTR_EXPR (ATOMIC_CONSTR_CHECK (NODE))
@@ -1861,19 +1878,6 @@ public:
#define cp_noexcept_operand scope_chain->noexcept_operand
-/* A list of private types mentioned, for deferred access checking. */
-
-struct GTY((for_user)) cxx_int_tree_map {
- unsigned int uid;
- tree to;
-};
-
-struct cxx_int_tree_map_hasher : ggc_ptr_hash<cxx_int_tree_map>
-{
- static hashval_t hash (cxx_int_tree_map *);
- static bool equal (cxx_int_tree_map *, cxx_int_tree_map *);
-};
-
struct named_label_entry; /* Defined in decl.c. */
struct named_label_hash : ggc_remove <named_label_entry *>
@@ -2217,7 +2221,6 @@ struct GTY(()) lang_type {
tree vtables;
tree typeinfo_var;
vec<tree, va_gc> *vbases;
- binding_table nested_udts;
tree as_base;
vec<tree, va_gc> *pure_virtuals;
tree friend_classes;
@@ -2370,12 +2373,6 @@ struct GTY(()) lang_type {
#define CLASSTYPE_DESTRUCTOR(NODE) \
(get_class_binding_direct (NODE, dtor_identifier))
-/* A dictionary of the nested user-defined-types (class-types, or enums)
- found within this class. This table includes nested member class
- templates. */
-#define CLASSTYPE_NESTED_UTDS(NODE) \
- (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
-
/* Nonzero if NODE has a primary base class, i.e., a base class with
which it shares the virtual function table pointer. */
#define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
@@ -2736,12 +2733,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 +3087,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 +3293,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)
@@ -3390,6 +3393,10 @@ struct GTY(()) lang_decl {
was inherited from a template parameter, not explicitly indicated. */
#define ABI_TAG_IMPLICIT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
+/* In a TREE_LIST for a parameter-declaration-list, indicates that all the
+ parameters in the list have declarators enclosed in (). */
+#define PARENTHESIZED_LIST_P(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
+
/* Non zero if this is a using decl for a dependent scope. */
#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
@@ -4039,11 +4046,6 @@ 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))
-/* 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) \
@@ -6046,6 +6048,7 @@ struct cp_declarator {
tree late_return_type;
/* The trailing requires-clause, if any. */
tree requires_clause;
+ location_t parens_loc;
} function;
/* For arrays. */
struct {
@@ -6746,6 +6749,7 @@ extern void use_thunk (tree, bool);
extern bool trivial_fn_p (tree);
extern tree forward_parm (tree);
extern bool is_trivially_xible (enum tree_code, tree, tree);
+extern bool is_nothrow_xible (enum tree_code, tree, tree);
extern bool is_xible (enum tree_code, tree, tree);
extern tree get_defaulted_eh_spec (tree, tsubst_flags_t = tf_warning_or_error);
extern bool maybe_explain_implicit_delete (tree);
@@ -7367,6 +7371,7 @@ extern const char *cxx_printable_name_translate (tree, int);
extern tree canonical_eh_spec (tree);
extern tree build_cp_fntype_variant (tree, cp_ref_qualifier, tree, bool);
extern tree build_exception_variant (tree, tree);
+extern void fixup_deferred_exception_variants (tree, tree);
extern tree bind_template_template_parm (tree, tree);
extern tree array_type_nelts_total (tree);
extern tree array_type_nelts_top (tree);
@@ -7825,15 +7830,14 @@ extern tree evaluate_concept_check (tree, tsubst_flags_t);
extern tree satisfy_constraint_expression (tree);
extern bool constraints_satisfied_p (tree);
extern bool constraints_satisfied_p (tree, tree);
-extern void clear_satisfaction_cache ();
extern bool* lookup_subsumption_result (tree, tree);
extern bool save_subsumption_result (tree, tree, bool);
extern tree find_template_parameters (tree, tree);
extern bool equivalent_constraints (tree, tree);
extern bool equivalently_constrained (tree, tree);
extern bool subsumes_constraints (tree, tree);
-extern bool strictly_subsumes (tree, tree, tree);
-extern bool weakly_subsumes (tree, tree, tree);
+extern bool strictly_subsumes (tree, tree);
+extern bool weakly_subsumes (tree, tree);
extern int more_constrained (tree, tree);
extern bool at_least_as_constrained (tree, tree);
extern bool constraints_equivalent_p (tree, tree);
@@ -7842,6 +7846,21 @@ extern hashval_t iterative_hash_constraint (tree, hashval_t);
extern hashval_t hash_atomic_constraint (tree);
extern void diagnose_constraints (location_t, tree, tree);
+/* A structural hasher for ATOMIC_CONSTRs. */
+
+struct atom_hasher : default_hash_traits<tree>
+{
+ static hashval_t hash (tree t)
+ {
+ return hash_atomic_constraint (t);
+ }
+
+ static bool equal (tree t1, tree t2)
+ {
+ return atomic_constraints_identical_p (t1, t2);
+ }
+};
+
/* in logic.cc */
extern bool subsumes (tree, tree);
@@ -7895,7 +7914,7 @@ extern bool var_in_maybe_constexpr_fn (tree);
extern void explain_invalid_constexpr_fn (tree);
extern vec<tree> cx_error_context (void);
extern tree fold_sizeof_expr (tree);
-extern void clear_cv_and_fold_caches (bool = true);
+extern void clear_cv_and_fold_caches (void);
extern tree unshare_constructor (tree CXX_MEM_STAT_INFO);
/* An RAII sentinel used to restrict constexpr evaluation so that it
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index c9e7b1f..bcd7c5a 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -1568,12 +1568,13 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
&& warn_unused_value
&& !TREE_NO_WARNING (expr)
&& !processing_template_decl
- && !cp_unevaluated_operand)
+ && !cp_unevaluated_operand
+ && (complain & tf_warning))
{
/* The middle end does not warn about expressions that have
been explicitly cast to void, so we must do so here. */
- if (!TREE_SIDE_EFFECTS (expr)) {
- if (complain & tf_warning)
+ if (!TREE_SIDE_EFFECTS (expr))
+ {
switch (implicit)
{
case ICV_SECOND_OF_COND:
@@ -1605,14 +1606,10 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
default:
gcc_unreachable ();
}
- }
+ }
else
{
- tree e;
- enum tree_code code;
- enum tree_code_class tclass;
-
- e = expr;
+ tree e = expr;
/* We might like to warn about (say) "(int) f()", as the
cast has no effect, but the compiler itself will
generate implicit conversions under some
@@ -1626,21 +1623,14 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
while (TREE_CODE (e) == NOP_EXPR)
e = TREE_OPERAND (e, 0);
- code = TREE_CODE (e);
- tclass = TREE_CODE_CLASS (code);
- if ((tclass == tcc_comparison
- || tclass == tcc_unary
- || (tclass == tcc_binary
- && !(code == MODIFY_EXPR
- || code == INIT_EXPR
- || code == PREDECREMENT_EXPR
- || code == PREINCREMENT_EXPR
- || code == POSTDECREMENT_EXPR
- || code == POSTINCREMENT_EXPR))
- || code == VEC_PERM_EXPR
- || code == VEC_COND_EXPR)
- && (complain & tf_warning))
- warning_at (loc, OPT_Wunused_value, "value computed is not used");
+ enum tree_code code = TREE_CODE (e);
+ enum tree_code_class tclass = TREE_CODE_CLASS (code);
+ if (tclass == tcc_comparison
+ || tclass == tcc_unary
+ || tclass == tcc_binary
+ || code == VEC_PERM_EXPR
+ || code == VEC_COND_EXPR)
+ warn_if_unused_value (e, loc);
}
}
expr = build1 (CONVERT_EXPR, void_type_node, expr);
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 8bea79b..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:
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0fe74b2..6264884 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -138,7 +138,7 @@ static location_t smallest_type_location (const cp_decl_specifier_seq*);
tree cp_global_trees[CPTI_MAX];
/* A list of objects which have constructors or destructors
- which reside in the global scope. The decl is stored in
+ which reside in namespace scope. The decl is stored in
the TREE_VALUE slot and the initializer is stored
in the TREE_PURPOSE slot. */
tree static_aggregates;
@@ -1002,7 +1002,7 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
/* A new declaration doesn't match a built-in one unless it
is also extern "C". */
- if (DECL_IS_BUILTIN (olddecl)
+ if (DECL_IS_UNDECLARED_BUILTIN (olddecl)
&& DECL_EXTERN_C_P (olddecl) && !DECL_EXTERN_C_P (newdecl))
return 0;
@@ -1205,7 +1205,7 @@ check_redeclaration_exception_specification (tree new_decl,
all declarations, including the definition and an explicit
specialization, of that function shall have an
exception-specification with the same set of type-ids. */
- if (! DECL_IS_BUILTIN (old_decl)
+ if (! DECL_IS_UNDECLARED_BUILTIN (old_decl)
&& !comp_except_specs (new_exceptions, old_exceptions, ce_normal))
{
const char *const msg
@@ -1340,18 +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_p)
+check_no_redeclaration_friend_default_args (tree olddecl, tree newdecl)
{
- if (!olddecl_hidden_p && !DECL_FRIEND_P (newdecl))
+ if (!DECL_UNIQUE_FRIEND_P (olddecl) && !DECL_UNIQUE_FRIEND_P (newdecl))
return;
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_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),
@@ -1444,8 +1443,7 @@ tree
duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
{
unsigned olddecl_uid = DECL_UID (olddecl);
- int olddecl_friend = 0, types_match = 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);
@@ -1467,7 +1465,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_UNDECLARED_BUILTIN_P (olddecl))
+ && DECL_IS_UNDECLARED_BUILTIN (olddecl))
{
if (TREE_CODE (newdecl) != FUNCTION_DECL)
{
@@ -1519,7 +1517,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
/* A new declaration doesn't match a built-in one unless it
is also extern "C". */
- gcc_assert (DECL_IS_BUILTIN (olddecl));
+ gcc_assert (DECL_IS_UNDECLARED_BUILTIN (olddecl));
gcc_assert (DECL_EXTERN_C_P (olddecl));
if (!DECL_EXTERN_C_P (newdecl))
return NULL_TREE;
@@ -1629,11 +1627,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
/* Replace the old RTL to avoid problems with inlining. */
COPY_DECL_RTL (newdecl, olddecl);
}
- /* Even if the types match, prefer the new declarations type for
- built-ins which have not been explicitly declared, for
- exception lists, etc... */
- else if (DECL_IS_BUILTIN (olddecl))
+ else
{
+ /* Even if the types match, prefer the new declarations type
+ for built-ins which have not been explicitly declared,
+ for exception lists, etc... */
tree type = TREE_TYPE (newdecl);
tree attribs = (*targetm.merge_type_attributes)
(TREE_TYPE (olddecl), type);
@@ -1778,7 +1776,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
newdecl);
inform (olddecl_loc,
"previous declaration %q#D", olddecl);
- return NULL_TREE;
+ return error_mark_node;
}
/* For function versions, params and types match, but they
are not ambiguous. */
@@ -1987,8 +1985,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
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, was_hidden);
+ check_no_redeclaration_friend_default_args (olddecl, newdecl);
}
}
}
@@ -2005,6 +2002,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
|| 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;
@@ -2135,12 +2135,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
else
DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
- if (DECL_DECLARES_FUNCTION_P (olddecl))
- {
- olddecl_friend = DECL_FRIEND_P (STRIP_TEMPLATE (olddecl));
- olddecl_hidden_friend = olddecl_friend && was_hidden;
- }
-
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
tree old_result = DECL_TEMPLATE_RESULT (olddecl);
@@ -2167,8 +2161,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
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);
@@ -2366,6 +2362,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
&& !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
{
@@ -2472,22 +2471,27 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
}
- DECL_TEMPLATE_INSTANTIATED (newdecl)
- |= DECL_TEMPLATE_INSTANTIATED (olddecl);
- DECL_ODR_USED (newdecl) |= DECL_ODR_USED (olddecl);
- /* If the OLDDECL is an instantiation and/or specialization,
- then the NEWDECL must be too. But, it may not yet be marked
- as such if the caller has created NEWDECL, but has not yet
- figured out that it is a redeclaration. */
- if (!DECL_USE_TEMPLATE (newdecl))
- DECL_USE_TEMPLATE (newdecl) = DECL_USE_TEMPLATE (olddecl);
+ if (TREE_CODE (newdecl) != TYPE_DECL)
+ {
+ DECL_TEMPLATE_INSTANTIATED (newdecl)
+ |= DECL_TEMPLATE_INSTANTIATED (olddecl);
+ DECL_ODR_USED (newdecl) |= DECL_ODR_USED (olddecl);
+
+ /* If the OLDDECL is an instantiation and/or specialization,
+ then the NEWDECL must be too. But, it may not yet be marked
+ as such if the caller has created NEWDECL, but has not yet
+ figured out that it is a redeclaration. */
+ if (!DECL_USE_TEMPLATE (newdecl))
+ DECL_USE_TEMPLATE (newdecl) = DECL_USE_TEMPLATE (olddecl);
+
+ DECL_INITIALIZED_IN_CLASS_P (newdecl)
+ |= DECL_INITIALIZED_IN_CLASS_P (olddecl);
+ }
/* Don't really know how much of the language-specific
values we should copy from old to new. */
DECL_IN_AGGR_P (newdecl) = DECL_IN_AGGR_P (olddecl);
- DECL_INITIALIZED_IN_CLASS_P (newdecl)
- |= DECL_INITIALIZED_IN_CLASS_P (olddecl);
if (LANG_DECL_HAS_MIN (newdecl))
{
@@ -2647,19 +2651,20 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
if (DECL_BUILT_IN_CLASS (newdecl) == BUILT_IN_NORMAL)
{
enum built_in_function fncode = DECL_FUNCTION_CODE (newdecl);
- switch (fncode)
+ if (builtin_decl_explicit_p (fncode))
{
- /* If a compatible prototype of these builtin functions
- is seen, assume the runtime implements it with the
- expected semantics. */
- case BUILT_IN_STPCPY:
- if (builtin_decl_explicit_p (fncode))
- set_builtin_decl_implicit_p (fncode, true);
- break;
- default:
- if (builtin_decl_explicit_p (fncode))
- set_builtin_decl_declared_p (fncode, true);
- break;
+ /* A compatible prototype of these builtin functions
+ is seen, assume the runtime implements it with
+ the expected semantics. */
+ switch (fncode)
+ {
+ case BUILT_IN_STPCPY:
+ set_builtin_decl_implicit_p (fncode, true);
+ break;
+ default:
+ set_builtin_decl_declared_p (fncode, true);
+ break;
+ }
}
copy_attributes_to_builtin (newdecl);
@@ -2885,8 +2890,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
}
DECL_UID (olddecl) = olddecl_uid;
- if (olddecl_friend)
- DECL_FRIEND_P (olddecl) = true;
/* NEWDECL contains the merged attribute lists.
Update OLDDECL to be the same. */
@@ -2918,6 +2921,16 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
snode->remove ();
}
+ if (TREE_CODE (olddecl) == FUNCTION_DECL)
+ {
+ tree clone;
+ FOR_EACH_CLONE (clone, olddecl)
+ {
+ DECL_ATTRIBUTES (clone) = DECL_ATTRIBUTES (olddecl);
+ DECL_PRESERVE_P (clone) |= DECL_PRESERVE_P (olddecl);
+ }
+ }
+
/* Remove the associated constraints for newdecl, if any, before
reclaiming memory. */
if (flag_concepts)
@@ -3062,7 +3075,7 @@ redeclaration_error_message (tree newdecl, tree olddecl)
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)
+ && 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,
@@ -3073,7 +3086,8 @@ redeclaration_error_message (tree newdecl, tree olddecl)
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)))
@@ -4247,6 +4261,8 @@ initialize_predefined_identifiers (void)
{"heap uninit", &heap_uninit_identifier, cik_normal},
{"heap ", &heap_identifier, cik_normal},
{"heap deleted", &heap_deleted_identifier, cik_normal},
+ {"heap [] uninit", &heap_vec_uninit_identifier, cik_normal},
+ {"heap []", &heap_vec_identifier, cik_normal},
{NULL, NULL, cik_normal}
};
@@ -4378,6 +4394,9 @@ cxx_init_decl_processing (void)
init_list_type_node = make_node (LANG_TYPE);
record_unknown_type (init_list_type_node, "init list");
+ /* Used when parsing to distinguish parameter-lists () and (void). */
+ explicit_void_list_node = build_void_list_node ();
+
{
/* Make sure we get a unique function type, so we can give
its pointer type a name. (This wins for gdb.) */
@@ -5452,20 +5471,17 @@ start_decl (const cp_declarator *declarator,
void
start_decl_1 (tree decl, bool initialized)
{
- tree type;
- bool complete_p;
- bool aggregate_definition_p;
-
- gcc_assert (!processing_template_decl);
+ gcc_checking_assert (!processing_template_decl);
if (error_operand_p (decl))
return;
- gcc_assert (VAR_P (decl));
+ gcc_checking_assert (VAR_P (decl));
- type = TREE_TYPE (decl);
- complete_p = COMPLETE_TYPE_P (type);
- aggregate_definition_p = MAYBE_CLASS_TYPE_P (type) && !DECL_EXTERNAL (decl);
+ tree type = TREE_TYPE (decl);
+ bool complete_p = COMPLETE_TYPE_P (type);
+ bool aggregate_definition_p
+ = MAYBE_CLASS_TYPE_P (type) && !DECL_EXTERNAL (decl);
/* If an explicit initializer is present, or if this is a definition
of an aggregate, then we need a complete type at this point.
@@ -5490,6 +5506,7 @@ start_decl_1 (tree decl, bool initialized)
: TCTX_STATIC_STORAGE);
verify_type_context (input_location, context, TREE_TYPE (decl));
}
+
if (initialized)
/* Is it valid for this decl to have an initializer at all? */
{
@@ -12039,8 +12056,17 @@ grokdeclarator (const cp_declarator *declarator,
&& inner_declarator->u.id.qualifying_scope
&& (MAYBE_CLASS_TYPE_P (type)
|| TREE_CODE (type) == ENUMERAL_TYPE)))
- warning_at (declarator->parenthesized, OPT_Wparentheses,
- "unnecessary parentheses in declaration of %qs", name);
+ {
+ if (warning_at (declarator->parenthesized, OPT_Wparentheses,
+ "unnecessary parentheses in declaration of %qs",
+ name))
+ {
+ gcc_rich_location iloc (declarator->parenthesized);
+ iloc.add_fixit_remove (get_start (declarator->parenthesized));
+ iloc.add_fixit_remove (get_finish (declarator->parenthesized));
+ inform (&iloc, "remove parentheses");
+ }
+ }
if (declarator->kind == cdk_id || declarator->kind == cdk_decomp)
break;
@@ -14024,7 +14050,7 @@ grokparms (tree parmlist, tree *parms)
tree init = TREE_PURPOSE (parm);
tree decl = TREE_VALUE (parm);
- if (parm == void_list_node)
+ if (parm == void_list_node || parm == explicit_void_list_node)
break;
if (! decl || TREE_TYPE (decl) == error_mark_node)
@@ -14174,6 +14200,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;
@@ -14247,6 +14277,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;
@@ -14854,7 +14888,6 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
else
decl = lookup_elaborated_type (name, how);
-
if (!decl)
/* We found nothing. */
return NULL_TREE;
@@ -14875,8 +14908,8 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
if (TREE_CODE (decl) != TYPE_DECL)
/* Found not-a-type. */
return NULL_TREE;
-
- /* Look for invalid nested type:
+
+ /* Look for invalid nested type:
class C {
class C {};
}; */
@@ -16110,36 +16143,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)
@@ -16206,7 +16224,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
by push_nested_class.) */
if (processing_template_decl)
{
- tree newdecl1 = push_template_decl (decl1, DECL_FRIEND_P (decl1));
+ tree newdecl1 = push_template_decl (decl1, doing_friend);
if (newdecl1 == error_mark_node)
{
if (ctype || DECL_STATIC_FUNCTION_P (decl1))
@@ -16222,7 +16240,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)
{
@@ -16312,7 +16330,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);
@@ -16329,7 +16347,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
@@ -16384,14 +16402,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. */;
@@ -17311,18 +17331,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, DECL_FRIEND_P (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 db3035d..1bc7b7e 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;
@@ -2894,9 +2894,8 @@ constrain_class_visibility (tree type)
/* Functions for adjusting the visibility of a tagged type and its nested
types and declarations when it gets a name for linkage purposes from a
typedef. */
-
-static void bt_reset_linkage_1 (binding_entry, void *);
-static void bt_reset_linkage_2 (binding_entry, void *);
+// FIXME: It is now a DR for such a class type to contain anything
+// other than C. So at minium most of this can probably be deleted.
/* First reset the visibility of all the types. */
@@ -2905,13 +2904,9 @@ reset_type_linkage_1 (tree type)
{
set_linkage_according_to_type (type, TYPE_MAIN_DECL (type));
if (CLASS_TYPE_P (type))
- binding_table_foreach (CLASSTYPE_NESTED_UTDS (type),
- bt_reset_linkage_1, NULL);
-}
-static void
-bt_reset_linkage_1 (binding_entry b, void */*data*/)
-{
- reset_type_linkage_1 (b->type);
+ for (tree member = TYPE_FIELDS (type); member; member = DECL_CHAIN (member))
+ if (DECL_IMPLICIT_TYPEDEF_P (member))
+ reset_type_linkage_1 (TREE_TYPE (member));
}
/* Then reset the visibility of any static data members or member
@@ -2930,9 +2925,10 @@ reset_decl_linkage (tree decl)
tentative_decl_linkage (decl);
}
-static void
-reset_type_linkage_2 (tree type)
+void
+reset_type_linkage (tree type)
{
+ reset_type_linkage_1 (type);
if (CLASS_TYPE_P (type))
{
if (tree vt = CLASSTYPE_VTABLES (type))
@@ -2955,24 +2951,12 @@ reset_type_linkage_2 (tree type)
tree mem = STRIP_TEMPLATE (m);
if (TREE_CODE (mem) == VAR_DECL || TREE_CODE (mem) == FUNCTION_DECL)
reset_decl_linkage (mem);
+ else if (DECL_IMPLICIT_TYPEDEF_P (mem))
+ reset_type_linkage (TREE_TYPE (mem));
}
- binding_table_foreach (CLASSTYPE_NESTED_UTDS (type),
- bt_reset_linkage_2, NULL);
}
}
-static void
-bt_reset_linkage_2 (binding_entry b, void */*data*/)
-{
- reset_type_linkage_2 (b->type);
-}
-void
-reset_type_linkage (tree type)
-{
- reset_type_linkage_1 (type);
- reset_type_linkage_2 (type);
-}
-
/* Set up our initial idea of what the linkage of DECL should be. */
void
@@ -4363,7 +4347,7 @@ collect_source_refs (tree namespc)
{
/* Iterate over names in this name space. */
for (tree t = NAMESPACE_LEVEL (namespc)->names; t; t = TREE_CHAIN (t))
- if (DECL_IS_BUILTIN (t))
+ if (DECL_IS_UNDECLARED_BUILTIN (t))
;
else if (TREE_CODE (t) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (t))
collect_source_refs (t);
@@ -5604,16 +5588,6 @@ mark_used (tree decl, tsubst_flags_t complain)
if (DECL_ODR_USED (decl))
return true;
- /* Normally, we can wait until instantiation-time to synthesize DECL.
- However, if DECL is a static data member initialized with a constant
- or a constexpr function, we need it right now because a reference to
- such a data member or a call to such function is not value-dependent.
- For a function that uses auto in the return type, we need to instantiate
- it to find out its type. For OpenMP user defined reductions, we need
- them instantiated for reduction clauses which inline them by hand
- directly. */
- maybe_instantiate_decl (decl);
-
if (flag_concepts && TREE_CODE (decl) == FUNCTION_DECL
&& !constraints_satisfied_p (decl))
{
@@ -5629,6 +5603,16 @@ mark_used (tree decl, tsubst_flags_t complain)
return false;
}
+ /* Normally, we can wait until instantiation-time to synthesize DECL.
+ However, if DECL is a static data member initialized with a constant
+ or a constexpr function, we need it right now because a reference to
+ such a data member or a call to such function is not value-dependent.
+ For a function that uses auto in the return type, we need to instantiate
+ it to find out its type. For OpenMP user defined reductions, we need
+ them instantiated for reduction clauses which inline them by hand
+ directly. */
+ maybe_instantiate_decl (decl);
+
if (processing_template_decl || in_template_function ())
return true;
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index cb1a410..0f6c76b 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -41,7 +41,6 @@ static tree do_allocate_exception (tree);
static tree wrap_cleanups_r (tree *, int *, void *);
static int complete_ptr_ref_or_void_ptr_p (tree, tree);
static bool is_admissible_throw_operand_or_catch_parameter (tree, bool);
-static int can_convert_eh (tree, tree);
/* Sets up all the global eh stuff that needs to be initialized at the
start of compilation. */
@@ -932,31 +931,34 @@ nothrow_libfn_p (const_tree fn)
/* Returns nonzero if an exception of type FROM will be caught by a
handler for type TO, as per [except.handle]. */
-static int
+static bool
can_convert_eh (tree to, tree from)
{
to = non_reference (to);
from = non_reference (from);
+ if (same_type_ignoring_top_level_qualifiers_p (to, from))
+ return true;
+
if (TYPE_PTR_P (to) && TYPE_PTR_P (from))
{
to = TREE_TYPE (to);
from = TREE_TYPE (from);
if (! at_least_as_qualified_p (to, from))
- return 0;
+ return false;
if (VOID_TYPE_P (to))
- return 1;
+ return true;
/* Else fall through. */
}
if (CLASS_TYPE_P (to) && CLASS_TYPE_P (from)
&& publicly_uniquely_derived_p (to, from))
- return 1;
+ return true;
- return 0;
+ return false;
}
/* Check whether any of the handlers in I are shadowed by another handler
@@ -975,11 +977,11 @@ check_handlers_1 (tree master, tree_stmt_iterator i)
tree handler = tsi_stmt (i);
if (TREE_TYPE (handler) && can_convert_eh (type, TREE_TYPE (handler)))
{
- warning_at (EXPR_LOCATION (handler), 0,
- "exception of type %qT will be caught",
- TREE_TYPE (handler));
- warning_at (EXPR_LOCATION (master), 0,
- " by earlier handler for %qT", type);
+ auto_diagnostic_group d;
+ if (warning_at (EXPR_LOCATION (handler), OPT_Wexceptions,
+ "exception of type %qT will be caught by earlier "
+ "handler", TREE_TYPE (handler)))
+ inform (EXPR_LOCATION (master), "for type %qT", type);
break;
}
}
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 6a783a9..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",
@@ -581,17 +581,11 @@ 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);
@@ -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 1bddb655..ffb84ea 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2957,7 +2957,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
return error_mark_node;
}
- if (is_std_init_list (elt_type))
+ if (is_std_init_list (elt_type) && !cp_unevaluated_operand)
warning (OPT_Winit_list_lifetime,
"%<new%> of %<initializer_list%> does not "
"extend the lifetime of the underlying array");
diff --git a/gcc/cp/logic.cc b/gcc/cp/logic.cc
index 194b743..6701488 100644
--- a/gcc/cp/logic.cc
+++ b/gcc/cp/logic.cc
@@ -47,21 +47,6 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "type-utils.h"
-/* Hash functions for atomic constrains. */
-
-struct constraint_hash : default_hash_traits<tree>
-{
- static hashval_t hash (tree t)
- {
- return hash_atomic_constraint (t);
- }
-
- static bool equal (tree t1, tree t2)
- {
- return atomic_constraints_identical_p (t1, t2);
- }
-};
-
/* A conjunctive or disjunctive clause.
Each clause maintains an iterator that refers to the current
@@ -219,7 +204,7 @@ struct clause
}
std::list<tree> m_terms; /* The list of terms. */
- hash_set<tree, false, constraint_hash> m_set; /* The set of atomic constraints. */
+ hash_set<tree, false, atom_hasher> m_set; /* The set of atomic constraints. */
iterator m_current; /* The current term. */
};
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 6e4c5f7..16e7635 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1924,15 +1924,26 @@ is_xible_helper (enum tree_code code, tree to, tree from, bool trivial)
bool
is_trivially_xible (enum tree_code code, tree to, tree from)
{
- tree expr;
- expr = is_xible_helper (code, to, from, /*trivial*/true);
-
+ tree expr = is_xible_helper (code, to, from, /*trivial*/true);
if (expr == NULL_TREE || expr == error_mark_node)
return false;
tree nt = cp_walk_tree_without_duplicates (&expr, check_nontriv, NULL);
return !nt;
}
+/* Returns true iff TO is nothrow assignable (if CODE is MODIFY_EXPR) or
+ constructible (otherwise) from FROM, which is a single type for
+ assignment or a list of types for construction. */
+
+bool
+is_nothrow_xible (enum tree_code code, tree to, tree from)
+{
+ tree expr = is_xible_helper (code, to, from, /*trivial*/false);
+ if (expr == NULL_TREE || expr == error_mark_node)
+ return false;
+ return expr_noexcept_p (expr, tf_none);
+}
+
/* Returns true iff TO is assignable (if CODE is MODIFY_EXPR) or
constructible (otherwise) from FROM, which is a single type for
assignment or a list of types for construction. */
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index e3f3712..410ec59 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -38,7 +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_with_scope (tree x, cp_binding_level *, bool hiding);
+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,
@@ -171,8 +171,13 @@ public:
public:
tree name; /* The identifier being looked for. */
+
+ /* Usually we just add things to the VALUE binding, but we record
+ (hidden) IMPLICIT_TYPEDEFs on the type binding, which is used for
+ using-decl resolution. */
tree value; /* A (possibly ambiguous) set of things found. */
tree type; /* A type that has been found. */
+
LOOK_want want; /* What kind of entity we want. */
bool deduping; /* Full deduping is needed because using declarations
@@ -263,14 +268,17 @@ private:
private:
void add_fns (tree);
+ private:
void adl_expr (tree);
void adl_type (tree);
void adl_template_arg (tree);
void adl_class (tree);
+ void adl_enum (tree);
void adl_bases (tree);
void adl_class_only (tree);
void adl_namespace (tree);
- void adl_namespace_only (tree);
+ void adl_class_fns (tree);
+ void adl_namespace_fns (tree);
public:
/* Search namespace + inlines + maybe usings as qualified lookup. */
@@ -433,8 +441,8 @@ name_lookup::add_overload (tree fns)
if (probe && TREE_CODE (probe) == OVERLOAD
&& OVL_DEDUP_P (probe))
{
- /* We're about to add something found by a using
- declaration, so need to engage deduping mode. */
+ /* We're about to add something found by multiple paths, so
+ need to engage deduping mode. */
lookup_mark (value, true);
deduping = true;
}
@@ -777,20 +785,56 @@ name_lookup::add_fns (tree fns)
add_overload (fns);
}
-/* Add functions of a namespace to the lookup structure. */
+/* Add the overloaded fns of SCOPE. */
void
-name_lookup::adl_namespace_only (tree scope)
+name_lookup::adl_namespace_fns (tree scope)
{
- mark_seen (scope);
+ if (tree *binding = find_namespace_slot (scope, name))
+ {
+ tree val = *binding;
+ add_fns (ovl_skip_hidden (MAYBE_STAT_DECL (val)));
+ }
+}
- /* Look down into inline namespaces. */
- if (vec<tree, va_gc> *inlinees = DECL_NAMESPACE_INLINEES (scope))
- for (unsigned ix = inlinees->length (); ix--;)
- adl_namespace_only ((*inlinees)[ix]);
+/* Add the hidden friends of SCOPE. */
+
+void
+name_lookup::adl_class_fns (tree type)
+{
+ /* Add friends. */
+ for (tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type));
+ list; list = TREE_CHAIN (list))
+ if (name == FRIEND_NAME (list))
+ {
+ tree context = NULL_TREE; /* Lazily computed. */
+ for (tree friends = FRIEND_DECLS (list); friends;
+ friends = TREE_CHAIN (friends))
+ {
+ tree fn = TREE_VALUE (friends);
- if (tree fns = find_namespace_value (scope, name))
- add_fns (ovl_skip_hidden (fns));
+ /* Only interested in global functions with potentially hidden
+ (i.e. unqualified) declarations. */
+ if (!context)
+ context = decl_namespace_context (type);
+ if (CP_DECL_CONTEXT (fn) != context)
+ continue;
+
+ if (!deduping)
+ {
+ lookup_mark (value, true);
+ deduping = true;
+ }
+
+ /* Template specializations are never found by name lookup.
+ (Templates themselves can be found, but not template
+ specializations.) */
+ if (TREE_CODE (fn) == FUNCTION_DECL && DECL_USE_TEMPLATE (fn))
+ continue;
+
+ add_fns (fn);
+ }
+ }
}
/* Find the containing non-inlined namespace, add it and all its
@@ -799,14 +843,17 @@ name_lookup::adl_namespace_only (tree scope)
void
name_lookup::adl_namespace (tree scope)
{
- if (seen_p (scope))
+ if (see_and_mark (scope))
return;
- /* Find the containing non-inline namespace. */
- while (DECL_NAMESPACE_INLINE_P (scope))
- scope = CP_DECL_CONTEXT (scope);
+ /* Look down into inline namespaces. */
+ if (vec<tree, va_gc> *inlinees = DECL_NAMESPACE_INLINEES (scope))
+ for (unsigned ix = inlinees->length (); ix--;)
+ adl_namespace ((*inlinees)[ix]);
- adl_namespace_only (scope);
+ if (DECL_NAMESPACE_INLINE_P (scope))
+ /* Mark parent. */
+ adl_namespace (CP_DECL_CONTEXT (scope));
}
/* Adds the class and its friends to the lookup structure. */
@@ -826,31 +873,6 @@ name_lookup::adl_class_only (tree type)
tree context = decl_namespace_context (type);
adl_namespace (context);
-
- complete_type (type);
-
- /* Add friends. */
- for (tree list = DECL_FRIENDLIST (TYPE_MAIN_DECL (type)); list;
- list = TREE_CHAIN (list))
- if (name == FRIEND_NAME (list))
- for (tree friends = FRIEND_DECLS (list); friends;
- friends = TREE_CHAIN (friends))
- {
- tree fn = TREE_VALUE (friends);
-
- /* Only interested in global functions with potentially hidden
- (i.e. unqualified) declarations. */
- if (CP_DECL_CONTEXT (fn) != context)
- continue;
-
- /* Template specializations are never found by name lookup.
- (Templates themselves can be found, but not template
- specializations.) */
- if (TREE_CODE (fn) == FUNCTION_DECL && DECL_USE_TEMPLATE (fn))
- continue;
-
- add_fns (fn);
- }
}
/* Adds the class and its bases to the lookup structure.
@@ -873,7 +895,7 @@ name_lookup::adl_bases (tree type)
}
/* Adds everything associated with a class argument type to the lookup
- structure. Returns true on error.
+ structure.
If T is a class type (including unions), its associated classes are: the
class itself; the class of which it is a member, if any; and its direct
@@ -897,11 +919,13 @@ name_lookup::adl_class (tree type)
return;
type = TYPE_MAIN_VARIANT (type);
+
/* We don't set found here because we have to have set seen first,
which is done in the adl_bases walk. */
if (found_p (type))
return;
+ complete_type (type);
adl_bases (type);
mark_found (type);
@@ -919,6 +943,19 @@ name_lookup::adl_class (tree type)
}
void
+name_lookup::adl_enum (tree type)
+{
+ type = TYPE_MAIN_VARIANT (type);
+ if (see_and_mark (type))
+ return;
+
+ if (TYPE_CLASS_SCOPE_P (type))
+ adl_class_only (TYPE_CONTEXT (type));
+ else
+ adl_namespace (decl_namespace_context (type));
+}
+
+void
name_lookup::adl_expr (tree expr)
{
if (!expr)
@@ -1003,9 +1040,7 @@ name_lookup::adl_type (tree type)
return;
case ENUMERAL_TYPE:
- if (TYPE_CLASS_SCOPE_P (type))
- adl_class_only (TYPE_CONTEXT (type));
- adl_namespace (decl_namespace_context (type));
+ adl_enum (type);
return;
case LANG_TYPE:
@@ -1074,10 +1109,9 @@ name_lookup::adl_template_arg (tree arg)
tree
name_lookup::search_adl (tree fns, vec<tree, va_gc> *args)
{
- deduping = true;
- lookup_mark (fns, true);
- value = fns;
-
+ gcc_checking_assert (!vec_safe_length (scopes));
+
+ /* Gather each associated entity onto the lookup's scope list. */
unsigned ix;
tree arg;
@@ -1089,7 +1123,27 @@ name_lookup::search_adl (tree fns, vec<tree, va_gc> *args)
else
adl_expr (arg);
- fns = value;
+ if (vec_safe_length (scopes))
+ {
+ /* Now do the lookups. */
+ if (fns)
+ {
+ deduping = true;
+ lookup_mark (fns, true);
+ }
+ value = fns;
+
+ for (unsigned ix = scopes->length (); ix--;)
+ {
+ tree scope = (*scopes)[ix];
+ if (TREE_CODE (scope) == NAMESPACE_DECL)
+ adl_namespace_fns (scope);
+ else if (RECORD_OR_UNION_TYPE_P (scope))
+ adl_class_fns (scope);
+ }
+
+ fns = value;
+ }
return fns;
}
@@ -1738,16 +1792,6 @@ insert_late_enum_def_bindings (tree klass, tree enumtype)
}
}
-/* Compute the chain index of a binding_entry given the HASH value of its
- name and the total COUNT of chains. COUNT is assumed to be a power
- of 2. */
-
-#define ENTRY_INDEX(HASH, COUNT) (((HASH) >> 3) & ((COUNT) - 1))
-
-/* A free list of "binding_entry"s awaiting for re-use. */
-
-static GTY((deletable)) binding_entry free_binding_entry = NULL;
-
/* The binding oracle; see cp-tree.h. */
cp_binding_oracle_function *cp_binding_oracle;
@@ -1770,180 +1814,6 @@ query_oracle (tree name)
cp_binding_oracle (CP_ORACLE_IDENTIFIER, name);
}
-/* Create a binding_entry object for (NAME, TYPE). */
-
-static inline binding_entry
-binding_entry_make (tree name, tree type)
-{
- binding_entry entry;
-
- if (free_binding_entry)
- {
- entry = free_binding_entry;
- free_binding_entry = entry->chain;
- }
- else
- entry = ggc_alloc<binding_entry_s> ();
-
- entry->name = name;
- entry->type = type;
- entry->chain = NULL;
-
- return entry;
-}
-
-/* Put ENTRY back on the free list. */
-#if 0
-static inline void
-binding_entry_free (binding_entry entry)
-{
- entry->name = NULL;
- entry->type = NULL;
- entry->chain = free_binding_entry;
- free_binding_entry = entry;
-}
-#endif
-
-/* The datatype used to implement the mapping from names to types at
- a given scope. */
-struct GTY(()) binding_table_s {
- /* Array of chains of "binding_entry"s */
- binding_entry * GTY((length ("%h.chain_count"))) chain;
-
- /* The number of chains in this table. This is the length of the
- member "chain" considered as an array. */
- size_t chain_count;
-
- /* Number of "binding_entry"s in this table. */
- size_t entry_count;
-};
-
-/* Construct TABLE with an initial CHAIN_COUNT. */
-
-static inline void
-binding_table_construct (binding_table table, size_t chain_count)
-{
- table->chain_count = chain_count;
- table->entry_count = 0;
- table->chain = ggc_cleared_vec_alloc<binding_entry> (table->chain_count);
-}
-
-/* Make TABLE's entries ready for reuse. */
-#if 0
-static void
-binding_table_free (binding_table table)
-{
- size_t i;
- size_t count;
-
- if (table == NULL)
- return;
-
- for (i = 0, count = table->chain_count; i < count; ++i)
- {
- binding_entry temp = table->chain[i];
- while (temp != NULL)
- {
- binding_entry entry = temp;
- temp = entry->chain;
- binding_entry_free (entry);
- }
- table->chain[i] = NULL;
- }
- table->entry_count = 0;
-}
-#endif
-
-/* Allocate a table with CHAIN_COUNT, assumed to be a power of two. */
-
-static inline binding_table
-binding_table_new (size_t chain_count)
-{
- binding_table table = ggc_alloc<binding_table_s> ();
- table->chain = NULL;
- binding_table_construct (table, chain_count);
- return table;
-}
-
-/* Expand TABLE to twice its current chain_count. */
-
-static void
-binding_table_expand (binding_table table)
-{
- const size_t old_chain_count = table->chain_count;
- const size_t old_entry_count = table->entry_count;
- const size_t new_chain_count = 2 * old_chain_count;
- binding_entry *old_chains = table->chain;
- size_t i;
-
- binding_table_construct (table, new_chain_count);
- for (i = 0; i < old_chain_count; ++i)
- {
- binding_entry entry = old_chains[i];
- for (; entry != NULL; entry = old_chains[i])
- {
- const unsigned int hash = IDENTIFIER_HASH_VALUE (entry->name);
- const size_t j = ENTRY_INDEX (hash, new_chain_count);
-
- old_chains[i] = entry->chain;
- entry->chain = table->chain[j];
- table->chain[j] = entry;
- }
- }
- table->entry_count = old_entry_count;
-}
-
-/* Insert a binding for NAME to TYPE into TABLE. */
-
-static void
-binding_table_insert (binding_table table, tree name, tree type)
-{
- const unsigned int hash = IDENTIFIER_HASH_VALUE (name);
- const size_t i = ENTRY_INDEX (hash, table->chain_count);
- binding_entry entry = binding_entry_make (name, type);
-
- entry->chain = table->chain[i];
- table->chain[i] = entry;
- ++table->entry_count;
-
- if (3 * table->chain_count < 5 * table->entry_count)
- binding_table_expand (table);
-}
-
-/* Return the binding_entry, if any, that maps NAME. */
-
-binding_entry
-binding_table_find (binding_table table, tree name)
-{
- const unsigned int hash = IDENTIFIER_HASH_VALUE (name);
- binding_entry entry = table->chain[ENTRY_INDEX (hash, table->chain_count)];
-
- while (entry != NULL && entry->name != name)
- entry = entry->chain;
-
- return entry;
-}
-
-/* Apply PROC -- with DATA -- to all entries in TABLE. */
-
-void
-binding_table_foreach (binding_table table, bt_foreach_proc proc, void *data)
-{
- size_t chain_count;
- size_t i;
-
- if (!table)
- return;
-
- chain_count = table->chain_count;
- for (i = 0; i < chain_count; ++i)
- {
- binding_entry entry = table->chain[i];
- for (; entry != NULL; entry = entry->chain)
- proc (entry, data);
- }
-}
-
#ifndef ENABLE_SCOPE_CHECKING
# define ENABLE_SCOPE_CHECKING 0
#else
@@ -2130,7 +2000,7 @@ anticipated_builtin_p (tree ovl)
{
return (TREE_CODE (ovl) == OVERLOAD
&& OVL_HIDDEN_P (ovl)
- && DECL_UNDECLARED_BUILTIN_P (OVL_FUNCTION (ovl)));
+ && DECL_IS_UNDECLARED_BUILTIN (OVL_FUNCTION (ovl)));
}
/* BINDING records an existing declaration for a name in the current scope.
@@ -2969,14 +2839,61 @@ push_local_extern_decl_alias (tree decl)
{
/* No existing namespace-scope decl. Make one. */
alias = copy_decl (decl);
+ if (TREE_CODE (alias) == FUNCTION_DECL)
+ {
+ /* 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);
- alias = do_pushdecl_with_scope (alias, NAMESPACE_LEVEL (ns),
- /* hiding= */true);
+ push_nested_namespace (ns);
+ alias = do_pushdecl (alias, /* hiding= */true);
+ pop_nested_namespace (ns);
}
}
@@ -3645,7 +3562,7 @@ print_binding_level (cp_binding_level* lvl)
continue;
if (no_print_builtins
&& (TREE_CODE (t) == TYPE_DECL)
- && DECL_IS_BUILTIN (t))
+ && DECL_IS_UNDECLARED_BUILTIN (t))
continue;
/* Function decls tend to have longer names. */
@@ -3848,10 +3765,17 @@ 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 hiding = false)
@@ -3956,7 +3880,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_UNDECLARED_BUILTIN_P (old_fn))
+ else if (old.hidden_p () && DECL_IS_UNDECLARED_BUILTIN (old_fn))
continue; /* This is an anticipated builtin. */
else if (!matching_fn_p (new_fn, old_fn))
continue; /* Parameters do not match. */
@@ -6015,7 +5939,14 @@ lookup_qualified_name (tree scope, tree name, LOOK_want want, bool complain)
name_lookup lookup (name, want);
if (qualified_namespace_lookup (scope, &lookup))
- t = lookup.value;
+ {
+ t = lookup.value;
+
+ /* If we have a known type overload, pull it out. This can happen
+ for using decls. */
+ if (TREE_CODE (t) == OVERLOAD && TREE_TYPE (t) != unknown_type_node)
+ t = OVL_FUNCTION (t);
+ }
}
else if (cxx_dialect != cxx98 && TREE_CODE (scope) == ENUMERAL_TYPE)
t = lookup_enumerator (scope, name);
@@ -6645,8 +6576,9 @@ lookup_name_1 (tree name, LOOK_where where, LOOK_want want)
found:;
- /* If we have a single function from a using decl, pull it out. */
- if (val && TREE_CODE (val) == OVERLOAD && !really_overloaded_fn (val))
+ /* If we have a known type overload, pull it out. This can happen
+ for both using decls and unhidden functions. */
+ if (val && TREE_CODE (val) == OVERLOAD && TREE_TYPE (val) != unknown_type_node)
val = OVL_FUNCTION (val);
return val;
@@ -6711,8 +6643,6 @@ lookup_elaborated_type_1 (tree name, TAG_how how)
typedef struct C {} C;
correctly. */
- tree found = NULL_TREE;
- bool reveal = false;
if (tree type = iter->type)
{
if (qualify_lookup (type, LOOK_want::TYPE)
@@ -6720,9 +6650,11 @@ lookup_elaborated_type_1 (tree name, TAG_how how)
|| LOCAL_BINDING_P (iter)
|| DECL_CONTEXT (type) == iter->scope->this_entity))
{
- found = type;
if (how != TAG_how::HIDDEN_FRIEND)
- reveal = HIDDEN_TYPE_BINDING_P (iter);
+ /* It is no longer a hidden binding. */
+ HIDDEN_TYPE_BINDING_P (iter) = false;
+
+ return type;
}
}
else
@@ -6731,32 +6663,12 @@ lookup_elaborated_type_1 (tree name, TAG_how how)
&& (how != TAG_how::CURRENT_ONLY
|| !INHERITED_VALUE_BINDING_P (iter)))
{
- found = iter->value;
- if (how != TAG_how::HIDDEN_FRIEND)
- reveal = !iter->type && HIDDEN_TYPE_BINDING_P (iter);
- }
- }
-
- if (found)
- {
- if (reveal)
- {
- /* It is no longer a hidden binding. */
- HIDDEN_TYPE_BINDING_P (iter) = false;
-
- /* Unanticipate the decl itself. */
- DECL_FRIEND_P (found) = false;
+ if (how != TAG_how::HIDDEN_FRIEND && !iter->type)
+ /* It is no longer a hidden binding. */
+ HIDDEN_TYPE_BINDING_P (iter) = false;
- gcc_checking_assert (TREE_CODE (found) != TEMPLATE_DECL);
-
- if (tree ti = TYPE_TEMPLATE_INFO (TREE_TYPE (found)))
- {
- tree tmpl = TI_TEMPLATE (ti);
- DECL_FRIEND_P (tmpl) = false;
- }
+ return iter->value;
}
-
- return found;
}
}
@@ -6773,61 +6685,31 @@ lookup_elaborated_type_1 (tree name, TAG_how how)
if (tree *slot = find_namespace_slot (ns, name))
{
/* If this is the kind of thing we're looking for, we're done. */
- tree found = NULL_TREE;
- bool reveal = false;
-
if (tree type = MAYBE_STAT_TYPE (*slot))
{
- found = type;
if (how != TAG_how::HIDDEN_FRIEND)
- {
- reveal = STAT_TYPE_HIDDEN_P (*slot);
- STAT_TYPE_HIDDEN_P (*slot) = false;
- }
+ /* 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))
{
- found = decl;
-
- if (how != TAG_how::HIDDEN_FRIEND && STAT_HACK_P (*slot))
+ if (how != TAG_how::HIDDEN_FRIEND && STAT_HACK_P (*slot)
+ && STAT_DECL_HIDDEN_P (*slot))
{
- reveal = STAT_DECL_HIDDEN_P (*slot);
- if (reveal)
- {
- if (STAT_TYPE (*slot))
- STAT_DECL_HIDDEN_P (*slot) = false;
- else
- /* There is no type, just remove the stat
- hack. */
- *slot = decl;
- }
+ if (STAT_TYPE (*slot))
+ STAT_DECL_HIDDEN_P (*slot) = false;
+ else
+ /* There is no type, just remove the stat
+ hack. */
+ *slot = decl;
}
- }
- }
- if (found)
- {
- if (reveal)
- {
- /* Reveal the previously hidden thing. */
- DECL_FRIEND_P (found) = false;
-
- if (TREE_CODE (found) == TEMPLATE_DECL)
- {
- tree res = DECL_TEMPLATE_RESULT (found);
- if (DECL_LANG_SPECIFIC (res))
- DECL_FRIEND_P (res) = false;
- }
- else if (tree ti = TYPE_TEMPLATE_INFO (TREE_TYPE (found)))
- {
- tree tmpl = TI_TEMPLATE (ti);
- DECL_FRIEND_P (tmpl) = false;
- }
+ return decl;
}
-
- return found;
}
}
@@ -6880,10 +6762,6 @@ maybe_process_template_type_declaration (tree type, int is_friend,
if (processing_template_decl)
{
- /* 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 (decl, is_friend);
if (decl == error_mark_node)
return error_mark_node;
@@ -6902,17 +6780,8 @@ maybe_process_template_type_declaration (tree type, int is_friend,
finish_member_declaration (CLASSTYPE_TI_TEMPLATE (type));
if (!COMPLETE_TYPE_P (current_class_type))
- {
- maybe_add_class_template_decl_list (current_class_type,
- type, /*friend_p=*/0);
- /* Put this UTD in the table of UTDs for the class. */
- if (CLASSTYPE_NESTED_UTDS (current_class_type) == NULL)
- CLASSTYPE_NESTED_UTDS (current_class_type) =
- binding_table_new (SCOPE_DEFAULT_HT_SIZE);
-
- binding_table_insert
- (CLASSTYPE_NESTED_UTDS (current_class_type), name, type);
- }
+ maybe_add_class_template_decl_list (current_class_type,
+ type, /*friend_p=*/0);
}
}
}
@@ -7009,18 +6878,8 @@ do_pushtag (tree name, tree type, TAG_how how)
tdef = create_implicit_typedef (name, type);
DECL_CONTEXT (tdef) = FROB_CONTEXT (context);
- bool is_friend = how == TAG_how::HIDDEN_FRIEND;
- if (is_friend)
- {
- // FIXME: can go away
- /* 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. */
- retrofit_lang_decl (tdef);
- DECL_FRIEND_P (tdef) = 1;
- }
-
- decl = maybe_process_template_type_declaration (type, is_friend, b);
+ decl = maybe_process_template_type_declaration
+ (type, how == TAG_how::HIDDEN_FRIEND, b);
if (decl == error_mark_node)
return decl;
@@ -7083,17 +6942,8 @@ do_pushtag (tree name, tree type, TAG_how how)
if (b->kind == sk_class
&& !COMPLETE_TYPE_P (current_class_type))
- {
- maybe_add_class_template_decl_list (current_class_type,
- type, /*friend_p=*/0);
-
- if (CLASSTYPE_NESTED_UTDS (current_class_type) == NULL)
- CLASSTYPE_NESTED_UTDS (current_class_type)
- = binding_table_new (SCOPE_DEFAULT_HT_SIZE);
-
- binding_table_insert
- (CLASSTYPE_NESTED_UTDS (current_class_type), name, type);
- }
+ maybe_add_class_template_decl_list (current_class_type,
+ type, /*friend_p=*/0);
decl = TYPE_NAME (type);
gcc_assert (TREE_CODE (decl) == TYPE_DECL);
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index d63ff10..6d18539 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -23,29 +23,6 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-common.h"
-/* The type of dictionary used to map names to types declared at
- a given scope. */
-typedef struct binding_table_s *binding_table;
-typedef struct binding_entry_s *binding_entry;
-
-/* The type of a routine repeatedly called by binding_table_foreach. */
-typedef void (*bt_foreach_proc) (binding_entry, void *);
-
-struct GTY(()) binding_entry_s {
- binding_entry chain;
- tree name;
- tree type;
-};
-
-/* These macros indicate the initial chains count for binding_table. */
-#define SCOPE_DEFAULT_HT_SIZE (1 << 3)
-#define CLASS_SCOPE_HT_SIZE (1 << 3)
-#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5)
-#define NAMESPACE_STD_HT_SIZE (1 << 8)
-#define GLOBAL_SCOPE_HT_SIZE (1 << 8)
-
-extern void binding_table_foreach (binding_table, bt_foreach_proc, void *);
-extern binding_entry binding_table_find (binding_table, tree);
/* The datatype used to implement C++ scope. */
struct cp_binding_level;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 592ce95..9c08c0e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -1438,7 +1438,8 @@ clear_decl_specs (cp_decl_specifier_seq *decl_specs)
VAR_DECLs or FUNCTION_DECLs) should do that directly. */
static cp_declarator *make_call_declarator
- (cp_declarator *, tree, cp_cv_quals, cp_virt_specifiers, cp_ref_qualifier, tree, tree, tree, tree);
+ (cp_declarator *, tree, cp_cv_quals, cp_virt_specifiers, cp_ref_qualifier,
+ tree, tree, tree, tree, location_t);
static cp_declarator *make_array_declarator
(cp_declarator *, tree);
static cp_declarator *make_pointer_declarator
@@ -1621,7 +1622,8 @@ make_call_declarator (cp_declarator *target,
tree tx_qualifier,
tree exception_specification,
tree late_return_type,
- tree requires_clause)
+ tree requires_clause,
+ location_t parens_loc)
{
cp_declarator *declarator;
@@ -1635,6 +1637,7 @@ make_call_declarator (cp_declarator *target,
declarator->u.function.exception_specification = exception_specification;
declarator->u.function.late_return_type = late_return_type;
declarator->u.function.requires_clause = requires_clause;
+ declarator->u.function.parens_loc = parens_loc;
if (target)
{
declarator->id_loc = target->id_loc;
@@ -5138,6 +5141,8 @@ cp_parser_fold_expression (cp_parser *parser, tree expr1)
// Left fold.
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
{
+ if (expr1)
+ return error_mark_node;
cp_lexer_consume_token (parser->lexer);
int op = cp_parser_fold_operator (parser);
if (op == ERROR_MARK)
@@ -5637,6 +5642,8 @@ cp_parser_primary_expression (cp_parser *parser,
case RID_IS_UNION:
case RID_IS_ASSIGNABLE:
case RID_IS_CONSTRUCTIBLE:
+ case RID_IS_NOTHROW_ASSIGNABLE:
+ case RID_IS_NOTHROW_CONSTRUCTIBLE:
return cp_parser_trait_expr (parser, token->keyword);
// C++ concepts
@@ -10501,6 +10508,14 @@ cp_parser_trait_expr (cp_parser* parser, enum rid keyword)
kind = CPTK_IS_CONSTRUCTIBLE;
variadic = true;
break;
+ case RID_IS_NOTHROW_ASSIGNABLE:
+ kind = CPTK_IS_NOTHROW_ASSIGNABLE;
+ binary = true;
+ break;
+ case RID_IS_NOTHROW_CONSTRUCTIBLE:
+ kind = CPTK_IS_NOTHROW_CONSTRUCTIBLE;
+ variadic = true;
+ break;
default:
gcc_unreachable ();
}
@@ -11234,7 +11249,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
tx_qual,
exception_spec,
return_type,
- trailing_requires_clause);
+ trailing_requires_clause,
+ UNKNOWN_LOCATION);
declarator->std_attributes = std_attrs;
fco = grokmethod (&return_type_specs,
@@ -13497,10 +13513,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);
@@ -16017,8 +16031,13 @@ cp_parser_template_declaration (cp_parser* parser, bool member_p)
{
/* Consume the `export' token. */
cp_lexer_consume_token (parser->lexer);
- /* Warn that we do not support `export'. */
- warning (0, "keyword %<export%> not implemented, and will be ignored");
+ /* Warn that this use of export is deprecated. */
+ if (cxx_dialect < cxx11)
+ warning (0, "keyword %<export%> not implemented, and will be ignored");
+ else if (cxx_dialect < cxx20)
+ warning (0, "keyword %<export%> is deprecated, and is ignored");
+ else
+ warning (0, "keyword %<export%> not implemented, and will be ignored");
}
cp_parser_template_declaration_after_export (parser, member_p);
@@ -17634,10 +17653,8 @@ cp_parser_explicit_instantiation (cp_parser* parser)
instantiation. */
if (declares_class_or_enum && cp_parser_declares_only_class_p (parser))
{
- tree type;
-
- type = check_tag_decl (&decl_specifiers,
- /*explicit_type_instantiation_p=*/true);
+ tree type = check_tag_decl (&decl_specifiers,
+ /*explicit_type_instantiation_p=*/true);
/* Turn access control back on for names used during
template instantiation. */
pop_deferring_access_checks ();
@@ -17741,7 +17758,6 @@ cp_parser_explicit_specialization (cp_parser* parser)
/* Give it C++ linkage to avoid confusing other parts of the
front end. */
push_lang_context (lang_name_cplusplus);
- need_lang_pop = true;
}
/* Let the front end know that we are beginning a specialization. */
@@ -20605,6 +20621,140 @@ strip_declarator_types (tree type, cp_declarator *declarator)
return type;
}
+/* Warn about the most vexing parse syntactic ambiguity, i.e., warn when
+ a construct looks like a variable definition but is actually a function
+ declaration. DECL_SPECIFIERS is the decl-specifier-seq and DECLARATOR
+ is the declarator for this function declaration. */
+
+static void
+warn_about_ambiguous_parse (const cp_decl_specifier_seq *decl_specifiers,
+ const cp_declarator *declarator)
+{
+ /* Only warn if we are declaring a function at block scope. */
+ if (!at_function_scope_p ())
+ return;
+
+ /* And only if there is no storage class specified. */
+ if (decl_specifiers->storage_class != sc_none
+ || decl_spec_seq_has_spec_p (decl_specifiers, ds_typedef))
+ return;
+
+ if (declarator->kind != cdk_function
+ || !declarator->declarator
+ || declarator->declarator->kind != cdk_id
+ || !identifier_p (get_unqualified_id
+ (const_cast<cp_declarator *>(declarator))))
+ return;
+
+ /* Don't warn when the whole declarator (not just the declarator-id!)
+ was parenthesized. That is, don't warn for int(n()) but do warn
+ for int(f)(). */
+ if (declarator->parenthesized != UNKNOWN_LOCATION)
+ return;
+
+ tree type;
+ if (decl_specifiers->type)
+ {
+ type = decl_specifiers->type;
+ if (TREE_CODE (type) == TYPE_DECL)
+ type = TREE_TYPE (type);
+
+ /* If the return type is void there is no ambiguity. */
+ if (same_type_p (type, void_type_node))
+ return;
+ }
+ else
+ {
+ /* Code like long f(); will have null ->type. If we have any
+ type-specifiers, pretend we've seen int. */
+ gcc_checking_assert (decl_specifiers->any_type_specifiers_p);
+ type = integer_type_node;
+ }
+
+ auto_diagnostic_group d;
+ location_t loc = declarator->u.function.parens_loc;
+ tree params = declarator->u.function.parameters;
+ const bool has_list_ctor_p = CLASS_TYPE_P (type) && TYPE_HAS_LIST_CTOR (type);
+
+ /* The T t() case. */
+ if (params == void_list_node)
+ {
+ if (warning_at (loc, OPT_Wvexing_parse,
+ "empty parentheses were disambiguated as a function "
+ "declaration"))
+ {
+ /* () means value-initialization (C++03 and up); {} (C++11 and up)
+ means value-initialization or aggregate-initialization, nothing
+ means default-initialization. We can only suggest removing the
+ parentheses/adding {} if T has a default constructor. */
+ if (!CLASS_TYPE_P (type) || TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
+ {
+ gcc_rich_location iloc (loc);
+ iloc.add_fixit_remove ();
+ inform (&iloc, "remove parentheses to default-initialize "
+ "a variable");
+ if (cxx_dialect >= cxx11 && !has_list_ctor_p)
+ {
+ if (CP_AGGREGATE_TYPE_P (type))
+ inform (loc, "or replace parentheses with braces to "
+ "aggregate-initialize a variable");
+ else
+ inform (loc, "or replace parentheses with braces to "
+ "value-initialize a variable");
+ }
+ }
+ }
+ return;
+ }
+
+ /* If we had (...) or the parameter-list wasn't parenthesized,
+ we're done. */
+ if (params == NULL_TREE || !PARENTHESIZED_LIST_P (params))
+ return;
+
+ /* The T t(X()) case. */
+ if (list_length (params) == 2)
+ {
+ if (warning_at (loc, OPT_Wvexing_parse,
+ "parentheses were disambiguated as a function "
+ "declaration"))
+ {
+ gcc_rich_location iloc (loc);
+ /* {}-initialization means that we can use an initializer-list
+ constructor if no default constructor is available, so don't
+ suggest using {} for classes that have an initializer_list
+ constructor. */
+ if (cxx_dialect >= cxx11 && !has_list_ctor_p)
+ {
+ iloc.add_fixit_replace (get_start (loc), "{");
+ iloc.add_fixit_replace (get_finish (loc), "}");
+ inform (&iloc, "replace parentheses with braces to declare a "
+ "variable");
+ }
+ else
+ {
+ iloc.add_fixit_insert_after (get_start (loc), "(");
+ iloc.add_fixit_insert_before (get_finish (loc), ")");
+ inform (&iloc, "add parentheses to declare a variable");
+ }
+ }
+ }
+ /* The T t(X(), X()) case. */
+ else if (warning_at (loc, OPT_Wvexing_parse,
+ "parentheses were disambiguated as a function "
+ "declaration"))
+ {
+ gcc_rich_location iloc (loc);
+ if (cxx_dialect >= cxx11 && !has_list_ctor_p)
+ {
+ iloc.add_fixit_replace (get_start (loc), "{");
+ iloc.add_fixit_replace (get_finish (loc), "}");
+ inform (&iloc, "replace parentheses with braces to declare a "
+ "variable");
+ }
+ }
+}
+
/* Declarators [gram.dcl.decl] */
/* Parse an init-declarator.
@@ -20782,6 +20932,7 @@ cp_parser_init_declarator (cp_parser* parser,
{
/* Handle C++17 deduction guides. */
if (!decl_specifiers->type
+ && !decl_specifiers->any_type_specifiers_p
&& ctor_dtor_or_conv_p <= 0
&& cxx_dialect >= cxx17)
{
@@ -20799,6 +20950,9 @@ cp_parser_init_declarator (cp_parser* parser,
}
}
+ if (!member_p && !cp_parser_error_occurred (parser))
+ warn_about_ambiguous_parse (decl_specifiers, declarator);
+
/* Check to see if the token indicates the start of a
function-definition. */
if (cp_parser_token_starts_function_definition_p (token))
@@ -21193,7 +21347,7 @@ cp_parser_declarator (cp_parser* parser,
/* If a ptr-operator was found, then this declarator was not
parenthesized. */
if (parenthesized_p)
- *parenthesized_p = true;
+ *parenthesized_p = false;
/* The dependent declarator is optional if we are parsing an
abstract-declarator. */
if (dcl_kind != CP_PARSER_DECLARATOR_NAMED)
@@ -21340,6 +21494,7 @@ cp_parser_direct_declarator (cp_parser* parser,
cp_parser_parse_tentatively (parser);
/* Consume the `('. */
+ const location_t parens_start = token->location;
matching_parens parens;
parens.consume_open (parser);
if (first)
@@ -21359,6 +21514,8 @@ cp_parser_direct_declarator (cp_parser* parser,
/* Parse the parameter-declaration-clause. */
params
= cp_parser_parameter_declaration_clause (parser, flags);
+ const location_t parens_end
+ = cp_lexer_peek_token (parser->lexer)->location;
/* Consume the `)'. */
parens.require_close (parser);
@@ -21423,6 +21580,9 @@ cp_parser_direct_declarator (cp_parser* parser,
/* Parse the virt-specifier-seq. */
virt_specifiers = cp_parser_virt_specifier_seq_opt (parser);
+ location_t parens_loc = make_location (parens_start,
+ parens_start,
+ parens_end);
/* Create the function-declarator. */
declarator = make_call_declarator (declarator,
params,
@@ -21432,7 +21592,8 @@ cp_parser_direct_declarator (cp_parser* parser,
tx_qual,
exception_specification,
late_return,
- requires_clause);
+ requires_clause,
+ parens_loc);
declarator->std_attributes = attrs;
declarator->attributes = gnu_attrs;
/* Any subsequent parameter lists are to do with
@@ -21858,7 +22019,9 @@ cp_parser_direct_declarator (cp_parser* parser,
open_paren = NULL;
}
if (open_paren)
- declarator->parenthesized = open_paren->location;
+ declarator->parenthesized = make_location (open_paren->location,
+ open_paren->location,
+ close_paren->location);
}
/* If we entered a scope, we must exit it now. */
@@ -22409,9 +22572,20 @@ cp_parser_type_id_1 (cp_parser *parser, cp_parser_flags flags,
if (!cp_parser_parse_definitely (parser))
abstract_declarator = NULL;
+ bool auto_typeid_ok = false;
+ /* The concepts TS allows 'auto' as a type-id. */
+ if (flag_concepts_ts)
+ auto_typeid_ok = !parser->in_type_id_in_expr_p;
+ /* DR 625 prohibits use of auto as a template-argument. We allow 'auto'
+ outside the template-argument-list context here only for the sake of
+ diagnostic: grokdeclarator then can emit a better error message for
+ e.g. using T = auto. */
+ else if (flag_concepts)
+ auto_typeid_ok = (!parser->in_type_id_in_expr_p
+ && !parser->in_template_argument_list_p);
+
if (type_specifier_seq.type
- /* The concepts TS allows 'auto' as a type-id. */
- && (!flag_concepts || parser->in_type_id_in_expr_p)
+ && !auto_typeid_ok
/* None of the valid uses of 'auto' in C++14 involve the type-id
nonterminal, but it is valid in a trailing-return-type. */
&& !(cxx_dialect >= cxx14 && is_trailing_return))
@@ -22438,6 +22612,9 @@ cp_parser_type_id_1 (cp_parser *parser, cp_parser_flags flags,
inform (DECL_SOURCE_LOCATION (tmpl), "%qD declared here",
tmpl);
}
+ else if (parser->in_template_argument_list_p)
+ error_at (loc, "%qT not permitted in template argument",
+ auto_node);
else
error_at (loc, "invalid use of %qT", auto_node);
return error_mark_node;
@@ -22683,7 +22860,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser,
/* Consume the `void' token. */
cp_lexer_consume_token (parser->lexer);
/* There are no parameters. */
- return void_list_node;
+ return explicit_void_list_node;
}
/* Parse the parameter-declaration-list. */
@@ -22807,6 +22984,12 @@ cp_parser_parameter_declaration_list (cp_parser* parser, cp_parser_flags flags)
*tail = build_tree_list (parameter->default_argument, decl);
tail = &TREE_CHAIN (*tail);
+ /* If the parameters were parenthesized, it's the case of
+ T foo(X(x)) which looks like a variable definition but
+ is a function declaration. */
+ if (index == 1 || PARENTHESIZED_LIST_P (parameters))
+ PARENTHESIZED_LIST_P (parameters) = parenthesized_p;
+
/* Peek at the next token. */
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN)
|| cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)
@@ -23786,13 +23969,10 @@ cp_parser_class_name (cp_parser *parser,
bool enum_ok)
{
tree decl;
- tree scope;
- bool typename_p;
- cp_token *token;
tree identifier = NULL_TREE;
/* All class-names start with an identifier. */
- token = cp_lexer_peek_token (parser->lexer);
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
if (token->type != CPP_NAME && token->type != CPP_TEMPLATE_ID)
{
cp_parser_error (parser, "expected class-name");
@@ -23808,14 +23988,16 @@ cp_parser_class_name (cp_parser *parser,
where we first want to look up A<T>::a in the class of the object
expression, as per [basic.lookup.classref]. */
- scope = parser->scope ? parser->scope : parser->context->object_type;
+ tree scope = parser->scope ? parser->scope : parser->context->object_type;
if (scope == error_mark_node)
return error_mark_node;
/* Any name names a type if we're following the `typename' keyword
in a qualified name where the enclosing scope is type-dependent. */
- typename_p = (typename_keyword_p && scope && TYPE_P (scope)
- && dependent_type_p (scope));
+ const bool typename_p = (typename_keyword_p
+ && parser->scope
+ && TYPE_P (parser->scope)
+ && dependent_type_p (parser->scope));
/* Handle the common case (an identifier, but not a template-id)
efficiently. */
if (token->type == CPP_NAME
@@ -24311,8 +24493,12 @@ cp_parser_class_specifier_1 (cp_parser* parser)
/* Now we can parse the noexcept-specifier. */
spec = cp_parser_late_noexcept_specifier (parser, spec);
- if (spec != error_mark_node)
- TREE_TYPE (decl) = build_exception_variant (TREE_TYPE (decl), spec);
+ if (spec == error_mark_node)
+ spec = NULL_TREE;
+
+ /* Update the fn's type directly -- it might have escaped
+ beyond this decl :( */
+ fixup_deferred_exception_variants (TREE_TYPE (decl), spec);
/* Restore the state of local_variables_forbidden_p. */
parser->local_variables_forbidden_p = local_variables_forbidden_p;
@@ -25148,14 +25334,12 @@ cp_parser_member_declaration (cp_parser* parser)
}
else
{
- tree type;
-
/* See if this declaration is a friend. */
friend_p = cp_parser_friend_p (&decl_specifiers);
/* If there were decl-specifiers, check to see if there was
a class-declaration. */
- type = check_tag_decl (&decl_specifiers,
- /*explicit_type_instantiation_p=*/false);
+ tree type = check_tag_decl (&decl_specifiers,
+ /*explicit_type_instantiation_p=*/false);
/* Nested classes have already been added to the class, but
a `friend' needs to be explicitly registered. */
if (friend_p)
@@ -25350,6 +25534,9 @@ cp_parser_member_declaration (cp_parser* parser)
int ctor_dtor_or_conv_p;
bool static_p = (decl_specifiers.storage_class == sc_static);
cp_parser_flags flags = CP_PARSER_FLAGS_TYPENAME_OPTIONAL;
+ /* We can't delay parsing for friends,
+ alias-declarations, and typedefs, even though the
+ standard seems to require it. */
if (!friend_p
&& !decl_spec_seq_has_spec_p (&decl_specifiers, ds_typedef))
flags |= CP_PARSER_FLAGS_DELAY_NOEXCEPT;
@@ -26038,19 +26225,14 @@ cp_parser_noexcept_specification_opt (cp_parser* parser,
a class. So, if the noexcept-specifier has the optional expression,
just save the tokens, and reparse this after we're done with the
class. */
- const bool literal_p
- = ((cp_lexer_nth_token_is (parser->lexer, 3, CPP_NUMBER)
- || cp_lexer_nth_token_is (parser->lexer, 3, CPP_KEYWORD))
- && cp_lexer_nth_token_is (parser->lexer, 4, CPP_CLOSE_PAREN));
- if (cp_lexer_nth_token_is (parser->lexer, 2, CPP_OPEN_PAREN)
+ if ((flags & CP_PARSER_FLAGS_DELAY_NOEXCEPT)
+ && cp_lexer_nth_token_is (parser->lexer, 2, CPP_OPEN_PAREN)
/* No need to delay parsing for a number literal or true/false. */
- && !literal_p
+ && !((cp_lexer_nth_token_is (parser->lexer, 3, CPP_NUMBER)
+ || cp_lexer_nth_token_is (parser->lexer, 3, CPP_KEYWORD))
+ && cp_lexer_nth_token_is (parser->lexer, 4, CPP_CLOSE_PAREN))
&& at_class_scope_p ()
- /* We don't delay parsing for friend member functions,
- alias-declarations, and typedefs, even though the standard seems
- to require it. */
- && (flags & CP_PARSER_FLAGS_DELAY_NOEXCEPT)
&& TYPE_BEING_DEFINED (current_class_type)
&& !LAMBDA_TYPE_P (current_class_type))
return cp_parser_save_noexcept (parser);
@@ -27098,30 +27280,30 @@ cp_parser_std_attribute (cp_parser *parser, tree attr_ns)
return attribute;
}
-/* Check that the attribute ATTRIBUTE appears at most once in the
- attribute-list ATTRIBUTES. This is enforced for noreturn (7.6.3),
- nodiscard, and deprecated (7.6.5). Note that
- carries_dependency (7.6.4) isn't implemented yet in GCC. */
+/* Warn if the attribute ATTRIBUTE appears more than once in the
+ attribute-list ATTRIBUTES. This used to be enforced for certain
+ attributes, but the restriction was removed in P2156. Note that
+ carries_dependency ([dcl.attr.depend]) isn't implemented yet in GCC.
+ LOC is the location of ATTRIBUTE. Returns true if ATTRIBUTE was not
+ found in ATTRIBUTES. */
-static void
-cp_parser_check_std_attribute (tree attributes, tree attribute)
+static bool
+cp_parser_check_std_attribute (location_t loc, tree attributes, tree attribute)
{
+ static auto alist = { "noreturn", "deprecated", "nodiscard", "maybe_unused",
+ "likely", "unlikely", "fallthrough",
+ "no_unique_address" };
if (attributes)
- {
- tree name = get_attribute_name (attribute);
- if (is_attribute_p ("noreturn", name)
- && lookup_attribute ("noreturn", attributes))
- error ("attribute %<noreturn%> can appear at most once "
- "in an attribute-list");
- else if (is_attribute_p ("deprecated", name)
- && lookup_attribute ("deprecated", attributes))
- error ("attribute %<deprecated%> can appear at most once "
- "in an attribute-list");
- else if (is_attribute_p ("nodiscard", name)
- && lookup_attribute ("nodiscard", attributes))
- error ("attribute %<nodiscard%> can appear at most once "
- "in an attribute-list");
- }
+ for (const auto &a : alist)
+ if (is_attribute_p (a, get_attribute_name (attribute))
+ && lookup_attribute (a, attributes))
+ {
+ if (!from_macro_expansion_at (loc))
+ warning_at (loc, OPT_Wattributes, "attribute %qs specified "
+ "multiple times", a);
+ return false;
+ }
+ return true;
}
/* Parse a list of standard C++-11 attributes.
@@ -27141,14 +27323,17 @@ cp_parser_std_attribute_list (cp_parser *parser, tree attr_ns)
while (true)
{
+ location_t loc = cp_lexer_peek_token (parser->lexer)->location;
attribute = cp_parser_std_attribute (parser, attr_ns);
if (attribute == error_mark_node)
break;
if (attribute != NULL_TREE)
{
- cp_parser_check_std_attribute (attributes, attribute);
- TREE_CHAIN (attribute) = attributes;
- attributes = attribute;
+ if (cp_parser_check_std_attribute (loc, attributes, attribute))
+ {
+ TREE_CHAIN (attribute) = attributes;
+ attributes = attribute;
+ }
}
token = cp_lexer_peek_token (parser->lexer);
if (token->type == CPP_ELLIPSIS)
@@ -28462,11 +28647,6 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
prefer_type_arg (tag_type),
/*complain=*/true);
- /* If we have a single function from a using decl, pull it out. */
- if (TREE_CODE (decl) == OVERLOAD
- && !really_overloaded_fn (decl))
- decl = OVL_FUNCTION (decl);
-
if (pushed_scope)
pop_scope (pushed_scope);
}
@@ -33830,30 +34010,11 @@ cp_parser_objc_struct_declaration (cp_parser *parser)
static void
cp_parser_objc_at_property_declaration (cp_parser *parser)
{
- /* The following variables hold the attributes of the properties as
- parsed. They are 'false' or 'NULL_TREE' if the attribute was not
- seen. When we see an attribute, we set them to 'true' (if they
- are boolean properties) or to the identifier (if they have an
- argument, ie, for getter and setter). Note that here we only
- parse the list of attributes, check the syntax and accumulate the
- attributes that we find. objc_add_property_declaration() will
- then process the information. */
- bool property_assign = false;
- bool property_copy = false;
- tree property_getter_ident = NULL_TREE;
- bool property_nonatomic = false;
- bool property_readonly = false;
- bool property_readwrite = false;
- bool property_retain = false;
- tree property_setter_ident = NULL_TREE;
+ /* Parse the optional attribute list.
- /* 'properties' is the list of properties that we read. Usually a
- single one, but maybe more (eg, in "@property int a, b, c;" there
- are three). */
- tree properties;
- location_t loc;
-
- loc = cp_lexer_peek_token (parser->lexer)->location;
+ A list of parsed, but not verified, attributes. */
+ vec<property_attribute_info *> prop_attr_list = vNULL;
+ location_t loc = cp_lexer_peek_token (parser->lexer)->location;
cp_lexer_consume_token (parser->lexer); /* Eat '@property'. */
@@ -33862,132 +34023,176 @@ cp_parser_objc_at_property_declaration (cp_parser *parser)
{
/* Eat the '('. */
matching_parens parens;
+ location_t attr_start = cp_lexer_peek_token (parser->lexer)->location;
parens.consume_open (parser);
+ bool syntax_error = false;
- while (true)
+ /* Allow empty @property attribute lists, but with a warning. */
+ location_t attr_end = cp_lexer_peek_token (parser->lexer)->location;
+ location_t attr_comb;
+ if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_PAREN))
{
- bool syntax_error = false;
- cp_token *token = cp_lexer_peek_token (parser->lexer);
- enum rid keyword;
+ attr_comb = make_location (attr_end, attr_start, attr_end);
+ warning_at (attr_comb, OPT_Wattributes,
+ "empty property attribute list");
+ }
+ else
+ while (true)
+ {
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
+ attr_start = token->location;
+ attr_end = get_finish (token->location);
+ attr_comb = make_location (attr_start, attr_start, attr_end);
- if (token->type != CPP_NAME)
- {
- cp_parser_error (parser, "expected identifier");
- break;
- }
- keyword = C_RID_CODE (token->u.value);
- cp_lexer_consume_token (parser->lexer);
- switch (keyword)
- {
- case RID_ASSIGN: property_assign = true; break;
- case RID_COPY: property_copy = true; break;
- case RID_NONATOMIC: property_nonatomic = true; break;
- case RID_READONLY: property_readonly = true; break;
- case RID_READWRITE: property_readwrite = true; break;
- case RID_RETAIN: property_retain = true; break;
-
- case RID_GETTER:
- case RID_SETTER:
- if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ))
- {
- if (keyword == RID_GETTER)
- cp_parser_error (parser,
- "missing %<=%> (after %<getter%> attribute)");
- else
- cp_parser_error (parser,
- "missing %<=%> (after %<setter%> attribute)");
- syntax_error = true;
- break;
- }
- cp_lexer_consume_token (parser->lexer); /* eat the = */
- if (!cp_parser_objc_selector_p (cp_lexer_peek_token (parser->lexer)->type))
- {
- cp_parser_error (parser, "expected identifier");
- syntax_error = true;
+ if (token->type == CPP_CLOSE_PAREN || token->type == CPP_COMMA)
+ {
+ warning_at (attr_comb, OPT_Wattributes,
+ "missing property attribute");
+ if (token->type == CPP_CLOSE_PAREN)
break;
- }
- if (keyword == RID_SETTER)
- {
- if (property_setter_ident != NULL_TREE)
- {
- cp_parser_error (parser, "the %<setter%> attribute may only be specified once");
- cp_lexer_consume_token (parser->lexer);
- }
- else
- property_setter_ident = cp_parser_objc_selector (parser);
- if (cp_lexer_next_token_is_not (parser->lexer, CPP_COLON))
- cp_parser_error (parser, "setter name must terminate with %<:%>");
- else
- cp_lexer_consume_token (parser->lexer);
- }
- else
- {
- if (property_getter_ident != NULL_TREE)
- {
- cp_parser_error (parser, "the %<getter%> attribute may only be specified once");
- cp_lexer_consume_token (parser->lexer);
- }
- else
- property_getter_ident = cp_parser_objc_selector (parser);
- }
- break;
- default:
- cp_parser_error (parser, "unknown property attribute");
- syntax_error = true;
- break;
- }
+ cp_lexer_consume_token (parser->lexer);
+ continue;
+ }
- if (syntax_error)
- break;
+ tree attr_name = NULL_TREE;
+ if (identifier_p (token->u.value))
+ attr_name = token->u.value;
- if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ enum rid keyword;
+ if (token->type == CPP_NAME)
+ keyword = C_RID_CODE (token->u.value);
+ else if (token->type == CPP_KEYWORD
+ && token->keyword == RID_CLASS)
+ /* Account for accepting the 'class' keyword in this context. */
+ keyword = RID_CLASS;
+ else
+ keyword = RID_MAX; /* By definition, an unknown property. */
cp_lexer_consume_token (parser->lexer);
- else
- break;
- }
- /* FIXME: "@property (setter, assign);" will generate a spurious
- "error: expected ‘)’ before ‘,’ token". This is because
- cp_parser_require, unlike the C counterpart, will produce an
- error even if we are in error recovery. */
- if (!parens.require_close (parser))
- {
- cp_parser_skip_to_closing_parenthesis (parser,
- /*recovering=*/true,
- /*or_comma=*/false,
- /*consume_paren=*/true);
- }
- }
+ enum objc_property_attribute_kind prop_kind
+ = objc_prop_attr_kind_for_rid (keyword);
+ property_attribute_info *prop
+ = new property_attribute_info (attr_name, attr_comb, prop_kind);
+ prop_attr_list.safe_push (prop);
- /* ... and the property declaration(s). */
- properties = cp_parser_objc_struct_declaration (parser);
+ tree meth_name;
+ switch (prop->prop_kind)
+ {
+ default: break;
+ case OBJC_PROPERTY_ATTR_UNKNOWN:
+ if (attr_name)
+ error_at (attr_start, "unknown property attribute %qE",
+ attr_name);
+ else
+ error_at (attr_start, "unknown property attribute");
+ prop->parse_error = syntax_error = true;
+ break;
- if (properties == error_mark_node)
- {
- cp_parser_skip_to_end_of_statement (parser);
- /* If the next token is now a `;', consume it. */
- if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
- cp_lexer_consume_token (parser->lexer);
- return;
+ case OBJC_PROPERTY_ATTR_GETTER:
+ case OBJC_PROPERTY_ATTR_SETTER:
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ))
+ {
+ attr_comb = make_location (attr_end, attr_start, attr_end);
+ error_at (attr_comb, "expected %<=%> after Objective-C %qE",
+ attr_name);
+ prop->parse_error = syntax_error = true;
+ break;
+ }
+
+ token = cp_lexer_peek_token (parser->lexer);
+ attr_end = token->location;
+ cp_lexer_consume_token (parser->lexer); /* eat the = */
+
+ if (!cp_parser_objc_selector_p
+ (cp_lexer_peek_token (parser->lexer)->type))
+ {
+ attr_comb = make_location (attr_end, attr_start, attr_end);
+ error_at (attr_comb, "expected %qE selector name",
+ attr_name);
+ prop->parse_error = syntax_error = true;
+ break;
+ }
+
+ /* Get the end of the method name, and consume the name. */
+ token = cp_lexer_peek_token (parser->lexer);
+ attr_end = get_finish (token->location);
+ /* Because method names may contain C++ keywords, we have a
+ routine to fetch them (this also consumes the token). */
+ meth_name = cp_parser_objc_selector (parser);
+
+ if (prop->prop_kind == OBJC_PROPERTY_ATTR_SETTER)
+ {
+ if (cp_lexer_next_token_is_not (parser->lexer, CPP_COLON))
+ {
+ attr_comb = make_location (attr_end, attr_start,
+ attr_end);
+ error_at (attr_comb, "setter method names must"
+ " terminate with %<:%>");
+ prop->parse_error = syntax_error = true;
+ }
+ else
+ {
+ attr_end = get_finish (cp_lexer_peek_token
+ (parser->lexer)->location);
+ cp_lexer_consume_token (parser->lexer);
+ }
+ attr_comb = make_location (attr_start, attr_start,
+ attr_end);
+ }
+ else
+ attr_comb = make_location (attr_start, attr_start,
+ attr_end);
+ prop->ident = meth_name;
+ /* Updated location including all that was successfully
+ parsed. */
+ prop->prop_loc = attr_comb;
+ break;
+ }
+
+ /* If we see a comma here, then keep going - even if we already
+ saw a syntax error. For simple mistakes e.g. (asign, getter=x)
+ this makes a more useful output and avoid spurious warnings
+ about missing attributes that are, in fact, specified after the
+ one with the syntax error. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
+ cp_lexer_consume_token (parser->lexer);
+ else
+ break;
+ }
+
+ if (syntax_error || !parens.require_close (parser))
+ cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
+ /*or_comma=*/false,
+ /*consume_paren=*/true);
}
- if (properties == NULL_TREE)
+ /* 'properties' is the list of properties that we read. Usually a
+ single one, but maybe more (eg, in "@property int a, b, c;" there
+ are three).
+ TODO: Update this parsing so that it accepts (erroneous) bitfields so
+ that we can issue a meaningful and consistent (between C/C++) error
+ message from objc_add_property_declaration (). */
+ tree properties = cp_parser_objc_struct_declaration (parser);
+
+ if (properties == error_mark_node)
+ cp_parser_skip_to_end_of_statement (parser);
+ else if (properties == NULL_TREE)
cp_parser_error (parser, "expected identifier");
else
{
- /* Comma-separated properties are chained together in
- reverse order; add them one by one. */
+ /* Comma-separated properties are chained together in reverse order;
+ add them one by one. */
properties = nreverse (properties);
-
for (; properties; properties = TREE_CHAIN (properties))
objc_add_property_declaration (loc, copy_node (properties),
- property_readonly, property_readwrite,
- property_assign, property_retain,
- property_copy, property_nonatomic,
- property_getter_ident, property_setter_ident);
+ prop_attr_list);
}
cp_parser_consume_semicolon_at_end_of_statement (parser);
+
+ while (!prop_attr_list.is_empty())
+ delete prop_attr_list.pop ();
+ prop_attr_list.release ();
}
/* Parse an Objective-C++ @synthesize declaration. The syntax is:
@@ -34123,6 +34328,8 @@ cp_parser_omp_clause_name (cp_parser *parser)
case 'a':
if (!strcmp ("aligned", p))
result = PRAGMA_OMP_CLAUSE_ALIGNED;
+ else if (!strcmp ("allocate", p))
+ result = PRAGMA_OMP_CLAUSE_ALLOCATE;
else if (!strcmp ("async", p))
result = PRAGMA_OACC_CLAUSE_ASYNC;
else if (!strcmp ("attach", p))
@@ -36278,6 +36485,47 @@ cp_parser_omp_clause_aligned (cp_parser *parser, tree list)
return nlist;
}
+/* OpenMP 5.0:
+ allocate ( variable-list )
+ allocate ( expression : variable-list ) */
+
+static tree
+cp_parser_omp_clause_allocate (cp_parser *parser, tree list)
+{
+ tree nlist, c, allocator = NULL_TREE;
+ bool colon;
+
+ matching_parens parens;
+ if (!parens.require_open (parser))
+ return list;
+
+ cp_parser_parse_tentatively (parser);
+ bool saved_colon_corrects_to_scope_p = parser->colon_corrects_to_scope_p;
+ parser->colon_corrects_to_scope_p = false;
+ allocator = cp_parser_assignment_expression (parser);
+ parser->colon_corrects_to_scope_p = saved_colon_corrects_to_scope_p;
+ if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
+ {
+ cp_parser_parse_definitely (parser);
+ cp_lexer_consume_token (parser->lexer);
+ if (allocator == error_mark_node)
+ allocator = NULL_TREE;
+ }
+ else
+ {
+ cp_parser_abort_tentative_parse (parser);
+ allocator = NULL_TREE;
+ }
+
+ nlist = cp_parser_omp_var_list_no_open (parser, OMP_CLAUSE_ALLOCATE, list,
+ &colon);
+
+ for (c = nlist; c != list; c = OMP_CLAUSE_CHAIN (c))
+ OMP_CLAUSE_ALLOCATE_ALLOCATOR (c) = allocator;
+
+ return nlist;
+}
+
/* OpenMP 2.5:
lastprivate ( variable-list )
@@ -37595,6 +37843,10 @@ cp_parser_omp_all_clauses (cp_parser *parser, omp_clause_mask mask,
clauses = cp_parser_omp_clause_aligned (parser, clauses);
c_name = "aligned";
break;
+ case PRAGMA_OMP_CLAUSE_ALLOCATE:
+ clauses = cp_parser_omp_clause_allocate (parser, clauses);
+ c_name = "allocate";
+ break;
case PRAGMA_OMP_CLAUSE_LINEAR:
{
bool declare_simd = false;
@@ -37785,7 +38037,7 @@ cp_parser_omp_structured_block (cp_parser *parser, bool *if_p)
where x and v are lvalue expressions with scalar type. */
static void
-cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok)
+cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok, bool openacc)
{
tree lhs = NULL_TREE, rhs = NULL_TREE, v = NULL_TREE, lhs1 = NULL_TREE;
tree rhs1 = NULL_TREE, orig_lhs;
@@ -37820,6 +38072,12 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok)
new_code = OMP_ATOMIC;
else if (!strcmp (p, "capture"))
new_code = OMP_ATOMIC_CAPTURE_NEW;
+ else if (openacc)
+ {
+ p = NULL;
+ error_at (cloc, "expected %<read%>, %<write%>, %<update%>, "
+ "or %<capture%> clause");
+ }
else if (!strcmp (p, "seq_cst"))
new_memory_order = OMP_MEMORY_ORDER_SEQ_CST;
else if (!strcmp (p, "acq_rel"))
@@ -37847,7 +38105,12 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok)
{
if (new_code != ERROR_MARK)
{
- if (code != ERROR_MARK)
+ /* OpenACC permits 'update capture'. */
+ if (openacc
+ && code == OMP_ATOMIC
+ && new_code == OMP_ATOMIC_CAPTURE_NEW)
+ code = new_code;
+ else if (code != ERROR_MARK)
error_at (cloc, "too many atomic clauses");
else
code = new_code;
@@ -37869,7 +38132,9 @@ cp_parser_omp_atomic (cp_parser *parser, cp_token *pragma_tok)
if (code == ERROR_MARK)
code = OMP_ATOMIC;
- if (memory_order == OMP_MEMORY_ORDER_UNSPECIFIED)
+ if (openacc)
+ memory_order = OMP_MEMORY_ORDER_RELAXED;
+ else if (memory_order == OMP_MEMORY_ORDER_UNSPECIFIED)
{
omp_requires_mask
= (enum omp_requires) (omp_requires_mask
@@ -39614,6 +39879,7 @@ cp_parser_omp_simd (cp_parser *parser, cp_token *pragma_tok,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_SCHEDULE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ORDER))
static tree
@@ -39898,6 +40164,7 @@ cp_parser_omp_sections_scope (cp_parser *parser)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
static tree
@@ -39948,6 +40215,7 @@ cp_parser_omp_sections (cp_parser *parser, cp_token *pragma_tok,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COPYIN) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_THREADS) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PROC_BIND))
static tree
@@ -40093,6 +40361,7 @@ cp_parser_omp_parallel (cp_parser *parser, cp_token *pragma_tok,
( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COPYPRIVATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT))
static tree
@@ -40125,6 +40394,7 @@ cp_parser_omp_single (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MERGEABLE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIORITY) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IN_REDUCTION))
static tree
@@ -40189,7 +40459,8 @@ cp_parser_omp_taskyield (cp_parser *parser, cp_token *pragma_tok)
# pragma omp taskgroup taskgroup-clause[optseq] new-line */
#define OMP_TASKGROUP_CLAUSE_MASK \
- ( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TASK_REDUCTION))
+ ( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_TASK_REDUCTION))
static tree
cp_parser_omp_taskgroup (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
@@ -40298,6 +40569,7 @@ cp_parser_omp_cancellation_point (cp_parser *parser, cp_token *pragma_tok,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_LASTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DIST_SCHEDULE)\
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_COLLAPSE))
static tree
@@ -40396,6 +40668,7 @@ cp_parser_omp_distribute (cp_parser *parser, cp_token *pragma_tok,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_THREAD_LIMIT) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEFAULT))
static tree
@@ -40512,6 +40785,7 @@ cp_parser_omp_target_data (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
tree clauses
= cp_parser_omp_all_clauses (parser, OMP_TARGET_DATA_CLAUSE_MASK,
"#pragma omp target data", pragma_tok);
+ c_omp_adjust_map_clauses (clauses, false);
int map_seen = 0;
for (tree *pc = &clauses; *pc;)
{
@@ -40530,6 +40804,7 @@ cp_parser_omp_target_data (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
map_seen |= 1;
@@ -40613,6 +40888,7 @@ cp_parser_omp_target_enter_data (cp_parser *parser, cp_token *pragma_tok,
tree clauses
= cp_parser_omp_all_clauses (parser, OMP_TARGET_ENTER_DATA_CLAUSE_MASK,
"#pragma omp target enter data", pragma_tok);
+ c_omp_adjust_map_clauses (clauses, false);
int map_seen = 0;
for (tree *pc = &clauses; *pc;)
{
@@ -40627,6 +40903,7 @@ cp_parser_omp_target_enter_data (cp_parser *parser, cp_token *pragma_tok,
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
map_seen |= 1;
@@ -40701,6 +40978,7 @@ cp_parser_omp_target_exit_data (cp_parser *parser, cp_token *pragma_tok,
tree clauses
= cp_parser_omp_all_clauses (parser, OMP_TARGET_EXIT_DATA_CLAUSE_MASK,
"#pragma omp target exit data", pragma_tok);
+ c_omp_adjust_map_clauses (clauses, false);
int map_seen = 0;
for (tree *pc = &clauses; *pc;)
{
@@ -40716,6 +40994,7 @@ cp_parser_omp_target_exit_data (cp_parser *parser, cp_token *pragma_tok,
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
map_seen |= 1;
@@ -40802,6 +41081,7 @@ cp_parser_omp_target_update (cp_parser *parser, cp_token *pragma_tok,
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_FIRSTPRIVATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEFAULTMAP) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR))
static bool
@@ -40964,6 +41244,8 @@ cp_parser_omp_target (cp_parser *parser, cp_token *pragma_tok,
OMP_TARGET_CLAUSES (stmt)
= cp_parser_omp_all_clauses (parser, OMP_TARGET_CLAUSE_MASK,
"#pragma omp target", pragma_tok);
+ c_omp_adjust_map_clauses (OMP_TARGET_CLAUSES (stmt), true);
+
pc = &OMP_TARGET_CLAUSES (stmt);
keep_next_level (true);
OMP_TARGET_BODY (stmt) = cp_parser_omp_structured_block (parser, if_p);
@@ -40987,6 +41269,7 @@ check_clauses:
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH_DETACH:
break;
default:
error_at (OMP_CLAUSE_LOCATION (*pc),
@@ -42640,15 +42923,19 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
DECL_ATTRIBUTES (fndecl)
= tree_cons (get_identifier ("gnu_inline"), NULL_TREE,
DECL_ATTRIBUTES (fndecl));
- if (processing_template_decl)
- fndecl = push_template_decl (fndecl);
bool block_scope = false;
- tree block = NULL_TREE;
if (current_function_decl)
{
block_scope = true;
DECL_CONTEXT (fndecl) = current_function_decl;
DECL_LOCAL_DECL_P (fndecl) = true;
+ }
+
+ if (processing_template_decl)
+ fndecl = push_template_decl (fndecl);
+
+ if (block_scope)
+ {
if (!processing_template_decl)
pushdecl (fndecl);
}
@@ -42676,6 +42963,8 @@ cp_parser_omp_declare_reduction (cp_parser *parser, cp_token *pragma_tok,
/* We should never meet a matched duplicate decl. */
gcc_checking_assert (d == error_mark_node || d == fndecl);
}
+
+ tree block = NULL_TREE;
if (!block_scope)
start_preparsed_function (fndecl, NULL_TREE, SF_PRE_PARSED);
else
@@ -42951,6 +43240,7 @@ cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok)
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MERGEABLE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOGROUP) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIORITY) \
+ | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_ALLOCATE) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION) \
| (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IN_REDUCTION))
@@ -43292,7 +43582,7 @@ cp_parser_omp_construct (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
switch (cp_parser_pragma_kind (pragma_tok))
{
case PRAGMA_OACC_ATOMIC:
- cp_parser_omp_atomic (parser, pragma_tok);
+ cp_parser_omp_atomic (parser, pragma_tok, true);
return;
case PRAGMA_OACC_CACHE:
stmt = cp_parser_oacc_cache (parser, pragma_tok);
@@ -43327,7 +43617,7 @@ cp_parser_omp_construct (cp_parser *parser, cp_token *pragma_tok, bool *if_p)
stmt = cp_parser_oacc_wait (parser, pragma_tok);
break;
case PRAGMA_OMP_ATOMIC:
- cp_parser_omp_atomic (parser, pragma_tok);
+ cp_parser_omp_atomic (parser, pragma_tok, false);
return;
case PRAGMA_OMP_CRITICAL:
stmt = cp_parser_omp_critical (parser, pragma_tok, if_p);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 555dc47..a2655a0 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
@@ -3634,7 +3634,7 @@ primary_template_specialization_p (const_tree t)
if (!t)
return false;
- if (TREE_CODE (t) == FUNCTION_DECL || VAR_P (t))
+ if (VAR_OR_FUNCTION_DECL_P (t))
return (DECL_LANG_SPECIFIC (t)
&& DECL_USE_TEMPLATE (t)
&& DECL_TEMPLATE_INFO (t)
@@ -3767,7 +3767,7 @@ builtin_pack_fn_p (tree fn)
{
if (!fn
|| TREE_CODE (fn) != FUNCTION_DECL
- || !DECL_IS_BUILTIN (fn))
+ || !DECL_IS_UNDECLARED_BUILTIN (fn))
return false;
if (id_equal (DECL_NAME (fn), "__integer_pack"))
@@ -4230,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);
@@ -4244,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)
@@ -5082,8 +5089,7 @@ process_partial_specialization (tree decl)
= TI_ARGS (get_template_info (DECL_TEMPLATE_RESULT (maintmpl)));
if (comp_template_args (inner_args, INNERMOST_TEMPLATE_ARGS (main_args))
&& (!flag_concepts
- || !strictly_subsumes (current_template_constraints (),
- main_args, maintmpl)))
+ || !strictly_subsumes (current_template_constraints (), maintmpl)))
{
if (!flag_concepts)
error ("partial specialization %q+D does not specialize "
@@ -5675,34 +5681,24 @@ template_parm_outer_level (tree t, void *data)
tree
push_template_decl (tree decl, bool is_friend)
{
- tree tmpl;
- tree args;
- tree info;
- tree ctx;
- bool is_primary;
- bool is_partial;
- int new_template_p = 0;
- /* True if the template is a member template, in the sense of
- [temp.mem]. */
- bool member_template_p = false;
-
if (decl == error_mark_node || !current_template_parms)
return error_mark_node;
/* See if this is a partial specialization. */
- is_partial = ((DECL_IMPLICIT_TYPEDEF_P (decl)
- && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
- && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl)))
- || (VAR_P (decl)
- && DECL_LANG_SPECIFIC (decl)
- && DECL_TEMPLATE_SPECIALIZATION (decl)
- && TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl))));
+ bool is_partial = ((DECL_IMPLICIT_TYPEDEF_P (decl)
+ && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
+ && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl)))
+ || (VAR_P (decl)
+ && DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_SPECIALIZATION (decl)
+ && TINFO_USED_TEMPLATE_ID (DECL_TEMPLATE_INFO (decl))));
/* No surprising friend functions. */
gcc_checking_assert (is_friend
|| !(TREE_CODE (decl) == FUNCTION_DECL
- && DECL_FRIEND_P (decl)));
+ && DECL_UNIQUE_FRIEND_P (decl)));
+ tree ctx;
if (is_friend)
/* For a friend, we want the context of the friend, not
the type of which it is a friend. */
@@ -5724,23 +5720,30 @@ push_template_decl (tree decl, bool is_friend)
DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
/* See if this is a primary template. */
+ bool is_primary = false;
if (is_friend && ctx
&& uses_template_parms_level (ctx, processing_template_decl))
/* A friend template that specifies a class context, i.e.
template <typename T> friend void A<T>::f();
is not primary. */
- is_primary = false;
+ ;
else if (TREE_CODE (decl) == TYPE_DECL && LAMBDA_TYPE_P (TREE_TYPE (decl)))
- is_primary = false;
+ /* Lambdas are not primary. */
+ ;
else
is_primary = template_parm_scope_p ();
+ /* True if the template is a member template, in the sense of
+ [temp.mem]. */
+ bool member_template_p = false;
+
if (is_primary)
{
warning (OPT_Wtemplates, "template %qD declared", decl);
if (DECL_CLASS_SCOPE_P (decl))
member_template_p = true;
+
if (TREE_CODE (decl) == TYPE_DECL
&& IDENTIFIER_ANON_P (DECL_NAME (decl)))
{
@@ -5808,11 +5811,16 @@ push_template_decl (tree decl, bool is_friend)
}
}
+ bool local_p = (!DECL_IMPLICIT_TYPEDEF_P (decl)
+ && ((ctx && TREE_CODE (ctx) == FUNCTION_DECL)
+ || (VAR_OR_FUNCTION_DECL_P (decl)
+ && DECL_LOCAL_DECL_P (decl))));
+
/* Check to see that the rules regarding the use of default
arguments are not being violated. We check args for a friend
functions when we know whether it's a definition, introducing
declaration or re-declaration. */
- if (!is_friend || TREE_CODE (decl) != FUNCTION_DECL)
+ if (!local_p && (!is_friend || TREE_CODE (decl) != FUNCTION_DECL))
check_default_tmpl_args (decl, current_template_parms,
is_primary, is_partial, is_friend);
@@ -5864,13 +5872,21 @@ push_template_decl (tree decl, bool is_friend)
if (is_partial)
return process_partial_specialization (decl);
- args = current_template_args ();
-
- if (!ctx
- || 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)))
+ tree args = current_template_args ();
+ tree tmpl = NULL_TREE;
+ bool new_template_p = false;
+ if (local_p)
+ {
+ /* Does not get a template head. */
+ tmpl = NULL_TREE;
+ gcc_checking_assert (!is_primary);
+ }
+ else if (!ctx
+ || 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_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_INFO (decl))))
{
if (DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_INFO (decl)
@@ -5897,7 +5913,7 @@ push_template_decl (tree decl, bool is_friend)
{
tmpl = build_template_decl (decl, current_template_parms,
member_template_p);
- new_template_p = 1;
+ new_template_p = true;
if (DECL_LANG_SPECIFIC (decl)
&& DECL_TEMPLATE_SPECIALIZATION (decl))
@@ -5929,8 +5945,6 @@ push_template_decl (tree decl, bool is_friend)
&& DECL_TEMPLATE_SPECIALIZATION (decl)
&& DECL_MEMBER_TEMPLATE_P (tmpl))
{
- tree new_tmpl;
-
/* The declaration is a specialization of a member
template, declared outside the class. Therefore, the
innermost template arguments will be NULL, so we
@@ -5938,7 +5952,7 @@ push_template_decl (tree decl, bool is_friend)
earlier call to check_explicit_specialization. */
args = DECL_TI_ARGS (decl);
- new_tmpl
+ tree new_tmpl
= build_template_decl (decl, current_template_parms,
member_template_p);
DECL_TI_TEMPLATE (decl) = new_tmpl;
@@ -6010,7 +6024,7 @@ push_template_decl (tree decl, bool is_friend)
}
}
- gcc_checking_assert (DECL_TEMPLATE_RESULT (tmpl) == decl);
+ gcc_checking_assert (!tmpl || DECL_TEMPLATE_RESULT (tmpl) == decl);
if (new_template_p)
{
@@ -6022,69 +6036,71 @@ push_template_decl (tree decl, bool is_friend)
if (!ctx
&& !(is_friend && template_class_depth (current_class_type) > 0))
{
- /* Hide template friend classes that haven't been declared yet. */
- if (is_friend && TREE_CODE (decl) == TYPE_DECL)
- DECL_FRIEND_P (tmpl) = 1;
-
- tmpl = pushdecl_namespace_level (tmpl, /*hiding=*/is_friend);
- if (tmpl == error_mark_node)
+ tree pushed = pushdecl_namespace_level (tmpl, /*hiding=*/is_friend);
+ if (pushed == error_mark_node)
return error_mark_node;
+
+ /* pushdecl may have found an existing template. */
+ if (pushed != tmpl)
+ {
+ decl = DECL_TEMPLATE_RESULT (pushed);
+ tmpl = NULL_TREE;
+ }
}
}
- else
+ else if (tmpl)
/* The type may have been completed, or (erroneously) changed. */
TREE_TYPE (tmpl) = TREE_TYPE (decl);
- if (is_primary)
+ if (tmpl)
{
- tree parms = DECL_TEMPLATE_PARMS (tmpl);
+ if (is_primary)
+ {
+ tree parms = DECL_TEMPLATE_PARMS (tmpl);
- DECL_PRIMARY_TEMPLATE (tmpl) = tmpl;
+ DECL_PRIMARY_TEMPLATE (tmpl) = tmpl;
- /* Give template template parms a DECL_CONTEXT of the template
- for which they are a parameter. */
- parms = INNERMOST_TEMPLATE_PARMS (parms);
- for (int i = TREE_VEC_LENGTH (parms) - 1; i >= 0; --i)
- {
- tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
- if (TREE_CODE (parm) == TEMPLATE_DECL)
- DECL_CONTEXT (parm) = tmpl;
- }
+ /* Give template template parms a DECL_CONTEXT of the template
+ for which they are a parameter. */
+ parms = INNERMOST_TEMPLATE_PARMS (parms);
+ for (int i = TREE_VEC_LENGTH (parms) - 1; i >= 0; --i)
+ {
+ tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
+ if (TREE_CODE (parm) == TEMPLATE_DECL)
+ DECL_CONTEXT (parm) = tmpl;
+ }
- if (TREE_CODE (decl) == TYPE_DECL
- && TYPE_DECL_ALIAS_P (decl))
- {
- if (tree constr
- = TEMPLATE_PARMS_CONSTRAINTS (DECL_TEMPLATE_PARMS (tmpl)))
+ if (TREE_CODE (decl) == TYPE_DECL
+ && TYPE_DECL_ALIAS_P (decl))
{
- /* ??? Why don't we do this here for all templates? */
- constr = build_constraints (constr, NULL_TREE);
- set_constraints (decl, constr);
+ if (tree constr
+ = TEMPLATE_PARMS_CONSTRAINTS (DECL_TEMPLATE_PARMS (tmpl)))
+ {
+ /* ??? Why don't we do this here for all templates? */
+ constr = build_constraints (constr, NULL_TREE);
+ set_constraints (decl, constr);
+ }
+ if (complex_alias_template_p (tmpl))
+ TEMPLATE_DECL_COMPLEX_ALIAS_P (tmpl) = true;
}
- if (complex_alias_template_p (tmpl))
- TEMPLATE_DECL_COMPLEX_ALIAS_P (tmpl) = true;
}
- }
- /* The DECL_TI_ARGS of DECL contains full set of arguments referring
- back to its most general template. If TMPL is a specialization,
- ARGS may only have the innermost set of arguments. Add the missing
- argument levels if necessary. */
- if (DECL_TEMPLATE_INFO (tmpl))
- args = add_outermost_template_args (DECL_TI_ARGS (tmpl), args);
+ /* The DECL_TI_ARGS of DECL contains full set of arguments
+ referring wback to its most general template. If TMPL is a
+ specialization, ARGS may only have the innermost set of
+ arguments. Add the missing argument levels if necessary. */
+ if (DECL_TEMPLATE_INFO (tmpl))
+ args = add_outermost_template_args (DECL_TI_ARGS (tmpl), args);
- info = build_template_info (tmpl, args);
+ tree info = build_template_info (tmpl, args);
- if (DECL_IMPLICIT_TYPEDEF_P (decl))
- SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
- else
- {
- if (is_primary)
- retrofit_lang_decl (decl);
- if (DECL_LANG_SPECIFIC (decl)
- && !(VAR_OR_FUNCTION_DECL_P (decl)
- && DECL_LOCAL_DECL_P (decl)))
- DECL_TEMPLATE_INFO (decl) = info;
+ if (DECL_IMPLICIT_TYPEDEF_P (decl))
+ SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
+ else
+ {
+ retrofit_lang_decl (decl);
+ DECL_TEMPLATE_INFO (decl) = info;
+ }
}
if (flag_implicit_templates
@@ -6096,7 +6112,9 @@ push_template_decl (tree decl, bool is_friend)
mark_needed will tell cgraph to do the right thing. */
DECL_COMDAT (decl) = true;
- return DECL_TEMPLATE_RESULT (tmpl);
+ gcc_checking_assert (!tmpl || DECL_TEMPLATE_RESULT (tmpl) == decl);
+
+ return decl;
}
/* FN is an inheriting constructor that inherits from the constructor
@@ -8159,7 +8177,7 @@ is_compatible_template_arg (tree parm, tree arg)
return false;
}
- return weakly_subsumes (parm_cons, new_args, arg);
+ return weakly_subsumes (parm_cons, arg);
}
// Convert a placeholder argument into a binding to the original
@@ -10599,6 +10617,16 @@ keep_template_parm (tree t, void* data)
if (!ftpi->parms.add (t))
ftpi->parm_list = tree_cons (NULL_TREE, t, ftpi->parm_list);
+ /* Verify the parameter we found has a valid index. */
+ if (flag_checking)
+ {
+ tree parms = ftpi->ctx_parms;
+ while (TMPL_PARMS_DEPTH (parms) > level)
+ parms = TREE_CHAIN (parms);
+ if (int len = TREE_VEC_LENGTH (TREE_VALUE (parms)))
+ gcc_assert (index < len);
+ }
+
return 0;
}
@@ -10737,7 +10765,7 @@ uses_template_parms (tree t)
else if (t == error_mark_node)
dependent_p = false;
else
- dependent_p = value_dependent_expression_p (t);
+ dependent_p = instantiation_dependent_expression_p (t);
processing_template_decl = saved_processing_template_decl;
@@ -11847,7 +11875,6 @@ instantiate_class_template_1 (tree type)
Ignore it; it will be regenerated when needed. */
continue;
- /* Build new CLASSTYPE_NESTED_UTDS. */
bool class_template_p = (TREE_CODE (t) != ENUMERAL_TYPE
&& TYPE_LANG_SPECIFIC (t)
&& CLASSTYPE_IS_TEMPLATE (t));
@@ -12005,10 +12032,10 @@ instantiate_class_template_1 (tree type)
TREE_TYPE (r) = error_mark_node;
}
- /* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE,
- such a thing will already have been added to the field
- list by tsubst_enum in finish_member_declaration in the
- CLASSTYPE_NESTED_UTDS case above. */
+ /* If it is a TYPE_DECL for a class-scoped
+ ENUMERAL_TYPE, such a thing will already have
+ been added to the field list by tsubst_enum
+ in finish_member_declaration case above. */
if (!(TREE_CODE (r) == TYPE_DECL
&& TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
&& DECL_ARTIFICIAL (r)))
@@ -13960,7 +13987,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));
@@ -14203,8 +14230,7 @@ tsubst_template_decl (tree t, tree args, tsubst_flags_t complain,
if (PRIMARY_TEMPLATE_P (t))
DECL_PRIMARY_TEMPLATE (r) = r;
- if (TREE_CODE (decl) != TYPE_DECL && !VAR_P (decl)
- && !lambda_fntype)
+ if (TREE_CODE (decl) == FUNCTION_DECL && !lambda_fntype)
/* Record this non-type partial instantiation. */
register_specialization (r, t,
DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)),
@@ -16044,20 +16070,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case TYPE_ARGUMENT_PACK:
case NONTYPE_ARGUMENT_PACK:
- {
- tree r;
-
- if (code == NONTYPE_ARGUMENT_PACK)
- r = make_node (code);
- else
- r = cxx_make_type (code);
-
- tree pack_args = ARGUMENT_PACK_ARGS (t);
- pack_args = tsubst_template_args (pack_args, args, complain, in_decl);
- SET_ARGUMENT_PACK_ARGS (r, pack_args);
-
- return r;
- }
+ return tsubst_argument_pack (t, args, complain, in_decl);
case VOID_CST:
case INTEGER_CST:
@@ -17303,6 +17316,7 @@ tsubst_omp_clauses (tree clauses, enum c_omp_region_type ort,
break;
case OMP_CLAUSE_GANG:
case OMP_CLAUSE_ALIGNED:
+ case OMP_CLAUSE_ALLOCATE:
OMP_CLAUSE_DECL (nc)
= tsubst_omp_clause_decl (OMP_CLAUSE_DECL (oc), args, complain,
in_decl, NULL);
@@ -17372,6 +17386,7 @@ tsubst_omp_clauses (tree clauses, enum c_omp_region_type ort,
case OMP_CLAUSE_IS_DEVICE_PTR:
case OMP_CLAUSE_INCLUSIVE:
case OMP_CLAUSE_EXCLUSIVE:
+ case OMP_CLAUSE_ALLOCATE:
/* tsubst_expr on SCOPE_REF results in returning
finish_non_static_data_member result. Undo that here. */
if (TREE_CODE (OMP_CLAUSE_DECL (oc)) == SCOPE_REF
@@ -18040,11 +18055,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
finish_label_decl (DECL_NAME (decl));
else if (TREE_CODE (decl) == USING_DECL)
{
+ /* We cannot have a member-using decl here (until 'using
+ enum T' is a thing). */
+ gcc_checking_assert (!DECL_DEPENDENT_P (decl));
+
+ /* This must be a non-dependent using-decl, and we'll have
+ used the names it found during template parsing. We do
+ not want to do the lookup again, because we might not
+ find the things we found then. (Again, using enum T
+ might mean we have to do things here.) */
tree scope = USING_DECL_SCOPE (decl);
- tree name = DECL_NAME (decl);
-
- scope = tsubst (scope, args, complain, in_decl);
- finish_nonmember_using_decl (scope, name);
+ gcc_checking_assert (scope
+ == tsubst (scope, args, complain, in_decl));
}
else if (is_capture_proxy (decl)
&& !DECL_TEMPLATE_INSTANTIATION (current_function_decl))
@@ -19062,15 +19084,6 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
LAMBDA_EXPR_MUTABLE_P (r) = LAMBDA_EXPR_MUTABLE_P (t);
LAMBDA_EXPR_INSTANTIATED (r) = true;
- if (LAMBDA_EXPR_EXTRA_SCOPE (t) == NULL_TREE)
- /* A lambda in a default argument outside a class gets no
- LAMBDA_EXPR_EXTRA_SCOPE, as specified by the ABI. But
- tsubst_default_argument calls start_lambda_scope, so we need to
- specifically ignore it here, and use the global scope. */
- record_null_lambda_scope (r);
- else
- record_lambda_scope (r);
-
gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (t) == NULL_TREE
&& LAMBDA_EXPR_PENDING_PROXIES (t) == NULL);
@@ -19149,6 +19162,15 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (type == error_mark_node)
return error_mark_node;
+ if (LAMBDA_EXPR_EXTRA_SCOPE (t) == NULL_TREE)
+ /* A lambda in a default argument outside a class gets no
+ LAMBDA_EXPR_EXTRA_SCOPE, as specified by the ABI. But
+ tsubst_default_argument calls start_lambda_scope, so we need to
+ specifically ignore it here, and use the global scope. */
+ record_null_lambda_scope (r);
+ else
+ record_lambda_scope (r);
+
/* Do this again now that LAMBDA_EXPR_EXTRA_SCOPE is set. */
determine_visibility (TYPE_NAME (type));
@@ -19614,8 +19636,11 @@ tsubst_copy_and_build (tree t,
{
/* If T was type-dependent, suppress warnings that depend on the range
of the types involved. */
- bool was_dep = type_dependent_expression_p_push (t);
-
+ ++processing_template_decl;
+ const bool was_dep = (potential_constant_expression (t)
+ ? value_dependent_expression_p (t)
+ : type_dependent_expression_p (t));
+ --processing_template_decl;
tree op0 = RECUR (TREE_OPERAND (t, 0));
tree op1 = RECUR (TREE_OPERAND (t, 1));
@@ -22671,8 +22696,20 @@ get_template_base (tree tparms, tree targs, tree parm, tree arg,
applies. */
if (rval && !same_type_p (r, rval))
{
- *result = NULL_TREE;
- return tbr_ambiguous_baseclass;
+ /* [temp.deduct.call]/4.3: If there is a class C that is a
+ (direct or indirect) base class of D and derived (directly or
+ indirectly) from a class B and that would be a valid deduced
+ A, the deduced A cannot be B or pointer to B, respectively. */
+ if (DERIVED_FROM_P (r, rval))
+ /* Ignore r. */
+ continue;
+ else if (DERIVED_FROM_P (rval, r))
+ /* Ignore rval. */;
+ else
+ {
+ *result = NULL_TREE;
+ return tbr_ambiguous_baseclass;
+ }
}
rval = r;
@@ -24955,19 +24992,6 @@ mark_class_instantiated (tree t, int extern_p)
}
}
-/* Called from do_type_instantiation through binding_table_foreach to
- do recursive instantiation for the type bound in ENTRY. */
-static void
-bt_instantiate_type_proc (binding_entry entry, void *data)
-{
- tree storage = *(tree *) data;
-
- if (MAYBE_CLASS_TYPE_P (entry->type)
- && CLASSTYPE_TEMPLATE_INFO (entry->type)
- && !uses_template_parms (CLASSTYPE_TI_ARGS (entry->type)))
- do_type_instantiation (TYPE_MAIN_DECL (entry->type), storage, 0);
-}
-
/* Perform an explicit instantiation of template class T. STORAGE, if
non-null, is the RID for extern, inline or static. COMPLAIN is
nonzero if this is called from the parser, zero if called recursively,
@@ -24976,20 +25000,11 @@ bt_instantiate_type_proc (binding_entry entry, void *data)
void
do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
{
- int extern_p = 0;
- int nomem_p = 0;
- int static_p = 0;
- int previous_instantiation_extern_p = 0;
-
- if (TREE_CODE (t) == TYPE_DECL)
- t = TREE_TYPE (t);
-
- if (! CLASS_TYPE_P (t) || ! CLASSTYPE_TEMPLATE_INFO (t))
+ if (!(CLASS_TYPE_P (t) && CLASSTYPE_TEMPLATE_INFO (t)))
{
- tree tmpl =
- (TYPE_TEMPLATE_INFO (t)) ? TYPE_TI_TEMPLATE (t) : NULL;
- if (tmpl)
- error ("explicit instantiation of non-class template %qD", tmpl);
+ if (tree ti = TYPE_TEMPLATE_INFO (t))
+ error ("explicit instantiation of non-class template %qD",
+ TI_TEMPLATE (ti));
else
error ("explicit instantiation of non-template type %qT", t);
return;
@@ -25005,6 +25020,11 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
return;
}
+ /* At most one of these will be true. */
+ bool extern_p = false;
+ bool nomem_p = false;
+ bool static_p = false;
+
if (storage != NULL_TREE)
{
if (storage == ridpointers[(int) RID_EXTERN])
@@ -25020,52 +25040,45 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
" on explicit instantiations", storage);
if (storage == ridpointers[(int) RID_INLINE])
- nomem_p = 1;
+ nomem_p = true;
else if (storage == ridpointers[(int) RID_EXTERN])
- extern_p = 1;
+ extern_p = true;
else if (storage == ridpointers[(int) RID_STATIC])
- static_p = 1;
+ static_p = true;
else
- {
- error ("storage class %qD applied to template instantiation",
- storage);
- extern_p = 0;
- }
+ error ("storage class %qD applied to template instantiation",
+ storage);
}
if (CLASSTYPE_TEMPLATE_SPECIALIZATION (t))
- {
- /* DR 259 [temp.spec].
+ /* DR 259 [temp.spec].
- Both an explicit instantiation and a declaration of an explicit
- specialization shall not appear in a program unless the explicit
- instantiation follows a declaration of the explicit specialization.
+ Both an explicit instantiation and a declaration of an explicit
+ specialization shall not appear in a program unless the
+ explicit instantiation follows a declaration of the explicit
+ specialization.
- For a given set of template parameters, if an explicit
- instantiation of a template appears after a declaration of an
- explicit specialization for that template, the explicit
- instantiation has no effect. */
- return;
- }
- else if (CLASSTYPE_EXPLICIT_INSTANTIATION (t))
+ For a given set of template parameters, if an explicit
+ instantiation of a template appears after a declaration of an
+ explicit specialization for that template, the explicit
+ instantiation has no effect. */
+ return;
+
+ if (CLASSTYPE_EXPLICIT_INSTANTIATION (t) && !CLASSTYPE_INTERFACE_ONLY (t))
{
+ /* We've already instantiated the template. */
+
/* [temp.spec]
No program shall explicitly instantiate any template more
than once.
- If PREVIOUS_INSTANTIATION_EXTERN_P, then the first explicit
- instantiation was `extern'. If EXTERN_P then the second is.
- These cases are OK. */
- previous_instantiation_extern_p = CLASSTYPE_INTERFACE_ONLY (t);
+ If EXTERN_P then this is ok. */
+ if (!extern_p && (complain & tf_error))
+ permerror (input_location,
+ "duplicate explicit instantiation of %q#T", t);
- if (!previous_instantiation_extern_p && !extern_p
- && (complain & tf_error))
- permerror (input_location, "duplicate explicit instantiation of %q#T", t);
-
- /* If we've already instantiated the template, just return now. */
- if (!CLASSTYPE_INTERFACE_ONLY (t))
- return;
+ return;
}
check_explicit_instantiation_namespace (TYPE_NAME (t));
@@ -25102,10 +25115,14 @@ do_type_instantiation (tree t, tree storage, tsubst_flags_t complain)
instantiate_decl (fld, /*defer_ok=*/true,
/*expl_inst_class_mem_p=*/true);
}
+ else if (DECL_IMPLICIT_TYPEDEF_P (fld))
+ {
+ tree type = TREE_TYPE (fld);
- if (CLASSTYPE_NESTED_UTDS (t))
- binding_table_foreach (CLASSTYPE_NESTED_UTDS (t),
- bt_instantiate_type_proc, &storage);
+ if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_INFO (type)
+ && !uses_template_parms (CLASSTYPE_TI_ARGS (type)))
+ do_type_instantiation (type, storage, 0);
+ }
}
/* Given a function DECL, which is a specialization of TMPL, modify
@@ -25569,9 +25586,6 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p)
if (VAR_P (d))
{
- tree init;
- bool const_init = false;
-
/* Clear out DECL_RTL; whatever was there before may not be right
since we've reset the type of the declaration. */
SET_DECL_RTL (d, NULL);
@@ -25581,7 +25595,8 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p)
regenerate_decl_from_template so we don't need to
push/pop_access_scope again here. Pull it out so that
cp_finish_decl can process it. */
- init = DECL_INITIAL (d);
+ bool const_init = false;
+ tree init = DECL_INITIAL (d);
DECL_INITIAL (d) = NULL_TREE;
DECL_INITIALIZED_P (d) = 0;
@@ -25613,9 +25628,11 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p)
if (nested_p)
block = push_stmt_list ();
else
- start_preparsed_function (d, NULL_TREE, SF_PRE_PARSED);
+ {
+ start_preparsed_function (d, NULL_TREE, SF_PRE_PARSED);
- perform_instantiation_time_access_checks (code_pattern, args);
+ perform_instantiation_time_access_checks (code_pattern, args);
+ }
/* Create substitution entries for the parameters. */
register_parameter_specializations (code_pattern, d);
@@ -25654,7 +25671,8 @@ instantiate_body (tree pattern, tree args, tree d, bool nested_p)
}
/* We're not deferring instantiation any more. */
- TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
+ if (!nested_p)
+ TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (d)) = 0;
if (push_to_top)
pop_from_top_level ();
@@ -27049,7 +27067,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))
@@ -27289,7 +27307,8 @@ bool
instantiation_dependent_expression_p (tree expression)
{
return (instantiation_dependent_uneval_expression_p (expression)
- || value_dependent_expression_p (expression));
+ || (potential_constant_expression (expression)
+ && value_dependent_expression_p (expression)));
}
/* Like type_dependent_expression_p, but it also works while not processing
@@ -29237,7 +29256,13 @@ do_auto_deduction (tree type, tree init, tree auto_node,
if (type == error_mark_node)
return error_mark_node;
- init = resolve_nondeduced_context (init, complain);
+ if (BRACE_ENCLOSED_INITIALIZER_P (init))
+ /* We don't recurse here because we can't deduce from a nested
+ initializer_list. */
+ for (constructor_elt &elt : *CONSTRUCTOR_ELTS (init))
+ elt.value = resolve_nondeduced_context (elt.value, complain);
+ else
+ init = resolve_nondeduced_context (init, complain);
if (context == adc_decomp_type
&& auto_node == type
@@ -29250,6 +29275,8 @@ do_auto_deduction (tree type, tree init, tree auto_node,
else if (AUTO_IS_DECLTYPE (auto_node))
{
tree stripped_init = tree_strip_any_location_wrapper (init);
+ if (REFERENCE_REF_P (stripped_init))
+ stripped_init = TREE_OPERAND (stripped_init, 0);
bool id = (DECL_P (stripped_init)
|| ((TREE_CODE (init) == COMPONENT_REF
|| TREE_CODE (init) == SCOPE_REF)
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 7c4bff7..887aae3 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -123,6 +123,7 @@ static GTY (()) vec<tinfo_s, va_gc> *tinfo_descs;
static tree ifnonnull (tree, tree, tsubst_flags_t);
static tree tinfo_name (tree, bool);
+static tree get_tinfo_decl_direct (tree type, tree name, int pseudo_ix);
static tree build_dynamic_cast_1 (location_t, tree, tree, tsubst_flags_t);
static tree throw_bad_cast (void);
static tree throw_bad_typeid (void);
@@ -166,10 +167,8 @@ pop_abi_namespace (void)
void
init_rtti_processing (void)
{
- tree type_info_type;
-
push_nested_namespace (std_node);
- type_info_type = xref_tag (class_type, get_identifier ("type_info"));
+ tree 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);
@@ -414,9 +413,6 @@ tinfo_name (tree type, bool mark_private)
tree
get_tinfo_decl (tree type)
{
- tree name;
- tree d;
-
if (variably_modified_type_p (type, /*fn=*/NULL_TREE))
{
error ("cannot create type information for type %qT because "
@@ -429,25 +425,41 @@ get_tinfo_decl (tree type)
type = build_function_type (TREE_TYPE (type),
TREE_CHAIN (TYPE_ARG_TYPES (type)));
- type = complete_type (type);
+ return get_tinfo_decl_direct (type, NULL, -1);
+}
+/* Get or create a tinfo VAR_DECL directly from the provided information.
+ The caller must have already checked it is valid to do so. */
+
+static tree
+get_tinfo_decl_direct (tree type, tree name, int pseudo_ix)
+{
/* For a class type, the variable is cached in the type node
itself. */
+ tree d = NULL_TREE;
+
+ gcc_checking_assert (TREE_CODE (type) != METHOD_TYPE);
+
+ if (pseudo_ix < 0)
+ type = complete_type (type);
+
if (CLASS_TYPE_P (type))
- {
- d = CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type));
- if (d)
- return d;
- }
+ d = CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type));
+
+ if (!name)
+ name = mangle_typeinfo_for_type (type);
- name = mangle_typeinfo_for_type (type);
+ if (!CLASS_TYPE_P (type))
+ d = get_global_binding (name);
- d = get_global_binding (name);
if (!d)
{
- int ix = get_pseudo_ti_index (type);
- const tinfo_s *ti = get_tinfo_desc (ix);
-
+ /* Create it. */
+ if (pseudo_ix < 0)
+ pseudo_ix = get_pseudo_ti_index (type);
+
+ const tinfo_s *ti = get_tinfo_desc (pseudo_ix);
+
d = build_lang_decl (VAR_DECL, name, ti->type);
SET_DECL_ASSEMBLER_NAME (d, name);
/* Remember the type it is for. */
@@ -754,23 +766,21 @@ build_dynamic_cast_1 (location_t loc, tree type, tree expr,
dcast_fn = dynamic_cast_node;
if (!dcast_fn)
{
- tree tmp;
- tree tinfo_ptr;
- const char *name;
-
push_abi_namespace ();
- tinfo_ptr = xref_tag (class_type,
- get_identifier ("__class_type_info"));
- tinfo_ptr = build_pointer_type
- (cp_build_qualified_type
- (tinfo_ptr, TYPE_QUAL_CONST));
- name = "__dynamic_cast";
- tmp = build_function_type_list (ptr_type_node,
- const_ptr_type_node,
- tinfo_ptr, tinfo_ptr,
- ptrdiff_type_node, NULL_TREE);
- dcast_fn = build_library_fn_ptr (name, tmp,
- ECF_LEAF | ECF_PURE | ECF_NOTHROW);
+ tree tinfo_ptr = xref_tag (class_type,
+ get_identifier ("__class_type_info"));
+ tinfo_ptr = cp_build_qualified_type (tinfo_ptr, TYPE_QUAL_CONST);
+ tinfo_ptr = build_pointer_type (tinfo_ptr);
+
+ const char *fn_name = "__dynamic_cast";
+ /* void *() (void const *, __class_type_info const *,
+ __class_type_info const *, ptrdiff_t) */
+ tree fn_type = (build_function_type_list
+ (ptr_type_node, const_ptr_type_node,
+ tinfo_ptr, tinfo_ptr, ptrdiff_type_node,
+ NULL_TREE));
+ dcast_fn = (build_library_fn_ptr
+ (fn_name, fn_type, ECF_LEAF | ECF_PURE | ECF_NOTHROW));
pop_abi_namespace ();
dynamic_cast_node = dcast_fn;
}
@@ -947,6 +957,8 @@ tinfo_base_init (tinfo_s *ti, tree target)
{
push_abi_namespace ();
tree real_type = xref_tag (class_type, ti->name);
+ tree real_decl = TYPE_NAME (real_type);
+ DECL_SOURCE_LOCATION (real_decl) = BUILTINS_LOCATION;
pop_abi_namespace ();
if (!COMPLETE_TYPE_P (real_type))
@@ -1450,8 +1462,6 @@ get_tinfo_desc (unsigned ix)
}
}
- push_abi_namespace ();
-
/* Generate the pseudo type name. */
const char *real_name = tinfo_names[ix < TK_VMI_CLASS_TYPES
? ix : unsigned (TK_VMI_CLASS_TYPES)];
@@ -1468,6 +1478,7 @@ get_tinfo_desc (unsigned ix)
/* Pass the fields chained in reverse. */
finish_builtin_struct (pseudo_type, pseudo_name, fields, NULL_TREE);
CLASSTYPE_AS_BASE (pseudo_type) = pseudo_type;
+ DECL_CONTEXT (TYPE_NAME (pseudo_type)) = FROB_CONTEXT (global_namespace);
xref_basetypes (pseudo_type, /*bases=*/NULL_TREE);
res->type = cp_build_qualified_type (pseudo_type, TYPE_QUAL_CONST);
@@ -1477,7 +1488,6 @@ get_tinfo_desc (unsigned ix)
internal linkage. */
TREE_PUBLIC (TYPE_MAIN_DECL (res->type)) = 1;
- pop_abi_namespace ();
return res;
}
@@ -1608,12 +1618,10 @@ emit_support_tinfos (void)
bool
emit_tinfo_decl (tree decl)
{
- tree type = TREE_TYPE (DECL_NAME (decl));
- int in_library = typeinfo_in_lib_p (type);
-
gcc_assert (DECL_TINFO_P (decl));
- if (in_library)
+ tree type = TREE_TYPE (DECL_NAME (decl));
+ if (typeinfo_in_lib_p (type))
{
if (doing_runtime)
DECL_EXTERNAL (decl) = 0;
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index e36a8ae..8a1de7c 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -977,17 +977,6 @@ lookup_field_r (tree binfo, void *data)
nval = get_class_binding (type, lfi->name, lfi->want_type);
- /* If we're looking up a type (as with an elaborated type specifier)
- we ignore all non-types we find. */
- if (lfi->want_type && nval && !DECL_DECLARES_TYPE_P (nval))
- {
- nval = NULL_TREE;
- if (CLASSTYPE_NESTED_UTDS (type))
- if (binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
- lfi->name))
- nval = TYPE_MAIN_DECL (e->type);
- }
-
/* If there is no declaration with the indicated name in this type,
then there's nothing to do. */
if (!nval)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 1e42cd7..33d715e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5382,11 +5382,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
if ((ort & C_ORT_OMP_DECLARE_SIMD) != C_ORT_OMP && ort != C_ORT_ACC)
OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_POINTER);
else if (TREE_CODE (t) == COMPONENT_REF)
- {
- gomp_map_kind k = (ort == C_ORT_ACC) ? GOMP_MAP_ATTACH_DETACH
- : GOMP_MAP_ALWAYS_POINTER;
- OMP_CLAUSE_SET_MAP_KIND (c2, k);
- }
+ OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ATTACH_DETACH);
else if (REFERENCE_REF_P (t)
&& TREE_CODE (TREE_OPERAND (t, 0)) == COMPONENT_REF)
{
@@ -5424,8 +5420,12 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
OMP_CLAUSE_MAP);
OMP_CLAUSE_SET_MAP_KIND (c3, OMP_CLAUSE_MAP_KIND (c2));
OMP_CLAUSE_DECL (c3) = ptr;
- if (OMP_CLAUSE_MAP_KIND (c2) == GOMP_MAP_ALWAYS_POINTER)
- OMP_CLAUSE_DECL (c2) = build_simple_mem_ref (ptr);
+ if (OMP_CLAUSE_MAP_KIND (c2) == GOMP_MAP_ALWAYS_POINTER
+ || OMP_CLAUSE_MAP_KIND (c2) == GOMP_MAP_ATTACH_DETACH)
+ {
+ OMP_CLAUSE_DECL (c2) = build_simple_mem_ref (ptr);
+ OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ALWAYS_POINTER);
+ }
else
OMP_CLAUSE_DECL (c2) = convert_from_reference (ptr);
OMP_CLAUSE_SIZE (c3) = size_zero_node;
@@ -6373,6 +6373,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
/* 1 if normal/task reduction has been seen, -1 if inscan reduction
has been seen, -2 if mixed inscan/normal reduction diagnosed. */
int reduction_seen = 0;
+ bool allocate_seen = false;
bitmap_obstack_initialize (NULL);
bitmap_initialize (&generic_head, &bitmap_default_obstack);
@@ -7198,6 +7199,80 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
bitmap_set_bit (&oacc_reduction_head, DECL_UID (t));
break;
+ case OMP_CLAUSE_ALLOCATE:
+ t = omp_clause_decl_field (OMP_CLAUSE_DECL (c));
+ if (t)
+ omp_note_field_privatization (t, OMP_CLAUSE_DECL (c));
+ else
+ t = OMP_CLAUSE_DECL (c);
+ if (t == current_class_ptr)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%<this%> not allowed in %<allocate%> clause");
+ remove = true;
+ break;
+ }
+ if (!VAR_P (t)
+ && TREE_CODE (t) != PARM_DECL
+ && TREE_CODE (t) != FIELD_DECL)
+ {
+ if (processing_template_decl && TREE_CODE (t) != OVERLOAD)
+ break;
+ if (DECL_P (t))
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qD is not a variable in %<allocate%> clause", t);
+ else
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qE is not a variable in %<allocate%> clause", t);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&aligned_head, DECL_UID (t)))
+ {
+ warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ "%qD appears more than once in %<allocate%> clauses",
+ t);
+ remove = true;
+ }
+ else
+ {
+ bitmap_set_bit (&aligned_head, DECL_UID (t));
+ allocate_seen = true;
+ }
+ tree allocator;
+ allocator = OMP_CLAUSE_ALLOCATE_ALLOCATOR (c);
+ if (error_operand_p (allocator))
+ {
+ remove = true;
+ break;
+ }
+ if (allocator == NULL_TREE)
+ goto handle_field_decl;
+ tree allocatort;
+ allocatort = TYPE_MAIN_VARIANT (TREE_TYPE (allocator));
+ if (!type_dependent_expression_p (allocator)
+ && (TREE_CODE (allocatort) != ENUMERAL_TYPE
+ || TYPE_NAME (allocatort) == NULL_TREE
+ || TREE_CODE (TYPE_NAME (allocatort)) != TYPE_DECL
+ || (DECL_NAME (TYPE_NAME (allocatort))
+ != get_identifier ("omp_allocator_handle_t"))
+ || (TYPE_CONTEXT (allocatort)
+ != DECL_CONTEXT (global_namespace))))
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%<allocate%> clause allocator expression has "
+ "type %qT rather than %<omp_allocator_handle_t%>",
+ TREE_TYPE (allocator));
+ remove = true;
+ }
+ else
+ {
+ allocator = mark_rvalue_use (allocator);
+ if (!processing_template_decl)
+ allocator = maybe_constant_value (allocator);
+ OMP_CLAUSE_ALLOCATE_ALLOCATOR (c) = allocator;
+ }
+ goto handle_field_decl;
+
case OMP_CLAUSE_DEPEND:
t = OMP_CLAUSE_DECL (c);
if (t == NULL_TREE)
@@ -7411,7 +7486,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
t = TREE_OPERAND (t, 0);
OMP_CLAUSE_DECL (c) = t;
}
- if (ort == C_ORT_ACC
+ if ((ort == C_ORT_ACC || ort == C_ORT_OMP)
&& TREE_CODE (t) == COMPONENT_REF
&& TREE_CODE (TREE_OPERAND (t, 0)) == INDIRECT_REF)
t = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
@@ -7457,7 +7532,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
t = TREE_OPERAND (t, 0);
if (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
{
- if (bitmap_bit_p (&map_field_head, DECL_UID (t)))
+ if (bitmap_bit_p (&map_field_head, DECL_UID (t))
+ || (ort == C_ORT_OMP
+ && bitmap_bit_p (&map_head, DECL_UID (t))))
goto handle_map_references;
}
}
@@ -7551,13 +7628,12 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
bitmap_set_bit (&generic_head, DECL_UID (t));
}
else if (bitmap_bit_p (&map_head, DECL_UID (t))
- && (ort != C_ORT_ACC
- || !bitmap_bit_p (&map_field_head, DECL_UID (t))))
+ && !bitmap_bit_p (&map_field_head, DECL_UID (t)))
{
if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
error_at (OMP_CLAUSE_LOCATION (c),
"%qD appears more than once in motion clauses", t);
- if (ort == C_ORT_ACC)
+ else if (ort == C_ORT_ACC)
error_at (OMP_CLAUSE_LOCATION (c),
"%qD appears more than once in data clauses", t);
else
@@ -7566,7 +7642,13 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
remove = true;
}
else if (bitmap_bit_p (&generic_head, DECL_UID (t))
- || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
+ && ort == C_ORT_ACC)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qD appears more than once in data clauses", t);
+ remove = true;
+ }
+ else if (bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
{
if (ort == C_ORT_ACC)
error_at (OMP_CLAUSE_LOCATION (c),
@@ -7602,17 +7684,14 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
&& (OMP_CLAUSE_MAP_KIND (c)
!= GOMP_MAP_FIRSTPRIVATE_REFERENCE)
&& (OMP_CLAUSE_MAP_KIND (c)
- != GOMP_MAP_ALWAYS_POINTER))
+ != GOMP_MAP_ALWAYS_POINTER)
+ && (OMP_CLAUSE_MAP_KIND (c)
+ != GOMP_MAP_ATTACH_DETACH))
{
tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
OMP_CLAUSE_MAP);
if (TREE_CODE (t) == COMPONENT_REF)
- {
- gomp_map_kind k
- = (ort == C_ORT_ACC) ? GOMP_MAP_ATTACH_DETACH
- : GOMP_MAP_ALWAYS_POINTER;
- OMP_CLAUSE_SET_MAP_KIND (c2, k);
- }
+ OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_ATTACH_DETACH);
else
OMP_CLAUSE_SET_MAP_KIND (c2,
GOMP_MAP_FIRSTPRIVATE_REFERENCE);
@@ -8115,17 +8194,11 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
}
t = OMP_CLAUSE_DECL (c);
- if (processing_template_decl
- && !VAR_P (t) && TREE_CODE (t) != PARM_DECL)
- {
- pc = &OMP_CLAUSE_CHAIN (c);
- continue;
- }
-
switch (c_kind)
{
case OMP_CLAUSE_LASTPRIVATE:
- if (!bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
+ if (DECL_P (t)
+ && !bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
{
need_default_ctor = true;
need_dtor = true;
@@ -8135,6 +8208,34 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
case OMP_CLAUSE_REDUCTION:
case OMP_CLAUSE_IN_REDUCTION:
case OMP_CLAUSE_TASK_REDUCTION:
+ if (allocate_seen)
+ {
+ if (TREE_CODE (t) == MEM_REF)
+ {
+ t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == POINTER_PLUS_EXPR)
+ t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == ADDR_EXPR
+ || TREE_CODE (t) == INDIRECT_REF)
+ t = TREE_OPERAND (t, 0);
+ if (DECL_P (t))
+ bitmap_clear_bit (&aligned_head, DECL_UID (t));
+ }
+ else if (TREE_CODE (t) == TREE_LIST)
+ {
+ while (TREE_CODE (t) == TREE_LIST)
+ t = TREE_CHAIN (t);
+ if (DECL_P (t))
+ bitmap_clear_bit (&aligned_head, DECL_UID (t));
+ t = OMP_CLAUSE_DECL (c);
+ }
+ else if (DECL_P (t))
+ bitmap_clear_bit (&aligned_head, DECL_UID (t));
+ t = OMP_CLAUSE_DECL (c);
+ }
+ if (processing_template_decl
+ && !VAR_P (t) && TREE_CODE (t) != PARM_DECL)
+ break;
if (finish_omp_reduction_clause (c, &need_default_ctor,
&need_dtor))
remove = true;
@@ -8143,6 +8244,9 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
break;
case OMP_CLAUSE_COPYIN:
+ if (processing_template_decl
+ && !VAR_P (t) && TREE_CODE (t) != PARM_DECL)
+ break;
if (!VAR_P (t) || !CP_DECL_THREAD_LOCAL_P (t))
{
error_at (OMP_CLAUSE_LOCATION (c),
@@ -8155,6 +8259,13 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
break;
}
+ if (processing_template_decl
+ && !VAR_P (t) && TREE_CODE (t) != PARM_DECL)
+ {
+ pc = &OMP_CLAUSE_CHAIN (c);
+ continue;
+ }
+
if (need_complete_type || need_copy_assignment)
{
t = require_complete_type (t);
@@ -8169,6 +8280,11 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
{
const char *share_name = NULL;
+ if (allocate_seen
+ && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_SHARED
+ && DECL_P (t))
+ bitmap_clear_bit (&aligned_head, DECL_UID (t));
+
if (VAR_P (t) && CP_DECL_THREAD_LOCAL_P (t))
share_name = "threadprivate";
else switch (cxx_omp_predetermined_sharing_1 (t))
@@ -8262,6 +8378,26 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
pc = &OMP_CLAUSE_CHAIN (c);
}
+ if (allocate_seen)
+ for (pc = &clauses, c = clauses; c ; c = *pc)
+ {
+ bool remove = false;
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ALLOCATE
+ && !OMP_CLAUSE_ALLOCATE_COMBINED (c)
+ && DECL_P (OMP_CLAUSE_DECL (c))
+ && bitmap_bit_p (&aligned_head, DECL_UID (OMP_CLAUSE_DECL (c))))
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qD specified in %<allocate%> clause but not in "
+ "an explicit privatization clause", OMP_CLAUSE_DECL (c));
+ remove = true;
+ }
+ if (remove)
+ *pc = OMP_CLAUSE_CHAIN (c);
+ else
+ pc = &OMP_CLAUSE_CHAIN (c);
+ }
+
bitmap_obstack_release (NULL);
return clauses;
}
@@ -10133,6 +10269,12 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
case CPTK_IS_CONSTRUCTIBLE:
return is_xible (INIT_EXPR, type1, type2);
+ case CPTK_IS_NOTHROW_ASSIGNABLE:
+ return is_nothrow_xible (MODIFY_EXPR, type1, type2);
+
+ case CPTK_IS_NOTHROW_CONSTRUCTIBLE:
+ return is_nothrow_xible (INIT_EXPR, type1, type2);
+
default:
gcc_unreachable ();
return false;
@@ -10213,6 +10355,8 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
case CPTK_IS_TRIVIALLY_ASSIGNABLE:
case CPTK_IS_TRIVIALLY_CONSTRUCTIBLE:
+ case CPTK_IS_NOTHROW_ASSIGNABLE:
+ case CPTK_IS_NOTHROW_CONSTRUCTIBLE:
if (!check_trait_type (type1)
|| !check_trait_type (type2))
return error_mark_node;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9bc37ac..28e5910 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2676,6 +2676,52 @@ build_cp_fntype_variant (tree type, cp_ref_qualifier rqual,
return v;
}
+/* TYPE is a function or method type with a deferred exception
+ specification that has been parsed to RAISES. Fixup all the type
+ variants that are affected in place. Via decltype &| noexcept
+ tricks, the unparsed spec could have escaped into the type system.
+ The general case is hard to fixup canonical types for. */
+
+void
+fixup_deferred_exception_variants (tree type, tree raises)
+{
+ tree original = TYPE_RAISES_EXCEPTIONS (type);
+ tree cr = flag_noexcept_type ? canonical_eh_spec (raises) : NULL_TREE;
+
+ gcc_checking_assert (TREE_CODE (TREE_PURPOSE (original))
+ == DEFERRED_PARSE);
+
+ /* Though sucky, this walk will process the canonical variants
+ first. */
+ for (tree variant = TYPE_MAIN_VARIANT (type);
+ variant; variant = TYPE_NEXT_VARIANT (variant))
+ if (TYPE_RAISES_EXCEPTIONS (variant) == original)
+ {
+ gcc_checking_assert (variant != TYPE_MAIN_VARIANT (type));
+
+ if (!TYPE_STRUCTURAL_EQUALITY_P (variant))
+ {
+ cp_cv_quals var_quals = TYPE_QUALS (variant);
+ cp_ref_qualifier rqual = type_memfn_rqual (variant);
+
+ tree v = TYPE_MAIN_VARIANT (type);
+ for (; v; v = TYPE_NEXT_VARIANT (v))
+ if (TYPE_CANONICAL (v) == v
+ && cp_check_qualified_type (v, variant, var_quals,
+ rqual, cr, false))
+ break;
+ TYPE_RAISES_EXCEPTIONS (variant) = raises;
+
+ if (!v)
+ v = build_cp_fntype_variant (TYPE_CANONICAL (variant),
+ rqual, cr, false);
+ TYPE_CANONICAL (variant) = v;
+ }
+ else
+ TYPE_RAISES_EXCEPTIONS (variant) = raises;
+ }
+}
+
/* Build the FUNCTION_TYPE or METHOD_TYPE which may throw exceptions
listed in RAISES. */
@@ -2700,6 +2746,7 @@ bind_template_template_parm (tree t, tree newargs)
t2 = cxx_make_type (BOUND_TEMPLATE_TEMPLATE_PARM);
decl = build_decl (input_location,
TYPE_DECL, DECL_NAME (decl), NULL_TREE);
+ SET_DECL_TEMPLATE_PARM_P (decl);
/* These nodes have to be created to reflect new TYPE_DECL and template
arguments. */
@@ -3671,20 +3718,28 @@ cp_tree_equal (tree t1, tree t2)
case CALL_EXPR:
{
- tree arg1, arg2;
- call_expr_arg_iterator iter1, iter2;
- if (KOENIG_LOOKUP_P (t1) != KOENIG_LOOKUP_P (t2)
- || !called_fns_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
+ if (KOENIG_LOOKUP_P (t1) != KOENIG_LOOKUP_P (t2))
return false;
- for (arg1 = first_call_expr_arg (t1, &iter1),
- arg2 = first_call_expr_arg (t2, &iter2);
- arg1 && arg2;
- arg1 = next_call_expr_arg (&iter1),
- arg2 = next_call_expr_arg (&iter2))
- if (!cp_tree_equal (arg1, arg2))
- return false;
- if (arg1 || arg2)
+
+ if (!called_fns_equal (CALL_EXPR_FN (t1), CALL_EXPR_FN (t2)))
return false;
+
+ call_expr_arg_iterator iter1, iter2;
+ init_call_expr_arg_iterator (t1, &iter1);
+ init_call_expr_arg_iterator (t2, &iter2);
+ if (iter1.n != iter2.n)
+ return false;
+
+ while (more_call_expr_args_p (&iter1))
+ {
+ tree arg1 = next_call_expr_arg (&iter1);
+ tree arg2 = next_call_expr_arg (&iter2);
+
+ gcc_checking_assert (arg1 && arg2);
+ if (!cp_tree_equal (arg1, arg2))
+ return false;
+ }
+
return true;
}
@@ -3779,16 +3834,11 @@ cp_tree_equal (tree t1, tree t2)
CHECK_CONSTR_ARGS (t2)));
case TREE_VEC:
- {
- unsigned ix;
- if (TREE_VEC_LENGTH (t1) != TREE_VEC_LENGTH (t2))
- return false;
- for (ix = TREE_VEC_LENGTH (t1); ix--;)
- if (!cp_tree_equal (TREE_VEC_ELT (t1, ix),
- TREE_VEC_ELT (t2, ix)))
- return false;
- return true;
- }
+ /* These are template args. Really we should be getting the
+ caller to do this as it knows it to be true. */
+ if (!comp_template_args (t1, t2, NULL, NULL, false))
+ return false;
+ return true;
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
@@ -4050,13 +4100,14 @@ is_dummy_object (const_tree ob)
&& TREE_OPERAND (ob, 0) == void_node);
}
-/* Returns true if TYPE is a character type or std::byte. */
+/* Returns true if TYPE is char, unsigned char, or std::byte. */
bool
is_byte_access_type (tree type)
{
type = TYPE_MAIN_VARIANT (type);
- if (char_type_p (type))
+ if (type == char_type_node
+ || type == unsigned_char_type_node)
return true;
return (TREE_CODE (type) == ENUMERAL_TYPE
@@ -5668,8 +5719,7 @@ cp_fix_function_decl_p (tree decl)
/* Don't fix same_body aliases. Although they don't have their own
CFG, they share it with what they alias to. */
- if (!node || !node->alias
- || !vec_safe_length (node->ref_list.references))
+ if (!node || !node->alias || !node->num_references ())
return true;
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 95b36a9..08e0c80 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4062,7 +4062,7 @@ error_args_num (location_t loc, tree fndecl, bool too_many_p)
? G_("too many arguments to function %q#D")
: G_("too few arguments to function %q#D"),
fndecl);
- if (!DECL_IS_BUILTIN (fndecl))
+ if (!DECL_IS_UNDECLARED_BUILTIN (fndecl))
inform (DECL_SOURCE_LOCATION (fndecl), "declared here");
}
else
@@ -4428,6 +4428,107 @@ warn_for_null_address (location_t location, tree op, tsubst_flags_t complain)
}
}
+/* Warn about [expr.arith.conv]/2: If one operand is of enumeration type and
+ the other operand is of a different enumeration type or a floating-point
+ type, this behavior is deprecated ([depr.arith.conv.enum]). CODE is the
+ code of the binary operation, TYPE0 and TYPE1 are the types of the operands,
+ and LOC is the location for the whole binary expression.
+ TODO: Consider combining this with -Wenum-compare in build_new_op_1. */
+
+static void
+do_warn_enum_conversions (location_t loc, enum tree_code code, tree type0,
+ tree type1)
+{
+ if (TREE_CODE (type0) == ENUMERAL_TYPE
+ && TREE_CODE (type1) == ENUMERAL_TYPE
+ && TYPE_MAIN_VARIANT (type0) != TYPE_MAIN_VARIANT (type1))
+ {
+ /* In C++20, -Wdeprecated-enum-enum-conversion is on by default.
+ Otherwise, warn if -Wenum-conversion is on. */
+ enum opt_code opt;
+ if (warn_deprecated_enum_enum_conv)
+ opt = OPT_Wdeprecated_enum_enum_conversion;
+ else if (warn_enum_conversion)
+ opt = OPT_Wenum_conversion;
+ else
+ return;
+
+ switch (code)
+ {
+ case GT_EXPR:
+ case LT_EXPR:
+ case GE_EXPR:
+ case LE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ /* Comparisons are handled by -Wenum-compare. */
+ return;
+ case SPACESHIP_EXPR:
+ /* This is invalid, don't warn. */
+ return;
+ case BIT_AND_EXPR:
+ case BIT_IOR_EXPR:
+ case BIT_XOR_EXPR:
+ warning_at (loc, opt, "bitwise operation between different "
+ "enumeration types %qT and %qT is deprecated",
+ type0, type1);
+ return;
+ default:
+ warning_at (loc, opt, "arithmetic between different enumeration "
+ "types %qT and %qT is deprecated", type0, type1);
+ return;
+ }
+ }
+ else if ((TREE_CODE (type0) == ENUMERAL_TYPE
+ && TREE_CODE (type1) == REAL_TYPE)
+ || (TREE_CODE (type0) == REAL_TYPE
+ && TREE_CODE (type1) == ENUMERAL_TYPE))
+ {
+ const bool enum_first_p = TREE_CODE (type0) == ENUMERAL_TYPE;
+ /* In C++20, -Wdeprecated-enum-float-conversion is on by default.
+ Otherwise, warn if -Wenum-conversion is on. */
+ enum opt_code opt;
+ if (warn_deprecated_enum_float_conv)
+ opt = OPT_Wdeprecated_enum_float_conversion;
+ else if (warn_enum_conversion)
+ opt = OPT_Wenum_conversion;
+ else
+ return;
+
+ switch (code)
+ {
+ case GT_EXPR:
+ case LT_EXPR:
+ case GE_EXPR:
+ case LE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ if (enum_first_p)
+ warning_at (loc, opt, "comparison of enumeration type %qT with "
+ "floating-point type %qT is deprecated",
+ type0, type1);
+ else
+ warning_at (loc, opt, "comparison of floating-point type %qT "
+ "with enumeration type %qT is deprecated",
+ type0, type1);
+ return;
+ case SPACESHIP_EXPR:
+ /* This is invalid, don't warn. */
+ return;
+ default:
+ if (enum_first_p)
+ warning_at (loc, opt, "arithmetic between enumeration type %qT "
+ "and floating-point type %qT is deprecated",
+ type0, type1);
+ else
+ warning_at (loc, opt, "arithmetic between floating-point type %qT "
+ "and enumeration type %qT is deprecated",
+ type0, type1);
+ return;
+ }
+ }
+}
+
/* Build a binary-operation expression without default conversions.
CODE is the kind of expression to build.
LOCATION is the location_t of the operator in the source code.
@@ -4706,14 +4807,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 +4829,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
@@ -5439,11 +5546,15 @@ cp_build_binary_op (const op_location_t &location,
{
result_type = cp_common_type (type0, type1);
if (complain & tf_warning)
- do_warn_double_promotion (result_type, type0, type1,
- "implicit conversion from %qH to %qI "
- "to match other operand of binary "
- "expression",
- location);
+ {
+ do_warn_double_promotion (result_type, type0, type1,
+ "implicit conversion from %qH to %qI "
+ "to match other operand of binary "
+ "expression",
+ location);
+ do_warn_enum_conversions (location, code, TREE_TYPE (orig_op0),
+ TREE_TYPE (orig_op1));
+ }
}
if (code == SPACESHIP_EXPR)
@@ -5476,6 +5587,12 @@ cp_build_binary_op (const op_location_t &location,
arithmetic conversions are applied to the operands." So we don't do
arithmetic conversions if the operands both have enumeral type. */
result_type = NULL_TREE;
+ else if ((orig_code0 == ENUMERAL_TYPE && orig_code1 == REAL_TYPE)
+ || (orig_code0 == REAL_TYPE && orig_code1 == ENUMERAL_TYPE))
+ /* [depr.arith.conv.enum]: Three-way comparisons between such operands
+ [where one is of enumeration type and the other is of a different
+ enumeration type or a floating-point type] are ill-formed. */
+ result_type = NULL_TREE;
if (result_type)
{
@@ -5490,12 +5607,12 @@ cp_build_binary_op (const op_location_t &location,
type to a floating point type, the program is ill-formed. */
bool ok = true;
if (TREE_CODE (result_type) == REAL_TYPE
- && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (orig_op0)))
+ && CP_INTEGRAL_TYPE_P (orig_type0))
/* OK */;
else if (!check_narrowing (result_type, orig_op0, complain))
ok = false;
if (TREE_CODE (result_type) == REAL_TYPE
- && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (orig_op1)))
+ && CP_INTEGRAL_TYPE_P (orig_type1))
/* OK */;
else if (!check_narrowing (result_type, orig_op1, complain))
ok = false;
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index e259a42..445e2a2 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -954,7 +954,7 @@ store_init_value (tree decl, tree init, vec<tree, va_gc>** cleanups, int flags)
return split_nonconstant_init (decl, value);
/* DECL may change value; purge caches. */
- clear_cv_and_fold_caches (TREE_STATIC (decl));
+ clear_cv_and_fold_caches ();
/* If the value is a constant, just put it in DECL_INITIAL. If DECL
is an automatic variable, the middle end will turn this into a
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 1ae5199..adab9a9 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,3 +1,32 @@
+2020-10-27 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * dmd/MERGE: Merge upstream dmd bec5973b0.
+ * d-target.cc (Target::critsecsize): Remove.
+ * d-target.def: Remove d_critsec_size.
+
+2020-10-27 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * dmd/MERGE: Merge upstream dmd 0fcdaab32
+
+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 78f1420..692fce6 100644
--- a/gcc/d/d-target.cc
+++ b/gcc/d/d-target.cc
@@ -202,16 +202,6 @@ Target::fieldalign (Type *type)
return align / BITS_PER_UNIT;
}
-/* Return size of OS critical section.
- Can't use the sizeof () calls directly since cross compiling is supported
- and would end up using the host sizes rather than the target sizes. */
-
-unsigned
-Target::critsecsize (void)
-{
- return targetdm.d_critsec_size ();
-}
-
/* Returns a Type for the va_list type of the target. */
Type *
diff --git a/gcc/d/d-target.def b/gcc/d/d-target.def
index d641c74..41b3172 100644
--- a/gcc/d/d-target.def
+++ b/gcc/d/d-target.def
@@ -46,15 +46,5 @@ relating to the target operating system.",
void, (void),
hook_void_void)
-/* The sizeof CRITICAL_SECTION or pthread_mutex_t. */
-DEFHOOK
-(d_critsec_size,
- "Returns the size of the data structure used by the target operating system\n\
-for critical sections and monitors. For example, on Microsoft Windows this\n\
-would return the @code{sizeof(CRITICAL_SECTION)}, while other platforms that\n\
-implement pthreads would return @code{sizeof(pthread_mutex_t)}.",
- unsigned, (void),
- hook_uint_void_0)
-
/* Close the 'struct gcc_targetdm' definition. */
HOOK_VECTOR_END (C90_EMPTY_HACK)
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 5f6193f..39e424f 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-70aabfb511d55f2bfbdccbac7868519d9d4b63da
+bec5973b0203c95adbda2a049ccdf3cd3a4378f6
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/dtemplate.c b/gcc/d/dmd/dtemplate.c
index a86daee..caa8a5b 100644
--- a/gcc/d/dmd/dtemplate.c
+++ b/gcc/d/dmd/dtemplate.c
@@ -33,6 +33,7 @@
#include "hdrgen.h"
#include "id.h"
#include "attrib.h"
+#include "cond.h"
#include "tokens.h"
#define IDX_NOTFOUND (0x12345678) // index is not found
@@ -6088,17 +6089,18 @@ Lerror:
if (minst && minst->isRoot() && !(inst->minst && inst->minst->isRoot()))
{
/* Swap the position of 'inst' and 'this' in the instantiation graph.
- * Then, the primary instance `inst` will be changed to a root instance.
+ * Then, the primary instance `inst` will be changed to a root instance,
+ * along with all members of `inst` having their scopes updated.
*
* Before:
- * non-root -> A!() -> B!()[inst] -> C!()
+ * non-root -> A!() -> B!()[inst] -> C!() { members[non-root] }
* |
* root -> D!() -> B!()[this]
*
* After:
* non-root -> A!() -> B!()[this]
* |
- * root -> D!() -> B!()[inst] -> C!()
+ * root -> D!() -> B!()[inst] -> C!() { members[root] }
*/
Module *mi = minst;
TemplateInstance *ti = tinst;
@@ -6107,6 +6109,64 @@ Lerror:
inst->minst = mi;
inst->tinst = ti;
+ /* https://issues.dlang.org/show_bug.cgi?id=21299
+ `minst` has been updated on the primary instance `inst` so it is
+ now coming from a root module, however all Dsymbol `inst.members`
+ of the instance still have their `_scope.minst` pointing at the
+ original non-root module. We must now propagate `minst` to all
+ members so that forward referenced dependencies that get
+ instantiated will also be appended to the root module, otherwise
+ there will be undefined references at link-time. */
+ class InstMemberWalker : public Visitor
+ {
+ public:
+ TemplateInstance *inst;
+
+ InstMemberWalker(TemplateInstance *inst)
+ : inst(inst) { }
+
+ void visit(Dsymbol *d)
+ {
+ if (d->_scope)
+ d->_scope->minst = inst->minst;
+ }
+
+ void visit(ScopeDsymbol *sds)
+ {
+ if (!sds->members)
+ return;
+ for (size_t i = 0; i < sds->members->length; i++)
+ {
+ Dsymbol *s = (*sds->members)[i];
+ s->accept(this);
+ }
+ visit((Dsymbol *)sds);
+ }
+
+ void visit(AttribDeclaration *ad)
+ {
+ Dsymbols *d = ad->include(NULL);
+ if (!d)
+ return;
+ for (size_t i = 0; i < d->length; i++)
+ {
+ Dsymbol *s = (*d)[i];
+ s->accept(this);
+ }
+ visit((Dsymbol *)ad);
+ }
+
+ void visit(ConditionalDeclaration *cd)
+ {
+ if (cd->condition->inc)
+ visit((AttribDeclaration *)cd);
+ else
+ visit((Dsymbol *)cd);
+ }
+ };
+ InstMemberWalker v(inst);
+ inst->accept(&v);
+
if (minst) // if inst was not speculative
{
/* Add 'inst' once again to the root module members[], then the
diff --git a/gcc/d/dmd/idgen.c b/gcc/d/dmd/idgen.c
index 2944a79..a6267c5 100644
--- a/gcc/d/dmd/idgen.c
+++ b/gcc/d/dmd/idgen.c
@@ -262,7 +262,7 @@ Msgtable msgtable[] =
{ "aaRehash", "_aaRehash" },
{ "monitorenter", "_d_monitorenter" },
{ "monitorexit", "_d_monitorexit" },
- { "criticalenter", "_d_criticalenter" },
+ { "criticalenter", "_d_criticalenter2" },
{ "criticalexit", "_d_criticalexit" },
{ "__ArrayEq", NULL },
{ "__ArrayPostblit", NULL },
diff --git a/gcc/d/dmd/statementsem.c b/gcc/d/dmd/statementsem.c
index 42f885d..4ff07f6 100644
--- a/gcc/d/dmd/statementsem.c
+++ b/gcc/d/dmd/statementsem.c
@@ -3213,14 +3213,15 @@ public:
else
{
/* Generate our own critical section, then rewrite as:
- * __gshared byte[CriticalSection.sizeof] critsec;
- * _d_criticalenter(critsec.ptr);
- * try { body } finally { _d_criticalexit(critsec.ptr); }
+ * __gshared void* __critsec;
+ * _d_criticalenter2(&__critsec);
+ * try { body } finally { _d_criticalexit(__critsec); }
*/
Identifier *id = Identifier::generateId("__critsec");
- Type *t = Type::tint8->sarrayOf(target.ptrsize + target.critsecsize());
+ Type *t = Type::tvoidptr;
VarDeclaration *tmp = new VarDeclaration(ss->loc, t, id, NULL);
tmp->storage_class |= STCtemp | STCgshared | STCstatic;
+ Expression *tmpExp = new VarExp(ss->loc, tmp);
Statements *cs = new Statements();
cs->push(new ExpStatement(ss->loc, tmp));
@@ -3236,15 +3237,14 @@ public:
args->push(new Parameter(0, t->pointerTo(), NULL, NULL));
FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalenter, STCnothrow);
- Expression *e = new DotIdExp(ss->loc, new VarExp(ss->loc, tmp), Id::ptr);
+ Expression *e = new AddrExp(ss->loc, tmpExp);
e = semantic(e, sc);
e = new CallExp(ss->loc, new VarExp(ss->loc, fdenter, false), e);
e->type = Type::tvoid; // do not run semantic on e
cs->push(new ExpStatement(ss->loc, e));
FuncDeclaration *fdexit = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalexit, STCnothrow);
- e = new DotIdExp(ss->loc, new VarExp(ss->loc, tmp), Id::ptr);
- e = semantic(e, sc);
+ e = semantic(tmpExp, sc);
e = new CallExp(ss->loc, new VarExp(ss->loc, fdexit, false), e);
e->type = Type::tvoid; // do not run semantic on e
Statement *s = new ExpStatement(ss->loc, e);
diff --git a/gcc/d/dmd/target.h b/gcc/d/dmd/target.h
index d76a9f8..c34826a 100644
--- a/gcc/d/dmd/target.h
+++ b/gcc/d/dmd/target.h
@@ -28,7 +28,6 @@ struct TargetC
{
unsigned longsize; // size of a C 'long' or 'unsigned long' type
unsigned long_doublesize; // size of a C 'long double'
- unsigned criticalSectionSize; // size of os critical section
};
struct TargetCPP
@@ -98,7 +97,6 @@ public:
// Type sizes and support.
unsigned alignsize(Type *type);
unsigned fieldalign(Type *type);
- unsigned critsecsize();
Type *va_listType(const Loc &loc, Scope *sc); // get type of va_list
int isVectorTypeSupported(int sz, Type *type);
bool isVectorOpSupported(Type *type, TOK op, Type *t2 = NULL);
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index 07946a8..a5b6bb6 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -171,6 +171,8 @@ DEBUG_COUNTER (if_after_reload)
DEBUG_COUNTER (if_conversion)
DEBUG_COUNTER (if_conversion_tree)
DEBUG_COUNTER (ipa_cp_bits)
+DEBUG_COUNTER (ipa_cp_values)
+DEBUG_COUNTER (ipa_cp_vr)
DEBUG_COUNTER (ipa_mod_ref)
DEBUG_COUNTER (ipa_sra_params)
DEBUG_COUNTER (ipa_sra_retvalues)
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 93b060f..9e75c13 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3614,6 +3614,14 @@ df_update_entry_block_defs (void)
}
+/* Return true if REGNO is used by the epilogue. */
+bool
+df_epilogue_uses_p (unsigned int regno)
+{
+ return (EPILOGUE_USES (regno)
+ || TEST_HARD_REG_BIT (crtl->must_be_zero_on_return, regno));
+}
+
/* Set the bit for regs that are considered being used at the exit. */
static void
@@ -3661,7 +3669,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
epilogue as being live at the end of the function since they
may be referenced by our caller. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i] || EPILOGUE_USES (i))
+ if (global_regs[i] || df_epilogue_uses_p (i))
bitmap_set_bit (exit_block_uses, i);
if (targetm.have_epilogue () && epilogue_completed)
@@ -3802,7 +3810,6 @@ df_hard_reg_init (void)
initialized = true;
}
-
/* Recompute the parts of scanning that are based on regs_ever_live
because something changed in that array. */
@@ -3862,7 +3869,6 @@ df_regs_ever_live_p (unsigned int regno)
return regs_ever_live[regno];
}
-
/* Set regs_ever_live[REGNO] to VALUE. If this cause regs_ever_live
to change, schedule that change for the next update. */
diff --git a/gcc/df.h b/gcc/df.h
index 8b6ca8c..0f098d7 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -1085,6 +1085,7 @@ extern void df_update_entry_exit_and_calls (void);
extern bool df_hard_reg_used_p (unsigned int);
extern unsigned int df_hard_reg_used_count (unsigned int);
extern bool df_regs_ever_live_p (unsigned int);
+extern bool df_epilogue_uses_p (unsigned int);
extern void df_set_regs_ever_live (unsigned int, bool);
extern void df_compute_regs_ever_live (bool);
extern void df_scan_verify (void);
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/extend.texi b/gcc/doc/extend.texi
index b9684dc..5f1e3bf 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -55,7 +55,7 @@ extensions, accepted by GCC in C90 mode and in C++.
* Designated Inits:: Labeling elements of initializers.
* Case Ranges:: `case 1 ... 9' and such.
* Cast to Union:: Casting to union type from any member of the union.
-* Mixed Declarations:: Mixing declarations and code.
+* Mixed Labels and Declarations:: Mixing declarations, labels and code.
* Function Attributes:: Declaring that functions have no side effects,
or that they can never return.
* Variable Attributes:: Specifying attributes of variables.
@@ -2353,15 +2353,17 @@ void hack (union foo);
hack ((union foo) x);
@end smallexample
-@node Mixed Declarations
-@section Mixed Declarations and Code
+@node Mixed Labels and Declarations
+@section Mixed Declarations, Labels and Code
@cindex mixed declarations and code
@cindex declarations, mixed with code
@cindex code, mixed with declarations
ISO C99 and ISO C++ allow declarations and code to be freely mixed
-within compound statements. As an extension, GNU C also allows this in
-C90 mode. For example, you could do:
+within compound statements. ISO C2X allows labels to be
+placed before declarations and at the end of a compound statement.
+As an extension, GNU C also allows all this in C90 mode. For example,
+you could do:
@smallexample
int i;
@@ -3680,6 +3682,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
@@ -3992,6 +3998,92 @@ performing a link with relocatable output (i.e.@: @code{ld -r}) on them.
A declaration to which @code{weakref} is attached and that is associated
with a named @code{target} must be @code{static}.
+@item zero_call_used_regs ("@var{choice}")
+@cindex @code{zero_call_used_regs} function attribute
+
+The @code{zero_call_used_regs} attribute causes the compiler to zero
+a subset of all call-used registers@footnote{A ``call-used'' register
+is a register whose contents can be changed by a function call;
+therefore, a caller cannot assume that the register has the same contents
+on return from the function as it had before calling the function. Such
+registers are also called ``call-clobbered'', ``caller-saved'', or
+``volatile''.} at function return.
+This is used to increase program security by either mitigating
+Return-Oriented Programming (ROP) attacks or preventing information leakage
+through registers.
+
+In order to satisfy users with different security needs and control the
+run-time overhead at the same time, the @var{choice} parameter provides a
+flexible way to choose the subset of the call-used registers to be zeroed.
+The three basic values of @var{choice} are:
+
+@itemize @bullet
+@item
+@samp{skip} doesn't zero any call-used registers.
+
+@item
+@samp{used} only zeros call-used registers that are used in the function.
+A ``used'' register is one whose content has been set or referenced in
+the function.
+
+@item
+@samp{all} zeros all call-used registers.
+@end itemize
+
+In addition to these three basic choices, it is possible to modify
+@samp{used} or @samp{all} as follows:
+
+@itemize @bullet
+@item
+Adding @samp{-gpr} restricts the zeroing to general-purpose registers.
+
+@item
+Adding @samp{-arg} restricts the zeroing to registers that can sometimes
+be used to pass function arguments. This includes all argument registers
+defined by the platform's calling conversion, regardless of whether the
+function uses those registers for function arguments or not.
+@end itemize
+
+The modifiers can be used individually or together. If they are used
+together, they must appear in the order above.
+
+The full list of @var{choice}s is therefore:
+
+@table @code
+@item skip
+doesn't zero any call-used register.
+
+@item used
+only zeros call-used registers that are used in the function.
+
+@item used-gpr
+only zeros call-used general purpose registers that are used in the function.
+
+@item used-arg
+only zeros call-used registers that are used in the function and pass arguments.
+
+@item used-gpr-arg
+only zeros call-used general purpose registers that are used in the function
+and pass arguments.
+
+@item all
+zeros all call-used registers.
+
+@item all-gpr
+zeros all call-used general purpose registers.
+
+@item all-arg
+zeros all call-used registers that pass arguments.
+
+@item all-gpr-arg
+zeros all call-used general purpose registers that pass
+arguments.
+@end table
+
+Of this list, @samp{used-arg}, @samp{used-gpr-arg}, @samp{all-arg},
+and @samp{all-gpr-arg} are mainly used for ROP mitigation.
+
+The default for the attribute is controlled by @option{-fzero-call-used-regs}.
@end table
@c This is the end of the target-independent attribute table
@@ -6638,6 +6730,26 @@ Enable/disable the generation of the AMX-INT8 instructions.
@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 kl
+@itemx no-kl
+@cindex @code{target("kl")} function attribute, x86
+Enable/disable the generation of the KEYLOCKER instructions.
+
+@item widekl
+@itemx no-widekl
+@cindex @code{target("widekl")} function attribute, x86
+Enable/disable the generation of the WIDEKL instructions.
+
@item cld
@itemx no-cld
@cindex @code{target("cld")} function attribute, x86
@@ -8520,7 +8632,8 @@ details of the exact syntax for using attributes. Other attributes are
available for functions (@pxref{Function Attributes}), variables
(@pxref{Variable Attributes}), enumerators (@pxref{Enumerator Attributes}),
statements (@pxref{Statement Attributes}), and for types
-(@pxref{Type Attributes}).
+(@pxref{Type Attributes}). A label attribute followed
+by a declaration appertains to the label and not the declaration.
This example uses the @code{cold} label attribute to indicate the
@code{ErrorHandling} branch is unlikely to be taken and that the
@@ -13755,6 +13868,18 @@ to be a signaling NaN@. The @code{nans} function is proposed by
@uref{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n965.htm,,WG14 N965}.
@end deftypefn
+@deftypefn {Built-in Function} _Decimal32 __builtin_nansd32 (const char *str)
+Similar to @code{__builtin_nans}, except the return type is @code{_Decimal32}.
+@end deftypefn
+
+@deftypefn {Built-in Function} _Decimal64 __builtin_nansd64 (const char *str)
+Similar to @code{__builtin_nans}, except the return type is @code{_Decimal64}.
+@end deftypefn
+
+@deftypefn {Built-in Function} _Decimal128 __builtin_nansd128 (const char *str)
+Similar to @code{__builtin_nans}, except the return type is @code{_Decimal128}.
+@end deftypefn
+
@deftypefn {Built-in Function} float __builtin_nansf (const char *str)
Similar to @code{__builtin_nans}, except the return type is @code{float}.
@end deftypefn
@@ -17650,6 +17775,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
@@ -20116,15 +20272,28 @@ __int128 vec_vsubuqm (__int128, __int128);
__uint128 vec_vsubuqm (__uint128, __uint128);
vector __int128 __builtin_bcdadd (vector __int128, vector __int128, const int);
+vector unsigned char __builtin_bcdadd (vector unsigned char, vector unsigned char,
+ const int);
int __builtin_bcdadd_lt (vector __int128, vector __int128, const int);
+int __builtin_bcdadd_lt (vector unsigned char, vector unsigned char, const int);
int __builtin_bcdadd_eq (vector __int128, vector __int128, const int);
+int __builtin_bcdadd_eq (vector unsigned char, vector unsigned char, const int);
int __builtin_bcdadd_gt (vector __int128, vector __int128, const int);
+int __builtin_bcdadd_gt (vector unsigned char, vector unsigned char, const int);
int __builtin_bcdadd_ov (vector __int128, vector __int128, const int);
+int __builtin_bcdadd_ov (vector unsigned char, vector unsigned char, const int);
+
vector __int128 __builtin_bcdsub (vector __int128, vector __int128, const int);
+vector unsigned char __builtin_bcdsub (vector unsigned char, vector unsigned char,
+ const int);
int __builtin_bcdsub_lt (vector __int128, vector __int128, const int);
+int __builtin_bcdsub_lt (vector unsigned char, vector unsigned char, const int);
int __builtin_bcdsub_eq (vector __int128, vector __int128, const int);
+int __builtin_bcdsub_eq (vector unsigned char, vector unsigned char, const int);
int __builtin_bcdsub_gt (vector __int128, vector __int128, const int);
+int __builtin_bcdsub_gt (vector unsigned char, vector unsigned char, const int);
int __builtin_bcdsub_ov (vector __int128, vector __int128, const int);
+int __builtin_bcdsub_ov (vector unsigned char, vector unsigned char, const int);
@end smallexample
@node PowerPC AltiVec Built-in Functions Available on ISA 3.0
@@ -21599,10 +21768,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/install.texi b/gcc/doc/install.texi
index 5330bf3..ed737d1 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1252,6 +1252,37 @@ If @option{--with-multilib-list} is not given, then only 32-bit and
64-bit run-time libraries will be enabled.
@end table
+@item --with-multilib-generator=@var{config}
+Specify what multilibs to build. @var{config} is a semicolon separated list of
+values, possibly consisting of a single value. Currently only implemented
+for riscv*-*-elf*. The accepted values and meanings are given below.
+
+
+Every config is constructed with four components: architecture string, ABI,
+reuse rule with architecture string and reuse rule with sub-extension.
+
+Example 1: Add multi-lib suppport for rv32i with ilp32.
+@smallexample
+rv32i-ilp32--
+@end smallexample
+
+Example 2: Add multi-lib suppport for rv32i with ilp32 and rv32imafd with ilp32.
+@smallexample
+rv32i-ilp32--;rv32imafd-ilp32--
+@end smallexample
+
+Example 3: Add multi-lib suppport for rv32i with ilp32; rv32im with ilp32 and
+rv32ic with ilp32 will reuse this multi-lib set.
+@smallexample
+rv32i-ilp32-rv32im-c
+@end smallexample
+
+Example 4: Add multi-lib suppport for rv64ima with lp64; rv64imaf with lp64,
+rv64imac with lp64 and rv64imafc with lp64 will reuse this multi-lib set.
+@smallexample
+rv64ima-lp64--f,c,fc
+@end smallexample
+
@item --with-endian=@var{endians}
Specify what endians to use.
Currently only implemented for sh*-*-*.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c8281ec..d01beb2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -239,7 +239,8 @@ in the following sections.
-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-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion @gol
+-Weffc++ -Wno-exceptions -Wextra-semi -Wno-inaccessible-base @gol
-Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
-Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-tags @gol
-Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
@@ -252,7 +253,8 @@ in the following sections.
-Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
-Wsized-deallocation -Wsuggest-final-methods @gol
-Wsuggest-final-types -Wsuggest-override @gol
--Wno-terminate -Wuseless-cast -Wvirtual-inheritance @gol
+-Wno-terminate -Wuseless-cast -Wno-vexing-parse @gol
+-Wvirtual-inheritance @gol
-Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
@item Objective-C and Objective-C++ Language Options
@@ -363,6 +365,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
@@ -552,7 +555,7 @@ Objective-C and Objective-C++ Dialects}.
-funit-at-a-time -funroll-all-loops -funroll-loops @gol
-funsafe-math-optimizations -funswitch-loops @gol
-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
--fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
+-fweb -fwhole-program -fwpa -fuse-linker-plugin -fzero-call-used-regs @gol
--param @var{name}=@var{value}
-O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
@@ -635,7 +638,7 @@ Objective-C and Objective-C++ Dialects}.
-fno-gnu-unique @gol
-finhibit-size-directive -fcommon -fno-ident @gol
-fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
--fno-jump-tables @gol
+-fno-jump-tables -fno-bit-tests @gol
-frecord-gcc-switches @gol
-freg-struct-return -fshort-enums -fshort-wchar @gol
-fverbose-asm -fpack-struct[=@var{n}] @gol
@@ -1109,7 +1112,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
@@ -1364,9 +1367,10 @@ 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@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
+-mkl -mwidekl @gol
-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
@@ -3357,6 +3361,42 @@ warning is enabled by @option{-Wextra}. With
@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
user-provided destructor.
+@item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
+@opindex Wdeprecated-enum-enum-conversion
+@opindex Wno-deprecated-enum-enum-conversion
+Disable the warning about the case when the usual arithmetic conversions
+are applied on operands where one is of enumeration type and the other is
+of a different enumeration type. This conversion was deprecated in C++20.
+For example:
+
+@smallexample
+enum E1 @{ e @};
+enum E2 @{ f @};
+int k = f - e;
+@end smallexample
+
+@option{-Wdeprecated-enum-enum-conversion} is enabled by default with
+@option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
+by @option{-Wenum-conversion}.
+
+@item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
+@opindex Wdeprecated-enum-float-conversion
+@opindex Wno-deprecated-enum-float-conversion
+Disable the warning about the case when the usual arithmetic conversions
+are applied on operands where one is of enumeration type and the other is
+of a floating-point type. This conversion was deprecated in C++20. For
+example:
+
+@smallexample
+enum E1 @{ e @};
+enum E2 @{ f @};
+bool b = e <= 3.7;
+@end smallexample
+
+@option{-Wdeprecated-enum-float-conversion} is enabled by default with
+@option{-std=c++20}. In pre-C++20 dialects, this warning can be enabled
+by @option{-Wenum-conversion}.
+
@item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
@opindex Winit-list-lifetime
@opindex Wno-init-list-lifetime
@@ -3699,6 +3739,12 @@ When selecting this option, be aware that the standard library
headers do not obey all of these guidelines; use @samp{grep -v}
to filter out those warnings.
+@item -Wno-exceptions @r{(C++ and Objective-C++ only)}
+@opindex Wexceptions
+@opindex Wno-exceptions
+Disable the warning about the case when an exception handler is shadowed by
+another handler, which can point out a wrong ordering of exception handlers.
+
@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
@opindex Wstrict-null-sentinel
@opindex Wno-strict-null-sentinel
@@ -3847,6 +3893,37 @@ use the STL. One may also use using directives and qualified names.
Disable the warning about a throw-expression that will immediately
result in a call to @code{terminate}.
+@item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
+@opindex Wvexing-parse
+@opindex Wno-vexing-parse
+Warn about the most vexing parse syntactic ambiguity. This warns about
+the cases when a declaration looks like a variable definition, but the
+C++ language requires it to be interpreted as a function declaration.
+For instance:
+
+@smallexample
+void f(double a) @{
+ int i(); // extern int i (void);
+ int n(int(a)); // extern int n (int);
+@}
+@end smallexample
+
+Another example:
+
+@smallexample
+struct S @{ S(int); @};
+void f(double a) @{
+ S x(int(a)); // extern struct S x (int);
+ S y(int()); // extern struct S y (int (*) (void));
+ S z(); // extern struct S z (void);
+@}
+@end smallexample
+
+The warning will suggest options how to deal with such an ambiguity; e.g.,
+it can suggest removing the parentheses or using braces instead.
+
+This warning is enabled by default.
+
@item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
@opindex Wno-class-conversion
@opindex Wclass-conversion
@@ -5270,7 +5347,6 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wcomment @gol
-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
--Wenum-conversion @r{in C/ObjC;} @gol
-Wformat @gol
-Wformat-overflow @gol
-Wformat-truncation @gol
@@ -5301,6 +5377,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-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
@@ -5338,6 +5415,7 @@ name is still supported, but the newer name is more descriptive.)
-Wcast-function-type @gol
-Wdeprecated-copy @r{(C++ only)} @gol
-Wempty-body @gol
+-Wenum-conversion @r{(C only)} @gol
-Wignored-qualifiers @gol
-Wimplicit-fallthrough=3 @gol
-Wmissing-field-initializers @gol
@@ -6859,37 +6937,28 @@ const char* f (enum Color clr)
Option @option{-Wstringop-overflow=2} is enabled by default.
-@item -Wno-stringop-overread
-@opindex Wstringop-overread
-@opindex Wno-stringop-overread
-Warn for calls to string manipulation functions such as @code{memchr},
-@code{strcpy} that are determined to read past the end of the source
-sequence.
-
-Option @option{-Wstringop-overread} is enabled by default.
-
@table @gcctabopt
@item -Wstringop-overflow
@itemx -Wstringop-overflow=1
@opindex Wstringop-overflow
@opindex Wno-stringop-overflow
The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
-to determine the sizes of destination objects. This is the default setting
-of the option. At this setting the option does not warn for writes past
-the end of subobjects of larger objects accessed by pointers unless the
-size of the largest surrounding object is known. When the destination may
-be one of several objects it is assumed to be the largest one of them. On
-Linux systems, when optimization is enabled at this setting the option warns
-for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
-a non-zero value.
+to determine the sizes of destination objects. At this setting the option
+does not warn for writes past the end of subobjects of larger objects accessed
+by pointers unless the size of the largest surrounding object is known. When
+the destination may be one of several objects it is assumed to be the largest
+one of them. On Linux systems, when optimization is enabled at this setting
+the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
+is defined to a non-zero value.
@item -Wstringop-overflow=2
The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
to determine the sizes of destination objects. At this setting the option
-warna about overflows when writing to members of the largest complete
+warns about overflows when writing to members of the largest complete
objects whose exact size is known. However, it does not warn for excessive
writes to the same members of unknown objects referenced by pointers since
-they may point to arrays containing unknown numbers of elements.
+they may point to arrays containing unknown numbers of elements. This is
+the default setting of the option.
@item -Wstringop-overflow=3
The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
@@ -6907,6 +6976,15 @@ whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
setting of the option may result in warnings for benign code.
@end table
+@item -Wno-stringop-overread
+@opindex Wstringop-overread
+@opindex Wno-stringop-overread
+Warn for calls to string manipulation functions such as @code{memchr}, or
+@code{strcpy} that are determined to read past the end of the source
+sequence.
+
+Option @option{-Wstringop-overread} is enabled by default.
+
@item -Wno-stringop-truncation
@opindex Wstringop-truncation
@opindex Wno-stringop-truncation
@@ -7552,7 +7630,7 @@ except when the same as the default promotion.
@opindex Wno-declaration-after-statement
Warn when a declaration is found after a statement in a block. This
construct, known from C++, was introduced with ISO C99 and is by default
-allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
+allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Labels and Declarations}.
@item -Wshadow
@opindex Wshadow
@@ -8004,11 +8082,12 @@ In C++ enumerated type mismatches in conditional expressions are also
diagnosed and the warning is enabled by default. In C this warning is
enabled by @option{-Wall}.
-@item -Wenum-conversion @r{(C, Objective-C only)}
+@item -Wenum-conversion
@opindex Wenum-conversion
@opindex Wno-enum-conversion
Warn when a value of enumerated type is implicitly converted to a
-different enumerated type. This warning is enabled by @option{-Wextra}.
+different enumerated type. This warning is enabled by @option{-Wextra}
+in C@.
@item -Wjump-misses-init @r{(C, Objective-C only)}
@opindex Wjump-misses-init
@@ -8055,6 +8134,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
@@ -11774,7 +11870,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
@@ -12590,6 +12686,19 @@ int foo (void)
Not all targets support this option.
+@item -fzero-call-used-regs=@var{choice}
+@opindex fzero-call-used-regs
+Zero call-used registers at function return to increase program
+security by either mitigating Return-Oriented Programming (ROP)
+attacks or preventing information leakage through registers.
+
+The possible values of @var{choice} are the same as for the
+@code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
+The default is @samp{skip}.
+
+You can control this behavior for a specific function by using the function
+attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
+
@item --param @var{name}=@var{value}
@opindex param
In some places, GCC uses various constants to control the amount of
@@ -13337,6 +13446,11 @@ is aborted and the load or store is not considered redundant. The
number of queries is algorithmically limited to the number of
stores on all paths from the load to the function entry.
+@item max-pre-hoist-insert-iterations
+The maximum number of iterations doing insertion during code
+hoisting which is done as part of the partial redundancy elimination
+insertion phase.
+
@item ira-max-loops-num
IRA uses regional register allocation by default. If a function
contains more loops than the number given by this parameter, only at most
@@ -13456,6 +13570,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.
@@ -13727,10 +13844,6 @@ code to iterate. 2 allows partial vector loads and stores in all loops.
The parameter only has an effect on targets that support partial
vector loads and stores.
-@item slp-max-insns-in-bb
-Maximum number of instructions in basic block to be
-considered for SLP vectorization.
-
@item avoid-fma-max-bits
Maximum number of bits for which we avoid creating FMAs.
@@ -15876,6 +15989,12 @@ building code that forms part of a dynamic linker and cannot
reference the address of a jump table. On some targets, jump tables
do not require a GOT and this option is not needed.
+@item -fno-bit-tests
+@opindex fno-bit-tests
+@opindex fbit-tests
+Do not use bit tests for switch statements even where it would be
+more efficient than other code generation strategies.
+
@item -ffixed-@var{reg}
@opindex ffixed
Treat the register named @var{reg} as a fixed register; generated code
@@ -25611,11 +25730,10 @@ 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
@@ -25998,14 +26116,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
@@ -29394,14 +29528,14 @@ BMI, BMI2 and F16C instruction set support.
@item broadwell
Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
-SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
-BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
+SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2,
+F16C, RDSEED and ADCX instruction set support.
@item skylake
Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
-BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
-XSAVES instruction set support.
+BMI, BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC and XSAVES instruction set
+support.
@item bonnell
Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
@@ -29409,52 +29543,53 @@ instruction set support.
@item silvermont
Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
-SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
+SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL and RDRND instruction set support.
@item goldmont
Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
-SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
-instruction set support.
+SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
+XSAVEOPT and FSGSBASE instruction set support.
@item goldmont-plus
Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
-SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
-PTWRITE, RDPID, SGX and UMIP instruction set support.
+SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
+XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP instruction set support.
@item tremont
Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
-SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
-RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
+SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
+XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI,
+MOVDIR64B, CLDEMOTE and WAITPKG instruction set support.
@item knl
Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
-BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
+BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER and
AVX512CD instruction set support.
@item knm
Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
-BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
+BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER, AVX512CD,
AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
@item skylake-avx512
Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
-BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
+BMI, BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
@item cannonlake
Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
-RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
+RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC,
XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
AVX512IFMA, SHA and UMIP instruction set support.
@item icelake-client
Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
-RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
+RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC,
XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
@@ -29462,7 +29597,7 @@ AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
@item icelake-server
Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
-RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
+RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC,
XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
@@ -29471,37 +29606,37 @@ set support.
@item cascadelake
Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
-BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
+BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
@item cooperlake
Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
-BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
+BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
set support.
@item tigerlake
Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
-BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
-AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
-RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
-VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
-set support.
+BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
+AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP, RDPID,
+GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES,
+PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
+instruction set support.
@item sapphirerapids
Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND,
-FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES,
-AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16,
-MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG,
-SERIALIZE and TSXLDTRK instruction set support.
+FMA, BMI, BMI2, F16C, RDSEED, ADCX, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
+AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI, AVX512BF16, MOVDIRI,
+MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE,
+TSXLDTRK, UINTR, AMX-BF16, AMX-TILE and AMX-INT8 instruction set support.
@item alderlake
Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, CLDEMOTE,
-PTWRITE, WAITPKG and SERIALIZE instruction set support.
+PTWRITE, WAITPKG, SERIALIZE, KEYLOCKER and HRESET instruction set support.
@item k6
AMD K6 CPU with MMX instruction set support.
@@ -30256,6 +30391,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
@@ -30289,6 +30426,14 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@need 200
@itemx -mamx-bf16
@opindex mamx-bf16
+@need 200
+@itemx -mhreset
+@opindex mhreset
+@itemx -mkl
+@opindex mkl
+@need 200
+@itemx -mwidekl
+@opindex mwidekl
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,
@@ -30297,9 +30442,10 @@ 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
-@option{-mno-} option to disable use of these instructions.
+ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
+UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL or CLDEMOTE extended
+instruction sets. Each has a corresponding @option{-mno-} option to disable
+use of these instructions.
These extensions are also available as built-in functions: see
@ref{x86 Built-in Functions}, for details of the functions enabled and
@@ -31662,6 +31808,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/md.texi b/gcc/doc/md.texi
index 2b46286..813875b 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -1634,7 +1634,7 @@ constraints with multiple alternatives, sometimes one alternative
requires @samp{&} while others do not. See, for example, the
@samp{movdf} insn of the 68000.
-A operand which is read by the instruction can be tied to an earlyclobber
+An operand which is read by the instruction can be tied to an earlyclobber
operand if its only use as an input occurs before the early result is
written. Adding alternatives of this form often allows GCC to produce
better code when only some of the read operands can be affected by the
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 49316a5..b3c5e53 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2356,6 +2356,11 @@ Target provides @file{fenv.h} include file.
Target supports @file{fenv.h} with all the standard IEEE exceptions
and floating-point exceptions are raised by arithmetic operations.
+@item fenv_exceptions_dfp
+Target supports @file{fenv.h} with all the standard IEEE exceptions
+and floating-point exceptions are raised by arithmetic operations for
+decimal floating point.
+
@item fileio
Target offers such file I/O library functions as @code{fopen},
@code{fclose}, @code{tmpnam}, and @code{remove}. This is a link-time
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 97437e8..833320b 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10817,13 +10817,6 @@ Similarly to @code{TARGET_D_CPU_VERSIONS}, but is used for versions
relating to the target operating system.
@end deftypefn
-@deftypefn {D Target Hook} unsigned TARGET_D_CRITSEC_SIZE (void)
-Returns the size of the data structure used by the target operating system
-for critical sections and monitors. For example, on Microsoft Windows this
-would return the @code{sizeof(CRITICAL_SECTION)}, while other platforms that
-implement pthreads would return @code{sizeof(pthread_mutex_t)}.
-@end deftypefn
-
@node Named Address Spaces
@section Adding support for named address spaces
@cindex named address spaces
@@ -12053,6 +12046,18 @@ argument list due to stack realignment. Return @code{NULL} if no DRAP
is needed.
@end deftypefn
+@deftypefn {Target Hook} HARD_REG_SET TARGET_ZERO_CALL_USED_REGS (HARD_REG_SET @var{selected_regs})
+This target hook emits instructions to zero the subset of @var{selected_regs}
+that could conceivably contain values that are useful to an attacker.
+Return the set of registers that were actually cleared.
+
+The default implementation uses normal move instructions to zero
+all the registers in @var{selected_regs}. Define this hook if the
+target has more efficient ways of zeroing certain registers,
+or if you believe that certain registers would never contain
+values that are useful to an attacker.
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS (void)
When optimization is disabled, this hook indicates whether or not
arguments should be allocated to stack slots. Normally, GCC allocates
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 412e22c..58109be 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7351,8 +7351,6 @@ floating-point support; they are not included in this mechanism.
@hook TARGET_D_OS_VERSIONS
-@hook TARGET_D_CRITSEC_SIZE
-
@node Named Address Spaces
@section Adding support for named address spaces
@cindex named address spaces
@@ -8111,6 +8109,8 @@ and the associated definitions of those functions.
@hook TARGET_GET_DRAP_RTX
+@hook TARGET_ZERO_CALL_USED_REGS
+
@hook TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
@hook TARGET_CONST_ANCHOR
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ba93a6c..bc32a17 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -5974,6 +5974,7 @@ maybe_create_die_with_external_ref (tree decl)
const char *sym = desc->sym;
unsigned HOST_WIDE_INT off = desc->off;
+ external_die_map->remove (decl);
in_lto_p = false;
dw_die_ref die = (TREE_CODE (decl) == BLOCK
@@ -11884,7 +11885,7 @@ asm_outputs_debug_line_str (void)
return true;
else
{
-#if defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) && defined(HAVE_AS_WORKING_DWARF_4_FLAG)
+#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;
@@ -12854,7 +12855,7 @@ base_type_die (tree type, bool reverse)
if ((dwarf_version >= 4 || !dwarf_strict)
&& TYPE_NAME (type)
&& TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
- && DECL_IS_BUILTIN (TYPE_NAME (type))
+ && DECL_IS_UNDECLARED_BUILTIN (TYPE_NAME (type))
&& DECL_NAME (TYPE_NAME (type)))
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
@@ -21292,7 +21293,16 @@ add_abstract_origin_attribute (dw_die_ref die, tree origin)
here. */
if (origin_die)
- add_AT_die_ref (die, DW_AT_abstract_origin, origin_die);
+ {
+ dw_attr_node *a;
+ /* Like above, if we already created a concrete instance DIE
+ do not use that for the abstract origin but the early DIE
+ if present. */
+ if (in_lto_p
+ && (a = get_AT (origin_die, DW_AT_abstract_origin)))
+ origin_die = AT_ref (a);
+ add_AT_die_ref (die, DW_AT_abstract_origin, origin_die);
+ }
}
/* We do not currently support the pure_virtual attribute. */
@@ -26036,7 +26046,7 @@ is_naming_typedef_decl (const_tree decl)
|| TREE_CODE (decl) != TYPE_DECL
|| DECL_NAMELESS (decl)
|| !is_tagged_type (TREE_TYPE (decl))
- || DECL_IS_BUILTIN (decl)
+ || DECL_IS_UNDECLARED_BUILTIN (decl)
|| is_redundant_typedef (decl)
/* It looks like Ada produces TYPE_DECLs that are very similar
to C++ naming typedefs but that have different
@@ -26948,7 +26958,7 @@ dwarf2out_decl (tree decl)
/* Don't bother trying to generate any DIEs to represent any of the
normal built-in types for the language we are compiling. */
- if (DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl))
return;
/* If we are in terse mode, don't generate any DIEs for types. */
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index 92ad0dd6..4658c4a 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -310,6 +310,9 @@ struct GTY(()) rtl_data {
sets them. */
HARD_REG_SET asm_clobbers;
+ /* All hard registers that need to be zeroed at the return of the routine. */
+ HARD_REG_SET must_be_zero_on_return;
+
/* The highest address seen during shorten_branches. */
int max_insn_address;
};
diff --git a/gcc/expr.c b/gcc/expr.c
index 1c79518..ae16f07 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -96,7 +96,6 @@ static void emit_single_push_insn (machine_mode, rtx, tree);
static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx,
profile_probability);
static rtx const_vector_from_tree (tree);
-static rtx const_scalar_mask_from_tree (scalar_int_mode, tree);
static tree tree_expr_size (const_tree);
static HOST_WIDE_INT int_expr_size (tree);
static void convert_mode_scalar (rtx, rtx, int);
@@ -5168,6 +5167,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))
@@ -10354,16 +10355,10 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
scalar_int_mode int_mode;
if (is_int_mode (mode, &int_mode))
{
- if (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (exp)))
- return const_scalar_mask_from_tree (int_mode, exp);
- else
- {
- tree type_for_mode
- = lang_hooks.types.type_for_mode (int_mode, 1);
- if (type_for_mode)
- tmp = fold_unary_loc (loc, VIEW_CONVERT_EXPR,
- type_for_mode, exp);
- }
+ tree type_for_mode = lang_hooks.types.type_for_mode (int_mode, 1);
+ if (type_for_mode)
+ tmp = fold_unary_loc (loc, VIEW_CONVERT_EXPR,
+ type_for_mode, exp);
}
if (!tmp)
{
@@ -12737,30 +12732,6 @@ const_vector_mask_from_tree (tree exp)
return builder.build ();
}
-/* EXP is a VECTOR_CST in which each element is either all-zeros or all-ones.
- Return a constant scalar rtx of mode MODE in which bit X is set if element
- X of EXP is nonzero. */
-static rtx
-const_scalar_mask_from_tree (scalar_int_mode mode, tree exp)
-{
- wide_int res = wi::zero (GET_MODE_PRECISION (mode));
- tree elt;
-
- /* The result has a fixed number of bits so the input must too. */
- unsigned int nunits = VECTOR_CST_NELTS (exp).to_constant ();
- for (unsigned int i = 0; i < nunits; ++i)
- {
- elt = VECTOR_CST_ELT (exp, i);
- gcc_assert (TREE_CODE (elt) == INTEGER_CST);
- if (integer_all_onesp (elt))
- res = wi::set_bit (res, i);
- else
- gcc_assert (integer_zerop (elt));
- }
-
- return immed_wide_int_const (res, mode);
-}
-
/* Return a CONST_VECTOR rtx for a VECTOR_CST tree. */
static rtx
const_vector_from_tree (tree exp)
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index cd0f7f8..a887c75 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_FLAG_TYPES_H
#define GCC_FLAG_TYPES_H
+#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)
+
enum debug_info_type
{
NO_DEBUG, /* Write no debug info. */
@@ -285,6 +287,24 @@ enum sanitize_code {
| SANITIZE_BOUNDS_STRICT
};
+/* Different settings for zeroing subset of registers. */
+namespace zero_regs_flags {
+ const unsigned int UNSET = 0;
+ const unsigned int SKIP = 1UL << 0;
+ const unsigned int ONLY_USED = 1UL << 1;
+ const unsigned int ONLY_GPR = 1UL << 2;
+ const unsigned int ONLY_ARG = 1UL << 3;
+ const unsigned int ENABLED = 1UL << 4;
+ const unsigned int USED_GPR_ARG = ENABLED | ONLY_USED | ONLY_GPR | ONLY_ARG;
+ const unsigned int USED_GPR = ENABLED | ONLY_USED | ONLY_GPR;
+ const unsigned int USED_ARG = ENABLED | ONLY_USED | ONLY_ARG;
+ const unsigned int USED = ENABLED | ONLY_USED;
+ const unsigned int ALL_GPR_ARG = ENABLED | ONLY_GPR | ONLY_ARG;
+ const unsigned int ALL_GPR = ENABLED | ONLY_GPR;
+ const unsigned int ALL_ARG = ENABLED | ONLY_ARG;
+ const unsigned int ALL = ENABLED;
+}
+
/* Settings of flag_incremental_link. */
enum incremental_link {
INCREMENTAL_LINK_NONE,
@@ -395,4 +415,6 @@ enum evrp_mode
EVRP_MODE_RVRP_DEBUG = EVRP_MODE_RVRP_ONLY | EVRP_MODE_DEBUG
};
+#endif
+
#endif /* ! GCC_FLAG_TYPES_H */
diff --git a/gcc/fold-const-call.c b/gcc/fold-const-call.c
index 11ed47d..3548fab 100644
--- a/gcc/fold-const-call.c
+++ b/gcc/fold-const-call.c
@@ -1300,6 +1300,9 @@ fold_const_call (combined_fn fn, tree type, tree arg)
CASE_CFN_NANS:
CASE_FLT_FN_FLOATN_NX (CFN_BUILT_IN_NANS):
+ case CFN_BUILT_IN_NANSD32:
+ case CFN_BUILT_IN_NANSD64:
+ case CFN_BUILT_IN_NANSD128:
return fold_const_builtin_nan (type, arg, false);
case CFN_REDUC_PLUS:
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 0cc80ad..c47557d 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);
}
@@ -15563,11 +15565,6 @@ getbyterep (tree src, unsigned HOST_WIDE_INT *strsize)
is equal to strlen (A) + 1. */
const unsigned HOST_WIDE_INT array_size = tree_to_uhwi (mem_size);
unsigned HOST_WIDE_INT init_bytes = TREE_STRING_LENGTH (src);
-
- /* Ideally this would turn into a gcc_checking_assert over time. */
- if (init_bytes > array_size)
- init_bytes = array_size;
-
const char *string = TREE_STRING_POINTER (src);
/* Ideally this would turn into a gcc_checking_assert over time. */
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 8de4b38..f5c6066 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,189 @@
+2020-11-09 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/90111
+ * parse.c (case_decl): Move ST_OACC_ROUTINE and ST_OACC_DECLARE to ...
+ (case_omp_decl): ... here.
+ (verify_st_order): Update comment.
+
+2020-11-06 Thomas Schwinge <thomas@codesourcery.com>
+
+ * openmp.c (oacc_is_parallel, resolve_oacc_params_in_parallel):
+ Remove.
+ (resolve_oacc_loop_blocks): Don't call the former.
+
+2020-11-06 Tobias Burnus <tobias@codesourcery.com>
+
+ * openmp.c (gfc_match_oacc_atomic): No longer accept 'update capture'.
+
+2020-11-06 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97652
+ * module.c (mio_symbol): Fix symbol name for pdt_type.
+
+2020-11-03 Nathan Sidwell <nathan@acm.org>
+
+ * cpp.c (gfc_cpp_add_dep): Only add dependency if we're recording
+ them.
+ (gfc_cpp_init): Likewise for target.
+
+2020-11-03 Tobias Burnus <tobias@codesourcery.com>
+
+ * decl.c (ext_attr_list): Add EXT_ATTR_DEPRECATED.
+ * gfortran.h (ext_attr_id_t): Ditto.
+ * gfortran.texi (GCC$ ATTRIBUTES): Document it.
+ * resolve.c (resolve_variable, resolve_function,
+ resolve_call, resolve_values): Show -Wdeprecated-declarations warning.
+ * trans-decl.c (add_attributes_to_decl): Skip those
+ with no middle_end_name.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR fortran/92793
+ * trans-openmp.c (gfc_trans_omp_clauses): More precise location
+ information for OpenACC 'gang', 'worker', 'vector' clauses with
+ argument.
+
+2020-11-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR fortran/92793
+ * trans.c (gfc_set_backend_locus): Use 'gfc_get_location'.
+ (gfc_restore_backend_locus): Adjust.
+
+2020-11-02 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97655
+ * openmp.c (gfc_match_omp_atomic): Fix mem-order handling;
+ reject specifying update + capture together.
+
+2020-10-30 Tobias Burnus <tobias@codesourcery.com>
+
+ * dump-parse-tree.c (show_omp_clauses): Handle atomic clauses.
+ (show_omp_node): Call it for atomic.
+ * gfortran.h (enum gfc_omp_atomic_op): Add GFC_OMP_ATOMIC_UNSET,
+ remove GFC_OMP_ATOMIC_SEQ_CST and GFC_OMP_ATOMIC_ACQ_REL.
+ (enum gfc_omp_memorder): Replace OMP_MEMORDER_LAST by
+ OMP_MEMORDER_UNSET, add OMP_MEMORDER_SEQ_CST/OMP_MEMORDER_RELAXED.
+ (gfc_omp_clauses): Add capture and atomic_op.
+ (gfc_code): remove omp_atomic.
+ * openmp.c (enum omp_mask1): Add atomic, capture, memorder clauses.
+ (gfc_match_omp_clauses): Match them.
+ (OMP_ATOMIC_CLAUSES): Add.
+ (gfc_match_omp_flush): Update for 'last' to 'unset' change.
+ (gfc_match_omp_oacc_atomic): Removed and placed content ..
+ (gfc_match_omp_atomic): ... here. Update for OpenMP 5 clauses.
+ (gfc_match_oacc_atomic): Match directly here.
+ (resolve_omp_atomic, gfc_resolve_omp_directive): Update.
+ * parse.c (parse_omp_oacc_atomic): Update for struct gfc_code changes.
+ * resolve.c (gfc_resolve_blocks): Update assert.
+ * st.c (gfc_free_statement): Also call for EXEC_O{ACC,MP}_ATOMIC.
+ * trans-openmp.c (gfc_trans_omp_atomic): Update.
+ (gfc_trans_omp_flush): Update for 'last' to 'unset' change.
+
+2020-10-30 Jan Hubicka <jh@suse.cz>
+
+ * trans-types.c: Include alias.h
+ (gfc_get_array_type_bounds): Set typeless storage.
+
+2020-10-27 Harald Anlauf <anlauf@gmx.de>
+
+ * resolve.c (gfc_impure_variable): A dummy argument with the VALUE
+ attribute may be redefined without making a procedure impure.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * trans-array.c (gfc_get_descriptor_field): New helper.
+ (gfc_conv_descriptor_data_get): Use it - drop strange
+ REFERENCE_TYPE handling and make sure we don't trigger it.
+ (gfc_conv_descriptor_data_addr): Use gfc_get_descriptor_field.
+ (gfc_conv_descriptor_data_set): Likewise.
+ (gfc_conv_descriptor_offset): Likewise.
+ (gfc_conv_descriptor_dtype): Likewise.
+ (gfc_conv_descriptor_span): Likewise.
+ (gfc_get_descriptor_dimension): Likewise.
+ (gfc_conv_descriptor_token): Likewise.
+ (gfc_conv_descriptor_subfield): New helper.
+ (gfc_conv_descriptor_stride): Use it.
+ (gfc_conv_descriptor_lbound): Likewise.
+ (gfc_conv_descriptor_ubound): Likewise.
+
+2020-10-25 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/97454
+ * gfortran.h (gfc_symbol): Add pass_as_value flag.
+ (gfc_copy_formal_args_intr): Add optional argument
+ copy_type.
+ (gfc_get_intrinsic_function_symbol): Add prototype.
+ (gfc_find_intrinsic_symbol): Add prototype.
+ * intrinsic.c (gfc_get_intrinsic_function_symbol): New function.
+ (gfc_find_intrinsic_symbol): New function.
+ * symbol.c (gfc_copy_formal_args_intr): Add argument. Handle case
+ where the type needs to be copied from the actual argument.
+ * trans-intrinsic.c (remove_empty_actual_arguments): New function.
+ (specific_intrinsic_symbol): New function.
+ (gfc_conv_intrinsic_funcall): Use it.
+ (strip_kind_from_actual): Adjust so that the expression pointer
+ is set to NULL.
+ (gfc_conv_intrinsic_minmaxloc): Likewise.
+ (gfc_conv_intrinsic_minmaxval): Adjust removal of dim.
+ * trans-types.c (gfc_sym_type): If sym->pass_as_value is set, do
+ not pass by reference.
+
+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
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/cpp.c b/gcc/fortran/cpp.c
index dcde557..51baf141 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -222,13 +222,15 @@ void
gfc_cpp_add_dep (const char *name, bool system)
{
if (!gfc_cpp_option.deps_skip_system || !system)
- deps_add_dep (cpp_get_deps (cpp_in), name);
+ if (mkdeps *deps = cpp_get_deps (cpp_in))
+ deps_add_dep (deps, name);
}
void
gfc_cpp_add_target (const char *name)
{
- deps_add_target (cpp_get_deps (cpp_in), name, 0);
+ if (mkdeps *deps = cpp_get_deps (cpp_in))
+ deps_add_target (deps, name, 0);
}
@@ -605,8 +607,8 @@ gfc_cpp_init (void)
cpp_assert (cpp_in, opt->arg);
}
else if (opt->code == OPT_MT || opt->code == OPT_MQ)
- deps_add_target (cpp_get_deps (cpp_in),
- opt->arg, opt->code == OPT_MQ);
+ if (mkdeps *deps = cpp_get_deps (cpp_in))
+ deps_add_target (deps, opt->arg, opt->code == OPT_MQ);
}
/* Pre-defined macros for non-required INTEGER kind types. */
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index bddf69c..93a155c 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -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);
@@ -11585,6 +11585,7 @@ const ext_attr_t ext_attr_list[] = {
{ "stdcall", EXT_ATTR_STDCALL, "stdcall" },
{ "fastcall", EXT_ATTR_FASTCALL, "fastcall" },
{ "no_arg_check", EXT_ATTR_NO_ARG_CHECK, NULL },
+ { "deprecated", EXT_ATTR_DEPRECATED, NULL },
{ NULL, EXT_ATTR_LAST, NULL }
};
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index 6e265f4..43b97ba 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -1715,6 +1715,36 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
}
if (omp_clauses->depend_source)
fputs (" DEPEND(source)", dumpfile);
+ if (omp_clauses->capture)
+ fputs (" CAPTURE", dumpfile);
+ if (omp_clauses->atomic_op != GFC_OMP_ATOMIC_UNSET)
+ {
+ const char *atomic_op;
+ switch (omp_clauses->atomic_op)
+ {
+ case GFC_OMP_ATOMIC_READ: atomic_op = "READ"; break;
+ case GFC_OMP_ATOMIC_WRITE: atomic_op = "WRITE"; break;
+ case GFC_OMP_ATOMIC_UPDATE: atomic_op = "UPDATE"; break;
+ default: gcc_unreachable ();
+ }
+ fputc (' ', dumpfile);
+ fputs (atomic_op, dumpfile);
+ }
+ if (omp_clauses->memorder != OMP_MEMORDER_UNSET)
+ {
+ const char *memorder;
+ switch (omp_clauses->memorder)
+ {
+ case OMP_MEMORDER_ACQ_REL: memorder = "ACQ_REL"; break;
+ case OMP_MEMORDER_ACQUIRE: memorder = "AQUIRE"; break;
+ case OMP_MEMORDER_RELAXED: memorder = "RELAXED"; break;
+ case OMP_MEMORDER_RELEASE: memorder = "RELEASE"; break;
+ case OMP_MEMORDER_SEQ_CST: memorder = "SEQ_CST"; break;
+ default: gcc_unreachable ();
+ }
+ fputc (' ', dumpfile);
+ fputs (memorder, dumpfile);
+ }
}
/* Show a single OpenMP or OpenACC directive node and everything underneath it
@@ -1880,6 +1910,10 @@ show_omp_node (int level, gfc_code *c)
case EXEC_OMP_TASKWAIT:
case EXEC_OMP_TASKYIELD:
return;
+ case EXEC_OACC_ATOMIC:
+ case EXEC_OMP_ATOMIC:
+ omp_clauses = c->block ? c->block->ext.omp_clauses : NULL;
+ break;
default:
break;
}
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index b87ae3d..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",
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index d0cea83..dfd7796 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -770,6 +770,7 @@ typedef enum
EXT_ATTR_CDECL,
EXT_ATTR_FASTCALL,
EXT_ATTR_NO_ARG_CHECK,
+ EXT_ATTR_DEPRECATED,
EXT_ATTR_LAST, EXT_ATTR_NUM = EXT_ATTR_LAST
}
ext_attr_id_t;
@@ -1343,6 +1344,16 @@ enum gfc_omp_if_kind
OMP_IF_LAST
};
+enum gfc_omp_atomic_op
+{
+ GFC_OMP_ATOMIC_UNSET = 0,
+ GFC_OMP_ATOMIC_UPDATE = 1,
+ GFC_OMP_ATOMIC_READ = 2,
+ GFC_OMP_ATOMIC_WRITE = 3,
+ GFC_OMP_ATOMIC_MASK = 3,
+ GFC_OMP_ATOMIC_SWAP = 16
+};
+
enum gfc_omp_requires_kind
{
/* Keep in sync with gfc_namespace, esp. with omp_req_mem_order. */
@@ -1361,6 +1372,16 @@ enum gfc_omp_requires_kind
| OMP_REQ_ATOMIC_MEM_ORDER_RELAXED)
};
+enum gfc_omp_memorder
+{
+ OMP_MEMORDER_UNSET,
+ OMP_MEMORDER_SEQ_CST,
+ OMP_MEMORDER_ACQ_REL,
+ OMP_MEMORDER_RELEASE,
+ OMP_MEMORDER_ACQUIRE,
+ OMP_MEMORDER_RELAXED
+};
+
typedef struct gfc_omp_clauses
{
struct gfc_expr *if_expr;
@@ -1375,7 +1396,9 @@ typedef struct gfc_omp_clauses
bool nowait, ordered, untied, mergeable;
bool inbranch, notinbranch, defaultmap, nogroup;
bool sched_simd, sched_monotonic, sched_nonmonotonic;
- bool simd, threads, depend_source, order_concurrent;
+ bool simd, threads, depend_source, order_concurrent, capture;
+ enum gfc_omp_atomic_op atomic_op;
+ 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 +1687,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 */
@@ -2670,18 +2696,6 @@ enum gfc_exec_op
EXEC_OMP_TASKLOOP, EXEC_OMP_TASKLOOP_SIMD
};
-enum gfc_omp_atomic_op
-{
- GFC_OMP_ATOMIC_UPDATE = 0,
- GFC_OMP_ATOMIC_READ = 1,
- GFC_OMP_ATOMIC_WRITE = 2,
- GFC_OMP_ATOMIC_CAPTURE = 3,
- GFC_OMP_ATOMIC_MASK = 3,
- GFC_OMP_ATOMIC_SEQ_CST = 4,
- GFC_OMP_ATOMIC_ACQ_REL = 8,
- GFC_OMP_ATOMIC_SWAP = 16
-};
-
typedef struct gfc_code
{
gfc_exec_op op;
@@ -2736,7 +2750,6 @@ typedef struct gfc_code
const char *omp_name;
gfc_omp_namelist *omp_namelist;
bool omp_bool;
- gfc_omp_atomic_op omp_atomic;
}
ext; /* Points to additional structures required by statement */
@@ -3239,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 */
@@ -3264,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/gfortran.texi b/gcc/fortran/gfortran.texi
index 151e3d7..453b30f 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -3639,6 +3639,9 @@ requires an explicit interface.
@itemize
@item @code{NO_ARG_CHECK} -- disable the type, kind and rank checking
+@item @code{DEPRECATED} -- print a warning when using a such-tagged
+deprecated procedure, variable or parameter; the warning can be suppressed
+with @option{-Wno-deprecated-declarations}.
@end itemize
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index ef33587..07b953a 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 c2a4865..994a9af 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -1296,11 +1296,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;
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/module.c b/gcc/fortran/module.c
index 33e7df7..4c6ff22 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4549,6 +4549,9 @@ mio_symbol (gfc_symbol *sym)
mio_symbol_attribute (&sym->attr);
+ if (sym->attr.pdt_type)
+ sym->name = gfc_dt_upper_string (sym->name);
+
/* Note that components are always saved, even if they are supposed
to be private. Component access is checked during searching. */
mio_component_list (&sym->components, sym->attr.vtype);
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 1efce33..2270c85 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -802,6 +802,9 @@ enum omp_mask1
OMP_CLAUSE_USE_DEVICE_PTR,
OMP_CLAUSE_USE_DEVICE_ADDR, /* OpenMP 5.0. */
OMP_CLAUSE_DEVICE_TYPE, /* OpenMP 5.0. */
+ OMP_CLAUSE_ATOMIC, /* OpenMP 5.0. */
+ OMP_CLAUSE_CAPTURE, /* OpenMP 5.0. */
+ OMP_CLAUSE_MEMORDER, /* OpenMP 5.0. */
OMP_CLAUSE_NOWAIT,
/* This must come last. */
OMP_MASK1_LAST
@@ -1017,6 +1020,22 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
n->expr = alignment;
continue;
}
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("acq_rel") == MATCH_YES)
+ {
+ c->memorder = OMP_MEMORDER_ACQ_REL;
+ needs_space = true;
+ continue;
+ }
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("acquire") == MATCH_YES)
+ {
+ c->memorder = OMP_MEMORDER_ACQUIRE;
+ needs_space = true;
+ continue;
+ }
if ((mask & OMP_CLAUSE_ASYNC)
&& !c->async
&& gfc_match ("async") == MATCH_YES)
@@ -1055,6 +1074,14 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
continue;
break;
case 'c':
+ if ((mask & OMP_CLAUSE_CAPTURE)
+ && !c->capture
+ && gfc_match ("capture") == MATCH_YES)
+ {
+ c->capture = true;
+ needs_space = true;
+ continue;
+ }
if ((mask & OMP_CLAUSE_COLLAPSE)
&& !c->collapse)
{
@@ -1681,6 +1708,14 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
}
break;
case 'r':
+ if ((mask & OMP_CLAUSE_ATOMIC)
+ && c->atomic_op == GFC_OMP_ATOMIC_UNSET
+ && gfc_match ("read") == MATCH_YES)
+ {
+ c->atomic_op = GFC_OMP_ATOMIC_READ;
+ needs_space = true;
+ continue;
+ }
if ((mask & OMP_CLAUSE_REDUCTION)
&& gfc_match ("reduction ( ") == MATCH_YES)
{
@@ -1801,6 +1836,22 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
else
gfc_current_locus = old_loc;
}
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("relaxed") == MATCH_YES)
+ {
+ c->memorder = OMP_MEMORDER_RELAXED;
+ needs_space = true;
+ continue;
+ }
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("release") == MATCH_YES)
+ {
+ c->memorder = OMP_MEMORDER_RELEASE;
+ needs_space = true;
+ continue;
+ }
break;
case 's':
if ((mask & OMP_CLAUSE_SAFELEN)
@@ -1885,6 +1936,14 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
needs_space = true;
continue;
}
+ if ((mask & OMP_CLAUSE_MEMORDER)
+ && c->memorder == OMP_MEMORDER_UNSET
+ && gfc_match ("seq_cst") == MATCH_YES)
+ {
+ c->memorder = OMP_MEMORDER_SEQ_CST;
+ needs_space = true;
+ continue;
+ }
if ((mask & OMP_CLAUSE_SHARED)
&& gfc_match_omp_variable_list ("shared (",
&c->lists[OMP_LIST_SHARED],
@@ -1945,6 +2004,14 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
c->untied = needs_space = true;
continue;
}
+ if ((mask & OMP_CLAUSE_ATOMIC)
+ && c->atomic_op == GFC_OMP_ATOMIC_UNSET
+ && gfc_match ("update") == MATCH_YES)
+ {
+ c->atomic_op = GFC_OMP_ATOMIC_UPDATE;
+ needs_space = true;
+ continue;
+ }
if ((mask & OMP_CLAUSE_USE_DEVICE)
&& gfc_match_omp_variable_list ("use_device (",
&c->lists[OMP_LIST_USE_DEVICE],
@@ -2026,6 +2093,14 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
needs_space = true;
continue;
}
+ if ((mask & OMP_CLAUSE_ATOMIC)
+ && c->atomic_op == GFC_OMP_ATOMIC_UNSET
+ && gfc_match ("write") == MATCH_YES)
+ {
+ c->atomic_op = GFC_OMP_ATOMIC_WRITE;
+ needs_space = true;
+ continue;
+ }
break;
}
break;
@@ -2658,6 +2733,9 @@ cleanup:
(omp_mask (OMP_CLAUSE_THREADS) | OMP_CLAUSE_SIMD)
#define OMP_DECLARE_TARGET_CLAUSES \
(omp_mask (OMP_CLAUSE_TO) | OMP_CLAUSE_LINK | OMP_CLAUSE_DEVICE_TYPE)
+#define OMP_ATOMIC_CLAUSES \
+ (omp_mask (OMP_CLAUSE_ATOMIC) | OMP_CLAUSE_CAPTURE | OMP_CLAUSE_HINT \
+ | OMP_CLAUSE_MEMORDER)
static match
@@ -2766,15 +2844,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_UNSET;
+ 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_UNSET)
+ {
+ 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;
}
@@ -3985,49 +4092,29 @@ gfc_match_omp_ordered_depend (void)
}
-static match
-gfc_match_omp_oacc_atomic (bool omp_p)
+/* omp atomic [clause-list]
+ - atomic-clause: read | write | update
+ - capture
+ - memory-order-clause: seq_cst | acq_rel | release | acquire | relaxed
+ - hint(hint-expr)
+*/
+
+match
+gfc_match_omp_atomic (void)
{
- gfc_omp_atomic_op op = GFC_OMP_ATOMIC_UPDATE;
- int seq_cst = 0;
- if (gfc_match ("% seq_cst") == MATCH_YES)
- seq_cst = 1;
- locus old_loc = gfc_current_locus;
- if (seq_cst && gfc_match_char (',') == MATCH_YES)
- seq_cst = 2;
- if (seq_cst == 2
- || gfc_match_space () == MATCH_YES)
- {
- gfc_gobble_whitespace ();
- if (gfc_match ("update") == MATCH_YES)
- op = GFC_OMP_ATOMIC_UPDATE;
- else if (gfc_match ("read") == MATCH_YES)
- op = GFC_OMP_ATOMIC_READ;
- else if (gfc_match ("write") == MATCH_YES)
- op = GFC_OMP_ATOMIC_WRITE;
- else if (gfc_match ("capture") == MATCH_YES)
- op = GFC_OMP_ATOMIC_CAPTURE;
- else
- {
- if (seq_cst == 2)
- gfc_current_locus = old_loc;
- goto finish;
- }
- if (!seq_cst
- && (gfc_match (", seq_cst") == MATCH_YES
- || gfc_match ("% seq_cst") == MATCH_YES))
- seq_cst = 1;
- }
- finish:
- if (gfc_match_omp_eos () != MATCH_YES)
- {
- gfc_error ("Unexpected junk after $OMP ATOMIC statement at %C");
- return MATCH_ERROR;
- }
- new_st.op = (omp_p ? EXEC_OMP_ATOMIC : EXEC_OACC_ATOMIC);
- if (seq_cst)
- op = (gfc_omp_atomic_op) (op | GFC_OMP_ATOMIC_SEQ_CST);
- else if (omp_p)
+ gfc_omp_clauses *c;
+ locus loc = gfc_current_locus;
+
+ if (gfc_match_omp_clauses (&c, OMP_ATOMIC_CLAUSES, true, true) != MATCH_YES)
+ return MATCH_ERROR;
+
+ if (c->capture && c->atomic_op != GFC_OMP_ATOMIC_UNSET)
+ gfc_error ("OMP ATOMIC at %L with multiple atomic clauses", &loc);
+
+ if (c->atomic_op == GFC_OMP_ATOMIC_UNSET)
+ c->atomic_op = GFC_OMP_ATOMIC_UPDATE;
+
+ if (c->memorder == OMP_MEMORDER_UNSET)
{
gfc_namespace *prog_unit = gfc_current_ns;
while (prog_unit->parent)
@@ -4036,32 +4123,93 @@ gfc_match_omp_oacc_atomic (bool omp_p)
{
case 0:
case OMP_REQ_ATOMIC_MEM_ORDER_RELAXED:
+ c->memorder = OMP_MEMORDER_RELAXED;
break;
case OMP_REQ_ATOMIC_MEM_ORDER_SEQ_CST:
- op = (gfc_omp_atomic_op) (op | GFC_OMP_ATOMIC_SEQ_CST);
+ c->memorder = OMP_MEMORDER_SEQ_CST;
break;
case OMP_REQ_ATOMIC_MEM_ORDER_ACQ_REL:
- op = (gfc_omp_atomic_op) (op | GFC_OMP_ATOMIC_ACQ_REL);
+ if (c->capture)
+ c->memorder = OMP_MEMORDER_ACQ_REL;
+ else if (c->atomic_op == GFC_OMP_ATOMIC_READ)
+ c->memorder = OMP_MEMORDER_ACQUIRE;
+ else
+ c->memorder = OMP_MEMORDER_RELEASE;
break;
default:
gcc_unreachable ();
}
}
- new_st.ext.omp_atomic = op;
+ else
+ switch (c->atomic_op)
+ {
+ case GFC_OMP_ATOMIC_READ:
+ if (c->memorder == OMP_MEMORDER_ACQ_REL
+ || c->memorder == OMP_MEMORDER_RELEASE)
+ {
+ gfc_error ("!$OMP ATOMIC READ at %L incompatible with "
+ "ACQ_REL or RELEASE clauses", &loc);
+ c->memorder = OMP_MEMORDER_SEQ_CST;
+ }
+ break;
+ case GFC_OMP_ATOMIC_WRITE:
+ if (c->memorder == OMP_MEMORDER_ACQ_REL
+ || c->memorder == OMP_MEMORDER_ACQUIRE)
+ {
+ gfc_error ("!$OMP ATOMIC WRITE at %L incompatible with "
+ "ACQ_REL or ACQUIRE clauses", &loc);
+ c->memorder = OMP_MEMORDER_SEQ_CST;
+ }
+ break;
+ case GFC_OMP_ATOMIC_UPDATE:
+ if ((c->memorder == OMP_MEMORDER_ACQ_REL
+ || c->memorder == OMP_MEMORDER_ACQUIRE)
+ && !c->capture)
+ {
+ gfc_error ("!$OMP ATOMIC UPDATE at %L incompatible with "
+ "ACQ_REL or ACQUIRE clauses", &loc);
+ c->memorder = OMP_MEMORDER_SEQ_CST;
+ }
+ break;
+ default:
+ break;
+ }
+ gfc_error_check ();
+ new_st.ext.omp_clauses = c;
+ new_st.op = EXEC_OMP_ATOMIC;
return MATCH_YES;
}
+
+/* acc atomic [ read | write | update | capture] */
+
match
gfc_match_oacc_atomic (void)
{
- return gfc_match_omp_oacc_atomic (false);
+ gfc_omp_clauses *c = gfc_get_omp_clauses ();
+ c->atomic_op = GFC_OMP_ATOMIC_UPDATE;
+ c->memorder = OMP_MEMORDER_RELAXED;
+ gfc_gobble_whitespace ();
+ if (gfc_match ("update") == MATCH_YES)
+ ;
+ else if (gfc_match ("read") == MATCH_YES)
+ c->atomic_op = GFC_OMP_ATOMIC_READ;
+ else if (gfc_match ("write") == MATCH_YES)
+ c->atomic_op = GFC_OMP_ATOMIC_WRITE;
+ else if (gfc_match ("capture") == MATCH_YES)
+ c->capture = true;
+ gfc_gobble_whitespace ();
+ if (gfc_match_omp_eos () != MATCH_YES)
+ {
+ gfc_error ("Unexpected junk after !$ACC ATOMIC statement at %C");
+ gfc_free_omp_clauses (c);
+ return MATCH_ERROR;
+ }
+ new_st.ext.omp_clauses = c;
+ new_st.op = EXEC_OACC_ATOMIC;
+ return MATCH_YES;
}
-match
-gfc_match_omp_atomic (void)
-{
- return gfc_match_omp_oacc_atomic (true);
-}
match
gfc_match_omp_barrier (void)
@@ -5485,11 +5633,12 @@ is_conversion (gfc_expr *expr, bool widening)
static void
resolve_omp_atomic (gfc_code *code)
{
- gfc_code *atomic_code = code;
+ gfc_code *atomic_code = code->block;
gfc_symbol *var;
gfc_expr *expr2, *expr2_tmp;
gfc_omp_atomic_op aop
- = (gfc_omp_atomic_op) (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK);
+ = (gfc_omp_atomic_op) (atomic_code->ext.omp_clauses->atomic_op
+ & GFC_OMP_ATOMIC_MASK);
code = code->block->next;
/* resolve_blocks asserts this is initially EXEC_ASSIGN.
@@ -5502,7 +5651,7 @@ resolve_omp_atomic (gfc_code *code)
gfc_error ("unexpected !$OMP ATOMIC expression at %L", &code->loc);
return;
}
- if (aop != GFC_OMP_ATOMIC_CAPTURE)
+ if (!atomic_code->ext.omp_clauses->capture)
{
if (code->next != NULL)
goto unexpected;
@@ -5562,7 +5711,11 @@ resolve_omp_atomic (gfc_code *code)
"must be scalar and cannot reference var at %L",
&expr2->where);
return;
- case GFC_OMP_ATOMIC_CAPTURE:
+ default:
+ break;
+ }
+ if (atomic_code->ext.omp_clauses->capture)
+ {
expr2_tmp = expr2;
if (expr2 == code->expr2)
{
@@ -5611,9 +5764,6 @@ resolve_omp_atomic (gfc_code *code)
if (expr2 == NULL)
expr2 = code->expr2;
}
- break;
- default:
- break;
}
if (gfc_expr_attr (code->expr1).allocatable)
@@ -5623,12 +5773,12 @@ resolve_omp_atomic (gfc_code *code)
return;
}
- if (aop == GFC_OMP_ATOMIC_CAPTURE
+ if (atomic_code->ext.omp_clauses->capture
&& code->next == NULL
&& code->expr2->rank == 0
&& !expr_references_sym (code->expr2, var, NULL))
- atomic_code->ext.omp_atomic
- = (gfc_omp_atomic_op) (atomic_code->ext.omp_atomic
+ atomic_code->ext.omp_clauses->atomic_op
+ = (gfc_omp_atomic_op) (atomic_code->ext.omp_clauses->atomic_op
| GFC_OMP_ATOMIC_SWAP);
else if (expr2->expr_type == EXPR_OP)
{
@@ -5838,7 +5988,7 @@ resolve_omp_atomic (gfc_code *code)
gfc_error ("!$OMP ATOMIC assignment must have an operator or "
"intrinsic on right hand side at %L", &expr2->where);
- if (aop == GFC_OMP_ATOMIC_CAPTURE && code->next)
+ if (atomic_code->ext.omp_clauses->capture && code->next)
{
code = code->next;
if (code->expr1->expr_type != EXPR_VARIABLE
@@ -6253,11 +6403,6 @@ resolve_omp_do (gfc_code *code)
}
}
-static bool
-oacc_is_parallel (gfc_code *code)
-{
- return code->op == EXEC_OACC_PARALLEL || code->op == EXEC_OACC_PARALLEL_LOOP;
-}
static gfc_statement
omp_code_to_statement (gfc_code *code)
@@ -6517,26 +6662,6 @@ resolve_oacc_nested_loops (gfc_code *code, gfc_code* do_code, int collapse,
static void
-resolve_oacc_params_in_parallel (gfc_code *code, const char *clause,
- const char *arg)
-{
- fortran_omp_context *c;
-
- if (oacc_is_parallel (code))
- gfc_error ("!$ACC LOOP %s in PARALLEL region doesn't allow "
- "%s arguments at %L", clause, arg, &code->loc);
- for (c = omp_current_ctx; c; c = c->previous)
- {
- if (oacc_is_loop (c->code))
- break;
- if (oacc_is_parallel (c->code))
- gfc_error ("!$ACC LOOP %s in PARALLEL region doesn't allow "
- "%s arguments at %L", clause, arg, &code->loc);
- }
-}
-
-
-static void
resolve_oacc_loop_blocks (gfc_code *code)
{
if (!oacc_is_loop (code))
@@ -6547,18 +6672,6 @@ resolve_oacc_loop_blocks (gfc_code *code)
gfc_error ("Tiled loop cannot be parallelized across gangs, workers and "
"vectors at the same time at %L", &code->loc);
- if (code->ext.omp_clauses->gang
- && code->ext.omp_clauses->gang_num_expr)
- resolve_oacc_params_in_parallel (code, "GANG", "num");
-
- if (code->ext.omp_clauses->worker
- && code->ext.omp_clauses->worker_expr)
- resolve_oacc_params_in_parallel (code, "WORKER", "num");
-
- if (code->ext.omp_clauses->vector
- && code->ext.omp_clauses->vector_expr)
- resolve_oacc_params_in_parallel (code, "VECTOR", "length");
-
if (code->ext.omp_clauses->tile_list)
{
gfc_expr_list *el;
@@ -6837,6 +6950,7 @@ gfc_resolve_omp_directive (gfc_code *code, gfc_namespace *ns ATTRIBUTE_UNUSED)
"FROM clause", &code->loc);
break;
case EXEC_OMP_ATOMIC:
+ resolve_omp_clauses (code, code->block->ext.omp_clauses, NULL);
resolve_omp_atomic (code);
break;
case EXEC_OMP_CRITICAL:
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 6669621..ec7abc2 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -1633,14 +1633,15 @@ next_statement (void)
#define case_decl case ST_ATTR_DECL: case ST_COMMON: case ST_DATA_DECL: \
case ST_EQUIVALENCE: case ST_NAMELIST: case ST_STATEMENT_FUNCTION: \
- case ST_TYPE: case ST_INTERFACE: case ST_PROCEDURE: case ST_OACC_ROUTINE: \
- case ST_OACC_DECLARE
+ case ST_TYPE: case ST_INTERFACE: case ST_PROCEDURE
-/* OpenMP declaration statements. */
+/* OpenMP and OpenACC declaration statements, which may appear anywhere in
+ the specification part. */
#define case_omp_decl case ST_OMP_THREADPRIVATE: case ST_OMP_DECLARE_SIMD: \
case ST_OMP_DECLARE_TARGET: case ST_OMP_DECLARE_REDUCTION: \
- case ST_OMP_REQUIRES
+ case ST_OMP_REQUIRES: case ST_OACC_ROUTINE: case ST_OACC_DECLARE
+
/* Block end statements. Errors associated with interchanging these
are detected in gfc_match_end(). */
@@ -2813,7 +2814,7 @@ verify_st_order (st_state *p, gfc_statement st, bool silent)
break;
case_omp_decl:
- /* The OpenMP directives have to be somewhere in the specification
+ /* The OpenMP/OpenACC directives have to be somewhere in the specification
part, but there are no further requirements on their ordering.
Thus don't adjust p->state, just ignore them. */
if (p->state >= ORDER_EXEC)
@@ -5062,9 +5063,9 @@ parse_omp_oacc_atomic (bool omp_p)
np = new_level (cp);
np->op = cp->op;
np->block = NULL;
- np->ext.omp_atomic = cp->ext.omp_atomic;
- count = 1 + ((cp->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
- == GFC_OMP_ATOMIC_CAPTURE);
+ np->ext.omp_clauses = cp->ext.omp_clauses;
+ cp->ext.omp_clauses = NULL;
+ count = 1 + np->ext.omp_clauses->capture;
while (count)
{
@@ -5090,8 +5091,7 @@ parse_omp_oacc_atomic (bool omp_p)
gfc_warning_check ();
st = next_statement ();
}
- else if ((cp->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
- == GFC_OMP_ATOMIC_CAPTURE)
+ else if (np->ext.omp_clauses->capture)
gfc_error ("Missing !$OMP END ATOMIC after !$OMP ATOMIC CAPTURE at %C");
return st;
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index f4ce49f..1641eb6 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. */
@@ -3397,6 +3404,11 @@ resolve_function (gfc_expr *expr)
/* typebound procedure: Assume the worst. */
gfc_current_ns->proc_name->attr.array_outer_dependency = 1;
+ if (expr->value.function.esym
+ && expr->value.function.esym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED))
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using function %qs at %L is deprecated",
+ sym->name, &expr->where);
return t;
}
@@ -3740,6 +3752,12 @@ resolve_call (gfc_code *c)
/* Typebound procedure: Assume the worst. */
gfc_current_ns->proc_name->attr.array_outer_dependency = 1;
+ if (c->resolved_sym
+ && c->resolved_sym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED))
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using subroutine %qs at %L is deprecated",
+ c->resolved_sym->name, &c->loc);
+
return t;
}
@@ -5910,6 +5928,10 @@ resolve_procedure:
if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
add_caf_get_intrinsic (e);
+ if (sym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED) && sym != sym->result)
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using variable %qs at %L is deprecated",
+ sym->name, &e->where);
/* Simplify cases where access to a parameter array results in a
single constant. Suppress errors since those will have been
issued before, as warnings. */
@@ -10724,15 +10746,12 @@ gfc_resolve_blocks (gfc_code *b, gfc_namespace *ns)
case EXEC_OMP_ATOMIC:
case EXEC_OACC_ATOMIC:
{
- gfc_omp_atomic_op aop
- = (gfc_omp_atomic_op) (b->ext.omp_atomic & GFC_OMP_ATOMIC_MASK);
-
/* Verify this before calling gfc_resolve_code, which might
change it. */
gcc_assert (b->next && b->next->op == EXEC_ASSIGN);
- gcc_assert (((aop != GFC_OMP_ATOMIC_CAPTURE)
+ gcc_assert ((!b->ext.omp_clauses->capture
&& b->next->next == NULL)
- || ((aop == GFC_OMP_ATOMIC_CAPTURE)
+ || (b->ext.omp_clauses->capture
&& b->next->next != NULL
&& b->next->next->op == EXEC_ASSIGN
&& b->next->next->next == NULL));
@@ -12228,6 +12247,11 @@ resolve_values (gfc_symbol *sym)
if (sym->value == NULL)
return;
+ if (sym->attr.ext_attr & (1 << EXT_ATTR_DEPRECATED))
+ gfc_warning (OPT_Wdeprecated_declarations,
+ "Using parameter %qs declared at %L is deprecated",
+ sym->name, &sym->declared_at);
+
if (sym->value->expr_type == EXPR_STRUCTURE)
t= resolve_structure_cons (sym->value, 1);
else
@@ -16469,6 +16493,7 @@ gfc_impure_variable (gfc_symbol *sym)
proc = sym->ns->proc_name;
if (sym->attr.dummy
+ && !sym->attr.value
&& ((proc->attr.subroutine && sym->attr.intent == INTENT_IN)
|| proc->attr.function))
return 1;
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/st.c b/gcc/fortran/st.c
index f6937b9..a3b0f12 100644
--- a/gcc/fortran/st.c
+++ b/gcc/fortran/st.c
@@ -198,6 +198,7 @@ gfc_free_statement (gfc_code *p)
gfc_free_oacc_declare_clauses (p->ext.oacc_declare);
break;
+ case EXEC_OACC_ATOMIC:
case EXEC_OACC_PARALLEL_LOOP:
case EXEC_OACC_PARALLEL:
case EXEC_OACC_KERNELS_LOOP:
@@ -213,6 +214,7 @@ gfc_free_statement (gfc_code *p)
case EXEC_OACC_ENTER_DATA:
case EXEC_OACC_EXIT_DATA:
case EXEC_OACC_ROUTINE:
+ case EXEC_OMP_ATOMIC:
case EXEC_OMP_CANCEL:
case EXEC_OMP_CANCELLATION_POINT:
case EXEC_OMP_CRITICAL:
@@ -266,8 +268,6 @@ gfc_free_statement (gfc_code *p)
gfc_free_omp_namelist (p->ext.omp_namelist);
break;
- case EXEC_OACC_ATOMIC:
- case EXEC_OMP_ATOMIC:
case EXEC_OMP_BARRIER:
case EXEC_OMP_MASTER:
case EXEC_OMP_END_NOWAIT:
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 998d4d4..b2c39aa 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -133,28 +133,31 @@ gfc_array_dataptr_type (tree desc)
#define LBOUND_SUBFIELD 1
#define UBOUND_SUBFIELD 2
+static tree
+gfc_get_descriptor_field (tree desc, unsigned field_idx)
+{
+ tree type = TREE_TYPE (desc);
+ gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
+
+ tree field = gfc_advance_chain (TYPE_FIELDS (type), field_idx);
+ gcc_assert (field != NULL_TREE);
+
+ return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
+ desc, field, NULL_TREE);
+}
+
/* This provides READ-ONLY access to the data field. The field itself
doesn't have the proper type. */
tree
gfc_conv_descriptor_data_get (tree desc)
{
- tree field, type, t;
-
- type = TREE_TYPE (desc);
+ tree type = TREE_TYPE (desc);
if (TREE_CODE (type) == REFERENCE_TYPE)
- type = TREE_TYPE (type);
+ gcc_unreachable ();
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = TYPE_FIELDS (type);
- gcc_assert (DATA_FIELD == 0);
-
- t = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field), desc,
- field, NULL_TREE);
- t = fold_convert (GFC_TYPE_ARRAY_DATAPTR_TYPE (type), t);
-
- return t;
+ tree field = gfc_get_descriptor_field (desc, DATA_FIELD);
+ return fold_convert (GFC_TYPE_ARRAY_DATAPTR_TYPE (type), field);
}
/* This provides WRITE access to the data field.
@@ -168,17 +171,8 @@ gfc_conv_descriptor_data_get (tree desc)
void
gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
{
- tree field, type, t;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = TYPE_FIELDS (type);
- gcc_assert (DATA_FIELD == 0);
-
- t = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field), desc,
- field, NULL_TREE);
- gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value));
+ tree field = gfc_get_descriptor_field (desc, DATA_FIELD);
+ gfc_add_modify (block, field, fold_convert (TREE_TYPE (field), value));
}
@@ -188,33 +182,16 @@ gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value)
tree
gfc_conv_descriptor_data_addr (tree desc)
{
- tree field, type, t;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = TYPE_FIELDS (type);
- gcc_assert (DATA_FIELD == 0);
-
- t = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field), desc,
- field, NULL_TREE);
- return gfc_build_addr_expr (NULL_TREE, t);
+ tree field = gfc_get_descriptor_field (desc, DATA_FIELD);
+ return gfc_build_addr_expr (NULL_TREE, field);
}
static tree
gfc_conv_descriptor_offset (tree desc)
{
- tree type;
- tree field;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = gfc_advance_chain (TYPE_FIELDS (type), OFFSET_FIELD);
- gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
-
- return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- desc, field, NULL_TREE);
+ tree field = gfc_get_descriptor_field (desc, OFFSET_FIELD);
+ gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
+ return field;
}
tree
@@ -235,34 +212,17 @@ gfc_conv_descriptor_offset_set (stmtblock_t *block, tree desc,
tree
gfc_conv_descriptor_dtype (tree desc)
{
- tree field;
- tree type;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = gfc_advance_chain (TYPE_FIELDS (type), DTYPE_FIELD);
- gcc_assert (field != NULL_TREE
- && TREE_TYPE (field) == get_dtype_type_node ());
-
- return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- desc, field, NULL_TREE);
+ tree field = gfc_get_descriptor_field (desc, DTYPE_FIELD);
+ gcc_assert (TREE_TYPE (field) == get_dtype_type_node ());
+ return field;
}
static tree
gfc_conv_descriptor_span (tree desc)
{
- tree type;
- tree field;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = gfc_advance_chain (TYPE_FIELDS (type), SPAN_FIELD);
- gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
-
- return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- desc, field, NULL_TREE);
+ tree field = gfc_get_descriptor_field (desc, SPAN_FIELD);
+ gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
+ return field;
}
tree
@@ -328,22 +288,13 @@ gfc_conv_descriptor_attribute (tree desc)
dtype, tmp, NULL_TREE);
}
-
tree
gfc_get_descriptor_dimension (tree desc)
{
- tree type, field;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
-
- field = gfc_advance_chain (TYPE_FIELDS (type), DIMENSION_FIELD);
- gcc_assert (field != NULL_TREE
- && TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
- && TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == RECORD_TYPE);
-
- return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- desc, field, NULL_TREE);
+ tree field = gfc_get_descriptor_field (desc, DIMENSION_FIELD);
+ gcc_assert (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (field))) == RECORD_TYPE);
+ return field;
}
@@ -361,38 +312,31 @@ gfc_conv_descriptor_dimension (tree desc, tree dim)
tree
gfc_conv_descriptor_token (tree desc)
{
- tree type;
- tree field;
-
- type = TREE_TYPE (desc);
- gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
- field = gfc_advance_chain (TYPE_FIELDS (type), CAF_TOKEN_FIELD);
-
+ tree field = gfc_get_descriptor_field (desc, CAF_TOKEN_FIELD);
/* Should be a restricted pointer - except in the finalization wrapper. */
- gcc_assert (field != NULL_TREE
- && (TREE_TYPE (field) == prvoid_type_node
- || TREE_TYPE (field) == pvoid_type_node));
+ gcc_assert (TREE_TYPE (field) == prvoid_type_node
+ || TREE_TYPE (field) == pvoid_type_node);
+ return field;
+}
+
+static tree
+gfc_conv_descriptor_subfield (tree desc, tree dim, unsigned field_idx)
+{
+ tree tmp = gfc_conv_descriptor_dimension (desc, dim);
+ tree field = gfc_advance_chain (TYPE_FIELDS (TREE_TYPE (tmp)), field_idx);
+ gcc_assert (field != NULL_TREE);
return fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- desc, field, NULL_TREE);
+ tmp, field, NULL_TREE);
}
-
static tree
gfc_conv_descriptor_stride (tree desc, tree dim)
{
- tree tmp;
- tree field;
-
- tmp = gfc_conv_descriptor_dimension (desc, dim);
- field = TYPE_FIELDS (TREE_TYPE (tmp));
- field = gfc_advance_chain (field, STRIDE_SUBFIELD);
- gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
-
- tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- tmp, field, NULL_TREE);
- return tmp;
+ tree field = gfc_conv_descriptor_subfield (desc, dim, STRIDE_SUBFIELD);
+ gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
+ return field;
}
tree
@@ -421,17 +365,9 @@ gfc_conv_descriptor_stride_set (stmtblock_t *block, tree desc,
static tree
gfc_conv_descriptor_lbound (tree desc, tree dim)
{
- tree tmp;
- tree field;
-
- tmp = gfc_conv_descriptor_dimension (desc, dim);
- field = TYPE_FIELDS (TREE_TYPE (tmp));
- field = gfc_advance_chain (field, LBOUND_SUBFIELD);
- gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
-
- tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- tmp, field, NULL_TREE);
- return tmp;
+ tree field = gfc_conv_descriptor_subfield (desc, dim, LBOUND_SUBFIELD);
+ gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
+ return field;
}
tree
@@ -451,17 +387,9 @@ gfc_conv_descriptor_lbound_set (stmtblock_t *block, tree desc,
static tree
gfc_conv_descriptor_ubound (tree desc, tree dim)
{
- tree tmp;
- tree field;
-
- tmp = gfc_conv_descriptor_dimension (desc, dim);
- field = TYPE_FIELDS (TREE_TYPE (tmp));
- field = gfc_advance_chain (field, UBOUND_SUBFIELD);
- gcc_assert (field != NULL_TREE && TREE_TYPE (field) == gfc_array_index_type);
-
- tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
- tmp, field, NULL_TREE);
- return tmp;
+ tree field = gfc_conv_descriptor_subfield (desc, dim, UBOUND_SUBFIELD);
+ gcc_assert (TREE_TYPE (field) == gfc_array_index_type);
+ return field;
}
tree
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 5940a1f..71d5c67 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1427,7 +1427,7 @@ add_attributes_to_decl (symbol_attribute sym_attr, tree list)
tree attr;
for (id = 0; id < EXT_ATTR_NUM; id++)
- if (sym_attr.ext_attr & (1 << id))
+ if (sym_attr.ext_attr & (1 << id) && ext_attr_list[id].middle_end_name)
{
attr = build_tree_list (
get_identifier (ext_attr_list[id].middle_end_name),
@@ -1749,7 +1749,6 @@ gfc_get_symbol_decl (gfc_symbol * sym)
|| sym->attr.if_source != IFSRC_DECL)
{
decl = gfc_get_extern_function_decl (sym);
- gfc_set_decl_location (decl, &sym->declared_at);
}
else
{
@@ -3021,8 +3020,9 @@ build_entry_thunks (gfc_namespace * ns, bool global)
poplevel (1, 1);
BLOCK_SUPERCONTEXT (DECL_INITIAL (thunk_fndecl)) = thunk_fndecl;
DECL_SAVED_TREE (thunk_fndecl)
- = build3_v (BIND_EXPR, tmp, DECL_SAVED_TREE (thunk_fndecl),
- DECL_INITIAL (thunk_fndecl));
+ = fold_build3_loc (DECL_SOURCE_LOCATION (thunk_fndecl), BIND_EXPR,
+ void_type_node, tmp, DECL_SAVED_TREE (thunk_fndecl),
+ DECL_INITIAL (thunk_fndecl));
/* Output the GENERIC tree. */
dump_function (TDI_original, thunk_fndecl);
@@ -3832,9 +3832,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);
@@ -3848,47 +3848,47 @@ 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")), "R R W W W W R ",
+ 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")), "W R W W R ",
+ 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 . R R W R R R W ",
+ 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 . R R R R R R W R ",
+ 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 . R R R R . R R R R R R ",
+ 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")), ". R W R R R R R W R ",
+ 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")), ". R R R R R R R W R ",
+ 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);
@@ -3896,7 +3896,7 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_caf_sendget_by_ref
= gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("caf_sendget_by_ref")),
- ". R R . R R R R R W W R R ",
+ ". 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,
@@ -3904,15 +3904,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")), ". W W . ", 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")), ". W W . ", 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")), ". . R W W . ", 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);
@@ -3923,7 +3923,7 @@ 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;
@@ -3935,55 +3935,55 @@ gfc_build_builtin_function_decls (void)
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 . . R W ",
+ 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 . . W W ",
+ 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 . . W R R W ",
+ 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 . . R W W ",
+ 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 . . W W W ",
+ 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 . . W W ",
+ 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 . . W W ",
+ 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 . . W W ",
+ 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 . . W W ",
+ 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);
@@ -3994,19 +3994,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")), "W R R ",
+ 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")), "R W R ",
+ 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")), "R R ",
+ get_identifier (PREFIX("caf_change_team")), ". w . ",
void_type_node, 2, ppvoid_type_node,
integer_type_node);
@@ -4021,43 +4021,43 @@ gfc_build_builtin_function_decls (void)
gfor_fndecl_caf_sync_team
= gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_sync_team")), "R R ",
+ 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")), "R R ",
+ 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")), "W R R ",
+ 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 . W W ",
+ 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 . W W ",
+ 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 . W W ",
+ 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 . W W ",
+ 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)),
@@ -4065,12 +4065,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 . W W ",
+ 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")), "R R R ",
+ get_identifier (PREFIX("caf_is_present")), ". r . r ",
integer_type_node, 3, pvoid_type_node, integer_type_node,
pvoid_type_node);
}
@@ -5786,8 +5786,8 @@ generate_coarray_init (gfc_namespace * ns __attribute((unused)))
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
DECL_SAVED_TREE (fndecl)
- = build3_v (BIND_EXPR, decl, DECL_SAVED_TREE (fndecl),
- DECL_INITIAL (fndecl));
+ = fold_build3_loc (DECL_SOURCE_LOCATION (fndecl), BIND_EXPR, void_type_node,
+ decl, DECL_SAVED_TREE (fndecl), DECL_INITIAL (fndecl));
dump_function (TDI_original, fndecl);
cfun->function_end_locus = input_location;
@@ -6512,8 +6512,9 @@ create_main_function (tree fndecl)
BLOCK_SUPERCONTEXT (DECL_INITIAL (ftn_main)) = ftn_main;
DECL_SAVED_TREE (ftn_main)
- = build3_v (BIND_EXPR, decl, DECL_SAVED_TREE (ftn_main),
- DECL_INITIAL (ftn_main));
+ = fold_build3_loc (DECL_SOURCE_LOCATION (ftn_main), BIND_EXPR,
+ void_type_node, decl, DECL_SAVED_TREE (ftn_main),
+ DECL_INITIAL (ftn_main));
/* Output the GENERIC tree. */
dump_function (TDI_original, ftn_main);
@@ -7004,8 +7005,8 @@ gfc_generate_function_code (gfc_namespace * ns)
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
DECL_SAVED_TREE (fndecl)
- = build3_v (BIND_EXPR, decl, DECL_SAVED_TREE (fndecl),
- DECL_INITIAL (fndecl));
+ = fold_build3_loc (DECL_SOURCE_LOCATION (fndecl), BIND_EXPR, void_type_node,
+ decl, DECL_SAVED_TREE (fndecl), DECL_INITIAL (fndecl));
/* Output the GENERIC tree. */
dump_function (TDI_original, fndecl);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 8729bc1..e0afc10 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -4238,12 +4238,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);
@@ -4252,7 +4300,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. */
@@ -4302,7 +4371,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.
@@ -5081,12 +5154,10 @@ strip_kind_from_actual (gfc_actual_arglist * actual)
{
for (gfc_actual_arglist *a = actual; a; a = a->next)
{
- gfc_actual_arglist *b = a->next;
- if (b && b->name && strcmp (b->name, "kind") == 0)
+ if (a && a->name && strcmp (a->name, "kind") == 0)
{
- a->next = b->next;
- b->next = NULL;
- gfc_free_actual_arglist (b);
+ gfc_free_expr (a->expr);
+ a->expr = NULL;
}
}
}
@@ -5224,20 +5295,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;
strip_kind_from_actual (a);
- while (a->next)
+ 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;
@@ -5996,29 +6064,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");
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 378088a..1d652a0 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"
@@ -3769,34 +3771,38 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
}
if (clauses->vector)
{
+ c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_VECTOR);
+ omp_clauses = gfc_trans_add_clause (c, omp_clauses);
+
if (clauses->vector_expr)
{
tree vector_var
= gfc_convert_expr_to_tree (block, clauses->vector_expr);
- c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_VECTOR);
OMP_CLAUSE_VECTOR_EXPR (c) = vector_var;
- omp_clauses = gfc_trans_add_clause (c, omp_clauses);
- }
- else
- {
- c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_VECTOR);
- omp_clauses = gfc_trans_add_clause (c, omp_clauses);
+
+ /* TODO: We're not capturing location information for individual
+ clauses. However, if we have an expression attached to the
+ clause, that one provides better location information. */
+ OMP_CLAUSE_LOCATION (c)
+ = gfc_get_location (&clauses->vector_expr->where);
}
}
if (clauses->worker)
{
+ c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_WORKER);
+ omp_clauses = gfc_trans_add_clause (c, omp_clauses);
+
if (clauses->worker_expr)
{
tree worker_var
= gfc_convert_expr_to_tree (block, clauses->worker_expr);
- c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_WORKER);
OMP_CLAUSE_WORKER_EXPR (c) = worker_var;
- omp_clauses = gfc_trans_add_clause (c, omp_clauses);
- }
- else
- {
- c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_WORKER);
- omp_clauses = gfc_trans_add_clause (c, omp_clauses);
+
+ /* TODO: We're not capturing location information for individual
+ clauses. However, if we have an expression attached to the
+ clause, that one provides better location information. */
+ OMP_CLAUSE_LOCATION (c)
+ = gfc_get_location (&clauses->worker_expr->where);
}
}
if (clauses->gang)
@@ -3804,11 +3810,19 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
tree arg;
c = build_omp_clause (gfc_get_location (&where), OMP_CLAUSE_GANG);
omp_clauses = gfc_trans_add_clause (c, omp_clauses);
+
if (clauses->gang_num_expr)
{
arg = gfc_convert_expr_to_tree (block, clauses->gang_num_expr);
OMP_CLAUSE_GANG_EXPR (c) = arg;
+
+ /* TODO: We're not capturing location information for individual
+ clauses. However, if we have an expression attached to the
+ clause, that one provides better location information. */
+ OMP_CLAUSE_LOCATION (c)
+ = gfc_get_location (&clauses->gang_num_expr->where);
}
+
if (clauses->gang_static)
{
arg = clauses->gang_static_expr
@@ -3965,7 +3979,7 @@ static tree gfc_trans_omp_workshare (gfc_code *, gfc_omp_clauses *);
static tree
gfc_trans_omp_atomic (gfc_code *code)
{
- gfc_code *atomic_code = code;
+ gfc_code *atomic_code = code->block;
gfc_se lse;
gfc_se rse;
gfc_se vse;
@@ -3977,12 +3991,16 @@ gfc_trans_omp_atomic (gfc_code *code)
enum tree_code aop = OMP_ATOMIC;
bool var_on_left = false;
enum omp_memory_order mo;
- if (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SEQ_CST)
- mo = OMP_MEMORY_ORDER_SEQ_CST;
- else if (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_ACQ_REL)
- mo = OMP_MEMORY_ORDER_ACQ_REL;
- else
- mo = OMP_MEMORY_ORDER_RELAXED;
+ switch (atomic_code->ext.omp_clauses->memorder)
+ {
+ case OMP_MEMORDER_UNSET: mo = OMP_MEMORY_ORDER_UNSPECIFIED; break;
+ case OMP_MEMORDER_ACQ_REL: mo = OMP_MEMORY_ORDER_ACQ_REL; break;
+ case OMP_MEMORDER_ACQUIRE: mo = OMP_MEMORY_ORDER_ACQUIRE; break;
+ case OMP_MEMORDER_RELAXED: mo = OMP_MEMORY_ORDER_RELAXED; break;
+ case OMP_MEMORDER_RELEASE: mo = OMP_MEMORY_ORDER_RELEASE; break;
+ case OMP_MEMORDER_SEQ_CST: mo = OMP_MEMORY_ORDER_SEQ_CST; break;
+ default: gcc_unreachable ();
+ }
code = code->block->next;
gcc_assert (code->op == EXEC_ASSIGN);
@@ -3994,16 +4012,16 @@ gfc_trans_omp_atomic (gfc_code *code)
gfc_start_block (&block);
expr2 = code->expr2;
- if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
+ if (((atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK)
!= GFC_OMP_ATOMIC_WRITE)
&& expr2->expr_type == EXPR_FUNCTION
&& expr2->value.function.isym
&& expr2->value.function.isym->id == GFC_ISYM_CONVERSION)
expr2 = expr2->value.function.actual->expr;
- switch (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
+ if ((atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK)
+ == GFC_OMP_ATOMIC_READ)
{
- case GFC_OMP_ATOMIC_READ:
gfc_conv_expr (&vse, code->expr1);
gfc_add_block_to_block (&block, &vse.pre);
@@ -4021,7 +4039,9 @@ gfc_trans_omp_atomic (gfc_code *code)
gfc_add_block_to_block (&block, &rse.pre);
return gfc_finish_block (&block);
- case GFC_OMP_ATOMIC_CAPTURE:
+ }
+ if (atomic_code->ext.omp_clauses->capture)
+ {
aop = OMP_ATOMIC_CAPTURE_NEW;
if (expr2->expr_type == EXPR_VARIABLE)
{
@@ -4040,9 +4060,6 @@ gfc_trans_omp_atomic (gfc_code *code)
&& expr2->value.function.isym->id == GFC_ISYM_CONVERSION)
expr2 = expr2->value.function.actual->expr;
}
- break;
- default:
- break;
}
gfc_conv_expr (&lse, code->expr1);
@@ -4050,9 +4067,9 @@ gfc_trans_omp_atomic (gfc_code *code)
type = TREE_TYPE (lse.expr);
lhsaddr = gfc_build_addr_expr (NULL, lse.expr);
- if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
+ if (((atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK)
== GFC_OMP_ATOMIC_WRITE)
- || (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SWAP))
+ || (atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_SWAP))
{
gfc_conv_expr (&rse, expr2);
gfc_add_block_to_block (&block, &rse.pre);
@@ -4188,9 +4205,9 @@ gfc_trans_omp_atomic (gfc_code *code)
rhs = gfc_evaluate_now (rse.expr, &block);
- if (((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK)
+ if (((atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK)
== GFC_OMP_ATOMIC_WRITE)
- || (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SWAP))
+ || (atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_SWAP))
x = rhs;
else
{
@@ -4785,10 +4802,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_UNSET)
+ {
+ 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 +6070,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-types.c b/gcc/fortran/trans-types.c
index 17f3ccc..b7129dc 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "trans-array.h"
#include "dwarf2out.h" /* For struct array_descr_info. */
#include "attribs.h"
+#include "alias.h"
#if (GFC_MAX_DIMENSIONS < 10)
@@ -1903,6 +1904,10 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
base_type = gfc_get_array_descriptor_base (dimen, codimen, false);
TYPE_CANONICAL (fat_type) = base_type;
TYPE_STUB_DECL (fat_type) = TYPE_STUB_DECL (base_type);
+ /* Arrays of unknown type must alias with all array descriptors. */
+ TYPE_TYPELESS_STORAGE (base_type) = 1;
+ TYPE_TYPELESS_STORAGE (fat_type) = 1;
+ gcc_checking_assert (!get_alias_set (base_type) && !get_alias_set (fat_type));
tmp = TYPE_NAME (etype);
if (tmp && TREE_CODE (tmp) == TYPE_DECL)
@@ -2246,7 +2251,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;
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 8caa625..025abe3 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1829,7 +1829,7 @@ void
gfc_set_backend_locus (locus * loc)
{
gfc_current_backend_file = loc->lb->file;
- input_location = loc->lb->location;
+ input_location = gfc_get_location (loc);
}
@@ -1839,7 +1839,10 @@ gfc_set_backend_locus (locus * loc)
void
gfc_restore_backend_locus (locus * loc)
{
- gfc_set_backend_locus (loc);
+ /* This only restores the information captured by gfc_save_backend_locus,
+ intentionally does not use gfc_get_location. */
+ input_location = loc->lb->location;
+ gfc_current_backend_file = loc->lb->file;
free (loc->lb);
}
diff --git a/gcc/function-tests.c b/gcc/function-tests.c
index 6536458..92f1acf 100644
--- a/gcc/function-tests.c
+++ b/gcc/function-tests.c
@@ -580,6 +580,7 @@ test_ranges ()
function *fun = DECL_STRUCT_FUNCTION (fndecl);
push_cfun (fun);
range_tests ();
+ range_op_tests ();
pop_cfun ();
}
diff --git a/gcc/function.c b/gcc/function.c
index c612959..004fa38 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -46,10 +46,12 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "expmed.h"
#include "optabs.h"
+#include "opts.h"
#include "regs.h"
#include "emit-rtl.h"
#include "recog.h"
#include "rtl-error.h"
+#include "hard-reg-set.h"
#include "alias.h"
#include "fold-const.h"
#include "stor-layout.h"
@@ -2846,7 +2848,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;
@@ -5815,6 +5817,103 @@ make_prologue_seq (void)
return seq;
}
+/* Emit a sequence of insns to zero the call-used registers before RET
+ according to ZERO_REGS_TYPE. */
+
+static void
+gen_call_used_regs_seq (rtx_insn *ret, unsigned int zero_regs_type)
+{
+ bool only_gpr = true;
+ bool only_used = true;
+ bool only_arg = true;
+
+ /* No need to zero call-used-regs in main (). */
+ if (MAIN_NAME_P (DECL_NAME (current_function_decl)))
+ return;
+
+ /* No need to zero call-used-regs if __builtin_eh_return is called
+ since it isn't a normal function return. */
+ if (crtl->calls_eh_return)
+ return;
+
+ /* If only_gpr is true, only zero call-used registers that are
+ general-purpose registers; if only_used is true, only zero
+ call-used registers that are used in the current function;
+ if only_arg is true, only zero call-used registers that pass
+ parameters defined by the flatform's calling conversion. */
+
+ using namespace zero_regs_flags;
+
+ only_gpr = zero_regs_type & ONLY_GPR;
+ only_used = zero_regs_type & ONLY_USED;
+ only_arg = zero_regs_type & ONLY_ARG;
+
+ /* For each of the hard registers, we should zero it if:
+ 1. it is a call-used register;
+ and 2. it is not a fixed register;
+ and 3. it is not live at the return of the routine;
+ and 4. it is general registor if only_gpr is true;
+ and 5. it is used in the routine if only_used is true;
+ and 6. it is a register that passes parameter if only_arg is true. */
+
+ /* First, prepare the data flow information. */
+ basic_block bb = BLOCK_FOR_INSN (ret);
+ auto_bitmap live_out;
+ bitmap_copy (live_out, df_get_live_out (bb));
+ df_simulate_initialize_backwards (bb, live_out);
+ df_simulate_one_insn_backwards (bb, ret, live_out);
+
+ HARD_REG_SET selected_hardregs;
+ CLEAR_HARD_REG_SET (selected_hardregs);
+ for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ {
+ if (!crtl->abi->clobbers_full_reg_p (regno))
+ continue;
+ if (fixed_regs[regno])
+ continue;
+ if (REGNO_REG_SET_P (live_out, regno))
+ continue;
+ if (only_gpr
+ && !TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], regno))
+ continue;
+ if (only_used && !df_regs_ever_live_p (regno))
+ continue;
+ if (only_arg && !FUNCTION_ARG_REGNO_P (regno))
+ continue;
+
+ /* Now this is a register that we might want to zero. */
+ SET_HARD_REG_BIT (selected_hardregs, regno);
+ }
+
+ if (hard_reg_set_empty_p (selected_hardregs))
+ return;
+
+ /* Now that we have a hard register set that needs to be zeroed, pass it to
+ target to generate zeroing sequence. */
+ HARD_REG_SET zeroed_hardregs;
+ start_sequence ();
+ zeroed_hardregs = targetm.calls.zero_call_used_regs (selected_hardregs);
+ rtx_insn *seq = get_insns ();
+ end_sequence ();
+ if (seq)
+ {
+ /* Emit the memory blockage and register clobber asm volatile before
+ the whole sequence. */
+ start_sequence ();
+ expand_asm_reg_clobber_mem_blockage (zeroed_hardregs);
+ rtx_insn *seq_barrier = get_insns ();
+ end_sequence ();
+
+ emit_insn_before (seq_barrier, ret);
+ emit_insn_before (seq, ret);
+
+ /* Update the data flow information. */
+ crtl->must_be_zero_on_return |= zeroed_hardregs;
+ df_set_bb_dirty (EXIT_BLOCK_PTR_FOR_FN (cfun));
+ }
+}
+
+
/* Return a sequence to be used as the epilogue for the current function,
or NULL. */
@@ -6486,7 +6585,96 @@ make_pass_thread_prologue_and_epilogue (gcc::context *ctxt)
{
return new pass_thread_prologue_and_epilogue (ctxt);
}
-
+
+namespace {
+
+const pass_data pass_data_zero_call_used_regs =
+{
+ RTL_PASS, /* type */
+ "zero_call_used_regs", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ TV_NONE, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_zero_call_used_regs: public rtl_opt_pass
+{
+public:
+ pass_zero_call_used_regs (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_zero_call_used_regs, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual unsigned int execute (function *);
+
+}; // class pass_zero_call_used_regs
+
+unsigned int
+pass_zero_call_used_regs::execute (function *fun)
+{
+ using namespace zero_regs_flags;
+ unsigned int zero_regs_type = UNSET;
+
+ tree attr_zero_regs = lookup_attribute ("zero_call_used_regs",
+ DECL_ATTRIBUTES (fun->decl));
+
+ /* Get the type of zero_call_used_regs from function attribute.
+ We have filtered out invalid attribute values already at this point. */
+ if (attr_zero_regs)
+ {
+ /* The TREE_VALUE of an attribute is a TREE_LIST whose TREE_VALUE
+ is the attribute argument's value. */
+ attr_zero_regs = TREE_VALUE (attr_zero_regs);
+ gcc_assert (TREE_CODE (attr_zero_regs) == TREE_LIST);
+ attr_zero_regs = TREE_VALUE (attr_zero_regs);
+ gcc_assert (TREE_CODE (attr_zero_regs) == STRING_CST);
+
+ for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL; ++i)
+ if (strcmp (TREE_STRING_POINTER (attr_zero_regs),
+ zero_call_used_regs_opts[i].name) == 0)
+ {
+ zero_regs_type = zero_call_used_regs_opts[i].flag;
+ break;
+ }
+ }
+
+ if (!zero_regs_type)
+ zero_regs_type = flag_zero_call_used_regs;
+
+ /* No need to zero call-used-regs when no user request is present. */
+ if (!(zero_regs_type & ENABLED))
+ return 0;
+
+ edge_iterator ei;
+ edge e;
+
+ /* This pass needs data flow information. */
+ df_analyze ();
+
+ /* Iterate over the function's return instructions and insert any
+ register zeroing required by the -fzero-call-used-regs command-line
+ option or the "zero_call_used_regs" function attribute. */
+ FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
+ {
+ rtx_insn *insn = BB_END (e->src);
+ if (JUMP_P (insn) && ANY_RETURN_P (JUMP_LABEL (insn)))
+ gen_call_used_regs_seq (insn, zero_regs_type);
+ }
+
+ return 0;
+}
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_zero_call_used_regs (gcc::context *ctxt)
+{
+ return new pass_zero_call_used_regs (ctxt);
+}
/* If CONSTRAINT is a matching constraint, then return its number.
Otherwise, return -1. */
diff --git a/gcc/function.h b/gcc/function.h
index d55cbdd..dbe8a58 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -269,6 +269,13 @@ struct GTY(()) function {
/* Value histograms attached to particular statements. */
htab_t GTY((skip)) value_histograms;
+ /* Different from normal TODO_flags which are handled right at the
+ beginning or the end of one pass execution, the pending_TODOs
+ are passed down in the pipeline until one of its consumers can
+ perform the requested action. Consumers should then clear the
+ flags for the actions that they have taken. */
+ unsigned int pending_TODOs;
+
/* For function.c. */
/* Points to the FUNCTION_DECL of this function. */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index ff7b6c4..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 **);
@@ -879,7 +880,7 @@ proper position among the other output files. */
/* Define ASM_DEBUG_SPEC to be a spec suitable for translating '-g'
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_4_FLAG)
+# 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.
@@ -920,7 +921,7 @@ proper position among the other output files. */
/* 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_4_FLAG)
+# 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 ;" \
@@ -1723,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 },
@@ -10087,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
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 4dba01c..4e95c7c 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -293,7 +293,7 @@ GCOV_COUNTERS
#define GCOV_TOPN_MAXIMUM_TRACKED_VALUES 32
/* Number of pre-allocated gcov_kvp structures. */
-#define GCOV_PREALLOCATED_KVP 16
+#define GCOV_PREALLOCATED_KVP 64
/* Convert a counter index to a tag. */
#define GCOV_TAG_FOR_COUNTER(COUNT) \
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..b21eeac 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1726,7 +1726,9 @@ 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",
+ "symtab-clones.h",
+ NULL
};
const char *const *ifp;
outf_p gtype_desc_c;
@@ -5198,6 +5200,7 @@ main (int argc, char **argv)
POS_HERE (do_scalar_typedef ("widest_int", &pos));
POS_HERE (do_scalar_typedef ("int64_t", &pos));
POS_HERE (do_scalar_typedef ("poly_int64", &pos));
+ POS_HERE (do_scalar_typedef ("poly_uint64", &pos));
POS_HERE (do_scalar_typedef ("uint64_t", &pos));
POS_HERE (do_scalar_typedef ("uint8", &pos));
POS_HERE (do_scalar_typedef ("uintptr_t", &pos));
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index c3fa4cb..ca38a31 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -7855,7 +7855,7 @@ gimple_build_vector (gimple_seq *seq, location_t loc,
gcc_assert (builder->nelts_per_pattern () <= 2);
unsigned int encoded_nelts = builder->encoded_nelts ();
for (unsigned int i = 0; i < encoded_nelts; ++i)
- if (!TREE_CONSTANT ((*builder)[i]))
+ if (!CONSTANT_CLASS_P ((*builder)[i]))
{
tree type = builder->type ();
unsigned int nelts = TYPE_VECTOR_SUBPARTS (type).to_constant ();
diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc
index b64e31f..9186ff5 100644
--- a/gcc/gimple-isel.cc
+++ b/gcc/gimple-isel.cc
@@ -162,11 +162,12 @@ gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi,
op0a = gimple_assign_rhs1 (def_stmt);
op0b = gimple_assign_rhs2 (def_stmt);
+ tree op0_type = TREE_TYPE (op0);
tree op0a_type = TREE_TYPE (op0a);
if (used_vec_cond_exprs >= 2
- && (get_vcond_mask_icode (mode, TYPE_MODE (op0a_type))
+ && (get_vcond_mask_icode (mode, TYPE_MODE (op0_type))
!= CODE_FOR_nothing)
- && expand_vec_cmp_expr_p (op0a_type, TREE_TYPE (lhs), tcode))
+ && expand_vec_cmp_expr_p (op0a_type, op0_type, tcode))
{
/* Keep the SSA name and use vcond_mask. */
tcode = TREE_CODE (op0);
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 13b9933..b01563c 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -91,19 +91,15 @@ non_null_ref::process_name (tree 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);
- }
+ // If we can infer a nonnull range, then set the bit for this BB
+ if (!SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)
+ && infer_nonnull_range (s, name))
+ bitmap_set_bit (b, index);
}
m_nn[v] = b;
@@ -169,6 +165,7 @@ ssa_block_ranges::~ssa_block_ranges ()
void
ssa_block_ranges::set_bb_range (const basic_block bb, const irange &r)
{
+ gcc_checking_assert ((unsigned) bb->index < m_tab.length ());
irange *m = m_irange_allocator->allocate (r);
m_tab[bb->index] = m;
}
@@ -178,6 +175,7 @@ ssa_block_ranges::set_bb_range (const basic_block bb, const irange &r)
void
ssa_block_ranges::set_bb_varying (const basic_block bb)
{
+ gcc_checking_assert ((unsigned) bb->index < m_tab.length ());
m_tab[bb->index] = m_type_range;
}
@@ -187,6 +185,7 @@ ssa_block_ranges::set_bb_varying (const basic_block bb)
bool
ssa_block_ranges::get_bb_range (irange &r, const basic_block bb)
{
+ gcc_checking_assert ((unsigned) bb->index < m_tab.length ());
irange *m = m_tab[bb->index];
if (m)
{
@@ -201,6 +200,7 @@ ssa_block_ranges::get_bb_range (irange &r, const basic_block bb)
bool
ssa_block_ranges::bb_range_p (const basic_block bb)
{
+ gcc_checking_assert ((unsigned) bb->index < m_tab.length ());
return m_tab[bb->index] != NULL;
}
@@ -248,8 +248,8 @@ block_range_cache::~block_range_cache ()
m_ssa_ranges.release ();
}
-// Return a reference to the m_block_cache for NAME. If it has not been
-// accessed yet, allocate it.
+// Return a reference to the ssa_block_cache for NAME. If it has not been
+// accessed yet, allocate it first.
ssa_block_ranges &
block_range_cache::get_block_ranges (tree name)
@@ -259,11 +259,24 @@ block_range_cache::get_block_ranges (tree name)
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);
-
+ m_ssa_ranges[v] = new ssa_block_ranges (TREE_TYPE (name),
+ m_irange_allocator);
return *(m_ssa_ranges[v]);
}
+
+// Return a pointer to the ssa_block_cache for NAME. If it has not been
+// accessed yet, return NULL.
+
+ssa_block_ranges *
+block_range_cache::query_block_ranges (tree name)
+{
+ unsigned v = SSA_NAME_VERSION (name);
+ if (v >= m_ssa_ranges.length () || !m_ssa_ranges[v])
+ return NULL;
+ return m_ssa_ranges[v];
+}
+
// Set the range for NAME on entry to block BB to R.
void
@@ -287,7 +300,10 @@ block_range_cache::set_bb_varying (tree name, const basic_block bb)
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);
+ ssa_block_ranges *ptr = query_block_ranges (name);
+ if (ptr)
+ return ptr->get_bb_range (r, bb);
+ return false;
}
// Return true if NAME has a range set in block BB.
@@ -295,7 +311,10 @@ block_range_cache::get_bb_range (irange &r, tree name, const basic_block bb)
bool
block_range_cache::bb_range_p (tree name, const basic_block bb)
{
- return get_block_ranges (name).bb_range_p (bb);
+ ssa_block_ranges *ptr = query_block_ranges (name);
+ if (ptr)
+ return ptr->bb_range_p (bb);
+ return false;
}
// Print all known block caches to file F.
@@ -400,8 +419,9 @@ ssa_global_cache::get_global_range (irange &r, tree name) const
}
// Set the range for NAME to R in the global cache.
+// Return TRUE if there was already a range set, otherwise false.
-void
+bool
ssa_global_cache::set_global_range (tree name, const irange &r)
{
unsigned v = SSA_NAME_VERSION (name);
@@ -413,6 +433,7 @@ ssa_global_cache::set_global_range (tree name, const irange &r)
*m = r;
else
m_tab[v] = m_irange_allocator->allocate (r);
+ return m != NULL;
}
// Set the range for NAME to R in the glonbal cache.
@@ -457,7 +478,141 @@ ssa_global_cache::dump (FILE *f)
// --------------------------------------------------------------------------
-ranger_cache::ranger_cache (range_query &q) : query (q)
+
+// This struct provides a timestamp for a global range calculation.
+// it contains the time counter, as well as a limited number of ssa-names
+// that it is dependent upon. If the timestamp for any of the dependent names
+// Are newer, then this range could need updating.
+
+struct range_timestamp
+{
+ unsigned time;
+ unsigned ssa1;
+ unsigned ssa2;
+};
+
+// This class will manage the timestamps for each ssa_name.
+// When a value is calcualted, its timestamp is set to the current time.
+// The ssanames it is dependent on have already been calculated, so they will
+// have older times. If one fo those values is ever calculated again, it
+// will get a newer timestamp, and the "current_p" check will fail.
+
+class temporal_cache
+{
+public:
+ temporal_cache ();
+ ~temporal_cache ();
+ bool current_p (tree name) const;
+ void set_timestamp (tree name);
+ void set_dependency (tree name, tree dep);
+ void set_always_current (tree name);
+private:
+ unsigned temporal_value (unsigned ssa) const;
+ const range_timestamp *get_timestamp (unsigned ssa) const;
+ range_timestamp *get_timestamp (unsigned ssa);
+
+ unsigned m_current_time;
+ vec <range_timestamp> m_timestamp;
+};
+
+
+inline
+temporal_cache::temporal_cache ()
+{
+ m_current_time = 1;
+ m_timestamp.create (0);
+ m_timestamp.safe_grow_cleared (num_ssa_names);
+}
+
+inline
+temporal_cache::~temporal_cache ()
+{
+ m_timestamp.release ();
+}
+
+// Return a pointer to the timetamp for ssa-name at index SSA, if there is
+// one, otherwise return NULL.
+
+inline const range_timestamp *
+temporal_cache::get_timestamp (unsigned ssa) const
+{
+ if (ssa >= m_timestamp.length ())
+ return NULL;
+ return &(m_timestamp[ssa]);
+}
+
+// Return a reference to the timetamp for ssa-name at index SSA. If the index
+// is past the end of the vector, extend the vector.
+
+inline range_timestamp *
+temporal_cache::get_timestamp (unsigned ssa)
+{
+ if (ssa >= m_timestamp.length ())
+ m_timestamp.safe_grow_cleared (num_ssa_names + 20);
+ return &(m_timestamp[ssa]);
+}
+
+// This routine will fill NAME's next operand slot with DEP if DEP is a valid
+// SSA_NAME and there is a free slot.
+
+inline void
+temporal_cache::set_dependency (tree name, tree dep)
+{
+ if (dep && TREE_CODE (dep) == SSA_NAME)
+ {
+ gcc_checking_assert (get_timestamp (SSA_NAME_VERSION (name)));
+ range_timestamp& ts = *(get_timestamp (SSA_NAME_VERSION (name)));
+ if (!ts.ssa1)
+ ts.ssa1 = SSA_NAME_VERSION (dep);
+ else if (!ts.ssa2 && ts.ssa1 != SSA_NAME_VERSION (name))
+ ts.ssa2 = SSA_NAME_VERSION (dep);
+ }
+}
+
+// Return the timestamp value for SSA, or 0 if there isnt one.
+inline unsigned
+temporal_cache::temporal_value (unsigned ssa) const
+{
+ const range_timestamp *ts = get_timestamp (ssa);
+ return ts ? ts->time : 0;
+}
+
+// Return TRUE if the timestampe for NAME is newer than any of its dependents.
+
+bool
+temporal_cache::current_p (tree name) const
+{
+ const range_timestamp *ts = get_timestamp (SSA_NAME_VERSION (name));
+ if (!ts || ts->time == 0)
+ return true;
+ // Any non-registered dependencies will have a value of 0 and thus be older.
+ // Return true if time is newer than either dependent.
+ return ts->time > temporal_value (ts->ssa1)
+ && ts->time > temporal_value (ts->ssa2);
+}
+
+// This increments the global timer and sets the timestamp for NAME.
+
+inline void
+temporal_cache::set_timestamp (tree name)
+{
+ gcc_checking_assert (get_timestamp (SSA_NAME_VERSION (name)));
+ get_timestamp (SSA_NAME_VERSION (name))->time = ++m_current_time;
+}
+
+// Set the timestamp to 0, marking it as "always up to date".
+
+inline void
+temporal_cache::set_always_current (tree name)
+{
+ gcc_checking_assert (get_timestamp (SSA_NAME_VERSION (name)));
+ get_timestamp (SSA_NAME_VERSION (name))->time = 0;
+}
+
+
+// --------------------------------------------------------------------------
+
+ranger_cache::ranger_cache (gimple_ranger &q) : query (q)
{
m_workback.create (0);
m_workback.safe_grow_cleared (last_basic_block_for_fn (cfun));
@@ -467,15 +622,106 @@ ranger_cache::ranger_cache (range_query &q) : query (q)
m_poor_value_list.create (0);
m_poor_value_list.safe_grow_cleared (20);
m_poor_value_list.truncate (0);
+ m_temporal = new temporal_cache;
}
ranger_cache::~ranger_cache ()
{
+ delete m_temporal;
m_poor_value_list.release ();
m_workback.release ();
m_update_list.release ();
}
+// Dump the global caches to file F. if GORI_DUMP is true, dump the
+// gori map as well.
+
+void
+ranger_cache::dump (FILE *f, bool gori_dump)
+{
+ m_globals.dump (f);
+ if (gori_dump)
+ {
+ fprintf (f, "\nDUMPING GORI MAP\n");
+ gori_compute::dump (f);
+ }
+ fprintf (f, "\n");
+}
+
+// Dump the caches for basic block BB to file F.
+
+void
+ranger_cache::dump (FILE *f, basic_block bb)
+{
+ m_on_entry.dump (f, bb);
+}
+
+// Get the global range for NAME, and return in R. Return false if the
+// global range is not set.
+
+bool
+ranger_cache::get_global_range (irange &r, tree name) const
+{
+ return m_globals.get_global_range (r, name);
+}
+
+// Get the global range for NAME, and return in R if the value is not stale.
+// If the range is set, but is stale, mark it current and return false.
+// If it is not set pick up the legacy global value, mark it current, and
+// return false.
+// Note there is always a value returned in R. The return value indicates
+// whether that value is an up-to-date calculated value or not..
+
+bool
+ranger_cache::get_non_stale_global_range (irange &r, tree name)
+{
+ if (m_globals.get_global_range (r, name))
+ {
+ if (m_temporal->current_p (name))
+ return true;
+ }
+ else
+ {
+ // Global has never been accessed, so pickup the legacy global value.
+ r = gimple_range_global (name);
+ m_globals.set_global_range (name, r);
+ }
+ // After a stale check failure, mark the value as always current until a
+ // new one is set.
+ m_temporal->set_always_current (name);
+ return false;
+}
+// Set the global range of NAME to R.
+
+void
+ranger_cache::set_global_range (tree name, const irange &r)
+{
+ if (m_globals.set_global_range (name, r))
+ {
+ // If there was already a range set, propagate the new value.
+ basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (name));
+ if (!bb)
+ bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);
+
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " GLOBAL :");
+
+ propagate_updated_value (name, bb);
+ }
+ // Mark the value as up-to-date.
+ m_temporal->set_timestamp (name);
+}
+
+// Register a dependency on DEP to name. If the timestamp for DEP is ever
+// greateer than the timestamp for NAME, then it is newer and NAMEs value
+// becomes stale.
+
+void
+ranger_cache::register_dependency (tree name, tree dep)
+{
+ m_temporal->set_dependency (name, dep);
+}
+
// 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).
@@ -601,11 +847,11 @@ ranger_cache::add_to_update (basic_block bb)
m_update_list.quick_push (bb);
}
-// If there is anything in the iterative update_list, continue
+// If there is anything in the propagation update_list, continue
// processing NAME until the list of blocks is empty.
void
-ranger_cache::iterative_cache_update (tree name)
+ranger_cache::propagate_cache (tree name)
{
basic_block bb;
edge_iterator ei;
@@ -696,6 +942,50 @@ ranger_cache::iterative_cache_update (tree name)
}
}
+// Check to see if an update to the value for NAME in BB has any effect
+// on values already in the on-entry cache for successor blocks.
+// If it does, update them. Don't visit any blocks which dont have a cache
+// entry.
+
+void
+ranger_cache::propagate_updated_value (tree name, basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+
+ // The update work list should be empty at this point.
+ gcc_checking_assert (m_update_list.length () == 0);
+ gcc_checking_assert (bb);
+
+ if (DEBUG_RANGE_CACHE)
+ {
+ fprintf (dump_file, " UPDATE cache for ");
+ print_generic_expr (dump_file, name, TDF_SLIM);
+ fprintf (dump_file, " in BB %d : successors : ", bb->index);
+ }
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ {
+ // Only update active cache entries.
+ if (m_on_entry.bb_range_p (name, e->dest))
+ {
+ add_to_update (e->dest);
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " UPDATE: bb%d", e->dest->index);
+ }
+ }
+ if (m_update_list.length () != 0)
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, "\n");
+ propagate_cache (name);
+ }
+ else
+ {
+ if (DEBUG_RANGE_CACHE)
+ fprintf (dump_file, " : No updates!\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.
@@ -805,13 +1095,13 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
fprintf (dump_file, "\n");
// Now fill in the marked blocks with values.
- iterative_cache_update (name);
+ propagate_cache (name);
if (DEBUG_RANGE_CACHE)
- fprintf (dump_file, " iterative update done.\n");
+ fprintf (dump_file, " Propagation 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
+ // Evaluate them, and inject any new values into the propagation
// list, and see if it improves any on-entry values.
if (poor_list_start != m_poor_value_list.length ())
{
@@ -827,51 +1117,25 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
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 ");
+ 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);
+ // Calculate a range at the exit from the block so the caches feeding
+ // this block will be filled, and we'll get a "better" value.
+ query.range_on_exit (tmp, calc_bb, 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);
+ // Then ask for NAME to be re-evaluated on outgoing edges and
+ // use any new values.
+ propagate_updated_value (name, calc_bb);
}
}
-
}
+
diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h
index 29ab01e..c5749fe 100644
--- a/gcc/gimple-range-cache.h
+++ b/gcc/gimple-range-cache.h
@@ -60,6 +60,7 @@ public:
private:
vec<class ssa_block_ranges *> m_ssa_ranges;
ssa_block_ranges &get_block_ranges (tree name);
+ ssa_block_ranges *query_block_ranges (tree name);
irange_allocator *m_irange_allocator;
};
@@ -73,7 +74,7 @@ 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);
+ bool set_global_range (tree name, const irange &r);
void clear_global_range (tree name);
void clear ();
void dump (FILE *f = stderr);
@@ -89,19 +90,30 @@ private:
class ranger_cache : public gori_compute_cache
{
public:
- ranger_cache (class range_query &q);
+ ranger_cache (class gimple_ranger &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;
+ bool get_global_range (irange &r, tree name) const;
+ bool get_non_stale_global_range (irange &r, tree name);
+ void set_global_range (tree name, const irange &r);
+ void register_dependency (tree name, tree dep);
+
non_null_ref m_non_null;
+
+ void dump (FILE *f, bool dump_gori = true);
+ void dump (FILE *f, basic_block bb);
private:
+ ssa_global_cache m_globals;
+ block_range_cache m_on_entry;
+ class temporal_cache *m_temporal;
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);
+ void propagate_cache (tree name);
+
+ void propagate_updated_value (tree name, basic_block bb);
vec<basic_block> m_workback;
vec<basic_block> m_update_list;
@@ -114,7 +126,7 @@ private:
};
bool push_poor_value (basic_block bb, tree name);
vec<update_record> m_poor_value_list;
- class range_query &query;
+ class gimple_ranger &query;
};
#endif // GCC_SSA_RANGE_CACHE_H
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index c5ee54f..b42dcd6 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -106,19 +106,14 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
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);
- irange *&default_slot = m_edge_table->get_or_insert (default_edge, &existed);
- // This should be the first call into this switch. For the default
- // range case, start with varying and intersect each other case from
- // it.
-
- gcc_checking_assert (!existed);
-
- // Allocate an int_range_max for default case.
- default_slot = m_range_allocator.allocate (255);
- default_slot->set_varying (type);
+ // 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++)
{
@@ -137,7 +132,7 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
int_range_max def_range (low, high);
range_cast (def_range, type);
def_range.invert ();
- default_slot->intersect (def_range);
+ default_range->intersect (def_range);
// Create/union this case with anything on else on the edge.
int_range_max case_range (low, high);
@@ -157,6 +152,11 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
// 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;
}
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 9864276..af3609e 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -618,7 +618,7 @@ range_is_either_true_or_false (const irange &r)
// 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 (types_compatible_p (type, boolean_type_node));
+ gcc_checking_assert (range_compatible_p (type, boolean_type_node));
return (r.singleton_p () || !r.contains_p (build_zero_cst (type)));
}
@@ -730,8 +730,8 @@ gori_compute::logical_combine (irange &r, enum tree_code code,
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].
+ // operands are false simlulateously, which means they should
+ // be intersected. !(x || y) == !x && !y
r = op1.false_range;
r.intersect (op2.false_range);
}
@@ -804,9 +804,12 @@ gori_compute::compute_logical_operands_in_chain (tf_range &range,
tree name,
tree op, bool op_in_chain)
{
- if (!op_in_chain)
+ gimple *src_stmt = gimple_range_ssa_p (op) ? SSA_NAME_DEF_STMT (op) : NULL;
+ basic_block bb = gimple_bb (stmt);
+ if (!op_in_chain || (src_stmt != NULL && bb != gimple_bb (src_stmt)))
{
- // If op is not in chain, use its known value.
+ // If op is not in the def chain, or defined in this block,
+ // use its known value on entry to the block.
expr_range_in_bb (range.true_range, name, gimple_bb (stmt));
range.false_range = range.true_range;
return;
@@ -814,14 +817,12 @@ gori_compute::compute_logical_operands_in_chain (tf_range &range,
if (optimize_logical_operands (range, stmt, lhs, name, op))
return;
- // Calulate ranges for true and false on both sides, since the false
+ // Calculate 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));
+ if (!compute_operand_range (range.true_range, src_stmt, m_bool_one, name))
+ expr_range_in_bb (range.true_range, name, bb);
+ if (!compute_operand_range (range.false_range, src_stmt, m_bool_zero, name))
+ expr_range_in_bb (range.false_range, name, bb);
}
// Given a logical STMT, calculate true and false for each potential
@@ -920,8 +921,9 @@ gori_compute::compute_operand2_range (irange &r, gimple *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))
- op2_range.intersect (r);
+ 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.
@@ -998,11 +1000,20 @@ gori_compute::outgoing_edge_range_p (irange &r, edge e, tree name)
// If NAME can be calculated on the edge, use that.
if (m_gori_map->is_export_p (name, e->src))
- return compute_operand_range (r, stmt, lhs, name);
-
- // Otherwise see if NAME is derived from something that can be
- // calculated. This performs no dynamic lookups whatsover, so it is
- // low cost.
+ {
+ 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;
}
@@ -1303,13 +1314,15 @@ gori_compute_cache::cache_stmt (gimple *stmt)
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));
+ bool ok = m_cache->get_range (op1_range, op1, cached_name);
+ ok = ok && m_cache->get_range (op2_range, op2, cached_name);
+ ok = ok && logical_combine (r_true_side, code, m_bool_one,
+ op1_range, op2_range);
+ ok = ok && logical_combine (r_false_side, code, m_bool_zero,
+ op1_range, op2_range);
+ gcc_checking_assert (ok);
+ if (ok)
+ m_cache->set_range (lhs, cached_name,
+ tf_range (r_true_side, r_false_side));
}
}
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 2ca86ed..92a6335 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -144,7 +144,7 @@ gimple_range_adjustment (irange &res, const gimple *stmt)
}
// Return a range in R for the tree EXPR. Return true if a range is
-// representable.
+// representable, and UNDEFINED/false if not.
bool
get_tree_range (irange &r, tree expr)
@@ -157,11 +157,16 @@ get_tree_range (irange &r, tree expr)
// Return false if the type isn't suported.
if (!irange::supports_type_p (type))
- return false;
+ {
+ r.set_undefined ();
+ return false;
+ }
switch (TREE_CODE (expr))
{
case INTEGER_CST:
+ if (TREE_OVERFLOW_P (expr))
+ expr = drop_tree_overflow (expr);
r.set (expr, expr);
return true;
@@ -373,7 +378,8 @@ gimple_ranger::calc_stmt (irange &r, gimple *s, tree name)
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 (!res)
{
// If no name is specified, try the expression kind.
if (!name)
@@ -384,19 +390,24 @@ gimple_ranger::calc_stmt (irange &r, gimple *s, tree name)
r.set_varying (t);
return true;
}
+ if (!gimple_range_ssa_p (name))
+ return false;
// 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 ())
{
- if (r.undefined_p ())
- return true;
- if (name && TREE_TYPE (name) != r.type ())
- range_cast (r, TREE_TYPE (name));
- return true;
+ gcc_checking_assert (range_compatible_p (r.type (), TREE_TYPE (name)));
+ range_cast (r, TREE_TYPE (name));
}
- return false;
+ return true;
}
// Calculate a range for range_op statement S and return it in R. If any
@@ -406,12 +417,20 @@ bool
gimple_ranger::range_of_range_op (irange &r, gimple *s)
{
int_range_max range1, range2;
+ tree lhs = gimple_get_lhs (s);
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 (lhs)
+ {
+ // Register potential dependencies for stale value tracking.
+ m_cache.register_dependency (lhs, op1);
+ m_cache.register_dependency (lhs, op2);
+ }
+
if (range_of_non_trivial_assignment (r, s))
return true;
@@ -440,17 +459,31 @@ gimple_ranger::range_of_non_trivial_assignment (irange &r, gimple *stmt)
return false;
tree base = gimple_range_base_of_assignment (stmt);
- if (base && TREE_CODE (base) == MEM_REF
- && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME)
+ if (base)
{
- int_range_max range1;
- tree ssa = TREE_OPERAND (base, 0);
- if (range_of_expr (range1, ssa, stmt))
+ if (TREE_CODE (base) == MEM_REF)
{
- 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);
+ 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;
}
}
@@ -478,6 +511,9 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi)
tree arg = gimple_phi_arg_def (phi, x);
edge e = gimple_phi_arg_edge (phi, x);
+ // Register potential dependencies for stale value tracking.
+ m_cache.register_dependency (phi_def, arg);
+
range_on_edge (arg_range, e, arg);
r.union_ (arg_range);
// Once the value reaches varying, stop looking.
@@ -490,7 +526,7 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi)
{
value_range loop_range;
class loop *l = loop_containing_stmt (phi);
- if (l)
+ if (l && loop_outer (l))
{
range_of_ssa_name_with_loop_info (loop_range, phi_def, l, phi);
if (!loop_range.varying_p ())
@@ -546,10 +582,13 @@ gimple_ranger::range_of_call (irange &r, gcall *call)
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).
-void
-gimple_ranger::range_of_builtin_ubsan_call (irange &r, gcall *call,
- tree_code code)
+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);
@@ -559,8 +598,8 @@ gimple_ranger::range_of_builtin_ubsan_call (irange &r, gcall *call,
int_range_max ir0, ir1;
tree arg0 = gimple_call_arg (call, 0);
tree arg1 = gimple_call_arg (call, 1);
- gcc_assert (range_of_expr (ir0, arg0, call));
- gcc_assert (range_of_expr (ir1, arg1, call));
+ query.range_of_expr (ir0, arg0, call);
+ query.range_of_expr (ir1, arg1, call);
bool saved_flag_wrapv = flag_wrapv;
// Pretend the arithmetic is wrapping. If there is any overflow,
@@ -576,9 +615,11 @@ gimple_ranger::range_of_builtin_ubsan_call (irange &r, gcall *call,
r.set_varying (type);
}
+// For a builtin in CALL, return a range in R if known and return
+// TRUE. Otherwise return FALSE.
bool
-gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
+range_of_builtin_call (range_query &query, irange &r, gcall *call)
{
combined_fn func = gimple_call_combined_fn (call);
if (func == CFN_LAST)
@@ -586,7 +627,7 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
tree type = gimple_call_return_type (call);
tree arg;
- int mini, maxi, zerov, prec;
+ int mini, maxi, zerov = 0, prec;
scalar_int_mode mode;
switch (func)
@@ -599,7 +640,7 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
return true;
}
arg = gimple_call_arg (call, 0);
- if (range_of_expr (r, arg, call) && r.singleton_p ())
+ if (query.range_of_expr (r, arg, call) && r.singleton_p ())
{
r.set (build_one_cst (type), build_one_cst (type));
return true;
@@ -613,7 +654,7 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
prec = TYPE_PRECISION (TREE_TYPE (arg));
mini = 0;
maxi = prec;
- gcc_assert (range_of_expr (r, arg, call));
+ 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;
@@ -657,7 +698,7 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
}
}
- gcc_assert (range_of_expr (r, arg, call));
+ query.range_of_expr (r, arg, call);
// From clz of minimum we can compute result maximum.
if (r.constant_p ())
{
@@ -722,7 +763,7 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
mini = -2;
}
}
- gcc_assert (range_of_expr (r, arg, call));
+ query.range_of_expr (r, arg, call);
if (!r.undefined_p ())
{
if (r.lower_bound () != 0)
@@ -760,13 +801,13 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
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 (r, call, PLUS_EXPR);
+ range_of_builtin_ubsan_call (query, r, call, PLUS_EXPR);
return true;
case CFN_UBSAN_CHECK_SUB:
- range_of_builtin_ubsan_call (r, call, MINUS_EXPR);
+ range_of_builtin_ubsan_call (query, r, call, MINUS_EXPR);
return true;
case CFN_UBSAN_CHECK_MUL:
- range_of_builtin_ubsan_call (r, call, MULT_EXPR);
+ range_of_builtin_ubsan_call (query, r, call, MULT_EXPR);
return true;
case CFN_GOACC_DIM_SIZE:
@@ -816,6 +857,11 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
}
+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.
@@ -834,9 +880,9 @@ gimple_ranger::range_of_cond_expr (irange &r, gassign *s)
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));
+ range_of_expr (cond_range, cond, s);
+ range_of_expr (range1, op1, s);
+ range_of_expr (range2, op2, s);
// If the condition is known, choose the appropriate expression.
if (cond_range.singleton_p ())
@@ -864,7 +910,7 @@ gimple_ranger::range_of_expr (irange &r, tree expr, gimple *stmt)
// If there is no statement, just get the global value.
if (!stmt)
{
- if (!m_cache.m_globals.get_global_range (r, expr))
+ if (!m_cache.get_global_range (r, expr))
r = gimple_range_global (expr);
return true;
}
@@ -874,7 +920,7 @@ gimple_ranger::range_of_expr (irange &r, tree expr, gimple *stmt)
// 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));
+ 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);
@@ -903,7 +949,7 @@ gimple_ranger::range_on_entry (irange &r, basic_block bb, tree name)
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));
+ 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))
@@ -918,6 +964,7 @@ 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));
+ gcc_checking_assert (gimple_range_ssa_p (name));
gimple *s = last_stmt (bb);
// If there is no statement in the block and this isn't the entry
@@ -926,9 +973,9 @@ gimple_ranger::range_on_exit (irange &r, basic_block bb, tree 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));
+ range_of_expr (r, name, s);
gcc_checking_assert (r.undefined_p ()
- || types_compatible_p (r.type(), TREE_TYPE (name)));
+ || range_compatible_p (r.type (), TREE_TYPE (name)));
}
// Calculate a range for NAME on edge E and return it in R.
@@ -941,14 +988,11 @@ gimple_ranger::range_on_edge (irange &r, edge e, tree name)
// PHI arguments can be constants, catch these here.
if (!gimple_range_ssa_p (name))
- {
- gcc_assert (range_of_expr (r, name));
- return true;
- }
+ return range_of_expr (r, name);
range_on_exit (r, e->src, name);
gcc_checking_assert (r.undefined_p ()
- || types_compatible_p (r.type(), TREE_TYPE (name)));
+ || 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))
@@ -961,33 +1005,36 @@ gimple_ranger::range_on_edge (irange &r, edge e, tree name)
// 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.
+// avoided. If a range cannot be calculated, return false and UNDEFINED.
bool
gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name)
{
- // If no name, simply call the base routine.
+ r.set_undefined ();
+
if (!name)
name = gimple_get_lhs (s);
+ // If no name, simply call the base routine.
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 (!gimple_range_ssa_p (name))
+ return false;
- // If this STMT has already been processed, return that value.
- if (m_cache.m_globals.get_global_range (r, name))
+ // Check if the stmt has already been processed, and is not stale.
+ if (m_cache.get_non_stale_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));
+ // Otherwise calculate a new value.
+ int_range_max tmp;
+ calc_stmt (tmp, s, name);
- if (is_a<gphi *> (s))
- r.intersect (tmp);
- m_cache.m_globals.set_global_range (name, r);
+ // Combine the new value with the old value. This is required because
+ // the way value propagation works, when the IL changes on the fly we
+ // can sometimes get different results. See PR 97741.
+ r.intersect (tmp);
+ m_cache.set_global_range (name, r);
return true;
}
@@ -1010,7 +1057,7 @@ gimple_ranger::export_global_ranges ()
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)
+ && m_cache.get_global_range (r, name)
&& !r.varying_p())
{
// Make sure the new range is a subset of the old range.
@@ -1054,7 +1101,7 @@ gimple_ranger::dump (FILE *f)
edge e;
int_range_max range;
fprintf (f, "\n=========== BB %d ============\n", bb->index);
- m_cache.m_on_entry.dump (f, bb);
+ m_cache.dump (f, bb);
dump_bb (f, bb, 4, TDF_NONE);
@@ -1064,7 +1111,7 @@ gimple_ranger::dump (FILE *f)
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))
+ m_cache.get_global_range (range, name))
{
if (!range.varying_p ())
{
@@ -1116,15 +1163,7 @@ gimple_ranger::dump (FILE *f)
}
}
- 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");
- }
+ m_cache.dump (dump_file, (dump_flags & TDF_DETAILS) != 0);
}
// If SCEV has any information about phi node NAME, return it as a range in R.
diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h
index 041dc7c..0aa6d46 100644
--- a/gcc/gimple-range.h
+++ b/gcc/gimple-range.h
@@ -64,7 +64,6 @@ 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);
- void range_of_builtin_ubsan_call (irange &r, gcall *call, tree_code code);
bool range_with_loop_info (irange &r, tree name);
void range_of_ssa_name_with_loop_info (irange &, tree, class loop *,
gphi *);
@@ -115,6 +114,18 @@ gimple_range_ssa_p (tree 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.
@@ -167,4 +178,7 @@ private:
// 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.c b/gcc/gimple-ssa-evrp.c
index 7688e4a..309cdd9 100644
--- a/gcc/gimple-ssa-evrp.c
+++ b/gcc/gimple-ssa-evrp.c
@@ -239,7 +239,9 @@ hybrid_folder::value_of_expr (tree op, gimple *stmt)
tree
hybrid_folder::value_on_edge (edge e, tree op)
{
- tree evrp_ret = evrp_folder::value_on_edge (e, 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);
}
@@ -247,7 +249,14 @@ hybrid_folder::value_on_edge (edge e, tree op)
tree
hybrid_folder::value_of_stmt (gimple *stmt, tree op)
{
- tree evrp_ret = evrp_folder::value_of_stmt (stmt, 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);
}
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 28fc2e2..6089faf 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -851,12 +851,16 @@ find_bswap_or_nop_finalize (struct symbolic_number *n, uint64_t *cmpxchg,
gimple *
find_bswap_or_nop (gimple *stmt, struct symbolic_number *n, bool *bswap)
{
+ tree type_size = TYPE_SIZE_UNIT (gimple_expr_type (stmt));
+ if (!tree_fits_uhwi_p (type_size))
+ return NULL;
+
/* The last parameter determines the depth search limit. It usually
correlates directly to the number n of bytes to be touched. We
increase that number by 2 * (log2(n) + 1) here in order to also
cover signed -> unsigned conversions of the src operand as can be seen
in libgcc, and for initial shift/and operation of the src operand. */
- int limit = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (gimple_expr_type (stmt)));
+ int limit = tree_to_uhwi (type_size);
limit += 2 * (1 + (int) ceil_log2 ((unsigned HOST_WIDE_INT) limit));
gimple *ins_stmt = find_bswap_or_nop_1 (stmt, n, limit);
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 e2734c8..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, SR_ALLOW_ZERO);
+ 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 f19e24d..1afed88 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1487,23 +1487,43 @@ gimple_call_flags (const gimple *stmt)
/* Return the "fn spec" string for call STMT. */
-static const_tree
+attr_fnspec
gimple_call_fnspec (const gcall *stmt)
{
tree type, attr;
if (gimple_call_internal_p (stmt))
- return internal_fn_fnspec (gimple_call_internal_fn (stmt));
+ {
+ const_tree spec = internal_fn_fnspec (gimple_call_internal_fn (stmt));
+ if (spec)
+ return spec;
+ else
+ return "";
+ }
type = gimple_call_fntype (stmt);
- if (!type)
- return NULL_TREE;
-
- attr = lookup_attribute ("fn spec", TYPE_ATTRIBUTES (type));
- if (!attr)
- return NULL_TREE;
-
- return TREE_VALUE (TREE_VALUE (attr));
+ if (type)
+ {
+ attr = lookup_attribute ("fn spec", TYPE_ATTRIBUTES (type));
+ if (attr)
+ return TREE_VALUE (TREE_VALUE (attr));
+ }
+ if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
+ return builtin_fnspec (gimple_call_fndecl (stmt));
+ tree fndecl = gimple_call_fndecl (stmt);
+ /* 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 we can treat it as free. */
+ if (fndecl
+ && DECL_IS_OPERATOR_DELETE_P (fndecl)
+ && gimple_call_from_new_or_delete (stmt))
+ return ".co ";
+ /* Similarly operator new can be treated as malloc. */
+ if (fndecl
+ && DECL_IS_OPERATOR_NEW_P (fndecl)
+ && gimple_call_from_new_or_delete (stmt))
+ return "mC";
+ return "";
}
/* Detects argument flags for argument number ARG on call STMT. */
@@ -1511,13 +1531,12 @@ gimple_call_fnspec (const gcall *stmt)
int
gimple_call_arg_flags (const gcall *stmt, unsigned arg)
{
- const_tree attr = gimple_call_fnspec (stmt);
+ attr_fnspec fnspec = gimple_call_fnspec (stmt);
- if (!attr)
+ if (!fnspec.known_p ())
return 0;
int flags = 0;
- attr_fnspec fnspec (attr);
if (!fnspec.arg_specified_p (arg))
;
@@ -1540,15 +1559,10 @@ gimple_call_arg_flags (const gcall *stmt, unsigned arg)
int
gimple_call_return_flags (const gcall *stmt)
{
- const_tree attr;
-
if (gimple_call_flags (stmt) & ECF_MALLOC)
return ERF_NOALIAS;
- attr = gimple_call_fnspec (stmt);
- if (!attr)
- return 0;
- attr_fnspec fnspec (attr);
+ attr_fnspec fnspec = gimple_call_fnspec (stmt);
unsigned int arg_no;
if (fnspec.returns_arg (&arg_no))
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 3c9b996..62b5a8a 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3405,7 +3405,7 @@ gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
from a new or delete expression. */
static inline bool
-gimple_call_from_new_or_delete (gcall *s)
+gimple_call_from_new_or_delete (const gcall *s)
{
return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
}
@@ -6598,6 +6598,8 @@ gimple_expr_type (const gimple *stmt)
}
else if (code == GIMPLE_COND)
return boolean_type_node;
+ else if (code == GIMPLE_PHI)
+ return TREE_TYPE (gimple_phi_result (stmt));
else
return void_type_node;
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index fa89e79..b2c623b 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);
}
@@ -8361,6 +8364,113 @@ extract_base_bit_offset (tree base, tree *base_ref, poly_int64 *bitposp,
return base;
}
+/* Returns true if EXPR is or contains (as a sub-component) BASE_PTR. */
+
+static bool
+is_or_contains_p (tree expr, tree base_ptr)
+{
+ while (expr != base_ptr)
+ if (TREE_CODE (base_ptr) == COMPONENT_REF)
+ base_ptr = TREE_OPERAND (base_ptr, 0);
+ else
+ break;
+ return expr == base_ptr;
+}
+
+/* Implement OpenMP 5.x map ordering rules for target directives. There are
+ several rules, and with some level of ambiguity, hopefully we can at least
+ collect the complexity here in one place. */
+
+static void
+omp_target_reorder_clauses (tree *list_p)
+{
+ /* Collect refs to alloc/release/delete maps. */
+ auto_vec<tree, 32> ard;
+ tree *cp = list_p;
+ while (*cp != NULL_TREE)
+ if (OMP_CLAUSE_CODE (*cp) == OMP_CLAUSE_MAP
+ && (OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_ALLOC
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_RELEASE
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_DELETE))
+ {
+ /* Unlink cp and push to ard. */
+ tree c = *cp;
+ tree nc = OMP_CLAUSE_CHAIN (c);
+ *cp = nc;
+ ard.safe_push (c);
+
+ /* Any associated pointer type maps should also move along. */
+ while (*cp != NULL_TREE
+ && OMP_CLAUSE_CODE (*cp) == OMP_CLAUSE_MAP
+ && (OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_FIRSTPRIVATE_REFERENCE
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_FIRSTPRIVATE_POINTER
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_ATTACH_DETACH
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_POINTER
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_ALWAYS_POINTER
+ || OMP_CLAUSE_MAP_KIND (*cp) == GOMP_MAP_TO_PSET))
+ {
+ c = *cp;
+ nc = OMP_CLAUSE_CHAIN (c);
+ *cp = nc;
+ ard.safe_push (c);
+ }
+ }
+ else
+ cp = &OMP_CLAUSE_CHAIN (*cp);
+
+ /* Link alloc/release/delete maps to the end of list. */
+ for (unsigned int i = 0; i < ard.length (); i++)
+ {
+ *cp = ard[i];
+ cp = &OMP_CLAUSE_CHAIN (ard[i]);
+ }
+ *cp = NULL_TREE;
+
+ /* OpenMP 5.0 requires that pointer variables are mapped before
+ its use as a base-pointer. */
+ auto_vec<tree *, 32> atf;
+ for (tree *cp = list_p; *cp; cp = &OMP_CLAUSE_CHAIN (*cp))
+ if (OMP_CLAUSE_CODE (*cp) == OMP_CLAUSE_MAP)
+ {
+ /* Collect alloc, to, from, to/from clause tree pointers. */
+ gomp_map_kind k = OMP_CLAUSE_MAP_KIND (*cp);
+ if (k == GOMP_MAP_ALLOC
+ || k == GOMP_MAP_TO
+ || k == GOMP_MAP_FROM
+ || k == GOMP_MAP_TOFROM
+ || k == GOMP_MAP_ALWAYS_TO
+ || k == GOMP_MAP_ALWAYS_FROM
+ || k == GOMP_MAP_ALWAYS_TOFROM)
+ atf.safe_push (cp);
+ }
+
+ for (unsigned int i = 0; i < atf.length (); i++)
+ if (atf[i])
+ {
+ tree *cp = atf[i];
+ tree decl = OMP_CLAUSE_DECL (*cp);
+ if (TREE_CODE (decl) == INDIRECT_REF || TREE_CODE (decl) == MEM_REF)
+ {
+ tree base_ptr = TREE_OPERAND (decl, 0);
+ STRIP_TYPE_NOPS (base_ptr);
+ for (unsigned int j = i + 1; j < atf.length (); j++)
+ {
+ tree *cp2 = atf[j];
+ tree decl2 = OMP_CLAUSE_DECL (*cp2);
+ if (is_or_contains_p (decl2, base_ptr))
+ {
+ /* Move *cp2 to before *cp. */
+ tree c = *cp2;
+ *cp2 = OMP_CLAUSE_CHAIN (c);
+ OMP_CLAUSE_CHAIN (c) = *cp;
+ *cp = c;
+ atf[j] = NULL;
+ }
+ }
+ }
+ }
+}
+
/* Scan the OMP clauses in *LIST_P, installing mappings into a new
and previous omp contexts. */
@@ -8402,6 +8512,12 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
break;
}
+ if (code == OMP_TARGET
+ || code == OMP_TARGET_DATA
+ || code == OMP_TARGET_ENTER_DATA
+ || code == OMP_TARGET_EXIT_DATA)
+ omp_target_reorder_clauses (list_p);
+
while ((c = *list_p) != NULL)
{
bool remove = false;
@@ -8842,15 +8958,18 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
}
else if ((OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
|| (OMP_CLAUSE_MAP_KIND (c)
- == GOMP_MAP_FIRSTPRIVATE_REFERENCE))
+ == GOMP_MAP_FIRSTPRIVATE_REFERENCE)
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
&& TREE_CODE (OMP_CLAUSE_SIZE (c)) != INTEGER_CST)
{
OMP_CLAUSE_SIZE (c)
= get_initialized_tmp_var (OMP_CLAUSE_SIZE (c), pre_p, NULL,
false);
- omp_add_variable (ctx, OMP_CLAUSE_SIZE (c),
- GOVD_FIRSTPRIVATE | GOVD_SEEN);
+ if ((region_type & ORT_TARGET) != 0)
+ omp_add_variable (ctx, OMP_CLAUSE_SIZE (c),
+ GOVD_FIRSTPRIVATE | GOVD_SEEN);
}
+
if (!DECL_P (decl))
{
tree d = decl, *pd;
@@ -8875,7 +8994,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
bool indir_p = false;
tree orig_decl = decl;
tree decl_ref = NULL_TREE;
- if ((region_type & ORT_ACC) != 0
+ if ((region_type & (ORT_ACC | ORT_TARGET | ORT_TARGET_DATA)) != 0
&& TREE_CODE (*pd) == COMPONENT_REF
&& OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH
&& code != OACC_UPDATE)
@@ -8883,9 +9002,11 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
while (TREE_CODE (decl) == COMPONENT_REF)
{
decl = TREE_OPERAND (decl, 0);
- if ((TREE_CODE (decl) == MEM_REF
- && integer_zerop (TREE_OPERAND (decl, 1)))
- || INDIRECT_REF_P (decl))
+ if (((TREE_CODE (decl) == MEM_REF
+ && integer_zerop (TREE_OPERAND (decl, 1)))
+ || INDIRECT_REF_P (decl))
+ && (TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0)))
+ == POINTER_TYPE))
{
indir_p = true;
decl = TREE_OPERAND (decl, 0);
@@ -8912,8 +9033,9 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
}
if (decl != orig_decl && DECL_P (decl) && indir_p)
{
- gomp_map_kind k = (code == OACC_EXIT_DATA) ? GOMP_MAP_DETACH
- : GOMP_MAP_ATTACH;
+ gomp_map_kind k
+ = ((code == OACC_EXIT_DATA || code == OMP_TARGET_EXIT_DATA)
+ ? GOMP_MAP_DETACH : GOMP_MAP_ATTACH);
/* We have a dereference of a struct member. Make this an
attach/detach operation, and ensure the base pointer is
mapped as a FIRSTPRIVATE_POINTER. */
@@ -8922,6 +9044,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
tree next_clause = OMP_CLAUSE_CHAIN (c);
if (k == GOMP_MAP_ATTACH
&& code != OACC_ENTER_DATA
+ && code != OMP_TARGET_ENTER_DATA
&& (!next_clause
|| (OMP_CLAUSE_CODE (next_clause) != OMP_CLAUSE_MAP)
|| (OMP_CLAUSE_MAP_KIND (next_clause)
@@ -8969,17 +9092,12 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
if (code == OACC_UPDATE
&& OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ALWAYS_POINTER);
- if (gimplify_expr (pd, pre_p, NULL, is_gimple_lvalue, fb_lvalue)
- == GS_ERROR)
- {
- remove = true;
- break;
- }
if (DECL_P (decl)
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_DETACH
- && code != OACC_UPDATE)
+ && code != OACC_UPDATE
+ && code != OMP_TARGET_UPDATE)
{
if (error_operand_p (decl))
{
@@ -9041,15 +9159,19 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
bool has_attachments = false;
/* For OpenACC, pointers in structs should trigger an
attach action. */
- if (attach_detach && (region_type & ORT_ACC) != 0)
+ if (attach_detach
+ && ((region_type & (ORT_ACC | ORT_TARGET | ORT_TARGET_DATA))
+ || code == OMP_TARGET_ENTER_DATA
+ || code == OMP_TARGET_EXIT_DATA))
+
{
/* Turn a GOMP_MAP_ATTACH_DETACH clause into a
GOMP_MAP_ATTACH or GOMP_MAP_DETACH clause after we
have detected a case that needs a GOMP_MAP_STRUCT
mapping added. */
gomp_map_kind k
- = (code == OACC_EXIT_DATA) ? GOMP_MAP_DETACH
- : GOMP_MAP_ATTACH;
+ = ((code == OACC_EXIT_DATA || code == OMP_TARGET_EXIT_DATA)
+ ? GOMP_MAP_DETACH : GOMP_MAP_ATTACH);
OMP_CLAUSE_SET_MAP_KIND (c, k);
has_attachments = true;
}
@@ -9145,33 +9267,38 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
break;
if (scp)
continue;
- tree d1 = OMP_CLAUSE_DECL (*sc);
- tree d2 = OMP_CLAUSE_DECL (c);
- while (TREE_CODE (d1) == ARRAY_REF)
- d1 = TREE_OPERAND (d1, 0);
- while (TREE_CODE (d2) == ARRAY_REF)
- d2 = TREE_OPERAND (d2, 0);
- if (TREE_CODE (d1) == INDIRECT_REF)
- d1 = TREE_OPERAND (d1, 0);
- if (TREE_CODE (d2) == INDIRECT_REF)
- d2 = TREE_OPERAND (d2, 0);
- while (TREE_CODE (d1) == COMPONENT_REF)
- if (TREE_CODE (d2) == COMPONENT_REF
- && TREE_OPERAND (d1, 1)
- == TREE_OPERAND (d2, 1))
- {
+ if ((region_type & ORT_ACC) != 0)
+ {
+ /* This duplicate checking code is currently only
+ enabled for OpenACC. */
+ tree d1 = OMP_CLAUSE_DECL (*sc);
+ tree d2 = OMP_CLAUSE_DECL (c);
+ while (TREE_CODE (d1) == ARRAY_REF)
d1 = TREE_OPERAND (d1, 0);
+ while (TREE_CODE (d2) == ARRAY_REF)
d2 = TREE_OPERAND (d2, 0);
- }
- else
- break;
- if (d1 == d2)
- {
- error_at (OMP_CLAUSE_LOCATION (c),
- "%qE appears more than once in map "
- "clauses", OMP_CLAUSE_DECL (c));
- remove = true;
- break;
+ if (TREE_CODE (d1) == INDIRECT_REF)
+ d1 = TREE_OPERAND (d1, 0);
+ if (TREE_CODE (d2) == INDIRECT_REF)
+ d2 = TREE_OPERAND (d2, 0);
+ while (TREE_CODE (d1) == COMPONENT_REF)
+ if (TREE_CODE (d2) == COMPONENT_REF
+ && TREE_OPERAND (d1, 1)
+ == TREE_OPERAND (d2, 1))
+ {
+ d1 = TREE_OPERAND (d1, 0);
+ d2 = TREE_OPERAND (d2, 0);
+ }
+ else
+ break;
+ if (d1 == d2)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "%qE appears more than once in map "
+ "clauses", OMP_CLAUSE_DECL (c));
+ remove = true;
+ break;
+ }
}
if (maybe_lt (offset1, offsetn)
|| (known_eq (offset1, offsetn)
@@ -9217,6 +9344,14 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
}
}
}
+
+ if (gimplify_expr (pd, pre_p, NULL, is_gimple_lvalue, fb_lvalue)
+ == GS_ERROR)
+ {
+ remove = true;
+ break;
+ }
+
if (!remove
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_POINTER
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH_DETACH
@@ -9233,10 +9368,60 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
break;
}
+ else
+ {
+ /* DECL_P (decl) == true */
+ tree *sc;
+ if (struct_map_to_clause
+ && (sc = struct_map_to_clause->get (decl)) != NULL
+ && OMP_CLAUSE_MAP_KIND (*sc) == GOMP_MAP_STRUCT
+ && decl == OMP_CLAUSE_DECL (*sc))
+ {
+ /* We have found a map of the whole structure after a
+ leading GOMP_MAP_STRUCT has been created, so refill the
+ leading clause into a map of the whole structure
+ variable, and remove the current one.
+ TODO: we should be able to remove some maps of the
+ following structure element maps if they are of
+ compatible TO/FROM/ALLOC type. */
+ OMP_CLAUSE_SET_MAP_KIND (*sc, OMP_CLAUSE_MAP_KIND (c));
+ OMP_CLAUSE_SIZE (*sc) = unshare_expr (OMP_CLAUSE_SIZE (c));
+ remove = true;
+ break;
+ }
+ }
flags = GOVD_MAP | GOVD_EXPLICIT;
if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_TO
|| OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_TOFROM)
flags |= GOVD_MAP_ALWAYS_TO;
+
+ if ((code == OMP_TARGET
+ || code == OMP_TARGET_DATA
+ || code == OMP_TARGET_ENTER_DATA
+ || code == OMP_TARGET_EXIT_DATA)
+ && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
+ {
+ for (struct gimplify_omp_ctx *octx = outer_ctx; octx;
+ octx = octx->outer_context)
+ {
+ splay_tree_node n
+ = splay_tree_lookup (octx->variables,
+ (splay_tree_key) OMP_CLAUSE_DECL (c));
+ /* If this is contained in an outer OpenMP region as a
+ firstprivate value, remove the attach/detach. */
+ if (n && (n->value & GOVD_FIRSTPRIVATE))
+ {
+ OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_FIRSTPRIVATE_POINTER);
+ goto do_add;
+ }
+ }
+
+ enum gomp_map_kind map_kind = (code == OMP_TARGET_EXIT_DATA
+ ? GOMP_MAP_DETACH
+ : GOMP_MAP_ATTACH);
+ OMP_CLAUSE_SET_MAP_KIND (c, map_kind);
+ }
+
goto do_add;
case OMP_CLAUSE_DEPEND:
@@ -9705,6 +9890,28 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
omp_add_variable (ctx, decl, GOVD_NONTEMPORAL);
break;
+ case OMP_CLAUSE_ALLOCATE:
+ decl = OMP_CLAUSE_DECL (c);
+ if (error_operand_p (decl))
+ {
+ remove = true;
+ break;
+ }
+ if (gimplify_expr (&OMP_CLAUSE_ALLOCATE_ALLOCATOR (c), pre_p, NULL,
+ is_gimple_val, fb_rvalue) == GS_ERROR)
+ {
+ remove = true;
+ break;
+ }
+ else if (code == OMP_TASKLOOP
+ && OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)
+ && (TREE_CODE (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c))
+ != INTEGER_CST))
+ OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)
+ = get_initialized_tmp_var (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c),
+ pre_p, NULL, false);
+ break;
+
case OMP_CLAUSE_DEFAULT:
ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c);
break;
@@ -10615,6 +10822,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
case OMP_CLAUSE_FINALIZE:
case OMP_CLAUSE_INCLUSIVE:
case OMP_CLAUSE_EXCLUSIVE:
+ case OMP_CLAUSE_ALLOCATE:
break;
default:
@@ -12101,6 +12309,20 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
tree *gtask_clauses_ptr = &task_clauses;
tree outer_for_clauses = NULL_TREE;
tree *gforo_clauses_ptr = &outer_for_clauses;
+ bitmap lastprivate_uids = NULL;
+ if (omp_find_clause (c, OMP_CLAUSE_ALLOCATE))
+ {
+ c = omp_find_clause (c, OMP_CLAUSE_LASTPRIVATE);
+ if (c)
+ {
+ lastprivate_uids = BITMAP_ALLOC (NULL);
+ for (; c; c = omp_find_clause (OMP_CLAUSE_CHAIN (c),
+ OMP_CLAUSE_LASTPRIVATE))
+ bitmap_set_bit (lastprivate_uids,
+ DECL_UID (OMP_CLAUSE_DECL (c)));
+ }
+ c = *gfor_clauses_ptr;
+ }
for (; c; c = OMP_CLAUSE_CHAIN (c))
switch (OMP_CLAUSE_CODE (c))
{
@@ -12146,7 +12368,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
*gforo_clauses_ptr = c;
gforo_clauses_ptr = &OMP_CLAUSE_CHAIN (c);
break;
- /* Taskloop clause we duplicate on both taskloops. */
+ /* Collapse clause we duplicate on both taskloops. */
case OMP_CLAUSE_COLLAPSE:
*gfor_clauses_ptr = c;
gfor_clauses_ptr = &OMP_CLAUSE_CHAIN (c);
@@ -12188,12 +12410,43 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
gtask_clauses_ptr
= &OMP_CLAUSE_CHAIN (*gtask_clauses_ptr);
break;
+ /* Allocate clause we duplicate on task and inner taskloop
+ if the decl is lastprivate, otherwise just put on task. */
+ case OMP_CLAUSE_ALLOCATE:
+ if (lastprivate_uids
+ && bitmap_bit_p (lastprivate_uids,
+ DECL_UID (OMP_CLAUSE_DECL (c))))
+ {
+ if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)
+ && DECL_P (OMP_CLAUSE_ALLOCATE_ALLOCATOR (c)))
+ {
+ /* Additionally, put firstprivate clause on task
+ for the allocator if it is not constant. */
+ *gtask_clauses_ptr
+ = build_omp_clause (OMP_CLAUSE_LOCATION (c),
+ OMP_CLAUSE_FIRSTPRIVATE);
+ OMP_CLAUSE_DECL (*gtask_clauses_ptr)
+ = OMP_CLAUSE_ALLOCATE_ALLOCATOR (c);
+ gtask_clauses_ptr = &OMP_CLAUSE_CHAIN (*gtask_clauses_ptr);
+ }
+ *gfor_clauses_ptr = c;
+ gfor_clauses_ptr = &OMP_CLAUSE_CHAIN (c);
+ *gtask_clauses_ptr = copy_node (c);
+ gtask_clauses_ptr = &OMP_CLAUSE_CHAIN (*gtask_clauses_ptr);
+ }
+ else
+ {
+ *gtask_clauses_ptr = c;
+ gtask_clauses_ptr = &OMP_CLAUSE_CHAIN (c);
+ }
+ break;
default:
gcc_unreachable ();
}
*gfor_clauses_ptr = NULL_TREE;
*gtask_clauses_ptr = NULL_TREE;
*gforo_clauses_ptr = NULL_TREE;
+ BITMAP_FREE (lastprivate_uids);
g = gimple_build_bind (NULL_TREE, gfor, NULL_TREE);
g = gimple_build_omp_task (g, task_clauses, NULL_TREE, NULL_TREE,
NULL_TREE, NULL_TREE, NULL_TREE);
diff --git a/gcc/ginclude/stdbool.h b/gcc/ginclude/stdbool.h
index 1b56498..2355422 100644
--- a/gcc/ginclude/stdbool.h
+++ b/gcc/ginclude/stdbool.h
@@ -31,8 +31,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef __cplusplus
#define bool _Bool
+#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
+#define true ((_Bool)+1u)
+#define false ((_Bool)+0u)
+#else
#define true 1
#define false 0
+#endif
#else /* __cplusplus */
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index b25aa0c..4229488 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,13 @@
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * go-gcc.cc (Gcc_backend::call_expression): Rename
+ DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
+
+2020-11-04 Ian Lance Taylor <iant@golang.org>
+
+ * go-lang.c (go_langhook_post_options): Disable
+ -fipa-icf-functions if it was not explicitly enabled.
+
2020-09-14 Jakub Jelinek <jakub@redhat.com>
* go-gcc.cc (Gcc_backend::function): Adjust
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 505fb15..ba286fa 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -2110,7 +2110,7 @@ Gcc_backend::call_expression(Bfunction*, // containing fcn for call
if (optimize
&& TREE_CODE(fndecl) == FUNCTION_DECL
&& fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)
- && DECL_IS_BUILTIN (fndecl)
+ && DECL_IS_UNDECLARED_BUILTIN (fndecl)
&& nargs > 0
&& ((SCALAR_FLOAT_TYPE_P(rettype)
&& SCALAR_FLOAT_TYPE_P(TREE_TYPE(args[0])))
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index 2cfb410..08c1f38 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -306,6 +306,12 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
SET_OPTION_IF_UNSET (&global_options, &global_options_set,
flag_partial_inlining, 0);
+ /* Go programs expect runtime.Callers to give the right answers,
+ which means that we can't combine functions even if they look the
+ same. */
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ flag_ipa_icf_functions, 0);
+
/* If the debug info level is still 1, as set in init_options, make
sure that some debugging type is selected. */
if (global_options.x_debug_info_level == DINFO_LEVEL_TERSE
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 930339e..e62578f 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-2563706e4ead80d6906d66ae23c8915c360583ad
+893fa057e36ae6c9b2ac5ffdf74634c35b3489c6
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/export.cc b/gcc/go/gofrontend/export.cc
index 277aa74..90a5f6d 100644
--- a/gcc/go/gofrontend/export.cc
+++ b/gcc/go/gofrontend/export.cc
@@ -1211,6 +1211,9 @@ Export::write_type_definition(const Type* type, int index)
this->write_string(nt->named_object()->name());
this->write_c_string("\" ");
+ if (!nt->in_heap())
+ this->write_c_string("notinheap ");
+
if (nt->is_alias())
this->write_c_string("= ");
}
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 0350e51..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.
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/import.cc b/gcc/go/gofrontend/import.cc
index c6c1178..f671416 100644
--- a/gcc/go/gofrontend/import.cc
+++ b/gcc/go/gofrontend/import.cc
@@ -1049,6 +1049,13 @@ Import::read_named_type(int index)
this->require_c_string(" ");
}
+ bool in_heap = true;
+ if (this->match_c_string("notinheap"))
+ {
+ this->require_c_string("notinheap ");
+ in_heap = false;
+ }
+
bool is_alias = false;
if (this->match_c_string("= "))
{
@@ -1102,7 +1109,14 @@ Import::read_named_type(int index)
// declaration of a type defined in some other file.
Type* type;
if (this->match_c_string(">") || this->match_c_string("\n"))
- type = this->types_[index];
+ {
+ type = this->types_[index];
+ if (!in_heap)
+ go_error_at(this->location_,
+ ("import error at %d for type index %d: "
+ "forward declaration marked notinheap"),
+ this->pos(), index);
+ }
else
{
if (no->is_type_declaration())
@@ -1117,6 +1131,8 @@ Import::read_named_type(int index)
// This type has not yet been imported.
ntype->clear_is_visible();
+ if (!in_heap)
+ ntype->set_not_in_heap();
if (is_alias)
ntype->set_is_alias();
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index e7a742f..f3bcf2e 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());
}
@@ -6044,7 +6048,7 @@ Struct_type::do_hash_might_panic()
// Return whether this struct type is permitted to be in the heap.
bool
-Struct_type::do_in_heap()
+Struct_type::do_in_heap() const
{
const Struct_field_list* fields = this->fields_;
if (fields == NULL)
diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h
index ef81589..9ac8516 100644
--- a/gcc/go/gofrontend/types.h
+++ b/gcc/go/gofrontend/types.h
@@ -667,7 +667,7 @@ class Type
// Whether the type is permitted in the heap.
bool
- in_heap()
+ in_heap() const
{ return this->do_in_heap(); }
// Return a hash code for this type for the method hash table.
@@ -1120,7 +1120,7 @@ class Type
{ return false; }
virtual bool
- do_in_heap()
+ do_in_heap() const
{ return true; }
virtual unsigned int
@@ -1426,8 +1426,6 @@ class Type
// The GC symbol for this type. This starts out as NULL and
// is filled in as needed.
Bvariable* gc_symbol_var_;
- // Whether this type can appear in the heap.
- bool in_heap_;
};
// Type hash table operations, treating aliases as identical to the
@@ -2662,7 +2660,7 @@ class Struct_type : public Type
do_hash_might_panic();
bool
- do_in_heap();
+ do_in_heap() const;
unsigned int
do_hash_for_method(Gogo*, int) const;
@@ -2844,7 +2842,7 @@ class Array_type : public Type
{ return this->length_ != NULL && this->element_type_->hash_might_panic(); }
bool
- do_in_heap()
+ do_in_heap() const
{ return this->length_ == NULL || this->element_type_->in_heap(); }
unsigned int
@@ -3593,7 +3591,7 @@ class Named_type : public Type
do_needs_key_update();
bool
- do_in_heap()
+ do_in_heap() const
{ return this->in_heap_ && this->type_->in_heap(); }
unsigned int
@@ -3756,7 +3754,7 @@ class Forward_declaration_type : public Type
{ return this->real_type()->needs_key_update(); }
bool
- do_in_heap()
+ do_in_heap() const
{ return this->real_type()->in_heap(); }
unsigned int
diff --git a/gcc/godump.c b/gcc/godump.c
index a7cd7ed..29a45ce 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -484,7 +484,7 @@ static void
go_decl (tree decl)
{
if (!TREE_PUBLIC (decl)
- || DECL_IS_BUILTIN (decl)
+ || DECL_IS_UNDECLARED_BUILTIN (decl)
|| DECL_NAME (decl) == NULL_TREE)
return;
vec_safe_push (queue, decl);
@@ -522,7 +522,7 @@ go_type_decl (tree decl, int local)
{
real_debug_hooks->type_decl (decl, local);
- if (local || DECL_IS_BUILTIN (decl))
+ if (local || DECL_IS_UNDECLARED_BUILTIN (decl))
return;
if (DECL_NAME (decl) == NULL_TREE
&& (TYPE_NAME (TREE_TYPE (decl)) == NULL_TREE
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 2152f9e..465b072 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -124,6 +124,7 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
#include "dbgcnt.h"
+#include "symtab-clones.h"
template <typename valtype> class ipcp_value;
@@ -595,7 +596,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 +647,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 +692,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 +1156,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 +1169,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 +1216,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 ());
@@ -1226,21 +1227,24 @@ initialize_node_lattices (struct cgraph_node *node)
auto_vec<bool, 16> surviving_params;
bool pre_modified = false;
- if (!disable && node->clone.param_adjustments)
+
+ clone_info *cinfo = clone_info::get (node);
+
+ if (!disable && cinfo && cinfo->param_adjustments)
{
/* At the moment all IPA optimizations should use the number of
parameters of the prevailing decl as the m_always_copy_start.
Handling any other value would complicate the code below, so for the
time bing let's only assert it is so. */
- gcc_assert ((node->clone.param_adjustments->m_always_copy_start
+ gcc_assert ((cinfo->param_adjustments->m_always_copy_start
== ipa_get_param_count (info))
- || node->clone.param_adjustments->m_always_copy_start < 0);
+ || cinfo->param_adjustments->m_always_copy_start < 0);
pre_modified = true;
- node->clone.param_adjustments->get_surviving_params (&surviving_params);
+ cinfo->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 +2810,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 +2857,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));
@@ -4456,9 +4460,10 @@ want_remove_some_param_p (cgraph_node *node, vec<tree> known_csts)
if (!filled_vec)
{
- if (!node->clone.param_adjustments)
+ clone_info *info = clone_info::get (node);
+ if (!info || !info->param_adjustments)
return true;
- node->clone.param_adjustments->get_surviving_params (&surviving);
+ info->param_adjustments->get_surviving_params (&surviving);
filled_vec = true;
}
if (surviving.length() < (unsigned) i && surviving[i])
@@ -4484,7 +4489,9 @@ create_specialized_node (struct cgraph_node *node,
struct ipa_agg_replacement_value *av;
struct cgraph_node *new_node;
int i, count = ipa_get_param_count (info);
- ipa_param_adjustments *old_adjustments = node->clone.param_adjustments;
+ clone_info *cinfo = clone_info::get (node);
+ ipa_param_adjustments *old_adjustments = cinfo
+ ? cinfo->param_adjustments : NULL;
ipa_param_adjustments *new_adjustments;
gcc_assert (!info->ipcp_orig_node);
gcc_assert (node->can_change_signature
@@ -4538,7 +4545,7 @@ create_specialized_node (struct cgraph_node *node,
else
new_adjustments = NULL;
- replace_trees = vec_safe_copy (node->clone.tree_map);
+ replace_trees = cinfo ? vec_safe_copy (cinfo->tree_map) : NULL;
for (i = 0; i < count; i++)
{
tree t = known_csts[i];
@@ -4698,7 +4705,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;
@@ -5462,6 +5469,9 @@ decide_about_value (struct cgraph_node *node, int index, HOST_WIDE_INT offset,
&caller_count))
return false;
+ if (!dbg_cnt (ipa_cp_values))
+ return false;
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, " - considering value ");
@@ -5577,6 +5587,12 @@ decide_whether_version_node (struct cgraph_node *node)
if (info->do_clone_for_all_contexts)
{
+ if (!dbg_cnt (ipa_cp_values))
+ {
+ info->do_clone_for_all_contexts = false;
+ return ret;
+ }
+
struct cgraph_node *clone;
vec<cgraph_edge *> callers = node->collect_callers ();
@@ -5661,7 +5677,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;
@@ -5864,7 +5880,8 @@ ipcp_store_vr_results (void)
ipa_vr vr;
if (!plats->m_value_range.bottom_p ()
- && !plats->m_value_range.top_p ())
+ && !plats->m_value_range.top_p ()
+ && dbg_cnt (ipa_cp_vr))
{
vr.known = true;
vr.type = plats->m_value_range.m_vr.kind ();
@@ -5943,22 +5960,6 @@ ipcp_generate_summary (void)
ipa_analyze_node (node);
}
-/* Write ipcp summary for nodes in SET. */
-
-static void
-ipcp_write_summary (void)
-{
- ipa_prop_write_jump_functions ();
-}
-
-/* Read ipcp summary. */
-
-static void
-ipcp_read_summary (void)
-{
- ipa_prop_read_jump_functions ();
-}
-
namespace {
const pass_data pass_data_ipa_cp =
@@ -5980,8 +5981,8 @@ public:
pass_ipa_cp (gcc::context *ctxt)
: ipa_opt_pass_d (pass_data_ipa_cp, ctxt,
ipcp_generate_summary, /* generate_summary */
- ipcp_write_summary, /* write_summary */
- ipcp_read_summary, /* read_summary */
+ NULL, /* write_summary */
+ NULL, /* read_summary */
ipcp_write_transformation_summaries, /*
write_optimization_summary */
ipcp_read_transformation_summaries, /*
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 771f432..b8f4a0a9 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
#include "tree-into-ssa.h"
+#include "symtab-clones.h"
/* Summaries. */
fast_function_summary <ipa_fn_summary *, va_gc> *ipa_fn_summaries;
@@ -141,6 +142,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);
}
@@ -162,8 +168,7 @@ ipa_fn_summary::account_size_time (int size, sreal time,
bool found = false;
int i;
predicate nonconst_pred;
- vec<size_time_entry, va_gc> *table = call
- ? call_size_time_table : size_time_table;
+ vec<size_time_entry> *table = call ? &call_size_time_table : &size_time_table;
if (exec_pred == false)
return;
@@ -175,13 +180,13 @@ ipa_fn_summary::account_size_time (int size, sreal time,
/* We need to create initial empty unconditional clause, but otherwise
we don't need to account empty times and sizes. */
- if (!size && time == 0 && table)
+ if (!size && time == 0 && table->length ())
return;
/* Only for calls we are unaccounting what we previously recorded. */
gcc_checking_assert (time >= 0 || call);
- for (i = 0; vec_safe_iterate (table, i, &e); i++)
+ for (i = 0; table->iterate (i, &e); i++)
if (e->exec_predicate == exec_pred
&& e->nonconst_predicate == nonconst_pred)
{
@@ -221,9 +226,9 @@ ipa_fn_summary::account_size_time (int size, sreal time,
new_entry.exec_predicate = exec_pred;
new_entry.nonconst_predicate = nonconst_pred;
if (call)
- vec_safe_push (call_size_time_table, new_entry);
+ call_size_time_table.safe_push (new_entry);
else
- vec_safe_push (size_time_table, new_entry);
+ size_time_table.safe_push (new_entry);
}
else
{
@@ -694,7 +699,7 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
}
}
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)
{
@@ -747,10 +752,10 @@ ipa_fn_summary::~ipa_fn_summary ()
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);
+ call_size_time_table.release ();
vec_free (loop_iterations);
vec_free (loop_strides);
+ builtin_constant_p_parms.release ();
}
void
@@ -797,19 +802,19 @@ remap_freqcounting_preds_after_dup (vec<ipa_freqcounting_predicate, va_gc> *v,
void
ipa_fn_summary_t::duplicate (cgraph_node *src,
cgraph_node *dst,
- ipa_fn_summary *,
+ ipa_fn_summary *src_info,
ipa_fn_summary *info)
{
- new (info) ipa_fn_summary (*ipa_fn_summaries->get (src));
+ new (info) ipa_fn_summary (*src_info);
/* TODO: as an optimization, we may avoid copying conditions
that are known to be false or true. */
info->conds = vec_safe_copy (info->conds);
+ clone_info *cinfo = clone_info::get (dst);
/* When there are any replacements in the function body, see if we can figure
out that something was optimized out. */
- if (ipa_node_params_sum && dst->clone.tree_map)
+ if (ipa_node_params_sum && cinfo && cinfo->tree_map)
{
- 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);
ipa_auto_call_arg_values avals;
@@ -822,13 +827,13 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
bool inlined_to_p = false;
struct cgraph_edge *edge, *next;
- info->size_time_table = 0;
+ info->size_time_table.release ();
avals.m_known_vals.safe_grow_cleared (count, true);
for (i = 0; i < count; i++)
{
struct ipa_replace_map *r;
- for (j = 0; vec_safe_iterate (dst->clone.tree_map, j, &r); j++)
+ for (j = 0; vec_safe_iterate (cinfo->tree_map, j, &r); j++)
{
if (r->parm_num == i)
{
@@ -851,7 +856,7 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
to be false.
TODO: as on optimization, we can also eliminate conditions known
to be true. */
- for (i = 0; vec_safe_iterate (entry, i, &e); i++)
+ for (i = 0; src_info->size_time_table.iterate (i, &e); i++)
{
predicate new_exec_pred;
predicate new_nonconst_pred;
@@ -899,7 +904,8 @@ 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);
}
info->loop_iterations
@@ -908,6 +914,15 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
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
@@ -917,10 +932,13 @@ ipa_fn_summary_t::duplicate (cgraph_node *src,
}
else
{
- info->size_time_table = vec_safe_copy (info->size_time_table);
- info->loop_iterations = vec_safe_copy (info->loop_iterations);
+ info->size_time_table = src_info->size_time_table.copy ();
+ info->loop_iterations = vec_safe_copy (src_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++)
{
@@ -1066,6 +1084,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);
@@ -1077,7 +1102,7 @@ ipa_dump_fn_summary (FILE *f, struct cgraph_node *node)
fprintf (f, " estimated growth:%i\n", (int) s->growth);
if (s->scc_no)
fprintf (f, " In SCC: %i\n", (int) s->scc_no);
- for (i = 0; vec_safe_iterate (s->size_time_table, i, &e); i++)
+ for (i = 0; s->size_time_table.iterate (i, &e); i++)
{
fprintf (f, " size:%f, time:%f",
(double) e->size / ipa_fn_summary::size_scale,
@@ -1517,6 +1542,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. */
@@ -1598,6 +1638,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,
@@ -1799,7 +1841,7 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi,
}
p_seg = add_condition (summary, params_summary, index,
- param_type, &aggpos, GT_EXPR,
+ param_type, &aggpos, GT_EXPR,
max, param_ops);
}
}
@@ -2550,8 +2592,8 @@ analyze_function_body (struct cgraph_node *node, bool early)
memset(&fbi, 0, sizeof(fbi));
vec_free (info->conds);
info->conds = NULL;
- vec_free (info->size_time_table);
- info->size_time_table = NULL;
+ info->size_time_table.release ();
+ info->call_size_time_table.release ();
/* When optimizing and analyzing for IPA inliner, initialize loop optimizer
so we can produce proper inline hints.
@@ -3008,12 +3050,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;
@@ -3329,7 +3371,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
if (use_table)
{
/* Build summary if it is absent. */
- if (!sum->call_size_time_table)
+ if (!sum->call_size_time_table.length ())
{
predicate true_pred = true;
sum->account_size_time (0, 0, true_pred, true_pred, true);
@@ -3340,13 +3382,13 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
sreal old_time = time ? *time : 0;
if (min_size)
- *min_size += (*sum->call_size_time_table)[0].size;
+ *min_size += sum->call_size_time_table[0].size;
unsigned int i;
size_time_entry *e;
/* Walk the table and account sizes and times. */
- for (i = 0; vec_safe_iterate (sum->call_size_time_table, i, &e);
+ for (i = 0; sum->call_size_time_table.iterate (i, &e);
i++)
if (e->exec_predicate.evaluate (possible_truths))
{
@@ -3359,7 +3401,7 @@ estimate_calls_size_and_time (struct cgraph_node *node, int *size,
if ((flag_checking || dump_file)
/* Do not try to sanity check when we know we lost some
precision. */
- && sum->call_size_time_table->length ()
+ && sum->call_size_time_table.length ()
< ipa_fn_summary::max_size_time_table_size)
{
estimate_calls_size_and_time_1 (node, &old_size, NULL, &old_time, NULL,
@@ -3649,8 +3691,8 @@ ipa_call_context::estimate_size_and_time (ipa_call_estimates *estimates,
sreal nonspecialized_time = time;
- min_size += (*info->size_time_table)[0].size;
- for (i = 0; vec_safe_iterate (info->size_time_table, i, &e); i++)
+ min_size += info->size_time_table[0].size;
+ for (i = 0; info->size_time_table.iterate (i, &e); i++)
{
bool exec = e->exec_predicate.evaluate (m_nonspec_possible_truths);
@@ -3696,8 +3738,8 @@ ipa_call_context::estimate_size_and_time (ipa_call_estimates *estimates,
gcc_checking_assert (time >= 0);
}
}
- gcc_checking_assert ((*info->size_time_table)[0].exec_predicate == true);
- gcc_checking_assert ((*info->size_time_table)[0].nonconst_predicate == true);
+ gcc_checking_assert (info->size_time_table[0].exec_predicate == true);
+ gcc_checking_assert (info->size_time_table[0].nonconst_predicate == true);
gcc_checking_assert (min_size >= 0);
gcc_checking_assert (size >= 0);
gcc_checking_assert (time >= 0);
@@ -3717,6 +3759,9 @@ ipa_call_context::estimate_size_and_time (ipa_call_estimates *estimates,
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++)
@@ -3896,7 +3941,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)
{
@@ -3957,7 +4002,7 @@ remap_freqcounting_predicate (class ipa_fn_summary *info,
class ipa_fn_summary *callee_info,
vec<ipa_freqcounting_predicate, va_gc> *v,
vec<int> operand_map,
- vec<int> offset_map,
+ vec<HOST_WIDE_INT> offset_map,
clause_t possible_truths,
predicate *toplev_predicate)
@@ -3987,7 +4032,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);
@@ -4044,9 +4089,14 @@ 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 ();
- for (i = 0; vec_safe_iterate (callee_info->size_time_table, i, &e); i++)
+ sreal freq = edge->sreal_frequency ();
+ for (i = 0; callee_info->size_time_table.iterate (i, &e); i++)
{
predicate p;
p = e->exec_predicate.remap_after_inlining
@@ -4093,7 +4143,7 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
info->estimated_stack_size = peak;
inline_update_callee_summaries (edge->callee, es->loop_depth);
- if (info->call_size_time_table)
+ if (info->call_size_time_table.length ())
{
int edge_size = 0;
sreal edge_time = 0;
@@ -4128,14 +4178,14 @@ ipa_update_overall_fn_summary (struct cgraph_node *node, bool reset)
size_info->size = 0;
info->time = 0;
- for (i = 0; vec_safe_iterate (info->size_time_table, i, &e); i++)
+ for (i = 0; info->size_time_table.iterate (i, &e); i++)
{
size_info->size += e->size;
info->time += e->time;
}
- info->min_size = (*info->size_time_table)[0].size;
+ info->min_size = info->size_time_table[0].size;
if (reset)
- vec_free (info->call_size_time_table);
+ info->call_size_time_table.release ();
if (node->callees || node->indirect_calls)
estimate_calls_size_and_time (node, &size_info->size, &info->min_size,
&info->time, NULL,
@@ -4170,7 +4220,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)
@@ -4251,7 +4301,11 @@ read_ipa_call_summary (class lto_input_block *ib, struct cgraph_edge *e,
if (es)
edge_set_predicate (e, &p);
length = streamer_read_uhwi (ib);
- if (length && es && e->possibly_call_in_translation_unit_p ())
+ if (length && es
+ && (e->possibly_call_in_translation_unit_p ()
+ /* Also stream in jump functions to builtins in hope that they
+ will get fnspecs. */
+ || fndecl_built_in_p (e->callee->decl, BUILT_IN_NORMAL)))
{
es->param.safe_grow_cleared (length, true);
for (i = 0; i < length; i++)
@@ -4399,9 +4453,9 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
info->conds->quick_push (c);
}
count2 = streamer_read_uhwi (&ib);
- gcc_assert (!info || !info->size_time_table);
+ gcc_assert (!info || !info->size_time_table.length ());
if (info && count2)
- vec_safe_reserve_exact (info->size_time_table, count2);
+ info->size_time_table.reserve_exact (count2);
for (j = 0; j < count2; j++)
{
class size_time_entry e;
@@ -4412,7 +4466,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
e.nonconst_predicate.stream_in (&ib);
if (info)
- info->size_time_table->quick_push (e);
+ info->size_time_table.quick_push (e);
}
count2 = streamer_read_uhwi (&ib);
@@ -4443,6 +4497,15 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
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)
@@ -4466,6 +4529,7 @@ ipa_fn_summary_read (void)
struct lto_file_decl_data *file_data;
unsigned int j = 0;
+ ipa_prop_read_jump_functions ();
ipa_fn_summary_alloc ();
while ((file_data = file_data_vec[j++]))
@@ -4484,8 +4548,6 @@ ipa_fn_summary_read (void)
"ipa inline summary is missing in input file");
}
ipa_register_cgraph_hooks ();
- if (!flag_ipa_cp)
- ipa_prop_read_jump_functions ();
gcc_assert (ipa_fn_summaries);
ipa_fn_summaries->enable_insertion_hook ();
@@ -4597,8 +4659,8 @@ ipa_fn_summary_write (void)
}
}
}
- streamer_write_uhwi (ob, vec_safe_length (info->size_time_table));
- for (i = 0; vec_safe_iterate (info->size_time_table, i, &e); i++)
+ streamer_write_uhwi (ob, info->size_time_table.length ());
+ for (i = 0; info->size_time_table.iterate (i, &e); i++)
{
streamer_write_uhwi (ob, e->size);
e->time.stream_out (ob);
@@ -4618,6 +4680,11 @@ ipa_fn_summary_write (void)
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)
@@ -4628,8 +4695,7 @@ ipa_fn_summary_write (void)
produce_asm (ob, NULL);
destroy_output_block (ob);
- if (!flag_ipa_cp)
- ipa_prop_write_jump_functions ();
+ ipa_prop_write_jump_functions ();
}
diff --git a/gcc/ipa-fnsummary.h b/gcc/ipa-fnsummary.h
index f4dd5b8..66984a9 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;
@@ -69,7 +72,7 @@ struct agg_position_info
/* Representation of function body size and time depending on the call
context. We keep simple array of record, every containing of predicate
and time/size to account. */
-class GTY(()) size_time_entry
+class size_time_entry
{
public:
/* Predicate for code to be executed. */
@@ -79,7 +82,7 @@ public:
the executed code paths will simplify. */
predicate nonconst_predicate;
int size;
- sreal GTY((skip)) time;
+ sreal time;
};
/* Summary about function and stack frame sizes. We keep this info
@@ -123,10 +126,12 @@ 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),
+ size_time_table (), call_size_time_table (vNULL),
loop_iterations (NULL), loop_strides (NULL),
+ builtin_constant_p_parms (vNULL),
growth (0), scc_no (0)
{
}
@@ -137,9 +142,10 @@ public:
inlinable (s.inlinable), single_caller (s.single_caller),
fp_expressions (s.fp_expressions),
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),
+ time (s.time), conds (s.conds), size_time_table (),
+ call_size_time_table (vNULL),
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)
{}
@@ -175,13 +181,18 @@ public:
accounted in call_size_time_table. This is because calls
are often adjusted by IPA optimizations and thus this summary
is generated from call summary information when needed. */
- vec<size_time_entry, va_gc> *size_time_table;
- vec<size_time_entry, va_gc> *call_size_time_table;
+ auto_vec<size_time_entry> GTY((skip)) size_time_table;
+ /* Unlike size_time_table that is initialized for all summaries
+ call_size_time_table is allocated only for functions with
+ many calls. Use effecient vl_ptr storage. */
+ vec<size_time_entry, va_heap, vl_ptr> GTY((skip)) call_size_time_table;
/* 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
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 acbf82e..bd0e322 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -127,6 +127,9 @@ initialize_growth_caches ()
= new fast_call_summary<edge_growth_cache_entry *, va_heap> (symtab);
node_context_cache
= new fast_function_summary<node_context_summary *, va_heap> (symtab);
+ edge_growth_cache->disable_duplication_hook ();
+ node_context_cache->disable_insertion_hook ();
+ node_context_cache->disable_duplication_hook ();
}
/* Free growth caches. */
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index af2c285..907a95c 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -50,6 +50,8 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-utils.h"
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
+#include "symtab-thunks.h"
+#include "symtab-clones.h"
int ncalls_inlined;
int nfunctions_inlined;
@@ -230,6 +232,11 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
e->callee->remove_from_same_comdat_group ();
e->callee->inlined_to = inlining_into;
+ if (e->callee->ipa_transforms_to_apply.length ())
+ {
+ e->callee->ipa_transforms_to_apply.release ();
+ e->callee->ipa_transforms_to_apply = vNULL;
+ }
/* Recursively clone all bodies. */
for (e = e->callee->callees; e; e = next)
@@ -353,14 +360,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)
;
@@ -564,9 +575,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;
@@ -601,7 +612,10 @@ save_inline_function_body (struct cgraph_node *node)
tree prev_body_holder = node->decl;
if (!ipa_saved_clone_sources)
- ipa_saved_clone_sources = new function_summary <tree *> (symtab);
+ {
+ ipa_saved_clone_sources = new function_summary <tree *> (symtab);
+ ipa_saved_clone_sources->disable_insertion_hook ();
+ }
else
{
tree *p = ipa_saved_clone_sources->get (node);
@@ -644,16 +658,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)
@@ -673,15 +687,40 @@ 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;
}
+/* tree-inline can not recurse; materialize all function bodie we will need
+ during inlining. This includes inlined functions, but also called functions
+ with param manipulation because IPA param manipulation attaches debug
+ statements to PARM_DECLs of called clone. Materialize them if needed.
+
+ FIXME: This is somehwat broken by design because it does not play well
+ with partitioning. */
+
+static void
+maybe_materialize_called_clones (cgraph_node *node)
+{
+ for (cgraph_edge *e = node->callees; e; e = e->next_callee)
+ {
+ clone_info *info;
+
+ if (!e->inline_failed)
+ maybe_materialize_called_clones (e->callee);
+
+ cgraph_node *callee = cgraph_node::get (e->callee->decl);
+ if (callee->clone_of
+ && (info = clone_info::get (callee)) && info->param_adjustments)
+ callee->get_untransformed_body ();
+ }
+}
+
/* Apply inline plan to function. */
unsigned int
@@ -696,6 +735,15 @@ 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 ();
+ }
+ node->clear_stmts_in_references ();
+
/* We might need the body of this function so that we can expand
it inline somewhere else. */
if (preserve_function_body_p (node))
@@ -726,6 +774,7 @@ inline_transform (struct cgraph_node *node)
ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = node->count;
}
+ maybe_materialize_called_clones (node);
for (e = node->callees; e; e = next)
{
if (!e->inline_failed)
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 225a014..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);
diff --git a/gcc/ipa-modref-tree.c b/gcc/ipa-modref-tree.c
index 1a59509..94c68cc 100644
--- a/gcc/ipa-modref-tree.c
+++ b/gcc/ipa-modref-tree.c
@@ -111,6 +111,8 @@ test_insert_search_collapse ()
ASSERT_TRUE (t->every_base);
ASSERT_EQ (t->bases, NULL);
ASSERT_EQ (t->search (1), NULL);
+
+ delete t;
}
static void
@@ -155,6 +157,9 @@ test_merge ()
base_node = t1->search (3);
ASSERT_EQ (base_node->refs, NULL);
ASSERT_TRUE (base_node->every_ref);
+
+ delete t1;
+ delete t2;
}
diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h
index b37280d..7d5acb1 100644
--- a/gcc/ipa-modref-tree.h
+++ b/gcc/ipa-modref-tree.h
@@ -23,17 +23,17 @@ along with GCC; see the file COPYING3. If not see
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
+ 1) Base: this level represent base alias set of the access 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
+ Because for LTO streaming we need to stream types rather 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.
+ 2) Ref: this level represent ref alias set and links to accesses unless
+ all_refs flag is set.
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
+ we record whether access is through a dereference of a function parameter
*/
#ifndef GCC_MODREF_TREE_H
@@ -50,7 +50,7 @@ struct GTY(()) modref_access_node
poly_int64 size;
poly_int64 max_size;
- /* Offset from parmeter pointer to the base of the access (in bytes). */
+ /* Offset from parameter 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
@@ -240,7 +240,7 @@ 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
+ -2 indicates that parameter points to local memory and access can be
discarded. */
int parm_index;
bool parm_offset_known;
@@ -333,7 +333,7 @@ struct GTY((user)) modref_tree
/* 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. */
+ /* No useful ref information and no useful base; collapse everything. */
if (!base && base_node->every_ref)
{
collapse ();
@@ -367,7 +367,7 @@ struct GTY((user)) modref_tree
return changed;
}
- /* Remove tree branches that are not useful (i.e. they will allways pass). */
+ /* Remove tree branches that are not useful (i.e. they will always pass). */
void cleanup ()
{
@@ -544,6 +544,32 @@ struct GTY((user)) modref_tree
{
collapse ();
}
+
+ /* Update parameter indexes in TT according to MAP. */
+ void
+ remap_params (vec <int> *map)
+ {
+ size_t i;
+ modref_base_node <T> *base_node;
+ FOR_EACH_VEC_SAFE_ELT (bases, i, base_node)
+ {
+ size_t j;
+ modref_ref_node <T> *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;
+ }
+ }
+ }
+ }
};
void modref_c_tests ();
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 1d4eaf8..3f46beb 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
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
+ analysis however tree pass is executed during early and late optimization
passes to propagate info downwards in the compilation order. IPA pass
propagates across the callgraph and is able to handle recursion and works on
whole program during link-time analysis.
@@ -59,9 +59,50 @@ along with GCC; see the file COPYING3. If not see
#include "value-range.h"
#include "ipa-prop.h"
#include "ipa-fnsummary.h"
+#include "attr-fnspec.h"
+#include "symtab-clones.h"
+
+/* We record fnspec specifiers for call edges since they depends on actual
+ gimple statements. */
+
+class fnspec_summary
+{
+public:
+ char *fnspec;
+
+ fnspec_summary ()
+ : fnspec (NULL)
+ {
+ }
+
+ ~fnspec_summary ()
+ {
+ free (fnspec);
+ }
+};
+
+/* Summary holding fnspec string for a given call. */
+
+class fnspec_summaries_t : public call_summary <fnspec_summary *>
+{
+public:
+ fnspec_summaries_t (symbol_table *symtab)
+ : call_summary <fnspec_summary *> (symtab) {}
+ /* Hook that is called by summary when an edge is duplicated. */
+ virtual void duplicate (cgraph_edge *,
+ cgraph_edge *,
+ fnspec_summary *src,
+ fnspec_summary *dst)
+ {
+ dst->fnspec = xstrdup (src->fnspec);
+ }
+};
+
+static fnspec_summaries_t *fnspec_summaries = NULL;
/* Class (from which there is one global instance) that holds modref summaries
for all analyzed functions. */
+
class GTY((user)) modref_summaries
: public fast_function_summary <modref_summary *, va_gc>
{
@@ -84,6 +125,7 @@ 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>
{
@@ -106,23 +148,26 @@ public:
/* 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
+/* Global variable holding all modref optimization 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 (NULL), stores (NULL), writes_errno (NULL)
{
}
@@ -159,6 +204,7 @@ struct GTY(()) modref_summary_lto
more verbose and thus more likely to hit the limits. */
modref_records_lto *loads;
modref_records_lto *stores;
+ bool writes_errno;
modref_summary_lto ();
~modref_summary_lto ();
@@ -169,7 +215,7 @@ struct GTY(()) modref_summary_lto
/* Summary for a single function which this pass produces. */
modref_summary_lto::modref_summary_lto ()
- : loads (NULL), stores (NULL)
+ : loads (NULL), stores (NULL), writes_errno (NULL)
{
}
@@ -298,7 +344,7 @@ dump_lto_records (modref_records_lto *tt, FILE *out)
r->ref ? get_alias_set (r->ref) : 0);
if (r->every_access)
{
- fprintf (out, " Every access\n");
+ fprintf (out, " Every access\n");
continue;
}
size_t k;
@@ -324,6 +370,8 @@ modref_summary::dump (FILE *out)
fprintf (out, " stores:\n");
dump_records (stores, out);
}
+ if (writes_errno)
+ fprintf (out, " Writes errno\n");
}
/* Dump summary. */
@@ -331,16 +379,12 @@ modref_summary::dump (FILE *out)
void
modref_summary_lto::dump (FILE *out)
{
- if (loads)
- {
- fprintf (out, " loads:\n");
- dump_lto_records (loads, out);
- }
- if (stores)
- {
- fprintf (out, " stores:\n");
- dump_lto_records (stores, out);
- }
+ fprintf (out, " loads:\n");
+ dump_lto_records (loads, out);
+ fprintf (out, " stores:\n");
+ dump_lto_records (stores, out);
+ if (writes_errno)
+ fprintf (out, " Writes errno\n");
}
/* Get function summary for FUNC if it exists, return NULL otherwise. */
@@ -523,6 +567,46 @@ ignore_stores_p (tree caller, int flags)
return false;
}
+/* Determine parm_map for argument I of STMT. */
+
+modref_parm_map
+parm_map_for_arg (gimple *stmt, int i)
+{
+ tree op = gimple_call_arg (stmt, i);
+ bool offset_known;
+ poly_int64 offset;
+ struct modref_parm_map parm_map;
+
+ parm_map.parm_offset_known = false;
+ parm_map.parm_offset = 0;
+
+ 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.parm_index = index;
+ parm_map.parm_offset_known = offset_known;
+ parm_map.parm_offset = offset;
+ }
+ else if (points_to_local_or_readonly_memory_p (op))
+ parm_map.parm_index = -2;
+ else
+ parm_map.parm_index = -1;
+ return parm_map;
+}
+
/* 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. */
@@ -530,59 +614,244 @@ ignore_stores_p (tree caller, int flags)
bool
merge_call_side_effects (modref_summary *cur_summary,
gimple *stmt, modref_summary *callee_summary,
- bool ignore_stores)
+ 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 ());
+
+ /* 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_node->binds_to_current_def_p ())
+ {
+ if (dump_file)
+ fprintf (dump_file, " - May be interposed: collapsing loads.\n");
+ cur_summary->loads->collapse ();
+ }
+
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);
- STRIP_NOPS (op);
- if (TREE_CODE (op) == SSA_NAME
- && SSA_NAME_IS_DEFAULT_DEF (op)
- && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL)
+ parm_map[i] = parm_map_for_arg (stmt, i);
+ if (dump_file)
{
- int index = 0;
- for (tree t = DECL_ARGUMENTS (current_function_decl);
- t != SSA_NAME_VAR (op); t = DECL_CHAIN (t))
+ fprintf (dump_file, " %i", parm_map[i].parm_index);
+ if (parm_map[i].parm_offset_known)
{
- if (!t)
- {
- index = -1;
- break;
- }
- index++;
+ fprintf (dump_file, " offset:");
+ print_dec ((poly_int64_pod)parm_map[i].parm_offset,
+ dump_file, SIGNED);
}
- parm_map[i].parm_index = index;
- parm_map[i].parm_offset_known = true;
- parm_map[i].parm_offset = 0;
}
- 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, "\n");
/* Merge with callee's summary. */
- if (cur_summary->loads)
- changed |= cur_summary->loads->merge (callee_summary->loads, &parm_map);
+ changed |= cur_summary->loads->merge (callee_summary->loads, &parm_map);
if (!ignore_stores)
{
- if (cur_summary->stores)
- changed |= cur_summary->stores->merge (callee_summary->stores,
- &parm_map);
+ changed |= cur_summary->stores->merge (callee_summary->stores,
+ &parm_map);
+ if (!cur_summary->writes_errno
+ && callee_summary->writes_errno)
+ {
+ cur_summary->writes_errno = true;
+ changed = true;
+ }
+ }
+ return changed;
+}
+
+/* Return access mode for argument I of call STMT with FNSPEC. */
+
+static modref_access_node
+get_access_for_fnspec (gcall *call, attr_fnspec &fnspec,
+ unsigned int i, modref_parm_map &map)
+{
+ tree size = NULL_TREE;
+ unsigned int size_arg;
+
+ if (!fnspec.arg_specified_p (i))
+ ;
+ else if (fnspec.arg_max_access_size_given_by_arg_p (i, &size_arg))
+ size = gimple_call_arg (call, size_arg);
+ else if (fnspec.arg_access_size_given_by_type_p (i))
+ {
+ tree callee = gimple_call_fndecl (call);
+ tree t = TYPE_ARG_TYPES (TREE_TYPE (callee));
+
+ for (unsigned int p = 0; p < i; p++)
+ t = TREE_CHAIN (t);
+ size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_VALUE (t)));
+ }
+ modref_access_node a = {0, -1, -1,
+ map.parm_offset, map.parm_index,
+ map.parm_offset_known};
+ 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))
+ {
+ a.size = -1;
+ a.max_size = size_hwi << LOG2_BITS_PER_UNIT;
+ }
+ return a;
+}
+
+/* Collapse loads and return true if something changed. */
+
+static 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;
+}
+
+/* Collapse loads and return true if something changed. */
+
+static bool
+collapse_stores (modref_summary *cur_summary,
+ modref_summary_lto *cur_summary_lto)
+{
+ bool changed = false;
+
+ if (cur_summary && !cur_summary->stores->every_base)
+ {
+ cur_summary->stores->collapse ();
+ changed = true;
+ }
+ if (cur_summary_lto
+ && !cur_summary_lto->stores->every_base)
+ {
+ cur_summary_lto->stores->collapse ();
+ changed = true;
}
return changed;
}
+
+/* Apply side effects of call STMT to CUR_SUMMARY using FNSPEC.
+ If IGNORE_STORES is true ignore them.
+ Return false if no useful summary can be produced. */
+
+static bool
+process_fnspec (modref_summary *cur_summary,
+ modref_summary_lto *cur_summary_lto,
+ gcall *call, bool ignore_stores)
+{
+ attr_fnspec fnspec = gimple_call_fnspec (call);
+ if (!fnspec.known_p ())
+ {
+ if (dump_file && gimple_call_builtin_p (call, BUILT_IN_NORMAL))
+ fprintf (dump_file, " Builtin with no fnspec: %s\n",
+ IDENTIFIER_POINTER (DECL_NAME (gimple_call_fndecl (call))));
+ if (ignore_stores)
+ {
+ collapse_loads (cur_summary, cur_summary_lto);
+ return true;
+ }
+ return false;
+ }
+ if (fnspec.global_memory_read_p ())
+ collapse_loads (cur_summary, cur_summary_lto);
+ else
+ {
+ for (unsigned int i = 0; i < gimple_call_num_args (call); i++)
+ if (!POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (call, i))))
+ ;
+ else if (!fnspec.arg_specified_p (i)
+ || fnspec.arg_maybe_read_p (i))
+ {
+ modref_parm_map map = parm_map_for_arg (call, i);
+
+ if (map.parm_index == -2)
+ continue;
+ if (map.parm_index == -1)
+ {
+ collapse_loads (cur_summary, cur_summary_lto);
+ break;
+ }
+ if (cur_summary)
+ cur_summary->loads->insert (0, 0,
+ get_access_for_fnspec (call,
+ fnspec, i,
+ map));
+ if (cur_summary_lto)
+ cur_summary_lto->loads->insert (0, 0,
+ get_access_for_fnspec (call,
+ fnspec, i,
+ map));
+ }
+ }
+ if (ignore_stores)
+ return true;
+ if (fnspec.global_memory_written_p ())
+ collapse_stores (cur_summary, cur_summary_lto);
+ else
+ {
+ for (unsigned int i = 0; i < gimple_call_num_args (call); i++)
+ if (!POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (call, i))))
+ ;
+ else if (!fnspec.arg_specified_p (i)
+ || fnspec.arg_maybe_written_p (i))
+ {
+ modref_parm_map map = parm_map_for_arg (call, i);
+
+ if (map.parm_index == -2)
+ continue;
+ if (map.parm_index == -1)
+ {
+ collapse_stores (cur_summary, cur_summary_lto);
+ break;
+ }
+ if (cur_summary)
+ cur_summary->stores->insert (0, 0,
+ get_access_for_fnspec (call,
+ fnspec, i,
+ map));
+ if (cur_summary_lto)
+ cur_summary_lto->stores->insert (0, 0,
+ get_access_for_fnspec (call,
+ fnspec, i,
+ map));
+ }
+ if (fnspec.errno_maybe_written_p () && flag_errno_math)
+ {
+ if (cur_summary)
+ cur_summary->writes_errno = true;
+ if (cur_summary_lto)
+ cur_summary_lto->writes_errno = true;
+ }
+ }
+ return true;
+}
+
/* Analyze function call STMT in function F.
Remember recursive calls in RECURSIVE_CALLS. */
static bool
-analyze_call (modref_summary *cur_summary,
- gimple *stmt, vec <gimple *> *recursive_calls)
+analyze_call (modref_summary *cur_summary, modref_summary_lto *cur_summary_lto,
+ gcall *stmt, vec <gimple *> *recursive_calls)
{
/* Check flags on the function call. In certain cases, analysis can be
simplified. */
@@ -607,35 +876,16 @@ analyze_call (modref_summary *cur_summary,
/* Check if this is an indirect call. */
if (!callee)
{
- /* If the indirect call does not write memory, our store summary is
- unaffected, but we have to discard our loads summary (we don't know
- anything about the loads that the called function performs). */
- if (ignore_stores)
- {
- if (dump_file)
- fprintf (dump_file, " - Indirect call which does not write memory, "
- "discarding loads.\n");
- cur_summary->loads->collapse ();
- return true;
- }
if (dump_file)
- fprintf (dump_file, " - Indirect call.\n");
- return false;
+ fprintf (dump_file, gimple_call_internal_p (stmt)
+ ? " - Internal call" : " - Indirect call.\n");
+ return process_fnspec (cur_summary, cur_summary_lto, stmt, ignore_stores);
}
+ /* We only need to handle internal calls in IPA mode. */
+ gcc_checking_assert (!cur_summary_lto);
struct cgraph_node *callee_node = cgraph_node::get_create (callee);
- /* 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_node->binds_to_current_def_p ())
- {
- if (dump_file)
- fprintf (dump_file, " - May be interposed: collapsing loads.\n");
- 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))
@@ -653,16 +903,9 @@ analyze_call (modref_summary *cur_summary,
callee_node = callee_node->function_symbol (&avail);
if (avail <= AVAIL_INTERPOSABLE)
{
- /* Keep stores summary, but discard all loads for interposable function
- symbols. */
- if (ignore_stores)
- {
- cur_summary->loads->collapse ();
- return true;
- }
if (dump_file)
fprintf (dump_file, " - Function availability <= AVAIL_INTERPOSABLE.\n");
- return false;
+ return process_fnspec (cur_summary, cur_summary_lto, stmt, ignore_stores);
}
/* Get callee's modref summary. As above, if there's no summary, we either
@@ -670,23 +913,18 @@ analyze_call (modref_summary *cur_summary,
modref_summary *callee_summary = optimization_summaries->get (callee_node);
if (!callee_summary)
{
- if (ignore_stores)
- {
- if (cur_summary->loads)
- cur_summary->loads->collapse ();
- return true;
- }
if (dump_file)
fprintf (dump_file, " - No modref summary available for callee.\n");
- return false;
+ return process_fnspec (cur_summary, cur_summary_lto, stmt, ignore_stores);
}
- merge_call_side_effects (cur_summary, stmt, callee_summary, ignore_stores);
+ 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. */
+/* Support analysis in non-lto and lto mode in parallel. */
struct summary_ptrs
{
@@ -757,10 +995,10 @@ static bool
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
+ /* In general we can not ignore clobbers because they are barriers for code
+ motion, however after inlining it is safe to do because local optimization
passes do not consider clobbers from other functions.
- Similar logic is in ipa-pure-consts. */
+ Similar logic is in ipa-pure-const.c. */
if ((ipa || cfun->after_inlining) && gimple_clobber_p (stmt))
return true;
@@ -782,8 +1020,24 @@ analyze_stmt (modref_summary *summary, modref_summary_lto *summary_lto,
"which clobbers memory.\n");
return false;
case GIMPLE_CALL:
- if (!ipa)
- return analyze_call (summary, stmt, recursive_calls);
+ if (!ipa || gimple_call_internal_p (stmt))
+ return analyze_call (summary, summary_lto,
+ as_a <gcall *> (stmt), recursive_calls);
+ else
+ {
+ attr_fnspec fnspec = gimple_call_fnspec (as_a <gcall *>(stmt));
+
+ if (fnspec.known_p ()
+ && (!fnspec.global_memory_read_p ()
+ || !fnspec.global_memory_written_p ()))
+ {
+ fnspec_summaries->get_create
+ (cgraph_node::get (current_function_decl)->get_edge (stmt))
+ ->fnspec = xstrdup (fnspec.get_str ());
+ if (dump_file)
+ fprintf (dump_file, " Recorded fnspec %s\n", fnspec.get_str ());
+ }
+ }
return true;
default:
/* Nothing to do for other types of statements. */
@@ -853,7 +1107,10 @@ analyze_function (function *f, bool ipa)
else /* Remove existing summary if we are re-running the pass. */
{
if (dump_file
- && optimization_summaries->get (cgraph_node::get (f->decl)))
+ && (summary
+ = optimization_summaries->get (cgraph_node::get (f->decl)))
+ != NULL
+ && summary->loads)
{
fprintf (dump_file, "Past summary:\n");
optimization_summaries->get
@@ -864,7 +1121,7 @@ analyze_function (function *f, bool ipa)
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. */
+ /* In IPA mode we analyze every function precisely once. Assert that. */
else
{
if (nolto)
@@ -883,6 +1140,8 @@ analyze_function (function *f, bool ipa)
summaries_lto->remove (cgraph_node::get (f->decl));
summary_lto = summaries_lto->get_create (cgraph_node::get (f->decl));
}
+ if (!fnspec_summaries)
+ fnspec_summaries = new fnspec_summaries_t (symtab);
}
@@ -899,6 +1158,7 @@ analyze_function (function *f, bool ipa)
summary->stores = modref_records::create_ggc (param_modref_max_bases,
param_modref_max_refs,
param_modref_max_accesses);
+ summary->writes_errno = false;
}
if (lto)
{
@@ -912,6 +1172,7 @@ analyze_function (function *f, bool ipa)
(param_modref_max_bases,
param_modref_max_refs,
param_modref_max_accesses);
+ summary_lto->writes_errno = false;
}
int ecf_flags = flags_from_decl_or_type (current_function_decl);
auto_vec <gimple *, 32> recursive_calls;
@@ -950,7 +1211,8 @@ analyze_function (function *f, bool ipa)
(summary, recursive_calls[i], summary,
ignore_stores_p (current_function_decl,
gimple_call_flags
- (recursive_calls[i])));
+ (recursive_calls[i])),
+ fnode);
if (!summary->useful_p (ecf_flags))
{
remove_summary (lto, nolto, ipa);
@@ -1005,18 +1267,19 @@ modref_generate (void)
void
modref_summaries::insert (struct cgraph_node *node, modref_summary *)
{
- if (!DECL_STRUCT_FUNCTION (node->decl))
+ /* 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))
+ {
summaries->remove (node);
+ return;
}
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
- /* This is not very pretty: We do not know if we insert into optimization
- summary or summary. Do both but check for duplicated effort. */
- if (optimization_summaries && !optimization_summaries->get (node)->loads)
- analyze_function (DECL_STRUCT_FUNCTION (node->decl), false);
- if (summaries && !summaries->get (node)->loads)
- analyze_function (DECL_STRUCT_FUNCTION (node->decl), true);
+ analyze_function (DECL_STRUCT_FUNCTION (node->decl), true);
pop_cfun ();
}
@@ -1042,26 +1305,28 @@ modref_summaries_lto::insert (struct cgraph_node *node, modref_summary_lto *)
/* 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)
{
- if (src_data->stores)
- {
- 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);
- }
- if (src_data->loads)
+ /* Do not duplicate optimization summaries; we do not handle parameter
+ transforms on them. */
+ if (this == optimization_summaries)
{
- 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);
+ 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);
+ dst_data->writes_errno = src_data->writes_errno;
}
/* Called when new clone is inserted to callgraph late. */
@@ -1071,22 +1336,20 @@ modref_summaries_lto::duplicate (cgraph_node *, cgraph_node *,
modref_summary_lto *src_data,
modref_summary_lto *dst_data)
{
- if (src_data->stores)
- {
- 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);
- }
- if (src_data->loads)
- {
- 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);
- }
+ /* Be sure that no further cloning happens after ipa-modref. If it does
+ we will need to update signatures for possible param changes. */
+ gcc_checking_assert (!((modref_summaries_lto *)summaries_lto)->propagated);
+ 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);
+ dst_data->writes_errno = src_data->writes_errno;
}
namespace
@@ -1154,7 +1417,7 @@ write_modref_records (modref_records_lto *tt, struct output_block *ob)
modref_access_node *access_node;
FOR_EACH_VEC_SAFE_ELT (ref_node->accesses, k, access_node)
{
- streamer_write_uhwi (ob, access_node->parm_index);
+ streamer_write_hwi (ob, access_node->parm_index);
if (access_node->parm_index != -1)
{
streamer_write_uhwi (ob, access_node->parm_offset_known);
@@ -1278,7 +1541,7 @@ read_modref_records (lto_input_block *ib, struct data_in *data_in,
for (size_t k = 0; k < naccesses; k++)
{
- int parm_index = streamer_read_uhwi (ib);
+ int parm_index = streamer_read_hwi (ib);
bool parm_offset_known = false;
poly_int64 parm_offset = 0;
poly_int64 offset = 0;
@@ -1350,7 +1613,6 @@ modref_write ()
if (cnode && cnode->definition && !cnode->alias)
{
-
modref_summary_lto *r = summaries_lto->get (cnode);
if (!r || !r->useful_p (flags_from_decl_or_type (cnode->decl)))
@@ -1358,12 +1620,30 @@ modref_write ()
streamer_write_uhwi (ob, lto_symtab_encoder_encode (encoder, cnode));
- streamer_write_uhwi (ob, r->loads ? 1 : 0);
- streamer_write_uhwi (ob, r->stores ? 1 : 0);
- if (r->loads)
- write_modref_records (r->loads, ob);
- if (r->stores)
- write_modref_records (r->stores, ob);
+ write_modref_records (r->loads, ob);
+ write_modref_records (r->stores, ob);
+
+ struct bitpack_d bp = bitpack_create (ob->main_stream);
+ bp_pack_value (&bp, r->writes_errno, 1);
+ if (!flag_wpa)
+ {
+ for (cgraph_edge *e = cnode->indirect_calls;
+ e; e = e->next_callee)
+ {
+ class fnspec_summary *sum = fnspec_summaries->get (e);
+ bp_pack_value (&bp, sum != NULL, 1);
+ if (sum)
+ bp_pack_string (ob, &bp, sum->fnspec, true);
+ }
+ for (cgraph_edge *e = cnode->callees; e; e = e->next_callee)
+ {
+ class fnspec_summary *sum = fnspec_summaries->get (e);
+ bp_pack_value (&bp, sum != NULL, 1);
+ if (sum)
+ bp_pack_string (ob, &bp, sum->fnspec, true);
+ }
+ }
+ streamer_write_bitpack (&bp);
}
}
streamer_write_char_stream (ob->main_stream, 0);
@@ -1406,24 +1686,51 @@ read_section (struct lto_file_decl_data *file_data, const char *data,
modref_summary_lto *modref_sum_lto = summaries_lto
? summaries_lto->get_create (node)
: NULL;
- int have_loads = streamer_read_uhwi (&ib);
- int have_stores = streamer_read_uhwi (&ib);
-
if (optimization_summaries)
modref_sum = optimization_summaries->get_create (node);
+ if (modref_sum)
+ modref_sum->writes_errno = false;
+ if (modref_sum_lto)
+ modref_sum_lto->writes_errno = false;
+
gcc_assert (!modref_sum || (!modref_sum->loads
&& !modref_sum->stores));
gcc_assert (!modref_sum_lto || (!modref_sum_lto->loads
&& !modref_sum_lto->stores));
- if (have_loads)
- read_modref_records (&ib, data_in,
- modref_sum ? &modref_sum->loads : NULL,
- modref_sum_lto ? &modref_sum_lto->loads : NULL);
- if (have_stores)
- read_modref_records (&ib, data_in,
- modref_sum ? &modref_sum->stores : NULL,
- modref_sum_lto ? &modref_sum_lto->stores : NULL);
+ 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);
+ struct bitpack_d bp = streamer_read_bitpack (&ib);
+ if (bp_unpack_value (&bp, 1))
+ {
+ if (modref_sum)
+ modref_sum->writes_errno = true;
+ if (modref_sum_lto)
+ modref_sum_lto->writes_errno = true;
+ }
+ if (!flag_ltrans)
+ {
+ for (cgraph_edge *e = node->indirect_calls; e; e = e->next_callee)
+ {
+ if (bp_unpack_value (&bp, 1))
+ {
+ class fnspec_summary *sum = fnspec_summaries->get_create (e);
+ sum->fnspec = xstrdup (bp_unpack_string (data_in, &bp));
+ }
+ }
+ for (cgraph_edge *e = node->callees; e; e = e->next_callee)
+ {
+ if (bp_unpack_value (&bp, 1))
+ {
+ class fnspec_summary *sum = fnspec_summaries->get_create (e);
+ sum->fnspec = xstrdup (bp_unpack_string (data_in, &bp));
+ }
+ }
+ }
if (dump_file)
{
fprintf (dump_file, "Read modref for %s\n",
@@ -1460,6 +1767,8 @@ modref_read (void)
|| (flag_incremental_link == INCREMENTAL_LINK_LTO
&& flag_fat_lto_objects))
summaries = modref_summaries::create_ggc (symtab);
+ if (!fnspec_summaries)
+ fnspec_summaries = new fnspec_summaries_t (symtab);
}
while ((file_data = file_data_vec[j++]))
@@ -1479,43 +1788,21 @@ 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)
+static void
+update_signature (struct cgraph_node *node)
{
- if (!node->clone.param_adjustments || !optimization_summaries)
- return 0;
- modref_summary *r = optimization_summaries->get (node);
- if (!r)
- return 0;
+ clone_info *info = clone_info::get (node);
+ if (!info || !info->param_adjustments)
+ return;
+
+ modref_summary *r = optimization_summaries
+ ? optimization_summaries->get (node) : NULL;
+ modref_summary_lto *r_lto = summaries_lto
+ ? summaries_lto->get (node) : NULL;
+ if (!r && !r_lto)
+ return;
if (dump_file)
{
fprintf (dump_file, "Updating summary for %s from:\n",
@@ -1526,9 +1813,9 @@ modref_transform (struct cgraph_node *node)
size_t i, max = 0;
ipa_adjusted_param *p;
- FOR_EACH_VEC_SAFE_ELT (node->clone.param_adjustments->m_adj_params, i, p)
+ FOR_EACH_VEC_SAFE_ELT (info->param_adjustments->m_adj_params, i, p)
{
- int idx = node->clone.param_adjustments->get_original_index (i);
+ int idx = info->param_adjustments->get_original_index (i);
if (idx > (int)max)
max = idx;
}
@@ -1538,20 +1825,31 @@ modref_transform (struct cgraph_node *node)
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)
+ FOR_EACH_VEC_SAFE_ELT (info->param_adjustments->m_adj_params, i, p)
{
- int idx = node->clone.param_adjustments->get_original_index (i);
+ int idx = info->param_adjustments->get_original_index (i);
if (idx >= 0)
map[idx] = i;
}
- remap_arguments (&map, r->loads);
- remap_arguments (&map, r->stores);
+ if (r)
+ {
+ r->loads->remap_params (&map);
+ r->stores->remap_params (&map);
+ }
+ if (r_lto)
+ {
+ r_lto->loads->remap_params (&map);
+ r_lto->stores->remap_params (&map);
+ }
if (dump_file)
{
fprintf (dump_file, "to:\n");
- r->dump (dump_file);
+ if (r)
+ r->dump (dump_file);
+ if (r_lto)
+ r_lto->dump (dump_file);
}
- return 0;
+ return;
}
/* Definition of the modref IPA pass. */
@@ -1580,7 +1878,7 @@ public:
modref_read, /* read_optimization_summary */
NULL, /* stmt_fixup */
0, /* function_transform_todo_flags_start */
- modref_transform,/* function_transform */
+ NULL, /* function_transform */
NULL) /* variable_transform */
{}
@@ -1598,9 +1896,6 @@ public:
unsigned int pass_modref::execute (function *f)
{
- /* If new function is being added during IPA, we can skip analysis. */
- if (!optimization_summaries)
- return 0;
analyze_function (f, false);
return 0;
}
@@ -1623,20 +1918,25 @@ 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 || !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));
}
-/* Compute parm_map for CALLE_EDGE. */
+/* Compute parm_map for CALLEE_EDGE. */
-static void
+static bool
compute_parm_map (cgraph_edge *callee_edge, vec<modref_parm_map> *parm_map)
{
class ipa_edge_args *args;
@@ -1657,7 +1957,7 @@ compute_parm_map (cgraph_edge *callee_edge, vec<modref_parm_map> *parm_map)
: callee_edge->caller);
callee_pi = IPA_NODE_REF (callee);
- (*parm_map).safe_grow (count);
+ (*parm_map).safe_grow_cleared (count);
for (i = 0; i < count; i++)
{
@@ -1684,10 +1984,19 @@ compute_parm_map (cgraph_edge *callee_edge, vec<modref_parm_map> *parm_map)
if (jf && jf->type == IPA_JF_PASS_THROUGH)
{
(*parm_map)[i].parm_index
- = ipa_get_jf_pass_through_formal_id (jf);
- (*parm_map)[i].parm_offset_known
- = ipa_get_jf_pass_through_operation (jf) == NOP_EXPR;
- (*parm_map)[i].parm_offset = 0;
+ = 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)
@@ -1709,7 +2018,9 @@ compute_parm_map (cgraph_edge *callee_edge, vec<modref_parm_map> *parm_map)
fprintf (dump_file, " %i", (*parm_map)[i].parm_index);
fprintf (dump_file, "\n");
}
+ return true;
}
+ return false;
}
/* Call EDGE was inlined; merge summary from callee to the caller. */
@@ -1743,7 +2054,7 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge *edge)
if (!callee_info && to_info)
{
- if (ignore_stores_p (edge->callee->decl, flags))
+ if (ignore_stores_p (edge->caller->decl, flags))
to_info->loads->collapse ();
else
{
@@ -1753,7 +2064,7 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge *edge)
}
if (!callee_info_lto && to_info_lto)
{
- if (ignore_stores_p (edge->callee->decl, flags))
+ if (ignore_stores_p (edge->caller->decl, flags))
to_info_lto->loads->collapse ();
else
{
@@ -1767,7 +2078,7 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge *edge)
compute_parm_map (edge, &parm_map);
- if (!ignore_stores_p (edge->callee->decl, flags))
+ if (!ignore_stores_p (edge->caller->decl, flags))
{
if (to_info && callee_info)
to_info->stores->merge (callee_info->stores, &parm_map);
@@ -1782,40 +2093,209 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge *edge)
if (summaries)
{
if (to_info && !to_info->useful_p (flags))
- summaries->remove (to);
+ {
+ 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))
- summaries_lto->remove (to);
+ {
+ 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;
}
-/* Collapse loads and return true if something changed. */
+/* Get parameter type from DECL. This is only safe for special cases
+ like builtins we create fnspec for because the type match is checked
+ at fnspec creation time. */
-bool
-collapse_loads (modref_summary *cur_summary,
- modref_summary_lto *cur_summary_lto)
+static tree
+get_parm_type (tree decl, unsigned int i)
{
- bool changed = false;
+ tree t = TYPE_ARG_TYPES (TREE_TYPE (decl));
- if (cur_summary && !cur_summary->loads->every_base)
+ for (unsigned int p = 0; p < i; p++)
+ t = TREE_CHAIN (t);
+ return TREE_VALUE (t);
+}
+
+/* Return access mode for argument I of call E with FNSPEC. */
+
+static modref_access_node
+get_access_for_fnspec (cgraph_edge *e, attr_fnspec &fnspec,
+ unsigned int i, modref_parm_map &map)
+{
+ tree size = NULL_TREE;
+ unsigned int size_arg;
+
+ if (!fnspec.arg_specified_p (i))
+ ;
+ else if (fnspec.arg_max_access_size_given_by_arg_p (i, &size_arg))
+ {
+ cgraph_node *node = e->caller->inlined_to
+ ? e->caller->inlined_to : e->caller;
+ class ipa_node_params *caller_parms_info = IPA_NODE_REF (node);
+ class ipa_edge_args *args = IPA_EDGE_REF (e);
+ struct ipa_jump_func *jf = ipa_get_ith_jump_func (args, size_arg);
+
+ if (jf)
+ size = ipa_value_from_jfunc (caller_parms_info, jf,
+ get_parm_type (e->callee->decl, size_arg));
+ }
+ else if (fnspec.arg_access_size_given_by_type_p (i))
+ size = TYPE_SIZE_UNIT (get_parm_type (e->callee->decl, i));
+ modref_access_node a = {0, -1, -1,
+ map.parm_offset, map.parm_index,
+ map.parm_offset_known};
+ 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))
+ {
+ a.size = -1;
+ a.max_size = size_hwi << LOG2_BITS_PER_UNIT;
+ }
+ return a;
+}
+
+/* Call E in NODE with ECF_FLAGS has no summary; update MODREF_SUMMARY and
+ CUR_SUMMARY_LTO accordingly. Return true if something changed. */
+
+static bool
+propagate_unknown_call (cgraph_node *node,
+ cgraph_edge *e, int ecf_flags,
+ modref_summary **cur_summary_ptr,
+ modref_summary_lto **cur_summary_lto_ptr)
+{
+ bool changed = false;
+ modref_summary *cur_summary = cur_summary_ptr ? *cur_summary_ptr : NULL;
+ modref_summary_lto *cur_summary_lto = cur_summary_lto_ptr
+ ? *cur_summary_lto_ptr : NULL;
+ class fnspec_summary *fnspec_sum = fnspec_summaries->get (e);
+ auto_vec <modref_parm_map, 32> parm_map;
+ if (fnspec_sum
+ && compute_parm_map (e, &parm_map))
{
- cur_summary->loads->collapse ();
- changed = true;
+ attr_fnspec fnspec (fnspec_sum->fnspec);
+
+ gcc_checking_assert (fnspec.known_p ());
+ if (fnspec.global_memory_read_p ())
+ collapse_loads (cur_summary, cur_summary_lto);
+ else
+ {
+ tree t = TYPE_ARG_TYPES (TREE_TYPE (e->callee->decl));
+ for (unsigned i = 0; i < parm_map.length () && t;
+ i++, t = TREE_CHAIN (t))
+ if (!POINTER_TYPE_P (TREE_VALUE (t)))
+ ;
+ else if (!fnspec.arg_specified_p (i)
+ || fnspec.arg_maybe_read_p (i))
+ {
+ modref_parm_map map = parm_map[i];
+ if (map.parm_index == -2)
+ continue;
+ if (map.parm_index == -1)
+ {
+ collapse_loads (cur_summary, cur_summary_lto);
+ break;
+ }
+ if (cur_summary)
+ changed |= cur_summary->loads->insert
+ (0, 0, get_access_for_fnspec (e, fnspec, i, map));
+ if (cur_summary_lto)
+ changed |= cur_summary_lto->loads->insert
+ (0, 0, get_access_for_fnspec (e, fnspec, i, map));
+ }
+ }
+ if (ignore_stores_p (node->decl, ecf_flags))
+ ;
+ else if (fnspec.global_memory_written_p ())
+ collapse_stores (cur_summary, cur_summary_lto);
+ else
+ {
+ tree t = TYPE_ARG_TYPES (TREE_TYPE (e->callee->decl));
+ for (unsigned i = 0; i < parm_map.length () && t;
+ i++, t = TREE_CHAIN (t))
+ if (!POINTER_TYPE_P (TREE_VALUE (t)))
+ ;
+ else if (!fnspec.arg_specified_p (i)
+ || fnspec.arg_maybe_written_p (i))
+ {
+ modref_parm_map map = parm_map[i];
+ if (map.parm_index == -2)
+ continue;
+ if (map.parm_index == -1)
+ {
+ collapse_stores (cur_summary, cur_summary_lto);
+ break;
+ }
+ if (cur_summary)
+ changed |= cur_summary->stores->insert
+ (0, 0, get_access_for_fnspec (e, fnspec, i, map));
+ if (cur_summary_lto)
+ changed |= cur_summary_lto->stores->insert
+ (0, 0, get_access_for_fnspec (e, fnspec, i, map));
+ }
+ }
+ if (fnspec.errno_maybe_written_p () && flag_errno_math)
+ {
+ if (cur_summary && !cur_summary->writes_errno)
+ {
+ cur_summary->writes_errno = true;
+ changed = true;
+ }
+ if (cur_summary_lto && !cur_summary_lto->writes_errno)
+ {
+ cur_summary_lto->writes_errno = true;
+ changed = true;
+ }
+ }
+ return changed;
}
- if (cur_summary_lto
- && !cur_summary_lto->loads->every_base)
+ if (ignore_stores_p (node->decl, ecf_flags))
{
- cur_summary_lto->loads->collapse ();
- changed = true;
+ if (dump_file)
+ fprintf (dump_file, " collapsing loads\n");
+ return collapse_loads (cur_summary, cur_summary_lto);
}
- return changed;
+ if (optimization_summaries)
+ optimization_summaries->remove (node);
+ if (summaries_lto)
+ summaries_lto->remove (node);
+ if (cur_summary_ptr)
+ *cur_summary_ptr = NULL;
+ if (cur_summary_lto_ptr)
+ *cur_summary_lto_ptr = NULL;
+ if (dump_file)
+ fprintf (dump_file, " Giving up\n");
+ return true;
}
/* Perform iterative dataflow on SCC component starting in COMPONENT_NODE. */
@@ -1853,26 +2333,14 @@ modref_propagate_in_scc (cgraph_node *component_node)
{
if (e->indirect_info->ecf_flags & (ECF_CONST | ECF_NOVOPS))
continue;
- if (ignore_stores_p (cur->decl, e->indirect_info->ecf_flags))
- {
- if (dump_file)
- fprintf (dump_file, " Indirect call: "
- "collapsing loads\n");
- changed |= collapse_loads (cur_summary, cur_summary_lto);
- }
- else
- {
- if (dump_file)
- fprintf (dump_file, " Indirect call: giving up\n");
- if (optimization_summaries)
- optimization_summaries->remove (node);
- if (summaries_lto)
- summaries_lto->remove (node);
- changed = true;
- cur_summary = NULL;
- cur_summary_lto = NULL;
- break;
- }
+ if (dump_file)
+ fprintf (dump_file, " Indirect call"
+ "collapsing loads\n");
+ changed |= propagate_unknown_call
+ (node, e, e->indirect_info->ecf_flags,
+ &cur_summary, &cur_summary_lto);
+ if (!cur_summary && !cur_summary_lto)
+ break;
}
if (!cur_summary && !cur_summary_lto)
@@ -1911,28 +2379,15 @@ modref_propagate_in_scc (cgraph_node *component_node)
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);
- 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;
- }
+ if (dump_file)
+ fprintf (dump_file, " Call target interposable"
+ " or not available\n");
+ changed |= propagate_unknown_call
+ (node, callee_edge, flags,
+ &cur_summary, &cur_summary_lto);
+ if (!cur_summary && !cur_summary_lto)
+ break;
+ continue;
}
/* We don't know anything about CALLEE, hence we cannot tell
@@ -1941,52 +2396,24 @@ modref_propagate_in_scc (cgraph_node *component_node)
if (cur_summary
&& !(callee_summary = optimization_summaries->get (callee)))
{
- if (!ignore_stores)
- {
- if (dump_file)
- fprintf (dump_file, " No call target summary\n");
-
- optimization_summaries->remove (node);
- cur_summary = NULL;
- changed = true;
- }
- else
- {
- if (dump_file)
- fprintf (dump_file, " No call target summary;"
- " collapsing loads\n");
-
- if (!cur_summary->loads->every_base)
- {
- cur_summary->loads->collapse ();
- changed = true;
- }
- }
+ if (dump_file)
+ fprintf (dump_file, " No call target summary\n");
+ changed |= propagate_unknown_call
+ (node, callee_edge, flags,
+ &cur_summary, NULL);
+ if (!cur_summary && !cur_summary_lto)
+ break;
}
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");
-
- summaries_lto->remove (node);
- cur_summary_lto = NULL;
- changed = true;
- }
- else
- {
- if (dump_file)
- fprintf (dump_file, " No call target summary;"
- " collapsing loads\n");
-
- if (!cur_summary_lto->loads->every_base)
- {
- cur_summary_lto->loads->collapse ();
- changed = true;
- }
- }
+ if (dump_file)
+ fprintf (dump_file, " No call target summary\n");
+ changed |= propagate_unknown_call
+ (node, callee_edge, flags,
+ NULL, &cur_summary_lto);
+ if (!cur_summary && !cur_summary_lto)
+ break;
}
/* We can not safely optimize based on summary of callee if it
@@ -2009,21 +2436,35 @@ modref_propagate_in_scc (cgraph_node *component_node)
/* Merge in callee's information. */
if (callee_summary)
{
- if (callee_summary->loads)
- changed |= cur_summary->loads->merge
- (callee_summary->loads, &parm_map);
- if (callee_summary->stores)
- changed |= cur_summary->stores->merge
- (callee_summary->stores, &parm_map);
+ changed |= cur_summary->loads->merge
+ (callee_summary->loads, &parm_map);
+ if (!ignore_stores)
+ {
+ changed |= cur_summary->stores->merge
+ (callee_summary->stores, &parm_map);
+ if (!cur_summary->writes_errno
+ && callee_summary->writes_errno)
+ {
+ cur_summary->writes_errno = true;
+ changed = true;
+ }
+ }
}
if (callee_summary_lto)
{
- if (callee_summary_lto->loads)
- changed |= cur_summary_lto->loads->merge
- (callee_summary_lto->loads, &parm_map);
- if (callee_summary_lto->stores)
- changed |= cur_summary_lto->stores->merge
- (callee_summary_lto->stores, &parm_map);
+ 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 (!cur_summary_lto->writes_errno
+ && callee_summary_lto->writes_errno)
+ {
+ cur_summary_lto->writes_errno = true;
+ changed = true;
+ }
+ }
}
if (dump_file && changed)
{
@@ -2107,10 +2548,15 @@ pass_ipa_modref::execute (function *)
modref_propagate_in_scc (component_node);
}
+ cgraph_node *node;
+ FOR_EACH_FUNCTION (node)
+ update_signature (node);
if (summaries_lto)
((modref_summaries_lto *)summaries_lto)->propagated = true;
ipa_free_postorder_info ();
free (order);
+ delete fnspec_summaries;
+ fnspec_summaries = NULL;
return 0;
}
@@ -2128,6 +2574,9 @@ ipa_modref_c_finalize ()
ggc_delete (summaries_lto);
summaries_lto = NULL;
}
+ if (fnspec_summaries)
+ delete fnspec_summaries;
+ fnspec_summaries = NULL;
}
#include "gt-ipa-modref.h"
diff --git a/gcc/ipa-modref.h b/gcc/ipa-modref.h
index 8828104..31ceffa 100644
--- a/gcc/ipa-modref.h
+++ b/gcc/ipa-modref.h
@@ -34,6 +34,7 @@ struct GTY(()) modref_summary
~modref_summary ();
void dump (FILE *);
bool useful_p (int ecf_flags);
+ bool writes_errno;
};
modref_summary *get_modref_function_summary (cgraph_node *func);
diff --git a/gcc/ipa-param-manipulation.c b/gcc/ipa-param-manipulation.c
index 5fc0de5..2bbea21 100644
--- a/gcc/ipa-param-manipulation.c
+++ b/gcc/ipa-param-manipulation.c
@@ -40,6 +40,9 @@ along with GCC; see the file COPYING3. If not see
#include "builtins.h"
#include "tree-ssa.h"
#include "tree-inline.h"
+#include "alloc-pool.h"
+#include "symbol-summary.h"
+#include "symtab-clones.h"
/* Actual prefixes of different newly synthetized parameters. Keep in sync
@@ -783,6 +786,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++)
@@ -1065,7 +1075,8 @@ ipa_param_body_adjustments::common_initialization (tree old_fndecl,
ipa_param_performed_split ps;
ps.dummy_decl = dummy_decl;
ps.unit_offset = apm->unit_offset;
- vec_safe_push (m_id->dst_node->clone.performed_splits, ps);
+ vec_safe_push (clone_info::get_create
+ (m_id->dst_node)->performed_splits, ps);
}
else
register_replacement (apm, new_parm);
@@ -1124,11 +1135,11 @@ ipa_param_body_adjustments::common_initialization (tree old_fndecl,
when they were in fact replaced by a constant. */
auto_vec <int, 16> index_mapping;
bool need_remap = false;
+ clone_info *info = clone_info::get (m_id->src_node);
- if (m_id && m_id->src_node->clone.param_adjustments)
+ if (m_id && info && info->param_adjustments)
{
- ipa_param_adjustments *prev_adjustments
- = m_id->src_node->clone.param_adjustments;
+ ipa_param_adjustments *prev_adjustments = info->param_adjustments;
prev_adjustments->get_updated_indices (&index_mapping);
need_remap = true;
}
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 05e3707..34a0d23 100644
--- a/gcc/ipa-predicate.h
+++ b/gcc/ipa-predicate.h
@@ -243,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 2d09d91..7a5fa59 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -52,6 +52,9 @@ along with GCC; see the file COPYING3. If not see
#include "domwalk.h"
#include "builtins.h"
#include "tree-cfgcleanup.h"
+#include "options.h"
+#include "symtab-clones.h"
+#include "attr-fnspec.h"
/* Function summary where the parameter infos are actually stored. */
ipa_node_params_t *ipa_node_params_sum = NULL;
@@ -122,7 +125,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 +1226,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
@@ -2294,7 +2365,8 @@ ipa_compute_jump_functions_for_bb (struct ipa_func_body_info *fbi, basic_block b
callee = callee->ultimate_alias_target ();
/* We do not need to bother analyzing calls to unknown functions
unless they may become known during lto/whopr. */
- if (!callee->definition && !flag_lto)
+ if (!callee->definition && !flag_lto
+ && !gimple_call_fnspec (cs->call_stmt).known_p ())
continue;
}
ipa_compute_jump_functions_for_edge (fbi, cs);
@@ -4142,7 +4214,10 @@ ipcp_transformation_initialize (void)
if (!ipa_vr_hash_table)
ipa_vr_hash_table = hash_table<ipa_vr_ggc_hash_traits>::create_ggc (37);
if (ipcp_transformation_sum == NULL)
- ipcp_transformation_sum = ipcp_transformation_t::create_ggc (symtab);
+ {
+ ipcp_transformation_sum = ipcp_transformation_t::create_ggc (symtab);
+ ipcp_transformation_sum->disable_insertion_hook ();
+ }
}
/* Release the IPA CP transformation summary. */
@@ -4901,7 +4976,11 @@ ipa_read_edge_info (class lto_input_block *ib,
count /= 2;
if (!count)
return;
- if (prevails && e->possibly_call_in_translation_unit_p ())
+ if (prevails
+ && (e->possibly_call_in_translation_unit_p ()
+ /* Also stream in jump functions to builtins in hope that they
+ will get fnspecs. */
+ || fndecl_built_in_p (e->callee->decl, BUILT_IN_NORMAL)))
{
class ipa_edge_args *args = IPA_EDGE_REF_GET_CREATE (e);
vec_safe_grow_cleared (args->jump_functions, count, true);
@@ -5347,12 +5426,13 @@ adjust_agg_replacement_values (struct cgraph_node *node,
struct ipa_agg_replacement_value *aggval)
{
struct ipa_agg_replacement_value *v;
+ clone_info *cinfo = clone_info::get (node);
- if (!node->clone.param_adjustments)
+ if (!cinfo || !cinfo->param_adjustments)
return;
auto_vec<int, 16> new_indices;
- node->clone.param_adjustments->get_updated_indices (&new_indices);
+ cinfo->param_adjustments->get_updated_indices (&new_indices);
for (v = aggval; v; v = v->next)
{
gcc_checking_assert (v->index >= 0);
@@ -5505,9 +5585,10 @@ ipcp_get_parm_bits (tree parm, tree *value, widest_int *mask)
return false;
}
- if (cnode->clone.param_adjustments)
+ clone_info *cinfo = clone_info::get (cnode);
+ if (cinfo && cinfo->param_adjustments)
{
- i = cnode->clone.param_adjustments->get_original_index (i);
+ i = cinfo->param_adjustments->get_original_index (i);
if (i < 0)
return false;
}
@@ -5538,9 +5619,10 @@ ipcp_update_bits (struct cgraph_node *node)
auto_vec<int, 16> new_indices;
bool need_remapping = false;
- if (node->clone.param_adjustments)
+ clone_info *cinfo = clone_info::get (node);
+ if (cinfo && cinfo->param_adjustments)
{
- node->clone.param_adjustments->get_updated_indices (&new_indices);
+ cinfo->param_adjustments->get_updated_indices (&new_indices);
need_remapping = true;
}
auto_vec <tree, 16> parm_decls;
@@ -5659,9 +5741,10 @@ ipcp_update_vr (struct cgraph_node *node)
auto_vec<int, 16> new_indices;
bool need_remapping = false;
- if (node->clone.param_adjustments)
+ clone_info *cinfo = clone_info::get (node);
+ if (cinfo && cinfo->param_adjustments)
{
- node->clone.param_adjustments->get_updated_indices (&new_indices);
+ cinfo->param_adjustments->get_updated_indices (&new_indices);
need_remapping = true;
}
auto_vec <tree, 16> parm_decls;
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 8b2edf6..77e92b0 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -941,7 +941,10 @@ class GTY((user)) ipa_node_params_t: public function_summary <ipa_node_params *>
{
public:
ipa_node_params_t (symbol_table *table, bool ggc):
- function_summary<ipa_node_params *> (table, ggc) { }
+ function_summary<ipa_node_params *> (table, ggc)
+ {
+ disable_insertion_hook ();
+ }
/* Hook that is called by summary when a node is duplicated. */
virtual void duplicate (cgraph_node *node,
@@ -1144,6 +1147,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 1af3206..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
@@ -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-ref.c b/gcc/ipa-ref.c
index 241828e..b7217c4 100644
--- a/gcc/ipa-ref.c
+++ b/gcc/ipa-ref.c
@@ -32,7 +32,6 @@ ipa_ref::remove_reference ()
{
struct ipa_ref_list *list = referred_ref_list ();
struct ipa_ref_list *list2 = referring_ref_list ();
- vec<ipa_ref_t, va_gc> *old_references = list2->references;
struct ipa_ref *last;
gcc_assert (list->referring[referred_index] == this);
@@ -66,7 +65,7 @@ ipa_ref::remove_reference ()
}
list->referring.pop ();
- last = &list2->references->last ();
+ last = &list2->references.last ();
struct ipa_ref *ref = this;
@@ -75,8 +74,7 @@ ipa_ref::remove_reference ()
*ref = *last;
ref->referred_ref_list ()->referring[referred_index] = ref;
}
- list2->references->pop ();
- gcc_assert (list2->references == old_references);
+ list2->references.pop ();
}
/* Return true when execution of reference can lead to return from
diff --git a/gcc/ipa-ref.h b/gcc/ipa-ref.h
index 1de5bd3..3ea3f66 100644
--- a/gcc/ipa-ref.h
+++ b/gcc/ipa-ref.h
@@ -27,7 +27,7 @@ struct symtab_node;
/* How the reference is done. */
-enum GTY(()) ipa_ref_use
+enum ipa_ref_use
{
IPA_REF_LOAD,
IPA_REF_STORE,
@@ -36,7 +36,7 @@ enum GTY(()) ipa_ref_use
};
/* Record of reference in callgraph or varpool. */
-struct GTY(()) ipa_ref
+struct ipa_ref
{
public:
/* Remove reference. */
@@ -59,28 +59,27 @@ public:
symtab_node *referred;
gimple *stmt;
unsigned int lto_stmt_uid;
+ unsigned int referred_index;
/* speculative id is used to link direct calls with their corresponding
IPA_REF_ADDR references when representing speculative calls. */
unsigned int speculative_id : 16;
- unsigned int referred_index;
ENUM_BITFIELD (ipa_ref_use) use:3;
unsigned int speculative:1;
};
typedef struct ipa_ref ipa_ref_t;
-typedef struct ipa_ref *ipa_ref_ptr;
/* List of references. This is stored in both callgraph and varpool nodes. */
-struct GTY(()) ipa_ref_list
+struct ipa_ref_list
{
public:
/* Return first reference in list or NULL if empty. */
struct ipa_ref *first_reference (void)
{
- if (!vec_safe_length (references))
+ if (!references.length ())
return NULL;
- return &(*references)[0];
+ return &references[0];
}
/* Return first referring ref in list or NULL if empty. */
@@ -121,20 +120,20 @@ public:
void clear (void)
{
referring.create (0);
- references = NULL;
+ references.create (0);
}
/* Return number of references. */
unsigned int nreferences (void)
{
- return vec_safe_length (references);
+ return references.length ();
}
/* Store actual references in references vector. */
- vec<ipa_ref_t, va_gc> *references;
+ vec<ipa_ref_t, va_heap, vl_ptr> references;
/* Referring is vector of pointers to references. It must not live in GGC space
or GGC will try to mark middle of references vectors. */
- vec<ipa_ref_ptr> GTY((skip)) referring;
+ vec<ipa_ref_t *, va_heap, vl_ptr> referring;
};
#endif /* GCC_IPA_REF_H */
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 4a6c011..871c997 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -894,7 +894,10 @@ propagate (void)
}
if (ipa_ref_opt_sum_summaries == NULL)
- ipa_ref_opt_sum_summaries = new ipa_ref_opt_summary_t (symtab);
+ {
+ ipa_ref_opt_sum_summaries = new ipa_ref_opt_summary_t (symtab);
+ ipa_ref_opt_sum_summaries->disable_insertion_hook ();
+ }
/* Cleanup. */
FOR_EACH_DEFINED_FUNCTION (node)
@@ -1130,6 +1133,7 @@ ipa_reference_read_optimization_summary (void)
gcc_checking_assert (ipa_ref_opt_sum_summaries == NULL);
ipa_ref_opt_sum_summaries = new ipa_ref_opt_summary_t (symtab);
+ ipa_ref_opt_sum_summaries->disable_insertion_hook ();
ipa_reference_vars_map = new reference_vars_map_t(257);
varpool_node_hooks
= symtab->add_varpool_removal_hook (varpool_removal_hook, NULL);
diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c
index 03e3fc5..82acc6a 100644
--- a/gcc/ipa-sra.c
+++ b/gcc/ipa-sra.c
@@ -84,6 +84,9 @@ along with GCC; see the file COPYING3. If not see
#include "cfganal.h"
#include "tree-streamer.h"
#include "internal-fn.h"
+#include "symtab-clones.h"
+
+static void ipa_sra_summarize_function (cgraph_node *);
/* Bits used to track size of an aggregate in bytes interprocedurally. */
#define ISRA_ARG_SIZE_LIMIT_BITS 16
@@ -373,6 +376,7 @@ public:
virtual void duplicate (cgraph_node *, cgraph_node *,
isra_func_summary *old_sum,
isra_func_summary *new_sum);
+ virtual void insert (cgraph_node *, isra_func_summary *);
};
/* Hook that is called by summary when a node is duplicated. */
@@ -426,6 +430,21 @@ ipa_sra_function_summaries::duplicate (cgraph_node *, cgraph_node *,
static GTY(()) ipa_sra_function_summaries *func_sums;
+/* Hook that is called by summary when new node appears. */
+
+void
+ipa_sra_function_summaries::insert (cgraph_node *node, isra_func_summary *)
+{
+ if (opt_for_fn (node->decl, flag_ipa_sra))
+ {
+ push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ ipa_sra_summarize_function (node);
+ pop_cfun ();
+ }
+ else
+ func_sums->remove (node);
+}
+
/* Class to manage call summaries. */
class ipa_sra_call_summaries: public call_summary <isra_call_summary *>
@@ -2478,79 +2497,6 @@ verify_splitting_accesses (cgraph_node *node, bool certain_must_exist)
}
}
-/* Intraprocedural part of IPA-SRA analysis. Scan function body of NODE and
- create a summary structure describing IPA-SRA opportunities and constraints
- in it. */
-
-static void
-ipa_sra_summarize_function (cgraph_node *node)
-{
- if (dump_file)
- fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (),
- node->order);
- if (!ipa_sra_preliminary_function_checks (node))
- return;
- gcc_obstack_init (&gensum_obstack);
- isra_func_summary *ifs = func_sums->get_create (node);
- ifs->m_candidate = true;
- tree ret = TREE_TYPE (TREE_TYPE (node->decl));
- ifs->m_returns_value = (TREE_CODE (ret) != VOID_TYPE);
-
- decl2desc = new hash_map<tree, gensum_param_desc *>;
- unsigned count = 0;
- for (tree parm = DECL_ARGUMENTS (node->decl); parm; parm = DECL_CHAIN (parm))
- count++;
-
- if (count > 0)
- {
- auto_vec<gensum_param_desc, 16> param_descriptions (count);
- param_descriptions.reserve_exact (count);
- param_descriptions.quick_grow_cleared (count);
-
- bool cfun_pushed = false;
- struct function *fun = DECL_STRUCT_FUNCTION (node->decl);
- if (create_parameter_descriptors (node, &param_descriptions))
- {
- push_cfun (fun);
- cfun_pushed = true;
- final_bbs = BITMAP_ALLOC (NULL);
- bb_dereferences = XCNEWVEC (HOST_WIDE_INT,
- by_ref_count
- * last_basic_block_for_fn (fun));
- aa_walking_limit = opt_for_fn (node->decl, param_ipa_max_aa_steps);
- scan_function (node, fun);
-
- if (dump_file)
- {
- dump_gensum_param_descriptors (dump_file, node->decl,
- &param_descriptions);
- fprintf (dump_file, "----------------------------------------\n");
- }
- }
- process_scan_results (node, fun, ifs, &param_descriptions);
-
- if (cfun_pushed)
- pop_cfun ();
- if (bb_dereferences)
- {
- free (bb_dereferences);
- bb_dereferences = NULL;
- BITMAP_FREE (final_bbs);
- final_bbs = NULL;
- }
- }
- isra_analyze_all_outgoing_calls (node);
-
- delete decl2desc;
- decl2desc = NULL;
- obstack_free (&gensum_obstack, NULL);
- if (dump_file)
- fprintf (dump_file, "\n\n");
- if (flag_checking)
- verify_splitting_accesses (node, false);
- return;
-}
-
/* Intraprocedural part of IPA-SRA analysis. Scan bodies of all functions in
this compilation unit and create summary structures describing IPA-SRA
opportunities and constraints in them. */
@@ -2935,7 +2881,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
@@ -3741,10 +3687,11 @@ process_isra_node_results (cgraph_node *node,
auto_vec<bool, 16> surviving_params;
bool check_surviving = false;
- if (node->clone.param_adjustments)
+ clone_info *cinfo = clone_info::get (node);
+ if (cinfo && cinfo->param_adjustments)
{
check_surviving = true;
- node->clone.param_adjustments->get_surviving_params (&surviving_params);
+ cinfo->param_adjustments->get_surviving_params (&surviving_params);
}
unsigned param_count = vec_safe_length (ifs->m_parameters);
@@ -3778,7 +3725,8 @@ process_isra_node_results (cgraph_node *node,
}
vec<ipa_adjusted_param, va_gc> *new_params = NULL;
- if (ipa_param_adjustments *old_adjustments = node->clone.param_adjustments)
+ if (ipa_param_adjustments *old_adjustments
+ = cinfo ? cinfo->param_adjustments : NULL)
{
unsigned old_adj_len = vec_safe_length (old_adjustments->m_adj_params);
for (unsigned i = 0; i < old_adj_len; i++)
@@ -3839,10 +3787,11 @@ disable_unavailable_parameters (cgraph_node *node, isra_func_summary *ifs)
auto_vec<bool, 16> surviving_params;
bool check_surviving = false;
- if (node->clone.param_adjustments)
+ clone_info *cinfo = clone_info::get (node);
+ if (cinfo && cinfo->param_adjustments)
{
check_surviving = true;
- node->clone.param_adjustments->get_surviving_params (&surviving_params);
+ cinfo->param_adjustments->get_surviving_params (&surviving_params);
}
bool dumped_first = false;
for (unsigned i = 0; i < len; i++)
@@ -4102,6 +4051,79 @@ public:
} // anon namespace
+/* Intraprocedural part of IPA-SRA analysis. Scan function body of NODE and
+ create a summary structure describing IPA-SRA opportunities and constraints
+ in it. */
+
+static void
+ipa_sra_summarize_function (cgraph_node *node)
+{
+ if (dump_file)
+ fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (),
+ node->order);
+ if (!ipa_sra_preliminary_function_checks (node))
+ return;
+ gcc_obstack_init (&gensum_obstack);
+ isra_func_summary *ifs = func_sums->get_create (node);
+ ifs->m_candidate = true;
+ tree ret = TREE_TYPE (TREE_TYPE (node->decl));
+ ifs->m_returns_value = (TREE_CODE (ret) != VOID_TYPE);
+
+ decl2desc = new hash_map<tree, gensum_param_desc *>;
+ unsigned count = 0;
+ for (tree parm = DECL_ARGUMENTS (node->decl); parm; parm = DECL_CHAIN (parm))
+ count++;
+
+ if (count > 0)
+ {
+ auto_vec<gensum_param_desc, 16> param_descriptions (count);
+ param_descriptions.reserve_exact (count);
+ param_descriptions.quick_grow_cleared (count);
+
+ bool cfun_pushed = false;
+ struct function *fun = DECL_STRUCT_FUNCTION (node->decl);
+ if (create_parameter_descriptors (node, &param_descriptions))
+ {
+ push_cfun (fun);
+ cfun_pushed = true;
+ final_bbs = BITMAP_ALLOC (NULL);
+ bb_dereferences = XCNEWVEC (HOST_WIDE_INT,
+ by_ref_count
+ * last_basic_block_for_fn (fun));
+ aa_walking_limit = opt_for_fn (node->decl, param_ipa_max_aa_steps);
+ scan_function (node, fun);
+
+ if (dump_file)
+ {
+ dump_gensum_param_descriptors (dump_file, node->decl,
+ &param_descriptions);
+ fprintf (dump_file, "----------------------------------------\n");
+ }
+ }
+ process_scan_results (node, fun, ifs, &param_descriptions);
+
+ if (cfun_pushed)
+ pop_cfun ();
+ if (bb_dereferences)
+ {
+ free (bb_dereferences);
+ bb_dereferences = NULL;
+ BITMAP_FREE (final_bbs);
+ final_bbs = NULL;
+ }
+ }
+ isra_analyze_all_outgoing_calls (node);
+
+ delete decl2desc;
+ decl2desc = NULL;
+ obstack_free (&gensum_obstack, NULL);
+ if (dump_file)
+ fprintf (dump_file, "\n\n");
+ if (flag_checking)
+ verify_splitting_accesses (node, false);
+ return;
+}
+
ipa_opt_pass_d *
make_pass_ipa_sra (gcc::context *ctxt)
{
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-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..5443031 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1845,6 +1845,7 @@ ira_setup_alts (rtx_insn *insn)
default:
{
enum constraint_num cn = lookup_constraint (p);
+ rtx mem = NULL;
switch (get_constraint_type (cn))
{
case CT_REGISTER:
@@ -1867,8 +1868,12 @@ ira_setup_alts (rtx_insn *insn)
goto op_success;
case CT_MEMORY:
+ mem = op;
+ /* Fall through. */
case CT_SPECIAL_MEMORY:
- if (MEM_P (op))
+ if (!mem)
+ mem = extract_mem_from_operand (op);
+ if (MEM_P (mem))
goto op_success;
win_p = true;
break;
@@ -5133,7 +5138,198 @@ move_unallocated_pseudos (void)
first_moveable_pseudo = last_moveable_pseudo = 0;
}
+
+
+/* Code dealing with scratches (changing them onto
+ pseudos and restoring them from the pseudos).
+
+ We change scratches into pseudos at the beginning of IRA to
+ simplify dealing with them (conflicts, hard register assignments).
+
+ If the pseudo denoting scratch was spilled it means that we do not
+ need a hard register for it. Such pseudos are transformed back to
+ scratches at the end of LRA. */
+
+/* Description of location of a former scratch operand. */
+struct sloc
+{
+ rtx_insn *insn; /* Insn where the scratch was. */
+ int nop; /* Number of the operand which was a scratch. */
+ unsigned regno; /* regno gnerated instead of scratch */
+ int icode; /* Original icode from which scratch was removed. */
+};
+
+typedef struct sloc *sloc_t;
+
+/* Locations of the former scratches. */
+static vec<sloc_t> scratches;
+
+/* Bitmap of scratch regnos. */
+static bitmap_head scratch_bitmap;
+
+/* Bitmap of scratch operands. */
+static bitmap_head scratch_operand_bitmap;
+
+/* Return true if pseudo REGNO is made of SCRATCH. */
+bool
+ira_former_scratch_p (int regno)
+{
+ return bitmap_bit_p (&scratch_bitmap, regno);
+}
+
+/* Return true if the operand NOP of INSN is a former scratch. */
+bool
+ira_former_scratch_operand_p (rtx_insn *insn, int nop)
+{
+ return bitmap_bit_p (&scratch_operand_bitmap,
+ INSN_UID (insn) * MAX_RECOG_OPERANDS + nop) != 0;
+}
+
+/* Register operand NOP in INSN as a former scratch. It will be
+ changed to scratch back, if it is necessary, at the LRA end. */
+void
+ira_register_new_scratch_op (rtx_insn *insn, int nop, int icode)
+{
+ rtx op = *recog_data.operand_loc[nop];
+ sloc_t loc = XNEW (struct sloc);
+ ira_assert (REG_P (op));
+ loc->insn = insn;
+ loc->nop = nop;
+ loc->regno = REGNO (op);
+ loc->icode = icode;
+ scratches.safe_push (loc);
+ bitmap_set_bit (&scratch_bitmap, REGNO (op));
+ bitmap_set_bit (&scratch_operand_bitmap,
+ INSN_UID (insn) * MAX_RECOG_OPERANDS + nop);
+ add_reg_note (insn, REG_UNUSED, op);
+}
+
+/* Return true if string STR contains constraint 'X'. */
+static bool
+contains_X_constraint_p (const char *str)
+{
+ int c;
+
+ while ((c = *str))
+ {
+ str += CONSTRAINT_LEN (c, str);
+ if (c == 'X') return true;
+ }
+ return false;
+}
+
+/* Change INSN's scratches into pseudos and save their location.
+ Return true if we changed any scratch. */
+bool
+ira_remove_insn_scratches (rtx_insn *insn, bool all_p, FILE *dump_file,
+ rtx (*get_reg) (rtx original))
+{
+ int i;
+ bool insn_changed_p;
+ rtx reg, *loc;
+
+ extract_insn (insn);
+ insn_changed_p = false;
+ for (i = 0; i < recog_data.n_operands; i++)
+ {
+ loc = recog_data.operand_loc[i];
+ if (GET_CODE (*loc) == SCRATCH && GET_MODE (*loc) != VOIDmode)
+ {
+ if (! all_p && contains_X_constraint_p (recog_data.constraints[i]))
+ continue;
+ insn_changed_p = true;
+ *loc = reg = get_reg (*loc);
+ ira_register_new_scratch_op (insn, i, INSN_CODE (insn));
+ if (ira_dump_file != NULL)
+ fprintf (dump_file,
+ "Removing SCRATCH to p%u in insn #%u (nop %d)\n",
+ REGNO (reg), INSN_UID (insn), i);
+ }
+ }
+ return insn_changed_p;
+}
+
+/* Return new register of the same mode as ORIGINAL. Used in
+ remove_scratches. */
+static rtx
+get_scratch_reg (rtx original)
+{
+ return gen_reg_rtx (GET_MODE (original));
+}
+
+/* Change scratches into pseudos and save their location. Return true
+ if we changed any scratch. */
+static bool
+remove_scratches (void)
+{
+ bool change_p = false;
+ basic_block bb;
+ rtx_insn *insn;
+
+ scratches.create (get_max_uid ());
+ bitmap_initialize (&scratch_bitmap, &reg_obstack);
+ bitmap_initialize (&scratch_operand_bitmap, &reg_obstack);
+ FOR_EACH_BB_FN (bb, cfun)
+ FOR_BB_INSNS (bb, insn)
+ if (INSN_P (insn)
+ && ira_remove_insn_scratches (insn, false, ira_dump_file, get_scratch_reg))
+ {
+ /* Because we might use DF, we need to keep DF info up to date. */
+ df_insn_rescan (insn);
+ change_p = true;
+ }
+ return change_p;
+}
+
+/* Changes pseudos created by function remove_scratches onto scratches. */
+void
+ira_restore_scratches (FILE *dump_file)
+{
+ int regno, n;
+ unsigned i;
+ rtx *op_loc;
+ sloc_t loc;
+
+ for (i = 0; scratches.iterate (i, &loc); i++)
+ {
+ /* Ignore already deleted insns. */
+ if (NOTE_P (loc->insn)
+ && NOTE_KIND (loc->insn) == NOTE_INSN_DELETED)
+ continue;
+ extract_insn (loc->insn);
+ if (loc->icode != INSN_CODE (loc->insn))
+ {
+ /* The icode doesn't match, which means the insn has been modified
+ (e.g. register elimination). The scratch cannot be restored. */
+ continue;
+ }
+ op_loc = recog_data.operand_loc[loc->nop];
+ if (REG_P (*op_loc)
+ && ((regno = REGNO (*op_loc)) >= FIRST_PSEUDO_REGISTER)
+ && reg_renumber[regno] < 0)
+ {
+ /* It should be only case when scratch register with chosen
+ constraint 'X' did not get memory or hard register. */
+ ira_assert (ira_former_scratch_p (regno));
+ *op_loc = gen_rtx_SCRATCH (GET_MODE (*op_loc));
+ for (n = 0; n < recog_data.n_dups; n++)
+ *recog_data.dup_loc[n]
+ = *recog_data.operand_loc[(int) recog_data.dup_num[n]];
+ if (dump_file != NULL)
+ fprintf (dump_file, "Restoring SCRATCH in insn #%u(nop %d)\n",
+ INSN_UID (loc->insn), loc->nop);
+ }
+ }
+ for (i = 0; scratches.iterate (i, &loc); i++)
+ free (loc);
+ scratches.release ();
+ bitmap_clear (&scratch_bitmap);
+ bitmap_clear (&scratch_operand_bitmap);
+}
+
+
+
/* If the backend knows where to allocate pseudos for hard
register initial values, register these allocations now. */
static void
@@ -5182,8 +5378,10 @@ allocate_initial_values (void)
&hreg, &preg));
}
}
+
+
/* True when we use LRA instead of reload pass for the current
function. */
bool ira_use_lra_p;
@@ -5204,6 +5402,17 @@ ira (FILE *f)
bool saved_flag_caller_saves = flag_caller_saves;
enum ira_region saved_flag_ira_region = flag_ira_region;
+ if (flag_ira_verbose < 10)
+ {
+ internal_flag_ira_verbose = flag_ira_verbose;
+ ira_dump_file = f;
+ }
+ else
+ {
+ internal_flag_ira_verbose = flag_ira_verbose - 10;
+ ira_dump_file = stderr;
+ }
+
clear_bb_flags ();
/* Determine if the current function is a leaf before running IRA
@@ -5250,17 +5459,6 @@ ira (FILE *f)
if (flag_caller_saves && !ira_use_lra_p)
init_caller_save ();
- if (flag_ira_verbose < 10)
- {
- internal_flag_ira_verbose = flag_ira_verbose;
- ira_dump_file = f;
- }
- else
- {
- internal_flag_ira_verbose = flag_ira_verbose - 10;
- ira_dump_file = stderr;
- }
-
setup_prohibited_mode_move_regs ();
decrease_live_ranges_number ();
df_note_add_problem ();
@@ -5305,9 +5503,6 @@ ira (FILE *f)
if (warn_clobbered)
generate_setjmp_warnings ();
- if (resize_reg_info () && flag_ira_loop_pressure)
- ira_set_pseudo_classes (true, ira_dump_file);
-
init_alias_analysis ();
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
reg_equiv = XCNEWVEC (struct equivalence, max_reg_num ());
@@ -5331,6 +5526,30 @@ ira (FILE *f)
end_alias_analysis ();
free (reg_equiv);
+ /* Once max_regno changes, we need to free and re-init/re-compute
+ some data structures like regstat_n_sets_and_refs and reg_info_p. */
+ auto regstat_recompute_for_max_regno = []() {
+ regstat_free_n_sets_and_refs ();
+ regstat_free_ri ();
+ regstat_init_n_sets_and_refs ();
+ regstat_compute_ri ();
+ };
+
+ int max_regno_before_rm = max_reg_num ();
+ if (ira_use_lra_p && remove_scratches ())
+ {
+ ira_expand_reg_equiv ();
+ /* For now remove_scatches is supposed to create pseudos when it
+ succeeds, assert this happens all the time. Once it doesn't
+ hold, we should guard the regstat recompute for the case
+ max_regno changes. */
+ gcc_assert (max_regno_before_rm != max_reg_num ());
+ regstat_recompute_for_max_regno ();
+ }
+
+ if (resize_reg_info () && flag_ira_loop_pressure)
+ ira_set_pseudo_classes (true, ira_dump_file);
+
setup_reg_equiv ();
grow_reg_equivs ();
setup_reg_equiv_init ();
@@ -5453,12 +5672,7 @@ ira (FILE *f)
#endif
if (max_regno != max_regno_before_ira)
- {
- regstat_free_n_sets_and_refs ();
- regstat_free_ri ();
- regstat_init_n_sets_and_refs ();
- regstat_compute_ri ();
- }
+ regstat_recompute_for_max_regno ();
overall_cost_before = ira_overall_cost;
if (! ira_conflicts_p)
diff --git a/gcc/ira.h b/gcc/ira.h
index 09f40ef..c30f36a 100644
--- a/gcc/ira.h
+++ b/gcc/ira.h
@@ -207,6 +207,13 @@ extern bool ira_bad_reload_regno (int, rtx, rtx);
extern void ira_adjust_equiv_reg_cost (unsigned, int);
+extern bool ira_former_scratch_p (int regno);
+extern bool ira_former_scratch_operand_p (rtx_insn *insn, int nop);
+extern void ira_register_new_scratch_op (rtx_insn *insn, int nop, int icode);
+extern bool ira_remove_insn_scratches (rtx_insn *insn, bool all_p, FILE *dump_file,
+ rtx (*get_reg) (rtx original));
+extern void ira_restore_scratches (FILE *dump_file);
+
/* ira-costs.c */
extern void ira_costs_c_finalize (void);
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 8819a88..d82f542 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -790,7 +790,7 @@ lhd_begin_section (const char *name)
saved_section = text_section;
/* Create a new section and switch to it. */
- section = get_section (name, SECTION_DEBUG | SECTION_EXCLUDE, NULL);
+ section = get_section (name, SECTION_DEBUG | SECTION_EXCLUDE, NULL, true);
switch_to_section (section);
}
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index f761d7d..fbc47ba 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -406,8 +406,10 @@ valid_address_p (rtx op, struct address_info *ad,
address_eliminator eliminator (ad);
/* Allow a memory OP if it matches CONSTRAINT, even if CONSTRAINT is more
- forgiving than "m". */
- if (MEM_P (op)
+ forgiving than "m".
+ Need to extract memory from op for special memory constraint,
+ i.e. bcst_mem_operand in i386 backend. */
+ if (MEM_P (extract_mem_from_operand (op))
&& (insn_extra_memory_constraint (constraint)
|| insn_extra_special_memory_constraint (constraint))
&& constraint_satisfied_p (op, constraint))
@@ -416,14 +418,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);
}
@@ -2448,8 +2470,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;
@@ -2487,7 +2508,7 @@ process_alt_operands (int only_alternative)
while ((p += len), c);
scratch_p = (operand_reg[nop] != NULL_RTX
- && lra_former_scratch_p (REGNO (operand_reg[nop])));
+ && ira_former_scratch_p (REGNO (operand_reg[nop])));
/* Record which operands fit this alternative. */
if (win)
{
@@ -3409,13 +3430,14 @@ process_address_1 (int nop, bool check_only_p,
rtx new_reg;
HOST_WIDE_INT scale;
rtx op = *curr_id->operand_loc[nop];
+ rtx mem = extract_mem_from_operand (op);
const char *constraint = curr_static_id->operand[nop].constraint;
enum constraint_num cn = lookup_constraint (constraint);
bool change_p = false;
- if (MEM_P (op)
- && GET_MODE (op) == BLKmode
- && GET_CODE (XEXP (op, 0)) == SCRATCH)
+ if (MEM_P (mem)
+ && GET_MODE (mem) == BLKmode
+ && GET_CODE (XEXP (mem, 0)) == SCRATCH)
return false;
if (insn_extra_address_constraint (cn)
@@ -3428,12 +3450,14 @@ process_address_1 (int nop, bool check_only_p,
&& curr_static_id->operand[nop].is_address)
decompose_lea_address (&ad, curr_id->operand_loc[nop]);
/* Do not attempt to decompose arbitrary addresses generated by combine
- for asm operands with loose constraints, e.g 'X'. */
- else if (MEM_P (op)
+ for asm operands with loose constraints, e.g 'X'.
+ Need to extract memory from op for special memory constraint,
+ i.e. bcst_mem_operand in i386 backend. */
+ else if (MEM_P (mem)
&& !(INSN_CODE (curr_insn) < 0
&& get_constraint_type (cn) == CT_FIXED_FORM
&& constraint_satisfied_p (op, cn)))
- decompose_mem_address (&ad, op);
+ decompose_mem_address (&ad, mem);
else if (GET_CODE (op) == SUBREG
&& MEM_P (SUBREG_REG (op)))
decompose_mem_address (&ad, SUBREG_REG (op));
@@ -4336,8 +4360,8 @@ curr_insn_transform (bool check_only_p)
assigment pass and the scratch pseudo will be
spilled. Spilled scratch pseudos are transformed
back to scratches at the LRA end. */
- && lra_former_scratch_operand_p (curr_insn, i)
- && lra_former_scratch_p (REGNO (op)))
+ && ira_former_scratch_operand_p (curr_insn, i)
+ && ira_former_scratch_p (REGNO (op)))
{
int regno = REGNO (op);
lra_change_class (regno, NO_REGS, " Change to", true);
@@ -4358,7 +4382,7 @@ curr_insn_transform (bool check_only_p)
&& goal_alt[i] != NO_REGS && REG_P (op)
&& (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER
&& regno < new_regno_start
- && ! lra_former_scratch_p (regno)
+ && ! ira_former_scratch_p (regno)
&& reg_renumber[regno] < 0
/* Check that the optional reload pseudo will be able to
hold given mode value. */
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 01fcbfa..f9e99a2 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -319,9 +319,6 @@ extern struct lra_insn_reg *lra_get_insn_regs (int);
extern void lra_free_copies (void);
extern void lra_create_copy (int, int, int);
extern lra_copy_t lra_get_copy (int);
-extern bool lra_former_scratch_p (int);
-extern bool lra_former_scratch_operand_p (rtx_insn *, int);
-extern void lra_register_new_scratch_op (rtx_insn *, int, int);
extern int lra_new_regno_start;
extern int lra_constraint_new_regno_start;
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 72309e5..7a62c8f 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -1031,12 +1031,12 @@ update_scratch_ops (rtx_insn *remat_insn)
if (! REG_P (*loc))
continue;
int regno = REGNO (*loc);
- if (! lra_former_scratch_p (regno))
+ if (! ira_former_scratch_p (regno))
continue;
*loc = lra_create_new_reg (GET_MODE (*loc), *loc,
lra_get_allocno_class (regno),
"scratch pseudo copy");
- lra_register_new_scratch_op (remat_insn, i, id->icode);
+ ira_register_new_scratch_op (remat_insn, i, id->icode);
}
}
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 0caa4ac..8082a5b 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -446,7 +446,7 @@ remove_pseudos (rtx *loc, rtx_insn *insn)
it might result in an address reload for some targets. In
any case we transform such pseudos not getting hard registers
into scratches back. */
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
{
if (lra_reg_info[i].nrefs == 0
&& pseudo_slots[i].mem == NULL && spill_hard_reg[i] == NULL)
@@ -494,7 +494,7 @@ spill_pseudos (void)
for (i = FIRST_PSEUDO_REGISTER; i < regs_num; i++)
{
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
{
bitmap_set_bit (spilled_pseudos, i);
bitmap_ior_into (changed_insns, &lra_reg_info[i].insn_bitmap);
@@ -578,7 +578,7 @@ lra_need_for_scratch_reg_p (void)
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
- && lra_former_scratch_p (i))
+ && ira_former_scratch_p (i))
return true;
return false;
}
@@ -591,7 +591,7 @@ lra_need_for_spills_p (void)
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
return true;
return false;
}
@@ -612,7 +612,7 @@ lra_spill (void)
for (n = 0, i = FIRST_PSEUDO_REGISTER; i < regs_num; i++)
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
/* We do not want to assign memory for former scratches. */
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
pseudo_regnos[n++] = i;
lra_assert (n > 0);
pseudo_slots = XNEWVEC (struct pseudo_slot, regs_num);
diff --git a/gcc/lra.c b/gcc/lra.c
index caa09d8..664f1b5 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -160,8 +160,6 @@ static void invalidate_insn_recog_data (int);
static int get_insn_freq (rtx_insn *);
static void invalidate_insn_data_regno_info (lra_insn_recog_data_t,
rtx_insn *, int);
-static void remove_scratches_1 (rtx_insn *);
-
/* Expand all regno related info needed for LRA. */
static void
expand_reg_data (int old)
@@ -482,6 +480,8 @@ lra_emit_add (rtx x, rtx y, rtx z)
/* The number of emitted reload insns so far. */
int lra_curr_reload_num;
+static void remove_insn_scratches (rtx_insn *insn);
+
/* Emit x := y, processing special case when y = u + v or y = u + v *
scale + w through emit_add (Y can be an address which is base +
index reg * scale + displacement in general case). X may be used
@@ -503,7 +503,7 @@ lra_emit_move (rtx x, rtx y)
/* The move pattern may require scratch registers, so convert them
into real registers now. */
if (insn != NULL_RTX)
- remove_scratches_1 (insn);
+ remove_insn_scratches (insn);
if (REG_P (x))
lra_reg_info[ORIGINAL_REGNO (x)].last_reload = ++lra_curr_reload_num;
/* Function emit_move can create pseudos -- so expand the pseudo
@@ -1988,170 +1988,35 @@ lra_substitute_pseudo_within_insn (rtx_insn *insn, int old_regno,
-/* This page contains code dealing with scratches (changing them onto
- pseudos and restoring them from the pseudos).
-
- We change scratches into pseudos at the beginning of LRA to
- simplify dealing with them (conflicts, hard register assignments).
-
- If the pseudo denoting scratch was spilled it means that we do need
- a hard register for it. Such pseudos are transformed back to
- scratches at the end of LRA. */
-
-/* Description of location of a former scratch operand. */
-struct sloc
+/* Return new register of the same mode as ORIGINAL of class ALL_REGS.
+ Used in ira_remove_scratches. */
+static rtx
+get_scratch_reg (rtx original)
{
- rtx_insn *insn; /* Insn where the scratch was. */
- int nop; /* Number of the operand which was a scratch. */
- int icode; /* Original icode from which scratch was removed. */
-};
-
-typedef struct sloc *sloc_t;
-
-/* Locations of the former scratches. */
-static vec<sloc_t> scratches;
-
-/* Bitmap of scratch regnos. */
-static bitmap_head scratch_bitmap;
-
-/* Bitmap of scratch operands. */
-static bitmap_head scratch_operand_bitmap;
-
-/* Return true if pseudo REGNO is made of SCRATCH. */
-bool
-lra_former_scratch_p (int regno)
-{
- return bitmap_bit_p (&scratch_bitmap, regno);
+ return lra_create_new_reg (GET_MODE (original), original, ALL_REGS, NULL);
}
-/* Return true if the operand NOP of INSN is a former scratch. */
-bool
-lra_former_scratch_operand_p (rtx_insn *insn, int nop)
-{
- return bitmap_bit_p (&scratch_operand_bitmap,
- INSN_UID (insn) * MAX_RECOG_OPERANDS + nop) != 0;
-}
-
-/* Register operand NOP in INSN as a former scratch. It will be
- changed to scratch back, if it is necessary, at the LRA end. */
-void
-lra_register_new_scratch_op (rtx_insn *insn, int nop, int icode)
-{
- lra_insn_recog_data_t id = lra_get_insn_recog_data (insn);
- rtx op = *id->operand_loc[nop];
- sloc_t loc = XNEW (struct sloc);
- lra_assert (REG_P (op));
- loc->insn = insn;
- loc->nop = nop;
- loc->icode = icode;
- scratches.safe_push (loc);
- bitmap_set_bit (&scratch_bitmap, REGNO (op));
- bitmap_set_bit (&scratch_operand_bitmap,
- INSN_UID (insn) * MAX_RECOG_OPERANDS + nop);
- add_reg_note (insn, REG_UNUSED, op);
-}
-
-/* Change INSN's scratches into pseudos and save their location. */
+/* Remove all insn scratches in INSN. */
static void
-remove_scratches_1 (rtx_insn *insn)
+remove_insn_scratches (rtx_insn *insn)
{
- int i;
- bool insn_changed_p;
- rtx reg;
- lra_insn_recog_data_t id;
- struct lra_static_insn_data *static_id;
-
- id = lra_get_insn_recog_data (insn);
- static_id = id->insn_static_data;
- insn_changed_p = false;
- for (i = 0; i < static_id->n_operands; i++)
- if (GET_CODE (*id->operand_loc[i]) == SCRATCH
- && GET_MODE (*id->operand_loc[i]) != VOIDmode)
- {
- insn_changed_p = true;
- *id->operand_loc[i] = reg
- = lra_create_new_reg (static_id->operand[i].mode,
- *id->operand_loc[i], ALL_REGS, NULL);
- lra_register_new_scratch_op (insn, i, id->icode);
- if (lra_dump_file != NULL)
- fprintf (lra_dump_file,
- "Removing SCRATCH in insn #%u (nop %d)\n",
- INSN_UID (insn), i);
- }
- if (insn_changed_p)
- /* Because we might use DF right after caller-saves sub-pass
- we need to keep DF info up to date. */
+ if (ira_remove_insn_scratches (insn, true, lra_dump_file, get_scratch_reg))
df_insn_rescan (insn);
}
-/* Change scratches into pseudos and save their location. */
+/* Remove all insn scratches in the current function. */
static void
remove_scratches (void)
{
basic_block bb;
rtx_insn *insn;
- scratches.create (get_max_uid ());
- bitmap_initialize (&scratch_bitmap, &reg_obstack);
- bitmap_initialize (&scratch_operand_bitmap, &reg_obstack);
FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
- if (INSN_P (insn))
- remove_scratches_1 (insn);
-}
-
-/* Changes pseudos created by function remove_scratches onto scratches. */
-static void
-restore_scratches (void)
-{
- int regno;
- unsigned i;
- sloc_t loc;
- rtx_insn *last = NULL;
- lra_insn_recog_data_t id = NULL;
-
- for (i = 0; scratches.iterate (i, &loc); i++)
- {
- /* Ignore already deleted insns. */
- if (NOTE_P (loc->insn)
- && NOTE_KIND (loc->insn) == NOTE_INSN_DELETED)
- continue;
- if (last != loc->insn)
- {
- last = loc->insn;
- id = lra_get_insn_recog_data (last);
- }
- if (loc->icode != id->icode)
- {
- /* The icode doesn't match, which means the insn has been modified
- (e.g. register elimination). The scratch cannot be restored. */
- continue;
- }
- if (REG_P (*id->operand_loc[loc->nop])
- && ((regno = REGNO (*id->operand_loc[loc->nop]))
- >= FIRST_PSEUDO_REGISTER)
- && lra_get_regno_hard_regno (regno) < 0)
- {
- /* It should be only case when scratch register with chosen
- constraint 'X' did not get memory or hard register. */
- lra_assert (lra_former_scratch_p (regno));
- *id->operand_loc[loc->nop]
- = gen_rtx_SCRATCH (GET_MODE (*id->operand_loc[loc->nop]));
- lra_update_dup (id, loc->nop);
- if (lra_dump_file != NULL)
- fprintf (lra_dump_file, "Restoring SCRATCH in insn #%u(nop %d)\n",
- INSN_UID (loc->insn), loc->nop);
- }
- }
- for (i = 0; scratches.iterate (i, &loc); i++)
- free (loc);
- scratches.release ();
- bitmap_clear (&scratch_bitmap);
- bitmap_clear (&scratch_operand_bitmap);
+ if (INSN_P (insn))
+ remove_insn_scratches (insn);
}
-
-
/* Function checks RTL for correctness. If FINAL_P is true, it is
done at the end of LRA and the check is more rigorous. */
static void
@@ -2543,7 +2408,7 @@ lra (FILE *f)
lra_bad_spill_regno_start = lra_constraint_new_regno_start;
lra_assignment_iter_after_spill = 0;
}
- restore_scratches ();
+ ira_restore_scratches (lra_dump_file);
lra_eliminate (true, false);
lra_final_code_change ();
lra_in_progress = 0;
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 93a99f3..8718678 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -39,6 +39,10 @@ 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"
+#include "symtab-clones.h"
/* True when asm nodes has been output. */
bool asm_nodes_output = false;
@@ -261,7 +265,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 +397,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 +537,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 +559,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.
@@ -766,6 +768,9 @@ output_refs (lto_symtab_encoder_t encoder)
for (int i = 0; node->iterate_reference (i, ref); i++)
lto_output_ref (ob, ref, encoder);
}
+ if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
+ if (cnode->declare_variant_alt)
+ omp_lto_output_declare_variant_alt (ob, cnode, encoder);
}
streamer_write_uhwi_stream (ob->main_stream, 0);
@@ -931,7 +936,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 +992,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 +1144,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 +1200,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 +1242,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 +1302,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 +1319,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 +1330,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;
}
@@ -1614,6 +1612,9 @@ input_refs (class lto_input_block *ib,
input_ref (ib, node, nodes);
count--;
}
+ if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
+ if (cnode->declare_variant_alt)
+ omp_lto_input_declare_variant_alt (ib, cnode, nodes);
}
}
@@ -1823,9 +1824,10 @@ input_offload_tables (bool do_force_output)
static int
output_cgraph_opt_summary_p (struct cgraph_node *node)
{
- return ((node->clone_of || node->former_clone_of)
- && (node->clone.tree_map
- || node->clone.param_adjustments));
+ if (node->clone_of || node->former_clone_of)
+ return true;
+ clone_info *info = clone_info::get (node);
+ return info && (info->tree_map || info->param_adjustments);
}
/* Output optimization summary for EDGE to OB. */
@@ -1849,9 +1851,12 @@ output_node_opt_summary (struct output_block *ob,
/* TODO: Should this code be moved to ipa-param-manipulation? */
struct bitpack_d bp;
bp = bitpack_create (ob->main_stream);
- bp_pack_value (&bp, (node->clone.param_adjustments != NULL), 1);
+ clone_info *info = clone_info::get (node);
+
+ bp_pack_value (&bp, (info && info->param_adjustments != NULL), 1);
streamer_write_bitpack (&bp);
- if (ipa_param_adjustments *adjustments = node->clone.param_adjustments)
+ if (ipa_param_adjustments *adjustments
+ = info ? info->param_adjustments : NULL)
{
streamer_write_uhwi (ob, vec_safe_length (adjustments->m_adj_params));
ipa_adjusted_param *adj;
@@ -1879,17 +1884,18 @@ output_node_opt_summary (struct output_block *ob,
}
streamer_write_hwi (ob, adjustments->m_always_copy_start);
bp = bitpack_create (ob->main_stream);
- bp_pack_value (&bp, node->clone.param_adjustments->m_skip_return, 1);
+ bp_pack_value (&bp, info->param_adjustments->m_skip_return, 1);
streamer_write_bitpack (&bp);
}
- streamer_write_uhwi (ob, vec_safe_length (node->clone.tree_map));
- FOR_EACH_VEC_SAFE_ELT (node->clone.tree_map, i, map)
- {
- streamer_write_uhwi (ob, map->parm_num);
- gcc_assert (EXPR_LOCATION (map->new_tree) == UNKNOWN_LOCATION);
- stream_write_tree (ob, map->new_tree, true);
- }
+ streamer_write_uhwi (ob, info ? vec_safe_length (info->tree_map) : 0);
+ if (info)
+ FOR_EACH_VEC_SAFE_ELT (info->tree_map, i, map)
+ {
+ streamer_write_uhwi (ob, map->parm_num);
+ gcc_assert (EXPR_LOCATION (map->new_tree) == UNKNOWN_LOCATION);
+ stream_write_tree (ob, map->new_tree, true);
+ }
if (lto_symtab_encoder_in_partition_p (encoder, node))
{
@@ -1959,6 +1965,8 @@ input_node_opt_summary (struct cgraph_node *node,
struct bitpack_d bp;
bp = streamer_read_bitpack (ib_main);
bool have_adjustments = bp_unpack_value (&bp, 1);
+ clone_info *info = clone_info::get_create (node);
+
if (have_adjustments)
{
count = streamer_read_uhwi (ib_main);
@@ -1991,7 +1999,7 @@ input_node_opt_summary (struct cgraph_node *node,
int always_copy_start = streamer_read_hwi (ib_main);
bp = streamer_read_bitpack (ib_main);
bool skip_return = bp_unpack_value (&bp, 1);
- node->clone.param_adjustments
+ info->param_adjustments
= (new (ggc_alloc <ipa_param_adjustments> ())
ipa_param_adjustments (new_params, always_copy_start, skip_return));
}
@@ -2001,7 +2009,7 @@ input_node_opt_summary (struct cgraph_node *node,
{
struct ipa_replace_map *map = ggc_alloc<ipa_replace_map> ();
- vec_safe_push (node->clone.tree_map, map);
+ vec_safe_push (info->tree_map, map);
map->parm_num = streamer_read_uhwi (ib_main);
map->new_tree = stream_read_tree (ib_main, data_in);
}
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-streamer-out.c b/gcc/lto-streamer-out.c
index 7882c89..0ca2796 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2424,7 +2424,7 @@ output_function (struct cgraph_node *node)
/* As we do not recurse into BLOCK_SUBBLOCKS but only BLOCK_SUPERCONTEXT
collect block tree leafs and stream those. */
auto_vec<tree> block_tree_leafs;
- if (DECL_INITIAL (function))
+ if (DECL_INITIAL (function) && DECL_INITIAL (function) != error_mark_node)
collect_block_tree_leafs (DECL_INITIAL (function), block_tree_leafs);
streamer_write_uhwi (ob, block_tree_leafs.length ());
for (unsigned i = 0; i < block_tree_leafs.length (); ++i)
@@ -2788,7 +2788,8 @@ lto_output (void)
&& flag_incremental_link != INCREMENTAL_LINK_LTO)
/* Thunks have no body but they may be synthetized
at WPA time. */
- || DECL_ARGUMENTS (cnode->decl)))
+ || DECL_ARGUMENTS (cnode->decl)
+ || cnode->declare_variant_alt))
output_function (cnode);
else if ((vnode = dyn_cast <varpool_node *> (snode))
&& (DECL_INITIAL (vnode->decl) != error_mark_node
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index b465a5e..c75a8b2 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -927,6 +927,12 @@ bool reachable_from_this_partition_p (struct cgraph_node *,
lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
void select_what_to_stream (void);
+/* In omp-general.c. */
+void omp_lto_output_declare_variant_alt (lto_simple_output_block *,
+ cgraph_node *, lto_symtab_encoder_t);
+void omp_lto_input_declare_variant_alt (lto_input_block *, cgraph_node *,
+ vec<symtab_node *>);
+
/* In options-save.c. */
void cl_target_option_stream_out (struct output_block *, struct bitpack_d *,
struct cl_target_option *);
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 82cfa6b..fe10f4f 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
@@ -1558,7 +1582,11 @@ run_gcc (unsigned argc, char *argv[])
{
const char *jobserver_error = jobserver_active_p ();
if (jobserver && jobserver_error != NULL)
- warning (0, jobserver_error);
+ {
+ warning (0, jobserver_error);
+ parallel = 0;
+ jobserver = 0;
+ }
else if (!jobserver && jobserver_error == NULL)
{
parallel = 1;
@@ -1566,6 +1594,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 +1730,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 +1805,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 +1950,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 +2006,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..d336074 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,21 @@
+2020-11-06 Nathan Sidwell <nathan@acm.org>
+
+ * lto-symtab.c (lto_symtab_merge_decls_1): Rename
+ DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR lto/96680
+ * lto-common.c (lto_fixup_prevailing_decls): Don't use
+ LTO_NO_PREVAIL on TREE_LIST's TREE_PURPOSE.
+ * lto-partition.c (lto_balanced_map): Treat declare_variant_alt
+ nodes like definitions.
+
+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-common.c b/gcc/lto/lto-common.c
index 3ca0fd8..6944c46 100644
--- a/gcc/lto/lto-common.c
+++ b/gcc/lto/lto-common.c
@@ -2592,7 +2592,6 @@ lto_fixup_prevailing_decls (tree t)
case TREE_LIST:
LTO_SET_PREVAIL (TREE_VALUE (t));
LTO_SET_PREVAIL (TREE_PURPOSE (t));
- LTO_NO_PREVAIL (TREE_PURPOSE (t));
break;
default:
gcc_unreachable ();
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 8e0488a..cc721f9 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);
}
@@ -593,7 +593,8 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
last_visited_node++;
- gcc_assert (node->definition || node->weakref);
+ gcc_assert (node->definition || node->weakref
+ || node->declare_variant_alt);
/* Compute boundary cost of callgraph edges. */
for (edge = node->callees; edge; edge = edge->next_callee)
@@ -704,7 +705,7 @@ lto_balanced_map (int n_lto_partitions, int max_partition_size)
int index;
node = dyn_cast <cgraph_node *> (ref->referring);
- gcc_assert (node->definition);
+ gcc_assert (node->definition || node->declare_variant_alt);
index = lto_symtab_encoder_lookup (partition->encoder,
node);
if (index != LCC_NOT_FOUND
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index d5e38be..0058d98 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -694,8 +694,8 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
location in that case. It also happens for AVR if two built-ins
use the same asm name because their libgcc assembler code is the
same, see PR78562. */
- if (DECL_IS_BUILTIN (prevailing->decl)
- && DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (prevailing->decl)
+ && DECL_IS_UNDECLARED_BUILTIN (decl))
continue;
int level = warn_type_compatibility_p (TREE_TYPE (prevailing->decl),
diff --git a/gcc/match.pd b/gcc/match.pd
index a7032dc..349eab6 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)
@@ -2915,6 +2925,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& (wi::ltu_p (wi::to_wide (@1), element_precision (type))))
(bit_and @0 (rshift { build_minus_one_cst (type); } @1))))
+/* Optimize x >> x into 0 */
+(simplify
+ (rshift @0 @0)
+ { build_zero_cst (type); })
+
(for shiftrotate (lrotate rrotate lshift rshift)
(simplify
(shiftrotate @0 integer_zerop)
@@ -4930,18 +4945,22 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* When one argument is a constant, overflow detection can be simplified.
Currently restricted to single use so as not to interfere too much with
ADD_OVERFLOW detection in tree-ssa-math-opts.c.
- A + CST CMP A -> A CMP' CST' */
+ CONVERT?(CONVERT?(A) + CST) CMP A -> A CMP' CST' */
(for cmp (lt le ge gt)
out (gt gt le le)
(simplify
- (cmp:c (plus@2 @0 INTEGER_CST@1) @0)
- (if (TYPE_UNSIGNED (TREE_TYPE (@0))
- && TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))
+ (cmp:c (convert?@3 (plus@2 (convert?@4 @0) INTEGER_CST@1)) @0)
+ (if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@2))
+ && types_match (TREE_TYPE (@0), TREE_TYPE (@3))
+ && tree_nop_conversion_p (TREE_TYPE (@4), TREE_TYPE (@0))
&& wi::to_wide (@1) != 0
&& single_use (@2))
- (with { unsigned int prec = TYPE_PRECISION (TREE_TYPE (@0)); }
+ (with {
+ unsigned int prec = TYPE_PRECISION (TREE_TYPE (@0));
+ signop sign = TYPE_SIGN (TREE_TYPE (@0));
+ }
(out @0 { wide_int_to_tree (TREE_TYPE (@0),
- wi::max_value (prec, UNSIGNED)
+ wi::max_value (prec, sign)
- wi::to_wide (@1)); })))))
/* To detect overflow in unsigned A - B, A < B is simpler than A - B > A.
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index f69d2d7..5bc41c6 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,48 @@
+2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (objc_prop_attr_kind_for_rid): Handle class
+ attribute.
+ (objc_add_property_declaration): Likewise.
+ * objc-act.h (PROPERTY_CLASS): Record class attribute state.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (objc_prop_attr_kind_for_rid): Handle
+ RID_PROPATOMIC.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (objc_compare_types): Handle NSObject type
+ attributes.
+ (objc_type_valid_for_messaging): Likewise.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (start_class): Accept visibility attributes
+ without warning.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (objc_prop_attr_kind_for_rid): New.
+ (objc_add_property_declaration): Adjust to consume the
+ parser output using a vector of parsed attributes.
+
+2020-11-04 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (objc_non_constant_expr_p): New.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * objc-act.c (synth_module_prologue): Get the SEL identifier.
+ * objc-act.h (enum objc_tree_index): Add OCTI_SEL_NAME.
+ (objc_selector_name): New.
+ (SEL_TYPEDEF_NAME): New.
+ * objc-gnu-runtime-abi-01.c
+ (gnu_runtime_01_initialize): Initialize SEL typedef.
+ * objc-next-runtime-abi-01.c
+ (next_runtime_01_initialize): Likewise.
+ * objc-next-runtime-abi-02.c
+
2020-10-11 Iain Sandoe <iain@sandoe.co.uk>
* objc-next-runtime-abi-02.c
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 31a2cf3..b9ed32d 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -804,119 +804,76 @@ lookup_property (tree interface_type, tree property)
return inter;
}
+/* This routine returns a PROPERTY_KIND for the front end RID code supplied. */
+
+enum objc_property_attribute_kind
+objc_prop_attr_kind_for_rid (enum rid prop_rid)
+{
+ switch (prop_rid)
+ {
+ default: return OBJC_PROPERTY_ATTR_UNKNOWN;
+ case RID_GETTER: return OBJC_PROPERTY_ATTR_GETTER;
+ case RID_SETTER: return OBJC_PROPERTY_ATTR_SETTER;
+
+ case RID_READONLY: return OBJC_PROPERTY_ATTR_READONLY;
+ case RID_READWRITE: return OBJC_PROPERTY_ATTR_READWRITE;
+
+ case RID_ASSIGN: return OBJC_PROPERTY_ATTR_ASSIGN;
+ case RID_RETAIN: return OBJC_PROPERTY_ATTR_RETAIN;
+ case RID_COPY: return OBJC_PROPERTY_ATTR_COPY;
+
+ case RID_PROPATOMIC: return OBJC_PROPERTY_ATTR_ATOMIC;
+ case RID_NONATOMIC: return OBJC_PROPERTY_ATTR_NONATOMIC;
+
+ case RID_CLASS: return OBJC_PROPERTY_ATTR_CLASS;
+ }
+}
+
/* This routine is called by the parser when a
@property... declaration is found. 'decl' is the declaration of
the property (type/identifier), and the other arguments represent
property attributes that may have been specified in the Objective-C
declaration. 'parsed_property_readonly' is 'true' if the attribute
'readonly' was specified, and 'false' if not; similarly for the
- other bool parameters. 'parsed_property_getter_ident' is NULL_TREE
+ other bool parameters. 'property_getter_ident' is NULL_TREE
if the attribute 'getter' was not specified, and is the identifier
corresponding to the specified getter if it was; similarly for
- 'parsed_property_setter_ident'. */
+ 'property_setter_ident'. */
void
objc_add_property_declaration (location_t location, tree decl,
- bool parsed_property_readonly, bool parsed_property_readwrite,
- bool parsed_property_assign, bool parsed_property_retain,
- bool parsed_property_copy, bool parsed_property_nonatomic,
- tree parsed_property_getter_ident, tree parsed_property_setter_ident)
+ vec<property_attribute_info *>& prop_attr_list)
{
- tree property_decl;
- tree x;
- /* 'property_readonly' and 'property_assign_semantics' are the final
- attributes of the property after all parsed attributes have been
- considered (eg, if we parsed no 'readonly' and no 'readwrite', ie
- parsed_property_readonly = false and parsed_property_readwrite =
- false, then property_readonly will be false because the default
- is readwrite). */
- bool property_readonly = false;
- objc_property_assign_semantics property_assign_semantics = OBJC_PROPERTY_ASSIGN;
- bool property_extension_in_class_extension = false;
-
if (flag_objc1_only)
- error_at (input_location, "%<@property%> is not available in Objective-C 1.0");
-
- if (parsed_property_readonly && parsed_property_readwrite)
- {
- error_at (location, "%<readonly%> attribute conflicts with %<readwrite%> attribute");
- /* In case of conflicting attributes (here and below), after
- producing an error, we pick one of the attributes and keep
- going. */
- property_readonly = false;
- }
- else
- {
- if (parsed_property_readonly)
- property_readonly = true;
-
- if (parsed_property_readwrite)
- property_readonly = false;
- }
-
- if (parsed_property_readonly && parsed_property_setter_ident)
- {
- error_at (location, "%<readonly%> attribute conflicts with %<setter%> attribute");
- property_readonly = false;
- }
-
- if (parsed_property_assign && parsed_property_retain)
- {
- error_at (location, "%<assign%> attribute conflicts with %<retain%> attribute");
- property_assign_semantics = OBJC_PROPERTY_RETAIN;
- }
- else if (parsed_property_assign && parsed_property_copy)
- {
- error_at (location, "%<assign%> attribute conflicts with %<copy%> attribute");
- property_assign_semantics = OBJC_PROPERTY_COPY;
- }
- else if (parsed_property_retain && parsed_property_copy)
- {
- error_at (location, "%<retain%> attribute conflicts with %<copy%> attribute");
- property_assign_semantics = OBJC_PROPERTY_COPY;
- }
- else
- {
- if (parsed_property_assign)
- property_assign_semantics = OBJC_PROPERTY_ASSIGN;
-
- if (parsed_property_retain)
- property_assign_semantics = OBJC_PROPERTY_RETAIN;
-
- if (parsed_property_copy)
- property_assign_semantics = OBJC_PROPERTY_COPY;
- }
+ /* FIXME: we probably ought to bail out at this point. */
+ error_at (location, "%<@property%> is not available in Objective-C 1.0");
+ /* We must be in an interface, category, or protocol. */
if (!objc_interface_context)
{
- error_at (location, "property declaration not in @interface or @protocol context");
+ error_at (location, "property declaration not in %<@interface%>,"
+ " %<@protocol%> or %<category%> context");
return;
}
- /* At this point we know that we are either in an interface, a
- category, or a protocol. */
+ /* Do some spot-checks for the most obvious invalid cases. */
- /* We expect a FIELD_DECL from the parser. Make sure we didn't get
- something else, as that would confuse the checks below. */
- if (TREE_CODE (decl) != FIELD_DECL)
+ gcc_checking_assert (decl && TREE_CODE (decl) == FIELD_DECL);
+
+ if (decl && !DECL_NAME (decl))
{
- error_at (location, "invalid property declaration");
+ error_at (location, "properties must be named");
return;
}
- /* Do some spot-checks for the most obvious invalid types. */
-
+ location_t decl_loc = DECL_SOURCE_LOCATION (decl);
+ decl_loc = make_location (decl_loc, location, decl_loc);
if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
{
- error_at (location, "property cannot be an array");
+ error_at (decl_loc, "property cannot be an array");
return;
}
- /* The C++/ObjC++ parser seems to reject the ':' for a bitfield when
- parsing, while the C/ObjC parser accepts it and gives us a
- FIELD_DECL with a DECL_INITIAL set. So we use the DECL_INITIAL
- to check for a bitfield when doing ObjC. */
-#ifndef OBJCPLUS
- if (DECL_INITIAL (decl))
+ if (DECL_C_BIT_FIELD (decl))
{
/* A @property is not an actual variable, but it is a way to
describe a pair of accessor methods, so its type (which is
@@ -925,10 +882,118 @@ objc_add_property_declaration (location_t location, tree decl,
and arguments of functions cannot be bitfields). The
underlying instance variable could be a bitfield, but that is
a different matter. */
- error_at (location, "property cannot be a bit-field");
+ error_at (decl_loc, "property cannot be a bit-field");
return;
}
-#endif
+
+ /* The final results of parsing the (growing number) of property
+ attributes. */
+ property_attribute_info *attrs[OBJC_PROPATTR_GROUP_MAX] = { nullptr };
+
+ tree property_getter_ident = NULL_TREE;
+ tree property_setter_ident = NULL_TREE;
+ for (unsigned pn = 0; pn < prop_attr_list.length (); ++pn)
+ {
+ if (prop_attr_list[pn]->parse_error)
+ continue; /* Ignore attributes known to be wrongly parsed. */
+
+ switch (int g = (int) prop_attr_list[pn]->group())
+ {
+ case OBJC_PROPATTR_GROUP_UNKNOWN:
+ continue;
+ case OBJC_PROPATTR_GROUP_SETTER:
+ case OBJC_PROPATTR_GROUP_GETTER:
+ if (attrs[g])
+ {
+ warning_at (prop_attr_list[pn]->prop_loc, OPT_Wattributes,
+ "multiple property %qE methods specified, the latest"
+ " one will be used", attrs[g]->name);
+ inform (attrs[g]->prop_loc, "previous specification");
+ }
+ attrs[g] = prop_attr_list[pn];
+ if (g == OBJC_PROPATTR_GROUP_SETTER)
+ property_setter_ident = attrs[g]->ident;
+ else
+ property_getter_ident = attrs[g]->ident;
+ continue;
+ default:
+ {
+ if (!attrs[g])
+ ;
+ else if (attrs[g]->prop_kind != prop_attr_list[pn]->prop_kind)
+ {
+ error_at (prop_attr_list[pn]->prop_loc,
+ "%qE attribute conflicts with %qE attribute",
+ prop_attr_list[pn]->name, attrs[g]->name);
+ inform (attrs[g]->prop_loc, "%qE specified here",
+ attrs[g]->name );
+ }
+ else
+ {
+ warning_at (prop_attr_list[pn]->prop_loc, OPT_Wattributes,
+ "duplicate %qE attribute", attrs[g]->name);
+ inform (attrs[g]->prop_loc, "first specified here");
+ }
+ attrs[g] = prop_attr_list[pn];
+ }
+ continue;
+ }
+ }
+
+ /* The defaults for atomicity (atomic) and write-ability (readwrite) apply
+ even if the user provides no specified attributes. */
+ bool property_nonatomic = false;
+ bool property_readonly = false;
+
+ /* Set the values from any specified by the user; these are easy, only two
+ states. */
+ if (attrs[OBJC_PROPATTR_GROUP_ATOMIC])
+ property_nonatomic = attrs[OBJC_PROPATTR_GROUP_ATOMIC]->prop_kind
+ == OBJC_PROPERTY_ATTR_NONATOMIC;
+
+ if (attrs[OBJC_PROPATTR_GROUP_READWRITE])
+ property_readonly = attrs[OBJC_PROPATTR_GROUP_READWRITE]->prop_kind
+ == OBJC_PROPERTY_ATTR_READONLY;
+
+ /* One can't set a readonly value; we issue an error, but force the property
+ to readwrite as well. */
+ if (property_readonly && property_setter_ident)
+ {
+ error_at (attrs[OBJC_PROPATTR_GROUP_READWRITE]->prop_loc, "%<readonly%>"
+ " attribute conflicts with %<setter%> attribute");
+ gcc_checking_assert (attrs[OBJC_PROPATTR_GROUP_SETTER]);
+ inform (attrs[OBJC_PROPATTR_GROUP_SETTER]->prop_loc, "%<setter%>"
+ " specified here");
+ property_readonly = false;
+ }
+
+ /* Assign semantics is a tri-state property, and also needs some further
+ checking against the object type. */
+ objc_property_assign_semantics property_assign_semantics
+ = OBJC_PROPERTY_ASSIGN;
+
+ if (attrs[OBJC_PROPATTR_GROUP_ASSIGN])
+ {
+ if (attrs[OBJC_PROPATTR_GROUP_ASSIGN]->prop_kind
+ == OBJC_PROPERTY_ATTR_ASSIGN)
+ property_assign_semantics = OBJC_PROPERTY_ASSIGN;
+ else if (attrs[OBJC_PROPATTR_GROUP_ASSIGN]->prop_kind
+ == OBJC_PROPERTY_ATTR_RETAIN)
+ property_assign_semantics = OBJC_PROPERTY_RETAIN;
+ else if (attrs[OBJC_PROPATTR_GROUP_ASSIGN]->prop_kind
+ == OBJC_PROPERTY_ATTR_COPY)
+ property_assign_semantics = OBJC_PROPERTY_COPY;
+ else
+ gcc_unreachable ();
+ }
+
+ /* An attribute that indicates this property manipulates a class variable.
+ In this case, both the variable and the getter/setter must be provided
+ by the user. */
+ bool property_class = false;
+ if (attrs[OBJC_PROPATTR_GROUP_CLASS])
+ property_nonatomic = attrs[OBJC_PROPATTR_GROUP_CLASS]->prop_kind
+ == OBJC_PROPERTY_ATTR_CLASS;
/* TODO: Check that the property type is an Objective-C object or a
"POD". */
@@ -950,69 +1015,77 @@ objc_add_property_declaration (location_t location, tree decl,
for non-{Objective-C objects}, and to 'retain' for
Objective-C objects. But that would break compatibility with
other compilers. */
- if (!parsed_property_assign && !parsed_property_retain && !parsed_property_copy)
+ if (!attrs[OBJC_PROPATTR_GROUP_ASSIGN])
{
/* Use 'false' so we do not warn for Class objects. */
if (objc_type_valid_for_messaging (TREE_TYPE (decl), false))
{
- warning_at (location,
- 0,
- "object property %qD has no %<assign%>, %<retain%> or %<copy%> attribute; assuming %<assign%>",
- decl);
- inform (location,
- "%<assign%> can be unsafe for Objective-C objects; please state explicitly if you need it");
+ warning_at (decl_loc, 0, "object property %qD has no %<assign%>,"
+ " %<retain%> or %<copy%> attribute; assuming"
+ " %<assign%>", decl);
+ inform (decl_loc, "%<assign%> can be unsafe for Objective-C"
+ " objects; please state explicitly if you need it");
}
}
}
- if (property_assign_semantics == OBJC_PROPERTY_RETAIN
- && !objc_type_valid_for_messaging (TREE_TYPE (decl), true))
- error_at (location, "%<retain%> attribute is only valid for Objective-C objects");
+ /* Some attributes make no sense unless applied to an Objective-C object. */
+ bool prop_objc_object_p
+ = objc_type_valid_for_messaging (TREE_TYPE (decl), true);
+ if (!prop_objc_object_p)
+ {
+ tree p_name = NULL_TREE;
+ if (property_assign_semantics == OBJC_PROPERTY_RETAIN
+ || property_assign_semantics == OBJC_PROPERTY_COPY)
+ p_name = attrs[OBJC_PROPATTR_GROUP_ASSIGN]->name;
- if (property_assign_semantics == OBJC_PROPERTY_COPY
- && !objc_type_valid_for_messaging (TREE_TYPE (decl), true))
- error_at (location, "%<copy%> attribute is only valid for Objective-C objects");
+ if (p_name)
+ error_at (decl_loc, "%qE attribute is only valid for Objective-C"
+ " objects", p_name);
+ }
/* Now determine the final property getter and setter names. They
will be stored in the PROPERTY_DECL, from which they'll always be
extracted and used. */
/* Adjust, or fill in, setter and getter names. We overwrite the
- parsed_property_setter_ident and parsed_property_getter_ident
+ property_setter_ident and property_getter_ident
with the final setter and getter identifiers that will be
used. */
- if (parsed_property_setter_ident)
+ if (property_setter_ident)
{
/* The setter should be terminated by ':', but the parser only
gives us an identifier without ':'. So, we need to add ':'
at the end. */
- const char *parsed_setter = IDENTIFIER_POINTER (parsed_property_setter_ident);
+ const char *parsed_setter = IDENTIFIER_POINTER (property_setter_ident);
size_t length = strlen (parsed_setter);
char *final_setter = (char *)alloca (length + 2);
sprintf (final_setter, "%s:", parsed_setter);
- parsed_property_setter_ident = get_identifier (final_setter);
+ property_setter_ident = get_identifier (final_setter);
}
else
{
if (!property_readonly)
- parsed_property_setter_ident = get_identifier (objc_build_property_setter_name
+ property_setter_ident = get_identifier (objc_build_property_setter_name
(DECL_NAME (decl)));
}
- if (!parsed_property_getter_ident)
- parsed_property_getter_ident = DECL_NAME (decl);
+ if (!property_getter_ident)
+ property_getter_ident = DECL_NAME (decl);
/* Check for duplicate property declarations. We first check the
immediate context for a property with the same name. Any such
declarations are an error, unless this is a class extension and
we are extending a property from readonly to readwrite. */
+ bool property_extension_in_class_extension = false;
+ tree x = NULL_TREE;
for (x = CLASS_PROPERTY_DECL (objc_interface_context); x; x = TREE_CHAIN (x))
{
if (PROPERTY_NAME (x) == DECL_NAME (decl))
{
if (objc_in_class_extension
- && property_readonly == 0
+ && !property_readonly
&& PROPERTY_READONLY (x) == 1)
{
/* This is a class extension, and we are extending an
@@ -1087,7 +1160,7 @@ objc_add_property_declaration (location_t location, tree decl,
types, or it is compatible. */
location_t original_location = DECL_SOURCE_LOCATION (x);
- if (PROPERTY_NONATOMIC (x) != parsed_property_nonatomic)
+ if (PROPERTY_NONATOMIC (x) != property_nonatomic)
{
warning_at (location, 0,
"%<nonatomic%> attribute of property %qD conflicts with "
@@ -1098,7 +1171,7 @@ objc_add_property_declaration (location_t location, tree decl,
return;
}
- if (PROPERTY_GETTER_NAME (x) != parsed_property_getter_ident)
+ if (PROPERTY_GETTER_NAME (x) != property_getter_ident)
{
warning_at (location, 0,
"%<getter%> attribute of property %qD conflicts with "
@@ -1112,7 +1185,7 @@ objc_add_property_declaration (location_t location, tree decl,
/* We can only compare the setter names if both the old and new property have a setter. */
if (!property_readonly && !PROPERTY_READONLY(x))
{
- if (PROPERTY_SETTER_NAME (x) != parsed_property_setter_ident)
+ if (PROPERTY_SETTER_NAME (x) != property_setter_ident)
{
warning_at (location, 0,
"%<setter%> attribute of property %qD conflicts with "
@@ -1190,13 +1263,13 @@ objc_add_property_declaration (location_t location, tree decl,
if (property_extension_in_class_extension)
{
PROPERTY_READONLY (x) = 0;
- PROPERTY_SETTER_NAME (x) = parsed_property_setter_ident;
+ PROPERTY_SETTER_NAME (x) = property_setter_ident;
return;
}
}
/* Create a PROPERTY_DECL node. */
- property_decl = make_node (PROPERTY_DECL);
+ tree property_decl = make_node (PROPERTY_DECL);
/* Copy the basic information from the original decl. */
TREE_TYPE (property_decl) = TREE_TYPE (decl);
@@ -1205,10 +1278,11 @@ objc_add_property_declaration (location_t location, tree decl,
/* Add property-specific information. */
PROPERTY_NAME (property_decl) = DECL_NAME (decl);
- PROPERTY_GETTER_NAME (property_decl) = parsed_property_getter_ident;
- PROPERTY_SETTER_NAME (property_decl) = parsed_property_setter_ident;
+ PROPERTY_GETTER_NAME (property_decl) = property_getter_ident;
+ PROPERTY_SETTER_NAME (property_decl) = property_setter_ident;
PROPERTY_READONLY (property_decl) = property_readonly;
- PROPERTY_NONATOMIC (property_decl) = parsed_property_nonatomic;
+ PROPERTY_NONATOMIC (property_decl) = property_nonatomic;
+ PROPERTY_CLASS (property_decl) = property_class;
PROPERTY_ASSIGN_SEMANTICS (property_decl) = property_assign_semantics;
PROPERTY_IVAR_NAME (property_decl) = NULL_TREE;
PROPERTY_DYNAMIC (property_decl) = 0;
@@ -1720,7 +1794,6 @@ objc_build_class_component_ref (tree class_name, tree property_ident)
}
-
/* This is used because we don't want to expose PROPERTY_REF to the
C/C++ frontends. Maybe we should! */
bool
@@ -1732,6 +1805,21 @@ objc_is_property_ref (tree node)
return false;
}
+/* We use this to report tree codes that are known to be invalid in const-
+ expression contexts. */
+bool
+objc_non_constant_expr_p (tree node)
+{
+ switch (TREE_CODE (node))
+ {
+ default:
+ return false;
+ case MESSAGE_SEND_EXPR:
+ case PROPERTY_REF:
+ return true;
+ }
+}
+
/* This function builds a setter call for a PROPERTY_REF (real, for a
declared property, or artificial, for a dot-syntax accessor which
is not corresponding to a property). 'lhs' must be a PROPERTY_REF
@@ -2399,9 +2487,14 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee)
if (!POINTER_TYPE_P (ltyp) || !POINTER_TYPE_P (rtyp))
return false;
+ tree ltyp_attr, rtyp_attr;
do
{
- ltyp = TREE_TYPE (ltyp); /* Remove indirections. */
+ /* Remove indirections, but keep the type attributes from the innermost
+ pointer type, to check for NSObject. */
+ ltyp_attr = TYPE_ATTRIBUTES (ltyp);
+ ltyp = TREE_TYPE (ltyp);
+ rtyp_attr = TYPE_ATTRIBUTES (rtyp);
rtyp = TREE_TYPE (rtyp);
}
while (POINTER_TYPE_P (ltyp) && POINTER_TYPE_P (rtyp));
@@ -2446,17 +2539,23 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee)
return true;
}
+ /* We might have void * with NSObject type attr. */
+ bool l_NSObject_p = ltyp_attr && lookup_attribute ("NSObject", ltyp_attr);
+ bool r_NSObject_p = rtyp_attr && lookup_attribute ("NSObject", rtyp_attr);
+
/* Past this point, we are only interested in ObjC class instances,
- or 'id' or 'Class'. */
- if (TREE_CODE (ltyp) != RECORD_TYPE || TREE_CODE (rtyp) != RECORD_TYPE)
+ or 'id' or 'Class' (except if the user applied the NSObject type
+ attribute). */
+ if ((TREE_CODE (ltyp) != RECORD_TYPE && !l_NSObject_p)
+ || (TREE_CODE (rtyp) != RECORD_TYPE && !r_NSObject_p))
return false;
if (!objc_is_object_id (ltyp) && !objc_is_class_id (ltyp)
- && !TYPE_HAS_OBJC_INFO (ltyp))
+ && !TYPE_HAS_OBJC_INFO (ltyp) && !l_NSObject_p)
return false;
if (!objc_is_object_id (rtyp) && !objc_is_class_id (rtyp)
- && !TYPE_HAS_OBJC_INFO (rtyp))
+ && !TYPE_HAS_OBJC_INFO (rtyp) && !r_NSObject_p)
return false;
/* Past this point, we are committed to returning 'true' to the caller
@@ -2490,12 +2589,15 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee)
rcls = NULL_TREE;
/* If either type is an unqualified 'id', we're done. This is because
- an 'id' can be assigned to or from any type with no warnings. */
+ an 'id' can be assigned to or from any type with no warnings. When
+ the pointer has NSObject attribute, consider that to be equivalent. */
if (argno != -5)
{
if ((!lproto && objc_is_object_id (ltyp))
|| (!rproto && objc_is_object_id (rtyp)))
return true;
+ if (l_NSObject_p || r_NSObject_p)
+ return true;
}
else
{
@@ -2503,7 +2605,7 @@ objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee)
general type of object, hence if you try to specialize an
'NSArray *' (ltyp) property with an 'id' (rtyp) one, we need
to warn. */
- if (!lproto && objc_is_object_id (ltyp))
+ if (!lproto && (objc_is_object_id (ltyp) || l_NSObject_p))
return true;
}
@@ -2954,6 +3056,7 @@ synth_module_prologue (void)
objc_object_name = get_identifier (OBJECT_TYPEDEF_NAME);
objc_instancetype_name = get_identifier (INSTANCE_TYPEDEF_NAME);
objc_class_name = get_identifier (CLASS_TYPEDEF_NAME);
+ objc_selector_name = get_identifier (SEL_TYPEDEF_NAME);
/* Declare the 'id', 'instancetype' and 'Class' typedefs. */
type = lang_hooks.decls.pushdecl (build_decl (input_location,
@@ -6935,12 +7038,14 @@ start_class (enum tree_code code, tree class_name, tree super_name,
tree name = TREE_PURPOSE (attribute);
/* TODO: Document what the objc_exception attribute is/does. */
- /* We handle the 'deprecated' and (undocumented) 'objc_exception'
- attributes. */
+ /* We handle the 'deprecated', 'visibility' and (undocumented)
+ 'objc_exception' attributes. */
if (is_attribute_p ("deprecated", name))
TREE_DEPRECATED (klass) = 1;
else if (is_attribute_p ("objc_exception", name))
CLASS_HAS_EXCEPTION_ATTR (klass) = 1;
+ else if (is_attribute_p ("visibility", name))
+ ;
else
/* Warn about and ignore all others for now, but store them. */
warning (OPT_Wattributes, "%qE attribute directive ignored", name);
@@ -8579,11 +8684,19 @@ objc_type_valid_for_messaging (tree type, bool accept_classes)
if (!POINTER_TYPE_P (type))
return false;
+ /* We will check for an NSObject type attribute on the pointer if other
+ tests fail. */
+ tree type_attr = TYPE_ATTRIBUTES (type);
+
/* Remove the pointer indirection; don't remove more than one
otherwise we'd consider "NSObject **" a valid type for messaging,
which it isn't. */
type = TREE_TYPE (type);
+ /* We allow void * to have an NSObject type attr. */
+ if (VOID_TYPE_P (type) && type_attr)
+ return lookup_attribute ("NSObject", type_attr) != NULL_TREE;
+
if (TREE_CODE (type) != RECORD_TYPE)
return false;
@@ -8596,6 +8709,9 @@ objc_type_valid_for_messaging (tree type, bool accept_classes)
if (TYPE_HAS_OBJC_INFO (type))
return true;
+ if (type_attr)
+ return lookup_attribute ("NSObject", type_attr) != NULL_TREE;
+
return false;
}
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index 913e152..5b0433f 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -137,6 +137,10 @@ enum objc_property_assign_semantics {
#define PROPERTY_OPTIONAL(DECL) \
DECL_LANG_FLAG_5 (PROPERTY_DECL_CHECK (DECL))
+/* PROPERTY_CLASS can be 0 or 1. */
+#define PROPERTY_CLASS(DECL) \
+ DECL_LANG_FLAG_6 (PROPERTY_DECL_CHECK (DECL))
+
/* PROPERTY_REF. A PROPERTY_REF represents an 'object.property'
expression. It is normally used for property access, but when
the Objective-C 2.0 "dot-syntax" (object.component) is used
@@ -371,6 +375,7 @@ enum objc_tree_index
OCTI_ID_NAME,
OCTI_INSTANCETYPE_NAME,
OCTI_CLASS_NAME,
+ OCTI_SEL_NAME,
OCTI_CNST_STR_ID,
OCTI_CNST_STR_TYPE,
OCTI_CNST_STR_GLOB_ID,
@@ -576,6 +581,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX];
#define objc_object_name objc_global_trees[OCTI_ID_NAME]
#define objc_instancetype_name objc_global_trees[OCTI_INSTANCETYPE_NAME]
#define objc_class_name objc_global_trees[OCTI_CLASS_NAME]
+#define objc_selector_name objc_global_trees[OCTI_SEL_NAME]
/* Constant string classes. */
#define constant_string_id objc_global_trees[OCTI_CNST_STR_ID]
@@ -614,6 +620,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX];
#define OBJECT_TYPEDEF_NAME "id"
#define INSTANCE_TYPEDEF_NAME "instancetype"
#define CLASS_TYPEDEF_NAME "Class"
+#define SEL_TYPEDEF_NAME "SEL"
#define TAG_OBJECT "objc_object"
#define TAG_CLASS "objc_class"
diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c
index 25c0e01..ac9a862 100644
--- a/gcc/objc/objc-gnu-runtime-abi-01.c
+++ b/gcc/objc/objc-gnu-runtime-abi-01.c
@@ -208,6 +208,13 @@ static void gnu_runtime_01_initialize (void)
type = build_qualified_type (type, TYPE_QUAL_CONST);
objc_selector_type = build_pointer_type (type);
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
/* typedef id (*IMP)(id, SEL, ...); */
ftype = build_varargs_function_type_list (objc_object_type,
objc_object_type,
diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c
index 233d89e..7fc449b 100644
--- a/gcc/objc/objc-next-runtime-abi-01.c
+++ b/gcc/objc/objc-next-runtime-abi-01.c
@@ -277,6 +277,13 @@ static void next_runtime_01_initialize (void)
objc_selector_type = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR)));
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
build_v1_class_template ();
build_super_template ();
build_v1_protocol_template ();
diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index d7812ff..f3c285a 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -374,6 +374,13 @@ static void next_runtime_02_initialize (void)
objc_selector_type = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR)));
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
/* IMP : id (*) (id, _message_ref_t*, ...)
SUPER_IMP : id (*) ( super_t*, _super_message_ref_t*, ...)
objc_v2_selector_type. */
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 0d30089..6583c88 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -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;
}
@@ -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),
@@ -7041,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
diff --git a/gcc/omp-general.c b/gcc/omp-general.c
index b70e3e3..b66dfb5 100644
--- a/gcc/omp-general.c
+++ b/gcc/omp-general.c
@@ -42,6 +42,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "omp-device-properties.h"
#include "tree-iterator.h"
+#include "data-streamer.h"
+#include "streamer-hooks.h"
enum omp_requires omp_requires_mask;
@@ -2337,6 +2339,125 @@ omp_resolve_declare_variant (tree base)
? TREE_PURPOSE (TREE_VALUE (variant1)) : base);
}
+void
+omp_lto_output_declare_variant_alt (lto_simple_output_block *ob,
+ cgraph_node *node,
+ lto_symtab_encoder_t encoder)
+{
+ gcc_assert (node->declare_variant_alt);
+
+ omp_declare_variant_base_entry entry;
+ entry.base = NULL;
+ entry.node = node;
+ entry.variants = NULL;
+ omp_declare_variant_base_entry *entryp
+ = omp_declare_variant_alt->find_with_hash (&entry, DECL_UID (node->decl));
+ gcc_assert (entryp);
+
+ int nbase = lto_symtab_encoder_lookup (encoder, entryp->base);
+ gcc_assert (nbase != LCC_NOT_FOUND);
+ streamer_write_hwi_stream (ob->main_stream, nbase);
+
+ streamer_write_hwi_stream (ob->main_stream, entryp->variants->length ());
+
+ unsigned int i;
+ omp_declare_variant_entry *varentry;
+ FOR_EACH_VEC_SAFE_ELT (entryp->variants, i, varentry)
+ {
+ int nvar = lto_symtab_encoder_lookup (encoder, varentry->variant);
+ gcc_assert (nvar != LCC_NOT_FOUND);
+ streamer_write_hwi_stream (ob->main_stream, nvar);
+
+ for (widest_int *w = &varentry->score; ;
+ w = &varentry->score_in_declare_simd_clone)
+ {
+ unsigned len = w->get_len ();
+ streamer_write_hwi_stream (ob->main_stream, len);
+ const HOST_WIDE_INT *val = w->get_val ();
+ for (unsigned j = 0; j < len; j++)
+ streamer_write_hwi_stream (ob->main_stream, val[j]);
+ if (w == &varentry->score_in_declare_simd_clone)
+ break;
+ }
+
+ HOST_WIDE_INT cnt = -1;
+ HOST_WIDE_INT i = varentry->matches ? 1 : 0;
+ for (tree attr = DECL_ATTRIBUTES (entryp->base->decl);
+ attr; attr = TREE_CHAIN (attr), i += 2)
+ {
+ attr = lookup_attribute ("omp declare variant base", attr);
+ if (attr == NULL_TREE)
+ break;
+
+ if (varentry->ctx == TREE_VALUE (TREE_VALUE (attr)))
+ {
+ cnt = i;
+ break;
+ }
+ }
+
+ gcc_assert (cnt != -1);
+ streamer_write_hwi_stream (ob->main_stream, cnt);
+ }
+}
+
+void
+omp_lto_input_declare_variant_alt (lto_input_block *ib, cgraph_node *node,
+ vec<symtab_node *> nodes)
+{
+ gcc_assert (node->declare_variant_alt);
+ omp_declare_variant_base_entry *entryp
+ = ggc_cleared_alloc<omp_declare_variant_base_entry> ();
+ entryp->base = dyn_cast<cgraph_node *> (nodes[streamer_read_hwi (ib)]);
+ entryp->node = node;
+ unsigned int len = streamer_read_hwi (ib);
+ vec_alloc (entryp->variants, len);
+
+ for (unsigned int i = 0; i < len; i++)
+ {
+ omp_declare_variant_entry varentry;
+ varentry.variant
+ = dyn_cast<cgraph_node *> (nodes[streamer_read_hwi (ib)]);
+ for (widest_int *w = &varentry.score; ;
+ w = &varentry.score_in_declare_simd_clone)
+ {
+ unsigned len2 = streamer_read_hwi (ib);
+ HOST_WIDE_INT arr[WIDE_INT_MAX_ELTS];
+ gcc_assert (len2 <= WIDE_INT_MAX_ELTS);
+ for (unsigned int j = 0; j < len2; j++)
+ arr[j] = streamer_read_hwi (ib);
+ *w = widest_int::from_array (arr, len2, true);
+ if (w == &varentry.score_in_declare_simd_clone)
+ break;
+ }
+
+ HOST_WIDE_INT cnt = streamer_read_hwi (ib);
+ HOST_WIDE_INT j = 0;
+ varentry.ctx = NULL_TREE;
+ varentry.matches = (cnt & 1) ? true : false;
+ cnt &= ~HOST_WIDE_INT_1;
+ for (tree attr = DECL_ATTRIBUTES (entryp->base->decl);
+ attr; attr = TREE_CHAIN (attr), j += 2)
+ {
+ attr = lookup_attribute ("omp declare variant base", attr);
+ if (attr == NULL_TREE)
+ break;
+
+ if (cnt == j)
+ {
+ varentry.ctx = TREE_VALUE (TREE_VALUE (attr));
+ break;
+ }
+ }
+ gcc_assert (varentry.ctx != NULL_TREE);
+ entryp->variants->quick_push (varentry);
+ }
+ if (omp_declare_variant_alt == NULL)
+ omp_declare_variant_alt
+ = hash_table<omp_declare_variant_alt_hasher>::create_ggc (64);
+ *omp_declare_variant_alt->find_slot_with_hash (entryp, DECL_UID (node->decl),
+ INSERT) = entryp;
+}
/* Encode an oacc launch argument. This matches the GOMP_LAUNCH_PACK
macro on gomp-constants.h. We do not check for overflow. */
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index b3e2468..447d7db 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -214,6 +214,21 @@ is_oacc_kernels (omp_context *ctx)
== GF_OMP_TARGET_KIND_OACC_KERNELS));
}
+/* Return true if STMT corresponds to an OpenMP target region. */
+static bool
+is_omp_target (gimple *stmt)
+{
+ if (gimple_code (stmt) == GIMPLE_OMP_TARGET)
+ {
+ int kind = gimple_omp_target_kind (stmt);
+ return (kind == GF_OMP_TARGET_KIND_REGION
+ || kind == GF_OMP_TARGET_KIND_DATA
+ || kind == GF_OMP_TARGET_KIND_ENTER_DATA
+ || kind == GF_OMP_TARGET_KIND_EXIT_DATA);
+ }
+ return false;
+}
+
/* If DECL is the artificial dummy VAR_DECL created for non-static
data member privatization, return the underlying "this" parameter,
otherwise return NULL. */
@@ -1346,7 +1361,9 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
&& DECL_P (decl)
&& ((OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FIRSTPRIVATE_POINTER
&& (OMP_CLAUSE_MAP_KIND (c)
- != GOMP_MAP_FIRSTPRIVATE_REFERENCE))
+ != GOMP_MAP_FIRSTPRIVATE_REFERENCE)
+ && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH
+ && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_DETACH)
|| TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_TO
&& OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_FROM
@@ -1368,6 +1385,40 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
break;
}
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+ && DECL_P (decl)
+ && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_DETACH)
+ && is_omp_target (ctx->stmt))
+ {
+ /* If this is an offloaded region, an attach operation should
+ only exist when the pointer variable is mapped in a prior
+ clause. */
+ if (is_gimple_omp_offloaded (ctx->stmt))
+ gcc_assert
+ (maybe_lookup_decl (decl, ctx)
+ || (is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))
+ && lookup_attribute ("omp declare target",
+ DECL_ATTRIBUTES (decl))));
+
+ /* By itself, attach/detach is generated as part of pointer
+ variable mapping and should not create new variables in the
+ offloaded region, however sender refs for it must be created
+ for its address to be passed to the runtime. */
+ tree field
+ = build_decl (OMP_CLAUSE_LOCATION (c),
+ FIELD_DECL, NULL_TREE, ptr_type_node);
+ SET_DECL_ALIGN (field, TYPE_ALIGN (ptr_type_node));
+ insert_field_into_struct (ctx->record_type, field);
+ /* To not clash with a map of the pointer variable itself,
+ attach/detach maps have their field looked up by the *clause*
+ tree expression, not the decl. */
+ gcc_assert (!splay_tree_lookup (ctx->field_map,
+ (splay_tree_key) c));
+ splay_tree_insert (ctx->field_map, (splay_tree_key) c,
+ (splay_tree_value) field);
+ break;
+ }
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
|| (OMP_CLAUSE_MAP_KIND (c)
== GOMP_MAP_FIRSTPRIVATE_REFERENCE)))
@@ -1486,6 +1537,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
case OMP_CLAUSE_IF_PRESENT:
case OMP_CLAUSE_FINALIZE:
case OMP_CLAUSE_TASK_REDUCTION:
+ case OMP_CLAUSE_ALLOCATE:
break;
case OMP_CLAUSE_ALIGNED:
@@ -1606,6 +1658,11 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
&& is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx))
&& varpool_node::get_create (decl)->offloadable)
break;
+ if ((OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_DETACH)
+ && is_omp_target (ctx->stmt)
+ && !is_gimple_omp_offloaded (ctx->stmt))
+ break;
if (DECL_P (decl))
{
if ((OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
@@ -1653,6 +1710,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
case OMP_CLAUSE_SIMDLEN:
case OMP_CLAUSE_ALIGNED:
case OMP_CLAUSE_DEPEND:
+ case OMP_CLAUSE_ALLOCATE:
case OMP_CLAUSE__LOOPTEMP_:
case OMP_CLAUSE__REDUCTEMP_:
case OMP_CLAUSE_TO:
@@ -1919,12 +1977,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++)
{
@@ -2390,50 +2474,43 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx)
if (!tgt || is_oacc_parallel_or_serial (tgt))
for (tree c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
{
- char const *check = NULL;
-
+ tree c_op0;
switch (OMP_CLAUSE_CODE (c))
{
case OMP_CLAUSE_GANG:
- check = "gang";
+ c_op0 = OMP_CLAUSE_GANG_EXPR (c);
break;
case OMP_CLAUSE_WORKER:
- check = "worker";
+ c_op0 = OMP_CLAUSE_WORKER_EXPR (c);
break;
case OMP_CLAUSE_VECTOR:
- check = "vector";
+ c_op0 = OMP_CLAUSE_VECTOR_EXPR (c);
break;
default:
- break;
+ continue;
}
- if (check && OMP_CLAUSE_OPERAND (c, 0))
- error_at (gimple_location (stmt),
- "argument not permitted on %qs clause in"
- " OpenACC %<parallel%> or %<serial%>", check);
+ if (c_op0)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "argument not permitted on %qs clause",
+ omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+ if (tgt)
+ inform (gimple_location (tgt->stmt),
+ "enclosing parent compute construct");
+ else if (oacc_get_fn_attrib (current_function_decl))
+ inform (DECL_SOURCE_LOCATION (current_function_decl),
+ "enclosing routine");
+ else
+ gcc_unreachable ();
+ }
}
if (tgt && is_oacc_kernels (tgt))
- {
- /* Strip out reductions, as they are not handled yet. */
- tree *prev_ptr = &clauses;
-
- while (tree probe = *prev_ptr)
- {
- tree *next_ptr = &OMP_CLAUSE_CHAIN (probe);
-
- if (OMP_CLAUSE_CODE (probe) == OMP_CLAUSE_REDUCTION)
- *prev_ptr = *next_ptr;
- else
- prev_ptr = next_ptr;
- }
-
- gimple_omp_for_set_clauses (stmt, clauses);
- check_oacc_kernel_gwv (stmt, ctx);
- }
+ check_oacc_kernel_gwv (stmt, ctx);
/* Collect all variables named in reductions on this loop. Ensure
that, if this loop has a reduction on some variable v, and there is
@@ -2516,6 +2593,24 @@ scan_omp_for (gomp_for *stmt, omp_context *outer_ctx)
ctx->outer_reduction_clauses
= chainon (unshare_expr (ctx->local_reduction_clauses),
ctx->outer_reduction_clauses);
+
+ if (tgt && is_oacc_kernels (tgt))
+ {
+ /* Strip out reductions, as they are not handled yet. */
+ tree *prev_ptr = &clauses;
+
+ while (tree probe = *prev_ptr)
+ {
+ tree *next_ptr = &OMP_CLAUSE_CHAIN (probe);
+
+ if (OMP_CLAUSE_CODE (probe) == OMP_CLAUSE_REDUCTION)
+ *prev_ptr = *next_ptr;
+ else
+ prev_ptr = next_ptr;
+ }
+
+ gimple_omp_for_set_clauses (stmt, clauses);
+ }
}
scan_sharing_clauses (clauses, ctx);
@@ -9530,7 +9625,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_);
@@ -10453,12 +10554,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),
@@ -10466,7 +10581,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)
@@ -10485,7 +10600,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_);
@@ -11412,6 +11527,8 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_STRUCT:
case GOMP_MAP_ALWAYS_POINTER:
+ case GOMP_MAP_ATTACH:
+ case GOMP_MAP_DETACH:
break;
case GOMP_MAP_IF_PRESENT:
case GOMP_MAP_FORCE_ALLOC:
@@ -11422,8 +11539,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
case GOMP_MAP_FORCE_DEVICEPTR:
case GOMP_MAP_DEVICE_RESIDENT:
case GOMP_MAP_LINK:
- case GOMP_MAP_ATTACH:
- case GOMP_MAP_DETACH:
case GOMP_MAP_FORCE_DETACH:
gcc_assert (is_gimple_omp_oacc (stmt));
break;
@@ -11478,6 +11593,16 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
continue;
}
+ if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+ && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_DETACH)
+ && is_omp_target (stmt))
+ {
+ gcc_assert (maybe_lookup_field (c, ctx));
+ map_cnt++;
+ continue;
+ }
+
if (!maybe_lookup_field (var, ctx))
continue;
@@ -11710,14 +11835,28 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
gcc_assert (DECL_P (ovar2));
ovar = ovar2;
}
- if (!maybe_lookup_field (ovar, ctx))
+ if (!maybe_lookup_field (ovar, ctx)
+ && !(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+ && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_DETACH)))
continue;
}
talign = TYPE_ALIGN_UNIT (TREE_TYPE (ovar));
if (DECL_P (ovar) && DECL_ALIGN_UNIT (ovar) > talign)
talign = DECL_ALIGN_UNIT (ovar);
- if (nc)
+
+ if (nc
+ && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
+ && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_DETACH)
+ && is_omp_target (stmt))
+ {
+ var = lookup_decl_in_outer_ctx (ovar, ctx);
+ x = build_sender_ref (c, ctx);
+ gimplify_assign (x, build_fold_addr_expr (var), &ilist);
+ }
+ else if (nc)
{
var = lookup_decl_in_outer_ctx (ovar, ctx);
x = build_sender_ref (ovar, ctx);
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index 590007b..4490701 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -196,7 +196,26 @@ 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)
+ if (TREE_CODE (*tp) == CALL_EXPR
+ && CALL_EXPR_FN (*tp)
+ && TREE_CODE (CALL_EXPR_FN (*tp)) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (*tp), 0)) == FUNCTION_DECL
+ && lookup_attribute ("omp declare variant base",
+ DECL_ATTRIBUTES (TREE_OPERAND (CALL_EXPR_FN (*tp),
+ 0))))
+ {
+ tree fn = TREE_OPERAND (CALL_EXPR_FN (*tp), 0);
+ for (tree attr = DECL_ATTRIBUTES (fn); attr; attr = TREE_CHAIN (attr))
+ {
+ attr = lookup_attribute ("omp declare variant base", attr);
+ if (attr == NULL_TREE)
+ break;
+ tree purpose = TREE_PURPOSE (TREE_VALUE (attr));
+ if (TREE_CODE (purpose) == FUNCTION_DECL)
+ omp_discover_declare_target_tgt_fn_r (&purpose, walk_subtrees, data);
+ }
+ }
+ else if (TREE_CODE (*tp) == FUNCTION_DECL)
{
tree decl = *tp;
tree id = get_identifier ("omp declare target");
@@ -237,7 +256,7 @@ omp_discover_declare_target_tgt_fn_r (tree *tp, int *walk_subtrees, void *data)
}
if (omp_declare_target_fn_p (decl)
|| lookup_attribute ("omp declare target host",
- DECL_ATTRIBUTES (decl)))
+ DECL_ATTRIBUTES (decl)))
return NULL_TREE;
if (!DECL_EXTERNAL (decl) && DECL_SAVED_TREE (decl))
@@ -334,7 +353,8 @@ omp_discover_implicit_declare_target (void)
else if (DECL_STRUCT_FUNCTION (node->decl)
&& DECL_STRUCT_FUNCTION (node->decl)->has_omp_target)
worklist.safe_push (node->decl);
- for (cgn = node->nested; cgn; cgn = cgn->next_nested)
+ 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)
diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c
index 942fb97..cbd58c8 100644
--- a/gcc/omp-simd-clone.c
+++ b/gcc/omp-simd-clone.c
@@ -338,16 +338,18 @@ simd_clone_mangle (struct cgraph_node *node,
{
char vecsize_mangle = clone_info->vecsize_mangle;
char mask = clone_info->inbranch ? 'M' : 'N';
- unsigned int simdlen = clone_info->simdlen;
+ poly_uint64 simdlen = clone_info->simdlen;
unsigned int n;
pretty_printer pp;
- gcc_assert (vecsize_mangle && simdlen);
+ gcc_assert (vecsize_mangle && maybe_ne (simdlen, 0U));
pp_string (&pp, "_ZGV");
pp_character (&pp, vecsize_mangle);
pp_character (&pp, mask);
- pp_decimal_int (&pp, simdlen);
+ /* For now, simdlen is always constant, while variable simdlen pp 'n'. */
+ unsigned int len = simdlen.to_constant ();
+ pp_decimal_int (&pp, (len));
for (n = 0; n < clone_info->nargs; ++n)
{
@@ -491,7 +493,7 @@ simd_clone_adjust_return_type (struct cgraph_node *node)
{
tree fndecl = node->decl;
tree orig_rettype = TREE_TYPE (TREE_TYPE (fndecl));
- unsigned int veclen;
+ poly_uint64 veclen;
tree t;
/* Adjust the function return type. */
@@ -502,17 +504,18 @@ simd_clone_adjust_return_type (struct cgraph_node *node)
veclen = node->simdclone->vecsize_int;
else
veclen = node->simdclone->vecsize_float;
- veclen /= GET_MODE_BITSIZE (SCALAR_TYPE_MODE (t));
- if (veclen > node->simdclone->simdlen)
+ veclen = exact_div (veclen, GET_MODE_BITSIZE (SCALAR_TYPE_MODE (t)));
+ if (multiple_p (veclen, node->simdclone->simdlen))
veclen = node->simdclone->simdlen;
if (POINTER_TYPE_P (t))
t = pointer_sized_int_node;
- if (veclen == node->simdclone->simdlen)
+ if (known_eq (veclen, node->simdclone->simdlen))
t = build_vector_type (t, node->simdclone->simdlen);
else
{
t = build_vector_type (t, veclen);
- t = build_array_type_nelts (t, node->simdclone->simdlen / veclen);
+ t = build_array_type_nelts (t, exact_div (node->simdclone->simdlen,
+ veclen));
}
TREE_TYPE (TREE_TYPE (fndecl)) = t;
if (!node->definition)
@@ -526,7 +529,7 @@ simd_clone_adjust_return_type (struct cgraph_node *node)
tree atype = build_array_type_nelts (orig_rettype,
node->simdclone->simdlen);
- if (veclen != node->simdclone->simdlen)
+ if (maybe_ne (veclen, node->simdclone->simdlen))
return build1 (VIEW_CONVERT_EXPR, atype, t);
/* Set up a SIMD array to use as the return value. */
@@ -546,7 +549,7 @@ simd_clone_adjust_return_type (struct cgraph_node *node)
SIMDLEN is the number of elements. */
static tree
-create_tmp_simd_array (const char *prefix, tree type, int simdlen)
+create_tmp_simd_array (const char *prefix, tree type, poly_uint64 simdlen)
{
tree atype = build_array_type_nelts (type, simdlen);
tree avar = create_tmp_var_raw (atype, prefix);
@@ -578,7 +581,8 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
struct cgraph_simd_clone *sc = node->simdclone;
vec<ipa_adjusted_param, va_gc> *new_params = NULL;
vec_safe_reserve (new_params, sc->nargs);
- unsigned i, j, veclen;
+ unsigned i, j, k;
+ poly_uint64 veclen;
for (i = 0; i < sc->nargs; ++i)
{
@@ -614,8 +618,9 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
veclen = sc->vecsize_int;
else
veclen = sc->vecsize_float;
- veclen /= GET_MODE_BITSIZE (SCALAR_TYPE_MODE (parm_type));
- if (veclen > sc->simdlen)
+ veclen = exact_div (veclen,
+ GET_MODE_BITSIZE (SCALAR_TYPE_MODE (parm_type)));
+ if (multiple_p (veclen, sc->simdlen))
veclen = sc->simdlen;
adj.op = IPA_PARAM_OP_NEW;
adj.param_prefix_index = IPA_PARAM_PREFIX_SIMD;
@@ -624,10 +629,11 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
else
adj.type = build_vector_type (parm_type, veclen);
sc->args[i].vector_type = adj.type;
- for (j = veclen; j < sc->simdlen; j += veclen)
+ k = vector_unroll_factor (sc->simdlen, veclen);
+ for (j = 1; j < k; j++)
{
vec_safe_push (new_params, adj);
- if (j == veclen)
+ if (j == 1)
{
memset (&adj, 0, sizeof (adj));
adj.op = IPA_PARAM_OP_NEW;
@@ -663,8 +669,9 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
veclen = sc->vecsize_int;
else
veclen = sc->vecsize_float;
- veclen /= GET_MODE_BITSIZE (SCALAR_TYPE_MODE (base_type));
- if (veclen > sc->simdlen)
+ veclen = exact_div (veclen,
+ GET_MODE_BITSIZE (SCALAR_TYPE_MODE (base_type)));
+ if (multiple_p (veclen, sc->simdlen))
veclen = sc->simdlen;
if (sc->mask_mode != VOIDmode)
adj.type
@@ -675,7 +682,8 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
adj.type = build_vector_type (base_type, veclen);
vec_safe_push (new_params, adj);
- for (j = veclen; j < sc->simdlen; j += veclen)
+ k = vector_unroll_factor (sc->simdlen, veclen);
+ for (j = 1; j < k; j++)
vec_safe_push (new_params, adj);
/* We have previously allocated one extra entry for the mask. Use
@@ -690,9 +698,9 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
if (sc->mask_mode == VOIDmode)
sc->args[i].simd_array
= create_tmp_simd_array ("mask", base_type, sc->simdlen);
- else if (veclen < sc->simdlen)
+ else if (k > 1)
sc->args[i].simd_array
- = create_tmp_simd_array ("mask", adj.type, sc->simdlen / veclen);
+ = create_tmp_simd_array ("mask", adj.type, k);
else
sc->args[i].simd_array = NULL_TREE;
}
@@ -783,7 +791,8 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
}
continue;
}
- if (simd_clone_subparts (TREE_TYPE (arg)) == node->simdclone->simdlen)
+ if (known_eq (simd_clone_subparts (TREE_TYPE (arg)),
+ node->simdclone->simdlen))
{
tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array)));
tree ptr = build_fold_addr_expr (array);
@@ -795,8 +804,10 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
else
{
unsigned int simdlen = simd_clone_subparts (TREE_TYPE (arg));
+ unsigned int times = vector_unroll_factor (node->simdclone->simdlen,
+ simdlen);
tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array)));
- for (k = 0; k < node->simdclone->simdlen; k += simdlen)
+ for (k = 0; k < times; k++)
{
tree ptr = build_fold_addr_expr (array);
int elemsize;
@@ -808,7 +819,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node,
tree elemtype = TREE_TYPE (TREE_TYPE (arg));
elemsize = GET_MODE_SIZE (SCALAR_TYPE_MODE (elemtype));
tree t = build2 (MEM_REF, TREE_TYPE (arg), ptr,
- build_int_cst (ptype, k * elemsize));
+ build_int_cst (ptype, k * elemsize * simdlen));
t = build2 (MODIFY_EXPR, TREE_TYPE (t), t, arg);
gimplify_and_add (t, &seq);
}
@@ -981,8 +992,9 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
iter, NULL_TREE, NULL_TREE);
adjustments->register_replacement (&(*adjustments->m_adj_params)[j], r);
- if (simd_clone_subparts (vectype) < node->simdclone->simdlen)
- j += node->simdclone->simdlen / simd_clone_subparts (vectype) - 1;
+ if (multiple_p (node->simdclone->simdlen, simd_clone_subparts (vectype)))
+ j += vector_unroll_factor (node->simdclone->simdlen,
+ simd_clone_subparts (vectype)) - 1;
}
tree name;
@@ -1249,7 +1261,8 @@ simd_clone_adjust (struct cgraph_node *node)
below). */
loop = alloc_loop ();
cfun->has_force_vectorize_loops = true;
- loop->safelen = node->simdclone->simdlen;
+ /* For now, simlen is always constant. */
+ loop->safelen = node->simdclone->simdlen.to_constant ();
loop->force_vectorize = true;
loop->header = body_bb;
}
@@ -1275,7 +1288,8 @@ simd_clone_adjust (struct cgraph_node *node)
{
tree maskt = TREE_TYPE (mask_array);
int c = tree_to_uhwi (TYPE_MAX_VALUE (TYPE_DOMAIN (maskt)));
- c = node->simdclone->simdlen / (c + 1);
+ /* For now, c must be constant here. */
+ c = exact_div (node->simdclone->simdlen, c + 1).to_constant ();
int s = exact_log2 (c);
gcc_assert (s > 0);
c--;
@@ -1683,7 +1697,7 @@ expand_simd_clones (struct cgraph_node *node)
if (clone_info == NULL)
continue;
- int orig_simdlen = clone_info->simdlen;
+ poly_uint64 orig_simdlen = clone_info->simdlen;
tree base_type = simd_clone_compute_base_data_type (node, clone_info);
/* The target can return 0 (no simd clones should be created),
1 (just one ISA of simd clones should be created) or higher
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 8ad7f4b..1820b91 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -6484,6 +6484,48 @@ expand_memory_blockage (void)
expand_asm_memory_blockage ();
}
+/* Generate asm volatile("" : : : "memory") as a memory blockage, at the
+ same time clobbering the register set specified by REGS. */
+
+void
+expand_asm_reg_clobber_mem_blockage (HARD_REG_SET regs)
+{
+ rtx asm_op, clob_mem;
+
+ unsigned int num_of_regs = 0;
+ for (unsigned int i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (TEST_HARD_REG_BIT (regs, i))
+ num_of_regs++;
+
+ asm_op = gen_rtx_ASM_OPERANDS (VOIDmode, "", "", 0,
+ rtvec_alloc (0), rtvec_alloc (0),
+ rtvec_alloc (0), UNKNOWN_LOCATION);
+ MEM_VOLATILE_P (asm_op) = 1;
+
+ rtvec v = rtvec_alloc (num_of_regs + 2);
+
+ clob_mem = gen_rtx_SCRATCH (VOIDmode);
+ clob_mem = gen_rtx_MEM (BLKmode, clob_mem);
+ clob_mem = gen_rtx_CLOBBER (VOIDmode, clob_mem);
+
+ RTVEC_ELT (v, 0) = asm_op;
+ RTVEC_ELT (v, 1) = clob_mem;
+
+ if (num_of_regs > 0)
+ {
+ unsigned int j = 2;
+ for (unsigned int i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (TEST_HARD_REG_BIT (regs, i))
+ {
+ RTVEC_ELT (v, j) = gen_rtx_CLOBBER (VOIDmode, regno_reg_rtx[i]);
+ j++;
+ }
+ gcc_assert (j == (num_of_regs + 2));
+ }
+
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, v));
+}
+
/* This routine will either emit the mem_thread_fence pattern or issue a
sync_synchronize to generate a fence for memory model MEMMODEL. */
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 0b14700..bfa10c8 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -345,6 +345,8 @@ rtx expand_atomic_store (rtx, rtx, enum memmodel, bool);
rtx expand_atomic_fetch_op (rtx, rtx, rtx, enum rtx_code, enum memmodel,
bool);
+extern void expand_asm_reg_clobber_mem_blockage (HARD_REG_SET);
+
extern bool insn_operand_matches (enum insn_code icode, unsigned int opno,
rtx operand);
extern bool valid_multiword_target_p (rtx);
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 73a96ba..9e7e997 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -104,6 +104,9 @@ for (i = 0; i < n_opts; i++) {
enabledby_negarg = nth_arg(3, enabledby_arg);
lang_enabled_by(enabledby_langs, enabledby_name, enabledby_posarg, enabledby_negarg);
}
+
+ if (flag_set_p("Param", flags[i]) && !(opts[i] ~ "^-param="))
+ print "#error Parameter option name '" opts[i] "' must start with '-param='"
}
diff --git a/gcc/opts.c b/gcc/opts.c
index da503c3..96291e8 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1776,6 +1776,24 @@ const struct sanitizer_opts_s coverage_sanitizer_opts[] =
{ NULL, 0U, 0UL, false }
};
+/* -fzero-call-used-regs= suboptions. */
+const struct zero_call_used_regs_opts_s zero_call_used_regs_opts[] =
+{
+#define ZERO_CALL_USED_REGS_OPT(name, flags) \
+ { #name, flags }
+ ZERO_CALL_USED_REGS_OPT (skip, zero_regs_flags::SKIP),
+ ZERO_CALL_USED_REGS_OPT (used-gpr-arg, zero_regs_flags::USED_GPR_ARG),
+ ZERO_CALL_USED_REGS_OPT (used-gpr, zero_regs_flags::USED_GPR),
+ ZERO_CALL_USED_REGS_OPT (used-arg, zero_regs_flags::USED_ARG),
+ ZERO_CALL_USED_REGS_OPT (used, zero_regs_flags::USED),
+ ZERO_CALL_USED_REGS_OPT (all-gpr-arg, zero_regs_flags::ALL_GPR_ARG),
+ ZERO_CALL_USED_REGS_OPT (all-gpr, zero_regs_flags::ALL_GPR),
+ ZERO_CALL_USED_REGS_OPT (all-arg, zero_regs_flags::ALL_ARG),
+ ZERO_CALL_USED_REGS_OPT (all, zero_regs_flags::ALL),
+#undef ZERO_CALL_USED_REGS_OPT
+ {NULL, 0U}
+};
+
/* A struct for describing a run of chars within a string. */
class string_fragment
@@ -1970,6 +1988,27 @@ parse_no_sanitize_attribute (char *value)
return flags;
}
+/* Parse -fzero-call-used-regs suboptions from ARG, return the FLAGS. */
+
+unsigned int
+parse_zero_call_used_regs_options (const char *arg)
+{
+ unsigned int flags = 0;
+
+ /* Check to see if the string matches a sub-option name. */
+ for (unsigned int i = 0; zero_call_used_regs_opts[i].name != NULL; ++i)
+ if (strcmp (arg, zero_call_used_regs_opts[i].name) == 0)
+ {
+ flags = zero_call_used_regs_opts[i].flag;
+ break;
+ }
+
+ if (!flags)
+ error ("unrecognized argument to %<-fzero-call-used-regs=%>: %qs", arg);
+
+ return flags;
+}
+
/* Parse -falign-NAME format for a FLAG value. Return individual
parsed integer values into RESULT_VALUES array. If REPORT_ERROR is
set, print error message at LOC location. */
@@ -2596,6 +2635,11 @@ common_handle_option (struct gcc_options *opts,
/* Automatically sets -ftree-loop-vectorize and
-ftree-slp-vectorize. Nothing more to do here. */
break;
+ case OPT_fzero_call_used_regs_:
+ opts->x_flag_zero_call_used_regs
+ = parse_zero_call_used_regs_options (arg);
+ break;
+
case OPT_fshow_column:
dc->show_column = value;
break;
diff --git a/gcc/opts.h b/gcc/opts.h
index 8f594b4..7d1e126 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -444,6 +444,12 @@ extern const struct sanitizer_opts_s
bool can_recover;
} sanitizer_opts[];
+extern const struct zero_call_used_regs_opts_s
+{
+ const char *const name;
+ unsigned int flag;
+} zero_call_used_regs_opts[];
+
extern vec<const char *> help_option_arguments;
extern void add_misspelling_candidates (auto_vec<char *> *candidates,
diff --git a/gcc/output.h b/gcc/output.h
index eb253c5..2f2f169 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -523,7 +523,8 @@ extern GTY(()) bool in_cold_section_p;
extern section *get_unnamed_section (unsigned int, void (*) (const void *),
const void *);
-extern section *get_section (const char *, unsigned int, tree);
+extern section *get_section (const char *, unsigned int, tree,
+ bool not_existing = false);
extern section *get_named_section (tree, const char *, int);
extern section *get_variable_section (tree, bool);
extern void place_block_symbol (rtx);
diff --git a/gcc/params.opt b/gcc/params.opt
index d770c55..a33a371 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -253,6 +253,10 @@ The size of translation unit that IPA-CP pass considers large.
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.
@@ -593,6 +597,10 @@ Maximum depth of sqrt chains to use when synthesizing exponentiation by a real c
Common Joined UInteger Var(param_max_predicted_iterations) Init(100) IntegerRange(0, 65536) Param Optimization
The maximum number of loop iterations we predict statically.
+-param=max-pre-hoist-insert-iterations=
+Common Joined UInteger Var(param_max_pre_hoist_insert_iterations) Init(3) Param Optimization
+The maximum number of insert iterations done for PRE code hoisting.
+
-param=max-reload-search-insns=
Common Joined UInteger Var(param_max_reload_search_insns) Init(100) Param Optimization
The maximum number of instructions to search backward when looking for equivalent reload.
@@ -851,10 +859,6 @@ The number of prefetches that can run at the same time.
Common Joined UInteger Var(param_sink_frequency_threshold) Init(75) IntegerRange(0, 100) Param Optimization
Target block's relative execution frequency (as a percentage) required to sink a statement.
--param=slp-max-insns-in-bb=
-Common Joined UInteger Var(param_slp_max_insns_in_bb) Init(1000) Param Optimization
-Maximum number of instructions in basic block to be considered for SLP vectorization.
-
-param=sms-dfa-history=
Common Joined UInteger Var(param_sms_dfa_history) IntegerRange(0, 16) Param Optimization
The number of cycles the swing modulo scheduler considers when checking conflicts using DFA.
diff --git a/gcc/passes.c b/gcc/passes.c
index 6ff31ec..f71f639 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -731,7 +731,54 @@ make_pass_late_compilation (gcc::context *ctxt)
return new pass_late_compilation (ctxt);
}
+/* Pre-SLP scalar cleanup, it has several cleanup passes like FRE, DSE. */
+namespace {
+
+const pass_data pass_data_pre_slp_scalar_cleanup =
+{
+ GIMPLE_PASS, /* type */
+ "*pre_slp_scalar_cleanup", /* name */
+ OPTGROUP_LOOP, /* optinfo_flags */
+ TV_SCALAR_CLEANUP, /* tv_id */
+ ( PROP_cfg | PROP_ssa ), /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_pre_slp_scalar_cleanup : public gimple_opt_pass
+{
+public:
+ pass_pre_slp_scalar_cleanup (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_pre_slp_scalar_cleanup, ctxt)
+ {
+ }
+
+ virtual bool
+ gate (function *fun)
+ {
+ return flag_tree_slp_vectorize
+ && (fun->pending_TODOs & PENDING_TODO_force_next_scalar_cleanup);
+ }
+
+ virtual unsigned int
+ execute (function *fun)
+ {
+ fun->pending_TODOs &= ~PENDING_TODO_force_next_scalar_cleanup;
+ return 0;
+ }
+
+}; // class pass_pre_slp_scalar_cleanup
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_pre_slp_scalar_cleanup (gcc::context *ctxt)
+{
+ return new pass_pre_slp_scalar_cleanup (ctxt);
+}
/* Set the static pass number of pass PASS to ID and record that
in the mapping from static pass number to pass. */
@@ -2271,6 +2318,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;
@@ -2558,7 +2613,8 @@ execute_one_pass (opt_pass *pass)
{
struct cgraph_node *node;
FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
- node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass);
+ if (!node->inlined_to)
+ node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass);
}
else if (dump_file)
do_per_function (execute_function_dump, pass);
@@ -2722,7 +2778,8 @@ ipa_write_summaries (void)
{
struct cgraph_node *node = order[i];
- if (node->definition && node->need_lto_streaming)
+ if ((node->definition || node->declare_variant_alt)
+ && node->need_lto_streaming)
{
if (gimple_has_body_p (node->decl))
lto_prepare_function_for_streaming (node);
diff --git a/gcc/passes.def b/gcc/passes.def
index f865bdc..c682312 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)
@@ -290,11 +289,16 @@ along with GCC; see the file COPYING3. If not see
/* pass_vectorize must immediately follow pass_if_conversion.
Please do not add any other passes in between. */
NEXT_PASS (pass_vectorize);
- PUSH_INSERT_PASSES_WITHIN (pass_vectorize)
+ PUSH_INSERT_PASSES_WITHIN (pass_vectorize)
NEXT_PASS (pass_dce);
- POP_INSERT_PASSES ()
- NEXT_PASS (pass_predcom);
+ POP_INSERT_PASSES ()
+ NEXT_PASS (pass_predcom);
NEXT_PASS (pass_complete_unroll);
+ NEXT_PASS (pass_pre_slp_scalar_cleanup);
+ PUSH_INSERT_PASSES_WITHIN (pass_pre_slp_scalar_cleanup)
+ NEXT_PASS (pass_fre, false /* may_iterate */);
+ NEXT_PASS (pass_dse);
+ POP_INSERT_PASSES ()
NEXT_PASS (pass_slp_vectorize);
NEXT_PASS (pass_loop_prefetch);
/* Run IVOPTs after the last pass that uses data-reference analysis
@@ -492,6 +496,7 @@ along with GCC; see the file COPYING3. If not see
POP_INSERT_PASSES ()
NEXT_PASS (pass_late_compilation);
PUSH_INSERT_PASSES_WITHIN (pass_late_compilation)
+ NEXT_PASS (pass_zero_call_used_regs);
NEXT_PASS (pass_compute_alignments);
NEXT_PASS (pass_variable_tracking);
NEXT_PASS (pass_free_cfg);
diff --git a/gcc/poly-int-types.h b/gcc/poly-int-types.h
index 5e04e63..302e5bf 100644
--- a/gcc/poly-int-types.h
+++ b/gcc/poly-int-types.h
@@ -81,6 +81,14 @@ typedef poly_int<NUM_POLY_INT_COEFFS, widest_int> poly_widest_int;
#define vector_element_size(SIZE, NELTS) \
(exact_div (SIZE, NELTS).to_constant ())
+/* Return the number of unroll times when a vector that has NELTS1 elements
+ is unrolled to vectors that have NELTS2 elements.
+
+ to_constant () is safe in this situation because the multiples of the
+ NELTS of two vectors are always constant-size scalars. */
+#define vector_unroll_factor(NELTS1, NELTS2) \
+ (exact_div (NELTS1, NELTS2).to_constant ())
+
/* Wrapper for poly_int arguments to target macros, so that if a target
doesn't need polynomial-sized modes, its header file can continue to
treat the argument as a normal constant. This should go away once
diff --git a/gcc/poly-int.h b/gcc/poly-int.h
index b953ffa..96a763d 100644
--- a/gcc/poly-int.h
+++ b/gcc/poly-int.h
@@ -2044,6 +2044,63 @@ constant_multiple_p (const poly_int_pod<N, Ca> &a,
return true;
}
+/* Return true if A is a constant multiple of B. */
+
+template<unsigned int N, typename Ca, typename Cb>
+inline typename if_nonpoly<Cb, bool>::type
+constant_multiple_p (const poly_int_pod<N, Ca> &a, Cb b)
+{
+ typedef POLY_CAST (Ca, Cb) NCa;
+ typedef POLY_CAST (Cb, Ca) NCb;
+
+ /* Do the modulus before the constant check, to catch divide by
+ zero errors. */
+ if (NCa (a.coeffs[0]) % NCb (b) != 0 || !a.is_constant ())
+ return false;
+ return true;
+}
+
+template<unsigned int N, typename Ca, typename Cb>
+inline typename if_nonpoly<Ca, bool>::type
+constant_multiple_p (Ca a, const poly_int_pod<N, Cb> &b)
+{
+ typedef POLY_CAST (Ca, Cb) NCa;
+ typedef POLY_CAST (Cb, Ca) NCb;
+ typedef POLY_INT_TYPE (Ca) int_type;
+
+ /* Do the modulus before the constant check, to catch divide by
+ zero errors. */
+ if (NCa (a) % NCb (b.coeffs[0]) != 0
+ || (a != int_type (0) && !b.is_constant ()))
+ return false;
+ return true;
+}
+
+template<unsigned int N, typename Ca, typename Cb>
+inline bool
+constant_multiple_p (const poly_int_pod<N, Ca> &a,
+ const poly_int_pod<N, Cb> &b)
+{
+ typedef POLY_CAST (Ca, Cb) NCa;
+ typedef POLY_CAST (Cb, Ca) NCb;
+ typedef POLY_INT_TYPE (Ca) ICa;
+ typedef POLY_INT_TYPE (Cb) ICb;
+ typedef POLY_BINARY_COEFF (Ca, Cb) C;
+
+ if (NCa (a.coeffs[0]) % NCb (b.coeffs[0]) != 0)
+ return false;
+
+ C r = NCa (a.coeffs[0]) / NCb (b.coeffs[0]);
+ for (unsigned int i = 1; i < N; ++i)
+ if (b.coeffs[i] == ICb (0)
+ ? a.coeffs[i] != ICa (0)
+ : (NCa (a.coeffs[i]) % NCb (b.coeffs[i]) != 0
+ || NCa (a.coeffs[i]) / NCb (b.coeffs[i]) != r))
+ return false;
+ return true;
+}
+
+
/* Return true if A is a multiple of B. */
template<typename Ca, typename Cb>
diff --git a/gcc/predict.c b/gcc/predict.c
index 5983889..361c401 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -243,7 +243,7 @@ probably_never_executed_bb_p (struct function *fun, const_basic_block bb)
static bool
unlikely_executed_edge_p (edge e)
{
- return (e->count () == profile_count::zero ()
+ return (e->src->count == profile_count::zero ()
|| e->probability == profile_probability::never ())
|| (e->flags & (EDGE_EH | EDGE_FAKE));
}
@@ -260,13 +260,15 @@ probably_never_executed_edge_p (struct function *fun, edge e)
/* Return true if function FUN should always be optimized for size. */
-bool
+optimize_size_level
optimize_function_for_size_p (struct function *fun)
{
if (!fun || !fun->decl)
- return optimize_size;
+ return optimize_size ? OPTIMIZE_SIZE_MAX : OPTIMIZE_SIZE_NO;
cgraph_node *n = cgraph_node::get (fun->decl);
- return n && n->optimize_for_size_p ();
+ if (n)
+ return n->optimize_for_size_p ();
+ return OPTIMIZE_SIZE_NO;
}
/* Return true if function FUN should always be optimized for speed. */
@@ -289,11 +291,16 @@ function_optimization_type (struct function *fun)
/* Return TRUE if basic block BB should be optimized for size. */
-bool
+optimize_size_level
optimize_bb_for_size_p (const_basic_block bb)
{
- return (optimize_function_for_size_p (cfun)
- || (bb && !maybe_hot_bb_p (cfun, bb)));
+ enum optimize_size_level ret = optimize_function_for_size_p (cfun);
+
+ if (bb && ret < OPTIMIZE_SIZE_MAX && bb->count == profile_count::zero ())
+ ret = OPTIMIZE_SIZE_MAX;
+ if (bb && ret < OPTIMIZE_SIZE_BALANCED && !maybe_hot_bb_p (cfun, bb))
+ ret = OPTIMIZE_SIZE_BALANCED;
+ return ret;
}
/* Return TRUE if basic block BB should be optimized for speed. */
@@ -316,10 +323,16 @@ bb_optimization_type (const_basic_block bb)
/* Return TRUE if edge E should be optimized for size. */
-bool
+optimize_size_level
optimize_edge_for_size_p (edge e)
{
- return optimize_function_for_size_p (cfun) || !maybe_hot_edge_p (e);
+ enum optimize_size_level ret = optimize_function_for_size_p (cfun);
+
+ if (ret < OPTIMIZE_SIZE_MAX && unlikely_executed_edge_p (e))
+ ret = OPTIMIZE_SIZE_MAX;
+ if (ret < OPTIMIZE_SIZE_BALANCED && !maybe_hot_edge_p (e))
+ ret = OPTIMIZE_SIZE_BALANCED;
+ return ret;
}
/* Return TRUE if edge E should be optimized for speed. */
@@ -332,10 +345,13 @@ optimize_edge_for_speed_p (edge e)
/* Return TRUE if the current function is optimized for size. */
-bool
+optimize_size_level
optimize_insn_for_size_p (void)
{
- return optimize_function_for_size_p (cfun) || !crtl->maybe_hot_insn_p;
+ enum optimize_size_level ret = optimize_function_for_size_p (cfun);
+ if (ret < OPTIMIZE_SIZE_BALANCED && !crtl->maybe_hot_insn_p)
+ ret = OPTIMIZE_SIZE_BALANCED;
+ return ret;
}
/* Return TRUE if the current function is optimized for speed. */
@@ -348,7 +364,7 @@ optimize_insn_for_speed_p (void)
/* Return TRUE if LOOP should be optimized for size. */
-bool
+optimize_size_level
optimize_loop_for_size_p (class loop *loop)
{
return optimize_bb_for_size_p (loop->header);
@@ -392,10 +408,31 @@ optimize_loop_nest_for_speed_p (class loop *loop)
/* Return TRUE if nest rooted at LOOP should be optimized for size. */
-bool
+optimize_size_level
optimize_loop_nest_for_size_p (class loop *loop)
{
- return !optimize_loop_nest_for_speed_p (loop);
+ enum optimize_size_level ret = optimize_loop_for_size_p (loop);
+ class loop *l = loop;
+
+ l = loop->inner;
+ while (l && l != loop)
+ {
+ if (ret == OPTIMIZE_SIZE_NO)
+ break;
+ ret = MIN (optimize_loop_for_size_p (l), ret);
+ if (l->inner)
+ l = l->inner;
+ else if (l->next)
+ l = l->next;
+ else
+ {
+ while (l != loop && !l->next)
+ l = loop_outer (l);
+ if (l != loop)
+ l = l->next;
+ }
+ }
+ return ret;
}
/* Return true if edge E is likely to be well predictable by branch
diff --git a/gcc/predict.h b/gcc/predict.h
index 274597e..b64d209 100644
--- a/gcc/predict.h
+++ b/gcc/predict.h
@@ -58,20 +58,20 @@ extern bool maybe_hot_bb_p (struct function *, const_basic_block);
extern bool maybe_hot_edge_p (edge);
extern bool probably_never_executed_bb_p (struct function *, const_basic_block);
extern bool probably_never_executed_edge_p (struct function *, edge);
-extern bool optimize_function_for_size_p (struct function *);
+extern enum optimize_size_level optimize_function_for_size_p (struct function *);
extern bool optimize_function_for_speed_p (struct function *);
extern optimization_type function_optimization_type (struct function *);
-extern bool optimize_bb_for_size_p (const_basic_block);
+extern enum optimize_size_level optimize_bb_for_size_p (const_basic_block);
extern bool optimize_bb_for_speed_p (const_basic_block);
extern optimization_type bb_optimization_type (const_basic_block);
-extern bool optimize_edge_for_size_p (edge);
+extern enum optimize_size_level optimize_edge_for_size_p (edge);
extern bool optimize_edge_for_speed_p (edge);
-extern bool optimize_insn_for_size_p (void);
+extern enum optimize_size_level optimize_insn_for_size_p (void);
extern bool optimize_insn_for_speed_p (void);
-extern bool optimize_loop_for_size_p (class loop *);
+extern enum optimize_size_level optimize_loop_for_size_p (class loop *);
extern bool optimize_loop_for_speed_p (class loop *);
extern bool optimize_loop_nest_for_speed_p (class loop *);
-extern bool optimize_loop_nest_for_size_p (class loop *);
+extern enum optimize_size_level optimize_loop_nest_for_size_p (class loop *);
extern bool predictable_edge_p (edge);
extern void rtl_profile_for_bb (basic_block);
extern void rtl_profile_for_edge (edge);
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 25265ef..d514b1c 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -2139,7 +2139,7 @@ extern void debug_bb_slim (basic_block);
DEBUG_FUNCTION void
debug_bb_slim (basic_block bb)
{
- dump_bb (stderr, bb, 0, TDF_SLIM | TDF_BLOCKS);
+ debug_bb (bb, TDF_SLIM | TDF_BLOCKS);
}
extern void debug_bb_n_slim (int);
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index d1150e4..17c88f8 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -742,20 +742,26 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
}
if (code == CALL_EXPR)
{
- call_expr_arg_iterator iter;
- tree arg;
print_node (file, "fn", CALL_EXPR_FN (node), indent + 4);
print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node),
indent + 4);
- i = 0;
- FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
+
+ call_expr_arg_iterator iter;
+ init_call_expr_arg_iterator (node, &iter);
+ while (more_call_expr_args_p (&iter))
{
/* Buffer big enough to format a 32-bit UINT_MAX into, plus
the text. */
char temp[15];
- sprintf (temp, "arg:%u", i);
- print_node (file, temp, arg, indent + 4);
- i++;
+ sprintf (temp, "arg:%u", iter.i);
+ tree arg = next_call_expr_arg (&iter);
+ if (arg)
+ print_node (file, temp, arg, indent + 4);
+ else
+ {
+ indent_to (file, indent + 4);
+ fprintf (file, "%s NULL", temp);
+ }
}
}
else
@@ -1046,7 +1052,7 @@ print_decl_identifier (FILE *file, tree decl, int flags)
if (flags & PRINT_DECL_ORIGIN)
{
- if (DECL_IS_BUILTIN (decl))
+ if (DECL_IS_UNDECLARED_BUILTIN (decl))
fputs ("<built-in>", file);
else
{
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/range-op.cc b/gcc/range-op.cc
index ce6ae2d..aff9383 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -428,9 +428,9 @@ operator_equal::fold_range (irange &r, tree type,
{
// If ranges do not intersect, we know the range is not equal,
// otherwise we don't know anything for sure.
- r = op1;
- r.intersect (op2);
- if (r.undefined_p ())
+ int_range_max tmp = op1;
+ tmp.intersect (op2);
+ if (tmp.undefined_p ())
r = range_false (type);
else
r = range_true_and_false (type);
@@ -513,9 +513,9 @@ operator_not_equal::fold_range (irange &r, tree type,
{
// If ranges do not intersect, we know the range is not equal,
// otherwise we don't know anything for sure.
- r = op1;
- r.intersect (op2);
- if (r.undefined_p ())
+ int_range_max tmp = op1;
+ tmp.intersect (op2);
+ if (tmp.undefined_p ())
r = range_true (type);
else
r = range_true_and_false (type);
@@ -1359,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;
}
@@ -1577,7 +1577,17 @@ operator_lshift::op1_range (irange &r,
if (op2.singleton_p (&shift_amount))
{
wide_int shift = wi::to_wide (shift_amount);
- gcc_checking_assert (wi::gt_p (shift, 0, SIGNED));
+ 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 = lhs;
+ return true;
+ }
// Work completely in unsigned mode to start.
tree utype = type;
@@ -1632,6 +1642,11 @@ operator_rshift::op1_range (irange &r,
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.
@@ -2624,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;
}
@@ -2691,27 +2706,21 @@ operator_logical_not::fold_range (irange &r, tree type,
if (empty_range_varying (r, type, lh, rh))
return true;
- if (lh.varying_p () || lh.undefined_p ())
- r = lh;
- else
- {
- r = lh;
- r.invert ();
- }
- gcc_checking_assert (lh.type() == type);
+ r = lh;
+ if (!lh.varying_p () && !lh.undefined_p ())
+ r.invert ();
+
return true;
}
bool
operator_logical_not::op1_range (irange &r,
- tree type ATTRIBUTE_UNUSED,
+ tree type,
const irange &lhs,
- const irange &op2 ATTRIBUTE_UNUSED) const
+ const irange &op2) const
{
- r = lhs;
- if (!lhs.varying_p () && !lhs.undefined_p ())
- r.invert ();
- return true;
+ // Logical NOT is involutary...do it again.
+ return fold_range (r, type, lhs, op2);
}
@@ -2734,6 +2743,9 @@ operator_bitwise_not::fold_range (irange &r, tree type,
if (empty_range_varying (r, type, lh, rh))
return true;
+ if (types_compatible_p (type, boolean_type_node))
+ return op_logical_not.fold_range (r, type, lh, rh);
+
// ~X is simply -1 - X.
int_range<1> minusone (type, wi::minus_one (TYPE_PRECISION (type)),
wi::minus_one (TYPE_PRECISION (type)));
@@ -2746,6 +2758,9 @@ operator_bitwise_not::op1_range (irange &r, tree type,
const irange &lhs,
const irange &op2) const
{
+ if (types_compatible_p (type, boolean_type_node))
+ return op_logical_not.op1_range (r, type, lhs, op2);
+
// ~X is -1 - X and since bitwise NOT is involutary...do it again.
return fold_range (r, type, lhs, op2);
}
@@ -3063,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.
//
@@ -3338,7 +3361,6 @@ range_cast (irange &r, tree type)
#if CHECKING_P
#include "selftest.h"
-#include "stor-layout.h"
namespace selftest
{
@@ -3346,400 +3368,21 @@ namespace selftest
#define UINT(N) build_int_cstu (unsigned_type_node, (N))
#define INT16(N) build_int_cst (short_integer_type_node, (N))
#define UINT16(N) build_int_cstu (short_unsigned_type_node, (N))
-#define INT64(N) build_int_cstu (long_long_integer_type_node, (N))
-#define UINT64(N) build_int_cstu (long_long_unsigned_type_node, (N))
-#define UINT128(N) build_int_cstu (u128_type, (N))
-#define UCHAR(N) build_int_cstu (unsigned_char_type_node, (N))
#define SCHAR(N) build_int_cst (signed_char_type_node, (N))
-
-static int_range<3>
-build_range3 (int a, int b, int c, int d, int e, int f)
-{
- int_range<3> i1 (INT (a), INT (b));
- int_range<3> i2 (INT (c), INT (d));
- int_range<3> i3 (INT (e), INT (f));
- i1.union_ (i2);
- i1.union_ (i3);
- return i1;
-}
-
-static void
-range3_tests ()
-{
- typedef int_range<3> int_range3;
- int_range3 r0, r1, r2;
- int_range3 i1, i2, i3;
-
- // ([10,20] U [5,8]) U [1,3] ==> [1,3][5,8][10,20].
- r0 = int_range3 (INT (10), INT (20));
- r1 = int_range3 (INT (5), INT (8));
- r0.union_ (r1);
- r1 = int_range3 (INT (1), INT (3));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == build_range3 (1, 3, 5, 8, 10, 20));
-
- // [1,3][5,8][10,20] U [-5,0] => [-5,3][5,8][10,20].
- r1 = int_range3 (INT (-5), INT (0));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == build_range3 (-5, 3, 5, 8, 10, 20));
-
- // [10,20][30,40] U [50,60] ==> [10,20][30,40][50,60].
- r1 = int_range3 (INT (50), INT (60));
- r0 = int_range3 (INT (10), INT (20));
- r0.union_ (int_range3 (INT (30), INT (40)));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == build_range3 (10, 20, 30, 40, 50, 60));
- // [10,20][30,40][50,60] U [70, 80] ==> [10,20][30,40][50,60][70,80].
- r1 = int_range3 (INT (70), INT (80));
- r0.union_ (r1);
-
- r2 = build_range3 (10, 20, 30, 40, 50, 60);
- r2.union_ (int_range3 (INT (70), INT (80)));
- ASSERT_TRUE (r0 == r2);
-
- // [10,20][30,40][50,60] U [6,35] => [6,40][50,60].
- r0 = build_range3 (10, 20, 30, 40, 50, 60);
- r1 = int_range3 (INT (6), INT (35));
- r0.union_ (r1);
- r1 = int_range3 (INT (6), INT (40));
- r1.union_ (int_range3 (INT (50), INT (60)));
- ASSERT_TRUE (r0 == r1);
-
- // [10,20][30,40][50,60] U [6,60] => [6,60].
- r0 = build_range3 (10, 20, 30, 40, 50, 60);
- r1 = int_range3 (INT (6), INT (60));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == int_range3 (INT (6), INT (60)));
-
- // [10,20][30,40][50,60] U [6,70] => [6,70].
- r0 = build_range3 (10, 20, 30, 40, 50, 60);
- r1 = int_range3 (INT (6), INT (70));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == int_range3 (INT (6), INT (70)));
-
- // [10,20][30,40][50,60] U [35,70] => [10,20][30,70].
- r0 = build_range3 (10, 20, 30, 40, 50, 60);
- r1 = int_range3 (INT (35), INT (70));
- r0.union_ (r1);
- r1 = int_range3 (INT (10), INT (20));
- r1.union_ (int_range3 (INT (30), INT (70)));
- ASSERT_TRUE (r0 == r1);
-
- // [10,20][30,40][50,60] U [15,35] => [10,40][50,60].
- r0 = build_range3 (10, 20, 30, 40, 50, 60);
- r1 = int_range3 (INT (15), INT (35));
- r0.union_ (r1);
- r1 = int_range3 (INT (10), INT (40));
- r1.union_ (int_range3 (INT (50), INT (60)));
- ASSERT_TRUE (r0 == r1);
-
- // [10,20][30,40][50,60] U [35,35] => [10,20][30,40][50,60].
- r0 = build_range3 (10, 20, 30, 40, 50, 60);
- r1 = int_range3 (INT (35), INT (35));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == build_range3 (10, 20, 30, 40, 50, 60));
-}
-
-static void
-int_range_max_tests ()
-{
- int_range_max big;
- unsigned int nrange;
-
- // Build a huge multi-range range.
- for (nrange = 0; nrange < 50; ++nrange)
- {
- int_range<1> tmp (INT (nrange*10), INT (nrange*10 + 5));
- big.union_ (tmp);
- }
- ASSERT_TRUE (big.num_pairs () == nrange);
-
- // Verify that we can copy it without loosing precision.
- int_range_max copy (big);
- ASSERT_TRUE (copy.num_pairs () == nrange);
-
- // Inverting it should produce one more sub-range.
- big.invert ();
- ASSERT_TRUE (big.num_pairs () == nrange + 1);
-
- int_range<1> tmp (INT (5), INT (37));
- big.intersect (tmp);
- ASSERT_TRUE (big.num_pairs () == 4);
-
- // Test that [10,10][20,20] does NOT contain 15.
- {
- int_range_max i1 (build_int_cst (integer_type_node, 10),
- build_int_cst (integer_type_node, 10));
- int_range_max i2 (build_int_cst (integer_type_node, 20),
- build_int_cst (integer_type_node, 20));
- i1.union_ (i2);
- ASSERT_FALSE (i1.contains_p (build_int_cst (integer_type_node, 15)));
- }
-
-}
-
-static void
-multi_precision_range_tests ()
-{
- // Test truncating copy to int_range<1>.
- int_range<3> big = build_range3 (10, 20, 30, 40, 50, 60);
- int_range<1> small = big;
- ASSERT_TRUE (small == int_range<1> (INT (10), INT (60)));
-
- // Test truncating copy to int_range<2>.
- int_range<2> medium = big;
- ASSERT_TRUE (!medium.undefined_p ());
-
- // Test that a truncating copy of [MIN,20][22,40][80,MAX]
- // ends up as a conservative anti-range of ~[21,21].
- big = int_range<3> (vrp_val_min (integer_type_node), INT (20));
- big.union_ (int_range<1> (INT (22), INT (40)));
- big.union_ (int_range<1> (INT (80), vrp_val_max (integer_type_node)));
- small = big;
- ASSERT_TRUE (small == int_range<1> (INT (21), INT (21), VR_ANTI_RANGE));
-
- // Copying a legacy symbolic to an int_range should normalize the
- // symbolic at copy time.
- {
- tree ssa = make_ssa_name (integer_type_node);
- value_range legacy_range (ssa, INT (25));
- int_range<2> copy = legacy_range;
- ASSERT_TRUE (copy == int_range<2> (vrp_val_min (integer_type_node),
- INT (25)));
-
- // Test that copying ~[abc_23, abc_23] to a multi-range yields varying.
- legacy_range = value_range (ssa, ssa, VR_ANTI_RANGE);
- copy = legacy_range;
- ASSERT_TRUE (copy.varying_p ());
- }
-
- range3_tests ();
-}
+#define UCHAR(N) build_int_cstu (unsigned_char_type_node, (N))
static void
-operator_tests ()
+range_op_cast_tests ()
{
- tree min = vrp_val_min (integer_type_node);
- tree max = vrp_val_max (integer_type_node);
- tree tiny = fold_build2 (PLUS_EXPR, integer_type_node, min,
- build_one_cst (integer_type_node));
- int_range_max res;
- int_range_max i1 (tiny, max);
- int_range_max i2 (build_int_cst (integer_type_node, 255),
- build_int_cst (integer_type_node, 255));
-
- // [MIN+1, MAX] = OP1 & 255: OP1 is VARYING
- op_bitwise_and.op1_range (res, integer_type_node, i1, i2);
- ASSERT_TRUE (res == int_range<1> (integer_type_node));
-
- // VARYING = OP1 & 255: OP1 is VARYING
- i1 = int_range<1> (integer_type_node);
- op_bitwise_and.op1_range (res, integer_type_node, i1, i2);
- ASSERT_TRUE (res == int_range<1> (integer_type_node));
-
- // Test that 0x808.... & 0x8.... still contains 0x8....
- // for a large set of numbers.
- {
- tree big_type = long_long_unsigned_type_node;
- // big_num = 0x808,0000,0000,0000
- tree big_num = fold_build2 (LSHIFT_EXPR, big_type,
- build_int_cst (big_type, 0x808),
- build_int_cst (big_type, 48));
- op_bitwise_and.fold_range (res, big_type,
- int_range <1> (big_type),
- int_range <1> (big_num, big_num));
- // val = 0x8,0000,0000,0000
- tree val = fold_build2 (LSHIFT_EXPR, big_type,
- build_int_cst (big_type, 0x8),
- build_int_cst (big_type, 48));
- ASSERT_TRUE (res.contains_p (val));
- }
-
- // unsigned: [3, MAX] = OP1 >> 1
- {
- int_range_max lhs (build_int_cst (unsigned_type_node, 3),
- TYPE_MAX_VALUE (unsigned_type_node));
- int_range_max one (build_one_cst (unsigned_type_node),
- build_one_cst (unsigned_type_node));
- int_range_max op1;
- op_rshift.op1_range (op1, unsigned_type_node, lhs, one);
- ASSERT_FALSE (op1.contains_p (UINT (3)));
- }
-
- // signed: [3, MAX] = OP1 >> 1
- {
- int_range_max lhs (INT (3), TYPE_MAX_VALUE (integer_type_node));
- int_range_max one (INT (1), INT (1));
- int_range_max op1;
- op_rshift.op1_range (op1, integer_type_node, lhs, one);
- ASSERT_FALSE (op1.contains_p (INT (-2)));
- }
-
- // This is impossible, so OP1 should be [].
- // signed: [MIN, MIN] = OP1 >> 1
- {
- int_range_max lhs (TYPE_MIN_VALUE (integer_type_node),
- TYPE_MIN_VALUE (integer_type_node));
- int_range_max one (INT (1), INT (1));
- int_range_max op1;
- op_rshift.op1_range (op1, integer_type_node, lhs, one);
- ASSERT_TRUE (op1.undefined_p ());
- }
-
- // signed: ~[-1] = OP1 >> 31
- if (TYPE_PRECISION (integer_type_node) > 31)
- {
- int_range_max lhs (INT (-1), INT (-1), VR_ANTI_RANGE);
- int_range_max shift (INT (31), INT (31));
- int_range_max op1;
- op_rshift.op1_range (op1, integer_type_node, lhs, shift);
- int_range_max negatives = range_negatives (integer_type_node);
- 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.
-
-void
-range_tests ()
-{
- tree u128_type = build_nonstandard_integer_type (128, /*unsigned=*/1);
- int_range<1> i1, i2, i3;
- int_range<1> r0, r1, rold;
-
- // Test 1-bit signed integer union.
- // [-1,-1] U [0,0] = VARYING.
- tree one_bit_type = build_nonstandard_integer_type (1, 0);
- {
- tree one_bit_min = vrp_val_min (one_bit_type);
- tree one_bit_max = vrp_val_max (one_bit_type);
- int_range<2> min (one_bit_min, one_bit_min);
- int_range<2> max (one_bit_max, one_bit_max);
- max.union_ (min);
- ASSERT_TRUE (max.varying_p ());
- }
-
- // Test that NOT(255) is [0..254] in 8-bit land.
- int_range<1> not_255 (UCHAR (255), UCHAR (255), VR_ANTI_RANGE);
- ASSERT_TRUE (not_255 == int_range<1> (UCHAR (0), UCHAR (254)));
-
- // Test that NOT(0) is [1..255] in 8-bit land.
- int_range<1> not_zero = range_nonzero (unsigned_char_type_node);
- ASSERT_TRUE (not_zero == int_range<1> (UCHAR (1), UCHAR (255)));
-
- // Check that [0,127][0x..ffffff80,0x..ffffff]
- // => ~[128, 0x..ffffff7f].
- r0 = int_range<1> (UINT128 (0), UINT128 (127));
- tree high = build_minus_one_cst (u128_type);
- // low = -1 - 127 => 0x..ffffff80.
- tree low = fold_build2 (MINUS_EXPR, u128_type, high, UINT128(127));
- r1 = int_range<1> (low, high); // [0x..ffffff80, 0x..ffffffff]
- // r0 = [0,127][0x..ffffff80,0x..fffffff].
- r0.union_ (r1);
- // r1 = [128, 0x..ffffff7f].
- r1 = int_range<1> (UINT128(128),
- fold_build2 (MINUS_EXPR, u128_type,
- build_minus_one_cst (u128_type),
- UINT128(128)));
- r0.invert ();
- ASSERT_TRUE (r0 == r1);
-
+ int_range<1> r0, r1, r2, rold;
r0.set_varying (integer_type_node);
- tree minint = wide_int_to_tree (integer_type_node, r0.lower_bound ());
tree maxint = wide_int_to_tree (integer_type_node, r0.upper_bound ());
+ // If a range is in any way outside of the range for the converted
+ // to range, default to the range for the new type.
r0.set_varying (short_integer_type_node);
tree minshort = wide_int_to_tree (short_integer_type_node, r0.lower_bound ());
tree maxshort = wide_int_to_tree (short_integer_type_node, r0.upper_bound ());
-
- r0.set_varying (unsigned_type_node);
- tree maxuint = wide_int_to_tree (unsigned_type_node, r0.upper_bound ());
-
- // Check that ~[0,5] => [6,MAX] for unsigned int.
- r0 = int_range<1> (UINT (0), UINT (5));
- r0.invert ();
- ASSERT_TRUE (r0 == int_range<1> (UINT(6), maxuint));
-
- // Check that ~[10,MAX] => [0,9] for unsigned int.
- r0 = int_range<1> (UINT(10), maxuint);
- r0.invert ();
- ASSERT_TRUE (r0 == int_range<1> (UINT (0), UINT (9)));
-
- // Check that ~[0,5] => [6,MAX] for unsigned 128-bit numbers.
- r0 = int_range<1> (UINT128 (0), UINT128 (5), VR_ANTI_RANGE);
- r1 = int_range<1> (UINT128(6), build_minus_one_cst (u128_type));
- ASSERT_TRUE (r0 == r1);
-
- // Check that [~5] is really [-MIN,4][6,MAX].
- r0 = int_range<1> (INT (5), INT (5), VR_ANTI_RANGE);
- r1 = int_range<1> (minint, INT (4));
- r1.union_ (int_range<1> (INT (6), maxint));
- ASSERT_FALSE (r1.undefined_p ());
- ASSERT_TRUE (r0 == r1);
-
- r1 = int_range<1> (INT (5), INT (5));
- int_range<1> r2 (r1);
- ASSERT_TRUE (r1 == r2);
-
- r1 = int_range<1> (INT (5), INT (10));
-
- r1 = int_range<1> (integer_type_node,
- wi::to_wide (INT (5)), wi::to_wide (INT (10)));
- ASSERT_TRUE (r1.contains_p (INT (7)));
-
- r1 = int_range<1> (SCHAR (0), SCHAR (20));
- ASSERT_TRUE (r1.contains_p (SCHAR(15)));
- ASSERT_FALSE (r1.contains_p (SCHAR(300)));
-
- // If a range is in any way outside of the range for the converted
- // to range, default to the range for the new type.
if (TYPE_PRECISION (TREE_TYPE (maxint))
> TYPE_PRECISION (short_integer_type_node))
{
@@ -3829,25 +3472,6 @@ range_tests ()
TYPE_MAX_VALUE (short_unsigned_type_node));
ASSERT_TRUE (r0 == r1);
- // NOT([10,20]) ==> [-MIN,9][21,MAX].
- r0 = r1 = int_range<1> (INT (10), INT (20));
- r2 = int_range<1> (minint, INT(9));
- r2.union_ (int_range<1> (INT(21), maxint));
- ASSERT_FALSE (r2.undefined_p ());
- r1.invert ();
- ASSERT_TRUE (r1 == r2);
- // Test that NOT(NOT(x)) == x.
- r2.invert ();
- ASSERT_TRUE (r0 == r2);
-
- // Test that booleans and their inverse work as expected.
- r0 = range_zero (boolean_type_node);
- ASSERT_TRUE (r0 == int_range<1> (build_zero_cst (boolean_type_node),
- build_zero_cst (boolean_type_node)));
- r0.invert ();
- ASSERT_TRUE (r0 == int_range<1> (build_one_cst (boolean_type_node),
- build_one_cst (boolean_type_node)));
-
// Casting NONZERO to a narrower type will wrap/overflow so
// it's just the entire range for the narrower type.
//
@@ -3874,84 +3498,153 @@ range_tests ()
r2 = int_range<1> (INT (1), INT (32767));
r1.union_ (r2);
ASSERT_TRUE (r0 == r1);
+}
- // Make sure NULL and non-NULL of pointer types work, and that
- // inverses of them are consistent.
- tree voidp = build_pointer_type (void_type_node);
- r0 = range_zero (voidp);
- r1 = r0;
- r0.invert ();
- r0.invert ();
- ASSERT_TRUE (r0 == r1);
+static void
+range_op_lshift_tests ()
+{
+ // Test that 0x808.... & 0x8.... still contains 0x8....
+ // for a large set of numbers.
+ {
+ int_range_max res;
+ tree big_type = long_long_unsigned_type_node;
+ // big_num = 0x808,0000,0000,0000
+ tree big_num = fold_build2 (LSHIFT_EXPR, big_type,
+ build_int_cst (big_type, 0x808),
+ build_int_cst (big_type, 48));
+ op_bitwise_and.fold_range (res, big_type,
+ int_range <1> (big_type),
+ int_range <1> (big_num, big_num));
+ // val = 0x8,0000,0000,0000
+ tree val = fold_build2 (LSHIFT_EXPR, big_type,
+ build_int_cst (big_type, 0x8),
+ build_int_cst (big_type, 48));
+ ASSERT_TRUE (res.contains_p (val));
+ }
- // [10,20] U [15, 30] => [10, 30].
- r0 = int_range<1> (INT (10), INT (20));
- r1 = int_range<1> (INT (15), INT (30));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == int_range<1> (INT (10), INT (30)));
-
- // [15,40] U [] => [15,40].
- r0 = int_range<1> (INT (15), INT (40));
- r1.set_undefined ();
- r0.union_ (r1);
- ASSERT_TRUE (r0 == int_range<1> (INT (15), INT (40)));
-
- // [10,20] U [10,10] => [10,20].
- r0 = int_range<1> (INT (10), INT (20));
- r1 = int_range<1> (INT (10), INT (10));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == int_range<1> (INT (10), INT (20)));
-
- // [10,20] U [9,9] => [9,20].
- r0 = int_range<1> (INT (10), INT (20));
- r1 = int_range<1> (INT (9), INT (9));
- r0.union_ (r1);
- ASSERT_TRUE (r0 == int_range<1> (INT (9), INT (20)));
-
- // [10,20] ^ [15,30] => [15,20].
- r0 = int_range<1> (INT (10), INT (20));
- r1 = int_range<1> (INT (15), INT (30));
- r0.intersect (r1);
- ASSERT_TRUE (r0 == int_range<1> (INT (15), INT (20)));
-
- // Test the internal sanity of wide_int's wrt HWIs.
- ASSERT_TRUE (wi::max_value (TYPE_PRECISION (boolean_type_node),
- TYPE_SIGN (boolean_type_node))
- == wi::uhwi (1, TYPE_PRECISION (boolean_type_node)));
-
- // Test zero_p().
- r0 = int_range<1> (INT (0), INT (0));
- ASSERT_TRUE (r0.zero_p ());
-
- // Test nonzero_p().
- r0 = int_range<1> (INT (0), INT (0));
- 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 ();
+ 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);
+ }
+}
+
+static void
+range_op_rshift_tests ()
+{
+ // unsigned: [3, MAX] = OP1 >> 1
+ {
+ int_range_max lhs (build_int_cst (unsigned_type_node, 3),
+ TYPE_MAX_VALUE (unsigned_type_node));
+ int_range_max one (build_one_cst (unsigned_type_node),
+ build_one_cst (unsigned_type_node));
+ int_range_max op1;
+ op_rshift.op1_range (op1, unsigned_type_node, lhs, one);
+ ASSERT_FALSE (op1.contains_p (UINT (3)));
+ }
+
+ // signed: [3, MAX] = OP1 >> 1
+ {
+ int_range_max lhs (INT (3), TYPE_MAX_VALUE (integer_type_node));
+ int_range_max one (INT (1), INT (1));
+ int_range_max op1;
+ op_rshift.op1_range (op1, integer_type_node, lhs, one);
+ ASSERT_FALSE (op1.contains_p (INT (-2)));
+ }
+
+ // This is impossible, so OP1 should be [].
+ // signed: [MIN, MIN] = OP1 >> 1
+ {
+ int_range_max lhs (TYPE_MIN_VALUE (integer_type_node),
+ TYPE_MIN_VALUE (integer_type_node));
+ int_range_max one (INT (1), INT (1));
+ int_range_max op1;
+ op_rshift.op1_range (op1, integer_type_node, lhs, one);
+ ASSERT_TRUE (op1.undefined_p ());
+ }
+
+ // signed: ~[-1] = OP1 >> 31
+ if (TYPE_PRECISION (integer_type_node) > 31)
+ {
+ int_range_max lhs (INT (-1), INT (-1), VR_ANTI_RANGE);
+ int_range_max shift (INT (31), INT (31));
+ int_range_max op1;
+ op_rshift.op1_range (op1, integer_type_node, lhs, shift);
+ int_range_max negatives = range_negatives (integer_type_node);
+ negatives.intersect (op1);
+ ASSERT_TRUE (negatives.undefined_p ());
+ }
+}
+
+static void
+range_op_bitwise_and_tests ()
+{
+ int_range_max res;
+ tree min = vrp_val_min (integer_type_node);
+ tree max = vrp_val_max (integer_type_node);
+ tree tiny = fold_build2 (PLUS_EXPR, integer_type_node, min,
+ build_one_cst (integer_type_node));
+ int_range_max i1 (tiny, max);
+ int_range_max i2 (build_int_cst (integer_type_node, 255),
+ build_int_cst (integer_type_node, 255));
+
+ // [MIN+1, MAX] = OP1 & 255: OP1 is VARYING
+ op_bitwise_and.op1_range (res, integer_type_node, i1, i2);
+ ASSERT_TRUE (res == int_range<1> (integer_type_node));
+
+ // VARYING = OP1 & 255: OP1 is VARYING
+ i1 = int_range<1> (integer_type_node);
+ op_bitwise_and.op1_range (res, integer_type_node, i1, i2);
+ ASSERT_TRUE (res == int_range<1> (integer_type_node));
+}
+
+void
+range_op_tests ()
+{
+ range_op_rshift_tests ();
+ range_op_lshift_tests ();
+ range_op_bitwise_and_tests ();
+ range_op_cast_tests ();
}
} // namespace selftest
diff --git a/gcc/recog.c b/gcc/recog.c
index ce83b7f..6d8b7d5 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -922,7 +922,23 @@ validate_simplify_insn (rtx_insn *insn)
}
return ((num_changes_pending () > 0) && (apply_change_group () > 0));
}
-
+
+/* Check whether INSN matches a specific alternative of an .md pattern. */
+
+bool
+valid_insn_p (rtx_insn *insn)
+{
+ recog_memoized (insn);
+ if (INSN_CODE (insn) < 0)
+ return false;
+ extract_insn (insn);
+ /* We don't know whether the insn will be in code that is optimized
+ for size or speed, so consider all enabled alternatives. */
+ if (!constrain_operands (1, get_enabled_alternatives (insn)))
+ return false;
+ return true;
+}
+
/* Return 1 if OP is a valid general operand for machine mode MODE.
This is either a register reference, a memory reference,
or a constant. In the case of a memory reference, the address
@@ -1778,6 +1794,7 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
/* FALLTHRU */
default:
cn = lookup_constraint (constraint);
+ rtx mem = NULL;
switch (get_constraint_type (cn))
{
case CT_REGISTER:
@@ -1796,9 +1813,13 @@ asm_operand_ok (rtx op, const char *constraint, const char **constraints)
break;
case CT_MEMORY:
+ mem = op;
+ /* Fall through. */
case CT_SPECIAL_MEMORY:
/* Every memory operand can be reloaded to fit. */
- result = result || memory_operand (op, VOIDmode);
+ if (!mem)
+ mem = extract_mem_from_operand (op);
+ result = result || memory_operand (mem, VOIDmode);
break;
case CT_ADDRESS:
@@ -2584,7 +2605,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/recog.h b/gcc/recog.h
index ae3675f..d87456c 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -113,6 +113,7 @@ extern void validate_replace_src_group (rtx, rtx, rtx_insn *);
extern bool validate_simplify_insn (rtx_insn *insn);
extern int num_changes_pending (void);
extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
+extern bool valid_insn_p (rtx_insn *);
extern int offsettable_memref_p (rtx);
extern int offsettable_nonstrict_memref_p (rtx);
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/resource.c b/gcc/resource.c
index 0a9d594..90cf091 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1186,7 +1186,7 @@ init_resource_info (rtx_insn *epilogue_insn)
&end_of_function_needs, true);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i] || EPILOGUE_USES (i))
+ if (global_regs[i] || df_epilogue_uses_p (i))
SET_HARD_REG_BIT (end_of_function_needs.regs, i);
/* The registers required to be live at the end of the function are
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/sbitmap.c b/gcc/sbitmap.c
index 292e7ee..3a43fe35 100644
--- a/gcc/sbitmap.c
+++ b/gcc/sbitmap.c
@@ -139,7 +139,8 @@ sbitmap_realloc (sbitmap src, unsigned int n_elms)
sbitmap *
sbitmap_vector_alloc (unsigned int n_vecs, unsigned int n_elms)
{
- unsigned int i, bytes, offset, elm_bytes, size, amt, vector_bytes;
+ unsigned int i, size;
+ size_t amt, bytes, vector_bytes, elm_bytes, offset;
sbitmap *bitmap_vector;
size = SBITMAP_SET_SIZE (n_elms);
diff --git a/gcc/selftest.h b/gcc/selftest.h
index 6c6c7f2..963e074 100644
--- a/gcc/selftest.h
+++ b/gcc/selftest.h
@@ -248,6 +248,7 @@ extern void ordered_hash_map_tests_cc_tests ();
extern void predict_c_tests ();
extern void pretty_print_c_tests ();
extern void range_tests ();
+extern void range_op_tests ();
extern void read_rtl_function_c_tests ();
extern void rtl_tests_c_tests ();
extern void sbitmap_c_tests ();
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/symbol-summary.h b/gcc/symbol-summary.h
index a38eb1d..3944f11 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -28,31 +28,75 @@ class function_summary_base
{
public:
/* Default construction takes SYMTAB as an argument. */
- function_summary_base (symbol_table *symtab CXX_MEM_STAT_INFO):
- m_symtab (symtab),
- m_insertion_enabled (true),
+ function_summary_base (symbol_table *symtab,
+ cgraph_node_hook symtab_insertion,
+ cgraph_node_hook symtab_removal,
+ cgraph_2node_hook symtab_duplication
+ CXX_MEM_STAT_INFO):
+ m_symtab (symtab), m_symtab_insertion (symtab_insertion),
+ m_symtab_removal (symtab_removal),
+ m_symtab_duplication (symtab_duplication),
+ m_symtab_insertion_hook (NULL), m_symtab_duplication_hook (NULL),
m_allocator ("function summary" PASS_MEM_STAT)
- {}
+ {
+ enable_insertion_hook ();
+ m_symtab_removal_hook
+ = m_symtab->add_cgraph_removal_hook (m_symtab_removal, this);
+ enable_duplication_hook ();
+ }
/* Basic implementation of insert operation. */
- virtual void insert (cgraph_node *, T *) {}
+ virtual void insert (cgraph_node *, T *)
+ {
+ /* In most cases, it makes no sense to create summaries without
+ initializing them. */
+ gcc_unreachable ();
+ }
/* Basic implementation of removal operation. */
virtual void remove (cgraph_node *, T *) {}
/* Basic implementation of duplication operation. */
- virtual void duplicate (cgraph_node *, cgraph_node *, T *, T *) {}
+ virtual void duplicate (cgraph_node *, cgraph_node *, T *, T *)
+ {
+ /* It makes no sense to not copy anything during duplication. */
+ gcc_unreachable ();
+ }
/* Enable insertion hook invocation. */
void enable_insertion_hook ()
{
- m_insertion_enabled = true;
+ if (m_symtab_insertion_hook == NULL)
+ m_symtab_insertion_hook
+ = m_symtab->add_cgraph_insertion_hook (m_symtab_insertion, this);
}
/* Enable insertion hook invocation. */
void disable_insertion_hook ()
{
- m_insertion_enabled = false;
+ if (m_symtab_insertion_hook != NULL)
+ {
+ m_symtab->remove_cgraph_insertion_hook (m_symtab_insertion_hook);
+ m_symtab_insertion_hook = NULL;
+ }
+ }
+
+ /* Enable duplication hook invocation. */
+ void enable_duplication_hook ()
+ {
+ if (m_symtab_duplication_hook == NULL)
+ m_symtab_duplication_hook
+ = m_symtab->add_cgraph_duplication_hook (m_symtab_duplication, this);
+ }
+
+ /* Enable duplication hook invocation. */
+ void disable_duplication_hook ()
+ {
+ if (m_symtab_duplication_hook != NULL)
+ {
+ m_symtab->remove_cgraph_duplication_hook (m_symtab_duplication_hook);
+ m_symtab_duplication_hook = NULL;
+ }
}
protected:
@@ -77,17 +121,22 @@ protected:
/* Unregister all call-graph hooks. */
void unregister_hooks ();
+ /* Symbol table the summary is registered to. */
+ symbol_table *m_symtab;
+
+ /* Insertion function defined by a summary. */
+ cgraph_node_hook m_symtab_insertion;
+ /* Removal function defined by a summary. */
+ cgraph_node_hook m_symtab_removal;
+ /* Duplication function defined by a summary. */
+ cgraph_2node_hook m_symtab_duplication;
+
/* Internal summary insertion hook pointer. */
cgraph_node_hook_list *m_symtab_insertion_hook;
/* Internal summary removal hook pointer. */
cgraph_node_hook_list *m_symtab_removal_hook;
/* Internal summary duplication hook pointer. */
cgraph_2node_hook_list *m_symtab_duplication_hook;
- /* Symbol table the summary is registered to. */
- symbol_table *m_symtab;
-
- /* Indicates if insertion hook is enabled. */
- bool m_insertion_enabled;
private:
/* Return true when the summary uses GGC memory for allocation. */
@@ -101,9 +150,9 @@ template <typename T>
void
function_summary_base<T>::unregister_hooks ()
{
- m_symtab->remove_cgraph_insertion_hook (m_symtab_insertion_hook);
+ disable_insertion_hook ();
m_symtab->remove_cgraph_removal_hook (m_symtab_removal_hook);
- m_symtab->remove_cgraph_duplication_hook (m_symtab_duplication_hook);
+ disable_duplication_hook ();
}
/* We want to pass just pointer types as argument for function_summary
@@ -218,19 +267,11 @@ private:
template <typename T>
function_summary<T *>::function_summary (symbol_table *symtab, bool ggc
MEM_STAT_DECL):
- function_summary_base<T> (symtab PASS_MEM_STAT), m_ggc (ggc),
- m_map (13, ggc, true, GATHER_STATISTICS PASS_MEM_STAT)
-{
- this->m_symtab_insertion_hook
- = this->m_symtab->add_cgraph_insertion_hook (function_summary::symtab_insertion,
- this);
- this->m_symtab_removal_hook
- = this->m_symtab->add_cgraph_removal_hook (function_summary::symtab_removal,
- this);
- this->m_symtab_duplication_hook
- = this->m_symtab->add_cgraph_duplication_hook (function_summary::symtab_duplication,
- this);
-}
+ function_summary_base<T> (symtab, function_summary::symtab_insertion,
+ function_summary::symtab_removal,
+ function_summary::symtab_duplication
+ PASS_MEM_STAT),
+ m_ggc (ggc), m_map (13, ggc, true, GATHER_STATISTICS PASS_MEM_STAT) {}
template <typename T>
function_summary<T *>::~function_summary ()
@@ -249,9 +290,7 @@ function_summary<T *>::symtab_insertion (cgraph_node *node, void *data)
{
gcc_checking_assert (node->get_uid ());
function_summary *summary = (function_summary <T *> *) (data);
-
- if (summary->m_insertion_enabled)
- summary->insert (node, summary->get_create (node));
+ summary->insert (node, summary->get_create (node));
}
template <typename T>
@@ -412,19 +451,15 @@ private:
};
template <typename T, typename V>
-fast_function_summary<T *, V>::fast_function_summary (symbol_table *symtab MEM_STAT_DECL):
- function_summary_base<T> (symtab PASS_MEM_STAT), m_vector (NULL)
+fast_function_summary<T *, V>::fast_function_summary (symbol_table *symtab
+ MEM_STAT_DECL):
+ function_summary_base<T> (symtab,
+ fast_function_summary::symtab_insertion,
+ fast_function_summary::symtab_removal,
+ fast_function_summary::symtab_duplication
+ PASS_MEM_STAT), m_vector (NULL)
{
vec_alloc (m_vector, 13 PASS_MEM_STAT);
- this->m_symtab_insertion_hook
- = this->m_symtab->add_cgraph_insertion_hook (fast_function_summary::symtab_insertion,
- this);
- this->m_symtab_removal_hook
- = this->m_symtab->add_cgraph_removal_hook (fast_function_summary::symtab_removal,
- this);
- this->m_symtab_duplication_hook
- = this->m_symtab->add_cgraph_duplication_hook (fast_function_summary::symtab_duplication,
- this);
}
template <typename T, typename V>
@@ -445,9 +480,7 @@ fast_function_summary<T *, V>::symtab_insertion (cgraph_node *node, void *data)
{
gcc_checking_assert (node->get_uid ());
fast_function_summary *summary = (fast_function_summary <T *, V> *) (data);
-
- if (summary->m_insertion_enabled)
- summary->insert (node, summary->get_create (node));
+ summary->insert (node, summary->get_create (node));
}
template <typename T, typename V>
@@ -533,17 +566,45 @@ class call_summary_base
{
public:
/* Default construction takes SYMTAB as an argument. */
- call_summary_base (symbol_table *symtab CXX_MEM_STAT_INFO):
- m_symtab (symtab),
+ call_summary_base (symbol_table *symtab, cgraph_edge_hook symtab_removal,
+ cgraph_2edge_hook symtab_duplication CXX_MEM_STAT_INFO):
+ m_symtab (symtab), m_symtab_removal (symtab_removal),
+ m_symtab_duplication (symtab_duplication), m_symtab_duplication_hook (NULL),
m_initialize_when_cloning (false),
m_allocator ("call summary" PASS_MEM_STAT)
- {}
+ {
+ m_symtab_removal_hook
+ = m_symtab->add_edge_removal_hook (m_symtab_removal, this);
+ enable_duplication_hook ();
+ }
/* Basic implementation of removal operation. */
virtual void remove (cgraph_edge *, T *) {}
/* Basic implementation of duplication operation. */
- virtual void duplicate (cgraph_edge *, cgraph_edge *, T *, T *) {}
+ virtual void duplicate (cgraph_edge *, cgraph_edge *, T *, T *)
+ {
+ gcc_unreachable ();
+ }
+
+ /* Enable duplication hook invocation. */
+ void enable_duplication_hook ()
+ {
+ if (m_symtab_duplication_hook == NULL)
+ m_symtab_duplication_hook
+ = m_symtab->add_edge_duplication_hook (m_symtab_duplication,
+ this);
+ }
+
+ /* Enable duplication hook invocation. */
+ void disable_duplication_hook ()
+ {
+ if (m_symtab_duplication_hook != NULL)
+ {
+ m_symtab->remove_edge_duplication_hook (m_symtab_duplication_hook);
+ m_symtab_duplication_hook = NULL;
+ }
+ }
protected:
/* Allocates new data that are stored within map. */
@@ -570,6 +631,11 @@ protected:
/* Symbol table the summary is registered to. */
symbol_table *m_symtab;
+ /* Removal function defined by a summary. */
+ cgraph_edge_hook m_symtab_removal;
+ /* Duplication function defined by a summary. */
+ cgraph_2edge_hook m_symtab_duplication;
+
/* Internal summary removal hook pointer. */
cgraph_edge_hook_list *m_symtab_removal_hook;
/* Internal summary duplication hook pointer. */
@@ -590,7 +656,7 @@ void
call_summary_base<T>::unregister_hooks ()
{
m_symtab->remove_edge_removal_hook (m_symtab_removal_hook);
- m_symtab->remove_edge_duplication_hook (m_symtab_duplication_hook);
+ disable_duplication_hook ();
}
/* An impossible class templated by non-pointers so, which makes sure that only
@@ -612,16 +678,9 @@ public:
/* Default construction takes SYMTAB as an argument. */
call_summary (symbol_table *symtab, bool ggc = false
CXX_MEM_STAT_INFO)
- : call_summary_base<T> (symtab PASS_MEM_STAT), m_ggc (ggc),
- m_map (13, ggc, true, GATHER_STATISTICS PASS_MEM_STAT)
- {
- this->m_symtab_removal_hook
- = this->m_symtab->add_edge_removal_hook (call_summary::symtab_removal,
- this);
- this->m_symtab_duplication_hook
- = this->m_symtab->add_edge_duplication_hook (call_summary::symtab_duplication,
- this);
- }
+ : call_summary_base<T> (symtab, call_summary::symtab_removal,
+ call_summary::symtab_duplication PASS_MEM_STAT),
+ m_ggc (ggc), m_map (13, ggc, true, GATHER_STATISTICS PASS_MEM_STAT) {}
/* Destructor. */
virtual ~call_summary ();
@@ -779,15 +838,11 @@ class GTY((user)) fast_call_summary <T *, V>: public call_summary_base<T>
public:
/* Default construction takes SYMTAB as an argument. */
fast_call_summary (symbol_table *symtab CXX_MEM_STAT_INFO)
- : call_summary_base<T> (symtab PASS_MEM_STAT), m_vector (NULL)
+ : call_summary_base<T> (symtab, fast_call_summary::symtab_removal,
+ fast_call_summary::symtab_duplication PASS_MEM_STAT),
+ m_vector (NULL)
{
vec_alloc (m_vector, 13 PASS_MEM_STAT);
- this->m_symtab_removal_hook
- = this->m_symtab->add_edge_removal_hook (fast_call_summary::symtab_removal,
- this);
- this->m_symtab_duplication_hook
- = this->m_symtab->add_edge_duplication_hook (fast_call_summary::symtab_duplication,
- this);
}
/* Destructor. */
diff --git a/gcc/symtab-clones.cc b/gcc/symtab-clones.cc
new file mode 100644
index 0000000..ad154f6
--- /dev/null
+++ b/gcc/symtab-clones.cc
@@ -0,0 +1,62 @@
+/* Support for virtual clones 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-clones.h"
+#include "lto-streamer.h"
+#include "data-streamer.h"
+
+namespace {
+
+/* Function summary for clone_infos. */
+class GTY((user)) clone_infos_t: public function_summary <clone_info *>
+{
+public:
+ clone_infos_t (symbol_table *table, bool ggc):
+ function_summary<clone_info *> (table, ggc) { }
+};
+
+} /* anon namespace */
+
+/* Return thunk_info possibly creating new one. */
+clone_info *
+clone_info::get_create (cgraph_node *node)
+{
+ if (!symtab->m_clones)
+ {
+ symtab->m_clones
+ = new (ggc_alloc_no_dtor <function_summary <clone_info *>> ())
+ function_summary <clone_info *> (symtab, true);
+ symtab->m_clones->disable_insertion_hook ();
+ symtab->m_clones->disable_duplication_hook ();
+ }
+ return symtab->m_clones->get_create (node);
+}
diff --git a/gcc/symtab-clones.h b/gcc/symtab-clones.h
new file mode 100644
index 0000000..a34fe21
--- /dev/null
+++ b/gcc/symtab-clones.h
@@ -0,0 +1,90 @@
+/* Representation of adjustment made to virtual clones in the 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_CLONES_H
+#define GCC_SYMTAB_CLONES_H
+
+struct GTY(()) clone_info
+{
+ /* Constructor. */
+ clone_info ()
+ : tree_map (NULL),
+ param_adjustments (NULL),
+ performed_splits (NULL)
+ {
+ }
+ /* Constants discovered by IPA-CP, i.e. which parameter should be replaced
+ with what. */
+ vec<ipa_replace_map *, va_gc> *tree_map;
+ /* Parameter modification that IPA-SRA decided to perform. */
+ ipa_param_adjustments *param_adjustments;
+ /* Lists of dummy-decl and offset pairs representing split formal parameters
+ in the caller. Offsets of all new replacements are enumerated, those
+ coming from the same original parameter have the same dummy decl stored
+ along with them.
+
+ Dummy decls sit in call statement arguments followed by new parameter
+ decls (or their SSA names) in between (caller) clone materialization and
+ call redirection. Redirection then recognizes the dummy variable and
+ together with the stored offsets can reconstruct what exactly the new
+ parameter decls represent and can leave in place only those that the
+ callee expects. */
+ vec<ipa_param_performed_split, va_gc> *performed_splits;
+
+ /* Return clone_info, if available. */
+ static clone_info *get (cgraph_node *node);
+
+ /* Return clone_info possibly creating new one. */
+ static clone_info *get_create (cgraph_node *node);
+
+ /* Remove clone_info. */
+ static void remove (cgraph_node *node);
+
+ /* Release all clone_infos. */
+ static void release (void);
+};
+
+/* Return clone_info, if available. */
+inline clone_info *
+clone_info::get (cgraph_node *node)
+{
+ if (!symtab->m_clones)
+ return NULL;
+ return symtab->m_clones->get (node);
+}
+
+
+/* Remove clone_info association for NODE. */
+inline void
+clone_info::remove (cgraph_node *node)
+{
+ symtab->m_clones->remove (node);
+}
+
+/* Free clone info summaries. */
+inline void
+clone_info::release ()
+{
+ if (symtab->m_clones)
+ delete (symtab->m_clones);
+ symtab->m_clones = NULL;
+}
+
+#endif /* GCC_SYMTAB_CLONES_H */
diff --git a/gcc/symtab-thunks.cc b/gcc/symtab-thunks.cc
new file mode 100644
index 0000000..2199f4e
--- /dev/null
+++ b/gcc/symtab-thunks.cc
@@ -0,0 +1,674 @@
+/* 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;
+struct GTY (()) unprocessed_thunk
+{
+ cgraph_node *node;
+ thunk_info *info;
+};
+/* To be PCH safe we store thunks into a vector before end of compilation
+ unit. */
+static GTY (()) vec<unprocessed_thunk, va_gc> *thunks;
+
+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 ();
+}
+
+/* Add unprocessed thunk. */
+void
+thunk_info::register_early (cgraph_node *node)
+{
+ unprocessed_thunk entry = {node, new (ggc_alloc <thunk_info> ()) thunk_info};
+ *entry.info = *this;
+ vec_safe_push (thunks, entry);
+}
+
+/* Attach recorded thunks to cgraph_nodes.
+ All this is done only to avoid need to stream summaries to PCH. */
+void
+thunk_info::process_early_thunks ()
+{
+ unprocessed_thunk *e;
+ unsigned int i;
+ if (!thunks)
+ return;
+
+ FOR_EACH_VEC_ELT (*thunks, i, e)
+ {
+ *thunk_info::get_create (e->node) = *e->info;
+ }
+ vec_free (thunks);
+ thunks = NULL;
+}
+
+/* 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..41a6849
--- /dev/null
+++ b/gcc/symtab-thunks.h
@@ -0,0 +1,173 @@
+/* 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;
+ alias = other.alias;
+ 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);
+
+ /* Add unprocessed thunk. */
+ void register_early (cgraph_node *node);
+
+ /* Attach recorded thunks to cgraph_nodes. */
+ static void process_early_thunks ();
+
+ /* 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..58b14f3 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -408,10 +408,11 @@ symtab_node::remove_from_same_comdat_group (void)
}
/* Remove node from symbol table. This function is not used directly, but via
- cgraph/varpool node removal routines. */
+ cgraph/varpool node removal routines.
+ INFO is a clone info to attach to new root of clone tree (if any). */
void
-symtab_node::unregister (void)
+symtab_node::unregister (clone_info *info)
{
remove_all_references ();
remove_all_referring ();
@@ -430,7 +431,7 @@ symtab_node::unregister (void)
{
symtab_node *replacement_node = NULL;
if (cgraph_node *cnode = dyn_cast <cgraph_node *> (this))
- replacement_node = cnode->find_replacement ();
+ replacement_node = cnode->find_replacement (info);
decl->decl_with_vis.symtab_node = replacement_node;
}
if (!is_a <varpool_node *> (this) || !DECL_HARD_REGISTER (decl))
@@ -591,10 +592,9 @@ symtab_node::create_reference (symtab_node *referred_node,
gcc_checking_assert (use_type != IPA_REF_ALIAS || !stmt);
list = &ref_list;
- old_references = vec_safe_address (list->references);
- vec_safe_grow (list->references, vec_safe_length (list->references) + 1,
- true);
- ref = &list->references->last ();
+ old_references = list->references.address ();
+ list->references.safe_grow (list->references.length () + 1, false);
+ ref = &list->references.last ();
list2 = &referred_node->ref_list;
@@ -622,7 +622,7 @@ symtab_node::create_reference (symtab_node *referred_node,
ref->speculative = 0;
/* If vector was moved in memory, update pointers. */
- if (old_references != list->references->address ())
+ if (old_references != list->references.address ())
{
int i;
for (i = 0; iterate_reference(i, ref2); i++)
@@ -752,7 +752,8 @@ symtab_node::remove_stmt_references (gimple *stmt)
i++;
}
-/* Remove all stmt references in non-speculative references.
+/* Remove all stmt references in non-speculative references in THIS
+ and all clones.
Those are not maintained during inlining & cloning.
The exception are speculative references that are updated along
with callgraph edges associated with them. */
@@ -770,6 +771,13 @@ symtab_node::clear_stmts_in_references (void)
r->lto_stmt_uid = 0;
r->speculative_id = 0;
}
+ cgraph_node *cnode = dyn_cast <cgraph_node *> (this);
+ if (cnode)
+ {
+ if (cnode->clones)
+ for (cnode = cnode->clones; cnode; cnode = cnode->next_sibling_clone)
+ cnode->clear_stmts_in_references ();
+ }
}
/* Remove all references in ref list. */
@@ -777,9 +785,9 @@ symtab_node::clear_stmts_in_references (void)
void
symtab_node::remove_all_references (void)
{
- while (vec_safe_length (ref_list.references))
- ref_list.references->last ().remove_reference ();
- vec_free (ref_list.references);
+ while (ref_list.references.length ())
+ ref_list.references.last ().remove_reference ();
+ ref_list.references.release ();
}
/* Remove all referring items in ref list. */
@@ -1765,7 +1773,7 @@ symtab_node::resolve_alias (symtab_node *target, bool transparent)
{
symtab_node *n;
- gcc_assert (!analyzed && !vec_safe_length (ref_list.references));
+ gcc_assert (!analyzed && !ref_list.references.length ());
/* Never let cycles to creep into the symbol table alias references;
those will make alias walkers to be infinite. */
@@ -1998,7 +2006,7 @@ symtab_node::get_partitioning_class (void)
if (DECL_ABSTRACT_P (decl))
return SYMBOL_EXTERNAL;
- if (cnode && cnode->inlined_to)
+ if (cnode && (cnode->inlined_to || cnode->declare_variant_alt))
return SYMBOL_DUPLICATE;
/* Transparent aliases are always duplicated. */
@@ -2391,7 +2399,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/target.def b/gcc/target.def
index ed2da15..b916635 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5080,6 +5080,21 @@ argument list due to stack realignment. Return @code{NULL} if no DRAP\n\
is needed.",
rtx, (void), NULL)
+/* Generate instruction sequence to zero call used registers. */
+DEFHOOK
+(zero_call_used_regs,
+ "This target hook emits instructions to zero the subset of @var{selected_regs}\n\
+that could conceivably contain values that are useful to an attacker.\n\
+Return the set of registers that were actually cleared.\n\
+\n\
+The default implementation uses normal move instructions to zero\n\
+all the registers in @var{selected_regs}. Define this hook if the\n\
+target has more efficient ways of zeroing certain registers,\n\
+or if you believe that certain registers would never contain\n\
+values that are useful to an attacker.",
+ HARD_REG_SET, (HARD_REG_SET selected_regs),
+default_zero_call_used_regs)
+
/* Return true if all function parameters should be spilled to the
stack. */
DEFHOOK
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 5d94fce..5b68a2a 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -56,6 +56,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-alias.h"
#include "gimple-expr.h"
#include "memmodel.h"
+#include "backend.h"
+#include "emit-rtl.h"
+#include "df.h"
#include "tm_p.h"
#include "stringpool.h"
#include "tree-vrp.h"
@@ -987,6 +990,35 @@ default_function_value_regno_p (const unsigned int regno ATTRIBUTE_UNUSED)
#endif
}
+/* The default hook for TARGET_ZERO_CALL_USED_REGS. */
+
+HARD_REG_SET
+default_zero_call_used_regs (HARD_REG_SET need_zeroed_hardregs)
+{
+ gcc_assert (!hard_reg_set_empty_p (need_zeroed_hardregs));
+
+ for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (TEST_HARD_REG_BIT (need_zeroed_hardregs, regno))
+ {
+ rtx_insn *last_insn = get_last_insn ();
+ machine_mode mode = GET_MODE (regno_reg_rtx[regno]);
+ rtx zero = CONST0_RTX (mode);
+ rtx_insn *insn = emit_move_insn (regno_reg_rtx[regno], zero);
+ if (!valid_insn_p (insn))
+ {
+ static bool issued_error;
+ if (!issued_error)
+ {
+ issued_error = true;
+ sorry ("%qs not supported on this target",
+ "-fzero-call-used-regs");
+ }
+ delete_insns_since (last_insn);
+ }
+ }
+ return need_zeroed_hardregs;
+}
+
rtx
default_internal_arg_pointer (void)
{
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 44ab926..e0a925f 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -160,6 +160,7 @@ extern unsigned int default_function_arg_round_boundary (machine_mode,
const_tree);
extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
extern rtx default_function_value (const_tree, const_tree, bool);
+extern HARD_REG_SET default_zero_call_used_regs (HARD_REG_SET);
extern rtx default_libcall_value (machine_mode, const_rtx);
extern bool default_function_value_regno_p (const unsigned int);
extern rtx default_internal_arg_pointer (void);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 12c7d8f..7f89efa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,2462 @@
+2020-11-09 Marek Polacek <polacek@redhat.com>
+
+ DR 1914
+ * c-c++-common/attr-fallthrough-2.c: Adjust dg-warning.
+ * g++.dg/cpp0x/fallthrough2.C: Likewise.
+ * g++.dg/cpp0x/gen-attrs-60.C: Turn dg-error into dg-warning.
+ * g++.dg/cpp1y/attr-deprecated-2.C: Likewise.
+ * g++.dg/cpp2a/attr-likely2.C: Adjust dg-warning.
+ * g++.dg/cpp2a/nodiscard-once.C: Turn dg-error into dg-warning.
+ * g++.dg/cpp0x/gen-attrs-72.C: New test.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/cpp2a/concepts-decltype2.C: New file.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/93907
+ * g++.dg/cpp2a/concepts-using3.C: New test, based off of
+ concepts-using2.C.
+
+2020-11-09 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/lookup/using26.C: Adjust location.
+ * g++.old-deja/g++.other/using1.C: Adjust location.
+
+2020-11-09 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97762
+ * g++.dg/warn/Wvexing-parse8.C: New test.
+
+2020-11-09 Patrick Palka <ppalka@redhat.com>
+
+ * gcc.dg/pragma-diag-6.c: Adjust expected diagnostics
+ accordingly.
+
+2020-11-09 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/90111
+ * gfortran.dg/goacc/specification-part.f90: New test.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97761
+ * gfortran.dg/vect/pr97761.f90: New testcase.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97753
+ * gcc.dg/vect/pr97753.c: New testcase.
+
+2020-11-09 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97746
+ * gcc.dg/vect/bb-slp-pr97746.c: New testcase.
+
+2020-11-09 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/arm/simd/vld1_lane_bf16_1.c: Require target to
+ support and add -mfloat-abi=hard flag.
+ * gcc.target/arm/simd/vld1_lane_bf16_indices_1.c: Likewise.
+ * gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c: Likewise.
+ * gcc.target/arm/simd/vst1_lane_bf16_1.c: Likewise.
+ * gcc.target/arm/simd/vst1_lane_bf16_indices_1.c: Likewise.
+ * gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c: Likewise.
+
+2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/property/at-property-4.mm: Test handling class
+ attributes.
+ * objc.dg/property/at-property-4.m: Likewise.
+
+2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-c++-common/zero-scratch-regs-10.c: Skip for powerpc
+ Darwin.
+ * c-c++-common/zero-scratch-regs-11.c: Likewise.
+ * c-c++-common/zero-scratch-regs-8.c: Likewise.
+ * c-c++-common/zero-scratch-regs-9.c: Likewise.
+
+2020-11-08 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.target/i386/builtin_thread_pointer.c: Require native TLS.
+
+2020-11-07 Marek Polacek <polacek@redhat.com>
+
+ * c-c++-common/Wimplicit-fallthrough-20.c: Adjust dg-warning.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/property/at-property-4.mm: Test atomic property
+ attribute.
+ * objc.dg/property/at-property-4.m: Likewise.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/attributes/nsobject-01.mm: New test.
+ * objc.dg/attributes/nsobject-01.m: New test.
+
+2020-11-07 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c-c++-common/zero-scratch-regs-10.c: XFAIL for
+ powerpc-darwin.
+ * c-c++-common/zero-scratch-regs-11.c: Likewise.
+ * c-c++-common/zero-scratch-regs-8.c: Likewise.
+ * c-c++-common/zero-scratch-regs-9.c: Likewise.
+
+2020-11-07 Martin Uecker <muecker@gwdg.de>
+
+ * c-c++-common/attr-fallthrough-2.c: Update compiler flags.
+ * c-c++-common/Wimplicit-fallthrough-20.c: Adapt test.
+ * gcc.dg/20031223-1.c: Update compiler flags and adapt test.
+ * gcc.dg/c11-labels-1.c: New test.
+ * gcc.dg/c11-labels-2.c: New test.
+ * gcc.dg/c11-labels-3.c: New test.
+ * gcc.dg/c2x-attr-syntax-3.c: Adapt test.
+ * gcc.dg/c2x-labels-1.c: New test.
+ * gcc.dg/c2x-labels-2.c: New test.
+ * gcc.dg/c2x-labels-3.c: New test.
+ * gcc.dg/decl-9.c: Update compiler flags and add error.
+ * gcc.dg/gomp/barrier-2.c: Update compiler flags and add warning.
+ * gcc.dg/gomp/declare-simd-5.c: Update compiler flags and adapt test.
+ * gcc.dg/gomp/declare-variant-2.c: Update compiler flags and add error.
+ * gcc.dg/label-compound-stmt-1.c: Update compiler flags.
+ * gcc.dg/parse-decl-after-label.c: Update compiler flags.
+
+2020-11-06 Peter Bergner <bergner@linux.ibm.com>
+
+ * gcc.target/powerpc/pr64505.c: Run everywhere. Use correct minimized
+ test case.
+
+2020-11-06 Peter Bergner <bergner@linux.ibm.com>
+
+ * gcc.target/powerpc/mma-alignment.c: New test.
+
+2020-11-06 Jeff Law <law@torsion.usersys.redhat.com>
+
+ PR target/91489
+ * gcc.target/i386/ms_hook_prologue.c: Expand testcase
+ to reproduce PR target/91489 issue.
+
+2020-11-06 Joseph Myers <joseph@codesourcery.com>
+
+ * lib/target-supports.exp
+ (check_effective_target_fenv_exceptions_dfp): New.
+ * gcc.dg/dfp/builtin-snan-1.c, gcc.dg/dfp/builtin-snan-2.c: New
+ tests.
+
+2020-11-06 Marek Polacek <polacek@redhat.com>
+
+ PR c++/81660
+ * g++.dg/warn/Wexceptions3.C: New test.
+ * g++.dg/eh/pr42859.C: Add dg-warning.
+ * g++.dg/torture/pr81659.C: Likewise.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/property/at-property-1.mm: Adjust expected
+ diagnostics.
+ * obj-c++.dg/property/at-property-29.mm: Likewise.
+ * obj-c++.dg/property/at-property-4.mm: Likewise.
+ * obj-c++.dg/property/property-neg-2.mm: Likewise.
+ * objc.dg/property/at-property-1.m: Likewise.
+ * objc.dg/property/at-property-29.m: Likewise.
+ * objc.dg/property/at-property-4.m: Likewise.
+ * objc.dg/property/at-property-5.m: Likewise.
+ * objc.dg/property/property-neg-2.m: Likewise.
+
+2020-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/67453
+ * g++.dg/ext/attr-used-2.C: New test.
+
+2020-11-06 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.dg/darwin-minversion-link.c: Allow for Darwin19 (macOS 10.15)
+ and Darwin20 (macOS 11.0).
+
+2020-11-06 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97737.c: New.
+ * gcc.dg/pr97741.c: New.
+
+2020-11-06 David Candler <david.candler@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/vqrshrn_high_n.c: New testcase.
+ * gcc.target/aarch64/advsimd-intrinsics/vqrshrun_high_n.c: Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vqshrn_high_n.c: Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vqshrun_high_n.c: Likewise.
+ * gcc.target/aarch64/narrow_high-intrinsics.c: Update expected assembler
+ for sqshrun2, sqrshrun2, sqshrn2, uqshrn2, sqrshrn2 and uqrshrn2.
+
+2020-11-06 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.target/aarch64/sve/dup_lane_2.c: New test.
+ * gcc.target/aarch64/sve/dup_lane_3.c: Likewise.
+ * gcc.target/aarch64/sve/ext_4.c: Likewise.
+ * gcc.target/aarch64/sve/rev_2.c: Likewise.
+ * gcc.target/aarch64/sve/revhw_1.c: Likewise.
+ * gcc.target/aarch64/sve/revhw_2.c: Likewise.
+ * gcc.target/aarch64/sve/slp_perm_8.c: Likewise.
+ * gcc.target/aarch64/sve/trn1_2.c: Likewise.
+ * gcc.target/aarch64/sve/trn2_2.c: Likewise.
+ * gcc.target/aarch64/sve/uzp1_2.c: Likewise.
+ * gcc.target/aarch64/sve/uzp2_2.c: Likewise.
+ * gcc.target/aarch64/sve/zip1_2.c: Likewise.
+ * gcc.target/aarch64/sve/zip2_2.c: Likewise.
+
+2020-11-06 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/tree-ssa/switch-4.c: New test.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97706
+ * gcc.dg/vect/bb-slp-pr97706.c: New testcase.
+
+2020-11-06 Kewen Lin <linkw@linux.ibm.com>
+
+ PR gcov-profile/97461
+ * gcc.dg/tree-prof/pr97461.c: Return aligned memory.
+
+2020-11-06 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gfortran.dg/goacc/loop-2-parallel-3.f95: Adjust.
+
+2020-11-06 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gfortran.dg/goacc/loop-6.f95: Remove.
+
+2020-11-06 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gfortran.dg/goacc/loop-5.f95: Remove.
+
+2020-11-06 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/goacc-gomp/goacc-gomp.exp: New.
+ * gfortran.dg/goacc-gomp/atomic.f90: New test.
+ * gfortran.dg/goacc/atomic.f90: New test.
+
+2020-11-06 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-c++-common/goacc-gomp/atomic.c: New test.
+ * c-c++-common/goacc/atomic.c: New test.
+
+2020-11-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97732
+ * gcc.dg/vect/bb-slp-pr97732.c: New testcase.
+
+2020-11-06 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.target/i386/fentryname1.c: Add dg-require-profiling.
+ * gcc.target/i386/fentryname2.c: Likewise.
+ * gcc.target/i386/fentryname3.c: Likewise.
+ * gcc.target/i386/returninst1.c: Likewise.
+ * gcc.target/i386/returninst2.c: Likewise.
+ * gcc.target/i386/returninst3.c: Likewise.
+
+2020-11-06 Olivier Hainque <hainque@adacore.com>
+
+ * g++.dg/pr57878.C: Add dg-require-effective-target fpic.
+ * g++.dg/pr65032.C: Likewise.
+ * g++.dg/pr84279.C: Likewise.
+ * g++.dg/inherit/thunk8.C: Likewise.
+ * g++.dg/opt/pr64411.C: Likewise.
+
+2020-11-06 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/ipa/modref-2.c: New test.
+ * gcc.dg/lto/modref-2_0.c: New test.
+
+2020-11-06 Jeff Law <law@redhat.com>
+
+ * gcc.dg/no-strict-overflow-4.c: Adjust expected output.
+
+2020-11-06 Eugene Rozenfeld <erozen@microsoft.com>
+
+ * gcc.dg/self-right-shift.c: New test.
+
+2020-11-06 Kito Cheng <kito.cheng@sifive.com>
+
+ PR target/96307
+ * gcc.dg/pr96307.c: New.
+ * gcc.target/riscv/pr96260.c: Move this test case from here to ...
+ * gcc.dg/pr96260.c: ... here.
+ * gcc.target/riscv/pr91441.c: Move this test case from here to ...
+ * gcc.dg/pr91441.c: ... here.
+ * lib/target-supports.exp (check_effective_target_no_fsanitize_address):
+ New proc.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/78209
+ * g++.dg/cpp1y/decltype-auto1.C: New test.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97675
+ * g++.old-deja/g++.eh/catch10.C: Adjust dg-warning.
+ * g++.dg/warn/Wexceptions1.C: New test.
+ * g++.dg/warn/Wexceptions2.C: New test.
+
+2020-11-05 Marek Polacek <polacek@redhat.com>
+
+ PR c++/25814
+ * g++.dg/cpp2a/fn-template16.C: Add a dg-warning.
+ * g++.dg/cpp2a/fn-template7.C: Likewise.
+ * g++.dg/lookup/pr80891-5.C: Likewise.
+ * g++.dg/lto/pr79050_0.C: Add extern.
+ * g++.dg/lto/pr84805_0.C: Likewise.
+ * g++.dg/parse/pr58898.C: Add a dg-warning.
+ * g++.dg/template/scope5.C: Likewise.
+ * g++.old-deja/g++.brendan/recurse.C: Likewise.
+ * g++.old-deja/g++.jason/template4.C: Likewise.
+ * g++.old-deja/g++.law/arm4.C: Likewise.
+ * g++.old-deja/g++.mike/for2.C: Likewise.
+ * g++.old-deja/g++.other/local4.C: Likewise.
+ * g++.old-deja/g++.pt/crash3.C: Likewise.
+ * g++.dg/warn/Wvexing-parse.C: New test.
+ * g++.dg/warn/Wvexing-parse2.C: New test.
+ * g++.dg/warn/Wvexing-parse3.C: New test.
+ * g++.dg/warn/Wvexing-parse4.C: New test.
+ * g++.dg/warn/Wvexing-parse5.C: New test.
+ * g++.dg/warn/Wvexing-parse6.C: New test.
+ * g++.dg/warn/Wvexing-parse7.C: New test.
+
+2020-11-05 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97725.c: New.
+
+2020-11-05 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.dg/sms-12.c: Add dg-require-effective-target fpic.
+
+2020-11-05 Jan Hubicka <jh@suse.cz>
+
+ * g++.dg/ipa/devirt-24.C: Update template.
+
+2020-11-05 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.dg/vect/slp-11b.c: Guard statements.
+
+2020-11-05 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97721.c: New test.
+
+2020-11-05 qing zhao <qinzhao@gcc.gnu.org>
+
+ PR target/97715
+ * gcc.target/i386/zero-scratch-regs-32.c: New test.
+
+2020-11-05 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97668
+ * gcc.dg/analyzer/pr97668.c: New test.
+ * gfortran.dg/analyzer/pr97668.f: New test.
+
+2020-11-05 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-69.c: New testcase.
+
+2020-11-05 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.dg/vect/slp-11b.c: Update testcase.
+ * gcc.dg/vect/slp-perm-6.c: Update target selector.
+
+2020-11-05 Kewen Lin <linkw@linux.ibm.com>
+
+ PR target/96933
+ * gcc.target/powerpc/pr96933-1.c: New test.
+ * gcc.target/powerpc/pr96933-2.c: New test.
+ * gcc.target/powerpc/pr96933-3.c: New test.
+ * gcc.target/powerpc/pr96933-4.c: New test.
+ * gcc.target/powerpc/pr96933.h: New test.
+ * gcc.target/powerpc/pr96933-run.h: New test.
+
+2020-11-04 Tamar Christina <tamar.christina@arm.com>
+
+ * gcc.dg/vect/slp-11b.c: Update output scan.
+ * gcc.dg/vect/slp-perm-6.c: Likewise.
+
+2020-11-04 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97515.c: Check listing for folding of entire function.
+
+2020-11-04 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97709
+ * gcc.dg/vect/bb-slp-pr97709.c: New testcase.
+
+2020-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97690
+ * gcc.dg/tree-ssa/phi-opt-22.c: New test.
+ * gcc.dg/tree-ssa/ssa-ccp-11.c: Use -O2 instead of -O1.
+ * gcc.dg/vect/bb-slp-pattern-2.c (foo): Use ? 2 : 7, ? 4 : 7 and
+ ? 8 : 7 instead of ? 2 : 0, ? 4 : 0, ? 8 : 0.
+
+2020-11-04 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/pure-code/no-literal-pool-m0.c: Add dg-skip-if
+ and -mfloat-abi=soft option.
+ * gcc.target/arm/pure-code/no-literal-pool-m23.c: Likewise.
+
+2020-11-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97670
+ * c-c++-common/gomp/allocate-4.c: New test.
+ * g++.dg/gomp/allocate-2.C: New test.
+ * g++.dg/gomp/allocate-3.C: New test.
+
+2020-11-04 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c2x-attr-nodiscard-1.c, gcc.dg/c2x-attr-nodiscard-2.c,
+ gcc.dg/c2x-attr-nodiscard-3.c, gcc.dg/c2x-attr-nodiscard-4.c: New
+ tests.
+ * gcc.dg/c2x-attr-syntax-5.c: Remove nodiscard test.
+
+2020-11-04 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/pr97540.c: New test.
+
+2020-11-03 Jan Hubicka <jh@suse.cz>
+
+ * gcc.c-torture/execute/pr97695.c: New test.
+
+2020-11-03 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/Wclass-memaccess.C: Check that signed char and
+ char16_t aren't treated as byte-access types.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/pr92793-1.c: Extend.
+ * gfortran.dg/goacc/pr92793-1.f90: Likewise.
+
+2020-11-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/97663
+ * g++.dg/cpp1z/class-deduction75.C: New test.
+
+2020-11-03 Kamlesh Kumar <kamleshbhalui@gmail.com>
+
+ * g++.dg/DRs/dr2303.C: New test.
+
+2020-11-03 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.target/powerpc/pr67789.c: Add
+ dg-require-effective-target fpic.
+ * gcc.target/powerpc/pr83629.c: Likewise.
+ * gcc.target/powerpc/pr84112.c: Likewise. Remove
+ a superflous target test in the dg-do compile
+ directive while at it.
+
+2020-11-03 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_get.c: New test.
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c: New test.
+
+2020-11-03 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97632
+ * g++.dg/warn/Winit-list4.C: New test.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/vst2_lane_bf16_indices_1.c:
+ Run it also for arm-*-*.
+ * gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst3_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst4_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/arm/simd/vstn_lane_bf16_1.c: New test.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/vld2_lane_bf16_indices_1.c:
+ Run it also for the arm backend.
+ * gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld3_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld4_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/arm/simd/vldn_lane_bf16_1.c: New test.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/arm/simd/vst1_bf16_1.c: New test.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/arm/simd/vld1_bf16_1.c: New test.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/arm/simd/vst1_lane_bf16_1.c: New testcase.
+ * gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c: Likewise.
+ * gcc.target/arm/simd/vst1_lane_bf16_indices_1.c: Likewise.
+
+2020-11-03 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/arm/simd/vld1_lane_bf16_1.c: New testcase.
+ * gcc.target/arm/simd/vld1_lane_bf16_indices_1.c: Likewise.
+ * gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c: Likewise.
+
+2020-11-03 Dennis Zhang <dennis.zhang@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c
+ (test_vcvt_f32_bf16, test_vcvtq_low_f32_bf16): New tests.
+ (test_vcvtq_high_f32_bf16, test_vcvth_f32_bf16): Likewise.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80928
+ * gcc.dg/vect/vect-outer-slp-2.c: New testcase.
+ * gcc.dg/vect/vect-outer-slp-3.c: Likewise.
+
+2020-11-03 Uroš Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/zero-scratch-regs-1.c: Add ia32 target
+ selector where appropriate. Improve scan-assembler regexp.
+ * gcc.target/i386/zero-scratch-regs-2.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-3.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-4.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-5.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-6.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-7.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-8.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-9.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-10.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-13.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-14.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-15.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-16.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-17.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-18.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-19.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-20.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-21.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-22.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-23.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-24.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-25.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-26.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-27.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-28.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-29.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-30.c: Ditto.
+ * gcc.target/i386/zero-scratch-regs-31.c: Ditto.
+
+2020-11-03 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.dg/tree-ssa/pr71077.c: Add
+ dg-require-effective-target lto.
+
+2020-11-03 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.target/i386/pr45352-1.c: Add dg-require-effective-target fpic.
+ * gcc.target/i386/pr47602.c: Likewise.
+ * gcc.target/i386/pr55151.c: Likewise.
+ * gcc.target/i386/pr55458.c: Likewise.
+ * gcc.target/i386/pr56348.c: Likewise.
+ * gcc.target/i386/pr57097.c: Likewise.
+ * gcc.target/i386/pr65753.c: Likewise.
+ * gcc.target/i386/pr65915.c: Likewise.
+ * gcc.target/i386/pr66232-5.c: Likewise.
+ * gcc.target/i386/pr66334.c: Likewise.
+ * gcc.target/i386/pr66819-2.c: Likewise.
+ * gcc.target/i386/pr67265.c: Likewise.
+ * gcc.target/i386/pr81481.c: Likewise.
+ * gcc.target/i386/pr83994.c: Likewise.
+
+2020-11-03 Jan Hubicka <hubicka@ucw.cz>
+
+ * gcc.c-torture/compile/pr97578.c: New test.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR testsuite/97688
+ * gcc.dg/vect/tree-vect.h (check_vect): Fix the x86 cpuid
+ check to always specify subleaf zero.
+
+2020-11-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97678
+ * gcc.dg/vect/pr97678.c: New testcase.
+
+2020-11-03 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/attr_deprecated.f90: New test.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/nested-reductions-1-kernels.c: Extend.
+ * c-c++-common/goacc/nested-reductions-2-kernels.c: Likewise.
+ * gfortran.dg/goacc/nested-reductions-1-kernels.f90: Likewise.
+ * gfortran.dg/goacc/nested-reductions-2-kernels.f90: Likewise.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/nested-reductions.c: Split file into...
+ * c-c++-common/goacc/nested-reductions-1-kernels.c: ... this...
+ * c-c++-common/goacc/nested-reductions-1-parallel.c: ..., this...
+ * c-c++-common/goacc/nested-reductions-1-routine.c: ..., and this.
+ * c-c++-common/goacc/nested-reductions-warn.c: Split file into...
+ * c-c++-common/goacc/nested-reductions-2-kernels.c: ... this...
+ * c-c++-common/goacc/nested-reductions-2-parallel.c: ..., this...
+ * c-c++-common/goacc/nested-reductions-2-routine.c: ..., and this.
+ * gfortran.dg/goacc/nested-reductions.f90: Split file into...
+ * gfortran.dg/goacc/nested-reductions-1-kernels.f90: ... this...
+ * gfortran.dg/goacc/nested-reductions-1-parallel.f90: ..., this...
+ * gfortran.dg/goacc/nested-reductions-1-routine.f90: ..., and
+ this.
+ * gfortran.dg/goacc/nested-reductions-warn.f90: Split file into...
+ * gfortran.dg/goacc/nested-reductions-2-kernels.f90: ... this...
+ * gfortran.dg/goacc/nested-reductions-2-parallel.f90: ..., this...
+ * gfortran.dg/goacc/nested-reductions-2-routine.f90: ..., and
+ this.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR fortran/92793
+ * gfortran.dg/goacc/pr92793-1.f90: Adjust.
+
+2020-11-03 Thomas Schwinge <thomas@codesourcery.com>
+
+ * c-c++-common/goacc/pr92793-1.c: Extend.
+ * gfortran.dg/goacc/pr92793-1.f90: Likewise.
+
+2020-11-03 Kewen Lin <linkw@gcc.gnu.org>
+
+ PR tree-optimization/96789
+ * gcc.dg/tree-ssa/ssa-dse-28.c: Adjust.
+ * gcc.dg/tree-ssa/ssa-dse-29.c: Likewise.
+ * gcc.dg/vect/bb-slp-41.c: Likewise.
+ * gcc.dg/tree-ssa/pr96789.c: New test.
+
+2020-11-03 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR target/97205
+ * gcc.c-torture/compile/pr97205.c: New test.
+
+2020-11-02 Alan Modra <amodra@gmail.com>
+
+ PR middle-end/97267
+ * gcc.target/powerpc/pr97267.c: New test.
+
+2020-11-02 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/97140
+ * gcc.target/i386/pr97140.c: New test.
+
+2020-11-02 Patrick Palka <ppalka@redhat.com>
+
+ * g++.dg/cpp2a/concepts-complete1.C: Delete test that became
+ ill-formed after P2104.
+
+2020-11-02 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/bcd-2.c: Add include altivec.h.
+ * gcc.target/powerpc/bcd-3.c: Add include altivec.h.
+ * gcc.target/powerpc/bcd-4.c: New test.
+
+2020-11-02 Nathan Sidwell <nathan@acm.org>
+
+ * g++.dg/concepts/pack-1.C: New.
+ * g++.dg/lookup/using53.C: Add an enum.
+ * g++.dg/template/error25.C: Relax 'export' error check.
+
+2020-11-02 Sudakshina Das <sudi.das@arm.com>
+
+ PR target/97638
+ * gcc.target/aarch64/pr97638.c: New test.a
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/slp-49.c: New testcase.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/pure-code/no-literal-pool-m23.c: New.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gcc.target/arm/pure-code/no-literal-pool-m0.c: New.
+
+2020-11-02 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR fortran/92793
+ * gfortran.dg/goacc/pr92793-1.f90: Adjust.
+
+2020-11-02 Tobias Burnus <tobias@codesourcery.com>
+
+ PR fortran/97655
+ * gfortran.dg/gomp/atomic.f90: Update tree-dump counts; move
+ invalid OMP 5.0 code to ...
+ * gfortran.dg/gomp/atomic-2.f90: ... here; update dg-error.
+ * gfortran.dg/gomp/requires-9.f90: Update tree dump scan.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97558
+ * gcc.dg/vect/pr97558-2.c: New testcase.
+
+2020-11-02 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97505
+ * gcc.dg/pr97505.c: New test.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97558
+ * gcc.dg/vect/pr97558.c: New testcase.
+
+2020-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97650
+ * gcc.dg/vect/bb-slp-pr97650.c: New testcase.
+
+2020-11-02 Kito Cheng <kito.cheng@sifive.com>
+
+ * gcc.target/riscv/arch-7.c: New.
+ * gcc.target/riscv/attribute-10.c: Update test arch string.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96770
+ * gcc.target/arm/pure-code/pr96770.c: New test.
+
+2020-11-02 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR target/96967
+ * gcc.target/arm/pure-code/pr96767.c: New test.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/SEL-typedef.mm: New test.
+ * objc.dg/SEL-typedef.m: New test.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * obj-c++.dg/property/at-property-1.mm: Adjust test after
+ fixing spurious error output.
+
+2020-11-01 Iain Sandoe <iain@sandoe.co.uk>
+
+ * gcc.target/i386/amxbf16-asmintel-1.c: Require masm_intel.
+ * gcc.target/i386/amxint8-asmintel-1.c: Likewise.
+ * gcc.target/i386/amxtile-asmintel-1.c: Likewise.
+
+2020-10-30 Qing Zhao <qing.zhao@oracle.com>
+ H.J.Lu <hjl.tools@gmail.com>
+
+ * c-c++-common/zero-scratch-regs-1.c: New test.
+ * c-c++-common/zero-scratch-regs-10.c: New test.
+ * c-c++-common/zero-scratch-regs-11.c: New test.
+ * c-c++-common/zero-scratch-regs-2.c: New test.
+ * c-c++-common/zero-scratch-regs-3.c: New test.
+ * c-c++-common/zero-scratch-regs-4.c: New test.
+ * c-c++-common/zero-scratch-regs-5.c: New test.
+ * c-c++-common/zero-scratch-regs-6.c: New test.
+ * c-c++-common/zero-scratch-regs-7.c: New test.
+ * c-c++-common/zero-scratch-regs-8.c: New test.
+ * c-c++-common/zero-scratch-regs-9.c: New test.
+ * c-c++-common/zero-scratch-regs-attr-usages.c: New test.
+ * gcc.target/i386/zero-scratch-regs-1.c: New test.
+ * gcc.target/i386/zero-scratch-regs-10.c: New test.
+ * gcc.target/i386/zero-scratch-regs-11.c: New test.
+ * gcc.target/i386/zero-scratch-regs-12.c: New test.
+ * gcc.target/i386/zero-scratch-regs-13.c: New test.
+ * gcc.target/i386/zero-scratch-regs-14.c: New test.
+ * gcc.target/i386/zero-scratch-regs-15.c: New test.
+ * gcc.target/i386/zero-scratch-regs-16.c: New test.
+ * gcc.target/i386/zero-scratch-regs-17.c: New test.
+ * gcc.target/i386/zero-scratch-regs-18.c: New test.
+ * gcc.target/i386/zero-scratch-regs-19.c: New test.
+ * gcc.target/i386/zero-scratch-regs-2.c: New test.
+ * gcc.target/i386/zero-scratch-regs-20.c: New test.
+ * gcc.target/i386/zero-scratch-regs-21.c: New test.
+ * gcc.target/i386/zero-scratch-regs-22.c: New test.
+ * gcc.target/i386/zero-scratch-regs-23.c: New test.
+ * gcc.target/i386/zero-scratch-regs-24.c: New test.
+ * gcc.target/i386/zero-scratch-regs-25.c: New test.
+ * gcc.target/i386/zero-scratch-regs-26.c: New test.
+ * gcc.target/i386/zero-scratch-regs-27.c: New test.
+ * gcc.target/i386/zero-scratch-regs-28.c: New test.
+ * gcc.target/i386/zero-scratch-regs-29.c: New test.
+ * gcc.target/i386/zero-scratch-regs-30.c: New test.
+ * gcc.target/i386/zero-scratch-regs-31.c: New test.
+ * gcc.target/i386/zero-scratch-regs-3.c: New test.
+ * gcc.target/i386/zero-scratch-regs-4.c: New test.
+ * gcc.target/i386/zero-scratch-regs-5.c: New test.
+ * gcc.target/i386/zero-scratch-regs-6.c: New test.
+ * gcc.target/i386/zero-scratch-regs-7.c: New test.
+ * gcc.target/i386/zero-scratch-regs-8.c: New test.
+ * gcc.target/i386/zero-scratch-regs-9.c: New test.
+
+2020-10-30 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/97556
+ * gcc.dg/Warray-bounds-70.c: New test.
+
+2020-10-30 Tobias Burnus <tobias@codesourcery.com>
+
+ * g++.dg/guality/guality.exp: Skip $rootme-based check if unset.
+ * gcc.dg/guality/guality.exp: Likewise.
+ * gfortran.dg/guality/guality.exp: Likewise.
+ * lib/asan-dg.exp: Don't use $asan_saved_library_path if not set.
+ * lib/tsan-dg.exp: Don't use $tsan_saved_library_path if not set.
+ * lib/ubsan-dg.exp: Don't use $ubsan_saved_library_path if not set.
+
+2020-10-30 Tobias Burnus <tobias@codesourcery.com>
+
+ * gfortran.dg/gomp/atomic-2.f90: New test.
+ * gfortran.dg/gomp/atomic.f90: New test.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97623
+ * gcc.dg/tree-ssa/ssa-hoist-7.c: New testcase.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97626
+ * gcc.dg/vect/bb-slp-pr97626.c: New testcase.
+
+2020-10-30 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR fortran/92793
+ * c-c++-common/goacc/clause-locations.c: Rewrite into...
+ * c-c++-common/goacc/pr92793-1.c: ... this.
+ * gfortran.dg/goacc/clause-locations.f90: Rewrite into...
+ * gfortran.dg/goacc/pr92793-1.f90: ... this.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97633
+ * g++.dg/vect/slp-pr97636.cc: New testcase.
+ * gcc.dg/vect/bb-slp-pr97633.c: Likewise.
+
+2020-10-30 Alex Coplan <alex.coplan@arm.com>
+
+ PR target/96998
+ * gcc.c-torture/compile/pr96998.c: New test.
+
+2020-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/allocate-3.c: New test.
+
+2020-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/allocate-1.c (qux): Add another test.
+ * g++.dg/gomp/allocate-1.C: New test.
+
+2020-10-30 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-pr65935.c: Adjust.
+
+2020-10-30 Michael Meissner <meissner@linux.ibm.com>
+
+ * gcc.target/powerpc/float128-mix-2.c: New test.
+ * gcc.target/powerpc/float128-mix-3.c: New test.
+ * gcc.target/powerpc/float128-mix.c: Update failure messages.
+
+2020-10-29 Marek Polacek <polacek@redhat.com>
+
+ DR 625
+ PR c++/97479
+ * g++.dg/cpp0x/auto3.C: Update dg-error.
+ * g++.dg/cpp0x/auto9.C: Likewise.
+ * g++.dg/cpp2a/concepts-pr84979-2.C: Likewise.
+ * g++.dg/cpp2a/concepts-pr84979-3.C: Likewise.
+ * g++.dg/cpp2a/concepts-pr84979.C: Likewise.
+ * g++.dg/DRs/dr625.C: New test.
+
+2020-10-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/93107
+ * g++.dg/cpp0x/initlist-deduce3.C: New test.
+
+2020-10-29 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/cpp2a/enum-conv1.C: Remove unused code.
+ * g++.dg/cpp2a/spaceship-err5.C: New test.
+
+2020-10-29 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/97412
+ * g++.dg/cpp2a/concepts-variadic2.C: New test.
+
+2020-10-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/97388
+ * g++.dg/cpp2a/constexpr-dtor8.C: New test.
+
+2020-10-29 Jakub Jelinek <jakub@redhat.com>
+ Jason Merrill <jason@redhat.com>
+
+ PR c++/97388
+ * g++.dg/cpp2a/constexpr-dtor5.C: New test.
+ * g++.dg/cpp2a/constexpr-dtor6.C: New test.
+ * g++.dg/cpp2a/constexpr-dtor7.C: New test.
+
+2020-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/95808
+ * g++.dg/cpp2a/constexpr-new15.C: New test.
+
+2020-10-29 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-bool-1.c, gcc.dg/c2x-bool-1.c, gcc.dg/c99-bool-4.c:
+ New tests.
+
+2020-10-29 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/pr97596.c: Require int128 effective target.
+
+2020-10-29 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97596.c: New.
+
+2020-10-29 Alexandre Oliva <oliva@adacore.com>
+
+ * gnat.dg/sin_cos.ads: New.
+ * gnat.dg/sin_cos.adb: New.
+ * gcc.dg/sin_cos.c: New.
+
+2020-10-29 liuhongt <hongtao.liu@intel.com>
+
+ * gcc.target/i386/keylocker-aesdec128kl.c: New test.
+ * gcc.target/i386/keylocker-aesdec256kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesdecwide128kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesdecwide256kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesenc128kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesencwide128kl.c: Likewise.
+ * gcc.target/i386/keylocker-aesencwide256kl.c: Likewise.
+ * gcc.target/i386/keylocker-encodekey128.c: Likewise.
+ * gcc.target/i386/keylocker-encodekey256.c: Likewise.
+ * gcc.target/i386/keylocker-loadiwkey.c: Likewise.
+ * g++.dg/other/i386-2.C: Add -mkl and -mwidekl.
+ * g++.dg/other/i386-3.C: Likewise.
+ * gcc.target/i386/sse-12.c: Likewise.
+ * gcc.target/i386/sse-13.c: Likewise.
+ * gcc.target/i386/sse-14.c: Likewise.
+ * gcc.target/i386/sse-22.c: Add kl and widekl.
+ * gcc.target/i386/sse-23.c: Likewise.
+ * gcc.target/i386/funcspec-56.inc: Add new target attribute test.
+
+2020-10-29 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-pr65935.c: Adjust.
+
+2020-10-29 Andrew MacLeod <amacleod@redhat.com>
+
+ * g++.dg/pr97609.C: New.
+
+2020-10-29 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97608
+ * gcc.dg/analyzer/malloc-1.c (test_42d): New.
+ * gcc.dg/analyzer/pr97608.c: New test.
+
+2020-10-28 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/vsx-load-element-extend-char.c: Put "dg-do run"
+ before "dg-do compile", and make them mutually exclusive.
+ * gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
+ * gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
+ * gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
+ * gcc.target/powerpc/altivec-consts.c: Likewise, add -save-temps.
+ * gcc.target/powerpc/le-altivec-consts.c: Likewise.
+
+2020-10-28 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/float128-type-1.c: Simplify target test.
+ * gcc.target/powerpc/float128-type-2.c: Likewise.
+
+2020-10-28 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/fold-vec-extract-char.p9.c: Don't check addi
+ count for ilp32.
+ * gcc.target/powerpc/fold-vec-extract-int.p9.c: Likewise.
+ * gcc.target/powerpc/fold-vec-extract-longlong.p7.c: Likewise.
+ * gcc.target/powerpc/fold-vec-extract-longlong.p8.c: Likewise.
+ * gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/warn/mvp3.C: New test.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/97573
+ * g++.dg/cpp0x/linkage2.C: Add dg-warning.
+ * g++.dg/parse/attr3.C: Likewise.
+ * g++.dg/cpp2a/enum-conv1.C: New test.
+ * g++.dg/cpp2a/enum-conv2.C: New test.
+ * g++.dg/cpp2a/enum-conv3.C: New test.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/96675
+ PR c++/96742
+ * g++.dg/warn/Wdiv-by-zero-3.C: Turn dg-warning into dg-bogus.
+ * g++.dg/warn/Wtautological-compare3.C: New test.
+ * g++.dg/warn/Wtype-limits5.C: New test.
+ * g++.old-deja/g++.pt/crash10.C: Remove dg-warning.
+
+2020-10-28 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/sad-vectorize-1.c: Remove AIX skip.
+ * gcc.target/powerpc/sad-vectorize-2.c: Remove AIX skip.
+ * gcc.target/powerpc/sad-vectorize-3.c: Remove target.
+ Require p9vector_hw.
+ * gcc.target/powerpc/sad-vectorize-4.c: Remove target.
+ Require p9vector_hw.
+ * gcc.target/powerpc/signbit-1.c: Remove target.
+ Require ppc_float128_sw.
+ * gcc.target/powerpc/signbit-2.c: Remove target.
+ Require ppc_float128_sw.
+ * gcc.target/powerpc/signbit-3.c: Remove target.
+ Require ppc_float128_sw.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94799
+ * g++.dg/template/lookup16.C: New test.
+
+2020-10-28 Marek Polacek <polacek@redhat.com>
+
+ PR c++/86773
+ * g++.dg/cpp1z/fold12.C: New test.
+
+2020-10-28 Tamar Christina <tamar.christina@arm.com>
+
+ PR target/97535
+ * gcc.target/aarch64/pr97535.c: Exclude ILP32.
+
+2020-10-28 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/97457
+ * gcc.dg/vect/pr97457.c: New test.
+
+2020-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c11-parm-omit-1.c, gcc.dg/c11-parm-omit-2.c,
+ gcc.dg/c11-parm-omit-3.c, gcc.dg/c11-parm-omit-4.c,
+ gcc.dg/c2x-parm-omit-1.c, gcc.dg/c2x-parm-omit-2.c,
+ gcc.dg/c2x-parm-omit-3.c, gcc.dg/c2x-parm-omit-4.c: New tests.
+ * gcc.dg/noncompile/pr79758.c: Do not expect error for omitted
+ parameter name.
+
+2020-10-28 Patrick Palka <ppalka@redhat.com>
+
+ PR c++/95132
+ * g++.dg/cpp2a/concepts-fn7.C: New test.
+
+2020-10-28 David Edelsohn <dje.gcc@gmail.com>
+
+ * gcc.target/powerpc/vadsdu-0.c: Remove target.
+ * gcc.target/powerpc/vadsdu-1.c: Remove target.
+ * gcc.target/powerpc/vadsdu-2.c: Remove target.
+ * gcc.target/powerpc/vadsdu-3.c: Remove target.
+ * gcc.target/powerpc/vadsdu-4.c: Remove target.
+ * gcc.target/powerpc/vadsdu-5.c: Remove target.
+ * gcc.target/powerpc/vadsdub-1.c: Remove target.
+ * gcc.target/powerpc/vadsdub-2.c: Remove target.
+ * gcc.target/powerpc/vadsduh-1.c: Remove target.
+ * gcc.target/powerpc/vadsduh-2.c: Remove target.
+ * gcc.target/powerpc/vadsduw-1.c: Remove target.
+ * gcc.target/powerpc/vadsduw-2.c: Remove target.
+ * gcc.target/powerpc/vslv-0.c: Remove target.
+ * gcc.target/powerpc/vslv-1.c: Remove target.
+ * gcc.target/powerpc/vsrv-0.c: Remove target.
+ * gcc.target/powerpc/vsrv-1.c: Remove target.
+
+2020-10-28 David Edelsohn <dje.gcc@gmail.com>
+ Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/byte-in-either-range-0.c: Remove target.
+ * gcc.target/powerpc/byte-in-either-range-1.c: Remove target.
+ * gcc.target/powerpc/byte-in-range-0.c: Remove target.
+ * gcc.target/powerpc/byte-in-range-1.c: Remove target.
+ * gcc.target/powerpc/byte-in-set-0.c: Remove target.
+ * gcc.target/powerpc/byte-in-set-1.c: Remove target.
+ * gcc.target/powerpc/byte-in-set-2.c: Remove target. Expect
+ implicit declaration warning.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-58.c: Require vect_double.
+ * gcc.dg/vect/bb-slp-59.c: Likewise.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97615
+ * gcc.dg/vect/bb-slp-pr97615.c: New testcase.
+
+2020-10-28 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-68.c: New testcase.
+
+2020-10-28 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h
+ (hbfloat16_t): Define type.
+ (CHECK_FP): Make it working for bfloat types.
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_1.c: New file.
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_2.c: Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst2_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst3_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst4_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_bf16_indices_1.c:
+ Likewise.
+
+2020-10-28 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_1.c: New
+ testcase.
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_2.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld2_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld3_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld4_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_bf16_indices_1.c:
+ Likewise.
+
+2020-10-28 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/gomp/allocate-1.c: New test.
+ * c-c++-common/gomp/allocate-2.c: New test.
+ * c-c++-common/gomp/clauses-1.c (omp_allocator_handle_t): New typedef.
+ (foo, bar, baz): Add allocate clauses where allowed.
+
+2020-10-28 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/vsx-load-element-extend-char.c: Add -save-temps.
+ * gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
+ * gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
+ * gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
+
+2020-10-28 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/vec-blend-runnable.c: Add save-temps.
+ * gcc.target/powerpc/vec-insert-word-runnable.c: Likewise.
+ * gcc.target/powerpc/vec-permute-ext-runnable.c: Likewise.
+ * gcc.target/powerpc/vec-replace-word-runnable.c: Likewise.
+ * gcc.target/powerpc/vec-splati-runnable.c: Likewise.
+ * gcc.target/powerpc/vec-ternarylogic-3.c: Likewise.
+ * gcc.target/powerpc/vec-ternarylogic-9.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-count-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
+ * gcc.target/powerpc/vec-shift-double-runnable.c: Likewise,
+ and correct assembly match.
+
+2020-10-27 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c2x-attr-deprecated-4.c, gcc.dg/c2x-attr-fallthrough-4.c,
+ gcc.dg/c2x-attr-maybe_unused-4.c: Allow duplicate attributes.
+
+2020-10-27 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ * gcc.target/s390/pr97497.c: New test.
+
+2020-10-27 Harald Anlauf <anlauf@gmx.de>
+
+ * gfortran.dg/value_8.f90: New test.
+
+2020-10-27 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/vec-blend-runnable.c: Change #ifdef
+ DEBUG to #if DEBUG.
+ Fix printf line so it is less then 80 characters long.
+ * gcc.target/powerpc/vec-insert-word-runnable.c: Change
+ #ifdef DEBUG to #if DEBUG.
+ * gcc.target/powerpc/vec-permute-ext-runnable.c: Change
+ #ifdef DEBUG to #if DEBUG.
+ * gcc.target/powerpc/vec-replace-word-runnable.c: Change
+ #ifdef DEBUG to #if DEBUG.
+ Fix printf lines so they are less then 80 characters long.
+ * gcc.target/powerpc/vec-shift-double-runnable.c: Change
+ #ifdef DEBUG to #if DEBUG.
+
+2020-10-27 Tamar Christina <tamar.christina@arm.com>
+
+ PR target/97535
+ * gcc.target/aarch64/pr97535.c: New test.
+
+2020-10-27 Andrea Corallo <andrea.corallo@arm.com>
+
+ * gcc.target/aarch64/advsimd-intrinsics/bf16_vect_copy_lane_1.c:
+ New test.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_2.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_2.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_2.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_1.c:
+ Likewise.
+ * gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_2.c:
+ Likewise.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-67.c: New testcase.
+
+2020-10-27 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/92942
+ * gcc.dg/Wstringop-overflow-56.c: New test.
+ * gcc.dg/Wstringop-overflow-57.c: Same.
+
+2020-10-27 Martin Sebor <msebor@redhat.com>
+
+ * gcc.dg/Wstringop-overflow-44.s: Remove.
+
+2020-10-27 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97567.c: Update to work with 32 bit targets.
+
+2020-10-27 David Malcolm <dmalcolm@redhat.com>
+
+ PR analyzer/97568
+ * gcc.dg/analyzer/pr97568.c: New test.
+
+2020-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/97560
+ PR testsuite/97590
+ * g++.dg/pr97560.C: Require c++11 effective target and add comment
+ with PR number.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/vect/bb-slp-54.c: New test.
+ * gcc.dg/vect/bb-slp-55.c: Likewise.
+ * gcc.dg/vect/bb-slp-56.c: Likewise.
+ * gcc.dg/vect/bb-slp-57.c: Likewise.
+ * gcc.dg/vect/bb-slp-58.c: Likewise.
+ * gcc.dg/vect/bb-slp-59.c: Likewise.
+ * gcc.dg/vect/bb-slp-60.c: Likewise.
+ * gcc.dg/vect/bb-slp-61.c: Likewise.
+ * gcc.dg/vect/bb-slp-62.c: Likewise.
+ * gcc.dg/vect/bb-slp-63.c: Likewise.
+ * gcc.dg/vect/bb-slp-64.c: Likewise.
+ * gcc.dg/vect/bb-slp-65.c: Likewise.
+ * gcc.dg/vect/bb-slp-66.c: Likewise.
+ * gcc.dg/vect/vect-outer-slp-1.c: Likewise.
+ * gfortran.dg/vect/O3-bb-slp-1.f: Likewise.
+ * gfortran.dg/vect/O3-bb-slp-2.f: Likewise.
+ * g++.dg/vect/simd-11.cc: Likewise.
+
+2020-10-27 Richard Biener <rguenther@suse.de>
+
+ * gcc.target/i386/pr95866-1.c: Adjust.
+
+2020-10-27 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/swaps-p8-22.c: Enable only for aix and
+ -m64 linux.
+
+2020-10-27 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/97461
+ * gcc.dg/tree-prof/pr97461.c: New test.
+
+2020-10-27 Aldy Hernandez <aldyh@redhat.com>
+
+ PR tree-optimization/97560
+ * g++.dg/pr97560.C: New test.
+
+2020-10-27 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/vsx_mask-count-runnable.c: Separate options
+ passed to dg-require-effective-target.
+ * gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/localentry-1.c: Remove -mpcrel from options.
+ * gcc.target/powerpc/notoc-direct-1.c: Likewise.
+ * gcc.target/powerpc/pr94740.c: Likewise.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/bswap64-4.c: Comment.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/pr93122.c: Replace -mcpu with -mdejagnu-cpu.
+ * gcc.target/powerpc/vsx_mask-count-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/vsx-load-element-extend-char.c: Require int128.
+ * gcc.target/powerpc/vsx-load-element-extend-int.c: Likewise.
+ * gcc.target/powerpc/vsx-load-element-extend-longlong.c: Likewise.
+ * gcc.target/powerpc/vsx-load-element-extend-short.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-char.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-int.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-longlong.c: Likewise.
+ * gcc.target/powerpc/vsx-store-element-truncate-short.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-count-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-expand-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-extract-runnable.c: Likewise.
+ * gcc.target/powerpc/vsx_mask-move-runnable.c: Likewise.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/cfuged-1.c,
+ gcc.target/powerpc/cntlzdm-1.c,
+ gcc.target/powerpc/cnttzdm-1.c,
+ gcc.target/powerpc/dg-future-1.c,
+ gcc.target/powerpc/lsbb-runnable.c,
+ gcc.target/powerpc/mma-double-test.c,
+ gcc.target/powerpc/mma-single-test.c,
+ gcc.target/powerpc/p10-arch31.c,
+ gcc.target/powerpc/p10-identify.c,
+ gcc.target/powerpc/pdep-1.c,
+ gcc.target/powerpc/pextd-1.c,
+ gcc.target/powerpc/pr96787-2.c,
+ gcc.target/powerpc/vec-blend-runnable.c,
+ gcc.target/powerpc/vec-cfuged-1.c,
+ gcc.target/powerpc/vec-clrl-1.c,
+ gcc.target/powerpc/vec-clrl-3.c,
+ gcc.target/powerpc/vec-clrr-1.c,
+ gcc.target/powerpc/vec-clrr-3.c,
+ gcc.target/powerpc/vec-cntlzm-1.c,
+ gcc.target/powerpc/vec-cnttzm-1.c,
+ gcc.target/powerpc/vec-extracth-1.c,
+ gcc.target/powerpc/vec-extracth-3.c,
+ gcc.target/powerpc/vec-extracth-5.c,
+ gcc.target/powerpc/vec-extracth-7.c,
+ gcc.target/powerpc/vec-extractl-1.c,
+ gcc.target/powerpc/vec-extractl-3.c,
+ gcc.target/powerpc/vec-extractl-5.c,
+ gcc.target/powerpc/vec-extractl-7.c,
+ gcc.target/powerpc/vec-gnb-1.c,
+ gcc.target/powerpc/vec-insert-word-runnable.c,
+ gcc.target/powerpc/vec-pdep-1.c,
+ gcc.target/powerpc/vec-permute-ext-runnable.c,
+ gcc.target/powerpc/vec-pext-1.c,
+ gcc.target/powerpc/vec-replace-word-runnable.c,
+ gcc.target/powerpc/vec-shift-double-runnable.c,
+ gcc.target/powerpc/vec-splati-runnable.c,
+ gcc.target/powerpc/vec-stril-1.c,
+ gcc.target/powerpc/vec-stril-16.c,
+ gcc.target/powerpc/vec-stril-17.c,
+ gcc.target/powerpc/vec-stril-18.c,
+ gcc.target/powerpc/vec-stril-19.c,
+ gcc.target/powerpc/vec-stril-20.c,
+ gcc.target/powerpc/vec-stril-21.c,
+ gcc.target/powerpc/vec-stril-22.c,
+ gcc.target/powerpc/vec-stril-23.c,
+ gcc.target/powerpc/vec-stril-3.c,
+ gcc.target/powerpc/vec-stril-5.c,
+ gcc.target/powerpc/vec-stril-7.c,
+ gcc.target/powerpc/vec-stril_p-1.c,
+ gcc.target/powerpc/vec-stril_p-3.c,
+ gcc.target/powerpc/vec-stril_p-5.c,
+ gcc.target/powerpc/vec-stril_p-7.c,
+ gcc.target/powerpc/vec-strir-1.c,
+ gcc.target/powerpc/vec-strir-16.c,
+ gcc.target/powerpc/vec-strir-17.c,
+ gcc.target/powerpc/vec-strir-18.c,
+ gcc.target/powerpc/vec-strir-19.c,
+ gcc.target/powerpc/vec-strir-20.c,
+ gcc.target/powerpc/vec-strir-21.c,
+ gcc.target/powerpc/vec-strir-22.c,
+ gcc.target/powerpc/vec-strir-23.c,
+ gcc.target/powerpc/vec-strir-3.c,
+ gcc.target/powerpc/vec-strir-5.c,
+ gcc.target/powerpc/vec-strir-7.c,
+ gcc.target/powerpc/vec-strir_p-1.c,
+ gcc.target/powerpc/vec-strir_p-3.c,
+ gcc.target/powerpc/vec-strir_p-5.c,
+ gcc.target/powerpc/vec-strir_p-7.c,
+ gcc.target/powerpc/vec-ternarylogic-1.c,
+ gcc.target/powerpc/vec-ternarylogic-3.c,
+ gcc.target/powerpc/vec-ternarylogic-5.c,
+ gcc.target/powerpc/vec-ternarylogic-7.c,
+ gcc.target/powerpc/vec-ternarylogic-9.c,
+ gcc.target/powerpc/vsx_mask-count-runnable.c,
+ gcc.target/powerpc/vsx_mask-expand-runnable.c,
+ gcc.target/powerpc/vsx_mask-extract-runnable.c,
+ gcc.target/powerpc/vsx_mask-move-runnable.c,
+ gcc.target/powerpc/xxgenpc-runnable.c: Link testcase when it
+ can't be run.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/dimode_off.c: Add -mno-prefixed to options.
+
+2020-10-26 Alan Modra <amodra@gmail.com>
+
+ * gcc.target/powerpc/cprophard.c: Add -mno-pcrel to options.
+ * gcc.target/powerpc/float128-hw3.c: Likewise.
+ * gcc.target/powerpc/pr79439-1.c: Likewise.
+ * gcc.target/powerpc/pr79439-2.c: Likewise.
+ * gcc.target/powerpc/r2_shrink-wrap.c: Likewise.
+
+2020-10-26 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97567.c: New.
+
+2020-10-26 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/pr97555.c: New test.
+
+2020-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ * g++.dg/ext/is_nothrow_constructible1.C: New file.
+ * g++.dg/ext/is_nothrow_constructible2.C: New file.
+ * g++.dg/ext/is_nothrow_constructible3.C: New file.
+ * g++.dg/ext/is_nothrow_constructible4.C: New file.
+ * g++.dg/ext/is_nothrow_constructible5.C: New file.
+ * g++.dg/ext/is_nothrow_constructible6.C: New file.
+
+2020-10-26 Jan Hubicka <jh@suse.cz>
+
+ PR ipa/97576
+ * gcc.c-torture/compile/pr97576.c: New test.
+
+2020-10-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR tree-optimization/97546
+ * gcc.target/aarch64/sve/acle/general/pr97546.c: New test.
+
+2020-10-26 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/97521
+ * gcc.target/i386/pr97521.c: New testcase.
+
+2020-10-26 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/95458
+ * gcc.target/i386/pr95458-1.c: New test.
+ * gcc.target/i386/pr95458-2.c: Likewise.
+
+2020-10-26 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/95151
+ * gcc.target/i386/pr95151-1.c: New test.
+ * gcc.target/i386/pr95151-2.c: Likewise.
+ * gcc.target/i386/pr95151-3.c: Likewise.
+ * gcc.target/i386/pr95151-4.c: Likewise.
+
+2020-10-26 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/97539
+ * gcc.dg/pr97539.c: New testcase.
+
+2020-10-26 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/warn14.adb: Update expectations.
+
+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.zhang@arm.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-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 Andrew MacLeod <amacleod@redhat.com>
+
+ * gcc.dg/pr97520.c: New.
+
+2020-10-22 Dennis Zhang <dennis.zhang@arm.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-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:
@@ -425,20 +2884,6 @@
* 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.
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/Wimplicit-fallthrough-20.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-20.c
index d37a840..bc0cd0f 100644
--- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-20.c
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-20.c
@@ -27,13 +27,13 @@ g (int i)
switch (i)
{
case -1:
- __attribute__((used)); /* { dg-warning "ignored|only attribute" } */
+ __attribute__((used)); /* { dg-warning "empty declaration|ignored" } */
default:
- __attribute__((used)); /* { dg-warning "ignored|only attribute" } */
+ __attribute__((used)); /* { dg-warning "empty declaration|ignored" } */
case 1:
return 6;
case 2 ... 4:
- __attribute__((used)); /* { dg-warning "ignored|only attribute" } */
+ __attribute__((used)); /* { dg-warning "empty declaration|ignored" } */
case 5:
return 7;
}
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/Wunused-value-1.c b/gcc/testsuite/c-c++-common/Wunused-value-1.c
new file mode 100644
index 0000000..90c9d93
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-value-1.c
@@ -0,0 +1,33 @@
+/* PR c/97748 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused-value" } */
+
+double _Complex f ();
+double _Complex *p;
+
+double _Complex
+foo (double _Complex x)
+{
+ ++x; /* { dg-bogus "value computed is not used" } */
+ --x; /* { dg-bogus "value computed is not used" } */
+ x += 1; /* { dg-bogus "value computed is not used" } */
+ x += 1.0iF; /* { dg-bogus "value computed is not used" } */
+ x++; /* { dg-bogus "value computed is not used" } */
+ x--; /* { dg-bogus "value computed is not used" } */
+ x + 1; /* { dg-warning "value computed is not used" } */
+ (void) (x + 1); /* { dg-bogus "value computed is not used" } */
+ 1 + f (); /* { dg-warning "value computed is not used" } */
+ f () + f (); /* { dg-warning "value computed is not used" } */
+ f () + f (), f (); /* { dg-warning "value computed is not used" } */
+ f ();
+ (void) f ();
+ *p++; /* { dg-warning "value computed is not used" } */
+ ++*p; /* { dg-bogus "value computed is not used" } */
+ (*p ? f () : 0);
+ ({ f (); });
+ ({ f () + 1; });
+ ({ f (); 0; });
+ ({ f () + 1; 0; }); /* { dg-warning "value computed is not used" } */
+ 1 + ({ f (); }); /* { dg-warning "value computed is not used" } */
+ return x;
+}
diff --git a/gcc/testsuite/c-c++-common/attr-fallthrough-2.c b/gcc/testsuite/c-c++-common/attr-fallthrough-2.c
index e8659e5..156b413 100644
--- a/gcc/testsuite/c-c++-common/attr-fallthrough-2.c
+++ b/gcc/testsuite/c-c++-common/attr-fallthrough-2.c
@@ -1,6 +1,6 @@
/* PR c/7652 */
/* { dg-do compile } */
-/* { dg-options "-Wall -Wextra -Wpedantic -Wno-unused -Wno-implicit-fallthrough" } */
+/* { dg-options "-Wall -Wextra -Wno-unused -Wno-implicit-fallthrough" } */
extern void bar (int);
void
@@ -34,7 +34,7 @@ fn (int i)
__attribute__((fallthrough ("x"))); /* { dg-warning "specified with a parameter" } */
case 7:
bar (1);
- __attribute__((fallthrough, fallthrough)); /* { dg-warning "attribute specified multiple times" } */
+ __attribute__((fallthrough, fallthrough)); /* { dg-warning "specified multiple times" } */
case 8:
bar (1);
__attribute__((fallthrough));
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-gomp/atomic.c b/gcc/testsuite/c-c++-common/goacc-gomp/atomic.c
new file mode 100644
index 0000000..4d18f23
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc-gomp/atomic.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original" } */
+
+#pragma omp requires atomic_default_mem_order(acq_rel)
+
+void
+foo ()
+{
+ int i, v;
+
+#pragma omp atomic read
+ i = v;
+
+#pragma acc atomic read
+ i = v;
+
+#pragma omp atomic write
+ i = v;
+
+#pragma acc atomic write
+ i = v;
+
+#pragma omp atomic update
+ i += 1;
+
+#pragma acc atomic update
+ i += 1;
+
+#pragma omp atomic capture
+ v = i += 1;
+
+#pragma acc atomic capture
+ v = i += 1;
+#pragma acc atomic update capture
+ v = i += 1;
+}
+
+/* { dg-final { scan-tree-dump-times "i = #pragma omp atomic read acquire" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "i = #pragma omp atomic read relaxed" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp atomic release" 2 "original" } } */
+/* { dg-final { scan-tree-dump-times "#pragma omp atomic relaxed" 2 "original" } } */
+/* { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture acq_rel" 1 "original" } } */
+/* { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture relaxed" 2 "original" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/atomic.c b/gcc/testsuite/c-c++-common/goacc/atomic.c
new file mode 100644
index 0000000..ff3b25e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/atomic.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+
+void
+foo ()
+{
+ int i, v;
+#pragma acc atomic read bar /* { dg-error "expected 'read', 'write', 'update', or 'capture' clause" } */
+ i = v; /* { dg-error "expected end of line before 'bar'" "" { target *-*-* } .-1 } */
+
+#pragma acc atomic read write /* { dg-error "too many atomic clauses" } */
+ i = v;
+
+#pragma acc atomic read seq_cst /* { dg-error "expected 'read', 'write', 'update', or 'capture' clause" } */
+ i = v; /* { dg-error "expected end of line before 'seq_cst'" "" { target *-*-* } .-1 } */
+
+#pragma acc atomic read relaxed /* { dg-error "expected 'read', 'write', 'update', or 'capture' clause" } */
+ i = v; /* { dg-error "expected end of line before 'relaxed'" "" { target *-*-* } .-1 } */
+
+#pragma acc atomic update hint(1) /* { dg-error "expected 'read', 'write', 'update', or 'capture' clause" } */
+ i += 1; /* { dg-error "expected end of line before 'hint'" "" { target *-*-* } .-1 } */
+
+#pragma acc atomic update update capture /* { dg-error "too many atomic clauses" } */
+ v = i += 1;
+
+#pragma acc atomic update capture capture /* { dg-error "too many atomic clauses" } */
+ v = i += 1;
+
+#pragma acc atomic write capture /* { dg-error "too many atomic clauses" } */
+ i = 1;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/clause-locations.c b/gcc/testsuite/c-c++-common/goacc/clause-locations.c
deleted file mode 100644
index 913988d..0000000
--- a/gcc/testsuite/c-c++-common/goacc/clause-locations.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Verify that the location information for clauses is correct. */
-
-void
-check_clause_columns() {
- int i, j, sum, diff;
-
- #pragma acc parallel
- {
- #pragma acc loop reduction(+:sum)
- for (i = 1; i <= 10; i++)
- {
- #pragma acc loop reduction(-:diff) reduction(-:sum)
- /* { dg-warning "53: conflicting reduction operations for .sum." "" { target c } .-1 } */
- /* { dg-warning "56: conflicting reduction operations for .sum." "" { target c++ } .-2 } */
- for (j = 1; j <= 10; j++)
- sum = 1;
- }
- }
-}
diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c
new file mode 100644
index 0000000..9323e2c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c
@@ -0,0 +1,236 @@
+/* Test cases of nested 'reduction' clauses expected to compile cleanly. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-1-kernels.f90'. */
+
+void acc_kernels (void)
+{
+ int i, j, k, sum, diff;
+
+ #pragma acc kernels
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but using a combined kernels loop construct. */
+
+void acc_kernels_loop (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc kernels loop
+ for (int h = 0; h < 10; ++h)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but now the outermost reduction clause is on
+ the kernels region, not the outermost loop. */
+
+void acc_kernels_reduction (void)
+{
+ /* In contrast to the 'parallel' construct, the 'reduction' clause is not
+ supported on the 'kernels' construct. */
+}
+
+/* The same tests as above, but using a combined kernels loop construct, and
+ the outermost reduction clause is on that one, not the outermost loop. */
+void acc_kernels_loop_reduction (void)
+{
+ int i, j, k, sum, diff;
+
+ #pragma acc kernels loop reduction(+:sum)
+ for (int h = 0; h < 10; ++h)
+ {
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ for (i = 0; i < 10; i++)
+ #pragma acc loop
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum) // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c
index 15385c4..ce1d0a1 100644
--- a/gcc/testsuite/c-c++-common/goacc/nested-reductions.c
+++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c
@@ -1,4 +1,6 @@
-/* Test cases of nested reduction loops that should compile cleanly. */
+/* Test cases of nested 'reduction' clauses expected to compile cleanly. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-1-parallel.f90'. */
void acc_parallel (void)
{
@@ -314,107 +316,3 @@ void acc_parallel_loop_reduction (void)
}
}
}
-
-/* The same tests as above, but inside a routine construct. */
-#pragma acc routine gang
-void acc_routine (void)
-{
- int i, j, k, sum, diff;
-
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop collapse(2) reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-void acc_kernels (void)
-{
- int i, j, k, sum, diff;
-
- /* FIXME: These tests are not meaningful yet because reductions in
- kernels regions are not supported yet. */
- #pragma acc kernels
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(+:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
- }
-}
diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c
new file mode 100644
index 0000000..83d3995
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c
@@ -0,0 +1,68 @@
+/* Test cases of nested 'reduction' clauses expected to compile cleanly. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-1-routine.f90'. */
+
+#pragma acc routine gang
+void acc_routine (void)
+{
+ int i, j, k, sum, diff;
+
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff)
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c
new file mode 100644
index 0000000..dec7dbd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c
@@ -0,0 +1,305 @@
+/* Test erroneous cases of nested 'reduction' clauses. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-2-kernels.f90'. */
+
+void acc_kernels (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc kernels
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but using a combined kernels loop construct. */
+
+void acc_kernels_loop (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc kernels loop
+ for (int h = 0; h < 10; ++h)
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
+
+/* The same tests as above, but now the outermost reduction clause is on
+ the kernels region, not the outermost loop. */
+void acc_kernels_reduction (void)
+{
+ /* In contrast to the 'parallel' construct, the 'reduction' clause is not
+ supported on the 'kernels' construct. */
+}
+
+/* The same tests as above, but using a combined kernels loop construct, and
+ the outermost reduction clause is on that one, not the outermost loop. */
+void acc_kernels_loop_reduction (void)
+{
+ int i, j, k, l, sum, diff;
+
+ #pragma acc kernels loop reduction(+:sum)
+ for (int h = 0; h < 10; ++h)
+ {
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(max:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-warn.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c
index e2af66e..1f6b4e7 100644
--- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-warn.c
+++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c
@@ -1,4 +1,6 @@
-/* Test erroneous cases of nested reduction loops. */
+/* Test erroneous cases of nested 'reduction' clauses. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-2-parallel.f90'. */
void acc_parallel (void)
{
@@ -385,141 +387,3 @@ void acc_parallel_loop_reduction (void)
}
}
}
-
-/* The same tests as above, but inside a routine construct. */
-#pragma acc routine gang
-void acc_routine (void)
-{
- int i, j, k, l, sum, diff;
-
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(+:sum)
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
- // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- for (k = 0; k < 10; k++)
- #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
- for (l = 0; l < 10; l++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) reduction(-:diff)
- for (i = 0; i < 10; i++)
- {
- #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(-:diff)
- for (k = 0; k < 10; k++)
- diff = 1;
- }
- }
-}
-
-void acc_kernels (void)
-{
- int i, j, k, sum, diff;
-
- /* FIXME: No diagnostics are produced for these loops because reductions
- in kernels regions are not supported yet. */
- #pragma acc kernels
- {
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop
- for (j = 0; j < 10; j++)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:diff)
- for (j = 0; j < 10; j++)
- #pragma acc loop
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
-
- #pragma acc loop reduction(+:sum)
- for (i = 0; i < 10; i++)
- #pragma acc loop reduction(-:sum)
- for (j = 0; j < 10; j++)
- #pragma acc loop reduction(+:sum)
- for (k = 0; k < 10; k++)
- sum = 1;
- }
-}
diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c
new file mode 100644
index 0000000..5988d50
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c
@@ -0,0 +1,93 @@
+/* Test erroneous cases of nested 'reduction' clauses. */
+
+/* See also 'gfortran.dg/goacc/nested-reductions-2-routine.f90'. */
+
+#pragma acc routine gang
+void acc_routine (void)
+{
+ int i, j, k, l, sum, diff;
+
+ {
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop collapse(2) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(+:sum)
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum)
+ for (i = 0; i < 10; i++)
+ #pragma acc loop reduction(-:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum) // { dg-warning "conflicting reduction operations for .sum." })
+ // { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ for (k = 0; k < 10; k++)
+ #pragma acc loop reduction(*:sum) // { dg-warning "conflicting reduction operations for .sum." }
+ for (l = 0; l < 10; l++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) reduction(-:diff)
+ for (i = 0; i < 10; i++)
+ {
+ #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(+:sum)
+ for (k = 0; k < 10; k++)
+ sum = 1;
+
+ #pragma acc loop reduction(+:sum) // { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ for (j = 0; j < 10; j++)
+ #pragma acc loop reduction(-:diff)
+ for (k = 0; k < 10; k++)
+ diff = 1;
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/pr92793-1.c b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
new file mode 100644
index 0000000..71a556e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/pr92793-1.c
@@ -0,0 +1,141 @@
+/* Verify column location information. */
+
+/* See also 'gfortran.dg/goacc/pr92793-1.f90'. */
+
+/* { dg-additional-options "-fdump-tree-original-lineno" }, and also
+ { dg-additional-options "-fdump-tree-gimple-lineno" } as the former doesn't
+ actually contain location information. */
+
+/* No tabs. Funny indentation/spacing for a reason. */
+
+
+static void
+check ()
+{
+ int i, j, sum, diff;
+
+ #pragma acc parallel \
+ /* C, C++ location information points to the 'a' in '#pragma acc parallel'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:17:12\\\] #pragma acc parallel" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:17:12\\\] #pragma omp target oacc_parallel" 1 "gimple" } } */
+ {
+#pragma acc loop \
+ /* C, C++ location information points to the 'a' in '#pragma acc loop'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:22:13\\\] #pragma acc loop" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:22:13\\\] #pragma acc loop" 1 "gimple" } } */ \
+ reduction ( + : sum) /* { dg-line sum1 } */ \
+ /* C location information points to the '(' in 'reduction(+:sum)'. */ \
+ /* { dg-message "19: location of the previous reduction for 'sum'" "" { target c } sum1 } */ \
+ /* C++ location information points to 'sum' in 'reduction(+:sum)'. */ \
+ /* { dg-message "28: location of the previous reduction for 'sum'" "" { target c++ } sum1 } */ \
+ independent
+ for (i = 1; i <= 10; i++)
+ {
+ #pragma acc loop \
+ /* C, C++ location information points to the 'a' in '#pragma acc loop'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:34:19\\\] #pragma acc loop" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:34:19\\\] #pragma acc loop" 1 "gimple" } } */ \
+ reduction ( - : diff ) \
+reduction(-:sum ) /* { dg-line sum2 } */ \
+ /* C location information points to the '(' in 'reduction(-:sum)'. */ \
+ /* { dg-warning "10: conflicting reduction operations for 'sum'" "" { target c } sum2 } */ \
+ /* C++ location information points to 'sum' in 'reduction(-:sum)'. */ \
+ /* { dg-warning "13: conflicting reduction operations for 'sum'" "" { target c++ } sum2 } */ \
+ independent
+ for (j = 1; j <= 10; j++)
+ {
+ sum
+ =
+ 1 ;
+ /* C, C++ location information points to the '=' in 'sum = 1'. */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:48:19\\\] sum = 1" 1 "original" { xfail *-*-* } } } */ \
+ /* { dg-final { scan-tree-dump-times "pr92793-1\\\.c:48:19\\\] sum = 1" 1 "gimple" } } */
+ }
+ }
+ }
+}
+
+
+void
+gwv_sl_1() {
+#pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */ \
+ gang(num:5) /* { dg-error "5: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "3: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "4: argument not permitted on 'vector' clause" } */
+ for (int i = 0; i < 10; i++)
+ ;
+}
+
+void
+gwv_sl_2() {
+#pragma acc serial loop /* { dg-message "9: enclosing parent compute construct" } */
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "9: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
+}
+
+void
+gwv_s_l() {
+#pragma acc serial /* { dg-message "9: enclosing parent compute construct" } */
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "8: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
+ for (int i = 0; i < 10; i++)
+ ;
+
+#pragma acc loop
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop /* { dg-bogus "enclosing parent compute construct" } */
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "10: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "7: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "5: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
+ }
+}
+
+void gwv_r();
+#pragma acc routine(gwv_r)
+
+void
+gwv_r() { /* { dg-message "1: enclosing routine" } */
+#pragma acc loop \
+ gang(num:5) /* { dg-error "4: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "5: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "3: argument not permitted on 'vector' clause" } */
+ for (int i = 0; i < 10; i++)
+ ;
+
+#pragma acc loop
+ for (int i = 0; i < 10; i++)
+ {
+#pragma acc loop
+ for (int j = 0; j < 10; j++)
+ {
+#pragma acc loop \
+ gang(num:5) /* { dg-error "6: argument not permitted on 'gang' clause" } */ \
+ worker(num:5) /* { dg-error "4: argument not permitted on 'worker' clause" } */ \
+ vector(length:5) /* { dg-error "6: argument not permitted on 'vector' clause" } */
+ for (int k = 0; k < 10; k++)
+ ;
+ }
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/allocate-1.c b/gcc/testsuite/c-c++-common/gomp/allocate-1.c
new file mode 100644
index 0000000..5630dac
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/allocate-1.c
@@ -0,0 +1,84 @@
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+int bar (int, int *, int);
+omp_allocator_handle_t baz (void);
+
+void
+foo (int x, int z)
+{
+ int y[16] = { 0 }, r = 0, i;
+ omp_allocator_handle_t h = baz ();
+ #pragma omp parallel allocate (x) allocate (omp_default_mem_alloc : y) \
+ allocate ((omp_allocator_handle_t) omp_default_mem_alloc:z) firstprivate (x, y, z)
+ bar (x, y, z);
+ #pragma omp task private (x) firstprivate (z) allocate (omp_low_lat_mem_alloc:x,z)
+ bar (0, &x, z);
+ #pragma omp taskwait
+ #pragma omp target teams distribute parallel for private (x) firstprivate (y) \
+ allocate ((omp_allocator_handle_t)(omp_default_mem_alloc + 0):z) \
+ allocate (omp_default_mem_alloc: x, y) allocate (omp_low_lat_mem_alloc: r) \
+ lastprivate (z) reduction(+:r)
+ for (i = 0; i < 64; i++)
+ {
+ z = bar (0, &x, 0);
+ r += bar (1, y, 0);
+ }
+ #pragma omp single private (x) allocate (h:x)
+ ;
+ #pragma omp single allocate (*&h : x) private (x)
+ ;
+ #pragma omp parallel shared (r, x, z)
+ #pragma omp single firstprivate (r) allocate (x, r, z) private (x, z)
+ ;
+ #pragma omp for allocate (x) private (x)
+ for (i = 0; i < 64; i++)
+ x = 1;
+ #pragma omp sections private (x) allocate (omp_low_lat_mem_alloc: x)
+ {
+ x = 1;
+ #pragma omp section
+ x = 2;
+ #pragma omp section
+ x = 3;
+ }
+ #pragma omp taskgroup task_reduction(+:r) allocate (omp_default_mem_alloc : r)
+ #pragma omp task in_reduction(+:r) allocate (omp_default_mem_alloc : r)
+ r += bar (r, &r, 0);
+ #pragma omp teams private (x) firstprivate (y) allocate (h : x, y)
+ bar (x, y, 0);
+ #pragma omp taskloop lastprivate (x) reduction (+:r) allocate (h : x, r)
+ for (i = 0; i < 16; i++)
+ {
+ r += bar (0, &r, 0);
+ x = i;
+ }
+ #pragma omp taskgroup task_reduction(+:r) allocate (omp_default_mem_alloc : r)
+ #pragma omp taskloop firstprivate (x) in_reduction (+:r) \
+ allocate (omp_default_mem_alloc : x, r)
+ for (i = 0; i < 16; i++)
+ r += bar (x, &r, 0);
+ #pragma omp taskwait
+}
+
+void
+qux (const omp_allocator_handle_t h)
+{
+ int x = 0;
+ #pragma omp parallel firstprivate (x) allocate (h: x)
+ x = 1;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/allocate-2.c b/gcc/testsuite/c-c++-common/gomp/allocate-2.c
new file mode 100644
index 0000000..cc77efc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/allocate-2.c
@@ -0,0 +1,45 @@
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+int bar (int, int *, int);
+omp_allocator_handle_t baz (void);
+
+void
+foo (int x, int z)
+{
+ int i;
+ #pragma omp task allocate (x) /* { dg-error "'x' specified in 'allocate' clause but not in an explicit privatization clause" } */
+ bar (x, &x, 0);
+ #pragma omp taskwait
+ #pragma omp parallel allocate (x) /* { dg-error "'x' specified in 'allocate' clause but not in an explicit privatization clause" } */
+ bar (x, &x, 0);
+ #pragma omp parallel for simd private (x) allocate (x) /* { dg-error "'x' specified in 'allocate' clause but not in an explicit privatization clause" } */
+ for (i = 0; i < 16; i++)
+ x = i;
+ #pragma omp parallel allocate (foo) /* { dg-error "'\[^\n\r]*foo\[^\n\r]*' is not a variable in 'allocate' clause" } */
+ ;
+ #pragma omp parallel allocate (x) shared (x) /* { dg-error "'x' specified in 'allocate' clause but not in an explicit privatization clause" } */
+ bar (x, &x, 0);
+ #pragma omp parallel private (x) allocate (x) allocate (x) /* { dg-warning "'x' appears more than once in 'allocate' clauses" } */
+ bar (x, &x, 0);
+ #pragma omp parallel private (x) allocate (x, x) /* { dg-warning "'x' appears more than once in 'allocate' clauses" } */
+ bar (x, &x, 0);
+ #pragma omp parallel private (x) allocate (0.0 : x) /* { dg-error "'allocate' clause allocator expression has type 'double' rather than 'omp_allocator_handle_t'" } */
+ bar (x, &x, 0);
+ #pragma omp parallel private (x) allocate (0 : x) /* { dg-error "'allocate' clause allocator expression has type 'int' rather than 'omp_allocator_handle_t'" } */
+ bar (x, &x, 0);
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/allocate-3.c b/gcc/testsuite/c-c++-common/gomp/allocate-3.c
new file mode 100644
index 0000000..e61cc1e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/allocate-3.c
@@ -0,0 +1,38 @@
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+omp_allocator_handle_t baz (int);
+
+int
+foo (omp_allocator_handle_t h1, omp_allocator_handle_t h2, int y)
+{
+ int x;
+ #pragma omp taskloop default(none) lastprivate (x) allocate (h1:x) firstprivate(y) allocate (h2:y)
+ for (int i = 0; i < 64; i++)
+ x = y + i;
+ return x;
+}
+
+int
+bar (int y)
+{
+ int x;
+ #pragma omp taskloop default(none) lastprivate (x) allocate (baz (0):x) allocate (baz (1):y) firstprivate(y)
+ for (int i = 0; i < 64; i++)
+ x = y + i;
+ return x;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/allocate-4.c b/gcc/testsuite/c-c++-common/gomp/allocate-4.c
new file mode 100644
index 0000000..4e0f44a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/allocate-4.c
@@ -0,0 +1,39 @@
+void
+foo (void)
+{
+ int s[4] = { 0, 0, 0, 0 };
+ int *p = s;
+#pragma omp parallel reduction (+: s) allocate(s)
+ s[0]++;
+#pragma omp parallel reduction (+: s[0:3]) allocate(s)
+ s[0]++;
+#pragma omp parallel reduction (+: s[2:2]) allocate(s)
+ s[2]++;
+#pragma omp parallel reduction (+: p[:2]) allocate(p)
+ p[0]++;
+#pragma omp parallel reduction (+: p[2:2]) allocate(p)
+ p[2]++;
+}
+
+void
+bar (void)
+{
+ int s[4] = { 0, 0, 0, 0 };
+ int *p = s;
+ int i;
+#pragma omp teams distribute parallel for reduction (+: s) allocate(s)
+ for (i = 0; i < 64; i++)
+ s[0]++;
+#pragma omp teams distribute parallel for reduction (+: s[0:3]) allocate(s)
+ for (i = 0; i < 64; i++)
+ s[0]++;
+#pragma omp teams distribute parallel for reduction (+: s[2:2]) allocate(s)
+ for (i = 0; i < 64; i++)
+ s[2]++;
+#pragma omp teams distribute parallel for reduction (+: p[:2]) allocate(p)
+ for (i = 0; i < 64; i++)
+ p[0]++;
+#pragma omp teams distribute parallel for reduction (+: p[2:2]) allocate(p)
+ for (i = 0; i < 64; i++)
+ p[2]++;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-1.c b/gcc/testsuite/c-c++-common/gomp/clauses-1.c
index be42797..105288e 100644
--- a/gcc/testsuite/c-c++-common/gomp/clauses-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-1.c
@@ -1,6 +1,23 @@
/* { dg-do compile } */
/* { dg-additional-options "-std=c99" { target c } } */
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
int t;
#pragma omp threadprivate (t)
@@ -14,20 +31,20 @@ foo (int d, int m, int i1, int i2, int p, int *idp, int s,
#pragma omp distribute parallel for \
private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) schedule(static, 4) order(concurrent)
+ lastprivate (l) schedule(static, 4) order(concurrent) allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp distribute parallel for simd \
private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
if (parallel: i2) if(simd: i1) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) nontemporal(ntm) \
- safelen(8) simdlen(4) aligned(q: 32) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) order(concurrent) allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp distribute simd \
private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
safelen(8) simdlen(4) aligned(q: 32) reduction(+:r) if(i1) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
}
@@ -49,20 +66,20 @@ baz (int d, int m, int i1, int i2, int p, int *idp, int s,
#pragma omp distribute parallel for \
private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) schedule(static, 4) copyin(t) order(concurrent)
+ lastprivate (l) schedule(static, 4) copyin(t) order(concurrent) allocate (p)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp distribute parallel for simd \
private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
if (parallel: i2) if(simd: i1) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) nontemporal(ntm) \
- safelen(8) simdlen(4) aligned(q: 32) copyin(t) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) copyin(t) order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp distribute simd \
private (p) firstprivate (f) collapse(1) dist_schedule(static, 16) \
safelen(8) simdlen(4) aligned(q: 32) reduction(+:r) if(i1) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp loop bind(parallel) order(concurrent) \
@@ -77,28 +94,28 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
{
#pragma omp for simd \
private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait \
- safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) if(i1) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) if(i1) order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel for \
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1)
+ lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel for \
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) order(concurrent)
+ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel for simd \
private (p) firstprivate (f) if (i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \
- safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel sections \
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l)
+ lastprivate (l) allocate (f)
{
#pragma omp section
{}
@@ -108,35 +125,39 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
#pragma omp target parallel \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- nowait depend(inout: dd[0])
+ nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f)
;
#pragma omp target parallel for \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) nowait depend(inout: dd[0])
+ lastprivate (l) linear (ll:1) ordered schedule(static, 4) collapse(1) nowait depend(inout: dd[0]) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target parallel for \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) nowait depend(inout: dd[0]) order(concurrent)
+ lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) nowait depend(inout: dd[0]) order(concurrent) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target parallel for simd \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
lastprivate (l) linear (ll:1) schedule(static, 4) collapse(1) \
- safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3) order(concurrent)
+ safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3) order(concurrent) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target teams \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
- shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0])
+ shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0]) \
+ allocate (omp_default_mem_alloc:f)
;
#pragma omp target teams distribute \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
- collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0])
+ collapse(1) dist_schedule(static, 16) nowait depend(inout: dd[0]) allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
;
#pragma omp target teams distribute parallel for \
@@ -144,7 +165,8 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
- lastprivate (l) schedule(static, 4) nowait depend(inout: dd[0]) order(concurrent)
+ lastprivate (l) schedule(static, 4) nowait depend(inout: dd[0]) order(concurrent) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target teams distribute parallel for simd \
@@ -153,47 +175,50 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) order(concurrent) \
- safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3)
+ safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) if (simd: i3) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target teams distribute simd \
device(d) map (tofrom: m) if (i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) order(concurrent) \
- safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm)
+ safelen(8) simdlen(4) aligned(q: 32) nowait depend(inout: dd[0]) nontemporal(ntm) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target simd \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
safelen(8) simdlen(4) lastprivate (l) linear(ll: 1) aligned(q: 32) reduction(+:r) \
- nowait depend(inout: dd[0]) nontemporal(ntm) if(simd:i3) order(concurrent)
+ nowait depend(inout: dd[0]) nontemporal(ntm) if(simd:i3) order(concurrent) \
+ allocate (omp_default_mem_alloc:f)
for (int i = 0; i < 64; i++)
ll++;
- #pragma omp taskgroup task_reduction(+:r2)
+ #pragma omp taskgroup task_reduction(+:r2) allocate (r2)
#pragma omp taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
- #pragma omp taskgroup task_reduction(+:r)
+ #pragma omp taskgroup task_reduction(+:r) allocate (r)
#pragma omp taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(i1) final(fi) mergeable nogroup priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) in_reduction(+:r) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp taskwait
#pragma omp taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) if(taskloop: i1) final(fi) priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(+:r) if (simd: i3) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target nowait depend(inout: dd[0])
#pragma omp teams distribute \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
- collapse(1) dist_schedule(static, 16)
+ collapse(1) dist_schedule(static, 16) allocate (omp_default_mem_alloc: f)
for (int i = 0; i < 64; i++)
;
#pragma omp target
@@ -201,7 +226,7 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
- lastprivate (l) schedule(static, 4) order(concurrent)
+ lastprivate (l) schedule(static, 4) order(concurrent) allocate (omp_default_mem_alloc: f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target
@@ -210,21 +235,23 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) order(concurrent) \
- safelen(8) simdlen(4) aligned(q: 32) if (simd: i3) nontemporal(ntm)
+ safelen(8) simdlen(4) aligned(q: 32) if (simd: i3) nontemporal(ntm) \
+ allocate (omp_default_mem_alloc: f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp target
#pragma omp teams distribute simd \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) order(concurrent) \
- safelen(8) simdlen(4) aligned(q: 32) if(i3) nontemporal(ntm)
+ safelen(8) simdlen(4) aligned(q: 32) if(i3) nontemporal(ntm) \
+ allocate (omp_default_mem_alloc: f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp teams distribute parallel for \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) order(concurrent) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
- lastprivate (l) schedule(static, 4) copyin(t)
+ lastprivate (l) schedule(static, 4) copyin(t) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp teams distribute parallel for simd \
@@ -232,65 +259,66 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
collapse(1) dist_schedule(static, 16) \
if (parallel: i2) num_threads (nth) proc_bind(spread) \
lastprivate (l) schedule(static, 4) order(concurrent) \
- safelen(8) simdlen(4) aligned(q: 32) if (simd: i3) nontemporal(ntm) copyin(t)
+ safelen(8) simdlen(4) aligned(q: 32) if (simd: i3) nontemporal(ntm) copyin(t) \
+ allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp teams distribute simd \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
collapse(1) dist_schedule(static, 16) order(concurrent) \
- safelen(8) simdlen(4) aligned(q: 32) if(i3) nontemporal(ntm)
+ safelen(8) simdlen(4) aligned(q: 32) if(i3) nontemporal(ntm) allocate(f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel master \
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) reduction(+:r) \
- num_threads (nth) proc_bind(spread) copyin(t)
+ num_threads (nth) proc_bind(spread) copyin(t) allocate (f)
;
- #pragma omp taskgroup task_reduction (+:r2)
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) \
- reduction(default, +:r) in_reduction(+:r2)
+ reduction(default, +:r) in_reduction(+:r2) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
- #pragma omp taskgroup task_reduction (+:r2)
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) final(fi) mergeable priority (pp) \
- reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t)
+ reduction(default, +:r) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) grainsize (g) collapse(1) untied if(taskloop: i1) if(simd: i2) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) if (parallel: i2) num_threads (nth) proc_bind(spread) copyin(t) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
- #pragma omp taskgroup task_reduction (+:r2)
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
reduction(default, +:r) in_reduction(+:r2)
for (int i = 0; i < 64; i++)
ll++;
- #pragma omp taskgroup task_reduction (+:r2)
+ #pragma omp taskgroup task_reduction (+:r2) allocate (r2)
#pragma omp master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) in_reduction(+:r2) nontemporal(ntm) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel master taskloop \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
- reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t)
+ reduction(default, +:r) num_threads (nth) proc_bind(spread) copyin(t) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp parallel master taskloop simd \
private (p) firstprivate (f) lastprivate (l) shared (s) default(shared) num_tasks (nta) collapse(1) untied if(i1) final(fi) mergeable priority (pp) \
safelen(8) simdlen(4) linear(ll: 1) aligned(q: 32) reduction(default, +:r) nontemporal(ntm) num_threads (nth) proc_bind(spread) copyin(t) \
- order(concurrent)
+ order(concurrent) allocate (f)
for (int i = 0; i < 64; i++)
ll++;
#pragma omp loop bind(thread) order(concurrent) \
@@ -299,46 +327,50 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
ll++;
#pragma omp parallel loop \
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) collapse(1) bind(parallel) order(concurrent)
+ lastprivate (l) collapse(1) bind(parallel) order(concurrent) allocate (f)
for (l = 0; l < 64; l++)
ll++;
#pragma omp parallel loop \
private (p) firstprivate (f) if (parallel: i2) default(shared) shared(s) copyin(t) reduction(+:r) num_threads (nth) proc_bind(spread) \
- lastprivate (l) collapse(1)
+ lastprivate (l) collapse(1) allocate (f)
for (l = 0; l < 64; l++)
ll++;
#pragma omp teams loop \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
- collapse(1) lastprivate (l) bind(teams)
+ collapse(1) lastprivate (l) bind(teams) allocate (f)
for (l = 0; l < 64; ++l)
;
#pragma omp teams loop \
private(p) firstprivate (f) shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) \
- collapse(1) lastprivate (l) order(concurrent)
+ collapse(1) lastprivate (l) order(concurrent) allocate (f)
for (l = 0; l < 64; ++l)
;
#pragma omp target parallel loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- nowait depend(inout: dd[0]) lastprivate (l) bind(parallel) order(concurrent) collapse(1)
+ nowait depend(inout: dd[0]) lastprivate (l) bind(parallel) order(concurrent) collapse(1) \
+ allocate (omp_default_mem_alloc: f)
for (l = 0; l < 64; ++l)
;
#pragma omp target parallel loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) default(shared) shared(s) reduction(+:r) num_threads (nth) proc_bind(spread) \
- nowait depend(inout: dd[0]) lastprivate (l) order(concurrent) collapse(1)
+ nowait depend(inout: dd[0]) lastprivate (l) order(concurrent) collapse(1) \
+ allocate (omp_default_mem_alloc: f)
for (l = 0; l < 64; ++l)
;
#pragma omp target teams loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0]) \
- lastprivate (l) bind(teams) collapse(1)
+ lastprivate (l) bind(teams) collapse(1) \
+ allocate (omp_default_mem_alloc: f)
for (l = 0; l < 64; ++l)
;
#pragma omp target teams loop \
device(d) map (tofrom: m) if (target: i1) private (p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
shared(s) default(shared) reduction(+:r) num_teams(nte) thread_limit(tl) nowait depend(inout: dd[0]) \
- lastprivate (l) order(concurrent) collapse(1)
+ lastprivate (l) order(concurrent) collapse(1) \
+ allocate (omp_default_mem_alloc: f)
for (l = 0; l < 64; ++l)
;
}
diff --git a/gcc/testsuite/c-c++-common/gomp/clauses-2.c b/gcc/testsuite/c-c++-common/gomp/clauses-2.c
index ded1d74..bbc8fb4 100644
--- a/gcc/testsuite/c-c++-common/gomp/clauses-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/clauses-2.c
@@ -13,35 +13,35 @@ foo (int *p, int q, struct S t, int i, int j, int k, int l)
bar (p);
#pragma omp target map (p[0]) map (p) /* { dg-error "appears both in data and map clauses" } */
bar (p);
- #pragma omp target map (p) , map (p[0]) /* { dg-error "appears both in data and map clauses" } */
+ #pragma omp target map (p) , map (p[0])
bar (p);
#pragma omp target map (q) map (q) /* { dg-error "appears more than once in map clauses" } */
bar (&q);
#pragma omp target map (p[0]) map (p[0]) /* { dg-error "appears more than once in data clauses" } */
bar (p);
- #pragma omp target map (t) map (t.r) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t) map (t.r)
bar (&t.r);
- #pragma omp target map (t.r) map (t) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t.r) map (t)
bar (&t.r);
- #pragma omp target map (t.r) map (t.r) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t.r) map (t.r)
bar (&t.r);
#pragma omp target firstprivate (t), map (t.r) /* { dg-error "appears both in data and map clauses" } */
bar (&t.r);
#pragma omp target map (t.r) firstprivate (t) /* { dg-error "appears both in data and map clauses" } */
bar (&t.r);
- #pragma omp target map (t.s[0]) map (t) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t.s[0]) map (t)
bar (t.s);
- #pragma omp target map (t) map(t.s[0]) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t) map(t.s[0])
bar (t.s);
#pragma omp target firstprivate (t) map (t.s[0]) /* { dg-error "appears both in data and map clauses" } */
bar (t.s);
#pragma omp target map (t.s[0]) firstprivate (t) /* { dg-error "appears both in data and map clauses" } */
bar (t.s);
- #pragma omp target map (t.s[0]) map (t.s[2]) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t.s[0]) map (t.s[2])
bar (t.s);
- #pragma omp target map (t.t[0:2]) map (t.t[4:6]) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t.t[0:2]) map (t.t[4:6])
bar (t.t);
- #pragma omp target map (t.t[i:j]) map (t.t[k:l]) /* { dg-error "appears more than once in map clauses" } */
+ #pragma omp target map (t.t[i:j]) map (t.t[k:l])
bar (t.t);
#pragma omp target map (t.s[0]) map (t.r)
bar (t.s);
@@ -50,5 +50,5 @@ foo (int *p, int q, struct S t, int i, int j, int k, int l)
#pragma omp target map (t.r) map (t) map (t.s[0]) firstprivate (t) /* { dg-error "appears both in data and map clauses" } */
bar (t.s);
#pragma omp target map (t) map (t.r) firstprivate (t) map (t.s[0]) /* { dg-error "appears both in data and map clauses" } */
- bar (t.s); /* { dg-error "appears more than once in map clauses" "" { target *-*-* } .-1 } */
+ bar (t.s);
}
diff --git a/gcc/testsuite/c-c++-common/gomp/map-5.c b/gcc/testsuite/c-c++-common/gomp/map-5.c
new file mode 100644
index 0000000..1d9d925
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/map-5.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+void foo (void)
+{
+ /* Basic test to ensure to,from,tofrom is ordered before alloc,release,delete clauses. */
+ int a, b, c;
+ #pragma omp target enter data map(alloc:a) map(to:b) map(alloc:c)
+ #pragma omp target exit data map(from:a) map(release:b) map(from:c)
+
+ #pragma omp target map(alloc:a) map(tofrom:b) map(alloc:c)
+ a = b = c = 1;
+
+ #pragma omp target enter data map(to:a) map(alloc:b) map(to:c)
+ #pragma omp target exit data map(from:a) map(delete:b) map(from:c)
+}
+
+/* { dg-final { scan-tree-dump "pragma omp target enter data map\\(to:.* map\\(alloc:.* map\\(alloc:.*" "gimple" } } */
+/* { dg-final { scan-tree-dump "pragma omp target exit data map\\(from:.* map\\(from:.* map\\(release:.*" "gimple" } } */
+
+/* { dg-final { scan-tree-dump "pragma omp target num_teams.* map\\(tofrom:.* map\\(alloc:.* map\\(alloc:.*" "gimple" } } */
+
+/* { dg-final { scan-tree-dump "pragma omp target enter data map\\(to:.* map\\(to:.* map\\(alloc:.*" "gimple" } } */
+/* { dg-final { scan-tree-dump "pragma omp target exit data map\\(from:.* map\\(from:.* map\\(delete:.*" "gimple" } } */
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/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/c-c++-common/zero-scratch-regs-1.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-1.c
new file mode 100644
index 0000000..2463353
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-1.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+volatile int result = 0;
+int
+__attribute__((noipa))
+foo (int x)
+{
+ return x;
+}
+int main()
+{
+ result = foo (2);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c
new file mode 100644
index 0000000..d63a57d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-10.c
@@ -0,0 +1,93 @@
+/* { dg-do run } */
+/* { dg-skip-if "not implemented" { powerpc*-*-darwin* } } */
+/* { dg-options "-O2" } */
+
+#include <assert.h>
+int result = 0;
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("skip")))
+foo1 (int x)
+{
+ return (x + 1);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("used-gpr-arg")))
+foo2 (int x)
+{
+ return (x + 2);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("used-gpr")))
+foo3 (int x)
+{
+ return (x + 3);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("used-arg")))
+foo4 (int x)
+{
+ return (x + 4);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("used")))
+foo5 (int x)
+{
+ return (x + 5);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("all-gpr-arg")))
+foo6 (int x)
+{
+ return (x + 6);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("all-gpr")))
+foo7 (int x)
+{
+ return (x + 7);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("all-arg")))
+foo8 (int x)
+{
+ return (x + 8);
+}
+
+int
+__attribute__((noipa))
+__attribute__ ((zero_call_used_regs("all")))
+foo9 (int x)
+{
+ return (x + 9);
+}
+
+int main()
+{
+ result = foo1 (1);
+ result += foo2 (1);
+ result += foo3 (1);
+ result += foo4 (1);
+ result += foo5 (1);
+ result += foo6 (1);
+ result += foo7 (1);
+ result += foo8 (1);
+ result += foo9 (1);
+ assert (result == 54);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c
new file mode 100644
index 0000000..1d8cabb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-skip-if "not implemented" { powerpc*-*-darwin* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all" } */
+
+#include "zero-scratch-regs-10.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-2.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-2.c
new file mode 100644
index 0000000..25891ac
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-2.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-gpr-arg" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-3.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-3.c
new file mode 100644
index 0000000..7c3d286
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-3.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-gpr" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-4.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-4.c
new file mode 100644
index 0000000..ba28c06
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-4.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-arg" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-5.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-5.c
new file mode 100644
index 0000000..26679a4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-5.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=used" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c
new file mode 100644
index 0000000..80f5bbb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-6.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr-arg" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c
new file mode 100644
index 0000000..159f35c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c
new file mode 100644
index 0000000..7fef0d2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-8.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-skip-if "not implemented" { powerpc*-*-darwin* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-arg" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c
new file mode 100644
index 0000000..1561656
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-skip-if "not implemented" { powerpc*-*-darwin* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all" } */
+
+#include "zero-scratch-regs-1.c"
diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-attr-usages.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-attr-usages.c
new file mode 100644
index 0000000..1e75795
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-attr-usages.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int result __attribute__ ((zero_call_used_regs("all"))); /* { dg-error "attribute applies only to functions" } */
+int
+__attribute__ ((zero_call_used_regs("gpr-arg-all")))
+foo1 (int x) /* { dg-error "unrecognized 'zero_call_used_regs' attribute argument" } */
+{
+ return (x + 1);
+}
+int
+__attribute__ ((zero_call_used_regs(1)))
+foo2 (int x) /* { dg-error "argument not a string" } */
+{
+ return (x + 2);
+}
diff --git a/gcc/testsuite/g++.dg/DRs/dr2303.C b/gcc/testsuite/g++.dg/DRs/dr2303.C
new file mode 100644
index 0000000..b6acb6e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr2303.C
@@ -0,0 +1,37 @@
+// DR 2303
+// PR c++/97453
+// { dg-do compile { target c++11 } }
+
+template <typename... T> struct A;
+template <> struct A<>
+{
+};
+template <typename T, typename... Ts> struct A<T, Ts...> : A<Ts...>
+{
+};
+struct B : A<int, int>
+{
+};
+
+struct C : A<int, int>, A<int> // { dg-warning "direct base .A<int>. inaccessible in .C. due to ambiguity" }
+{
+};
+
+struct D : A<int>, A<int, int> // { dg-warning "direct base .A<int>. inaccessible in .D. due to ambiguity" }
+{
+};
+template <typename... T>
+void
+f (const A<T...> &)
+{
+ static_assert (sizeof...(T) == 2, "it should duduce to A<int,int>");
+}
+
+
+void
+g ()
+{
+ f (B{});
+ f (C{});
+ f (D{});
+}
diff --git a/gcc/testsuite/g++.dg/DRs/dr625.C b/gcc/testsuite/g++.dg/DRs/dr625.C
new file mode 100644
index 0000000..ce30a92
--- /dev/null
+++ b/gcc/testsuite/g++.dg/DRs/dr625.C
@@ -0,0 +1,15 @@
+// DR 625 - Use of auto as a template-argument
+// PR c++/97479
+// { dg-do compile { target c++14 } }
+
+template<typename>
+struct A { };
+
+void f(int);
+
+int main()
+{
+ A<decltype(auto)> x = A<void>(); // { dg-error "not permitted|invalid|cannot convert" }
+ A<auto> a = A<void>(); // { dg-error "not permitted|invalid|cannot convert" }
+ void (*p)(auto); // { dg-error "parameter" }
+}
diff --git a/gcc/testsuite/g++.dg/Wclass-memaccess.C b/gcc/testsuite/g++.dg/Wclass-memaccess.C
index 57573b3..1dc23df 100644
--- a/gcc/testsuite/g++.dg/Wclass-memaccess.C
+++ b/gcc/testsuite/g++.dg/Wclass-memaccess.C
@@ -23,6 +23,10 @@ typedef unsigned char byte;
#endif
}
+#if __cplusplus < 201103L
+typedef unsigned short char16_t;
+#endif
+
/* Ordinary bzcopy and bzero aren't recognized as special. */
#define bcopy __builtin_bcopy
#define bzero __builtin_bzero
@@ -190,6 +194,7 @@ struct HasDefault { char a[4]; HasDefault (); };
void test (HasDefault *p, const HasDefault &x,
void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -247,6 +252,8 @@ void test (HasDefault *p, const HasDefault &x,
T (memcpy, (p, ia, sizeof *p)); // { dg-warning ".void\\* memcpy(\[^\n\r\]*). copying an object of non-trivial type .struct HasDefault. from an array of .const int." }
extern long *ip;
T (memcpy, (p, ip, sizeof *p)); // { dg-warning ".void\\* memcpy(\[^\n\r\]*). copying an object of non-trivial type .struct HasDefault. from an array of .long." }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning ".void\\* memcpy(\[^\n\r\]*). copying an object of non-trivial type .struct HasDefault. from an array of .const signed char." }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning ".void\\* memcpy(\[^\n\r\]*). copying an object of non-trivial type .struct HasDefault. from an array of .const \(char16_t\|unsigned short\)." }
T (memmove, (p, ia, sizeof *p)); // { dg-warning ".void\\* memmove(\[^\n\r\]*). copying an object of non-trivial type .struct HasDefault. from an array of .const int." }
@@ -274,6 +281,7 @@ struct HasTemplateDefault
void test (HasTemplateDefault *p, const HasTemplateDefault &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -291,24 +299,32 @@ void test (HasTemplateDefault *p, const HasTemplateDefault &x,
T (bcopy, (q, p, sizeof *p));
T (bcopy, (s, p, sizeof *p));
T (bcopy, (b, p, sizeof *p));
+ T (bcopy, (ss, p, sizeof *p)); // { dg-warning "bcopy" }
+ T (bcopy, (ws, p, sizeof *p)); // { dg-warning "bcopy" }
T (bcopy, (ia, p, sizeof *p)); // { dg-warning "bcopy" }
T (memcpy, (p, &x, sizeof *p));
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p));
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p));
T (mempcpy, (p, q, sizeof *p));
T (mempcpy, (p, s, sizeof *p));
T (mempcpy, (p, b, sizeof *p));
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -329,6 +345,7 @@ struct HasCopy { int i; HasCopy (const HasCopy&); };
void test (HasCopy *p, const HasCopy &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -348,24 +365,32 @@ void test (HasCopy *p, const HasCopy &x,
T (bcopy, (q, p, sizeof *p)); // { dg-warning "bcopy" }
T (bcopy, (s, p, sizeof *p)); // { dg-warning "bcopy" }
T (bcopy, (b, p, sizeof *p)); // { dg-warning "bcopy" }
+ T (bcopy, (ss, p, sizeof *p)); // { dg-warning "bcopy" }
+ T (bcopy, (ws, p, sizeof *p)); // { dg-warning "bcopy" }
T (bcopy, (ia, p, sizeof *p)); // { dg-warning "bcopy" }
T (memcpy, (p, &x, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -410,6 +435,7 @@ private:
void test (HasPrivateCopy *p, const HasPrivateCopy &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -429,18 +455,24 @@ void test (HasPrivateCopy *p, const HasPrivateCopy &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -459,6 +491,7 @@ struct HasDtor { int i; ~HasDtor (); };
void test (HasDtor *p, const HasDtor &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -479,18 +512,24 @@ void test (HasDtor *p, const HasDtor &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -503,7 +542,7 @@ void test (HasDtor *p, const HasDtor &x,
#if !defined TEST || TEST == TEST_HAS_DELETED_DTOR
-// HasDeletedDtor is trivial so clearing and cpying it is okay.
+// HasDeletedDtor is trivial so clearing and copying it is okay.
// Relocation would bypass the deleted dtor and so it's diagnosed.
struct HasDeletedDtor
@@ -514,6 +553,7 @@ struct HasDeletedDtor
void test (HasDeletedDtor *p, const HasDeletedDtor &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -528,18 +568,24 @@ void test (HasDeletedDtor *p, const HasDeletedDtor &x,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p));
+ T (memcpy, (p, ws, sizeof *p));
T (memcpy, (p, ia, sizeof *p));
T (memmove, (p, &x, sizeof *p));
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p));
+ T (memmove, (p, ws, sizeof *p));
T (memmove, (p, ia, sizeof *p));
T (mempcpy, (p, &x, sizeof *p));
T (mempcpy, (p, q, sizeof *p));
T (mempcpy, (p, s, sizeof *p));
T (mempcpy, (p, b, sizeof *p));
+ T (mempcpy, (p, ss, sizeof *p));
+ T (mempcpy, (p, ws, sizeof *p));
T (mempcpy, (p, ia, sizeof *p));
// Reallocating is diagnosed.
@@ -564,6 +610,7 @@ private:
void test (HasPrivateDtor *p, const HasPrivateDtor &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -578,18 +625,24 @@ void test (HasPrivateDtor *p, const HasPrivateDtor &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is diagnosed.
@@ -608,6 +661,7 @@ struct HasCopyAssign { void operator= (HasCopyAssign&); };
void test (HasCopyAssign *p, const HasCopyAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -626,18 +680,24 @@ void test (HasCopyAssign *p, const HasCopyAssign &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -665,6 +725,7 @@ struct HasMoveAssign
void test (HasMoveAssign *p, const HasMoveAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -683,18 +744,24 @@ void test (HasMoveAssign *p, const HasMoveAssign &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -727,6 +794,7 @@ struct TrivialCopyHasMoveAssign
void test (TrivialCopyHasMoveAssign *p, const TrivialCopyHasMoveAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -745,18 +813,24 @@ void test (TrivialCopyHasMoveAssign *p, const TrivialCopyHasMoveAssign &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -786,6 +860,7 @@ struct TrivialMoveNontrivialCopyAssign
void test (TrivialMoveNontrivialCopyAssign *p,
const TrivialMoveNontrivialCopyAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -804,18 +879,24 @@ void test (TrivialMoveNontrivialCopyAssign *p,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -841,6 +922,7 @@ struct TrivialAssignRefOverload {
void test (TrivialAssignRefOverload *p, const TrivialAssignRefOverload &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -855,18 +937,24 @@ void test (TrivialAssignRefOverload *p, const TrivialAssignRefOverload &x,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p));
+ T (memcpy, (p, ws, sizeof *p));
T (memcpy, (p, ia, sizeof *p));
T (memmove, (p, &x, sizeof *p));
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p));
+ T (memmove, (p, ws, sizeof *p));
T (memmove, (p, ia, sizeof *p));
T (mempcpy, (p, &x, sizeof *p));
T (mempcpy, (p, q, sizeof *p));
T (mempcpy, (p, s, sizeof *p));
T (mempcpy, (p, b, sizeof *p));
+ T (mempcpy, (p, ss, sizeof *p));
+ T (mempcpy, (p, ws, sizeof *p));
T (mempcpy, (p, ia, sizeof *p));
T (q = realloc, (p, 1));
@@ -892,6 +980,7 @@ struct TrivialAssignCstRefOverload {
void test (TrivialAssignCstRefOverload *p,
const TrivialAssignCstRefOverload &x,
const void *q, const unsigned char *s, std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -906,18 +995,24 @@ void test (TrivialAssignCstRefOverload *p,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p));
+ T (memcpy, (p, ws, sizeof *p));
T (memcpy, (p, ia, sizeof *p));
T (memmove, (p, &x, sizeof *p));
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p));
+ T (memmove, (p, ws, sizeof *p));
T (memmove, (p, ia, sizeof *p));
T (mempcpy, (p, &x, sizeof *p));
T (mempcpy, (p, q, sizeof *p));
T (mempcpy, (p, s, sizeof *p));
T (mempcpy, (p, b, sizeof *p));
+ T (mempcpy, (p, ss, sizeof *p));
+ T (mempcpy, (p, ws, sizeof *p));
T (mempcpy, (p, ia, sizeof *p));
T (q = realloc, (p, 1));
@@ -940,6 +1035,7 @@ struct TrivialRefHasVolRefAssign
void test (TrivialRefHasVolRefAssign *p,
const TrivialRefHasVolRefAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -958,18 +1054,24 @@ void test (TrivialRefHasVolRefAssign *p,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -991,6 +1093,7 @@ struct HasVolRefAssign {
void test (HasVolRefAssign *p, const HasVolRefAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1009,18 +1112,24 @@ void test (HasVolRefAssign *p, const HasVolRefAssign &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -1040,6 +1149,7 @@ struct HasVirtuals { int i; virtual void foo (); };
void test (HasVirtuals *p, const HasVirtuals &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1057,18 +1167,24 @@ void test (HasVirtuals *p, const HasVirtuals &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -1089,6 +1205,7 @@ struct HasConstData { const char a[4]; };
void test (HasConstData *p, const HasConstData &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1115,18 +1232,24 @@ void test (HasConstData *p, const HasConstData &x,
T (memcpy, (p, q, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, s, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memmove, (p, &x, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is not diagnosed except in C++ 98 due to a bug.
@@ -1147,6 +1270,7 @@ struct HasReference { int &ci; };
void test (HasReference *p, const HasReference &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1181,6 +1305,10 @@ void test (HasReference *p, const HasReference &x,
T (memcpy, (p, s, n)); // { dg-warning "memcpy" }
T (memcpy, (p, b, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, b, n)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, n)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, n)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, n)); // { dg-warning "memcpy" }
@@ -1188,12 +1316,16 @@ void test (HasReference *p, const HasReference &x,
T (memmove, (p, q, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, s, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, b, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (mempcpy, (p, &x, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, q, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, s, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, b, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is not diagnosed because a type with a reference
@@ -1218,6 +1350,7 @@ struct HasMemDataPtr { int HasMemDataPtr::*p; };
void test (HasMemDataPtr *p, const HasMemDataPtr &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1243,6 +1376,10 @@ void test (HasMemDataPtr *p, const HasMemDataPtr &x,
T (memcpy, (p, s, n));
T (memcpy, (p, b, sizeof *p));
T (memcpy, (p, b, n));
+ T (memcpy, (p, ss, sizeof *p));
+ T (memcpy, (p, ss, n));
+ T (memcpy, (p, ws, sizeof *p));
+ T (memcpy, (p, ws, n));
T (memcpy, (p, ia, sizeof *p));
T (memcpy, (p, ia, n));
@@ -1250,12 +1387,16 @@ void test (HasMemDataPtr *p, const HasMemDataPtr &x,
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p));
+ T (memmove, (p, ws, sizeof *p));
T (memmove, (p, ia, sizeof *p));
T (mempcpy, (p, &x, sizeof *p));
T (mempcpy, (p, q, sizeof *p));
T (mempcpy, (p, s, sizeof *p));
T (mempcpy, (p, b, sizeof *p));
+ T (mempcpy, (p, ss, sizeof *p));
+ T (mempcpy, (p, ws, sizeof *p));
T (mempcpy, (p, ia, sizeof *p));
// Reallocating is the same as calling memcpy.
@@ -1276,6 +1417,7 @@ struct HasSomePrivateData { char a[2]; private: char b[2]; };
void test (HasSomePrivateData *p, const HasSomePrivateData &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1298,6 +1440,10 @@ void test (HasSomePrivateData *p, const HasSomePrivateData &x,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, n)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, n)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, n)); // { dg-warning "memcpy" }
@@ -1307,6 +1453,10 @@ void test (HasSomePrivateData *p, const HasSomePrivateData &x,
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, n)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, n)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, n)); // { dg-warning "memmove" }
@@ -1319,6 +1469,10 @@ void test (HasSomePrivateData *p, const HasSomePrivateData &x,
T (mempcpy, (p, s, n));
T (mempcpy, (p, b, sizeof *p));
T (mempcpy, (p, b, n));
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, n)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, n)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, n)); // { dg-warning "mempcpy" }
@@ -1342,6 +1496,7 @@ struct HasSomeProtectedData { char a[2]; protected: char b[2]; };
void test (HasSomeProtectedData *p, const HasSomeProtectedData &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1364,6 +1519,10 @@ void test (HasSomeProtectedData *p, const HasSomeProtectedData &x,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, n)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, n)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, n)); // { dg-warning "memcpy" }
@@ -1373,6 +1532,10 @@ void test (HasSomeProtectedData *p, const HasSomeProtectedData &x,
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, n)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, n)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, n)); // { dg-warning "memmove" }
@@ -1385,6 +1548,10 @@ void test (HasSomeProtectedData *p, const HasSomeProtectedData &x,
T (mempcpy, (p, s, n));
T (mempcpy, (p, b, sizeof *p));
T (mempcpy, (p, b, n));
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, n)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, n)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, n)); // { dg-warning "mempcpy" }
@@ -1408,6 +1575,7 @@ struct HasAllPrivateData { private: char a[4]; };
void test (HasAllPrivateData *p, const HasAllPrivateData &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1430,6 +1598,10 @@ void test (HasAllPrivateData *p, const HasAllPrivateData &x,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, n)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, n)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, n)); // { dg-warning "memcpy" }
@@ -1439,6 +1611,10 @@ void test (HasAllPrivateData *p, const HasAllPrivateData &x,
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, n)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, n)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, n)); // { dg-warning "memmove" }
@@ -1451,6 +1627,10 @@ void test (HasAllPrivateData *p, const HasAllPrivateData &x,
T (mempcpy, (p, s, n));
T (mempcpy, (p, b, sizeof *p));
T (mempcpy, (p, b, n));
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, n)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, n)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, n)); // { dg-warning "mempcpy" }
@@ -1474,6 +1654,7 @@ struct HasAllProtectedData { protected: char a[4]; };
void test (HasAllProtectedData *p, const HasAllProtectedData &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1496,6 +1677,10 @@ void test (HasAllProtectedData *p, const HasAllProtectedData &x,
T (memcpy, (p, q, sizeof *p));
T (memcpy, (p, s, sizeof *p));
T (memcpy, (p, b, sizeof *p));
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ss, n)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "memcpy" }
+ T (memcpy, (p, ws, n)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "memcpy" }
T (memcpy, (p, ia, n)); // { dg-warning "memcpy" }
@@ -1505,6 +1690,10 @@ void test (HasAllProtectedData *p, const HasAllProtectedData &x,
T (memmove, (p, q, sizeof *p));
T (memmove, (p, s, sizeof *p));
T (memmove, (p, b, sizeof *p));
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ss, n)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, n)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, n)); // { dg-warning "memmove" }
@@ -1517,6 +1706,10 @@ void test (HasAllProtectedData *p, const HasAllProtectedData &x,
T (mempcpy, (p, s, n));
T (mempcpy, (p, b, sizeof *p));
T (mempcpy, (p, b, n));
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ss, n)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, n)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, n)); // { dg-warning "mempcpy" }
@@ -1543,6 +1736,7 @@ private:
void test (HasDefaultPrivateAssign *p, const HasDefaultPrivateAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1596,8 +1790,14 @@ void test (HasDefaultPrivateAssign *p, const HasDefaultPrivateAssign &x,
T (mempcpy, (p, q, 3)); // { dg-warning "mempcpy" } */
// Otherwise, copying from an object of an unrelated type is diagnosed.
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "writing to an object of type .struct HasDefaultPrivateAssign. with (deleted|no trivial) copy-assignment." }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "writing to an object of type .struct HasDefaultPrivateAssign. with (deleted|no trivial) copy-assignment." }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "writing to an object of type .struct HasDefaultPrivateAssign. with (deleted|no trivial) copy-assignment." }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
@@ -1621,6 +1821,7 @@ private:
void test (HasDefaultDeletedAssign *p, const HasDefaultDeletedAssign &x,
const void *q, const unsigned char *s, const std::byte *b,
+ const signed char *ss, const char16_t *ws,
const int ia[])
{
const int i = *ia;
@@ -1674,8 +1875,14 @@ void test (HasDefaultDeletedAssign *p, const HasDefaultDeletedAssign &x,
T (mempcpy, (p, q, 3)); // { dg-warning "mempcpy" } */
// Otherwise, copying from an object of an unrelated type is diagnosed.
+ T (memcpy, (p, ss, sizeof *p)); // { dg-warning "writing to an object of type .struct HasDefaultDeletedAssign. with (deleted|no trivial) copy-assignment." }
+ T (memcpy, (p, ws, sizeof *p)); // { dg-warning "writing to an object of type .struct HasDefaultDeletedAssign. with (deleted|no trivial) copy-assignment." }
T (memcpy, (p, ia, sizeof *p)); // { dg-warning "writing to an object of type .struct HasDefaultDeletedAssign. with (deleted|no trivial) copy-assignment." }
+ T (memmove, (p, ss, sizeof *p)); // { dg-warning "memmove" }
+ T (memmove, (p, ws, sizeof *p)); // { dg-warning "memmove" }
T (memmove, (p, ia, sizeof *p)); // { dg-warning "memmove" }
+ T (mempcpy, (p, ss, sizeof *p)); // { dg-warning "mempcpy" }
+ T (mempcpy, (p, ws, sizeof *p)); // { dg-warning "mempcpy" }
T (mempcpy, (p, ia, sizeof *p)); // { dg-warning "mempcpy" }
// Reallocating is the same as calling memcpy.
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/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/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/pack-1.C b/gcc/testsuite/g++.dg/concepts/pack-1.C
new file mode 100644
index 0000000..b4f2c36
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/pack-1.C
@@ -0,0 +1,31 @@
+// { dg-do compile { target c++17 } }
+// { dg-options "-fconcepts" }
+
+// distilled from <concepts>, via header units
+
+template<typename _ArgTypes>
+struct is_invocable;
+
+template<typename... _Args>
+concept invocable = is_invocable<_Args...>::value;
+
+template<typename _Is>
+requires invocable<_Is>
+class BUG;
+
+template<typename _Is>
+requires invocable<_Is>
+class BUG {}; // { dg-bogus "different constraints" }
+
+template<int> struct is_invocable_NT;
+
+template<int... Ints>
+concept invocable_NT = is_invocable_NT<Ints...>::value;
+
+template<int _Is>
+requires invocable_NT<_Is>
+class BUG_NT;
+
+template<int _Is>
+requires invocable_NT<_Is>
+class BUG_NT {};
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/auto3.C b/gcc/testsuite/g++.dg/cpp0x/auto3.C
index 709898d..2cd0520 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto3.C
@@ -17,7 +17,7 @@ struct A { };
A<int> A1;
// CWG issue 625
-A<auto> A2 = A1; // { dg-error "" "" { target { ! concepts } } }
+A<auto> A2 = A1; // { dg-error "" }
auto foo() { } // { dg-error "auto" "" { target { ! c++14 } } }
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C
index a3f9be5..0e80c30 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C
@@ -114,7 +114,7 @@ badthrow2 () throw (auto &) // { dg-error "invalid use of|expected" }
template <auto V = 4> struct G {}; // { dg-error "11:parameter" "" { target { ! c++17 } } }
template <typename T> struct H { H (); ~H (); };
-H<auto> h; // { dg-error "invalid|initializer" }
+H<auto> h; // { dg-error "invalid|initializer|not permitted in template argument" }
void qq (auto); // { dg-error "auto" "" { target { ! concepts } } }
void qr (auto*); // { dg-error "auto" "" { target { ! concepts } } }
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/fallthrough2.C b/gcc/testsuite/g++.dg/cpp0x/fallthrough2.C
index f2d0ce1..071c2cb 100644
--- a/gcc/testsuite/g++.dg/cpp0x/fallthrough2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/fallthrough2.C
@@ -14,7 +14,7 @@ f (int i)
[[fallthrough]];
case 3:
bar (1);
- [[gnu::fallthrough, gnu::fallthrough]]; // { dg-warning ".fallthrough. attribute specified multiple times" }
+ [[gnu::fallthrough, gnu::fallthrough]]; // { dg-warning ".fallthrough. specified multiple times" }
case 2:
bar (2);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-60.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-60.C
index cb0c31e..9203d1d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-60.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-60.C
@@ -1,4 +1,4 @@
// PR c++/60365
// { dg-do compile { target c++11 } }
-void func [[noreturn, noreturn]] (); // { dg-error "at most once" }
+void func [[noreturn, noreturn]] (); // { dg-warning "specified multiple times" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-72.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-72.C
new file mode 100644
index 0000000..3c235b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-72.C
@@ -0,0 +1,45 @@
+// DR 1914 - Duplicate standard attributes
+// { dg-do compile { target c++11 } }
+
+#define ATTR_NORETURN [[noreturn, noreturn]]
+
+[[noreturn, noreturn]] void fn0(); // { dg-warning "specified multiple times" }
+ATTR_NORETURN void fn0a();
+[[noreturn]] [[noreturn]] void fn1();
+[[deprecated, deprecated]] void fn2(); // { dg-warning "specified multiple times" }
+[[deprecated]] [[deprecated]] void fn3();
+[[maybe_unused]] [[maybe_unused]] int fn4();
+[[maybe_unused, maybe_unused]] int fn5(); // { dg-warning "specified multiple times" }
+[[nodiscard]] [[nodiscard]] int fn6();
+[[nodiscard, nodiscard]] int fn7(); // { dg-warning "specified multiple times" }
+
+struct E { };
+struct A {
+ [[no_unique_address]] [[no_unique_address]] E e;
+};
+struct B {
+ [[no_unique_address, no_unique_address]] E e; // { dg-warning "specified multiple times" }
+};
+
+int
+f (int n)
+{
+ switch (n)
+ {
+ case 1:
+ [[fallthrough, fallthrough]]; // { dg-warning "specified multiple times" }
+ case 2:
+ [[fallthrough]] [[fallthrough]]; // { dg-warning "specified multiple times" }
+ case 3:
+ return 15;
+ }
+
+ if (n == 10)
+ [[likely]] [[likely]] return 42; // { dg-warning "ignoring attribute" }
+ else if (n == 11)
+ [[unlikely]] [[unlikely]] return 10; // { dg-warning "ignoring attribute" }
+ else if (n == 12)
+ [[likely, likely]] return 42; // { dg-warning "specified multiple times" }
+ else
+ [[unlikely, unlikely]] return 0; // { dg-warning "specified multiple times" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-deduce3.C b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce3.C
new file mode 100644
index 0000000..b8417d7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-deduce3.C
@@ -0,0 +1,22 @@
+// PR c++/93107
+// { dg-do compile { target c++11 } }
+
+using size_t = decltype(sizeof 0);
+
+namespace std {
+ template<typename T> struct initializer_list {
+ const T *ptr;
+ size_t n;
+ initializer_list(const T*, size_t);
+ };
+}
+
+template<typename T>
+void Task() {}
+
+auto a = &Task<int>;
+auto b = { &Task<int> };
+auto e{ &Task<int> };
+auto f = { &Task<int>, &Task<int> };
+std::initializer_list<void(*)()> c = { &Task<int> };
+auto d = { static_cast<void(*)()>(&Task<int>) };
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/linkage2.C b/gcc/testsuite/g++.dg/cpp0x/linkage2.C
index 5285868..549bd82 100644
--- a/gcc/testsuite/g++.dg/cpp0x/linkage2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/linkage2.C
@@ -29,5 +29,5 @@ void f() {
ba.g(a); // OK
ba.h(a); // error, B<T>::h never defined
i(ba, a); // OK
- e1+e2+e3;
+ e1+e2+e3; // { dg-warning "arithmetic between different enumeration types" "" { target c++20 } }
}
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/attr-deprecated-2.C b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-2.C
index 12c75c7..ac6c4ae 100644
--- a/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-2.C
@@ -1,4 +1,4 @@
// PR c++/60365
// { dg-do compile { target c++14 } }
-void func [[deprecated, deprecated]] (); // { dg-error "at most once" }
+void func [[deprecated, deprecated]] (); // { dg-warning "specified multiple times" }
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/decltype-auto1.C b/gcc/testsuite/g++.dg/cpp1y/decltype-auto1.C
new file mode 100644
index 0000000..13baf8e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/decltype-auto1.C
@@ -0,0 +1,8 @@
+// PR c++/78209
+// { dg-do compile { target c++14 } }
+
+int main()
+{
+ int &&i = 0;
+ decltype(auto) j = i; // { dg-error "cannot bind rvalue reference" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction75.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction75.C
new file mode 100644
index 0000000..52e6131
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction75.C
@@ -0,0 +1,15 @@
+// PR c++/97663
+
+template <class T> struct foo {};
+template <class T> struct bar {};
+template <class T> struct baz {};
+template <class T> struct qux {};
+template <class T> struct corge {};
+
+namespace N {
+ unsigned foo ();
+ signed bar ();
+ long baz ();
+ long long qux ();
+ short corge ();
+}
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/cpp1z/fold12.C b/gcc/testsuite/g++.dg/cpp1z/fold12.C
new file mode 100644
index 0000000..90d74cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/fold12.C
@@ -0,0 +1,13 @@
+// PR c++/86773
+// { dg-do compile { target c++17 } }
+
+template <typename ... Param>
+auto work(Param && ...param)
+{
+ return ("asda" ... / param); // { dg-error "expected" }
+}
+
+int main()
+{
+ work(1.0, 2.0, 5, 4.0);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/attr-likely2.C b/gcc/testsuite/g++.dg/cpp2a/attr-likely2.C
index ee178de..0bc5f1e 100644
--- a/gcc/testsuite/g++.dg/cpp2a/attr-likely2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/attr-likely2.C
@@ -4,7 +4,7 @@ bool b;
int main()
{
if (b)
- [[likely, likely]] b; // { dg-warning "ignoring" }
+ [[likely, likely]] b; // { dg-warning "specified multiple times" }
else
[[unlikely]] [[likely]] b; // { dg-warning "ignoring" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-complete1.C b/gcc/testsuite/g++.dg/cpp2a/concepts-complete1.C
deleted file mode 100644
index 63f3696..0000000
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-complete1.C
+++ /dev/null
@@ -1,11 +0,0 @@
-// { dg-do compile { target c++20 } }
-
-template <class T> concept has_mem_type = requires { typename T::type; };
-
-template <has_mem_type T> int f () { return 0; }
-template <class T> char f() { return 0; }
-
-struct A;
-static_assert (sizeof (f<A>()) == 1);
-struct A { typedef int type; };
-static_assert (sizeof (f<A>()) > 1);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-decltype2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-decltype2.C
new file mode 100644
index 0000000..529dab1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-decltype2.C
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++20 } }
+
+template <class T> concept C = requires(T t) { t; };
+
+template <class T> using A = decltype((T{}, int{}));
+
+template <class T> concept D = C<A<T>>;
+
+template <class T> void f() requires D<T>;
+
+template <class, class>
+void g() { f<int>(); }
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-fn7.C b/gcc/testsuite/g++.dg/cpp2a/concepts-fn7.C
new file mode 100644
index 0000000..62111df
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-fn7.C
@@ -0,0 +1,11 @@
+// PR c++/95132
+// { dg-do compile { target c++20 } }
+
+template <class T> struct A {
+ static auto f() requires false { return T::fail; }
+};
+
+template <class T>
+concept C = requires { A<T>::f(); };
+
+static_assert(!C<int>);
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-2.C
index ce69a0f..290aaf8 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-2.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-2.C
@@ -4,9 +4,9 @@
template <typename T>
void foo1(T& t) {
typename T::template C<void> tcv = t;
- typename T::template C<auto> u = tcv;
- T::template C<auto>::f (tcv, u); // { dg-error "incomplete" }
- (typename T::template D<auto> (t)); // { dg-error "invalid" }
+ typename T::template C<auto> u = tcv; // { dg-error "not permitted" "" { target c++20 } }
+ T::template C<auto>::f (tcv, u); // { dg-error "incomplete|not permitted" }
+ (typename T::template D<auto> (t)); // { dg-error "invalid|not permitted" }
}
struct T1 {
@@ -22,9 +22,9 @@ struct T1 {
template <typename T>
void foo2(T& t) {
typename T::template C<void> tcv = t;
- typename T::template C<auto> u = tcv;
- T::template C<auto>::f (tcv, u); // { dg-error "incomplete" }
- T::template D<auto> (t); // { dg-error "invalid" }
+ typename T::template C<auto> u = tcv; // { dg-error "not permitted" "" { target c++20 } }
+ T::template C<auto>::f (tcv, u); // { dg-error "incomplete|not permitted" }
+ T::template D<auto> (t); // { dg-error "invalid|not permitted" }
}
struct T2 {
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-3.C
index 3809c2d..d612327 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-3.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979-3.C
@@ -8,9 +8,9 @@
template <typename T>
void foo1(T& t) {
typename T::template C<void> tcv = t;
- typename T::template C<auto> u = tcv;
- T::template C<auto>::f (tcv, u); // { dg-error "incomplete" }
- (typename T::template D<auto> (t)); // { dg-error "invalid" }
+ typename T::template C<auto> u = tcv; // { dg-error "not permitted" "" { target c++20 } }
+ T::template C<auto>::f (tcv, u); // { dg-error "incomplete|not permitted" }
+ (typename T::template D<auto> (t)); // { dg-error "invalid|not permitted" }
}
struct T1 {
@@ -26,9 +26,9 @@ struct T1 {
template <typename T>
void foo2(T& t) {
typename T::template C<void> tcv = t;
- typename T::template C<auto> u = tcv;
- T::template C<auto>::f (tcv, u); // { dg-error "incomplete" }
- T::template D<auto> (t); // { dg-error "yields a type" }
+ typename T::template C<auto> u = tcv; // { dg-error "not permitted" "" { target c++20 } }
+ T::template C<auto>::f (tcv, u); // { dg-error "incomplete|not permitted" }
+ T::template D<auto> (t); // { dg-error "yields a type|not permitted" }
}
struct T2 {
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979.C b/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979.C
index 9bd40df..81555eb 100644
--- a/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979.C
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-pr84979.C
@@ -5,5 +5,5 @@ template<typename> void foo() {}
void bar()
{
- foo<auto>(); // { dg-error "invalid" }
+ foo<auto>(); // { dg-error "not permitted|invalid|no matching function" }
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-using3.C b/gcc/testsuite/g++.dg/cpp2a/concepts-using3.C
new file mode 100644
index 0000000..2c8ad40
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-using3.C
@@ -0,0 +1,52 @@
+// PR c++/93907
+// { dg-options -std=gnu++20 }
+
+// This testcase is a variadic version of concepts-using2.C; the only
+// difference is that 'cd' and 'ce' are now variadic concepts.
+
+template <int a> struct c {
+ static constexpr int d = a;
+ typedef c e;
+};
+template <typename> struct f;
+template <typename b> using g = typename f<b>::e;
+struct b;
+template <typename b> struct f { using e = b; };
+template <typename ai> struct m { typedef g<ai> aj; };
+template <typename b> struct n { typedef typename m<b>::aj e; };
+template <typename b> using an = typename n<b>::e;
+template <typename> constexpr bool ao = c<true>::d;
+template <typename> constexpr bool i = c<1>::d;
+template <typename> concept bb = i<b>;
+#ifdef __SIZEOF_INT128__
+using cc = __int128;
+#else
+using cc = long long;
+#endif
+template <typename...> concept cd = bb<cc>;
+template <typename... bt> concept ce = requires { requires cd<bt...>; };
+template <typename bt> concept h = ce<bt>;
+template <typename bt> concept l = h<bt>;
+template <typename> concept cl = ao<b>;
+template <typename b> concept cp = requires(b j) {
+ requires h<an<decltype(j.begin())>>;
+};
+struct o {
+ template <cl b> requires cp<b> auto operator()(b) {}
+};
+template <typename b> using cm = decltype(o{}(b()));
+template <typename bt> concept ct = l<bt>;
+template <typename da> concept dd = ct<cm<da>>;
+template <typename da> concept de = dd<da>;
+struct {
+ template <de da, typename b> void operator()(da, b);
+} di;
+struct p {
+ void begin();
+};
+template <typename> using df = p;
+template <int> void q() {
+ df<int> k;
+ int d;
+ di(k, d);
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-variadic2.C b/gcc/testsuite/g++.dg/cpp2a/concepts-variadic2.C
new file mode 100644
index 0000000..ce61aef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/concepts-variadic2.C
@@ -0,0 +1,12 @@
+// PR c++/97412
+// { dg-do compile { target c++20 } }
+
+template <class T, class... TArgs>
+concept call_bar_with = requires(T t, TArgs... args) {
+ t.bar(args...);
+};
+
+template <class T, class... TArgs>
+concept foo = requires {
+ requires call_bar_with<T, TArgs...>;
+};
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor5.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor5.C
new file mode 100644
index 0000000..1739afb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor5.C
@@ -0,0 +1,35 @@
+// PR c++/97388
+// { dg-do compile { target c++20 } }
+
+struct S {
+ int m;
+ constexpr S () : m(1) {}
+ constexpr ~S () noexcept (false) { if (m == 1) { throw; } }
+};
+
+constexpr bool
+foo (S v)
+{
+ v.m = 2;
+ return true;
+}
+
+constexpr bool
+bar ()
+{
+ return foo (S ());
+}
+
+constexpr bool
+baz ()
+{
+ foo (S ());
+ return foo (S ());
+}
+
+static_assert (foo (S ()));
+static_assert (bar ());
+static_assert (baz ());
+constexpr bool x = foo (S ());
+constexpr bool y = bar ();
+constexpr bool z = baz ();
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor6.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor6.C
new file mode 100644
index 0000000..ce783a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor6.C
@@ -0,0 +1,36 @@
+// PR c++/97388
+// { dg-do compile { target c++20 } }
+
+struct S {
+ int *s;
+ constexpr S () : s(new int ()) {}
+ constexpr S (S &&x) noexcept : s(x.s) { x.s = nullptr; }
+ constexpr ~S () noexcept { delete s; }
+};
+
+constexpr bool
+foo (S v)
+{
+ auto x = static_cast<S &&> (v);
+ return true;
+}
+
+constexpr bool
+bar ()
+{
+ return foo (S ());
+}
+
+constexpr bool
+baz ()
+{
+ foo (S ());
+ return foo (S ());
+}
+
+static_assert (foo (S ()));
+static_assert (bar ());
+static_assert (baz ());
+constexpr bool x = foo (S ());
+constexpr bool y = bar ();
+constexpr bool z = baz ();
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C
new file mode 100644
index 0000000..463eaca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor7.C
@@ -0,0 +1,19 @@
+// PR c++/97388
+// { dg-do compile { target c++20 } }
+
+struct S {
+ int *s;
+ constexpr S () : s(new int) {} // { dg-error "is not a constant expression because allocated storage has not been deallocated" }
+ S (const S &) = delete;
+ S &operator= (const S &) = delete;
+ constexpr ~S () { delete s; }
+};
+
+constexpr bool
+foo (S v)
+{
+ v.s = nullptr;
+ return true;
+}
+
+static_assert (foo (S ())); // { dg-error "non-constant condition for static assertion" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor8.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor8.C
new file mode 100644
index 0000000..3048110
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-dtor8.C
@@ -0,0 +1,19 @@
+// PR c++/97388
+// { dg-do compile { target c++20 } }
+
+struct S {
+ int *s;
+ constexpr S () : s(new int) {}
+ S (const S &) = delete;
+ S &operator= (const S &) = delete;
+ constexpr ~S () { delete s; } // { dg-error "already deallocated" }
+};
+
+constexpr bool
+foo (S v)
+{
+ delete v.s;
+ return true;
+}
+
+static_assert (foo (S ())); // { dg-error "non-constant condition for static assertion" }
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-new15.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new15.C
new file mode 100644
index 0000000..e97e7aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new15.C
@@ -0,0 +1,21 @@
+// PR c++/95808
+// { dg-do compile { target c++20 } }
+
+constexpr
+bool foo ()
+{
+ int *p = new int; // { dg-message "allocation performed here" }
+ delete[] p; // { dg-error "array deallocation of object allocated with non-array allocation" }
+ return false;
+}
+
+constexpr
+bool bar ()
+{
+ int *p = new int[1]; // { dg-message "allocation performed here" }
+ delete p; // { dg-error "non-array deallocation of object allocated with array allocation" }
+ return false;
+}
+
+constexpr auto x = foo ();
+constexpr auto y = bar ();
diff --git a/gcc/testsuite/g++.dg/cpp2a/enum-conv1.C b/gcc/testsuite/g++.dg/cpp2a/enum-conv1.C
new file mode 100644
index 0000000..4571b5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/enum-conv1.C
@@ -0,0 +1,117 @@
+// PR c++/97573
+// { dg-do compile }
+// No special options. In C++20 (only), we should get the deprecated warnings
+// by default. -Wenum-compare is enabled by default so some of them will be
+// printed even pre-C++20.
+
+enum E1 { e } e1;
+enum E2 { f } e2;
+__extension__ static enum { } u1;
+__extension__ static enum { } u2;
+static double d;
+
+void
+conv ()
+{
+ bool b1 = e == e1;
+ bool b2 = e == f; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ bool b3 = e == 0.0; // { dg-warning "comparison of enumeration type .E1. with floating-point type .double." "" { target c++20 } }
+ bool b4 = 0.0 == f; // { dg-warning "comparison of floating-point type .double. with enumeration type .E2." "" { target c++20 } }
+ int n1 = true ? e : f; // { dg-warning "enumerated mismatch" }
+ int n2 = true ? e : 0.0; // { dg-warning "conditional expression between" "" { target c++20 } }
+}
+
+int
+enum_enum (bool b)
+{
+ int r = 0;
+ const E1 e1c = e;
+
+ r += e - e;
+ r += e - e1;
+ r += e - f; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." "" { target c++20 } }
+ r += f - e; // { dg-warning "arithmetic between different enumeration types .E2. and .E1." "" { target c++20 } }
+
+ r += f + f;
+ r += f + e; // { dg-warning "arithmetic between different enumeration types .E2. and .E1." "" { target c++20 } }
+ r += e + f; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." "" { target c++20 } }
+
+ r += e1 - e2; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." "" { target c++20 } }
+ r += e1 - e1c;
+ r += e1c - e1;
+
+ r += e * f; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." "" { target c++20 } }
+ r += f * e; // { dg-warning "arithmetic between different enumeration types .E2. and .E1." "" { target c++20 } }
+ r += e * e;
+
+ r += e1 < e1c;
+ r += e < e1;
+ r += e1 < e2; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += e < f; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += f < e; // { dg-warning "comparison between .enum E2. and .enum E1." }
+
+ r += e1 == e1c;
+ r += e == e1;
+ r += e == f; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += f == e; // { dg-warning "comparison between .enum E2. and .enum E1." }
+ r += e1 == e2; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += e2 == e1; // { dg-warning "comparison between .enum E2. and .enum E1." }
+
+ r += b ? e1 : e1c;
+ r += b ? e1 : e;
+ r += b ? f : e; // { dg-warning "enumerated mismatch in conditional expression: .E2. vs .E1." }
+ r += b ? e1 : e2; // { dg-warning "enumerated mismatch in conditional expression: .E1. vs .E2." }
+
+ r += e | f; // { dg-warning "bitwise operation between different enumeration types .E1. and .E2." "" { target c++20 } }
+ r += e ^ f; // { dg-warning "bitwise operation between different enumeration types .E1. and .E2." "" { target c++20 } }
+ r += e & f; // { dg-warning "bitwise operation between different enumeration types .E1. and .E2." "" { target c++20 } }
+ r += !e;
+ r += e1 | e;
+
+ r += e << f;
+ r += e >> f;
+ r += e || f;
+ r += e && f;
+ e1 = e1c;
+
+ // Anonymous enum.
+ r += u1 - u1;
+ r += u1 + u2; // { dg-warning "arithmetic between different enumeration types" "" { target c++20 } }
+ r += u1 * u2; // { dg-warning "arithmetic between different enumeration types" "" { target c++20 } }
+ r += u1 == u2; // { dg-warning "comparison between" }
+ r += u1 & u2; // { dg-warning "bitwise operation between different enumeration types" "" { target c++20 } }
+
+ return r;
+}
+
+double
+enum_float (bool b)
+{
+ double r = 0.0;
+
+ r += e1 - d; // { dg-warning "arithmetic between enumeration type .E1. and floating-point type .double." "" { target c++20 } }
+ r += d - e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." "" { target c++20 } }
+ r += e1 + d; // { dg-warning "arithmetic between enumeration type .E1. and floating-point type .double." "" { target c++20 } }
+ r += d + e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." "" { target c++20 } }
+ r += e1 * d; // { dg-warning "arithmetic between enumeration type .E1. and floating-point type .double." "" { target c++20 } }
+ r += d * e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." "" { target c++20 } }
+ r += u1 * d; // { dg-warning "arithmetic between enumeration type" "" { target c++20 } }
+ r += d * u1; // { dg-warning "arithmetic between floating-point type" "" { target c++20 } }
+
+ r += e1 < d; // { dg-warning "comparison of enumeration type .E1. with floating-point type .double." "" { target c++20 } }
+ r += d < e1; // { dg-warning "comparison of floating-point type .double. with enumeration type .E1." "" { target c++20 } }
+ r += d == e1; // { dg-warning "comparison of floating-point type .double. with enumeration type .E1." "" { target c++20 } }
+ r += e1 == d; // { dg-warning "comparison of enumeration type .E1. with floating-point type .double." "" { target c++20 } }
+ r += u1 == d; // { dg-warning "comparison of enumeration type" "" { target c++20 } }
+ r += d == u1; // { dg-warning "comparison of floating-point type" "" { target c++20 } }
+
+ r += b ? e1 : d; // { dg-warning "conditional expression between enumeration type .E1. and floating-point type .double." "" { target c++20 } }
+ r += b ? d : e1; // { dg-warning "conditional expression between floating-point type .double. and enumeration type .E1." "" { target c++20 } }
+ r += b ? d : u1; // { dg-warning "conditional expression between" "" { target c++20 } }
+ r += b ? u1 : d; // { dg-warning "conditional expression between" "" { target c++20 } }
+
+ d += e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." "" { target c++20 } }
+ d = e1;
+
+ return r;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/enum-conv2.C b/gcc/testsuite/g++.dg/cpp2a/enum-conv2.C
new file mode 100644
index 0000000..f15827b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/enum-conv2.C
@@ -0,0 +1,115 @@
+// PR c++/97573
+// { dg-do compile { target c++20 } }
+// { dg-options "-Wno-deprecated -Wno-enum-compare" }
+
+enum E1 { e } e1;
+enum E2 { f } e2;
+__extension__ static enum { } u1;
+__extension__ static enum { } u2;
+static double d;
+
+void
+conv ()
+{
+ bool b1 = e == e1;
+ bool b2 = e == f;
+ bool b3 = e == 0.0;
+ bool b4 = 0.0 == f;
+ int n1 = true ? e : f;
+ int n2 = true ? e : 0.0;
+}
+
+int
+enum_enum (bool b)
+{
+ int r = 0;
+ const E1 e1c = e;
+
+ r += e - e;
+ r += e - e1;
+ r += e - f;
+ r += f - e;
+
+ r += f + f;
+ r += f + e;
+ r += e + f;
+
+ r += e1 - e2;
+ r += e1 - e1c;
+ r += e1c - e1;
+
+ r += e * f;
+ r += f * e;
+ r += e * e;
+
+ r += e1 < e1c;
+ r += e < e1;
+ r += e1 < e2;
+ r += e < f;
+ r += f < e;
+
+ r += e1 == e1c;
+ r += e == e1;
+ r += e == f;
+ r += f == e;
+ r += e1 == e2;
+ r += e2 == e1;
+
+ r += b ? e1 : e1c;
+ r += b ? e1 : e;
+ r += b ? f : e;
+ r += b ? e1 : e2;
+
+ r += e | f;
+ r += e ^ f;
+ r += e & f;
+ r += !e;
+ r += e1 | e;
+
+ r += e << f;
+ r += e >> f;
+ r += e || f;
+ r += e && f;
+ e1 = e1c;
+
+ // Anonymous enum.
+ r += u1 - u1;
+ r += u1 + u2;
+ r += u1 * u2;
+ r += u1 == u2;
+ r += u1 & u2;
+
+ return r;
+}
+
+double
+enum_float (bool b)
+{
+ double r = 0.0;
+
+ r += e1 - d;
+ r += d - e1;
+ r += e1 + d;
+ r += d + e1;
+ r += e1 * d;
+ r += d * e1;
+ r += u1 * d;
+ r += d * u1;
+
+ r += e1 < d;
+ r += d < e1;
+ r += d == e1;
+ r += e1 == d;
+ r += u1 == d;
+ r += d == u1;
+
+ r += b ? e1 : d;
+ r += b ? d : e1;
+ r += b ? d : u1;
+ r += b ? u1 : d;
+
+ d += e1;
+ d = e1;
+
+ return r;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/enum-conv3.C b/gcc/testsuite/g++.dg/cpp2a/enum-conv3.C
new file mode 100644
index 0000000..67bdf16
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/enum-conv3.C
@@ -0,0 +1,115 @@
+// PR c++/97573
+// { dg-do compile { target { c++17_down } } }
+// { dg-options "-Wenum-conversion" }
+
+enum E1 { e } e1;
+enum E2 { f } e2;
+__extension__ static enum { } u1;
+__extension__ static enum { } u2;
+static double d;
+
+void
+conv ()
+{
+ bool b1 = e == e1;
+ bool b2 = e == f; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ bool b3 = e == 0.0; // { dg-warning "comparison of enumeration type .E1. with floating-point type .double." }
+ bool b4 = 0.0 == f; // { dg-warning "comparison of floating-point type .double. with enumeration type .E2." }
+ int n1 = true ? e : f; // { dg-warning "enumerated mismatch" }
+ int n2 = true ? e : 0.0; // { dg-warning "enumerated and non-enumerated type in conditional expression" }
+}
+
+int
+enum_enum (bool b)
+{
+ int r = 0;
+ const E1 e1c = e;
+
+ r += e - e;
+ r += e - e1;
+ r += e - f; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." }
+ r += f - e; // { dg-warning "arithmetic between different enumeration types .E2. and .E1." }
+
+ r += f + f;
+ r += f + e; // { dg-warning "arithmetic between different enumeration types .E2. and .E1." }
+ r += e + f; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." }
+
+ r += e1 - e2; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." }
+ r += e1 - e1c;
+ r += e1c - e1;
+
+ r += e * f; // { dg-warning "arithmetic between different enumeration types .E1. and .E2." }
+ r += f * e; // { dg-warning "arithmetic between different enumeration types .E2. and .E1." }
+ r += e * e;
+
+ r += e1 < e1c;
+ r += e < e1;
+ r += e1 < e2; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += e < f; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += f < e; // { dg-warning "comparison between .enum E2. and .enum E1." }
+
+ r += e1 == e1c;
+ r += e == e1;
+ r += e == f; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += f == e; // { dg-warning "comparison between .enum E2. and .enum E1." }
+ r += e1 == e2; // { dg-warning "comparison between .enum E1. and .enum E2." }
+ r += e2 == e1; // { dg-warning "comparison between .enum E2. and .enum E1." }
+
+ r += b ? e1 : e1c;
+ r += b ? e1 : e;
+ r += b ? f : e; // { dg-warning "enumerated mismatch in conditional expression: .E2. vs .E1." }
+ r += b ? e1 : e2; // { dg-warning "enumerated mismatch in conditional expression: .E1. vs .E2." }
+
+ r += e | f; // { dg-warning "bitwise operation between different enumeration types .E1. and .E2." }
+ r += e ^ f; // { dg-warning "bitwise operation between different enumeration types .E1. and .E2." }
+ r += e & f; // { dg-warning "bitwise operation between different enumeration types .E1. and .E2." }
+ r += !e;
+ r += e1 | e;
+
+ r += e << f;
+ r += e >> f;
+ r += e || f;
+ r += e && f;
+ e1 = e1c;
+
+ // Anonymous enum.
+ r += u1 - u1;
+ r += u1 + u2; // { dg-warning "arithmetic between different enumeration types" }
+ r += u1 * u2; // { dg-warning "arithmetic between different enumeration types" }
+ r += u1 == u2; // { dg-warning "comparison between" }
+ r += u1 & u2; // { dg-warning "bitwise operation between different enumeration types" }
+
+ return r;
+}
+
+double
+enum_float (bool b)
+{
+ double r = 0.0;
+
+ r += e1 - d; // { dg-warning "arithmetic between enumeration type .E1. and floating-point type .double." }
+ r += d - e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." }
+ r += e1 + d; // { dg-warning "arithmetic between enumeration type .E1. and floating-point type .double." }
+ r += d + e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." }
+ r += e1 * d; // { dg-warning "arithmetic between enumeration type .E1. and floating-point type .double." }
+ r += d * e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." }
+ r += u1 * d; // { dg-warning "arithmetic between enumeration type" }
+ r += d * u1; // { dg-warning "arithmetic between floating-point type" }
+
+ r += e1 < d; // { dg-warning "comparison of enumeration type .E1. with floating-point type .double." }
+ r += d < e1; // { dg-warning "comparison of floating-point type .double. with enumeration type .E1." }
+ r += d == e1; // { dg-warning "comparison of floating-point type .double. with enumeration type .E1." }
+ r += e1 == d; // { dg-warning "comparison of enumeration type .E1. with floating-point type .double." }
+ r += u1 == d; // { dg-warning "comparison of enumeration type" }
+ r += d == u1; // { dg-warning "comparison of floating-point type" }
+
+ r += b ? e1 : d; // { dg-warning "enumerated and non-enumerated type in conditional expression" }
+ r += b ? d : e1; // { dg-warning "enumerated and non-enumerated type in conditional expression" }
+ r += b ? d : u1; // { dg-warning "enumerated and non-enumerated type in conditional expression" }
+ r += b ? u1 : d; // { dg-warning "enumerated and non-enumerated type in conditional expression" }
+
+ d += e1; // { dg-warning "arithmetic between floating-point type .double. and enumeration type .E1." }
+ d = e1;
+
+ return r;
+}
diff --git a/gcc/testsuite/g++.dg/cpp2a/fn-template16.C b/gcc/testsuite/g++.dg/cpp2a/fn-template16.C
index becaff1..8ee783a 100644
--- a/gcc/testsuite/g++.dg/cpp2a/fn-template16.C
+++ b/gcc/testsuite/g++.dg/cpp2a/fn-template16.C
@@ -7,7 +7,7 @@ struct undeclared<int> { }; // { dg-error "not a class template" }
int
main ()
{
- int foo ();
+ int foo (); // { dg-warning "empty parentheses" }
int foo (int);
int foo (int, int);
int a, b = 10;
diff --git a/gcc/testsuite/g++.dg/cpp2a/fn-template7.C b/gcc/testsuite/g++.dg/cpp2a/fn-template7.C
index d048606..2c5ee12 100644
--- a/gcc/testsuite/g++.dg/cpp2a/fn-template7.C
+++ b/gcc/testsuite/g++.dg/cpp2a/fn-template7.C
@@ -7,7 +7,7 @@ struct undeclared<int> { }; // { dg-error "not a class template" }
int
main ()
{
- int foo ();
+ int foo (); // { dg-warning "empty parentheses" }
int a, b = 10;
a = foo<; // { dg-error "invalid template-argument-list|invalid" }
a = foo < b; // { dg-error "invalid template-argument-list|invalid" }
diff --git a/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C b/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C
index c810fd0..c95fa1b 100644
--- a/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C
+++ b/gcc/testsuite/g++.dg/cpp2a/nodiscard-once.C
@@ -2,7 +2,7 @@
/* { dg-do compile { target c++20 } } */
/* { dg-options "-O -ftrack-macro-expansion=0" } */
-[[nodiscard, nodiscard]] int check1 (void); /* { dg-error "nodiscard\[^\n\r]*can appear at most once" } */
+[[nodiscard, nodiscard]] int check1 (void); // { dg-warning "specified multiple times" }
void
test (void)
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/spaceship-err5.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-err5.C
new file mode 100644
index 0000000..3dc2a0f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-err5.C
@@ -0,0 +1,23 @@
+// { dg-do compile { target c++20 } }
+// Test [depr.arith.conv.enum] for <=>.
+
+#include <compare>
+
+enum E1 { e } e1;
+enum E2 { f } e2;
+static double d;
+
+void
+g ()
+{
+ void(e1 <=> e);
+ e1 <=> d; // { dg-error "invalid operands of types .E1. and .double." }
+ d <=> e1; // { dg-error "invalid operands of types .double. and .E1." }
+ e <=> d; // { dg-error "invalid operands of types .E1. and .double." }
+ d <=> e; // { dg-error "invalid operands of types .double. and .E1." }
+
+ e <=> f; // { dg-error "invalid operands of types .E1. and .E2." }
+ f <=> e; // { dg-error "invalid operands of types .E2. and .E1." }
+ e1 <=> e2; // { dg-error "invalid operands of types .E1. and .E2." }
+ e2 <=> e1; // { dg-error "invalid operands of types .E2. and .E1." }
+}
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/eh/pr42859.C b/gcc/testsuite/g++.dg/eh/pr42859.C
index a9f1473..0de9140 100644
--- a/gcc/testsuite/g++.dg/eh/pr42859.C
+++ b/gcc/testsuite/g++.dg/eh/pr42859.C
@@ -13,7 +13,7 @@ ptw32_terminate (void)
catch (int)
{
}
- catch (int)
+ catch (int) // { dg-warning "will be caught by earlier handler" }
{
}
}
diff --git a/gcc/testsuite/g++.dg/ext/attr-used-2.C b/gcc/testsuite/g++.dg/ext/attr-used-2.C
new file mode 100644
index 0000000..d7cf6e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-used-2.C
@@ -0,0 +1,15 @@
+// PR c++/67453
+// { dg-do compile }
+// { dg-final { scan-assembler "_ZN1SC\[12]Ev" } }
+// { dg-final { scan-assembler "_ZN1SD\[12]Ev" } }
+// { dg-final { scan-assembler "_ZN1SC\[12]ERKS_" } }
+
+struct S {
+ S();
+ ~S();
+ S(const S&);
+};
+
+__attribute__((used)) inline S::S() { }
+__attribute__((used)) inline S::~S() { }
+__attribute__((used)) inline S::S(const S&) { }
diff --git a/gcc/testsuite/g++.dg/ext/is_nothrow_constructible1.C b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible1.C
new file mode 100644
index 0000000..472acf9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible1.C
@@ -0,0 +1,48 @@
+// { dg-do compile { target c++11 } }
+
+struct A { };
+struct B { B(); operator int(); };
+struct C {
+ C() = default;
+ C(const C&);
+ C(C&&) = default;
+ C& operator=(C&&);
+ C& operator= (const C&) = default;
+};
+struct D { ~D() noexcept(false) {} };
+
+#define SA(X) static_assert((X),#X)
+
+SA(__is_nothrow_constructible(A));
+SA(__is_nothrow_constructible(A,A));
+SA(!__is_nothrow_constructible(B));
+SA(__is_nothrow_constructible(B,B));
+
+SA(!__is_nothrow_constructible(A,B));
+SA(!__is_nothrow_constructible(B,A));
+
+SA(__is_nothrow_constructible(C));
+SA(__is_nothrow_constructible(C,C));
+SA(!__is_nothrow_constructible(C,C&));
+SA(__is_nothrow_assignable(C,C&));
+SA(!__is_nothrow_assignable(C,C));
+SA(!__is_nothrow_assignable(C,C&&));
+SA(!__is_nothrow_assignable(void,int));
+SA(!__is_nothrow_assignable(const void,int));
+SA(!__is_nothrow_assignable(volatile void,int));
+SA(!__is_nothrow_assignable(const volatile void,int));
+
+SA(__is_nothrow_constructible(int,int));
+SA(__is_nothrow_constructible(int,double));
+SA(!__is_nothrow_constructible(int,B));
+SA(!__is_nothrow_constructible(void,int));
+SA(!__is_nothrow_constructible(const void,int));
+SA(!__is_nothrow_constructible(volatile void,int));
+SA(!__is_nothrow_constructible(const volatile void,int));
+SA(!__is_nothrow_constructible(int, void*));
+SA(!__is_nothrow_constructible(int, int*));
+SA(!__is_nothrow_constructible(int, const int*));
+SA(!__is_nothrow_constructible(int*, void*));
+SA(!__is_nothrow_constructible(int*, const int*));
+
+SA(!__is_nothrow_constructible(D));
diff --git a/gcc/testsuite/g++.dg/ext/is_nothrow_constructible2.C b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible2.C
new file mode 100644
index 0000000..86b9668
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible2.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++11 } }
+
+struct X {
+ X() = default;
+ template<class... U> X(U...) noexcept;
+};
+
+struct Y {
+ template<class... U> Y(U...);
+};
+
+#define SA(X) static_assert((X),#X)
+
+SA(__is_nothrow_constructible(X));
+SA(!__is_nothrow_constructible(Y));
diff --git a/gcc/testsuite/g++.dg/ext/is_nothrow_constructible3.C b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible3.C
new file mode 100644
index 0000000..220ee0b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible3.C
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++11 } }
+
+template <class T, class... Args> void bar() {
+ static_assert(__is_nothrow_constructible(T, Args...), "");
+}
+
+template void bar<int>();
+template void bar<int,int>();
diff --git a/gcc/testsuite/g++.dg/ext/is_nothrow_constructible4.C b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible4.C
new file mode 100644
index 0000000..9448c2d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible4.C
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+void f()
+{
+ int x;
+ auto l = [=]{ return x; };
+ typedef decltype(l) C;
+ SA(__is_nothrow_constructible(C,C));
+}
diff --git a/gcc/testsuite/g++.dg/ext/is_nothrow_constructible5.C b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible5.C
new file mode 100644
index 0000000..b847113
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible5.C
@@ -0,0 +1,12 @@
+// PR c++/80991
+// { dg-do compile { target c++11 } }
+
+template<bool> void foo()
+{
+ static_assert(__is_nothrow_constructible(int, int), "");
+}
+
+void bar()
+{
+ foo<true>();
+}
diff --git a/gcc/testsuite/g++.dg/ext/is_nothrow_constructible6.C b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible6.C
new file mode 100644
index 0000000..bdfdfb9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_nothrow_constructible6.C
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++11 } }
+// PR c++/81589
+
+template <typename k>
+struct z {
+ z() noexcept {
+ k::error;
+ }
+};
+
+int x = __is_nothrow_constructible(z<int>);
diff --git a/gcc/testsuite/g++.dg/gomp/allocate-1.C b/gcc/testsuite/g++.dg/gomp/allocate-1.C
new file mode 100644
index 0000000..e70c65e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/allocate-1.C
@@ -0,0 +1,88 @@
+// { dg-do compile }
+// { dg-additional-options "-std=c++11" }
+
+typedef enum omp_allocator_handle_t
+#if __cplusplus >= 201103L
+: __UINTPTR_TYPE__
+#endif
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
+ omp_low_lat_mem_alloc = 5,
+ omp_cgroup_mem_alloc = 6,
+ omp_pteam_mem_alloc = 7,
+ omp_thread_mem_alloc = 8,
+ __omp_allocator_handle_t_max__ = __UINTPTR_MAX__
+} omp_allocator_handle_t;
+
+namespace N1
+{
+ using ::omp_allocator_handle_t;
+ void
+ foo (const omp_allocator_handle_t h)
+ {
+ int x = 0;
+ #pragma omp parallel allocate (h: x) private (x)
+ x = 1;
+ }
+}
+
+namespace N2
+{
+ typedef enum omp_allocator_handle_t { my = 0 } omp_allocator_handle_t;
+ void
+ foo (omp_allocator_handle_t h)
+ {
+ int x = 0;
+ #pragma omp parallel allocate (h: x) private (x) // { dg-error "'allocate' clause allocator expression has type 'N2::omp_allocator_handle_t' rather than 'omp_allocator_handle_t'" }
+ x = 1;
+ }
+}
+
+struct S
+{
+ void foo ()
+ {
+ #pragma omp parallel allocate (omp_default_mem_alloc:s) firstprivate (s)
+ s++;
+ }
+ int s;
+};
+
+template <typename T>
+struct U
+{
+ int foo ()
+ {
+ #pragma omp parallel allocate (omp_default_mem_alloc:s) firstprivate (s)
+ s++;
+ return 1;
+ }
+ T s;
+};
+
+template <typename T>
+int foo (T t)
+{
+ int x = 0;
+ #pragma omp parallel firstprivate (x) allocate (t: x)
+ x = 1;
+ return 0;
+}
+
+template <typename T>
+int bar (T t)
+{
+ int x = 0;
+ #pragma omp parallel firstprivate (x) allocate (t: x) // { dg-error "'allocate' clause allocator expression has type 'int' rather than 'omp_allocator_handle_t'" }
+ x = 1;
+ return 0;
+}
+
+omp_allocator_handle_t h;
+int a = foo (h);
+int b = bar (0);
+int c = U<int> ().foo ();
diff --git a/gcc/testsuite/g++.dg/gomp/allocate-2.C b/gcc/testsuite/g++.dg/gomp/allocate-2.C
new file mode 100644
index 0000000..b8cf480
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/allocate-2.C
@@ -0,0 +1,11 @@
+// PR c++/97670
+
+struct S { int s; };
+
+void
+foo ()
+{
+ S s[1] = { S () };
+#pragma omp parallel reduction (+: s) allocate(s) // { dg-error "user defined reduction not found for 's'" }
+ s[0].s++;
+}
diff --git a/gcc/testsuite/g++.dg/gomp/allocate-3.C b/gcc/testsuite/g++.dg/gomp/allocate-3.C
new file mode 100644
index 0000000..e778314
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/allocate-3.C
@@ -0,0 +1,206 @@
+template <typename T>
+void
+foo (T &x, T (&y)[4], T *&z, int &u, int (&v)[4], int *&w)
+{
+ T s[4] = { 0, 0, 0, 0 };
+ T *p = s;
+#pragma omp parallel reduction (+: s) allocate(s)
+ s[0]++;
+#pragma omp parallel reduction (+: s[0:3]) allocate(s)
+ s[0]++;
+#pragma omp parallel reduction (+: s[2:2]) allocate(s)
+ s[2]++;
+#pragma omp parallel reduction (+: p[:2]) allocate(p)
+ p[0]++;
+#pragma omp parallel reduction (+: p[2:2]) allocate(p)
+ p[2]++;
+ int s2[4] = { 0, 0, 0, 0 };
+ int *p2 = s2;
+#pragma omp parallel reduction (+: s2) allocate(s2)
+ s2[0]++;
+#pragma omp parallel reduction (+: s2[0:3]) allocate(s2)
+ s2[0]++;
+#pragma omp parallel reduction (+: s2[2:2]) allocate(s2)
+ s2[2]++;
+#pragma omp parallel reduction (+: p2[:2]) allocate(p2)
+ p2[0]++;
+#pragma omp parallel reduction (+: p2[2:2]) allocate(p2)
+ p2[2]++;
+#pragma omp parallel reduction (+: x) allocate(x)
+ x++;
+#pragma omp parallel reduction (+: y) allocate(y)
+ y[0]++;
+#pragma omp parallel reduction (+: y[0:3]) allocate(y)
+ y[0]++;
+#pragma omp parallel reduction (+: y[2:2]) allocate(y)
+ y[2]++;
+#pragma omp parallel reduction (+: z[:2]) allocate(z)
+ z[0]++;
+#pragma omp parallel reduction (+: z[2:2]) allocate(z)
+ z[2]++;
+#pragma omp parallel reduction (+: u) allocate(u)
+ u++;
+#pragma omp parallel reduction (+: v) allocate(v)
+ v[0]++;
+#pragma omp parallel reduction (+: v[0:3]) allocate(v)
+ v[0]++;
+#pragma omp parallel reduction (+: v[2:2]) allocate(v)
+ v[2]++;
+#pragma omp parallel reduction (+: w[:2]) allocate(w)
+ w[0]++;
+#pragma omp parallel reduction (+: w[2:2]) allocate(w)
+ w[2]++;
+}
+
+template <typename T>
+void
+bar (T &x, T (&y)[4], T *&z, int &u, int (&v)[4], int *&w)
+{
+ T s[4] = { 0, 0, 0, 0 };
+ T *p = s;
+ int i;
+#pragma omp teams distribute parallel for reduction (+: s) allocate(s)
+ for (i = 0; i < 64; i++)
+ s[0]++;
+#pragma omp teams distribute parallel for reduction (+: s[0:3]) allocate(s)
+ for (i = 0; i < 64; i++)
+ s[0]++;
+#pragma omp teams distribute parallel for reduction (+: s[2:2]) allocate(s)
+ for (i = 0; i < 64; i++)
+ s[2]++;
+#pragma omp teams distribute parallel for reduction (+: p[:2]) allocate(p)
+ for (i = 0; i < 64; i++)
+ p[0]++;
+#pragma omp teams distribute parallel for reduction (+: p[2:2]) allocate(p)
+ for (i = 0; i < 64; i++)
+ p[2]++;
+ int s2[4] = { 0, 0, 0, 0 };
+ int *p2 = s2;
+#pragma omp teams distribute parallel for reduction (+: s2) allocate(s2)
+ for (i = 0; i < 64; i++)
+ s2[0]++;
+#pragma omp teams distribute parallel for reduction (+: s2[0:3]) allocate(s2)
+ for (i = 0; i < 64; i++)
+ s2[0]++;
+#pragma omp teams distribute parallel for reduction (+: s2[2:2]) allocate(s2)
+ for (i = 0; i < 64; i++)
+ s2[2]++;
+#pragma omp teams distribute parallel for reduction (+: p2[:2]) allocate(p2)
+ for (i = 0; i < 64; i++)
+ p2[0]++;
+#pragma omp teams distribute parallel for reduction (+: p2[2:2]) allocate(p2)
+ for (i = 0; i < 64; i++)
+ p2[2]++;
+#pragma omp teams distribute parallel for reduction (+: x) allocate(x)
+ for (i = 0; i < 64; i++)
+ x++;
+#pragma omp teams distribute parallel for reduction (+: y) allocate(y)
+ for (i = 0; i < 64; i++)
+ y[0]++;
+#pragma omp teams distribute parallel for reduction (+: y[0:3]) allocate(y)
+ for (i = 0; i < 64; i++)
+ y[0]++;
+#pragma omp teams distribute parallel for reduction (+: y[2:2]) allocate(y)
+ for (i = 0; i < 64; i++)
+ y[2]++;
+#pragma omp teams distribute parallel for reduction (+: z[:2]) allocate(z)
+ for (i = 0; i < 64; i++)
+ z[0]++;
+#pragma omp teams distribute parallel for reduction (+: z[2:2]) allocate(z)
+ for (i = 0; i < 64; i++)
+ z[2]++;
+#pragma omp teams distribute parallel for reduction (+: u) allocate(u)
+ for (i = 0; i < 64; i++)
+ u++;
+#pragma omp teams distribute parallel for reduction (+: v) allocate(v)
+ for (i = 0; i < 64; i++)
+ v[0]++;
+#pragma omp teams distribute parallel for reduction (+: v[0:3]) allocate(v)
+ for (i = 0; i < 64; i++)
+ v[0]++;
+#pragma omp teams distribute parallel for reduction (+: v[2:2]) allocate(v)
+ for (i = 0; i < 64; i++)
+ v[2]++;
+#pragma omp teams distribute parallel for reduction (+: w[:2]) allocate(w)
+ for (i = 0; i < 64; i++)
+ w[0]++;
+#pragma omp teams distribute parallel for reduction (+: w[2:2]) allocate(w)
+ for (i = 0; i < 64; i++)
+ w[2]++;
+}
+
+void
+baz (long int &x, long int (&y)[4], long int *&z)
+{
+#pragma omp parallel reduction (+: x) allocate(x)
+ x++;
+#pragma omp parallel reduction (+: y) allocate(y)
+ y[0]++;
+#pragma omp parallel reduction (+: y[0:3]) allocate(y)
+ y[0]++;
+#pragma omp parallel reduction (+: y[2:2]) allocate(y)
+ y[2]++;
+#pragma omp parallel reduction (+: z[:2]) allocate(z)
+ z[0]++;
+#pragma omp parallel reduction (+: z[2:2]) allocate(z)
+ z[2]++;
+}
+
+void
+qux (long long int &x, long long int (&y)[4], long long int *&z)
+{
+ int i;
+#pragma omp teams distribute parallel for reduction (+: x) allocate(x)
+ for (i = 0; i < 64; i++)
+ x++;
+#pragma omp teams distribute parallel for reduction (+: y) allocate(y)
+ for (i = 0; i < 64; i++)
+ y[0]++;
+#pragma omp teams distribute parallel for reduction (+: y[0:3]) allocate(y)
+ for (i = 0; i < 64; i++)
+ y[0]++;
+#pragma omp teams distribute parallel for reduction (+: y[2:2]) allocate(y)
+ for (i = 0; i < 64; i++)
+ y[2]++;
+#pragma omp teams distribute parallel for reduction (+: z[:2]) allocate(z)
+ for (i = 0; i < 64; i++)
+ z[0]++;
+#pragma omp teams distribute parallel for reduction (+: z[2:2]) allocate(z)
+ for (i = 0; i < 64; i++)
+ z[2]++;
+}
+
+void
+test ()
+{
+ long int x = 0;
+ long int y[4] = { 0, 0, 0, 0 };
+ long int *z = y;
+ int u = 0;
+ int v[4] = { 0, 0, 0, 0 };
+ int *w = v;
+ long long int x2 = 0;
+ long long int y2[4] = { 0, 0, 0, 0 };
+ long long int *z2 = y2;
+ foo (x, y, z, u, v, w);
+ bar (x2, y2, z2, u, v, w);
+}
+
+namespace N
+{
+ int a;
+ void foo ()
+ {
+ int i;
+ #pragma omp parallel firstprivate (N::a) allocate (a)
+ a++;
+ #pragma omp parallel firstprivate (a) allocate (N::a)
+ a++;
+ #pragma omp teams distribute parallel for firstprivate (N::a) allocate (a)
+ for (i = 0; i < 64; i++)
+ a++;
+ #pragma omp teams distribute parallel for firstprivate (a) allocate (N::a)
+ for (i = 0; i < 64; i++)
+ a++;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp
index 33571f1..1d5b65f 100644
--- a/gcc/testsuite/g++.dg/guality/guality.exp
+++ b/gcc/testsuite/g++.dg/guality/guality.exp
@@ -38,7 +38,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
diff --git a/gcc/testsuite/g++.dg/inherit/thunk8.C b/gcc/testsuite/g++.dg/inherit/thunk8.C
index ef64535..ecb9cbf 100644
--- a/gcc/testsuite/g++.dg/inherit/thunk8.C
+++ b/gcc/testsuite/g++.dg/inherit/thunk8.C
@@ -4,6 +4,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target arm_thumb1_ok } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-mthumb -fPIC" } */
struct A {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-24.C b/gcc/testsuite/g++.dg/ipa/devirt-24.C
index eaef1f5..7b5b806 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-24.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-24.C
@@ -37,4 +37,4 @@ C *b = new (C);
}
}
/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" { xfail *-*-* } } } */
-/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 1 "cp" } } */
+/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 2 "cp" } } */
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/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/lookup/pr80891-5.C b/gcc/testsuite/g++.dg/lookup/pr80891-5.C
index e018922..10d1ce3 100644
--- a/gcc/testsuite/g++.dg/lookup/pr80891-5.C
+++ b/gcc/testsuite/g++.dg/lookup/pr80891-5.C
@@ -14,7 +14,7 @@ template <typename, typename, typename, typename,
struct B {
B(A, A, int, int, int, int);
void m_fn1(SubGraphIsoMapCallback p1) {
- __normal_iterator __trans_tmp_1();
+ __normal_iterator __trans_tmp_1(); // { dg-warning "empty parentheses" }
p1(__trans_tmp_1, 0);
}
};
diff --git a/gcc/testsuite/g++.dg/lookup/using26.C b/gcc/testsuite/g++.dg/lookup/using26.C
index 857c134..dd4e130 100644
--- a/gcc/testsuite/g++.dg/lookup/using26.C
+++ b/gcc/testsuite/g++.dg/lookup/using26.C
@@ -17,9 +17,9 @@ struct C
int next;
};
-struct D : A, B, C // { dg-error "context" }
+struct D : A, B, C
{
- using B::next;
+ using B::next; // { dg-error "context" }
void f()
{
next = 12;
diff --git a/gcc/testsuite/g++.dg/lookup/using53.C b/gcc/testsuite/g++.dg/lookup/using53.C
index 595612e..f9e59e6 100644
--- a/gcc/testsuite/g++.dg/lookup/using53.C
+++ b/gcc/testsuite/g++.dg/lookup/using53.C
@@ -43,6 +43,7 @@ template class DT<int>;
namespace N
{
int i;
+ enum bob {Q};
}
void
diff --git a/gcc/testsuite/g++.dg/lto/pr79050_0.C b/gcc/testsuite/g++.dg/lto/pr79050_0.C
index 1f31b5d..464f559 100644
--- a/gcc/testsuite/g++.dg/lto/pr79050_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr79050_0.C
@@ -3,5 +3,5 @@
int main ()
{
- auto foo ();
+ extern auto foo ();
}
diff --git a/gcc/testsuite/g++.dg/lto/pr84805_0.C b/gcc/testsuite/g++.dg/lto/pr84805_0.C
index 1509eae..668ba36 100644
--- a/gcc/testsuite/g++.dg/lto/pr84805_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr84805_0.C
@@ -149,5 +149,5 @@ public:
class XclImpRoot : XclRoot {};
class XclImpColRowSettings : XclImpRoot {};
void lcl_ExportExcelBiff() {
-XclRootData aExpData();
+extern XclRootData aExpData();
}
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/pr64411.C b/gcc/testsuite/g++.dg/opt/pr64411.C
index 122b9ee..6ecc0a8 100644
--- a/gcc/testsuite/g++.dg/opt/pr64411.C
+++ b/gcc/testsuite/g++.dg/opt/pr64411.C
@@ -1,5 +1,6 @@
// PR target/64411
// { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } }
+// { dg-require-effective-target fpic }
// { dg-options "-Os -mcmodel=medium -fPIC -fschedule-insns -fselective-scheduling" }
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/opt/pr97767.C b/gcc/testsuite/g++.dg/opt/pr97767.C
new file mode 100644
index 0000000..da0879d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr97767.C
@@ -0,0 +1,10 @@
+// { dg-do compile }
+// { dg-options "-O -fstrict-enums -ftree-vrp -w" }
+
+enum { E0 = 0, E1 = 1, E2 = 2 } e;
+
+int
+foo (void)
+{
+ return __builtin_popcount ((int) e);
+}
diff --git a/gcc/testsuite/g++.dg/other/i386-2.C b/gcc/testsuite/g++.dg/other/i386-2.C
index 449f30d..b964248 100644
--- a/gcc/testsuite/g++.dg/other/i386-2.C
+++ b/gcc/testsuite/g++.dg/other/i386-2.C
@@ -1,5 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16" } */
+/* { dg-options "-O -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl" } */
/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h,
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h,
diff --git a/gcc/testsuite/g++.dg/other/i386-3.C b/gcc/testsuite/g++.dg/other/i386-3.C
index 29e9891..2f73de2 100644
--- a/gcc/testsuite/g++.dg/other/i386-3.C
+++ b/gcc/testsuite/g++.dg/other/i386-3.C
@@ -1,5 +1,5 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16" } */
+/* { dg-options "-O -fkeep-inline-functions -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl" } */
/* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, mm3dnow.h, fma4intrin.h,
xopintrin.h, abmintrin.h, bmiintrin.h, tbmintrin.h, lwpintrin.h,
diff --git a/gcc/testsuite/g++.dg/parse/attr3.C b/gcc/testsuite/g++.dg/parse/attr3.C
index 57fa60e..de09598 100644
--- a/gcc/testsuite/g++.dg/parse/attr3.C
+++ b/gcc/testsuite/g++.dg/parse/attr3.C
@@ -10,5 +10,5 @@ int main () {
S::F y; // { dg-warning "'F' is deprecated" }
y = S::f;
- return x + y;
+ return x + y; // { dg-warning "arithmetic between different enumeration types" "" { target c++20 } }
}
diff --git a/gcc/testsuite/g++.dg/parse/pr58898.C b/gcc/testsuite/g++.dg/parse/pr58898.C
index e788c91..e67011d2 100644
--- a/gcc/testsuite/g++.dg/parse/pr58898.C
+++ b/gcc/testsuite/g++.dg/parse/pr58898.C
@@ -5,12 +5,12 @@ struct Foo
{
Foo()
{
- int t(int()); // Error
+ int t(int()); // { dg-warning "parentheses were disambiguated" }
}
};
int main()
{
- int t(int()); // OK
+ int t(int()); // { dg-warning "parentheses were disambiguated" }
Foo<> a; // Error
}
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/pr57878.C b/gcc/testsuite/g++.dg/pr57878.C
index 5df2b7c9e..ee9142b 100644
--- a/gcc/testsuite/g++.dg/pr57878.C
+++ b/gcc/testsuite/g++.dg/pr57878.C
@@ -1,5 +1,6 @@
/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
// { dg-require-effective-target c++11 }
+// { dg-require-effective-target fpic }
/* { dg-options "-O2 -fno-omit-frame-pointer -fPIC" } */
typedef int int32;
diff --git a/gcc/testsuite/g++.dg/pr65032.C b/gcc/testsuite/g++.dg/pr65032.C
index d6b6768..6e348f8 100644
--- a/gcc/testsuite/g++.dg/pr65032.C
+++ b/gcc/testsuite/g++.dg/pr65032.C
@@ -1,4 +1,5 @@
// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-require-effective-target fpic }
// { dg-options "-Os -std=c++11 -fPIC -fstack-protector-strong -fomit-frame-pointer" }
#pragma GCC visibility push(hidden)
diff --git a/gcc/testsuite/g++.dg/pr84279.C b/gcc/testsuite/g++.dg/pr84279.C
index a88d3fb..b2b5b8e 100644
--- a/gcc/testsuite/g++.dg/pr84279.C
+++ b/gcc/testsuite/g++.dg/pr84279.C
@@ -1,6 +1,7 @@
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-require-effective-target fpic } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
/* { dg-options "-O3 -mcpu=power8 -g -fPIC -fvisibility=hidden -fstack-protector-strong" } */
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/pr97560.C b/gcc/testsuite/g++.dg/pr97560.C
new file mode 100644
index 0000000..59313f9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr97560.C
@@ -0,0 +1,45 @@
+// PR tree-optimization/97560
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fno-tree-forwprop -fnon-call-exceptions" }
+
+template <typename>
+struct pv;
+
+template <typename CY>
+struct pv<CY &> {
+ typedef CY g7;
+};
+
+template <typename Q6>
+typename pv<Q6>::g7 hq (Q6 &&lb)
+{
+ return static_cast<typename pv<Q6>::g7 &&> (lb);
+}
+
+struct fk {
+ fk *j6;
+ fk *od;
+};
+
+fk *qi;
+
+struct xz : fk {
+ xz (xz &&)
+ {
+ qi = this;
+
+ if (j6)
+ od = this;
+ }
+};
+
+struct el {
+ struct {
+ xz ls;
+ } eu;
+};
+
+struct be : el {
+};
+
+be l1 = hq (l1);
diff --git a/gcc/testsuite/g++.dg/pr97609.C b/gcc/testsuite/g++.dg/pr97609.C
new file mode 100644
index 0000000..8e582c9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr97609.C
@@ -0,0 +1,46 @@
+// PR tree-optimization/97609
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fno-tree-fre -fnon-call-exceptions" }
+
+struct _Fwd_list_node_base {
+ _Fwd_list_node_base *_M_next;
+ void _M_transfer_after() { _Fwd_list_node_base *__keep = _M_next = __keep; }
+};
+struct _Fwd_list_const_iterator {
+ _Fwd_list_const_iterator(_Fwd_list_node_base *__n) : _M_node(__n) {}
+ _Fwd_list_const_iterator(int);
+ _Fwd_list_node_base *_M_node;
+};
+template <typename, typename> struct forward_list {
+ _Fwd_list_node_base _M_head;
+ template <typename _InputIterator>
+ forward_list(_InputIterator, _InputIterator);
+ forward_list(int);
+ _Fwd_list_const_iterator cbefore_begin() { return &_M_head; }
+ void splice_after(_Fwd_list_const_iterator) noexcept;
+ void splice_after(_Fwd_list_const_iterator __pos, forward_list &) {
+ splice_after(__pos, 0);
+ }
+ using __remove_return_type = void;
+ __remove_return_type unique() { unique(0); }
+ template <typename _BinPred> __remove_return_type unique(_BinPred);
+};
+template <typename _Tp, typename _Alloc>
+void forward_list<_Tp, _Alloc>::splice_after(_Fwd_list_const_iterator __pos)
+ noexcept {
+ __pos._M_node->_M_transfer_after();
+}
+template <typename _Tp, typename _Alloc>
+template <typename _BinPred>
+auto forward_list<_Tp, _Alloc>::unique(_BinPred) -> __remove_return_type {
+ forward_list __to_destroy(0);
+ splice_after(__to_destroy.cbefore_begin());
+}
+
+void
+foo ()
+{
+ forward_list<int, int> c1 (0, 0);
+ c1.unique ();
+}
+
diff --git a/gcc/testsuite/g++.dg/template/error25.C b/gcc/testsuite/g++.dg/template/error25.C
index 8901157..77b59cd 100644
--- a/gcc/testsuite/g++.dg/template/error25.C
+++ b/gcc/testsuite/g++.dg/template/error25.C
@@ -12,5 +12,5 @@ extern void f2 ();
template<>
extern void f2<void> (); // { dg-error "explicit template specialization cannot have a storage class" }
-export template<class T> // { dg-warning "keyword 'export' not implemented" }
+export template<class T> // { dg-warning "keyword 'export'" }
static void* f3 ();
diff --git a/gcc/testsuite/g++.dg/template/lookup16.C b/gcc/testsuite/g++.dg/template/lookup16.C
new file mode 100644
index 0000000..5b34c08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/lookup16.C
@@ -0,0 +1,23 @@
+// PR c++/94799
+// { dg-do compile { target c++11 } }
+
+template <typename> struct A {
+ typedef int type;
+ operator int();
+};
+
+template <typename T> using B = A<T>;
+
+template <typename T> typename B<T>::type foo(B<T> b)
+{
+ auto r1 = b.operator typename A<T>::type();
+ auto r2 = b.operator typename A<T>::template A<T>::type();
+ auto r3 = b.operator typename B<T>::type();
+ auto r4 = b.operator typename B<T>::template A<T>::type();
+ return r1 + r2 + r3 + r4;
+}
+
+void bar()
+{
+ foo(A<int>());
+}
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 cf23a08..b20d897 100644
--- a/gcc/testsuite/g++.dg/template/scope5.C
+++ b/gcc/testsuite/g++.dg/template/scope5.C
@@ -59,7 +59,7 @@ 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) {
// 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();
+ au<c::e<ap<typename ak<i>::o>::f> > az2(); // { dg-warning "empty parentheses" }
}
void v() {
ad a;
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/pr81659.C b/gcc/testsuite/g++.dg/torture/pr81659.C
index 3696957..074099b 100644
--- a/gcc/testsuite/g++.dg/torture/pr81659.C
+++ b/gcc/testsuite/g++.dg/torture/pr81659.C
@@ -12,7 +12,7 @@ a (int b)
catch (int)
{
}
- catch (int)
+ catch (int) // { dg-warning "will be caught by earlier handler" }
{
}
}
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/vect/simd-11.cc b/gcc/testsuite/g++.dg/vect/simd-11.cc
new file mode 100644
index 0000000..912d184
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/simd-11.cc
@@ -0,0 +1,61 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+// { dg-additional-options "-Ofast" }
+
+template <typename> class h {
+public:
+ ~h();
+};
+template <typename> struct l;
+template <typename c> struct l<h<c> > {
+ using d = c;
+ template <typename e> using f = h<e>;
+};
+template <typename g> struct o {
+ typedef l<g> j;
+ typedef typename j::d k;
+ template <typename c> struct p { typedef typename j::f<c> m; };
+};
+template <typename c, typename g> struct F {
+ typedef typename o<g>::p<c>::m q;
+ struct : q {
+ } r;
+};
+template <typename c, typename g = h<c> > class s : F<c, g> {
+public:
+ s(long);
+ typename o<typename F<c, g>::q>::k operator[](long);
+};
+template <int> class t {
+public:
+ int dimension;
+ t(const t &);
+ void operator+=(t);
+ double values[];
+};
+template <int dim> t<dim>::t(const t &p1) {
+ for (int i = 0; i < dim; ++i)
+ values[i] = p1.values[i];
+}
+template <int dim> class u : public t<dim> {
+public:
+ double m_fn1(const u &) const;
+};
+template <int dim> double u<dim>::m_fn1(const u &) const {
+ double a;
+ for (int i = 0; i < dim; ++i) {
+ double b = this->values[i];
+ a += b;
+ }
+ return a;
+}
+int m_fn2(const u<2> &p1, const u<2> &w) {
+ int n;
+ s<u<2> > c(n);
+ s<double> d(n);
+ double e = p1.m_fn1(w);
+ for (;;) {
+ c[0] += p1;
+ d = e;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/vect/slp-pr97636.cc b/gcc/testsuite/g++.dg/vect/slp-pr97636.cc
new file mode 100644
index 0000000..0123420
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/slp-pr97636.cc
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target c++17 } */
+
+struct u {
+ int b;
+ int c;
+ template <typename d, typename e> u(d, e);
+};
+template <class, class> struct f { u g; };
+template <class h, class i> class v {
+ typedef f<h, i> k;
+ k *l[4];
+ k m;
+public:
+ v(h, h);
+ void aa(h, i);
+};
+template <class h, class i> void v<h, i>::aa(h, i) { n(&l[1], &m); }
+template <class h, class i> void n(f<h, i> **o, f<h, i> *ab) {
+ bool p, r;
+ f q = **o;
+ f<h, i> *t;
+ h a = q.g;
+ h b = t->g;
+ if (r)
+ ;
+ else
+ goto ac;
+s:
+ p = a.b || a.c < b.c;
+ if (p)
+ goto s;
+ac:
+ ab->g = b;
+ b = t->g;
+ goto s;
+}
+template <class, class, class> class w {};
+template <class> class x;
+template <class, class> class z;
+class ad {
+public:
+ template <typename, typename y, typename ae, typename af, typename ag>
+ static void ah(const z<y, ae> &, const z<y, af> &, x<ag> *&);
+};
+template <typename, typename y, typename ae, typename af, typename ag>
+void ad::ah(const z<y, ae> &ai, const z<y, af> &aj, x<ag> *&) {
+ u c(0, 0), d(0, 0), g(aj, ai);
+ v<u, y> e(c, d);
+ e.aa(g, 0);
+}
+template <class, class> class ak;
+template <class, class, class al, class am, class an>
+void ao(ak<al, am> ap, ak<al, an> aq) {
+ x<double> *f;
+ ad::ah<int>(*ap.ar, *aq.ar, f);
+}
+template <typename, typename, typename al, typename am, typename an,
+ typename as, typename at>
+void au(w<al, am, as> ap, w<al, an, at> aq) {
+ ao<int, double>(static_cast<as &>(ap), static_cast<at &>(aq));
+}
+template <class, class> class z {};
+template <class, class> class ak : public w<int, int, ak<int, int>> {
+public:
+ z<int, int> *ar;
+};
+template <class, class, class> class av;
+template <typename, typename, typename, typename al, typename am, typename an,
+ typename aw, typename ax>
+void ay(av<al, am, aw>, av<al, an, ax>) {
+ aw h, i;
+ au<int, double>(h, i);
+}
+template <class, class, class> class av {};
+class az {
+public:
+ typedef av<int, double, ak<int, double>> ba;
+};
+int main() {
+ az::ba j, k;
+ ay<int, double, az>(j, k);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wdiv-by-zero-3.C b/gcc/testsuite/g++.dg/warn/Wdiv-by-zero-3.C
index 424eb0c..01f691f 100644
--- a/gcc/testsuite/g++.dg/warn/Wdiv-by-zero-3.C
+++ b/gcc/testsuite/g++.dg/warn/Wdiv-by-zero-3.C
@@ -5,8 +5,10 @@ foo (T t, int i)
{
int m1 = 10 / t;
int m2 = 10 / i;
- int m3 = 10 / (sizeof(T) - sizeof(int)); // { dg-warning "division by" }
- int m4 = 10 / N; // { dg-warning "division by" }
+ // People don't want to see warnings for type- or value-dependent
+ // expressions.
+ int m3 = 10 / (sizeof(T) - sizeof(int)); // { dg-bogus "division by" }
+ int m4 = 10 / N; // { dg-bogus "division by" }
return m1 + m2 + m3 + m4;
}
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions1.C b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
new file mode 100644
index 0000000..af140fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions1.C
@@ -0,0 +1,9 @@
+// PR c++/97675
+
+struct Base { };
+struct Child : Base { };
+int main() {
+ try { throw Child(); }
+ catch (Base const&) { }
+ catch (Child const&) { } // { dg-warning "exception of type .Child. will be caught by earlier handler" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions2.C b/gcc/testsuite/g++.dg/warn/Wexceptions2.C
new file mode 100644
index 0000000..07c5155
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions2.C
@@ -0,0 +1,10 @@
+// PR c++/97675
+// { dg-additional-options -Wno-exceptions }
+
+struct Base { };
+struct Child : Base { };
+int main() {
+ try { throw Child(); }
+ catch (Base const&) { }
+ catch (Child const&) { } // { dg-bogus "exception of type .Child. will be caught by earlier handler" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wexceptions3.C b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
new file mode 100644
index 0000000..97fda9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wexceptions3.C
@@ -0,0 +1,29 @@
+// PR c++/81660
+
+void bar (int);
+
+void
+fn (int b)
+{
+ if (b)
+ throw;
+ try
+ {
+ bar (3);
+ }
+ catch (int)
+ {
+ }
+ catch (int) // { dg-warning "will be caught by earlier handler" }
+ {
+ }
+ catch (const int) // { dg-warning "will be caught by earlier handler" }
+ {
+ }
+ catch (int &) // { dg-warning "will be caught by earlier handler" }
+ {
+ }
+ catch (const int &) // { dg-warning "will be caught by earlier handler" }
+ {
+ }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Winit-list4.C b/gcc/testsuite/g++.dg/warn/Winit-list4.C
new file mode 100644
index 0000000..d136187
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Winit-list4.C
@@ -0,0 +1,15 @@
+// PR c++/97632
+// { dg-do compile { target c++20 } }
+// Test we don't warn in an unevaluated operand.
+
+#include <initializer_list>
+
+template<typename _Tp>
+concept default_initializable
+ = requires
+ {
+ _Tp{};
+ (void) ::new _Tp; // { dg-bogus "does not extend the lifetime" }
+ };
+
+static_assert(default_initializable<std::initializer_list<int>>);
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++.dg/warn/Wtautological-compare3.C b/gcc/testsuite/g++.dg/warn/Wtautological-compare3.C
new file mode 100644
index 0000000..89bf1b6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtautological-compare3.C
@@ -0,0 +1,11 @@
+// PR c++/96675
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wtautological-compare" }
+
+template<char c>
+constexpr bool f(char d) {
+ return 'a' <= c && c <= 'z' ? (d | 0x20) == c :
+ 'A' <= c && c <= 'Z' ? (d & ~0x20) == c :
+ d == c;
+}
+static_assert(f<'p'>('P'), "");
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits5.C b/gcc/testsuite/g++.dg/warn/Wtype-limits5.C
new file mode 100644
index 0000000..5e79123
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits5.C
@@ -0,0 +1,11 @@
+// PR c++/96742
+// { dg-additional-options "-Wtype-limits" }
+
+template <unsigned N>
+bool f(unsigned x) {
+ return unsigned(x < N);
+}
+
+int main() {
+ f<0>(1);
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse.C
new file mode 100644
index 0000000..b02e904
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse.C
@@ -0,0 +1,110 @@
+// PR c++/25814
+// { dg-do compile }
+// Test -Wvexing-parse.
+
+struct T { };
+
+struct X {
+ X();
+};
+
+struct S {
+ S(int);
+ S foo (int (int));
+ S(T);
+ int m;
+};
+
+struct W {
+ W();
+ W(X, X);
+ int m;
+};
+
+int g;
+int g1(int(g));
+int g2(int());
+void fg(int);
+
+void
+fn1 (double (a))
+{
+ extern int f0();
+ extern int f1(int(a));
+ int f2(int(a)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ int (*f3)(int(a));
+ int f4(int a);
+ int f5(int()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ int f6(...);
+ int f7((int(a)));
+ int (f8);
+ int f9(S(s)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ int(f10) __attribute__(());
+ int(f11(int()));
+ if (int(a) = 1) { }
+ int j, k, l(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ int m, f12(int(j)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+
+ T t1(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ T t2(T()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ /* Declares a variable t3. */
+ T(t3);
+ T t4(), // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ t5(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+
+ extern S s1(int(a));
+ S s2(int(a)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ S s3(int a);
+ S s4(int()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ S s5(int(int)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ S s6(...);
+ S s7((int(a)));
+ S s8((int)a);
+ S s9 = int(a);
+ S(T());
+ S s10(S()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ S s11(T());
+ S s12(X()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ S s13 = S(T());
+ S(T()).foo(0);
+ S (S::*foo)(int (int));
+ S(*s14)(int(a));
+ S s15(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ S s16(void);
+
+ /* Don't warn here. */
+ void fv1(int(a));
+ void fv2(int());
+ void (fv3)();
+ void (fv4)(void);
+ void (fv5)(int);
+
+ int n(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ int (n2)(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ int n3(void);
+
+ typedef int F(const char*);
+ typedef int F2();
+ typedef int F3() const;
+ typedef int F4(int(a)) const;
+
+ W w(X(), X()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+}
+
+struct C1 {
+ C1(int);
+};
+
+struct C2 {
+ C2(C1, int);
+};
+
+template<int N> int value() { return N; }
+
+void
+fn2 ()
+{
+ int i = 0;
+ C2 c2(C1(int(i)), i);
+ C1(value<0>());
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse2.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse2.C
new file mode 100644
index 0000000..0dbeb72
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse2.C
@@ -0,0 +1,24 @@
+// PR c++/25814
+// { dg-do compile { target c++11 } }
+// Test -Wvexing-parse. C++11 features.
+
+struct X { };
+struct T {
+ T(X);
+};
+
+void
+fn1 (double (a))
+{
+ auto l = [](){
+ int f(int(a)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ };
+
+ [[noreturn]] int(e)(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+
+ T t1{X()};
+ T t2(X{});
+ T t3{X{}};
+
+ using U = int();
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse3.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse3.C
new file mode 100644
index 0000000..43fcdf2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse3.C
@@ -0,0 +1,129 @@
+// PR c++/25814
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-fdiagnostics-show-caret" }
+// Test -Wvexing-parse's fix-it hints in C++11.
+
+#include <initializer_list>
+
+struct X { };
+
+struct S {
+ S(X);
+ S(std::initializer_list<X>);
+ int m;
+};
+
+struct T {
+ T(X);
+ int m;
+};
+
+struct W {
+ W();
+ W(std::initializer_list<X>);
+ int m;
+};
+
+struct U {
+ U();
+ int m;
+};
+
+int
+main ()
+{
+ /*
+ Careful what we're suggesting:
+ S a((X())) -> S(X)
+ S a({X()}) -> (std::initializer_list<X>)
+ S a{X()} -> (std::initializer_list<X>)
+ */
+ S a(X()); // { dg-warning "6:parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ S a(X());
+ ^~~~~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:add parentheses to declare a variable" "" { target *-*-* } 41 }
+ /* { dg-begin-multiline-output "" }
+ S a(X());
+ ^~~~~
+ ( )
+ { dg-end-multiline-output "" } */
+
+ T t(X()); // { dg-warning "6:parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ T t(X());
+ ^~~~~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:replace parentheses with braces to declare a variable" "" { target *-*-* } 53 }
+ /* { dg-begin-multiline-output "" }
+ T t(X());
+ ^~~~~
+ -
+ { -
+ }
+ { dg-end-multiline-output "" } */
+
+ int n( ); // { dg-warning "8:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ int n( );
+ ^~~~~
+ { dg-end-multiline-output "" } */
+ // { dg-message "8:remove parentheses to default-initialize a variable" "" { target *-*-* } 67 }
+ /* { dg-begin-multiline-output "" }
+ int n( );
+ ^~~~~
+ -----
+ { dg-end-multiline-output "" } */
+ // { dg-message "8:or replace parentheses with braces to value-initialize a variable" "" { target *-*-* } 67 }
+
+ S s(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ S s();
+ ^~
+ { dg-end-multiline-output "" } */
+
+ X x(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ X x();
+ ^~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:remove parentheses to default-initialize a variable" "" { target *-*-* } 86 }
+ /* { dg-begin-multiline-output "" }
+ X x();
+ ^~
+ --
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:or replace parentheses with braces to aggregate-initialize a variable" "" { target *-*-* } 86 }
+
+ W w(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ W w();
+ ^~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:remove parentheses to default-initialize a variable" "" { target *-*-* } 99 }
+ /* { dg-begin-multiline-output "" }
+ W w();
+ ^~
+ --
+ { dg-end-multiline-output "" } */
+
+ T t2(); // { dg-warning "7:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ T t2();
+ ^~
+ { dg-end-multiline-output "" } */
+
+ U u(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ U u();
+ ^~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:remove parentheses to default-initialize a variable" "" { target *-*-* } 117 }
+ /* { dg-begin-multiline-output "" }
+ U u();
+ ^~
+ --
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:or replace parentheses with braces to value-initialize a variable" "" { target *-*-* } 117 }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse4.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse4.C
new file mode 100644
index 0000000..3e010aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse4.C
@@ -0,0 +1,74 @@
+// PR c++/25814
+// { dg-do compile { target c++98_only } }
+// { dg-additional-options "-fdiagnostics-show-caret" }
+// Test -Wvexing-parse's fix-it hints in C++98.
+
+struct X { };
+
+struct T {
+ T(X);
+ int m;
+};
+
+struct U {
+ U();
+ int m;
+};
+
+int
+main ()
+{
+ T t(X()); // { dg-warning "6:parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ T t(X());
+ ^~~~~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:add parentheses to declare a variable" "" { target *-*-* } 21 }
+ /* { dg-begin-multiline-output "" }
+ T t(X());
+ ^~~~~
+ ( )
+ { dg-end-multiline-output "" } */
+
+ int n( ); // { dg-warning "8:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ int n( );
+ ^~~~~
+ { dg-end-multiline-output "" } */
+ // { dg-message "8:remove parentheses to default-initialize a variable" "" { target *-*-* } 33 }
+ /* { dg-begin-multiline-output "" }
+ int n( );
+ ^~~~~
+ -----
+ { dg-end-multiline-output "" } */
+
+ T y(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ T y();
+ ^~
+ { dg-end-multiline-output "" } */
+
+ X x(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ X x();
+ ^~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:remove parentheses to default-initialize a variable" "" { target *-*-* } 51 }
+ /* { dg-begin-multiline-output "" }
+ X x();
+ ^~
+ --
+ { dg-end-multiline-output "" } */
+
+ U u(); // { dg-warning "6:empty parentheses were disambiguated as a function declaration" }
+ /* { dg-begin-multiline-output "" }
+ U u();
+ ^~
+ { dg-end-multiline-output "" } */
+ // { dg-message "6:remove parentheses to default-initialize a variable" "" { target *-*-* } 63 }
+ /* { dg-begin-multiline-output "" }
+ U u();
+ ^~
+ --
+ { dg-end-multiline-output "" } */
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse5.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse5.C
new file mode 100644
index 0000000..3422e70
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse5.C
@@ -0,0 +1,14 @@
+// PR c++/25814
+// { dg-do compile }
+// Test -Wvexing-parse in a template.
+
+struct X { };
+
+template<typename T>
+void fn ()
+{
+ T t(); // { dg-warning "empty parentheses were disambiguated as a function declaration" }
+ T a(X()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ X x(T()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ int i(T()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse6.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse6.C
new file mode 100644
index 0000000..58fa725
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse6.C
@@ -0,0 +1,24 @@
+// PR c++/25814
+// { dg-do compile }
+// Test from Wikipedia.
+
+class Timer {
+ public:
+ Timer();
+};
+
+class TimeKeeper {
+ public:
+ TimeKeeper(const Timer& t);
+
+ int get_time();
+};
+
+void f(double adouble) {
+ int i(int(adouble)); // { dg-warning "parentheses were disambiguated as a function declaration" }
+}
+
+int main() {
+ TimeKeeper time_keeper(Timer()); // { dg-warning "parentheses were disambiguated as a function declaration" }
+ return time_keeper.get_time(); // { dg-error "request for member" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse7.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse7.C
new file mode 100644
index 0000000..9f4c702
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse7.C
@@ -0,0 +1,27 @@
+// PR c++/25814
+// { dg-do compile }
+
+struct X { };
+struct W {
+ W(X, X);
+};
+
+void
+fn ()
+{
+ W w1(X(), X()); // { dg-warning "parentheses" }
+ W w2(X(a), X()); // { dg-warning "parentheses" }
+ W w3(X(), X(a)); // { dg-warning "parentheses" }
+ W w4(X(a), X(b)); // { dg-warning "parentheses" }
+ W w5(X, X);
+ W w6(X(a), X);
+ W w7(X, X(a));
+ W w8(X(a), X()); // { dg-warning "parentheses" }
+ W w9(X, X());
+ W w10(X, X());
+
+ // Not function declarations.
+ W z1(X(), (X()));
+ W z2((X()), X());
+ W z3((X()), (X()));
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wvexing-parse8.C b/gcc/testsuite/g++.dg/warn/Wvexing-parse8.C
new file mode 100644
index 0000000..2d26d22
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wvexing-parse8.C
@@ -0,0 +1,11 @@
+// PR c++/97762
+// { dg-do compile }
+
+void
+g ()
+{
+ long a(); // { dg-warning "empty parentheses" }
+ signed b(); // { dg-warning "empty parentheses" }
+ unsigned c(); // { dg-warning "empty parentheses" }
+ short d(); // { dg-warning "empty parentheses" }
+}
diff --git a/gcc/testsuite/g++.dg/warn/mvp3.C b/gcc/testsuite/g++.dg/warn/mvp3.C
new file mode 100644
index 0000000..4d371c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/mvp3.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-Wparentheses -fdiagnostics-show-caret" }
+// Test fix-it hints for the MVP warning.
+
+void
+g ()
+{
+ int (i); // { dg-warning "7:unnecessary parentheses" }
+/* { dg-begin-multiline-output "" }
+ int (i);
+ ^~~
+ { dg-end-multiline-output "" } */
+// { dg-message "7:remove parentheses" "" { target *-*-* } 8 }
+/* { dg-begin-multiline-output "" }
+ int (i);
+ ^~~
+ - -
+ { dg-end-multiline-output "" } */
+ int (fn(void)); // { dg-warning "7:unnecessary parentheses" }
+/* { dg-begin-multiline-output "" }
+ int (fn(void));
+ ^~~~~~~~~~
+ { dg-end-multiline-output "" } */
+// { dg-message "7:remove parentheses" "" { target *-*-* } 19 }
+/* { dg-begin-multiline-output "" }
+ int (fn(void));
+ ^~~~~~~~~~
+ - -
+ { dg-end-multiline-output "" } */
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C b/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C
index de20a07..0af1c14 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/recurse.C
@@ -73,7 +73,7 @@ public:
int main()
{
- DBpathrec a(), b();
+ DBpathrec a(), b(); // { dg-warning "empty parentheses" }
a = b;// { dg-error "" } non-lvalue in assignment.*
}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
index 2300a94..7cc6096 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/catch10.C
@@ -13,8 +13,8 @@ void g()
catch (A*) { }
try { f(); }
- catch (A*) { } // { dg-warning "" } A* before B*
- catch (B*) { } // { dg-warning "" } A* before B*
+ catch (A*) { } // { dg-message "for type" } A* before B*
+ catch (B*) { } // { dg-warning "will be caught" } A* before B*
try { f(); }
catch (A*) { }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template4.C b/gcc/testsuite/g++.old-deja/g++.jason/template4.C
index de7d331..1cf5a61 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/template4.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/template4.C
@@ -17,5 +17,5 @@ template <class T>
ccList <T> cc_List<T>::copy (){}
int main (int, char **) {
- ccList <int> size1();
+ ccList <int> size1(); // { dg-warning "empty parentheses" }
}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/arm4.C b/gcc/testsuite/g++.old-deja/g++.law/arm4.C
index bbcf7df..59492ca 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/arm4.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/arm4.C
@@ -20,7 +20,7 @@ int main(void)
{
double a = 2.0;
- S x(int (a));
+ S x(int (a)); // { dg-warning "parentheses were disambiguated" }
if (count > 0)
{ printf ("FAIL\n"); return 1; }
else
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/for2.C b/gcc/testsuite/g++.old-deja/g++.mike/for2.C
index 6eb5d66..4a7c304 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/for2.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/for2.C
@@ -14,7 +14,7 @@ void bar() {
void bee () {
int i = 0;
- for (int fun() = 0; i != 2; ++i) { // { dg-warning "extern" "extern" }
+ for (int fun() = 0; i != 2; ++i) { // { dg-warning "extern|empty parentheses" "extern" }
// { dg-error "initialized" "init" { target *-*-* } .-1 }
}
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/local4.C b/gcc/testsuite/g++.old-deja/g++.other/local4.C
index b5514a5..492ce2b 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/local4.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/local4.C
@@ -6,6 +6,6 @@ int f (int);
int main ()
{
- int f ();
+ int f (); // { dg-warning "empty parentheses" }
return f ();
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/using1.C b/gcc/testsuite/g++.old-deja/g++.other/using1.C
index 6cebc29..8910091 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/using1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/using1.C
@@ -10,9 +10,9 @@ protected:
friend class D2;
};
-class D : public B { // { dg-error "" } within this context
+class D : public B {
public:
- using B::a;
+ using B::a; // { dg-error "" } within this context
using B::b;
};
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C
index 012e3d0..a84b190 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash10.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash10.C
@@ -6,7 +6,6 @@ public:
enum { val = (N == 0) ? M : GCD<N, M % N>::val };
// { dg-error "constant expression" "valid" { target *-*-* } .-1 }
// { dg-message "template argument" "valid" { target *-*-* } .-2 }
-// { dg-warning "division by" "" { target *-*-* } .-3 }
};
int main() {
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash3.C b/gcc/testsuite/g++.old-deja/g++.pt/crash3.C
index 52701b7..d1d9b12 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/crash3.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash3.C
@@ -7,11 +7,13 @@ public:
{
// local-extern :)
CVector<int> v(); // { dg-message "old declaration" }
+ // { dg-warning "empty parentheses" "" { target *-*-* } .-1 }
return v; // { dg-error "convert" }
}
CVector<long> g() const
{
CVector<long> v(); // { dg-error "ambiguating new" }
+ // { dg-warning "empty parentheses" "" { target *-*-* } .-1 }
return v; // { dg-error "convert" }
}
};
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/pr96998.c b/gcc/testsuite/gcc.c-torture/compile/pr96998.c
new file mode 100644
index 0000000..a75d5dc
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr96998.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target arm*-*-* aarch64*-*-* } } */
+
+int h(void);
+struct c d;
+struct c {
+ int e[1];
+};
+
+void f(void) {
+ int g;
+ for (;; g = h()) {
+ int *i = &d.e[g];
+ asm("" : "=Q"(*i));
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97205.c b/gcc/testsuite/gcc.c-torture/compile/pr97205.c
new file mode 100644
index 0000000..6600011
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr97205.c
@@ -0,0 +1,7 @@
+int a;
+typedef __attribute__((aligned(2))) int x;
+int f ()
+{
+ x b = a;
+ return b;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97576.c b/gcc/testsuite/gcc.c-torture/compile/pr97576.c
new file mode 100644
index 0000000..28294c8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr97576.c
@@ -0,0 +1,18 @@
+void
+pc (void);
+
+void __attribute__ ((simd))
+ty (void);
+
+void __attribute__ ((simd))
+gf ()
+{
+ ty ();
+}
+
+void __attribute__ ((simd))
+ty (void)
+{
+ gf (pc);
+ gf (gf);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr97578.c b/gcc/testsuite/gcc.c-torture/compile/pr97578.c
new file mode 100644
index 0000000..e007724
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr97578.c
@@ -0,0 +1,11 @@
+int printf (const char *, ...);
+
+int a;
+static void b(int c) {
+ if (c)
+ printf("%d", a);
+}
+void e() {
+ int d = 0;
+ b(d);
+}
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/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.c-torture/execute/pr97695.c b/gcc/testsuite/gcc.c-torture/execute/pr97695.c
new file mode 100644
index 0000000..36f48b4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97695.c
@@ -0,0 +1,20 @@
+int *a, b, **c = &a, d, e;
+
+int f(int g, int h) { return !h || (g && h == 1) ? 0 : g / h; }
+
+static void *i(int g) {
+ while (e < 2)
+ if (!f(g, 9)) {
+ while (b)
+ ;
+ return 0;
+ }
+ return 0;
+}
+
+void j() {
+ i(1);
+ *c = i(d);
+}
+
+int main() { j(); return 0; }
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97764.c b/gcc/testsuite/gcc.c-torture/execute/pr97764.c
new file mode 100644
index 0000000..4ceaab8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr97764.c
@@ -0,0 +1,14 @@
+/* PR tree-optimization/97764 */
+/* { dg-require-effective-target int32plus } */
+
+struct S { int b : 3; int c : 28; int d : 1; };
+
+int
+main ()
+{
+ struct S e = {};
+ e.c = -1;
+ if (e.d)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/20031223-1.c b/gcc/testsuite/gcc.dg/20031223-1.c
index 68aa74f..c529739 100644
--- a/gcc/testsuite/gcc.dg/20031223-1.c
+++ b/gcc/testsuite/gcc.dg/20031223-1.c
@@ -3,11 +3,10 @@
because GCC was trying to expand the trees to rtl. */
/* { dg-do compile } */
-/* { dg-options "" } */
+/* { dg-options "-std=c17 -pedantic-errors" } */
void f ()
{
l: int; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "not stmt" } */
- /* { dg-warning "useless type name in empty declaration" "type name" { target *-*-* } .-1 } */
- /* { dg-error "label at end of compound statement" "label" { target *-*-* } .-2 } */
+ /* { dg-error "useless type name in empty declaration" "type name" { target *-*-* } .-1 } */
}
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-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-bounds-70.c b/gcc/testsuite/gcc.dg/Warray-bounds-70.c
new file mode 100644
index 0000000..087e255
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-70.c
@@ -0,0 +1,18 @@
+/* PR middle-end/97556 - ICE on excessively large index into a multidimensional
+ array
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define SIZE_MAX __SIZE_MAX__
+
+typedef __SIZE_TYPE__ size_t;
+
+char a[1][3];
+
+void f (int c)
+{
+ size_t i = c ? SIZE_MAX / 2 : SIZE_MAX;
+ a[i][0] = 0; // { dg-warning "\\\[-Warray-bounds" }
+}
+
+// { dg-prune-output "\\\[-Wstringop-overflow=" }
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-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-44.s b/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s
deleted file mode 100644
index 0fc73a9..0000000
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-44.s
+++ /dev/null
@@ -1,271 +0,0 @@
- .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-56.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-56.c
new file mode 100644
index 0000000..b3e598c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-56.c
@@ -0,0 +1,163 @@
+/* PR middle-end/92942 - missing -Wstringop-overflow for allocations with
+ a negative lower bound size
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+#define SIZE_MAX __SIZE_MAX__
+#define UINT8_MAX __UINT8_MAX__
+#define UINT16_MAX __UINT16_MAX__
+
+typedef __SIZE_TYPE__ size_t;
+typedef __UINT8_TYPE__ uint8_t;
+typedef __UINT16_TYPE__ uint16_t;
+
+void* usr_alloc1 (size_t) __attribute__ ((alloc_size (1)));
+void* usr_alloc2 (size_t, size_t) __attribute__ ((alloc_size (1, 2)));
+
+void* malloc (size_t);
+void* memcpy (void*, const void*, size_t);
+void* memset (void*, int, size_t);
+char* strcpy (char*, const char*);
+
+void sink (void*);
+
+void malloc_uint_range_strcpy (unsigned n)
+{
+ void *p = malloc (5 < n ? 5 : n);
+
+ strcpy (p, "01234"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "0123");
+ sink (p);
+}
+
+void malloc_uint16_anti_range_memset (uint16_t n)
+{
+ if (5 <= n && n <= 9) return;
+ void *p = malloc (n);
+
+ if (UINT16_MAX < SIZE_MAX)
+ {
+ size_t sz = (uint16_t)-1 + (size_t)1;
+ memset (p, 0, sz); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+ }
+
+ memset (p, 0, 1);
+ sink (p);
+ memset (p, 0, 5);
+ sink (p);
+ memset (p, 0, 6);
+ sink (p);
+ memset (p, 0, UINT16_MAX - 1);
+ sink (p);
+ memset (p, 0, UINT16_MAX);
+ sink (p);
+}
+
+void malloc_int_strcpy (int n)
+{
+ void *p = malloc (7 < n ? 7 : n);
+
+ strcpy (p, "0123456"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "012345");
+ sink (p);
+}
+
+void vla_int_strcpy (int n)
+{
+ char a[9 < n ? 9 : n];
+
+ strcpy (a, "012345678"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (a);
+
+ strcpy (a, "01234567");
+ sink (a);
+}
+
+void usr_alloc1_int_strcpy (int n)
+{
+ void *p = usr_alloc1 (7 < n ? 7 : n);
+
+ strcpy (p, "0123456"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "012345");
+ sink (p);
+}
+
+void usr_alloc2_cst_ir_strcpy (int n)
+{
+ void *p = usr_alloc2 (1, 5 < n ? 5 : n);
+
+ strcpy (p, "01234"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "0123");
+ sink (p);
+}
+
+void usr_alloc2_ir_ir_strcpy (int m, int n)
+{
+ void *p = usr_alloc2 (3 < n ? 3 : n, 5 < n ? 5 : n);
+
+ strcpy (p, "0123456789abcde"); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ strcpy (p, "0123456789abcd");
+ sink (p);
+}
+
+void usr_alloc2_uint8_memset (uint8_t m, uint8_t n)
+{
+ if (3 <= m && m <= 7) return;
+ if (5 <= n && n <= 9) return;
+ void *p = usr_alloc2 (m, n);
+
+ size_t sz = UINT8_MAX * UINT8_MAX + 1;
+ memset (p, 0, sz); // { dg-warning "\\\[-Wstringop-overflow" "" { xfail *-*-* } }
+ // { dg-warning "\\\[-Warray-bounds" "pr?????" { target *-*-* } .-1 }
+ sink (p);
+
+ memset (p, 0, sz - 1);
+ sink (p);
+ memset (p, 0, 64);
+ sink (p);
+ memset (p, 0, 63);
+ sink (p);
+ memset (p, 0, 16);
+ sink (p);
+ memset (p, 0, 15);
+ sink (p);
+ memset (p, 0, 14);
+ sink (p);
+ memset (p, 0, 3);
+ sink (p);
+}
+
+
+
+void malloc_int_memset (int n)
+{
+ void *p = malloc (11 < n ? 11 : n);
+
+ memset (p, 0, 12); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (p);
+
+ memset (p, 0, 11);
+ sink (p);
+}
+
+void vla_int_memset (int n)
+{
+ char a[13 < n ? 13 : n];
+
+ memset (a, 0, 14); // { dg-warning "\\\[-Wstringop-overflow" }
+ sink (a);
+
+ memset (a, 0, 13);
+ sink (a);
+}
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-57.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-57.c
new file mode 100644
index 0000000..173aa16
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-57.c
@@ -0,0 +1,91 @@
+/* Verify that an anti-range ~[A, B] with small positive A and B
+ is handled correctly and doesn't trigger warnings.
+ { dg-do compile }
+ { dg-options "-O2 -Wall" } */
+
+typedef __typeof__ (sizeof 0) size_t;
+
+int f (void*, size_t);
+int g (void*);
+
+// Test case distilled from gcc/cp/semantics.c
+
+int omp_reduction_id (int i, int j, const char *mm)
+{
+ const char *p = 0;
+ const char *m = 0;
+
+ switch (i)
+ {
+ case 1:
+ p = "min";
+ break;
+ case 2:
+ p = "max";
+ break;
+ default:
+ break;
+ }
+
+ if (j)
+ m = mm;
+
+ const char prefix[] = "omp declare reduction ";
+ size_t lenp = sizeof (prefix);
+
+ if (__builtin_strncmp (p, prefix, lenp - 1) == 0)
+ lenp = 1;
+
+ size_t len = __builtin_strlen (p);
+ size_t lenm = m ? __builtin_strlen (m) + 1 : 0;
+ char *name = ((char *) __builtin_alloca(lenp + len + lenm));
+
+ if (lenp > 1)
+ __builtin_memcpy (name, prefix, lenp - 1);
+
+ __builtin_memcpy (name + lenp - 1, p, len + 1);
+ if (m)
+ {
+ name[lenp + len - 1] = '~';
+ __builtin_memcpy (name + lenp + len, m, lenm);
+ }
+ return (__builtin_constant_p (name)
+ ? f (name, __builtin_strlen (name)) : g (name));
+}
+
+// Test case derived from gcc/d/dmd/root/filename.c.
+
+const char *ext (const char *str)
+{
+ size_t len = __builtin_strlen(str);
+
+ const char *e = str + len;
+ for (;;)
+ {
+ switch (*e)
+ {
+ case '.': return e + 1;
+ case '/': break;
+ default:
+ if (e == str)
+ break;
+ e--;
+ continue;
+ }
+ return 0;
+ }
+}
+
+const char *removeExt (const char *str)
+{
+ const char *e = ext (str);
+ if (e)
+ {
+ size_t len = (e - str) - 1;
+ char *n = (char *)__builtin_malloc (len + 1);
+ __builtin_memcpy(n, str, len);
+ n[len] = 0;
+ return n;
+ }
+ return 0;
+}
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-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/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/malloc-1.c b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
index c3e1330..38ce1a5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
@@ -509,6 +509,14 @@ void test_42c (void)
free (q - 64); /* this is probably OK. */
} /* { dg-bogus "leak of 'p'" } */
+void *
+test_42d (void)
+{
+ void *p = malloc (1024);
+ void *q = p + 64;
+ return q;
+} /* { dg-bogus "leak of 'p'" } */
+
#if 0
void test_31 (void *p)
{
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/pr97568.c b/gcc/testsuite/gcc.dg/analyzer/pr97568.c
new file mode 100644
index 0000000..22d574b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97568.c
@@ -0,0 +1,29 @@
+#include "analyzer-decls.h"
+
+#define NULL ((void *)0)
+
+extern int *const p1;
+
+int *const p2;
+
+int v3;
+extern int *const p3 = &v3; /* { dg-warning "'p3' initialized and declared 'extern'" } */
+
+int v4;
+int *const p4 = &v4;
+
+int main (void)
+{
+ __analyzer_describe (0, p1); /* { dg-message "INIT_VAL\\(p1\\)" } */
+ __analyzer_eval (p1 == NULL); /* { dg-message "UNKNOWN" } */
+
+ __analyzer_eval (p2 == NULL); /* { dg-message "TRUE" } */
+
+ __analyzer_describe (0, p3); /* { dg-message "&v3" } */
+ __analyzer_eval (p3 == NULL); /* { dg-message "FALSE" } */
+
+ __analyzer_describe (0, p4); /* { dg-message "&v4" } */
+ __analyzer_eval (p4 == NULL); /* { dg-message "FALSE" } */
+
+ return p1[0];
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97608.c b/gcc/testsuite/gcc.dg/analyzer/pr97608.c
new file mode 100644
index 0000000..a2bc130
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97608.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+
+void *f (void)
+{
+ void *p = malloc (8);
+ if (p == NULL)
+ abort ();
+ return (void *) ((char *) p + 0);
+}
+
+void *g (void)
+{
+ void *p = malloc (8);
+ if (p == NULL)
+ abort ();
+ return (void *) ((char *) p + 1);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr97668.c b/gcc/testsuite/gcc.dg/analyzer/pr97668.c
new file mode 100644
index 0000000..6ec8164
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr97668.c
@@ -0,0 +1,27 @@
+/* { dg-additional-options "-O1" } */
+
+void
+wb (_Complex double jh)
+{
+ _Complex double af = 0.0;
+
+ do
+ {
+ af += jh;
+ }
+ while (af != 0.0);
+}
+
+_Complex double
+o6 (void)
+{
+ _Complex double ba = 0.0;
+
+ for (;;)
+ {
+ wb (ba);
+ ba = 1.0;
+ }
+
+ return ba;
+}
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/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/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/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/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/c11-bool-1.c b/gcc/testsuite/gcc.dg/c11-bool-1.c
new file mode 100644
index 0000000..0412624
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-bool-1.c
@@ -0,0 +1,50 @@
+/* Test macro expansions in <stdbool.h> in C11. */
+/* { dg-do run } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+#include <stdbool.h>
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+#if false - 1 >= 0
+#error "false unsigned in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 >= 0
+#error "true unsigned in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+int
+main (void)
+{
+ if (strcmp (str (bool), "_Bool") != 0)
+ abort ();
+ if (_Generic (true, int : 1) != 1)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (strcmp (str (true), "1") != 0)
+ abort ();
+ if (_Generic (false, int : 1) != 1)
+ abort ();
+ if (false != 0)
+ abort ();
+ if (strcmp (str (false), "0") != 0)
+ abort ();
+ if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c11-labels-1.c b/gcc/testsuite/gcc.dg/c11-labels-1.c
new file mode 100644
index 0000000..6350403
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-labels-1.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x;
+ goto c;
+ b: goto a;
+ { i *= 3; c: }
+ return i;
+ d:
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-labels-2.c b/gcc/testsuite/gcc.dg/c11-labels-2.c
new file mode 100644
index 0000000..e9b4924
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-labels-2.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x; /* { dg-warning "a label can only be part of a statement and a declaration is not a statement" } */
+ goto c;
+ b: goto a;
+ { i *= 3; c: } /* { dg-warning "label at end of compound statement" } */
+ return i;
+ d: /* { dg-warning "label at end of compound statement" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-labels-3.c b/gcc/testsuite/gcc.dg/c11-labels-3.c
new file mode 100644
index 0000000..1e4be63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-labels-3.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" } */
+ goto c;
+ b: goto a;
+ { i *= 3; c: } /* { dg-error "label at end of compound statement" } */
+ return i;
+ d: /* { dg-error "label at end of compound statement" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-1.c b/gcc/testsuite/gcc.dg/c11-parm-omit-1.c
new file mode 100644
index 0000000..83d1b50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-1.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names not in C11: -pedantic-errors. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+void f (int) { } /* { dg-error "omitting parameter names" } */
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-2.c b/gcc/testsuite/gcc.dg/c11-parm-omit-2.c
new file mode 100644
index 0000000..2efd450
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-2.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names not in C11: -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic" } */
+
+void f (int) { } /* { dg-warning "omitting parameter names" } */
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-3.c b/gcc/testsuite/gcc.dg/c11-parm-omit-3.c
new file mode 100644
index 0000000..5bf27a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-3.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names not in C11: -pedantic -Wno-c11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic -Wno-c11-c2x-compat" } */
+
+void f (int) { }
diff --git a/gcc/testsuite/gcc.dg/c11-parm-omit-4.c b/gcc/testsuite/gcc.dg/c11-parm-omit-4.c
new file mode 100644
index 0000000..ea4cbfa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-parm-omit-4.c
@@ -0,0 +1,6 @@
+/* Test omitted parameter names not in C11: accepted by default in the
+ absence of -pedantic. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+void f (int) { }
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c b/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
index f1848a2..7698434 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-deprecated-4.c
@@ -1,13 +1,11 @@
-/* Test C2x deprecated attribute: duplicates. */
+/* Test C2x deprecated attribute: duplicates (allowed after N2557). */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
-[[deprecated, __deprecated__]] int a; /* { dg-error "can appear at most once" } */
-[[__deprecated__, deprecated("message")]] int b; /* { dg-error "can appear at most once" } */
-int c [[deprecated("message"), deprecated]]; /* { dg-error "can appear at most once" } */
-[[deprecated, deprecated]]; /* { dg-error "can appear at most once" } */
+[[deprecated, __deprecated__]] int a;
+[[__deprecated__, deprecated("message")]] int b;
+int c [[deprecated("message"), deprecated]];
+[[deprecated, deprecated]];
/* { dg-error "ignored" "ignored" { target *-*-* } .-1 } */
-/* Separate attribute lists in the same attribute specifier sequence,
- with the same attribute in them, are OK. */
[[deprecated]] [[deprecated]] int d [[deprecated]] [[deprecated]];
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c b/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c
index 75aceff..a6cedcd 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-fallthrough-4.c
@@ -1,4 +1,4 @@
-/* Test C2x fallthrough attribute: duplicates. */
+/* Test C2x fallthrough attribute: duplicates (allowed after N2557). */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
@@ -9,12 +9,9 @@ f (int a)
{
case 1:
a++;
- [[fallthrough, __fallthrough__]]; /* { dg-error "can appear at most once" } */
+ [[fallthrough, __fallthrough__]]; /* { dg-warning "specified multiple times" } */
case 2:
a++;
- /* Separate attribute lists in the same attribute specifier
- sequence, with the same attribute in them, are OK (but
- receive a warning). */
[[fallthrough]] [[fallthrough]]; /* { dg-warning "specified multiple times" } */
case 3:
a++;
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c
index 300c0da..6b997aa 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-maybe_unused-4.c
@@ -1,13 +1,11 @@
-/* Test C2x maybe_unused attribute: duplicates. */
+/* Test C2x maybe_unused attribute: duplicates (allowed after N2557). */
/* { dg-do compile } */
/* { dg-options "-std=c2x -pedantic-errors" } */
-[[maybe_unused, __maybe_unused__]] int a; /* { dg-error "can appear at most once" } */
-[[__maybe_unused__, maybe_unused]] int b; /* { dg-error "can appear at most once" } */
-int c [[maybe_unused, maybe_unused]]; /* { dg-error "can appear at most once" } */
-[[maybe_unused, maybe_unused]]; /* { dg-error "can appear at most once" } */
+[[maybe_unused, __maybe_unused__]] int a;
+[[__maybe_unused__, maybe_unused]] int b;
+int c [[maybe_unused, maybe_unused]];
+[[maybe_unused, maybe_unused]];
/* { dg-error "ignored" "ignored" { target *-*-* } .-1 } */
-/* Separate attribute lists in the same attribute specifier sequence,
- with the same attribute in them, are OK. */
[[maybe_unused]] [[maybe_unused]] int d [[maybe_unused]] [[maybe_unused]];
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c
new file mode 100644
index 0000000..f4893bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-1.c
@@ -0,0 +1,62 @@
+/* Test C2x deprecated attribute: valid uses. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+[[nodiscard]] int c1 (void); /* { dg-message "declared here" } */
+[[__nodiscard__ ("some reason")]] int c2 (void); /* { dg-message "declared here" } */
+
+struct [[nodiscard ("struct reason")]] s1 { int a; };
+struct [[__nodiscard__]] s2 { long b; };
+struct s1 cs1 (void); /* { dg-message "declared here" } */
+struct s2 cs2 (void); /* { dg-message "declared here" } */
+typedef struct s2 s2t;
+s2t cs3 (void); /* { dg-message "declared here" } */
+
+union [[nodiscard]] u1 { int a; long b; };
+union [[nodiscard ("union reason")]] u2 { short c; float d; };
+union u1 cu1 (void); /* { dg-message "declared here" } */
+union u2 cu2 (void); /* { dg-message "declared here" } */
+
+enum [[nodiscard]] e1 { E1 };
+enum [[nodiscard ("enum reason")]] e2 { E2 };
+enum e1 ce1 (void); /* { dg-message "declared here" } */
+enum e2 ce2 (void); /* { dg-message "declared here" } */
+enum e1 ce1a (void);
+int i;
+
+[[nodiscard]] void v (void); /* { dg-warning "void return type" } */
+
+int ok (void);
+
+void
+f (void)
+{
+ c1 (); /* { dg-warning "ignoring return value" } */
+ c2 (); /* { dg-warning "some reason" } */
+ cs1 (); /* { dg-warning "struct reason" } */
+ cs2 (); /* { dg-warning "ignoring return value of type" } */
+ cs3 (); /* { dg-warning "ignoring return value of type" } */
+ cu1 (); /* { dg-warning "ignoring return value of type" } */
+ cu2 (); /* { dg-warning "union reason" } */
+ ce1 (); /* { dg-warning "ignoring return value of type" } */
+ ce2 (); /* { dg-warning "enum reason" } */
+ ok ();
+ c1 (), ok (); /* { dg-warning "ignoring return value" } */
+ cs1 (), ok (); /* { dg-warning "struct reason" } */
+ ok (), cu1 (); /* { dg-warning "ignoring return value" } */
+ ok (), (ok (), (ok (), ce2 ())); /* { dg-warning "enum reason" } */
+ (ok (), cu1 ()), ok (); /* { dg-warning "ignoring return value" } */
+ v ();
+ (i ? ce1 : ce1a) (); /* { dg-warning "ignoring return value of type" } */
+ (void) c1 ();
+ (void) c2 ();
+ (void) cs1 ();
+ (void) cs2 ();
+ (void) cs3 ();
+ (void) cu1 ();
+ (void) cu2 ();
+ (void) ce1 ();
+ (void) ce2 ();
+ (void) (ok (), cu1 ());
+ (void) (i ? ce1 : ce1a) ();
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
new file mode 100644
index 0000000..45c4d50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-2.c
@@ -0,0 +1,42 @@
+/* Test C2x nodiscard attribute: invalid contexts. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+/* This attribute is not valid on types other than their definitions,
+ or on declarations other than function declarations, or on
+ statements, or as an attribute-declaration. */
+
+[[nodiscard]]; /* { dg-error "ignored" } */
+
+int [[nodiscard]] var; /* { dg-error "ignored" } */
+
+int [[nodiscard ("reason")]] var2; /* { dg-error "ignored" } */
+
+int array_with_nod_type[2] [[nodiscard]]; /* { dg-error "ignored" } */
+
+void fn_with_nod_type () [[nodiscard]]; /* { dg-error "ignored" } */
+
+int z = sizeof (int [[__nodiscard__]]); /* { dg-error "ignored" } */
+
+[[nodiscard]] typedef int nod_int; /* { dg-error "can only be applied" } */
+
+[[nodiscard]] int nvar; /* { dg-error "can only be applied" } */
+
+struct s { int a; };
+
+[[nodiscard]] typedef struct s nod_s; /* { dg-error "can only be applied" } */
+
+struct t { [[nodiscard]] int b; }; /* { dg-error "can only be applied" } */
+
+enum e { E [[nodiscard]] }; /* { dg-error "can only be applied" } */
+
+void fx ([[nodiscard]] int p); /* { dg-error "can only be applied" } */
+
+void
+f (void)
+{
+ int a;
+ [[nodiscard ("reason")]] int b = 1; /* { dg-error "can only be applied" } */
+ [[nodiscard]]; /* { dg-error "ignored" } */
+ [[nodiscard]] a = 1; /* { dg-error "ignored" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c
new file mode 100644
index 0000000..2e70d12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-3.c
@@ -0,0 +1,11 @@
+/* Test C2x nodiscard attribute: invalid syntax. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+[[nodiscard()]] int a (void); /* { dg-error "parentheses must be omitted if attribute argument list is empty" } */
+
+[[nodiscard(0)]] int b (void); /* { dg-error "expected" } */
+
+[[nodiscard("", 123)]] int c (void); /* { dg-error "expected" } */
+
+[[nodiscard((""))]] int d (void); /* { dg-error "expected" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c
new file mode 100644
index 0000000..278f55d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-attr-nodiscard-4.c
@@ -0,0 +1,6 @@
+/* Test C2x nodiscard attribute: duplicates (allowed after N2557). */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+[[nodiscard, __nodiscard__]] int f (void);
+[[__nodiscard__, nodiscard("message")]] int g (void);
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c b/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c
index 1f883d8..2f0d9f6 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-syntax-3.c
@@ -25,13 +25,14 @@ f2 (void)
}
/* Declarations, including attribute declarations, cannot appear after
- labels. */
+ labels when a statement is expected. */
void
f3 (void)
{
- x: [[]];; /* { dg-error "can only be part of a statement" } */
-}
+ if (1)
+ x: [[]]; /* { dg-error "expected" } */
+}
/* Prefix attributes cannot appear on type names. */
diff --git a/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c b/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
index 37a2411..b261be0 100644
--- a/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
+++ b/gcc/testsuite/gcc.dg/c2x-attr-syntax-5.c
@@ -49,8 +49,3 @@ func (void) [[unknown_attribute]] { /* { dg-error "attribute ignored" } */
[[unknown_attribute]] x: var = 2; /* { dg-error "attribute ignored" } */
for ([[unknown_attribute]] int zz = 1; zz < 10; zz++) ; /* { dg-error "attribute ignored" } */
}
-
-/* nodiscard is not yet implemented, but is a standard attribute, so
- its use is not a constraint violation and should only receive a
- warning. */
-[[nodiscard]] int ndfunc (void); /* { dg-warning "attribute directive ignored" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-bool-1.c b/gcc/testsuite/gcc.dg/c2x-bool-1.c
new file mode 100644
index 0000000..b64da1f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-bool-1.c
@@ -0,0 +1,50 @@
+/* Test macro expansions in <stdbool.h> in C2x. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stdbool.h>
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+#if false - 1 < 0
+#error "false signed in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 < 0
+#error "true signed in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+int
+main (void)
+{
+ if (strcmp (str (bool), "_Bool") != 0)
+ abort ();
+ if (_Generic (true, _Bool : 1) != 1)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (strcmp (str (true), "((_Bool)+1u)") != 0)
+ abort ();
+ if (_Generic (false, _Bool : 1) != 1)
+ abort ();
+ if (false != 0)
+ abort ();
+ if (strcmp (str (false), "((_Bool)+0u)") != 0)
+ abort ();
+ if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-labels-1.c b/gcc/testsuite/gcc.dg/c2x-labels-1.c
new file mode 100644
index 0000000..439cf78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-labels-1.c
@@ -0,0 +1,23 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x;
+ aa: int u = 0; int v = 0;
+ goto c;
+ b: goto a;
+ { i *= 3; c: }
+ return i + u + v;
+ d:
+}
+
+int main(void)
+{
+ if (2 != f(1))
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-labels-2.c b/gcc/testsuite/gcc.dg/c2x-labels-2.c
new file mode 100644
index 0000000..bd010e9e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-labels-2.c
@@ -0,0 +1,15 @@
+/* Tests for labels before declarations and at ends of compound statements. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wc11-c2x-compat" } */
+
+int f(int x)
+{
+ goto b;
+ a: int i = 2 * x; /* { dg-warning "a label can only be part of a statement and a declaration is not a statement" } */
+ goto c;
+ b: goto a;
+ { i *= 3; c: } /* { dg-warning "label at end of compound statement" } */
+ return i;
+ d: /* { dg-warning "label at end of compound statement" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/c2x-labels-3.c b/gcc/testsuite/gcc.dg/c2x-labels-3.c
new file mode 100644
index 0000000..159116d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-labels-3.c
@@ -0,0 +1,38 @@
+/* Tests for labels before declarations and at ends of compound statements
+ * in combination with attributes. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -Wall" } */
+
+int f(void)
+{
+ goto b;
+ a: int i = 0;
+ aa: __attribute__((unused)) int u = 0; int v = 0; /* { dg-warning "GNU-style attribute between label and declaration appertains to the label" } */
+ goto c;
+ { c: }
+ b: goto a;
+ return i + u + v;
+ d: __attribute__((unused)) (void)0;
+ e: __attribute__((unused))
+}
+
+int g(void)
+{
+ goto b;
+ a: int i = 0;
+ [[maybe_unused]] aa: int u = 0; int v = 0;
+ goto c;
+ { c: }
+ b: goto a;
+ return i + u + v;
+ [[maybe_unused]] d: (void)0;
+ [[maybe_unused]] e:
+}
+
+void h(void)
+{
+ [[maybe_unused]] a: [[maybe_unused]] b: [[maybe_unused]] int x;
+
+ if (1)
+ [[maybe_unused]] c: [[maybe_unused]] d: (void)0;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-1.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-1.c
new file mode 100644
index 0000000..0dc89bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-1.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names in C2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+void f (int) { }
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-2.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-2.c
new file mode 100644
index 0000000..7d68933
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-2.c
@@ -0,0 +1,10 @@
+/* Test omitted parameter names in C2x. Warning test: there should be
+ no warning for an unnamed parameter being unused. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wall -Wextra" } */
+
+int
+f (int a, int, int c, int d) /* { dg-warning "unused parameter 'd'" } */
+{
+ return a + c;
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-3.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-3.c
new file mode 100644
index 0000000..dac258b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-3.c
@@ -0,0 +1,23 @@
+/* Test omitted parameter names in C2x. Execution test. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+extern void abort (void);
+extern void exit (int);
+
+void
+f (int a, int [++a], int b)
+{
+ /* Verify array size expression of unnamed parameter is processed as
+ expected. */
+ if (a != 2 || b != 3)
+ abort ();
+}
+
+int
+main (void)
+{
+ int t[2];
+ f (1, t, 3);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-parm-omit-4.c b/gcc/testsuite/gcc.dg/c2x-parm-omit-4.c
new file mode 100644
index 0000000..a4b0deb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-parm-omit-4.c
@@ -0,0 +1,5 @@
+/* Test omitted parameter names in C2x: diagnosed with -Wc11-c2x-compat. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" } */
+
+void f (int) { } /* { dg-warning "omitting parameter names" } */
diff --git a/gcc/testsuite/gcc.dg/c99-bool-4.c b/gcc/testsuite/gcc.dg/c99-bool-4.c
new file mode 100644
index 0000000..5cae18a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-bool-4.c
@@ -0,0 +1,46 @@
+/* Test macro expansions in <stdbool.h> in C99. */
+/* { dg-do run } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+
+#include <stdbool.h>
+
+#define str(x) xstr(x)
+#define xstr(x) #x
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+#if false - 1 >= 0
+#error "false unsigned in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 >= 0
+#error "true unsigned in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+int
+main (void)
+{
+ if (strcmp (str (bool), "_Bool") != 0)
+ abort ();
+ if (true != 1)
+ abort ();
+ if (strcmp (str (true), "1") != 0)
+ abort ();
+ if (false != 0)
+ abort ();
+ if (strcmp (str (false), "0") != 0)
+ abort ();
+ if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/darwin-minversion-link.c b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
index 0a80048..765fb79 100644
--- a/gcc/testsuite/gcc.dg/darwin-minversion-link.c
+++ b/gcc/testsuite/gcc.dg/darwin-minversion-link.c
@@ -13,8 +13,9 @@
/* { dg-additional-options "-mmacosx-version-min=010.011.06 -DCHECK=101106" { target *-*-darwin15* } } */
/* { dg-additional-options "-mmacosx-version-min=010.012.06 -DCHECK=101206" { target *-*-darwin16* } } */
/* { dg-additional-options "-mmacosx-version-min=010.013.06 -DCHECK=101306" { target *-*-darwin17* } } */
-/* This next test covers 10.18 and (currently unreleased) 10.19 for now. */
-/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin1[89]* } } */
+/* { dg-additional-options "-mmacosx-version-min=010.014.05 -DCHECK=101405" { target *-*-darwin18* } } */
+/* { dg-additional-options "-mmacosx-version-min=010.015.06 -DCHECK=101506" { target *-*-darwin19* } } */
+/* { dg-additional-options "-mmacosx-version-min=011.000.00 -DCHECK=110000" { target *-*-darwin20 } } */
int
main ()
diff --git a/gcc/testsuite/gcc.dg/decl-9.c b/gcc/testsuite/gcc.dg/decl-9.c
index eeca8e0..9bb1560 100644
--- a/gcc/testsuite/gcc.dg/decl-9.c
+++ b/gcc/testsuite/gcc.dg/decl-9.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-std=gnu89" } */
+/* { dg-options "-std=gnu89 -pedantic-errors" } */
w *x; /* { dg-error "unknown type name 'w'" } */
@@ -12,6 +12,7 @@ int f1()
int d, e;
d * e; /* { dg-bogus "unknown type name 'd'" } */
g * h; /* { dg-error "unknown type name 'g'" } */
+ /* { dg-error "mixed declarations" "" { target *-*-* } .-1 } */
g i; /* { dg-error "unknown type name 'g'" } */
}
diff --git a/gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c b/gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c
new file mode 100644
index 0000000..49a32c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/builtin-snan-1.c
@@ -0,0 +1,23 @@
+/* Test __builtin_nansd* functions. Test not requiring runtime
+ exceptions support. */
+/* { dg-do run } */
+/* { dg-options "" } */
+
+volatile _Decimal32 d32 = __builtin_nansd32 ("");
+volatile _Decimal64 d64 = __builtin_nansd64 ("");
+volatile _Decimal128 d128 = __builtin_nansd128 ("");
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ if (!__builtin_isnan (d32))
+ abort ();
+ if (!__builtin_isnan (d64))
+ abort ();
+ if (!__builtin_isnan (d128))
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c b/gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c
new file mode 100644
index 0000000..248481b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/builtin-snan-2.c
@@ -0,0 +1,44 @@
+/* Test __builtin_nansd* functions. Test requiring runtime exceptions
+ support. */
+/* { dg-do run } */
+/* { dg-require-effective-target fenv_exceptions_dfp } */
+/* { dg-options "" } */
+
+#include <fenv.h>
+
+volatile _Decimal32 d32 = __builtin_nansd32 ("");
+volatile _Decimal64 d64 = __builtin_nansd64 ("");
+volatile _Decimal128 d128 = __builtin_nansd128 ("");
+
+extern void abort (void);
+extern void exit (int);
+
+int
+main (void)
+{
+ feclearexcept (FE_ALL_EXCEPT);
+ d32 += d32;
+ if (!fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d32 += d32;
+ if (fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d64 += d64;
+ if (!fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d64 += d64;
+ if (fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d128 += d128;
+ if (!fetestexcept (FE_INVALID))
+ abort ();
+ feclearexcept (FE_ALL_EXCEPT);
+ d128 += d128;
+ if (fetestexcept (FE_INVALID))
+ abort ();
+ exit (0);
+}
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/barrier-2.c b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
index 5a70919..c0d62f5 100644
--- a/gcc/testsuite/gcc.dg/gomp/barrier-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/barrier-2.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-options "-Wall -std=c17 -fopenmp -pedantic-errors" } */
void f1(void)
{
@@ -16,6 +17,7 @@ void f1(void)
void f2(void)
{
label: /* { dg-error "label at end of compound statement" } */
+ /* { dg-warning "defined but not used" "" { target *-*-* } .-1 } */
#pragma omp barrier /* { dg-error "may only be used in compound statements" } */
}
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c b/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
index fe23652..b9a4161 100644
--- a/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
+++ b/gcc/testsuite/gcc.dg/gomp/declare-simd-5.c
@@ -1,5 +1,6 @@
/* Test parsing of #pragma omp declare simd */
/* { dg-do compile } */
+/* { dg-options "-std=c17 -fopenmp -pedantic-errors" } */
int
f1 (int x)
@@ -14,7 +15,7 @@ f1 (int x)
lab:
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
- x++; /* { dg-error "expected expression before" "" { target *-*-* } .-1 } */
+ x++; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "" { target *-*-* } .-1 } */
}
return x;
}
diff --git a/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c b/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
index 701d83b..39c2c1d 100644
--- a/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
+++ b/gcc/testsuite/gcc.dg/gomp/declare-variant-2.c
@@ -1,5 +1,6 @@
/* Test parsing of #pragma omp declare variant */
/* { dg-do compile } */
+/* { dg-options "-std=c17 -fopenmp -pedantic-errors" } */
int f0 (int, int *, int);
@@ -16,7 +17,7 @@ f1 (int x)
lab:
#pragma omp declare variant (fn0) match (user={condition(0)})
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
- x++; /* { dg-error "expected expression before" "" { target *-*-* } .-1 } */
+ x++; /* { dg-error "a label can only be part of a statement and a declaration is not a statement" "" { target *-*-* } .-1 } */
}
return x;
}
diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp
index 89cd896..ba87132 100644
--- a/gcc/testsuite/gcc.dg/guality/guality.exp
+++ b/gcc/testsuite/gcc.dg/guality/guality.exp
@@ -38,7 +38,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
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/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/modref-2.c b/gcc/testsuite/gcc.dg/ipa/modref-2.c
new file mode 100644
index 0000000..5ac2c65
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/modref-2.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O2 -fdump-ipa-modref" } */
+/* { dg-do compile } */
+void
+test (int *a, int size)
+{
+ __builtin_memset (a, 0, 321);
+}
+void
+test2 (double x, double *y)
+{
+ __builtin_modf (x,y);
+}
+/* 321*8 */
+/* { dg-final { scan-ipa-dump "Parm 0 param offset:0 offset:0 size:-1 max_size:2568" "modref" } } */
+/* { dg-final { scan-ipa-dump "Parm 1 param offset:0 offset:0 size:-1 max_size:64" "modref" } } */
diff --git a/gcc/testsuite/gcc.dg/label-compound-stmt-1.c b/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
index 2f8fa4e..2ae2b82 100644
--- a/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
+++ b/gcc/testsuite/gcc.dg/label-compound-stmt-1.c
@@ -1,7 +1,7 @@
/* Test that labels at ends of compound statements are hard errors. */
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
/* { dg-do compile } */
-/* { dg-options "" } */
+/* { dg-options "-std=c17 -pedantic-errors" } */
void f(void) { g: } /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "label|parse|syntax" "label at end of compound statement" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/lto/modref-2_0.c b/gcc/testsuite/gcc.dg/lto/modref-2_0.c
new file mode 100644
index 0000000..cf84ed9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/modref-2_0.c
@@ -0,0 +1,27 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options {"-O2 -flto-partition=max -flto -fno-ipa-sra"} } */
+__attribute__ ((noinline))
+void
+test (char *a)
+{
+ __builtin_memset (a,0,321);
+}
+__attribute__ ((noinline))
+void
+test2 (double *x, double *y)
+{
+ __builtin_modf (*x,y);
+}
+int
+main (void)
+{
+ char array[321];
+ double x=1, y=2;
+ char arrayz[321];
+ arrayz[0]=1;
+ test (array);
+ test2 (&x,&y);
+ if (!__builtin_constant_p (x==2) || !__builtin_constant_p (arrayz[0]==1))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/no-strict-overflow-4.c b/gcc/testsuite/gcc.dg/no-strict-overflow-4.c
index b6d3da3..90145ff9 100644
--- a/gcc/testsuite/gcc.dg/no-strict-overflow-4.c
+++ b/gcc/testsuite/gcc.dg/no-strict-overflow-4.c
@@ -4,7 +4,8 @@
/* Source: Ian Lance Taylor. Dual of strict-overflow-4.c. */
/* We can only simplify the conditional when using strict overflow
- semantics. */
+ semantics or when using wrap overflow semantics. -fno-strict-overflow is
+ equivalent to -fwrapv. */
int
foo (int i)
@@ -12,4 +13,4 @@ foo (int i)
return i + 1 > i;
}
-/* { dg-final { scan-tree-dump "\[^ \]*_.(\\\(D\\\))? (>|<) \[^ \]*_." "optimized" } } */
+/* { dg-final { scan-tree-dump "\[^ \]*_.(\\\(D\\\))? != \[0-9]+" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr79758.c b/gcc/testsuite/gcc.dg/noncompile/pr79758.c
index aeaf7c7..a312160 100644
--- a/gcc/testsuite/gcc.dg/noncompile/pr79758.c
+++ b/gcc/testsuite/gcc.dg/noncompile/pr79758.c
@@ -1,6 +1,6 @@
/* PR c/79758 */
/* { dg-do compile } */
-void fn1 (int[a]) { }; /* { dg-error "undeclared here|parameter name omitted" } */
+void fn1 (int[a]) { }; /* { dg-error "undeclared here" } */
void fn1 (b) { }; /* { dg-error "redefinition" } */
/* { dg-warning "defaults to 'int'" "" { target *-*-* } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/parse-decl-after-label.c b/gcc/testsuite/gcc.dg/parse-decl-after-label.c
index 9c9886a..6e2a047e 100644
--- a/gcc/testsuite/gcc.dg/parse-decl-after-label.c
+++ b/gcc/testsuite/gcc.dg/parse-decl-after-label.c
@@ -1,6 +1,6 @@
/* PR 29062
{ dg-do compile }
-{ dg-options "-fsyntax-only" }
+{ dg-options "-std=c17 -pedantic-errors -fsyntax-only" }
*/
int f(int x)
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/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.target/riscv/pr91441.c b/gcc/testsuite/gcc.dg/pr91441.c
index b55df5e..4f7a8fb 100644
--- a/gcc/testsuite/gcc.target/riscv/pr91441.c
+++ b/gcc/testsuite/gcc.dg/pr91441.c
@@ -1,5 +1,6 @@
/* PR target/91441 */
/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
/* { dg-options "--param asan-stack=1 -fsanitize=kernel-address" } */
int *bar(int *);
diff --git a/gcc/testsuite/gcc.target/riscv/pr96260.c b/gcc/testsuite/gcc.dg/pr96260.c
index 229997f..734832f 100644
--- a/gcc/testsuite/gcc.target/riscv/pr96260.c
+++ b/gcc/testsuite/gcc.dg/pr96260.c
@@ -1,5 +1,6 @@
/* PR target/96260 */
/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
/* { dg-options "--param asan-stack=1 -fsanitize=kernel-address -fasan-shadow-offset=0x100000" } */
int *bar(int *);
diff --git a/gcc/testsuite/gcc.dg/pr96307.c b/gcc/testsuite/gcc.dg/pr96307.c
new file mode 100644
index 0000000..cd1c17c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96307.c
@@ -0,0 +1,25 @@
+/* PR target/96307 */
+/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
+/* { dg-additional-options "-fsanitize=kernel-address --param=asan-instrumentation-with-call-threshold=8" } */
+
+#include <limits.h>
+enum a {test1, test2, test3=INT_MAX};
+enum a a;
+enum a *b;
+
+void reset (void);
+
+void
+t()
+{
+ if (a != test2)
+ __builtin_abort ();
+ if (*b != test2)
+ __builtin_abort ();
+ reset ();
+ if (a != test1)
+ __builtin_abort ();
+ if (*b != test1)
+ __builtin_abort ();
+}
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/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/pr97505.c b/gcc/testsuite/gcc.dg/pr97505.c
new file mode 100644
index 0000000..f01d912
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97505.c
@@ -0,0 +1,23 @@
+// { dg-do compile }
+// { dg-options "-Os -fsanitize=signed-integer-overflow -fdump-tree-evrp" }
+
+// Test that .UBSAN_CHECK_SUB(y, x) is treated as y-x for range
+// purposes, where X and Y are related to each other.
+//
+// This effectively checks that range relationals work with builtins.
+
+void unreachable();
+
+int foobar(int x, int y)
+{
+ if (x < y)
+ {
+ int z = y - x;
+ if (z == 0)
+ unreachable();
+ return z;
+ }
+ return 5;
+}
+
+// { dg-final { scan-tree-dump-not "unreachable" "evrp" } }
diff --git a/gcc/testsuite/gcc.dg/pr97515.c b/gcc/testsuite/gcc.dg/pr97515.c
new file mode 100644
index 0000000..84f145a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97515.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+int
+e7 (int gg)
+{
+ int xe = 0;
+
+ while (xe < 1)
+ {
+ int ui;
+
+ ui = ~xe;
+ if (ui == 0)
+ ui = xe >> gg;
+
+ xe %= !ui;
+ }
+
+ return xe;
+}
+
+/* EVRP should be able to reduce this to a single goto. */
+
+/* { dg-final { scan-tree-dump-times "goto" 1 "evrp" } } */
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/pr97539.c b/gcc/testsuite/gcc.dg/pr97539.c
new file mode 100644
index 0000000..def55e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97539.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -g" } */
+
+int a, b;
+void c() {
+ char d;
+ for (; b;)
+ for (;;)
+ for (; d <= 7; d += 1) {
+ a = 7;
+ for (; a; a += 1)
+ e:
+ d += d;
+ d ^= 0;
+ }
+ goto e;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97555.c b/gcc/testsuite/gcc.dg/pr97555.c
new file mode 100644
index 0000000..625bc6f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97555.c
@@ -0,0 +1,22 @@
+// { dg-do run }
+// { dg-options "-Os" }
+
+struct {
+ int a:1;
+} b;
+
+int c, d, e, f = 1, g;
+
+int main ()
+{
+ for (; d < 3; d++) {
+ char h = 1 % f, i = ~(0 || ~0);
+ c = h;
+ f = ~b.a;
+ ~b.a | 1 ^ ~i && g;
+ if (~e)
+ i = b.a;
+ b.a = i;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97567-2.c b/gcc/testsuite/gcc.dg/pr97567-2.c
new file mode 100644
index 0000000..dee31c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97567-2.c
@@ -0,0 +1,24 @@
+/* { dg-do compile} */
+/* { dg-options "-O2 -fdump-tree-evrp" } */
+
+char a[2];
+
+extern int x;
+
+void foo(void);
+
+signed char g (signed char min, signed char max)
+{
+ signed char i = x;
+ return i < min || max < i ? min : i;
+}
+
+void gg (void)
+{
+ signed char t = g (0, 9);
+ /* Ranger should be able to remove the call to foo (). */
+ if (t > 9 || t < 0)
+ foo ();
+}
+
+/* { dg-final { scan-tree-dump-not "foo" "evrp" } } */
diff --git a/gcc/testsuite/gcc.dg/pr97567.c b/gcc/testsuite/gcc.dg/pr97567.c
new file mode 100644
index 0000000..8922f27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97567.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int a, b, c, d;
+void k() {
+ unsigned f = 1;
+ long long g = 4073709551615;
+ for (; a; a++)
+ for (;;) {
+ d = 0;
+ L1:
+ break;
+ }
+ if (f)
+ for (; a; a++)
+ ;
+ g || f;
+ int i = 0 - f || g;
+ long long j = g - f;
+ if (j || f) {
+ if (g < 4073709551615)
+ for (;;)
+ ;
+ int e = ~f, h = b / ~e;
+ if (c)
+ goto L2;
+ g = f = h;
+ }
+ g || d;
+L2:
+ if (c)
+ goto L1;
+}
+int main() { k(); return 0; }
diff --git a/gcc/testsuite/gcc.dg/pr97596.c b/gcc/testsuite/gcc.dg/pr97596.c
new file mode 100644
index 0000000..b0726ad
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97596.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2" } */
+
+void
+q8 (__int128 *uv, unsigned short int nf)
+{
+ __int128 i4;
+
+ i4 = -nf;
+ if (i4 << 1 != 0)
+ *uv += nf;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97721.c b/gcc/testsuite/gcc.dg/pr97721.c
new file mode 100644
index 0000000..c2a2848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97721.c
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-options "-O -fno-tree-dominator-opts" }
+
+int ot;
+
+void
+z6 (char *tw)
+{
+ while (ot >= 0)
+ --ot;
+
+ __builtin_strcpy (&tw[ot], tw);
+}
diff --git a/gcc/testsuite/gcc.dg/pr97725.c b/gcc/testsuite/gcc.dg/pr97725.c
new file mode 100644
index 0000000..2fcb12c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97725.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a;
+unsigned b;
+
+int main() {
+ if (a) {
+ goto L1;
+ while (1)
+ while (1) {
+ long e = -1L, g;
+ int f, h, i;
+ L1:
+ a = f;
+ L2:
+ g = e;
+ f = h || g;
+ e = ~(f & b);
+ if (i || g < -1L) {
+ ~(g || 0);
+ break;
+ }
+ goto L2;
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97737.c b/gcc/testsuite/gcc.dg/pr97737.c
new file mode 100644
index 0000000..eef1c35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97737.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int a = 1, b, c;
+
+void d() {
+ int e = 1;
+L1:
+ b = e;
+L2:
+ e = e / a;
+ if (!(e || c || e - 1))
+ goto L1;
+ if (!b)
+ goto L2;
+}
diff --git a/gcc/testsuite/gcc.dg/pr97741.c b/gcc/testsuite/gcc.dg/pr97741.c
new file mode 100644
index 0000000..47115d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97741.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wextra -fno-strict-aliasing -fwrapv -Os -fno-toplevel-reorder -fno-tree-ccp -fno-tree-fre" } */
+
+short a = 0;
+long b = 0;
+char c = 0;
+void d() {
+ int e = 0;
+f:
+ for (a = 6; a;)
+ c = e;
+ e = 0;
+ for (; e == 20; ++e)
+ for (; b;)
+ goto f;
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/gcc.dg/pragma-diag-6.c b/gcc/testsuite/gcc.dg/pragma-diag-6.c
index 0dca1dc..f2df88d 100644
--- a/gcc/testsuite/gcc.dg/pragma-diag-6.c
+++ b/gcc/testsuite/gcc.dg/pragma-diag-6.c
@@ -2,7 +2,10 @@
#pragma GCC diagnostic error "-Wnoexcept" /* { dg-warning "is valid for C../ObjC.. but not for C" } */
#pragma GCC diagnostic error "-fstrict-aliasing" /* { dg-warning "not an option that controls warnings" } */
#pragma GCC diagnostic error "-Werror" /* { dg-warning "not an option that controls warnings" } */
-#pragma GCC diagnostic error "-Wvla2" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind; did you mean '-Wvla'" } */
-#pragma GCC diagnostic error "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind; did you mean '-Wall'" } */
-#pragma GCC diagnostic warning "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind; did you mean '-Wall'" } */
+#pragma GCC diagnostic error "-Wvla2" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind" } */
+/* { dg-message "did you mean '-Wvla'" "" { target *-*-* } .-1 } */
+#pragma GCC diagnostic error "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind" } */
+/* { dg-message "did you mean '-Wall'" "" { target *-*-* } .-1 } */
+#pragma GCC diagnostic warning "-Walla" /* { dg-warning "unknown option after '#pragma GCC diagnostic' kind" } */
+/* { dg-message "did you mean '-Wall'" "" { target *-*-* } .-1 } */
int i;
diff --git a/gcc/testsuite/gcc.dg/self-right-shift.c b/gcc/testsuite/gcc.dg/self-right-shift.c
new file mode 100644
index 0000000..c457ee5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/self-right-shift.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+/* Self right-shift should be optimized to 0. */
+
+int
+foo (int i)
+{
+ return i >> i;
+}
+
+/* { dg-final { scan-tree-dump "return 0;" "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/sin_cos.c b/gcc/testsuite/gcc.dg/sin_cos.c
new file mode 100644
index 0000000..aa71dca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sin_cos.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+/* This maps to essentially the same gimple that is generated for
+ gnat.dg/sin_cos.adb, on platforms that use the wraplf variant of
+ Ada.Numerics.Aux_Float. The value of EPSILON is not relevant to
+ the test, but the test must be there to keep the conversions in
+ different BBs long enough to trigger the problem that prevented the
+ sincos optimization, because the arguments passed to sin and cos
+ didn't get unified into a single SSA_NAME in time for sincos. */
+
+#include <math.h>
+
+#define EPSILON 3.4526697709225118160247802734375e-4
+
+static float my_sinf(float x) {
+ return (float) sin ((double) x);
+}
+
+static float wrap_sinf(float x) {
+ if (fabs (x) < EPSILON)
+ return 0;
+ return my_sinf (x);
+}
+
+static float my_cosf(float x) {
+ return (float) cos ((double) x);
+}
+
+static float wrap_cosf(float x) {
+ if (fabs (x) < EPSILON)
+ return 1;
+ return my_cosf (x);
+}
+
+float my_sin_cos(float x, float *s, float *c) {
+ *s = wrap_sinf (x);
+ *c = wrap_cosf (x);
+}
+
+/* { dg-final { scan-assembler "sincos\|cexp" { target *-linux-gnu* *-w64-mingw* *-*-vxworks* } } } */
diff --git a/gcc/testsuite/gcc.dg/sms-12.c b/gcc/testsuite/gcc.dg/sms-12.c
index aef32ee..3ec50f2 100644
--- a/gcc/testsuite/gcc.dg/sms-12.c
+++ b/gcc/testsuite/gcc.dg/sms-12.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-skip-if "" { ! { aarch64*-*-* } } } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves -fPIC" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr97461.c b/gcc/testsuite/gcc.dg/tree-prof/pr97461.c
new file mode 100644
index 0000000..213fac9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr97461.c
@@ -0,0 +1,64 @@
+/* PR gcov-profile/97461 */
+/* { dg-options "-O2 -ldl" } */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int malloc_depth = 0;
+
+static char memory[128* 1024];
+static size_t memory_p = 0;
+
+void f1(void) {}
+void f2(void) {}
+
+typedef void (*fun_t)(void);
+static const fun_t funs[2] = { f1, f2, };
+
+static void * malloc_impl(size_t size) {
+ void * r = &memory[memory_p];
+ /* The malloc() and calloc() functions return a pointer to the allocated
+ * memory, which is suitably aligned for any built-in type. Use 16
+ * bytes here as the basic alignment requirement for user-defined malloc
+ * and calloc. See PR97594 for the details. */
+ #define ROUND_UP_FOR_16B_ALIGNMENT(x) ((x + 15) & (-16))
+
+ memory_p += ROUND_UP_FOR_16B_ALIGNMENT(size);
+
+ // force TOPN profile
+ funs[size % 2]();
+ return r;
+}
+
+// Override default malloc, check it it get s called recursively
+void * malloc(size_t size) {
+ // Must not be called recursively. Malloc implementation does not support it.
+ if (malloc_depth != 0) __builtin_trap();
+
+ ++malloc_depth;
+ void * r = malloc_impl(size);
+ --malloc_depth;
+ return r;
+}
+
+// Called from gcov
+void *calloc(size_t nmemb, size_t size) {
+ // Must not be called recursively. Malloc implementation does not support it.
+ if (malloc_depth != 0) __builtin_trap();
+
+ ++malloc_depth;
+ void * r = malloc_impl(size * nmemb);
+ memset(r, 0, size * nmemb);
+ --malloc_depth;
+ return r;
+}
+
+void free(void *ptr){}
+
+int main() {
+ void * p = malloc(8);
+ return p != 0 ? 0 : 1;
+}
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/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/phi-opt-22.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
new file mode 100644
index 0000000..fd37066
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
@@ -0,0 +1,11 @@
+/* PR tree-optimization/97690 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-phiopt2" } */
+
+int foo (_Bool d) { return d ? 2 : 0; }
+int bar (_Bool d) { return d ? 1 : 0; }
+int baz (_Bool d) { return d ? -__INT_MAX__ - 1 : 0; }
+int qux (_Bool d) { return d ? 1024 : 0; }
+
+/* { dg-final { scan-tree-dump-not "if" "phiopt2" } } */
+/* { dg-final { scan-tree-dump-times " << " 3 "phiopt2" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c
index 4753740..259055f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71077.c
@@ -1,5 +1,6 @@
/* PR c++/71077 */
/* { dg-do link { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-require-effective-target lto } */
/* { dg-options "-O3 -flto -march=core-avx2" } */
int *a;
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/pr96789.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
new file mode 100644
index 0000000..d6139a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96789.c
@@ -0,0 +1,58 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -funroll-loops -ftree-vectorize -fdump-tree-dse-details" } */
+
+/* Test if scalar cleanup pass takes effects, mainly check
+ its secondary pass DSE can remove dead stores on array
+ tmp. */
+
+#include "stdint.h"
+
+static inline void
+foo (int16_t *diff, int i_size, uint8_t *val1, int i_val1, uint8_t *val2,
+ int i_val2)
+{
+ for (int y = 0; y < i_size; y++)
+ {
+ for (int x = 0; x < i_size; x++)
+ diff[x + y * i_size] = val1[x] - val2[x];
+ val1 += i_val1;
+ val2 += i_val2;
+ }
+}
+
+void
+bar (int16_t res[16], uint8_t *val1, uint8_t *val2)
+{
+ int16_t d[16];
+ int16_t tmp[16];
+
+ foo (d, 4, val1, 16, val2, 32);
+
+ for (int i = 0; i < 4; i++)
+ {
+ int s03 = d[i * 4 + 0] + d[i * 4 + 3];
+ int s12 = d[i * 4 + 1] + d[i * 4 + 2];
+ int d03 = d[i * 4 + 0] - d[i * 4 + 3];
+ int d12 = d[i * 4 + 1] - d[i * 4 + 2];
+
+ tmp[0 * 4 + i] = s03 + s12;
+ tmp[1 * 4 + i] = 2 * d03 + d12;
+ tmp[2 * 4 + i] = s03 - s12;
+ tmp[3 * 4 + i] = d03 - 2 * d12;
+ }
+
+ for (int i = 0; i < 4; i++)
+ {
+ int s03 = tmp[i * 4 + 0] + tmp[i * 4 + 3];
+ int s12 = tmp[i * 4 + 1] + tmp[i * 4 + 2];
+ int d03 = tmp[i * 4 + 0] - tmp[i * 4 + 3];
+ int d12 = tmp[i * 4 + 1] - tmp[i * 4 + 2];
+
+ res[i * 4 + 0] = s03 + s12;
+ res[i * 4 + 1] = 2 * d03 + d12;
+ res[i * 4 + 2] = s03 - s12;
+ res[i * 4 + 3] = d03 - 2 * d12;
+ }
+}
+
+/* { dg-final { scan-tree-dump {Deleted dead store:.*tmp} "dse3" } } */
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-ccp-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
index 36b8e7f..d70ea5a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-11.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
/* Test for CPROP across a DAG. */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
index d3a1bbc..b81cabe 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
@@ -17,5 +17,5 @@ int foo (int *p, int b)
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse1"} } */
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */
-/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
index 31529e7..f4ef89c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-29.c
@@ -22,5 +22,5 @@ foo(int cond, struct z *s)
/* { dg-final { scan-tree-dump-times "Deleted dead store" 3 "dse1"} } */
/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse2"} } */
-/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse3"} } */
+/* { dg-final { scan-tree-dump-not "Deleted dead store" "dse4"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c
new file mode 100644
index 0000000..ce9cec6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-hoist-7.c
@@ -0,0 +1,54 @@
+/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+
+void baz();
+int tem;
+void foo (int a, int b, int c, int d, int e, int x, int y, int z)
+{
+ if (a)
+ {
+ if (b)
+ {
+ if (c)
+ {
+ if (d)
+ {
+ if (e)
+ {
+ tem = x + y;
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+ }
+ else
+ {
+ if (z) baz ();
+ tem = x + y;
+ }
+}
+
+/* Now inserting x + y five times is unnecessary but the cascading
+ cannot be avoided with the simple-minded dataflow. But make sure
+ we do the insertions all in the first iteration. */
+/* { dg-final { scan-tree-dump "insert iterations == 2" "pre" } } */
+/* { dg-final { scan-tree-dump "HOIST inserted: 5" "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/switch-4.c b/gcc/testsuite/gcc.dg/tree-ssa/switch-4.c
new file mode 100644
index 0000000..5953ef3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/switch-4.c
@@ -0,0 +1,25 @@
+/* { dg-do compile { target { { x86_64-*-* aarch64-*-* ia64-*-* powerpc64-*-* } && lp64 } } } */
+/* { dg-options "-O2 -fno-bit-tests -fdump-tree-switchlower1" } */
+
+int global;
+
+int foo (int x)
+{
+ switch (x) {
+ case 0:
+ case 10:
+ return 1;
+ case 20:
+ case 30:
+ case 62:
+ return 2;
+ case 1000:
+ case 1010:
+ case 1025 ... 1030:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "BT:" "switchlower1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-41.c b/gcc/testsuite/gcc.dg/vect/bb-slp-41.c
index 7de5ed1..7224511 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-41.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-41.c
@@ -10,7 +10,10 @@ foo (int *a, int *b)
a[i] = b[0] + b[1] + b[i+1] + b[i+2];
}
-void bar (int *a, int *b)
+/* Disable pre-slp FRE to avoid unexpected SLP on the epilogue
+ of the 1st loop. */
+void __attribute__((optimize("-fno-tree-fre")))
+bar (int *a, int *b)
{
int i;
for (i = 0; i < (ARR_SIZE - 2); ++i)
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-54.c b/gcc/testsuite/gcc.dg/vect/bb-slp-54.c
new file mode 100644
index 0000000..d05ce33
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-54.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double a[2], b[2], c[2];
+
+void foo(int flag)
+{
+ double tem1, tem2;
+ if (flag)
+ {
+ tem1 = a[0];
+ tem2 = a[1];
+ }
+ else
+ {
+ tem1 = b[0];
+ tem2 = b[1];
+ }
+ c[0] = tem1;
+ c[1] = tem2;
+}
+
+/* { dg-final { scan-tree-dump-times "transform load" 2 "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-55.c b/gcc/testsuite/gcc.dg/vect/bb-slp-55.c
new file mode 100644
index 0000000..57a042b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-55.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+typedef struct {
+ int a;
+ int b;
+ int c;
+ int d;
+} e;
+e *f;
+int g;
+void h() {
+ e *i;
+ if (g) {
+ i->c = f[g].b;
+ i->d = f[g].a;
+ } else
+ i->c = i->d = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-56.c b/gcc/testsuite/gcc.dg/vect/bb-slp-56.c
new file mode 100644
index 0000000..90d1751
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-56.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+typedef struct {
+ double a, b;
+} c;
+int d, e;
+int i(void);
+void h(c, c);
+void f() {
+ c a, g;
+ do {
+ a.a = e ?: g.a;
+ a.b = g.b + d;
+ h(g, a);
+ g = a;
+ } while (i());
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-57.c b/gcc/testsuite/gcc.dg/vect/bb-slp-57.c
new file mode 100644
index 0000000..6f13507
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-57.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math" } */
+/* { dg-require-effective-target vect_float } */
+
+float *a;
+typedef struct {
+ int c;
+ float bbmax[3];
+} d;
+d e;
+int f[3];
+int g, h, i, j;
+float k, k;
+void l()
+{
+ for (unsigned z = 0; z < 2048; ++z) {
+ {
+ j = e.bbmax[1] > k ? e.bbmax[1] : k;
+ }
+ e.bbmax[1] = j;
+ { i = e.bbmax[2] > k ? e.bbmax[2] : k; }
+ e.bbmax[2] = i;
+ f[2] = a[2];
+ {
+ float b;
+ h = e.bbmax[1] > b ? e.bbmax[1] : b;
+ }
+ e.bbmax[1] = h;
+ {
+ float b;
+ g = e.bbmax[2] > b ? e.bbmax[2] : b;
+ }
+ e.bbmax[2] = g;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "transform load" 1 "slp1" { target { { x86_64-*-* i?86-*-* } && lp64 } } } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp1" { target { { x86_64-*-* i?86-*-* } && lp64 } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-58.c b/gcc/testsuite/gcc.dg/vect/bb-slp-58.c
new file mode 100644
index 0000000..5a3d3b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-58.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+
+double x[1024];
+void bar (void);
+
+void foo (void)
+{
+ double tem1 = x[0];
+ double tem2 = x[1];
+ for (int i = 0; i < 511; ++i)
+ {
+ x[2*i] = tem1;
+ x[2*i+1] = tem2;
+ bar ();
+ tem1 = x[2*(i+1)];
+ tem2 = x[2*(i+1)+1];
+ }
+}
+
+/* We should be able to vectorize the cycle in one SLP attempt including
+ both load groups. */
+/* { dg-final { scan-tree-dump-times "transform load" 2 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-59.c b/gcc/testsuite/gcc.dg/vect/bb-slp-59.c
new file mode 100644
index 0000000..815b44e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-59.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+/* { dg-additional-options "-fdump-tree-loopdone" } */
+
+double x[1024];
+void bar (void);
+
+void foo (void)
+{
+ double tem1 = x[0];
+ double tem2 = x[1];
+ for (int i = 0; i < 511; ++i)
+ {
+ x[2*i] = tem2;
+ x[2*i+1] = tem1;
+ bar ();
+ tem1 = x[2*(i+1)];
+ tem2 = x[2*(i+1)+1];
+ }
+}
+
+/* We should be able to vectorize the cycle in one SLP attempt including
+ both load groups and do only one permutation. */
+/* { dg-final { scan-tree-dump-times "transform load" 2 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 1 "loopdone" } } */
+/* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp1" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-60.c b/gcc/testsuite/gcc.dg/vect/bb-slp-60.c
new file mode 100644
index 0000000..52643bf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-60.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+enum { a = 1, b };
+float *c, *e;
+float d, h;
+int f, g;
+void i()
+{
+ float j = h;
+ for (; g;)
+ for (; f; f++)
+ {
+ c[a] = j * d;
+ c[b] = h * d;
+ j = 0;
+ h = e[2];
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-61.c b/gcc/testsuite/gcc.dg/vect/bb-slp-61.c
new file mode 100644
index 0000000..3323a2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-61.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+struct a {
+ enum { b, c } d;
+ unsigned e;
+ unsigned f;
+};
+void j(struct a *a, int i, int h)
+{
+ unsigned f = a->f;
+ switch (a->d)
+ while (1)
+ {
+ if (i)
+ {
+ case b:
+ if (h)
+ goto k;
+ }
+ else
+ f = 0;
+ case c:;
+ }
+k:
+ a->e = a->f = f;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-62.c b/gcc/testsuite/gcc.dg/vect/bb-slp-62.c
new file mode 100644
index 0000000..84ee04c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-62.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+typedef struct {
+ char a;
+ int b[];
+} c;
+int d, f;
+c e;
+void g() {
+ int h, i, j;
+ for (; i;)
+ switch (i)
+ case 4: {
+ h = (__UINTPTR_TYPE__)g >= 3;
+ for (; h; h -= 1)
+ if (d)
+ j = f;
+ }
+ for (; i < 3; i++)
+ e.b[i] = j;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-63.c b/gcc/testsuite/gcc.dg/vect/bb-slp-63.c
new file mode 100644
index 0000000..6519c97
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-63.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+struct {
+ unsigned a;
+ unsigned c;
+} d;
+int e, g;
+void h(unsigned b) {
+ unsigned a, c;
+ while (e) {
+ if (b) {
+ ++e;
+ continue;
+ }
+ c = g;
+ if (g)
+ a |= 10;
+ }
+ d.a = a;
+ d.c = c;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-64.c b/gcc/testsuite/gcc.dg/vect/bb-slp-64.c
new file mode 100644
index 0000000..dcb6a14
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-64.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+enum { a, b };
+double *c, *e;
+int d, f;
+void g() {
+ for (;;) {
+ c[a] = c[b] = d * e[b];
+ f = d -= f;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-65.c b/gcc/testsuite/gcc.dg/vect/bb-slp-65.c
new file mode 100644
index 0000000..ec1707b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-65.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */
+
+int *a;
+int b, c, d, e;
+void f() {
+ int g;
+ for (;;)
+ for (; b;)
+ if (d)
+ for (; c;)
+ if (g)
+ e += a[1] = a[2] = e;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-66.c b/gcc/testsuite/gcc.dg/vect/bb-slp-66.c
new file mode 100644
index 0000000..b59a2cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-66.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+typedef struct {
+ double a, b;
+} c;
+typedef struct {
+ c d;
+ long coordinates;
+} e;
+int f;
+c g;
+e h;
+void k(int);
+int n();
+void j() { int i; k(i); }
+void k(int l) {
+ double a;
+ int b;
+ c m[4];
+ long i;
+ for (; l;)
+ do {
+ g.a = b ?: a;
+ m[3] = g;
+ if (f)
+ m[0] = m[1] = m[3];
+ i = 0;
+ for (; i < 4; i++)
+ (&h + i)->d = m[i];
+ } while (n());
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-67.c b/gcc/testsuite/gcc.dg/vect/bb-slp-67.c
new file mode 100644
index 0000000..ff959c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-67.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_float } */
+
+float a[6];
+
+void foo (float x, float y)
+{
+ a[0] = 1.;
+ a[1] = 2.;
+ a[2] = 3.;
+ a[3] = 4.;
+ a[4] = 5.;
+ a[5] = x + y;
+}
+
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-68.c b/gcc/testsuite/gcc.dg/vect/bb-slp-68.c
new file mode 100644
index 0000000..8718031
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-68.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_double } */
+/* { dg-additional-options "-mavx" { target avx } } */
+
+double x[10], y[6], z[4];
+
+void foo ()
+{
+ x[0] = y[0];
+ x[1] = y[1];
+ x[2] = y[2];
+ x[3] = y[3];
+ x[4] = y[4];
+ x[5] = y[5];
+ x[6] = z[0] + 1.;
+ x[7] = z[1] + 1.;
+ x[8] = z[2] + 1.;
+ x[9] = z[3] + 1.;
+}
+
+/* We want to have the store group split into 4, 2, 4 when using 32byte vectors. */
+/* { dg-final { scan-tree-dump-not "from scalars" "slp2" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-69.c b/gcc/testsuite/gcc.dg/vect/bb-slp-69.c
new file mode 100644
index 0000000..ca72a68
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-69.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+_Bool arr[16];
+
+void foo(char *q)
+{
+ char *p = __builtin_assume_aligned (q, 16);
+ _Bool b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15;
+ b0 = p[0] != 0;
+ b1 = p[1] != 0;
+ b2 = p[2] != 0;
+ b3 = p[3] != 0;
+ b4 = p[4] != 0;
+ b5 = p[5] != 0;
+ b6 = p[6] != 0;
+ b7 = p[7] != 0;
+ b8 = p[8] != 0;
+ b9 = p[9] != 0;
+ b10 = p[10] != 0;
+ b11 = p[11] != 0;
+ b12 = p[12] != 0;
+ b13 = p[13] != 0;
+ b14 = p[14] != 0;
+ b15 = p[15] != 0;
+ arr[0] = b0;
+ arr[1] = b1;
+ arr[2] = b2;
+ arr[3] = b3;
+ arr[4] = b4;
+ arr[5] = b5;
+ arr[6] = b6;
+ arr[7] = b7;
+ arr[8] = b8;
+ arr[9] = b9;
+ arr[10] = b10;
+ arr[11] = b11;
+ arr[12] = b12;
+ arr[13] = b13;
+ arr[14] = b14;
+ arr[15] = b15;
+}
+
+/* { dg-final { scan-tree-dump "transform load" "slp2" } } */
+/* { dg-final { scan-tree-dump "optimized: basic block" "slp2" } } */
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 f6b99ea..c50560b 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c
@@ -13,13 +13,13 @@ foo (short * __restrict__ a, int * __restrict__ b, int stride)
for (i = 0; i < N/stride; i++, a += stride, b += stride)
{
a[0] = b[0] ? 1 : 7;
- a[1] = b[1] ? 2 : 0;
+ a[1] = b[1] ? 2 : 7;
a[2] = b[2] ? 3 : 0;
- a[3] = b[3] ? 4 : 0;
+ a[3] = b[3] ? 4 : 7;
a[4] = b[4] ? 5 : 0;
a[5] = b[5] ? 6 : 0;
a[6] = b[6] ? 7 : 0;
- a[7] = b[7] ? 8 : 0;
+ a[7] = b[7] ? 8 : 7;
}
}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
index ea37e4e..5d80f56 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
@@ -60,6 +60,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 "optimized: basic block" 10 "slp1" } } */
-/* We should see the s->phase[dir] operand and only that operand built
+/* We should see the s->phase[dir] operand splatted and no other operand built
from scalars. See PR97334. */
-/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump "Using a splat" "slp1" } } */
+/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 0 "slp1" } } */
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-pr97615.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c
new file mode 100644
index 0000000..b4a8aa2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97615.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+short *a;
+int e, f;
+
+void
+foo (int c, int d)
+{
+ short *a1, *a2, *a3;
+ a1 = a++;
+ *a1 = c;
+ a2 = a++;
+ *a2 = *a1;
+ a3 = a++;
+ *a3 = d;
+}
+
+void
+bar (void)
+{
+ foo (e + f - 2, e + f - 1);
+ foo (e + f - 1, 0);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c
new file mode 100644
index 0000000..943d8a6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97626.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+
+struct {
+ int x;
+ int y;
+} do_plasma_rect;
+
+int do_plasma_context_0, do_plasma_x2, do_plasma_y2, do_plasma_plasma_depth,
+ do_plasma_xm, do_plasma_ym;
+void gegl_buffer_set();
+
+void do_plasma(int x1, int y1) {
+ if (__builtin_expect(({
+ int _g_boolean_var_;
+ if (do_plasma_context_0)
+ _g_boolean_var_ = 1;
+ else
+ _g_boolean_var_ = 0;
+ _g_boolean_var_;
+ }),
+ 0)) {
+ do_plasma_rect.x = x1;
+ do_plasma_rect.y = y1;
+ gegl_buffer_set();
+ }
+ do_plasma_xm = (x1 + do_plasma_x2) / 2;
+ do_plasma_ym = (y1 + do_plasma_y2) / 2;
+ if (do_plasma_plasma_depth) {
+ do_plasma_rect.x = do_plasma_xm;
+ do_plasma_rect.y = do_plasma_ym;
+ return;
+ }
+ do_plasma(do_plasma_xm, do_plasma_ym);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c
new file mode 100644
index 0000000..ab0ae1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97633.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+extern short i (void);
+
+struct {
+ short a;
+ short b;
+} c;
+
+int d, e;
+static int f = 1;
+
+void g () {
+ if (e) {
+ if (f)
+ goto L;
+ while (d) {
+ i ();
+ short j = d, k = i (), l = k;
+ L:
+ if (!(d && e) || l)
+ goto L;
+ c.a = j;
+ c.b = k;
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c
new file mode 100644
index 0000000..f9c91fb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97650.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Os -fallow-store-data-races" } */
+
+short a=0;
+unsigned long *volatile *volatile *volatile *b;
+unsigned long *volatile *volatile *volatile **c[7];
+void d() {
+ short e=0;
+ for (; a;) {
+ e = 0;
+ for (; e < 7; e++)
+ c[e] = &b;
+ }
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c
new file mode 100644
index 0000000..228ae70
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97706.c
@@ -0,0 +1,61 @@
+/* { dg-do compile } */
+
+_Bool arr[16];
+void bar();
+void foo(int n, char *p)
+{
+ _Bool b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15;
+ do
+ {
+ b0 = p[0] != 0;
+ b1 = p[1] != 0;
+ b2 = p[2] != 0;
+ b3 = p[3] != 0;
+ b4 = p[4] != 0;
+ b5 = p[5] != 0;
+ b6 = p[6] != 0;
+ b7 = p[7] != 0;
+ b8 = p[8] != 0;
+ b9 = p[9] != 0;
+ b10 = p[10] != 0;
+ b11 = p[11] != 0;
+ b12 = p[12] != 0;
+ b13 = p[13] != 0;
+ b14 = p[14] != 0;
+ b15 = p[15] != 0;
+ arr[0] = b0;
+ arr[1] = b1;
+ arr[2] = b2;
+ arr[3] = b3;
+ arr[4] = b4;
+ arr[5] = b5;
+ arr[6] = b6;
+ arr[7] = b7;
+ arr[8] = b8;
+ arr[9] = b9;
+ arr[10] = b10;
+ arr[11] = b11;
+ arr[12] = b12;
+ arr[13] = b13;
+ arr[14] = b14;
+ arr[15] = b15;
+ bar ();
+ }
+ while (--n);
+ arr[0] = b0;
+ arr[1] = b1;
+ arr[2] = b2;
+ arr[3] = b3;
+ arr[4] = b4;
+ arr[5] = b5;
+ arr[6] = b6;
+ arr[7] = b7;
+ arr[8] = b8;
+ arr[9] = b9;
+ arr[10] = b10;
+ arr[11] = b11;
+ arr[12] = b12;
+ arr[13] = b13;
+ arr[14] = b14;
+ arr[15] = b15;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c
new file mode 100644
index 0000000..672807f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+int a;
+struct b {
+ int c;
+ int d;
+};
+void k (struct b);
+struct b
+e()
+{
+ void *f[] = {&&g, &&h, &&i, &&j};
+ int d, c;
+j:
+ goto *a;
+g:
+ d = 0;
+h:
+ c = 1;
+ goto *a;
+i:
+ {
+ struct b b = {c, d};
+ k(b);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c
new file mode 100644
index 0000000..5187090
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97732.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+struct S { int a, b; } *e;
+int d;
+
+void
+foo (struct S *x)
+{
+ for (e = x; d; d++, e++)
+ e->a = e->b = (int) (__UINTPTR_TYPE__) e;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c
new file mode 100644
index 0000000..c5a615d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97746.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+int a, b;
+short c;
+
+extern void f (short*);
+
+void d()
+{
+ short e[2] = {0, 0};
+ while (a)
+ {
+ f(e);
+ int g = 0 || a, h = 8 && c;
+ short i = c;
+ c = h & g;
+ if (b)
+ b = g || i;
+ }
+}
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/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/pr97457.c b/gcc/testsuite/gcc.dg/vect/pr97457.c
new file mode 100644
index 0000000..506ba24
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97457.c
@@ -0,0 +1,15 @@
+/* { dg-additional-options "-O3" } */
+
+int a;
+long c;
+signed char d(char e, char f) { return e + f; }
+int main(void) {
+ for (; a <= 1; a++) {
+ c = -8;
+ for (; c != 3; c = d(c, 1))
+ ;
+ }
+ char b = c;
+ if (b != 3)
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97558-2.c b/gcc/testsuite/gcc.dg/vect/pr97558-2.c
new file mode 100644
index 0000000..8f08086
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97558-2.c
@@ -0,0 +1,54 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O3 -fno-tree-forwprop -fno-tree-scev-cprop" } */
+
+#include "tree-vect.h"
+
+#define N 40
+
+int a[N];
+int b[N];
+
+__attribute__ ((noinline)) int
+foo (int n){
+ int i,j;
+ int sum,x,y;
+
+ if (n<=0)
+ return 0;
+
+ for (i = 0; i < N/2; i++) {
+ sum = 0;
+ x = b[2*i];
+ y = b[2*i+1];
+ for (j = 0; j < n; j++) {
+ sum += j;
+ }
+ a[2*i] = sum + x;
+ a[2*i+1] = sum + y;
+ }
+}
+
+int main (void)
+{
+ int i,j;
+ int sum;
+
+ check_vect ();
+
+ for (i=0; i<N; i++)
+ b[i] = i;
+
+ foo (N-1);
+
+ /* check results: */
+ for (i=0; i<N/2; i++)
+ {
+ sum = 0;
+ for (j = 0; j < N-1; j++)
+ sum += j;
+ if (a[2*i] != sum + b[2*i] || a[2*i+1] != sum + b[2*i+1])
+ abort();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97558.c b/gcc/testsuite/gcc.dg/vect/pr97558.c
new file mode 100644
index 0000000..fef9623
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97558.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-dce -Ofast" } */
+
+long int x1;
+int fr;
+
+int
+us (int sk, int jx)
+{
+ while (sk < 1)
+ {
+ jx *= 2;
+ fr += x1 + 1;
+ ++sk;
+ }
+
+ return jx;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97678.c b/gcc/testsuite/gcc.dg/vect/pr97678.c
new file mode 100644
index 0000000..ebe4a35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97678.c
@@ -0,0 +1,29 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-additional-options "-mavx2" { target avx2_runtime } } */
+
+#include "tree-vect.h"
+
+int
+main ()
+{
+ unsigned int i = 0;
+ unsigned short b[158 * 2];
+
+ check_vect ();
+
+ for (i = 0; i < 158; i++)
+ {
+ b[i * 2] = i * 7;
+ b[i * 2 + 1] = i * 8;
+ }
+
+ for (i = 0; i < 158; ++i)
+ if (b[i*2] != (unsigned short)(i*7)
+ || b[i*2+1] != (unsigned short)(i*8))
+ abort ();
+
+ return 0;
+}
+
+/* The init loop should be vectorized with SLP. */
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr97753.c b/gcc/testsuite/gcc.dg/vect/pr97753.c
new file mode 100644
index 0000000..e49a848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97753.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+long a[6];
+void d(int c)
+{
+ for (; c; c++)
+ for (int b = 0; b < 8; b++)
+ ((char *)&a[c])[b] = c;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97760.c b/gcc/testsuite/gcc.dg/vect/pr97760.c
new file mode 100644
index 0000000..da5ac93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97760.c
@@ -0,0 +1,26 @@
+#include "tree-vect.h"
+
+int b=1;
+static int *g = &b;
+
+void __attribute__((noipa))
+h (unsigned int n)
+{
+ int i = 3;
+ int f = 3;
+ for (; f <= 50; f += 4) {
+ i += 4;
+ *g = i;
+ i += n;
+ }
+}
+
+int main ()
+{
+ check_vect ();
+
+ h (9);
+ if (*g != 150 || b != 150)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr97769.c b/gcc/testsuite/gcc.dg/vect/pr97769.c
new file mode 100644
index 0000000..127f91a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97769.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+typedef struct {
+ int alg;
+ int h1[8];
+ unsigned d1[1];
+} tmp;
+typedef struct {
+ tmp itmp;
+ tmp otmp;
+} h1;
+h1 c;
+
+static void
+fn1(char *p1, int p2)
+{
+ int i = 0;
+ for (; i < 4; i++)
+ *p1++ = p2;
+}
+
+static void
+fn2(tmp *p1)
+{
+ char *d = (char *)p1->d1;
+ int *b = p1->h1;
+ for (int a; a; a++, d += 4)
+ fn1(d, *b++);
+}
+
+void fn3() { fn2(&(&c)->otmp); }
diff --git a/gcc/testsuite/gcc.dg/vect/slp-11b.c b/gcc/testsuite/gcc.dg/vect/slp-11b.c
index 0cc2377..0aece80 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-11b.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-11b.c
@@ -45,4 +45,5 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_strided4 && vect_int_mult } } } } */
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { target { ! { vect_strided4 && vect_int_mult } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { ! vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_load_lanes } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-49.c b/gcc/testsuite/gcc.dg/vect/slp-49.c
new file mode 100644
index 0000000..3f53baf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-49.c
@@ -0,0 +1,38 @@
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+int a[1024];
+
+void __attribute__((noipa))
+foo(int k)
+{
+ int j = 5;
+ for (int i = 0; i < 512; ++i)
+ {
+ a[2*i] = j;
+ a[2*i+1] = k;
+ j++;
+ k+=3;
+ }
+}
+
+int
+main()
+{
+ check_vect ();
+
+ foo (17);
+
+ for (int i = 0; i < 512; ++i)
+ {
+ if (a[2*i] != 5 + i
+ || a[2*i+1] != 17 + 3 * i)
+ __builtin_abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
index 3848929..cc863de 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c
@@ -106,7 +106,7 @@ int main (int argc, const char* argv[])
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && {! vect_partial_vectors_usage_1 } } } } } } */
/* The epilogues are vectorized using partial vectors. */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target { vect_perm3_int && { {! vect_load_lanes } && vect_partial_vectors_usage_1 } } } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } } } } */
-/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target vect_load_lanes } } } */
-/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_load_lanes } } } */
+/* { dg-final { scan-tree-dump "Built SLP cancelled: can use load/store-lanes" "vect" { target { vect_perm3_int && vect_load_lanes } xfail { vect_perm3_int && vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "LOAD_LANES" "vect" { target { vect_load_lanes } xfail { vect_load_lanes } } } } */
+/* { dg-final { scan-tree-dump "STORE_LANES" "vect" { target { vect_load_lanes } xfail { vect_load_lanes } } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/tree-vect.h b/gcc/testsuite/gcc.dg/vect/tree-vect.h
index 5d8d9eb..c4b8144 100644
--- a/gcc/testsuite/gcc.dg/vect/tree-vect.h
+++ b/gcc/testsuite/gcc.dg/vect/tree-vect.h
@@ -52,7 +52,7 @@ check_vect (void)
want_level = 1, want_d = bit_SSE2;
# endif
- if (!__get_cpuid (want_level, &a, &b, &c, &d)
+ if (!__get_cpuid_count (want_level, 0, &a, &b, &c, &d)
|| ((b & want_b) | (c & want_c) | (d & want_d)) == 0)
exit (0);
}
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-outer-slp-1.c b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-1.c
new file mode 100644
index 0000000..62b18bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+int a[1024];
+
+void foo (void)
+{
+ for (int i = 0; i < 1020; i += 4)
+ {
+ int suma = a[i];
+ int sumb = a[i+1];
+ int sumc = a[i+2];
+ int sumd = a[i+3];
+ for (unsigned j = 0; j < 77; ++j)
+ {
+ suma = (suma ^ i) + 1;
+ sumb = (sumb ^ i) + 2;
+ sumc = (sumc ^ i) + 3;
+ sumd = (sumd ^ i) + 4;
+ }
+ a[i] = suma;
+ a[i+1] = sumb;
+ a[i+2] = sumc;
+ a[i+3] = sumd;
+ }
+}
+
+/* We should vectorize this outer loop with SLP. */
+/* { dg-final { scan-tree-dump "OUTER LOOP VECTORIZED" "vect" } } */
+/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c
new file mode 100644
index 0000000..08b4fc5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-2.c
@@ -0,0 +1,51 @@
+/* { dg-require-effective-target vect_double } */
+/* { dg-require-effective-target vect_intdouble_cvt } */
+
+#include "tree-vect.h"
+
+double image[40];
+
+void __attribute__((noipa))
+foo (void)
+{
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ for (int j = 0; j < 40; j++)
+ {
+ suma += j+i;
+ sumb += j+i;
+ }
+ image[2*i] = suma;
+ image[2*i+1] = sumb;
+ }
+}
+
+int main ()
+{
+ check_vect ();
+
+ foo ();
+
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ for (int j = 0; j < 40; j++)
+ {
+ suma += j+i;
+ sumb += j+i;
+ asm ("" : "+g" (suma));
+ asm ("" : "+g" (sumb));
+ }
+ if (image[2*i] != suma
+ || image[2*i+1] != sumb)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c
new file mode 100644
index 0000000..c67d369
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-slp-3.c
@@ -0,0 +1,62 @@
+/* { dg-require-effective-target vect_double } */
+/* { dg-require-effective-target vect_intdouble_cvt } */
+
+#include "tree-vect.h"
+
+double image[40];
+
+void __attribute__((noipa))
+foo (void)
+{
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ int k = image[2*i];
+ int l = image[2*i+1];
+ for (int j = 0; j < 40; j++)
+ {
+ suma += k+i;
+ sumb += l+i;
+ k++;
+ l++;
+ }
+ image[2*i] = suma;
+ image[2*i+1] = sumb;
+ }
+}
+
+int main ()
+{
+ check_vect ();
+
+ for (int i = 0; i < 40; ++i)
+ image[i] = 1.;
+
+ foo ();
+
+ for (int i = 0; i < 20; i++)
+ {
+ double suma = 0;
+ double sumb = 0;
+ int k = 1;
+ int l = 1;
+ for (int j = 0; j < 40; j++)
+ {
+ suma += k+i;
+ sumb += l+i;
+ asm ("" : "+g" (suma));
+ asm ("" : "+g" (sumb));
+ k++;
+ l++;
+ }
+ if (image[2*i] != suma
+ || image[2*i+1] != sumb)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
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 791972c..61fe7e7 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
@@ -11,6 +11,8 @@ typedef uint16_t hfloat16_t;
typedef uint32_t hfloat32_t;
typedef uint64_t hfloat64_t;
+typedef uint16_t hbfloat16_t;
+
extern void abort(void);
extern void *memset(void *, int, size_t);
extern void *memcpy(void *, const void *, size_t);
@@ -107,7 +109,7 @@ extern size_t strlen(const char *);
{ \
union fp_operand { \
uint##W##_t i; \
- float##W##_t f; \
+ T##W##_t f; \
} tmp_res, tmp_exp; \
tmp_res.f = VECT_VAR(result, T, W, N)[i]; \
tmp_exp.i = VECT_VAR(EXPECTED, h##T, W, N)[i]; \
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c
new file mode 100644
index 0000000..bd9bb11
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get-be.c
@@ -0,0 +1,27 @@
+/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mbig-endian -save-temps" } */
+/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+
+#include <arm_neon.h>
+
+/*
+**test_vget_low_bf16:
+** ret
+*/
+bfloat16x4_t test_vget_low_bf16 (bfloat16x8_t a)
+{
+ return vget_low_bf16 (a);
+}
+
+/*
+**test_vget_high_bf16:
+** dup d0, v0.d\[1\]
+** ret
+*/
+bfloat16x4_t test_vget_high_bf16 (bfloat16x8_t a)
+{
+ return vget_high_bf16 (a);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c
new file mode 100644
index 0000000..2193753
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_get.c
@@ -0,0 +1,27 @@
+/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-save-temps" } */
+/* { dg-final { check-function-bodies "**" "" {-O[^0]} } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+
+#include <arm_neon.h>
+
+/*
+**test_vget_low_bf16:
+** ret
+*/
+bfloat16x4_t test_vget_low_bf16 (bfloat16x8_t a)
+{
+ return vget_low_bf16 (a);
+}
+
+/*
+**test_vget_high_bf16:
+** dup d0, v0.d\[1\]
+** ret
+*/
+bfloat16x4_t test_vget_high_bf16 (bfloat16x8_t a)
+{
+ return vget_high_bf16 (a);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vect_copy_lane_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vect_copy_lane_1.c
new file mode 100644
index 0000000..d5aa215
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vect_copy_lane_1.c
@@ -0,0 +1,32 @@
+/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-additional-options "-march=armv8.2-a+bf16 -O3 --save-temps -std=gnu90" } */
+
+#include "arm_neon.h"
+
+bfloat16x4_t __attribute__((noinline,noclone))
+test_vcopy_lane_bf16 (bfloat16x4_t a, bfloat16x4_t b)
+{
+ return vcopy_lane_bf16 (a, 1, b, 2);
+}
+
+bfloat16x8_t __attribute__((noinline,noclone))
+test_vcopyq_lane_bf16 (bfloat16x8_t a, bfloat16x4_t b)
+{
+ return vcopyq_lane_bf16 (a, 1, b, 2);
+}
+
+bfloat16x4_t __attribute__((noinline,noclone))
+test_vcopy_laneq_bf16 (bfloat16x4_t a, bfloat16x8_t b)
+{
+ return vcopy_laneq_bf16 (a, 1, b, 2);
+}
+
+bfloat16x8_t __attribute__((noinline,noclone))
+test_vcopyq_laneq_bf16 (bfloat16x8_t a, bfloat16x8_t b)
+{
+ return vcopyq_laneq_bf16 (a, 1, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "ins\\tv0.h\\\[1\\\], v1.h\\\[2\\\]" 2 } } */
+/* { dg-final { scan-assembler-times "ins\\tv0.h\\\[1\\\], v1.h\\\[0\\\]" 2 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_1.c
new file mode 100644
index 0000000..a83ed3e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_1.c
@@ -0,0 +1,74 @@
+/* { dg-do run { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+extern void abort (void);
+
+typedef union
+{
+ bfloat16_t bf16;
+ uint16_t u16;
+} bfloat16_u_t;
+
+#define VARIANTS(VARIANT, STRUCT) \
+VARIANT (bfloat16, , 4, _bf16, 3, STRUCT) \
+VARIANT (bfloat16, q, 8, _bf16, 7, STRUCT)
+
+#define TESTMETH(BASE, Q, ELTS, SUFFIX, LANE, STRUCT) \
+ int \
+ test_vld##STRUCT##Q##_lane##SUFFIX (const bfloat16_u_t *data, \
+ const bfloat16_u_t *overwrite) \
+ { \
+ BASE##x##ELTS##x##STRUCT##_t vectors; \
+ bfloat16_u_t temp[ELTS]; \
+ int i,j; \
+ for (i = 0; i < STRUCT; i++, data += ELTS) \
+ vectors.val[i] = vld1##Q##SUFFIX ((bfloat16_t *)data); \
+ vectors = vld##STRUCT##Q##_lane##SUFFIX ((bfloat16_t *) overwrite, \
+ vectors, LANE); \
+ while (--i >= 0) \
+ { \
+ vst1##Q##SUFFIX ((bfloat16_t *)temp, vectors.val[i]); \
+ data -= ELTS; /* Point at value loaded before vldN_lane. */ \
+ for (j = 0; j < ELTS; j++) \
+ if (temp[j].u16 != (j == LANE ? overwrite[i].u16 : data[j].u16)) \
+ return 1; \
+ } \
+ return 0; \
+ }
+
+/* Tests of vld2_lane and vld2q_lane. */
+VARIANTS (TESTMETH, 2)
+/* Tests of vld3_lane and vld3q_lane. */
+VARIANTS (TESTMETH, 3)
+/* Tests of vld4_lane and vld4q_lane. */
+VARIANTS (TESTMETH, 4)
+
+#define CHECK(BASE, Q, ELTS, SUFFIX, LANE, STRUCT) \
+ if (test_vld##STRUCT##Q##_lane##SUFFIX ((const bfloat16_u_t *)orig_data, \
+ BASE##_data) != 0) \
+ abort ();
+
+int
+main (int argc, char **argv)
+{
+ /* Original data for all vector formats. */
+ uint64_t orig_data[8] = {0x1234567890abcdefULL, 0x13579bdf02468aceULL,
+ 0x012389ab4567cdefULL, 0xdeeddadacafe0431ULL,
+ 0x1032547698badcfeULL, 0xbadbadbadbad0badULL,
+ 0x0102030405060708ULL, 0x0f0e0d0c0b0a0908ULL};
+
+ /* Data with which vldN_lane will overwrite some of previous. */
+ bfloat16_u_t bfloat16_data[4];
+ bfloat16_data[0].u16 = 0xABAB;
+ bfloat16_data[1].u16 = 0x0;
+ bfloat16_data[2].u16 = 0xCAFE;
+ bfloat16_data[3].u16 = 0x1234;
+
+ VARIANTS (CHECK, 2);
+ VARIANTS (CHECK, 3);
+ VARIANTS (CHECK, 4);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_2.c
new file mode 100644
index 0000000..670cf0b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vldN_lane_2.c
@@ -0,0 +1,52 @@
+/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-O2 --save-temps" } */
+
+#include <arm_neon.h>
+
+bfloat16x4x2_t
+test_vld2_lane_bf16 (const bfloat16_t *ptr, bfloat16x4x2_t b)
+{
+ return vld2_lane_bf16 (ptr, b, 2);
+}
+
+bfloat16x8x2_t
+test_vld2q_lane_bf16 (const bfloat16_t *ptr, bfloat16x8x2_t b)
+{
+ return vld2q_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "ld2\\t{v2.h - v3.h}\\\[2\\\], \\\[x0\\\]" 2 } } */
+
+bfloat16x4x3_t
+test_vld3_lane_bf16 (const bfloat16_t *ptr, bfloat16x4x3_t b)
+{
+ return vld3_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "ld3\t{v4.h - v6.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
+
+bfloat16x8x3_t
+test_vld3q_lane_bf16 (const bfloat16_t *ptr, bfloat16x8x3_t b)
+{
+ return vld3q_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "ld3\t{v1.h - v3.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
+
+bfloat16x4x4_t
+test_vld4_lane_bf16 (const bfloat16_t *ptr, bfloat16x4x4_t b)
+{
+ return vld4_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "ld4\t{v4.h - v7.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
+
+bfloat16x8x4_t
+test_vld4q_lane_bf16 (const bfloat16_t *ptr, bfloat16x8x4_t b)
+{
+ return vld4q_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "ld4\t{v0.h - v3.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_1.c
new file mode 100644
index 0000000..2c70bb9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_1.c
@@ -0,0 +1,227 @@
+/* { dg-do run { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+#include "arm-neon-ref.h"
+#include "compute-ref-data.h"
+
+/* Expected results for vst2, chunk 0. */
+VECT_VAR_DECL(expected_st2_0,hbfloat,16,4) [] = { 0xABAB, 0x3210, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st2_0,hbfloat,16,8) [] = { 0xABAB, 0x3210, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst2, chunk 1. */
+VECT_VAR_DECL(expected_st2_1,hbfloat,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st2_1,hbfloat,16,8) [] = { 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst3, chunk 0. */
+VECT_VAR_DECL(expected_st3_0,hbfloat,16,4) [] = { 0xABAB, 0x3210, 0xCAFE, 0x0 };
+VECT_VAR_DECL(expected_st3_0,hbfloat,16,8) [] = { 0xABAB, 0x3210, 0xCAFE, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst3, chunk 1. */
+VECT_VAR_DECL(expected_st3_1,hbfloat,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st3_1,hbfloat,16,8) [] = { 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst3, chunk 2. */
+VECT_VAR_DECL(expected_st3_2,hbfloat,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st3_2,hbfloat,16,8) [] = { 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst4, chunk 0. */
+VECT_VAR_DECL(expected_st4_0,hbfloat,16,4) [] =
+ { 0xABAB, 0x3210, 0xCAFE, 0x1234 };
+VECT_VAR_DECL(expected_st4_0,hbfloat,16,8) [] =
+ { 0xABAB, 0x3210, 0xCAFE, 0x1234, 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst4, chunk 1. */
+VECT_VAR_DECL(expected_st4_1,hbfloat,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st4_1,hbfloat,16,8) [] = { 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst4, chunk 2. */
+VECT_VAR_DECL(expected_st4_2,hbfloat,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st4_2,hbfloat,16,8) [] = { 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+/* Expected results for vst4, chunk 3. */
+VECT_VAR_DECL(expected_st4_3,hbfloat,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_st4_3,hbfloat,16,8) [] = { 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+
+typedef union
+{
+ bfloat16_t bf16;
+ uint16_t u16;
+} bfloat16_u_t;
+
+static bfloat16_t result_bfloat16x4[4];
+static bfloat16_t result_bfloat16x8[8];
+
+void exec_vstX_lane (void)
+{
+ bfloat16_u_t bfloat16_data[4];
+ bfloat16_data[0].u16 = 0xABAB;
+ bfloat16_data[1].u16 = 0x3210;
+ bfloat16_data[2].u16 = 0xCAFE;
+ bfloat16_data[3].u16 = 0x1234;
+
+ bfloat16_t buffer_vld2_lane_bfloat16x2 [2] =
+ { bfloat16_data[0].bf16,
+ bfloat16_data[1].bf16 };
+ bfloat16_t buffer_vld3_lane_bfloat16x3 [3] =
+ { bfloat16_data[0].bf16,
+ bfloat16_data[1].bf16,
+ bfloat16_data[2].bf16 };
+ bfloat16_t buffer_vld4_lane_bfloat16x4 [4] =
+ { bfloat16_data[0].bf16,
+ bfloat16_data[1].bf16,
+ bfloat16_data[2].bf16,
+ bfloat16_data[3].bf16 };
+
+ /* In this case, input variables are arrays of vectors. */
+#define DECL_VSTX_LANE(T1, W, N, X) \
+ VECT_ARRAY_TYPE(T1, W, N, X) VECT_ARRAY_VAR(vector, T1, W, N, X); \
+ VECT_ARRAY_TYPE(T1, W, N, X) VECT_ARRAY_VAR(vector_src, T1, W, N, X); \
+ VECT_VAR_DECL(result_bis_##X, T1, W, N)[X * N]
+
+ /* We need to use a temporary result buffer (result_bis), because
+ the one used for other tests is not large enough. A subset of the
+ result data is moved from result_bis to result, and it is this
+ subset which is used to check the actual behavior. The next
+ macro enables to move another chunk of data from result_bis to
+ result. */
+ /* We also use another extra input buffer (buffer_src), which we
+ fill with 0xAA, and which it used to load a vector from which we
+ read a given lane. */
+#define TEST_VSTX_LANE(Q, T1, T2, W, N, X, L) \
+ memset (VECT_VAR(buffer_src, T1, W, N), 0xAA, \
+ sizeof(VECT_VAR(buffer_src, T1, W, N))); \
+ memset (VECT_VAR(result_bis_##X, T1, W, N), 0, \
+ sizeof(VECT_VAR(result_bis_##X, T1, W, N))); \
+ \
+ VECT_ARRAY_VAR(vector_src, T1, W, N, X) = \
+ vld##X##Q##_##T2##W(VECT_VAR(buffer_src, T1, W, N)); \
+ \
+ VECT_ARRAY_VAR(vector, T1, W, N, X) = \
+ /* Use dedicated init buffer, of size X. */ \
+ vld##X##Q##_lane_##T2##W(VECT_VAR(buffer_vld##X##_lane, T1, W, X), \
+ VECT_ARRAY_VAR(vector_src, T1, W, N, X), \
+ L); \
+ vst##X##Q##_lane_##T2##W(VECT_VAR(result_bis_##X, T1, W, N), \
+ VECT_ARRAY_VAR(vector, T1, W, N, X), \
+ L); \
+ memcpy(VECT_VAR(result, T1, W, N), VECT_VAR(result_bis_##X, T1, W, N), \
+ sizeof(VECT_VAR(result, T1, W, N)));
+
+ /* Overwrite "result" with the contents of "result_bis"[Y]. */
+#define TEST_EXTRA_CHUNK(T1, W, N, X, Y) \
+ memcpy(VECT_VAR(result, T1, W, N), \
+ &(VECT_VAR(result_bis_##X, T1, W, N)[Y*N]), \
+ sizeof(VECT_VAR(result, T1, W, N)));
+
+#define DUMMY_ARRAY(V, T, W, N, L) VECT_VAR_DECL(V,T,W,N)[N*L]
+
+ DECL_VSTX_LANE(bfloat, 16, 4, 2);
+ DECL_VSTX_LANE(bfloat, 16, 8, 2);
+ DECL_VSTX_LANE(bfloat, 16, 4, 3);
+ DECL_VSTX_LANE(bfloat, 16, 8, 3);
+ DECL_VSTX_LANE(bfloat, 16, 4, 4);
+ DECL_VSTX_LANE(bfloat, 16, 8, 4);
+
+ DUMMY_ARRAY(buffer_src, bfloat, 16, 4, 4);
+ DUMMY_ARRAY(buffer_src, bfloat, 16, 8, 4);
+
+ /* Check vst2_lane/vst2q_lane. */
+ clean_results ();
+ TEST_VSTX_LANE(, bfloat, bf, 16, 4, 2, 2);
+ TEST_VSTX_LANE(q, bfloat, bf, 16, 8, 2, 6);
+
+#undef CMT
+#define CMT " (chunk 0)"
+#undef TEST_MSG
+#define TEST_MSG "VST2_LANE/VST2Q_LANE"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st2_0, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st2_0, CMT);
+ TEST_EXTRA_CHUNK(bfloat, 16, 4, 2, 1);
+ TEST_EXTRA_CHUNK(bfloat, 16, 8, 2, 1);
+
+#undef CMT
+#define CMT " (chunk 1)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st2_1, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st2_1, CMT);
+
+ /* Check vst3_lane/vst3q_lane. */
+ clean_results ();
+#undef TEST_MSG
+#define TEST_MSG "VST3_LANE/VST3Q_LANE"
+ TEST_VSTX_LANE(, bfloat, bf, 16, 4, 3, 2);
+ TEST_VSTX_LANE(q, bfloat, bf, 16, 8, 3, 6);
+
+#undef CMT
+#define CMT " (chunk 0)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st3_0, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st3_0, CMT);
+
+ TEST_EXTRA_CHUNK(bfloat, 16, 4, 3, 1);
+ TEST_EXTRA_CHUNK(bfloat, 16, 8, 3, 1);
+
+
+#undef CMT
+#define CMT " (chunk 1)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st3_1, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st3_1, CMT);
+
+ TEST_EXTRA_CHUNK(bfloat, 16, 4, 3, 2);
+ TEST_EXTRA_CHUNK(bfloat, 16, 8, 3, 2);
+
+#undef CMT
+#define CMT " (chunk 2)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st3_2, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st3_2, CMT);
+
+ /* Check vst4_lane/vst4q_lane. */
+ clean_results ();
+#undef TEST_MSG
+#define TEST_MSG "VST4_LANE/VST4Q_LANE"
+ TEST_VSTX_LANE(, bfloat, bf, 16, 4, 4, 2);
+ TEST_VSTX_LANE(q, bfloat, bf, 16, 8, 4, 6);
+
+#undef CMT
+#define CMT " (chunk 0)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st4_0, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st4_0, CMT);
+
+ TEST_EXTRA_CHUNK(bfloat, 16, 4, 4, 1);
+ TEST_EXTRA_CHUNK(bfloat, 16, 8, 4, 1);
+
+#undef CMT
+#define CMT " (chunk 1)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st4_1, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st4_1, CMT);
+
+ TEST_EXTRA_CHUNK(bfloat, 16, 4, 4, 2);
+ TEST_EXTRA_CHUNK(bfloat, 16, 8, 4, 2);
+
+#undef CMT
+#define CMT " (chunk 2)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st4_2, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st4_2, CMT);
+
+ TEST_EXTRA_CHUNK(bfloat, 16, 4, 4, 3);
+ TEST_EXTRA_CHUNK(bfloat, 16, 8, 4, 3);
+
+#undef CMT
+#define CMT " (chunk 3)"
+ CHECK_FP(TEST_MSG, bfloat, 16, 4, PRIx16, expected_st4_3, CMT);
+ CHECK_FP(TEST_MSG, bfloat, 16, 8, PRIx16, expected_st4_3, CMT);
+}
+
+int main (void)
+{
+ exec_vstX_lane ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_2.c
new file mode 100644
index 0000000..f70c34d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bf16_vstN_lane_2.c
@@ -0,0 +1,52 @@
+/* { dg-do assemble { target { aarch64*-*-* } } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-O2 --save-temps" } */
+
+#include <arm_neon.h>
+
+void
+test_vst2_lane_bf16 (bfloat16_t *ptr, bfloat16x4x2_t b)
+{
+ vst2_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "st2\\t{v2.h - v3.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
+
+void
+test_vst2q_lane_bf16 (bfloat16_t *ptr, bfloat16x8x2_t b)
+{
+ vst2q_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "st2\\t{v0.h - v1.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
+
+void
+test_vst3_lane_bf16 (bfloat16_t *ptr, bfloat16x4x3_t b)
+{
+ vst3_lane_bf16 (ptr, b, 2);
+}
+
+void
+test_vst3q_lane_bf16 (bfloat16_t *ptr, bfloat16x8x3_t b)
+{
+ vst3q_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "st3\\t{v4.h - v6.h}\\\[2\\\], \\\[x0\\\]" 2 } } */
+
+void
+test_vst4_lane_bf16 (bfloat16_t *ptr, bfloat16x4x4_t b)
+{
+ vst4_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "st4\\t{v4.h - v7.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
+
+void
+test_vst4q_lane_bf16 (bfloat16_t *ptr, bfloat16x8x4_t b)
+{
+ vst4q_lane_bf16 (ptr, b, 2);
+}
+
+/* { dg-final { scan-assembler-times "st4\\t{v0.h - v3.h}\\\[2\\\], \\\[x0\\\]" 1 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c
index bbea630..47af7c4 100644
--- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/bfcvt-compile.c
@@ -46,3 +46,43 @@ bfloat16_t test_bfcvt (float32_t a)
{
return vcvth_bf16_f32 (a);
}
+
+/*
+**test_vcvt_f32_bf16:
+** shll v0.4s, v0.4h, #16
+** ret
+*/
+float32x4_t test_vcvt_f32_bf16 (bfloat16x4_t a)
+{
+ return vcvt_f32_bf16 (a);
+}
+
+/*
+**test_vcvtq_low_f32_bf16:
+** shll v0.4s, v0.4h, #16
+** ret
+*/
+float32x4_t test_vcvtq_low_f32_bf16 (bfloat16x8_t a)
+{
+ return vcvtq_low_f32_bf16 (a);
+}
+
+/*
+**test_vcvtq_high_f32_bf16:
+** shll2 v0.4s, v0.8h, #16
+** ret
+*/
+float32x4_t test_vcvtq_high_f32_bf16 (bfloat16x8_t a)
+{
+ return vcvtq_high_f32_bf16 (a);
+}
+
+/*
+**test_vcvtah_f32_bf16:
+** shl d0, d0, #16
+** ret
+*/
+float32_t test_vcvtah_f32_bf16 (bfloat16_t a)
+{
+ return vcvtah_f32_bf16 (a);
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_1.c
new file mode 100644
index 0000000..7057980
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4_t
+test_vcopy_lane_bf16 (bfloat16x4_t a, bfloat16x4_t b)
+{
+ bfloat16x4_t res;
+ res = vcopy_lane_bf16 (a, 0, b, 4);
+ res = vcopy_lane_bf16 (a, 0, b, -1);
+ return res;
+}
+
+/* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+/* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_2.c
new file mode 100644
index 0000000..a8ef930
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_lane_bf16_indices_2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4_t
+test_vcopy_lane_bf16 (bfloat16x4_t a, bfloat16x4_t b)
+{
+ bfloat16x4_t res;
+ res = vcopy_lane_bf16 (a, -1, b, 2);
+ res = vcopy_lane_bf16 (a, 4, b, 2);
+ return res;
+}
+
+/* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+/* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_1.c
new file mode 100644
index 0000000..c156204
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4_t
+test_vcopy_laneq_bf16 (bfloat16x4_t a, bfloat16x8_t b)
+{
+ bfloat16x4_t res;
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vcopy_laneq_bf16 (a, -1, b, 2);
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vcopy_laneq_bf16 (a, 4, b, 2);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_2.c
new file mode 100644
index 0000000..036690b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopy_laneq_bf16_indices_2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4_t
+test_vcopy_laneq_bf16 (bfloat16x4_t a, bfloat16x8_t b)
+{
+ bfloat16x4_t res;
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopy_laneq_bf16 (a, 1, b, -1);
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopy_laneq_bf16 (a, 1, b, 8);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_1.c
new file mode 100644
index 0000000..15fce1b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8_t
+test_vcopyq_lane_bf16 (bfloat16x8_t a, bfloat16x4_t b)
+{
+ bfloat16x8_t res;
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopyq_lane_bf16 (a, -1, b, 2);
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopyq_lane_bf16 (a, 8, b, 2);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_2.c
new file mode 100644
index 0000000..6e8004a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_lane_bf16_indices_2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8_t
+test_vcopyq_lane_bf16 (bfloat16x8_t a, bfloat16x4_t b)
+{
+ bfloat16x8_t res;
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vcopyq_lane_bf16 (a, 2, b, -1);
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vcopyq_lane_bf16 (a, 2, b, 4);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_1.c
new file mode 100644
index 0000000..2a26b42
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8_t
+test_vcopyq_laneq_bf16 (bfloat16x8_t a, bfloat16x8_t b)
+{
+ bfloat16x8_t res;
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopyq_laneq_bf16 (a, -1, b, 2);
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopyq_laneq_bf16 (a, 8, b, 2);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_2.c
new file mode 100644
index 0000000..421cb2a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcopyq_laneq_bf16_indices_2.c
@@ -0,0 +1,17 @@
+/* { dg-do compile { target { aarch64*-*-* } } } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8_t
+test_vcopyq_laneq_bf16 (bfloat16x8_t a, bfloat16x8_t b)
+{
+ bfloat16x8_t res;
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopyq_laneq_bf16 (a, 2, b, -1);
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vcopyq_laneq_bf16 (a, 2, b, 8);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_bf16_indices_1.c
new file mode 100644
index 0000000..d568a26
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4x2_t
+f_vld2_lane_bf16 (bfloat16_t * p, bfloat16x4x2_t v)
+{
+ bfloat16x4x2_t res;
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vld2_lane_bf16 (p, v, 4);
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vld2_lane_bf16 (p, v, -1);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..b91f14a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8x2_t
+f_vld2q_lane_bf16 (bfloat16_t * p, bfloat16x8x2_t v)
+{
+ bfloat16x8x2_t res;
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vld2q_lane_bf16 (p, v, 8);
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vld2q_lane_bf16 (p, v, -1);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_bf16_indices_1.c
new file mode 100644
index 0000000..331abf4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4x3_t
+f_vld3_lane_bf16 (bfloat16_t * p, bfloat16x4x3_t v)
+{
+ bfloat16x4x3_t res;
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vld3_lane_bf16 (p, v, 4);
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vld3_lane_bf16 (p, v, -1);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..1c52887
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8x3_t
+f_vld3q_lane_bf16 (bfloat16_t * p, bfloat16x8x3_t v)
+{
+ bfloat16x8x3_t res;
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vld3q_lane_bf16 (p, v, 8);
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vld3q_lane_bf16 (p, v, -1);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_bf16_indices_1.c
new file mode 100644
index 0000000..3f486f9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x4x4_t
+f_vld4_lane_bf16 (bfloat16_t * p, bfloat16x4x4_t v)
+{
+ bfloat16x4x4_t res;
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vld4_lane_bf16 (p, v, 4);
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ res = vld4_lane_bf16 (p, v, -1);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..7159cd8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+bfloat16x8x4_t
+f_vld4q_lane_bf16 (bfloat16_t * p, bfloat16x8x4_t v)
+{
+ bfloat16x8x4_t res;
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vld4q_lane_bf16 (p, v, 8);
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ res = vld4q_lane_bf16 (p, v, -1);
+ return res;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrn_high_n.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrn_high_n.c
new file mode 100644
index 0000000..6ebe074
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrn_high_n.c
@@ -0,0 +1,195 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { arm*-*-* } } */
+
+#include <arm_neon.h>
+#include "arm-neon-ref.h"
+#include "compute-ref-data.h"
+
+/* Expected results. */
+VECT_VAR_DECL(expected,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf9, 0xf9, 0xfa,
+ 0xfa, 0xfb, 0xfb, 0xfc };
+VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
+ 0xfff8, 0xfff9, 0xfff9, 0xfffa };
+VECT_VAR_DECL(expected,int,32,4) [] = { 0xfffffff0, 0xfffffff1,
+ 0xfffffffc, 0xfffffffc };
+VECT_VAR_DECL(expected,uint,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected,uint,32,4) [] = { 0xfffffff0, 0xfffffff1,
+ 0xffffffff, 0xffffffff };
+
+/* Expected results with shift by 3. */
+VECT_VAR_DECL(expected_sh3,int,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f };
+VECT_VAR_DECL(expected_sh3,int,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0x7fff, 0x7fff, 0x7fff, 0x7fff };
+VECT_VAR_DECL(expected_sh3,int,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0x7fffffff, 0x7fffffff };
+VECT_VAR_DECL(expected_sh3,uint,8,16) [] = { 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected_sh3,uint,16,8) [] = { 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected_sh3,uint,32,4) [] = { 0xffffffff, 0xffffffff,
+ 0xffffffff, 0xffffffff };
+
+/* Expected results with shift by max amount. */
+VECT_VAR_DECL(expected_shmax,int,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f };
+VECT_VAR_DECL(expected_shmax,int,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0x7fff, 0x7fff, 0x7fff, 0x7fff };
+VECT_VAR_DECL(expected_shmax,int,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0x7fffffff, 0x7fffffff };
+VECT_VAR_DECL(expected_shmax,uint,8,16) [] = { 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected_shmax,uint,16,8) [] = { 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected_shmax,uint,32,4) [] = { 0xffffffff, 0xffffffff,
+ 0xffffffff, 0xffffffff };
+
+#define INSN vqrshrn_high_n
+#define TEST_MSG "VQRSHRN_HIGH_N"
+
+#define FNNAME1(NAME) void exec_ ## NAME (void)
+#define FNNAME(NAME) FNNAME1(NAME)
+
+FNNAME (INSN)
+{
+ /* Basic test: y=vqrshrn_high_n(x,v), then store the result. */
+#define TEST_VQRSHRN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V) \
+ VECT_VAR(vector_res, T1, W2, N2) = \
+ INSN##_##T2##W(VECT_VAR(vector1, T1, W2, N), \
+ VECT_VAR(vector2, T1, W, N), V); \
+ vst1q_##T2##W2(VECT_VAR(result, T1, W2, N2), \
+ VECT_VAR(vector_res, T1, W2, N2)); \
+
+ /* Two auxliary macros are necessary to expand INSN */
+#define TEST_VQRSHRN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V) \
+ TEST_VQRSHRN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V)
+
+#define TEST_VQRSHRN_HIGH_N(T1, T2, W, W2, N, N2, V) \
+ TEST_VQRSHRN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V)
+
+
+ DECL_VARIABLE(vector1, int, 8, 8);
+ DECL_VARIABLE(vector1, int, 16, 4);
+ DECL_VARIABLE(vector1, int, 32, 2);
+ DECL_VARIABLE(vector1, uint, 8, 8);
+ DECL_VARIABLE(vector1, uint, 16, 4);
+ DECL_VARIABLE(vector1, uint, 32, 2);
+
+ /* vector is twice as large as vector_res. */
+ DECL_VARIABLE(vector2, int, 16, 8);
+ DECL_VARIABLE(vector2, int, 32, 4);
+ DECL_VARIABLE(vector2, int, 64, 2);
+ DECL_VARIABLE(vector2, uint, 16, 8);
+ DECL_VARIABLE(vector2, uint, 32, 4);
+ DECL_VARIABLE(vector2, uint, 64, 2);
+
+ DECL_VARIABLE(vector_res, int, 8, 16);
+ DECL_VARIABLE(vector_res, int, 16, 8);
+ DECL_VARIABLE(vector_res, int, 32, 4);
+ DECL_VARIABLE(vector_res, uint, 8, 16);
+ DECL_VARIABLE(vector_res, uint, 16, 8);
+ DECL_VARIABLE(vector_res, uint, 32, 4);
+
+ clean_results ();
+
+ VLOAD(vector1, buffer, , int, s, 8, 8);
+ VLOAD(vector1, buffer, , int, s, 16, 4);
+ VLOAD(vector1, buffer, , int, s, 32, 2);
+ VLOAD(vector1, buffer, , uint, u, 8, 8);
+ VLOAD(vector1, buffer, , uint, u, 16, 4);
+ VLOAD(vector1, buffer, , uint, u, 32, 2);
+
+ VLOAD(vector2, buffer, q, int, s, 16, 8);
+ VLOAD(vector2, buffer, q, int, s, 32, 4);
+ VLOAD(vector2, buffer, q, int, s, 64, 2);
+ VLOAD(vector2, buffer, q, uint, u, 16, 8);
+ VLOAD(vector2, buffer, q, uint, u, 32, 4);
+ VLOAD(vector2, buffer, q, uint, u, 64, 2);
+
+ /* Choose shift amount arbitrarily. */
+#define CMT ""
+ TEST_VQRSHRN_HIGH_N(int, s, 16, 8, 8, 16, 1);
+ TEST_VQRSHRN_HIGH_N(int, s, 32, 16, 4, 8, 1);
+ TEST_VQRSHRN_HIGH_N(int, s, 64, 32, 2, 4, 2);
+ TEST_VQRSHRN_HIGH_N(uint, u, 16, 8, 8, 16, 2);
+ TEST_VQRSHRN_HIGH_N(uint, u, 32, 16, 4, 8, 3);
+ TEST_VQRSHRN_HIGH_N(uint, u, 64, 32, 2, 4, 3);
+
+ CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, CMT);
+ CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, CMT);
+ CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, CMT);
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, CMT);
+
+
+ /* Another set of tests, shifting max value by 3. */
+ VDUP(vector1, , int, s, 8, 8, 0x7F);
+ VDUP(vector1, , int, s, 16, 4, 0x7FFF);
+ VDUP(vector1, , int, s, 32, 2, 0x7FFFFFFFLL);
+ VDUP(vector1, , uint, u, 8, 8, 0xFF);
+ VDUP(vector1, , uint, u, 16, 4, 0xFFFF);
+ VDUP(vector1, , uint, u, 32, 2, 0xFFFFFFFFULL);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x7FFF);
+ VDUP(vector2, q, int, s, 32, 4, 0x7FFFFFFF);
+ VDUP(vector2, q, int, s, 64, 2, 0x7FFFFFFFFFFFFFFFLL);
+ VDUP(vector2, q, uint, u, 16, 8, 0xFFFF);
+ VDUP(vector2, q, uint, u, 32, 4, 0xFFFFFFFF);
+ VDUP(vector2, q, uint, u, 64, 2, 0xFFFFFFFFFFFFFFFFULL);
+
+#undef CMT
+#define CMT " (check saturation: shift by 3)"
+ TEST_VQRSHRN_HIGH_N(int, s, 16, 8, 8, 16, 3);
+ TEST_VQRSHRN_HIGH_N(int, s, 32, 16, 4, 8, 3);
+ TEST_VQRSHRN_HIGH_N(int, s, 64, 32, 2, 4, 3);
+ TEST_VQRSHRN_HIGH_N(uint, u, 16, 8, 8, 16, 3);
+ TEST_VQRSHRN_HIGH_N(uint, u, 32, 16, 4, 8, 3);
+ TEST_VQRSHRN_HIGH_N(uint, u, 64, 32, 2, 4, 3);
+
+ CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_sh3, CMT);
+ CHECK(TEST_MSG, int, 16, 8, PRIx16, expected_sh3, CMT);
+ CHECK(TEST_MSG, int, 32, 4, PRIx32, expected_sh3, CMT);
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_sh3, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_sh3, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_sh3, CMT);
+
+
+ /* Shift by max amount. */
+#undef CMT
+#define CMT " (check saturation: shift by max)"
+ TEST_VQRSHRN_HIGH_N(int, s, 16, 8, 8, 16, 8);
+ TEST_VQRSHRN_HIGH_N(int, s, 32, 16, 4, 8, 16);
+ TEST_VQRSHRN_HIGH_N(int, s, 64, 32, 2, 4, 32);
+ TEST_VQRSHRN_HIGH_N(uint, u, 16, 8, 8, 16, 8);
+ TEST_VQRSHRN_HIGH_N(uint, u, 32, 16, 4, 8, 16);
+ TEST_VQRSHRN_HIGH_N(uint, u, 64, 32, 2, 4, 32);
+
+ CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_shmax, CMT);
+ CHECK(TEST_MSG, int, 16, 8, PRIx16, expected_shmax, CMT);
+ CHECK(TEST_MSG, int, 32, 4, PRIx32, expected_shmax, CMT);
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_shmax, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_shmax, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_shmax, CMT);
+}
+
+int main (void)
+{
+ exec_vqrshrn_high_n ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrun_high_n.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrun_high_n.c
new file mode 100644
index 0000000..49d319d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqrshrun_high_n.c
@@ -0,0 +1,197 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { arm*-*-* } } */
+
+#include <arm_neon.h>
+#include "arm-neon-ref.h"
+#include "compute-ref-data.h"
+
+/* Expected results with negative input. */
+VECT_VAR_DECL(expected_neg,uint,8,16) [] = { 0xfe, 0xfe, 0xfe, 0xfe,
+ 0xfe, 0xfe, 0xfe, 0xfe,
+ 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_neg,uint,16,8) [] = { 0xfffd, 0xfffd, 0xfffd, 0xfffd,
+ 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_neg,uint,32,4) [] = { 0xfffffffc, 0xfffffffc, 0x0, 0x0 };
+
+/* Expected results with max input value shifted by 1. */
+VECT_VAR_DECL(expected_max_sh1,uint,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected_max_sh1,uint,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected_max_sh1,uint,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0xffffffff, 0xffffffff };
+
+/* Expected results with max input value shifted by max amount. */
+VECT_VAR_DECL(expected_max_shmax,uint,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80 };
+VECT_VAR_DECL(expected_max_shmax,uint,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0x8000, 0x8000, 0x8000, 0x8000 };
+VECT_VAR_DECL(expected_max_shmax,uint,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0x80000000, 0x80000000 };
+
+/* Expected results with min input value shifted by max amount. */
+VECT_VAR_DECL(expected_min_shmax,uint,8,16) [] = { 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80,
+ 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_min_shmax,uint,16,8) [] = { 0x8000, 0x8000, 0x8000, 0x8000,
+ 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_min_shmax,uint,32,4) [] = { 0x80000000, 0x80000000,
+ 0x0, 0x0 };
+
+/* Expected results with inputs in usual range. */
+VECT_VAR_DECL(expected,uint,8,16) [] = { 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12,
+ 0x49, 0x49, 0x49, 0x49,
+ 0x49, 0x49, 0x49, 0x49 };
+VECT_VAR_DECL(expected,uint,16,8) [] = { 0x4321, 0x4321, 0x4321, 0x4321,
+ 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected,uint,32,4) [] = { 0xdeadbeef, 0xdeadbeef,
+ 0xdeadbf, 0xdeadbf };
+
+#define INSN vqrshrun_high_n
+#define TEST_MSG "VQRSHRUN_HIGH_N"
+
+#define FNNAME1(NAME) void exec_ ## NAME (void)
+#define FNNAME(NAME) FNNAME1(NAME)
+
+FNNAME (INSN)
+{
+ /* Basic test: y=vqrshrun_high_n(x,v), then store the result. */
+#define TEST_VQRSHRUN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V) \
+ VECT_VAR(vector_res, uint, W2, N2) = \
+ INSN##_##T2##W(VECT_VAR(vector1, uint, W2, N), \
+ VECT_VAR(vector2, T1, W, N), V); \
+ vst1q_u##W2(VECT_VAR(result, uint, W2, N2), \
+ VECT_VAR(vector_res, uint, W2, N2)); \
+
+ /* Two auxliary macros are necessary to expand INSN */
+#define TEST_VQRSHRUN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V) \
+ TEST_VQRSHRUN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V)
+
+#define TEST_VQRSHRUN_HIGH_N(T1, T2, W, W2, N, N2, V) \
+ TEST_VQRSHRUN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V)
+
+
+ DECL_VARIABLE(vector1, uint, 8, 8);
+ DECL_VARIABLE(vector1, uint, 16, 4);
+ DECL_VARIABLE(vector1, uint, 32, 2);
+
+ /* vector is twice as large as vector_res. */
+ DECL_VARIABLE(vector2, int, 16, 8);
+ DECL_VARIABLE(vector2, int, 32, 4);
+ DECL_VARIABLE(vector2, int, 64, 2);
+
+ DECL_VARIABLE(vector_res, uint, 8, 16);
+ DECL_VARIABLE(vector_res, uint, 16, 8);
+ DECL_VARIABLE(vector_res, uint, 32, 4);
+
+ clean_results ();
+
+ /* Fill input vector with negative values, to check saturation on
+ limits. */
+ VDUP(vector1, , uint, u, 8, 8, -2);
+ VDUP(vector1, , uint, u, 16, 4, -3);
+ VDUP(vector1, , uint, u, 32, 2, -4);
+
+ VDUP(vector2, q, int, s, 16, 8, -2);
+ VDUP(vector2, q, int, s, 32, 4, -3);
+ VDUP(vector2, q, int, s, 64, 2, -4);
+
+ /* Choose shift amount arbitrarily. */
+#define CMT " (negative input)"
+ TEST_VQRSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 3);
+ TEST_VQRSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 4);
+ TEST_VQRSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 2);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_neg, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_neg, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_neg, CMT);
+
+
+ /* Fill input vector with max value, to check saturation on
+ limits. */
+ VDUP(vector1, , uint, u, 8, 8, 0x7F);
+ VDUP(vector1, , uint, u, 16, 4, 0x7FFF);
+ VDUP(vector1, , uint, u, 32, 2, 0x7FFFFFFFLL);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x7FFF);
+ VDUP(vector2, q, int, s, 32, 4, 0x7FFFFFFF);
+ VDUP(vector2, q, int, s, 64, 2, 0x7FFFFFFFFFFFFFFFLL);
+
+ /* shift by 1. */
+#undef CMT
+#define CMT " (check cumulative saturation: shift by 1)"
+ TEST_VQRSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 1);
+ TEST_VQRSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 1);
+ TEST_VQRSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 1);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_max_sh1, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_max_sh1, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_max_sh1, CMT);
+
+
+ /* shift by max. */
+#undef CMT
+#define CMT " (check cumulative saturation: shift by max, positive input)"
+ TEST_VQRSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 8);
+ TEST_VQRSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 16);
+ TEST_VQRSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 32);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_max_shmax, CMT);
+
+
+ /* Fill input vector with min value, to check saturation on limits. */
+ VDUP(vector1, , uint, u, 8, 8, 0x80);
+ VDUP(vector1, , uint, u, 16, 4, 0x8000);
+ VDUP(vector1, , uint, u, 32, 2, 0x80000000LL);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x8000);
+ VDUP(vector2, q, int, s, 32, 4, 0x80000000);
+ VDUP(vector2, q, int, s, 64, 2, 0x8000000000000000LL);
+
+ /* shift by max */
+#undef CMT
+#define CMT " (check cumulative saturation: shift by max, negative input)"
+ TEST_VQRSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 8);
+ TEST_VQRSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 16);
+ TEST_VQRSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 32);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_min_shmax, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_min_shmax, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_min_shmax, CMT);
+
+
+ /* Fill input vector with positive values, to check normal case. */
+ VDUP(vector1, , uint, u, 8, 8, 0x12);
+ VDUP(vector1, , uint, u, 16, 4, 0x4321);
+ VDUP(vector1, , uint, u, 32, 2, 0xDEADBEEF);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x1234);
+ VDUP(vector2, q, int, s, 32, 4, 0x87654321);
+ VDUP(vector2, q, int, s, 64, 2, 0xDEADBEEF);
+
+ /* shift arbitrary amount. */
+#undef CMT
+#define CMT ""
+ TEST_VQRSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 6);
+ TEST_VQRSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 7);
+ TEST_VQRSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 8);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, CMT);
+}
+
+int main (void)
+{
+ exec_vqrshrun_high_n ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrn_high_n.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrn_high_n.c
new file mode 100644
index 0000000..8d06f11
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrn_high_n.c
@@ -0,0 +1,193 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { arm*-*-* } } */
+
+#include <arm_neon.h>
+#include "arm-neon-ref.h"
+#include "compute-ref-data.h"
+
+/* Expected results. */
+VECT_VAR_DECL(expected,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xf8, 0xf8, 0xf9, 0xf9,
+ 0xfa, 0xfa, 0xfb, 0xfb };
+VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
+ 0xfff8, 0xfff8, 0xfff9, 0xfff9 };
+VECT_VAR_DECL(expected,int,32,4) [] = { 0xfffffff0, 0xfffffff1,
+ 0xfffffffc, 0xfffffffc };
+VECT_VAR_DECL(expected,uint,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected,uint,32,4) [] = { 0xfffffff0, 0xfffffff1,
+ 0xffffffff, 0xffffffff };
+
+/* Expected results with max input value shifted by 3. */
+VECT_VAR_DECL(expected_max_sh3,int,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f };
+VECT_VAR_DECL(expected_max_sh3,int,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0x7fff, 0x7fff, 0x7fff, 0x7fff };
+VECT_VAR_DECL(expected_max_sh3,int,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0x7fffffff, 0x7fffffff };
+VECT_VAR_DECL(expected_max_sh3,uint,8,16) [] = { 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected_max_sh3,uint,16,8) [] = { 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected_max_sh3,uint,32,4) [] = { 0xffffffff, 0xffffffff,
+ 0xffffffff, 0xffffffff };
+
+/* Expected results with max input value shifted by type size. */
+VECT_VAR_DECL(expected_max_shmax,int,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f };
+VECT_VAR_DECL(expected_max_shmax,int,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0x7fff, 0x7fff, 0x7fff, 0x7fff };
+VECT_VAR_DECL(expected_max_shmax,int,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0x7fffffff, 0x7fffffff };
+VECT_VAR_DECL(expected_max_shmax,uint,8,16) [] = { 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected_max_shmax,uint,16,8) [] = { 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected_max_shmax,uint,32,4) [] = { 0xffffffff, 0xffffffff,
+ 0xffffffff, 0xffffffff };
+
+#define INSN vqshrn_high_n
+#define TEST_MSG "VQSHRN_HIGH_N"
+
+#define FNNAME1(NAME) void exec_ ## NAME (void)
+#define FNNAME(NAME) FNNAME1(NAME)
+
+FNNAME (INSN)
+{
+ /* Basic test: y=vqshrn_high_n(x1,x2,v), then store the result. */
+#define TEST_VQSHRN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V) \
+ VECT_VAR(vector_res, T1, W2, N2) = \
+ INSN##_##T2##W(VECT_VAR(vector1, T1, W2, N), \
+ VECT_VAR(vector2, T1, W, N), V); \
+ vst1q_##T2##W2(VECT_VAR(result, T1, W2, N2), \
+ VECT_VAR(vector_res, T1, W2, N2));
+
+ /* Two auxliary macros are necessary to expand INSN */
+#define TEST_VQSHRN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V) \
+ TEST_VQSHRN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V)
+
+#define TEST_VQSHRN_HIGH_N(T1, T2, W, W2, N, N2, V) \
+ TEST_VQSHRN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V)
+
+
+ DECL_VARIABLE(vector1, int, 8, 8);
+ DECL_VARIABLE(vector1, int, 16, 4);
+ DECL_VARIABLE(vector1, int, 32, 2);
+ DECL_VARIABLE(vector1, uint, 8, 8);
+ DECL_VARIABLE(vector1, uint, 16, 4);
+ DECL_VARIABLE(vector1, uint, 32, 2);
+
+ /* vector is twice as large as vector_res. */
+ DECL_VARIABLE(vector2, int, 16, 8);
+ DECL_VARIABLE(vector2, int, 32, 4);
+ DECL_VARIABLE(vector2, int, 64, 2);
+ DECL_VARIABLE(vector2, uint, 16, 8);
+ DECL_VARIABLE(vector2, uint, 32, 4);
+ DECL_VARIABLE(vector2, uint, 64, 2);
+
+ DECL_VARIABLE(vector_res, int, 8, 16);
+ DECL_VARIABLE(vector_res, int, 16, 8);
+ DECL_VARIABLE(vector_res, int, 32, 4);
+ DECL_VARIABLE(vector_res, uint, 8, 16);
+ DECL_VARIABLE(vector_res, uint, 16, 8);
+ DECL_VARIABLE(vector_res, uint, 32, 4);
+
+ clean_results ();
+
+ VLOAD(vector1, buffer, , int, s, 8, 8);
+ VLOAD(vector1, buffer, , int, s, 16, 4);
+ VLOAD(vector1, buffer, , int, s, 32, 2);
+ VLOAD(vector1, buffer, , uint, u, 8, 8);
+ VLOAD(vector1, buffer, , uint, u, 16, 4);
+ VLOAD(vector1, buffer, , uint, u, 32, 2);
+
+ VLOAD(vector2, buffer, q, int, s, 16, 8);
+ VLOAD(vector2, buffer, q, int, s, 32, 4);
+ VLOAD(vector2, buffer, q, int, s, 64, 2);
+ VLOAD(vector2, buffer, q, uint, u, 16, 8);
+ VLOAD(vector2, buffer, q, uint, u, 32, 4);
+ VLOAD(vector2, buffer, q, uint, u, 64, 2);
+
+ /* Choose shift amount arbitrarily. */
+#define CMT ""
+ TEST_VQSHRN_HIGH_N(int, s, 16, 8, 8, 16, 1);
+ TEST_VQSHRN_HIGH_N(int, s, 32, 16, 4, 8, 1);
+ TEST_VQSHRN_HIGH_N(int, s, 64, 32, 2, 4, 2);
+ TEST_VQSHRN_HIGH_N(uint, u, 16, 8, 8, 16, 2);
+ TEST_VQSHRN_HIGH_N(uint, u, 32, 16, 4, 8, 3);
+ TEST_VQSHRN_HIGH_N(uint, u, 64, 32, 2, 4, 3);
+
+ CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, CMT);
+ CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, CMT);
+ CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, CMT);
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, CMT);
+
+ /* Use max possible value as input. */
+ VDUP(vector1, , int, s, 8, 8, 0x7F);
+ VDUP(vector1, , int, s, 16, 4, 0x7FFF);
+ VDUP(vector1, , int, s, 32, 2, 0x7FFFFFFFLL);
+ VDUP(vector1, , uint, u, 8, 8, 0xFF);
+ VDUP(vector1, , uint, u, 16, 4, 0xFFFF);
+ VDUP(vector1, , uint, u, 32, 2, 0xFFFFFFFFULL);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x7FFF);
+ VDUP(vector2, q, int, s, 32, 4, 0x7FFFFFFF);
+ VDUP(vector2, q, int, s, 64, 2, 0x7FFFFFFFFFFFFFFFLL);
+ VDUP(vector2, q, uint, u, 16, 8, 0xFFFF);
+ VDUP(vector2, q, uint, u, 32, 4, 0xFFFFFFFF);
+ VDUP(vector2, q, uint, u, 64, 2, 0xFFFFFFFFFFFFFFFFULL);
+
+#undef CMT
+#define CMT " (check saturation: shift by 3)"
+ TEST_VQSHRN_HIGH_N(int, s, 16, 8, 8, 16, 3);
+ TEST_VQSHRN_HIGH_N(int, s, 32, 16, 4, 8, 3);
+ TEST_VQSHRN_HIGH_N(int, s, 64, 32, 2, 4, 3);
+ TEST_VQSHRN_HIGH_N(uint, u, 16, 8, 8, 16, 3);
+ TEST_VQSHRN_HIGH_N(uint, u, 32, 16, 4, 8, 3);
+ TEST_VQSHRN_HIGH_N(uint, u, 64, 32, 2, 4, 3);
+
+ CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_max_sh3, CMT);
+ CHECK(TEST_MSG, int, 16, 8, PRIx16, expected_max_sh3, CMT);
+ CHECK(TEST_MSG, int, 32, 4, PRIx32, expected_max_sh3, CMT);
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_max_sh3, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_max_sh3, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_max_sh3, CMT);
+
+
+#undef CMT
+#define CMT " (check saturation: shift by max)"
+ TEST_VQSHRN_HIGH_N(int, s, 16, 8, 8, 16, 8);
+ TEST_VQSHRN_HIGH_N(int, s, 32, 16, 4, 8, 16);
+ TEST_VQSHRN_HIGH_N(int, s, 64, 32, 2, 4, 32);
+ TEST_VQSHRN_HIGH_N(uint, u, 16, 8, 8, 16, 8);
+ TEST_VQSHRN_HIGH_N(uint, u, 32, 16, 4, 8, 16);
+ TEST_VQSHRN_HIGH_N(uint, u, 64, 32, 2, 4, 32);
+
+ CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, int, 16, 8, PRIx16, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, int, 32, 4, PRIx32, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_max_shmax, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_max_shmax, CMT);
+}
+
+int main (void)
+{
+ exec_vqshrn_high_n ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrun_high_n.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrun_high_n.c
new file mode 100644
index 0000000..e8235fe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqshrun_high_n.c
@@ -0,0 +1,143 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { arm*-*-* } } */
+
+#include <arm_neon.h>
+#include "arm-neon-ref.h"
+#include "compute-ref-data.h"
+
+/* Expected results with negative input. */
+VECT_VAR_DECL(expected_neg,uint,8,16) [] = { 0xfe, 0xfe, 0xfe, 0xfe,
+ 0xfe, 0xfe, 0xfe, 0xfe,
+ 0x0, 0x0, 0x0, 0x0,
+ 0x0,0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_neg,uint,16,8) [] = { 0xfffd, 0xfffd, 0xfffd, 0xfffd,
+ 0x0, 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected_neg,uint,32,4) [] = { 0xfffffffc, 0xfffffffc,
+ 0x0, 0x0 };
+
+/* Expected results with max input value shifted by 1. */
+VECT_VAR_DECL(expected_max_sh1,uint,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
+ 0x7f, 0x7f, 0x7f, 0x7f,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff };
+VECT_VAR_DECL(expected_max_sh1,uint,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
+ 0xffff, 0xffff, 0xffff, 0xffff };
+VECT_VAR_DECL(expected_max_sh1,uint,32,4) [] = { 0x7fffffff, 0x7fffffff,
+ 0xffffffff, 0xffffffff };
+
+/* Expected results. */
+VECT_VAR_DECL(expected,uint,8,16) [] = { 0x12, 0x12, 0x12, 0x12,
+ 0x12, 0x12, 0x12, 0x12,
+ 0x48, 0x48, 0x48, 0x48,
+ 0x48, 0x48, 0x48, 0x48 };
+VECT_VAR_DECL(expected,uint,16,8) [] = { 0x4321, 0x4321, 0x4321, 0x4321,
+ 0x0, 0x0, 0x0, 0x0 };
+VECT_VAR_DECL(expected,uint,32,4) [] = { 0xdeadbeef, 0xdeadbeef,
+ 0xdeadbe, 0xdeadbe };
+
+#define INSN vqshrun_high_n
+#define TEST_MSG "VQSHRUN_HIGH_N"
+
+#define FNNAME1(NAME) void exec_ ## NAME (void)
+#define FNNAME(NAME) FNNAME1(NAME)
+
+FNNAME (INSN)
+{
+ /* Basic test: y=vqshrun_high_n(x,v), then store the result. */
+#define TEST_VQSHRUN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V) \
+ VECT_VAR(vector_res, uint, W2, N2) = \
+ INSN##_##T2##W(VECT_VAR(vector1,uint, W2, N), \
+ VECT_VAR(vector2, T1, W, N), V); \
+ vst1q_u##W2(VECT_VAR(result, uint, W2, N2), \
+ VECT_VAR(vector_res, uint, W2, N2)); \
+
+ /* Two auxliary macros are necessary to expand INSN */
+#define TEST_VQSHRUN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V) \
+ TEST_VQSHRUN_HIGH_N2(INSN, T1, T2, W, W2, N, N2, V)
+
+#define TEST_VQSHRUN_HIGH_N(T1, T2, W, W2, N, N2, V) \
+ TEST_VQSHRUN_HIGH_N1(INSN, T1, T2, W, W2, N, N2, V)
+
+
+ DECL_VARIABLE(vector1, uint, 8, 8);
+ DECL_VARIABLE(vector1, uint, 16, 4);
+ DECL_VARIABLE(vector1, uint, 32, 2);
+
+ /* vector is twice as large as vector_res. */
+ DECL_VARIABLE(vector2, int, 16, 8);
+ DECL_VARIABLE(vector2, int, 32, 4);
+ DECL_VARIABLE(vector2, int, 64, 2);
+
+ DECL_VARIABLE(vector_res, uint, 8, 16);
+ DECL_VARIABLE(vector_res, uint, 16, 8);
+ DECL_VARIABLE(vector_res, uint, 32, 4);
+
+ clean_results ();
+
+ /* Fill input vector with negative values, to check saturation on
+ limits. */
+ VDUP(vector1, , uint, u, 8, 8, -2);
+ VDUP(vector1, , uint, u, 16, 4, -3);
+ VDUP(vector1, , uint, u, 32, 2, -4);
+
+ VDUP(vector2, q, int, s, 16, 8, -2);
+ VDUP(vector2, q, int, s, 32, 4, -3);
+ VDUP(vector2, q, int, s, 64, 2, -4);
+
+ /* Choose shift amount arbitrarily. */
+#define CMT " (negative input)"
+ TEST_VQSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 3);
+ TEST_VQSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 4);
+ TEST_VQSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 2);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_neg, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_neg, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_neg, CMT);
+
+
+ /* Fill input vector with max value, to check saturation on
+ limits. */
+ VDUP(vector1, , uint, u, 8, 8, 0x7F);
+ VDUP(vector1, , uint, u, 16, 4, 0x7FFF);
+ VDUP(vector1, , uint, u, 32, 2, 0x7FFFFFFFLL);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x7FFF);
+ VDUP(vector2, q, int, s, 32, 4, 0x7FFFFFFF);
+ VDUP(vector2, q, int, s, 64, 2, 0x7FFFFFFFFFFFFFFFLL);
+
+#undef CMT
+#define CMT " (check cumulative saturation)"
+ TEST_VQSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 1);
+ TEST_VQSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 1);
+ TEST_VQSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 1);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected_max_sh1, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected_max_sh1, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected_max_sh1, CMT);
+
+
+ /* Fill input vector with positive values, to check normal case. */
+ VDUP(vector1, , uint, u, 8, 8, 0x12);
+ VDUP(vector1, , uint, u, 16, 4, 0x4321);
+ VDUP(vector1, , uint, u, 32, 2, 0xDEADBEEF);
+
+ VDUP(vector2, q, int, s, 16, 8, 0x1234);
+ VDUP(vector2, q, int, s, 32, 4, 0x87654321);
+ VDUP(vector2, q, int, s, 64, 2, 0xDEADBEEF);
+
+#undef CMT
+#define CMT ""
+ TEST_VQSHRUN_HIGH_N(int, s, 16, 8, 8, 16, 6);
+ TEST_VQSHRUN_HIGH_N(int, s, 32, 16, 4, 8, 7);
+ TEST_VQSHRUN_HIGH_N(int, s, 64, 32, 2, 4, 8);
+
+ CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected, CMT);
+ CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, CMT);
+ CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, CMT);
+}
+
+int main (void)
+{
+ exec_vqshrun_high_n ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_bf16_indices_1.c
new file mode 100644
index 0000000..7421dc6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_bf16_indices_1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+void
+f_vst2_lane_bf16 (bfloat16_t * p, bfloat16x4x2_t v)
+{
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ vst2_lane_bf16 (p, v, 4);
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ vst2_lane_bf16 (p, v, -1);
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..92aecfc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_bf16_indices_1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+void
+f_vst2q_lane_bf16 (bfloat16_t * p, bfloat16x8x2_t v)
+{
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ vst2q_lane_bf16 (p, v, 8);
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ vst2q_lane_bf16 (p, v, -1);
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_bf16_indices_1.c
new file mode 100644
index 0000000..5d1f4f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_bf16_indices_1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+void
+f_vst3_lane_bf16 (bfloat16_t * p, bfloat16x4x3_t v)
+{
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ vst3_lane_bf16 (p, v, 4);
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ vst3_lane_bf16 (p, v, -1);
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..65592db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_bf16_indices_1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+void
+f_vst3q_lane_bf16 (bfloat16_t * p, bfloat16x8x3_t v)
+{
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ vst3q_lane_bf16 (p, v, 8);
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ vst3q_lane_bf16 (p, v, -1);
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_bf16_indices_1.c
new file mode 100644
index 0000000..8abd402
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_bf16_indices_1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+void
+f_vst4_lane_bf16 (bfloat16_t * p, bfloat16x4x4_t v)
+{
+ /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
+ vst4_lane_bf16 (p, v, 4);
+ /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+ vst4_lane_bf16 (p, v, -1);
+ return;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..7d4d4ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_bf16_indices_1.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+
+#include <arm_neon.h>
+
+void
+f_vst4q_lane_bf16 (bfloat16_t * p, bfloat16x8x4_t v)
+{
+ /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
+ vst4q_lane_bf16 (p, v, 8);
+ /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+ vst4q_lane_bf16 (p, v, -1);
+ return;
+}
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/narrow_high-intrinsics.c b/gcc/testsuite/gcc.target/aarch64/narrow_high-intrinsics.c
index 8b8a630..07d7803 100644
--- a/gcc/testsuite/gcc.target/aarch64/narrow_high-intrinsics.c
+++ b/gcc/testsuite/gcc.target/aarch64/narrow_high-intrinsics.c
@@ -113,12 +113,12 @@ ONE (vmovn_high, uint32x4_t, uint32x2_t, uint64x2_t, u64)
/* { dg-final { scan-assembler-times "raddhn2\\tv" 6} } */
/* { dg-final { scan-assembler-times "\\trshrn2 v" 6} } */
/* { dg-final { scan-assembler-times "\\tshrn2 v" 6} } */
-/* { dg-final { scan-assembler-times "sqshrun2 v" 3} } */
-/* { dg-final { scan-assembler-times "sqrshrun2 v" 3} } */
-/* { dg-final { scan-assembler-times "sqshrn2 v" 3} } */
-/* { dg-final { scan-assembler-times "uqshrn2 v" 3} } */
-/* { dg-final { scan-assembler-times "sqrshrn2 v" 3} } */
-/* { dg-final { scan-assembler-times "uqrshrn2 v" 3} } */
+/* { dg-final { scan-assembler-times "sqshrun2\\tv" 3} } */
+/* { dg-final { scan-assembler-times "sqrshrun2\\tv" 3} } */
+/* { dg-final { scan-assembler-times "sqshrn2\\tv" 3} } */
+/* { dg-final { scan-assembler-times "uqshrn2\\tv" 3} } */
+/* { dg-final { scan-assembler-times "sqrshrn2\\tv" 3} } */
+/* { dg-final { scan-assembler-times "uqrshrn2\\tv" 3} } */
/* { dg-final { scan-assembler-times "uqxtn2 v" 3} } */
/* { dg-final { scan-assembler-times "sqxtn2 v" 3} } */
/* { dg-final { scan-assembler-times "sqxtun2 v" 3} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr97535.c b/gcc/testsuite/gcc.target/aarch64/pr97535.c
new file mode 100644
index 0000000..7d4db48
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr97535.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { ! ilp32 } } } */
+
+#include <string.h>
+
+#define SIZE 2181038080
+
+extern char raw_buffer[SIZE];
+
+void setRaw(const void *raw)
+{
+ memcpy(raw_buffer, raw, SIZE);
+}
+
+/* At any optimization level this should be a function call
+ and not inlined. */
+/* { dg-final { scan-assembler "bl\tmemcpy" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr97638.c b/gcc/testsuite/gcc.target/aarch64/pr97638.c
new file mode 100644
index 0000000..e5869e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr97638.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mbranch-protection=bti" } */
+
+char *foo (const char *s, const int c)
+{
+ const char *p = 0;
+ for (;;)
+ {
+ if (*s == c)
+ p = s;
+ if (p != 0 || *s++ == 0)
+ break;
+ }
+ return (char *)p;
+}
+
+/* { dg-final { scan-assembler "hint\t34" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr97546.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr97546.c
new file mode 100644
index 0000000..25707cd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr97546.c
@@ -0,0 +1,22 @@
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+static svbool_t visinf_vo_vf(svfloat32_t d)
+{
+ return svcmpeq_n_f32 (svptrue_b8 (),
+ svabs_f32_x (svptrue_b8 (), d),
+ __builtin_inff ());
+}
+
+const svint32_t _ZGVsNxv_ilogbf(svfloat32_t d)
+{
+ svint32_t e = svreinterpret_s32_f32 (svdup_n_f32 (0.0f));
+ e = svsel_s32 (svcmpne_f32 (svptrue_b8(), d, d),
+ svdup_n_s32 (2147483647),
+ e);
+ e = svsel_s32 (visinf_vo_vf (d),
+ svdup_n_s32 (0x7fffffff),
+ e);
+ return e;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_2.c b/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_2.c
new file mode 100644
index 0000000..3d74ff9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_2.c
@@ -0,0 +1,331 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B) B, B
+#define PERM1(B) PERM0 (B), PERM0 (B)
+#define PERM2(B) PERM1 (B), PERM1 (B)
+#define PERM3(B) PERM2 (B), PERM2 (B)
+#define PERM4(B) PERM3 (B), PERM3 (B)
+#define PERM5(B) PERM4 (B), PERM4 (B)
+#define PERM6(B) PERM5 (B), PERM5 (B)
+
+/*
+** qi_dup_h_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** dup (z[0-9]+)\.h, \2\.h\[1\]
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_dup_h_1 (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (1) });
+}
+
+/*
+** qi_dup_h_31:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** dup (z[0-9]+)\.h, \2\.h\[31\]
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_dup_h_31 (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (31) });
+}
+
+/*
+** qi_dup_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[1\]
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_dup_s_1 (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (1) });
+}
+
+/*
+** qi_dup_s_15:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[15\]
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_dup_s_15 (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (15) });
+}
+
+/*
+** qi_dup_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[1\]
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_dup_d_1 (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (1) });
+}
+
+/*
+** qi_dup_d_7:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[7\]
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_dup_d_7 (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (7) });
+}
+
+/*
+** hi_dup_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[1\]
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_dup_s_1 (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hi_dup_s_15:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[15\]
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_dup_s_15 (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (15) });
+}
+
+/*
+** hf_dup_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[1\]
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_dup_s_1 (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hf_dup_s_11:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[11\]
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_dup_s_11 (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (11) });
+}
+
+/*
+** bf_dup_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[1\]
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_dup_s_1 (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** bf_dup_s_13:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** dup (z[0-9]+)\.s, \2\.s\[13\]
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_dup_s_13 (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (13) });
+}
+
+/*
+** hi_dup_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[1\]
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_dup_d_1 (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hi_dup_d_7:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[7\]
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_dup_d_7 (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (7) });
+}
+
+/*
+** hf_dup_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[1\]
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_dup_d_1 (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hf_dup_d_5:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[5\]
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_dup_d_5 (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (5) });
+}
+
+/*
+** bf_dup_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[1\]
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_dup_d_1 (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** bf_dup_d_6:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[6\]
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_dup_d_6 (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (6) });
+}
+
+/*
+** si_dup_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[1\]
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_dup_d_1 (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1) });
+}
+
+/*
+** si_dup_d_7:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[7\]
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_dup_d_7 (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (7) });
+}
+
+/*
+** sf_dup_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[1\]
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_dup_d_1 (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1) });
+}
+
+/*
+** sf_dup_d_7:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** dup (z[0-9]+)\.d, \2\.d\[7\]
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_dup_d_7 (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (7) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_3.c b/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_3.c
new file mode 100644
index 0000000..50f73a1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/dup_lane_3.c
@@ -0,0 +1,90 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B) B, B
+#define PERM1(B) PERM0 (B), PERM0 (B)
+#define PERM2(B) PERM1 (B), PERM1 (B)
+#define PERM3(B) PERM2 (B), PERM2 (B)
+#define PERM4(B) PERM3 (B), PERM3 (B)
+#define PERM5(B) PERM4 (B), PERM4 (B)
+#define PERM6(B) PERM5 (B), PERM5 (B)
+
+v128qi
+qi_dup_h_32 (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (32) });
+}
+
+v64qi
+qi_dup_s_16 (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (16) });
+}
+
+v32qi
+qi_dup_d_8 (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (8) });
+}
+
+v64hi
+hi_dup_s_16 (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (16) });
+}
+
+v64hf
+hf_dup_s_16 (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (16) });
+}
+
+v64bf
+bf_dup_s_16 (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (16) });
+}
+
+v32hi
+hi_dup_d_8 (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (8) });
+}
+
+v32hf
+hf_dup_d_8 (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (8) });
+}
+
+v32bf
+bf_dup_d_8 (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (8) });
+}
+
+v32si
+si_dup_d_8 (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (8) });
+}
+
+v32sf
+sf_dup_d_8 (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (8) });
+}
+
+/* { dg-final { scan-assembler-not {\tdup\tz} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/ext_4.c b/gcc/testsuite/gcc.target/aarch64/sve/ext_4.c
new file mode 100644
index 0000000..4637b5c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/ext_4.c
@@ -0,0 +1,353 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B) B, B + 1
+#define PERM1(B) PERM0 (B), PERM0 (B + 2)
+#define PERM2(B) PERM1 (B), PERM1 (B + 4)
+#define PERM3(B) PERM2 (B), PERM2 (B + 8)
+#define PERM4(B) PERM3 (B), PERM3 (B + 16)
+#define PERM5(B) PERM4 (B), PERM4 (B + 32)
+#define PERM6(B) PERM5 (B), PERM5 (B + 64)
+
+/*
+** qi_ext_h_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #2
+** st1b \2\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_ext_h_1 (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (1) });
+}
+
+/*
+** qi_ext_h_1_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ext \3\.b, \3\.b, \2\.b, #2
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ext \4\.b, \4\.b, \5\.b, #2
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_ext_h_1_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (1) });
+}
+
+/*
+** qi_ext_h_127:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #254
+** st1b \2\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_ext_h_127 (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (127) });
+}
+
+/*
+** qi_ext_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #4
+** st1b \2\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_ext_s_1 (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (1) });
+}
+
+/*
+** qi_ext_s_63:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #252
+** st1b \2\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_ext_s_63 (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (63) });
+}
+
+/*
+** qi_ext_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #8
+** st1b \2\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_ext_d_1 (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (1) });
+}
+
+/*
+** qi_ext_d_31:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #248
+** st1b \2\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_ext_d_31 (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (31) });
+}
+
+/*
+** hi_ext_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #4
+** st1h \2\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_ext_s_1 (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hi_ext_s_63:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #252
+** st1h \2\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_ext_s_63 (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (63) });
+}
+
+/*
+** hf_ext_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #4
+** st1h \2\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_ext_s_1 (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hf_ext_s_60:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #240
+** st1h \2\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_ext_s_60 (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (60) });
+}
+
+/*
+** bf_ext_s_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #4
+** st1h \2\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_ext_s_1 (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** bf_ext_s_40:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #160
+** st1h \2\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_ext_s_40 (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (40) });
+}
+
+/*
+** hi_ext_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #8
+** st1h \2\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_ext_d_1 (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hi_ext_d_31:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #248
+** st1h \2\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_ext_d_31 (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (31) });
+}
+
+/*
+** hf_ext_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #8
+** st1h \2\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_ext_d_1 (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hf_ext_d_18:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #144
+** st1h \2\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_ext_d_18 (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (18) });
+}
+
+/*
+** bf_ext_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #8
+** st1h \2\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_ext_d_1 (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** bf_ext_d_7:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #56
+** st1h \2\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_ext_d_7 (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (7) });
+}
+
+/*
+** si_ext_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #8
+** st1w \2\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_ext_d_1 (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1) });
+}
+
+/*
+** si_ext_d_31:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #248
+** st1w \2\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_ext_d_31 (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (31) });
+}
+
+/*
+** sf_ext_d_1:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #8
+** st1w \2\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_ext_d_1 (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1) });
+}
+
+/*
+** sf_ext_d_31:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** ext \2\.b, \2\.b, \2\.b, #248
+** st1w \2\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_ext_d_31 (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (31) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/rev_2.c b/gcc/testsuite/gcc.target/aarch64/sve/rev_2.c
new file mode 100644
index 0000000..417da37
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/rev_2.c
@@ -0,0 +1,177 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B) B, B - 1
+#define PERM1(B) PERM0 (B), PERM0 (B - 2)
+#define PERM2(B) PERM1 (B), PERM1 (B - 4)
+#define PERM3(B) PERM2 (B), PERM2 (B - 8)
+#define PERM4(B) PERM3 (B), PERM3 (B - 16)
+#define PERM5(B) PERM4 (B), PERM4 (B - 32)
+#define PERM6(B) PERM5 (B), PERM5 (B - 64)
+
+/*
+** qi_rev_h:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** rev (z[0-9]+)\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_rev_h (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (127) });
+}
+
+/*
+** qi_rev_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** rev (z[0-9]+)\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_rev_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (63) });
+}
+
+/*
+** qi_rev_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** rev (z[0-9]+)\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_rev_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (31) });
+}
+
+/*
+** hi_rev_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** rev (z[0-9]+)\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_rev_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (63) });
+}
+
+/*
+** hf_rev_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** rev (z[0-9]+)\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_rev_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (63) });
+}
+
+/*
+** bf_rev_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** rev (z[0-9]+)\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_rev_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (63) });
+}
+
+/*
+** hi_rev_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** rev (z[0-9]+)\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_rev_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (31) });
+}
+
+/*
+** hf_rev_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** rev (z[0-9]+)\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_rev_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (31) });
+}
+
+/*
+** bf_rev_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** rev (z[0-9]+)\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_rev_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (31) });
+}
+
+/*
+** si_rev_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** rev (z[0-9]+)\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_rev_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (31) });
+}
+
+/*
+** sf_rev_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** rev (z[0-9]+)\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_rev_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (31) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/revhw_1.c b/gcc/testsuite/gcc.target/aarch64/sve/revhw_1.c
new file mode 100644
index 0000000..62de812
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/revhw_1.c
@@ -0,0 +1,127 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+
+#define PERM0(B) B + 1, B
+#define PERM1(B) PERM0 (B), PERM0 (B + 2)
+#define PERM2(B) PERM1 (B), PERM1 (B + 4)
+#define PERM3(B) PERM2 (B), PERM2 (B + 8)
+#define PERM4(B) PERM3 (B), PERM3 (B + 16)
+#define PERM5(B) PERM4 (B), PERM4 (B + 32)
+#define PERM6(B) PERM5 (B), PERM5 (B + 64)
+
+/*
+** qi_revh_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** revh (z[0-9]+)\.s, \1/m, \2\.s
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_revh_s (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+/*
+** qi_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_revw_d (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0) });
+}
+
+/*
+** hi_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_revw_d (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** hf_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_revw_d (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** bf_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_revw_d (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+#undef PERM1
+#define PERM1(B) PERM0 (B + 2), PERM0 (B)
+
+/*
+** qi_revh_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** revh (z[0-9]+)\.d, \1/m, \2\.d
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_revh_d (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+v64qi
+qi_revw_q (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0) });
+}
+
+v64hi
+hi_revw_q (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+#undef PERM2
+#define PERM2(B) PERM0 (B + 4), PERM0 (B)
+
+v128qi
+qi_revh_q (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+/* { dg-final { scan-assembler-times {\trev.\t} 6 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c b/gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c
new file mode 100644
index 0000000..7634d01
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c
@@ -0,0 +1,127 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mbig-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+
+#define PERM0(B) B + 1, B
+#define PERM1(B) PERM0 (B), PERM0 (B + 2)
+#define PERM2(B) PERM1 (B), PERM1 (B + 4)
+#define PERM3(B) PERM2 (B), PERM2 (B + 8)
+#define PERM4(B) PERM3 (B), PERM3 (B + 16)
+#define PERM5(B) PERM4 (B), PERM4 (B + 32)
+#define PERM6(B) PERM5 (B), PERM5 (B + 64)
+
+/*
+** qi_revh_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** revh (z[0-9]+)\.s, \1/m, \2\.s
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_revh_s (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+/*
+** qi_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_revw_d (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0) });
+}
+
+/*
+** hi_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_revw_d (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** hf_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_revw_d (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** bf_revw_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** revw (z[0-9]+)\.d, \1/m, \2\.d
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_revw_d (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+#undef PERM1
+#define PERM1(B) PERM0 (B + 2), PERM0 (B)
+
+/*
+** qi_revh_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** revh (z[0-9]+)\.d, \1/m, \2\.d
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_revh_d (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+v64qi
+qi_revw_q (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0) });
+}
+
+v64hi
+hi_revw_q (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+#undef PERM2
+#define PERM2(B) PERM0 (B + 4), PERM0 (B)
+
+v128qi
+qi_revh_q (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+/* { dg-final { scan-assembler-times {\trev.\t} 6 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/slp_perm_8.c b/gcc/testsuite/gcc.target/aarch64/sve/slp_perm_8.c
new file mode 100644
index 0000000..fe25000
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/slp_perm_8.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize" } */
+
+void
+f (short *restrict s, signed char *restrict c)
+{
+ for (int i = 0; i < 8; i += 2)
+ {
+ s[i] = c[i];
+ s[i + 1] = c[i];
+ }
+}
+
+/* Ideally this would use LD1SB, but currently we use LD1B and
+ sign-extend it after the permute. */
+/* { dg-final { scan-assembler {\tptrue\tp[0-7]\.h, vl6\n} } } */
+/* { dg-final { scan-assembler {\tld1s?b\tz[0-9]+\.h} } } */
+/* { dg-final { scan-assembler {\ttrn1\tz[0-9]+\.h,} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/trn1_2.c b/gcc/testsuite/gcc.target/aarch64/sve/trn1_2.c
new file mode 100644
index 0000000..df059dd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/trn1_2.c
@@ -0,0 +1,403 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B, C) B, B + C
+#define PERM1(B, C) PERM0 (B, C), PERM0 (B + 2, C)
+#define PERM2(B, C) PERM1 (B, C), PERM1 (B + 4, C)
+#define PERM3(B, C) PERM2 (B, C), PERM2 (B + 8, C)
+#define PERM4(B, C) PERM3 (B, C), PERM3 (B + 16, C)
+#define PERM5(B, C) PERM4 (B, C), PERM4 (B + 32, C)
+#define PERM6(B, C) PERM5 (B, C), PERM5 (B + 64, C)
+
+/*
+** qi_trn1_h_a:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_trn1_h_a (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0, 0) });
+}
+
+/*
+** qi_trn1_h_b:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_trn1_h_b (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0, 128) });
+}
+
+/*
+** qi_trn1_h_c:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_trn1_h_c (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (128, 0) });
+}
+
+/*
+** qi_trn1_h_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn1 \3\.h, \3\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** trn1 \4\.h, \4\.h, \5\.h
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_trn1_h_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (0, 128) });
+}
+
+/*
+** qi_trn1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_trn1_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0, 64) });
+}
+
+/*
+** qi_trn1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 \3\.s, \3\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** trn1 \4\.s, \4\.s, \5\.s
+** st1b \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64qi
+qi_trn1_s_two_op (v64qi x, v64qi y)
+{
+ return __builtin_shuffle (x, y, (v64qi) { PERM5 (0, 64) });
+}
+
+/*
+** qi_trn1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_trn1_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (0, 32) });
+}
+
+/*
+** qi_trn1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 \3\.d, \3\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** trn1 \4\.d, \4\.d, \5\.d
+** st1b \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32qi
+qi_trn1_d_two_op (v32qi x, v32qi y)
+{
+ return __builtin_shuffle (x, y, (v32qi) { PERM4 (0, 32) });
+}
+
+/*
+** hi_trn1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_trn1_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hi_trn1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** trn1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hi
+hi_trn1_s_two_op (v64hi x, v64hi y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hf_trn1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_trn1_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hf_trn1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** trn1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hf
+hf_trn1_s_two_op (v64hf x, v64hf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** bf_trn1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_trn1_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** bf_trn1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** trn1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64bf
+bf_trn1_s_two_op (v64bf x, v64bf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hi_trn1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_trn1_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** hi_trn1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** trn1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hi
+hi_trn1_d_two_op (v32hi x, v32hi y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** hf_trn1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_trn1_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** hf_trn1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** trn1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hf
+hf_trn1_d_two_op (v32hf x, v32hf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** bf_trn1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_trn1_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** bf_trn1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** trn1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32bf
+bf_trn1_d_two_op (v32bf x, v32bf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** si_trn1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_trn1_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (0, 32) });
+}
+
+/*
+** sf_trn1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** trn1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_trn1_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (0, 32) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/trn2_2.c b/gcc/testsuite/gcc.target/aarch64/sve/trn2_2.c
new file mode 100644
index 0000000..290ce8e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/trn2_2.c
@@ -0,0 +1,403 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B, C) B, B + C
+#define PERM1(B, C) PERM0 (B, C), PERM0 (B + 2, C)
+#define PERM2(B, C) PERM1 (B, C), PERM1 (B + 4, C)
+#define PERM3(B, C) PERM2 (B, C), PERM2 (B + 8, C)
+#define PERM4(B, C) PERM3 (B, C), PERM3 (B + 16, C)
+#define PERM5(B, C) PERM4 (B, C), PERM4 (B + 32, C)
+#define PERM6(B, C) PERM5 (B, C), PERM5 (B + 64, C)
+
+/*
+** qi_trn2_h_a:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_trn2_h_a (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (1, 0) });
+}
+
+/*
+** qi_trn2_h_b:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_trn2_h_b (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (1, 128) });
+}
+
+/*
+** qi_trn2_h_c:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_trn2_h_c (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (1, 0) });
+}
+
+/*
+** qi_trn2_h_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** trn2 \3\.h, \3\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** trn2 \4\.h, \4\.h, \5\.h
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_trn2_h_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (1, 128) });
+}
+
+/*
+** qi_trn2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_trn2_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (1, 64) });
+}
+
+/*
+** qi_trn2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 \3\.s, \3\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** trn2 \4\.s, \4\.s, \5\.s
+** st1b \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64qi
+qi_trn2_s_two_op (v64qi x, v64qi y)
+{
+ return __builtin_shuffle (x, y, (v64qi) { PERM5 (1, 64) });
+}
+
+/*
+** qi_trn2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_trn2_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (1, 32) });
+}
+
+/*
+** qi_trn2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 \3\.d, \3\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** trn2 \4\.d, \4\.d, \5\.d
+** st1b \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32qi
+qi_trn2_d_two_op (v32qi x, v32qi y)
+{
+ return __builtin_shuffle (x, y, (v32qi) { PERM4 (1, 32) });
+}
+
+/*
+** hi_trn2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_trn2_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1, 64) });
+}
+
+/*
+** hi_trn2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** trn2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hi
+hi_trn2_s_two_op (v64hi x, v64hi y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (1, 64) });
+}
+
+/*
+** hf_trn2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_trn2_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1, 64) });
+}
+
+/*
+** hf_trn2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** trn2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hf
+hf_trn2_s_two_op (v64hf x, v64hf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (1, 64) });
+}
+
+/*
+** bf_trn2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_trn2_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1, 64) });
+}
+
+/*
+** bf_trn2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** trn2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** trn2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64bf
+bf_trn2_s_two_op (v64bf x, v64bf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (1, 64) });
+}
+
+/*
+** hi_trn2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_trn2_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1, 32) });
+}
+
+/*
+** hi_trn2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** trn2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hi
+hi_trn2_d_two_op (v32hi x, v32hi y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (1, 32) });
+}
+
+/*
+** hf_trn2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_trn2_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1, 32) });
+}
+
+/*
+** hf_trn2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** trn2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hf
+hf_trn2_d_two_op (v32hf x, v32hf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (1, 32) });
+}
+
+/*
+** bf_trn2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_trn2_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1, 32) });
+}
+
+/*
+** bf_trn2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** trn2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32bf
+bf_trn2_d_two_op (v32bf x, v32bf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (1, 32) });
+}
+
+/*
+** si_trn2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_trn2_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1, 32) });
+}
+
+/*
+** sf_trn2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** trn2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_trn2_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1, 32) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/uzp1_2.c b/gcc/testsuite/gcc.target/aarch64/sve/uzp1_2.c
new file mode 100644
index 0000000..e2f2692
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/uzp1_2.c
@@ -0,0 +1,375 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B) B, B + 2
+#define PERM1(B) PERM0 (B), PERM0 (B + 4)
+#define PERM2(B) PERM1 (B), PERM1 (B + 8)
+#define PERM3(B) PERM2 (B), PERM2 (B + 16)
+#define PERM4(B) PERM3 (B), PERM3 (B + 32)
+#define PERM5(B) PERM4 (B), PERM4 (B + 64)
+#define PERM6(B) PERM5 (B), PERM5 (B + 128)
+
+/*
+** qi_uzp1_h:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_uzp1_h (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0) });
+}
+
+/*
+** qi_uzp1_h_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** uzp1 \3\.h, \3\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** uzp1 \4\.h, \4\.h, \5\.h
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_uzp1_h_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (0) });
+}
+
+/*
+** qi_uzp1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_uzp1_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0) });
+}
+
+/*
+** qi_uzp1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 \3\.s, \3\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp1 \4\.s, \4\.s, \5\.s
+** st1b \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64qi
+qi_uzp1_s_two_op (v64qi x, v64qi y)
+{
+ return __builtin_shuffle (x, y, (v64qi) { PERM5 (0) });
+}
+
+/*
+** qi_uzp1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_uzp1_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (0) });
+}
+
+/*
+** qi_uzp1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 \3\.d, \3\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp1 \4\.d, \4\.d, \5\.d
+** st1b \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32qi
+qi_uzp1_d_two_op (v32qi x, v32qi y)
+{
+ return __builtin_shuffle (x, y, (v32qi) { PERM4 (0) });
+}
+
+/*
+** hi_uzp1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_uzp1_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** hi_uzp1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hi
+hi_uzp1_s_two_op (v64hi x, v64hi y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0) });
+}
+
+/*
+** hf_uzp1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_uzp1_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** hf_uzp1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hf
+hf_uzp1_s_two_op (v64hf x, v64hf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0) });
+}
+
+/*
+** bf_uzp1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_uzp1_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0) });
+}
+
+/*
+** bf_uzp1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64bf
+bf_uzp1_s_two_op (v64bf x, v64bf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0) });
+}
+
+/*
+** hi_uzp1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_uzp1_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0) });
+}
+
+/*
+** hi_uzp1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hi
+hi_uzp1_d_two_op (v32hi x, v32hi y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0) });
+}
+
+/*
+** hf_uzp1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_uzp1_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0) });
+}
+
+/*
+** hf_uzp1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hf
+hf_uzp1_d_two_op (v32hf x, v32hf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0) });
+}
+
+/*
+** bf_uzp1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_uzp1_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0) });
+}
+
+/*
+** bf_uzp1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32bf
+bf_uzp1_d_two_op (v32bf x, v32bf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0) });
+}
+
+/*
+** si_uzp1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_uzp1_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (0) });
+}
+
+/*
+** sf_uzp1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_uzp1_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (0) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/uzp2_2.c b/gcc/testsuite/gcc.target/aarch64/sve/uzp2_2.c
new file mode 100644
index 0000000..0d8eda5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/uzp2_2.c
@@ -0,0 +1,375 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B) B, B + 2
+#define PERM1(B) PERM0 (B), PERM0 (B + 4)
+#define PERM2(B) PERM1 (B), PERM1 (B + 8)
+#define PERM3(B) PERM2 (B), PERM2 (B + 16)
+#define PERM4(B) PERM3 (B), PERM3 (B + 32)
+#define PERM5(B) PERM4 (B), PERM4 (B + 64)
+#define PERM6(B) PERM5 (B), PERM5 (B + 128)
+
+/*
+** qi_uzp2_h:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_uzp2_h (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (1) });
+}
+
+/*
+** qi_uzp2_h_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** uzp2 \3\.h, \3\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** uzp2 \4\.h, \4\.h, \5\.h
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_uzp2_h_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (1) });
+}
+
+/*
+** qi_uzp2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_uzp2_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (1) });
+}
+
+/*
+** qi_uzp2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 \3\.s, \3\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp2 \4\.s, \4\.s, \5\.s
+** st1b \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64qi
+qi_uzp2_s_two_op (v64qi x, v64qi y)
+{
+ return __builtin_shuffle (x, y, (v64qi) { PERM5 (1) });
+}
+
+/*
+** qi_uzp2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_uzp2_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (1) });
+}
+
+/*
+** qi_uzp2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 \3\.d, \3\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp2 \4\.d, \4\.d, \5\.d
+** st1b \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32qi
+qi_uzp2_d_two_op (v32qi x, v32qi y)
+{
+ return __builtin_shuffle (x, y, (v32qi) { PERM4 (1) });
+}
+
+/*
+** hi_uzp2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_uzp2_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hi_uzp2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hi
+hi_uzp2_s_two_op (v64hi x, v64hi y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hf_uzp2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_uzp2_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hf_uzp2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hf
+hf_uzp2_s_two_op (v64hf x, v64hf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (1) });
+}
+
+/*
+** bf_uzp2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_uzp2_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (1) });
+}
+
+/*
+** bf_uzp2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** uzp2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** uzp2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64bf
+bf_uzp2_s_two_op (v64bf x, v64bf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (1) });
+}
+
+/*
+** hi_uzp2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_uzp2_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hi_uzp2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hi
+hi_uzp2_d_two_op (v32hi x, v32hi y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hf_uzp2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_uzp2_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** hf_uzp2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hf
+hf_uzp2_d_two_op (v32hf x, v32hf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (1) });
+}
+
+/*
+** bf_uzp2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_uzp2_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (1) });
+}
+
+/*
+** bf_uzp2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** uzp2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32bf
+bf_uzp2_d_two_op (v32bf x, v32bf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (1) });
+}
+
+/*
+** si_uzp2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_uzp2_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1) });
+}
+
+/*
+** sf_uzp2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** uzp2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_uzp2_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (1) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/zip1_2.c b/gcc/testsuite/gcc.target/aarch64/sve/zip1_2.c
new file mode 100644
index 0000000..395b96f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/zip1_2.c
@@ -0,0 +1,403 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B, C) B, B + C
+#define PERM1(B, C) PERM0 (B, C), PERM0 (B + 1, C)
+#define PERM2(B, C) PERM1 (B, C), PERM1 (B + 2, C)
+#define PERM3(B, C) PERM2 (B, C), PERM2 (B + 4, C)
+#define PERM4(B, C) PERM3 (B, C), PERM3 (B + 8, C)
+#define PERM5(B, C) PERM4 (B, C), PERM4 (B + 16, C)
+#define PERM6(B, C) PERM5 (B, C), PERM5 (B + 32, C)
+
+/*
+** qi_zip1_h_a:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_zip1_h_a (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0, 0) });
+}
+
+/*
+** qi_zip1_h_b:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_zip1_h_b (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (0, 128) });
+}
+
+/*
+** qi_zip1_h_c:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_zip1_h_c (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (128, 0) });
+}
+
+/*
+** qi_zip1_h_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip1 \3\.h, \3\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** zip1 \4\.h, \4\.h, \5\.h
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_zip1_h_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (0, 128) });
+}
+
+/*
+** qi_zip1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_zip1_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (0, 64) });
+}
+
+/*
+** qi_zip1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 \3\.s, \3\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** zip1 \4\.s, \4\.s, \5\.s
+** st1b \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64qi
+qi_zip1_s_two_op (v64qi x, v64qi y)
+{
+ return __builtin_shuffle (x, y, (v64qi) { PERM5 (0, 64) });
+}
+
+/*
+** qi_zip1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_zip1_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (0, 32) });
+}
+
+/*
+** qi_zip1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 \3\.d, \3\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** zip1 \4\.d, \4\.d, \5\.d
+** st1b \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32qi
+qi_zip1_d_two_op (v32qi x, v32qi y)
+{
+ return __builtin_shuffle (x, y, (v32qi) { PERM4 (0, 32) });
+}
+
+/*
+** hi_zip1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_zip1_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hi_zip1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** zip1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hi
+hi_zip1_s_two_op (v64hi x, v64hi y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hf_zip1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_zip1_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hf_zip1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** zip1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hf
+hf_zip1_s_two_op (v64hf x, v64hf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** bf_zip1_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_zip1_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** bf_zip1_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip1 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** zip1 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64bf
+bf_zip1_s_two_op (v64bf x, v64bf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (0, 64) });
+}
+
+/*
+** hi_zip1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_zip1_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** hi_zip1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** zip1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hi
+hi_zip1_d_two_op (v32hi x, v32hi y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** hf_zip1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_zip1_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** hf_zip1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** zip1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hf
+hf_zip1_d_two_op (v32hf x, v32hf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** bf_zip1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_zip1_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** bf_zip1_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** zip1 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32bf
+bf_zip1_d_two_op (v32bf x, v32bf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (0, 32) });
+}
+
+/*
+** si_zip1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_zip1_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (0, 32) });
+}
+
+/*
+** sf_zip1_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** zip1 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_zip1_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (0, 32) });
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/zip2_2.c b/gcc/testsuite/gcc.target/aarch64/sve/zip2_2.c
new file mode 100644
index 0000000..9158ace
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/zip2_2.c
@@ -0,0 +1,403 @@
+/* { dg-do assemble { target aarch64_asm_sve_ok } } */
+/* { dg-options "-O -msve-vector-bits=2048 -mlittle-endian --save-temps" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+typedef unsigned char v128qi __attribute__((vector_size(128)));
+typedef unsigned char v64qi __attribute__((vector_size(64)));
+typedef unsigned char v32qi __attribute__((vector_size(32)));
+typedef unsigned short v64hi __attribute__((vector_size(128)));
+typedef unsigned short v32hi __attribute__((vector_size(64)));
+typedef _Float16 v64hf __attribute__((vector_size(128)));
+typedef _Float16 v32hf __attribute__((vector_size(64)));
+typedef __bf16 v64bf __attribute__((vector_size(128)));
+typedef __bf16 v32bf __attribute__((vector_size(64)));
+typedef unsigned int v32si __attribute__((vector_size(128)));
+typedef float v32sf __attribute__((vector_size(128)));
+
+#define PERM0(B, C) B, B + C
+#define PERM1(B, C) PERM0 (B, C), PERM0 (B + 1, C)
+#define PERM2(B, C) PERM1 (B, C), PERM1 (B + 2, C)
+#define PERM3(B, C) PERM2 (B, C), PERM2 (B + 4, C)
+#define PERM4(B, C) PERM3 (B, C), PERM3 (B + 8, C)
+#define PERM5(B, C) PERM4 (B, C), PERM4 (B + 16, C)
+#define PERM6(B, C) PERM5 (B, C), PERM5 (B + 32, C)
+
+/*
+** qi_zip2_h_a:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_zip2_h_a (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (64, 128) });
+}
+
+/*
+** qi_zip2_h_b:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_zip2_h_b (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (64, 128) });
+}
+
+/*
+** qi_zip2_h_c:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.h, \2\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** ret
+*/
+v128qi
+qi_zip2_h_c (v128qi x)
+{
+ return __builtin_shuffle (x, x, (v128qi) { PERM6 (192, 0) });
+}
+
+/*
+** qi_zip2_h_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** zip2 \3\.h, \3\.h, \2\.h
+** st1b \3\.h, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.h, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.h, \1/z, \[x1\]
+** zip2 \4\.h, \4\.h, \5\.h
+** st1b \4\.h, \1, \[x8\]
+** )
+** ret
+*/
+v128qi
+qi_zip2_h_two_op (v128qi x, v128qi y)
+{
+ return __builtin_shuffle (x, y, (v128qi) { PERM6 (64, 128) });
+}
+
+/*
+** qi_zip2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** ret
+*/
+v64qi
+qi_zip2_s (v64qi x)
+{
+ return __builtin_shuffle (x, x, (v64qi) { PERM5 (32, 64) });
+}
+
+/*
+** qi_zip2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 \3\.s, \3\.s, \2\.s
+** st1b \3\.s, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.s, \1/z, \[x1\]
+** zip2 \4\.s, \4\.s, \5\.s
+** st1b \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64qi
+qi_zip2_s_two_op (v64qi x, v64qi y)
+{
+ return __builtin_shuffle (x, y, (v64qi) { PERM5 (32, 64) });
+}
+
+/*
+** qi_zip2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** ret
+*/
+v32qi
+qi_zip2_d (v32qi x)
+{
+ return __builtin_shuffle (x, x, (v32qi) { PERM4 (16, 32) });
+}
+
+/*
+** qi_zip2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 \3\.d, \3\.d, \2\.d
+** st1b \3\.d, \1, \[x8\]
+** |
+** ld1b (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1b (z[0-9]+)\.d, \1/z, \[x1\]
+** zip2 \4\.d, \4\.d, \5\.d
+** st1b \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32qi
+qi_zip2_d_two_op (v32qi x, v32qi y)
+{
+ return __builtin_shuffle (x, y, (v32qi) { PERM4 (16, 32) });
+}
+
+/*
+** hi_zip2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hi
+hi_zip2_s (v64hi x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (32, 64) });
+}
+
+/*
+** hi_zip2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** zip2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hi
+hi_zip2_s_two_op (v64hi x, v64hi y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (32, 64) });
+}
+
+/*
+** hf_zip2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64hf
+hf_zip2_s (v64hf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (32, 64) });
+}
+
+/*
+** hf_zip2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** zip2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64hf
+hf_zip2_s_two_op (v64hf x, v64hf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (32, 64) });
+}
+
+/*
+** bf_zip2_s:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.s, \2\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** ret
+*/
+v64bf
+bf_zip2_s (v64bf x)
+{
+ return __builtin_shuffle (x, x, (v64hi) { PERM5 (32, 64) });
+}
+
+/*
+** bf_zip2_s_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** zip2 \3\.s, \3\.s, \2\.s
+** st1h \3\.s, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.s, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.s, \1/z, \[x1\]
+** zip2 \4\.s, \4\.s, \5\.s
+** st1h \4\.s, \1, \[x8\]
+** )
+** ret
+*/
+v64bf
+bf_zip2_s_two_op (v64bf x, v64bf y)
+{
+ return __builtin_shuffle (x, y, (v64hi) { PERM5 (32, 64) });
+}
+
+/*
+** hi_zip2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hi
+hi_zip2_d (v32hi x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (16, 32) });
+}
+
+/*
+** hi_zip2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** zip2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hi
+hi_zip2_d_two_op (v32hi x, v32hi y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (16, 32) });
+}
+
+/*
+** hf_zip2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32hf
+hf_zip2_d (v32hf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (16, 32) });
+}
+
+/*
+** hf_zip2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** zip2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32hf
+hf_zip2_d_two_op (v32hf x, v32hf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (16, 32) });
+}
+
+/*
+** bf_zip2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** ret
+*/
+v32bf
+bf_zip2_d (v32bf x)
+{
+ return __builtin_shuffle (x, x, (v32hi) { PERM4 (16, 32) });
+}
+
+/*
+** bf_zip2_d_two_op:
+** ptrue (p[0-7])\.b, vl256
+** (
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 \3\.d, \3\.d, \2\.d
+** st1h \3\.d, \1, \[x8\]
+** |
+** ld1h (z[0-9]+)\.d, \1/z, \[x0\]
+** ld1h (z[0-9]+)\.d, \1/z, \[x1\]
+** zip2 \4\.d, \4\.d, \5\.d
+** st1h \4\.d, \1, \[x8\]
+** )
+** ret
+*/
+v32bf
+bf_zip2_d_two_op (v32bf x, v32bf y)
+{
+ return __builtin_shuffle (x, y, (v32hi) { PERM4 (16, 32) });
+}
+
+/*
+** si_zip2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32si
+si_zip2_d (v32si x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (16, 32) });
+}
+
+/*
+** sf_zip2_d:
+** ptrue (p[0-7])\.b, vl256
+** ld1w (z[0-9]+)\.d, \1/z, \[x0\]
+** zip2 (z[0-9]+)\.d, \2\.d, \2\.d
+** st1w \3\.d, \1, \[x8\]
+** ret
+*/
+v32sf
+sf_zip2_d (v32sf x)
+{
+ return __builtin_shuffle (x, x, (v32si) { PERM4 (16, 32) });
+}
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/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/pure-code/no-literal-pool-m0.c b/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool-m0.c
new file mode 100644
index 0000000..bd6f4af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool-m0.c
@@ -0,0 +1,176 @@
+/* { dg-do compile } */
+/* { dg-skip-if "skip override" { *-*-* } { "-mfloat-abi=hard" } { "" } } */
+/* { dg-options "-mpure-code -mcpu=cortex-m0 -march=armv6s-m -mthumb -mfloat-abi=soft" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/* Does not use thumb1_gen_const_int.
+** test_0:
+** ...
+** movs r[0-3], #0
+** ...
+*/
+int
+test_0 ()
+{
+ return 0;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_128:
+** ...
+** movs r[0-3], #128
+** ...
+*/
+int
+test_128 ()
+{
+ return 128;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_264:
+** ...
+** movs r[0-3], #132
+** lsls r[0-3], r[0-3], #1
+** ...
+*/
+int
+test_264 ()
+{
+ return 264;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_510:
+** ...
+** movs r[0-3], #255
+** lsls r[0-3], r[0-3], #1
+** ...
+*/
+int
+test_510 ()
+{
+ return 510;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_512:
+** ...
+** movs r[0-3], #128
+** lsls r[0-3], r[0-3], #2
+** ...
+*/
+int
+test_512 ()
+{
+ return 512;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_764:
+** ...
+** movs r[0-3], #191
+** lsls r[0-3], r[0-3], #2
+** ...
+*/
+int
+test_764 ()
+{
+ return 764;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_65536:
+** ...
+** movs r[0-3], #128
+** lsls r[0-3], r[0-3], #9
+** ...
+*/
+int
+test_65536 ()
+{
+ return 65536;
+}
+
+/*
+** test_0x123456:
+** ...
+** movs r[0-3], #18
+** lsls r[0-3], r[0-3], #8
+** adds r[0-3], r[0-3], #52
+** lsls r[0-3], r[0-3], #8
+** adds r[0-3], r[0-3], #86
+** ...
+*/
+int
+test_0x123456 ()
+{
+ return 0x123456;
+}
+
+/*
+** test_0x1123456:
+** ...
+** movs r[0-3], #137
+** lsls r[0-3], r[0-3], #8
+** adds r[0-3], r[0-3], #26
+** lsls r[0-3], r[0-3], #8
+** adds r[0-3], r[0-3], #43
+** lsls r[0-3], r[0-3], #1
+** ...
+*/
+int
+test_0x1123456 ()
+{
+ return 0x1123456;
+}
+
+/* With -Os, we generate:
+ movs r0, #16
+ lsls r0, r0, r0
+ With the other optimization levels, we generate:
+ movs r0, #16
+ lsls r0, r0, #16
+ hence the two alternatives. */
+/*
+** test_0x1000010:
+** ...
+** movs r[0-3], #16
+** lsls r[0-3], r[0-3], (#16|r[0-3])
+** adds r[0-3], r[0-3], #1
+** lsls r[0-3], r[0-3], #4
+** ...
+*/
+int
+test_0x1000010 ()
+{
+ return 0x1000010;
+}
+
+/*
+** test_0x1000011:
+** ...
+** movs r[0-3], #1
+** lsls r[0-3], r[0-3], #24
+** adds r[0-3], r[0-3], #17
+** ...
+*/
+int
+test_0x1000011 ()
+{
+ return 0x1000011;
+}
+
+/*
+** test_m8192:
+** ...
+** movs r[0-3], #1
+** lsls r[0-3], r[0-3], #13
+** rsbs r[0-3], r[0-3], #0
+** ...
+*/
+int
+test_m8192 ()
+{
+ return -8192;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool-m23.c b/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool-m23.c
new file mode 100644
index 0000000..9537012
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pure-code/no-literal-pool-m23.c
@@ -0,0 +1,172 @@
+/* { dg-do compile } */
+/* { dg-skip-if "skip override" { *-*-* } { "-mfloat-abi=hard" } { "" } } */
+/* { dg-options "-mpure-code -mcpu=cortex-m23 -march=armv8-m.base -mthumb -mfloat-abi=soft" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+/*
+** testi:
+** ...
+** movs r[0-3], #1
+** lsls r[0-3], #13
+** rsbs r[0-3], #0
+** ...
+*/
+int
+testi (int *p)
+{
+ if (*p > 0x12345678)
+ return *p-8192;
+ else
+ return *p+8192;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_0:
+** ...
+** movs r[0-3], #0
+** ...
+*/
+int
+test_0 ()
+{
+ return 0;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_128:
+** ...
+** movs r[0-3], #128
+** ...
+*/
+int
+test_128 ()
+{
+ return 128;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_264:
+** ...
+** movw r[0-3], #264
+** ...
+*/
+int
+test_264 ()
+{
+ return 264;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_510:
+** ...
+** movw r[0-3], #510
+** ...
+*/
+int
+test_510 ()
+{
+ return 510;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_512:
+** ...
+** movw r[0-3], #512
+** ...
+*/
+int
+test_512 ()
+{
+ return 512;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_764:
+** ...
+** movw r[0-3], #764
+** ...
+*/
+int
+test_764 ()
+{
+ return 764;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_65536:
+** ...
+** movs r[0-3], #128
+** lsls r[0-3], r[0-3], #9
+** ...
+*/
+int
+test_65536 ()
+{
+ return 65536;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_0x123456:
+** ...
+** movw r[0-3], #13398
+** movt r[0-3], 18
+** ...
+*/
+int
+test_0x123456 ()
+{
+ return 0x123456;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_0x1123456:
+** ...
+** movw r[0-3], #13398
+** movt r[0-3], 274
+** ...
+*/
+int
+test_0x1123456 ()
+{
+ return 0x1123456;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_0x1000010:
+** ...
+** movs r[0-3], #16
+** movt r[0-3], 256
+** ...
+*/
+int
+test_0x1000010 ()
+{
+ return 0x1000010;
+}
+
+/* Does not use thumb1_gen_const_int.
+** test_0x1000011:
+** ...
+** movs r[0-3], #17
+** movt r[0-3], 256
+** ...
+*/
+int
+test_0x1000011 ()
+{
+ return 0x1000011;
+}
+
+/*
+** test_m8192:
+** ...
+** movs r[0-3], #1
+** lsls r[0-3], #13
+** rsbs r[0-3], #0
+** ...
+*/
+int
+test_m8192 ()
+{
+ return -8192;
+}
diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr96767.c b/gcc/testsuite/gcc.target/arm/pure-code/pr96767.c
new file mode 100644
index 0000000..cb3ee68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pure-code/pr96767.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-mpure-code" } */
+
+int x;
+int f1 (void) { return x; }
+
+/* We expect only one indirect load like ldr r3, [r3]. In some
+ configurations there is an additional ldr rX, [sp], #4 which is not
+ related to what we check here, so make sure not to match it. */
+/* { dg-final { scan-assembler-times "ldr\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 1 } } */
diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
new file mode 100644
index 0000000..a43d71f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-mpure-code" } */
+
+int arr[1000];
+int *f4 (void) { return &arr[1]; }
+
+/* For cortex-m0 (thumb-1/v6m), we generate 4 movs with upper/lower:#arr+4. */
+/* { dg-final { scan-assembler-times "\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
+
+/* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we
+ generate a movt/movw pair with upper/lower:#arr+4. */
+/* { dg-final { scan-assembler-times "\\+4" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+
+int *f5 (void) { return &arr[80]; }
+
+/* For cortex-m0 (thumb-1/v6m), we generate 1 ldr from rodata pointer to arr+320. */
+/* { dg-final { scan-assembler-times "\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
+
+/* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we
+ generate a movt/movw pair with upper/lower:arr+320. */
+/* { dg-final { scan-assembler-times "\\+320" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
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/simd/vld1_bf16_1.c b/gcc/testsuite/gcc.target/arm/simd/vld1_bf16_1.c
new file mode 100644
index 0000000..b6b00dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vld1_bf16_1.c
@@ -0,0 +1,29 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "arm_neon.h"
+
+/*
+**test_vld1_bf16:
+** vld1.16 {d0}, \[r0\]
+** bx lr
+*/
+bfloat16x4_t
+test_vld1_bf16 (bfloat16_t const *p)
+{
+ return vld1_bf16 (p);
+}
+
+/*
+**test_vld1q_bf16:
+** vld1.16 {d0-d1}, \[r0\]
+** bx lr
+*/
+bfloat16x8_t
+test_vld1q_bf16 (bfloat16_t const *p)
+{
+ return vld1q_bf16 (p);
+}
diff --git a/gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_1.c b/gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_1.c
new file mode 100644
index 0000000..94fb38f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_1.c
@@ -0,0 +1,22 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-O3 --save-temps -mfloat-abi=hard" } */
+
+#include "arm_neon.h"
+
+bfloat16x4_t
+test_vld1_lane_bf16 (bfloat16_t *a, bfloat16x4_t b)
+{
+ return vld1_lane_bf16 (a, b, 1);
+}
+
+bfloat16x8_t
+test_vld1q_lane_bf16 (bfloat16_t *a, bfloat16x8_t b)
+{
+ return vld1q_lane_bf16 (a, b, 2);
+}
+
+/* { dg-final { scan-assembler "vld1.16\t{d0\\\[1\\\]}, \\\[r0\\\]" } } */
+/* { dg-final { scan-assembler "vld1.16\t{d0\\\[2\\\]}, \\\[r0\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_indices_1.c
new file mode 100644
index 0000000..d9af512
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vld1_lane_bf16_indices_1.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
+
+#include "arm_neon.h"
+
+bfloat16x4_t
+test_vld1_lane_bf16 (bfloat16_t *a, bfloat16x4_t b)
+{
+ bfloat16x4_t res;
+ res = vld1_lane_bf16 (a, b, -1);
+ res = vld1_lane_bf16 (a, b, 4);
+ return res;
+}
+
+/* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+/* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c
new file mode 100644
index 0000000..a73184c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vld1q_lane_bf16_indices_1.c
@@ -0,0 +1,19 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
+
+#include "arm_neon.h"
+
+bfloat16x8_t
+test_vld1q_lane_bf16 (bfloat16_t *a, bfloat16x8_t b)
+{
+ bfloat16x8_t res;
+ res = vld1q_lane_bf16 (a, b, -1);
+ res = vld1q_lane_bf16 (a, b, 8);
+ return res;
+}
+
+/* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+/* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/vldn_lane_bf16_1.c b/gcc/testsuite/gcc.target/arm/simd/vldn_lane_bf16_1.c
new file mode 100644
index 0000000..58153ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vldn_lane_bf16_1.c
@@ -0,0 +1,73 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "arm_neon.h"
+
+/*
+**test_vld2_lane_bf16:
+** vld2.16 {d0\[2\], d1\[2\]}, \[r0\]
+** bx lr
+*/
+bfloat16x4x2_t
+test_vld2_lane_bf16 (const bfloat16_t *a, bfloat16x4x2_t b)
+{
+ return vld2_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vld2q_lane_bf16:
+** vld2.16 {d0\[2\], d2\[2\]}, \[r0\]
+** bx lr
+*/
+bfloat16x8x2_t
+test_vld2q_lane_bf16 (const bfloat16_t *a, bfloat16x8x2_t b)
+{
+ return vld2q_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vld3_lane_bf16:
+** vld3.16 {d0\[2\], d1\[2\], d2\[2\]}, \[r0\]
+** bx lr
+*/
+bfloat16x4x3_t
+test_vld3_lane_bf16 (const bfloat16_t *a, bfloat16x4x3_t b)
+{
+ return vld3_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vld3q_lane_bf16:
+** vld3.16 {d0\[2\], d2\[2\], d4\[2\]}, \[r0\]
+** bx lr
+*/
+bfloat16x8x3_t
+test_vld3q_lane_bf16 (const bfloat16_t *a, bfloat16x8x3_t b)
+{
+ return vld3q_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vld4_lane_bf16:
+** vld4.16 {d0\[2\], d1\[2\], d2\[2\], d3\[2\]}, \[r0\]
+** bx lr
+*/
+bfloat16x4x4_t
+test_vld4_lane_bf16 (const bfloat16_t *a, bfloat16x4x4_t b)
+{
+ return vld4_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vld4q_lane_bf16:
+** vld4.16 {d0\[2\], d2\[2\], d4\[2\], d6\[2\]}, \[r0\]
+** bx lr
+*/
+bfloat16x8x4_t
+test_vld4q_lane_bf16 (const bfloat16_t *a, bfloat16x8x4_t b)
+{
+ return vld4q_lane_bf16 (a, b, 2);
+}
diff --git a/gcc/testsuite/gcc.target/arm/simd/vst1_bf16_1.c b/gcc/testsuite/gcc.target/arm/simd/vst1_bf16_1.c
new file mode 100644
index 0000000..06fb58e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vst1_bf16_1.c
@@ -0,0 +1,29 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "arm_neon.h"
+
+/*
+**test_vst1_bf16:
+** vst1.16 {d0}, \[r0\]
+** bx lr
+*/
+void
+test_vst1_bf16 (bfloat16_t *a, bfloat16x4_t b)
+{
+ vst1_bf16 (a, b);
+}
+
+/*
+**test_vst1q_bf16:
+** vst1.16 {d0-d1}, \[r0\]
+** bx lr
+*/
+void
+test_vst1q_bf16 (bfloat16_t *a, bfloat16x8_t b)
+{
+ vst1q_bf16 (a, b);
+}
diff --git a/gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_1.c b/gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_1.c
new file mode 100644
index 0000000..8564b8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_1.c
@@ -0,0 +1,22 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-O3 --save-temps -mfloat-abi=hard" } */
+
+#include "arm_neon.h"
+
+void
+test_vst1_lane_bf16 (bfloat16_t *a, bfloat16x4_t b)
+{
+ vst1_lane_bf16 (a, b, 1);
+}
+
+void
+test_vst1q_lane_bf16 (bfloat16_t *a, bfloat16x8_t b)
+{
+ vst1q_lane_bf16 (a, b, 2);
+}
+
+/* { dg-final { scan-assembler "vst1.16\t{d0\\\[1\\\]}, \\\[r0\\\]" } } */
+/* { dg-final { scan-assembler "vst1.16\t{d0\\\[2\\\]}, \\\[r0\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_indices_1.c
new file mode 100644
index 0000000..1bd6871
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vst1_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
+
+#include "arm_neon.h"
+
+void
+test_vst1_lane_bf16 (bfloat16_t *a, bfloat16x4_t b)
+{
+ vst1_lane_bf16 (a, b, -1);
+ vst1_lane_bf16 (a, b, 4);
+}
+
+/* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */
+/* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/arm/simd/vstn_lane_bf16_1.c b/gcc/testsuite/gcc.target/arm/simd/vstn_lane_bf16_1.c
new file mode 100644
index 0000000..416ae77
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vstn_lane_bf16_1.c
@@ -0,0 +1,73 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-save-temps -O2 -mfloat-abi=hard" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include "arm_neon.h"
+
+/*
+**test_vst2_lane_bf16:
+** vst2.16 {d0\[2\], d1\[2\]}, \[r0\]
+** bx lr
+*/
+void
+test_vst2_lane_bf16 (bfloat16_t *a, bfloat16x4x2_t b)
+{
+ return vst2_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vst2q_lane_bf16:
+** vst2.16 {d0\[2\], d2\[2\]}, \[r0\]
+** bx lr
+*/
+void
+test_vst2q_lane_bf16 (bfloat16_t *a, bfloat16x8x2_t b)
+{
+ return vst2q_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vst3_lane_bf16:
+** vst3.16 {d0\[2\], d1\[2\], d2\[2\]}, \[r0\]
+** bx lr
+*/
+void
+test_vst3_lane_bf16 (bfloat16_t *a, bfloat16x4x3_t b)
+{
+ return vst3_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vst3q_lane_bf16:
+** vst3.16 {d0\[2\], d2\[2\], d4\[2\]}, \[r0\]
+** bx lr
+*/
+void
+test_vst3q_lane_bf16 (bfloat16_t *a, bfloat16x8x3_t b)
+{
+ return vst3q_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vst4_lane_bf16:
+** vst4.16 {d0\[2\], d1\[2\], d2\[2\], d3\[2\]}, \[r0\]
+** bx lr
+*/
+void
+test_vst4_lane_bf16 (bfloat16_t *a, bfloat16x4x4_t b)
+{
+ return vst4_lane_bf16 (a, b, 2);
+}
+
+/*
+**test_vst4q_lane_bf16:
+** vst4.16 {d0\[2\], d2\[2\], d4\[2\], d6\[2\]}, \[r0\]
+** bx lr
+*/
+void
+test_vst4q_lane_bf16 (bfloat16_t *a, bfloat16x8x4_t b)
+{
+ return vst4q_lane_bf16 (a, b, 2);
+}
diff --git a/gcc/testsuite/gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c b/gcc/testsuite/gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c
new file mode 100644
index 0000000..f18a479
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/vstq1_lane_bf16_indices_1.c
@@ -0,0 +1,17 @@
+/* { dg-do assemble } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-require-effective-target arm_hard_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mfloat-abi=hard" } */
+
+#include "arm_neon.h"
+
+void
+test_vstq1_lane_bf16 (bfloat16_t *a, bfloat16x8_t b)
+{
+ vst1q_lane_bf16 (a, b, -1);
+ vst1q_lane_bf16 (a, b, 8);
+}
+
+/* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */
+/* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-5.c b/gcc/testsuite/gcc.target/arm/stack-protector-5.c
index b808b11..ae70b99 100644
--- a/gcc/testsuite/gcc.target/arm/stack-protector-5.c
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fstack-protector-all -O2" } */
+/* { dg-options "-fstack-protector-all -Os" } */
void __attribute__ ((noipa))
f (void)
diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-6.c b/gcc/testsuite/gcc.target/arm/stack-protector-6.c
index f8eec87..2b7e6f7 100644
--- a/gcc/testsuite/gcc.target/arm/stack-protector-6.c
+++ b/gcc/testsuite/gcc.target/arm/stack-protector-6.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target fpic } */
-/* { dg-options "-fstack-protector-all -O2 -fpic" } */
+/* { dg-options "-fstack-protector-all -Os -fpic" } */
#include "stack-protector-5.c"
diff --git a/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c b/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c
index c2d6074..54194e1 100644
--- a/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c
+++ b/gcc/testsuite/gcc.target/i386/amxbf16-asmintel-1.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target masm_intel } */
/* { dg-options "-O2 -mamx-bf16 -masm=intel" } */
/* { dg-final { scan-assembler "tdpbf16ps\[ \\t]+\[^\n\]*%tmm1+\[^\n\]*%tmm2+\[^\n\]*%tmm3" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c b/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c
index bcfbb3f..f8c376a 100644
--- a/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c
+++ b/gcc/testsuite/gcc.target/i386/amxint8-asmintel-1.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target masm_intel } */
/* { 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" } } *
diff --git a/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c b/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c
index 88ef612..6c08fec 100644
--- a/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c
+++ b/gcc/testsuite/gcc.target/i386/amxtile-asmintel-1.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target masm_intel } */
/* { dg-options "-O2 -mamx-tile -masm=intel " } */
/* { dg-final { scan-assembler "ldtilecfg\[ \\t]" } } */
/* { dg-final { scan-assembler "sttilecfg\[ \\t]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/avx-1.c b/gcc/testsuite/gcc.target/i386/avx-1.c
index 2dbed1c..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)
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/builtin_thread_pointer.c b/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c
index 16a7ca4..09b704b 100644
--- a/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c
+++ b/gcc/testsuite/gcc.target/i386/builtin_thread_pointer.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target tls_native } */
/* { dg-options "-mtls-direct-seg-refs -O2 -masm=att" } */
int*
diff --git a/gcc/testsuite/gcc.target/i386/fentryname1.c b/gcc/testsuite/gcc.target/i386/fentryname1.c
index 1265342..a9d1c72 100644
--- a/gcc/testsuite/gcc.target/i386/fentryname1.c
+++ b/gcc/testsuite/gcc.target/i386/fentryname1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target mfentry } */
+/* { dg-require-profiling "-pg" } */
/* { dg-options "-pg -mfentry -mfentry-name=foo" } */
/* { dg-final { scan-assembler "call.*foo" } } */
/* { dg-final { scan-assembler "call.*bar" } } */
diff --git a/gcc/testsuite/gcc.target/i386/fentryname2.c b/gcc/testsuite/gcc.target/i386/fentryname2.c
index c51c5d1..13a43ec 100644
--- a/gcc/testsuite/gcc.target/i386/fentryname2.c
+++ b/gcc/testsuite/gcc.target/i386/fentryname2.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target mfentry } */
+/* { dg-require-profiling "-pg" } */
/* { dg-options "-pg -mfentry -mrecord-mcount -mfentry-section=foo" } */
/* { dg-final { scan-assembler "section.*foo" } } */
/* { dg-final { scan-assembler "section.*bar" } } */
diff --git a/gcc/testsuite/gcc.target/i386/fentryname3.c b/gcc/testsuite/gcc.target/i386/fentryname3.c
index 5688109..bd7c997 100644
--- a/gcc/testsuite/gcc.target/i386/fentryname3.c
+++ b/gcc/testsuite/gcc.target/i386/fentryname3.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target mfentry } */
+/* { dg-require-profiling "-pg" } */
/* { dg-options "-pg -mfentry" } */
/* { dg-final { scan-assembler "section.*__entry_loc" } } */
/* { dg-final { scan-assembler "0x0f, 0x1f, 0x44, 0x00, 0x00" } } */
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
index 8e669f1..b8e3b1f 100644
--- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc
+++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc
@@ -74,6 +74,10 @@ extern void test_avx512vp2intersect (void) __attribute__((__target__("avx512vp2i
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_keylocker (void) __attribute__((__target__("kl")));
+extern void test_widekl (void) __attribute__((__target__("widekl")));
extern void test_no_sgx (void) __attribute__((__target__("no-sgx")));
extern void test_no_avx5124fmaps(void) __attribute__((__target__("no-avx5124fmaps")));
@@ -149,6 +153,10 @@ extern void test_no_avx512vp2intersect (void) __attribute__((__target__("no-avx5
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_no_keylocker (void) __attribute__((__target__("no-kl")));
+extern void test_no_widekl (void) __attribute__((__target__("no-widekl")));
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/keylocker-aesdec128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c
new file mode 100644
index 0000000..d134612
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdec128kl.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "aesdec128kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+__m128i k1, k2;
+const char h1[48];
+
+unsigned char
+test_keylocker_1 (void)
+{
+ return _mm_aesdec128kl_u8 (&k1, k2, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c
new file mode 100644
index 0000000..34736d2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdec256kl.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "aesdec256kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+__m128i k1, k2;
+const char h1[48];
+
+unsigned char
+test_keylocker_3 (void)
+{
+ return _mm_aesdec256kl_u8 (&k1, k2, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c
new file mode 100644
index 0000000..d23cf4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide128kl.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-mwidekl -O2" } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*16\[^\\n\\r\]*, %xmm1" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*32\[^\\n\\r\]*, %xmm2" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*48\[^\\n\\r\]*, %xmm3" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*64\[^\\n\\r\]*, %xmm4" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*80\[^\\n\\r\]*, %xmm5" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
+/* { dg-final { scan-assembler "aesdecwide128kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm2,\[^\\n\\r\]*32\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm3,\[^\\n\\r\]*48\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm4,\[^\\n\\r\]*64\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+const char h1[48];
+const __m128i idata[8];
+__m128i odata[8];
+
+unsigned char
+test_keylocker_5 (void)
+{
+ return _mm_aesdecwide128kl_u8 (odata, idata, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c
new file mode 100644
index 0000000..44c3252
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesdecwide256kl.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-mwidekl -O2" } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*16\[^\\n\\r\]*, %xmm1" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*32\[^\\n\\r\]*, %xmm2" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*48\[^\\n\\r\]*, %xmm3" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*64\[^\\n\\r\]*, %xmm4" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*80\[^\\n\\r\]*, %xmm5" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
+/* { dg-final { scan-assembler "aesdecwide256kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm2,\[^\\n\\r\]*32\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm3,\[^\\n\\r\]*48\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm4,\[^\\n\\r\]*64\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+const char h1[48];
+const __m128i idata[8];
+__m128i odata[8];
+
+unsigned char
+test_keylocker_6 (void)
+{
+ return _mm_aesdecwide256kl_u8 (odata, idata, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c
new file mode 100644
index 0000000..9ff4836
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesenc128kl.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "aesenc128kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+__m128i k1, k2;
+const char h1[48];
+
+unsigned char
+test_keylocker_2 (void)
+{
+ return _mm_aesenc128kl_u8 (&k1, k2, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c
new file mode 100644
index 0000000..1c5e076
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesenc256kl.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "aesenc256kl\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+__m128i k1, k2;
+const char h1[48];
+
+unsigned char
+test_keylocker_4 (void)
+{
+ return _mm_aesenc256kl_u8 (&k1, k2, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c
new file mode 100644
index 0000000..9fb9c49
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide128kl.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-options "-mwidekl -O2" } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*16\[^\\n\\r\]*, %xmm1" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*32\[^\\n\\r\]*, %xmm2" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*48\[^\\n\\r\]*, %xmm3" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*64\[^\\n\\r\]*, %xmm4" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*80\[^\\n\\r\]*, %xmm5" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
+/* { dg-final { scan-assembler "aesencwide128kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm2,\[^\\n\\r\]*32\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm3,\[^\\n\\r\]*48\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm4,\[^\\n\\r\]*64\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+const char h1[48];
+const __m128i idata[8];
+__m128i odata[8];
+
+unsigned char
+test_keylocker_7 (void)
+{
+ return _mm_aesencwide128kl_u8 (odata, idata, h1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c
new file mode 100644
index 0000000..125a787
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-aesencwide256kl.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-mwidekl -O2" } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*16\[^\\n\\r\]*, %xmm1" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*32\[^\\n\\r\]*, %xmm2" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*48\[^\\n\\r\]*, %xmm3" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*64\[^\\n\\r\]*, %xmm4" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*80\[^\\n\\r\]*, %xmm5" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*96\[^\\n\\r\]*, %xmm6" } } */
+/* { dg-final { scan-assembler "movdqu\[ \\t\]+\[^\\n\\r\]*112\[^\\n\\r\]*, %xmm7" } } */
+/* { dg-final { scan-assembler "aesencwide256kl\[ \\t\]+\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "sete" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm2,\[^\\n\\r\]*32\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm3,\[^\\n\\r\]*48\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm4,\[^\\n\\r\]*64\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm5,\[^\\n\\r\]*80\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm6,\[^\\n\\r\]*96\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\\r\]*%xmm7,\[^\\n\\r\]*112\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+const char h1[48];
+const __m128i idata[8];
+__m128i odata[8];
+
+unsigned char
+test_keylocker_8 (void)
+{
+ return _mm_aesencwide256kl_u8 (odata, idata, h1);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-encodekey128.c b/gcc/testsuite/gcc.target/i386/keylocker-encodekey128.c
new file mode 100644
index 0000000..805e062
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-encodekey128.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "movl\[ \\t\]+\[^\\n\\r\]*, %eax" } } */
+/* { dg-final { scan-assembler "encodekey128\[ \\t\]+\[^\\n\]*%eax\[^\\n\\r\]*%eax" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm2,\[^\\n\\r\]*32\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqa|movaps)\[ \\t\]+\[^\\n\]*%xmm\[4-6\],\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+unsigned int ctrl;
+char h2[48];
+__m128i k1, k2;
+
+unsigned int
+test_keylocker_9 (void)
+{
+ unsigned int ret;
+
+ ret = _mm_encodekey128_u32 (ctrl, k1, h2);
+
+ if (ret)
+ k2 = (__m128i){0};
+
+ return ret;
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-encodekey256.c b/gcc/testsuite/gcc.target/i386/keylocker-encodekey256.c
new file mode 100644
index 0000000..26f04dc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-encodekey256.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm0" } } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\\n\\r\]*, %xmm1" } } */
+/* { dg-final { scan-assembler "movl\[ \\t\]+\[^\\n\\r\]*, %eax" } } */
+/* { dg-final { scan-assembler "encodekey256\[ \\t\]+\[^\\n\]*%eax\[^\\n\\r\]*%eax" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm0,\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm1,\[^\\n\\r\]*16\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm2,\[^\\n\\r\]*32\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqu|movups)\[ \\t\]+\[^\\n\]*%xmm3,\[^\\n\\r\]*48\[^\\n\\r\]*" } } */
+/* { dg-final { scan-assembler "(?:movdqa|movaps)\[ \\t\]+\[^\\n\]*%xmm\[4-6\],\[^\\n\\r\]*" } } */
+
+#include <immintrin.h>
+
+unsigned int ctrl;
+char h2[48];
+__m128i k1, k2, k3;
+
+unsigned int
+test_keylocker_10 (void)
+{
+ unsigned int ret;
+ ret = _mm_encodekey256_u32 (ctrl, k1, k2, h2);
+
+ if (ret)
+ k3 = (__m128i){0};
+
+ return ret;
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/keylocker-loadiwkey.c b/gcc/testsuite/gcc.target/i386/keylocker-loadiwkey.c
new file mode 100644
index 0000000..cc0f2e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/keylocker-loadiwkey.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-mkl -O2" } */
+/* { dg-final { scan-assembler "movl\[ \\t\]+\[^\n\]*ctrl(\\(%rip\\))?\[^\n\r]*%eax" } } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\n\]*k2(\\(%rip\\))?\[^\n\r]*%xmm1" } } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\n\]*k3(\\(%rip\\))?\[^\n\r]*%xmm2" } } */
+/* { dg-final { scan-assembler "movdqa\[ \\t\]+\[^\n\]*k1(\\(%rip\\))?\[^\n\r]*%xmm0" } } */
+/* { dg-final { scan-assembler "loadiwkey\[ \\t\]+\[^\n\]*%xmm1\[^\n\r]*%xmm2" } } */
+
+#include <immintrin.h>
+
+unsigned int ctrl;
+__m128i k1, k2, k3;
+
+void
+test_keylocker_11 (void)
+{
+ _mm_loadiwkey (ctrl, k1, k2, k3);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/ms_hook_prologue.c b/gcc/testsuite/gcc.target/i386/ms_hook_prologue.c
index e11bcc0..12e54c0 100644
--- a/gcc/testsuite/gcc.target/i386/ms_hook_prologue.c
+++ b/gcc/testsuite/gcc.target/i386/ms_hook_prologue.c
@@ -4,6 +4,8 @@
/* { dg-require-effective-target ms_hook_prologue } */
/* { dg-options "-O2 -fomit-frame-pointer" } */
+#include <stdio.h>
+
int __attribute__ ((__ms_hook_prologue__)) foo ()
{
unsigned char *ptr = (unsigned char *) foo;
@@ -32,7 +34,16 @@ int __attribute__ ((__ms_hook_prologue__)) foo ()
return 0;
}
+unsigned int __attribute__ ((noinline, __ms_hook_prologue__)) test_func()
+{
+ static int value;
+
+ if (value++) puts("");
+
+ return 0;
+}
+
int main ()
{
- return foo();
+ return foo() || test_func();
}
diff --git a/gcc/testsuite/gcc.target/i386/pr45352-1.c b/gcc/testsuite/gcc.target/i386/pr45352-1.c
index 5cd1bd8..f5e96b2 100644
--- a/gcc/testsuite/gcc.target/i386/pr45352-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr45352-1.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-mtune=amdfam10 -O3 -fpeel-loops -fselective-scheduling2 -fsel-sched-pipelining -fPIC" } */
static int FIR_Tab_16[16][16];
diff --git a/gcc/testsuite/gcc.target/i386/pr47602.c b/gcc/testsuite/gcc.target/i386/pr47602.c
index fa5f5bd..5ed1e1f 100644
--- a/gcc/testsuite/gcc.target/i386/pr47602.c
+++ b/gcc/testsuite/gcc.target/i386/pr47602.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-fPIC" } */
/* Test verifies that %ebx is no longer fixed when generating PIC code on i686. */
diff --git a/gcc/testsuite/gcc.target/i386/pr55151.c b/gcc/testsuite/gcc.target/i386/pr55151.c
index 62da8cb..d6255a8 100644
--- a/gcc/testsuite/gcc.target/i386/pr55151.c
+++ b/gcc/testsuite/gcc.target/i386/pr55151.c
@@ -1,5 +1,6 @@
/* PR rtl-optimization/55151 */
/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-fPIC" } */
int a, b, c, d, e, f, g, h, i, j, k, l;
diff --git a/gcc/testsuite/gcc.target/i386/pr55458.c b/gcc/testsuite/gcc.target/i386/pr55458.c
index 7164ca9..1dea55c 100644
--- a/gcc/testsuite/gcc.target/i386/pr55458.c
+++ b/gcc/testsuite/gcc.target/i386/pr55458.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-fPIC" } */
/* Test verifies that %ebx is no longer fixed when generating PIC code on i686. */
diff --git a/gcc/testsuite/gcc.target/i386/pr56348.c b/gcc/testsuite/gcc.target/i386/pr56348.c
index c31814f..93423d9 100644
--- a/gcc/testsuite/gcc.target/i386/pr56348.c
+++ b/gcc/testsuite/gcc.target/i386/pr56348.c
@@ -1,5 +1,6 @@
/* PR target/56348 */
/* { dg-do compile { target ia32 } } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fPIC -mfpmath=sse -msse2" } */
typedef unsigned int size_t;
diff --git a/gcc/testsuite/gcc.target/i386/pr57097.c b/gcc/testsuite/gcc.target/i386/pr57097.c
index 2f00938..debacbf 100644
--- a/gcc/testsuite/gcc.target/i386/pr57097.c
+++ b/gcc/testsuite/gcc.target/i386/pr57097.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fPIC" } */
extern double ad[], bd[], cd[], dd[];
extern long long all[], bll[], cll[], dll[];
diff --git a/gcc/testsuite/gcc.target/i386/pr65753.c b/gcc/testsuite/gcc.target/i386/pr65753.c
index 562f54b..117d6ed 100644
--- a/gcc/testsuite/gcc.target/i386/pr65753.c
+++ b/gcc/testsuite/gcc.target/i386/pr65753.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-fPIC -O2" } */
/* { dg-final { scan-assembler-not "call" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr65915.c b/gcc/testsuite/gcc.target/i386/pr65915.c
index 990c5aa..6588de4 100644
--- a/gcc/testsuite/gcc.target/i386/pr65915.c
+++ b/gcc/testsuite/gcc.target/i386/pr65915.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -mavx512f -fpic -mcmodel=medium" } */
/* { dg-require-effective-target avx512f } */
/* { dg-require-effective-target lp64 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr66232-5.c b/gcc/testsuite/gcc.target/i386/pr66232-5.c
index 87f9380..76705a5 100644
--- a/gcc/testsuite/gcc.target/i386/pr66232-5.c
+++ b/gcc/testsuite/gcc.target/i386/pr66232-5.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target maybe_x32 } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fpic -mx32" } */
extern void (*bar) (void);
diff --git a/gcc/testsuite/gcc.target/i386/pr66334.c b/gcc/testsuite/gcc.target/i386/pr66334.c
index 97dfecc..19c2396 100644
--- a/gcc/testsuite/gcc.target/i386/pr66334.c
+++ b/gcc/testsuite/gcc.target/i386/pr66334.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fpic -fexceptions -fasynchronous-unwind-tables" } */
/* { dg-final { scan-assembler "movl\[ \\t\].+, %ebx" } } */
extern int foo (int);
diff --git a/gcc/testsuite/gcc.target/i386/pr66819-2.c b/gcc/testsuite/gcc.target/i386/pr66819-2.c
index 9de4f97..ad2a33e 100644
--- a/gcc/testsuite/gcc.target/i386/pr66819-2.c
+++ b/gcc/testsuite/gcc.target/i386/pr66819-2.c
@@ -1,4 +1,5 @@
/* { dg-do compile { target ia32 } } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-fPIC -O2 -mregparm=3" } */
/* { dg-final { scan-assembler-not "call" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr67265.c b/gcc/testsuite/gcc.target/i386/pr67265.c
index 2671acc..1708d53 100644
--- a/gcc/testsuite/gcc.target/i386/pr67265.c
+++ b/gcc/testsuite/gcc.target/i386/pr67265.c
@@ -3,6 +3,7 @@
/* { dg-do compile } */
/* { dg-require-stack-check "" } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O -fstack-check -fPIC" } */
int a, b, c, d, e;
diff --git a/gcc/testsuite/gcc.target/i386/pr81481.c b/gcc/testsuite/gcc.target/i386/pr81481.c
index a5b936f..49f7821 100644
--- a/gcc/testsuite/gcc.target/i386/pr81481.c
+++ b/gcc/testsuite/gcc.target/i386/pr81481.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target ssse3 } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fpic -mssse3" } */
/* { dg-final { scan-assembler-not "pshufb\[ \t\]\\(%esp\\)" } } */
#include <immintrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr83994.c b/gcc/testsuite/gcc.target/i386/pr83994.c
index dc0b7cb..1eb47e3 100644
--- a/gcc/testsuite/gcc.target/i386/pr83994.c
+++ b/gcc/testsuite/gcc.target/i386/pr83994.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -march=i686 -fpic -fstack-clash-protection" } */
/* { dg-require-effective-target ia32 } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95151-1.c b/gcc/testsuite/gcc.target/i386/pr95151-1.c
new file mode 100644
index 0000000..54a7510
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95151-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -minline-all-stringops" } */
+
+struct foo
+{
+ char array[257];
+};
+
+extern struct foo x;
+
+int
+func (struct foo i)
+{
+ return __builtin_memcmp (&x, &i, sizeof (x)) ? 1 : 2;
+}
+
+/* { dg-final { scan-assembler-not "call\[\\t \]*_?memcmp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95151-2.c b/gcc/testsuite/gcc.target/i386/pr95151-2.c
new file mode 100644
index 0000000..8f9d8ee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95151-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -minline-all-stringops" } */
+
+int
+func (void *d, void *s, unsigned int l)
+{
+ return __builtin_memcmp (d, s, l) ? 1 : 2;
+}
+
+/* { dg-final { scan-assembler-not "call\[\\t \]*_?memcmp" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95151-3.c b/gcc/testsuite/gcc.target/i386/pr95151-3.c
new file mode 100644
index 0000000..14cbdec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95151-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-inline-all-stringops" } */
+
+struct foo
+{
+ char array[257];
+};
+
+extern struct foo x;
+
+int
+func (struct foo i)
+{
+ return __builtin_memcmp (&x, &i, sizeof (x)) ? 1 : 2;
+}
+
+/* { dg-final { scan-assembler "call\[\\t \]*_?memcmp" } } */
+/* { dg-final { scan-assembler-not "cmpsb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95151-4.c b/gcc/testsuite/gcc.target/i386/pr95151-4.c
new file mode 100644
index 0000000..c93b2b6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95151-4.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-inline-all-stringops" } */
+
+int
+func (void *d, void *s, unsigned int l)
+{
+ return __builtin_memcmp (d, s, l) ? 1 : 2;
+}
+
+/* { dg-final { scan-assembler "call\[\\t \]*_?memcmp" } } */
+/* { dg-final { scan-assembler-not "cmpsb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95458-1.c b/gcc/testsuite/gcc.target/i386/pr95458-1.c
new file mode 100644
index 0000000..231a478
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95458-1.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -minline-all-stringops" } */
+
+int
+func (char *d, unsigned int l)
+{
+ return __builtin_strncmp (d, "foo", l) ? 1 : 2;
+}
+
+/* { dg-final { scan-assembler-not "call\[\\t \]*_?strncmp" } } */
+/* { dg-final { scan-assembler "cmpsb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr95458-2.c b/gcc/testsuite/gcc.target/i386/pr95458-2.c
new file mode 100644
index 0000000..1a62044
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr95458-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-inline-all-stringops" } */
+
+#include "pr95458-1.c"
+
+/* { dg-final { scan-assembler "call\[\\t \]*_?strncmp" } } */
+/* { dg-final { scan-assembler-not "cmpsb" } } */
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/pr95866-1.c b/gcc/testsuite/gcc.target/i386/pr95866-1.c
index 991370c..553d415 100644
--- a/gcc/testsuite/gcc.target/i386/pr95866-1.c
+++ b/gcc/testsuite/gcc.target/i386/pr95866-1.c
@@ -13,6 +13,6 @@ void foo(int i)
/* We should not use vector operations for i + 1 and (i + 1) & 31 but
instead use { j, j, j, j }. */
-/* { dg-final { scan-tree-dump-times "Building parent vector operands from scalars" 2 "slp2" } } */
+/* { dg-final { scan-tree-dump-times "Using a splat of the uniform operand" 2 "slp2" } } */
/* { dg-final { scan-tree-dump-not " = \{i_" "slp2" } } */
/* { dg-final { scan-tree-dump-times " = \{j_" 1 "slp2" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr97140.c b/gcc/testsuite/gcc.target/i386/pr97140.c
new file mode 100644
index 0000000..edb39d9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97140.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mno-mmx -Wno-psabi" } */
+
+typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
+typedef char __v8qi __attribute__ ((__vector_size__ (8)));
+void
+_mm_maskmove_si64 (__m64 __A, __m64 __N, char *__P)
+{
+ __builtin_ia32_maskmovq ((__v8qi)__A, (__v8qi)__N, __P); /* { dg-error "needs isa option -msse -m3dnowa -mmmx" } */
+}
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/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/pr97521.c b/gcc/testsuite/gcc.target/i386/pr97521.c
new file mode 100644
index 0000000..804ffd6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97521.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O -mno-sse2" } */
+
+typedef unsigned char __attribute__ ((__vector_size__ (8))) V;
+typedef unsigned long long __attribute__ ((__vector_size__ (16))) W;
+
+V c;
+W d, e;
+
+V
+foo (W f)
+{
+ W g = (W) { 0, 209 } <7 <= (0 < f);
+ W h = e + g + d;
+ V j = (V) (h[0]) + (V) c;
+ return j;
+}
+
+int
+main (void)
+{
+ V x = foo ((W) { 3 });
+ for (unsigned i = 0; i < sizeof (x); i++)
+ if (x[i] != 0xff)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr97540.c b/gcc/testsuite/gcc.target/i386/pr97540.c
new file mode 100644
index 0000000..20f8717
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97540.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int mt7615_add_interface_dev_0;
+int ffs(int x) { asm("" : : "rm"(x)); }
+int mt7615_add_interface() { ffs(~mt7615_add_interface_dev_0); }
diff --git a/gcc/testsuite/gcc.target/i386/returninst1.c b/gcc/testsuite/gcc.target/i386/returninst1.c
index 133fdee..74d10c9 100644
--- a/gcc/testsuite/gcc.target/i386/returninst1.c
+++ b/gcc/testsuite/gcc.target/i386/returninst1.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target mfentry } */
+/* { dg-require-profiling "-pg" } */
/* { dg-options "-pg -mfentry -minstrument-return=call -mrecord-return" } */
/* { dg-final { scan-assembler "call.*__return__" } } */
/* { dg-final { scan-assembler "section.*return_loc" } } */
diff --git a/gcc/testsuite/gcc.target/i386/returninst2.c b/gcc/testsuite/gcc.target/i386/returninst2.c
index 3629310..e19f0d0 100644
--- a/gcc/testsuite/gcc.target/i386/returninst2.c
+++ b/gcc/testsuite/gcc.target/i386/returninst2.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target mfentry } */
+/* { dg-require-profiling "-pg" } */
/* { dg-options "-pg -mfentry -minstrument-return=nop5 -mrecord-return" } */
/* { dg-final { scan-assembler-times "0x0f, 0x1f, 0x44, 0x00, 0x00" 3 } } */
/* { dg-final { scan-assembler "section.*return_loc" } } */
diff --git a/gcc/testsuite/gcc.target/i386/returninst3.c b/gcc/testsuite/gcc.target/i386/returninst3.c
index b84cc77..acb8984 100644
--- a/gcc/testsuite/gcc.target/i386/returninst3.c
+++ b/gcc/testsuite/gcc.target/i386/returninst3.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target mfentry } */
+/* { dg-require-profiling "-pg" } */
/* { dg-options "-pg -mfentry -minstrument-return=call" } */
/* { dg-final { scan-assembler-not "call.*__return__" } } */
diff --git a/gcc/testsuite/gcc.target/i386/sse-12.c b/gcc/testsuite/gcc.target/i386/sse-12.c
index 61146b2b..f1e05e6 100644
--- a/gcc/testsuite/gcc.target/i386/sse-12.c
+++ b/gcc/testsuite/gcc.target/i386/sse-12.c
@@ -3,7 +3,7 @@
popcntintrin.h gfniintrin.h and mm_malloc.h are usable
with -O -std=c89 -pedantic-errors. */
/* { dg-do compile } */
-/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16" } */
+/* { dg-options "-O -std=c89 -pedantic-errors -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512bw -mavx512dq -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl" } */
#include <x86intrin.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c
index 4d6c9b3..7f96331 100644
--- a/gcc/testsuite/gcc.target/i386/sse-13.c
+++ b/gcc/testsuite/gcc.target/i386/sse-13.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vbmi2 -mavx512ifma -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mavx512vp2intersect -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16" } */
+/* { dg-options "-O2 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vbmi2 -mavx512ifma -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mavx512vp2intersect -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mavx512bitalg -mpconfig -mwbnoinvd -mavx512bf16 -menqcmd -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl" } */
/* { 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 837b51c..27704c3 100644
--- a/gcc/testsuite/gcc.target/i386/sse-14.c
+++ b/gcc/testsuite/gcc.target/i386/sse-14.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mpconfig -mwbnoinvd -mavx512vl -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16" } */
+/* { dg-options "-O0 -Werror-implicit-function-declaration -march=k8 -msse4a -m3dnow -mavx -mavx2 -mfma4 -mxop -maes -mpclmul -mpopcnt -mabm -mlzcnt -mbmi -mbmi2 -mtbm -mlwp -mfsgsbase -mrdrnd -mf16c -mfma -mrtm -mrdseed -mprfchw -madx -mfxsr -mxsaveopt -mavx512f -mavx512er -mavx512cd -mavx512pf -msha -mprefetchwt1 -mxsavec -mxsaves -mclflushopt -mavx512dq -mavx512bw -mavx512vl -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx5124fmaps -mavx5124vnniw -mavx512vpopcntdq -mclwb -mmwaitx -mclzero -mpku -msgx -mrdpid -mgfni -mpconfig -mwbnoinvd -mavx512vl -mavx512bf16 -menqcmd -mavx512vp2intersect -mserialize -mtsxldtrk -mamx-tile -mamx-int8 -mamx-bf16 -mkl -mwidekl" } */
/* { 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 fc75669f..789c8be 100644
--- a/gcc/testsuite/gcc.target/i386/sse-22.c
+++ b/gcc/testsuite/gcc.target/i386/sse-22.c
@@ -103,7 +103,7 @@
#ifndef DIFFERENT_PRAGMAS
-#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,avx512vl,avx512bw,avx512dq,avx512vbmi,avx512vbmi2,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16")
+#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,avx512vl,avx512bw,avx512dq,avx512vbmi,avx512vbmi2,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl")
#endif
/* Following intrinsics require immediate arguments. They
@@ -220,7 +220,7 @@ test_4 (_mm_cmpestrz, int, __m128i, int, __m128i, int, 1)
/* immintrin.h (AVX/AVX2/RDRND/FSGSBASE/F16C/RTM/AVX512F/SHA) */
#ifdef DIFFERENT_PRAGMAS
-#pragma GCC target ("avx,avx2,rdrnd,fsgsbase,f16c,rtm,avx512f,avx512er,avx512cd,avx512pf,sha,avx512vl,avx512bw,avx512dq,avx512ifma,avx512vbmi,avx512vbmi2,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16")
+#pragma GCC target ("avx,avx2,rdrnd,fsgsbase,f16c,rtm,avx512f,avx512er,avx512cd,avx512pf,sha,avx512vl,avx512bw,avx512dq,avx512ifma,avx512vbmi,avx512vbmi2,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl")
#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 9ca7c5d..3e5e3e9 100644
--- a/gcc/testsuite/gcc.target/i386/sse-23.c
+++ b/gcc/testsuite/gcc.target/i386/sse-23.c
@@ -399,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)
@@ -421,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)
@@ -482,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)
@@ -698,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,amx-tile,amx-int8,amx-bf16")
+#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,fma,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,xsavec,xsaves,clflushopt,avx512bw,avx512dq,avx512vl,avx512vbmi,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,clwb,mwaitx,clzero,pku,sgx,rdpid,gfni,avx512vbmi2,vpclmulqdq,avx512bitalg,pconfig,wbnoinvd,avx512bf16,enqcmd,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl")
#include <x86intrin.h>
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/x86gprintrin-1.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-1.c
index d9c759b..293be09 100644
--- a/gcc/testsuite/gcc.target/i386/x86gprintrin-1.c
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-1.c
@@ -1,6 +1,7 @@
/* 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 -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-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>
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c
index 5ea4772..c633027 100644
--- a/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-2.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Werror-implicit-function-declaration -march=x86-64 -madx -mbmi -mbmi2 -mcldemote -mclflushopt -mclwb -mclzero -menqcmd -mfsgsbase -mfxsr -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-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
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c
index 01d3f78..3a7e1f4 100644
--- a/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-3.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
-/* { dg-options "-O0 -Werror-implicit-function-declaration -march=x86-64 -madx -mbmi -mbmi2 -mcldemote -mclflushopt -mclwb -mclzero -menqcmd -mfsgsbase -mfxsr -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-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
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c
index 053f07b..d8a6126 100644
--- a/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-4.c
@@ -14,7 +14,11 @@
#define __inline
#ifndef DIFFERENT_PRAGMAS
-#pragma GCC target ("adx,bmi,bmi2,fsgsbase,fxsr,lwp,lzcnt,popcnt,rdrnd,rdseed,tbm,rtm,serialize,tsxldtrk,xsaveopt")
+#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). */
diff --git a/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c b/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c
index fe9c5c7..9ef66fd 100644
--- a/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c
+++ b/gcc/testsuite/gcc.target/i386/x86gprintrin-5.c
@@ -27,6 +27,10 @@
/* rtmintrin.h */
#define __builtin_ia32_xabort(M) __builtin_ia32_xabort(1)
-#pragma GCC target ("adx,bmi,bmi2,clflushopt,clwb,clzero,enqcmd,fsgsbase,fxsr,lwp,lzcnt,mwaitx,pconfig,pku,popcnt,rdpid,rdrnd,rdseed,tbm,rtm,serialize,sgx,tsxldtrk,xsavec,xsaveopt,xsaves,wbnoinvd")
+#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/zero-scratch-regs-1.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-1.c
new file mode 100644
index 0000000..1ea6de8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-1.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-10.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-10.c
new file mode 100644
index 0000000..389b114
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-10.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+extern int foo (int) __attribute__ ((zero_call_used_regs("all-gpr")));
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edx, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-11.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-11.c
new file mode 100644
index 0000000..4862688
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-11.c
@@ -0,0 +1,39 @@
+/* { dg-do run { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-gpr" } */
+
+struct S { int i; };
+__attribute__((const, noinline, noclone))
+struct S foo (int x)
+{
+ struct S s;
+ s.i = x;
+ return s;
+}
+
+int a[2048], b[2048], c[2048], d[2048];
+struct S e[2048];
+
+__attribute__((noinline, noclone)) void
+bar (void)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ e[i] = foo (i);
+ a[i+2] = a[i] + a[i+1];
+ b[10] = b[10] + i;
+ c[i] = c[2047 - i];
+ d[i] = d[i + 1];
+ }
+}
+
+int
+main ()
+{
+ int i;
+ bar ();
+ for (i = 0; i < 1024; i++)
+ if (e[i].i != i)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-12.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-12.c
new file mode 100644
index 0000000..500251b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-12.c
@@ -0,0 +1,39 @@
+/* { dg-do run { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */
+
+struct S { int i; };
+__attribute__((const, noinline, noclone))
+struct S foo (int x)
+{
+ struct S s;
+ s.i = x;
+ return s;
+}
+
+int a[2048], b[2048], c[2048], d[2048];
+struct S e[2048];
+
+__attribute__((noinline, noclone)) void
+bar (void)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ e[i] = foo (i);
+ a[i+2] = a[i] + a[i+1];
+ b[10] = b[10] + i;
+ c[i] = c[2047 - i];
+ d[i] = d[i + 1];
+ }
+}
+
+int
+main ()
+{
+ int i;
+ bar ();
+ for (i = 0; i < 1024; i++)
+ if (e[i].i != i)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-13.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-13.c
new file mode 100644
index 0000000..07d8de7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-13.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -march=corei7" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
+/* { dg-final { scan-assembler-times "movaps\[ \t\]+%xmm0, %xmm\[0-9\]+" 7 { target { ia32 } } } } */
+/* { dg-final { scan-assembler-times "movaps\[ \t\]+%xmm0, %xmm\[0-9\]+" 15 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-14.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-14.c
new file mode 100644
index 0000000..55a272c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-14.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -march=corei7 -mavx" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-times "vzeroall" 1 } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-15.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-15.c
new file mode 100644
index 0000000..d0e975c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-15.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+extern void foo (void) __attribute__ ((zero_call_used_regs("used")));
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-16.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-16.c
new file mode 100644
index 0000000..d41a255
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-16.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all" } */
+
+extern void foo (void) __attribute__ ((zero_call_used_regs("skip")));
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-17.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-17.c
new file mode 100644
index 0000000..c79fcd3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-17.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" { target ia32 } } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edi, %edi" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-18.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-18.c
new file mode 100644
index 0000000..6f90723
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-18.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used -march=corei7" } */
+
+float
+foo (float z, float y, float x)
+{
+ return x + y;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm1, %xmm2" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-19.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-19.c
new file mode 100644
index 0000000..491d2d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-19.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used -march=corei7" } */
+
+float
+foo (float z, float y, float x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm2, %xmm2" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-2.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-2.c
new file mode 100644
index 0000000..52406fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-20.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-20.c
new file mode 100644
index 0000000..ccd4917
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-20.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -march=corei7" } */
+
+float
+foo (float z, float y, float x)
+{
+ return x + y;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" { target { ia32 } } } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "movaps\[ \t\]+%xmm0, %xmm\[0-9\]+" 7 { target { ia32 } } } } */
+/* { dg-final { scan-assembler-times "movaps\[ \t\]+%xmm1, %xmm\[0-9\]+" 14 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-21.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-21.c
new file mode 100644
index 0000000..b3570f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-21.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip -march=corei7" } */
+
+__attribute__ ((zero_call_used_regs("used")))
+float
+foo (float z, float y, float x)
+{
+ return x + y;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm1, %xmm1" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm1, %xmm2" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-22.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-22.c
new file mode 100644
index 0000000..b253420
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-22.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -march=corei7 -mavx" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "vzeroall" } } */
+/* { dg-final { scan-assembler-times "fldz" 8 } } */
+/* { dg-final { scan-assembler-times "fstp\[ \t\]+%st\\(0\\)" 8 } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-23.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-23.c
new file mode 100644
index 0000000..69d42d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-23.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -march=corei7 -mavx512f" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler "vzeroall" } } */
+/* { dg-final { scan-assembler-times "fldz" 8 } } */
+/* { dg-final { scan-assembler-times "fstp\[ \t\]+%st\\(0\\)" 8 } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kxorw\[ \t\]+%k0, %k0, %k0" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k1" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k2" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k3" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k4" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k5" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k6" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "kmovw\[ \t\]+%k0, %k7" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-24.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-24.c
new file mode 100644
index 0000000..5c68287
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-24.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-gpr-arg" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edi, %edi" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-25.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-25.c
new file mode 100644
index 0000000..902d3ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-25.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-arg" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edi, %edi" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-26.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-26.c
new file mode 100644
index 0000000..8fb5299
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-26.c
@@ -0,0 +1,23 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -msse2 -fzero-call-used-regs=all-arg" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edx, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "pxor\[ \t\]+%xmm0, %xmm0" } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm1" } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm2" } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm3" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm4" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm5" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm6" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movaps\[ \t\]+%xmm0, %xmm7" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-27.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-27.c
new file mode 100644
index 0000000..26ceacf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-27.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr-arg" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edx, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r9d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-28.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-28.c
new file mode 100644
index 0000000..044e4af
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-28.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mmmx -fzero-call-used-regs=all" } */
+/* { dg-require-effective-target ia32 } */
+
+typedef int __v2si __attribute__ ((vector_size (8)));
+
+__v2si ret_mmx (void)
+{
+ return (__v2si) { 123, 345 };
+}
+
+/* { dg-final { scan-assembler "pxor\[ \t\]+%mm1, %mm1" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm2" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm3" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm4" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm5" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm6" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm7" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-29.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-29.c
new file mode 100644
index 0000000..6270645
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-29.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all" } */
+
+long double ret_x87 (void)
+{
+ return 1.1L;
+}
+
+/* { dg-final { scan-assembler-times "fldz" 7 } } */
+/* { dg-final { scan-assembler-times "fstp\[ \t\]+%st\\(0\\)" 7 } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-3.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-3.c
new file mode 100644
index 0000000..89e69b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-30.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-30.c
new file mode 100644
index 0000000..c4e9930
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-30.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all" } */
+
+_Complex long double ret_x87_cplx (void)
+{
+ return 1.1L + 1.2iL;
+}
+
+/* { dg-final { scan-assembler-times "fldz" 8 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "fstp\[ \t\]+%st\\(0\\)" 8 { target ia32 } } } */
+/* { dg-final { scan-assembler-times "fldz" 6 { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler-times "fstp\[ \t\]+%st\\(0\\)" 6 { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-31.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-31.c
new file mode 100644
index 0000000..afa8b33
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-31.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -mmmx -fzero-call-used-regs=all-arg" } */
+/* { dg-require-effective-target ia32 } */
+
+typedef int __v2si __attribute__ ((vector_size (8)));
+
+__v2si ret_mmx (void)
+{
+ return (__v2si) { 123, 345 };
+}
+
+/* { dg-final { scan-assembler "pxor\[ \t\]+%mm1, %mm1" } } */
+/* { dg-final { scan-assembler "movq\[ \t\]+%mm1, %mm2" } } */
+/* { dg-final { scan-assembler-not "movq\[ \t\]+%mm1, %mm\[34567\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c
new file mode 100644
index 0000000..ca3261f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-32.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all -mno-80387" } */
+
+int
+foo (int x)
+{
+ return (x + 1);
+}
+
+/* { dg-final { scan-assembler-not "fldz" } } */
+
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-4.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-4.c
new file mode 100644
index 0000000..1e98d17
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+extern void foo (void) __attribute__ ((zero_call_used_regs("used-gpr")));
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-5.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-5.c
new file mode 100644
index 0000000..56aecda
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-5.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+__attribute__ ((zero_call_used_regs("all-gpr")))
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%eax, %eax" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%eax, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-6.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-6.c
new file mode 100644
index 0000000..fa83185
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-6.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */
+
+extern void foo (void) __attribute__ ((zero_call_used_regs("skip")));
+
+void
+foo (void)
+{
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" } } */
+/* { dg-final { scan-assembler-not "movl\[ \t\]+%" } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-7.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-7.c
new file mode 100644
index 0000000..0444a21
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-7.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=used-gpr" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" { target ia32 } } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edi, %edi" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-8.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-8.c
new file mode 100644
index 0000000..75356db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-8.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edx, %edx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %ecx" } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %esi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %edi" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r8d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r9d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r10d" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movl\[ \t\]+%edx, %r11d" { target { ! ia32 } } } } */
diff --git a/gcc/testsuite/gcc.target/i386/zero-scratch-regs-9.c b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-9.c
new file mode 100644
index 0000000..64755b00
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/zero-scratch-regs-9.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target *-*-linux* } } */
+/* { dg-options "-O2 -fzero-call-used-regs=skip" } */
+
+extern int foo (int) __attribute__ ((zero_call_used_regs("used-gpr")));
+
+int
+foo (int x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-not "vzeroall" } } */
+/* { dg-final { scan-assembler-not "%xmm" } } */
+/* { dg-final { scan-assembler-not "xorl\[ \t\]+%" { target ia32 } } } */
+/* { dg-final { scan-assembler "xorl\[ \t\]+%edi, %edi" { target { ! ia32 } } } } */
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/altivec-consts.c b/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
index d59f9b4..c68c681 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-consts.c
@@ -1,7 +1,7 @@
/* { dg-do run { target vmx_hw } } */
-/* { dg-do compile } */
+/* { dg-do compile { target { ! vmx_hw } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -mabi=altivec -O2" } */
+/* { dg-options "-maltivec -mabi=altivec -O2 -save-temps" } */
/* Check that "easy" AltiVec constants are correctly synthesized. */
diff --git a/gcc/testsuite/gcc.target/powerpc/bcd-2.c b/gcc/testsuite/gcc.target/powerpc/bcd-2.c
index 2f51dee..95c3699 100644
--- a/gcc/testsuite/gcc.target/powerpc/bcd-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/bcd-2.c
@@ -14,6 +14,8 @@
/* { dg-final { scan-assembler-not "stxvw4x" } } */
/* { dg-final { scan-assembler-not "stxvd2x" } } */
+#include <altivec.h>
+
typedef __int128_t __attribute__((__vector_size__(16))) vector_128_t;
typedef __int128_t scalar_128_t;
typedef unsigned long long scalar_64_t;
diff --git a/gcc/testsuite/gcc.target/powerpc/bcd-3.c b/gcc/testsuite/gcc.target/powerpc/bcd-3.c
index 1b20841..7948a0c 100644
--- a/gcc/testsuite/gcc.target/powerpc/bcd-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/bcd-3.c
@@ -18,6 +18,8 @@ typedef __int128_t __attribute__((__vector_size__(16))) vector_128_t;
typedef __int128_t scalar_128_t;
typedef unsigned long long scalar_64_t;
+#include <altivec.h>
+
/* Test whether the peephole works to allow folding a bcdadd, with a
bcdadd_<test> into a single instruction. */
diff --git a/gcc/testsuite/gcc.target/powerpc/bcd-4.c b/gcc/testsuite/gcc.target/powerpc/bcd-4.c
new file mode 100644
index 0000000..2c8554d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bcd-4.c
@@ -0,0 +1,521 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target power10_hw } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -save-temps" } */
+/* { dg-final { scan-assembler-times {\mbcdadd\M} 7 } } */
+/* { dg-final { scan-assembler-times {\mbcdsub\M} 18 } } */
+/* { dg-final { scan-assembler-times {\mbcds\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mdenbcdq\M} 1 } } */
+
+#include <altivec.h>
+
+#define DEBUG 0
+
+#if DEBUG
+#include <stdio.h>
+#endif
+
+
+#define BCD_POS0 12 // 0xC
+#define BCD_POS1 15 // 0xF
+#define BCD_NEG 13 // 0xD
+
+void abort (void);
+
+ union conv_t
+ {
+ _Decimal128 d128;
+ vector unsigned char ch;
+ vector long long unsigned int vllui;
+ } conv;
+
+_Decimal128 convert_vec_char (vector unsigned char a)
+{
+ union conv_t conv;
+ _Decimal128 result;
+
+ conv.ch = a;
+ result = conv.d128;
+ return result;
+}
+
+vector unsigned char maxbcd(unsigned int sign)
+{
+ vector unsigned char result;
+ int i;
+
+ for (i = 15; i > 0; i--)
+ result[i] = 0x99;
+
+ result[0] = sign << 4 | 0x9;
+}
+
+vector unsigned char num2bcd(long int a, int encoding)
+{
+ int i;
+ unsigned int hi, low, sign;
+
+ vector unsigned char result;
+
+ if (a > 0) {
+ if (encoding == 0)
+ sign = BCD_POS0;
+ else
+ sign = BCD_POS1;
+
+ } else {
+ sign = BCD_NEG;
+ a = -a;
+ }
+
+ hi = a % 10; // 1st digit
+ a = a / 10;
+ result[0] = hi << 4| sign;
+
+ for (i = 1; i < 16; i++)
+ {
+ low = a % 10;
+ a = a / 10;
+ hi = a % 10;
+ a = a / 10;
+ result[i] = hi << 4 | low;
+ }
+
+
+ return result;
+}
+
+int main ()
+{
+ int i;
+ long int value_a, value_b, value_result;
+ vector unsigned char a, b, result, exp_result;
+ _Decimal128 result_d128, exp_result_d128;
+
+ /* Make a and b positive BCD numbers */
+ value_a = 1020304;
+ a = num2bcd(value_a, 0);
+
+ value_b = 101010;
+ b = num2bcd(value_b, 0);
+
+ value_result = value_a + value_b;
+ exp_result = num2bcd(value_result, 0);
+
+ result = __builtin_bcdadd (a, b, 0);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd result[%d] = %d does not match "
+ "expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* result should be positive */
+ if ((result[0] & 0xF) != BCD_POS0)
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd sign of result is %d. Does not match "
+ "expected_result = %d\n",
+ result[0] & 0xF, BCD_POS0);
+#else
+ abort();
+#endif
+
+ /* Make a and b positive BCD numbers using alternate positive encoding. */
+ value_a = 1030507;
+ a = num2bcd(value_a, 1);
+
+ value_b = 204060;
+ b = num2bcd(value_b, 1);
+
+ value_result = value_a + value_b;
+ exp_result = num2bcd(value_result, 1);
+
+ result = __builtin_bcdadd (a, b, 1);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd result[%d] = %d does not match "
+ "expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* Result should be positive, alternate encoding. */
+ if ((result[0] & 0xF) != BCD_POS1)
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd sign of result is %d. Does not "
+ "match expected_result = %d\n",
+ result[0] & 0xF, BCD_POS1);
+#else
+ abort();
+#endif
+
+ /* Make a and b negative BCD numbers */
+ value_a = -1030507;
+ a = num2bcd(value_a, 0);
+
+ value_b = -1010101;
+ b = num2bcd(value_b, 0);
+
+ value_result = value_a + value_b;
+ exp_result = num2bcd(value_result, 0);
+
+ result = __builtin_bcdadd (a, b, 0);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd, neg result[%d] = %d does not match "
+ "expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* result should be negative */
+ if ((result[0] & 0xF) != BCD_NEG)
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd sign, neg of result is %d. Does not "
+ "match expected_result = %d\n",
+ result[0] & 0xF, BCD_NEG);
+#else
+ abort();
+#endif
+
+
+ /* Make a negative, b positive BCD numbers */
+ value_a = -1030507;
+ a = num2bcd(value_a, 0);
+
+ value_b = 1010101;
+ b = num2bcd(value_b, 0);
+
+ value_result = value_a - value_b;
+ exp_result = num2bcd(value_result, 0);
+
+ result = __builtin_bcdsub (a, b, 0);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+#if DEBUG
+ printf("ERROR: __builtin_bcdsub, neg result[%d] = %d does not match "
+ "expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* result should be positive, alt encoding */
+ if ((result[0] & 0xF) != BCD_NEG)
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd sign, of result is %d. Does not match "
+ "expected_result = %d\n",
+ result[0] & 0xF, BCD_NEG);
+#else
+ abort();
+#endif
+
+ /* Make a and b positive BCD numbers */
+ value_a = 1030507;
+ a = num2bcd(value_a, 1);
+
+ value_b = 1010101;
+ b = num2bcd(value_b, 1);
+
+ value_result = value_a - value_b;
+ exp_result = num2bcd(value_result, 1);
+
+ result = __builtin_bcdsub (a, b, 1);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+#if DEBUG
+ printf("ERROR:carll __builtin_bcdsub, pos result[%d] = %d does not "
+ "match expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* result should be positive */
+ if ((result[0] & 0xF) != BCD_POS1)
+#if DEBUG
+ printf("ERROR: __builtin_bcdsub sign, result is %d. Does not match "
+ "expected_result = %d\n",
+ result[0] & 0xF, BCD_POS1);
+#else
+ abort();
+#endif
+
+ /* Test overflow add and subtract. */
+ a = maxbcd(BCD_POS0);
+ b = maxbcd(BCD_POS0);
+
+ if(__builtin_bcdadd_ofl (a, b, 0) == 0)
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd did not overflow as expected\n");
+#else
+ abort();
+#endif
+
+ value_a = 99999999;
+ a = num2bcd(value_a, 0);
+
+ value_b = 999999999;
+ b = num2bcd(value_b, 0);
+
+ if(__builtin_bcdadd_ofl (a, b, 0))
+#if DEBUG
+ printf("ERROR: __builtin_bcdadd unexpectedly overflowed\n");
+#else
+ abort();
+#endif
+
+ a = maxbcd(BCD_NEG);
+ b = maxbcd(BCD_NEG);
+
+ if (__builtin_bcdsub_ofl (a, b, 0) == 0)
+#if DEBUG
+ printf("ERROR: __builtin_bcdsub did not overflow as expected\n");
+#else
+ abort();
+#endif
+
+ value_a = -99999999;
+ a = num2bcd(value_a, 0);
+
+ value_b = -999999999;
+ b = num2bcd(value_b, 0);
+
+ if (__builtin_bcdsub_ofl (a, b, 0))
+#if DEBUG
+ printf("ERROR: __builtin_bcdsub unexpectedly overflowed\n");
+#else
+ abort();
+#endif
+
+ /* Test arguments for valid/invalid */
+ if (__builtin_bcdinvalid (a))
+#if DEBUG
+ printf("ERROR: __builtin_invalid input is unexpectedly invalid.\n");
+#else
+ abort();
+#endif
+
+ a[3] = 0xBB; /* an invalid BCD digit */
+ if (!__builtin_bcdinvalid (a))
+#if DEBUG
+ printf("ERROR: __builtin_invalid input is unexpectedly valid.\n");
+#else
+ abort();
+#endif
+
+ value_a = 1020304;
+ a = num2bcd(value_a, 0);
+
+ value_b = 101010;
+ b = num2bcd(value_b, 0);
+
+ /* Test equality */
+ if (__builtin_bcdcmpeq (a, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpeq result is unexpectedly 1.\n");
+#else
+ abort();
+#endif
+
+ if (!__builtin_bcdcmpeq (a, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpeq result is unexpectedly 0.\n");
+#else
+ abort();
+#endif
+
+
+ /* Test a greater then b, inputs already setup this way. */
+ if (!__builtin_bcdcmpgt (a, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpgt result is unexpectedly 0.\n");
+#else
+ abort();
+#endif
+
+ if (__builtin_bcdcmpgt (b, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpgt result is unexpectedly 1.\n");
+#else
+ abort();
+#endif
+
+ if (__builtin_bcdcmpgt (a, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpgt input equal, result is unexpectedly "
+ "1.\n");
+#else
+ abort();
+#endif
+
+
+ if (!__builtin_bcdcmpge (a, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpge result is unexpectedly 0.\n");
+#else
+ abort();
+#endif
+
+ if (__builtin_bcdcmpge (b, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpge result is unexpectedly 1.\n");
+#else
+ abort();
+#endif
+
+ if (!__builtin_bcdcmpge (b, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmpge inputs equal result is unexpectedly "
+ "0.\n");
+#else
+ abort();
+#endif
+
+ /* Test a less then b. */
+ value_a = 101010;
+ a = num2bcd(value_a, 0);
+ value_b = 1020304;
+ b = num2bcd(value_b, 0);
+
+ if (!__builtin_bcdcmplt (a, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmplt result is unexpectedly 0.\n");
+#else
+ abort();
+#endif
+
+ if (__builtin_bcdcmplt (b, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmplt result is unexpectedly 1.\n");
+#else
+ abort();
+#endif
+
+ if (__builtin_bcdcmplt (b, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmplt inputs equal result is unexpectedly "
+ "1.\n");
+#else
+ abort();
+#endif
+
+
+ if (!__builtin_bcdcmple (a, b))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmple result is unexpectedly 0.\n");
+#else
+ abort();
+#endif
+
+ if (__builtin_bcdcmple (b, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmple result is unexpectedly 1.\n");
+#else
+ abort();
+#endif
+
+ if (!__builtin_bcdcmple (a, a))
+#if DEBUG
+ printf("ERROR: __builtin__bcdcmple inputs equal result is unexpectedly "
+ "0.\n");
+#else
+ abort();
+#endif
+
+ /* Test multipy 10 */
+ value_a = 1020304;
+ a = num2bcd(value_a, 0);
+
+ value_result = value_a * 10;
+ exp_result = num2bcd(value_result, 0);
+
+ result = __builtin_bcdmul10 (a);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+#if DEBUG
+ printf("ERROR:carll __builtin_bcdmul10, pos result[%d] = %d does not "
+ "match expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* result should be positive */
+ if ((result[0] & 0xF) != BCD_POS0)
+#if 0
+ printf("ERROR: __builtin_bcdmul10 sign, result is %d. Does not match "
+ "expected_result = %d\n",
+ result[0] & 0xF, BCD_POS1);
+#else
+ abort();
+#endif
+
+ /* Test divide 10 */
+ value_a = 1020304;
+ a = num2bcd(value_a, 0);
+
+ value_result = value_a / 10;
+ exp_result = num2bcd(value_result, 0);
+
+ result = __builtin_bcddiv10 (a);
+
+ for (i = 0; i < 16; i++)
+ if (exp_result[i] != result[i]) {
+#if DEBUG
+ printf("ERROR:carll __builtin_bcddiv10, pos result[%d] = %d does not "
+ "match expected_result[%d] = %d\n",
+ i, result[i], i, exp_result[i]);
+#else
+ abort();
+#endif
+ }
+
+ /* result should be positive */
+ if ((result[0] & 0xF) != BCD_POS0)
+#if DEBUG
+ printf("ERROR: __builtin_bcddiv10 sign, result is %d. Does not match "
+ "expected_result = %d\n",
+ result[0] & 0xF, BCD_POS1);
+#else
+ abort();
+#endif
+
+ value_a = 1020304;
+ exp_result_d128 = 1020304;
+ a = num2bcd(value_a, 0);
+
+ conv.ch = a;
+ conv.d128 = __builtin_bcd2dfp (a);
+ result_d128 = conv.d128;
+
+ if (result_d128 != exp_result_d128)
+#if DEBUG
+ printf("ERROR: __builtin_bcd2dfp, result does not match expected_result."
+ "\n");
+#else
+ abort();
+#endif
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap64-4.c b/gcc/testsuite/gcc.target/powerpc/bswap64-4.c
index a3c0553..5acbb91 100644
--- a/gcc/testsuite/gcc.target/powerpc/bswap64-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/bswap64-4.c
@@ -7,6 +7,12 @@
/* { dg-final { scan-assembler-times "ldbrx" 1 { target has_arch_pwr7 } } } */
/* { dg-final { scan-assembler-times "stdbrx" 1 { target has_arch_pwr7 } } } */
+/* On some versions of dejagnu this test will fail when biarch testing
+ with RUNTESTFLAGS="--target_board=unix'{-m64,-m32}'" due to -m32
+ being added on the command line after the dg-options -mpowerpc64.
+ common/config/rs6000/rs6000-common.c:rs6000_handle_option disables
+ -mpowerpc64 for -m32. */
+
long long swap_load (long long *a) { return __builtin_bswap64 (*a); }
long long swap_reg (long long a) { return __builtin_bswap64 (a); }
void swap_store (long long *a, long long b) { *a = __builtin_bswap64 (b); }
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/byte-in-either-range-0.c b/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-0.c
index a5300b4..647186d 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-0.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-0.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-1.c b/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-1.c
index e67fb66..3a07f7f 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-either-range-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power8" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-range-0.c b/gcc/testsuite/gcc.target/powerpc/byte-in-range-0.c
index ca58afe..9603177 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-range-0.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-range-0.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-range-1.c b/gcc/testsuite/gcc.target/powerpc/byte-in-range-1.c
index 4f4ad8f..ec1740d 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-range-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-range-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power8" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-set-0.c b/gcc/testsuite/gcc.target/powerpc/byte-in-set-0.c
index 777d00d..16126bf 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-set-0.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-set-0.c
@@ -1,7 +1,6 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed only on 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-set-1.c b/gcc/testsuite/gcc.target/powerpc/byte-in-set-1.c
index a369dc1..53fa5d8 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-set-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-set-1.c
@@ -1,7 +1,6 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power8" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c b/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c
index 9a80c27..44cc778 100644
--- a/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/byte-in-set-2.c
@@ -1,7 +1,6 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
#include <altivec.h>
@@ -11,5 +10,5 @@
int
test_byte_in_set (unsigned char b, unsigned long long set_members)
{
- return __builtin_byte_in_set (b, set_members); /* { dg-error "'__builtin_byte_in_set' is not supported in this compiler configuration" } */
+ return __builtin_byte_in_set (b, set_members); /* { dg-warning "implicit declaration of function" } */
}
diff --git a/gcc/testsuite/gcc.target/powerpc/cfuged-1.c b/gcc/testsuite/gcc.target/powerpc/cfuged-1.c
index 198d541..0088309 100644
--- a/gcc/testsuite/gcc.target/powerpc/cfuged-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/cfuged-1.c
@@ -1,6 +1,7 @@
-/* { dg-do run } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
/* { dg-require-effective-target lp64 } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.target/powerpc/cntlzdm-1.c b/gcc/testsuite/gcc.target/powerpc/cntlzdm-1.c
index e9ee835..a6bc2d6 100644
--- a/gcc/testsuite/gcc.target/powerpc/cntlzdm-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/cntlzdm-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target lp64 } */
/* { dg-options "-mdejagnu-cpu=power10" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/cnttzdm-1.c b/gcc/testsuite/gcc.target/powerpc/cnttzdm-1.c
index 4c05c1b..ba94871 100644
--- a/gcc/testsuite/gcc.target/powerpc/cnttzdm-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/cnttzdm-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target lp64 } */
/* { dg-options "-mdejagnu-cpu=power10" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/cprophard.c b/gcc/testsuite/gcc.target/powerpc/cprophard.c
index f93081f..0aac9a5 100644
--- a/gcc/testsuite/gcc.target/powerpc/cprophard.c
+++ b/gcc/testsuite/gcc.target/powerpc/cprophard.c
@@ -1,6 +1,6 @@
-/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-do compile { target lp64 } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mno-pcrel" } */
/* { dg-final { scan-assembler {ld 2,(24|40)\(1\)} } } */
/* From a linux kernel mis-compile of net/core/skbuff.c. */
diff --git a/gcc/testsuite/gcc.target/powerpc/dg-future-1.c b/gcc/testsuite/gcc.target/powerpc/dg-future-1.c
index 0dbfb06..bc2b3b7 100644
--- a/gcc/testsuite/gcc.target/powerpc/dg-future-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/dg-future-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run { target { powerpc*-*-* } } } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
/* This tests that power10_hw works. */
diff --git a/gcc/testsuite/gcc.target/powerpc/dimode_off.c b/gcc/testsuite/gcc.target/powerpc/dimode_off.c
index 19ca40c..12718ea 100644
--- a/gcc/testsuite/gcc.target/powerpc/dimode_off.c
+++ b/gcc/testsuite/gcc.target/powerpc/dimode_off.c
@@ -1,5 +1,5 @@
/* { dg-do assemble } */
-/* { dg-options "-O2 -fno-align-functions -fno-asynchronous-unwind-tables -mtraceback=no -save-temps" } */
+/* { dg-options "-O2 -fno-align-functions -fno-asynchronous-unwind-tables -mtraceback=no -mno-prefixed -save-temps" } */
void w1 (void *x, long long y) { *(long long *) (x + 32767) = y; }
void w2 (void *x, long long y) { *(long long *) (x + 32766) = y; }
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/float128-hw3.c b/gcc/testsuite/gcc.target/powerpc/float128-hw3.c
index b3bbeb2..630c93d 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-hw3.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-hw3.c
@@ -1,7 +1,7 @@
/* { dg-do compile { target lp64 } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-require-effective-target float128 } */
-/* { dg-options "-mpower9-vector -O2 -ffast-math -std=c11" } */
+/* { dg-options "-mpower9-vector -O2 -ffast-math -std=c11 -mno-pcrel" } */
/* Test to make sure the compiler calls the external function instead of doing
the built-in processing for _Float128 functions that have hardware support
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
new file mode 100644
index 0000000..6122713
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and long double do not generate errors if
+ long double uses the IEEE 128-bit format. */
+__float128
+add (__float128 a, long double b)
+{
+ return a+b;
+}
+
+long double
+sub (long double a, __float128 b)
+{
+ return a-b;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
new file mode 100644
index 0000000..a2582bb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and __ibm128 cannot be combined
+ together. */
+__float128
+add (__float128 a, __ibm128 b)
+{
+ return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
+
+__ibm128
+sub (__ibm128 a, __float128 b)
+{
+ return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
index 71f840c..48e651c 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
@@ -1,15 +1,17 @@
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O2 -mvsx" } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
-
-/* Test to make sure that __float128 and long double cannot be combined together. */
-__float128 add (__float128 a, long double b)
+/* Test to make sure that __float128 and long double cannot be combined
+ together, when long double uses the IBM extended double format, and
+ __float128 uses the IEEE 128-bit format. */
+__float128
+add (__float128 a, long double b)
{
- return a+b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */
+ return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
}
-__ibm128 sub (long double a, __float128 b)
+long double
+sub (long double a, __float128 b)
{
- return a-b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */
+ return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-type-1.c b/gcc/testsuite/gcc.target/powerpc/float128-type-1.c
index 13152ac..53f9e35 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-type-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-type-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */
+/* { dg-do compile { target { *-*-linux* && lp64 } } } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2 -mno-float128" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-type-2.c b/gcc/testsuite/gcc.target/powerpc/float128-type-2.c
index 5644281..02dbad1 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-type-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-type-2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target { powerpc64-*-linux* && lp64 } } } */
+/* { dg-do compile { target { *-*-linux* && lp64 } } } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 -mno-float128" } */
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..8a4c380 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,6 @@
/* { 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 } } } */
#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..1abf19d 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,6 @@
/* { 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 } } } */
#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..b97fcb4 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,7 @@
/* { 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 {\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..8ddce3fd 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,6 @@
/* { 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 {\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..a851fd6 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" } */
@@ -58,8 +58,6 @@ testui2_cst(unsigned int x, vector unsigned int v)
/* { dg-final { scan-assembler-times {\mmtvsrwz\M} 4 { target lp64 } } } */
/* { 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 {\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/le-altivec-consts.c b/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
index f48ef44..a1db5e9 100644
--- a/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
+++ b/gcc/testsuite/gcc.target/powerpc/le-altivec-consts.c
@@ -1,7 +1,7 @@
/* { dg-do run { target vmx_hw } } */
-/* { dg-do compile } */
+/* { dg-do compile { target { ! vmx_hw } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
-/* { dg-options "-maltivec -mabi=altivec -O2" } */
+/* { dg-options "-maltivec -mabi=altivec -O2 -save-temps" } */
/* Check that "easy" AltiVec constants are correctly synthesized. */
diff --git a/gcc/testsuite/gcc.target/powerpc/localentry-1.c b/gcc/testsuite/gcc.target/powerpc/localentry-1.c
index c3c5168..1343df2 100644
--- a/gcc/testsuite/gcc.target/powerpc/localentry-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/localentry-1.c
@@ -1,11 +1,10 @@
/* { dg-do compile } */
-/* { dg-options "-mdejagnu-cpu=power10 -O2 -mpcrel" } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
/* { dg-require-effective-target powerpc_elfv2 } */
/* { dg-require-effective-target power10_ok } */
-/* Ensure we generate ".localentry fn,1" for both leaf and non-leaf functions.
- At present, -mcpu=power10 does not enable pc-relative mode, so make sure we
- enable it to be able to check for .localentry. */
+/* Ensure we generate ".localentry fn,1" for both leaf and non-leaf
+ functions. */
extern int y (int);
diff --git a/gcc/testsuite/gcc.target/powerpc/lsbb-runnable.c b/gcc/testsuite/gcc.target/powerpc/lsbb-runnable.c
index 7da530c..2e97cc1 100644
--- a/gcc/testsuite/gcc.target/powerpc/lsbb-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/lsbb-runnable.c
@@ -6,8 +6,9 @@
int vec_test_lsbb_all_ones (vector unsigned char);
*/
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-fno-inline -mdejagnu-cpu=power10 -O2" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-alignment.c b/gcc/testsuite/gcc.target/powerpc/mma-alignment.c
new file mode 100644
index 0000000..0981893
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/mma-alignment.c
@@ -0,0 +1,41 @@
+/* { dg-do run } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-O2 -mhard-float" } */
+
+#include <stdlib.h>
+
+/* The MMA types below are enabled for pre-power10 compiles, because the
+ built-ins that use them must always be initialized in case the user has
+ a target attribute or pragma on a function that uses the MMA built-ins.
+ Since the test below doesn't need any other MMA support, we can enable
+ this test case on basically any cpu that has hard floating point
+ registers. */
+
+struct
+{
+ int __attribute__ ((__aligned__)) ivar;
+ __vector_pair pair;
+ __vector_quad quad;
+} s;
+
+int
+main (void)
+{
+ /* Verify default alignment is 16-byte aligned (BIGGEST_ALIGNMENT).
+ This may change in the future, but that is an ABI break, so this
+ hardcoded test case is here to be a noisy FAIL as a warning, in
+ case the ABI change was unintended and unwanted. An example of where
+ this can break an ABI is in glibc's struct _Unwind_Exception. */
+ if (__alignof__ (s.ivar) != 16)
+ abort ();
+
+ /* Verify __vector_pair types are 32-byte aligned. */
+ if (__alignof__ (s.pair) != 32)
+ abort ();
+
+ /* Verify __vector_quad types are 64-byte aligned. */
+ if (__alignof__ (s.quad) != 64)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-double-test.c b/gcc/testsuite/gcc.target/powerpc/mma-double-test.c
index 044a288..5384379 100755
--- a/gcc/testsuite/gcc.target/powerpc/mma-double-test.c
+++ b/gcc/testsuite/gcc.target/powerpc/mma-double-test.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target ppc_mma_hw } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/mma-single-test.c b/gcc/testsuite/gcc.target/powerpc/mma-single-test.c
index 7e628df..ac4125b 100755
--- a/gcc/testsuite/gcc.target/powerpc/mma-single-test.c
+++ b/gcc/testsuite/gcc.target/powerpc/mma-single-test.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target ppc_mma_hw } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c b/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c
index 74187e1..8fa09b0 100644
--- a/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/notoc-direct-1.c
@@ -1,11 +1,10 @@
/* { dg-do compile } */
-/* { dg-options "-mdejagnu-cpu=power10 -O2 -mpcrel" } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
/* { dg-require-effective-target powerpc_elfv2 } */
/* { dg-require-effective-target power10_ok } */
-/* Test that calls generated from PC-relative code are annotated with @notoc.
- At present, -mcpu=power10 does not enable pc-relative mode. Enable it here
- explicitly until it is turned on by default. */
+/* Test that calls generated from PC-relative code are annotated with
+ @notoc. */
extern int yy0 (int);
extern void yy1 (int);
@@ -40,4 +39,3 @@ int ww (void)
/* { dg-final { scan-assembler {yy0@notoc} } } */
/* { dg-final { scan-assembler {zz1@notoc} } } */
/* { dg-final { scan-assembler {zz0@notoc} } } */
-
diff --git a/gcc/testsuite/gcc.target/powerpc/p10-arch31.c b/gcc/testsuite/gcc.target/powerpc/p10-arch31.c
index a9a75ec..d4ec18c 100644
--- a/gcc/testsuite/gcc.target/powerpc/p10-arch31.c
+++ b/gcc/testsuite/gcc.target/powerpc/p10-arch31.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
/* This test will only run when the power10_hw_available test passes.
diff --git a/gcc/testsuite/gcc.target/powerpc/p10-identify.c b/gcc/testsuite/gcc.target/powerpc/p10-identify.c
index 8532697..6b00abf 100644
--- a/gcc/testsuite/gcc.target/powerpc/p10-identify.c
+++ b/gcc/testsuite/gcc.target/powerpc/p10-identify.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
/* This test will only run when the power10_hw_available test passes.
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-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/pdep-1.c b/gcc/testsuite/gcc.target/powerpc/pdep-1.c
index ab0efd2..458bcea 100644
--- a/gcc/testsuite/gcc.target/powerpc/pdep-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/pdep-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target lp64 } */
/* { dg-options "-mdejagnu-cpu=power10" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pextd-1.c b/gcc/testsuite/gcc.target/powerpc/pextd-1.c
index ab08142..4f00cc9 100644
--- a/gcc/testsuite/gcc.target/powerpc/pextd-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/pextd-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target lp64 } */
/* { dg-options "-mdejagnu-cpu=power10" } */
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/pr64505.c b/gcc/testsuite/gcc.target/powerpc/pr64505.c
index 8601f2d..42b961f 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr64505.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr64505.c
@@ -1,231 +1,52 @@
-/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */
+/* { dg-do compile } */
/* { dg-skip-if "" { powerpc*-*-aix* } } */
-/* { dg-options "-O2 -mpowerpc64" } */
+/* { dg-options "-w -O2 -mpowerpc64" } */
/*
- * (below is inlined and simplified from previously included headers)
+ * (below is minimized test case)
*/
-struct fltcom_st {
- short fltbuf[950];
-} fltcom_ __attribute__((common)) ;
-#define CM_PLIBOR (*(((double *)&fltcom_ + 1)))
-#define CM_QMRG (*(((double *)&fltcom_ + 2)))
+extern double pow(double x, double y);
+extern long func ();
+short global0, global1;
+static int i0, i1, i2, i3, i4, i5;
+double dbl, *array0, *array1;
-struct fltcom2_st {
- short fltbuf2[56];
-} fltcom2_ __attribute__((common)) ;
-#define CM_FLPRV ((short *)&fltcom2_ + 17)
-#define CM_FLNXT ((short *)&fltcom2_ + 20)
-#define CM_FLCPN (*(((double *)&fltcom2_)))
-#define CM_FLCNT (*(((short *)&fltcom2_ + 12)))
-
-struct aidatcm_st {
- double cm_aid, cm_ext, cm_basis;
- short cm_aiday, cm_exday, cm_dperd, cm_aiexf, cm_aidex, cm_aiok,
- cm_aigdo, cm_aildo, cm_prev[3], cm_next[3], cm_aid_pad[2];
- double cm_rvgfact, cm_ai1st, cm_ai2nd;
- int cm_aieurok;
-} aidatcm_ __attribute__((common)) ;
-#define CM_EXDAY aidatcm_.cm_exday
-#define CM_BASIS aidatcm_.cm_basis
-#define CM_PREV aidatcm_.cm_prev
-
-struct cshfcm_st {
- short bufff[10862];
-} cshfcm_ __attribute__((common)) ;
-#define CM_FNUM (*(((short *)&cshfcm_ + 9038)))
-#define CM_FIFLX ((double *)&cshfcm_ + 1)
-#define CM_FEXTX ((double *)&cshfcm_ + 1201)
-#define CM_FSHDT ((short *)&cshfcm_ + 7230)
-
-struct calctsdb_st {
- short calctsdbbuff[115];
-} calctsdb_ __attribute__((common)) ;
-#define CM_CTUP_GOOD_TO_GO (*(((short *)&calctsdb_ + 16)))
-#define CM_PAYMENT_FREQUENCY (*(((short *)&calctsdb_ + 61)))
-#define CM_DISCOUNTING_DAYTYP (*(((short *)&calctsdb_ + 59)))
-
-struct cf600cm_st {
- short bufcf[14404];
-} cf600cm_ __attribute__((common)) ;
-#define CM_FLT_RFIXRATES ((double *)&cf600cm_ + 600)
-
-typedef struct { int id; int type; const char *name; } bregdb_bitinfo_t;
-
-int
-bregdb_eval_bbitcxt_bool_rv(const bregdb_bitinfo_t * const bbit,
- const int bbit_default,
- const void * const bregucxt);
-
-static const bregdb_bitinfo_t bbit_calc_dr_d33 =
- { 160667, 5, "bbit_calc_dr_d33" };
-#define bbit_calc_dr_d33__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d33, 0, 0)
-static const bregdb_bitinfo_t bbit_calc_sx_b24 =
- { 158854, 5, "bbit_calc_sx_b24" };
-#define bbit_calc_sx_b24__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_sx_b24, 0, 0)
-static const bregdb_bitinfo_t bbit_calc_dr_d36 =
- { 161244, 5, "bbit_calc_dr_d36" };
-#define bbit_calc_dr_d36__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d36, 0, 0)
-static const bregdb_bitinfo_t bbit_calc_dr_d37 =
- { 161315, 5, "bbit_calc_dr_d37" };
-#define bbit_calc_dr_d37__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d37, 0, 0)
-static const bregdb_bitinfo_t bbit_calc_dr_d47 =
- { 163259, 5, "bbit_calc_dr_d47" };
-#define bbit_calc_dr_d47__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d47, 0, 0)
-static const bregdb_bitinfo_t bbit_calc_dr_d46 =
- { 163239, 5, "bbit_calc_dr_d46" };
-#define bbit_calc_dr_d46__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d46, 0, 0)
-static const bregdb_bitinfo_t bbit_calc_dr_d62 =
- { 166603, 5, "bbit_calc_dr_d62" };
-#define bbit_calc_dr_d62__value() \
- bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d62, 0, 0)
-
-
-
-int dtyp_is_actact_(short *daytyp);
-double rnd_trunc_numb(double in, short num_digits, short rnd_or_trunc);
-void datetrn_(const short* dt, short* dt2);
-short difday_(short* daytyp_in, short* srtdti, short* enddti, short* ercode);
-
-
-double pow(double x, double y);
-
-
-/*
- * (above is inlined and simplified from previously included headers)
- */
-
-
-void calc_1566(
- short sCalcType,
- short sDayType,
- short sFreq,
- short asSettleDt[3],
- short asMtyDt[3],
- short asIssueDt[3],
- short asFCpnDt[3],
- double dCpn,
- short *psNoPer,
- double *pdExt,
- double *pdAI,
- double *pdAI2,
- double *pdFCpn,
- short *psRcode)
+void
+pr64505 (short *arg0, double *arg1)
{
-
- short ercode = 0;
- int isactact;
- short days_to_next_cpn = 0;
- const short discDaytype = CM_DISCOUNTING_DAYTYP;
-
- if(bbit_calc_sx_b24__value())
- isactact = (dtyp_is_actact_(&sDayType) != 0);
- else
- isactact = (sDayType == 1 || sDayType == 10);
-
- short days_in_current_period = difday_(&sDayType,CM_FLPRV,CM_FLNXT,&ercode);
- const short sfreq1 = (CM_CTUP_GOOD_TO_GO == 1 && CM_PAYMENT_FREQUENCY == 1);
-
- for (int j = 0; j < CM_FNUM; j++) {
-
- if(j == 0) {
- days_to_next_cpn = difday_(&sDayType,asSettleDt,CM_FLNXT,&ercode);
-
- if(isactact) {
- CM_FIFLX[j] = CM_FLCPN / sFreq;
- CM_FEXTX[j] = (double)days_to_next_cpn / (double)days_in_current_period;
- }
- else {
- CM_FIFLX[j] = CM_FLCPN * days_in_current_period;
- CM_FEXTX[j] = (double)days_to_next_cpn / (double)(1/sfreq1);
- }
-
- if(CM_FNUM == 1) {
- CM_FEXTX[j] = (double)days_to_next_cpn / ((double)1/sfreq1);
- }
- }
- else {
-
- short days_from_settle, days_in_period;
-
- if(bbit_calc_dr_d46__value()){
- days_from_settle = difday_(&sDayType,asSettleDt,
- &CM_FSHDT[j*3],&ercode);
- days_in_period = difday_(&sDayType,&CM_FSHDT[(j-1)*3],
- &CM_FSHDT[j*3],&ercode);
- }
-
- double cpn_rate = CM_PLIBOR;
-
- if(bbit_calc_dr_d62__value()) {
- if(j < CM_FLCNT && CM_FLT_RFIXRATES[j] != 0) cpn_rate = CM_FLT_RFIXRATES[j];
- }
- else {
- if(j < CM_FLCNT ) cpn_rate = CM_FLT_RFIXRATES[j];
- }
-
- if(bbit_calc_dr_d37__value()&& j >= CM_FLCNT && sCalcType == 1570) {
- cpn_rate = CM_PLIBOR + CM_QMRG;
-
- if(bbit_calc_dr_d36__value()){
- double projected_rate = pow((1 + CM_PLIBOR/100.0),
- (days_in_period)) - 1;
-
- projected_rate = projected_rate + CM_QMRG/100.0 * days_in_period;
- cpn_rate = 100 * projected_rate * (1/days_in_period);
- }
- }
-
-
- if(isactact) {
- CM_FIFLX[j] = cpn_rate / sFreq;
- CM_FEXTX[j] = CM_FEXTX[j-1] + 1;
-
- if(bbit_calc_dr_d46__value() && discDaytype != 0) {
- CM_FEXTX[j] = (double)days_from_settle / (double)(1/sfreq1);
- }
- }
- else {
- if(!bbit_calc_dr_d46__value()){
- days_from_settle = difday_(&sDayType,asSettleDt,
- &CM_FSHDT[j*3],&ercode);
- days_in_period = difday_(&sDayType,&CM_FSHDT[(j-1)*3],
- &CM_FSHDT[j*3],&ercode);
-
- }
-
- CM_FIFLX[j] = cpn_rate * days_in_period;
- CM_FEXTX[j] = (double)days_from_settle / (double)(1/sfreq1);
- }
-
- }
-
- if(bbit_calc_dr_d33__value() && CM_CTUP_GOOD_TO_GO != 0) {
- CM_FIFLX[j] = rnd_trunc_numb (CM_FIFLX[j], 0, 0);
- }
-
+ int error = 0;
+ short num = func (&global1 + 15, &error);
+ for (int j = 0; j < array0[0]; j++)
+ {
+ if (j == 0)
+ {
+ func (arg0, &global1 + 20, &error);
+ array0[0] = num;
+ }
+ else
+ {
+ double cr = (&dbl)[1];
+ if (func (&i4))
+ func (0, &(&array0)[j]);
+ if (func (&i5))
+ {
+ if ((&global1)[12])
+ cr = array1[j];
+ }
+ if (func (&i2)
+ && (&global1)[12])
+ {
+ if (func (&i1))
+ pow ((&dbl)[1], 2);
+ }
+ array0[j] = cr;
+ }
+ if (func (&i0) && global0)
+ func (((short *) array0 + 1)[j]);
}
-
-
- short accrued_days = difday_(&sDayType,CM_FLPRV,asSettleDt,&ercode);
-
- if(!bbit_calc_dr_d47__value()) {
- if(isactact) {
- *pdAI = (CM_FLCPN / sFreq)* accrued_days / ((double)days_in_current_period);
- }
- else{
- *pdAI = (CM_FLCPN / sFreq)* accrued_days / ((double)1/sFreq);
- }
- }
-
- CM_EXDAY = days_to_next_cpn;
- CM_BASIS = days_in_current_period;
- datetrn_(CM_FLPRV,CM_PREV);
+ short ad = func (&global1 + 15, 0);
+ if (func (&i3) && func ())
+ *arg1 = *((double *) &global1) * ad;
+ func (&global1 + 15);
}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr67789.c b/gcc/testsuite/gcc.target/powerpc/pr67789.c
index 371d7a3..05d01ef 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr67789.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr67789.c
@@ -1,4 +1,5 @@
/* { dg-do assemble } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -msecure-plt -fPIC" } */
/* { dg-skip-if "" { powerpc*-*-darwin* powerpc-ibm-aix* } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79439-1.c b/gcc/testsuite/gcc.target/powerpc/pr79439-1.c
index 539c96f..8eb08a4 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79439-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79439-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
-/* { dg-options "-O2 -fpic -fno-reorder-blocks -fno-inline-functions" } */
+/* { dg-options "-O2 -fpic -fno-reorder-blocks -fno-inline-functions -mno-pcrel" } */
/* On the Linux 64-bit ABIs, we eliminate NOP in the 'rec' call even if
-fpic is used. The recursive call should call the local alias. The
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79439-2.c b/gcc/testsuite/gcc.target/powerpc/pr79439-2.c
index b53af44..9ebcf25 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79439-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79439-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
-/* { dg-options "-O2 -fpic -fno-reorder-blocks" } */
+/* { dg-options "-O2 -fpic -fno-reorder-blocks -mno-pcrel" } */
/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if
-fpic is used because rec can be interposed at link time (since it has an
diff --git a/gcc/testsuite/gcc.target/powerpc/pr83629.c b/gcc/testsuite/gcc.target/powerpc/pr83629.c
index 250378e..976b564 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr83629.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr83629.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fPIC -frename-registers --param=sched-autopref-queue-depth=0 -mdejagnu-cpu=603" } */
extern void bar (void *);
diff --git a/gcc/testsuite/gcc.target/powerpc/pr84112.c b/gcc/testsuite/gcc.target/powerpc/pr84112.c
index cd429df..8fbafa1 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr84112.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr84112.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target powerpc*-*-* } }*/
+/* { dg-do compile } */
+/* { dg-require-effective-target fpic } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 -fstack-protector-strong -fpic" } */
char *b;
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/pr93122.c b/gcc/testsuite/gcc.target/powerpc/pr93122.c
index 8ea4eb6..97bcb0c 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr93122.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr93122.c
@@ -1,7 +1,7 @@
/* PR target/93122 */
/* { dg-require-effective-target power10_ok } */
/* { dg-do compile { target lp64 } } */
-/* { dg-options "-fstack-clash-protection -mprefixed -mcpu=power10" } */
+/* { dg-options "-fstack-clash-protection -mprefixed -mdejagnu-cpu=power10" } */
void bar (char *);
diff --git a/gcc/testsuite/gcc.target/powerpc/pr94740.c b/gcc/testsuite/gcc.target/powerpc/pr94740.c
index 9c2b464..09decc3 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr94740.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr94740.c
@@ -1,7 +1,7 @@
/* PR rtl-optimization/94740 */
/* { dg-do compile } */
/* { dg-require-effective-target power10_ok } */
-/* { dg-options "-O2 -mdejagnu-cpu=power10 -mpcrel" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
int array[8];
int
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/pr96787-2.c b/gcc/testsuite/gcc.target/powerpc/pr96787-2.c
index b10ab7a8..8c4469d 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr96787-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr96787-2.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
/* Verify that we generate an indirect sibcall for ELFv2 on P10 and
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96933-1.c b/gcc/testsuite/gcc.target/powerpc/pr96933-1.c
new file mode 100644
index 0000000..3b63865
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr96933-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+
+/* Test vector constructions with char/short type values whether use 128bit
+ direct move instructions mtvsrdd on Power9 or later, rather than transfering
+ with memory store/load with stb/sth and vector load. */
+
+#include "pr96933.h"
+
+/* { dg-final { scan-assembler-times {\mmtvsrdd\M} 24 } } */
+/* { dg-final { scan-assembler-times {\mvpkudum\M} 12 } } */
+/* { dg-final { scan-assembler-not {\mstb\M} } } */
+/* { dg-final { scan-assembler-not {\msth\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96933-2.c b/gcc/testsuite/gcc.target/powerpc/pr96933-2.c
new file mode 100644
index 0000000..cef8fbd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr96933-2.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
+
+/* Test vector constructions with char/short type values whether use direct
+ move instructions like mtvsrd/mtvsrwz on Power8, rather than transfering
+ with memory store/load with stb/sth and vector load. */
+
+#include "pr96933.h"
+
+/* { dg-final { scan-assembler-times {\mmtvsrd\M} 48 {target lp64 } } } */
+/* { dg-final { scan-assembler-times {\mmtvsrwz\M} 48 {target {! lp64 } } } } */
+/* { dg-final { scan-assembler-times {\mxxpermdi\M} 4 } } */
+/* { dg-final { scan-assembler-not {\mstb\M} } } */
+/* { dg-final { scan-assembler-not {\msth\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96933-3.c b/gcc/testsuite/gcc.target/powerpc/pr96933-3.c
new file mode 100644
index 0000000..3e5709a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr96933-3.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p8vector_hw } */
+/* { dg-options "-O2 -mdejagnu-cpu=power8" } */
+
+/* Test vector constructions with char/short run successfully on Power8. */
+
+#include <stdlib.h>
+#include "pr96933.h"
+#include "pr96933-run.h"
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96933-4.c b/gcc/testsuite/gcc.target/powerpc/pr96933-4.c
new file mode 100644
index 0000000..5a1c3d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr96933-4.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-require-effective-target p9vector_hw } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+
+/* Test vector constructions with char/short run successfully on Power9. */
+
+#include <stdlib.h>
+#include "pr96933.h"
+#include "pr96933-run.h"
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96933-run.h b/gcc/testsuite/gcc.target/powerpc/pr96933-run.h
new file mode 100644
index 0000000..7fa8dac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr96933-run.h
@@ -0,0 +1,56 @@
+/* Test function for pr96933-{3,4}.c run result verification. */
+
+int
+main ()
+{
+ unsigned char uc[16];
+ signed char sc[16];
+
+ for (int i = 0; i < 16; i++)
+ {
+ uc[i] = (unsigned char) (i * 2 + 1);
+ sc[i] = (signed char) ((i % 2 == 0) ? (i + 1) : -i);
+ }
+
+ vector unsigned char ucv
+ = test_uchar (uc[0], uc[1], uc[2], uc[3], uc[4], uc[5], uc[6], uc[7], uc[8],
+ uc[9], uc[10], uc[11], uc[12], uc[13], uc[14], uc[15]);
+ vector signed char scv
+ = test_schar (sc[0], sc[1], sc[2], sc[3], sc[4], sc[5], sc[6], sc[7], sc[8],
+ sc[9], sc[10], sc[11], sc[12], sc[13], sc[14], sc[15]);
+
+ for (int i = 0; i < 16; i++)
+ {
+ unsigned char uexp = (unsigned char) (i * 2 + 1);
+ signed char sexp = (signed char) ((i % 2 == 0) ? (i + 1) : -i);
+ if (ucv[i] != uexp)
+ abort ();
+ if (scv[i] != sexp)
+ abort ();
+ }
+
+ unsigned short us[8];
+ signed short ss[8];
+ for (int i = 0; i < 8; i++)
+ {
+ us[i] = (unsigned short) (i * 2 + 1);
+ ss[i] = (signed short) ((i % 2 == 0) ? (i + 1) : -i);
+ }
+
+ vector unsigned short usv
+ = test_ushort (us[0], us[1], us[2], us[3], us[4], us[5], us[6], us[7]);
+ vector signed short ssv
+ = test_sshort (ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7]);
+
+ for (int i = 0; i < 8; i++)
+ {
+ unsigned short uexp = (unsigned short) (i * 2 + 1);
+ signed short sexp = (signed short) ((i % 2 == 0) ? (i + 1) : -i);
+ if (usv[i] != uexp)
+ abort ();
+ if (ssv[i] != sexp)
+ abort ();
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr96933.h b/gcc/testsuite/gcc.target/powerpc/pr96933.h
new file mode 100644
index 0000000..4bc2b94
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr96933.h
@@ -0,0 +1,50 @@
+/* Source file for pr96933-*.c testing, this mainly contains 4
+ functions as below:
+
+ - test_uchar // vector unsigned char
+ - test_schar // vector signed char
+ - test_ushort // vector unsigned short
+ - test_sshort // vector signed short
+*/
+
+__attribute__ ((noipa)) vector unsigned char
+test_uchar (unsigned char c1, unsigned char c2, unsigned char c3,
+ unsigned char c4, unsigned char c5, unsigned char c6,
+ unsigned char c7, unsigned char c8, unsigned char c9,
+ unsigned char c10, unsigned char c11, unsigned char c12,
+ unsigned char c13, unsigned char c14, unsigned char c15,
+ unsigned char c16)
+{
+ vector unsigned char v
+ = {c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16};
+ return v;
+}
+
+__attribute__ ((noipa)) vector signed char
+test_schar (signed char c1, signed char c2, signed char c3, signed char c4,
+ signed char c5, signed char c6, signed char c7, signed char c8,
+ signed char c9, signed char c10, signed char c11, signed char c12,
+ signed char c13, signed char c14, signed char c15, signed char c16)
+{
+ vector signed char v
+ = {c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16};
+ return v;
+}
+
+__attribute__ ((noipa)) vector unsigned short
+test_ushort (unsigned short c1, unsigned short c2, unsigned short c3,
+ unsigned short c4, unsigned short c5, unsigned short c6,
+ unsigned short c7, unsigned short c8)
+{
+ vector unsigned short v = {c1, c2, c3, c4, c5, c6, c7, c8};
+ return v;
+}
+
+__attribute__ ((noipa)) vector signed short
+test_sshort (signed short c1, signed short c2, signed short c3,
+ signed short c4, signed short c5, signed short c6,
+ signed short c7, signed short c8)
+{
+ vector signed short v = {c1, c2, c3, c4, c5, c6, c7, c8};
+ return v;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr97267.c b/gcc/testsuite/gcc.target/powerpc/pr97267.c
new file mode 100644
index 0000000..cab4624
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr97267.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static int __attribute__ ((__noclone__, __noinline__))
+reg_args (int j1, int j2, int j3, int j4, int j5, int j6, int j7, int j8)
+{
+ return j1 + j2 + j3 + j4 + j5 + j6 + j7 + j8;
+}
+
+int __attribute__ ((__noclone__, __noinline__))
+stack_args (int j1, int j2, int j3, int j4, int j5, int j6, int j7, int j8,
+ int j9)
+{
+ if (j9 == 0)
+ return 0;
+ return reg_args (j1, j2, j3, j4, j5, j6, j7, j8);
+}
+
+/* { dg-final { scan-assembler-not {(?n)^\s+bl\s} } } */
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/r2_shrink-wrap.c b/gcc/testsuite/gcc.target/powerpc/r2_shrink-wrap.c
index b81b9b1..a74da38 100644
--- a/gcc/testsuite/gcc.target/powerpc/r2_shrink-wrap.c
+++ b/gcc/testsuite/gcc.target/powerpc/r2_shrink-wrap.c
@@ -1,5 +1,5 @@
/* { dg-do compile { target lp64 } } */
-/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */
+/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue -mno-pcrel" } */
/* Verify we move the prologue past the TOC reference of 'j' and shrink-wrap
the function. */
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..326a821 100644
--- a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-1.c
@@ -1,6 +1,5 @@
-/* { 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" } */
/* Verify that we vectorize this SAD loop using vabsdub. */
diff --git a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c
index 8149870..3ae5c48 100644
--- a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-2.c
@@ -1,6 +1,5 @@
-/* { 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" } */
/* Verify that we vectorize this SAD loop using vabsduh. */
diff --git a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-3.c b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-3.c
index bb10fe6..2986abb 100644
--- a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-3.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { powerpc*-*-linux* && { lp64 && p9vector_hw } } } } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-do run } */
+/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-O3 -mdejagnu-cpu=power9" } */
/* Verify that we get correct code when we vectorize this SAD loop using
diff --git a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-4.c b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-4.c
index 15f5d14..d24e2a8 100644
--- a/gcc/testsuite/gcc.target/powerpc/sad-vectorize-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/sad-vectorize-4.c
@@ -1,5 +1,5 @@
-/* { dg-do run { target { powerpc*-*-linux* && { lp64 && p9vector_hw } } } } */
-/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-do run } */
+/* { dg-require-effective-target p9vector_hw } */
/* { dg-options "-O3 -mdejagnu-cpu=power9" } */
/* Verify that we get correct code when we vectorize this SAD loop using
diff --git a/gcc/testsuite/gcc.target/powerpc/signbit-1.c b/gcc/testsuite/gcc.target/powerpc/signbit-1.c
index 552dd1b..eb4f53e 100644
--- a/gcc/testsuite/gcc.target/powerpc/signbit-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/signbit-1.c
@@ -1,5 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
-/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-do compile } */
+/* { dg-require-effective-target ppc_float128_sw } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mdejagnu-cpu=power8 -O2 -mfloat128" } */
diff --git a/gcc/testsuite/gcc.target/powerpc/signbit-2.c b/gcc/testsuite/gcc.target/powerpc/signbit-2.c
index d17fc81..ff6af96 100644
--- a/gcc/testsuite/gcc.target/powerpc/signbit-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/signbit-2.c
@@ -1,6 +1,6 @@
-/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
-/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-require-effective-target ppc_float128_sw } */
/* { dg-options "-mdejagnu-cpu=power9 -O2 -mfloat128" } */
int do_signbit_kf (__float128 *a) { return __builtin_signbit (*a); }
diff --git a/gcc/testsuite/gcc.target/powerpc/signbit-3.c b/gcc/testsuite/gcc.target/powerpc/signbit-3.c
index 68d641e..2d1ecb9 100644
--- a/gcc/testsuite/gcc.target/powerpc/signbit-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/signbit-3.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { powerpc*-*-linux* } } } */
+/* { dg-do run } */
/* { dg-require-effective-target ppc_float128_sw } */
/* { dg-options "-mdejagnu-cpu=power7 -O2 -mfloat128 -lm" } */
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..847aebc 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 { target { *-*-aix* || { *-*-linux* && lp64 } } } } */
+/* { 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/vadsdu-0.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-0.c
index 26c9e53..e02ba44 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdu-0.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-0.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c
index 7c54cfe..2f02d39 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c
index a2a668b..2530e67 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-2.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c
index 9755c6f..17d7c8d 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-3.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c
index 4a3dd41..d6e56cc 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-4.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c b/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c
index 9d5947c..ff6d436 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdu-5.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c b/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c
index 58f2797..a460962 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdub-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c b/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c
index 1d51766..c3d1bc8 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsdub-2.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c b/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c
index 1084e75..d08395a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsduh-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c b/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c
index 0448917..7f17694 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsduh-2.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c b/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c
index 4844e3e..8a809d5 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsduw-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c b/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c
index 021772f..a330f52 100644
--- a/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/vadsduw-2.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
/* This test should succeed on both 32- and 64-bit configurations. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-blend-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-blend-runnable.c
index 0c3d472..d63dfee 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-blend-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-blend-runnable.c
@@ -1,11 +1,12 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
@@ -144,7 +145,8 @@ main (int argc, char *argv [])
if (!vec_all_eq (vresult_ushort, expected_vresult_ushort)) {
#if DEBUG
- printf("ERROR, vec_blendv (vsrc_a_ushort, vsrc_b_ushort, vsrc_c_ushort)\n");
+ printf("ERROR, vec_blendv (vsrc_a_ushort, vsrc_b_ushort, "
+ "vsrc_c_ushort)\n");
for(i = 0; i < 8; i++)
printf(" vresult_ushort[%d] = %d, expected_vresult_ushort[%d] = %d\n",
i, vresult_ushort[i], i, expected_vresult_ushort[i]);
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cfuged-1.c b/gcc/testsuite/gcc.target/powerpc/vec-cfuged-1.c
index 2a6f5ed..7507c63 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cfuged-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cfuged-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-clrl-1.c b/gcc/testsuite/gcc.target/powerpc/vec-clrl-1.c
index 7f7d28b..43ab32c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-clrl-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-clrl-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-clrl-3.c b/gcc/testsuite/gcc.target/powerpc/vec-clrl-3.c
index 26eae79..0ae5abc 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-clrl-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-clrl-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-clrr-1.c b/gcc/testsuite/gcc.target/powerpc/vec-clrr-1.c
index 307617e..c72ae86 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-clrr-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-clrr-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-clrr-3.c b/gcc/testsuite/gcc.target/powerpc/vec-clrr-3.c
index b46995d..1413c11 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-clrr-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-clrr-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
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-cntlzm-1.c b/gcc/testsuite/gcc.target/powerpc/vec-cntlzm-1.c
index b92bccf..f356970 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cntlzm-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cntlzm-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cnttzm-1.c b/gcc/testsuite/gcc.target/powerpc/vec-cnttzm-1.c
index 83bdd95..b460c16 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-cnttzm-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-cnttzm-1.c
@@ -1,5 +1,6 @@
-/* { dg-do compile } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
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-extracth-1.c b/gcc/testsuite/gcc.target/powerpc/vec-extracth-1.c
index 13618ce..8109abc 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extracth-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extracth-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extracth-3.c b/gcc/testsuite/gcc.target/powerpc/vec-extracth-3.c
index 1d8a690..7ba9768 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extracth-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extracth-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extracth-5.c b/gcc/testsuite/gcc.target/powerpc/vec-extracth-5.c
index 17229f4..c59dea0 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extracth-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extracth-5.c
@@ -1,4 +1,6 @@
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extracth-7.c b/gcc/testsuite/gcc.target/powerpc/vec-extracth-7.c
index 64ca22e..e74ea5c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extracth-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extracth-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extractl-1.c b/gcc/testsuite/gcc.target/powerpc/vec-extractl-1.c
index 879c253..4153956 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extractl-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extractl-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extractl-3.c b/gcc/testsuite/gcc.target/powerpc/vec-extractl-3.c
index b3ab433..babd25f 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extractl-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extractl-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extractl-5.c b/gcc/testsuite/gcc.target/powerpc/vec-extractl-5.c
index df239e8..e642e31 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extractl-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extractl-5.c
@@ -1,4 +1,6 @@
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extractl-7.c b/gcc/testsuite/gcc.target/powerpc/vec-extractl-7.c
index fd1ab60..4c3c7cb 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-extractl-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-extractl-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-gnb-1.c b/gcc/testsuite/gcc.target/powerpc/vec-gnb-1.c
index 527cc3f..e64fe02 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-gnb-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-gnb-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target int128 } */
/* { dg-options "-mdejagnu-cpu=power10" } */
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-insert-word-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-insert-word-runnable.c
index 8c2721a..bd96e13 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-insert-word-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-insert-word-runnable.c
@@ -1,11 +1,12 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
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-pdep-1.c b/gcc/testsuite/gcc.target/powerpc/vec-pdep-1.c
index 02404a6d..d7e6484 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-pdep-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-pdep-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-permute-ext-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-permute-ext-runnable.c
index c2dcd48..f833265 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-permute-ext-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-permute-ext-runnable.c
@@ -1,11 +1,12 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-pext-1.c b/gcc/testsuite/gcc.target/powerpc/vec-pext-1.c
index ed289bf..286fdce 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-pext-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-pext-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-replace-word-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-replace-word-runnable.c
index 94af210..9497cbf 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-replace-word-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-replace-word-runnable.c
@@ -1,12 +1,13 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
@@ -212,7 +213,8 @@ main (int argc, char *argv [])
if (!vec_all_eq (vresult_float, expected_vresult_float)) {
#if DEBUG
- printf("ERROR, vec_replace_unaligned (src_vb_float, src_va_float, index)\n");
+ printf("ERROR, vec_replace_unaligned (src_vb_float, src_va_float, "
+ "index)\n");
for(i = 0; i < 4; i++)
printf(" vresult_float[%d] = %f, expected_vresult_float[%d] = %f\n",
i, vresult_float[i], i, expected_vresult_float[i]);
@@ -233,7 +235,8 @@ main (int argc, char *argv [])
if (!vec_all_eq (vresult_ullint, expected_vresult_ullint)) {
#if DEBUG
- printf("ERROR, vec_replace_unaligned (src_vb_ullint, src_va_ullint, index)\n");
+ printf("ERROR, vec_replace_unaligned (src_vb_ullint, src_va_ullint, "
+ "index)\n");
for(i = 0; i < 2; i++)
printf(" vresult_ullint[%d] = %d, expected_vresult_ullint[%d] = %d\n",
i, vresult_ullint[i], i, expected_vresult_ullint[i]);
@@ -252,7 +255,8 @@ main (int argc, char *argv [])
if (!vec_all_eq (vresult_llint, expected_vresult_llint)) {
#if DEBUG
- printf("ERROR, vec_replace_unaligned (src_vb_llint, src_va_llint, index)\n");
+ printf("ERROR, vec_replace_unaligned (src_vb_llint, src_va_llint, "
+ "index)\n");
for(i = 0; i < 2; i++)
printf(" vresult_llint[%d] = %d, expected_vresult_llint[%d] = %d\n",
i, vresult_llint[i], i, expected_vresult_llint[i]);
@@ -270,8 +274,8 @@ main (int argc, char *argv [])
if (!vec_all_eq (vresult_double, expected_vresult_double)) {
#if DEBUG
- printf("ERROR, vec_replace_unaligned (src_vb_double, src_va_double, index)\
-n");
+ printf("ERROR, vec_replace_unaligned (src_vb_double, src_va_double, "
+ "index)\n");
for(i = 0; i < 2; i++)
printf(" vresult_double[%d] = %f, expected_vresult_double[%d] = %f\n",
i, vresult_double[i], i, expected_vresult_double[i]);
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-shift-double-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-shift-double-runnable.c
index 13213bd..90b19f0 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-shift-double-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-shift-double-runnable.c
@@ -1,11 +1,12 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
@@ -378,7 +379,5 @@ main (int argc, char *argv [])
return 0;
}
-/* { dg-final { scan-assembler-times {\msldbi\M} 6 } } */
-/* { dg-final { scan-assembler-times {\msrdbi\M} 6 } } */
-
-
+/* { dg-final { scan-assembler-times {\mvsldbi\M} 8 } } */
+/* { dg-final { scan-assembler-times {\mvsrdbi\M} 8 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
index afb0bfd..e84ce77 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
@@ -1,11 +1,12 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
#define DEBUG 0
-#ifdef DEBUG
+#if DEBUG
#include <stdio.h>
#endif
@@ -100,7 +101,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-stril-1.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-1.c
index 98ee29f..ce83f77 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-16.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-16.c
index 6aaad99..ad888d8 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-16.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-16.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-stril-17.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-17.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-17.c
index 2015aad..6274f2a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-17.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-17.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-18.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-18.c
index fce56937..be48daa 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-18.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-18.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-stril-19.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-19.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-19.c
index 6226dde..74ab15c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-19.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-19.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-20.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-20.c
index 9da116c..a2db6a7 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-20.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-20.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-stril-21.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-21.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-21.c
index b281c45..07274c68 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-21.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-21.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-22.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-22.c
index a63dab7..a2e6bac 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-22.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-22.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-stril-23.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-23.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-23.c
index ec0e483..a5ef78d 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-23.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-23.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-3.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-3.c
index 970c1a1..49cb232 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-5.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-5.c
index c74cad6..8e29d55 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-5.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril-7.c b/gcc/testsuite/gcc.target/powerpc/vec-stril-7.c
index 9c5d454..6b39dfc 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-1.c b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-1.c
index cd9c468..ca2c76c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-3.c b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-3.c
index 24b0a86..8fb3fe7 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-5.c b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-5.c
index 2c2ff34..bc8834a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-5.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-7.c b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-7.c
index 900aaf1..d235a53 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-stril_p-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-stril_p-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-1.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-1.c
index ff09cd3..5bee3f7 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-16.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-16.c
index 19e051e..86a450e 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-16.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-16.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-strir-17.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-17.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-17.c
index 00f27cc..d660092 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-17.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-17.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-18.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-18.c
index d69b474..c6dd6ca 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-18.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-18.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-strir-19.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-19.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-19.c
index 3728d49..54277cc 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-19.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-19.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-20.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-20.c
index a635a04..3baa035 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-20.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-20.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-strir-21.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-21.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-21.c
index 5557d5d..1a90e56 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-21.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-21.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-22.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-22.c
index 328a56b..5621f3c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-22.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-22.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O1 -mdejagnu-cpu=power10" } */
/* See vec-strir-23.c for the same test with -O2 optimization. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-23.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-23.c
index 5f05ab2..118c702 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-23.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-23.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-3.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-3.c
index 5fb2306..c266d3a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-5.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-5.c
index eabecaf..f18d91b 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-5.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir-7.c b/gcc/testsuite/gcc.target/powerpc/vec-strir-7.c
index a73efea..2641985 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-1.c b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-1.c
index 569b8b4..3744c90 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-3.c b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-3.c
index 3a411fe..70ab0f6 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-3.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-5.c b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-5.c
index 0edff34..ad02c97 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-5.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-7.c b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-7.c
index 18926b0..71ce608 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-strir_p-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-strir_p-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-1.c b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-1.c
index 052d99d..3cd0a55 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-1.c
@@ -1,5 +1,6 @@
-/* { dg-do run} */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-3.c b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-3.c
index 411bafe..9697068 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-3.c
@@ -1,6 +1,7 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-5.c b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-5.c
index 527e8f2..4d4344b 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-5.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-7.c b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-7.c
index b754195..45936f3 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-7.c
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-9.c b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-9.c
index 0d9998e..bcf4a35 100644
--- a/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-9.c
+++ b/gcc/testsuite/gcc.target/powerpc/vec-ternarylogic-9.c
@@ -1,7 +1,8 @@
-/* { dg-do run } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
/* { dg-require-effective-target int128 } */
-/* { dg-options "-mdejagnu-cpu=power10" } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
#include <altivec.h>
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/vslv-0.c b/gcc/testsuite/gcc.target/powerpc/vslv-0.c
index b7e5172..f921b2c 100644
--- a/gcc/testsuite/gcc.target/powerpc/vslv-0.c
+++ b/gcc/testsuite/gcc.target/powerpc/vslv-0.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vslv-1.c b/gcc/testsuite/gcc.target/powerpc/vslv-1.c
index c1a58c8..37407c1 100644
--- a/gcc/testsuite/gcc.target/powerpc/vslv-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vslv-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vsrv-0.c b/gcc/testsuite/gcc.target/powerpc/vsrv-0.c
index fc3be46..8ecd326 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsrv-0.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsrv-0.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/powerpc/vsrv-1.c b/gcc/testsuite/gcc.target/powerpc/vsrv-1.c
index 112899a..186e79a 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsrv-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsrv-1.c
@@ -1,6 +1,5 @@
-/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p9vector_ok } */
-/* { dg-skip-if "" { powerpc*-*-aix* } } */
/* { dg-options "-mdejagnu-cpu=power9" } */
#include <altivec.h>
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..c23a912
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-char.c
@@ -0,0 +1,172 @@
+/*
+ Test of vec_xl_sext and vec_xl_zext (load into rightmost
+ vector element and zero/sign extend). */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -save-temps" } */
+
+/* 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..c40e1a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.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 run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+
+/* 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 -save-temps" } */
+
+/* { 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..405b424
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
@@ -0,0 +1,171 @@
+/*
+ Test of vec_xl_sext and vec_xl_zext (load into rightmost
+ vector element and zero/sign extend). */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-mdejagnu-cpu=power10 -O3 -save-temps" } */
+
+/* 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..837ba79
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.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 run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+
+/* 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 -save-temps" } */
+
+/* { 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..3049b1c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-char.c
@@ -0,0 +1,127 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+/* 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 -save-temps" } */
+
+/* { 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..7cc7699
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-int.c
@@ -0,0 +1,127 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+/* 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 -save-temps" } */
+
+/* { 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..e1bd021
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c
@@ -0,0 +1,128 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+
+/* 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 -save-temps" } */
+
+/* { 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..b173b36
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-short.c
@@ -0,0 +1,128 @@
+/*
+ Test of vec_xst_trunc (truncate and store rightmost vector element) */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-do compile { target { ! power10_hw } } } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
+
+/* 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 -save-temps" } */
+
+/* { 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/vsx_mask-count-runnable.c b/gcc/testsuite/gcc.target/powerpc/vsx_mask-count-runnable.c
index f1e3860..1ea2d65 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx_mask-count-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx_mask-count-runnable.c
@@ -1,6 +1,8 @@
-/* { dg-do run } */
-/* { dg-options "-mcpu=power10 -O2" } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -save-temps" } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
/* Check that the expected 128-bit instructions are generated if the processor
supports the 128-bit integer instructions. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx_mask-expand-runnable.c b/gcc/testsuite/gcc.target/powerpc/vsx_mask-expand-runnable.c
index 0c5695e..2c49814 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx_mask-expand-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx_mask-expand-runnable.c
@@ -1,6 +1,8 @@
-/* { dg-do run } */
-/* { dg-options "-mcpu=power10 -O2" } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -save-temps" } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
/* Check that the expected 128-bit instructions are generated if the processor
supports the 128-bit integer instructions. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx_mask-extract-runnable.c b/gcc/testsuite/gcc.target/powerpc/vsx_mask-extract-runnable.c
index 93c3c72..9e257f5 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx_mask-extract-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx_mask-extract-runnable.c
@@ -1,6 +1,8 @@
-/* { dg-do run } */
-/* { dg-options "-mcpu=power10 -O2" } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -save-temps" } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
/* Check that the expected 128-bit instructions are generated if the processor
supports the 128-bit integer instructions. */
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx_mask-move-runnable.c b/gcc/testsuite/gcc.target/powerpc/vsx_mask-move-runnable.c
index 41dee58..53fd99e 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx_mask-move-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx_mask-move-runnable.c
@@ -1,6 +1,8 @@
-/* { dg-do run } */
-/* { dg-options "-mcpu=power10 -O2" } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
+/* { dg-options "-mdejagnu-cpu=power10 -O2 -save-temps" } */
+/* { dg-require-effective-target power10_ok } */
+/* { dg-require-effective-target int128 } */
/* Check that the expected 128-bit instructions are generated if the processor
supports the 128-bit integer instructions. */
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/powerpc/xxgenpc-runnable.c b/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c
index 244c573..d4040ea 100644
--- a/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/xxgenpc-runnable.c
@@ -1,6 +1,7 @@
-/* { dg-do run } */
+/* { dg-do run { target { power10_hw } } } */
+/* { dg-do link { target { ! power10_hw } } } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
-/* { dg-require-effective-target power10_hw } */
+/* { dg-require-effective-target power10_ok } */
#include <altivec.h>
diff --git a/gcc/testsuite/gcc.target/riscv/arch-7.c b/gcc/testsuite/gcc.target/riscv/arch-7.c
new file mode 100644
index 0000000..74ab248
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-7.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv32i -march=rv32im_s -mabi=ilp32" } */
+int foo()
+{
+}
+/* { dg-error ".'-march=rv32im_s': name of supervisor extension must be more than 1 letter" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/riscv/attribute-10.c b/gcc/testsuite/gcc.target/riscv/attribute-10.c
index a874a62..26fdd08 100644
--- a/gcc/testsuite/gcc.target/riscv/attribute-10.c
+++ b/gcc/testsuite/gcc.target/riscv/attribute-10.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -march=rv32i -march=rv32im_s_sx_unexpectedstring -mabi=ilp32" } */
+/* { dg-options "-O2 -march=rv32i -march=rv32im_sx_unexpectedstring -mabi=ilp32" } */
int foo()
{
}
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/s390/pr97497.c b/gcc/testsuite/gcc.target/s390/pr97497.c
new file mode 100644
index 0000000..460c850
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr97497.c
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -march=z900 -mzarch -fpic" } */
+
+char *t;
+
+void __attribute__((noinline,noclone))
+bar(int a, char* b)
+{
+ if (a != 1)
+ __builtin_abort();
+}
+
+void __attribute__((noinline,noclone))
+baz(char* a, int b)
+{
+ if (b != 1)
+ __builtin_abort();
+}
+
+int __attribute__((noinline,noclone))
+foo (int a)
+{
+ bar (1, t);
+ if (a)
+ baz (t, 1);
+
+ bar (1, t);
+}
+
+int
+main ()
+{
+ foo (1);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-callee-abi-scan.c b/gcc/testsuite/gcc.target/s390/vector/long-double-callee-abi-scan.c
new file mode 100644
index 0000000..69e8c61
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-callee-abi-scan.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -fno-unroll-loops" } */
+#include <stdarg.h>
+
+__attribute__ ((noipa, used)) long double
+long_double_callee (long double x, int n, ...)
+{
+ long double sum = x;
+ va_list vl;
+ int i;
+
+ va_start (vl, n);
+ for (i = 0; i < n; i++)
+ sum += va_arg (vl, long double);
+ va_end (vl);
+
+ return sum;
+}
+
+/* { dg-final { scan-assembler-times {\n\tvl\t} 3 } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-run.c b/gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-run.c
new file mode 100644
index 0000000..f3a41ba
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-run.c
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-callee-abi-scan.c"
+#include "long-double-caller-abi-scan.c"
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-scan.c b/gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-scan.c
new file mode 100644
index 0000000..c1ec5b1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-caller-abi-scan.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include <assert.h>
+
+long double long_double_callee (long double x, int n, ...);
+
+int
+main ()
+{
+ assert (long_double_callee (1.L, 2, 2.L, 3.L) == 6.L);
+}
+
+/* { dg-final { scan-assembler-times {\n\tvst\t} 3 } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-copysign.c b/gcc/testsuite/gcc.target/s390/vector/long-double-copysign.c
new file mode 100644
index 0000000..3115195
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-copysign.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_copysign (long double x, long double y)
+{
+ return __builtin_copysignl (x, y);
+}
+
+/* { dg-final { scan-assembler-times {\n\tvsel\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_copysign (1.1L, 2.2L) == 1.1L);
+ assert (long_double_copysign (1.1L, -2.2L) == -1.1L);
+ assert (long_double_copysign (-1.1L, 2.2L) == 1.1L);
+ assert (long_double_copysign (-1.1L, -2.2L) == -1.1L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-fprx2-constant.c b/gcc/testsuite/gcc.target/s390/vector/long-double-fprx2-constant.c
new file mode 100644
index 0000000..02a6a1f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-fprx2-constant.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mtune=z14 -funroll-loops" } */
+
+long double a;
+int d;
+void
+b ()
+{
+ for (int c = 0; c < d; ++c)
+ a = (a - c) / (c + 1);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-double.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-double.c
new file mode 100644
index 0000000..5eb31f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-double.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_double (double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\twflld\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_double (42.) == 42.L);
+ assert (long_double_from_double (-42.) == -42.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-float.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-float.c
new file mode 100644
index 0000000..0449f0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-float.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_float (float x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tldebr\t} 1 } } */
+/* { dg-final { scan-assembler-times {\n\twflld\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_float (42.F) == 42.L);
+ assert (long_double_from_float (-42.F) == -42.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-i16.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i16.c
new file mode 100644
index 0000000..68b164d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i16.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_i16 (int16_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxfbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_i16 (42) == 42.L);
+ assert (long_double_from_i16 (-42) == -42.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-i32.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i32.c
new file mode 100644
index 0000000..ad8443b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i32.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_i32 (int32_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxfbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_i32 (42) == 42.L);
+ assert (long_double_from_i32 (-42) == -42.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-i64.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i64.c
new file mode 100644
index 0000000..3d2c424
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i64.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_i64 (int64_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxgbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_i64 (42) == 42.L);
+ assert (long_double_from_i64 (-42) == -42.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-i8.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i8.c
new file mode 100644
index 0000000..44c8c9d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-i8.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_i8 (int8_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxfbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_i8 (42) == 42.L);
+ assert (long_double_from_i8 (-42) == -42.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-u16.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u16.c
new file mode 100644
index 0000000..f10c298
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u16.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_u16 (uint16_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxlfbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_u16 (42) == 42.L);
+ assert (long_double_from_u16 (-42) == 65494.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-u32.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u32.c
new file mode 100644
index 0000000..2763fb4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u32.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_u32 (uint32_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxlfbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_u32 (42) == 42.L);
+ assert (long_double_from_u32 (-42) == 4294967254.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-u64.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u64.c
new file mode 100644
index 0000000..4686dfd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u64.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_u64 (uint64_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxlgbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_u64 (42) == 42.L);
+ assert (long_double_from_u64 (-42) == 18446744073709551574.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-from-u8.c b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u8.c
new file mode 100644
index 0000000..3e6eb92
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-from-u8.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static long double
+long_double_from_u8 (uint8_t x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcxlfbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_from_u8 (42) == 42.L);
+ assert (long_double_from_u8 (-42) == 214.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-double.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-double.c
new file mode 100644
index 0000000..88aa053
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-double.c
@@ -0,0 +1,18 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+
+__attribute__ ((noipa)) static double
+long_double_to_double (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\twflrx\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_double (42.L) == 42.);
+ assert (long_double_to_double (-42.L) == -42.);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-float.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-float.c
new file mode 100644
index 0000000..36fd429
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-float.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+
+__attribute__ ((noipa)) static float
+long_double_to_float (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\twflrx\t%v\d+,%v\d+,0,3\n} 1 } } */
+/* { dg-final { scan-assembler-times {\n\tledbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_float (42.L) == 42.F);
+ assert (long_double_to_float (-42.L) == -42.F);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-i16.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i16.c
new file mode 100644
index 0000000..ddfc668
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i16.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static int16_t
+long_double_to_i16 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcfxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_i16 (42.L) == 42);
+ assert (long_double_to_i16 (-42.L) == -42);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-i32.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i32.c
new file mode 100644
index 0000000..975a5de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i32.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static int32_t
+long_double_to_i32 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcfxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_i32 (42.L) == 42);
+ assert (long_double_to_i32 (-42.L) == -42);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-i64.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i64.c
new file mode 100644
index 0000000..6bd5079
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i64.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static int64_t
+long_double_to_i64 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,1\n} 1 } } */
+/* { dg-final { scan-assembler-times {\n\tvpdi\t%v\d+,%v\d+,%v\d+,5\n} 1 } } */
+/* { dg-final { scan-assembler-times {\n\tcgxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_i64 (42.L) == 42);
+ assert (long_double_to_i64 (-42.L) == -42);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-i8.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i8.c
new file mode 100644
index 0000000..46e6d6b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-i8.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static int8_t
+long_double_to_i8 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tcfxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_i8 (42.L) == 42);
+ assert (long_double_to_i8 (-42.L) == -42);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-u16.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u16.c
new file mode 100644
index 0000000..0690f3d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u16.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static uint16_t
+long_double_to_u16 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tclfxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_u16 (42.L) == 42);
+ /* Not (-42 & 0xffff) due to loss of precision. */
+ assert (long_double_to_u16 (-42.L) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-u32.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u32.c
new file mode 100644
index 0000000..aa0e318
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u32.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static uint32_t
+long_double_to_u32 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tclfxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_u32 (42.L) == 42);
+ /* Not (-42 & 0xffffffff) due to loss of precision. */
+ assert (long_double_to_u32 (-42.L) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-u64.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u64.c
new file mode 100644
index 0000000..e37b65e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u64.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static uint64_t
+long_double_to_u64 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tclgxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_u64 (42.L) == 42);
+ /* Not (-42 & 0xffffffffffffffff) due to loss of precision. */
+ assert (long_double_to_u64 (-42.L) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-to-u8.c b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u8.c
new file mode 100644
index 0000000..bddbff8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-to-u8.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+#include <stdint.h>
+
+__attribute__ ((noipa)) static uint8_t
+long_double_to_u8 (long double x)
+{
+ return x;
+}
+
+/* { dg-final { scan-assembler-times {\n\tclfxbr\t} 1 } } */
+
+int
+main (void)
+{
+ assert (long_double_to_u8 (42.L) == 42);
+ /* Not (-42 & 0xff) due to loss of precision. */
+ assert (long_double_to_u8 (-42.L) == 0);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-vec-duplicate.c b/gcc/testsuite/gcc.target/s390/vector/long-double-vec-duplicate.c
new file mode 100644
index 0000000..2ce9da3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-vec-duplicate.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -funroll-loops -march=z14 -mtune=z14" } */
+
+long double a, b;
+double *c;
+long double *d;
+
+void
+e ()
+{
+ while (d != &a)
+ *d++ = b * *c++;
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wf.h b/gcc/testsuite/gcc.target/s390/vector/long-double-wf.h
new file mode 100644
index 0000000..a564fc6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wf.h
@@ -0,0 +1,60 @@
+#ifndef LONG_DOUBLE_WF_H
+#define LONG_DOUBLE_WF_H 1
+
+#include <math.h>
+
+#define ADD(x, y, z) ((x) + (z))
+#define DIV(x, y, z) ((x) / (z))
+#define FABSL(x, y, z) (fabsl (y))
+#define ISINFL(x, y, z) (isinfl (x) ? (y) : (z))
+#define MUL(x, y, z) ((x) * (z))
+#define MUL_ADD(x, y, z) ((x) * (y) + (z))
+#define MUL_SUB(x, y, z) ((x) * (y) - (z))
+#define NEG(x, y, z) \
+ ({ \
+ volatile long double r = -(y); \
+ r; \
+ })
+#define NEG_MUL_ADD(x, y, z) NEG (0, MUL_ADD (x, y, z), 0)
+#define NEG_MUL_SUB(x, y, z) NEG (0, MUL_SUB (x, y, z), 0)
+#define QUIET_IFEQUAL(x, y, z) ((x) == (y) ? (z) : 0)
+#define QUIET_IFGREATER(x, y, z) (__builtin_isgreater (x, y) ? (z) : 0)
+#define QUIET_IFLESS(x, y, z) (__builtin_isless (x, y) ? (z) : 0)
+#define QUIET_IFUNORDERED(x, y, z) (__builtin_isunordered (x, y) ? (z) : 0)
+#define SIGNALING_IFEQUAL(x, y, z) (((x) >= (y) && (x) <= (y)) ? (z) : 0)
+#define SIGNALING_IFGREATER(x, y, z) ((x) > (y) ? (z) : 0)
+#define SIGNALING_IFLESS(x, y, z) ((x) < (y) ? (z) : 0)
+#define ROUNDL(x, y, z) (roundl (y))
+#define SQRTL(x, y, z) (sqrtl (y))
+#define SUB(x, y, z) ((x) - (z))
+
+#define LONG_DOUBLE_WF(op) \
+ long double test ( \
+ long double x0, long double x1, long double x2, long double x3, \
+ long double x4, long double x5, long double x6, long double x7, \
+ long double x8, long double x9, long double x10, long double x11, \
+ long double x12, long double x13, long double x14, long double x15) \
+ { \
+ while (x15 < 1E+30) \
+ { \
+ x0 = op (x1, x2, x3); \
+ x1 = op (x2, x3, x4) + 1; \
+ x2 = op (x3, x4, x5) + 2; \
+ x3 = op (x4, x5, x6) + 3; \
+ x4 = op (x5, x6, x7) + 4; \
+ x5 = op (x6, x7, x8) + 5; \
+ x6 = op (x7, x8, x9) + 6; \
+ x7 = op (x8, x9, x10) + 7; \
+ x8 = op (x9, x10, x11) + 8; \
+ x9 = op (x10, x11, x12) + 9; \
+ x10 = op (x11, x12, x13) + 10; \
+ x11 = op (x12, x13, x14) + 11; \
+ x12 = op (x13, x14, x15) + 12; \
+ x13 = op (x14, x15, x0) + 13; \
+ x14 = op (x15, x0, x1) + 14; \
+ x15 = op (x0, x1, x2) + 15; \
+ } \
+ return x15; \
+ }
+
+#endif
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfaxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfaxb.c
new file mode 100644
index 0000000..1b35c1c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfaxb.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+
+__attribute__ ((noipa)) static long double
+wfaxb (long double x, long double y, long double z)
+{
+ return x + y + z;
+}
+
+/* { dg-final { scan-assembler-times {\n\twfaxb\t} 2 } } */
+
+int
+main (void)
+{
+ assert (wfaxb (1.11L, 2.22L, 3.33L) == 6.66L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0001.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0001.c
new file mode 100644
index 0000000..9ffff6f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0001.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (QUIET_IFUNORDERED);
+
+/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
+/* jo == brc 0b0001, ... */
+/* { dg-final { scan-assembler {\n\tjo\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0111.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0111.c
new file mode 100644
index 0000000..3ade835
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-0111.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (QUIET_IFEQUAL);
+
+/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
+/* jne == brc 0b0111, ... */
+/* { dg-final { scan-assembler {\n\tjne\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1011.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1011.c
new file mode 100644
index 0000000..a9c819d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1011.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (QUIET_IFLESS);
+
+/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
+/* jnl == brc 0b1011, ... */
+/* { dg-final { scan-assembler {\n\tjnl\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1101.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1101.c
new file mode 100644
index 0000000..47ea7c7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfcxb-1101.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (QUIET_IFGREATER);
+
+/* { dg-final { scan-assembler {\n\twfcxb\t} } } */
+/* jnh == brc 0b1101, ... */
+/* { dg-final { scan-assembler {\n\tjnh\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfdxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfdxb.c
new file mode 100644
index 0000000..16b4893
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfdxb.c
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch --save-temps" } */
+#include <assert.h>
+
+__attribute__ ((noipa)) static long double
+wfdxb (long double x, long double y, long double z)
+{
+ return (x / y) / z;
+}
+
+/* { dg-final { scan-assembler-times {\n\twfdxb\t} 2 } } */
+
+int
+main (void)
+{
+ assert (wfdxb (2.22L, 1.11L, 2.L) == 1.L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfixb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfixb.c
new file mode 100644
index 0000000..69348bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfixb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (ROUNDL);
+
+/* { dg-final { scan-assembler {\n\twfixb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-0111.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-0111.c
new file mode 100644
index 0000000..0f7b209
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-0111.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (SIGNALING_IFEQUAL);
+
+/* { dg-final { scan-assembler {\n\twfkxb\t} } } */
+/* jne == brc 0b0111, ... */
+/* { dg-final { scan-assembler {\n\tjne\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1011.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1011.c
new file mode 100644
index 0000000..b76dbb0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1011.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (SIGNALING_IFLESS);
+
+/* { dg-final { scan-assembler {\n\twfkxb\t} } } */
+/* jnl == brc 0b1011, ... */
+/* { dg-final { scan-assembler {\n\tjnl\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1101.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1101.c
new file mode 100644
index 0000000..61f0ec4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfkxb-1101.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (SIGNALING_IFGREATER);
+
+/* { dg-final { scan-assembler {\n\twfkxb\t} } } */
+/* jnh == brc 0b1101, ... */
+/* { dg-final { scan-assembler {\n\tjnh\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wflcxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wflcxb.c
new file mode 100644
index 0000000..ddcf972
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wflcxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (NEG);
+
+/* { dg-final { scan-assembler {\n\twflcxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wflpxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wflpxb.c
new file mode 100644
index 0000000..df90505
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wflpxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (FABSL);
+
+/* { dg-final { scan-assembler {\n\twflpxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-2.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-2.c
new file mode 100644
index 0000000..0b2fdcc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-2.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
+
+int a, c, d, f, k, l, m;
+long double b, e, g, h, i;
+double j;
+
+void
+n (void)
+{
+ while (m)
+ {
+ a = b * d;
+ b = c;
+ c = d * e + 2;
+ e = f + g + 4;
+ f = h + 6;
+ g = h * 0 + i + 7;
+ h = i + 9;
+ i = j * k + 0 + 10;
+ j = l;
+ m = a * b;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-3.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-3.c
new file mode 100644
index 0000000..9ef49c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
+
+long double a, c, d;
+int b;
+void
+e (void)
+{
+ while (d)
+ {
+ a = 0 * c + 0;
+ d = b;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-disabled.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-disabled.c
new file mode 100644
index 0000000..59bc80a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb-disabled.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (MUL_ADD);
+
+/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
+/* { dg-final { scan-assembler {\n\twfaxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb.c
new file mode 100644
index 0000000..319a02f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmaxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (MUL_ADD);
+
+/* { dg-final { scan-assembler {\n\twfmaxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb-disabled.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb-disabled.c
new file mode 100644
index 0000000..bb5c0f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb-disabled.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (MUL_SUB);
+
+/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
+/* { dg-final { scan-assembler {\n\twfsxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb.c
new file mode 100644
index 0000000..c14f673
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmsxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (MUL_SUB);
+
+/* { dg-final { scan-assembler {\n\twfmsxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfmxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmxb.c
new file mode 100644
index 0000000..6ab1e68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfmxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (MUL);
+
+/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb-disabled.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb-disabled.c
new file mode 100644
index 0000000..8c5298e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb-disabled.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (NEG_MUL_ADD);
+
+/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
+/* { dg-final { scan-assembler {\n\twfaxb\t} } } */
+/* { dg-final { scan-assembler {\n\twflcxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb.c
new file mode 100644
index 0000000..9f0da13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmaxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (NEG_MUL_ADD);
+
+/* { dg-final { scan-assembler {\n\twfnmaxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb-disabled.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb-disabled.c
new file mode 100644
index 0000000..39e4f60
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb-disabled.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (NEG_MUL_SUB);
+
+/* { dg-final { scan-assembler {\n\twfmxb\t} } } */
+/* { dg-final { scan-assembler {\n\twfsxb\t} } } */
+/* { dg-final { scan-assembler {\n\twflcxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb.c
new file mode 100644
index 0000000..698e277
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfnmsxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch -mvx-long-double-fma" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (NEG_MUL_SUB);
+
+/* { dg-final { scan-assembler {\n\twfnmsxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfsqxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfsqxb.c
new file mode 100644
index 0000000..09f9128
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfsqxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (SQRTL);
+
+/* { dg-final { scan-assembler {\n\twfsqxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb-1.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb-1.c
new file mode 100644
index 0000000..20960d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb-1.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include <assert.h>
+
+typedef float tf __attribute__ ((mode (TF)));
+static tf x;
+static tf y;
+
+__attribute__ ((noipa)) static tf
+sub (void)
+{
+ return x - y;
+}
+
+int
+main (void)
+{
+ x = 1.5L;
+ y = 2.5L;
+ assert (sub () == -1.0L);
+}
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb.c
new file mode 100644
index 0000000..1c430ee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wfsxb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (SUB);
+
+/* { dg-final { scan-assembler {\n\twfsxb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb-1.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb-1.c
new file mode 100644
index 0000000..224995f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -march=z14 -mzarch" } */
+
+int a, b;
+
+void
+c (void)
+{
+ long double d;
+ a = d;
+ if (__builtin_isinf (d))
+ b = 0;
+}
+
+/* { dg-final { scan-assembler {\n\twftcixb\t} } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb.c b/gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb.c
new file mode 100644
index 0000000..c2658b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/long-double-wftcixb.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=z14 -mzarch" } */
+#include "long-double-wf.h"
+
+LONG_DOUBLE_WF (ISINFL);
+
+/* { dg-final { scan-assembler {\n\twftcixb\t} } } */
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21299/func.d b/gcc/testsuite/gdc.test/compilable/imports/test21299/func.d
new file mode 100644
index 0000000..fe3321f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test21299/func.d
@@ -0,0 +1,8 @@
+module imports.test21299.func;
+import imports.test21299.mtype;
+import imports.test21299.rootstringtable;
+class FuncDeclaration {
+ StringTable!Type stringtable;
+ StringTable2!Type stringtable2;
+ StringTable3!Type stringtable3;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21299/mtype.d b/gcc/testsuite/gdc.test/compilable/imports/test21299/mtype.d
new file mode 100644
index 0000000..01bac82
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test21299/mtype.d
@@ -0,0 +1,8 @@
+module imports.test21299.mtype;
+import imports.test21299.func;
+import imports.test21299.rootstringtable;
+class Type {
+ StringTable!Type stringtable;
+ StringTable2!Type stringtable2;
+ StringTable3!Type stringtable3;
+}
diff --git a/gcc/testsuite/gdc.test/compilable/imports/test21299/rootstringtable.d b/gcc/testsuite/gdc.test/compilable/imports/test21299/rootstringtable.d
new file mode 100644
index 0000000..12a2d92
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/imports/test21299/rootstringtable.d
@@ -0,0 +1,96 @@
+module imports.test21299.rootstringtable;
+struct StringValue(T)
+{
+ char* lstring()
+ {
+ return cast(char*)&this;
+ }
+}
+
+struct StringTable(T)
+{
+ StringValue!T* insert()
+ {
+ allocValue;
+ return getValue;
+ }
+
+ uint allocValue()
+ {
+ StringValue!(T) sv;
+ sv.lstring[0] = 0;
+ return 0;
+ }
+
+ StringValue!T* getValue()
+ {
+ return cast(StringValue!T*)&this;
+ }
+}
+
+// Other tests are the same as the original issue, but use other kinds of
+// nesting Dsymbols that need to be handled by templateInstanceSemantic().
+struct StringValue2(T)
+{
+ char* lstring()
+ {
+ return cast(char*)&this;
+ }
+}
+
+struct StringTable2(T)
+{
+ @nogc // AttribDeclaration (also covers pragma, extern(), static foreach, ...)
+ {
+ StringValue2!T* insert()
+ {
+ allocValue;
+ return getValue;
+ }
+
+ uint allocValue()
+ {
+ StringValue2!(T) sv;
+ sv.lstring[0] = 0;
+ return 0;
+ }
+
+ StringValue2!T* getValue()
+ {
+ return cast(StringValue2!T*)&this;
+ }
+ }
+}
+
+//
+struct StringValue3(T)
+{
+ char* lstring()
+ {
+ return cast(char*)&this;
+ }
+}
+
+struct StringTable3(T)
+{
+ static if (true) // ConditionalDeclaration (static if)
+ {
+ StringValue3!T* insert()
+ {
+ allocValue;
+ return getValue;
+ }
+
+ uint allocValue()
+ {
+ StringValue3!(T) sv;
+ sv.lstring[0] = 0;
+ return 0;
+ }
+
+ StringValue3!T* getValue()
+ {
+ return cast(StringValue3!T*)&this;
+ }
+ }
+}
diff --git a/gcc/testsuite/gdc.test/compilable/test21299a.d b/gcc/testsuite/gdc.test/compilable/test21299a.d
new file mode 100644
index 0000000..049ee6a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21299a.d
@@ -0,0 +1,4 @@
+// EXTRA_SOURCES: imports/test21299/mtype.d imports/test21299/rootstringtable.d
+// REQUIRED_ARGS: -main
+// LINK
+module test21299a;
diff --git a/gcc/testsuite/gdc.test/compilable/test21299b.d b/gcc/testsuite/gdc.test/compilable/test21299b.d
new file mode 100644
index 0000000..b9d992a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21299b.d
@@ -0,0 +1,4 @@
+// EXTRA_SOURCES: imports/test21299/func.d imports/test21299/rootstringtable.d
+// REQUIRED_ARGS: -main
+// LINK:
+module test21299b;
diff --git a/gcc/testsuite/gdc.test/compilable/test21299c.d b/gcc/testsuite/gdc.test/compilable/test21299c.d
new file mode 100644
index 0000000..88ed21f
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21299c.d
@@ -0,0 +1,5 @@
+// EXTRA_SOURCES: imports/test21299/mtype.d imports/test21299/func.d imports/test21299/rootstringtable.d
+// COMPILE_SEPARATELY:
+// LINK:
+module test21299c;
+void main() {}
diff --git a/gcc/testsuite/gdc.test/compilable/test21299d.d b/gcc/testsuite/gdc.test/compilable/test21299d.d
new file mode 100644
index 0000000..67ec60a
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test21299d.d
@@ -0,0 +1,27 @@
+// REQUIRED_ARGS: -main
+// LINK:
+module test21299d;
+
+struct DefaultPredicates
+{
+ struct IsEqual(T)
+ {
+ static opCall(in T, in T)
+ {
+ return 0;
+ }
+ }
+}
+
+void moveToEnd(T, Pred = DefaultPredicates.IsEqual!T)(T[] array, T element, Pred pred = Pred.init)
+{
+ pred(array[0], element);
+}
+
+class Task
+{
+ void removeTerminationHook(void delegate() hook)
+ {
+ moveToEnd([], hook);
+ }
+}
diff --git a/gcc/testsuite/gfortran.dg/analyzer/pr97668.f b/gcc/testsuite/gfortran.dg/analyzer/pr97668.f
new file mode 100644
index 0000000..568c891
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/analyzer/pr97668.f
@@ -0,0 +1,26 @@
+c { dg-additional-options "-std=legacy" }
+
+ SUBROUTINE PPADD (A, C, BH)
+
+ COMPLEX DD, FP, FPP, R1, R2
+ DIMENSION A(*), C(*), BH(*)
+
+ DO 136 IG=IS,1
+ FP = (0.,0.)
+ FPP = (0.,0.)
+
+ DO 121 J=1,1
+ DD = 1./2
+ FP = DD
+ FPP = DD+1
+ 121 CONTINUE
+
+ R2 = -FP
+ IF (ABS(R1)-ABS(R2)) 129,129,133
+ 129 R1 = R2/FPP
+ 133 IT = IT+1
+
+ 136 CONTINUE
+
+ RETURN
+ END
diff --git a/gcc/testsuite/gfortran.dg/attr_deprecated.f90 b/gcc/testsuite/gfortran.dg/attr_deprecated.f90
new file mode 100644
index 0000000..aa3f513
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/attr_deprecated.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+
+module m
+ implicit none
+ integer :: A
+ integer, parameter :: PARM = 5 ! { dg-warning "Using parameter 'parm' declared at .1. is deprecated" }
+!GCC$ ATTRIBUTES DEPRECATED :: A, foo, func, parm
+contains
+subroutine foo
+end
+integer function func()
+ func = 42
+end
+subroutine bar
+ integer :: i
+ call foo ! { dg-warning "Using subroutine 'foo' at .1. is deprecated" }
+ print *, A ! { dg-warning "Using variable 'a' at .1. is deprecated" }
+ i = func() ! { dg-warning "Using function 'func' at .1. is deprecated" }
+ print *, PARM
+end
+
+end module m
+
+use m ! { dg-warning "Using parameter 'parm' declared at .1. is deprecated" }
+ integer :: i
+ call foo ! { dg-warning "Using subroutine 'foo' at .1. is deprecated" }
+ print *, A ! { dg-warning "Using variable 'a' at .1. is deprecated" }
+ i = func() ! { dg-warning "Using function 'func' at .1. is deprecated" }
+ print *, PARM
+end
diff --git a/gcc/testsuite/gfortran.dg/coverage.f90 b/gcc/testsuite/gfortran.dg/coverage.f90
new file mode 100644
index 0000000..e0800f8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coverage.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! { dg-additional-options "-fprofile-arcs -ftest-coverage" }
+!
+! PR fortran/95847
+!
+module foo
+contains
+ subroutine sbr()
+ end subroutine sbr
+end module foo
+
+function foo_suite() result(suite)
+ use foo
+ integer :: bar
+ integer :: res
+ res = bar(sbr)
+end function foo_suite
diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/atomic.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/atomic.f90
new file mode 100644
index 0000000..59186a2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/atomic.f90
@@ -0,0 +1,48 @@
+! { dg-do compile } */
+! { dg-additional-options "-fdump-tree-original" } */
+
+subroutine foo
+ !$omp requires atomic_default_mem_order(acq_rel)
+ integer :: i, v
+
+ !$omp atomic read
+ i = v
+
+ !$acc atomic read
+ i = v
+
+ !$omp atomic write
+ i = v
+
+ !$acc atomic write
+ i = v
+
+ !$omp atomic update
+ i = i + 1
+
+ !$acc atomic update
+ i = i + 1
+
+ !$omp atomic capture
+ i = i + 1
+ v = i
+ !$omp end atomic
+
+ !$acc atomic capture
+ i = i + 1
+ v = i
+ !$acc end atomic
+
+ ! Valid in C/C++ since OpenACC 2.5 but not in Fortran:
+ ! !$acc atomic update capture
+ ! i = i + 1
+ ! v = i
+ ! !$acc end atomic
+end
+
+! { dg-final { scan-tree-dump-times "i = #pragma omp atomic read acquire" 1 "original" } }
+! { dg-final { scan-tree-dump-times "i = #pragma omp atomic read relaxed" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp atomic release" 2 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp atomic relaxed" 2 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture acq_rel" 1 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture relaxed" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/goacc-gomp.exp b/gcc/testsuite/gfortran.dg/goacc-gomp/goacc-gomp.exp
new file mode 100644
index 0000000..6073fb3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc-gomp/goacc-gomp.exp
@@ -0,0 +1,37 @@
+# Copyright (C) 2005-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/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gfortran-dg.exp
+
+if { ![check_effective_target_fopenacc] \
+ || ![check_effective_target_fopenmp] } {
+ return
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+gfortran-dg-runtest [lsort \
+ [find $srcdir/$subdir *.\[fF\]{,90,95,03,08} ] ] "" "-fopenacc -fopenmp"
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gfortran.dg/goacc/atomic.f90 b/gcc/testsuite/gfortran.dg/goacc/atomic.f90
new file mode 100644
index 0000000..072d024
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/atomic.f90
@@ -0,0 +1,35 @@
+! { dg-do compile }
+
+subroutine foo
+ integer :: i, v
+ !$acc atomic read bar ! { dg-error "21: Unexpected junk after !.ACC ATOMIC statement" }
+ i = v
+
+ !$acc atomic read write ! { dg-error "21: Unexpected junk after !.ACC ATOMIC statement" }
+ i = v
+
+ !$acc atomic read seq_cst ! { dg-error "21: Unexpected junk after !.ACC ATOMIC statement" }
+ i = v
+
+ !$acc atomic read relaxed ! { dg-error "21: Unexpected junk after !.ACC ATOMIC statement" }
+ i = v
+
+ !$acc atomic update hint(1) ! { dg-error "23: Unexpected junk after !.ACC ATOMIC statement" }
+ i = i + 1
+
+ !$acc atomic update update capture ! { dg-error "23: Unexpected junk after !.ACC ATOMIC statement" }
+ i = i + 1
+ v = i
+
+ !$acc atomic update capture capture ! { dg-error "23: Unexpected junk after !.ACC ATOMIC statement" }
+ i = i + 1
+ v = i
+
+ !$acc atomic write capture ! { dg-error "22: Unexpected junk after !.ACC ATOMIC statement" }
+ i = 1
+
+ ! Valid in C/C++ since OpenACC 2.5 but not in Fortran:
+ !$acc atomic update capture ! { dg-error "23: Unexpected junk after !.ACC ATOMIC statement" }
+ i = i + 1
+ v = i
+end
diff --git a/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90 b/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90
deleted file mode 100644
index 29798d3..0000000
--- a/gcc/testsuite/gfortran.dg/goacc/clause-locations.f90
+++ /dev/null
@@ -1,18 +0,0 @@
-! Verify that the location information for clauses is correct.
-! See also PR 92793.
-
-subroutine check_clause_columns ()
- implicit none (type, external)
- integer :: i, j, sum, diff
-
- !$acc parallel
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:diff) reduction(-:sum) ! { dg-warning "47: conflicting reduction operations for .sum." }
- do j = 1, 10
- sum = 1
- end do
- end do
- !$acc end parallel
-end subroutine check_clause_columns
-
diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95
index 03cae74..5379fba 100644
--- a/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/loop-2-parallel-3.f95
@@ -5,52 +5,52 @@ program test
integer :: i
!$acc parallel
- !$acc loop gang(5) ! { dg-error "num arguments" }
+ !$acc loop gang(5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc loop gang(num:5) ! { dg-error "num arguments" }
+ !$acc loop gang(num:5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc loop worker(5) ! { dg-error "num arguments" }
+ !$acc loop worker(5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc loop worker(num:5) ! { dg-error "num arguments" }
+ !$acc loop worker(num:5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc loop vector(5) ! { dg-error "length arguments" }
+ !$acc loop vector(5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc loop vector(length:5) ! { dg-error "length arguments" }
+ !$acc loop vector(length:5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
!$acc end parallel
- !$acc parallel loop gang(5) ! { dg-error "num arguments" }
+ !$acc parallel loop gang(5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc parallel loop gang(num:5) ! { dg-error "num arguments" }
+ !$acc parallel loop gang(num:5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc parallel loop worker(5) ! { dg-error "num arguments" }
+ !$acc parallel loop worker(5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc parallel loop worker(num:5) ! { dg-error "num arguments" }
+ !$acc parallel loop worker(num:5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc parallel loop vector(5) ! { dg-error "length arguments" }
+ !$acc parallel loop vector(5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
- !$acc parallel loop vector(length:5) ! { dg-error "length arguments" }
+ !$acc parallel loop vector(length:5) ! { dg-error "argument not permitted" }
DO i = 1,10
ENDDO
end
diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-5.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-5.f95
deleted file mode 100644
index d059cf7..0000000
--- a/gcc/testsuite/gfortran.dg/goacc/loop-5.f95
+++ /dev/null
@@ -1,357 +0,0 @@
-program test
- implicit none
- integer :: i, j
-
- !$acc kernels
- !$acc loop auto
- DO i = 1,10
- ENDDO
- !$acc loop gang
- DO i = 1,10
- ENDDO
- !$acc loop gang(5)
- DO i = 1,10
- ENDDO
- !$acc loop gang(num:5)
- DO i = 1,10
- ENDDO
- !$acc loop gang(static:5)
- DO i = 1,10
- ENDDO
- !$acc loop gang(static:*)
- DO i = 1,10
- ENDDO
- !$acc loop gang
- DO i = 1,10
- !$acc loop vector
- DO j = 1,10
- ENDDO
- !$acc loop worker
- DO j = 1,10
- ENDDO
- ENDDO
-
- !$acc loop worker
- DO i = 1,10
- ENDDO
- !$acc loop worker(5)
- DO i = 1,10
- ENDDO
- !$acc loop worker(num:5)
- DO i = 1,10
- ENDDO
- !$acc loop worker
- DO i = 1,10
- !$acc loop vector
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc loop gang worker
- DO i = 1,10
- ENDDO
-
- !$acc loop vector
- DO i = 1,10
- ENDDO
- !$acc loop vector(5)
- DO i = 1,10
- ENDDO
- !$acc loop vector(length:5)
- DO i = 1,10
- ENDDO
- !$acc loop vector
- DO i = 1,10
- ENDDO
- !$acc loop gang vector
- DO i = 1,10
- ENDDO
- !$acc loop worker vector
- DO i = 1,10
- ENDDO
-
- !$acc loop auto
- DO i = 1,10
- ENDDO
-
- !$acc loop tile(1)
- DO i = 1,10
- ENDDO
- !$acc loop tile(2)
- DO i = 1,10
- ENDDO
- !$acc loop tile(6-2)
- DO i = 1,10
- ENDDO
- !$acc loop tile(6+2)
- DO i = 1,10
- ENDDO
- !$acc loop tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop tile(*, 1)
- DO i = 1,10
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc loop tile(-1) ! { dg-warning "must be positive" }
- do i = 1,10
- enddo
- !$acc loop vector tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop vector gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop vector worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop gang worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc end kernels
-
-
- !$acc parallel
- !$acc loop tile(1)
- DO i = 1,10
- ENDDO
- !$acc loop tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop tile(2)
- DO i = 1,10
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc loop tile(-1) ! { dg-warning "must be positive" }
- do i = 1,10
- enddo
- !$acc loop vector tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop vector gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop vector worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc loop gang worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc end parallel
-
- !$acc kernels loop auto
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang(5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang(num:5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang(static:5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang(static:*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang
- DO i = 1,10
- !$acc kernels loop gang ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- ENDDO
-
- !$acc kernels loop worker
- DO i = 1,10
- ENDDO
- !$acc kernels loop worker(5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop worker(num:5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop worker
- DO i = 1,10
- !$acc kernels loop worker ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- !$acc kernels loop gang ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc kernels loop gang worker
- DO i = 1,10
- ENDDO
-
- !$acc kernels loop vector
- DO i = 1,10
- ENDDO
- !$acc kernels loop vector(5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop vector(length:5)
- DO i = 1,10
- ENDDO
- !$acc kernels loop vector
- DO i = 1,10
- !$acc kernels loop vector ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- !$acc kernels loop worker ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- !$acc kernels loop gang ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc kernels loop gang vector
- DO i = 1,10
- ENDDO
- !$acc kernels loop worker vector
- DO i = 1,10
- ENDDO
-
- !$acc kernels loop auto
- DO i = 1,10
- ENDDO
-
- !$acc kernels loop tile(1)
- DO i = 1,10
- ENDDO
- !$acc kernels loop tile(*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop tile(*, 1)
- DO i = 1,10
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc kernels loop tile(-1) ! { dg-warning "must be positive" }
- do i = 1,10
- enddo
- !$acc kernels loop vector tile(*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop vector gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop vector worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc kernels loop gang worker tile(*)
- DO i = 1,10
- ENDDO
-
- !$acc parallel loop auto
- DO i = 1,10
- ENDDO
- !$acc parallel loop gang
- DO i = 1,10
- ENDDO
- !$acc parallel loop gang(static:5)
- DO i = 1,10
- ENDDO
- !$acc parallel loop gang(static:*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop gang
- DO i = 1,10
- !$acc parallel loop gang ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- ENDDO
-
- !$acc parallel loop worker
- DO i = 1,10
- ENDDO
- !$acc parallel loop worker
- DO i = 1,10
- !$acc parallel loop worker ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- !$acc parallel loop gang ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc parallel loop gang worker
- DO i = 1,10
- ENDDO
-
- !$acc parallel loop vector
- DO i = 1,10
- !$acc parallel loop vector ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- !$acc parallel loop worker ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- !$acc parallel loop gang ! { dg-error "OpenACC construct inside of non-OpenACC region" }
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc parallel loop gang vector
- DO i = 1,10
- ENDDO
- !$acc parallel loop worker vector
- DO i = 1,10
- ENDDO
-
- !$acc parallel loop auto
- DO i = 1,10
- ENDDO
-
- !$acc parallel loop tile(1)
- DO i = 1,10
- ENDDO
- !$acc parallel loop tile(*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop tile(*, 1)
- DO i = 1,10
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc parallel loop tile(-1) ! { dg-warning "must be positive" }
- do i = 1,10
- enddo
- !$acc parallel loop vector tile(*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop vector gang tile(*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop vector worker tile(*)
- DO i = 1,10
- ENDDO
- !$acc parallel loop gang worker tile(*)
- DO i = 1,10
- ENDDO
-end
diff --git a/gcc/testsuite/gfortran.dg/goacc/loop-6.f95 b/gcc/testsuite/gfortran.dg/goacc/loop-6.f95
deleted file mode 100644
index d0855b4..0000000
--- a/gcc/testsuite/gfortran.dg/goacc/loop-6.f95
+++ /dev/null
@@ -1,74 +0,0 @@
-program test
- implicit none
- integer :: i, j
-
- !$acc parallel
- !$acc loop auto
- DO i = 1,10
- ENDDO
- !$acc loop gang
- DO i = 1,10
- ENDDO
- !$acc loop gang(static:5)
- DO i = 1,10
- ENDDO
- !$acc loop gang(static:*)
- DO i = 1,10
- ENDDO
- !$acc loop gang
- DO i = 1,10
- !$acc loop vector
- DO j = 1,10
- ENDDO
- !$acc loop worker
- DO j = 1,10
- ENDDO
- ENDDO
-
- !$acc loop worker
- DO i = 1,10
- ENDDO
- !$acc loop worker
- DO i = 1,10
- !$acc loop vector
- DO j = 1,10
- ENDDO
- ENDDO
- !$acc loop gang worker
- DO i = 1,10
- ENDDO
-
- !$acc loop vector
- DO i = 1,10
- ENDDO
- !$acc loop vector(5) ! { dg-error "length arguments" }
- DO i = 1,10
- ENDDO
- !$acc loop vector(length:5) ! { dg-error "length arguments" }
- DO i = 1,10
- ENDDO
- !$acc loop vector
- DO i = 1,10
- ENDDO
- !$acc loop gang vector
- DO i = 1,10
- ENDDO
- !$acc loop worker vector
- DO i = 1,10
- ENDDO
-
- !$acc loop auto
- DO i = 1,10
- ENDDO
- !$acc end parallel
-
- !$acc parallel loop vector
- DO i = 1,10
- ENDDO
- !$acc parallel loop vector(5) ! { dg-error "length arguments" }
- DO i = 1,10
- ENDDO
- !$acc parallel loop vector(length:5) ! { dg-error "length arguments" }
- DO i = 1,10
- ENDDO
-end
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90
new file mode 100644
index 0000000..60cb630
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90
@@ -0,0 +1,300 @@
+! Test cases of nested 'reduction' clauses expected to compile cleanly.
+
+! See also 'c-c++-common/goacc/nested-reductions-1-kernels.c'.
+
+subroutine acc_kernels ()
+ implicit none (type, external)
+ integer :: i, j, k, sum, diff
+
+ !$acc kernels
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop collapse(2) reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ !$acc end kernels
+end subroutine acc_kernels
+
+! The same tests as above, but using a combined kernels loop construct.
+
+subroutine acc_kernels_loop ()
+ implicit none (type, external)
+ integer :: h, i, j, k, l, sum, diff
+
+ !$acc kernels loop
+ do h = 1, 10
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop collapse(2) reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_kernels_loop
+
+! The same tests as above, but now the outermost reduction clause is on
+! the kernels region, not the outermost loop. */
+
+subroutine acc_kernels_reduction ()
+ implicit none (type, external)
+
+ ! In contrast to the 'parallel' construct, the 'reduction' clause is not
+ ! supported on the 'kernels' construct.
+end subroutine acc_kernels_reduction
+
+! The same tests as above, but using a combined kernels loop construct, and
+! the outermost reduction clause is on that one, not the outermost loop. */
+subroutine acc_kernels_loop_reduction ()
+ implicit none (type, external)
+ integer :: h, i, j, k, sum, diff
+
+ !$acc kernels loop reduction(+:sum)
+ do h = 1, 10
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ do i = 1, 10
+ !$acc loop
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_kernels_loop_reduction
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90
index 3becafa..2915d67 100644
--- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90
@@ -1,4 +1,6 @@
-! Test cases of nested reduction loops that should compile cleanly.
+! Test cases of nested 'reduction' clauses expected to compile cleanly.
+
+! See also 'c-c++-common/goacc/nested-reductions-1-parallel.c'.
subroutine acc_parallel ()
implicit none (type, external)
@@ -400,141 +402,3 @@ subroutine acc_parallel_loop_reduction ()
end do
end do
end subroutine acc_parallel_loop_reduction
-
-! The same tests as above, but inside a routine construct.
-subroutine acc_routine ()
- implicit none (type, external)
- !$acc routine gang
-
- integer :: i, j, k, sum, diff
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop collapse(2) reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-end subroutine acc_routine
-
-subroutine acc_kernels ()
- implicit none (type, external)
- integer :: i, j, k, sum, diff
-
- ! FIXME: These tests are not meaningful yet because reductions in
- ! kernels regions are not supported yet.
- !$acc kernels
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(+:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc end kernels
-end subroutine acc_kernels
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90
new file mode 100644
index 0000000..17a5861
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90
@@ -0,0 +1,88 @@
+! Test cases of nested 'reduction' clauses expected to compile cleanly.
+
+! See also 'c-c++-common/goacc/nested-reductions-1-routine.c'.
+
+subroutine acc_routine ()
+ implicit none (type, external)
+ !$acc routine gang
+
+ integer :: i, j, k, sum, diff
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop collapse(2) reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) reduction(+:sum)
+ do j = 1, 10
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(+:sum)
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(-:diff)
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+end subroutine acc_routine
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90
new file mode 100644
index 0000000..6ee41843
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90
@@ -0,0 +1,389 @@
+! Test erroneous cases of nested 'reduction' clauses.
+
+! See also 'c-c++-common/goacc/nested-reductions-2-kernels.c'.
+
+subroutine acc_kernels ()
+ implicit none (type, external)
+ integer :: i, j, k, l, sum, diff
+
+ !$acc kernels
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ !$acc end kernels
+end subroutine acc_kernels
+
+! The same tests as above, but using a combined kernels loop construct.
+
+subroutine acc_kernels_loop ()
+ implicit none (type, external)
+ integer :: h, i, j, k, l, sum, diff
+
+ !$acc kernels loop
+ do h = 1, 10
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_kernels_loop
+
+! The same tests as above, but now the outermost reduction clause is on
+! the kernels region, not the outermost loop.
+
+subroutine acc_kernels_reduction ()
+ implicit none (type, external)
+
+ ! In contrast to the 'parallel' construct, the 'reduction' clause is not
+ ! supported on the 'kernels' construct.
+end subroutine acc_kernels_reduction
+
+! The same tests as above, but using a combined kernels loop construct, and
+! the outermost reduction clause is on that one, not the outermost loop. */
+subroutine acc_kernels_loop_reduction ()
+ implicit none (type, external)
+ integer :: h, i, j, k, l, sum, diff
+
+ !$acc kernels loop reduction(+:sum)
+ do h = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(max:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "TODO" { xfail *-*-* } .-1 }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+ end do
+end subroutine acc_kernels_loop_reduction
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-warn.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90
index ec36bc9..8fa2cab 100644
--- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-warn.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90
@@ -1,4 +1,6 @@
-! Test erroneous cases of nested reduction loops.
+! Test erroneous cases of nested 'reduction' clauses.
+
+! See also 'c-c++-common/goacc/nested-reductions-2-parallel.c'.
subroutine acc_parallel ()
implicit none (type, external)
@@ -495,180 +497,3 @@ subroutine acc_parallel_loop_reduction ()
end do
end do
end subroutine acc_parallel_loop_reduction
-
-! The same tests as above, but inside a routine construct.
-subroutine acc_routine ()
- implicit none (type, external)
- !$acc routine gang
- integer :: i, j, k, l, sum, diff
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(+:sum)
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(-:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
- do k = 1, 10
- !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
- do l = 1, 10
- sum = 1
- end do
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum) reduction(-:diff)
- do i = 1, 10
- !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
-
- !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
- do j = 1, 10
- !$acc loop reduction(-:diff)
- do k = 1, 10
- diff = 1
- end do
- end do
- end do
-end subroutine acc_routine
-
-subroutine acc_kernels ()
- integer :: i, j, k, sum, diff
-
- ! FIXME: No diagnostics are produced for these loops because reductions
- ! in kernels regions are not supported yet.
- !$acc kernels
- !$acc loop reduction(+:sum)
- do i = 1, 10
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop
- do j = 1, 10
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:diff)
- do j = 1, 10
- !$acc loop
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
-
- !$acc loop reduction(+:sum)
- do i = 1, 10
- !$acc loop reduction(-:sum)
- do j = 1, 10
- !$acc loop reduction(+:sum)
- do k = 1, 10
- sum = 1
- end do
- end do
- end do
- !$acc end kernels
-end subroutine acc_kernels
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90
new file mode 100644
index 0000000..cc7802e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90
@@ -0,0 +1,119 @@
+! Test erroneous cases of nested 'reduction' clauses.
+
+! See also 'c-c++-common/goacc/nested-reductions-2-routine.c'.
+
+subroutine acc_routine ()
+ implicit none (type, external)
+ !$acc routine gang
+ integer :: i, j, k, l, sum, diff
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop collapse(2) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(+:sum)
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(-:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum)
+ do i = 1, 10
+ !$acc loop reduction(-:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 }
+ do k = 1, 10
+ !$acc loop reduction(*:sum) ! { dg-warning "conflicting reduction operations for .sum." }
+ do l = 1, 10
+ sum = 1
+ end do
+ end do
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) reduction(-:diff)
+ do i = 1, 10
+ !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." }
+ do j = 1, 10
+ !$acc loop reduction(+:sum)
+ do k = 1, 10
+ sum = 1
+ end do
+ end do
+
+ !$acc loop reduction(+:sum) ! { dg-warning "nested loop in reduction needs reduction clause for .diff." }
+ do j = 1, 10
+ !$acc loop reduction(-:diff)
+ do k = 1, 10
+ diff = 1
+ end do
+ end do
+ end do
+end subroutine acc_routine
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90 b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
new file mode 100644
index 0000000..422131b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/pr92793-1.f90
@@ -0,0 +1,135 @@
+! Verify column location information.
+
+! See also 'c-c++-common/goacc/pr92793-1.c'.
+
+! { dg-additional-options "-fdump-tree-original-lineno" }
+! { dg-additional-options "-fdump-tree-gimple-lineno" }
+
+! No tabs. Funny indentation/spacing for a reason.
+
+
+subroutine check ()
+ implicit none (type, external)
+ integer :: i, j, sum, diff
+
+ !$acc parallel &
+ !$acc & & ! Fortran location information points to the last line, and last character of the directive.
+!$acc && ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:18:123\\\] #pragma acc parallel" 1 "original" } }
+ !$acc & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:18:123\\\] #pragma omp target oacc_parallel" 1 "gimple" } }
+ !$acc loop &
+ !$acc & & ! Fortran location information points to the last line, and last character of the directive.
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:26:22\\\] #pragma acc loop" 1 "original" } }
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:26:22\\\] #pragma acc loop" 1 "gimple" } }
+ !$acc& reduction ( + : sum ) & ! { dg-line sum1 }
+ !$acc && ! Fortran location information points to the ':' in 'reduction(+:sum)'.
+ !$acc & & ! { dg-message "36: location of the previous reduction for 'sum'" "" { target *-*-* } sum1 }
+!$acc& independent
+ do i = 1, 10
+ !$acc loop &
+!$acc & & ! Fortran location information points to the last line, and last character of the directive.
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:36:34\\\] #pragma acc loop" 1 "original" } }
+ !$acc & & ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:36:34\\\] #pragma acc loop" 1 "gimple" } }
+ !$acc & reduction(-: diff ) &
+ !$acc&reduction(- : sum) & ! { dg-line sum2 }
+ !$acc & & ! Fortran location information points to the ':' in 'reduction(-:sum)'.
+ !$acc& & ! { dg-warning "32: conflicting reduction operations for 'sum'" "" { target *-*-* } sum2 }
+ !$acc &independent
+ do j = 1, 10
+ sum &
+ & = &
+ & 1
+ ! Fortran location information points to the last line, and last character of the statement.
+ ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:40:9\\\] sum = 1" 1 "original" } }
+ ! { dg-final { scan-tree-dump-times "pr92793-1\\\.f90:40:9\\\] sum = 1" 1 "gimple" } }
+ end do
+ end do
+!$acc end parallel
+end subroutine check
+
+
+subroutine gwv_sl_1 ()
+ implicit none (type, external)
+ integer :: i
+
+ !$acc serial loop &
+ !$acc & gang(num:5) & ! { dg-error "25: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "24: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "28: argument not permitted on 'vector' clause" }
+ ! { dg-message "93: enclosing parent compute construct" "" { target *-*-* } .-1 }
+ do i = 0, 10
+ end do
+ !$acc end serial loop
+end subroutine gwv_sl_1
+
+subroutine gwv_sl_2 ()
+ implicit none (type, external)
+ integer :: i, j, k
+
+ !$acc serial loop ! { dg-message "77: enclosing parent compute construct" }
+ do i = 0, 10
+ !$acc loop ! { dg-bogus "enclosing parent compute construct" }
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "35: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "32: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "33: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+ !$acc end serial loop
+end subroutine gwv_sl_2
+
+subroutine gwv_s_l ()
+ implicit none (type, external)
+ integer :: i, j, k
+
+ !$acc serial ! { dg-message "72: enclosing parent compute construct" }
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "27: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "23: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "29: argument not permitted on 'vector' clause" }
+ do i = 0, 10
+ end do
+
+ !$acc loop
+ do i = 0, 10
+ !$acc loop ! { dg-bogus "enclosing parent compute construct" }
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "35: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "32: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "37: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+!$acc end serial
+end subroutine gwv_s_l
+
+subroutine gwv_r () ! { dg-message "16: enclosing routine" }
+ implicit none (type, external)
+ integer :: i, j, k
+
+ !$acc routine(gwv_r)
+
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "23: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "26: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "27: argument not permitted on 'vector' clause" }
+ do i = 0, 10
+ end do
+
+ !$acc loop
+ do i = 0, 10
+ !$acc loop
+ do j = 0, 10
+ !$acc loop &
+ !$acc & gang(num:5) & ! { dg-error "31: argument not permitted on 'gang' clause" }
+ !$acc & worker(num:5) & ! { dg-error "31: argument not permitted on 'worker' clause" }
+ !$acc & vector(length:5) ! { dg-error "36: argument not permitted on 'vector' clause" }
+ do k = 0, 10
+ end do
+ end do
+ end do
+end subroutine gwv_r
diff --git a/gcc/testsuite/gfortran.dg/goacc/specification-part.f90 b/gcc/testsuite/gfortran.dg/goacc/specification-part.f90
new file mode 100644
index 0000000..14af6ae
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/specification-part.f90
@@ -0,0 +1,100 @@
+! { dg-do compile }
+!
+! PR fortran/90111
+!
+! Check that OpenACC directives in everywhere in specification part,
+! i.e. it may appear before/after the use, import, implicit, and declaration
+!
+
+module m
+end module m
+
+subroutine foo0(kk)
+ use m
+ implicit none
+ integer :: jj, kk
+ !$acc routine
+end
+
+subroutine foo1()
+ use m
+ implicit none
+ !$acc routine
+ integer :: jj
+end
+
+subroutine foo2()
+ use m
+ !$acc routine
+ implicit none
+end
+
+subroutine foo3()
+ !$acc routine
+ use m
+ implicit none
+end
+
+module m2
+ interface
+ subroutine foo0(kk)
+ use m
+ import
+ implicit none
+ integer :: kk
+ !$acc routine
+ end
+ subroutine foo1()
+ use m
+ import
+ implicit none
+ !$acc routine
+ end
+ subroutine foo2()
+ use m
+ import
+ !$acc routine
+ implicit none
+ end
+ subroutine foo3()
+ use m
+ !$acc routine
+ import
+ implicit none
+ end
+ subroutine foo4()
+ use m
+ !$acc routine
+ import
+ implicit none
+ end
+ end interface
+end module m2
+
+subroutine bar0()
+ use m
+ implicit none
+ integer :: ii
+ !$acc declare copyin(ii)
+end
+
+subroutine bar1()
+ use m
+ implicit none
+ !$acc declare copyin(ii)
+ integer :: ii
+end
+
+subroutine bar2()
+ use m
+ !$acc declare copyin(ii)
+ implicit none
+ integer :: ii
+end
+
+subroutine bar3()
+ !$acc declare copyin(ii)
+ use m
+ implicit none
+ integer :: ii
+end
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/atomic-2.f90 b/gcc/testsuite/gfortran.dg/gomp/atomic-2.f90
new file mode 100644
index 0000000..1de418d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/atomic-2.f90
@@ -0,0 +1,70 @@
+! { dg-do compile }
+
+subroutine bar
+ integer :: i, v
+ real :: f
+ !$omp atomic update acq_rel hint("abc") ! { dg-error "OMP ATOMIC UPDATE at .1. incompatible with ACQ_REL or ACQUIRE clauses" }
+ ! { dg-error "HINT clause at .1. requires a scalar INTEGER expression" "" { target *-*-* } .-1 }
+ ! { dg-error "Value of HINT clause at .1. shall be a valid constant hint expression" "" { target *-*-* } .-2 }
+ i = i + 1
+ !$omp end atomic
+
+ !$omp atomic acq_rel ! { dg-error "OMP ATOMIC UPDATE at .1. incompatible with ACQ_REL or ACQUIRE clauses" }
+ i = i + 1
+ !$omp end atomic
+
+ !$omp atomic capture,acq_rel , hint (1)
+ i = i + 1
+ v = i
+ !$omp end atomic
+
+ !$omp atomic acq_rel , hint (1), update ! { dg-error "OMP ATOMIC UPDATE at .1. incompatible with ACQ_REL or ACQUIRE clauses" }
+ i = i + 1
+ !$omp end atomic
+
+ !$omp atomic hint(0),acquire capture
+ i = i + 1
+ v = i
+ !$omp end atomic
+
+ !$omp atomic write capture ! { dg-error "multiple atomic clauses" }
+ i = 2
+ v = i
+ !$omp end atomic
+
+ !$omp atomic foobar ! { dg-error "Failed to match clause" }
+end
+
+! moved here from atomic.f90
+subroutine openmp51_foo
+ integer :: x, v
+ !$omp atomic update seq_cst capture ! { dg-error "multiple atomic clauses" }
+ x = x + 2
+ v = x
+ !$omp end atomic
+ !$omp atomic seq_cst, capture, update ! { dg-error "multiple atomic clauses" }
+ x = x + 2
+ v = x
+ !$omp end atomic
+ !$omp atomic capture, seq_cst ,update ! { dg-error "multiple atomic clauses" }
+ x = x + 2
+ v = x
+ !$omp end atomic
+end
+
+subroutine openmp51_bar
+ integer :: i, v
+ real :: f
+ !$omp atomic relaxed capture update ! { dg-error "multiple atomic clauses" }
+ i = i + 1
+ v = i
+ !$omp end atomic
+ !$omp atomic update capture,release , hint (1) ! { dg-error "multiple atomic clauses" }
+ i = i + 1
+ v = i
+ !$omp end atomic
+ !$omp atomic hint(0),update relaxed capture ! { dg-error "multiple atomic clauses" }
+ i = i + 1
+ v = i
+ !$omp end atomic
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/atomic.f90 b/gcc/testsuite/gfortran.dg/gomp/atomic.f90
new file mode 100644
index 0000000..b4caf03
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/atomic.f90
@@ -0,0 +1,87 @@
+! { dg-do compile }
+! { dg-additional-options "-fdump-tree-original" }
+
+! { dg-final { scan-tree-dump-times "#pragma omp atomic relaxed" 4 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp atomic release" 4 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture relaxed" 2 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture release" 1 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic read acquire" 1 "original" } }
+
+! { dg-final { scan-tree-dump-times "#pragma omp atomic seq_cst" 7 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic read seq_cst" 3 "original" } }
+! { dg-final { scan-tree-dump-times "v = #pragma omp atomic capture seq_cst" 3 "original" } }
+
+
+subroutine foo ()
+ integer :: x, v
+ !$omp atomic
+ i = i + 2
+
+ !$omp atomic relaxed
+ i = i + 2
+
+ !$omp atomic seq_cst read
+ v = x
+ !$omp atomic seq_cst, read
+ v = x
+ !$omp atomic seq_cst write
+ x = v
+ !$omp atomic seq_cst ,write
+ x = v
+ !$omp atomic seq_cst update
+ x = x + v
+ !$omp atomic seq_cst , update
+ x = x + v
+ !$omp atomic seq_cst capture
+ x = x + 2
+ v = x
+ !$omp end atomic
+ !$omp atomic seq_cst, capture
+ x = x + 2
+ v = x
+ !$omp end atomic
+ !$omp atomic read , seq_cst
+ v = x
+ !$omp atomic write ,seq_cst
+ x = v
+ !$omp atomic update, seq_cst
+ x = x + v
+ !$omp atomic capture, seq_cst
+ x = x + 2
+ v = x
+ !$omp end atomic
+end
+
+subroutine bar
+ integer :: i, v
+ real :: f
+ !$omp atomic release, hint (0), update
+ i = i + 1
+ !$omp end atomic
+ !$omp atomic hint(0)seq_cst
+ i = i + 1
+ !$omp atomic relaxed,update,hint (0)
+ i = i + 1
+ !$omp atomic release
+ i = i + 1
+ !$omp atomic relaxed
+ i = i + 1
+ !$omp atomic relaxed capture
+ i = i + 1
+ v = i
+ !$omp end atomic
+ !$omp atomic capture,release , hint (1)
+ i = i + 1
+ v = i
+ !$omp end atomic
+ !$omp atomic hint(0),relaxed capture
+ i = i + 1
+ v = i
+ !$omp end atomic
+ !$omp atomic read acquire
+ v = i
+ !$omp atomic release,write
+ i = v
+ !$omp atomic hint(1),update,release
+ f = f + 2.0
+end
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/gomp/map-2.f90 b/gcc/testsuite/gfortran.dg/gomp/map-2.f90
index 73c4f5a..79bab72 100644
--- a/gcc/testsuite/gfortran.dg/gomp/map-2.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/map-2.f90
@@ -2,5 +2,5 @@ type t
integer :: i
end type t
type(t) v
-!$omp target enter data map(to:v%i, v%i) ! { dg-error "appears more than once in map clauses" }
+!$omp target enter data map(to:v%i, v%i)
end
diff --git a/gcc/testsuite/gfortran.dg/gomp/requires-9.f90 b/gcc/testsuite/gfortran.dg/gomp/requires-9.f90
index a2b0f50..d90940d 100644
--- a/gcc/testsuite/gfortran.dg/gomp/requires-9.f90
+++ b/gcc/testsuite/gfortran.dg/gomp/requires-9.f90
@@ -80,6 +80,6 @@ end subroutine
! { dg-final { scan-tree-dump-times "#pragma omp atomic seq_cst\[\n\r]\[^\n\r]*&i5 =" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp atomic seq_cst\[\n\r]\[^\n\r]*&i5b =" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp atomic seq_cst\[\n\r]\[^\n\r]*&i6 =" 1 "original" } }
-! { dg-final { scan-tree-dump-times "#pragma omp atomic acq_rel\[\n\r]\[^\n\r]*&i7 =" 1 "original" } }
-! { dg-final { scan-tree-dump-times "#pragma omp atomic acq_rel\[\n\r]\[^\n\r]*&i7b =" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp atomic release\[\n\r]\[^\n\r]*&i7 =" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp atomic release\[\n\r]\[^\n\r]*&i7b =" 1 "original" } }
! { dg-final { scan-tree-dump-times "#pragma omp atomic seq_cst\[\n\r]\[^\n\r]*&i8 =" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp
index eaa7ae7..0375edf 100644
--- a/gcc/testsuite/gfortran.dg/guality/guality.exp
+++ b/gcc/testsuite/gfortran.dg/guality/guality.exp
@@ -19,7 +19,7 @@ global GDB
if ![info exists ::env(GUALITY_GDB_NAME)] {
if [info exists GDB] {
set guality_gdb_name "$GDB"
- } elseif [file exists $rootme/../gdb/gdb] {
+ } elseif { [info exists rootme] && [file exists $rootme/../gdb/gdb] } {
# If we're doing a combined build, and gdb is available, use it.
set guality_gdb_name "$rootme/../gdb/gdb"
} else {
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/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/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/value_8.f90 b/gcc/testsuite/gfortran.dg/value_8.f90
new file mode 100644
index 0000000..8273fe8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/value_8.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! PR97491 - Wrong restriction for VALUE arguments of pure procedures
+
+pure function foo (x) result (ret)
+ integer :: ret
+ integer, value :: x
+ x = x / 2
+ ret = x
+end function foo
+
+elemental function foo1 (x)
+ integer :: foo1
+ integer, value :: x
+ x = x / 2
+ foo1 = x
+end function foo1
diff --git a/gcc/testsuite/gfortran.dg/vect/O3-bb-slp-1.f b/gcc/testsuite/gfortran.dg/vect/O3-bb-slp-1.f
new file mode 100644
index 0000000..74b3b17
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/O3-bb-slp-1.f
@@ -0,0 +1,28 @@
+! { dg-do compile }
+ subroutine tranx3 (jbeg,jend,kbeg,kend,dlo,den,mflx,zro)
+ parameter(in = 128+5
+ & , jn = 128+5
+ & , kn = 128+5)
+ parameter(ijkn = 128+5)
+ real*8 zro, dqm, dqp, dx3bi (kn)
+ real*8 mflux (ijkn,4), dtwid (ijkn,4), dd (ijkn,4)
+ real*8 mflx (in,jn,kn)
+ real*8 dlo (in,jn,kn), den (in,jn,kn)
+ do 2100 j=jbeg-1,jend
+ dtwid (k,1) = ( 0.5 + q1 ) * ( dlo(i ,j,k-1)
+ 3 - ( dx3a(k ) + xi ) * dd (k ,1) )
+ mflux (k,1) = dtwid (k,1) * ( v3(i ,j,k) - vg3(k) ) * dt
+ if (j.ge.jbeg) then
+ den(i ,j,k) = ( dlo(i ,j,k) * dvl3a(k)
+ 1 - etwid (k+1,1) + etwid (k,1) ) * dvl3a i(k)
+ if (kend .eq. ke) mflx(i ,j,ke+1) = mflux (ke+1,1)
+ endif
+ do 2030 k=max(kbeg-2,ks-1),kend+1
+ dqm = (dlo(i ,j,k ) - dlo(i ,j,k-1)) * dx3bi(k )
+ dqp = (dlo(i ,j,k+1) - dlo(i ,j,k )) * dx3bi(k+1)
+ dd(k,1) = max ( dqm * dqp, zro )
+2030 continue
+ dtwid (k,3) = ( 0.5 + q1 ) * ( dlo(i+2,j,k-1)
+ 3 - ( dx3a(k ) + xi ) * deod (k ,3) )
+2100 continue
+ end
diff --git a/gcc/testsuite/gfortran.dg/vect/O3-bb-slp-2.f b/gcc/testsuite/gfortran.dg/vect/O3-bb-slp-2.f
new file mode 100644
index 0000000..34c44de
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/O3-bb-slp-2.f
@@ -0,0 +1,40 @@
+! { dg-do compile }
+! { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } }
+ subroutine tranx3 (ibeg,jbeg,jend,kbeg,kend
+ & ,dlo,den
+ & ,edn)
+ parameter(in = 128+5
+ & , jn = 128+5
+ & , kn = 128+5)
+ parameter(ijkn = 128+5)
+ real*8 e (in,jn,kn), dqm, dvl3a (kn), dvl3ai (kn)
+ & , dtwid (ijkn,4), dd (ijkn,4)
+ & , etwid (ijkn,4), deod (ijkn,4)
+ real*8 dlo (in,jn,kn), den (in,jn,kn)
+ & , edn (in,jn,kn)
+ do 2100 j=jbeg-1,jend
+ i = ibeg - 1
+ do 1080 k=kbeg,kend
+ den(i ,j,k) = ( dlo(i ,j,k) * dvl3a(k)
+ 1 - etwid (k+1,1) + etwid (k,1) ) * dvl3a i(k)
+1080 continue
+ do 2030 k=max(kbeg-2,ks-1),kend+1
+ dqm = (dlo(i+2,j,k ) - dlo(i+2,j,k-1)) * dx3bi(k )
+ dd(k,4) = max ( dqm * dqp, zro )
+2030 continue
+ dtwid (k,3) = ( 0.5 + q1 ) * ( dlo(i+2,j,k-1)
+ 1 + ( dx3a(k-1) - xi ) * dd (k-1,3) )
+ 2 + ( 0.5 - q1 ) * ( dlo(i+2,j,k )
+ 3 - ( dx3a(k ) + xi ) * deod (k ,3) )
+ do 2080 k=kbeg,kend
+ den(i ,j,k) = ( dlo(i ,j,k) * dvl3a(k)
+ 1 - dtwid (k+1,3) + dtwid (k,3) ) * dvl3a i(k)
+ e (i+2,j,k) = ( e (i+2,j,k) * dvl3a(k)
+ 1 - etwid (k+1,3) + etwid (k,3) ) * dvl3a i(k)
+ edn(i+2,j,k) = e(i+2,j,k) / den(i+2,j,k)
+ e (i+3,j,k) = ( e (i+3,j,k) * dvl3a(k)
+ 1 - etwid (k+1,4) + etwid (k,4) ) * dvl3a i(k)
+ edn(i+3,j,k) = e(i+3,j,k) / den(i+3,j,k)
+2080 continue
+2100 continue
+ end
diff --git a/gcc/testsuite/gfortran.dg/vect/pr97761.f90 b/gcc/testsuite/gfortran.dg/vect/pr97761.f90
new file mode 100644
index 0000000..250e2bf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr97761.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! { dg-additional-options "-O1" }
+
+subroutine ni (ps)
+ type vector
+ real x, y
+ end type
+ type quad_inductor
+ type (vector) v1, v2
+ end type
+ type (quad_inductor), dimension(inout) :: ps
+ integer :: dl, nk = 1.0
+ fo = 1.0
+ if (f == 1) then
+ nk = 0.0
+ fo = 0.0
+ end if
+ ot = nk * 0.5
+ gb = -fo * 0.5
+ wu = fo * 0.5
+ up = nk * 0.1
+ xe = up * 0.1
+ do lx = 0, 7
+ ps%v2%y = -wu
+ ps(dl)%v1%x = xe + 1.0
+ ps(dl)%v1%y = wu - tn
+ end do
+ do lx = 0, 7
+ ps(dl)%v1%x = 0.1 - ot
+ ps(dl)%v1%y = 0.1 - wu
+ end do
+end
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/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/opt88.adb b/gcc/testsuite/gnat.dg/opt88.adb
new file mode 100644
index 0000000..a6abd01
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt88.adb
@@ -0,0 +1,52 @@
+-- { dg-do run }
+-- { dg-options "-O -ftree-vrp -fno-inline" }
+
+procedure Opt88 is
+
+ Val : Integer := 1;
+
+ procedure Dummy (B : out Boolean) is
+ begin
+ B := True;
+ end;
+
+ function Test return Boolean is
+ begin
+ return False;
+ end;
+
+ procedure Do_It (OK : out Boolean) is
+
+ Blue : Boolean := False;
+ Red : Boolean := False;
+
+ begin
+ OK := True;
+ Blue := True;
+ Dummy (Red);
+
+ if Red then
+ Red := False;
+
+ if Test then
+ Dummy (Red);
+ end if;
+ end if;
+
+ if Blue and not Red then
+ Val := 0;
+ end if;
+
+ if Red then
+ OK := False;
+ end if;
+ end;
+
+ OK : Boolean;
+
+begin
+ Do_It (OK);
+ if not OK then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/sin_cos.adb b/gcc/testsuite/gnat.dg/sin_cos.adb
new file mode 100644
index 0000000..6e18df9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sin_cos.adb
@@ -0,0 +1,14 @@
+-- { dg-do compile }
+-- { dg-options "-O2 -gnatn" }
+
+with Ada.Numerics.Elementary_Functions;
+use Ada.Numerics.Elementary_Functions;
+package body Sin_Cos is
+ procedure Sin_Cos (Angle : T; SinA, CosA : out T) is
+ begin
+ SinA := Sin (Angle);
+ CosA := Cos (Angle);
+ end;
+end Sin_Cos;
+
+-- { dg-final { scan-assembler "sincos\|cexp" { target *-linux-gnu* *-w64-mingw* *-*-vxworks* } } }
diff --git a/gcc/testsuite/gnat.dg/sin_cos.ads b/gcc/testsuite/gnat.dg/sin_cos.ads
new file mode 100644
index 0000000..a0eff3d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/sin_cos.ads
@@ -0,0 +1,4 @@
+package Sin_Cos is
+ subtype T is Float;
+ procedure Sin_Cos (Angle : T; SinA, CosA : out T);
+end Sin_Cos;
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/gnat.dg/warn14.adb b/gcc/testsuite/gnat.dg/warn14.adb
index d7fbece..f9d03d1 100644
--- a/gcc/testsuite/gnat.dg/warn14.adb
+++ b/gcc/testsuite/gnat.dg/warn14.adb
@@ -23,7 +23,7 @@ procedure Warn14 is
package YY is
type XX is tagged null record;
- function F4 (Y : XX; U : Boolean) return Natural is (1); -- { dg-warning "formal parameter \"U\" is not referenced" }
+ function F4 (Y : XX; U : Boolean) return Natural is (1);
end YY;
XXX : YY.XX;
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 2124607..ce745df 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -151,8 +151,10 @@ proc asan_finish { args } {
unset TEST_ALWAYS_FLAGS
}
}
- set ld_library_path $asan_saved_library_path
- set_ld_library_path_env_vars
+ if [info exists asan_saved_library_path ] {
+ set ld_library_path $asan_saved_library_path
+ set_ld_library_path_env_vars
+ }
clear_effective_target_cache
}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index ecf8be3..60ebbb3 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
@@ -9690,6 +9693,44 @@ proc check_effective_target_fenv_exceptions {} {
} [add_options_for_ieee "-std=gnu99"]]
}
+# Return 1 if <fenv.h> is available with all the standard IEEE
+# exceptions and floating-point exceptions are raised by arithmetic
+# operations for decimal floating point. (If the target requires
+# special options for "inexact" exceptions, those need to be specified
+# in the testcases.)
+
+proc check_effective_target_fenv_exceptions_dfp {} {
+ return [check_runtime fenv_exceptions_dfp {
+ #include <fenv.h>
+ #include <stdlib.h>
+ #ifndef FE_DIVBYZERO
+ # error Missing FE_DIVBYZERO
+ #endif
+ #ifndef FE_INEXACT
+ # error Missing FE_INEXACT
+ #endif
+ #ifndef FE_INVALID
+ # error Missing FE_INVALID
+ #endif
+ #ifndef FE_OVERFLOW
+ # error Missing FE_OVERFLOW
+ #endif
+ #ifndef FE_UNDERFLOW
+ # error Missing FE_UNDERFLOW
+ #endif
+ volatile _Decimal64 a = 0.0DD, r;
+ int
+ main (void)
+ {
+ r = a / a;
+ if (fetestexcept (FE_INVALID))
+ exit (0);
+ else
+ abort ();
+ }
+ } [add_options_for_ieee "-std=gnu99"]]
+}
+
# Return 1 if -fexceptions is supported.
proc check_effective_target_exceptions {} {
@@ -10579,3 +10620,14 @@ proc check_effective_target_movdir { } {
}
} "-mmovdiri -mmovdir64b" ]
}
+
+# Return 1 if target is not support address sanitize, 1 otherwise.
+
+proc check_effective_target_no_fsanitize_address {} {
+ if ![check_no_compiler_messages fsanitize_address executable {
+ int main (void) { return 0; }
+ }] {
+ return 1;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/lib/tsan-dg.exp b/gcc/testsuite/lib/tsan-dg.exp
index b5631a7..6dcfd0a 100644
--- a/gcc/testsuite/lib/tsan-dg.exp
+++ b/gcc/testsuite/lib/tsan-dg.exp
@@ -150,7 +150,9 @@ proc tsan_finish { args } {
} else {
unset dg-do-what-default
}
- set ld_library_path $tsan_saved_library_path
- set_ld_library_path_env_vars
+ if [info exists tsan_saved_library_path ] {
+ set ld_library_path $tsan_saved_library_path
+ set_ld_library_path_env_vars
+ }
clear_effective_target_cache
}
diff --git a/gcc/testsuite/lib/ubsan-dg.exp b/gcc/testsuite/lib/ubsan-dg.exp
index f4ab29e..31740e0 100644
--- a/gcc/testsuite/lib/ubsan-dg.exp
+++ b/gcc/testsuite/lib/ubsan-dg.exp
@@ -141,7 +141,9 @@ proc ubsan_finish { args } {
unset TEST_ALWAYS_FLAGS
}
}
- set ld_library_path $ubsan_saved_library_path
- set_ld_library_path_env_vars
+ if [info exists ubsan_saved_library_path ] {
+ set ld_library_path $ubsan_saved_library_path
+ set_ld_library_path_env_vars
+ }
clear_effective_target_cache
}
diff --git a/gcc/testsuite/obj-c++.dg/SEL-typedef.mm b/gcc/testsuite/obj-c++.dg/SEL-typedef.mm
new file mode 100644
index 0000000..2ece1fd
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/SEL-typedef.mm
@@ -0,0 +1,7 @@
+/* Check that we accept the SEL typedef. */
+/* { dg-additional-options "-fsyntax-only " } */
+
+SEL aSelector;
+
+typedef SEL MySEL;
+
diff --git a/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm b/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm
new file mode 100644
index 0000000..498fbc7
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/attributes/nsobject-01.mm
@@ -0,0 +1,66 @@
+/* Test handling of the NSObject attribute. */
+/* { dg-additional-options "-fsyntax-only " } */
+
+typedef struct AnObj * __attribute__ ((NSObject)) AnObjRef;
+typedef struct AnObj * __attribute__ ((__NSObject__)) AnotherObjRef;
+
+/* We allow a void * to be labeled as NSObject. */
+typedef void * __attribute__((NSObject)) AnonRef;
+
+typedef struct AnObj * __attribute__((NSObject("foo"))) Bad; // { dg-error {wrong number of arguments specified for 'NSObject' attribute} }
+typedef struct AnObj * __attribute__((NSObject(42))) Wrong; // { dg-error {wrong number of arguments specified for 'NSObject' attribute} }
+
+/* Must be a pointer. */
+typedef struct AnObj __attribute__((NSObject)) BadRef; // { dg-error {'NSObject' attribute is for pointer types only} }
+
+typedef void * VPtr;
+
+@interface CheckAttrNSObject
+{
+@public
+ AnObjRef aor;
+ /* TODO: synthesize without pre-defined ivars. */
+ VPtr obj_v;
+ int bar;
+ /* TODO: This should warn, even tho the property does not */
+ __attribute__((NSObject)) struct AnObj *Thing;
+}
+
+@property(copy) AnObjRef aor;
+
+typedef struct AnObj * __attribute__((NSObject)) AnObjPtr3;
+@property (nonatomic, retain) AnObjPtr3 obj_3;
+
+@property (retain) __attribute__((NSObject)) VPtr obj_v;
+
+//@property (strong, nullable) AnObjPtr3 objp_4;
+
+@property(retain) __attribute__((NSObject)) int bar;
+ // { dg-error {'NSObject' attribute is for pointer types only} "" { target *-*-* } .-1 }
+ // { dg-error {'retain' attribute is only valid for Objective-C objects} "" { target *-*-* } .-2 }
+
+@end
+
+void foo ()
+{
+ __attribute__((NSObject)) struct AnObj *AnotherThing; // { dg-warning {'NSObject' attribute may be put on a typedef only; attribute is ignored} }
+}
+
+void
+setProperty(id self, id value)
+{
+ ((CheckAttrNSObject *)self)->aor = value;
+}
+
+id
+getProperty(id self)
+{
+ return (id)((CheckAttrNSObject *)self)->aor;
+}
+
+@implementation CheckAttrNSObject
+@synthesize aor;
+@dynamic obj_3;
+@synthesize obj_v;
+@synthesize bar;
+@end // { dg-error {invalid conversion} }
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-1.mm b/gcc/testsuite/obj-c++.dg/property/at-property-1.mm
index 7cf650f..3325823 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-1.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-1.mm
@@ -6,15 +6,18 @@
{
Class isa;
}
-@property; /* { dg-error "expected identifier" } */
+@property; /* { dg-error "expected" } */
@property int; /* { dg-error "expected identifier" } */
+
@property int a;
@property int b, c;
-@property () int d; /* { dg-error "expected identifier" } */
+@property () int d; /* { dg-warning "empty property attribute list" } */
@property (readonly) int e;
-@property (readonly,) int f; /* { dg-error "expected identifier" } */
+@property (readonly,) int f; /* { dg-warning "missing property attribute" } */
@property (xxx) int g; /* { dg-error "unknown property attribute" } */
@property (readonly,xxx) int h; /* { dg-error "unknown property attribute" } */
-@property ( int i; /* { dg-error "expected identifier" } */
- /* { dg-error "expected ... " "" { target *-*-* } .-1 } */
+@property ( int i; /* { dg-error "unknown property attribute" } */
+ /* { dg-error "expected" "" { target *-*-* } .-1 } */
+@property (assign,,nonatomic) int j; /* { dg-warning "missing property attribute" } */
+@property (assign nonatomic) int k; /* { dg-error {expected } } */
@end
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-29.mm b/gcc/testsuite/obj-c++.dg/property/at-property-29.mm
index 0f31617..64dfe83 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-29.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-29.mm
@@ -8,7 +8,9 @@
Class isa;
}
/* Test missing '=' in setter/getter attributes. */
-@property (getter) int property_a; /* { dg-error "missing .=. .after .getter. attribute." } */
-@property (setter) int property_b; /* { dg-error "missing .=. .after .setter. attribute." } */
-@property (assign, getter) int property_c; /* { dg-error "missing .=. .after .getter. attribute." } */
+@property (getter) int property_a; /* { dg-error {expected '=' after Objective-C 'getter'} } */
+@property (setter) int property_b; /* { dg-error {expected '=' after Objective-C 'setter'} } */
+@property (assign, getter) int property_c; /* { dg-error {expected '=' after Objective-C 'getter'} } */
+@property (retain, getter=) id x; /* { dg-error {expected 'getter' selector name} } */
+@property (retain, setter=) id y; /* { dg-error {expected 'setter' selector name} } */
@end
diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-4.mm b/gcc/testsuite/obj-c++.dg/property/at-property-4.mm
index 941aab8..f73d706 100644
--- a/gcc/testsuite/obj-c++.dg/property/at-property-4.mm
+++ b/gcc/testsuite/obj-c++.dg/property/at-property-4.mm
@@ -14,27 +14,35 @@
- (void) mySetter2: (int)property;
/* Test that all the new property attributes can be parsed. */
-@property (assign) id property_a;
-@property (copy) id property_b;
-@property (nonatomic) int property_c;
-@property (readonly) int property_d;
-@property (readwrite) int property_e;
-@property (retain) id property_f;
-@property (release) int property_g; /* { dg-error "unknown property attribute" } */
+@property (assign) id property_as_1;
+@property (copy) id property_as_2;
+@property (retain) id property_as_3;
-@property (getter=myGetter) int property_h;
-@property (setter=mySetter:) int property_i;
+@property (atomic) int property_at_1;
+@property (nonatomic) int property_at_2;
+
+@property (readonly) int property_rw_1;
+@property (readwrite) int property_rw_2;
+
+@property (class) int property_cl_1;
+
+@property (release) int property_err_1; /* { dg-error "unknown property attribute" } */
+
+@property (getter=myGetter) int property_g0;
+@property (setter=mySetter:) int property_s0;
/* Now test various problems. */
-@property (readonly, readwrite) int a; /* { dg-error ".readonly. attribute conflicts with .readwrite. attribute" } */
+@property (readonly, readwrite) int a; /* { dg-error ".readwrite. attribute conflicts with .readonly. attribute" } */
@property (readonly, setter=mySetterB:) int b; /* { dg-error ".readonly. attribute conflicts with .setter. attribute" } */
-@property (assign, retain) id c; /* { dg-error ".assign. attribute conflicts with .retain. attribute" } */
-@property (assign, copy) id d; /* { dg-error ".assign. attribute conflicts with .copy. attribute" } */
+@property (assign, retain) id c; /* { dg-error ".retain. attribute conflicts with .assign. attribute" } */
+@property (assign, copy) id d; /* { dg-error ".copy. attribute conflicts with .assign. attribute" } */
@property (copy, retain) id e; /* { dg-error ".retain. attribute conflicts with .copy. attribute" } */
-@property (setter=mySetter:,setter=mySetter2:) int f; /* { dg-error ".setter. attribute may only be specified once" } */
-@property (getter=myGetter, getter=myGetter2 ) int g; /* { dg-error ".getter. attribute may only be specified once" } */
+@property (atomic, nonatomic) int property_j; /* { dg-error {'nonatomic' attribute conflicts with 'atomic' attribute} } */
+
+@property (setter=mySetter:,setter=mySetter2:) int f; /* { dg-warning {multiple property 'setter' methods specified, the latest one will be used} } */
+@property (getter=myGetter, getter=myGetter2 ) int g; /* { dg-warning {multiple property 'getter' methods specified, the latest one will be used} } */
@end
diff --git a/gcc/testsuite/obj-c++.dg/property/property-neg-2.mm b/gcc/testsuite/obj-c++.dg/property/property-neg-2.mm
index f730fe8..794f2bd 100644
--- a/gcc/testsuite/obj-c++.dg/property/property-neg-2.mm
+++ b/gcc/testsuite/obj-c++.dg/property/property-neg-2.mm
@@ -4,5 +4,5 @@
@end
@implementation Bar
-@property int FooBar; /* { dg-error "property declaration not in @interface or @protocol context" } */
+@property int FooBar; /* { dg-error {property declaration not in '@interface', '@protocol' or 'category' context} } */
@end
diff --git a/gcc/testsuite/objc.dg/SEL-typedef.m b/gcc/testsuite/objc.dg/SEL-typedef.m
new file mode 100644
index 0000000..2ece1fd
--- /dev/null
+++ b/gcc/testsuite/objc.dg/SEL-typedef.m
@@ -0,0 +1,7 @@
+/* Check that we accept the SEL typedef. */
+/* { dg-additional-options "-fsyntax-only " } */
+
+SEL aSelector;
+
+typedef SEL MySEL;
+
diff --git a/gcc/testsuite/objc.dg/attributes/nsobject-01.m b/gcc/testsuite/objc.dg/attributes/nsobject-01.m
new file mode 100644
index 0000000..5b56849
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/nsobject-01.m
@@ -0,0 +1,66 @@
+/* Test handling of the NSObject attribute. */
+/* { dg-additional-options "-fsyntax-only " } */
+
+typedef struct AnObj * __attribute__ ((NSObject)) AnObjRef;
+typedef struct AnObj * __attribute__ ((__NSObject__)) AnotherObjRef;
+
+/* We allow a void * to be labeled as NSObject. */
+typedef void * __attribute__((NSObject)) AnonRef;
+
+typedef struct AnObj * __attribute__((NSObject("foo"))) Bad; // { dg-error {wrong number of arguments specified for 'NSObject' attribute} }
+typedef struct AnObj * __attribute__((NSObject(42))) Wrong; // { dg-error {wrong number of arguments specified for 'NSObject' attribute} }
+
+/* Must be a pointer. */
+typedef struct AnObj __attribute__((NSObject)) BadRef; // { dg-error {'NSObject' attribute is for pointer types only} }
+
+typedef void * VPtr;
+
+@interface CheckAttrNSObject
+{
+@public
+ AnObjRef aor;
+ /* TODO: synthesize without pre-defined ivars. */
+ VPtr obj_v;
+ int bar;
+ /* TODO: This should warn, even tho the property does not */
+ __attribute__((NSObject)) struct AnObj *Thing;
+}
+
+@property(copy) AnObjRef aor;
+
+typedef struct AnObj * __attribute__((NSObject)) AnObjPtr3;
+@property (nonatomic, retain) AnObjPtr3 obj_3;
+
+@property (retain) __attribute__((NSObject)) VPtr obj_v;
+
+//@property (strong, nullable) AnObjPtr3 objp_4;
+
+@property(retain) __attribute__((NSObject)) int bar;
+ // { dg-error {'NSObject' attribute is for pointer types only} "" { target *-*-* } .-1 }
+ // { dg-error {'retain' attribute is only valid for Objective-C objects} "" { target *-*-* } .-2 }
+
+@end
+
+void foo ()
+{
+ __attribute__((NSObject)) struct AnObj *AnotherThing; // { dg-warning {'NSObject' attribute may be put on a typedef only; attribute is ignored} }
+}
+
+void
+setProperty(id self, id value)
+{
+ ((CheckAttrNSObject *)self)->aor = value;
+}
+
+id
+getProperty(id self)
+{
+ return (id)((CheckAttrNSObject *)self)->aor;
+}
+
+@implementation CheckAttrNSObject
+@synthesize aor;
+@dynamic obj_3;
+@synthesize obj_v;
+@synthesize bar; // { dg-warning {returning 'id' from a function with return type 'int'} }
+@end // { dg-warning {passing argument} }
diff --git a/gcc/testsuite/objc.dg/property/at-property-1.m b/gcc/testsuite/objc.dg/property/at-property-1.m
index fa12fa2..6dba8f4 100644
--- a/gcc/testsuite/objc.dg/property/at-property-1.m
+++ b/gcc/testsuite/objc.dg/property/at-property-1.m
@@ -11,11 +11,15 @@
/* { dg-warning "declaration does not declare anything" "" { target *-*-* } .-1 } */
@property int a;
@property int b, c;
-@property () int d; /* { dg-error "expected identifier" } */
+@property () int d; /* { dg-warning "empty property attribute list" } */
@property (readonly) int e;
-@property (readonly,) int f; /* { dg-error "expected identifier" } */
+@property (readonly,) int f; /* { dg-warning "missing property attribute" } */
@property (xxx) int g; /* { dg-error "unknown property attribute" } */
@property (readonly,xxx) int h; /* { dg-error "unknown property attribute" } */
@property ( int i; /* { dg-error "unknown property attribute" } */
-/* Because the last syntax error opens a '(' and never closes it, we get to the end of input. */
-@end /* { dg-error "expected ..end. at end of input" } */
+ /* { dg-error "expected" "" { target *-*-* } .-1 } */
+@property (assign,,nonatomic) int j; /* { dg-warning "missing property attribute" } */
+@property (assign nonatomic) int k; /* { dg-error {expected } } */
+@property (assign) int l[4]; /* { dg-error {property cannot be an array} } */
+@property (assign) int : 5; /* { dg-error {properties must be named} } */
+@end
diff --git a/gcc/testsuite/objc.dg/property/at-property-29.m b/gcc/testsuite/objc.dg/property/at-property-29.m
index 0f31617..0b34e1c 100644
--- a/gcc/testsuite/objc.dg/property/at-property-29.m
+++ b/gcc/testsuite/objc.dg/property/at-property-29.m
@@ -8,7 +8,8 @@
Class isa;
}
/* Test missing '=' in setter/getter attributes. */
-@property (getter) int property_a; /* { dg-error "missing .=. .after .getter. attribute." } */
-@property (setter) int property_b; /* { dg-error "missing .=. .after .setter. attribute." } */
-@property (assign, getter) int property_c; /* { dg-error "missing .=. .after .getter. attribute." } */
+@property (getter) int property_a; /* { dg-error {expected '=' after Objective-C 'getter'} } */
+@property (setter) int property_b; /* { dg-error {expected '=' after Objective-C 'setter'} } */
+@property (assign, getter) int property_c; /* { dg-error {expected '=' after Objective-C 'getter'} } */
+@property (retain, getter=) id x; /* { dg-error {expected 'getter' selector name} } */
@end
diff --git a/gcc/testsuite/objc.dg/property/at-property-4.m b/gcc/testsuite/objc.dg/property/at-property-4.m
index 941aab8..0e905db 100644
--- a/gcc/testsuite/objc.dg/property/at-property-4.m
+++ b/gcc/testsuite/objc.dg/property/at-property-4.m
@@ -14,27 +14,35 @@
- (void) mySetter2: (int)property;
/* Test that all the new property attributes can be parsed. */
-@property (assign) id property_a;
-@property (copy) id property_b;
-@property (nonatomic) int property_c;
-@property (readonly) int property_d;
-@property (readwrite) int property_e;
-@property (retain) id property_f;
-@property (release) int property_g; /* { dg-error "unknown property attribute" } */
+@property (assign) id property_as_1;
+@property (copy) id property_as_2;
+@property (retain) id property_as_3;
+
+@property (atomic) int property_at_1;
+@property (nonatomic) int property_at_2;
+
+@property (readonly) int property_rw_1;
+@property (readwrite) int property_rw_2;
+
+@property (class) int property_cl_1;
+
+@property (release) int property_err_1; /* { dg-error "unknown property attribute" } */
@property (getter=myGetter) int property_h;
@property (setter=mySetter:) int property_i;
/* Now test various problems. */
-@property (readonly, readwrite) int a; /* { dg-error ".readonly. attribute conflicts with .readwrite. attribute" } */
+@property (readonly, readwrite) int a; /* { dg-error ".readwrite. attribute conflicts with .readonly. attribute" } */
@property (readonly, setter=mySetterB:) int b; /* { dg-error ".readonly. attribute conflicts with .setter. attribute" } */
-@property (assign, retain) id c; /* { dg-error ".assign. attribute conflicts with .retain. attribute" } */
-@property (assign, copy) id d; /* { dg-error ".assign. attribute conflicts with .copy. attribute" } */
+@property (assign, retain) id c; /* { dg-error ".retain. attribute conflicts with .assign. attribute" } */
+@property (assign, copy) id d; /* { dg-error ".copy. attribute conflicts with .assign. attribute" } */
@property (copy, retain) id e; /* { dg-error ".retain. attribute conflicts with .copy. attribute" } */
-@property (setter=mySetter:,setter=mySetter2:) int f; /* { dg-error ".setter. attribute may only be specified once" } */
-@property (getter=myGetter, getter=myGetter2 ) int g; /* { dg-error ".getter. attribute may only be specified once" } */
+@property (atomic, nonatomic) int property_j; /* { dg-error {'nonatomic' attribute conflicts with 'atomic' attribute} } */
+
+@property (setter=mySetter:,setter=mySetter2:) int f; /* { dg-warning {multiple property 'setter' methods specified, the latest one will be used} } */
+@property (getter=myGetter, getter=myGetter2 ) int g; /* { dg-warning {multiple property 'getter' methods specified, the latest one will be used} } */
@end
diff --git a/gcc/testsuite/objc.dg/property/at-property-5.m b/gcc/testsuite/objc.dg/property/at-property-5.m
index 1267df3..820f5b3 100644
--- a/gcc/testsuite/objc.dg/property/at-property-5.m
+++ b/gcc/testsuite/objc.dg/property/at-property-5.m
@@ -31,4 +31,4 @@
/* { dg-message "originally specified here" "" { target *-*-* } property_e_first } */
@end
-@property id test; /* { dg-error "property declaration not in .interface or .protocol context" } */
+@property id test; /* { dg-error {property declaration not in '@interface', '@protocol' or 'category' context} } */
diff --git a/gcc/testsuite/objc.dg/property/property-neg-2.m b/gcc/testsuite/objc.dg/property/property-neg-2.m
index f730fe8..794f2bd 100644
--- a/gcc/testsuite/objc.dg/property/property-neg-2.m
+++ b/gcc/testsuite/objc.dg/property/property-neg-2.m
@@ -4,5 +4,5 @@
@end
@implementation Bar
-@property int FooBar; /* { dg-error "property declaration not in @interface or @protocol context" } */
+@property int FooBar; /* { dg-error {property declaration not in '@interface', '@protocol' or 'category' context} } */
@end
diff --git a/gcc/timevar.def b/gcc/timevar.def
index 08c21c0..a303179 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -194,6 +194,7 @@ DEFTIMEVAR (TV_TREE_LOOP_UNSWITCH , "tree loop unswitching")
DEFTIMEVAR (TV_LOOP_SPLIT , "loop splitting")
DEFTIMEVAR (TV_LOOP_JAM , "unroll and jam")
DEFTIMEVAR (TV_COMPLETE_UNROLL , "complete unrolling")
+DEFTIMEVAR (TV_SCALAR_CLEANUP , "scalar cleanup")
DEFTIMEVAR (TV_TREE_PARALLELIZE_LOOPS, "tree parallelize loops")
DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree vectorization")
DEFTIMEVAR (TV_TREE_SLP_VECTORIZATION, "tree slp vectorization")
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 8c1e1e1..e32dc28 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1843,7 +1843,6 @@ process_options (void)
if ((flag_sanitize & SANITIZE_KERNEL_ADDRESS)
&& (targetm.asan_shadow_offset == NULL
- && param_asan_stack
&& !asan_shadow_offset_set_p ()))
{
warning_at (UNKNOWN_LOCATION, 0,
@@ -2507,6 +2506,7 @@ toplev::finalize (void)
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 e1c2b95..2f9daf9 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -84,65 +84,6 @@ bb_seen_p (basic_block bb)
return bitmap_bit_p (bb_seen, bb->index);
}
-/* Return true if gimple stmt G can be duplicated. */
-static bool
-can_duplicate_insn_p (gimple *g)
-{
- /* 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;
-}
-
-/* Return true if BB can be duplicated. Avoid iterating over the insns. */
-static bool
-can_duplicate_bb_no_insn_iter_p (const_basic_block bb)
-{
- if (bb->index < NUM_FIXED_BLOCKS)
- return false;
-
- 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 false;
-
- /* 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 false;
- }
-
- return true;
-}
-
-/* Return true if BB can be duplicated. */
-static bool
-can_duplicate_bb_p (const_basic_block bb)
-{
- if (!can_duplicate_bb_no_insn_iter_p (bb))
- return false;
-
- for (gimple_stmt_iterator gsi = gsi_start_bb (CONST_CAST_BB (bb));
- !gsi_end_p (gsi); gsi_next (&gsi))
- if (!can_duplicate_insn_p (gsi_stmt (gsi)))
- return false;
-
- return true;
-}
-
static sbitmap can_duplicate_bb;
/* Cache VAL as value of can_duplicate_bb_p for BB. */
@@ -167,7 +108,7 @@ cached_can_duplicate_bb_p (const_basic_block bb)
return false;
}
- return can_duplicate_bb_p (bb);
+ return can_duplicate_block_p (bb);
}
/* Return true if we should ignore the basic block for purposes of tracing. */
@@ -190,16 +131,15 @@ analyze_bb (basic_block bb, int *count)
gimple_stmt_iterator gsi;
gimple *stmt;
int n = 0;
- bool can_duplicate = can_duplicate_bb_no_insn_iter_p (bb);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
stmt = gsi_stmt (gsi);
n += estimate_num_insns (stmt, &eni_size_weights);
- can_duplicate = can_duplicate && can_duplicate_insn_p (stmt);
}
*count = n;
- cache_can_duplicate_bb_p (bb, can_duplicate);
+
+ cache_can_duplicate_bb_p (bb, can_duplicate_block_p (CONST_CAST_BB (bb)));
}
/* Return true if E1 is more frequent than E2. */
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 5caf3b6..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;
}
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 752bec3..c9280a8 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -276,6 +276,9 @@ enum omp_clause_code {
/* OpenMP clause: aligned (variable-list[:alignment]). */
OMP_CLAUSE_ALIGNED,
+ /* OpenMP clause: allocate ([allocator:]variable-list). */
+ OMP_CLAUSE_ALLOCATE,
+
/* OpenMP clause: depend ({in,out,inout}:variable-list). */
OMP_CLAUSE_DEPEND,
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-diagnostic-path.cc b/gcc/tree-diagnostic-path.cc
index 82b3c2d..164df86 100644
--- a/gcc/tree-diagnostic-path.cc
+++ b/gcc/tree-diagnostic-path.cc
@@ -110,112 +110,108 @@ can_consolidate_events (const diagnostic_event &e1,
return true;
}
-/* A class for grouing together the events in a diagnostic_path into
- ranges of events, partitioned by stack frame (i.e. by fndecl and
- stack depth). */
-
-class path_summary
+/* A range of consecutive events within a diagnostic_path,
+ all with the same fndecl and stack_depth, and which are suitable
+ to print with a single call to diagnostic_show_locus. */
+struct event_range
{
- /* A range of consecutive events within a diagnostic_path,
- all with the same fndecl and stack_depth, and which are suitable
- to print with a single call to diagnostic_show_locus. */
- struct event_range
+ event_range (const diagnostic_path *path, unsigned start_idx,
+ const diagnostic_event &initial_event)
+ : m_path (path),
+ m_initial_event (initial_event),
+ m_fndecl (initial_event.get_fndecl ()),
+ m_stack_depth (initial_event.get_stack_depth ()),
+ m_start_idx (start_idx), m_end_idx (start_idx),
+ m_path_label (path, start_idx),
+ m_richloc (initial_event.get_location (), &m_path_label)
+ {}
+
+ bool maybe_add_event (const diagnostic_event &new_ev, unsigned idx,
+ bool check_rich_locations)
{
- event_range (const diagnostic_path *path, unsigned start_idx,
- const diagnostic_event &initial_event)
- : m_path (path),
- m_initial_event (initial_event),
- m_fndecl (initial_event.get_fndecl ()),
- m_stack_depth (initial_event.get_stack_depth ()),
- m_start_idx (start_idx), m_end_idx (start_idx),
- m_path_label (path, start_idx),
- m_richloc (initial_event.get_location (), &m_path_label)
- {}
-
- bool maybe_add_event (const diagnostic_event &new_ev, unsigned idx,
- bool check_rich_locations)
- {
- if (!can_consolidate_events (m_initial_event, new_ev,
- check_rich_locations))
+ if (!can_consolidate_events (m_initial_event, new_ev,
+ check_rich_locations))
+ return false;
+ if (check_rich_locations)
+ if (!m_richloc.add_location_if_nearby (new_ev.get_location (),
+ false, &m_path_label))
return false;
- if (check_rich_locations)
- if (!m_richloc.add_location_if_nearby (new_ev.get_location (),
- false, &m_path_label))
- return false;
- m_end_idx = idx;
- return true;
- }
+ m_end_idx = idx;
+ return true;
+ }
- /* Print the events in this range to DC, typically as a single
- call to the printer's diagnostic_show_locus. */
+ /* Print the events in this range to DC, typically as a single
+ call to the printer's diagnostic_show_locus. */
- void print (diagnostic_context *dc)
- {
- location_t initial_loc = m_initial_event.get_location ();
+ void print (diagnostic_context *dc)
+ {
+ location_t initial_loc = m_initial_event.get_location ();
- /* Emit a span indicating the filename (and line/column) if the
- line has changed relative to the last call to
- diagnostic_show_locus. */
- if (dc->show_caret)
- {
- expanded_location exploc
- = linemap_client_expand_location_to_spelling_point
- (initial_loc, LOCATION_ASPECT_CARET);
- if (exploc.file != LOCATION_FILE (dc->last_location))
- dc->start_span (dc, exploc);
- }
+ /* Emit a span indicating the filename (and line/column) if the
+ line has changed relative to the last call to
+ diagnostic_show_locus. */
+ if (dc->show_caret)
+ {
+ expanded_location exploc
+ = linemap_client_expand_location_to_spelling_point
+ (initial_loc, LOCATION_ASPECT_CARET);
+ if (exploc.file != LOCATION_FILE (dc->last_location))
+ dc->start_span (dc, exploc);
+ }
- /* If we have an UNKNOWN_LOCATION (or BUILTINS_LOCATION) as the
- primary location for an event, diagnostic_show_locus won't print
- anything.
+ /* If we have an UNKNOWN_LOCATION (or BUILTINS_LOCATION) as the
+ primary location for an event, diagnostic_show_locus won't print
+ anything.
- In particular the label for the event won't get printed.
- Fail more gracefully in this case by showing the event
- index and text, at no particular location. */
- if (get_pure_location (initial_loc) <= BUILTINS_LOCATION)
- {
- for (unsigned i = m_start_idx; i <= m_end_idx; i++)
- {
- const diagnostic_event &iter_event = m_path->get_event (i);
- diagnostic_event_id_t event_id (i);
- label_text event_text (iter_event.get_desc (true));
- pretty_printer *pp = dc->printer;
- pp_printf (pp, " %@: %s", &event_id, event_text.m_buffer);
- pp_newline (pp);
- event_text.maybe_free ();
- }
- return;
- }
+ In particular the label for the event won't get printed.
+ Fail more gracefully in this case by showing the event
+ index and text, at no particular location. */
+ if (get_pure_location (initial_loc) <= BUILTINS_LOCATION)
+ {
+ for (unsigned i = m_start_idx; i <= m_end_idx; i++)
+ {
+ const diagnostic_event &iter_event = m_path->get_event (i);
+ diagnostic_event_id_t event_id (i);
+ label_text event_text (iter_event.get_desc (true));
+ pretty_printer *pp = dc->printer;
+ pp_printf (pp, " %@: %s", &event_id, event_text.m_buffer);
+ pp_newline (pp);
+ event_text.maybe_free ();
+ }
+ return;
+ }
- /* Call diagnostic_show_locus to show the events using labels. */
- diagnostic_show_locus (dc, &m_richloc, DK_DIAGNOSTIC_PATH);
+ /* Call diagnostic_show_locus to show the events using labels. */
+ diagnostic_show_locus (dc, &m_richloc, DK_DIAGNOSTIC_PATH);
- /* If we have a macro expansion, show the expansion to the user. */
- if (linemap_location_from_macro_expansion_p (line_table, initial_loc))
- {
- gcc_assert (m_start_idx == m_end_idx);
- maybe_unwind_expanded_macro_loc (dc, initial_loc);
- }
- }
+ /* If we have a macro expansion, show the expansion to the user. */
+ if (linemap_location_from_macro_expansion_p (line_table, initial_loc))
+ {
+ gcc_assert (m_start_idx == m_end_idx);
+ maybe_unwind_expanded_macro_loc (dc, initial_loc);
+ }
+ }
- const diagnostic_path *m_path;
- const diagnostic_event &m_initial_event;
- tree m_fndecl;
- int m_stack_depth;
- unsigned m_start_idx;
- unsigned m_end_idx;
- path_label m_path_label;
- gcc_rich_location m_richloc;
- };
+ const diagnostic_path *m_path;
+ const diagnostic_event &m_initial_event;
+ tree m_fndecl;
+ int m_stack_depth;
+ unsigned m_start_idx;
+ unsigned m_end_idx;
+ path_label m_path_label;
+ gcc_rich_location m_richloc;
+};
- public:
- path_summary (const diagnostic_path &path, bool check_rich_locations);
+/* A struct for grouping together the events in a diagnostic_path into
+ ranges of events, partitioned by stack frame (i.e. by fndecl and
+ stack depth). */
- void print (diagnostic_context *dc, bool show_depths) const;
+struct path_summary
+{
+ path_summary (const diagnostic_path &path, bool check_rich_locations);
unsigned get_num_ranges () const { return m_ranges.length (); }
- private:
auto_delete_vec <event_range> m_ranges;
};
@@ -265,7 +261,7 @@ print_fndecl (pretty_printer *pp, tree fndecl, bool quoted)
pp_string (pp, n);
}
-/* Print this path_summary to DC, giving an overview of the interprocedural
+/* Print path_summary PS to DC, giving an overview of the interprocedural
calls and returns.
Print the event descriptions in a nested form, printing the event
@@ -299,7 +295,8 @@ print_fndecl (pretty_printer *pp, tree fndecl, bool quoted)
For events with UNKNOWN_LOCATION, print a summary of each the event. */
void
-path_summary::print (diagnostic_context *dc, bool show_depths) const
+print_path_summary_as_text (const path_summary *ps, diagnostic_context *dc,
+ bool show_depths)
{
pretty_printer *pp = dc->printer;
@@ -322,13 +319,12 @@ path_summary::print (diagnostic_context *dc, bool show_depths) const
int cur_indent = base_indent;
unsigned i;
event_range *range;
- FOR_EACH_VEC_ELT (m_ranges, i, range)
+ FOR_EACH_VEC_ELT (ps->m_ranges, i, range)
{
write_indent (pp, cur_indent);
if (i > 0)
{
- const path_summary::event_range *prev_range
- = m_ranges[i - 1];
+ const event_range *prev_range = ps->m_ranges[i - 1];
if (range->m_stack_depth > prev_range->m_stack_depth)
{
/* Show pushed stack frame(s). */
@@ -384,10 +380,9 @@ path_summary::print (diagnostic_context *dc, bool show_depths) const
pp_newline (pp);
}
- if (i < m_ranges.length () - 1)
+ if (i < ps->m_ranges.length () - 1)
{
- const path_summary::event_range *next_range
- = m_ranges[i + 1];
+ const event_range *next_range = ps->m_ranges[i + 1];
if (range->m_stack_depth > next_range->m_stack_depth)
{
@@ -481,7 +476,8 @@ default_tree_diagnostic_path_printer (diagnostic_context *context,
path_summary summary (*path, true);
char *saved_prefix = pp_take_prefix (context->printer);
pp_set_prefix (context->printer, NULL);
- summary.print (context, context->show_path_depths);
+ print_path_summary_as_text (&summary, context,
+ context->show_path_depths);
pp_flush (context->printer);
pp_set_prefix (context->printer, saved_prefix);
}
@@ -569,7 +565,7 @@ test_empty_path (pretty_printer *event_pp)
ASSERT_EQ (summary.get_num_ranges (), 0);
test_diagnostic_context dc;
- summary.print (&dc, true);
+ print_path_summary_as_text (&summary, &dc, true);
ASSERT_STREQ ("",
pp_formatted_text (dc.printer));
}
@@ -593,7 +589,7 @@ test_intraprocedural_path (pretty_printer *event_pp)
ASSERT_EQ (summary.get_num_ranges (), 1);
test_diagnostic_context dc;
- summary.print (&dc, true);
+ print_path_summary_as_text (&summary, &dc, true);
ASSERT_STREQ (" `foo': events 1-2 (depth 0)\n"
" |\n"
" | (1): first `free'\n"
@@ -642,7 +638,7 @@ test_interprocedural_path_1 (pretty_printer *event_pp)
ASSERT_EQ (summary.get_num_ranges (), 9);
test_diagnostic_context dc;
- summary.print (&dc, true);
+ print_path_summary_as_text (&summary, &dc, true);
ASSERT_STREQ
(" `test': events 1-2 (depth 0)\n"
" |\n"
@@ -724,7 +720,7 @@ test_interprocedural_path_2 (pretty_printer *event_pp)
ASSERT_EQ (summary.get_num_ranges (), 5);
test_diagnostic_context dc;
- summary.print (&dc, true);
+ print_path_summary_as_text (&summary, &dc, true);
ASSERT_STREQ
(" `foo': events 1-2 (depth 0)\n"
" |\n"
@@ -776,7 +772,7 @@ test_recursion (pretty_printer *event_pp)
ASSERT_EQ (summary.get_num_ranges (), 4);
test_diagnostic_context dc;
- summary.print (&dc, true);
+ print_path_summary_as_text (&summary, &dc, true);
ASSERT_STREQ
(" `factorial': events 1-2 (depth 0)\n"
" |\n"
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0d33ee7..32424b1 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -61,6 +61,10 @@ 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"
+#include "symtab-clones.h"
/* I'm not real happy about this, but we need to handle gimple and
non-gimple trees. */
@@ -4699,6 +4703,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
use_operand_p use;
gimple *simtenter_stmt = NULL;
vec<tree> *simtvars_save;
+ clone_info *info;
/* The gimplifier uses input_location in too many places, such as
internal_get_tmp_var (). */
@@ -4792,13 +4797,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 +4813,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);
@@ -5020,31 +5026,33 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
/* Add local vars in this inlined callee to caller. */
add_local_variables (id->src_cfun, cfun, id);
- if (id->src_node->clone.performed_splits)
+ info = clone_info::get (id->src_node);
+ if (info && info->performed_splits)
{
+ clone_info *dst_info = clone_info::get_create (id->dst_node);
/* Any calls from the inlined function will be turned into calls from the
function we inline into. We must preserve notes about how to split
parameters such calls should be redirected/updated. */
- unsigned len = vec_safe_length (id->src_node->clone.performed_splits);
+ unsigned len = vec_safe_length (info->performed_splits);
for (unsigned i = 0; i < len; i++)
{
ipa_param_performed_split ps
- = (*id->src_node->clone.performed_splits)[i];
+ = (*info->performed_splits)[i];
ps.dummy_decl = remap_decl (ps.dummy_decl, id);
- vec_safe_push (id->dst_node->clone.performed_splits, ps);
+ vec_safe_push (dst_info->performed_splits, ps);
}
if (flag_checking)
{
- len = vec_safe_length (id->dst_node->clone.performed_splits);
+ len = vec_safe_length (dst_info->performed_splits);
for (unsigned i = 0; i < len; i++)
{
ipa_param_performed_split *ps1
- = &(*id->dst_node->clone.performed_splits)[i];
+ = &(*dst_info->performed_splits)[i];
for (unsigned j = i + 1; j < len; j++)
{
ipa_param_performed_split *ps2
- = &(*id->dst_node->clone.performed_splits)[j];
+ = &(*dst_info->performed_splits)[j];
gcc_assert (ps1->dummy_decl != ps2->dummy_decl
|| ps1->unit_offset != ps2->unit_offset);
}
@@ -6070,8 +6078,9 @@ tree_versionable_function_p (tree fndecl)
static void
update_clone_info (copy_body_data * id)
{
+ clone_info *dst_info = clone_info::get (id->dst_node);
vec<ipa_param_performed_split, va_gc> *cur_performed_splits
- = id->dst_node->clone.performed_splits;
+ = dst_info ? dst_info->performed_splits : NULL;
if (cur_performed_splits)
{
unsigned len = cur_performed_splits->length ();
@@ -6088,23 +6097,24 @@ update_clone_info (copy_body_data * id)
for (node = id->dst_node->clones; node != id->dst_node;)
{
/* First update replace maps to match the new body. */
- if (node->clone.tree_map)
- {
+ clone_info *info = clone_info::get (node);
+ if (info && info->tree_map)
+ {
unsigned int i;
- for (i = 0; i < vec_safe_length (node->clone.tree_map); i++)
+ for (i = 0; i < vec_safe_length (info->tree_map); i++)
{
struct ipa_replace_map *replace_info;
- replace_info = (*node->clone.tree_map)[i];
+ replace_info = (*info->tree_map)[i];
walk_tree (&replace_info->new_tree, copy_tree_body_r, id, NULL);
}
}
- if (node->clone.performed_splits)
+ if (info && info->performed_splits)
{
- unsigned len = vec_safe_length (node->clone.performed_splits);
+ unsigned len = vec_safe_length (info->performed_splits);
for (unsigned i = 0; i < len; i++)
{
ipa_param_performed_split *ps
- = &(*node->clone.performed_splits)[i];
+ = &(*info->performed_splits)[i];
ps->dummy_decl = remap_decl (ps->dummy_decl, id);
}
}
@@ -6114,10 +6124,12 @@ update_clone_info (copy_body_data * id)
a copy of function body for later during inlining, that would just
duplicate all entries. So let's have a look whether anything
referring to the first dummy_decl is present. */
- unsigned dst_len = vec_safe_length (node->clone.performed_splits);
+ if (!info)
+ info = clone_info::get_create (node);
+ unsigned dst_len = vec_safe_length (info->performed_splits);
ipa_param_performed_split *first = &(*cur_performed_splits)[0];
for (unsigned i = 0; i < dst_len; i++)
- if ((*node->clone.performed_splits)[i].dummy_decl
+ if ((*info->performed_splits)[i].dummy_decl
== first->dummy_decl)
{
len = 0;
@@ -6125,18 +6137,18 @@ update_clone_info (copy_body_data * id)
}
for (unsigned i = 0; i < len; i++)
- vec_safe_push (node->clone.performed_splits,
+ vec_safe_push (info->performed_splits,
(*cur_performed_splits)[i]);
if (flag_checking)
{
for (unsigned i = 0; i < dst_len; i++)
{
ipa_param_performed_split *ps1
- = &(*node->clone.performed_splits)[i];
+ = &(*info->performed_splits)[i];
for (unsigned j = i + 1; j < dst_len; j++)
{
ipa_param_performed_split *ps2
- = &(*node->clone.performed_splits)[j];
+ = &(*info->performed_splits)[j];
gcc_assert (ps1->dummy_decl != ps2->dummy_decl
|| ps1->unit_offset != ps2->unit_offset);
}
@@ -6266,8 +6278,9 @@ tree_function_versioning (tree old_decl, tree new_decl,
= copy_static_chain (p, &id);
auto_vec<int, 16> new_param_indices;
+ clone_info *info = clone_info::get (old_version_node);
ipa_param_adjustments *old_param_adjustments
- = old_version_node->clone.param_adjustments;
+ = info ? info->param_adjustments : NULL;
if (old_param_adjustments)
old_param_adjustments->get_updated_indices (&new_param_indices);
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index f74a727..a4d82174 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -42,7 +42,107 @@
#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);
+ nested_function_sum->disable_insertion_hook ();
+ }
+ 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)
+{
+ /* All nested functions gets lowered during the construction of symtab. */
+ if (symtab->state > CONSTRUCTION)
+ return;
+ 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 +686,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 +917,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 +944,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;
@@ -1339,6 +1441,7 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
}
/* FALLTHRU */
case OMP_CLAUSE_NONTEMPORAL:
+ do_decl_clause_no_supp:
/* Like do_decl_clause, but don't add any suppression. */
decl = OMP_CLAUSE_DECL (clause);
if (VAR_P (decl)
@@ -1351,6 +1454,16 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
}
break;
+ case OMP_CLAUSE_ALLOCATE:
+ if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause))
+ {
+ wi->val_only = true;
+ wi->is_lhs = false;
+ convert_nonlocal_reference_op
+ (&OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause), &dummy, wi);
+ }
+ goto do_decl_clause_no_supp;
+
case OMP_CLAUSE_NOWAIT:
case OMP_CLAUSE_ORDERED:
case OMP_CLAUSE_DEFAULT:
@@ -2101,6 +2214,7 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
}
/* FALLTHRU */
case OMP_CLAUSE_NONTEMPORAL:
+ do_decl_clause_no_supp:
/* Like do_decl_clause, but don't add any suppression. */
decl = OMP_CLAUSE_DECL (clause);
if (VAR_P (decl)
@@ -2119,6 +2233,16 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
}
break;
+ case OMP_CLAUSE_ALLOCATE:
+ if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause))
+ {
+ wi->val_only = true;
+ wi->is_lhs = false;
+ convert_local_reference_op
+ (&OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause), &dummy, wi);
+ }
+ goto do_decl_clause_no_supp;
+
case OMP_CLAUSE_NOWAIT:
case OMP_CLAUSE_ORDERED:
case OMP_CLAUSE_DEFAULT:
@@ -2952,7 +3076,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 +3112,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 +3622,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 +3665,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 +3682,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-pass.h b/gcc/tree-pass.h
index 62e5b69..9cb22ac 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -310,6 +310,11 @@ protected:
#define TODO_verify_all TODO_verify_il
+/* To-do flags for pending_TODOs. */
+
+/* Tell the next scalar cleanup pass that there is
+ work for it to do. */
+#define PENDING_TODO_force_next_scalar_cleanup (1 << 1)
/* Register pass info. */
@@ -380,6 +385,7 @@ extern gimple_opt_pass *make_pass_simduid_cleanup (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_slp_vectorize (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_complete_unroll (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_complete_unrolli (gcc::context *ctxt);
+extern gimple_opt_pass *make_pass_pre_slp_scalar_cleanup (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_parallelize_loops (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_loop_prefetch (gcc::context *ctxt);
extern gimple_opt_pass *make_pass_iv_optimize (gcc::context *ctxt);
@@ -519,8 +525,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);
@@ -592,6 +596,7 @@ extern rtl_opt_pass *make_pass_gcse2 (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_split_after_reload (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_thread_prologue_and_epilogue (gcc::context
*ctxt);
+extern rtl_opt_pass *make_pass_zero_call_used_regs (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_stack_adjustments (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_sched_fusion (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_peephole2 (gcc::context *ctxt);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index ed6407c..318f048 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -712,6 +712,19 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
pp_right_paren (pp);
break;
+ case OMP_CLAUSE_ALLOCATE:
+ pp_string (pp, "allocate(");
+ if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause))
+ {
+ dump_generic_node (pp, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause),
+ spc, flags, false);
+ pp_colon (pp);
+ }
+ dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
+ spc, flags, false);
+ pp_right_paren (pp);
+ break;
+
case OMP_CLAUSE_DEPEND:
pp_string (pp, "depend(");
switch (OMP_CLAUSE_DEPEND_KIND (clause))
@@ -1542,8 +1555,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);
@@ -2153,7 +2165,7 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
break;
case TYPE_DECL:
- if (DECL_IS_BUILTIN (node))
+ if (DECL_IS_UNDECLARED_BUILTIN (node))
{
/* Don't print the declaration of built-in types. */
break;
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 877e499..e64011d 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "errors.h"
#include "dbgcnt.h"
#include "gimple-pretty-print.h"
+#include "print-tree.h"
/* Broad overview of how alias analysis on gimple works:
@@ -2572,6 +2573,99 @@ modref_may_conflict (const gimple *stmt,
return false;
}
+/* Check if REF conflicts with call using "fn spec" attribute.
+ If CLOBBER is true we are checking for writes, otherwise check loads.
+
+ Return 0 if there are no conflicts (except for possible function call
+ argument reads), 1 if there are conflicts and -1 if we can not decide by
+ fn spec. */
+
+static int
+check_fnspec (gcall *call, ao_ref *ref, bool clobber)
+{
+ attr_fnspec fnspec = gimple_call_fnspec (call);
+ if (fnspec.known_p ())
+ {
+ if (clobber
+ ? !fnspec.global_memory_written_p ()
+ : !fnspec.global_memory_read_p ())
+ {
+ for (unsigned int i = 0; i < gimple_call_num_args (call); i++)
+ if (POINTER_TYPE_P (TREE_TYPE (gimple_call_arg (call, i)))
+ && (!fnspec.arg_specified_p (i)
+ || (clobber ? fnspec.arg_maybe_written_p (i)
+ : fnspec.arg_maybe_read_p (i))))
+ {
+ ao_ref dref;
+ tree size = NULL_TREE;
+ unsigned int size_arg;
+
+ if (!fnspec.arg_specified_p (i))
+ ;
+ else if (fnspec.arg_max_access_size_given_by_arg_p
+ (i, &size_arg))
+ size = gimple_call_arg (call, size_arg);
+ else if (fnspec.arg_access_size_given_by_type_p (i))
+ {
+ tree callee = gimple_call_fndecl (call);
+ tree t = TYPE_ARG_TYPES (TREE_TYPE (callee));
+
+ for (unsigned int p = 0; p < i; p++)
+ t = TREE_CHAIN (t);
+ size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_VALUE (t)));
+ }
+ ao_ref_init_from_ptr_and_size (&dref,
+ gimple_call_arg (call, i),
+ size);
+ if (refs_may_alias_p_1 (&dref, ref, false))
+ return 1;
+ }
+ if (clobber
+ && fnspec.errno_maybe_written_p ()
+ && flag_errno_math
+ && targetm.ref_may_alias_errno (ref))
+ return 1;
+ return 0;
+ }
+ }
+
+ /* FIXME: we should handle barriers more consistently, but for now leave the
+ check here. */
+ if (gimple_call_builtin_p (call, BUILT_IN_NORMAL))
+ switch (DECL_FUNCTION_CODE (gimple_call_fndecl (call)))
+ {
+ /* __sync_* builtins and some OpenMP builtins act as threading
+ barriers. */
+#undef DEF_SYNC_BUILTIN
+#define DEF_SYNC_BUILTIN(ENUM, NAME, TYPE, ATTRS) case ENUM:
+#include "sync-builtins.def"
+#undef DEF_SYNC_BUILTIN
+ case BUILT_IN_GOMP_ATOMIC_START:
+ case BUILT_IN_GOMP_ATOMIC_END:
+ case BUILT_IN_GOMP_BARRIER:
+ case BUILT_IN_GOMP_BARRIER_CANCEL:
+ case BUILT_IN_GOMP_TASKWAIT:
+ case BUILT_IN_GOMP_TASKGROUP_END:
+ case BUILT_IN_GOMP_CRITICAL_START:
+ case BUILT_IN_GOMP_CRITICAL_END:
+ case BUILT_IN_GOMP_CRITICAL_NAME_START:
+ case BUILT_IN_GOMP_CRITICAL_NAME_END:
+ case BUILT_IN_GOMP_LOOP_END:
+ case BUILT_IN_GOMP_LOOP_END_CANCEL:
+ case BUILT_IN_GOMP_ORDERED_START:
+ case BUILT_IN_GOMP_ORDERED_END:
+ case BUILT_IN_GOMP_SECTIONS_END:
+ case BUILT_IN_GOMP_SECTIONS_END_CANCEL:
+ case BUILT_IN_GOMP_SINGLE_COPY_START:
+ case BUILT_IN_GOMP_SINGLE_COPY_END:
+ return 1;
+
+ default:
+ return -1;
+ }
+ return -1;
+}
+
/* If the call CALL may use the memory reference REF return true,
otherwise return false. */
@@ -2650,222 +2744,13 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
&& !is_global_var (base))
goto process_args;
- /* Handle those builtin functions explicitly that do not act as
- escape points. See tree-ssa-structalias.c:find_func_aliases
- for the list of builtins we might need to handle here. */
- if (callee != NULL_TREE
- && gimple_call_builtin_p (call, BUILT_IN_NORMAL))
- switch (DECL_FUNCTION_CODE (callee))
- {
- /* All the following functions read memory pointed to by
- their second argument. strcat/strncat additionally
- reads memory pointed to by the first argument. */
- case BUILT_IN_STRCAT:
- case BUILT_IN_STRNCAT:
- {
- ao_ref dref;
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- NULL_TREE);
- if (refs_may_alias_p_1 (&dref, ref, false))
- return true;
- }
- /* FALLTHRU */
- case BUILT_IN_STRCPY:
- case BUILT_IN_STRNCPY:
- case BUILT_IN_MEMCPY:
- case BUILT_IN_MEMMOVE:
- case BUILT_IN_MEMPCPY:
- case BUILT_IN_STPCPY:
- case BUILT_IN_STPNCPY:
- case BUILT_IN_TM_MEMCPY:
- case BUILT_IN_TM_MEMMOVE:
- {
- ao_ref dref;
- tree size = NULL_TREE;
- if (gimple_call_num_args (call) == 3)
- size = gimple_call_arg (call, 2);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 1),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- case BUILT_IN_STRCAT_CHK:
- case BUILT_IN_STRNCAT_CHK:
- {
- ao_ref dref;
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- NULL_TREE);
- if (refs_may_alias_p_1 (&dref, ref, false))
- return true;
- }
- /* FALLTHRU */
- case BUILT_IN_STRCPY_CHK:
- case BUILT_IN_STRNCPY_CHK:
- case BUILT_IN_MEMCPY_CHK:
- case BUILT_IN_MEMMOVE_CHK:
- case BUILT_IN_MEMPCPY_CHK:
- case BUILT_IN_STPCPY_CHK:
- case BUILT_IN_STPNCPY_CHK:
- {
- ao_ref dref;
- tree size = NULL_TREE;
- if (gimple_call_num_args (call) == 4)
- size = gimple_call_arg (call, 2);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 1),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- case BUILT_IN_BCOPY:
- {
- ao_ref dref;
- tree size = gimple_call_arg (call, 2);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
-
- /* The following functions read memory pointed to by their
- first argument. */
- CASE_BUILT_IN_TM_LOAD (1):
- CASE_BUILT_IN_TM_LOAD (2):
- CASE_BUILT_IN_TM_LOAD (4):
- CASE_BUILT_IN_TM_LOAD (8):
- CASE_BUILT_IN_TM_LOAD (FLOAT):
- CASE_BUILT_IN_TM_LOAD (DOUBLE):
- CASE_BUILT_IN_TM_LOAD (LDOUBLE):
- CASE_BUILT_IN_TM_LOAD (M64):
- CASE_BUILT_IN_TM_LOAD (M128):
- CASE_BUILT_IN_TM_LOAD (M256):
- case BUILT_IN_TM_LOG:
- case BUILT_IN_TM_LOG_1:
- case BUILT_IN_TM_LOG_2:
- case BUILT_IN_TM_LOG_4:
- case BUILT_IN_TM_LOG_8:
- case BUILT_IN_TM_LOG_FLOAT:
- case BUILT_IN_TM_LOG_DOUBLE:
- case BUILT_IN_TM_LOG_LDOUBLE:
- case BUILT_IN_TM_LOG_M64:
- case BUILT_IN_TM_LOG_M128:
- case BUILT_IN_TM_LOG_M256:
- return ptr_deref_may_alias_ref_p_1 (gimple_call_arg (call, 0), ref);
-
- /* These read memory pointed to by the first argument. */
- case BUILT_IN_STRDUP:
- case BUILT_IN_STRNDUP:
- case BUILT_IN_REALLOC:
- {
- ao_ref dref;
- tree size = NULL_TREE;
- if (gimple_call_num_args (call) == 2)
- size = gimple_call_arg (call, 1);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- /* These read memory pointed to by the first argument. */
- case BUILT_IN_INDEX:
- case BUILT_IN_STRCHR:
- case BUILT_IN_STRRCHR:
- {
- ao_ref dref;
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- NULL_TREE);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- /* These read memory pointed to by the first argument with size
- in the third argument. */
- case BUILT_IN_MEMCHR:
- {
- ao_ref dref;
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- gimple_call_arg (call, 2));
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- /* These read memory pointed to by the first and second arguments. */
- case BUILT_IN_STRSTR:
- case BUILT_IN_STRPBRK:
- {
- ao_ref dref;
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- NULL_TREE);
- if (refs_may_alias_p_1 (&dref, ref, false))
- return true;
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 1),
- NULL_TREE);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
-
- /* The following builtins do not read from memory. */
- case BUILT_IN_FREE:
- case BUILT_IN_MALLOC:
- case BUILT_IN_POSIX_MEMALIGN:
- case BUILT_IN_ALIGNED_ALLOC:
- case BUILT_IN_CALLOC:
- CASE_BUILT_IN_ALLOCA:
- case BUILT_IN_STACK_SAVE:
- case BUILT_IN_STACK_RESTORE:
- case BUILT_IN_MEMSET:
- case BUILT_IN_TM_MEMSET:
- case BUILT_IN_MEMSET_CHK:
- case BUILT_IN_FREXP:
- case BUILT_IN_FREXPF:
- case BUILT_IN_FREXPL:
- case BUILT_IN_GAMMA_R:
- case BUILT_IN_GAMMAF_R:
- case BUILT_IN_GAMMAL_R:
- case BUILT_IN_LGAMMA_R:
- case BUILT_IN_LGAMMAF_R:
- case BUILT_IN_LGAMMAL_R:
- case BUILT_IN_MODF:
- case BUILT_IN_MODFF:
- case BUILT_IN_MODFL:
- case BUILT_IN_REMQUO:
- case BUILT_IN_REMQUOF:
- case BUILT_IN_REMQUOL:
- case BUILT_IN_SINCOS:
- case BUILT_IN_SINCOSF:
- case BUILT_IN_SINCOSL:
- case BUILT_IN_ASSUME_ALIGNED:
- case BUILT_IN_VA_END:
- return false;
- /* __sync_* builtins and some OpenMP builtins act as threading
- barriers. */
-#undef DEF_SYNC_BUILTIN
-#define DEF_SYNC_BUILTIN(ENUM, NAME, TYPE, ATTRS) case ENUM:
-#include "sync-builtins.def"
-#undef DEF_SYNC_BUILTIN
- case BUILT_IN_GOMP_ATOMIC_START:
- case BUILT_IN_GOMP_ATOMIC_END:
- case BUILT_IN_GOMP_BARRIER:
- case BUILT_IN_GOMP_BARRIER_CANCEL:
- case BUILT_IN_GOMP_TASKWAIT:
- case BUILT_IN_GOMP_TASKGROUP_END:
- case BUILT_IN_GOMP_CRITICAL_START:
- case BUILT_IN_GOMP_CRITICAL_END:
- case BUILT_IN_GOMP_CRITICAL_NAME_START:
- case BUILT_IN_GOMP_CRITICAL_NAME_END:
- case BUILT_IN_GOMP_LOOP_END:
- case BUILT_IN_GOMP_LOOP_END_CANCEL:
- case BUILT_IN_GOMP_ORDERED_START:
- case BUILT_IN_GOMP_ORDERED_END:
- case BUILT_IN_GOMP_SECTIONS_END:
- case BUILT_IN_GOMP_SECTIONS_END_CANCEL:
- case BUILT_IN_GOMP_SINGLE_COPY_START:
- case BUILT_IN_GOMP_SINGLE_COPY_END:
- return true;
-
- default:
- /* Fallthru to general call handling. */;
- }
+ if (int res = check_fnspec (call, ref, false))
+ {
+ if (res == 1)
+ return true;
+ }
+ else
+ goto process_args;
/* Check if base is a global static variable that is not read
by the function. */
@@ -3040,7 +2925,9 @@ 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 (call, summary->stores, ref, tbaa_p))
+ if (!modref_may_conflict (call, summary->stores, ref, tbaa_p)
+ && (!summary->writes_errno
+ || !targetm.ref_may_alias_errno (ref)))
{
alias_stats.modref_clobber_no_alias++;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -3104,205 +2991,13 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
&& SSA_NAME_POINTS_TO_READONLY_MEMORY (TREE_OPERAND (base, 0)))
return false;
- /* Handle those builtin functions explicitly that do not act as
- escape points. See tree-ssa-structalias.c:find_func_aliases
- for the list of builtins we might need to handle here. */
- if (callee != NULL_TREE
- && gimple_call_builtin_p (call, BUILT_IN_NORMAL))
- switch (DECL_FUNCTION_CODE (callee))
- {
- /* All the following functions clobber memory pointed to by
- their first argument. */
- case BUILT_IN_STRCPY:
- case BUILT_IN_STRNCPY:
- case BUILT_IN_MEMCPY:
- case BUILT_IN_MEMMOVE:
- case BUILT_IN_MEMPCPY:
- case BUILT_IN_STPCPY:
- case BUILT_IN_STPNCPY:
- case BUILT_IN_STRCAT:
- case BUILT_IN_STRNCAT:
- case BUILT_IN_MEMSET:
- case BUILT_IN_TM_MEMSET:
- CASE_BUILT_IN_TM_STORE (1):
- CASE_BUILT_IN_TM_STORE (2):
- CASE_BUILT_IN_TM_STORE (4):
- CASE_BUILT_IN_TM_STORE (8):
- CASE_BUILT_IN_TM_STORE (FLOAT):
- CASE_BUILT_IN_TM_STORE (DOUBLE):
- CASE_BUILT_IN_TM_STORE (LDOUBLE):
- CASE_BUILT_IN_TM_STORE (M64):
- CASE_BUILT_IN_TM_STORE (M128):
- CASE_BUILT_IN_TM_STORE (M256):
- case BUILT_IN_TM_MEMCPY:
- case BUILT_IN_TM_MEMMOVE:
- {
- ao_ref dref;
- tree size = NULL_TREE;
- /* Don't pass in size for strncat, as the maximum size
- is strlen (dest) + n + 1 instead of n, resp.
- n + 1 at dest + strlen (dest), but strlen (dest) isn't
- known. */
- if (gimple_call_num_args (call) == 3
- && DECL_FUNCTION_CODE (callee) != BUILT_IN_STRNCAT)
- size = gimple_call_arg (call, 2);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- case BUILT_IN_STRCPY_CHK:
- case BUILT_IN_STRNCPY_CHK:
- case BUILT_IN_MEMCPY_CHK:
- case BUILT_IN_MEMMOVE_CHK:
- case BUILT_IN_MEMPCPY_CHK:
- case BUILT_IN_STPCPY_CHK:
- case BUILT_IN_STPNCPY_CHK:
- case BUILT_IN_STRCAT_CHK:
- case BUILT_IN_STRNCAT_CHK:
- case BUILT_IN_MEMSET_CHK:
- {
- ao_ref dref;
- tree size = NULL_TREE;
- /* Don't pass in size for __strncat_chk, as the maximum size
- is strlen (dest) + n + 1 instead of n, resp.
- n + 1 at dest + strlen (dest), but strlen (dest) isn't
- known. */
- if (gimple_call_num_args (call) == 4
- && DECL_FUNCTION_CODE (callee) != BUILT_IN_STRNCAT_CHK)
- size = gimple_call_arg (call, 2);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 0),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- case BUILT_IN_BCOPY:
- {
- ao_ref dref;
- tree size = gimple_call_arg (call, 2);
- ao_ref_init_from_ptr_and_size (&dref,
- gimple_call_arg (call, 1),
- size);
- return refs_may_alias_p_1 (&dref, ref, false);
- }
- /* Allocating memory does not have any side-effects apart from
- being the definition point for the pointer. */
- case BUILT_IN_MALLOC:
- case BUILT_IN_ALIGNED_ALLOC:
- case BUILT_IN_CALLOC:
- case BUILT_IN_STRDUP:
- case BUILT_IN_STRNDUP:
- /* Unix98 specifies that errno is set on allocation failure. */
- if (flag_errno_math
- && targetm.ref_may_alias_errno (ref))
- return true;
- return false;
- case BUILT_IN_STACK_SAVE:
- CASE_BUILT_IN_ALLOCA:
- case BUILT_IN_ASSUME_ALIGNED:
- return false;
- /* But posix_memalign stores a pointer into the memory pointed to
- by its first argument. */
- case BUILT_IN_POSIX_MEMALIGN:
- {
- tree ptrptr = gimple_call_arg (call, 0);
- ao_ref dref;
- ao_ref_init_from_ptr_and_size (&dref, ptrptr,
- TYPE_SIZE_UNIT (ptr_type_node));
- return (refs_may_alias_p_1 (&dref, ref, false)
- || (flag_errno_math
- && targetm.ref_may_alias_errno (ref)));
- }
- /* Freeing memory kills the pointed-to memory. More importantly
- the call has to serve as a barrier for moving loads and stores
- across it. */
- case BUILT_IN_FREE:
- case BUILT_IN_VA_END:
- {
- tree ptr = gimple_call_arg (call, 0);
- return ptr_deref_may_alias_ref_p_1 (ptr, ref);
- }
- /* Realloc serves both as allocation point and deallocation point. */
- case BUILT_IN_REALLOC:
- {
- tree ptr = gimple_call_arg (call, 0);
- /* Unix98 specifies that errno is set on allocation failure. */
- return ((flag_errno_math
- && targetm.ref_may_alias_errno (ref))
- || ptr_deref_may_alias_ref_p_1 (ptr, ref));
- }
- case BUILT_IN_GAMMA_R:
- case BUILT_IN_GAMMAF_R:
- case BUILT_IN_GAMMAL_R:
- case BUILT_IN_LGAMMA_R:
- case BUILT_IN_LGAMMAF_R:
- case BUILT_IN_LGAMMAL_R:
- {
- tree out = gimple_call_arg (call, 1);
- if (ptr_deref_may_alias_ref_p_1 (out, ref))
- return true;
- if (flag_errno_math)
- break;
- return false;
- }
- case BUILT_IN_FREXP:
- case BUILT_IN_FREXPF:
- case BUILT_IN_FREXPL:
- case BUILT_IN_MODF:
- case BUILT_IN_MODFF:
- case BUILT_IN_MODFL:
- {
- tree out = gimple_call_arg (call, 1);
- return ptr_deref_may_alias_ref_p_1 (out, ref);
- }
- case BUILT_IN_REMQUO:
- case BUILT_IN_REMQUOF:
- case BUILT_IN_REMQUOL:
- {
- tree out = gimple_call_arg (call, 2);
- if (ptr_deref_may_alias_ref_p_1 (out, ref))
- return true;
- if (flag_errno_math)
- break;
- return false;
- }
- case BUILT_IN_SINCOS:
- case BUILT_IN_SINCOSF:
- case BUILT_IN_SINCOSL:
- {
- tree sin = gimple_call_arg (call, 1);
- tree cos = gimple_call_arg (call, 2);
- return (ptr_deref_may_alias_ref_p_1 (sin, ref)
- || ptr_deref_may_alias_ref_p_1 (cos, ref));
- }
- /* __sync_* builtins and some OpenMP builtins act as threading
- barriers. */
-#undef DEF_SYNC_BUILTIN
-#define DEF_SYNC_BUILTIN(ENUM, NAME, TYPE, ATTRS) case ENUM:
-#include "sync-builtins.def"
-#undef DEF_SYNC_BUILTIN
- case BUILT_IN_GOMP_ATOMIC_START:
- case BUILT_IN_GOMP_ATOMIC_END:
- case BUILT_IN_GOMP_BARRIER:
- case BUILT_IN_GOMP_BARRIER_CANCEL:
- case BUILT_IN_GOMP_TASKWAIT:
- case BUILT_IN_GOMP_TASKGROUP_END:
- case BUILT_IN_GOMP_CRITICAL_START:
- case BUILT_IN_GOMP_CRITICAL_END:
- case BUILT_IN_GOMP_CRITICAL_NAME_START:
- case BUILT_IN_GOMP_CRITICAL_NAME_END:
- case BUILT_IN_GOMP_LOOP_END:
- case BUILT_IN_GOMP_LOOP_END_CANCEL:
- case BUILT_IN_GOMP_ORDERED_START:
- case BUILT_IN_GOMP_ORDERED_END:
- case BUILT_IN_GOMP_SECTIONS_END:
- case BUILT_IN_GOMP_SECTIONS_END_CANCEL:
- case BUILT_IN_GOMP_SINGLE_COPY_START:
- case BUILT_IN_GOMP_SINGLE_COPY_END:
- return true;
- default:
- /* Fallthru to general call handling. */;
- }
+ if (int res = check_fnspec (call, ref, true))
+ {
+ if (res == 1)
+ return true;
+ }
+ else
+ return false;
/* Check if base is a global static variable that is not written
by the function. */
@@ -4079,6 +3774,8 @@ void
attr_fnspec::verify ()
{
bool err = false;
+ if (!len)
+ return;
/* Check return value specifier. */
if (len < return_desc_size)
@@ -4086,14 +3783,20 @@ attr_fnspec::verify ()
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')
+ && str[0] != '.' && str[0] != 'm')
err = true;
- if (str[1] != ' ')
- err = true;
+ switch (str[1])
+ {
+ case ' ':
+ case 'p':
+ case 'P':
+ case 'c':
+ case 'C':
+ break;
+ default:
+ err = true;
+ }
/* Now check all parameters. */
for (unsigned int i = 0; arg_specified_p (i); i++)
@@ -4105,6 +3808,8 @@ attr_fnspec::verify ()
case 'X':
case 'r':
case 'R':
+ case 'o':
+ case 'O':
case 'w':
case 'W':
case '.':
@@ -4112,7 +3817,15 @@ attr_fnspec::verify ()
default:
err = true;
}
- if (str[idx + 1] != ' ')
+ if ((str[idx + 1] >= '1' && str[idx + 1] <= '9')
+ || str[idx + 1] == 't')
+ {
+ if (str[idx] != 'r' && str[idx] != 'R'
+ && str[idx] != 'w' && str[idx] != 'W'
+ && str[idx] != 'o' && str[idx] != 'O')
+ err = true;
+ }
+ else if (str[idx + 1] != ' ')
err = true;
}
if (err)
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 0432fe5..23b2902 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1796,6 +1796,7 @@ evaluate_stmt (gimple *stmt)
ccp_lattice_t likelyvalue = likely_value (stmt);
bool is_constant = false;
unsigned int align;
+ bool ignore_return_flags = false;
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1965,22 +1966,9 @@ evaluate_stmt (gimple *stmt)
val.mask = ~((HOST_WIDE_INT) align / BITS_PER_UNIT - 1);
break;
- /* These builtins return their first argument, unmodified. */
- case BUILT_IN_MEMCPY:
- case BUILT_IN_MEMMOVE:
- case BUILT_IN_MEMSET:
- case BUILT_IN_STRCPY:
- case BUILT_IN_STRNCPY:
- case BUILT_IN_MEMCPY_CHK:
- case BUILT_IN_MEMMOVE_CHK:
- case BUILT_IN_MEMSET_CHK:
- case BUILT_IN_STRCPY_CHK:
- case BUILT_IN_STRNCPY_CHK:
- val = get_value_for_expr (gimple_call_arg (stmt, 0), true);
- break;
-
case BUILT_IN_ASSUME_ALIGNED:
val = bit_value_assume_aligned (stmt, NULL_TREE, val, false);
+ ignore_return_flags = true;
break;
case BUILT_IN_ALIGNED_ALLOC:
@@ -2049,6 +2037,15 @@ evaluate_stmt (gimple *stmt)
if (attrs)
val = bit_value_assume_aligned (stmt, attrs, val, true);
}
+ int flags = ignore_return_flags
+ ? 0 : gimple_call_return_flags (as_a <gcall *> (stmt));
+ if (flags & ERF_RETURNS_ARG
+ && (flags & ERF_RETURN_ARG_MASK) < gimple_call_num_args (stmt))
+ {
+ val = get_value_for_expr
+ (gimple_call_arg (stmt,
+ flags & ERF_RETURN_ARG_MASK), true);
+ }
}
is_constant = (val.lattice_val == CONSTANT);
}
@@ -3586,7 +3583,7 @@ pass_post_ipa_warn::execute (function *fun)
continue;
tree fndecl = gimple_call_fndecl (stmt);
- if (fndecl && DECL_IS_BUILTIN (fndecl))
+ if (fndecl && DECL_IS_UNDECLARED_BUILTIN (fndecl))
inform (loc, "in a call to built-in function %qD",
fndecl);
else if (fndecl)
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 5bb781d..33e15d4 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -1406,6 +1406,9 @@ tree_unroll_loops_completely_1 (bool may_increase_size, bool unroll_outer,
bitmap_clear (father_bbs);
bitmap_set_bit (father_bbs, loop_father->header->index);
}
+ else if (unroll_outer)
+ /* Trigger scalar cleanup once any outermost loop gets unrolled. */
+ cfun->pending_TODOs |= PENDING_TODO_force_next_scalar_cleanup;
return true;
}
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-math-opts.c b/gcc/tree-ssa-math-opts.c
index 90dfb98..65c7b34 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -187,6 +187,10 @@ static struct
{
/* Number of cexpi calls inserted. */
int inserted;
+
+ /* Number of conversions removed. */
+ int conv_removed;
+
} sincos_stats;
static struct
@@ -1099,6 +1103,103 @@ make_pass_cse_reciprocals (gcc::context *ctxt)
return new pass_cse_reciprocals (ctxt);
}
+/* If NAME is the result of a type conversion, look for other
+ equivalent dominating or dominated conversions, and replace all
+ uses with the earliest dominating name, removing the redundant
+ conversions. Return the prevailing name. */
+
+static tree
+execute_cse_conv_1 (tree name)
+{
+ if (SSA_NAME_IS_DEFAULT_DEF (name)
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name))
+ return name;
+
+ gimple *def_stmt = SSA_NAME_DEF_STMT (name);
+
+ if (!gimple_assign_cast_p (def_stmt))
+ return name;
+
+ tree src = gimple_assign_rhs1 (def_stmt);
+
+ if (TREE_CODE (src) != SSA_NAME)
+ return name;
+
+ imm_use_iterator use_iter;
+ gimple *use_stmt;
+
+ /* Find the earliest dominating def. */
+ FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, src)
+ {
+ if (use_stmt == def_stmt
+ || !gimple_assign_cast_p (use_stmt))
+ continue;
+
+ tree lhs = gimple_assign_lhs (use_stmt);
+
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)
+ || (gimple_assign_rhs1 (use_stmt)
+ != gimple_assign_rhs1 (def_stmt))
+ || !types_compatible_p (TREE_TYPE (name), TREE_TYPE (lhs)))
+ continue;
+
+ bool use_dominates;
+ if (gimple_bb (def_stmt) == gimple_bb (use_stmt))
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ while (!gsi_end_p (gsi) && gsi_stmt (gsi) != def_stmt)
+ gsi_next (&gsi);
+ use_dominates = !gsi_end_p (gsi);
+ }
+ else if (dominated_by_p (CDI_DOMINATORS, gimple_bb (use_stmt),
+ gimple_bb (def_stmt)))
+ use_dominates = false;
+ else if (dominated_by_p (CDI_DOMINATORS, gimple_bb (def_stmt),
+ gimple_bb (use_stmt)))
+ use_dominates = true;
+ else
+ continue;
+
+ if (use_dominates)
+ {
+ std::swap (name, lhs);
+ std::swap (def_stmt, use_stmt);
+ }
+ }
+
+ /* Now go through all uses of SRC again, replacing the equivalent
+ dominated conversions. We may replace defs that were not
+ dominated by the then-prevailing defs when we first visited
+ them. */
+ FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, src)
+ {
+ if (use_stmt == def_stmt
+ || !gimple_assign_cast_p (use_stmt))
+ continue;
+
+ tree lhs = gimple_assign_lhs (use_stmt);
+
+ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)
+ || (gimple_assign_rhs1 (use_stmt)
+ != gimple_assign_rhs1 (def_stmt))
+ || !types_compatible_p (TREE_TYPE (name), TREE_TYPE (lhs)))
+ continue;
+
+ if (gimple_bb (def_stmt) == gimple_bb (use_stmt)
+ || dominated_by_p (CDI_DOMINATORS, gimple_bb (use_stmt),
+ gimple_bb (def_stmt)))
+ {
+ sincos_stats.conv_removed++;
+
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ replace_uses_by (lhs, name);
+ gsi_remove (&gsi, true);
+ }
+ }
+
+ return name;
+}
+
/* Records an occurrence at statement USE_STMT in the vector of trees
STMTS if it is dominated by *TOP_BB or dominates it or this basic block
is not yet initialized. Returns true if the occurrence was pushed on
@@ -1147,6 +1248,8 @@ execute_cse_sincos_1 (tree name)
int i;
bool cfg_changed = false;
+ name = execute_cse_conv_1 (name);
+
FOR_EACH_IMM_USE_STMT (use_stmt, use_iter, name)
{
if (gimple_code (use_stmt) != GIMPLE_CALL
@@ -1181,7 +1284,7 @@ execute_cse_sincos_1 (tree name)
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;
+ RETURN_FROM_IMM_USE_STMT (use_iter, false);
}
if (seen_cos + seen_sin + seen_cexpi <= 1)
return false;
@@ -2296,6 +2399,8 @@ pass_cse_sincos::execute (function *fun)
statistics_counter_event (fun, "sincos statements inserted",
sincos_stats.inserted);
+ statistics_counter_event (fun, "conv statements removed",
+ sincos_stats.conv_removed);
return cfg_changed ? TODO_cleanup_cfg : 0;
}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index b97f863..e2758b2 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;
@@ -749,7 +752,9 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
gimple_stmt_iterator gsi;
edge true_edge, false_edge;
tree new_var, new_var2;
- bool neg;
+ bool neg = false;
+ int shift = 0;
+ tree nonzero_arg;
/* FIXME: Gimplification of complex type is too hard for now. */
/* We aren't prepared to handle vectors either (and it is a question
@@ -760,14 +765,22 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
|| POINTER_TYPE_P (TREE_TYPE (arg1))))
return false;
- /* The PHI arguments have the constants 0 and 1, or 0 and -1, then
- convert it to the conditional. */
- if ((integer_zerop (arg0) && integer_onep (arg1))
- || (integer_zerop (arg1) && integer_onep (arg0)))
- neg = false;
- else if ((integer_zerop (arg0) && integer_all_onesp (arg1))
- || (integer_zerop (arg1) && integer_all_onesp (arg0)))
+ /* The PHI arguments have the constants 0 and 1, or 0 and -1 or
+ 0 and (1 << cst), then convert it to the conditional. */
+ if (integer_zerop (arg0))
+ nonzero_arg = arg1;
+ else if (integer_zerop (arg1))
+ nonzero_arg = arg0;
+ else
+ return false;
+ if (integer_all_onesp (nonzero_arg))
neg = true;
+ else if (integer_pow2p (nonzero_arg))
+ {
+ shift = tree_log2 (nonzero_arg);
+ if (shift && POINTER_TYPE_P (TREE_TYPE (nonzero_arg)))
+ return false;
+ }
else
return false;
@@ -779,12 +792,12 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
falls through into BB.
There is a single PHI node at the join point (BB) and its arguments
- are constants (0, 1) or (0, -1).
+ are constants (0, 1) or (0, -1) or (0, (1 << shift)).
So, given the condition COND, and the two PHI arguments, we can
rewrite this PHI into non-branching code:
- dest = (COND) or dest = COND'
+ dest = (COND) or dest = COND' or dest = (COND) << shift
We use the condition as-is if the argument associated with the
true edge has the value one or the argument associated with the
@@ -819,6 +832,14 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
cond = fold_build1_loc (gimple_location (stmt),
NEGATE_EXPR, TREE_TYPE (cond), cond);
}
+ else if (shift)
+ {
+ cond = fold_convert_loc (gimple_location (stmt),
+ TREE_TYPE (result), cond);
+ cond = fold_build2_loc (gimple_location (stmt),
+ LSHIFT_EXPR, TREE_TYPE (cond), cond,
+ build_int_cst (integer_type_node, shift));
+ }
/* Insert our new statements at the end of conditional block before the
COND_STMT. */
@@ -1777,16 +1798,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 +1829,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 +1902,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 +1922,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 +1936,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-pre.c b/gcc/tree-ssa-pre.c
index 63f3a81..90877e3 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -256,6 +256,7 @@ typedef struct pre_expr_d : nofree_ptr_hash <pre_expr_d>
{
enum pre_expr_kind kind;
unsigned int id;
+ unsigned value_id;
location_t loc;
pre_expr_union u;
@@ -422,11 +423,65 @@ get_or_alloc_expr_for_name (tree name)
result = pre_expr_pool.allocate ();
result->kind = NAME;
result->loc = UNKNOWN_LOCATION;
+ result->value_id = VN_INFO (name)->value_id;
PRE_EXPR_NAME (result) = name;
alloc_expression_id (result);
return result;
}
+/* Given an NARY, get or create a pre_expr to represent it. */
+
+static pre_expr
+get_or_alloc_expr_for_nary (vn_nary_op_t nary,
+ location_t loc = UNKNOWN_LOCATION)
+{
+ struct pre_expr_d expr;
+ pre_expr result;
+ unsigned int result_id;
+
+ expr.kind = NARY;
+ expr.id = 0;
+ PRE_EXPR_NARY (&expr) = nary;
+ result_id = lookup_expression_id (&expr);
+ if (result_id != 0)
+ return expression_for_id (result_id);
+
+ result = pre_expr_pool.allocate ();
+ result->kind = NARY;
+ result->loc = loc;
+ result->value_id = nary->value_id;
+ PRE_EXPR_NARY (result) = nary;
+ alloc_expression_id (result);
+ return result;
+}
+
+/* Given an REFERENCE, get or create a pre_expr to represent it. */
+
+static pre_expr
+get_or_alloc_expr_for_reference (vn_reference_t reference,
+ location_t loc = UNKNOWN_LOCATION)
+{
+ struct pre_expr_d expr;
+ pre_expr result;
+ unsigned int result_id;
+
+ expr.kind = REFERENCE;
+ expr.id = 0;
+ PRE_EXPR_REFERENCE (&expr) = reference;
+ result_id = lookup_expression_id (&expr);
+ if (result_id != 0)
+ return expression_for_id (result_id);
+
+ result = pre_expr_pool.allocate ();
+ result->kind = REFERENCE;
+ result->loc = loc;
+ result->value_id = reference->value_id;
+ PRE_EXPR_REFERENCE (result) = reference;
+ alloc_expression_id (result);
+ return result;
+}
+
+
/* An unordered bitmap set. One bitmap tracks values, the other,
expressions. */
typedef class bitmap_set
@@ -444,6 +499,108 @@ public:
/* Mapping from value id to expressions with that value_id. */
static vec<bitmap> value_expressions;
+/* We just record a single expression for each constant value,
+ one of kind CONSTANT. */
+static vec<pre_expr> constant_value_expressions;
+
+
+/* This structure is used to keep track of statistics on what
+ optimization PRE was able to perform. */
+static struct
+{
+ /* The number of new expressions/temporaries generated by PRE. */
+ int insertions;
+
+ /* The number of inserts found due to partial anticipation */
+ int pa_insert;
+
+ /* The number of inserts made for code hoisting. */
+ int hoist_insert;
+
+ /* The number of new PHI nodes added by PRE. */
+ int phis;
+} pre_stats;
+
+static bool do_partial_partial;
+static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int);
+static void bitmap_value_insert_into_set (bitmap_set_t, pre_expr);
+static void bitmap_value_replace_in_set (bitmap_set_t, pre_expr);
+static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
+static bool bitmap_set_contains_value (bitmap_set_t, unsigned int);
+static void bitmap_insert_into_set (bitmap_set_t, pre_expr);
+static bitmap_set_t bitmap_set_new (void);
+static tree create_expression_by_pieces (basic_block, pre_expr, gimple_seq *,
+ tree);
+static tree find_or_generate_expression (basic_block, tree, gimple_seq *);
+static unsigned int get_expr_value_id (pre_expr);
+
+/* We can add and remove elements and entries to and from sets
+ and hash tables, so we use alloc pools for them. */
+
+static object_allocator<bitmap_set> bitmap_set_pool ("Bitmap sets");
+static bitmap_obstack grand_bitmap_obstack;
+
+/* A three tuple {e, pred, v} used to cache phi translations in the
+ phi_translate_table. */
+
+typedef struct expr_pred_trans_d : public typed_noop_remove <expr_pred_trans_d>
+{
+ typedef expr_pred_trans_d value_type;
+ typedef expr_pred_trans_d compare_type;
+
+ /* The expression ID. */
+ unsigned e;
+
+ /* The value expression ID that resulted from the translation. */
+ unsigned v;
+
+ /* hash_table support. */
+ static inline void mark_empty (expr_pred_trans_d &);
+ static inline bool is_empty (const expr_pred_trans_d &);
+ static inline void mark_deleted (expr_pred_trans_d &);
+ static inline bool is_deleted (const expr_pred_trans_d &);
+ static const bool empty_zero_p = true;
+ static inline hashval_t hash (const expr_pred_trans_d &);
+ static inline int equal (const expr_pred_trans_d &, const expr_pred_trans_d &);
+} *expr_pred_trans_t;
+typedef const struct expr_pred_trans_d *const_expr_pred_trans_t;
+
+inline bool
+expr_pred_trans_d::is_empty (const expr_pred_trans_d &e)
+{
+ return e.e == 0;
+}
+
+inline bool
+expr_pred_trans_d::is_deleted (const expr_pred_trans_d &e)
+{
+ return e.e == -1u;
+}
+
+inline void
+expr_pred_trans_d::mark_empty (expr_pred_trans_d &e)
+{
+ e.e = 0;
+}
+
+inline void
+expr_pred_trans_d::mark_deleted (expr_pred_trans_d &e)
+{
+ e.e = -1u;
+}
+
+inline hashval_t
+expr_pred_trans_d::hash (const expr_pred_trans_d &e)
+{
+ return e.e;
+}
+
+inline int
+expr_pred_trans_d::equal (const expr_pred_trans_d &ve1,
+ const expr_pred_trans_d &ve2)
+{
+ return ve1.e == ve2.e;
+}
/* Sets that we need to keep track of. */
typedef struct bb_bitmap_sets
@@ -483,6 +640,9 @@ typedef struct bb_bitmap_sets
/* The live virtual operand on successor edges. */
tree vop_on_exit;
+ /* PHI translate cache for the single successor edge. */
+ hash_table<expr_pred_trans_d> *phi_translate_table;
+
/* True if we have visited this block during ANTIC calculation. */
unsigned int visited : 1;
@@ -498,119 +658,34 @@ typedef struct bb_bitmap_sets
#define PA_IN(BB) ((bb_value_sets_t) ((BB)->aux))->pa_in
#define NEW_SETS(BB) ((bb_value_sets_t) ((BB)->aux))->new_sets
#define EXPR_DIES(BB) ((bb_value_sets_t) ((BB)->aux))->expr_dies
+#define PHI_TRANS_TABLE(BB) ((bb_value_sets_t) ((BB)->aux))->phi_translate_table
#define BB_VISITED(BB) ((bb_value_sets_t) ((BB)->aux))->visited
#define BB_MAY_NOTRETURN(BB) ((bb_value_sets_t) ((BB)->aux))->contains_may_not_return_call
#define BB_LIVE_VOP_ON_EXIT(BB) ((bb_value_sets_t) ((BB)->aux))->vop_on_exit
-/* This structure is used to keep track of statistics on what
- optimization PRE was able to perform. */
-static struct
-{
- /* The number of new expressions/temporaries generated by PRE. */
- int insertions;
-
- /* The number of inserts found due to partial anticipation */
- int pa_insert;
-
- /* The number of inserts made for code hoisting. */
- int hoist_insert;
-
- /* The number of new PHI nodes added by PRE. */
- int phis;
-} pre_stats;
-
-static bool do_partial_partial;
-static pre_expr bitmap_find_leader (bitmap_set_t, unsigned int);
-static void bitmap_value_insert_into_set (bitmap_set_t, pre_expr);
-static void bitmap_value_replace_in_set (bitmap_set_t, pre_expr);
-static void bitmap_set_copy (bitmap_set_t, bitmap_set_t);
-static bool bitmap_set_contains_value (bitmap_set_t, unsigned int);
-static void bitmap_insert_into_set (bitmap_set_t, pre_expr);
-static bitmap_set_t bitmap_set_new (void);
-static tree create_expression_by_pieces (basic_block, pre_expr, gimple_seq *,
- tree);
-static tree find_or_generate_expression (basic_block, tree, gimple_seq *);
-static unsigned int get_expr_value_id (pre_expr);
-
-/* We can add and remove elements and entries to and from sets
- and hash tables, so we use alloc pools for them. */
-
-static object_allocator<bitmap_set> bitmap_set_pool ("Bitmap sets");
-static bitmap_obstack grand_bitmap_obstack;
-
-/* A three tuple {e, pred, v} used to cache phi translations in the
- phi_translate_table. */
-
-typedef struct expr_pred_trans_d : free_ptr_hash<expr_pred_trans_d>
-{
- /* The expression. */
- pre_expr e;
-
- /* The predecessor block along which we translated the expression. */
- basic_block pred;
-
- /* The value that resulted from the translation. */
- pre_expr v;
-
- /* The hashcode for the expression, pred pair. This is cached for
- speed reasons. */
- hashval_t hashcode;
-
- /* hash_table support. */
- static inline hashval_t hash (const expr_pred_trans_d *);
- static inline int equal (const expr_pred_trans_d *, const expr_pred_trans_d *);
-} *expr_pred_trans_t;
-typedef const struct expr_pred_trans_d *const_expr_pred_trans_t;
-
-inline hashval_t
-expr_pred_trans_d::hash (const expr_pred_trans_d *e)
-{
- return e->hashcode;
-}
-
-inline int
-expr_pred_trans_d::equal (const expr_pred_trans_d *ve1,
- const expr_pred_trans_d *ve2)
-{
- basic_block b1 = ve1->pred;
- basic_block b2 = ve2->pred;
-
- /* If they are not translations for the same basic block, they can't
- be equal. */
- if (b1 != b2)
- return false;
- return pre_expr_d::equal (ve1->e, ve2->e);
-}
-
-/* The phi_translate_table caches phi translations for a given
- expression and predecessor. */
-static hash_table<expr_pred_trans_d> *phi_translate_table;
-
/* Add the tuple mapping from {expression E, basic block PRED} to
the phi translation table and return whether it pre-existed. */
static inline bool
phi_trans_add (expr_pred_trans_t *entry, pre_expr e, basic_block pred)
{
- expr_pred_trans_t *slot;
+ if (!PHI_TRANS_TABLE (pred))
+ PHI_TRANS_TABLE (pred) = new hash_table<expr_pred_trans_d> (11);
+
+ expr_pred_trans_t slot;
expr_pred_trans_d tem;
- hashval_t hash = iterative_hash_hashval_t (pre_expr_d::hash (e),
- pred->index);
- tem.e = e;
- tem.pred = pred;
- tem.hashcode = hash;
- slot = phi_translate_table->find_slot_with_hash (&tem, hash, INSERT);
- if (*slot)
+ unsigned id = get_expression_id (e);
+ tem.e = id;
+ slot = PHI_TRANS_TABLE (pred)->find_slot_with_hash (tem, id, INSERT);
+ if (slot->e)
{
- *entry = *slot;
+ *entry = slot;
return true;
}
- *entry = *slot = XNEW (struct expr_pred_trans_d);
- (*entry)->e = e;
- (*entry)->pred = pred;
- (*entry)->hashcode = hash;
+ *entry = slot;
+ slot->e = id;
return false;
}
@@ -620,23 +695,33 @@ phi_trans_add (expr_pred_trans_t *entry, pre_expr e, basic_block pred)
static void
add_to_value (unsigned int v, pre_expr e)
{
- bitmap set;
-
gcc_checking_assert (get_expr_value_id (e) == v);
- if (v >= value_expressions.length ())
+ if (value_id_constant_p (v))
{
- value_expressions.safe_grow_cleared (v + 1, true);
- }
+ if (e->kind != CONSTANT)
+ return;
- set = value_expressions[v];
- if (!set)
- {
- set = BITMAP_ALLOC (&grand_bitmap_obstack);
- value_expressions[v] = set;
+ if (-v >= constant_value_expressions.length ())
+ constant_value_expressions.safe_grow_cleared (-v + 1);
+
+ pre_expr leader = constant_value_expressions[-v];
+ if (!leader)
+ constant_value_expressions[-v] = e;
}
+ else
+ {
+ if (v >= value_expressions.length ())
+ value_expressions.safe_grow_cleared (v + 1);
- bitmap_set_bit (set, get_or_alloc_expression_id (e));
+ bitmap set = value_expressions[v];
+ if (!set)
+ {
+ set = BITMAP_ALLOC (&grand_bitmap_obstack);
+ value_expressions[v] = set;
+ }
+ bitmap_set_bit (set, get_or_alloc_expression_id (e));
+ }
}
/* Create a new bitmap set and return it. */
@@ -655,29 +740,10 @@ bitmap_set_new (void)
static unsigned int
get_expr_value_id (pre_expr expr)
{
- unsigned int id;
- switch (expr->kind)
- {
- case CONSTANT:
- id = get_constant_value_id (PRE_EXPR_CONSTANT (expr));
- break;
- case NAME:
- id = VN_INFO (PRE_EXPR_NAME (expr))->value_id;
- break;
- case NARY:
- gcc_assert (!PRE_EXPR_NARY (expr)->predicated_values);
- id = PRE_EXPR_NARY (expr)->value_id;
- break;
- case REFERENCE:
- id = PRE_EXPR_REFERENCE (expr)->value_id;
- break;
- default:
- gcc_unreachable ();
- }
/* ??? We cannot assert that expr has a value-id (it can be 0), because
we assign value-ids only to expressions that have a result
in set_hashtable_value_ids. */
- return id;
+ return expr->value_id;
}
/* Return a VN valnum (SSA name or constant) for the PRE value-id VAL. */
@@ -685,16 +751,22 @@ get_expr_value_id (pre_expr expr)
static tree
vn_valnum_from_value_id (unsigned int val)
{
+ if (value_id_constant_p (val))
+ {
+ pre_expr vexpr = constant_value_expressions[-val];
+ if (vexpr)
+ return PRE_EXPR_CONSTANT (vexpr);
+ return NULL_TREE;
+ }
+
+ bitmap exprset = value_expressions[val];
bitmap_iterator bi;
unsigned int i;
- bitmap exprset = value_expressions[val];
EXECUTE_IF_SET_IN_BITMAP (exprset, 0, i, bi)
{
pre_expr vexpr = expression_for_id (i);
if (vexpr->kind == NAME)
return VN_INFO (PRE_EXPR_NAME (vexpr))->valnum;
- else if (vexpr->kind == CONSTANT)
- return PRE_EXPR_CONSTANT (vexpr);
}
return NULL_TREE;
}
@@ -1066,7 +1138,6 @@ static pre_expr
get_or_alloc_expr_for_constant (tree constant)
{
unsigned int result_id;
- unsigned int value_id;
struct pre_expr_d expr;
pre_expr newexpr;
@@ -1081,8 +1152,8 @@ get_or_alloc_expr_for_constant (tree constant)
newexpr->loc = UNKNOWN_LOCATION;
PRE_EXPR_CONSTANT (newexpr) = constant;
alloc_expression_id (newexpr);
- value_id = get_or_alloc_constant_value_id (constant);
- add_to_value (value_id, newexpr);
+ newexpr->value_id = get_or_alloc_constant_value_id (constant);
+ add_to_value (newexpr->value_id, newexpr);
return newexpr;
}
@@ -1307,10 +1378,11 @@ get_representative_for (const pre_expr e, basic_block b = NULL)
??? We should be able to re-use this when we insert the statement
to compute it. */
name = make_temp_ssa_name (get_expr_type (e), gimple_build_nop (), "pretmp");
- VN_INFO (name)->value_id = value_id;
- VN_INFO (name)->valnum = valnum ? valnum : name;
+ vn_ssa_aux_t vn_info = VN_INFO (name);
+ vn_info->value_id = value_id;
+ vn_info->valnum = valnum ? valnum : name;
/* ??? For now mark this SSA name for release by VN. */
- VN_INFO (name)->needs_insertion = true;
+ vn_info->needs_insertion = true;
add_to_value (value_id, get_or_alloc_expr_for_name (name));
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1438,30 +1510,17 @@ phi_translate_1 (bitmap_set_t dest,
if (result && is_gimple_min_invariant (result))
return get_or_alloc_expr_for_constant (result);
- expr = pre_expr_pool.allocate ();
- expr->kind = NARY;
- expr->id = 0;
- expr->loc = expr_loc;
- if (nary && !nary->predicated_values)
- {
- PRE_EXPR_NARY (expr) = nary;
- new_val_id = nary->value_id;
- get_or_alloc_expression_id (expr);
- }
- else
+ if (!nary || nary->predicated_values)
{
new_val_id = get_next_value_id ();
- value_expressions.safe_grow_cleared (get_max_value_id () + 1,
- true);
nary = vn_nary_op_insert_pieces (newnary->length,
newnary->opcode,
newnary->type,
&newnary->op[0],
result, new_val_id);
- PRE_EXPR_NARY (expr) = nary;
- get_or_alloc_expression_id (expr);
}
- add_to_value (new_val_id, expr);
+ expr = get_or_alloc_expr_for_nary (nary, expr_loc);
+ add_to_value (get_expr_value_id (expr), expr);
}
return expr;
}
@@ -1593,21 +1652,12 @@ phi_translate_1 (bitmap_set_t dest,
return NULL;
}
- expr = pre_expr_pool.allocate ();
- expr->kind = REFERENCE;
- expr->id = 0;
- expr->loc = expr_loc;
-
if (newref)
new_val_id = newref->value_id;
else
{
if (changed || !same_valid)
- {
- new_val_id = get_next_value_id ();
- value_expressions.safe_grow_cleared
- (get_max_value_id () + 1, true);
- }
+ new_val_id = get_next_value_id ();
else
new_val_id = ref->value_id;
if (!newoperands.exists ())
@@ -1618,8 +1668,7 @@ phi_translate_1 (bitmap_set_t dest,
result, new_val_id);
newoperands = vNULL;
}
- PRE_EXPR_REFERENCE (expr) = newref;
- get_or_alloc_expression_id (expr);
+ expr = get_or_alloc_expr_for_reference (newref, expr_loc);
add_to_value (new_val_id, expr);
}
newoperands.release ();
@@ -1678,10 +1727,10 @@ phi_translate (bitmap_set_t dest, pre_expr expr,
if (expr->kind != NAME)
{
if (phi_trans_add (&slot, expr, e->src))
- return slot->v;
+ return slot->v == 0 ? NULL : expression_for_id (slot->v);
/* Store NULL for the value we want to return in the case of
recursing. */
- slot->v = NULL;
+ slot->v = 0;
}
/* Translate. */
@@ -1692,12 +1741,14 @@ phi_translate (bitmap_set_t dest, pre_expr expr,
if (slot)
{
+ /* We may have reallocated. */
+ phi_trans_add (&slot, expr, e->src);
if (phitrans)
- slot->v = phitrans;
+ slot->v = get_expression_id (phitrans);
else
/* Remove failed translations again, they cause insert
iteration to not pick up new opportunities reliably. */
- phi_translate_table->remove_elt_with_hash (slot, slot->hashcode);
+ PHI_TRANS_TABLE (e->src)->clear_slot (slot);
}
return phitrans;
@@ -1722,6 +1773,13 @@ phi_translate_set (bitmap_set_t dest, bitmap_set_t set, edge e)
}
exprs = sorted_array_from_bitmap_set (set);
+ /* Allocate the phi-translation cache where we have an idea about
+ its size. hash-table implementation internals tell us that
+ allocating the table to fit twice the number of elements will
+ make sure we do not usually re-allocate. */
+ if (!PHI_TRANS_TABLE (e->src))
+ PHI_TRANS_TABLE (e->src)
+ = new hash_table<expr_pred_trans_d> (2 * exprs.length ());
FOR_EACH_VEC_ELT (exprs, i, expr)
{
pre_expr translated;
@@ -1742,18 +1800,8 @@ static pre_expr
bitmap_find_leader (bitmap_set_t set, unsigned int val)
{
if (value_id_constant_p (val))
- {
- unsigned int i;
- bitmap_iterator bi;
- bitmap exprset = value_expressions[val];
+ return constant_value_expressions[-val];
- EXECUTE_IF_SET_IN_BITMAP (exprset, 0, i, bi)
- {
- pre_expr expr = expression_for_id (i);
- if (expr->kind == CONSTANT)
- return expr;
- }
- }
if (bitmap_set_contains_value (set, val))
{
/* Rather than walk the entire bitmap of expressions, and see
@@ -2950,10 +2998,11 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
if (forcedname != folded)
{
- VN_INFO (forcedname)->valnum = forcedname;
- VN_INFO (forcedname)->value_id = get_next_value_id ();
+ vn_ssa_aux_t vn_info = VN_INFO (forcedname);
+ vn_info->valnum = forcedname;
+ vn_info->value_id = get_next_value_id ();
nameexpr = get_or_alloc_expr_for_name (forcedname);
- add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
+ add_to_value (vn_info->value_id, nameexpr);
bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
}
@@ -2976,11 +3025,12 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
the expression may have been represented. There is no harm in replacing
here. */
value_id = get_expr_value_id (expr);
- VN_INFO (name)->value_id = value_id;
- VN_INFO (name)->valnum = vn_valnum_from_value_id (value_id);
- if (VN_INFO (name)->valnum == NULL_TREE)
- VN_INFO (name)->valnum = name;
- gcc_assert (VN_INFO (name)->valnum != NULL_TREE);
+ vn_ssa_aux_t vn_info = VN_INFO (name);
+ vn_info->value_id = value_id;
+ vn_info->valnum = vn_valnum_from_value_id (value_id);
+ if (vn_info->valnum == NULL_TREE)
+ vn_info->valnum = name;
+ gcc_assert (vn_info->valnum != NULL_TREE);
nameexpr = get_or_alloc_expr_for_name (name);
add_to_value (value_id, nameexpr);
if (NEW_SETS (block))
@@ -3082,10 +3132,11 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
temp = make_temp_ssa_name (type, NULL, "prephitmp");
phi = create_phi_node (temp, block);
- VN_INFO (temp)->value_id = val;
- VN_INFO (temp)->valnum = vn_valnum_from_value_id (val);
- if (VN_INFO (temp)->valnum == NULL_TREE)
- VN_INFO (temp)->valnum = temp;
+ vn_ssa_aux_t vn_info = VN_INFO (temp);
+ vn_info->value_id = val;
+ vn_info->valnum = vn_valnum_from_value_id (val);
+ if (vn_info->valnum == NULL_TREE)
+ vn_info->valnum = temp;
bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (temp));
FOR_EACH_EDGE (pred, ei, block->preds)
{
@@ -3190,7 +3241,7 @@ do_pre_regular_insertion (basic_block block, basic_block dom)
bool new_stuff = false;
vec<pre_expr> exprs;
pre_expr expr;
- auto_vec<pre_expr> avail;
+ auto_vec<pre_expr, 2> avail;
int i;
exprs = sorted_array_from_bitmap_set (ANTIC_IN (block));
@@ -3327,10 +3378,11 @@ do_pre_regular_insertion (basic_block block, basic_block dom)
gimple_stmt_iterator gsi = gsi_after_labels (block);
gsi_insert_before (&gsi, assign, GSI_NEW_STMT);
- VN_INFO (temp)->value_id = val;
- VN_INFO (temp)->valnum = vn_valnum_from_value_id (val);
- if (VN_INFO (temp)->valnum == NULL_TREE)
- VN_INFO (temp)->valnum = temp;
+ vn_ssa_aux_t vn_info = VN_INFO (temp);
+ vn_info->value_id = val;
+ vn_info->valnum = vn_valnum_from_value_id (val);
+ if (vn_info->valnum == NULL_TREE)
+ vn_info->valnum = temp;
bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (temp));
pre_expr newe = get_or_alloc_expr_for_name (temp);
add_to_value (val, newe);
@@ -3357,7 +3409,7 @@ do_pre_partial_partial_insertion (basic_block block, basic_block dom)
bool new_stuff = false;
vec<pre_expr> exprs;
pre_expr expr;
- auto_vec<pre_expr> avail;
+ auto_vec<pre_expr, 2> avail;
int i;
exprs = sorted_array_from_bitmap_set (PA_IN (block));
@@ -3646,6 +3698,18 @@ insert (void)
fprintf (dump_file, "Starting insert iteration %d\n", num_iterations);
changed = false;
+ /* Insert expressions for hoisting. Do a backward walk here since
+ inserting into BLOCK exposes new opportunities in its predecessors.
+ Since PRE and hoist insertions can cause back-to-back iteration
+ limit that on the hoist side. */
+ if (flag_code_hoisting
+ && num_iterations <= param_max_pre_hoist_insert_iterations)
+ for (int idx = rpo_num - 1; idx >= 0; --idx)
+ {
+ basic_block block = BASIC_BLOCK_FOR_FN (cfun, rpo[idx]);
+ if (EDGE_COUNT (block->succs) >= 2)
+ changed |= do_hoist_insertion (block);
+ }
for (int idx = 0; idx < rpo_num; ++idx)
{
basic_block block = BASIC_BLOCK_FOR_FN (cfun, rpo[idx]);
@@ -3680,10 +3744,6 @@ insert (void)
if (do_partial_partial)
changed |= do_pre_partial_partial_insertion (block, dom);
}
-
- /* Insert expressions for hoisting. */
- if (flag_code_hoisting && EDGE_COUNT (block->succs) >= 2)
- changed |= do_hoist_insertion (block);
}
}
@@ -3879,13 +3939,8 @@ compute_avail (void)
|| gimple_bb (SSA_NAME_DEF_STMT
(gimple_vuse (stmt))) != block)
{
- result = pre_expr_pool.allocate ();
- result->kind = REFERENCE;
- result->id = 0;
- result->loc = gimple_location (stmt);
- PRE_EXPR_REFERENCE (result) = ref;
-
- get_or_alloc_expression_id (result);
+ result = get_or_alloc_expr_for_reference
+ (ref, gimple_location (stmt));
add_to_value (get_expr_value_id (result), result);
bitmap_value_insert_into_set (EXP_GEN (block), result);
}
@@ -3920,11 +3975,8 @@ compute_avail (void)
&& vn_nary_may_trap (nary))
continue;
- result = pre_expr_pool.allocate ();
- result->kind = NARY;
- result->id = 0;
- result->loc = gimple_location (stmt);
- PRE_EXPR_NARY (result) = nary;
+ result = get_or_alloc_expr_for_nary
+ (nary, gimple_location (stmt));
break;
}
@@ -3953,7 +4005,10 @@ compute_avail (void)
adding the reference to EXP_GEN. */
if (BB_MAY_NOTRETURN (block)
&& vn_reference_may_trap (ref))
- continue;
+ {
+ operands.release ();
+ continue;
+ }
/* If the value of the reference is not invalidated in
this block until it is computed, add the expression
@@ -4042,11 +4097,8 @@ compute_avail (void)
}
operands.release ();
- result = pre_expr_pool.allocate ();
- result->kind = REFERENCE;
- result->id = 0;
- result->loc = gimple_location (stmt);
- PRE_EXPR_REFERENCE (result) = ref;
+ result = get_or_alloc_expr_for_reference
+ (ref, gimple_location (stmt));
break;
}
@@ -4054,7 +4106,6 @@ compute_avail (void)
continue;
}
- get_or_alloc_expression_id (result);
add_to_value (get_expr_value_id (result), result);
bitmap_value_insert_into_set (EXP_GEN (block), result);
continue;
@@ -4100,7 +4151,9 @@ init_pre (void)
expressions.create (0);
expressions.safe_push (NULL);
value_expressions.create (get_max_value_id () + 1);
- value_expressions.safe_grow_cleared (get_max_value_id () + 1, true);
+ value_expressions.quick_grow_cleared (get_max_value_id () + 1);
+ constant_value_expressions.create (get_max_constant_value_id () + 1);
+ constant_value_expressions.quick_grow_cleared (get_max_constant_value_id () + 1);
name_to_id.create (0);
inserted_exprs = BITMAP_ALLOC (NULL);
@@ -4113,7 +4166,6 @@ init_pre (void)
calculate_dominance_info (CDI_DOMINATORS);
bitmap_obstack_initialize (&grand_bitmap_obstack);
- phi_translate_table = new hash_table<expr_pred_trans_d> (5110);
expression_to_id = new hash_table<pre_expr_d> (num_ssa_names * 3);
FOR_ALL_BB_FN (bb, cfun)
{
@@ -4121,6 +4173,7 @@ init_pre (void)
PHI_GEN (bb) = bitmap_set_new ();
TMP_GEN (bb) = bitmap_set_new ();
AVAIL_OUT (bb) = bitmap_set_new ();
+ PHI_TRANS_TABLE (bb) = NULL;
}
}
@@ -4131,17 +4184,20 @@ static void
fini_pre ()
{
value_expressions.release ();
+ constant_value_expressions.release ();
expressions.release ();
BITMAP_FREE (inserted_exprs);
bitmap_obstack_release (&grand_bitmap_obstack);
bitmap_set_pool.release ();
pre_expr_pool.release ();
- delete phi_translate_table;
- phi_translate_table = NULL;
delete expression_to_id;
expression_to_id = NULL;
name_to_id.release ();
+ basic_block bb;
+ FOR_ALL_BB_FN (bb, cfun)
+ if (bb->aux && PHI_TRANS_TABLE (bb))
+ delete PHI_TRANS_TABLE (bb);
free_aux_for_blocks ();
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index c139adb..8c93e51 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -288,7 +288,6 @@ vn_constant_hasher::equal (const vn_constant_s *vc1, const vn_constant_s *vc2)
}
static hash_table<vn_constant_hasher> *constant_to_value_id;
-static bitmap constant_value_ids;
/* Obstack we allocate the vn-tables elements from. */
@@ -322,6 +321,7 @@ tree VN_TOP;
/* Unique counter for our value ids. */
static unsigned int next_value_id;
+static int next_constant_value_id;
/* Table of vn_ssa_aux_t's, one per ssa_name. The vn_ssa_aux_t objects
@@ -611,20 +611,11 @@ get_or_alloc_constant_value_id (tree constant)
vcp = XNEW (struct vn_constant_s);
vcp->hashcode = vc.hashcode;
vcp->constant = constant;
- vcp->value_id = get_next_value_id ();
+ vcp->value_id = get_next_constant_value_id ();
*slot = vcp;
- bitmap_set_bit (constant_value_ids, vcp->value_id);
return vcp->value_id;
}
-/* Return true if V is a value id for a constant. */
-
-bool
-value_id_constant_p (unsigned int v)
-{
- return bitmap_bit_p (constant_value_ids, v);
-}
-
/* Compute the hash for a reference operand VRO1. */
static void
@@ -2048,12 +2039,12 @@ vn_walk_cb_data::push_partial_def (pd_data pd,
}
else
{
- size = MIN (size, (HOST_WIDE_INT) needed_len * BITS_PER_UNIT);
if (pd.offset >= 0)
{
/* LSB of this_buffer[0] byte should be at pd.offset bits
in buffer. */
unsigned int msk;
+ size = MIN (size, (HOST_WIDE_INT) needed_len * BITS_PER_UNIT);
amnt = pd.offset % BITS_PER_UNIT;
if (amnt)
shift_bytes_in_array_left (this_buffer, len + 1, amnt);
@@ -2083,6 +2074,9 @@ vn_walk_cb_data::push_partial_def (pd_data pd,
{
amnt = (unsigned HOST_WIDE_INT) pd.offset % BITS_PER_UNIT;
if (amnt)
+ size -= BITS_PER_UNIT - amnt;
+ size = MIN (size, (HOST_WIDE_INT) needed_len * BITS_PER_UNIT);
+ if (amnt)
shift_bytes_in_array_left (this_buffer, len + 1, amnt);
}
memcpy (p, this_buffer + (amnt != 0), size / BITS_PER_UNIT);
@@ -5578,14 +5572,32 @@ get_max_value_id (void)
return next_value_id;
}
+/* Return the maximum constant value id we have ever seen. */
+
+unsigned int
+get_max_constant_value_id (void)
+{
+ return -next_constant_value_id;
+}
+
/* Return the next unique value id. */
unsigned int
get_next_value_id (void)
{
+ gcc_checking_assert ((int)next_value_id > 0);
return next_value_id++;
}
+/* Return the next unique value id for constants. */
+
+unsigned int
+get_next_constant_value_id (void)
+{
+ gcc_checking_assert (next_constant_value_id < 0);
+ return next_constant_value_id--;
+}
+
/* Compare two expressions E1 and E2 and return true if they are equal. */
@@ -5834,8 +5846,9 @@ eliminate_dom_walker::eliminate_insert (basic_block bb,
else
{
gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
- VN_INFO (res)->valnum = val;
- VN_INFO (res)->visited = true;
+ vn_ssa_aux_t vn_info = VN_INFO (res);
+ vn_info->valnum = val;
+ vn_info->visited = true;
}
insertions++;
@@ -5875,10 +5888,12 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
it has an expression it wants to use as replacement,
insert that. */
tree val = VN_INFO (lhs)->valnum;
+ vn_ssa_aux_t vn_info;
if (val != VN_TOP
&& TREE_CODE (val) == SSA_NAME
- && VN_INFO (val)->needs_insertion
- && VN_INFO (val)->expr != NULL
+ && (vn_info = VN_INFO (val), true)
+ && vn_info->needs_insertion
+ && vn_info->expr != NULL
&& (sprime = eliminate_insert (b, gsi, val)) != NULL_TREE)
eliminate_push_avail (b, sprime);
}
@@ -6265,8 +6280,9 @@ eliminate_dom_walker::eliminate_stmt (basic_block b, gimple_stmt_iterator *gsi)
only process new ones. */
if (! has_VN_INFO (def))
{
- VN_INFO (def)->valnum = def;
- VN_INFO (def)->visited = true;
+ vn_ssa_aux_t vn_info = VN_INFO (def);
+ vn_info->valnum = def;
+ vn_info->visited = true;
}
if (gsi_stmt (prev) == gsi_stmt (*gsi))
break;
@@ -6654,7 +6670,6 @@ run_rpo_vn (vn_lookup_kind kind)
/* ??? Prune requirement of these. */
constant_to_value_id = new hash_table<vn_constant_hasher> (23);
- constant_value_ids = BITMAP_ALLOC (NULL);
/* Initialize the value ids and prune out remaining VN_TOPs
from dead code. */
@@ -6721,7 +6736,6 @@ free_rpo_vn (void)
delete constant_to_value_id;
constant_to_value_id = NULL;
- BITMAP_FREE (constant_value_ids);
}
/* Hook for maybe_push_res_to_seq, lookup the expression in the VN tables. */
@@ -7446,6 +7460,7 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs,
/ (n_basic_blocks_for_fn (fn) - NUM_FIXED_BLOCKS));
VN_TOP = create_tmp_var_raw (void_type_node, "vn_top");
next_value_id = 1;
+ next_constant_value_id = -1;
vn_ssa_aux_hash = new hash_table <vn_ssa_aux_hasher> (region_size * 2);
gcc_obstack_init (&vn_ssa_aux_obstack);
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 48701c3..3420e6b 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -269,11 +269,21 @@ bool vn_nary_op_eq (const_vn_nary_op_t const vno1,
bool vn_nary_may_trap (vn_nary_op_t);
bool vn_reference_may_trap (vn_reference_t);
bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const);
+
unsigned int get_max_value_id (void);
+unsigned int get_max_constant_value_id (void);
unsigned int get_next_value_id (void);
+unsigned int get_next_constant_value_id (void);
unsigned int get_constant_value_id (tree);
unsigned int get_or_alloc_constant_value_id (tree);
-bool value_id_constant_p (unsigned int);
+
+/* Return true if V is a value id for a constant. */
+static inline bool
+value_id_constant_p (unsigned int v)
+{
+ return (int)v < 0;
+}
+
tree fully_constant_vn_reference_p (vn_reference_t);
tree vn_nary_simplify (vn_nary_op_t);
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 30a8c93..a4832b7 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -7972,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)
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 7ed1686..f235143 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -1345,21 +1345,18 @@ value_sat_pred_p (tree val, tree boundary, enum tree_code cmpc,
}
/* Returns true if PRED is common among all the predicate
- chains (PREDS) (and therefore can be factored out).
- NUM_PRED_CHAIN is the size of array PREDS. */
+ chains (PREDS) (and therefore can be factored out). */
static bool
-find_matching_predicate_in_rest_chains (pred_info pred,
- pred_chain_union preds,
- size_t num_pred_chains)
+find_matching_predicate_in_rest_chains (pred_info pred, pred_chain_union preds)
{
size_t i, j, n;
/* Trival case. */
- if (num_pred_chains == 1)
+ if (preds.length () == 1)
return true;
- for (i = 1; i < num_pred_chains; i++)
+ for (i = 1; i < preds.length (); i++)
{
bool found = false;
pred_chain one_chain = preds[i];
@@ -1530,6 +1527,129 @@ prune_uninit_phi_opnds (gphi *phi, unsigned uninit_opnds, gphi *flag_def,
return true;
}
+/* A helper function finds predicate which will be examined against uninit
+ paths. If there is no "flag_var cmp const" form predicate, the function
+ tries to find predicate of form like "flag_var cmp flag_var" with value
+ range info. PHI is the phi node whose incoming (undefined) paths need to
+ be examined. On success, the function returns the comparsion code, sets
+ defintion gimple of the flag_var to FLAG_DEF, sets boundary_cst to
+ BOUNDARY_CST. On fail, the function returns ERROR_MARK. */
+
+static enum tree_code
+find_var_cmp_const (pred_chain_union preds, gphi *phi, gimple **flag_def,
+ tree *boundary_cst)
+{
+ enum tree_code vrinfo_code = ERROR_MARK, code;
+ gimple *vrinfo_def = NULL;
+ tree vrinfo_cst = NULL, cond_lhs, cond_rhs;
+
+ gcc_assert (preds.length () > 0);
+ pred_chain the_pred_chain = preds[0];
+ for (unsigned i = 0; i < the_pred_chain.length (); i++)
+ {
+ bool use_vrinfo_p = false;
+ pred_info the_pred = the_pred_chain[i];
+ cond_lhs = the_pred.pred_lhs;
+ cond_rhs = the_pred.pred_rhs;
+ if (cond_lhs == NULL_TREE || cond_rhs == NULL_TREE)
+ continue;
+
+ code = get_cmp_code (the_pred.cond_code, false, the_pred.invert);
+ if (code == ERROR_MARK)
+ continue;
+
+ if (TREE_CODE (cond_lhs) == SSA_NAME && is_gimple_constant (cond_rhs))
+ ;
+ else if (TREE_CODE (cond_rhs) == SSA_NAME
+ && is_gimple_constant (cond_lhs))
+ {
+ std::swap (cond_lhs, cond_rhs);
+ if ((code = get_cmp_code (code, true, false)) == ERROR_MARK)
+ continue;
+ }
+ /* Check if we can take advantage of "flag_var comp flag_var" predicate
+ with value range info. Note only first of such case is handled. */
+ else if (vrinfo_code == ERROR_MARK
+ && TREE_CODE (cond_lhs) == SSA_NAME
+ && TREE_CODE (cond_rhs) == SSA_NAME)
+ {
+ gimple* lhs_def = SSA_NAME_DEF_STMT (cond_lhs);
+ if (!lhs_def || gimple_code (lhs_def) != GIMPLE_PHI
+ || gimple_bb (lhs_def) != gimple_bb (phi))
+ {
+ std::swap (cond_lhs, cond_rhs);
+ if ((code = get_cmp_code (code, true, false)) == ERROR_MARK)
+ continue;
+ }
+
+ /* Check value range info of rhs, do following transforms:
+ flag_var < [min, max] -> flag_var < max
+ flag_var > [min, max] -> flag_var > min
+
+ We can also transform LE_EXPR/GE_EXPR to LT_EXPR/GT_EXPR:
+ flag_var <= [min, max] -> flag_var < [min, max+1]
+ flag_var >= [min, max] -> flag_var > [min-1, max]
+ if no overflow/wrap. */
+ wide_int min, max;
+ tree type = TREE_TYPE (cond_lhs);
+ if (!INTEGRAL_TYPE_P (type)
+ || get_range_info (cond_rhs, &min, &max) != VR_RANGE)
+ continue;
+ if (code == LE_EXPR
+ && max != wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type)))
+ {
+ code = LT_EXPR;
+ max = max + 1;
+ }
+ if (code == GE_EXPR
+ && min != wi::min_value (TYPE_PRECISION (type), TYPE_SIGN (type)))
+ {
+ code = GT_EXPR;
+ min = min - 1;
+ }
+ if (code == LT_EXPR)
+ cond_rhs = wide_int_to_tree (type, max);
+ else if (code == GT_EXPR)
+ cond_rhs = wide_int_to_tree (type, min);
+ else
+ continue;
+
+ use_vrinfo_p = true;
+ }
+ else
+ continue;
+
+ if ((*flag_def = SSA_NAME_DEF_STMT (cond_lhs)) == NULL)
+ continue;
+
+ if (gimple_code (*flag_def) != GIMPLE_PHI
+ || gimple_bb (*flag_def) != gimple_bb (phi)
+ || !find_matching_predicate_in_rest_chains (the_pred, preds))
+ continue;
+
+ /* Return if any "flag_var comp const" predicate is found. */
+ if (!use_vrinfo_p)
+ {
+ *boundary_cst = cond_rhs;
+ return code;
+ }
+ /* Record if any "flag_var comp flag_var[vinfo]" predicate is found. */
+ else if (vrinfo_code == ERROR_MARK)
+ {
+ vrinfo_code = code;
+ vrinfo_def = *flag_def;
+ vrinfo_cst = cond_rhs;
+ }
+ }
+ /* Return the "flag_var cmp flag_var[vinfo]" predicate we found. */
+ if (vrinfo_code != ERROR_MARK)
+ {
+ *flag_def = vrinfo_def;
+ *boundary_cst = vrinfo_cst;
+ }
+ return vrinfo_code;
+}
+
/* A helper function that determines if the predicate set
of the use is not overlapping with that of the uninit paths.
The most common senario of guarded use is in Example 1:
@@ -1607,75 +1727,21 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
gphi *phi, unsigned uninit_opnds,
hash_set<gphi *> *visited_phis)
{
- unsigned int i, n;
gimple *flag_def = 0;
tree boundary_cst = 0;
enum tree_code cmp_code;
- bool swap_cond = false;
- bool invert = false;
- pred_chain the_pred_chain = vNULL;
bitmap visited_flag_phis = NULL;
bool all_pruned = false;
- size_t num_preds = preds.length ();
- gcc_assert (num_preds > 0);
/* Find within the common prefix of multiple predicate chains
a predicate that is a comparison of a flag variable against
a constant. */
- the_pred_chain = preds[0];
- n = the_pred_chain.length ();
- for (i = 0; i < n; i++)
- {
- tree cond_lhs, cond_rhs, flag = 0;
-
- pred_info the_pred = the_pred_chain[i];
-
- invert = the_pred.invert;
- cond_lhs = the_pred.pred_lhs;
- cond_rhs = the_pred.pred_rhs;
- cmp_code = the_pred.cond_code;
-
- if (cond_lhs != NULL_TREE && TREE_CODE (cond_lhs) == SSA_NAME
- && cond_rhs != NULL_TREE && is_gimple_constant (cond_rhs))
- {
- boundary_cst = cond_rhs;
- flag = cond_lhs;
- }
- else if (cond_rhs != NULL_TREE && TREE_CODE (cond_rhs) == SSA_NAME
- && cond_lhs != NULL_TREE && is_gimple_constant (cond_lhs))
- {
- boundary_cst = cond_lhs;
- flag = cond_rhs;
- swap_cond = true;
- }
-
- if (!flag)
- continue;
-
- flag_def = SSA_NAME_DEF_STMT (flag);
-
- if (!flag_def)
- continue;
-
- if ((gimple_code (flag_def) == GIMPLE_PHI)
- && (gimple_bb (flag_def) == gimple_bb (phi))
- && find_matching_predicate_in_rest_chains (the_pred, preds,
- num_preds))
- break;
-
- flag_def = 0;
- }
-
- if (!flag_def)
+ cmp_code = find_var_cmp_const (preds, phi, &flag_def, &boundary_cst);
+ if (cmp_code == ERROR_MARK)
return false;
/* Now check all the uninit incoming edge has a constant flag value
that is in conflict with the use guard/predicate. */
- cmp_code = get_cmp_code (cmp_code, swap_cond, invert);
-
- if (cmp_code == ERROR_MARK)
- return false;
-
all_pruned = prune_uninit_phi_opnds
(phi, uninit_opnds, as_a<gphi *> (flag_def), boundary_cst, cmp_code,
visited_phis, &visited_flag_phis);
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 03a1fe6..426462e 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1310,6 +1310,9 @@ jump_table_cluster::is_beneficial (const vec<cluster *> &,
vec<cluster *>
bit_test_cluster::find_bit_tests (vec<cluster *> &clusters)
{
+ if (!is_enabled ())
+ return clusters.copy ();
+
unsigned l = clusters.length ();
auto_vec<min_cluster_item> min;
min.reserve (l + 1);
diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
index dbfd9ee..7515e95 100644
--- a/gcc/tree-switch-conversion.h
+++ b/gcc/tree-switch-conversion.h
@@ -411,6 +411,12 @@ public:
basic_block case_bb,
profile_probability prob);
+ /* Return whether bit test expansion is allowed. */
+ static inline bool is_enabled (void)
+ {
+ return flag_bit_tests;
+ }
+
/* True when the jump table handles an entire switch statement. */
bool m_handles_entire_switch;
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 3ff3088..0efab49 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);
}
@@ -689,7 +688,8 @@ vect_slp_analyze_node_dependences (vec_info *vinfo, slp_tree node,
stmt_vec_info last_access_info = vect_find_last_scalar_stmt_in_slp (node);
for (unsigned k = 0; k < SLP_TREE_SCALAR_STMTS (node).length (); ++k)
{
- stmt_vec_info access_info = SLP_TREE_SCALAR_STMTS (node)[k];
+ stmt_vec_info access_info
+ = vect_orig_stmt (SLP_TREE_SCALAR_STMTS (node)[k]);
if (access_info == last_access_info)
continue;
data_reference *dr_a = STMT_VINFO_DATA_REF (access_info);
@@ -760,7 +760,8 @@ vect_slp_analyze_node_dependences (vec_info *vinfo, slp_tree node,
= vect_find_first_scalar_stmt_in_slp (node);
for (unsigned k = 0; k < SLP_TREE_SCALAR_STMTS (node).length (); ++k)
{
- stmt_vec_info access_info = SLP_TREE_SCALAR_STMTS (node)[k];
+ stmt_vec_info access_info
+ = vect_orig_stmt (SLP_TREE_SCALAR_STMTS (node)[k]);
if (access_info == first_access_info)
continue;
data_reference *dr_a = STMT_VINFO_DATA_REF (access_info);
@@ -1130,6 +1131,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,22 +1186,9 @@ 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 dr_info is aligned of dr_peel_info is, then mark it so. */
+ 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)
- == DR_MISALIGNMENT (dr_peel_info)));
SET_DR_MISALIGNMENT (dr_info, 0);
return;
}
@@ -1572,6 +1599,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 +1730,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 +1743,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 +1752,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 +1901,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 +1935,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 +2008,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 +2031,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 +2383,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 +2393,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)
@@ -2383,7 +2425,13 @@ vect_slp_analyze_node_alignment (vec_info *vinfo, slp_tree node)
/* We need to commit to a vector type for the group now. */
if (is_a <bb_vec_info> (vinfo)
&& !vect_update_shared_vectype (first_stmt_info, SLP_TREE_VECTYPE (node)))
- return false;
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "desired vector type conflicts with earlier one "
+ "for %G", first_stmt_info->stmt);
+ return false;
+ }
dr_vec_info *dr_info = STMT_VINFO_DR_INFO (first_stmt_info);
vect_compute_data_ref_alignment (vinfo, dr_info);
@@ -2393,7 +2441,8 @@ vect_slp_analyze_node_alignment (vec_info *vinfo, slp_tree node)
/* For creating the data-ref pointer we need alignment of the
first element as well. */
- first_stmt_info = vect_find_first_scalar_stmt_in_slp (node);
+ first_stmt_info
+ = vect_stmt_to_vectorize (vect_find_first_scalar_stmt_in_slp (node));
if (first_stmt_info != SLP_TREE_SCALAR_STMTS (node)[0])
{
first_dr_info = STMT_VINFO_DR_INFO (first_stmt_info);
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 7cf00e6..3617918 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -1084,6 +1084,33 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop,
exit = single_exit (loop);
basic_block new_preheader = new_bbs[0];
+ /* Before installing PHI arguments make sure that the edges
+ into them match that of the scalar loop we analyzed. This
+ makes sure the SLP tree matches up between the main vectorized
+ loop and the epilogue vectorized copies. */
+ if (single_succ_edge (preheader)->dest_idx
+ != single_succ_edge (new_bbs[0])->dest_idx)
+ {
+ basic_block swap_bb = new_bbs[1];
+ gcc_assert (EDGE_COUNT (swap_bb->preds) == 2);
+ std::swap (EDGE_PRED (swap_bb, 0), EDGE_PRED (swap_bb, 1));
+ EDGE_PRED (swap_bb, 0)->dest_idx = 0;
+ EDGE_PRED (swap_bb, 1)->dest_idx = 1;
+ }
+ if (duplicate_outer_loop)
+ {
+ class loop *new_inner_loop = get_loop_copy (scalar_loop->inner);
+ if (loop_preheader_edge (scalar_loop)->dest_idx
+ != loop_preheader_edge (new_inner_loop)->dest_idx)
+ {
+ basic_block swap_bb = new_inner_loop->header;
+ gcc_assert (EDGE_COUNT (swap_bb->preds) == 2);
+ std::swap (EDGE_PRED (swap_bb, 0), EDGE_PRED (swap_bb, 1));
+ EDGE_PRED (swap_bb, 0)->dest_idx = 0;
+ EDGE_PRED (swap_bb, 1)->dest_idx = 1;
+ }
+ }
+
add_phi_args_after_copy (new_bbs, scalar_loop->num_nodes + 1, NULL);
/* Skip new preheader since it's deleted if copy loop is added at entry. */
@@ -2545,6 +2572,45 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
if (!prolog_peeling && !epilog_peeling)
return NULL;
+ /* Before doing any peeling make sure to reset debug binds outside of
+ the loop refering to defs not in LC SSA. */
+ class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ for (unsigned i = 0; i < loop->num_nodes; ++i)
+ {
+ basic_block bb = LOOP_VINFO_BBS (loop_vinfo)[i];
+ imm_use_iterator ui;
+ gimple *use_stmt;
+ for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ FOR_EACH_IMM_USE_STMT (use_stmt, ui, gimple_phi_result (gsi.phi ()))
+ if (gimple_debug_bind_p (use_stmt)
+ && loop != gimple_bb (use_stmt)->loop_father
+ && !flow_loop_nested_p (loop,
+ gimple_bb (use_stmt)->loop_father))
+ {
+ gimple_debug_bind_reset_value (use_stmt);
+ update_stmt (use_stmt);
+ }
+ }
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
+ {
+ ssa_op_iter op_iter;
+ def_operand_p def_p;
+ FOR_EACH_SSA_DEF_OPERAND (def_p, gsi_stmt (gsi), op_iter, SSA_OP_DEF)
+ FOR_EACH_IMM_USE_STMT (use_stmt, ui, DEF_FROM_PTR (def_p))
+ if (gimple_debug_bind_p (use_stmt)
+ && loop != gimple_bb (use_stmt)->loop_father
+ && !flow_loop_nested_p (loop,
+ gimple_bb (use_stmt)->loop_father))
+ {
+ gimple_debug_bind_reset_value (use_stmt);
+ update_stmt (use_stmt);
+ }
+ }
+ }
+
prob_vector = profile_probability::guessed_always ().apply_scale (9, 10);
estimated_vf = vect_vf_for_cost (loop_vinfo);
if (estimated_vf == 2)
@@ -2552,7 +2618,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
prob_prolog = prob_epilog = profile_probability::guessed_always ()
.apply_scale (estimated_vf - 1, estimated_vf);
- class loop *prolog, *epilog = NULL, *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ class loop *prolog, *epilog = NULL;
class loop *first_loop = loop;
bool irred_flag = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP;
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 0a315e2..39b7319 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -666,27 +666,50 @@ vect_fixup_scalar_cycles_with_patterns (loop_vec_info loop_vinfo)
unsigned i;
FOR_EACH_VEC_ELT (LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo), i, first)
- if (STMT_VINFO_IN_PATTERN_P (first))
- {
- stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (first);
- while (next)
- {
- if (! STMT_VINFO_IN_PATTERN_P (next)
- || STMT_VINFO_REDUC_IDX (STMT_VINFO_RELATED_STMT (next)) == -1)
- break;
- next = REDUC_GROUP_NEXT_ELEMENT (next);
- }
- /* If not all stmt in the chain are patterns or if we failed
- to update STMT_VINFO_REDUC_IDX try to handle the chain
- without patterns. */
- if (! next
- && STMT_VINFO_REDUC_IDX (STMT_VINFO_RELATED_STMT (first)) != -1)
- {
- vect_fixup_reduc_chain (first);
- LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo)[i]
- = STMT_VINFO_RELATED_STMT (first);
- }
- }
+ {
+ stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (first);
+ while (next)
+ {
+ if ((STMT_VINFO_IN_PATTERN_P (next)
+ != STMT_VINFO_IN_PATTERN_P (first))
+ || STMT_VINFO_REDUC_IDX (vect_stmt_to_vectorize (next)) == -1)
+ break;
+ next = REDUC_GROUP_NEXT_ELEMENT (next);
+ }
+ /* If all reduction chain members are well-formed patterns adjust
+ the group to group the pattern stmts instead. */
+ if (! next
+ && STMT_VINFO_REDUC_IDX (vect_stmt_to_vectorize (first)) != -1)
+ {
+ if (STMT_VINFO_IN_PATTERN_P (first))
+ {
+ vect_fixup_reduc_chain (first);
+ LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo)[i]
+ = STMT_VINFO_RELATED_STMT (first);
+ }
+ }
+ /* If not all stmt in the chain are patterns or if we failed
+ to update STMT_VINFO_REDUC_IDX dissolve the chain and handle
+ it as regular reduction instead. */
+ else
+ {
+ stmt_vec_info vinfo = first;
+ stmt_vec_info last = NULL;
+ while (vinfo)
+ {
+ next = REDUC_GROUP_NEXT_ELEMENT (vinfo);
+ REDUC_GROUP_FIRST_ELEMENT (vinfo) = NULL;
+ REDUC_GROUP_NEXT_ELEMENT (vinfo) = NULL;
+ last = vinfo;
+ vinfo = next;
+ }
+ STMT_VINFO_DEF_TYPE (vect_stmt_to_vectorize (first))
+ = vect_internal_def;
+ loop_vinfo->reductions.safe_push (vect_stmt_to_vectorize (last));
+ LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo).unordered_remove (i);
+ --i;
+ }
+ }
}
/* Function vect_get_loop_niters.
@@ -2342,6 +2365,79 @@ start_over:
"unsupported SLP instances\n");
goto again;
}
+
+ /* Check whether any load in ALL SLP instances is possibly permuted. */
+ slp_tree load_node, slp_root;
+ unsigned i, x;
+ slp_instance instance;
+ bool can_use_lanes = true;
+ FOR_EACH_VEC_ELT (LOOP_VINFO_SLP_INSTANCES (loop_vinfo), x, instance)
+ {
+ slp_root = SLP_INSTANCE_TREE (instance);
+ int group_size = SLP_TREE_LANES (slp_root);
+ tree vectype = SLP_TREE_VECTYPE (slp_root);
+ bool loads_permuted = false;
+ FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), i, load_node)
+ {
+ if (!SLP_TREE_LOAD_PERMUTATION (load_node).exists ())
+ continue;
+ unsigned j;
+ stmt_vec_info load_info;
+ FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (load_node), j, load_info)
+ if (SLP_TREE_LOAD_PERMUTATION (load_node)[j] != j)
+ {
+ loads_permuted = true;
+ break;
+ }
+ }
+
+ /* If the loads and stores can be handled with load/store-lane
+ instructions record it and move on to the next instance. */
+ if (loads_permuted
+ && SLP_INSTANCE_KIND (instance) == slp_inst_kind_store
+ && vect_store_lanes_supported (vectype, group_size, false))
+ {
+ FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), i, load_node)
+ {
+ stmt_vec_info stmt_vinfo = DR_GROUP_FIRST_ELEMENT
+ (SLP_TREE_SCALAR_STMTS (load_node)[0]);
+ /* Use SLP for strided accesses (or if we can't
+ load-lanes). */
+ if (STMT_VINFO_STRIDED_P (stmt_vinfo)
+ || ! vect_load_lanes_supported
+ (STMT_VINFO_VECTYPE (stmt_vinfo),
+ DR_GROUP_SIZE (stmt_vinfo), false))
+ break;
+ }
+
+ can_use_lanes
+ = can_use_lanes && i == SLP_INSTANCE_LOADS (instance).length ();
+
+ if (can_use_lanes && dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "SLP instance %p can use load/store-lanes\n",
+ instance);
+ }
+ else
+ {
+ can_use_lanes = false;
+ break;
+ }
+ }
+
+ /* If all SLP instances can use load/store-lanes abort SLP and try again
+ with SLP disabled. */
+ if (can_use_lanes)
+ {
+ ok = opt_result::failure_at (vect_location,
+ "Built SLP cancelled: can use "
+ "load/store-lanes\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Built SLP cancelled: all SLP instances support "
+ "load/store-lanes\n");
+ goto again;
+ }
}
/* Dissolve SLP-only groups. */
@@ -3230,14 +3326,17 @@ pop:
fail = true;
break;
}
- /* Check there's only a single stmt the op is used on inside
- of the loop. */
+ /* Check there's only a single stmt the op is used on. For the
+ not value-changing tail and the last stmt allow out-of-loop uses.
+ ??? We could relax this and handle arbitrary live stmts by
+ forcing a scalar epilogue for example. */
imm_use_iterator imm_iter;
gimple *op_use_stmt;
unsigned cnt = 0;
FOR_EACH_IMM_USE_STMT (op_use_stmt, imm_iter, op)
if (!is_gimple_debug (op_use_stmt)
- && flow_bb_inside_loop_p (loop, gimple_bb (op_use_stmt)))
+ && (*code != ERROR_MARK
+ || flow_bb_inside_loop_p (loop, gimple_bb (op_use_stmt))))
{
/* We want to allow x + x but not x < 1 ? x : 2. */
if (is_gimple_assign (op_use_stmt)
@@ -4420,34 +4519,6 @@ vect_model_reduction_cost (loop_vec_info loop_vinfo,
}
-/* Function vect_model_induction_cost.
-
- Models cost for induction operations. */
-
-static void
-vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies,
- stmt_vector_for_cost *cost_vec)
-{
- unsigned inside_cost, prologue_cost;
-
- if (PURE_SLP_STMT (stmt_info))
- return;
-
- /* loop cost for vec_loop. */
- inside_cost = record_stmt_cost (cost_vec, ncopies, vector_stmt,
- stmt_info, 0, vect_body);
-
- /* prologue cost for vec_init and vec_step. */
- prologue_cost = record_stmt_cost (cost_vec, 2, scalar_to_vec,
- stmt_info, 0, vect_prologue);
-
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_induction_cost: inside_cost = %d, "
- "prologue_cost = %d .\n", inside_cost, prologue_cost);
-}
-
-
/* Function get_initial_def_for_reduction
@@ -6313,9 +6384,28 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_nested_cycle)
{
if (is_a <gphi *> (stmt_info->stmt))
- /* Analysis for double-reduction is done on the outer
- loop PHI, nested cycles have no further restrictions. */
- STMT_VINFO_TYPE (stmt_info) = cycle_phi_info_type;
+ {
+ if (slp_node)
+ {
+ /* We eventually need to set a vector type on invariant
+ arguments. */
+ unsigned j;
+ slp_tree child;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
+ if (!vect_maybe_update_slp_op_vectype
+ (child, SLP_TREE_VECTYPE (slp_node)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "incompatible vector types for "
+ "invariants\n");
+ return false;
+ }
+ }
+ /* Analysis for double-reduction is done on the outer
+ loop PHI, nested cycles have no further restrictions. */
+ STMT_VINFO_TYPE (stmt_info) = cycle_phi_info_type;
+ }
else
STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
return true;
@@ -6359,8 +6449,10 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
/* Verify following REDUC_IDX from the latch def leads us back to the PHI
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 (loop));
+ 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;
@@ -7375,15 +7467,24 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo,
if (slp_node)
{
vec_initial_defs.reserve (vec_num);
- gcc_assert (slp_node == slp_node_instance->reduc_phis);
- stmt_vec_info first = REDUC_GROUP_FIRST_ELEMENT (reduc_stmt_info);
- tree neutral_op
- = neutral_op_for_slp_reduction (slp_node, vectype_out,
- STMT_VINFO_REDUC_CODE (reduc_info),
- first != NULL);
- get_initial_defs_for_reduction (loop_vinfo, slp_node_instance->reduc_phis,
- &vec_initial_defs, vec_num,
- first != NULL, neutral_op);
+ if (nested_cycle)
+ {
+ unsigned phi_idx = loop_preheader_edge (loop)->dest_idx;
+ vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[phi_idx],
+ &vec_initial_defs);
+ }
+ else
+ {
+ gcc_assert (slp_node == slp_node_instance->reduc_phis);
+ stmt_vec_info first = REDUC_GROUP_FIRST_ELEMENT (reduc_stmt_info);
+ tree neutral_op
+ = neutral_op_for_slp_reduction (slp_node, vectype_out,
+ STMT_VINFO_REDUC_CODE (reduc_info),
+ first != NULL);
+ get_initial_defs_for_reduction (loop_vinfo, slp_node_instance->reduc_phis,
+ &vec_initial_defs, vec_num,
+ first != NULL, neutral_op);
+ }
}
else
{
@@ -7518,6 +7619,81 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo,
return true;
}
+/* Vectorizes PHIs. */
+
+bool
+vectorizable_phi (vec_info *,
+ stmt_vec_info stmt_info, gimple **vec_stmt,
+ slp_tree slp_node, stmt_vector_for_cost *cost_vec)
+{
+ if (!is_a <gphi *> (stmt_info->stmt) || !slp_node)
+ return false;
+
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
+ return false;
+
+ tree vectype = SLP_TREE_VECTYPE (slp_node);
+
+ if (!vec_stmt) /* transformation not required. */
+ {
+ slp_tree child;
+ unsigned i;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), i, child)
+ if (!child)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "PHI node with unvectorized backedge def\n");
+ return false;
+ }
+ else if (!vect_maybe_update_slp_op_vectype (child, vectype))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "incompatible vector types for invariants\n");
+ return false;
+ }
+ record_stmt_cost (cost_vec, SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node),
+ vector_stmt, stmt_info, vectype, 0, vect_body);
+ STMT_VINFO_TYPE (stmt_info) = phi_info_type;
+ return true;
+ }
+
+ tree scalar_dest = gimple_phi_result (stmt_info->stmt);
+ basic_block bb = gimple_bb (stmt_info->stmt);
+ tree vec_dest = vect_create_destination_var (scalar_dest, vectype);
+ auto_vec<gphi *> new_phis;
+ for (unsigned i = 0; i < gimple_phi_num_args (stmt_info->stmt); ++i)
+ {
+ slp_tree child = SLP_TREE_CHILDREN (slp_node)[i];
+
+ /* Skip not yet vectorized defs. */
+ if (SLP_TREE_DEF_TYPE (child) == vect_internal_def
+ && SLP_TREE_VEC_STMTS (child).is_empty ())
+ continue;
+
+ auto_vec<tree> vec_oprnds;
+ vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[i], &vec_oprnds);
+ if (!new_phis.exists ())
+ {
+ new_phis.create (vec_oprnds.length ());
+ for (unsigned j = 0; j < vec_oprnds.length (); j++)
+ {
+ /* Create the vectorized LC PHI node. */
+ new_phis.quick_push (create_phi_node (vec_dest, bb));
+ SLP_TREE_VEC_STMTS (slp_node).quick_push (new_phis[j]);
+ }
+ }
+ edge e = gimple_phi_arg_edge (as_a <gphi *> (stmt_info->stmt), i);
+ for (unsigned j = 0; j < vec_oprnds.length (); j++)
+ add_phi_arg (new_phis[j], vec_oprnds[j], e, UNKNOWN_LOCATION);
+ }
+ /* We should have at least one already vectorized child. */
+ gcc_assert (new_phis.exists ());
+
+ return true;
+}
+
/* Function vect_min_worthwhile_factor.
@@ -7588,7 +7764,6 @@ vectorizable_induction (loop_vec_info loop_vinfo,
poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
unsigned i;
tree expr;
- gimple_seq stmts;
gimple_stmt_iterator si;
gphi *phi = dyn_cast <gphi *> (stmt_info->stmt);
@@ -7628,10 +7803,6 @@ vectorizable_induction (loop_vec_info loop_vinfo,
return false;
}
- /* FORNOW: outer loop induction with SLP not supported. */
- if (STMT_SLP_TYPE (stmt_info))
- return false;
-
exit_phi = NULL;
latch_e = loop_latch_edge (loop->inner);
loop_arg = PHI_ARG_DEF_FROM_EDGE (phi, latch_e);
@@ -7670,7 +7841,7 @@ vectorizable_induction (loop_vec_info loop_vinfo,
if (slp_node && !nunits.is_constant ())
{
- /* The current SLP code creates the initial value element-by-element. */
+ /* The current SLP code creates the step value element-by-element. */
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"SLP induction not supported for variable-length"
@@ -7680,9 +7851,50 @@ vectorizable_induction (loop_vec_info loop_vinfo,
if (!vec_stmt) /* transformation not required. */
{
+ unsigned inside_cost = 0, prologue_cost = 0;
+ if (slp_node)
+ {
+ /* We eventually need to set a vector type on invariant
+ arguments. */
+ unsigned j;
+ slp_tree child;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
+ if (!vect_maybe_update_slp_op_vectype
+ (child, SLP_TREE_VECTYPE (slp_node)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "incompatible vector types for "
+ "invariants\n");
+ return false;
+ }
+ /* loop cost for vec_loop. */
+ inside_cost
+ = record_stmt_cost (cost_vec,
+ SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node),
+ vector_stmt, stmt_info, 0, vect_body);
+ /* prologue cost for vec_init (if not nested) and step. */
+ prologue_cost = record_stmt_cost (cost_vec, 1 + !nested_in_vect_loop,
+ scalar_to_vec,
+ stmt_info, 0, vect_prologue);
+ }
+ else /* if (!slp_node) */
+ {
+ /* loop cost for vec_loop. */
+ inside_cost = record_stmt_cost (cost_vec, ncopies, vector_stmt,
+ stmt_info, 0, vect_body);
+ /* prologue cost for vec_init and vec_step. */
+ prologue_cost = record_stmt_cost (cost_vec, 2, scalar_to_vec,
+ stmt_info, 0, vect_prologue);
+ }
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_induction_cost: inside_cost = %d, "
+ "prologue_cost = %d .\n", inside_cost,
+ prologue_cost);
+
STMT_VINFO_TYPE (stmt_info) = induc_vec_info_type;
DUMP_VECT_SCOPE ("vectorizable_induction");
- vect_model_induction_cost (stmt_info, ncopies, cost_vec);
return true;
}
@@ -7701,164 +7913,195 @@ vectorizable_induction (loop_vec_info loop_vinfo,
tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
pe = loop_preheader_edge (iv_loop);
- init_expr = PHI_ARG_DEF_FROM_EDGE (phi,
- loop_preheader_edge (iv_loop));
-
- stmts = NULL;
- if (!nested_in_vect_loop)
- {
- /* Convert the initial value to the IV update type. */
- tree new_type = TREE_TYPE (step_expr);
- init_expr = gimple_convert (&stmts, new_type, init_expr);
-
- /* If we are using the loop mask to "peel" for alignment then we need
- to adjust the start value here. */
- tree skip_niters = LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo);
- if (skip_niters != NULL_TREE)
- {
- if (FLOAT_TYPE_P (vectype))
- skip_niters = gimple_build (&stmts, FLOAT_EXPR, new_type,
- skip_niters);
- else
- skip_niters = gimple_convert (&stmts, new_type, skip_niters);
- tree skip_step = gimple_build (&stmts, MULT_EXPR, new_type,
- skip_niters, step_expr);
- init_expr = gimple_build (&stmts, MINUS_EXPR, new_type,
- init_expr, skip_step);
- }
- }
-
- if (stmts)
- {
- new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
- gcc_assert (!new_bb);
- }
-
/* Find the first insertion point in the BB. */
basic_block bb = gimple_bb (phi);
si = gsi_after_labels (bb);
/* For SLP induction we have to generate several IVs as for example
- with group size 3 we need [i, i, i, i + S] [i + S, i + S, i + 2*S, i + 2*S]
- [i + 2*S, i + 3*S, i + 3*S, i + 3*S]. The step is the same uniform
- [VF*S, VF*S, VF*S, VF*S] for all. */
+ with group size 3 we need
+ [i0, i1, i2, i0 + S0] [i1 + S1, i2 + S2, i0 + 2*S0, i1 + 2*S1]
+ [i2 + 2*S2, i0 + 3*S0, i1 + 3*S1, i2 + 3*S2]. */
if (slp_node)
{
/* Enforced above. */
unsigned int const_nunits = nunits.to_constant ();
- /* Generate [VF*S, VF*S, ... ]. */
- if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr)))
+ /* The initial values are vectorized, but any lanes > group_size
+ need adjustment. */
+ slp_tree init_node
+ = SLP_TREE_CHILDREN (slp_node)[pe->dest_idx];
+
+ /* Gather steps. Since we do not vectorize inductions as
+ cycles we have to reconstruct the step from SCEV data. */
+ unsigned group_size = SLP_TREE_LANES (slp_node);
+ tree *steps = XALLOCAVEC (tree, group_size);
+ tree *inits = XALLOCAVEC (tree, group_size);
+ stmt_vec_info phi_info;
+ FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (slp_node), i, phi_info)
{
- expr = build_int_cst (integer_type_node, vf);
- expr = fold_convert (TREE_TYPE (step_expr), expr);
+ steps[i] = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (phi_info);
+ if (!init_node)
+ inits[i] = gimple_phi_arg_def (as_a<gphi *> (phi_info->stmt),
+ pe->dest_idx);
}
- else
- expr = build_int_cst (TREE_TYPE (step_expr), vf);
- new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
- expr, step_expr);
- if (! CONSTANT_CLASS_P (new_name))
- new_name = vect_init_vector (loop_vinfo, stmt_info, new_name,
- TREE_TYPE (step_expr), NULL);
- new_vec = build_vector_from_val (step_vectype, new_name);
- vec_step = vect_init_vector (loop_vinfo, stmt_info,
- new_vec, step_vectype, NULL);
/* Now generate the IVs. */
- unsigned group_size = SLP_TREE_LANES (slp_node);
unsigned nvects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
- unsigned elts = const_nunits * nvects;
- /* Compute the number of distinct IVs we need. First reduce
- group_size if it is a multiple of const_nunits so we get
- one IV for a group_size of 4 but const_nunits 2. */
- unsigned group_sizep = group_size;
- if (group_sizep % const_nunits == 0)
- group_sizep = group_sizep / const_nunits;
- unsigned nivs = least_common_multiple (group_sizep,
- const_nunits) / const_nunits;
- gcc_assert (elts % group_size == 0);
- tree elt = init_expr;
+ gcc_assert ((const_nunits * nvects) % group_size == 0);
+ unsigned nivs;
+ if (nested_in_vect_loop)
+ nivs = nvects;
+ else
+ {
+ /* Compute the number of distinct IVs we need. First reduce
+ group_size if it is a multiple of const_nunits so we get
+ one IV for a group_size of 4 but const_nunits 2. */
+ unsigned group_sizep = group_size;
+ if (group_sizep % const_nunits == 0)
+ group_sizep = group_sizep / const_nunits;
+ nivs = least_common_multiple (group_sizep,
+ const_nunits) / const_nunits;
+ }
+ tree stept = TREE_TYPE (step_vectype);
+ tree lupdate_mul = NULL_TREE;
+ if (!nested_in_vect_loop)
+ {
+ /* The number of iterations covered in one vector iteration. */
+ unsigned lup_mul = (nvects * const_nunits) / group_size;
+ lupdate_mul
+ = build_vector_from_val (step_vectype,
+ SCALAR_FLOAT_TYPE_P (stept)
+ ? build_real_from_wide (stept, lup_mul,
+ UNSIGNED)
+ : build_int_cstu (stept, lup_mul));
+ }
+ tree peel_mul = NULL_TREE;
+ gimple_seq init_stmts = NULL;
+ if (LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo))
+ {
+ if (SCALAR_FLOAT_TYPE_P (stept))
+ peel_mul = gimple_build (&init_stmts, FLOAT_EXPR, stept,
+ LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo));
+ else
+ peel_mul = gimple_convert (&init_stmts, stept,
+ LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo));
+ peel_mul = gimple_build_vector_from_val (&init_stmts,
+ step_vectype, peel_mul);
+ }
unsigned ivn;
+ auto_vec<tree> vec_steps;
for (ivn = 0; ivn < nivs; ++ivn)
{
- tree_vector_builder elts (step_vectype, const_nunits, 1);
- stmts = NULL;
+ tree_vector_builder step_elts (step_vectype, const_nunits, 1);
+ tree_vector_builder init_elts (vectype, const_nunits, 1);
+ tree_vector_builder mul_elts (step_vectype, const_nunits, 1);
for (unsigned eltn = 0; eltn < const_nunits; ++eltn)
{
- if (ivn*const_nunits + eltn >= group_size
- && (ivn * const_nunits + eltn) % group_size == 0)
- elt = gimple_build (&stmts, PLUS_EXPR, TREE_TYPE (elt),
- elt, step_expr);
- elts.quick_push (elt);
- }
- vec_init = gimple_build_vector (&stmts, &elts);
- vec_init = gimple_convert (&stmts, vectype, vec_init);
- if (stmts)
- {
- new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
- gcc_assert (!new_bb);
+ /* The scalar steps of the IVs. */
+ tree elt = steps[(ivn*const_nunits + eltn) % group_size];
+ step_elts.quick_push (elt);
+ if (!init_node)
+ {
+ /* The scalar inits of the IVs if not vectorized. */
+ elt = inits[(ivn*const_nunits + eltn) % group_size];
+ if (!useless_type_conversion_p (TREE_TYPE (vectype),
+ TREE_TYPE (elt)))
+ elt = gimple_build (&init_stmts, VIEW_CONVERT_EXPR,
+ TREE_TYPE (vectype), elt);
+ init_elts.quick_push (elt);
+ }
+ /* The number of steps to add to the initial values. */
+ unsigned mul_elt = (ivn*const_nunits + eltn) / group_size;
+ mul_elts.quick_push (SCALAR_FLOAT_TYPE_P (stept)
+ ? build_real_from_wide (stept,
+ mul_elt, UNSIGNED)
+ : build_int_cstu (stept, mul_elt));
}
+ vec_step = gimple_build_vector (&init_stmts, &step_elts);
+ vec_step = gimple_convert (&init_stmts, step_vectype, vec_step);
+ vec_steps.safe_push (vec_step);
+ tree step_mul = gimple_build_vector (&init_stmts, &mul_elts);
+ if (peel_mul)
+ step_mul = gimple_build (&init_stmts, PLUS_EXPR, step_vectype,
+ step_mul, peel_mul);
+ if (!init_node)
+ vec_init = gimple_build_vector (&init_stmts, &init_elts);
/* Create the induction-phi that defines the induction-operand. */
- vec_dest = vect_get_new_vect_var (vectype, vect_simple_var, "vec_iv_");
+ vec_dest = vect_get_new_vect_var (vectype, vect_simple_var,
+ "vec_iv_");
induction_phi = create_phi_node (vec_dest, iv_loop->header);
induc_def = PHI_RESULT (induction_phi);
/* Create the iv update inside the loop */
+ tree up = vec_step;
+ if (lupdate_mul)
+ up = gimple_build (&init_stmts, MULT_EXPR, step_vectype,
+ vec_step, lupdate_mul);
gimple_seq stmts = NULL;
vec_def = gimple_convert (&stmts, step_vectype, induc_def);
vec_def = gimple_build (&stmts,
- PLUS_EXPR, step_vectype, vec_def, vec_step);
+ PLUS_EXPR, step_vectype, vec_def, up);
vec_def = gimple_convert (&stmts, vectype, vec_def);
gsi_insert_seq_before (&si, stmts, GSI_SAME_STMT);
+ add_phi_arg (induction_phi, vec_def, loop_latch_edge (iv_loop),
+ UNKNOWN_LOCATION);
+
+ if (init_node)
+ vec_init = vect_get_slp_vect_def (init_node, ivn);
+ if (!nested_in_vect_loop
+ && !integer_zerop (step_mul))
+ {
+ vec_def = gimple_convert (&init_stmts, step_vectype, vec_init);
+ up = gimple_build (&init_stmts, MULT_EXPR, step_vectype,
+ vec_step, step_mul);
+ vec_def = gimple_build (&init_stmts, PLUS_EXPR, step_vectype,
+ vec_def, up);
+ vec_init = gimple_convert (&init_stmts, vectype, vec_def);
+ }
/* Set the arguments of the phi node: */
add_phi_arg (induction_phi, vec_init, pe, UNKNOWN_LOCATION);
- add_phi_arg (induction_phi, vec_def, loop_latch_edge (iv_loop),
- UNKNOWN_LOCATION);
SLP_TREE_VEC_STMTS (slp_node).quick_push (induction_phi);
}
- /* Fill up to the number of vectors we need for the whole group. */
- nivs = least_common_multiple (group_size,
- const_nunits) / const_nunits;
- for (; ivn < nivs; ++ivn)
- SLP_TREE_VEC_STMTS (slp_node)
- .quick_push (SLP_TREE_VEC_STMTS (slp_node)[0]);
+ if (!nested_in_vect_loop)
+ {
+ /* Fill up to the number of vectors we need for the whole group. */
+ nivs = least_common_multiple (group_size,
+ const_nunits) / const_nunits;
+ for (; ivn < nivs; ++ivn)
+ {
+ SLP_TREE_VEC_STMTS (slp_node)
+ .quick_push (SLP_TREE_VEC_STMTS (slp_node)[0]);
+ vec_steps.safe_push (vec_steps[0]);
+ }
+ }
- /* Re-use IVs when we can. */
+ /* Re-use IVs when we can. We are generating further vector
+ stmts by adding VF' * stride to the IVs generated above. */
if (ivn < nvects)
{
unsigned vfp
= least_common_multiple (group_size, const_nunits) / group_size;
- /* Generate [VF'*S, VF'*S, ... ]. */
- if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (step_expr)))
- {
- expr = build_int_cst (integer_type_node, vfp);
- expr = fold_convert (TREE_TYPE (step_expr), expr);
- }
- else
- expr = build_int_cst (TREE_TYPE (step_expr), vfp);
- new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
- expr, step_expr);
- if (! CONSTANT_CLASS_P (new_name))
- new_name = vect_init_vector (loop_vinfo, stmt_info, new_name,
- TREE_TYPE (step_expr), NULL);
- new_vec = build_vector_from_val (step_vectype, new_name);
- vec_step = vect_init_vector (loop_vinfo, stmt_info, new_vec,
- step_vectype, NULL);
+ tree lupdate_mul
+ = build_vector_from_val (step_vectype,
+ SCALAR_FLOAT_TYPE_P (stept)
+ ? build_real_from_wide (stept,
+ vfp, UNSIGNED)
+ : build_int_cstu (stept, vfp));
for (; ivn < nvects; ++ivn)
{
gimple *iv = SLP_TREE_VEC_STMTS (slp_node)[ivn - nivs];
- tree def;
- if (gimple_code (iv) == GIMPLE_PHI)
- def = gimple_phi_result (iv);
- else
- def = gimple_assign_lhs (iv);
+ tree def = gimple_get_lhs (iv);
+ if (ivn < 2*nivs)
+ vec_steps[ivn - nivs]
+ = gimple_build (&init_stmts, MULT_EXPR, step_vectype,
+ vec_steps[ivn - nivs], lupdate_mul);
gimple_seq stmts = NULL;
def = gimple_convert (&stmts, step_vectype, def);
- def = gimple_build (&stmts,
- PLUS_EXPR, step_vectype, def, vec_step);
+ def = gimple_build (&stmts, PLUS_EXPR, step_vectype,
+ def, vec_steps[ivn % nivs]);
def = gimple_convert (&stmts, vectype, def);
if (gimple_code (iv) == GIMPLE_PHI)
gsi_insert_seq_before (&si, stmts, GSI_SAME_STMT);
@@ -7872,9 +8115,45 @@ vectorizable_induction (loop_vec_info loop_vinfo,
}
}
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, init_stmts);
+ gcc_assert (!new_bb);
+
return true;
}
+ init_expr = PHI_ARG_DEF_FROM_EDGE (phi,
+ loop_preheader_edge (iv_loop));
+
+ gimple_seq stmts = NULL;
+ if (!nested_in_vect_loop)
+ {
+ /* Convert the initial value to the IV update type. */
+ tree new_type = TREE_TYPE (step_expr);
+ init_expr = gimple_convert (&stmts, new_type, init_expr);
+
+ /* If we are using the loop mask to "peel" for alignment then we need
+ to adjust the start value here. */
+ tree skip_niters = LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo);
+ if (skip_niters != NULL_TREE)
+ {
+ if (FLOAT_TYPE_P (vectype))
+ skip_niters = gimple_build (&stmts, FLOAT_EXPR, new_type,
+ skip_niters);
+ else
+ skip_niters = gimple_convert (&stmts, new_type, skip_niters);
+ tree skip_step = gimple_build (&stmts, MULT_EXPR, new_type,
+ skip_niters, step_expr);
+ init_expr = gimple_build (&stmts, MINUS_EXPR, new_type,
+ init_expr, skip_step);
+ }
+ }
+
+ if (stmts)
+ {
+ new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
+ gcc_assert (!new_bb);
+ }
+
/* Create the vector that holds the initial_value of the induction. */
if (nested_in_vect_loop)
{
@@ -8374,8 +8653,19 @@ vectorizable_live_operation (vec_info *vinfo,
gimple_seq stmts = NULL;
new_tree = force_gimple_operand (fold_convert (lhs_type, new_tree),
&stmts, true, NULL_TREE);
-
- gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
+ if (TREE_CODE (new_tree) == SSA_NAME
+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+ SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree) = 1;
+ if (is_a <gphi *> (vec_stmt))
+ {
+ gimple_stmt_iterator si = gsi_after_labels (gimple_bb (vec_stmt));
+ gsi_insert_seq_before (&si, stmts, GSI_SAME_STMT);
+ }
+ else
+ {
+ gimple_stmt_iterator si = gsi_for_stmt (vec_stmt);
+ gsi_insert_seq_after (&si, stmts, GSI_SAME_STMT);
+ }
/* Replace use of lhs with newly computed result. If the use stmt is a
single arg PHI, just replace all uses of PHI result. It's necessary
@@ -8395,8 +8685,11 @@ 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))
{
enum tree_code code = gimple_assign_rhs_code (use_stmt);
gcc_assert (code == CONSTRUCTOR
@@ -9079,8 +9372,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 ac56ace..f68a87e 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -5007,6 +5007,8 @@ possible_vector_mask_operation_p (stmt_vec_info stmt_info)
return TREE_CODE_CLASS (rhs_code) == tcc_comparison;
}
}
+ else if (is_a <gphi *> (stmt_info->stmt))
+ return true;
return false;
}
@@ -5017,47 +5019,40 @@ possible_vector_mask_operation_p (stmt_vec_info stmt_info)
static void
vect_determine_mask_precision (vec_info *vinfo, stmt_vec_info stmt_info)
{
- if (!possible_vector_mask_operation_p (stmt_info)
- || stmt_info->mask_precision)
+ if (!possible_vector_mask_operation_p (stmt_info))
return;
- auto_vec<stmt_vec_info, 32> worklist;
- worklist.quick_push (stmt_info);
- while (!worklist.is_empty ())
- {
- stmt_info = worklist.last ();
- unsigned int orig_length = worklist.length ();
-
- /* If at least one boolean input uses a vector mask type,
- pick the mask type with the narrowest elements.
+ /* If at least one boolean input uses a vector mask type,
+ pick the mask type with the narrowest elements.
- ??? This is the traditional behavior. It should always produce
- the smallest number of operations, but isn't necessarily the
- optimal choice. For example, if we have:
+ ??? This is the traditional behavior. It should always produce
+ the smallest number of operations, but isn't necessarily the
+ optimal choice. For example, if we have:
- a = b & c
+ a = b & c
- where:
+ where:
- - the user of a wants it to have a mask type for 16-bit elements (M16)
- - b also uses M16
- - c uses a mask type for 8-bit elements (M8)
+ - the user of a wants it to have a mask type for 16-bit elements (M16)
+ - b also uses M16
+ - c uses a mask type for 8-bit elements (M8)
- then picking M8 gives:
+ then picking M8 gives:
- - 1 M16->M8 pack for b
- - 1 M8 AND for a
- - 2 M8->M16 unpacks for the user of a
+ - 1 M16->M8 pack for b
+ - 1 M8 AND for a
+ - 2 M8->M16 unpacks for the user of a
- whereas picking M16 would have given:
+ whereas picking M16 would have given:
- - 2 M8->M16 unpacks for c
- - 2 M16 ANDs for a
+ - 2 M8->M16 unpacks for c
+ - 2 M16 ANDs for a
- The number of operations are equal, but M16 would have given
- a shorter dependency chain and allowed more ILP. */
- unsigned int precision = ~0U;
- gassign *assign = as_a <gassign *> (stmt_info->stmt);
+ The number of operations are equal, but M16 would have given
+ a shorter dependency chain and allowed more ILP. */
+ unsigned int precision = ~0U;
+ if (gassign *assign = dyn_cast <gassign *> (stmt_info->stmt))
+ {
unsigned int nops = gimple_num_ops (assign);
for (unsigned int i = 1; i < nops; ++i)
{
@@ -5076,14 +5071,8 @@ vect_determine_mask_precision (vec_info *vinfo, stmt_vec_info stmt_info)
if (precision > def_stmt_info->mask_precision)
precision = def_stmt_info->mask_precision;
}
- else if (possible_vector_mask_operation_p (def_stmt_info))
- worklist.safe_push (def_stmt_info);
}
- /* Defer the choice if we need to visit operands first. */
- if (orig_length != worklist.length ())
- continue;
-
/* If the statement compares two values that shouldn't use vector masks,
try comparing the values as normal scalars instead. */
tree_code rhs_code = gimple_assign_rhs_code (assign);
@@ -5099,22 +5088,41 @@ vect_determine_mask_precision (vec_info *vinfo, stmt_vec_info stmt_info)
&& expand_vec_cmp_expr_p (vectype, mask_type, rhs_code))
precision = GET_MODE_BITSIZE (mode);
}
-
- if (dump_enabled_p ())
+ }
+ else
+ {
+ gphi *phi = as_a <gphi *> (stmt_info->stmt);
+ for (unsigned i = 0; i < gimple_phi_num_args (phi); ++i)
{
- if (precision == ~0U)
- dump_printf_loc (MSG_NOTE, vect_location,
- "using normal nonmask vectors for %G",
- stmt_info->stmt);
- else
- dump_printf_loc (MSG_NOTE, vect_location,
- "using boolean precision %d for %G",
- precision, stmt_info->stmt);
+ tree rhs = gimple_phi_arg_def (phi, i);
+
+ stmt_vec_info def_stmt_info = vinfo->lookup_def (rhs);
+ if (!def_stmt_info)
+ /* Don't let external or constant operands influence the choice.
+ We can convert them to whichever vector type we pick. */
+ continue;
+
+ if (def_stmt_info->mask_precision)
+ {
+ if (precision > def_stmt_info->mask_precision)
+ precision = def_stmt_info->mask_precision;
+ }
}
+ }
- stmt_info->mask_precision = precision;
- worklist.pop ();
+ if (dump_enabled_p ())
+ {
+ if (precision == ~0U)
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "using normal nonmask vectors for %G",
+ stmt_info->stmt);
+ else
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "using boolean precision %d for %G",
+ precision, stmt_info->stmt);
}
+
+ stmt_info->mask_precision = precision;
}
/* Handle vect_determine_precisions for STMT_INFO, given that we
@@ -5129,7 +5137,6 @@ vect_determine_stmt_precisions (vec_info *vinfo, stmt_vec_info stmt_info)
vect_determine_precisions_from_range (stmt_info, stmt);
vect_determine_precisions_from_users (stmt_info, stmt);
}
- vect_determine_mask_precision (vinfo, stmt_info);
}
/* Walk backwards through the vectorizable region to determine the
@@ -5153,6 +5160,14 @@ vect_determine_precisions (vec_info *vinfo)
for (unsigned int i = 0; i < nbbs; i++)
{
+ basic_block bb = bbs[i];
+ for (auto si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ if (!is_gimple_debug (gsi_stmt (si)))
+ vect_determine_mask_precision
+ (vinfo, vinfo->lookup_stmt (gsi_stmt (si)));
+ }
+ for (unsigned int i = 0; i < nbbs; i++)
+ {
basic_block bb = bbs[nbbs - i - 1];
for (gimple_stmt_iterator si = gsi_last_bb (bb);
!gsi_end_p (si); gsi_prev (&si))
@@ -5164,14 +5179,39 @@ vect_determine_precisions (vec_info *vinfo)
else
{
bb_vec_info bb_vinfo = as_a <bb_vec_info> (vinfo);
+ for (unsigned i = 0; i < bb_vinfo->bbs.length (); ++i)
+ {
+ basic_block bb = bb_vinfo->bbs[i];
+ for (auto gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi.phi ());
+ if (stmt_info && STMT_VINFO_VECTORIZABLE (stmt_info))
+ vect_determine_mask_precision (vinfo, stmt_info);
+ }
+ for (auto gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi_stmt (gsi));
+ if (stmt_info && STMT_VINFO_VECTORIZABLE (stmt_info))
+ vect_determine_mask_precision (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);
- }
+ {
+ 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);
+ }
+ for (auto gsi = gsi_start_phis (bb_vinfo->bbs[i]);
+ !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi.phi ());
+ if (stmt_info && STMT_VINFO_VECTORIZABLE (stmt_info))
+ vect_determine_stmt_precisions (vinfo, stmt_info);
+ }
+ }
}
}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index ff0ecda..e4c2aa4 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -52,6 +52,23 @@ along with GCC; see the file COPYING3. If not see
static bool vectorizable_slp_permutation (vec_info *, gimple_stmt_iterator *,
slp_tree, stmt_vector_for_cost *);
+object_allocator<_slp_tree> *slp_tree_pool;
+
+void *
+_slp_tree::operator new (size_t n)
+{
+ gcc_assert (n == sizeof (_slp_tree));
+ return slp_tree_pool->allocate_raw ();
+}
+
+void
+_slp_tree::operator delete (void *node, size_t n)
+{
+ gcc_assert (n == sizeof (_slp_tree));
+ slp_tree_pool->remove_raw (node);
+}
+
+
/* Initialize a SLP node. */
_slp_tree::_slp_tree ()
@@ -98,7 +115,8 @@ vect_free_slp_tree (slp_tree node)
return;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- vect_free_slp_tree (child);
+ if (child)
+ vect_free_slp_tree (child);
delete node;
}
@@ -131,9 +149,9 @@ vect_free_slp_instance (slp_instance instance)
/* Create an SLP node for SCALAR_STMTS. */
static slp_tree
-vect_create_new_slp_node (vec<stmt_vec_info> scalar_stmts, unsigned nops)
+vect_create_new_slp_node (slp_tree node,
+ vec<stmt_vec_info> scalar_stmts, unsigned nops)
{
- slp_tree node = new _slp_tree;
SLP_TREE_SCALAR_STMTS (node) = scalar_stmts;
SLP_TREE_CHILDREN (node).create (nops);
SLP_TREE_DEF_TYPE (node) = vect_internal_def;
@@ -142,18 +160,33 @@ vect_create_new_slp_node (vec<stmt_vec_info> scalar_stmts, unsigned nops)
return node;
}
+/* Create an SLP node for SCALAR_STMTS. */
+
+static slp_tree
+vect_create_new_slp_node (vec<stmt_vec_info> scalar_stmts, unsigned nops)
+{
+ return vect_create_new_slp_node (new _slp_tree, scalar_stmts, nops);
+}
+
/* Create an SLP node for OPS. */
static slp_tree
-vect_create_new_slp_node (vec<tree> ops)
+vect_create_new_slp_node (slp_tree node, vec<tree> ops)
{
- slp_tree node = new _slp_tree;
SLP_TREE_SCALAR_OPS (node) = ops;
SLP_TREE_DEF_TYPE (node) = vect_external_def;
SLP_TREE_LANES (node) = ops.length ();
return node;
}
+/* Create an SLP node for OPS. */
+
+static slp_tree
+vect_create_new_slp_node (vec<tree> ops)
+{
+ return vect_create_new_slp_node (new _slp_tree, ops);
+}
+
/* This structure is used in creation of an SLP tree. Each instance
corresponds to the same operand in a group of scalar stmts in an SLP
@@ -356,6 +389,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
@@ -370,6 +413,7 @@ can_duplicate_and_interleave_p (vec_info *vinfo, unsigned int count,
ok return 0. */
static int
vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
+ bool *skip_args,
vec<stmt_vec_info> stmts, unsigned stmt_num,
vec<slp_oprnd_info> *oprnds_info)
{
@@ -416,14 +460,17 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
else
commutative_op = commutative_tree_code (code) ? 0U : -1U;
}
+ else if (gphi *stmt = dyn_cast <gphi *> (stmt_info->stmt))
+ number_of_oprnds = gimple_phi_num_args (stmt);
else
return -1;
bool swapped = (swap != 0);
+ bool backedge = false;
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. */
@@ -436,6 +483,13 @@ again:
else
oprnd = gimple_op (stmt_info->stmt, map[i]);
}
+ else if (gphi *stmt = dyn_cast <gphi *> (stmt_info->stmt))
+ {
+ oprnd = gimple_phi_arg_def (stmt, i);
+ backedge = dominated_by_p (CDI_DOMINATORS,
+ gimple_phi_arg_edge (stmt, i)->src,
+ gimple_bb (stmt_info->stmt));
+ }
else
oprnd = gimple_op (stmt_info->stmt, first_op_idx + (swapped ? !i : i));
if (TREE_CODE (oprnd) == VIEW_CONVERT_EXPR)
@@ -444,7 +498,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,
@@ -454,66 +508,45 @@ again:
return -1;
}
+ if (skip_args[i])
+ {
+ oprnd_info->def_stmts.quick_push (NULL);
+ oprnd_info->ops.quick_push (NULL_TREE);
+ oprnd_info->first_dt = vect_uninitialized_def;
+ continue;
+ }
+
if (def_stmt_info && is_pattern_stmt_p (def_stmt_info))
oprnd_info->any_pattern = true;
- if (first)
+ oprnd_info->def_stmts.quick_push (def_stmt_info);
+ oprnd_info->ops.quick_push (oprnd);
+
+ /* If there's a extern def on a backedge make sure we can
+ code-generate at the region start.
+ ??? This is another case that could be fixed by adjusting
+ how we split the function but at the moment we'd have conflicting
+ goals there. */
+ if (backedge
+ && dts[i] == vect_external_def
+ && is_a <bb_vec_info> (vinfo)
+ && TREE_CODE (oprnd) == SSA_NAME
+ && !SSA_NAME_IS_DEFAULT_DEF (oprnd)
+ && !dominated_by_p (CDI_DOMINATORS,
+ as_a <bb_vec_info> (vinfo)->bbs[0],
+ gimple_bb (SSA_NAME_DEF_STMT (oprnd))))
{
- /* 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);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Build SLP failed: extern def %T only defined "
+ "on backedge\n", oprnd);
+ return -1;
}
- else
+
+ if (first)
{
- /* 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 ()
@@ -527,53 +560,147 @@ 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:
+ case vect_nested_cycle:
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;)
+ {
+ if (skip_args[i])
+ {
+ ++i;
+ continue;
+ }
+
+ 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. */
@@ -751,6 +878,7 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
machine_mode vec_mode;
stmt_vec_info first_load = NULL, prev_first_load = NULL;
bool first_stmt_load_p = false, load_p = false;
+ bool first_stmt_phi_p = false, phi_p = false;
/* For every stmt in NODE find its def stmt/s. */
stmt_vec_info stmt_info;
@@ -840,6 +968,11 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
return false;
}
}
+ else if (gimple_code (stmt) == GIMPLE_PHI)
+ {
+ rhs_code = ERROR_MARK;
+ phi_p = true;
+ }
else
{
rhs_code = gimple_assign_rhs_code (stmt);
@@ -852,6 +985,7 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
*node_vectype = vectype;
first_stmt_code = rhs_code;
first_stmt_load_p = load_p;
+ first_stmt_phi_p = phi_p;
/* Shift arguments should be equal in all the packed stmts for a
vector shift with scalar shift operand. */
@@ -957,7 +1091,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
|| first_stmt_code == INDIRECT_REF
|| first_stmt_code == COMPONENT_REF
|| first_stmt_code == MEM_REF)))
- || first_stmt_load_p != load_p)
+ || first_stmt_load_p != load_p
+ || first_stmt_phi_p != phi_p)
{
if (dump_enabled_p ())
{
@@ -1013,6 +1148,18 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
}
}
+ if (phi_p
+ && (gimple_bb (first_stmt_info->stmt)
+ != gimple_bb (stmt_info->stmt)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Build SLP failed: different BB for PHI "
+ "in %G", stmt);
+ /* Mismatch. */
+ continue;
+ }
+
if (!types_compatible_p (vectype, *node_vectype))
{
if (dump_enabled_p ())
@@ -1074,7 +1221,8 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
}
/* Not memory operation. */
- if (TREE_CODE_CLASS (rhs_code) != tcc_binary
+ if (!phi_p
+ && TREE_CODE_CLASS (rhs_code) != tcc_binary
&& TREE_CODE_CLASS (rhs_code) != tcc_unary
&& TREE_CODE_CLASS (rhs_code) != tcc_expression
&& TREE_CODE_CLASS (rhs_code) != tcc_comparison
@@ -1187,7 +1335,7 @@ typedef hash_map <vec <gimple *>, slp_tree,
scalar_stmts_to_slp_tree_map_t;
static slp_tree
-vect_build_slp_tree_2 (vec_info *vinfo,
+vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
vec<stmt_vec_info> stmts, unsigned int group_size,
poly_uint64 *max_nunits,
bool *matches, unsigned *npermutes, unsigned *tree_size,
@@ -1212,19 +1360,37 @@ vect_build_slp_tree (vec_info *vinfo,
}
return *leader;
}
+
+ /* Seed the bst_map with a stub node to be filled by vect_build_slp_tree_2
+ so we can pick up backedge destinations during discovery. */
+ slp_tree res = new _slp_tree;
+ SLP_TREE_DEF_TYPE (res) = vect_internal_def;
+ SLP_TREE_SCALAR_STMTS (res) = stmts;
+ bst_map->put (stmts.copy (), res);
+
poly_uint64 this_max_nunits = 1;
- slp_tree res = vect_build_slp_tree_2 (vinfo, stmts, group_size,
+ slp_tree res_ = vect_build_slp_tree_2 (vinfo, res, stmts, group_size,
&this_max_nunits,
matches, npermutes, tree_size, bst_map);
- if (res)
+ if (!res_)
{
+ bool existed_p = bst_map->put (stmts, NULL);
+ gcc_assert (existed_p);
+ /* Mark the node invalid so we can detect those when still in use
+ as backedge destinations. */
+ SLP_TREE_SCALAR_STMTS (res) = vNULL;
+ SLP_TREE_DEF_TYPE (res) = vect_uninitialized_def;
+ vect_free_slp_tree (res);
+ }
+ else
+ {
+ gcc_assert (res_ == res);
res->max_nunits = this_max_nunits;
vect_update_max_nunits (max_nunits, this_max_nunits);
/* Keep a reference for the bst_map use. */
SLP_TREE_REF_COUNT (res)++;
}
- bst_map->put (stmts.copy (), res);
- return res;
+ return res_;
}
/* Recursively build an SLP tree starting from NODE.
@@ -1235,7 +1401,7 @@ vect_build_slp_tree (vec_info *vinfo,
was found. */
static slp_tree
-vect_build_slp_tree_2 (vec_info *vinfo,
+vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
vec<stmt_vec_info> stmts, unsigned int group_size,
poly_uint64 *max_nunits,
bool *matches, unsigned *npermutes, unsigned *tree_size,
@@ -1243,7 +1409,6 @@ vect_build_slp_tree_2 (vec_info *vinfo,
{
unsigned nops, i, this_tree_size = 0;
poly_uint64 this_max_nunits = *max_nunits;
- slp_tree node;
matches[0] = false;
@@ -1263,41 +1428,59 @@ vect_build_slp_tree_2 (vec_info *vinfo,
/* If the SLP node is a PHI (induction or reduction), terminate
the recursion. */
- 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,
- group_size);
- if (!vect_record_max_nunits (vinfo, stmt_info, group_size, vectype,
- max_nunits))
- return NULL;
+ bool *skip_args = XALLOCAVEC (bool, nops);
+ memset (skip_args, 0, sizeof (bool) * nops);
+ if (loop_vec_info loop_vinfo = dyn_cast <loop_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,
+ group_size);
+ if (!vect_record_max_nunits (vinfo, stmt_info, group_size, vectype,
+ max_nunits))
+ return NULL;
- vect_def_type def_type = STMT_VINFO_DEF_TYPE (stmt_info);
- /* Induction from different IVs is not supported. */
- if (def_type == vect_induction_def)
- {
- stmt_vec_info other_info;
- FOR_EACH_VEC_ELT (stmts, i, other_info)
- if (stmt_info != other_info)
- return NULL;
- }
- else if (def_type == vect_reduction_def
- || def_type == vect_double_reduction_def
- || def_type == vect_nested_cycle)
- {
- /* Else def types have to match. */
- stmt_vec_info other_info;
- FOR_EACH_VEC_ELT (stmts, i, other_info)
- if (STMT_VINFO_DEF_TYPE (other_info) != def_type)
- return NULL;
- }
- else
- return NULL;
- (*tree_size)++;
- node = vect_create_new_slp_node (stmts, nops);
- SLP_TREE_VECTYPE (node) = vectype;
- return node;
- }
+ vect_def_type def_type = STMT_VINFO_DEF_TYPE (stmt_info);
+ if (def_type == vect_induction_def)
+ {
+ /* Induction PHIs are not cycles but walk the initial
+ value. Only for inner loops through, for outer loops
+ we need to pick up the value from the actual PHIs
+ to more easily support peeling and epilogue vectorization. */
+ class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ if (!nested_in_vect_loop_p (loop, stmt_info))
+ skip_args[loop_preheader_edge (loop)->dest_idx] = true;
+ else
+ loop = loop->inner;
+ skip_args[loop_latch_edge (loop)->dest_idx] = true;
+ }
+ else if (def_type == vect_reduction_def
+ || def_type == vect_double_reduction_def
+ || def_type == vect_nested_cycle)
+ {
+ /* Else def types have to match. */
+ stmt_vec_info other_info;
+ bool all_same = true;
+ FOR_EACH_VEC_ELT (stmts, i, other_info)
+ {
+ if (STMT_VINFO_DEF_TYPE (other_info) != def_type)
+ return NULL;
+ if (other_info != stmt_info)
+ all_same = false;
+ }
+ class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ /* Reduction initial values are not explicitely represented. */
+ if (!nested_in_vect_loop_p (loop, stmt_info))
+ skip_args[loop_preheader_edge (loop)->dest_idx] = true;
+ /* Reduction chain backedge defs are filled manually.
+ ??? Need a better way to identify a SLP reduction chain PHI.
+ Or a better overall way to SLP match those. */
+ if (all_same && def_type == vect_reduction_def)
+ skip_args[loop_latch_edge (loop)->dest_idx] = true;
+ }
+ else if (def_type != vect_internal_def)
+ return NULL;
+ }
bool two_operators = false;
@@ -1322,7 +1505,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
{
*max_nunits = this_max_nunits;
(*tree_size)++;
- node = vect_create_new_slp_node (stmts, 0);
+ node = vect_create_new_slp_node (node, stmts, 0);
SLP_TREE_VECTYPE (node) = vectype;
/* And compute the load permutation. Whether it is actually
a permutation depends on the unrolling factor which is
@@ -1376,7 +1559,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
representing an actual vector without any scalar ops.
??? We could hide it completely with making the permute node
external? */
- node = vect_create_new_slp_node (stmts, 1);
+ node = vect_create_new_slp_node (node, stmts, 1);
SLP_TREE_CODE (node) = VEC_PERM_EXPR;
SLP_TREE_LANE_PERMUTATION (node) = lperm;
SLP_TREE_VECTYPE (node) = vectype;
@@ -1389,7 +1572,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
slp_oprnd_info oprnd_info;
FOR_EACH_VEC_ELT (stmts, i, stmt_info)
{
- int res = vect_get_and_check_slp_defs (vinfo, swap[i],
+ int res = vect_get_and_check_slp_defs (vinfo, swap[i], skip_args,
stmts, i, &oprnds_info);
if (res != 0)
matches[(res == -1) ? 0 : i] = false;
@@ -1414,6 +1597,14 @@ vect_build_slp_tree_2 (vec_info *vinfo,
slp_tree child;
unsigned int j;
+ /* We're skipping certain operands from processing, for example
+ outer loop reduction initial defs. */
+ if (skip_args[i])
+ {
+ children.safe_push (NULL);
+ continue;
+ }
+
if (oprnd_info->first_dt == vect_uninitialized_def)
{
/* COND_EXPR have one too many eventually if the condition
@@ -1422,9 +1613,33 @@ vect_build_slp_tree_2 (vec_info *vinfo,
continue;
}
- if (oprnd_info->first_dt != vect_internal_def
- && oprnd_info->first_dt != vect_reduction_def
- && oprnd_info->first_dt != vect_induction_def)
+ if (is_a <bb_vec_info> (vinfo)
+ && oprnd_info->first_dt == vect_internal_def
+ && !oprnd_info->any_pattern)
+ {
+ /* For BB vectorization, if all defs are the same do not
+ bother to continue the build along the single-lane
+ graph but use a splat of the scalar value. */
+ stmt_vec_info first_def = oprnd_info->def_stmts[0];
+ for (j = 1; j < group_size; ++j)
+ if (oprnd_info->def_stmts[j] != first_def)
+ break;
+ if (j == group_size
+ /* But avoid doing this for loads where we may be
+ able to CSE things, unless the stmt is not
+ vectorizable. */
+ && (!STMT_VINFO_VECTORIZABLE (first_def)
+ || !gimple_vuse (first_def->stmt)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Using a splat of the uniform operand\n");
+ oprnd_info->first_dt = vect_external_def;
+ }
+ }
+
+ if (oprnd_info->first_dt == vect_external_def
+ || oprnd_info->first_dt == vect_constant_def)
{
slp_tree invnode = vect_create_new_slp_node (oprnd_info->ops);
SLP_TREE_DEF_TYPE (invnode) = oprnd_info->first_dt;
@@ -1553,14 +1768,14 @@ fail:
child = vect_create_new_slp_node (oprnd_info->ops);
children.safe_push (child);
oprnd_info->ops = vNULL;
- oprnd_info->def_stmts = vNULL;
continue;
}
}
gcc_assert (child == NULL);
FOR_EACH_VEC_ELT (children, j, child)
- vect_free_slp_tree (child);
+ if (child)
+ vect_free_slp_tree (child);
vect_free_oprnd_info (oprnds_info);
return NULL;
}
@@ -1568,7 +1783,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)
@@ -1579,16 +1795,28 @@ 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 (!child)
+ ;
+ else 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;
FOR_EACH_VEC_ELT (children, j, child)
- vect_free_slp_tree (child);
+ if (child)
+ vect_free_slp_tree (child);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
@@ -1622,7 +1850,7 @@ fail:
/* Here we record the original defs since this
node represents the final lane configuration. */
- node = vect_create_new_slp_node (stmts, 2);
+ node = vect_create_new_slp_node (node, stmts, 2);
SLP_TREE_VECTYPE (node) = vectype;
SLP_TREE_CODE (node) = VEC_PERM_EXPR;
SLP_TREE_CHILDREN (node).quick_push (one);
@@ -1653,7 +1881,7 @@ fail:
return node;
}
- node = vect_create_new_slp_node (stmts, nops);
+ node = vect_create_new_slp_node (node, stmts, nops);
SLP_TREE_VECTYPE (node) = vectype;
SLP_TREE_CHILDREN (node).splice (children);
return node;
@@ -1739,7 +1967,8 @@ vect_print_slp_graph (dump_flags_t dump_kind, dump_location_t loc,
vect_print_slp_tree (dump_kind, loc, node);
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- vect_print_slp_graph (dump_kind, loc, child, visited);
+ if (child)
+ vect_print_slp_graph (dump_kind, loc, child, visited);
}
static void
@@ -1769,7 +1998,8 @@ vect_mark_slp_stmts (slp_tree node, hash_set<slp_tree> &visited)
STMT_SLP_TYPE (stmt_info) = pure_slp;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- vect_mark_slp_stmts (child, visited);
+ if (child)
+ vect_mark_slp_stmts (child, visited);
}
static void
@@ -1802,7 +2032,8 @@ vect_mark_slp_stmts_relevant (slp_tree node, hash_set<slp_tree> &visited)
}
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- vect_mark_slp_stmts_relevant (child, visited);
+ if (child)
+ vect_mark_slp_stmts_relevant (child, visited);
}
static void
@@ -1819,7 +2050,7 @@ static void
vect_gather_slp_loads (vec<slp_tree> &loads, slp_tree node,
hash_set<slp_tree> &visited)
{
- if (visited.add (node))
+ if (!node || visited.add (node))
return;
if (SLP_TREE_CHILDREN (node).length () == 0)
@@ -1940,141 +2171,44 @@ calculate_unrolling_factor (poly_uint64 nunits, unsigned int group_size)
return exact_div (common_multiple (nunits, group_size), group_size);
}
-/* Analyze an SLP instance starting from a group of grouped stores. Call
- vect_build_slp_tree to build a tree of packed stmts if possible.
- Return FALSE if it's impossible to SLP any stmt in the loop. */
-
static bool
vect_analyze_slp_instance (vec_info *vinfo,
scalar_stmts_to_slp_tree_map_t *bst_map,
- stmt_vec_info stmt_info, unsigned max_tree_size)
-{
- 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;
- bool constructor = false;
+ stmt_vec_info stmt_info, slp_instance_kind kind,
+ unsigned max_tree_size);
- if (is_a <bb_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;
- if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
- {
- /* Collect the stores and store them in SLP_TREE_SCALAR_STMTS. */
- while (next_info)
- {
- scalar_stmts.safe_push (vect_stmt_to_vectorize (next_info));
- next_info = DR_GROUP_NEXT_ELEMENT (next_info);
- }
- }
- else if (!dr && REDUC_GROUP_FIRST_ELEMENT (stmt_info))
- {
- /* Collect the reduction stmts and store them in
- SLP_TREE_SCALAR_STMTS. */
- while (next_info)
- {
- scalar_stmts.safe_push (vect_stmt_to_vectorize (next_info));
- next_info = REDUC_GROUP_NEXT_ELEMENT (next_info);
- }
- /* Mark the first element of the reduction chain as reduction to properly
- transform the node. In the reduction analysis phase only the last
- element of the chain is marked as reduction. */
- STMT_VINFO_DEF_TYPE (stmt_info)
- = STMT_VINFO_DEF_TYPE (scalar_stmts.last ());
- STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info))
- = STMT_VINFO_REDUC_DEF (vect_orig_stmt (scalar_stmts.last ()));
- }
- else if (constructor)
- {
- tree rhs = gimple_assign_rhs1 (stmt_info->stmt);
- tree val;
- FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs), i, val)
- {
- if (TREE_CODE (val) == SSA_NAME)
- {
- gimple* def = SSA_NAME_DEF_STMT (val);
- stmt_vec_info def_info = vinfo->lookup_stmt (def);
- /* Value is defined in another basic block. */
- if (!def_info)
- return false;
- def_info = vect_stmt_to_vectorize (def_info);
- scalar_stmts.safe_push (def_info);
- }
- else
- return false;
- }
- if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "Analyzing vectorizable constructor: %G\n",
- stmt_info->stmt);
- }
- else
- {
- /* Collect reduction statements. */
- vec<stmt_vec_info> reductions = as_a <loop_vec_info> (vinfo)->reductions;
- for (i = 0; reductions.iterate (i, &next_info); i++)
- scalar_stmts.safe_push (next_info);
- }
+/* Analyze an SLP instance starting from SCALAR_STMTS which are a group
+ of KIND. Return true if successful. */
+static bool
+vect_build_slp_instance (vec_info *vinfo,
+ slp_instance_kind kind,
+ vec<stmt_vec_info> scalar_stmts,
+ stmt_vec_info root_stmt_info,
+ unsigned max_tree_size,
+ scalar_stmts_to_slp_tree_map_t *bst_map,
+ /* ??? We need stmt_info for group splitting. */
+ stmt_vec_info stmt_info_)
+{
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
"Starting SLP discovery for\n");
- for (i = 0; i < scalar_stmts.length (); ++i)
+ for (unsigned i = 0; i < scalar_stmts.length (); ++i)
dump_printf_loc (MSG_NOTE, vect_location,
" %G", scalar_stmts[i]->stmt);
}
/* Build the tree for the SLP instance. */
+ unsigned int group_size = scalar_stmts.length ();
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,
- &tree_size, bst_map);
+ unsigned i;
+ slp_tree node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
+ &max_nunits, matches, &npermutes,
+ &tree_size, bst_map);
if (node != NULL)
{
/* Calculate the unrolling factor based on the smallest type. */
@@ -2108,11 +2242,12 @@ vect_analyze_slp_instance (vec_info *vinfo,
else
{
/* Create a new SLP instance. */
- new_instance = XNEW (class _slp_instance);
+ slp_instance new_instance = XNEW (class _slp_instance);
SLP_INSTANCE_TREE (new_instance) = node;
SLP_INSTANCE_UNROLLING_FACTOR (new_instance) = unrolling_factor;
SLP_INSTANCE_LOADS (new_instance) = vNULL;
- SLP_INSTANCE_ROOT_STMT (new_instance) = constructor ? stmt_info : NULL;
+ SLP_INSTANCE_ROOT_STMT (new_instance) = root_stmt_info;
+ SLP_INSTANCE_KIND (new_instance) = kind;
new_instance->reduc_phis = NULL;
new_instance->cost_vec = vNULL;
new_instance->subgraph_entries = vNULL;
@@ -2123,81 +2258,62 @@ vect_analyze_slp_instance (vec_info *vinfo,
"SLP size %u vs. limit %u.\n",
tree_size, max_tree_size);
- /* Check whether any load is possibly permuted. */
- slp_tree load_node;
- bool loads_permuted = false;
- FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (new_instance), i, load_node)
+ /* Fixup SLP reduction chains. */
+ if (kind == slp_inst_kind_reduc_chain)
{
- if (!SLP_TREE_LOAD_PERMUTATION (load_node).exists ())
- continue;
- unsigned j;
- stmt_vec_info load_info;
- FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (load_node), j, load_info)
- if (SLP_TREE_LOAD_PERMUTATION (load_node)[j] != j)
- {
- loads_permuted = true;
- break;
- }
- }
-
- /* If the loads and stores can be handled with load/store-lane
- 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))
- {
- slp_tree load_node;
- FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (new_instance), i, load_node)
- {
- stmt_vec_info stmt_vinfo = DR_GROUP_FIRST_ELEMENT
- (SLP_TREE_SCALAR_STMTS (load_node)[0]);
- /* Use SLP for strided accesses (or if we can't load-lanes). */
- if (STMT_VINFO_STRIDED_P (stmt_vinfo)
- || ! vect_load_lanes_supported
- (STMT_VINFO_VECTYPE (stmt_vinfo),
- DR_GROUP_SIZE (stmt_vinfo), false))
- break;
- }
- if (i == SLP_INSTANCE_LOADS (new_instance).length ())
+ /* If this is a reduction chain with a conversion in front
+ amend the SLP tree with a node for that. */
+ gimple *scalar_def
+ = vect_orig_stmt (scalar_stmts[group_size - 1])->stmt;
+ if (STMT_VINFO_DEF_TYPE (scalar_stmts[0]) != vect_reduction_def)
{
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Built SLP cancelled: can use "
- "load/store-lanes\n");
- vect_free_slp_instance (new_instance);
- return false;
+ /* Get at the conversion stmt - we know it's the single use
+ of the last stmt of the reduction chain. */
+ use_operand_p use_p;
+ bool r = single_imm_use (gimple_assign_lhs (scalar_def),
+ &use_p, &scalar_def);
+ gcc_assert (r);
+ stmt_vec_info next_info = vinfo->lookup_stmt (scalar_def);
+ next_info = vect_stmt_to_vectorize (next_info);
+ scalar_stmts = vNULL;
+ scalar_stmts.create (group_size);
+ for (unsigned i = 0; i < group_size; ++i)
+ scalar_stmts.quick_push (next_info);
+ slp_tree conv = vect_create_new_slp_node (scalar_stmts, 1);
+ SLP_TREE_VECTYPE (conv) = STMT_VINFO_VECTYPE (next_info);
+ SLP_TREE_CHILDREN (conv).quick_push (node);
+ SLP_INSTANCE_TREE (new_instance) = conv;
+ /* We also have to fake this conversion stmt as SLP reduction
+ group so we don't have to mess with too much code
+ elsewhere. */
+ REDUC_GROUP_FIRST_ELEMENT (next_info) = next_info;
+ REDUC_GROUP_NEXT_ELEMENT (next_info) = NULL;
}
- }
-
- /* If this is a reduction chain with a conversion in front
- amend the SLP tree with a node for that. */
- if (!dr
- && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
- && STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def)
- {
- /* Get at the conversion stmt - we know it's the single use
- of the last stmt of the reduction chain. */
- gimple *tem = vect_orig_stmt (scalar_stmts[group_size - 1])->stmt;
+ /* Fill the backedge child of the PHI SLP node. The
+ general matching code cannot find it because the
+ scalar code does not reflect how we vectorize the
+ reduction. */
use_operand_p use_p;
- gimple *use_stmt;
- bool r = single_imm_use (gimple_assign_lhs (tem),
- &use_p, &use_stmt);
- gcc_assert (r);
- next_info = vinfo->lookup_stmt (use_stmt);
- next_info = vect_stmt_to_vectorize (next_info);
- scalar_stmts = vNULL;
- scalar_stmts.create (group_size);
- for (unsigned i = 0; i < group_size; ++i)
- scalar_stmts.quick_push (next_info);
- slp_tree conv = vect_create_new_slp_node (scalar_stmts, 1);
- SLP_TREE_VECTYPE (conv) = STMT_VINFO_VECTYPE (next_info);
- SLP_TREE_CHILDREN (conv).quick_push (node);
- SLP_INSTANCE_TREE (new_instance) = conv;
- /* We also have to fake this conversion stmt as SLP reduction
- group so we don't have to mess with too much code
- elsewhere. */
- REDUC_GROUP_FIRST_ELEMENT (next_info) = next_info;
- REDUC_GROUP_NEXT_ELEMENT (next_info) = NULL;
+ imm_use_iterator imm_iter;
+ class loop *loop = LOOP_VINFO_LOOP (as_a <loop_vec_info> (vinfo));
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter,
+ gimple_get_lhs (scalar_def))
+ /* There are exactly two non-debug uses, the reduction
+ PHI and the loop-closed PHI node. */
+ if (!is_gimple_debug (USE_STMT (use_p))
+ && gimple_bb (USE_STMT (use_p)) == loop->header)
+ {
+ auto_vec<stmt_vec_info, 64> phis (group_size);
+ stmt_vec_info phi_info
+ = vinfo->lookup_stmt (USE_STMT (use_p));
+ for (unsigned i = 0; i < group_size; ++i)
+ phis.quick_push (phi_info);
+ slp_tree *phi_node = bst_map->get (phis);
+ unsigned dest_idx = loop_latch_edge (loop)->dest_idx;
+ SLP_TREE_CHILDREN (*phi_node)[dest_idx]
+ = SLP_INSTANCE_TREE (new_instance);
+ SLP_INSTANCE_TREE (new_instance)->refcnt++;
+ }
}
vinfo->slp_instances.safe_push (new_instance);
@@ -2211,7 +2327,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
- "Final SLP tree for instance:\n");
+ "Final SLP tree for instance %p:\n", new_instance);
vect_print_slp_graph (MSG_NOTE, vect_location,
SLP_INSTANCE_TREE (new_instance));
}
@@ -2226,46 +2342,91 @@ 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))
+ stmt_vec_info stmt_info = stmt_info_;
+ /* Try to break the group up into pieces. */
+ if (kind == slp_inst_kind_store)
{
- /* We consider breaking the group only on VF boundaries from the existing
- start. */
+ /* ??? We could delay all the actual splitting of store-groups
+ until after SLP discovery of the original group completed.
+ Then we can recurse to vect_build_slp_instance directly. */
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,
+ 1 << floor_log2 (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,
+ kind, max_tree_size);
+ /* Split the rest at the failure point and possibly
+ re-analyze the remaining matching part if it has
+ at least two lanes. */
+ if (group1_size < i
+ && (i + 1 < group_size
+ || i - group1_size > 1))
+ {
+ stmt_vec_info rest2 = rest;
+ rest = vect_split_slp_store_group (rest, i - group1_size);
+ if (i - group1_size > 1)
+ res |= vect_analyze_slp_instance (vinfo, bst_map, rest2,
+ kind, max_tree_size);
+ }
+ /* Re-analyze the non-matching tail if it has at least
+ two lanes. */
+ if (i + 1 < group_size)
+ res |= vect_analyze_slp_instance (vinfo, bst_map,
+ rest, kind, 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. 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);
- }
+ kind, max_tree_size);
if (i + 1 < group_size)
res |= vect_analyze_slp_instance (vinfo, bst_map,
- rest, max_tree_size);
+ rest, kind, 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. */
}
@@ -2276,52 +2437,96 @@ 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)
+/* Analyze an SLP instance starting from a group of grouped stores. Call
+ vect_build_slp_tree to build a tree of packed stmts if possible.
+ Return FALSE if it's impossible to SLP any stmt in the loop. */
+
+static bool
+vect_analyze_slp_instance (vec_info *vinfo,
+ scalar_stmts_to_slp_tree_map_t *bst_map,
+ stmt_vec_info stmt_info,
+ slp_instance_kind kind,
+ unsigned max_tree_size)
{
- if (SLP_TREE_DEF_TYPE (node) != vect_internal_def
- || visited.add (node))
- return;
+ unsigned int i;
+ vec<stmt_vec_info> scalar_stmts;
- 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);
+ if (is_a <bb_vec_info> (vinfo))
+ vect_location = stmt_info->stmt;
- 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++;
- }
- }
+ stmt_vec_info next_info = stmt_info;
+ if (kind == slp_inst_kind_store)
+ {
+ /* Collect the stores and store them in scalar_stmts. */
+ scalar_stmts.create (DR_GROUP_SIZE (stmt_info));
+ while (next_info)
+ {
+ scalar_stmts.quick_push (vect_stmt_to_vectorize (next_info));
+ next_info = DR_GROUP_NEXT_ELEMENT (next_info);
+ }
+ }
+ else if (kind == slp_inst_kind_reduc_chain)
+ {
+ /* Collect the reduction stmts and store them in scalar_stmts. */
+ scalar_stmts.create (REDUC_GROUP_SIZE (stmt_info));
+ while (next_info)
+ {
+ scalar_stmts.quick_push (vect_stmt_to_vectorize (next_info));
+ next_info = REDUC_GROUP_NEXT_ELEMENT (next_info);
+ }
+ /* Mark the first element of the reduction chain as reduction to properly
+ transform the node. In the reduction analysis phase only the last
+ element of the chain is marked as reduction. */
+ STMT_VINFO_DEF_TYPE (stmt_info)
+ = STMT_VINFO_DEF_TYPE (scalar_stmts.last ());
+ STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info))
+ = STMT_VINFO_REDUC_DEF (vect_orig_stmt (scalar_stmts.last ()));
+ }
+ else if (kind == slp_inst_kind_ctor)
+ {
+ tree rhs = gimple_assign_rhs1 (stmt_info->stmt);
+ tree val;
+ scalar_stmts.create (CONSTRUCTOR_NELTS (rhs));
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs), i, val)
+ {
+ stmt_vec_info def_info = vinfo->lookup_def (val);
+ def_info = vect_stmt_to_vectorize (def_info);
+ scalar_stmts.quick_push (def_info);
+ }
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Analyzing vectorizable constructor: %G\n",
+ stmt_info->stmt);
+ }
+ else if (kind == slp_inst_kind_reduc_group)
+ {
+ /* Collect reduction statements. */
+ vec<stmt_vec_info> reductions = as_a <loop_vec_info> (vinfo)->reductions;
+ scalar_stmts.create (reductions.length ());
+ for (i = 0; reductions.iterate (i, &next_info); i++)
+ if (STMT_VINFO_RELEVANT_P (next_info)
+ || STMT_VINFO_LIVE_P (next_info))
+ scalar_stmts.quick_push (next_info);
+ /* If less than two were relevant/live there's nothing to SLP. */
+ if (scalar_stmts.length () < 2)
+ return false;
+ }
+ else
+ gcc_unreachable ();
+
+ /* Build the tree for the SLP instance. */
+ bool res = vect_build_slp_instance (vinfo, kind, scalar_stmts,
+ kind == slp_inst_kind_ctor
+ ? stmt_info : NULL,
+ max_tree_size, bst_map,
+ kind == slp_inst_kind_store
+ ? stmt_info : NULL);
+
+ /* ??? If this is slp_inst_kind_store and the above succeeded here's
+ where we should do store group splitting. */
+
+ return res;
}
/* Check if there are stmts in the loop can be vectorized using SLP. Build SLP
@@ -2340,47 +2545,44 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
/* Find SLP sequences starting from groups of grouped stores. */
FOR_EACH_VEC_ELT (vinfo->grouped_stores, i, first_element)
- vect_analyze_slp_instance (vinfo, bst_map, first_element, max_tree_size);
+ vect_analyze_slp_instance (vinfo, bst_map, first_element,
+ STMT_VINFO_GROUPED_ACCESS (first_element)
+ ? slp_inst_kind_store : slp_inst_kind_ctor,
+ max_tree_size);
if (loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo))
{
- if (loop_vinfo->reduction_chains.length () > 0)
- {
- /* Find SLP sequences starting from reduction chains. */
- FOR_EACH_VEC_ELT (loop_vinfo->reduction_chains, i, first_element)
- if (! vect_analyze_slp_instance (vinfo, bst_map, first_element,
- max_tree_size))
+ /* Find SLP sequences starting from reduction chains. */
+ FOR_EACH_VEC_ELT (loop_vinfo->reduction_chains, i, first_element)
+ if (! STMT_VINFO_RELEVANT_P (first_element)
+ && ! STMT_VINFO_LIVE_P (first_element))
+ ;
+ else if (! vect_analyze_slp_instance (vinfo, bst_map, first_element,
+ slp_inst_kind_reduc_chain,
+ max_tree_size))
+ {
+ /* Dissolve reduction chain group. */
+ stmt_vec_info vinfo = first_element;
+ stmt_vec_info last = NULL;
+ while (vinfo)
{
- /* Dissolve reduction chain group. */
- stmt_vec_info vinfo = first_element;
- stmt_vec_info last = NULL;
- while (vinfo)
- {
- stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (vinfo);
- REDUC_GROUP_FIRST_ELEMENT (vinfo) = NULL;
- REDUC_GROUP_NEXT_ELEMENT (vinfo) = NULL;
- last = vinfo;
- vinfo = next;
- }
- STMT_VINFO_DEF_TYPE (first_element) = vect_internal_def;
- /* It can be still vectorized as part of an SLP reduction. */
- loop_vinfo->reductions.safe_push (last);
+ stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (vinfo);
+ REDUC_GROUP_FIRST_ELEMENT (vinfo) = NULL;
+ REDUC_GROUP_NEXT_ELEMENT (vinfo) = NULL;
+ last = vinfo;
+ vinfo = next;
}
- }
+ STMT_VINFO_DEF_TYPE (first_element) = vect_internal_def;
+ /* It can be still vectorized as part of an SLP reduction. */
+ loop_vinfo->reductions.safe_push (last);
+ }
/* Find SLP sequences starting from groups of reductions. */
if (loop_vinfo->reductions.length () > 1)
vect_analyze_slp_instance (vinfo, bst_map, loop_vinfo->reductions[0],
- max_tree_size);
+ slp_inst_kind_reduc_group, 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)
@@ -2405,11 +2607,16 @@ vect_slp_build_vertices (hash_set<slp_tree> &visited, slp_tree node,
node->vertex = vertices.length ();
vertices.safe_push (node);
- if (SLP_TREE_CHILDREN (node).is_empty ())
+
+ bool leaf = true;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
+ if (child)
+ {
+ leaf = false;
+ vect_slp_build_vertices (visited, child, vertices, leafs);
+ }
+ if (leaf)
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. */
@@ -2487,7 +2694,8 @@ vect_optimize_slp (vec_info *vinfo)
unsigned j;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
- add_edge (slpg, i, child->vertex);
+ if (child)
+ add_edge (slpg, i, child->vertex);
}
/* Compute (reverse) postorder on the inverted graph. */
@@ -2686,7 +2894,7 @@ vect_optimize_slp (vec_info *vinfo)
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
{
- if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
+ if (!child || SLP_TREE_DEF_TYPE (child) == vect_internal_def)
continue;
/* If the vector is uniform there's nothing to do. */
@@ -2712,6 +2920,18 @@ vect_optimize_slp (vec_info *vinfo)
/* For loads simply drop the permutation, the load permutation
already performs the desired permutation. */
;
+ else if (SLP_TREE_LANE_PERMUTATION (node).exists ())
+ {
+ /* If the node if already a permute node we just need to apply
+ the permutation to the permute node itself. */
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "simplifying permute node %p\n",
+ node);
+
+ vect_slp_permute (perms[perm], SLP_TREE_LANE_PERMUTATION (node),
+ true);
+ }
else
{
if (dump_enabled_p ())
@@ -2780,7 +3000,7 @@ vect_optimize_slp (vec_info *vinfo)
/* Now elide load permutations that are not necessary. */
for (i = 0; i < leafs.length (); ++i)
{
- node = vertices[i];
+ node = vertices[leafs[i]];
if (!SLP_TREE_LOAD_PERMUTATION (node).exists ())
continue;
@@ -3091,7 +3311,13 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
if (is_a <bb_vec_info> (vinfo)
&& !vect_update_shared_vectype (stmt_info, SLP_TREE_VECTYPE (node)))
- return false;
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "desired vector type conflicts with earlier one "
+ "for %G", stmt_info->stmt);
+ return false;
+ }
bool dummy;
return vect_analyze_stmt (vinfo, stmt_info, &dummy,
@@ -3116,7 +3342,7 @@ vect_slp_convert_to_external (vec_info *vinfo, slp_tree node,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Building vector operands from scalars instead\n");
+ "Building vector operands of %p from scalars instead\n", node);
/* Don't remove and free the child nodes here, since they could be
referenced by other structures. The analysis and scheduling phases
@@ -3124,6 +3350,7 @@ vect_slp_convert_to_external (vec_info *vinfo, slp_tree node,
unsigned int group_size = SLP_TREE_LANES (node);
SLP_TREE_DEF_TYPE (node) = vect_external_def;
SLP_TREE_SCALAR_OPS (node).safe_grow (group_size, true);
+ SLP_TREE_LOAD_PERMUTATION (node).release ();
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
{
tree lhs = gimple_get_lhs (vect_orig_stmt (stmt_info)->stmt);
@@ -3198,28 +3425,42 @@ vect_prologue_cost_for_slp (slp_tree node,
static bool
vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
slp_instance node_instance,
- hash_set<slp_tree> &visited,
- hash_set<slp_tree> &lvisited,
+ hash_set<slp_tree> &visited_set,
+ vec<slp_tree> &visited_vec,
stmt_vector_for_cost *cost_vec)
{
int i, j;
slp_tree child;
/* Assume we can code-generate all invariants. */
- if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
+ if (!node
+ || SLP_TREE_DEF_TYPE (node) == vect_constant_def
+ || SLP_TREE_DEF_TYPE (node) == vect_external_def)
return true;
+ if (SLP_TREE_DEF_TYPE (node) == vect_uninitialized_def)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Failed cyclic SLP reference in %p", node);
+ return false;
+ }
+ gcc_assert (SLP_TREE_DEF_TYPE (node) == vect_internal_def);
+
/* If we already analyzed the exact same set of scalar stmts we're done.
We share the generated vector stmts for those. */
- if (visited.contains (node)
- || lvisited.add (node))
+ if (visited_set.add (node))
return true;
+ visited_vec.safe_push (node);
bool res = true;
+ unsigned visited_rec_start = visited_vec.length ();
+ unsigned cost_vec_rec_start = cost_vec->length ();
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
{
res = vect_slp_analyze_node_operations (vinfo, child, node_instance,
- visited, lvisited, cost_vec);
+ visited_set, visited_vec,
+ cost_vec);
if (!res)
break;
}
@@ -3227,8 +3468,14 @@ 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 analysis failed we have to pop all recursive visited nodes
+ plus ourselves. */
if (!res)
- lvisited.remove (node);
+ {
+ while (visited_vec.length () >= visited_rec_start)
+ visited_set.remove (visited_vec.pop ());
+ cost_vec->truncate (cost_vec_rec_start);
+ }
/* When the node can be vectorized cost invariant nodes it references.
This is not done in DFS order to allow the refering node
@@ -3237,14 +3484,15 @@ vect_slp_analyze_node_operations (vec_info *vinfo, slp_tree node,
other referrers. */
if (res)
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
- if ((SLP_TREE_DEF_TYPE (child) == vect_constant_def
- || SLP_TREE_DEF_TYPE (child) == vect_external_def)
+ if (child
+ && (SLP_TREE_DEF_TYPE (child) == vect_constant_def
+ || SLP_TREE_DEF_TYPE (child) == vect_external_def)
/* Perform usual caching, note code-generation still
code-gens these nodes multiple times but we expect
to CSE them later. */
- && !visited.contains (child)
- && !lvisited.add (child))
+ && !visited_set.add (child))
{
+ visited_vec.safe_push (child);
/* ??? After auditing more code paths make a "default"
and push the vector type from NODE to all children
if it is not already set. */
@@ -3292,17 +3540,19 @@ static void
vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
slp_instance instance,
stmt_vector_for_cost *cost_vec,
- hash_set<stmt_vec_info> &svisited)
+ hash_set<stmt_vec_info> &svisited,
+ hash_set<slp_tree> &visited)
{
+ if (visited.add (node))
+ return;
+
unsigned i;
stmt_vec_info stmt_info;
stmt_vec_info last_stmt = vect_find_last_scalar_stmt_in_slp (node);
- bool all_visited = true;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, 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)
@@ -3312,7 +3562,7 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
gimple *orig_stmt = orig_stmt_info->stmt;
ssa_op_iter op_iter;
def_operand_p def_p;
- FOR_EACH_SSA_DEF_OPERAND (def_p, orig_stmt, op_iter, SSA_OP_DEF)
+ FOR_EACH_PHI_OR_STMT_DEF (def_p, orig_stmt, op_iter, SSA_OP_DEF)
{
imm_use_iterator use_iter;
gimple *use_stmt;
@@ -3376,14 +3626,12 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node,
if (mark_visited)
svisited.add (stmt_info);
}
- if (all_visited)
- return;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
+ if (child && SLP_TREE_DEF_TYPE (child) == vect_internal_def)
vect_bb_slp_mark_live_stmts (bb_vinfo, child, instance,
- cost_vec, svisited);
+ cost_vec, svisited, visited);
}
/* Analyze statements in SLP instances of VINFO. Return true if the
@@ -3400,14 +3648,14 @@ vect_slp_analyze_operations (vec_info *vinfo)
hash_set<slp_tree> visited;
for (i = 0; vinfo->slp_instances.iterate (i, &instance); )
{
- hash_set<slp_tree> lvisited;
+ auto_vec<slp_tree> visited_vec;
stmt_vector_for_cost cost_vec;
cost_vec.create (2);
if (is_a <bb_vec_info> (vinfo))
vect_location = instance->location ();
if (!vect_slp_analyze_node_operations (vinfo,
SLP_INSTANCE_TREE (instance),
- instance, visited, lvisited,
+ instance, visited, visited_vec,
&cost_vec)
/* Instances with a root stmt require vectorized defs for the
SLP tree root. */
@@ -3424,12 +3672,11 @@ vect_slp_analyze_operations (vec_info *vinfo)
vect_free_slp_instance (instance);
vinfo->slp_instances.ordered_remove (i);
cost_vec.release ();
+ while (!visited_vec.is_empty ())
+ visited.remove (visited_vec.pop ());
}
else
{
- for (hash_set<slp_tree>::iterator x = lvisited.begin();
- x != lvisited.end(); ++x)
- visited.add (*x);
i++;
/* For BB vectorization remember the SLP graph entry
@@ -3448,11 +3695,13 @@ vect_slp_analyze_operations (vec_info *vinfo)
if (bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (vinfo))
{
hash_set<stmt_vec_info> svisited;
+ hash_set<slp_tree> visited;
for (i = 0; vinfo->slp_instances.iterate (i, &instance); ++i)
{
vect_location = instance->location ();
vect_bb_slp_mark_live_stmts (bb_vinfo, SLP_INSTANCE_TREE (instance),
- instance, &instance->cost_vec, svisited);
+ instance, &instance->cost_vec, svisited,
+ visited);
}
}
@@ -3516,7 +3765,7 @@ vect_bb_partition_graph_r (bb_vec_info bb_vinfo,
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
- if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
+ if (child && SLP_TREE_DEF_TYPE (child) == vect_internal_def)
vect_bb_partition_graph_r (bb_vinfo, instance, child, stmt_to_instance,
instance_leader, visited);
}
@@ -3592,7 +3841,7 @@ vect_bb_slp_scalar_cost (vec_info *vinfo,
the scalar cost. */
if (!STMT_VINFO_LIVE_P (stmt_info))
{
- FOR_EACH_SSA_DEF_OPERAND (def_p, orig_stmt, op_iter, SSA_OP_DEF)
+ FOR_EACH_PHI_OR_STMT_DEF (def_p, orig_stmt, op_iter, SSA_OP_DEF)
{
imm_use_iterator use_iter;
gimple *use_stmt;
@@ -3630,13 +3879,14 @@ vect_bb_slp_scalar_cost (vec_info *vinfo,
continue;
else
kind = scalar_stmt;
- record_stmt_cost (cost_vec, 1, kind, orig_stmt_info, 0, vect_body);
+ record_stmt_cost (cost_vec, 1, kind, orig_stmt_info,
+ SLP_TREE_VECTYPE (node), 0, vect_body);
}
auto_vec<bool, 20> subtree_life;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
{
- if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
+ if (child && SLP_TREE_DEF_TYPE (child) == vect_internal_def)
{
/* Do not directly pass LIFE to the recursive call, copy it to
confine changes in the callee to the current child/subtree. */
@@ -3755,11 +4005,62 @@ vect_slp_check_for_constructors (bb_vec_info bb_vinfo)
|| uniform_vector_p (rhs))
continue;
+ unsigned j;
+ tree val;
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (rhs), j, val)
+ if (TREE_CODE (val) != SSA_NAME
+ || !bb_vinfo->lookup_def (val))
+ break;
+ if (j != CONSTRUCTOR_NELTS (rhs))
+ continue;
+
stmt_vec_info stmt_info = bb_vinfo->lookup_stmt (assign);
BB_VINFO_GROUPED_STORES (bb_vinfo).safe_push (stmt_info);
}
}
+/* Walk the grouped store chains and replace entries with their
+ pattern variant if any. */
+
+static void
+vect_fixup_store_groups_with_patterns (vec_info *vinfo)
+{
+ stmt_vec_info first_element;
+ unsigned i;
+
+ FOR_EACH_VEC_ELT (vinfo->grouped_stores, i, first_element)
+ {
+ /* We also have CTORs in this array. */
+ if (!STMT_VINFO_GROUPED_ACCESS (first_element))
+ continue;
+ if (STMT_VINFO_IN_PATTERN_P (first_element))
+ {
+ stmt_vec_info orig = first_element;
+ first_element = STMT_VINFO_RELATED_STMT (first_element);
+ DR_GROUP_FIRST_ELEMENT (first_element) = first_element;
+ DR_GROUP_SIZE (first_element) = DR_GROUP_SIZE (orig);
+ DR_GROUP_GAP (first_element) = DR_GROUP_GAP (orig);
+ DR_GROUP_NEXT_ELEMENT (first_element) = DR_GROUP_NEXT_ELEMENT (orig);
+ vinfo->grouped_stores[i] = first_element;
+ }
+ stmt_vec_info prev = first_element;
+ while (DR_GROUP_NEXT_ELEMENT (prev))
+ {
+ stmt_vec_info elt = DR_GROUP_NEXT_ELEMENT (prev);
+ if (STMT_VINFO_IN_PATTERN_P (elt))
+ {
+ stmt_vec_info orig = elt;
+ elt = STMT_VINFO_RELATED_STMT (elt);
+ DR_GROUP_NEXT_ELEMENT (prev) = elt;
+ DR_GROUP_GAP (elt) = DR_GROUP_GAP (orig);
+ DR_GROUP_NEXT_ELEMENT (elt) = DR_GROUP_NEXT_ELEMENT (orig);
+ }
+ DR_GROUP_FIRST_ELEMENT (elt) = first_element;
+ prev = elt;
+ }
+ }
+}
+
/* Check if the region described by BB_VINFO can be vectorized, returning
true if so. When returning false, set FATAL to true if the same failure
would prevent vectorization at other vector sizes, false if it is still
@@ -3818,6 +4119,9 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal,
vect_pattern_recog (bb_vinfo);
+ /* Update store groups from pattern processing. */
+ vect_fixup_store_groups_with_patterns (bb_vinfo);
+
/* Check the SLP opportunities in the basic block, analyze and build SLP
trees. */
if (!vect_analyze_slp (bb_vinfo, n_stmts))
@@ -4060,14 +4364,6 @@ vect_slp_bbs (vec<basic_block> bbs)
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 "
- "region.\n");
- }
}
}
@@ -4105,20 +4401,31 @@ vect_slp_function (function *fun)
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. */
+ if (!bbs.is_empty ()
+ && !dominated_by_p (CDI_DOMINATORS, bb, bbs[0]))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "splitting region at dominance boundary bb%d\n",
+ bb->index);
+ split = true;
+ }
+ /* Split when the loop determined by the first block
+ is exited. This is because we eventually insert
+ invariants at region begin. */
else if (!bbs.is_empty ()
- && !dominated_by_p (CDI_DOMINATORS, bb, bbs[0]))
- split = true;
+ && bbs[0]->loop_father != bb->loop_father
+ && !flow_loop_nested_p (bbs[0]->loop_father, bb->loop_father))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "splitting region at loop %d exit at bb%d\n",
+ bbs[0]->loop_father->num, bb->index);
+ split = true;
+ }
if (split && !bbs.is_empty ())
{
@@ -4128,6 +4435,21 @@ vect_slp_function (function *fun)
}
else
bbs.safe_push (bb);
+
+ /* When we have a stmt ending this block and defining a
+ value we have to insert on edges when inserting after it for
+ a vector containing its definition. Avoid this for now. */
+ if (gimple *last = last_stmt (bb))
+ if (gimple_get_lhs (last)
+ && is_ctrl_altering_stmt (last))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "splitting region at control altering "
+ "definition %G", last);
+ r |= vect_slp_bbs (bbs);
+ bbs.truncate (0);
+ }
}
if (!bbs.is_empty ())
@@ -4504,13 +4826,16 @@ vect_get_slp_defs (vec_info *,
/* Generate vector permute statements from a list of loads in DR_CHAIN.
If ANALYZE_ONLY is TRUE, only check that it is possible to create valid
- permute statements for the SLP node NODE. */
+ permute statements for the SLP node NODE. Store the number of vector
+ permute instructions in *N_PERMS and the number of vector load
+ instructions in *N_LOADS. */
bool
vect_transform_slp_perm_load (vec_info *vinfo,
slp_tree node, vec<tree> dr_chain,
gimple_stmt_iterator *gsi, poly_uint64 vf,
- bool analyze_only, unsigned *n_perms)
+ bool analyze_only, unsigned *n_perms,
+ unsigned int *n_loads)
{
stmt_vec_info stmt_info = SLP_TREE_SCALAR_STMTS (node)[0];
int vec_index = 0;
@@ -4562,6 +4887,7 @@ vect_transform_slp_perm_load (vec_info *vinfo,
vec_perm_builder mask;
unsigned int nelts_to_build;
unsigned int nvectors_per_build;
+ unsigned int in_nlanes;
bool repeating_p = (group_size == DR_GROUP_SIZE (stmt_info)
&& multiple_p (nunits, group_size));
if (repeating_p)
@@ -4572,6 +4898,7 @@ vect_transform_slp_perm_load (vec_info *vinfo,
mask.new_vector (nunits, group_size, 3);
nelts_to_build = mask.encoded_nelts ();
nvectors_per_build = SLP_TREE_VEC_STMTS (node).length ();
+ in_nlanes = DR_GROUP_SIZE (stmt_info) * 3;
}
else
{
@@ -4583,7 +4910,10 @@ vect_transform_slp_perm_load (vec_info *vinfo,
mask.new_vector (const_nunits, const_nunits, 1);
nelts_to_build = const_vf * group_size;
nvectors_per_build = 1;
+ in_nlanes = const_vf * DR_GROUP_SIZE (stmt_info);
}
+ auto_sbitmap used_in_lanes (in_nlanes);
+ bitmap_clear (used_in_lanes);
unsigned int count = mask.encoded_nelts ();
mask.quick_grow (count);
@@ -4595,6 +4925,7 @@ vect_transform_slp_perm_load (vec_info *vinfo,
unsigned int stmt_num = j % group_size;
unsigned int i = (iter_num * DR_GROUP_SIZE (stmt_info)
+ SLP_TREE_LOAD_PERMUTATION (node)[stmt_num]);
+ bitmap_set_bit (used_in_lanes, i);
if (repeating_p)
{
first_vec_index = 0;
@@ -4708,6 +5039,32 @@ vect_transform_slp_perm_load (vec_info *vinfo,
}
}
+ if (n_loads)
+ {
+ if (repeating_p)
+ *n_loads = SLP_TREE_NUMBER_OF_VEC_STMTS (node);
+ else
+ {
+ /* Enforced above when !repeating_p. */
+ unsigned int const_nunits = nunits.to_constant ();
+ *n_loads = 0;
+ bool load_seen = false;
+ for (unsigned i = 0; i < in_nlanes; ++i)
+ {
+ if (i % const_nunits == 0)
+ {
+ if (load_seen)
+ *n_loads += 1;
+ load_seen = false;
+ }
+ if (bitmap_bit_p (used_in_lanes, i))
+ load_seen = true;
+ }
+ if (load_seen)
+ *n_loads += 1;
+ }
+ }
+
return true;
}
@@ -4836,7 +5193,7 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"permutation requires at "
- "least three vectors");
+ "least three vectors\n");
gcc_assert (!gsi);
return false;
}
@@ -4911,24 +5268,22 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi,
return true;
}
-/* Vectorize SLP instance tree in postorder. */
+/* Vectorize SLP NODE. */
static void
-vect_schedule_slp_instance (vec_info *vinfo,
- slp_tree node, slp_instance instance,
- hash_set<slp_tree> &visited)
+vect_schedule_slp_node (vec_info *vinfo,
+ slp_tree node, slp_instance instance)
{
gimple_stmt_iterator si;
int i;
slp_tree child;
- /* See if we have already vectorized the node in the graph of the
- SLP instance. */
- if ((SLP_TREE_DEF_TYPE (node) == vect_internal_def
- && SLP_TREE_VEC_STMTS (node).exists ())
- || SLP_TREE_VEC_DEFS (node).exists ())
+ /* For existing vectors there's nothing to do. */
+ if (SLP_TREE_VEC_DEFS (node).exists ())
return;
+ gcc_assert (SLP_TREE_VEC_STMTS (node).is_empty ());
+
/* Vectorize externals and constants. */
if (SLP_TREE_DEF_TYPE (node) == vect_constant_def
|| SLP_TREE_DEF_TYPE (node) == vect_external_def)
@@ -4943,17 +5298,11 @@ 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, visited);
+ stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
gcc_assert (SLP_TREE_NUMBER_OF_VEC_STMTS (node) != 0);
SLP_TREE_VEC_STMTS (node).create (SLP_TREE_NUMBER_OF_VEC_STMTS (node));
- stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"------>vectorizing SLP node starting from: %G",
@@ -4972,13 +5321,12 @@ 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 ((STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
- == cycle_phi_info_type)
- || (STMT_VINFO_TYPE (SLP_TREE_REPRESENTATIVE (node))
- == induc_vec_info_type))
+ else if ((STMT_VINFO_TYPE (stmt_info) == cycle_phi_info_type
+ || STMT_VINFO_TYPE (stmt_info) == induc_vec_info_type
+ || STMT_VINFO_TYPE (stmt_info) == phi_info_type)
+ && SLP_TREE_CODE (node) != VEC_PERM_EXPR)
{
- /* For reduction and induction PHIs we do not use the
- insertion iterator. */
+ /* For PHI node vectorization we do not use the insertion iterator. */
si = gsi_none ();
}
else
@@ -5101,7 +5449,7 @@ vect_remove_slp_scalar_calls (vec_info *vinfo,
tree lhs;
stmt_vec_info stmt_info;
- if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
+ if (!node || SLP_TREE_DEF_TYPE (node) != vect_internal_def)
return;
if (visited.add (node))
@@ -5183,6 +5531,156 @@ vectorize_slp_instance_root_stmt (slp_tree node, slp_instance instance)
gsi_replace (&rgsi, rstmt, true);
}
+struct slp_scc_info
+{
+ bool on_stack;
+ int dfs;
+ int lowlink;
+};
+
+/* Schedule the SLP INSTANCE doing a DFS walk and collecting SCCs. */
+
+static void
+vect_schedule_scc (vec_info *vinfo, slp_tree node, slp_instance instance,
+ hash_map<slp_tree, slp_scc_info> &scc_info,
+ int &maxdfs, vec<slp_tree> &stack)
+{
+ bool existed_p;
+ slp_scc_info *info = &scc_info.get_or_insert (node, &existed_p);
+ gcc_assert (!existed_p);
+ info->dfs = maxdfs;
+ info->lowlink = maxdfs;
+ maxdfs++;
+
+ /* Leaf. */
+ if (SLP_TREE_DEF_TYPE (node) != vect_internal_def)
+ {
+ info->on_stack = false;
+ vect_schedule_slp_node (vinfo, node, instance);
+ return;
+ }
+
+ info->on_stack = true;
+ stack.safe_push (node);
+
+ unsigned i;
+ slp_tree child;
+ /* DFS recurse. */
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
+ {
+ if (!child)
+ continue;
+ slp_scc_info *child_info = scc_info.get (child);
+ if (!child_info)
+ {
+ vect_schedule_scc (vinfo, child, instance, scc_info, maxdfs, stack);
+ /* Recursion might have re-allocated the node. */
+ info = scc_info.get (node);
+ child_info = scc_info.get (child);
+ info->lowlink = MIN (info->lowlink, child_info->lowlink);
+ }
+ else if (child_info->on_stack)
+ info->lowlink = MIN (info->lowlink, child_info->dfs);
+ }
+ if (info->lowlink != info->dfs)
+ return;
+
+ auto_vec<slp_tree, 4> phis_to_fixup;
+
+ /* Singleton. */
+ if (stack.last () == node)
+ {
+ stack.pop ();
+ info->on_stack = false;
+ vect_schedule_slp_node (vinfo, node, instance);
+ if (SLP_TREE_CODE (node) != VEC_PERM_EXPR
+ && is_a <gphi *> (SLP_TREE_REPRESENTATIVE (node)->stmt))
+ phis_to_fixup.quick_push (node);
+ }
+ else
+ {
+ /* SCC. */
+ int last_idx = stack.length () - 1;
+ while (stack[last_idx] != node)
+ last_idx--;
+ /* We can break the cycle at PHIs who have at least one child
+ code generated. Then we could re-start the DFS walk until
+ all nodes in the SCC are covered (we might have new entries
+ for only back-reachable nodes). But it's simpler to just
+ iterate and schedule those that are ready. */
+ unsigned todo = stack.length () - last_idx;
+ do
+ {
+ for (int idx = stack.length () - 1; idx >= last_idx; --idx)
+ {
+ slp_tree entry = stack[idx];
+ if (!entry)
+ continue;
+ bool phi = (SLP_TREE_CODE (entry) != VEC_PERM_EXPR
+ && is_a <gphi *> (SLP_TREE_REPRESENTATIVE (entry)->stmt));
+ bool ready = !phi;
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (entry), i, child)
+ if (!child)
+ {
+ gcc_assert (phi);
+ ready = true;
+ break;
+ }
+ else if (scc_info.get (child)->on_stack)
+ {
+ if (!phi)
+ {
+ ready = false;
+ break;
+ }
+ }
+ else
+ {
+ if (phi)
+ {
+ ready = true;
+ break;
+ }
+ }
+ if (ready)
+ {
+ vect_schedule_slp_node (vinfo, entry, instance);
+ scc_info.get (entry)->on_stack = false;
+ stack[idx] = NULL;
+ todo--;
+ if (phi)
+ phis_to_fixup.safe_push (entry);
+ }
+ }
+ }
+ while (todo != 0);
+
+ /* Pop the SCC. */
+ stack.truncate (last_idx);
+ }
+
+ /* Now fixup the backedge def of the vectorized PHIs in this SCC. */
+ slp_tree phi_node;
+ FOR_EACH_VEC_ELT (phis_to_fixup, i, phi_node)
+ {
+ gphi *phi = as_a <gphi *> (SLP_TREE_REPRESENTATIVE (phi_node)->stmt);
+ edge_iterator ei;
+ edge e;
+ FOR_EACH_EDGE (e, ei, gimple_bb (phi)->preds)
+ {
+ unsigned dest_idx = e->dest_idx;
+ child = SLP_TREE_CHILDREN (phi_node)[dest_idx];
+ if (!child || SLP_TREE_DEF_TYPE (child) != vect_internal_def)
+ continue;
+ /* Simply fill all args. */
+ for (unsigned i = 0; i < SLP_TREE_VEC_STMTS (phi_node).length (); ++i)
+ add_phi_arg (as_a <gphi *> (SLP_TREE_VEC_STMTS (phi_node)[i]),
+ vect_get_slp_vect_def (child, i),
+ e, gimple_phi_arg_location (phi, dest_idx));
+ }
+ }
+}
+
/* Generate vector code for SLP_INSTANCES in the loop/basic block. */
void
@@ -5191,7 +5689,8 @@ vect_schedule_slp (vec_info *vinfo, vec<slp_instance> slp_instances)
slp_instance instance;
unsigned int i;
- hash_set<slp_tree> visited;
+ hash_map<slp_tree, slp_scc_info> scc_info;
+ int maxdfs = 0;
FOR_EACH_VEC_ELT (slp_instances, i, instance)
{
slp_tree node = SLP_INSTANCE_TREE (instance);
@@ -5205,8 +5704,11 @@ vect_schedule_slp (vec_info *vinfo, vec<slp_instance> slp_instances)
vect_print_slp_graph (MSG_NOTE, vect_location,
SLP_INSTANCE_TREE (instance));
}
- /* Schedule the tree of INSTANCE. */
- vect_schedule_slp_instance (vinfo, node, instance, visited);
+ /* Schedule the tree of INSTANCE, scheduling SCCs in a way to
+ have a PHI be the node breaking the cycle. */
+ auto_vec<slp_tree> stack;
+ if (!scc_info.get (node))
+ vect_schedule_scc (vinfo, node, instance, scc_info, maxdfs, stack);
if (SLP_INSTANCE_ROOT_STMT (instance))
vectorize_slp_instance_root_stmt (node, instance);
@@ -5222,25 +5724,6 @@ vect_schedule_slp (vec_info *vinfo, vec<slp_instance> slp_instances)
stmt_vec_info store_info;
unsigned int j;
- /* For reductions set the latch values of the vectorized PHIs. */
- if (instance->reduc_phis
- && STMT_VINFO_REDUC_TYPE (SLP_TREE_REPRESENTATIVE
- (instance->reduc_phis)) != FOLD_LEFT_REDUCTION
- && STMT_VINFO_REDUC_TYPE (SLP_TREE_REPRESENTATIVE
- (instance->reduc_phis)) != EXTRACT_LAST_REDUCTION)
- {
- slp_tree slp_node = root;
- slp_tree phi_node = instance->reduc_phis;
- gphi *phi = as_a <gphi *> (SLP_TREE_SCALAR_STMTS (phi_node)[0]->stmt);
- edge e = loop_latch_edge (gimple_bb (phi)->loop_father);
- gcc_assert (SLP_TREE_VEC_STMTS (phi_node).length ()
- == SLP_TREE_VEC_STMTS (slp_node).length ());
- for (unsigned j = 0; j < SLP_TREE_VEC_STMTS (phi_node).length (); ++j)
- add_phi_arg (as_a <gphi *> (SLP_TREE_VEC_STMTS (phi_node)[j]),
- vect_get_slp_vect_def (slp_node, j),
- e, gimple_phi_arg_location (phi, e->dest_idx));
- }
-
/* Remove scalar call stmts. Do not do this for basic-block
vectorization as not all uses may be vectorized.
??? Why should this be necessary? DCE should be able to
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 3575f25..2c7a8a7 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1098,39 +1098,15 @@ vect_model_load_cost (vec_info *vinfo,
the first group element not by the first scalar stmt DR. */
stmt_vec_info first_stmt_info = DR_GROUP_FIRST_ELEMENT (stmt_info);
/* Record the cost for the permutation. */
- unsigned n_perms;
- unsigned assumed_nunits
- = vect_nunits_for_cost (STMT_VINFO_VECTYPE (first_stmt_info));
+ unsigned n_perms, n_loads;
vect_transform_slp_perm_load (vinfo, slp_node, vNULL, NULL,
- vf, true, &n_perms);
+ vf, true, &n_perms, &n_loads);
inside_cost += record_stmt_cost (cost_vec, n_perms, vec_perm,
first_stmt_info, 0, vect_body);
+
/* And adjust the number of loads performed. This handles
redundancies as well as loads that are later dead. */
- auto_sbitmap perm (DR_GROUP_SIZE (first_stmt_info));
- bitmap_clear (perm);
- for (unsigned i = 0;
- i < SLP_TREE_LOAD_PERMUTATION (slp_node).length (); ++i)
- bitmap_set_bit (perm, SLP_TREE_LOAD_PERMUTATION (slp_node)[i]);
- ncopies = 0;
- bool load_seen = false;
- for (unsigned i = 0; i < DR_GROUP_SIZE (first_stmt_info); ++i)
- {
- if (i % assumed_nunits == 0)
- {
- if (load_seen)
- ncopies++;
- load_seen = false;
- }
- if (bitmap_bit_p (perm, i))
- load_seen = true;
- }
- if (load_seen)
- ncopies++;
- gcc_assert (ncopies
- <= (DR_GROUP_SIZE (first_stmt_info)
- - DR_GROUP_GAP (first_stmt_info)
- + assumed_nunits - 1) / assumed_nunits);
+ ncopies = n_loads;
}
/* Grouped loads read all elements in the group at once,
@@ -3731,7 +3707,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
tree op, type;
tree vec_oprnd0 = NULL_TREE;
tree vectype;
- unsigned int nunits;
+ poly_uint64 nunits;
loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo);
bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (vinfo);
class loop *loop = loop_vinfo ? LOOP_VINFO_LOOP (loop_vinfo) : NULL;
@@ -3883,8 +3859,8 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
arginfo.quick_push (thisarginfo);
}
- unsigned HOST_WIDE_INT vf;
- if (!LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant (&vf))
+ poly_uint64 vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+ if (!vf.is_constant ())
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -3902,12 +3878,12 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
n = n->simdclone->next_clone)
{
unsigned int this_badness = 0;
- if (n->simdclone->simdlen > vf
+ unsigned int num_calls;
+ if (!constant_multiple_p (vf, n->simdclone->simdlen, &num_calls)
|| n->simdclone->nargs != nargs)
continue;
- if (n->simdclone->simdlen < vf)
- this_badness += (exact_log2 (vf)
- - exact_log2 (n->simdclone->simdlen)) * 1024;
+ if (num_calls != 1)
+ this_badness += exact_log2 (num_calls) * 1024;
if (n->simdclone->inbranch)
this_badness += 2048;
int target_badness = targetm.simd_clone.usable (n);
@@ -3988,19 +3964,19 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
arginfo[i].vectype = get_vectype_for_scalar_type (vinfo, arg_type,
slp_node);
if (arginfo[i].vectype == NULL
- || (simd_clone_subparts (arginfo[i].vectype)
- > bestn->simdclone->simdlen))
+ || !constant_multiple_p (bestn->simdclone->simdlen,
+ simd_clone_subparts (arginfo[i].vectype)))
return false;
}
fndecl = bestn->decl;
nunits = bestn->simdclone->simdlen;
- ncopies = vf / nunits;
+ ncopies = vector_unroll_factor (vf, nunits);
/* If the function isn't const, only allow it in simd loops where user
has asserted that at least nunits consecutive iterations can be
performed using SIMD instructions. */
- if ((loop == NULL || (unsigned) loop->safelen < nunits)
+ if ((loop == NULL || maybe_lt ((unsigned) loop->safelen, nunits))
&& gimple_vuse (stmt))
return false;
@@ -4078,7 +4054,8 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
{
case SIMD_CLONE_ARG_TYPE_VECTOR:
atype = bestn->simdclone->args[i].vector_type;
- o = nunits / simd_clone_subparts (atype);
+ o = vector_unroll_factor (nunits,
+ simd_clone_subparts (atype));
for (m = j * o; m < (j + 1) * o; m++)
{
if (simd_clone_subparts (atype)
@@ -4203,7 +4180,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
? POINTER_PLUS_EXPR : PLUS_EXPR;
tree type = POINTER_TYPE_P (TREE_TYPE (op))
? sizetype : TREE_TYPE (op);
- widest_int cst
+ poly_widest_int cst
= wi::mul (bestn->simdclone->args[i].linear_step,
ncopies * nunits);
tree tcst = wide_int_to_tree (type, cst);
@@ -4224,7 +4201,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
? POINTER_PLUS_EXPR : PLUS_EXPR;
tree type = POINTER_TYPE_P (TREE_TYPE (op))
? sizetype : TREE_TYPE (op);
- widest_int cst
+ poly_widest_int cst
= wi::mul (bestn->simdclone->args[i].linear_step,
j * nunits);
tree tcst = wide_int_to_tree (type, cst);
@@ -4250,7 +4227,8 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
gcall *new_call = gimple_build_call_vec (fndecl, vargs);
if (vec_dest)
{
- gcc_assert (ratype || simd_clone_subparts (rtype) == nunits);
+ gcc_assert (ratype
+ || known_eq (simd_clone_subparts (rtype), nunits));
if (ratype)
new_temp = create_tmp_var (ratype);
else if (useless_type_conversion_p (vectype, rtype))
@@ -4264,12 +4242,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
if (vec_dest)
{
- if (simd_clone_subparts (vectype) < nunits)
+ if (!multiple_p (simd_clone_subparts (vectype), nunits))
{
unsigned int k, l;
poly_uint64 prec = GET_MODE_BITSIZE (TYPE_MODE (vectype));
poly_uint64 bytes = GET_MODE_SIZE (TYPE_MODE (vectype));
- k = nunits / simd_clone_subparts (vectype);
+ k = vector_unroll_factor (nunits,
+ simd_clone_subparts (vectype));
gcc_assert ((k & (k - 1)) == 0);
for (l = 0; l < k; l++)
{
@@ -4295,7 +4274,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
vect_clobber_variable (vinfo, stmt_info, gsi, new_temp);
continue;
}
- else if (simd_clone_subparts (vectype) > nunits)
+ else if (!multiple_p (nunits, simd_clone_subparts (vectype)))
{
unsigned int k = (simd_clone_subparts (vectype)
/ simd_clone_subparts (rtype));
@@ -4304,7 +4283,9 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
vec_alloc (ret_ctor_elts, k);
if (ratype)
{
- unsigned int m, o = nunits / simd_clone_subparts (rtype);
+ unsigned int m, o;
+ o = vector_unroll_factor (nunits,
+ simd_clone_subparts (rtype));
for (m = 0; m < o; m++)
{
tree tem = build4 (ARRAY_REF, rtype, new_temp,
@@ -10745,7 +10726,8 @@ vect_analyze_stmt (vec_info *vinfo,
|| vectorizable_condition (vinfo, stmt_info,
NULL, NULL, node, cost_vec)
|| vectorizable_comparison (vinfo, stmt_info, NULL, NULL, node,
- cost_vec));
+ cost_vec)
+ || vectorizable_phi (vinfo, stmt_info, NULL, node, cost_vec));
}
if (!ok)
@@ -10885,6 +10867,11 @@ vect_transform_stmt (vec_info *vinfo,
gcc_assert (done);
break;
+ case phi_info_type:
+ done = vectorizable_phi (vinfo, stmt_info, &vec_stmt, slp_node, NULL);
+ gcc_assert (done);
+ break;
+
default:
if (!STMT_VINFO_LIVE_P (stmt_info))
{
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 02da755..b63dda3 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -684,13 +684,13 @@ vec_info::new_stmt_vec_info (gimple *stmt)
STMT_VINFO_SLP_VECT_ONLY (res) = false;
STMT_VINFO_VEC_STMTS (res) = vNULL;
- if (gimple_code (stmt) == GIMPLE_PHI
+ if (is_a <loop_vec_info> (this)
+ && gimple_code (stmt) == GIMPLE_PHI
&& is_loop_header_bb_p (gimple_bb (stmt)))
STMT_VINFO_DEF_TYPE (res) = vect_unknown_def_type;
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. */
@@ -746,7 +746,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);
@@ -1172,6 +1171,8 @@ vectorize_loops (void)
if (vect_loops_num <= 1)
return 0;
+ slp_tree_pool = new object_allocator<_slp_tree> ("SLP nodes for vect");
+
if (cfun->has_simduid_loops)
note_simd_array_uses (&simd_array_to_simduid_htab);
@@ -1294,6 +1295,8 @@ vectorize_loops (void)
shrink_simd_arrays (simd_array_to_simduid_htab, simduid_to_vf_htab);
delete simduid_to_vf_htab;
cfun->has_simduid_loops = false;
+ delete slp_tree_pool;
+ slp_tree_pool = NULL;
if (num_vectorized_loops > 0)
{
@@ -1429,8 +1432,13 @@ pass_slp_vectorize::execute (function *fun)
}
}
+ slp_tree_pool = new object_allocator<_slp_tree> ("SLP nodes for slp");
+
vect_slp_function (fun);
+ delete slp_tree_pool;
+ slp_tree_pool = NULL;
+
if (!in_loop_pipeline)
{
scev_finalize ();
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 2a8c4a5..3ccd0fd 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -26,6 +26,7 @@ typedef class _stmt_vec_info *stmt_vec_info;
#include "tree-data-ref.h"
#include "tree-hash-traits.h"
#include "target.h"
+#include "alloc-pool.h"
/* Used for naming of new temporaries. */
@@ -115,6 +116,8 @@ typedef hash_map<tree_operand_hash,
************************************************************************/
typedef struct _slp_tree *slp_tree;
+extern object_allocator<_slp_tree> *slp_tree_pool;
+
/* A computation tree of an SLP instance. Each node corresponds to a group of
stmts to be packed in a SIMD stmt. */
struct _slp_tree {
@@ -163,8 +166,23 @@ struct _slp_tree {
enum tree_code code;
int vertex;
+
+ /* Allocate from slp_tree_pool. */
+ static void *operator new (size_t);
+
+ /* Return memory to slp_tree_pool. */
+ static void operator delete (void *, size_t);
};
+/* The enum describes the type of operations that an SLP instance
+ can perform. */
+
+enum slp_instance_kind {
+ slp_inst_kind_store,
+ slp_inst_kind_reduc_group,
+ slp_inst_kind_reduc_chain,
+ slp_inst_kind_ctor
+};
/* SLP instance is a sequence of stmts in a loop that can be packed into
SIMD stmts. */
@@ -193,6 +211,9 @@ public:
entries into the same subgraph, including itself. */
vec<_slp_instance *> subgraph_entries;
+ /* The type of operation the SLP instance is performing. */
+ slp_instance_kind kind;
+
dump_user_location_t location () const;
} *slp_instance;
@@ -202,6 +223,7 @@ public:
#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_ROOT_STMT(S) (S)->root_stmt
+#define SLP_INSTANCE_KIND(S) (S)->kind
#define SLP_TREE_CHILDREN(S) (S)->children
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
@@ -872,6 +894,7 @@ enum stmt_vec_info_type {
type_conversion_vec_info_type,
cycle_phi_info_type,
lc_phi_info_type,
+ phi_info_type,
loop_exit_ctrl_vec_info_type
};
@@ -1058,10 +1081,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). */
@@ -1251,7 +1270,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) \
@@ -1935,6 +1953,8 @@ extern bool vect_transform_cycle_phi (loop_vec_info, stmt_vec_info,
slp_tree, slp_instance);
extern bool vectorizable_lc_phi (loop_vec_info, stmt_vec_info,
gimple **, slp_tree);
+extern bool vectorizable_phi (vec_info *, stmt_vec_info, gimple **, slp_tree,
+ stmt_vector_for_cost *);
extern bool vect_worthwhile_without_simd_p (vec_info *, tree_code);
extern int vect_get_known_peeling_cost (loop_vec_info, int, int *,
stmt_vector_for_cost *,
@@ -1946,7 +1966,8 @@ extern tree cse_and_gimplify_to_preheader (loop_vec_info, tree);
extern void vect_free_slp_instance (slp_instance);
extern bool vect_transform_slp_perm_load (vec_info *, slp_tree, vec<tree>,
gimple_stmt_iterator *, poly_uint64,
- bool, unsigned *);
+ bool, unsigned *,
+ unsigned * = nullptr);
extern bool vect_slp_analyze_operations (vec_info *);
extern void vect_schedule_slp (vec_info *, vec<slp_instance>);
extern opt_result vect_analyze_slp (vec_info *, unsigned);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 0e19690..e00c034 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4395,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
@@ -4482,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 555ba97..9260772 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -291,6 +291,7 @@ unsigned const char omp_clause_num_ops[] =
1, /* OMP_CLAUSE_COPYPRIVATE */
3, /* OMP_CLAUSE_LINEAR */
2, /* OMP_CLAUSE_ALIGNED */
+ 2, /* OMP_CLAUSE_ALLOCATE */
1, /* OMP_CLAUSE_DEPEND */
1, /* OMP_CLAUSE_NONTEMPORAL */
1, /* OMP_CLAUSE_UNIFORM */
@@ -375,6 +376,7 @@ const char * const omp_clause_code_name[] =
"copyprivate",
"linear",
"aligned",
+ "allocate",
"depend",
"nontemporal",
"uniform",
@@ -1735,6 +1737,8 @@ cache_integer_cst (tree t)
gcc_assert (!TREE_OVERFLOW (t));
+ /* The caching indices here must match those in
+ wide_int_to_type_1. */
switch (TREE_CODE (type))
{
case NULLPTR_TYPE:
@@ -1743,12 +1747,15 @@ cache_integer_cst (tree t)
case POINTER_TYPE:
case REFERENCE_TYPE:
- /* Cache NULL pointer. */
- if (integer_zerop (t))
- {
- limit = 1;
+ {
+ if (integer_zerop (t))
ix = 0;
- }
+ else if (integer_onep (t))
+ ix = 2;
+
+ if (ix >= 0)
+ limit = 3;
+ }
break;
case BOOLEAN_TYPE:
@@ -2248,6 +2255,22 @@ build_real_from_int_cst (tree type, const_tree i)
return v;
}
+/* Return a new REAL_CST node whose type is TYPE
+ and whose value is the integer value I which has sign SGN. */
+
+tree
+build_real_from_wide (tree type, const wide_int_ref &i, signop sgn)
+{
+ REAL_VALUE_TYPE d;
+
+ /* Clear all bits of the real value type so that we can later do
+ bitwise comparisons to see if two values are the same. */
+ memset (&d, 0, sizeof d);
+
+ real_from_integer (&d, TYPE_MODE (type), i, sgn);
+ return build_real (type, d);
+}
+
/* Return a newly constructed STRING_CST node whose value is the LEN
characters at STR when STR is nonnull, or all zeros otherwise.
Note that for a C string literal, LEN should include the trailing NUL.
@@ -5777,7 +5800,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;
@@ -10514,7 +10537,7 @@ set_call_expr_flags (tree decl, int flags)
if (flags & ECF_RET1)
DECL_ATTRIBUTES (decl)
= tree_cons (get_identifier ("fn spec"),
- build_tree_list (NULL_TREE, build_string (1, "1")),
+ build_tree_list (NULL_TREE, build_string (2, "1 ")),
DECL_ATTRIBUTES (decl));
if ((flags & ECF_TM_PURE) && flag_tm)
apply_tm_attr (decl, get_identifier ("transaction_pure"));
@@ -10576,10 +10599,10 @@ build_common_builtin_nodes (void)
if (!builtin_decl_explicit_p (BUILT_IN_MEMCPY))
local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY,
- "memcpy", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
+ "memcpy", ECF_NOTHROW | ECF_LEAF);
if (!builtin_decl_explicit_p (BUILT_IN_MEMMOVE))
local_define_builtin ("__builtin_memmove", ftype, BUILT_IN_MEMMOVE,
- "memmove", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
+ "memmove", ECF_NOTHROW | ECF_LEAF);
}
if (!builtin_decl_explicit_p (BUILT_IN_MEMCMP))
@@ -10597,7 +10620,7 @@ build_common_builtin_nodes (void)
ptr_type_node, integer_type_node,
size_type_node, NULL_TREE);
local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET,
- "memset", ECF_NOTHROW | ECF_LEAF | ECF_RET1);
+ "memset", ECF_NOTHROW | ECF_LEAF);
}
/* If we're checking the stack, `alloca' can throw. */
@@ -10926,8 +10949,15 @@ build_truth_vector_type_for_mode (poly_uint64 nunits, machine_mode mask_mode)
{
gcc_assert (mask_mode != BLKmode);
- poly_uint64 vsize = GET_MODE_BITSIZE (mask_mode);
- unsigned HOST_WIDE_INT esize = vector_element_size (vsize, nunits);
+ unsigned HOST_WIDE_INT esize;
+ if (VECTOR_MODE_P (mask_mode))
+ {
+ poly_uint64 vsize = GET_MODE_BITSIZE (mask_mode);
+ esize = vector_element_size (vsize, nunits);
+ }
+ else
+ esize = 1;
+
tree bool_type = build_nonstandard_boolean_type (esize);
return make_vector_type (bool_type, nunits, mask_mode);
@@ -12206,6 +12236,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
case OMP_CLAUSE_ALIGNED:
+ case OMP_CLAUSE_ALLOCATE:
case OMP_CLAUSE_FROM:
case OMP_CLAUSE_TO:
case OMP_CLAUSE_MAP:
diff --git a/gcc/tree.h b/gcc/tree.h
index f43ac9f..f8f0a60 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1731,6 +1731,16 @@ class auto_suppress_location_wrappers
#define OMP_CLAUSE_ALIGNED_ALIGNMENT(NODE) \
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ALIGNED), 1)
+#define OMP_CLAUSE_ALLOCATE_ALLOCATOR(NODE) \
+ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ALLOCATE), 1)
+
+/* True if an ALLOCATE clause was present on a combined or composite
+ construct and the code for splitting the clauses has already performed
+ checking if the listed variable has explicit privatization on the
+ construct. */
+#define OMP_CLAUSE_ALLOCATE_COMBINED(NODE) \
+ (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ALLOCATE)->base.public_flag)
+
#define OMP_CLAUSE_NUM_TEAMS_EXPR(NODE) \
OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TEAMS), 0)
@@ -2446,11 +2456,12 @@ extern tree vector_element_bits_tree (const_tree);
#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
#define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE))
-/* This accessor returns TRUE if the decl it operates on was created
- by a front-end or back-end rather than by user code. In this case
- builtin-ness is indicated by source location. */
-#define DECL_IS_BUILTIN(DECL) \
- (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)
+/* This decl was created by a front-end or back-end rather than by
+ user code, and has not been explicitly declared by the user -- when
+ that happens the source location is updated to the user's
+ source. This includes decls with no location (!). */
+#define DECL_IS_UNDECLARED_BUILTIN(DECL) \
+ (DECL_SOURCE_LOCATION (DECL) <= BUILTINS_LOCATION)
/* For FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or
QUAL_UNION_TYPE node that the field is a member of. For VAR_DECL,
@@ -3849,7 +3860,7 @@ id_equal (const_tree id, const char *str)
inline bool
id_equal (const char *str, const_tree id)
{
- return !strcmp (str, IDENTIFIER_POINTER (id));
+ return id_equal (id, str);
}
/* Return the number of elements in the VECTOR_TYPE given by NODE. */
@@ -4419,6 +4430,7 @@ extern tree build_constructor_from_vec (tree, const vec<tree, va_gc> *);
extern tree build_constructor_va (tree, int, ...);
extern tree build_clobber (tree);
extern tree build_real_from_int_cst (tree, const_tree);
+extern tree build_real_from_wide (tree, const wide_int_ref &, signop);
extern tree build_complex (tree, tree, tree);
extern tree build_complex_inf (tree, bool);
extern tree build_each_one_cst (tree);
@@ -6267,9 +6279,8 @@ type_has_mode_precision_p (const_tree t)
/* Return true if a FUNCTION_DECL NODE is a GCC built-in function.
- Note that it is different from the DECL_IS_BUILTIN accessor. For
- instance, user declared prototypes of C library functions are not
- DECL_IS_BUILTIN but may be fndecl_built_in_p. */
+ Note that it is different from the DECL_IS_UNDECLARED_BUILTIN
+ accessor, as this is impervious to user declaration. */
inline bool
fndecl_built_in_p (const_tree node)
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 95d33c6..db4fb8a 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1222,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
index 5370a23..f9a948f 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -78,12 +78,20 @@ tree
range_query::value_of_expr (tree name, gimple *stmt)
{
tree t;
- value_range r;
+ int_range_max r;
if (!irange::supports_type_p (TREE_TYPE (name)))
return NULL_TREE;
- if (range_of_expr (r, name, stmt) && r.singleton_p (&t))
- return t;
+
+ 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;
}
@@ -91,12 +99,19 @@ tree
range_query::value_on_edge (edge e, tree name)
{
tree t;
- value_range r;
+ int_range_max r;
if (!irange::supports_type_p (TREE_TYPE (name)))
return NULL_TREE;
- if (range_on_edge (r, e, name) && r.singleton_p (&t))
- return t;
+ 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;
}
@@ -105,7 +120,7 @@ tree
range_query::value_of_stmt (gimple *stmt, tree name)
{
tree t;
- value_range r;
+ int_range_max r;
if (!name)
name = gimple_get_lhs (stmt);
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index cdcc6c6..f83a824 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,51 +77,68 @@ 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 ());
}
}
-// Swap min/max if they are out of order. Return TRUE if further
-// processing of the range is necessary, FALSE otherwise.
+// Copy any type of irange into a legacy.
-bool
-irange::swap_out_of_order_endpoints (tree &min, tree &max,
- value_range_kind &kind)
+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 and adjust KIND appropriately.
+
+static void
+swap_out_of_order_endpoints (tree &min, tree &max, value_range_kind &kind)
+{
+ gcc_checking_assert (kind != VR_UNDEFINED);
+ if (kind == VR_VARYING)
+ return;
/* Wrong order for min and max, to swap them and the VR type we need
to adjust them. */
if (tree_int_cst_lt (max, min))
@@ -137,8 +150,8 @@ irange::swap_out_of_order_endpoints (tree &min, tree &max,
for VR_ANTI_RANGE empty range, so drop to varying as well. */
if (TYPE_PRECISION (TREE_TYPE (min)) == 1)
{
- set_varying (TREE_TYPE (min));
- return false;
+ kind = VR_VARYING;
+ return;
}
one = build_int_cst (TREE_TYPE (min), 1);
@@ -151,12 +164,11 @@ irange::swap_out_of_order_endpoints (tree &min, tree &max,
to varying in this case. */
if (tree_int_cst_lt (max, min))
{
- set_varying (TREE_TYPE (min));
- return false;
+ kind = VR_VARYING;
+ return;
}
kind = kind == VR_RANGE ? VR_ANTI_RANGE : VR_RANGE;
}
- return true;
}
void
@@ -236,38 +248,11 @@ irange::set (tree min, tree max, value_range_kind kind)
set_undefined ();
return;
}
- if (kind == VR_RANGE)
- {
- /* Convert POLY_INT_CST bounds into worst-case INTEGER_CST bounds. */
- if (POLY_INT_CST_P (min))
- {
- tree type_min = vrp_val_min (TREE_TYPE (min));
- widest_int lb
- = constant_lower_bound_with_limit (wi::to_poly_widest (min),
- wi::to_widest (type_min));
- min = wide_int_to_tree (TREE_TYPE (min), lb);
- }
- if (POLY_INT_CST_P (max))
- {
- tree type_max = vrp_val_max (TREE_TYPE (max));
- widest_int ub
- = constant_upper_bound_with_limit (wi::to_poly_widest (max),
- wi::to_widest (type_max));
- max = wide_int_to_tree (TREE_TYPE (max), ub);
- }
- }
- else if (kind != VR_VARYING)
- {
- if (POLY_INT_CST_P (min) || POLY_INT_CST_P (max))
- kind = VR_VARYING;
- }
- if (kind == VR_VARYING)
- {
- set_varying (TREE_TYPE (min));
- return;
- }
- tree type = TREE_TYPE (min);
+ if (kind != VR_VARYING
+ && (POLY_INT_CST_P (min) || POLY_INT_CST_P (max)))
+ kind = VR_VARYING;
+
// Nothing to canonicalize for symbolic ranges.
if (TREE_CODE (min) != INTEGER_CST
|| TREE_CODE (max) != INTEGER_CST)
@@ -278,8 +263,13 @@ irange::set (tree min, tree max, value_range_kind kind)
m_num_ranges = 1;
return;
}
- if (!swap_out_of_order_endpoints (min, max, kind))
- goto cleanup_set;
+
+ swap_out_of_order_endpoints (min, max, kind);
+ if (kind == VR_VARYING)
+ {
+ set_varying (TREE_TYPE (min));
+ return;
+ }
// Anti-ranges that can be represented as ranges should be so.
if (kind == VR_ANTI_RANGE)
@@ -288,6 +278,7 @@ irange::set (tree min, tree max, value_range_kind kind)
values < -INF and values > INF as -INF/INF as well. */
bool is_min = vrp_val_is_min (min);
bool is_max = vrp_val_is_max (max);
+ tree type = TREE_TYPE (min);
if (is_min && is_max)
{
@@ -322,38 +313,17 @@ irange::set (tree min, tree max, value_range_kind kind)
kind = VR_RANGE;
}
}
- else if (!swap_out_of_order_endpoints (min, max, kind))
- goto cleanup_set;
- /* Do not drop [-INF(OVF), +INF(OVF)] to varying. (OVF) has to be sticky
- to make sure VRP iteration terminates, otherwise we can get into
- oscillations. */
- if (!normalize_min_max (type, min, max, kind))
- {
- m_kind = kind;
- m_base[0] = min;
- m_base[1] = max;
- m_num_ranges = 1;
- if (flag_checking)
- verify_range ();
- }
-
- cleanup_set:
- // Avoid using TYPE_{MIN,MAX}_VALUE because -fstrict-enums can
- // restrict those to a subset of what actually fits in the type.
- // Instead use the extremes of the type precision
- unsigned prec = TYPE_PRECISION (type);
- signop sign = TYPE_SIGN (type);
- if (wi::eq_p (wi::to_wide (min), wi::min_value (prec, sign))
- && wi::eq_p (wi::to_wide (max), wi::max_value (prec, sign)))
- m_kind = VR_VARYING;
- else if (undefined_p ())
- m_kind = VR_UNDEFINED;
+ m_kind = kind;
+ m_base[0] = min;
+ m_base[1] = max;
+ m_num_ranges = 1;
+ normalize_min_max ();
if (flag_checking)
verify_range ();
}
-/* Check the validity of the range. */
+// Check the validity of the range.
void
irange::verify_range ()
@@ -1760,19 +1730,30 @@ irange::irange_intersect (const irange &r)
verify_range ();
}
+// Signed 1-bits are strange. You can't subtract 1, because you can't
+// represent the number 1. This works around that for the invert routine.
+
static wide_int inline
subtract_one (const wide_int &x, tree type, wi::overflow_type &overflow)
{
- // A signed 1-bit bit-field, has a range of [-1,0] so subtracting +1
- // overflows, since +1 is unrepresentable. This is why we have an
- // addition of -1 here.
if (TYPE_SIGN (type) == SIGNED)
- return wi::add (x, -1 , SIGNED, &overflow);
+ return wi::add (x, -1, SIGNED, &overflow);
else
return wi::sub (x, 1, UNSIGNED, &overflow);
}
-/* Return the inverse of a range. */
+// The analogous function for adding 1.
+
+static wide_int inline
+add_one (const wide_int &x, tree type, wi::overflow_type &overflow)
+{
+ if (TYPE_SIGN (type) == SIGNED)
+ return wi::sub (x, -1, SIGNED, &overflow);
+ else
+ return wi::add (x, 1, UNSIGNED, &overflow);
+}
+
+// Return the inverse of a range.
void
irange::invert ()
@@ -1869,7 +1850,7 @@ irange::invert ()
// set the overflow bit.
if (type_max != wi::to_wide (orig_range.m_base[i]))
{
- tmp = wi::add (wi::to_wide (orig_range.m_base[i]), 1, sign, &ovf);
+ tmp = add_one (wi::to_wide (orig_range.m_base[i]), ttype, ovf);
m_base[nitems++] = wide_int_to_tree (ttype, tmp);
m_base[nitems++] = wide_int_to_tree (ttype, type_max);
if (ovf)
@@ -1885,12 +1866,17 @@ static void
dump_bound_with_infinite_markers (FILE *file, tree bound)
{
tree type = TREE_TYPE (bound);
+ wide_int type_min = wi::min_value (TYPE_PRECISION (type), TYPE_SIGN (type));
+ wide_int type_max = wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type));
+
if (INTEGRAL_TYPE_P (type)
&& !TYPE_UNSIGNED (type)
- && vrp_val_is_min (bound)
+ && TREE_CODE (bound) == INTEGER_CST
+ && wi::to_wide (bound) == type_min
&& TYPE_PRECISION (type) != 1)
fprintf (file, "-INF");
- else if (vrp_val_is_max (bound)
+ else if (TREE_CODE (bound) == INTEGER_CST
+ && wi::to_wide (bound) == type_max
&& TYPE_PRECISION (type) != 1)
fprintf (file, "+INF");
else
@@ -2087,3 +2073,416 @@ DEFINE_INT_RANGE_INSTANCE(2)
DEFINE_INT_RANGE_INSTANCE(3)
DEFINE_INT_RANGE_INSTANCE(255)
DEFINE_INT_RANGE_GC_STUBS(1)
+
+#if CHECKING_P
+#include "selftest.h"
+
+namespace selftest
+{
+#define INT(N) build_int_cst (integer_type_node, (N))
+#define UINT(N) build_int_cstu (unsigned_type_node, (N))
+#define UINT128(N) build_int_cstu (u128_type, (N))
+#define UCHAR(N) build_int_cstu (unsigned_char_type_node, (N))
+#define SCHAR(N) build_int_cst (signed_char_type_node, (N))
+
+static int_range<3>
+build_range3 (int a, int b, int c, int d, int e, int f)
+{
+ int_range<3> i1 (INT (a), INT (b));
+ int_range<3> i2 (INT (c), INT (d));
+ int_range<3> i3 (INT (e), INT (f));
+ i1.union_ (i2);
+ i1.union_ (i3);
+ return i1;
+}
+
+static void
+range_tests_irange3 ()
+{
+ typedef int_range<3> int_range3;
+ int_range3 r0, r1, r2;
+ int_range3 i1, i2, i3;
+
+ // ([10,20] U [5,8]) U [1,3] ==> [1,3][5,8][10,20].
+ r0 = int_range3 (INT (10), INT (20));
+ r1 = int_range3 (INT (5), INT (8));
+ r0.union_ (r1);
+ r1 = int_range3 (INT (1), INT (3));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == build_range3 (1, 3, 5, 8, 10, 20));
+
+ // [1,3][5,8][10,20] U [-5,0] => [-5,3][5,8][10,20].
+ r1 = int_range3 (INT (-5), INT (0));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == build_range3 (-5, 3, 5, 8, 10, 20));
+
+ // [10,20][30,40] U [50,60] ==> [10,20][30,40][50,60].
+ r1 = int_range3 (INT (50), INT (60));
+ r0 = int_range3 (INT (10), INT (20));
+ r0.union_ (int_range3 (INT (30), INT (40)));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == build_range3 (10, 20, 30, 40, 50, 60));
+ // [10,20][30,40][50,60] U [70, 80] ==> [10,20][30,40][50,60][70,80].
+ r1 = int_range3 (INT (70), INT (80));
+ r0.union_ (r1);
+
+ r2 = build_range3 (10, 20, 30, 40, 50, 60);
+ r2.union_ (int_range3 (INT (70), INT (80)));
+ ASSERT_TRUE (r0 == r2);
+
+ // [10,20][30,40][50,60] U [6,35] => [6,40][50,60].
+ r0 = build_range3 (10, 20, 30, 40, 50, 60);
+ r1 = int_range3 (INT (6), INT (35));
+ r0.union_ (r1);
+ r1 = int_range3 (INT (6), INT (40));
+ r1.union_ (int_range3 (INT (50), INT (60)));
+ ASSERT_TRUE (r0 == r1);
+
+ // [10,20][30,40][50,60] U [6,60] => [6,60].
+ r0 = build_range3 (10, 20, 30, 40, 50, 60);
+ r1 = int_range3 (INT (6), INT (60));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == int_range3 (INT (6), INT (60)));
+
+ // [10,20][30,40][50,60] U [6,70] => [6,70].
+ r0 = build_range3 (10, 20, 30, 40, 50, 60);
+ r1 = int_range3 (INT (6), INT (70));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == int_range3 (INT (6), INT (70)));
+
+ // [10,20][30,40][50,60] U [35,70] => [10,20][30,70].
+ r0 = build_range3 (10, 20, 30, 40, 50, 60);
+ r1 = int_range3 (INT (35), INT (70));
+ r0.union_ (r1);
+ r1 = int_range3 (INT (10), INT (20));
+ r1.union_ (int_range3 (INT (30), INT (70)));
+ ASSERT_TRUE (r0 == r1);
+
+ // [10,20][30,40][50,60] U [15,35] => [10,40][50,60].
+ r0 = build_range3 (10, 20, 30, 40, 50, 60);
+ r1 = int_range3 (INT (15), INT (35));
+ r0.union_ (r1);
+ r1 = int_range3 (INT (10), INT (40));
+ r1.union_ (int_range3 (INT (50), INT (60)));
+ ASSERT_TRUE (r0 == r1);
+
+ // [10,20][30,40][50,60] U [35,35] => [10,20][30,40][50,60].
+ r0 = build_range3 (10, 20, 30, 40, 50, 60);
+ r1 = int_range3 (INT (35), INT (35));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == build_range3 (10, 20, 30, 40, 50, 60));
+}
+
+static void
+range_tests_int_range_max ()
+{
+ int_range_max big;
+ unsigned int nrange;
+
+ // Build a huge multi-range range.
+ for (nrange = 0; nrange < 50; ++nrange)
+ {
+ int_range<1> tmp (INT (nrange*10), INT (nrange*10 + 5));
+ big.union_ (tmp);
+ }
+ ASSERT_TRUE (big.num_pairs () == nrange);
+
+ // Verify that we can copy it without loosing precision.
+ int_range_max copy (big);
+ ASSERT_TRUE (copy.num_pairs () == nrange);
+
+ // Inverting it should produce one more sub-range.
+ big.invert ();
+ ASSERT_TRUE (big.num_pairs () == nrange + 1);
+
+ int_range<1> tmp (INT (5), INT (37));
+ big.intersect (tmp);
+ ASSERT_TRUE (big.num_pairs () == 4);
+
+ // Test that [10,10][20,20] does NOT contain 15.
+ {
+ int_range_max i1 (build_int_cst (integer_type_node, 10),
+ build_int_cst (integer_type_node, 10));
+ int_range_max i2 (build_int_cst (integer_type_node, 20),
+ build_int_cst (integer_type_node, 20));
+ i1.union_ (i2);
+ ASSERT_FALSE (i1.contains_p (build_int_cst (integer_type_node, 15)));
+ }
+}
+
+static void
+range_tests_legacy ()
+{
+ // Test truncating copy to int_range<1>.
+ int_range<3> big = build_range3 (10, 20, 30, 40, 50, 60);
+ int_range<1> small = big;
+ ASSERT_TRUE (small == int_range<1> (INT (10), INT (60)));
+
+ // Test truncating copy to int_range<2>.
+ int_range<2> medium = big;
+ ASSERT_TRUE (!medium.undefined_p ());
+
+ // Test that a truncating copy of [MIN,20][22,40][80,MAX]
+ // ends up as a conservative anti-range of ~[21,21].
+ big = int_range<3> (vrp_val_min (integer_type_node), INT (20));
+ big.union_ (int_range<1> (INT (22), INT (40)));
+ big.union_ (int_range<1> (INT (80), vrp_val_max (integer_type_node)));
+ small = big;
+ ASSERT_TRUE (small == int_range<1> (INT (21), INT (21), VR_ANTI_RANGE));
+
+ // Copying a legacy symbolic to an int_range should normalize the
+ // symbolic at copy time.
+ {
+ tree ssa = make_ssa_name (integer_type_node);
+ value_range legacy_range (ssa, INT (25));
+ int_range<2> copy = legacy_range;
+ ASSERT_TRUE (copy == int_range<2> (vrp_val_min (integer_type_node),
+ INT (25)));
+
+ // Test that copying ~[abc_23, abc_23] to a multi-range yields varying.
+ legacy_range = value_range (ssa, ssa, VR_ANTI_RANGE);
+ copy = legacy_range;
+ ASSERT_TRUE (copy.varying_p ());
+ }
+}
+
+// Simulate -fstrict-enums where the domain of a type is less than the
+// underlying type.
+
+static void
+range_tests_strict_enum ()
+{
+ // The enum can only hold [0, 3].
+ tree rtype = copy_node (unsigned_type_node);
+ TYPE_MIN_VALUE (rtype) = build_int_cstu (rtype, 0);
+ TYPE_MAX_VALUE (rtype) = build_int_cstu (rtype, 3);
+
+ // Test that even though vr1 covers the strict enum domain ([0, 3]),
+ // it does not cover the domain of the underlying type.
+ int_range<1> vr1 (build_int_cstu (rtype, 0), build_int_cstu (rtype, 1));
+ int_range<1> vr2 (build_int_cstu (rtype, 2), build_int_cstu (rtype, 3));
+ vr1.union_ (vr2);
+ ASSERT_TRUE (vr1 == int_range<1> (build_int_cstu (rtype, 0),
+ build_int_cstu (rtype, 3)));
+ ASSERT_FALSE (vr1.varying_p ());
+
+ // Test that copying to a multi-range does not change things.
+ int_range<2> ir1 (vr1);
+ ASSERT_TRUE (ir1 == vr1);
+ ASSERT_FALSE (ir1.varying_p ());
+
+ // The same test as above, but using TYPE_{MIN,MAX}_VALUE instead of [0,3].
+ vr1 = int_range<1> (TYPE_MIN_VALUE (rtype), TYPE_MAX_VALUE (rtype));
+ ir1 = vr1;
+ ASSERT_TRUE (ir1 == vr1);
+ ASSERT_FALSE (ir1.varying_p ());
+}
+
+static void
+range_tests_misc ()
+{
+ tree u128_type = build_nonstandard_integer_type (128, /*unsigned=*/1);
+ int_range<1> i1, i2, i3;
+ int_range<1> r0, r1, rold;
+
+ // Test 1-bit signed integer union.
+ // [-1,-1] U [0,0] = VARYING.
+ tree one_bit_type = build_nonstandard_integer_type (1, 0);
+ tree one_bit_min = vrp_val_min (one_bit_type);
+ tree one_bit_max = vrp_val_max (one_bit_type);
+ {
+ int_range<2> min (one_bit_min, one_bit_min);
+ int_range<2> max (one_bit_max, one_bit_max);
+ max.union_ (min);
+ ASSERT_TRUE (max.varying_p ());
+ }
+
+ // Test inversion of 1-bit signed integers.
+ {
+ int_range<2> min (one_bit_min, one_bit_min);
+ int_range<2> max (one_bit_max, one_bit_max);
+ int_range<2> t;
+ t = min;
+ t.invert ();
+ ASSERT_TRUE (t == max);
+ t = max;
+ t.invert ();
+ ASSERT_TRUE (t == min);
+ }
+
+ // Test that NOT(255) is [0..254] in 8-bit land.
+ int_range<1> not_255 (UCHAR (255), UCHAR (255), VR_ANTI_RANGE);
+ ASSERT_TRUE (not_255 == int_range<1> (UCHAR (0), UCHAR (254)));
+
+ // Test that NOT(0) is [1..255] in 8-bit land.
+ int_range<1> not_zero = range_nonzero (unsigned_char_type_node);
+ ASSERT_TRUE (not_zero == int_range<1> (UCHAR (1), UCHAR (255)));
+
+ // Check that [0,127][0x..ffffff80,0x..ffffff]
+ // => ~[128, 0x..ffffff7f].
+ r0 = int_range<1> (UINT128 (0), UINT128 (127));
+ tree high = build_minus_one_cst (u128_type);
+ // low = -1 - 127 => 0x..ffffff80.
+ tree low = fold_build2 (MINUS_EXPR, u128_type, high, UINT128(127));
+ r1 = int_range<1> (low, high); // [0x..ffffff80, 0x..ffffffff]
+ // r0 = [0,127][0x..ffffff80,0x..fffffff].
+ r0.union_ (r1);
+ // r1 = [128, 0x..ffffff7f].
+ r1 = int_range<1> (UINT128(128),
+ fold_build2 (MINUS_EXPR, u128_type,
+ build_minus_one_cst (u128_type),
+ UINT128(128)));
+ r0.invert ();
+ ASSERT_TRUE (r0 == r1);
+
+ r0.set_varying (integer_type_node);
+ tree minint = wide_int_to_tree (integer_type_node, r0.lower_bound ());
+ tree maxint = wide_int_to_tree (integer_type_node, r0.upper_bound ());
+
+ r0.set_varying (short_integer_type_node);
+
+ r0.set_varying (unsigned_type_node);
+ tree maxuint = wide_int_to_tree (unsigned_type_node, r0.upper_bound ());
+
+ // Check that ~[0,5] => [6,MAX] for unsigned int.
+ r0 = int_range<1> (UINT (0), UINT (5));
+ r0.invert ();
+ ASSERT_TRUE (r0 == int_range<1> (UINT(6), maxuint));
+
+ // Check that ~[10,MAX] => [0,9] for unsigned int.
+ r0 = int_range<1> (UINT(10), maxuint);
+ r0.invert ();
+ ASSERT_TRUE (r0 == int_range<1> (UINT (0), UINT (9)));
+
+ // Check that ~[0,5] => [6,MAX] for unsigned 128-bit numbers.
+ r0 = int_range<1> (UINT128 (0), UINT128 (5), VR_ANTI_RANGE);
+ r1 = int_range<1> (UINT128(6), build_minus_one_cst (u128_type));
+ ASSERT_TRUE (r0 == r1);
+
+ // Check that [~5] is really [-MIN,4][6,MAX].
+ r0 = int_range<1> (INT (5), INT (5), VR_ANTI_RANGE);
+ r1 = int_range<1> (minint, INT (4));
+ r1.union_ (int_range<1> (INT (6), maxint));
+ ASSERT_FALSE (r1.undefined_p ());
+ ASSERT_TRUE (r0 == r1);
+
+ r1 = int_range<1> (INT (5), INT (5));
+ int_range<1> r2 (r1);
+ ASSERT_TRUE (r1 == r2);
+
+ r1 = int_range<1> (INT (5), INT (10));
+
+ r1 = int_range<1> (integer_type_node,
+ wi::to_wide (INT (5)), wi::to_wide (INT (10)));
+ ASSERT_TRUE (r1.contains_p (INT (7)));
+
+ r1 = int_range<1> (SCHAR (0), SCHAR (20));
+ ASSERT_TRUE (r1.contains_p (SCHAR(15)));
+ ASSERT_FALSE (r1.contains_p (SCHAR(300)));
+
+ // NOT([10,20]) ==> [-MIN,9][21,MAX].
+ r0 = r1 = int_range<1> (INT (10), INT (20));
+ r2 = int_range<1> (minint, INT(9));
+ r2.union_ (int_range<1> (INT(21), maxint));
+ ASSERT_FALSE (r2.undefined_p ());
+ r1.invert ();
+ ASSERT_TRUE (r1 == r2);
+ // Test that NOT(NOT(x)) == x.
+ r2.invert ();
+ ASSERT_TRUE (r0 == r2);
+
+ // Test that booleans and their inverse work as expected.
+ r0 = range_zero (boolean_type_node);
+ ASSERT_TRUE (r0 == int_range<1> (build_zero_cst (boolean_type_node),
+ build_zero_cst (boolean_type_node)));
+ r0.invert ();
+ ASSERT_TRUE (r0 == int_range<1> (build_one_cst (boolean_type_node),
+ build_one_cst (boolean_type_node)));
+
+ // Make sure NULL and non-NULL of pointer types work, and that
+ // inverses of them are consistent.
+ tree voidp = build_pointer_type (void_type_node);
+ r0 = range_zero (voidp);
+ r1 = r0;
+ r0.invert ();
+ r0.invert ();
+ ASSERT_TRUE (r0 == r1);
+
+ // [10,20] U [15, 30] => [10, 30].
+ r0 = int_range<1> (INT (10), INT (20));
+ r1 = int_range<1> (INT (15), INT (30));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == int_range<1> (INT (10), INT (30)));
+
+ // [15,40] U [] => [15,40].
+ r0 = int_range<1> (INT (15), INT (40));
+ r1.set_undefined ();
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == int_range<1> (INT (15), INT (40)));
+
+ // [10,20] U [10,10] => [10,20].
+ r0 = int_range<1> (INT (10), INT (20));
+ r1 = int_range<1> (INT (10), INT (10));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == int_range<1> (INT (10), INT (20)));
+
+ // [10,20] U [9,9] => [9,20].
+ r0 = int_range<1> (INT (10), INT (20));
+ r1 = int_range<1> (INT (9), INT (9));
+ r0.union_ (r1);
+ ASSERT_TRUE (r0 == int_range<1> (INT (9), INT (20)));
+
+ // [10,20] ^ [15,30] => [15,20].
+ r0 = int_range<1> (INT (10), INT (20));
+ r1 = int_range<1> (INT (15), INT (30));
+ r0.intersect (r1);
+ ASSERT_TRUE (r0 == int_range<1> (INT (15), INT (20)));
+
+ // Test the internal sanity of wide_int's wrt HWIs.
+ ASSERT_TRUE (wi::max_value (TYPE_PRECISION (boolean_type_node),
+ TYPE_SIGN (boolean_type_node))
+ == wi::uhwi (1, TYPE_PRECISION (boolean_type_node)));
+
+ // Test zero_p().
+ r0 = int_range<1> (INT (0), INT (0));
+ ASSERT_TRUE (r0.zero_p ());
+
+ // Test nonzero_p().
+ r0 = int_range<1> (INT (0), INT (0));
+ 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)));
+}
+
+void
+range_tests ()
+{
+ range_tests_legacy ();
+ range_tests_irange3 ();
+ range_tests_int_range_max ();
+ range_tests_strict_enum ();
+ range_tests_misc ();
+}
+
+} // namespace selftest
+
+#endif // CHECKING_P
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 63c9620..7428c91 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -111,8 +111,7 @@ protected:
void irange_set (tree, tree);
void irange_set_anti_range (tree, tree);
- bool swap_out_of_order_endpoints (tree &min, tree &max, value_range_kind &);
- bool normalize_min_max (tree type, tree min, tree max, value_range_kind);
+ void normalize_min_max ();
bool legacy_mode_p () const;
bool legacy_equal_p (const irange &) const;
@@ -124,7 +123,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;
@@ -280,12 +280,14 @@ irange::varying_p () const
tree l = m_base[0];
tree u = m_base[1];
tree t = TREE_TYPE (l);
+ unsigned prec = TYPE_PRECISION (t);
+ signop sign = TYPE_SIGN (t);
if (INTEGRAL_TYPE_P (t))
- return l == TYPE_MIN_VALUE (t) && u == TYPE_MAX_VALUE (t);
+ return (wi::to_wide (l) == wi::min_value (prec, sign)
+ && wi::to_wide (u) == wi::max_value (prec, sign));
if (POINTER_TYPE_P (t))
- return wi::to_wide (l) == 0
- && wi::to_wide (u) == wi::max_value (TYPE_PRECISION (t),
- TYPE_SIGN (t));
+ return (wi::to_wide (l) == 0
+ && wi::to_wide (u) == wi::max_value (prec, sign));
return true;
}
@@ -469,8 +471,10 @@ irange::set_varying (tree type)
m_num_ranges = 1;
if (INTEGRAL_TYPE_P (type))
{
- m_base[0] = TYPE_MIN_VALUE (type);
- m_base[1] = TYPE_MAX_VALUE (type);
+ wide_int min = wi::min_value (TYPE_PRECISION (type), TYPE_SIGN (type));
+ wide_int max = wi::max_value (TYPE_PRECISION (type), TYPE_SIGN (type));
+ m_base[0] = wide_int_to_tree (type, min);
+ m_base[1] = wide_int_to_tree (type, max);
}
else if (POINTER_TYPE_P (type))
{
@@ -565,33 +569,25 @@ irange::set_zero (tree type)
irange_set (z, z);
}
-// Normalize [MIN, MAX] into VARYING and ~[MIN, MAX] into UNDEFINED.
-//
-// Avoid using TYPE_{MIN,MAX}_VALUE because -fstrict-enums can
-// restrict those to a subset of what actually fits in the type.
-// Instead use the extremes of the type precision which will allow
-// compare_range_with_value() to check if a value is inside a range,
-// whereas if we used TYPE_*_VAL, said function would just punt upon
-// seeing a VARYING.
+// Normalize a range to VARYING or UNDEFINED if possible.
-inline bool
-irange::normalize_min_max (tree type, tree min, tree max,
- value_range_kind kind)
+inline void
+irange::normalize_min_max ()
{
- unsigned prec = TYPE_PRECISION (type);
- signop sign = TYPE_SIGN (type);
- if (wi::eq_p (wi::to_wide (min), wi::min_value (prec, sign))
- && wi::eq_p (wi::to_wide (max), wi::max_value (prec, sign)))
+ gcc_checking_assert (legacy_mode_p ());
+ gcc_checking_assert (!undefined_p ());
+ unsigned prec = TYPE_PRECISION (type ());
+ signop sign = TYPE_SIGN (type ());
+ if (wi::eq_p (wi::to_wide (min ()), wi::min_value (prec, sign))
+ && wi::eq_p (wi::to_wide (max ()), wi::max_value (prec, sign)))
{
- if (kind == VR_RANGE)
- set_varying (type);
- else if (kind == VR_ANTI_RANGE)
+ if (m_kind == VR_RANGE)
+ set_varying (type ());
+ else if (m_kind == VR_ANTI_RANGE)
set_undefined ();
else
gcc_unreachable ();
- return true;
}
- return false;
}
// Return the maximum value for TYPE.
diff --git a/gcc/varasm.c b/gcc/varasm.c
index ea0b59c..435c7b3 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -277,10 +277,12 @@ get_noswitch_section (unsigned int flags, noswitch_section_callback callback)
}
/* Return the named section structure associated with NAME. Create
- a new section with the given fields if no such structure exists. */
+ a new section with the given fields if no such structure exists.
+ When NOT_EXISTING, then fail if the section already exists. */
section *
-get_section (const char *name, unsigned int flags, tree decl)
+get_section (const char *name, unsigned int flags, tree decl,
+ bool not_existing)
{
section *sect, **slot;
@@ -297,6 +299,9 @@ get_section (const char *name, unsigned int flags, tree decl)
}
else
{
+ if (not_existing)
+ internal_error ("Section already exists: %qs", name);
+
sect = *slot;
/* It is fine if one of the sections has SECTION_NOTYPE as long as
the other has none of the contrary flags (see the logic at the end
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 31ea213..dc04d10 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -186,7 +186,7 @@ varpool_node::remove (void)
&& !ctor_useable_for_folding_p ())
remove_initializer ();
- unregister ();
+ unregister (NULL);
ggc_free (this);
}
diff --git a/gcc/vec.h b/gcc/vec.h
index d8c7cda..14d77e8 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1541,13 +1541,15 @@ public:
auto_vec (size_t n) { this->create (n); }
~auto_vec () { this->release (); }
- auto_vec (auto_vec&& r)
+ 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= (auto_vec&& r)
+ 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;
@@ -1729,7 +1731,7 @@ vec<T, va_heap, vl_ptr>::copy (ALONE_MEM_STAT_DECL) const
{
vec<T, va_heap, vl_ptr> new_vec = vNULL;
if (length ())
- new_vec.m_vec = m_vec->copy ();
+ new_vec.m_vec = m_vec->copy (ALONE_PASS_MEM_STAT);
return new_vec;
}
diff --git a/gcc/vr-values.c b/gcc/vr-values.c
index da0b249..9f5943a 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. */
@@ -174,9 +175,12 @@ vr_values::get_value_range (const_tree var,
}
bool
-vr_values::range_of_expr (irange &r, tree name, gimple *stmt)
+vr_values::range_of_expr (irange &r, tree expr, gimple *stmt)
{
- if (const value_range *vr = get_value_range (name, 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;
@@ -1151,271 +1155,295 @@ check_for_binary_op_overflow (range_query *query,
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;
- }
- 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)
+ 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)
{
- 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;
+ /* 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;
}
- 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 (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 ()))
{
- if (optab_handler (clz_optab, mode) != CODE_FOR_nothing
- && CLZ_DEFINED_VALUE_AT_ZERO (mode, zerov) == 2)
- {
- /* 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;
- }
+ maxi = prec - 1 - tree_floor_log2 (vr0->min ());
+ if (mini == -2)
+ mini = 0;
}
- 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
- && integer_nonzerop (vr0->min ()))
- {
- maxi = prec - 1 - tree_floor_log2 (vr0->min ());
- if (mini == -2)
- 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)
- {
- int newmini = prec - 1 - tree_floor_log2 (vr0->max ());
- if (newmini == prec)
- {
- if (maxi == prec)
- mini = prec;
- }
- else
- mini = newmini;
- }
+ 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.
- 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))
+ /* From clz of VR_RANGE maximum we can compute
+ result minimum. */
+ if (vr0->kind () == VR_RANGE
+ && TREE_CODE (vr0->max ()) == INTEGER_CST)
{
- if (optab_handler (ctz_optab, mode) != CODE_FOR_nothing
- && CTZ_DEFINED_VALUE_AT_ZERO (mode, zerov) == 2)
+ int newmini = prec - 1 - tree_floor_log2 (vr0->max ());
+ if (newmini == prec)
{
- /* Handle only the two common values. */
- if (zerov == -1)
- mini = -1;
- else if (zerov == prec)
- maxi = prec;
- else
- /* Magic value to give up, unless vr0 proves
- arg is non-zero. */
- mini = -2;
+ if (maxi == prec)
+ mini = prec;
}
+ else
+ mini = newmini;
}
- if (TREE_CODE (arg) == SSA_NAME)
+ }
+ 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) == 2)
{
- 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)
+ /* Handle only the two common values. */
+ if (zerov == -1)
+ mini = -1;
+ else if (zerov == prec)
+ maxi = prec;
+ else
+ /* Magic value to give up, unless vr0 proves
+ arg is non-zero. */
+ mini = -2;
+ }
+ }
+ 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 ())))
+ {
+ 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)
{
- int newmaxi = tree_floor_log2 (vr0->max ());
- if (newmaxi == -1)
- {
- if (mini == -1)
- maxi = -1;
- else if (maxi == prec)
- mini = prec;
- }
- else if (maxi != prec)
- maxi = newmaxi;
+ 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))
+ {
+ combined_fn cfn = gimple_call_combined_fn (stmt);
+ if (cfn == CFN_UBSAN_CHECK_ADD
+ || cfn == CFN_UBSAN_CHECK_SUB
+ || cfn == CFN_UBSAN_CHECK_MUL)
+ return;
+
+ 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)));
+ gcc_assert (tmp.equal_p (*vr, /*ignore_equivs=*/false));
+ return;
}
/* Handle extraction of the two results (result of arithmetics and
a flag whether arithmetics overflowed) from {ADD,SUB,MUL}_OVERFLOW
@@ -1819,7 +1847,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)
@@ -1939,6 +1967,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. */
@@ -1999,7 +2028,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, ": ");
@@ -3569,7 +3598,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)
{
@@ -3756,67 +3785,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 *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");
- }
- }
- }
- }
-}
-
/* Simplify a switch statement using the value range of the switch
argument. */
diff --git a/gcc/vr-values.h b/gcc/vr-values.h
index a30f05c..59fac0c 100644
--- a/gcc/vr-values.h
+++ b/gcc/vr-values.h
@@ -101,7 +101,7 @@ class vr_values : public range_query
vr_values (void);
~vr_values (void);
- virtual bool range_of_expr (irange &r, tree name, gimple *stmt) OVERRIDE;
+ 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;
@@ -148,6 +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 *);
+ bool extract_range_builtin (value_range_equiv *, gimple *);
/* This probably belongs in the lattice rather than in here. */
bool values_propagated;
@@ -169,9 +170,8 @@ class vr_values : public range_query
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);
diff --git a/gcc/wide-int.cc b/gcc/wide-int.cc
index f4d949c..99d7ded 100644
--- a/gcc/wide-int.cc
+++ b/gcc/wide-int.cc
@@ -702,8 +702,11 @@ wi::set_bit_large (HOST_WIDE_INT *val, const HOST_WIDE_INT *xval,
/* If the bit we just set is at the msb of the block, make sure
that any higher bits are zeros. */
if (bit + 1 < precision && subbit == HOST_BITS_PER_WIDE_INT - 1)
- val[len++] = 0;
- return len;
+ {
+ val[len++] = 0;
+ return len;
+ }
+ return canonize (val, len, precision);
}
else
{
diff --git a/gcc/wide-int.h b/gcc/wide-int.h
index 39cd5b9..6eae46d 100644
--- a/gcc/wide-int.h
+++ b/gcc/wide-int.h
@@ -1387,8 +1387,10 @@ private:
/* The shared maximum length of each number. */
unsigned char m_max_len;
- /* The current length of each number. */
- unsigned char m_len[N];
+ /* The current length of each number.
+ Avoid char array so the whole structure is not a typeless storage
+ that will, in turn, turn off TBAA on gimple, trees and RTL. */
+ struct {unsigned char len;} m_len[N];
/* The variable-length part of the structure, which always contains
at least one HWI. Element I starts at index I * M_MAX_LEN. */
@@ -1470,7 +1472,7 @@ template <int N>
inline trailing_wide_int
trailing_wide_ints <N>::operator [] (unsigned int index)
{
- return trailing_wide_int_storage (m_precision, &m_len[index],
+ return trailing_wide_int_storage (m_precision, &m_len[index].len,
&m_val[index * m_max_len]);
}
@@ -1479,7 +1481,7 @@ inline typename trailing_wide_ints <N>::const_reference
trailing_wide_ints <N>::operator [] (unsigned int index) const
{
return wi::storage_ref (&m_val[index * m_max_len],
- m_len[index], m_precision);
+ m_len[index].len, m_precision);
}
/* Return how many extra bytes need to be added to the end of the structure
diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c
index 4e51e62..1e72c6e 100644
--- a/gcc/xcoffout.c
+++ b/gcc/xcoffout.c
@@ -164,7 +164,7 @@ xcoff_assign_fundamental_type_number (tree decl)
size_t i;
/* Do not waste time searching the list for non-intrinsic types. */
- if (DECL_NAME (decl) == 0 || ! DECL_IS_BUILTIN (decl))
+ if (DECL_NAME (decl) == 0 || ! DECL_IS_UNDECLARED_BUILTIN (decl))
return 0;
name = IDENTIFIER_POINTER (DECL_NAME (decl));